@@ -44,33 +44,33 @@ discard block |
||
44 | 44 | * @throws EE_Error |
45 | 45 | * @return void |
46 | 46 | */ |
47 | - public static function register( $shortcode_id = NULL, $setup_args = array() ) { |
|
47 | + public static function register($shortcode_id = NULL, $setup_args = array()) { |
|
48 | 48 | |
49 | 49 | //required fields MUST be present, so let's make sure they are. |
50 | - if ( empty( $shortcode_id ) || ! is_array( $setup_args ) || empty( $setup_args['shortcode_paths'] )) { |
|
51 | - throw new EE_Error( __( 'In order to register Modules with EE_Register_Shortcode::register(), you must include a "shortcode_id" (a unique identifier for this set of shortcodes), and an array containing the following keys: "shortcode_paths" (an array of full server paths to folders that contain shortcodes, or to the shortcode files themselves)', 'event_espresso' )); |
|
50 | + if (empty($shortcode_id) || ! is_array($setup_args) || empty($setup_args['shortcode_paths'])) { |
|
51 | + throw new EE_Error(__('In order to register Modules with EE_Register_Shortcode::register(), you must include a "shortcode_id" (a unique identifier for this set of shortcodes), and an array containing the following keys: "shortcode_paths" (an array of full server paths to folders that contain shortcodes, or to the shortcode files themselves)', 'event_espresso')); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | //make sure we don't register twice |
55 | - if( isset( self::$_settings[ $shortcode_id ] ) ){ |
|
55 | + if (isset(self::$_settings[$shortcode_id])) { |
|
56 | 56 | return; |
57 | 57 | } |
58 | 58 | |
59 | 59 | //make sure this was called in the right place! |
60 | - if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' )) { |
|
60 | + if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')) { |
|
61 | 61 | EE_Error::doing_it_wrong( |
62 | 62 | __METHOD__, |
63 | - __( 'An attempt to register shortcodes has failed because it was not registered at the correct time. Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register shortcodes.','event_espresso'), |
|
63 | + __('An attempt to register shortcodes has failed because it was not registered at the correct time. Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register shortcodes.', 'event_espresso'), |
|
64 | 64 | '4.3.0' |
65 | 65 | ); |
66 | 66 | } |
67 | 67 | //setup $_settings array from incoming values. |
68 | - self::$_settings[ $shortcode_id ] = array( |
|
68 | + self::$_settings[$shortcode_id] = array( |
|
69 | 69 | // array of full server paths to any EES_Shortcodes used by the shortcode |
70 | - 'shortcode_paths' => isset( $setup_args['shortcode_paths'] ) ? (array)$setup_args['shortcode_paths'] : array(), |
|
70 | + 'shortcode_paths' => isset($setup_args['shortcode_paths']) ? (array) $setup_args['shortcode_paths'] : array(), |
|
71 | 71 | ); |
72 | 72 | // add to list of shortcodes to be registered |
73 | - add_filter( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', array( 'EE_Register_Shortcode', 'add_shortcodes' )); |
|
73 | + add_filter('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', array('EE_Register_Shortcode', 'add_shortcodes')); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | * @param array $shortcodes_to_register array of paths to all shortcodes that require registering |
83 | 83 | * @return array |
84 | 84 | */ |
85 | - public static function add_shortcodes( $shortcodes_to_register ){ |
|
86 | - foreach( self::$_settings as $settings ) { |
|
87 | - $shortcodes_to_register = array_merge( $shortcodes_to_register, $settings['shortcode_paths'] ); |
|
85 | + public static function add_shortcodes($shortcodes_to_register) { |
|
86 | + foreach (self::$_settings as $settings) { |
|
87 | + $shortcodes_to_register = array_merge($shortcodes_to_register, $settings['shortcode_paths']); |
|
88 | 88 | } |
89 | 89 | return $shortcodes_to_register; |
90 | 90 | } |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | * @param string $shortcode_id the name for the shortcode that was previously registered |
101 | 101 | * @return void |
102 | 102 | */ |
103 | - public static function deregister( $shortcode_id = NULL ) { |
|
104 | - if ( isset( self::$_settings[ $shortcode_id ] )) { |
|
105 | - unset( self::$_settings[ $shortcode_id ] ); |
|
103 | + public static function deregister($shortcode_id = NULL) { |
|
104 | + if (isset(self::$_settings[$shortcode_id])) { |
|
105 | + unset(self::$_settings[$shortcode_id]); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 |
@@ -44,34 +44,34 @@ discard block |
||
44 | 44 | * @throws EE_Error |
45 | 45 | * @return void |
46 | 46 | */ |
47 | - public static function register( $widget_id = NULL, $setup_args = array() ) { |
|
47 | + public static function register($widget_id = NULL, $setup_args = array()) { |
|
48 | 48 | |
49 | 49 | //required fields MUST be present, so let's make sure they are. |
50 | - if ( empty( $widget_id ) || ! is_array( $setup_args ) || empty( $setup_args['widget_paths'] )) { |
|
51 | - throw new EE_Error( __( 'In order to register Widgets with EE_Register_Widget::register(), you must include a "widget_id" (a unique identifier for this set of widgets), and an array containing the following keys: "widget_paths" (an array of full server paths to folders that contain widgets, or to the widget files themselves)', 'event_espresso' )); |
|
50 | + if (empty($widget_id) || ! is_array($setup_args) || empty($setup_args['widget_paths'])) { |
|
51 | + throw new EE_Error(__('In order to register Widgets with EE_Register_Widget::register(), you must include a "widget_id" (a unique identifier for this set of widgets), and an array containing the following keys: "widget_paths" (an array of full server paths to folders that contain widgets, or to the widget files themselves)', 'event_espresso')); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | //make sure we don't register twice |
55 | - if( isset( self::$_settings[ $widget_id ] ) ){ |
|
55 | + if (isset(self::$_settings[$widget_id])) { |
|
56 | 56 | return; |
57 | 57 | } |
58 | 58 | |
59 | 59 | |
60 | 60 | //make sure this was called in the right place! |
61 | - if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' )) { |
|
61 | + if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System__register_shortcodes_modules_and_widgets')) { |
|
62 | 62 | EE_Error::doing_it_wrong( |
63 | 63 | __METHOD__, |
64 | - __( 'An attempt to register widgets has failed because it was not registered at the correct time. Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register widgets.','event_espresso'), |
|
64 | + __('An attempt to register widgets has failed because it was not registered at the correct time. Please use the "AHEE__EE_System__register_shortcodes_modules_and_widgets" hook to register widgets.', 'event_espresso'), |
|
65 | 65 | '4.3.0' |
66 | 66 | ); |
67 | 67 | } |
68 | 68 | //setup $_settings array from incoming values. |
69 | - self::$_settings[ $widget_id ] = array( |
|
69 | + self::$_settings[$widget_id] = array( |
|
70 | 70 | // array of full server paths to any EED_Widgets used by the widget |
71 | - 'widget_paths' => isset( $setup_args['widget_paths'] ) ? (array)$setup_args['widget_paths'] : array(), |
|
71 | + 'widget_paths' => isset($setup_args['widget_paths']) ? (array) $setup_args['widget_paths'] : array(), |
|
72 | 72 | ); |
73 | 73 | // add to list of widgets to be registered |
74 | - add_filter( 'FHEE__EE_Config__register_widgets__widgets_to_register', array( 'EE_Register_Widget', 'add_widgets' )); |
|
74 | + add_filter('FHEE__EE_Config__register_widgets__widgets_to_register', array('EE_Register_Widget', 'add_widgets')); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | * @param array $widgets_to_register array of paths to all widgets that require registering |
84 | 84 | * @return array |
85 | 85 | */ |
86 | - public static function add_widgets( $widgets_to_register = array() ) { |
|
87 | - foreach( self::$_settings as $settings ) { |
|
88 | - $widgets_to_register = array_merge( $widgets_to_register, $settings['widget_paths'] ); |
|
86 | + public static function add_widgets($widgets_to_register = array()) { |
|
87 | + foreach (self::$_settings as $settings) { |
|
88 | + $widgets_to_register = array_merge($widgets_to_register, $settings['widget_paths']); |
|
89 | 89 | } |
90 | 90 | return $widgets_to_register; |
91 | 91 | } |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | * @param string $widget_id the name for the widget that was previously registered |
102 | 102 | * @return void |
103 | 103 | */ |
104 | - public static function deregister( $widget_id = NULL ) { |
|
105 | - if ( isset( self::$_settings[ $widget_id ] )) { |
|
106 | - unset( self::$_settings[ $widget_id ] ); |
|
104 | + public static function deregister($widget_id = NULL) { |
|
105 | + if (isset(self::$_settings[$widget_id])) { |
|
106 | + unset(self::$_settings[$widget_id]); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 |
@@ -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 | /** |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | */ |
48 | 48 | protected $_ = NULL; |
49 | 49 | |
50 | - public function __construct(){ |
|
51 | - if( ! $this->_model_name_extended){ |
|
50 | + public function __construct() { |
|
51 | + if ( ! $this->_model_name_extended) { |
|
52 | 52 | throw new EE_Error(sprintf(__("When declaring a class extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", "event_espresso"))); |
53 | 53 | } |
54 | - if(did_action('AHEE__EE_'.$this->_model_name_extended.'__construct__end')){ |
|
55 | - throw new EE_Error(sprintf(__("Hooked in model object extension '%s' too late! The model object %s has already been used!", "event_espresso"),get_class($this),$this->_model_name_extended)); |
|
54 | + if (did_action('AHEE__EE_'.$this->_model_name_extended.'__construct__end')) { |
|
55 | + throw new EE_Error(sprintf(__("Hooked in model object extension '%s' too late! The model object %s has already been used!", "event_espresso"), get_class($this), $this->_model_name_extended)); |
|
56 | 56 | } |
57 | 57 | $this->_register_extending_methods(); |
58 | 58 | } |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | * scans the child of EEME_Base for functions starting with ext_, and magically makes them functions on the |
62 | 62 | * model extended. (Internally uses filters, and the __call magic method) |
63 | 63 | */ |
64 | - protected function _register_extending_methods(){ |
|
64 | + protected function _register_extending_methods() { |
|
65 | 65 | $all_methods = get_class_methods(get_class($this)); |
66 | - foreach($all_methods as $method_name){ |
|
67 | - if(strpos($method_name, self::extending_method_prefix) === 0){ |
|
66 | + foreach ($all_methods as $method_name) { |
|
67 | + if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
68 | 68 | $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
69 | 69 | $callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model"; |
70 | - add_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10,10); |
|
70 | + add_filter($callback_name, array($this, self::dynamic_callback_method_prefix.$method_name_on_model), 10, 10); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | } |
@@ -75,20 +75,20 @@ discard block |
||
75 | 75 | * scans the child of EEME_Base for functions starting with ext_, and magically REMOVES them as functions on the |
76 | 76 | * model extended. (Internally uses filters, and the __call magic method) |
77 | 77 | */ |
78 | - public function deregister(){ |
|
78 | + public function deregister() { |
|
79 | 79 | $all_methods = get_class_methods(get_class($this)); |
80 | - foreach($all_methods as $method_name){ |
|
81 | - if(strpos($method_name, self::extending_method_prefix) === 0){ |
|
80 | + foreach ($all_methods as $method_name) { |
|
81 | + if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
82 | 82 | $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
83 | 83 | $callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model"; |
84 | - remove_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10); |
|
84 | + remove_filter($callback_name, array($this, self::dynamic_callback_method_prefix.$method_name_on_model), 10); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | 89 | |
90 | - public function __call($callback_method_name,$args){ |
|
91 | - if(strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0){ |
|
90 | + public function __call($callback_method_name, $args) { |
|
91 | + if (strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0) { |
|
92 | 92 | //it's a dynamic callback for a method name |
93 | 93 | $method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name); |
94 | 94 | $original_return_val = $args[0]; |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | $this->_ = $model_called; |
97 | 97 | $args_provided_to_method_on_model = $args[2]; |
98 | 98 | $extending_method = self::extending_method_prefix.$method_called_on_model; |
99 | - if(method_exists($this, $extending_method)){ |
|
100 | - return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model); |
|
101 | - }else{ |
|
102 | - throw new EE_Error(sprintf(__("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"),$this->_model_name_extended,get_class($this),$extending_method,$extending_method)); |
|
99 | + if (method_exists($this, $extending_method)) { |
|
100 | + return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model); |
|
101 | + } else { |
|
102 | + throw new EE_Error(sprintf(__("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"), $this->_model_name_extended, get_class($this), $extending_method, $extending_method)); |
|
103 | 103 | } |
104 | 104 | |
105 | - }else{ |
|
106 | - throw new EE_Error(sprintf(__("There is no method named '%s' on '%s'", "event_espresso"),$callback_method_name,get_class($this))); |
|
105 | + } else { |
|
106 | + throw new EE_Error(sprintf(__("There is no method named '%s' on '%s'", "event_espresso"), $callback_method_name, get_class($this))); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 |
@@ -1,7 +1,8 @@ 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 | 7 | /** |
7 | 8 | * |
@@ -159,11 +160,11 @@ discard block |
||
159 | 160 | $extending_method = self::extending_method_prefix.$method_called_on_model; |
160 | 161 | if(method_exists($this, $extending_method)){ |
161 | 162 | return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model); |
162 | - }else{ |
|
163 | + } else{ |
|
163 | 164 | throw new EE_Error(sprintf(__("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"),$this->_model_name_extended,get_class($this),$extending_method,$extending_method)); |
164 | 165 | } |
165 | 166 | |
166 | - }else{ |
|
167 | + } else{ |
|
167 | 168 | throw new EE_Error(sprintf(__("There is no method named '%s' on '%s'", "event_espresso"),$callback_method_name,get_class($this))); |
168 | 169 | } |
169 | 170 | } |
@@ -1,7 +1,8 @@ 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 | 7 | /** |
7 | 8 | * |
@@ -159,11 +160,11 @@ discard block |
||
159 | 160 | $extending_method = self::extending_method_prefix.$method_called_on_model; |
160 | 161 | if(method_exists($this, $extending_method)){ |
161 | 162 | return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model); |
162 | - }else{ |
|
163 | + } else{ |
|
163 | 164 | throw new EE_Error(sprintf(__("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"),$this->_model_name_extended,get_class($this),$extending_method,$extending_method)); |
164 | 165 | } |
165 | 166 | |
166 | - }else{ |
|
167 | + } else{ |
|
167 | 168 | throw new EE_Error(sprintf(__("There is no method named '%s' on '%s'", "event_espresso"),$callback_method_name,get_class($this))); |
168 | 169 | } |
169 | 170 | } |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function __construct(){ |
73 | 73 | if( ! $this->_model_name_extended){ |
74 | - throw new EE_Error( |
|
75 | - __( "When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", |
|
76 | - "event_espresso" ) |
|
77 | - ); |
|
74 | + throw new EE_Error( |
|
75 | + __( "When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", |
|
76 | + "event_espresso" ) |
|
77 | + ); |
|
78 | 78 | } |
79 | 79 | $construct_end_action = 'AHEE__EEM_'.$this->_model_name_extended.'__construct__end'; |
80 | 80 | if ( did_action( $construct_end_action )) { |
@@ -95,30 +95,30 @@ discard block |
||
95 | 95 | |
96 | 96 | |
97 | 97 | |
98 | - /** |
|
99 | - * @param array $existing_tables |
|
100 | - * @return array |
|
101 | - */ |
|
102 | - public function add_extra_tables_on_filter( $existing_tables ){ |
|
103 | - return array_merge( (array)$existing_tables, $this->_extra_tables ); |
|
98 | + /** |
|
99 | + * @param array $existing_tables |
|
100 | + * @return array |
|
101 | + */ |
|
102 | + public function add_extra_tables_on_filter( $existing_tables ){ |
|
103 | + return array_merge( (array)$existing_tables, $this->_extra_tables ); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
107 | 107 | |
108 | - /** |
|
109 | - * @param array $existing_fields |
|
110 | - * @return array |
|
111 | - */ |
|
112 | - public function add_extra_fields_on_filter( $existing_fields ){ |
|
108 | + /** |
|
109 | + * @param array $existing_fields |
|
110 | + * @return array |
|
111 | + */ |
|
112 | + public function add_extra_fields_on_filter( $existing_fields ){ |
|
113 | 113 | if( $this->_extra_fields){ |
114 | 114 | foreach($this->_extra_fields as $table_alias => $fields){ |
115 | 115 | if( ! isset( $existing_fields[ $table_alias ] ) ){ |
116 | 116 | $existing_fields[ $table_alias ] = array(); |
117 | 117 | } |
118 | 118 | $existing_fields[$table_alias] = array_merge( |
119 | - (array)$existing_fields[$table_alias], |
|
120 | - $this->_extra_fields[$table_alias] |
|
121 | - ); |
|
119 | + (array)$existing_fields[$table_alias], |
|
120 | + $this->_extra_fields[$table_alias] |
|
121 | + ); |
|
122 | 122 | |
123 | 123 | } |
124 | 124 | } |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | |
128 | 128 | |
129 | 129 | |
130 | - /** |
|
131 | - * @param array $existing_relations |
|
132 | - * @return array |
|
133 | - */ |
|
134 | - public function add_extra_relations_on_filter( $existing_relations ){ |
|
135 | - return array_merge((array)$existing_relations,$this->_extra_relations); |
|
130 | + /** |
|
131 | + * @param array $existing_relations |
|
132 | + * @return array |
|
133 | + */ |
|
134 | + public function add_extra_relations_on_filter( $existing_relations ){ |
|
135 | + return array_merge((array)$existing_relations,$this->_extra_relations); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | remove_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10); |
169 | 169 | } |
170 | 170 | } |
171 | - /** @var EEM_Base $model_to_reset */ |
|
172 | - $model_to_reset = 'EEM_' . $this->_model_name_extended; |
|
171 | + /** @var EEM_Base $model_to_reset */ |
|
172 | + $model_to_reset = 'EEM_' . $this->_model_name_extended; |
|
173 | 173 | if ( class_exists( $model_to_reset ) ) { |
174 | 174 | $model_to_reset::reset(); |
175 | 175 | } |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | |
178 | 178 | |
179 | 179 | |
180 | - /** |
|
181 | - * @param string $callback_method_name |
|
182 | - * @param array $args |
|
183 | - * @return mixed |
|
184 | - * @throws EE_Error |
|
185 | - */ |
|
186 | - public function __call( $callback_method_name, $args){ |
|
180 | + /** |
|
181 | + * @param string $callback_method_name |
|
182 | + * @param array $args |
|
183 | + * @return mixed |
|
184 | + * @throws EE_Error |
|
185 | + */ |
|
186 | + public function __call( $callback_method_name, $args){ |
|
187 | 187 | if(strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0){ |
188 | 188 | //it's a dynamic callback for a method name |
189 | 189 | $method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name); |
@@ -194,23 +194,23 @@ discard block |
||
194 | 194 | return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model); |
195 | 195 | }else{ |
196 | 196 | throw new EE_Error( |
197 | - sprintf( |
|
198 | - __("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"), |
|
199 | - $this->_model_name_extended, |
|
200 | - get_class($this), |
|
201 | - $extending_method,$extending_method |
|
202 | - ) |
|
203 | - ); |
|
197 | + sprintf( |
|
198 | + __("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"), |
|
199 | + $this->_model_name_extended, |
|
200 | + get_class($this), |
|
201 | + $extending_method,$extending_method |
|
202 | + ) |
|
203 | + ); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | }else{ |
207 | 207 | throw new EE_Error( |
208 | - sprintf( |
|
209 | - __("There is no method named '%s' on '%s'", "event_espresso"), |
|
210 | - $callback_method_name, |
|
211 | - get_class($this) |
|
212 | - ) |
|
213 | - ); |
|
208 | + sprintf( |
|
209 | + __("There is no method named '%s' on '%s'", "event_espresso"), |
|
210 | + $callback_method_name, |
|
211 | + get_class($this) |
|
212 | + ) |
|
213 | + ); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 |
@@ -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 | /** |
@@ -69,27 +69,27 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * @throws \EE_Error |
71 | 71 | */ |
72 | - public function __construct(){ |
|
73 | - if( ! $this->_model_name_extended){ |
|
72 | + public function __construct() { |
|
73 | + if ( ! $this->_model_name_extended) { |
|
74 | 74 | throw new EE_Error( |
75 | - __( "When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", |
|
76 | - "event_espresso" ) |
|
75 | + __("When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", |
|
76 | + "event_espresso") |
|
77 | 77 | ); |
78 | 78 | } |
79 | 79 | $construct_end_action = 'AHEE__EEM_'.$this->_model_name_extended.'__construct__end'; |
80 | - if ( did_action( $construct_end_action )) { |
|
80 | + if (did_action($construct_end_action)) { |
|
81 | 81 | throw new EE_Error( |
82 | 82 | sprintf( |
83 | - __( "Hooked in model extension '%s' too late! The model %s has already been used! We know because the action %s has been fired", "event_espresso"), |
|
83 | + __("Hooked in model extension '%s' too late! The model %s has already been used! We know because the action %s has been fired", "event_espresso"), |
|
84 | 84 | get_class($this), |
85 | 85 | $this->_model_name_extended, |
86 | 86 | $construct_end_action |
87 | 87 | ) |
88 | 88 | ); |
89 | 89 | } |
90 | - add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables',array($this,'add_extra_tables_on_filter')); |
|
91 | - add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields',array($this,'add_extra_fields_on_filter')); |
|
92 | - add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations',array($this,'add_extra_relations_on_filter')); |
|
90 | + add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables', array($this, 'add_extra_tables_on_filter')); |
|
91 | + add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields', array($this, 'add_extra_fields_on_filter')); |
|
92 | + add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations', array($this, 'add_extra_relations_on_filter')); |
|
93 | 93 | $this->_register_extending_methods(); |
94 | 94 | } |
95 | 95 | |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | * @param array $existing_tables |
100 | 100 | * @return array |
101 | 101 | */ |
102 | - public function add_extra_tables_on_filter( $existing_tables ){ |
|
103 | - return array_merge( (array)$existing_tables, $this->_extra_tables ); |
|
102 | + public function add_extra_tables_on_filter($existing_tables) { |
|
103 | + return array_merge((array) $existing_tables, $this->_extra_tables); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | * @param array $existing_fields |
110 | 110 | * @return array |
111 | 111 | */ |
112 | - public function add_extra_fields_on_filter( $existing_fields ){ |
|
113 | - if( $this->_extra_fields){ |
|
114 | - foreach($this->_extra_fields as $table_alias => $fields){ |
|
115 | - if( ! isset( $existing_fields[ $table_alias ] ) ){ |
|
116 | - $existing_fields[ $table_alias ] = array(); |
|
112 | + public function add_extra_fields_on_filter($existing_fields) { |
|
113 | + if ($this->_extra_fields) { |
|
114 | + foreach ($this->_extra_fields as $table_alias => $fields) { |
|
115 | + if ( ! isset($existing_fields[$table_alias])) { |
|
116 | + $existing_fields[$table_alias] = array(); |
|
117 | 117 | } |
118 | 118 | $existing_fields[$table_alias] = array_merge( |
119 | - (array)$existing_fields[$table_alias], |
|
119 | + (array) $existing_fields[$table_alias], |
|
120 | 120 | $this->_extra_fields[$table_alias] |
121 | 121 | ); |
122 | 122 | |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param array $existing_relations |
132 | 132 | * @return array |
133 | 133 | */ |
134 | - public function add_extra_relations_on_filter( $existing_relations ){ |
|
135 | - return array_merge((array)$existing_relations,$this->_extra_relations); |
|
134 | + public function add_extra_relations_on_filter($existing_relations) { |
|
135 | + return array_merge((array) $existing_relations, $this->_extra_relations); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | * scans the child of EEME_Base for functions starting with ext_, and magically makes them functions on the |
142 | 142 | * model extended. (Internally uses filters, and the __call magic method) |
143 | 143 | */ |
144 | - protected function _register_extending_methods(){ |
|
144 | + protected function _register_extending_methods() { |
|
145 | 145 | $all_methods = get_class_methods(get_class($this)); |
146 | - foreach($all_methods as $method_name){ |
|
147 | - if(strpos($method_name, self::extending_method_prefix) === 0){ |
|
146 | + foreach ($all_methods as $method_name) { |
|
147 | + if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
148 | 148 | $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
149 | 149 | $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model"; |
150 | - add_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10,10); |
|
150 | + add_filter($callback_name, array($this, self::dynamic_callback_method_prefix.$method_name_on_model), 10, 10); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | } |
@@ -156,21 +156,21 @@ discard block |
||
156 | 156 | * scans the child of EEME_Base for functions starting with ext_, and magically REMOVES them as functions on the |
157 | 157 | * model extended. (Internally uses filters, and the __call magic method) |
158 | 158 | */ |
159 | - public function deregister(){ |
|
160 | - remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables',array($this,'add_extra_tables_on_filter')); |
|
161 | - remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields',array($this,'add_extra_fields_on_filter')); |
|
162 | - remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations',array($this,'add_extra_relations_on_filter')); |
|
159 | + public function deregister() { |
|
160 | + remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables', array($this, 'add_extra_tables_on_filter')); |
|
161 | + remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields', array($this, 'add_extra_fields_on_filter')); |
|
162 | + remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations', array($this, 'add_extra_relations_on_filter')); |
|
163 | 163 | $all_methods = get_class_methods(get_class($this)); |
164 | - foreach($all_methods as $method_name){ |
|
165 | - if(strpos($method_name, self::extending_method_prefix) === 0){ |
|
164 | + foreach ($all_methods as $method_name) { |
|
165 | + if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
166 | 166 | $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
167 | 167 | $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model"; |
168 | - remove_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10); |
|
168 | + remove_filter($callback_name, array($this, self::dynamic_callback_method_prefix.$method_name_on_model), 10); |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | /** @var EEM_Base $model_to_reset */ |
172 | - $model_to_reset = 'EEM_' . $this->_model_name_extended; |
|
173 | - if ( class_exists( $model_to_reset ) ) { |
|
172 | + $model_to_reset = 'EEM_'.$this->_model_name_extended; |
|
173 | + if (class_exists($model_to_reset)) { |
|
174 | 174 | $model_to_reset::reset(); |
175 | 175 | } |
176 | 176 | } |
@@ -183,27 +183,27 @@ discard block |
||
183 | 183 | * @return mixed |
184 | 184 | * @throws EE_Error |
185 | 185 | */ |
186 | - public function __call( $callback_method_name, $args){ |
|
187 | - if(strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0){ |
|
186 | + public function __call($callback_method_name, $args) { |
|
187 | + if (strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0) { |
|
188 | 188 | //it's a dynamic callback for a method name |
189 | 189 | $method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name); |
190 | - list( $original_return_val, $model_called, $args_provided_to_method_on_model ) = (array) $args; |
|
190 | + list($original_return_val, $model_called, $args_provided_to_method_on_model) = (array) $args; |
|
191 | 191 | $this->_ = $model_called; |
192 | 192 | $extending_method = self::extending_method_prefix.$method_called_on_model; |
193 | - if(method_exists($this, $extending_method)){ |
|
194 | - return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model); |
|
195 | - }else{ |
|
193 | + if (method_exists($this, $extending_method)) { |
|
194 | + return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model); |
|
195 | + } else { |
|
196 | 196 | throw new EE_Error( |
197 | 197 | sprintf( |
198 | 198 | __("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"), |
199 | 199 | $this->_model_name_extended, |
200 | 200 | get_class($this), |
201 | - $extending_method,$extending_method |
|
201 | + $extending_method, $extending_method |
|
202 | 202 | ) |
203 | 203 | ); |
204 | 204 | } |
205 | 205 | |
206 | - }else{ |
|
206 | + } else { |
|
207 | 207 | throw new EE_Error( |
208 | 208 | sprintf( |
209 | 209 | __("There is no method named '%s' on '%s'", "event_espresso"), |
@@ -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 | /** |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | |
49 | 49 | |
50 | 50 | |
51 | - protected function _parser( $shortcode ) { |
|
52 | - switch ( $shortcode ) { |
|
51 | + protected function _parser($shortcode) { |
|
52 | + switch ($shortcode) { |
|
53 | 53 | case '[ATTENDEE_LIST]' : |
54 | 54 | return $this->_get_attendee_list(); |
55 | 55 | break; |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | $this->_validate_list_requirements(); |
68 | 68 | $this->_set_shortcode_helper(); |
69 | 69 | |
70 | - if ( $this->_data['data'] instanceof EE_Messages_Addressee ) |
|
70 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) |
|
71 | 71 | return $this->_get_attendee_list_for_main(); |
72 | 72 | |
73 | - else if ( $this->_data['data'] instanceof EE_Event ) |
|
73 | + else if ($this->_data['data'] instanceof EE_Event) |
|
74 | 74 | return $this->_get_attendee_list_for_event(); |
75 | 75 | |
76 | - else if ( $this->_data['data'] instanceof EE_Ticket ) |
|
76 | + else if ($this->_data['data'] instanceof EE_Ticket) |
|
77 | 77 | return $this->_get_registration_list_for_ticket(); |
78 | 78 | |
79 | 79 | //prevent recursive loop |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | |
95 | 95 | //now we need to loop through the attendee list and send data to the EE_Parser helper. |
96 | - foreach ( $data->reg_objs as $registration ) { |
|
96 | + foreach ($data->reg_objs as $registration) { |
|
97 | 97 | $attnds .= $this->_shortcode_helper->parse_attendee_list_template($template, $registration, $valid_shortcodes, $this->_extra_data); |
98 | 98 | } |
99 | 99 | |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | * @return string |
108 | 108 | */ |
109 | 109 | private function _get_attendee_list_for_event() { |
110 | - $valid_shortcodes = array('attendee', 'ticket_list', 'question_list', 'recipient_details' ); |
|
111 | - $template = is_array( $this->_data['template'] ) && isset($this->_data['template']['attendee_list']) ? $this->_data['template']['attendee_list'] : $this->_extra_data['template']['attendee_list']; |
|
110 | + $valid_shortcodes = array('attendee', 'ticket_list', 'question_list', 'recipient_details'); |
|
111 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['attendee_list']) ? $this->_data['template']['attendee_list'] : $this->_extra_data['template']['attendee_list']; |
|
112 | 112 | $event = $this->_data['data']; |
113 | 113 | |
114 | 114 | //let's remove any existing [EVENT_LIST] shortcode from the attendee list template so that we don't get recursion. |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $registrations = $this->_get_registrations_from_event($event); |
120 | 120 | |
121 | 121 | //each attendee in this case should be an attendee object. |
122 | - foreach ( $registrations as $registration ) { |
|
122 | + foreach ($registrations as $registration) { |
|
123 | 123 | $att_result .= $this->_shortcode_helper->parse_attendee_list_template($template, $registration, $valid_shortcodes, $this->_extra_data); |
124 | 124 | } |
125 | 125 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @return string |
134 | 134 | */ |
135 | 135 | private function _get_registration_list_for_ticket() { |
136 | - $valid_shortcodes = array( 'attendee', 'event_list', 'question_list', 'recipient_details' ); |
|
137 | - $template = is_array( $this->_data['template'] ) && isset($this->_data['template']['attendee_list']) ? $this->_data['template']['attendee_list'] : $this->_extra_data['template']['attendee_list']; |
|
136 | + $valid_shortcodes = array('attendee', 'event_list', 'question_list', 'recipient_details'); |
|
137 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['attendee_list']) ? $this->_data['template']['attendee_list'] : $this->_extra_data['template']['attendee_list']; |
|
138 | 138 | $ticket = $this->_data['data']; |
139 | 139 | |
140 | 140 | //let's remove any existing [TICKET_LIST] (or related) shortcode from the attendee list template so that we don't get recursion. |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | |
145 | 145 | //here we're setting up the attendees for the attendee_list template for THIS ticket. |
146 | 146 | $att_result = ''; |
147 | - $registrations = isset( $this->_extra_data['data']->tickets ) ? $this->_extra_data['data']->tickets[$ticket->ID()]['reg_objs'] : array(); |
|
147 | + $registrations = isset($this->_extra_data['data']->tickets) ? $this->_extra_data['data']->tickets[$ticket->ID()]['reg_objs'] : array(); |
|
148 | 148 | |
149 | 149 | //each attendee in this case should be an attendee object. |
150 | - foreach ( $registrations as $registration ) { |
|
150 | + foreach ($registrations as $registration) { |
|
151 | 151 | $att_result .= $this->_shortcode_helper->parse_attendee_list_template($template, $registration, $valid_shortcodes, $this->_extra_data); |
152 | 152 | } |
153 | 153 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | |
159 | 159 | |
160 | - private function _get_registrations_from_event( EE_Event $event ) { |
|
160 | + private function _get_registrations_from_event(EE_Event $event) { |
|
161 | 161 | return isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[$event->ID()]['reg_objs'] : array(); |
162 | 162 | } |
163 | 163 |
@@ -1,7 +1,8 @@ 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 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -67,18 +68,18 @@ discard block |
||
67 | 68 | $this->_validate_list_requirements(); |
68 | 69 | $this->_set_shortcode_helper(); |
69 | 70 | |
70 | - if ( $this->_data['data'] instanceof EE_Messages_Addressee ) |
|
71 | - return $this->_get_attendee_list_for_main(); |
|
72 | - |
|
73 | - else if ( $this->_data['data'] instanceof EE_Event ) |
|
74 | - return $this->_get_attendee_list_for_event(); |
|
75 | - |
|
76 | - else if ( $this->_data['data'] instanceof EE_Ticket ) |
|
77 | - return $this->_get_registration_list_for_ticket(); |
|
71 | + if ( $this->_data['data'] instanceof EE_Messages_Addressee ) { |
|
72 | + return $this->_get_attendee_list_for_main(); |
|
73 | + } else if ( $this->_data['data'] instanceof EE_Event ) { |
|
74 | + return $this->_get_attendee_list_for_event(); |
|
75 | + } else if ( $this->_data['data'] instanceof EE_Ticket ) { |
|
76 | + return $this->_get_registration_list_for_ticket(); |
|
77 | + } |
|
78 | 78 | |
79 | 79 | //prevent recursive loop |
80 | - else |
|
81 | - return ''; |
|
80 | + else { |
|
81 | + return ''; |
|
82 | + } |
|
82 | 83 | } |
83 | 84 | |
84 | 85 |
@@ -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 | /** |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | |
45 | 45 | |
46 | 46 | |
47 | - protected function _parser( $shortcode ) { |
|
48 | - switch ( $shortcode ) { |
|
47 | + protected function _parser($shortcode) { |
|
48 | + switch ($shortcode) { |
|
49 | 49 | case '[DATETIME_LIST]' : |
50 | 50 | return $this->_get_datetime_list(); |
51 | 51 | break; |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | $this->_validate_list_requirements(); |
64 | 64 | $this->_set_shortcode_helper(); |
65 | 65 | |
66 | - if ( $this->_data['data'] instanceof EE_Ticket ) |
|
66 | + if ($this->_data['data'] instanceof EE_Ticket) |
|
67 | 67 | return $this->_get_datetime_list_for_ticket(); |
68 | 68 | |
69 | - else if ( $this->_data['data'] instanceof EE_Event ) |
|
69 | + else if ($this->_data['data'] instanceof EE_Event) |
|
70 | 70 | return $this->_get_datetime_list_for_event(); |
71 | 71 | |
72 | - else if ( $this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration ) { |
|
72 | + else if ($this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration) { |
|
73 | 73 | return $this->_get_datetime_list_for_registration(); |
74 | 74 | } |
75 | 75 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | private function _get_datetime_list_for_event() { |
88 | 88 | $valid_shortcodes = array('datetime', 'attendee'); |
89 | - $template = is_array($this->_data['template'] ) && isset($this->_data['template']['datetime_list']) ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
89 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
90 | 90 | $event = $this->_data['data']; |
91 | 91 | |
92 | 92 | //here we're setting up the datetimes for the datetime list template for THIS event. |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $datetimes = $this->_get_datetimes_from_event($event); |
95 | 95 | |
96 | 96 | //each datetime in this case should be an datetime object. |
97 | - foreach ( $datetimes as $datetime ) { |
|
97 | + foreach ($datetimes as $datetime) { |
|
98 | 98 | $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template($template, $datetime, $valid_shortcodes, $this->_extra_data); |
99 | 99 | } |
100 | 100 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | private function _get_datetime_list_for_ticket() { |
111 | 111 | $valid_shortcodes = array('datetime', 'attendee'); |
112 | 112 | |
113 | - $template = is_array($this->_data['template'] ) && isset($this->_data['template']['datetime_list']) ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
113 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
114 | 114 | $ticket = $this->_data['data']; |
115 | 115 | |
116 | 116 | //here we're setting up the datetimes for the datetime list template for THIS ticket. |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $datetimes = $this->_get_datetimes_from_ticket($ticket); |
119 | 119 | |
120 | 120 | //each datetime in this case should be an datetime object. |
121 | - foreach ( $datetimes as $datetime ) { |
|
121 | + foreach ($datetimes as $datetime) { |
|
122 | 122 | $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template($template, $datetime, $valid_shortcodes, $this->_extra_data); |
123 | 123 | } |
124 | 124 | |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | |
144 | 144 | |
145 | 145 | |
146 | - private function _get_datetimes_from_event( EE_Event $event, $att = NULL ) { |
|
146 | + private function _get_datetimes_from_event(EE_Event $event, $att = NULL) { |
|
147 | 147 | return isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[$event->ID()]['dtt_objs'] : array(); |
148 | 148 | } |
149 | 149 | |
150 | - private function _get_datetimes_from_ticket( EE_Ticket $ticket, $att = NULL ) { |
|
150 | + private function _get_datetimes_from_ticket(EE_Ticket $ticket, $att = NULL) { |
|
151 | 151 | return isset($this->_extra_data['data']->tickets) ? $this->_extra_data['data']->tickets[$ticket->ID()]['dtt_objs'] : array(); |
152 | 152 | } |
153 | 153 |
@@ -1,7 +1,8 @@ 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 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -63,19 +64,18 @@ discard block |
||
63 | 64 | $this->_validate_list_requirements(); |
64 | 65 | $this->_set_shortcode_helper(); |
65 | 66 | |
66 | - if ( $this->_data['data'] instanceof EE_Ticket ) |
|
67 | - return $this->_get_datetime_list_for_ticket(); |
|
68 | - |
|
69 | - else if ( $this->_data['data'] instanceof EE_Event ) |
|
70 | - return $this->_get_datetime_list_for_event(); |
|
71 | - |
|
72 | - else if ( $this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration ) { |
|
67 | + if ( $this->_data['data'] instanceof EE_Ticket ) { |
|
68 | + return $this->_get_datetime_list_for_ticket(); |
|
69 | + } else if ( $this->_data['data'] instanceof EE_Event ) { |
|
70 | + return $this->_get_datetime_list_for_event(); |
|
71 | + } else if ( $this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration ) { |
|
73 | 72 | return $this->_get_datetime_list_for_registration(); |
74 | 73 | } |
75 | 74 | |
76 | 75 | //prevent recursive loop |
77 | - else |
|
78 | - return ''; |
|
76 | + else { |
|
77 | + return ''; |
|
78 | + } |
|
79 | 79 | } |
80 | 80 | |
81 | 81 |
@@ -1,7 +1,8 @@ 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 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -101,8 +102,9 @@ discard block |
||
101 | 102 | private function _get_event_admin_emails( $fancy_headers = TRUE ) { |
102 | 103 | |
103 | 104 | if ( !empty( $this->_data->admin_email ) ) { |
104 | - if ( ! $fancy_headers ) |
|
105 | - return $this->_data->admin_email; |
|
105 | + if ( ! $fancy_headers ) { |
|
106 | + return $this->_data->admin_email; |
|
107 | + } |
|
106 | 108 | return !empty( $this->_data->fname ) ? $this->_data->fname . ' ' . $this->_data->lname . ' <' . $this->_data->admin_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $this->_data->admin_email . '>'; |
107 | 109 | } |
108 | 110 | |
@@ -142,7 +144,9 @@ discard block |
||
142 | 144 | |
143 | 145 | foreach ( $admin_details as $admin ) { |
144 | 146 | //only add an admin email if it is present. |
145 | - if ( empty( $admin->email ) || $admin->email == '' ) continue; |
|
147 | + if ( empty( $admin->email ) || $admin->email == '' ) { |
|
148 | + continue; |
|
149 | + } |
|
146 | 150 | |
147 | 151 | if ( ! $fancy_headers ) { |
148 | 152 | $admin_email[] = $admin->email; |
@@ -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 | /** |
@@ -43,19 +43,19 @@ discard block |
||
43 | 43 | $this->description = esc_html__('All shortcodes related to emails', 'event_espresso'); |
44 | 44 | $this->_shortcodes = array( |
45 | 45 | '[SITE_ADMIN_EMAIL]' => esc_html__('Will be replaced with the admin email for the site that Event Espresso is installed on', 'event_espresso'), |
46 | - '[EVENT_AUTHOR_FORMATTED_EMAIL]' => sprintf( esc_html__('This will be replaced with a properly formatted list of Event Creator emails for the events in a registration. %1$sNOTE:%2$s If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', 'event_espresso'),'<strong>','</strong>' ), |
|
47 | - '[EVENT_AUTHOR_EMAIL]' => sprintf( esc_html__('This is the same as %1$s shortcode except it is just a list of emails (not fancy headers).', 'event_espresso'), '[EVENT_AUTHOR_FORMATTED_EMAIL]' ), |
|
48 | - '[CO_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization <[email protected]>"', 'event_espresso' ), |
|
46 | + '[EVENT_AUTHOR_FORMATTED_EMAIL]' => sprintf(esc_html__('This will be replaced with a properly formatted list of Event Creator emails for the events in a registration. %1$sNOTE:%2$s If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', 'event_espresso'), '<strong>', '</strong>'), |
|
47 | + '[EVENT_AUTHOR_EMAIL]' => sprintf(esc_html__('This is the same as %1$s shortcode except it is just a list of emails (not fancy headers).', 'event_espresso'), '[EVENT_AUTHOR_FORMATTED_EMAIL]'), |
|
48 | + '[CO_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization <[email protected]>"', 'event_espresso'), |
|
49 | 49 | '[CO_EMAIL]' => esc_html__('This will parse to the email address only for the organization set in Your Organization Settings.', 'event_espresso'), |
50 | - '[ESPRESSO_ADMIN_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization <[email protected]>"', 'event_espresso' ), |
|
50 | + '[ESPRESSO_ADMIN_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization <[email protected]>"', 'event_espresso'), |
|
51 | 51 | '[ESPRESSO_ADMIN_EMAIL]' => esc_html__('This parses to the email address only for the organization set in Your Organization Settings page.', 'event_espresso') |
52 | 52 | ); |
53 | 53 | } |
54 | 54 | |
55 | 55 | |
56 | - protected function _parser( $shortcode ) { |
|
56 | + protected function _parser($shortcode) { |
|
57 | 57 | |
58 | - switch ( $shortcode ) { |
|
58 | + switch ($shortcode) { |
|
59 | 59 | |
60 | 60 | case '[SITE_ADMIN_EMAIL]' : |
61 | 61 | return $this->_get_site_admin_email(); |
@@ -66,17 +66,17 @@ discard block |
||
66 | 66 | break; |
67 | 67 | |
68 | 68 | case '[EVENT_AUTHOR_EMAIL]' : |
69 | - return $this->_get_event_admin_emails( FALSE ); |
|
69 | + return $this->_get_event_admin_emails(FALSE); |
|
70 | 70 | break; |
71 | 71 | |
72 | 72 | case '[CO_FORMATTED_EMAIL]' : |
73 | 73 | case '[ESPRESSO_ADMIN_FORMATTED_EMAIL]' : |
74 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) . '>'; |
|
74 | + return EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.EE_Registry::instance()->CFG->organization->get_pretty('email').'>'; |
|
75 | 75 | break; |
76 | 76 | |
77 | 77 | case '[CO_EMAIL]' : |
78 | 78 | case '[ESPRESSO_ADMIN_EMAIL]' : |
79 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
79 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
80 | 80 | break; |
81 | 81 | |
82 | 82 | default : |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | |
101 | - private function _get_event_admin_emails( $fancy_headers = TRUE ) { |
|
101 | + private function _get_event_admin_emails($fancy_headers = TRUE) { |
|
102 | 102 | |
103 | - if ( !empty( $this->_data->admin_email ) ) { |
|
104 | - if ( ! $fancy_headers ) |
|
103 | + if ( ! empty($this->_data->admin_email)) { |
|
104 | + if ( ! $fancy_headers) |
|
105 | 105 | return $this->_data->admin_email; |
106 | - return !empty( $this->_data->fname ) ? $this->_data->fname . ' ' . $this->_data->lname . ' <' . $this->_data->admin_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $this->_data->admin_email . '>'; |
|
106 | + return ! empty($this->_data->fname) ? $this->_data->fname.' '.$this->_data->lname.' <'.$this->_data->admin_email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.$this->_data->admin_email.'>'; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | //k this shortcode has been used else where. Since we don't know what particular event this is for, let's loop through the events and get an array of event admins for the events. We'll return the formatted list of admin emails and let the messenger make sure we only pick one if this is for a field that can only have ONE!. |
@@ -111,18 +111,18 @@ discard block |
||
111 | 111 | $admin_email = array(); |
112 | 112 | |
113 | 113 | //loop through events and set the list of event_ids to retrieve so we can do ONE query. |
114 | - foreach ( $this->_data->events as $event ) { |
|
114 | + foreach ($this->_data->events as $event) { |
|
115 | 115 | $ids[] = $event['ID']; |
116 | 116 | } |
117 | 117 | |
118 | 118 | //get all the events |
119 | - $events = EE_Registry::instance()->load_model('Event')->get_all( array(array('EVT_ID' => array('IN', $ids ) ) ) ); |
|
119 | + $events = EE_Registry::instance()->load_model('Event')->get_all(array(array('EVT_ID' => array('IN', $ids)))); |
|
120 | 120 | |
121 | 121 | //now loop through each event and setup the details |
122 | 122 | $admin_details = array(); |
123 | 123 | $cnt = 0; |
124 | - foreach ( $events as $event ) { |
|
125 | - $user = get_userdata($event->get('EVT_wp_user') ); |
|
124 | + foreach ($events as $event) { |
|
125 | + $user = get_userdata($event->get('EVT_wp_user')); |
|
126 | 126 | $admin_details[$cnt] = new stdClass(); |
127 | 127 | $admin_details[$cnt]->email = $user->user_email; |
128 | 128 | $admin_details[$cnt]->first_name = $user->user_firstname; |
@@ -131,28 +131,28 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | //results? |
134 | - if ( empty($admin_details) || !is_array($admin_details) ) { |
|
134 | + if (empty($admin_details) || ! is_array($admin_details)) { |
|
135 | 135 | $msg[] = esc_html__('The admin details could not be retrieved from the database.', 'event_espresso'); |
136 | - $msg[] = sprintf( esc_html__('Query: %s', 'event_espresso'), $sql ); |
|
137 | - $msg[] = sprintf( esc_html__('Events Data: %s', 'event_espresso'), var_export($this->_data->events, TRUE) ); |
|
138 | - $msg[] = sprintf( esc_html__('Event IDS: %s', 'event_espresso'), var_export($ids, TRUE) ); |
|
139 | - $msg[] = sprintf( esc_html__('Query Results: %s', 'event_espresso'), var_export($admin_details) ); |
|
140 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, implode( PHP_EOL, $msg ), 'shortcode_parser' ); |
|
136 | + $msg[] = sprintf(esc_html__('Query: %s', 'event_espresso'), $sql); |
|
137 | + $msg[] = sprintf(esc_html__('Events Data: %s', 'event_espresso'), var_export($this->_data->events, TRUE)); |
|
138 | + $msg[] = sprintf(esc_html__('Event IDS: %s', 'event_espresso'), var_export($ids, TRUE)); |
|
139 | + $msg[] = sprintf(esc_html__('Query Results: %s', 'event_espresso'), var_export($admin_details)); |
|
140 | + do_action('AHEE_log', __FILE__, __FUNCTION__, implode(PHP_EOL, $msg), 'shortcode_parser'); |
|
141 | 141 | } |
142 | 142 | |
143 | - foreach ( $admin_details as $admin ) { |
|
143 | + foreach ($admin_details as $admin) { |
|
144 | 144 | //only add an admin email if it is present. |
145 | - if ( empty( $admin->email ) || $admin->email == '' ) continue; |
|
145 | + if (empty($admin->email) || $admin->email == '') continue; |
|
146 | 146 | |
147 | - if ( ! $fancy_headers ) { |
|
147 | + if ( ! $fancy_headers) { |
|
148 | 148 | $admin_email[] = $admin->email; |
149 | 149 | continue; |
150 | 150 | } |
151 | 151 | |
152 | - $admin_email[] = !empty( $admin->first_name ) ? $admin->first_name . ' ' . $admin->last_name . ' <' . $admin->email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $admin->email . '>'; |
|
152 | + $admin_email[] = ! empty($admin->first_name) ? $admin->first_name.' '.$admin->last_name.' <'.$admin->email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.$admin->email.'>'; |
|
153 | 153 | } |
154 | 154 | |
155 | - $admin_email = implode( ',', $admin_email ); |
|
155 | + $admin_email = implode(',', $admin_email); |
|
156 | 156 | return $admin_email; |
157 | 157 | } |
158 | 158 |
@@ -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 | break; |
125 | 125 | } |
@@ -1,7 +1,8 @@ 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 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -58,8 +59,9 @@ discard block |
||
58 | 59 | //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 | 60 | $event = $this->_data instanceof EE_Event ? $this->_data : NULL; |
60 | 61 | |
61 | - if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event ) |
|
62 | - return ''; |
|
62 | + if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event ) { |
|
63 | + return ''; |
|
64 | + } |
|
63 | 65 | |
64 | 66 | switch ( $shortcode ) { |
65 | 67 | case '[EVENT_AUTHOR_FNAME]' : |
@@ -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 | /** |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | |
49 | 49 | |
50 | 50 | |
51 | - protected function _parser( $shortcode ) { |
|
52 | - switch ( $shortcode ) { |
|
51 | + protected function _parser($shortcode) { |
|
52 | + switch ($shortcode) { |
|
53 | 53 | case '[EVENT_LIST]' : |
54 | 54 | return $this->_get_event_list(); |
55 | 55 | break; |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | $this->_set_shortcode_helper(); |
68 | 68 | |
69 | 69 | |
70 | - if ( $this->_data['data'] instanceof EE_Messages_Addressee ) |
|
70 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) |
|
71 | 71 | return $this->_get_event_list_for_main(); |
72 | 72 | |
73 | - else if ( $this->_data['data'] instanceof EE_Registration ) |
|
73 | + else if ($this->_data['data'] instanceof EE_Registration) |
|
74 | 74 | return $this->_get_event_list_for_registration(); |
75 | 75 | |
76 | 76 | //prevent recursive loop |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $events = ''; |
92 | 92 | |
93 | 93 | //now we need to loop through the events array in EE_Messages_Addressee and send data to the EE_Parser helper. |
94 | - foreach ( $data->events as $event ) { |
|
94 | + foreach ($data->events as $event) { |
|
95 | 95 | $events .= $this->_shortcode_helper->parse_event_list_template($template, $event['event'], $valid_shortcodes, $this->_extra_data); |
96 | 96 | } |
97 | 97 | return $events; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | private function _get_event_list_for_registration() { |
109 | 109 | $valid_shortcodes = array('event', 'ticket_list', 'datetime_list', 'attendee', 'event_author', 'recipient_details', 'recipient_list', 'venue'); |
110 | - $template = is_array( $this->_data['template'] ) && isset($this->_data['template']['event_list']) ? $this->_data['template']['event_list'] : $this->_extra_data['template']['event_list']; |
|
110 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['event_list']) ? $this->_data['template']['event_list'] : $this->_extra_data['template']['event_list']; |
|
111 | 111 | $registration = $this->_data['data']; |
112 | 112 | |
113 | 113 | //let's remove any existing [ATTENDEE_LIST] shortcode from the event list template so that we don't get recursion. |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | //we're NOT going to prepare a list of attendees this time around |
121 | 121 | $events = ''; |
122 | 122 | |
123 | - foreach ( (array) $all_events as $event ) { |
|
123 | + foreach ((array) $all_events as $event) { |
|
124 | 124 | $events .= $this->_shortcode_helper->parse_event_list_template($template, $event, $valid_shortcodes, $this->_extra_data); |
125 | 125 | } |
126 | 126 | |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | |
130 | 130 | |
131 | 131 | |
132 | - private function _get_events_from_registration( EE_Registration $registration ) { |
|
133 | - return isset( $this->_extra_data['data']->registrations ) ? array($this->_extra_data['data']->registrations[$registration->ID()]['evt_obj']) : array(); |
|
132 | + private function _get_events_from_registration(EE_Registration $registration) { |
|
133 | + return isset($this->_extra_data['data']->registrations) ? array($this->_extra_data['data']->registrations[$registration->ID()]['evt_obj']) : array(); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 |
@@ -1,7 +1,8 @@ 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 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -67,15 +68,16 @@ discard block |
||
67 | 68 | $this->_set_shortcode_helper(); |
68 | 69 | |
69 | 70 | |
70 | - if ( $this->_data['data'] instanceof EE_Messages_Addressee ) |
|
71 | - return $this->_get_event_list_for_main(); |
|
72 | - |
|
73 | - else if ( $this->_data['data'] instanceof EE_Registration ) |
|
74 | - return $this->_get_event_list_for_registration(); |
|
71 | + if ( $this->_data['data'] instanceof EE_Messages_Addressee ) { |
|
72 | + return $this->_get_event_list_for_main(); |
|
73 | + } else if ( $this->_data['data'] instanceof EE_Registration ) { |
|
74 | + return $this->_get_event_list_for_registration(); |
|
75 | + } |
|
75 | 76 | |
76 | 77 | //prevent recursive loop |
77 | - else |
|
78 | - return ''; |
|
78 | + else { |
|
79 | + return ''; |
|
80 | + } |
|
79 | 81 | } |
80 | 82 | |
81 | 83 |