@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * _migration_step() (ie, it its a count of rows in the old attendees table in _count_records_to_migrate(), it should also be OLD attendee rows migrated |
35 | 35 | * on each call to _migration_step(). |
36 | 36 | */ |
37 | -abstract class EE_Data_Migration_Script_Stage extends EE_Data_Migration_Class_Base{ |
|
37 | +abstract class EE_Data_Migration_Script_Stage extends EE_Data_Migration_Class_Base { |
|
38 | 38 | /** |
39 | 39 | * The migration script this is a stage of |
40 | 40 | * @var EE_Data_Migration_Script_Base |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * called by EE_Data_Migration_Script_Base's __construct() method so children don't have to |
48 | 48 | * @param EE_Data_Migration_Script_Base $migration_script |
49 | 49 | */ |
50 | - public function _construct_finalize($migration_script){ |
|
50 | + public function _construct_finalize($migration_script) { |
|
51 | 51 | $this->_migration_script = $migration_script; |
52 | 52 | } |
53 | 53 | |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | * @param int $num_items_to_migrate |
59 | 59 | * @return int |
60 | 60 | */ |
61 | - public function migration_step($num_items_to_migrate=50){ |
|
61 | + public function migration_step($num_items_to_migrate = 50) { |
|
62 | 62 | //before we run the migration step, we want ot take note of warnings that get outputted |
63 | 63 | ob_start(); |
64 | 64 | $items_migrated = $this->_migration_step($num_items_to_migrate); |
65 | 65 | $output = ob_get_contents(); |
66 | 66 | ob_end_clean(); |
67 | - if( $output ){ |
|
67 | + if ($output) { |
|
68 | 68 | $this->add_error($output); |
69 | 69 | } |
70 | 70 | $this->_records_migrated += $items_migrated; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param int $num_items_to_migrate |
83 | 83 | * @return int number of items ACTUALLY migrated |
84 | 84 | */ |
85 | - abstract protected function _migration_step($num_items_to_migrate=50); |
|
85 | + abstract protected function _migration_step($num_items_to_migrate = 50); |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Counts the records that have been migrated so far |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * returns an array of strings describing errors |
97 | 97 | * @return array |
98 | 98 | */ |
99 | - public function get_errors(){ |
|
99 | + public function get_errors() { |
|
100 | 100 | return $this->_errors; |
101 | 101 | } |
102 | 102 | |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | * to have been made from the properties_as_array() function. |
107 | 107 | * @param array $array_of_properties like what's produced from properties_as_array() method |
108 | 108 | */ |
109 | - public function instantiate_from_array_of_properties($array_of_properties){ |
|
109 | + public function instantiate_from_array_of_properties($array_of_properties) { |
|
110 | 110 | unset($array_of_properties['class']); |
111 | - foreach($array_of_properties as $property_name => $property_value){ |
|
111 | + foreach ($array_of_properties as $property_name => $property_value) { |
|
112 | 112 | $this->{$property_name} = $property_value; |
113 | 113 | } |
114 | 114 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * Gets the script this is a stage of |
118 | 118 | * @return EE_Data_Migration_Script_Base |
119 | 119 | */ |
120 | - protected function get_migration_script(){ |
|
120 | + protected function get_migration_script() { |
|
121 | 121 | return $this->_migration_script; |
122 | 122 | } |
123 | 123 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | |
30 | 30 | |
31 | -require_once( EE_HELPERS . 'EEH_Base.helper.php' ); |
|
31 | +require_once(EE_HELPERS.'EEH_Base.helper.php'); |
|
32 | 32 | class EEH_Sideloader extends EEH_Base { |
33 | 33 | |
34 | 34 | private $_upload_to; |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | * @access public |
44 | 44 | * @param array $init array fo initializing the sideloader if keys match the properties. |
45 | 45 | */ |
46 | - public function __construct( $init = array() ) { |
|
47 | - $this->_init( $init ); |
|
46 | + public function __construct($init = array()) { |
|
47 | + $this->_init($init); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -55,24 +55,24 @@ discard block |
||
55 | 55 | * @param array $init array on init (keys match properties others ignored) |
56 | 56 | * @return void |
57 | 57 | */ |
58 | - private function _init( $init ) { |
|
58 | + private function _init($init) { |
|
59 | 59 | $defaults = array( |
60 | 60 | '_upload_to' => $this->_get_wp_uploads_dir(), |
61 | 61 | '_upload_from' => '', |
62 | 62 | '_permissions' => 0644, |
63 | - '_new_file_name' => 'EE_Sideloader_' . uniqid() . '.default' |
|
63 | + '_new_file_name' => 'EE_Sideloader_'.uniqid().'.default' |
|
64 | 64 | ); |
65 | 65 | |
66 | - $props = array_merge( $defaults, $init ); |
|
66 | + $props = array_merge($defaults, $init); |
|
67 | 67 | |
68 | - foreach ( $props as $key => $val ) { |
|
69 | - if ( EEH_Class_Tools::has_property( $this, $key ) ) { |
|
68 | + foreach ($props as $key => $val) { |
|
69 | + if (EEH_Class_Tools::has_property($this, $key)) { |
|
70 | 70 | $this->{$key} = $val; |
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | 74 | //make sure we include the required wp file for needed functions |
75 | - require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
75 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
@@ -80,16 +80,16 @@ discard block |
||
80 | 80 | private function _get_wp_uploads_dir() {} |
81 | 81 | |
82 | 82 | //setters |
83 | - public function set_upload_to( $upload_to_folder ) { |
|
83 | + public function set_upload_to($upload_to_folder) { |
|
84 | 84 | $this->_upload_to = $upload_to_folder; |
85 | 85 | } |
86 | - public function set_upload_from( $upload_from_folder ) { |
|
86 | + public function set_upload_from($upload_from_folder) { |
|
87 | 87 | $this->_upload_from_folder = $upload_from_folder; |
88 | 88 | } |
89 | - public function set_permissions( $permissions ) { |
|
89 | + public function set_permissions($permissions) { |
|
90 | 90 | $this->_permissions = $permissions; |
91 | 91 | } |
92 | - public function set_new_file_name( $new_file_name ) { |
|
92 | + public function set_new_file_name($new_file_name) { |
|
93 | 93 | $this->_new_file_name = $new_file_name; |
94 | 94 | } |
95 | 95 | |
@@ -111,34 +111,34 @@ discard block |
||
111 | 111 | //upload methods |
112 | 112 | public function sideload() { |
113 | 113 | //setup temp dir |
114 | - $temp_file = wp_tempnam( $this->_upload_from ); |
|
114 | + $temp_file = wp_tempnam($this->_upload_from); |
|
115 | 115 | |
116 | - if ( !$temp_file ) { |
|
117 | - EE_Error::add_error( __('Something went wrong with the upload. Unable to create a tmp file for the uploaded file on the server', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
116 | + if ( ! $temp_file) { |
|
117 | + EE_Error::add_error(__('Something went wrong with the upload. Unable to create a tmp file for the uploaded file on the server', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
118 | 118 | return false; |
119 | 119 | } |
120 | 120 | |
121 | - do_action( 'AHEE__EEH_Sideloader__sideload__before', $this, $temp_file ); |
|
121 | + do_action('AHEE__EEH_Sideloader__sideload__before', $this, $temp_file); |
|
122 | 122 | |
123 | - $wp_remote_args = apply_filters( 'FHEE__EEH_Sideloader__sideload__wp_remote_args', array( 'timeout' => 500, 'stream' => true, 'filename' => $temp_file ), $this, $temp_file ); |
|
123 | + $wp_remote_args = apply_filters('FHEE__EEH_Sideloader__sideload__wp_remote_args', array('timeout' => 500, 'stream' => true, 'filename' => $temp_file), $this, $temp_file); |
|
124 | 124 | |
125 | - $response = wp_safe_remote_get( $this->_upload_from, $wp_remote_args ); |
|
125 | + $response = wp_safe_remote_get($this->_upload_from, $wp_remote_args); |
|
126 | 126 | |
127 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
128 | - unlink( $temp_file ); |
|
129 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
130 | - EE_Error::add_error( sprintf( __('Unable to upload the file. Either the path given to upload from is incorrect, or something else happened. Here is the response returned:<br />%s<br />Here is the path given: %s', 'event_espresso'), var_export( $response, true ), $this->_upload_from ), __FILE__, __FUNCTION__, __LINE__ ); |
|
127 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
128 | + unlink($temp_file); |
|
129 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
130 | + EE_Error::add_error(sprintf(__('Unable to upload the file. Either the path given to upload from is incorrect, or something else happened. Here is the response returned:<br />%s<br />Here is the path given: %s', 'event_espresso'), var_export($response, true), $this->_upload_from), __FILE__, __FUNCTION__, __LINE__); |
|
131 | 131 | } |
132 | 132 | return false; |
133 | 133 | } |
134 | 134 | |
135 | 135 | //possible md5 check |
136 | - $content_md5 = wp_remote_retrieve_header( $response, 'content-md5' ); |
|
137 | - if ( $content_md5 ) { |
|
138 | - $md5_check = verify_file_md5( $temp_file, $content_md5 ); |
|
139 | - if ( is_wp_error( $md5_check ) ) { |
|
140 | - unlink( $temp_file ); |
|
141 | - EE_Error::add_error( $md5_check->get_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
136 | + $content_md5 = wp_remote_retrieve_header($response, 'content-md5'); |
|
137 | + if ($content_md5) { |
|
138 | + $md5_check = verify_file_md5($temp_file, $content_md5); |
|
139 | + if (is_wp_error($md5_check)) { |
|
140 | + unlink($temp_file); |
|
141 | + EE_Error::add_error($md5_check->get_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
142 | 142 | return false; |
143 | 143 | } |
144 | 144 | } |
@@ -146,24 +146,24 @@ discard block |
||
146 | 146 | $file = $temp_file; |
147 | 147 | |
148 | 148 | //now we have the file, let's get it in the right directory with the right name. |
149 | - $path = apply_filters( 'FHEE__EEH_Sideloader__sideload__new_path', $this->_upload_to . $this->_new_file_name, $this ); |
|
149 | + $path = apply_filters('FHEE__EEH_Sideloader__sideload__new_path', $this->_upload_to.$this->_new_file_name, $this); |
|
150 | 150 | |
151 | 151 | //move file in |
152 | - if ( false === @ rename( $file, $path ) ) { |
|
153 | - unlink( $temp_file ); |
|
154 | - EE_Error::add_error( sprintf( __('Unable to move the file to new location (possible permissions errors). This is the path the class attempted to move the file to: %s', 'event_espresso' ), $path ), __FILE__, __FUNCTION__, __LINE__ ); |
|
152 | + if (false === @ rename($file, $path)) { |
|
153 | + unlink($temp_file); |
|
154 | + EE_Error::add_error(sprintf(__('Unable to move the file to new location (possible permissions errors). This is the path the class attempted to move the file to: %s', 'event_espresso'), $path), __FILE__, __FUNCTION__, __LINE__); |
|
155 | 155 | return false; |
156 | 156 | } |
157 | 157 | |
158 | 158 | //set permissions |
159 | - $permissions = apply_filters( 'FHEE__EEH_Sideloader__sideload__permissions_applied', $this->_permissions, $this ); |
|
160 | - chmod( $path, $permissions ); |
|
159 | + $permissions = apply_filters('FHEE__EEH_Sideloader__sideload__permissions_applied', $this->_permissions, $this); |
|
160 | + chmod($path, $permissions); |
|
161 | 161 | |
162 | 162 | //that's it. let's allow for actions after file uploaded. |
163 | - do_action( 'AHEE__EE_Sideloader__sideload_after', $this, $path ); |
|
163 | + do_action('AHEE__EE_Sideloader__sideload_after', $this, $path); |
|
164 | 164 | |
165 | 165 | //unlink tempfile |
166 | - @unlink( $temp_file ); |
|
166 | + @unlink($temp_file); |
|
167 | 167 | return true; |
168 | 168 | } |
169 | 169 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -49,54 +49,54 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | |
52 | - protected function _parser( $shortcode ) { |
|
52 | + protected function _parser($shortcode) { |
|
53 | 53 | //make sure we end up with a copy of the EE_Messages_Addressee object |
54 | 54 | $recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL; |
55 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient; |
|
56 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient; |
|
55 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient; |
|
56 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient; |
|
57 | 57 | |
58 | 58 | //now it's possible that $recipient is not an instance of EE_Messages_Addressee in which case we need to see if $this->_data is an instance of $event. |
59 | 59 | $event = $this->_data instanceof EE_Event ? $this->_data : NULL; |
60 | 60 | |
61 | - if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event ) |
|
61 | + if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event) |
|
62 | 62 | return ''; |
63 | 63 | |
64 | - switch ( $shortcode ) { |
|
64 | + switch ($shortcode) { |
|
65 | 65 | case '[EVENT_AUTHOR_FNAME]' : |
66 | - $fname = !empty( $recipient ) ? $recipient->fname : NULL; |
|
67 | - if ( empty( $fname ) && !empty( $event ) ) { |
|
68 | - $user = $this->_get_author_for_event( $event ); |
|
66 | + $fname = ! empty($recipient) ? $recipient->fname : NULL; |
|
67 | + if (empty($fname) && ! empty($event)) { |
|
68 | + $user = $this->_get_author_for_event($event); |
|
69 | 69 | $fname = $user->first_name; |
70 | 70 | } |
71 | 71 | return $fname; |
72 | 72 | break; |
73 | 73 | |
74 | 74 | case '[EVENT_AUTHOR_LNAME]' : |
75 | - $lname = !empty( $recipient ) ? $recipient->lname : NULL; |
|
76 | - if ( empty( $lname ) && !empty( $event ) ) { |
|
77 | - $user = $this->_get_author_for_event( $event ); |
|
75 | + $lname = ! empty($recipient) ? $recipient->lname : NULL; |
|
76 | + if (empty($lname) && ! empty($event)) { |
|
77 | + $user = $this->_get_author_for_event($event); |
|
78 | 78 | $lname = $user->last_name; |
79 | 79 | } |
80 | 80 | return $lname; |
81 | 81 | break; |
82 | 82 | |
83 | 83 | case '[EVENT_AUTHOR_FORMATTED_EMAIL]' : |
84 | - if ( !empty( $recipient ) ) { |
|
85 | - $email = !empty( $recipient->fname ) ? $recipient->fname . ' ' . $recipient->lname . '<' . $recipient->admin_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . '<' . $recipient->admin_email . '>'; |
|
84 | + if ( ! empty($recipient)) { |
|
85 | + $email = ! empty($recipient->fname) ? $recipient->fname.' '.$recipient->lname.'<'.$recipient->admin_email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').'<'.$recipient->admin_email.'>'; |
|
86 | 86 | } else { |
87 | 87 | $email = NULL; |
88 | 88 | } |
89 | - if ( empty( $email ) && ! empty( $event ) ) { |
|
90 | - $user = $this->_get_author_for_event( $event ); |
|
91 | - $email = ! empty( $user->first_name ) ? $user->first_name . ' ' . $user->last_name . '<' . $user->user_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . '<' . $user->user_email . '>'; |
|
89 | + if (empty($email) && ! empty($event)) { |
|
90 | + $user = $this->_get_author_for_event($event); |
|
91 | + $email = ! empty($user->first_name) ? $user->first_name.' '.$user->last_name.'<'.$user->user_email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').'<'.$user->user_email.'>'; |
|
92 | 92 | } |
93 | 93 | return $email; |
94 | 94 | break; |
95 | 95 | |
96 | 96 | case '[EVENT_AUTHOR_EMAIL]' : |
97 | - $email = ! empty( $recipient ) ? $recipient->admin_email : NULL; |
|
98 | - if ( empty( $email ) && !empty( $event ) ) { |
|
99 | - $user = $this->_get_author_for_event( $event ); |
|
97 | + $email = ! empty($recipient) ? $recipient->admin_email : NULL; |
|
98 | + if (empty($email) && ! empty($event)) { |
|
99 | + $user = $this->_get_author_for_event($event); |
|
100 | 100 | $email = $user->user_email; |
101 | 101 | } |
102 | 102 | return $email; |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @return WP_User |
119 | 119 | */ |
120 | - private function _get_author_for_event( EE_Event $event ) { |
|
120 | + private function _get_author_for_event(EE_Event $event) { |
|
121 | 121 | $author_id = $event->wp_user(); |
122 | - $user_data = get_userdata( (int) $author_id ); |
|
122 | + $user_data = get_userdata((int) $author_id); |
|
123 | 123 | return $user_data; |
124 | 124 | } |
125 | 125 |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $model_names = $this->models_for_requested_version(); |
232 | 232 | if( isset( $model_names[ $model_name ] ) ) { |
233 | 233 | return true; |
234 | - }else{ |
|
234 | + } else{ |
|
235 | 235 | return false; |
236 | 236 | } |
237 | 237 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | public function load_model( $model_name ) { |
250 | 250 | if( $this->is_model_name_in_this_version( $model_name ) ) { |
251 | 251 | return \EE_Registry::instance()->load_model( $model_name ); |
252 | - }else{ |
|
252 | + } else{ |
|
253 | 253 | throw new \EE_Error( |
254 | 254 | sprintf( |
255 | 255 | __( |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\libraries\rest_api; |
3 | 3 | |
4 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | protected $_cached_fields_on_models = array(); |
89 | 89 | |
90 | 90 | |
91 | - public function __construct( $requested_version ) { |
|
91 | + public function __construct($requested_version) { |
|
92 | 92 | $this->_requested_version = $requested_version; |
93 | 93 | $this->_model_changes = array( |
94 | 94 | '4.8.29' => array( |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | 'table_column' => 'N/A', |
111 | 111 | 'always_available' => true, |
112 | 112 | ); |
113 | - foreach( $this->_resource_changes as $version => $model_classnames ) { |
|
114 | - foreach( $model_classnames as $model_classname => $extra_fields ) { |
|
115 | - foreach( $extra_fields as $fieldname => $field_data ) { |
|
116 | - $this->_resource_changes[ $model_classname ][ $fieldname ][ 'name' ] = $fieldname; |
|
117 | - foreach( $defaults as $attribute => $default_value ) { |
|
118 | - if( ! isset( $this->_resource_changes[ $model_classname ][ $fieldname ][ $attribute ] ) ) { |
|
119 | - $this->_resource_changes[ $model_classname ][ $fieldname ][ $attribute ] = $default_value; |
|
113 | + foreach ($this->_resource_changes as $version => $model_classnames) { |
|
114 | + foreach ($model_classnames as $model_classname => $extra_fields) { |
|
115 | + foreach ($extra_fields as $fieldname => $field_data) { |
|
116 | + $this->_resource_changes[$model_classname][$fieldname]['name'] = $fieldname; |
|
117 | + foreach ($defaults as $attribute => $default_value) { |
|
118 | + if ( ! isset($this->_resource_changes[$model_classname][$fieldname][$attribute])) { |
|
119 | + $this->_resource_changes[$model_classname][$fieldname][$attribute] = $default_value; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | } |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | * @return array |
133 | 133 | */ |
134 | 134 | public function model_changes_between_requested_version_and_current() { |
135 | - if( $this->_cached_model_changes_between_requested_version_and_current === null ) { |
|
135 | + if ($this->_cached_model_changes_between_requested_version_and_current === null) { |
|
136 | 136 | $model_changes = array(); |
137 | - foreach( $this->model_changes() as $version => $models_changed_in_version ) { |
|
138 | - if( $version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version() ) { |
|
139 | - $model_changes[ $version ] = $models_changed_in_version; |
|
137 | + foreach ($this->model_changes() as $version => $models_changed_in_version) { |
|
138 | + if ($version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version()) { |
|
139 | + $model_changes[$version] = $models_changed_in_version; |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | $this->_cached_model_changes_between_requested_version_and_current = $model_changes; |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | * @return array |
153 | 153 | */ |
154 | 154 | public function resource_changes_between_requested_version_and_current() { |
155 | - if( $this->_cached_resource_changes_between_requested_version_and_current === null ) { |
|
155 | + if ($this->_cached_resource_changes_between_requested_version_and_current === null) { |
|
156 | 156 | $resource_changes = array(); |
157 | - foreach( $this->resource_changes() as $version => $model_classnames ) { |
|
158 | - if( $version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version() ) { |
|
159 | - $resource_changes[ $version ] = $model_classnames; |
|
157 | + foreach ($this->resource_changes() as $version => $model_classnames) { |
|
158 | + if ($version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version()) { |
|
159 | + $resource_changes[$version] = $model_classnames; |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | $this->_cached_resource_changes_between_requested_version_and_current = $resource_changes; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * If a request was sent to 'wp-json/ee/v4.7/events' this would be '4.7' |
169 | 169 | * @return string like '4.6' |
170 | 170 | */ |
171 | - public function requested_version(){ |
|
171 | + public function requested_version() { |
|
172 | 172 | return $this->_requested_version; |
173 | 173 | } |
174 | 174 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * If a version is missing then we don't know anything about what changes it introduced from the previous version |
183 | 183 | * @return array |
184 | 184 | */ |
185 | - public function model_changes(){ |
|
185 | + public function model_changes() { |
|
186 | 186 | return $this->_model_changes; |
187 | 187 | } |
188 | 188 | |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | * @return array keys are model names, values are their classname |
194 | 194 | */ |
195 | 195 | public function models_for_requested_version() { |
196 | - if( $this->_cached_models_for_requested_version === null ) { |
|
196 | + if ($this->_cached_models_for_requested_version === null) { |
|
197 | 197 | $all_models_in_current_version = \EE_Registry::instance()->non_abstract_db_models; |
198 | - foreach( $this->model_changes_between_requested_version_and_current() as $version => $models_changed ) { |
|
199 | - foreach( $models_changed as $model_name => $new_indicator_or_fields_added ) { |
|
200 | - if( $new_indicator_or_fields_added === Model_Version_Info::model_added ) { |
|
201 | - unset( $all_models_in_current_version[ $model_name ] ); |
|
198 | + foreach ($this->model_changes_between_requested_version_and_current() as $version => $models_changed) { |
|
199 | + foreach ($models_changed as $model_name => $new_indicator_or_fields_added) { |
|
200 | + if ($new_indicator_or_fields_added === Model_Version_Info::model_added) { |
|
201 | + unset($all_models_in_current_version[$model_name]); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | } |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | * @param string $model_name eg 'Event' |
218 | 218 | * @return boolean |
219 | 219 | */ |
220 | - public function is_model_name_in_this_version( $model_name ) { |
|
220 | + public function is_model_name_in_this_version($model_name) { |
|
221 | 221 | $model_names = $this->models_for_requested_version(); |
222 | - if( isset( $model_names[ $model_name ] ) ) { |
|
222 | + if (isset($model_names[$model_name])) { |
|
223 | 223 | return true; |
224 | - }else{ |
|
224 | + } else { |
|
225 | 225 | return false; |
226 | 226 | } |
227 | 227 | } |
@@ -236,10 +236,10 @@ discard block |
||
236 | 236 | * @return \EEM_Base |
237 | 237 | * @throws \EE_Error |
238 | 238 | */ |
239 | - public function load_model( $model_name ) { |
|
240 | - if( $this->is_model_name_in_this_version( $model_name ) ) { |
|
241 | - return \EE_Registry::instance()->load_model( $model_name ); |
|
242 | - }else{ |
|
239 | + public function load_model($model_name) { |
|
240 | + if ($this->is_model_name_in_this_version($model_name)) { |
|
241 | + return \EE_Registry::instance()->load_model($model_name); |
|
242 | + } else { |
|
243 | 243 | throw new \EE_Error( |
244 | 244 | sprintf( |
245 | 245 | __( |
@@ -261,21 +261,21 @@ discard block |
||
261 | 261 | * @param \EEM_Base $model |
262 | 262 | * @return array|\EE_Model_Field_Base[] |
263 | 263 | */ |
264 | - public function fields_on_model_in_this_version( $model ) { |
|
265 | - if( ! isset( $this->_cached_fields_on_models[ $model->get_this_model_name() ] ) ) { |
|
264 | + public function fields_on_model_in_this_version($model) { |
|
265 | + if ( ! isset($this->_cached_fields_on_models[$model->get_this_model_name()])) { |
|
266 | 266 | //get all model changes between the requested version and current core version |
267 | 267 | $changes = $this->model_changes_between_requested_version_and_current(); |
268 | 268 | //fetch all fields currently on this model |
269 | 269 | $current_fields = $model->field_settings(); |
270 | 270 | //remove all fields that have been added since |
271 | - foreach( $changes as $version => $changes_in_version ) { |
|
272 | - if( |
|
273 | - isset( $changes_in_version[ $model->get_this_model_name() ] ) |
|
274 | - && $changes_in_version[ $model->get_this_model_name() ] !== Model_Version_Info::model_added |
|
271 | + foreach ($changes as $version => $changes_in_version) { |
|
272 | + if ( |
|
273 | + isset($changes_in_version[$model->get_this_model_name()]) |
|
274 | + && $changes_in_version[$model->get_this_model_name()] !== Model_Version_Info::model_added |
|
275 | 275 | ) { |
276 | 276 | $current_fields = array_diff_key( |
277 | 277 | $current_fields, |
278 | - array_flip( $changes_in_version[ $model->get_this_model_name() ] ) |
|
278 | + array_flip($changes_in_version[$model->get_this_model_name()]) |
|
279 | 279 | ); |
280 | 280 | } |
281 | 281 | } |
@@ -293,9 +293,9 @@ discard block |
||
293 | 293 | * @param array $classnames |
294 | 294 | * @return boolean |
295 | 295 | */ |
296 | - public function is_subclass_of_one( $object, $classnames ) { |
|
297 | - foreach( $classnames as $classname ) { |
|
298 | - if( is_a( $object, $classname ) ) { |
|
296 | + public function is_subclass_of_one($object, $classnames) { |
|
297 | + foreach ($classnames as $classname) { |
|
298 | + if (is_a($object, $classname)) { |
|
299 | 299 | return true; |
300 | 300 | } |
301 | 301 | } |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | * Returns the list of model field classes that that the API basically ignores |
307 | 307 | * @return array |
308 | 308 | */ |
309 | - public function fields_ignored(){ |
|
309 | + public function fields_ignored() { |
|
310 | 310 | return apply_filters( |
311 | 311 | 'FHEE__Controller_Model_Read_fields_ignored', |
312 | - array( 'EE_Foreign_Key_Field_Base', 'EE_Any_Foreign_Model_Name_Field' ) |
|
312 | + array('EE_Foreign_Key_Field_Base', 'EE_Any_Foreign_Model_Name_Field') |
|
313 | 313 | ); |
314 | 314 | } |
315 | 315 | |
@@ -318,8 +318,8 @@ discard block |
||
318 | 318 | * @param EE_Model_Field_Base |
319 | 319 | * @return boolean |
320 | 320 | */ |
321 | - public function field_is_ignored( $field_obj ){ |
|
322 | - return $this->is_subclass_of_one( $field_obj, $this->fields_ignored() ); |
|
321 | + public function field_is_ignored($field_obj) { |
|
322 | + return $this->is_subclass_of_one($field_obj, $this->fields_ignored()); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | public function fields_that_have_rendered_format() { |
331 | 331 | return apply_filters( |
332 | 332 | 'FHEE__Controller_Model_Read__fields_raw', |
333 | - array( 'EE_Post_Content_Field', 'EE_Full_HTML_Field' ) |
|
333 | + array('EE_Post_Content_Field', 'EE_Full_HTML_Field') |
|
334 | 334 | ); |
335 | 335 | } |
336 | 336 | |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | * @param EE_Model_Field_Base |
340 | 340 | * @return boolean |
341 | 341 | */ |
342 | - public function field_has_rendered_format( $field_obj ){ |
|
343 | - return $this->is_subclass_of_one( $field_obj, $this->fields_that_have_rendered_format() ); |
|
342 | + public function field_has_rendered_format($field_obj) { |
|
343 | + return $this->is_subclass_of_one($field_obj, $this->fields_that_have_rendered_format()); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | public function fields_that_have_pretty_format() { |
353 | 353 | return apply_filters( |
354 | 354 | 'FHEE__Controller_Model_Read__fields_pretty', |
355 | - array( 'EE_Enum_Integer_Field', 'EE_Enum_Text_Field', 'EE_Money_Field' ) |
|
355 | + array('EE_Enum_Integer_Field', 'EE_Enum_Text_Field', 'EE_Money_Field') |
|
356 | 356 | ); |
357 | 357 | } |
358 | 358 | |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | * @param EE_Model_Field_Base |
362 | 362 | * @return boolean |
363 | 363 | */ |
364 | - public function field_has_pretty_format( $field_obj ){ |
|
365 | - return $this->is_subclass_of_one( $field_obj, $this->fields_that_have_pretty_format() ); |
|
364 | + public function field_has_pretty_format($field_obj) { |
|
365 | + return $this->is_subclass_of_one($field_obj, $this->fields_that_have_pretty_format()); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | /** |
@@ -379,12 +379,12 @@ discard block |
||
379 | 379 | * @param \EEM_Base $model |
380 | 380 | * @return array |
381 | 381 | */ |
382 | - public function extra_resource_properties_for_model( $model ) { |
|
382 | + public function extra_resource_properties_for_model($model) { |
|
383 | 383 | $extra_properties = array(); |
384 | - foreach( $this->resource_changes_between_requested_version_and_current() as $version => $model_classnames ) { |
|
385 | - foreach( $model_classnames as $model_classname => $properties_added_in_this_version ) { |
|
386 | - if( is_subclass_of( $model, $model_classname ) ) { |
|
387 | - $extra_properties = array_merge( $extra_properties, $properties_added_in_this_version ); |
|
384 | + foreach ($this->resource_changes_between_requested_version_and_current() as $version => $model_classnames) { |
|
385 | + foreach ($model_classnames as $model_classname => $properties_added_in_this_version) { |
|
386 | + if (is_subclass_of($model, $model_classname)) { |
|
387 | + $extra_properties = array_merge($extra_properties, $properties_added_in_this_version); |
|
388 | 388 | } |
389 | 389 | } |
390 | 390 | } |
@@ -13,8 +13,8 @@ |
||
13 | 13 | */ |
14 | 14 | namespace EventEspressoBatchRequest\JobHandlerBaseClasses; |
15 | 15 | |
16 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
17 | - exit( 'No direct script access allowed' ); |
|
16 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
17 | + exit('No direct script access allowed'); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @since $VID:$ |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Fieldset_Section_Layout extends EE_Div_Per_Section_Layout{ |
|
14 | +class EE_Fieldset_Section_Layout extends EE_Div_Per_Section_Layout { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * legend_class |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @param array $options |
34 | 34 | */ |
35 | - function __construct( $options = array() ){ |
|
36 | - foreach( $options as $key => $value ) { |
|
37 | - $key = '_' . $key; |
|
38 | - if ( property_exists( $this, $key )) { |
|
35 | + function __construct($options = array()) { |
|
36 | + foreach ($options as $key => $value) { |
|
37 | + $key = '_'.$key; |
|
38 | + if (property_exists($this, $key)) { |
|
39 | 39 | $this->{$key} = $value; |
40 | 40 | } |
41 | 41 | } |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @return string |
48 | 48 | */ |
49 | 49 | public function layout_form_begin() { |
50 | - $html = EEH_HTML::nl(1) . '<fieldset id="' . $this->_form_section->html_id() . '" class="' . $this->_form_section->html_class() . '" style="' . $this->_form_section->html_style() . '">'; |
|
51 | - $html .= '<legend class="' . $this->legend_class() . '">' . $this->legend_text() . '</legend>'; |
|
50 | + $html = EEH_HTML::nl(1).'<fieldset id="'.$this->_form_section->html_id().'" class="'.$this->_form_section->html_class().'" style="'.$this->_form_section->html_style().'">'; |
|
51 | + $html .= '<legend class="'.$this->legend_class().'">'.$this->legend_text().'</legend>'; |
|
52 | 52 | return $html; |
53 | 53 | } |
54 | 54 | |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | * closing div tag for a form |
59 | 59 | * @return string |
60 | 60 | */ |
61 | - public function layout_form_end(){ |
|
62 | - return EEH_HTML::nl(-1) . '</fieldset>'; |
|
61 | + public function layout_form_end() { |
|
62 | + return EEH_HTML::nl(-1).'</fieldset>'; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /** |
68 | 68 | * @param string $legend_class |
69 | 69 | */ |
70 | - public function set_legend_class( $legend_class ) { |
|
70 | + public function set_legend_class($legend_class) { |
|
71 | 71 | $this->_legend_class = $legend_class; |
72 | 72 | } |
73 | 73 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | /** |
86 | 86 | * @param string $legend_text |
87 | 87 | */ |
88 | - public function set_legend_text( $legend_text ) { |
|
88 | + public function set_legend_text($legend_text) { |
|
89 | 89 | $this->_legend_text = $legend_text; |
90 | 90 | } |
91 | 91 |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <p><strong><?php _e('Messengers', 'event_espresso'); ?></strong></p> |
2 | 2 | <p> |
3 | -<?php printf( __('Messengers are the vehicles that deliver messages to individuals (recipients). By default, every install of Event Espresso has the %sEmail%s messenger active. The Email messenger is a vehicle for delivering messages. Other possible vehicles might be any social media applications, 3rd party API\'s etc.', 'event_espresso'), '<strong>', '</strong>' ); ?> |
|
3 | +<?php printf(__('Messengers are the vehicles that deliver messages to individuals (recipients). By default, every install of Event Espresso has the %sEmail%s messenger active. The Email messenger is a vehicle for delivering messages. Other possible vehicles might be any social media applications, 3rd party API\'s etc.', 'event_espresso'), '<strong>', '</strong>'); ?> |
|
4 | 4 | </p> |
5 | 5 | \ No newline at end of file |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <p><strong><?php _e('Activating / Deactivating Messengers', 'event_espresso'); ?></strong></p> |
2 | 2 | <p><?php _e('You can select Messengers via the tabs across the top of the settings page. The available messengers you see depends on what version of Event Espresso you have and what addons are installed. Every install include an "Email" messenger tab. When you click one of those tabs it will display that messenger.', 'event_espresso'); ?></p> |
3 | 3 | <p><?php _e('There are two ways to determine whether a messenger is active or not. The first way is via the messenger tab itself.', 'event_espresso'); ?></p> |
4 | -<p><?php echo _e('The green colored gear <img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" /> indicates that this messenger is currently active.', 'event_espresso'); echo _e(' The white colored gear <img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" /> indicates the messenger is inactive. This is very helpful for seeing at a glance all the messengers that are active when you first view the page.', 'event_espresso'); ?></p> |
|
4 | +<p><?php echo _e('The green colored gear <img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" /> indicates that this messenger is currently active.', 'event_espresso'); echo _e(' The white colored gear <img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" /> indicates the messenger is inactive. This is very helpful for seeing at a glance all the messengers that are active when you first view the page.', 'event_espresso'); ?></p> |
|
5 | 5 | <p><?php _e('The second way to determine whether a messenger is active or not is via the "on/off" button in the top right corner of the active messenger displayed content:', 'event_espresso'); ?></p> |
6 | -<p><?php printf( __('%1$s means of course that the messenger is active and %2$s means the messenger is inactive.', 'event_espresso'), '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked" disabled><label for="ee-on-off-toggle-on"></label></div>', '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" disabled><label for="ee-on-off-toggle-on"></label></div>' ); ?></p> |
|
7 | -<p><?php _e( 'The on/off toggle is also what you use to activate or deactivate a messenger.', 'event_espresso' ); ?></p> |
|
8 | -<p><?php _e( 'What happens when you click the toggle to activate is the messenger is activated and the system determines what default message types are activated with the messenger. Then, if there are any default settings for either the messenger or message types those settings are saved. Next, the system will generate any default templates (if none have been generated before, if there are previously generated templates then they are reactivated). Finally, you will see the display change to reflect that the messenger is active. If the messenger has settings you can modify them then. Any message types that have settings will also automatically expand so you can see the default settings and make any changes as necessary to fit your needs. Usually the defaults are sufficient however.', 'event_espresso'); ?></p> |
|
9 | -<p><?php _e( 'When you deactivate a messenger, the system will first check if there are any custom event templates for that messenger. If there are you will be unable to deactivate the messenger. This is a fail safe to make sure you know that no messages will go out for those specific events so you don\'t accidentally deactivate. If this check passes, then the system will deactivate any global templates for that messenger (note the templates are not erased, they just become inactive, so if you decide to reactivate the messenger later all your customizations are preserved). Then the display will change to reflect the deactivation.', 'event_espresso'); ?></p> |
|
6 | +<p><?php printf(__('%1$s means of course that the messenger is active and %2$s means the messenger is inactive.', 'event_espresso'), '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked" disabled><label for="ee-on-off-toggle-on"></label></div>', '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" disabled><label for="ee-on-off-toggle-on"></label></div>'); ?></p> |
|
7 | +<p><?php _e('The on/off toggle is also what you use to activate or deactivate a messenger.', 'event_espresso'); ?></p> |
|
8 | +<p><?php _e('What happens when you click the toggle to activate is the messenger is activated and the system determines what default message types are activated with the messenger. Then, if there are any default settings for either the messenger or message types those settings are saved. Next, the system will generate any default templates (if none have been generated before, if there are previously generated templates then they are reactivated). Finally, you will see the display change to reflect that the messenger is active. If the messenger has settings you can modify them then. Any message types that have settings will also automatically expand so you can see the default settings and make any changes as necessary to fit your needs. Usually the defaults are sufficient however.', 'event_espresso'); ?></p> |
|
9 | +<p><?php _e('When you deactivate a messenger, the system will first check if there are any custom event templates for that messenger. If there are you will be unable to deactivate the messenger. This is a fail safe to make sure you know that no messages will go out for those specific events so you don\'t accidentally deactivate. If this check passes, then the system will deactivate any global templates for that messenger (note the templates are not erased, they just become inactive, so if you decide to reactivate the messenger later all your customizations are preserved). Then the display will change to reflect the deactivation.', 'event_espresso'); ?></p> |
|
10 | 10 | <p><strong><?php _e('Important', 'event_espresso'); ?></strong><br /> |
11 | 11 | <?php _e('Although customizations made to global templates are preserved when a messenger is deactivated, any settings for that messenger (or the message types that were attached to it) are lost on deactivation. Also, once you deactivate a messenger, no more messages will be delivered using that messenger for any of your events.', 'event_espresso'); ?></p> |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <li id="<?php echo $slug_id; ?>" class="ui-widget-content ui-corner-tr mt-tab <?php echo $class; ?>"> |
2 | - <div id="<?php echo $slug_id; ?>-handle" class="mt-handlediv no-drag" title="<?php esc_attr_e( 'Click to toggle', 'event_espresso' ); ?>"><br></div> |
|
2 | + <div id="<?php echo $slug_id; ?>-handle" class="mt-handlediv no-drag" title="<?php esc_attr_e('Click to toggle', 'event_espresso'); ?>"><br></div> |
|
3 | 3 | <strong class="ui-widget-header"><?php echo $label; ?></strong> |
4 | 4 | <?php echo $content; ?> |
5 | 5 | <span class="mt_nonce hidden"><?php echo $mt_nonce; ?></span> |