@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * Class EE_Admin_File_Uploader_Display_Strategy |
|
4 | - * |
|
5 | - * @package Event Espresso |
|
6 | - * @subpackage core |
|
7 | - * @author Mike Nelson |
|
8 | - * @since 4.6 |
|
9 | - * |
|
10 | - */ |
|
3 | + * Class EE_Admin_File_Uploader_Display_Strategy |
|
4 | + * |
|
5 | + * @package Event Espresso |
|
6 | + * @subpackage core |
|
7 | + * @author Mike Nelson |
|
8 | + * @since 4.6 |
|
9 | + * |
|
10 | + */ |
|
11 | 11 | class EE_Admin_File_Uploader_Display_Strategy extends EE_Display_Strategy_Base{ |
12 | 12 | |
13 | 13 | /** |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Admin_File_Uploader_Display_Strategy extends EE_Display_Strategy_Base{ |
|
11 | +class EE_Admin_File_Uploader_Display_Strategy extends EE_Display_Strategy_Base { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * return EE_Admin_File_Uploader_Display_Strategy |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | * Besides that, no special consideration should be required to make the media uploader appear, besides having |
30 | 30 | * this input displayed. |
31 | 31 | */ |
32 | - static function enqueue_scripts(){ |
|
32 | + static function enqueue_scripts() { |
|
33 | 33 | wp_enqueue_media(); |
34 | 34 | wp_enqueue_script('media-upload'); |
35 | - wp_enqueue_script('ee-payments',EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js'); |
|
35 | + wp_enqueue_script('ee-payments', EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -42,18 +42,18 @@ discard block |
||
42 | 42 | * @return string of html to display the field |
43 | 43 | */ |
44 | 44 | |
45 | - function display(){ |
|
45 | + function display() { |
|
46 | 46 | // the actual input |
47 | 47 | $input = '<input type="text" size="34" '; |
48 | - $input .= 'name="' . $this->_input->html_name() . '" '; |
|
49 | - $input .= $this->_input->html_class() != '' ? 'class="large-text ee_media_url ' . $this->_input->html_class() . '" ' : 'class="large-text ee_media_url" '; |
|
50 | - $input .= 'value="' . $this->_input->raw_value_in_form() . '">'; |
|
48 | + $input .= 'name="'.$this->_input->html_name().'" '; |
|
49 | + $input .= $this->_input->html_class() != '' ? 'class="large-text ee_media_url '.$this->_input->html_class().'" ' : 'class="large-text ee_media_url" '; |
|
50 | + $input .= 'value="'.$this->_input->raw_value_in_form().'">'; |
|
51 | 51 | // image uploader |
52 | - $uploader = EEH_HTML::link( '#', '<img src="' . admin_url( 'images/media-button-image.gif' ) . '" >', __( 'click to add an image', 'event_espresso' ), '', 'ee_media_upload' ); |
|
52 | + $uploader = EEH_HTML::link('#', '<img src="'.admin_url('images/media-button-image.gif').'" >', __('click to add an image', 'event_espresso'), '', 'ee_media_upload'); |
|
53 | 53 | //only attempt to show the image if it at least exists |
54 | - $image = $this->src_exists( $this->_input->raw_value() ) ? EEH_HTML::br(2) . EEH_HTML::img( $this->_input->raw_value(), __( 'logo', 'event_espresso' ), '', 'ee_media_image' ) : ''; |
|
54 | + $image = $this->src_exists($this->_input->raw_value()) ? EEH_HTML::br(2).EEH_HTML::img($this->_input->raw_value(), __('logo', 'event_espresso'), '', 'ee_media_image') : ''; |
|
55 | 55 | // html string |
56 | - return EEH_HTML::div( $input . EEH_HTML::nbsp() . $uploader . $image, '', 'ee_media_uploader_area' ); |
|
56 | + return EEH_HTML::div($input.EEH_HTML::nbsp().$uploader.$image, '', 'ee_media_uploader_area'); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | * @param string $src |
65 | 65 | * @return boolean |
66 | 66 | */ |
67 | - protected function src_exists( $src ){ |
|
68 | - $results = wp_remote_head( $src ); |
|
69 | - if( is_array( $results) && ! $results instanceof WP_Error){ |
|
70 | - return strpos($results['headers']['content-type'], "image" ) !== FALSE; |
|
71 | - }else{ |
|
67 | + protected function src_exists($src) { |
|
68 | + $results = wp_remote_head($src); |
|
69 | + if (is_array($results) && ! $results instanceof WP_Error) { |
|
70 | + return strpos($results['headers']['content-type'], "image") !== FALSE; |
|
71 | + } else { |
|
72 | 72 | return FALSE; |
73 | 73 | } |
74 | 74 | } |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * EE_Template_Layout |
|
4 | - * |
|
5 | - * For very customized layouts, where you provide this class with the location of |
|
6 | - * a template file to use for laying out the form section. Inherits from EE_Div_per_Section |
|
7 | - * in case you call layout_input() or layout_subsection(), or get_html_for_label(), |
|
8 | - * get_html_for_input(), or get_html_for_errors() on one if the form section's inputs. |
|
9 | - * When would you want to use this instead of just laying out the form's subsections manually |
|
10 | - * in a template file? When you want a very customized layout, but that layout is essential |
|
11 | - * to the form; so that if you were to use the same form on two different pages (eg a contact form, |
|
12 | - * one on the website's frontend for contacting the site admin, and then again on the backend for |
|
13 | - * contacting the plugin's developer), you would still use this exact same template layout strategy. |
|
14 | - * (Eg, if you wanted to add a button to that same form for automatically adding "@gmail.com" or "@yahoo.com" |
|
15 | - * onto the 'from' input. The input is important to the form section on either page, but isn't an input so it's best |
|
16 | - * added as a part of the template layout.) |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage |
|
20 | - * @author Mike Nelson |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * EE_Template_Layout |
|
4 | + * |
|
5 | + * For very customized layouts, where you provide this class with the location of |
|
6 | + * a template file to use for laying out the form section. Inherits from EE_Div_per_Section |
|
7 | + * in case you call layout_input() or layout_subsection(), or get_html_for_label(), |
|
8 | + * get_html_for_input(), or get_html_for_errors() on one if the form section's inputs. |
|
9 | + * When would you want to use this instead of just laying out the form's subsections manually |
|
10 | + * in a template file? When you want a very customized layout, but that layout is essential |
|
11 | + * to the form; so that if you were to use the same form on two different pages (eg a contact form, |
|
12 | + * one on the website's frontend for contacting the site admin, and then again on the backend for |
|
13 | + * contacting the plugin's developer), you would still use this exact same template layout strategy. |
|
14 | + * (Eg, if you wanted to add a button to that same form for automatically adding "@gmail.com" or "@yahoo.com" |
|
15 | + * onto the 'from' input. The input is important to the form section on either page, but isn't an input so it's best |
|
16 | + * added as a part of the template layout.) |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage |
|
20 | + * @author Mike Nelson |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | class EE_Template_Layout extends EE_Div_Per_Section_Layout{ |
25 | 25 | |
26 | 26 | protected $_layout_template_file = NULL; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -class EE_Template_Layout extends EE_Div_Per_Section_Layout{ |
|
24 | +class EE_Template_Layout extends EE_Div_Per_Section_Layout { |
|
25 | 25 | |
26 | 26 | protected $_layout_template_file = NULL; |
27 | 27 | protected $_layout_begin_template_file = NULL; |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | * @type array $_template_args |
43 | 43 | * } |
44 | 44 | */ |
45 | - public function __construct( $template_options = array() ) { |
|
45 | + public function __construct($template_options = array()) { |
|
46 | 46 | // loop thru incoming options |
47 | - foreach( $template_options as $key => $value ) { |
|
47 | + foreach ($template_options as $key => $value) { |
|
48 | 48 | // add underscore to $key to match property names |
49 | - $_key = '_' . $key; |
|
50 | - if ( property_exists( $this, $_key )) { |
|
49 | + $_key = '_'.$key; |
|
50 | + if (property_exists($this, $_key)) { |
|
51 | 51 | $this->{$_key} = $value; |
52 | 52 | } |
53 | 53 | } |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | * @return string |
66 | 66 | */ |
67 | 67 | public function layout_form() { |
68 | - if ( $this->_layout_template_file ) { |
|
69 | - return EEH_Template::locate_template( $this->_layout_template_file, $this->template_args(), TRUE, TRUE ); |
|
68 | + if ($this->_layout_template_file) { |
|
69 | + return EEH_Template::locate_template($this->_layout_template_file, $this->template_args(), TRUE, TRUE); |
|
70 | 70 | } else { |
71 | 71 | return parent::layout_form(); |
72 | 72 | } |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return string |
80 | 80 | */ |
81 | 81 | public function layout_form_begin() { |
82 | - if($this->_layout_begin_template_file){ |
|
83 | - return EEH_Template::locate_template( $this->_layout_begin_template_file, $this->template_args(), TRUE, TRUE ); |
|
84 | - }else{ |
|
82 | + if ($this->_layout_begin_template_file) { |
|
83 | + return EEH_Template::locate_template($this->_layout_begin_template_file, $this->template_args(), TRUE, TRUE); |
|
84 | + } else { |
|
85 | 85 | return parent::layout_form_begin(); |
86 | 86 | } |
87 | 87 | } |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | * @param EE_Form_Input_Base $input |
95 | 95 | * @return string |
96 | 96 | */ |
97 | - public function layout_input( $input ) { |
|
98 | - if($this->_input_template_file){ |
|
99 | - return EEH_Template::locate_template( $this->_input_template_file, array( 'input' => $input ), TRUE, TRUE ); |
|
97 | + public function layout_input($input) { |
|
98 | + if ($this->_input_template_file) { |
|
99 | + return EEH_Template::locate_template($this->_input_template_file, array('input' => $input), TRUE, TRUE); |
|
100 | 100 | } |
101 | 101 | return parent::layout_input($input); |
102 | 102 | } |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | * @param EE_Form_Section_Proper $form_section |
110 | 110 | * @return string |
111 | 111 | */ |
112 | - public function layout_subsection( $form_section ) { |
|
113 | - if($this->_subsection_template_file){ |
|
114 | - return EEH_Template::locate_template( $this->_subsection_template_file, $this->template_args(), TRUE, TRUE ); |
|
112 | + public function layout_subsection($form_section) { |
|
113 | + if ($this->_subsection_template_file) { |
|
114 | + return EEH_Template::locate_template($this->_subsection_template_file, $this->template_args(), TRUE, TRUE); |
|
115 | 115 | } |
116 | - return parent::layout_subsection( $form_section ); |
|
116 | + return parent::layout_subsection($form_section); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | * @return string |
124 | 124 | */ |
125 | 125 | public function layout_form_end() { |
126 | - if($this->_layout_end_template_file){ |
|
127 | - return EEH_Template::locate_template( $this->_layout_end_template_file, $this->template_args(), TRUE, TRUE); |
|
128 | - }else{ |
|
126 | + if ($this->_layout_end_template_file) { |
|
127 | + return EEH_Template::locate_template($this->_layout_end_template_file, $this->template_args(), TRUE, TRUE); |
|
128 | + } else { |
|
129 | 129 | return parent::layout_form_end(); |
130 | 130 | } |
131 | 131 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | /** |
136 | 136 | * @param array $template_args |
137 | 137 | */ |
138 | - public function set_template_args( $template_args = array() ) { |
|
138 | + public function set_template_args($template_args = array()) { |
|
139 | 139 | $this->_template_args = $template_args; |
140 | 140 | } |
141 | 141 | |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | /** |
145 | 145 | * @param array $template_args |
146 | 146 | */ |
147 | - public function add_template_args( $template_args = array() ) { |
|
148 | - $this->_template_args = array_merge_recursive( $this->_template_args, $template_args ); |
|
147 | + public function add_template_args($template_args = array()) { |
|
148 | + $this->_template_args = array_merge_recursive($this->_template_args, $template_args); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | * @return array |
155 | 155 | */ |
156 | 156 | public function template_args() { |
157 | - foreach ( $this->form_section()->subsections() as $subsection_name => $subsection ) { |
|
158 | - $subsection_name = self::prep_form_subsection_key_name( $subsection_name ); |
|
159 | - if ( strpos( $subsection_name, '[' ) !== FALSE ) { |
|
160 | - $sub_name = explode( '[', $subsection_name ); |
|
161 | - $this->_template_args[ $sub_name[0] ][ rtrim( $sub_name[1], ']' ) ] = $this->layout_subsection( $subsection ); |
|
157 | + foreach ($this->form_section()->subsections() as $subsection_name => $subsection) { |
|
158 | + $subsection_name = self::prep_form_subsection_key_name($subsection_name); |
|
159 | + if (strpos($subsection_name, '[') !== FALSE) { |
|
160 | + $sub_name = explode('[', $subsection_name); |
|
161 | + $this->_template_args[$sub_name[0]][rtrim($sub_name[1], ']')] = $this->layout_subsection($subsection); |
|
162 | 162 | } else { |
163 | - $this->_template_args[ $subsection_name ] = $this->layout_subsection( $subsection ); |
|
163 | + $this->_template_args[$subsection_name] = $this->layout_subsection($subsection); |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | // d( $this->_template_args ); |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | * @param string $subsection_name |
177 | 177 | * @return string |
178 | 178 | */ |
179 | - public static function prep_form_subsection_key_name( $subsection_name = '' ) { |
|
180 | - $subsection_name = str_replace( array( '-', ' ' ), array( '', '_' ), $subsection_name ); |
|
181 | - return is_numeric( substr( $subsection_name, 0, 1 )) ? 'form_' . $subsection_name : $subsection_name; |
|
179 | + public static function prep_form_subsection_key_name($subsection_name = '') { |
|
180 | + $subsection_name = str_replace(array('-', ' '), array('', '_'), $subsection_name); |
|
181 | + return is_numeric(substr($subsection_name, 0, 1)) ? 'form_'.$subsection_name : $subsection_name; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | * @param string $subsection_name |
191 | 191 | * @return string |
192 | 192 | */ |
193 | - public static function get_subform_name( $subsection_name = '' ) { |
|
194 | - return EE_Template_Layout::prep_form_subsection_key_name( $subsection_name ); |
|
193 | + public static function get_subform_name($subsection_name = '') { |
|
194 | + return EE_Template_Layout::prep_form_subsection_key_name($subsection_name); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 |
@@ -11,25 +11,25 @@ discard block |
||
11 | 11 | final class EE_Registry { |
12 | 12 | |
13 | 13 | /** |
14 | - * EE_Registry Object |
|
15 | - * @var EE_Registry $_instance |
|
16 | - * @access private |
|
17 | - */ |
|
14 | + * EE_Registry Object |
|
15 | + * @var EE_Registry $_instance |
|
16 | + * @access private |
|
17 | + */ |
|
18 | 18 | private static $_instance = NULL; |
19 | 19 | |
20 | 20 | |
21 | 21 | /** |
22 | - * EE_Cart Object |
|
23 | - * @access public |
|
24 | - * @var EE_Cart $CART |
|
25 | - */ |
|
22 | + * EE_Cart Object |
|
23 | + * @access public |
|
24 | + * @var EE_Cart $CART |
|
25 | + */ |
|
26 | 26 | public $CART = NULL; |
27 | 27 | |
28 | 28 | /** |
29 | - * EE_Config Object |
|
30 | - * @access public |
|
31 | - * @var EE_Config $CFG |
|
32 | - */ |
|
29 | + * EE_Config Object |
|
30 | + * @access public |
|
31 | + * @var EE_Config $CFG |
|
32 | + */ |
|
33 | 33 | public $CFG = NULL; |
34 | 34 | |
35 | 35 | |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | |
45 | 45 | |
46 | 46 | /** |
47 | - * StdClass object for storing library classes in |
|
48 | - * @public LIB |
|
49 | - */ |
|
47 | + * StdClass object for storing library classes in |
|
48 | + * @public LIB |
|
49 | + */ |
|
50 | 50 | public $LIB = NULL; |
51 | 51 | |
52 | 52 | /** |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | public $REQ = NULL; |
58 | 58 | |
59 | 59 | /** |
60 | - * EE_Session Object |
|
61 | - * @access public |
|
62 | - * @var EE_Session $SSN |
|
63 | - */ |
|
60 | + * EE_Session Object |
|
61 | + * @access public |
|
62 | + * @var EE_Session $SSN |
|
63 | + */ |
|
64 | 64 | public $SSN = NULL; |
65 | 65 | |
66 | 66 | |
@@ -127,21 +127,21 @@ discard block |
||
127 | 127 | |
128 | 128 | |
129 | 129 | /** |
130 | - * $i18n_js_strings - internationalization for JS strings |
|
131 | - * usage: EE_Registry::i18n_js_strings['string_key'] = __( 'string to translate.', 'event_espresso' ); |
|
132 | - * in js file: var translatedString = eei18n.string_key; |
|
133 | - * |
|
134 | - * @access public |
|
135 | - * @var array |
|
136 | - */ |
|
130 | + * $i18n_js_strings - internationalization for JS strings |
|
131 | + * usage: EE_Registry::i18n_js_strings['string_key'] = __( 'string to translate.', 'event_espresso' ); |
|
132 | + * in js file: var translatedString = eei18n.string_key; |
|
133 | + * |
|
134 | + * @access public |
|
135 | + * @var array |
|
136 | + */ |
|
137 | 137 | public static $i18n_js_strings = array(); |
138 | 138 | |
139 | 139 | /** |
140 | - * $main_file - path to espresso.php |
|
141 | - * |
|
142 | - * @access public |
|
143 | - * @var array |
|
144 | - */ |
|
140 | + * $main_file - path to espresso.php |
|
141 | + * |
|
142 | + * @access public |
|
143 | + * @var array |
|
144 | + */ |
|
145 | 145 | public $main_file; |
146 | 146 | |
147 | 147 |
@@ -219,6 +219,7 @@ discard block |
||
219 | 219 | |
220 | 220 | /** |
221 | 221 | * @param mixed string | EED_Module $module |
222 | + * @param string $module |
|
222 | 223 | */ |
223 | 224 | public function add_module( $module ) { |
224 | 225 | if ( $module instanceof EED_Module ) { |
@@ -250,7 +251,7 @@ discard block |
||
250 | 251 | * @param string $class_name - simple class name ie: session |
251 | 252 | * @param mixed $arguments |
252 | 253 | * @param bool $load_only |
253 | - * @return mixed |
|
254 | + * @return boolean |
|
254 | 255 | */ |
255 | 256 | public function load_core ( $class_name, $arguments = array(), $load_only = FALSE ) { |
256 | 257 | $core_paths = apply_filters( |
@@ -274,7 +275,7 @@ discard block |
||
274 | 275 | * @access public |
275 | 276 | * @param string $class_name - class name for the DMS ie: EE_DMS_Core_4_2_0 |
276 | 277 | * @param mixed $arguments |
277 | - * @return EE_Data_Migration_Script_Base |
|
278 | + * @return boolean |
|
278 | 279 | */ |
279 | 280 | public function load_dms ( $class_name, $arguments = array() ) { |
280 | 281 | // retrieve instantiated class |
@@ -291,7 +292,7 @@ discard block |
||
291 | 292 | * @param bool $from_db - some classes are instantiated from the db and thus call a different method to instantiate |
292 | 293 | * @param bool $cache if you don't want the class to be stored in the internal cache (non-persistent) then set this to FALSE (ie. when instantiating model objects from client in a loop) |
293 | 294 | * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default) |
294 | - * @return EE_Base_Class |
|
295 | + * @return boolean |
|
295 | 296 | */ |
296 | 297 | public function load_class ( $class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) { |
297 | 298 | $paths = apply_filters('FHEE__EE_Registry__load_class__paths',array( |
@@ -312,7 +313,7 @@ discard block |
||
312 | 313 | * @param string $class_name - simple class name ie: price |
313 | 314 | * @param mixed $arguments |
314 | 315 | * @param bool $load_only |
315 | - * @return EEH_Base |
|
316 | + * @return boolean |
|
316 | 317 | */ |
317 | 318 | public function load_helper ( $class_name, $arguments = array(), $load_only = TRUE ) { |
318 | 319 | // todo: add doing_it_wrong() in a few versions after all addons have had calls to this method removed |
@@ -330,7 +331,7 @@ discard block |
||
330 | 331 | * @param string $class_name - simple class name ie: session |
331 | 332 | * @param mixed $arguments |
332 | 333 | * @param bool $load_only |
333 | - * @return mixed |
|
334 | + * @return boolean |
|
334 | 335 | */ |
335 | 336 | public function load_lib ( $class_name, $arguments = array(), $load_only = FALSE ) { |
336 | 337 | $paths = array( |
@@ -352,7 +353,7 @@ discard block |
||
352 | 353 | * @param string $class_name - simple class name ie: price |
353 | 354 | * @param mixed $arguments |
354 | 355 | * @param bool $load_only |
355 | - * @return EEM_Base |
|
356 | + * @return boolean |
|
356 | 357 | */ |
357 | 358 | public function load_model ( $class_name, $arguments = array(), $load_only = FALSE ) { |
358 | 359 | $paths = apply_filters('FHEE__EE_Registry__load_model__paths',array( |
@@ -371,7 +372,7 @@ discard block |
||
371 | 372 | * @param string $class_name - simple class name ie: price |
372 | 373 | * @param mixed $arguments |
373 | 374 | * @param bool $load_only |
374 | - * @return mixed |
|
375 | + * @return boolean |
|
375 | 376 | */ |
376 | 377 | public function load_model_class ( $class_name, $arguments = array(), $load_only = TRUE ) { |
377 | 378 | $paths = array( |
@@ -407,7 +408,7 @@ discard block |
||
407 | 408 | * @param string $type - file type - core? class? helper? model? |
408 | 409 | * @param mixed $arguments |
409 | 410 | * @param bool $load_only |
410 | - * @return mixed |
|
411 | + * @return boolean |
|
411 | 412 | */ |
412 | 413 | public function load_file ( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE ) { |
413 | 414 | // retrieve instantiated class |
@@ -424,7 +425,7 @@ discard block |
||
424 | 425 | * @param string $type - file type - core? class? helper? model? |
425 | 426 | * @param mixed $arguments |
426 | 427 | * @param bool $load_only |
427 | - * @return EE_Addon |
|
428 | + * @return boolean |
|
428 | 429 | */ |
429 | 430 | public function load_addon ( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE ) { |
430 | 431 | // retrieve instantiated class |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public static function instance() { |
158 | 158 | // check if class object is instantiated |
159 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Registry )) { |
|
159 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Registry)) { |
|
160 | 160 | self::$_instance = new self(); |
161 | 161 | } |
162 | 162 | return self::$_instance; |
@@ -171,14 +171,14 @@ discard block |
||
171 | 171 | * @return EE_Registry |
172 | 172 | */ |
173 | 173 | private function __construct() { |
174 | - $this->load_core( 'Base' ); |
|
174 | + $this->load_core('Base'); |
|
175 | 175 | // class library |
176 | 176 | $this->LIB = new StdClass(); |
177 | 177 | $this->addons = new StdClass(); |
178 | 178 | $this->modules = new StdClass(); |
179 | 179 | $this->shortcodes = new StdClass(); |
180 | 180 | $this->widgets = new StdClass(); |
181 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'init' )); |
|
181 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init')); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function init() { |
193 | 193 | // Get current page protocol |
194 | - $protocol = isset( $_SERVER['HTTPS'] ) ? 'https://' : 'http://'; |
|
194 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
195 | 195 | // Output admin-ajax.php URL with same protocol as current page |
196 | - self::$i18n_js_strings['ajax_url'] = admin_url( 'admin-ajax.php', $protocol ); |
|
197 | - self::$i18n_js_strings['wp_debug'] = defined( 'WP_DEBUG' ) ? WP_DEBUG : FALSE; |
|
196 | + self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol); |
|
197 | + self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : FALSE; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -205,14 +205,14 @@ discard block |
||
205 | 205 | * @return string |
206 | 206 | */ |
207 | 207 | public static function localize_i18n_js_strings() { |
208 | - $i18n_js_strings = (array)EE_Registry::$i18n_js_strings; |
|
209 | - foreach ( $i18n_js_strings as $key => $value ) { |
|
210 | - if ( is_scalar( $value ) ) { |
|
211 | - $i18n_js_strings[ $key ] = html_entity_decode( (string)$value, ENT_QUOTES, 'UTF-8' ); |
|
208 | + $i18n_js_strings = (array) EE_Registry::$i18n_js_strings; |
|
209 | + foreach ($i18n_js_strings as $key => $value) { |
|
210 | + if (is_scalar($value)) { |
|
211 | + $i18n_js_strings[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
215 | - return "/* <![CDATA[ */ var eei18n = " . wp_json_encode( $i18n_js_strings ) . '; /* ]]> */'; |
|
215 | + return "/* <![CDATA[ */ var eei18n = ".wp_json_encode($i18n_js_strings).'; /* ]]> */'; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -220,15 +220,15 @@ discard block |
||
220 | 220 | /** |
221 | 221 | * @param mixed string | EED_Module $module |
222 | 222 | */ |
223 | - public function add_module( $module ) { |
|
224 | - if ( $module instanceof EED_Module ) { |
|
225 | - $module_class = get_class( $module ); |
|
223 | + public function add_module($module) { |
|
224 | + if ($module instanceof EED_Module) { |
|
225 | + $module_class = get_class($module); |
|
226 | 226 | $this->modules->{$module_class} = $module; |
227 | 227 | } else { |
228 | - if ( ! class_exists( 'EE_Module_Request_Router' )) { |
|
229 | - $this->load_core( 'Module_Request_Router' ); |
|
228 | + if ( ! class_exists('EE_Module_Request_Router')) { |
|
229 | + $this->load_core('Module_Request_Router'); |
|
230 | 230 | } |
231 | - $this->modules->{$module} = EE_Module_Request_Router::module_factory( $module ); |
|
231 | + $this->modules->{$module} = EE_Module_Request_Router::module_factory($module); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | * @param string $module_name |
239 | 239 | * @return mixed EED_Module | NULL |
240 | 240 | */ |
241 | - public function get_module( $module_name = '' ) { |
|
242 | - return isset( $this->modules->{$module_name} ) ? $this->modules->{$module_name} : NULL; |
|
241 | + public function get_module($module_name = '') { |
|
242 | + return isset($this->modules->{$module_name} ) ? $this->modules->{$module_name} : NULL; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | |
@@ -252,18 +252,18 @@ discard block |
||
252 | 252 | * @param bool $load_only |
253 | 253 | * @return mixed |
254 | 254 | */ |
255 | - public function load_core ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
255 | + public function load_core($class_name, $arguments = array(), $load_only = FALSE) { |
|
256 | 256 | $core_paths = apply_filters( |
257 | 257 | 'FHEE__EE_Registry__load_core__core_paths', |
258 | 258 | array( |
259 | 259 | EE_CORE, |
260 | 260 | EE_ADMIN, |
261 | 261 | EE_CPTS, |
262 | - EE_CORE . 'data_migration_scripts' . DS |
|
262 | + EE_CORE.'data_migration_scripts'.DS |
|
263 | 263 | ) |
264 | 264 | ); |
265 | 265 | // retrieve instantiated class |
266 | - return $this->_load( $core_paths, 'EE_' , $class_name, 'core', $arguments, FALSE, TRUE, $load_only ); |
|
266 | + return $this->_load($core_paths, 'EE_', $class_name, 'core', $arguments, FALSE, TRUE, $load_only); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -276,9 +276,9 @@ discard block |
||
276 | 276 | * @param mixed $arguments |
277 | 277 | * @return EE_Data_Migration_Script_Base |
278 | 278 | */ |
279 | - public function load_dms ( $class_name, $arguments = array() ) { |
|
279 | + public function load_dms($class_name, $arguments = array()) { |
|
280 | 280 | // retrieve instantiated class |
281 | - return $this->_load( EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_' , $class_name, 'dms', $arguments, FALSE, FALSE, FALSE ); |
|
281 | + return $this->_load(EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, FALSE, FALSE, FALSE); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -293,14 +293,14 @@ discard block |
||
293 | 293 | * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default) |
294 | 294 | * @return EE_Base_Class |
295 | 295 | */ |
296 | - public function load_class ( $class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) { |
|
297 | - $paths = apply_filters('FHEE__EE_Registry__load_class__paths',array( |
|
296 | + public function load_class($class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE) { |
|
297 | + $paths = apply_filters('FHEE__EE_Registry__load_class__paths', array( |
|
298 | 298 | EE_CORE, |
299 | 299 | EE_CLASSES, |
300 | 300 | EE_BUSINESS |
301 | 301 | )); |
302 | 302 | // retrieve instantiated class |
303 | - return $this->_load( $paths, 'EE_' , $class_name, 'class', $arguments, $from_db, $cache, $load_only ); |
|
303 | + return $this->_load($paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -314,11 +314,11 @@ discard block |
||
314 | 314 | * @param bool $load_only |
315 | 315 | * @return EEH_Base |
316 | 316 | */ |
317 | - public function load_helper ( $class_name, $arguments = array(), $load_only = TRUE ) { |
|
317 | + public function load_helper($class_name, $arguments = array(), $load_only = TRUE) { |
|
318 | 318 | // todo: add doing_it_wrong() in a few versions after all addons have had calls to this method removed |
319 | - $helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS ) ); |
|
319 | + $helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS)); |
|
320 | 320 | // retrieve instantiated class |
321 | - return $this->_load( $helper_paths, 'EEH_', $class_name, 'helper', $arguments, FALSE, TRUE, $load_only ); |
|
321 | + return $this->_load($helper_paths, 'EEH_', $class_name, 'helper', $arguments, FALSE, TRUE, $load_only); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | |
@@ -332,16 +332,16 @@ discard block |
||
332 | 332 | * @param bool $load_only |
333 | 333 | * @return mixed |
334 | 334 | */ |
335 | - public function load_lib ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
335 | + public function load_lib($class_name, $arguments = array(), $load_only = FALSE) { |
|
336 | 336 | $paths = array( |
337 | 337 | EE_LIBRARIES, |
338 | - EE_LIBRARIES . 'messages' . DS, |
|
339 | - EE_LIBRARIES . 'shortcodes' . DS, |
|
340 | - EE_LIBRARIES . 'qtips' . DS, |
|
341 | - EE_LIBRARIES . 'payment_methods' . DS, |
|
338 | + EE_LIBRARIES.'messages'.DS, |
|
339 | + EE_LIBRARIES.'shortcodes'.DS, |
|
340 | + EE_LIBRARIES.'qtips'.DS, |
|
341 | + EE_LIBRARIES.'payment_methods'.DS, |
|
342 | 342 | ); |
343 | 343 | // retrieve instantiated class |
344 | - return $this->_load( $paths, 'EE_' , $class_name, 'lib', $arguments, FALSE, TRUE, $load_only ); |
|
344 | + return $this->_load($paths, 'EE_', $class_name, 'lib', $arguments, FALSE, TRUE, $load_only); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
@@ -354,13 +354,13 @@ discard block |
||
354 | 354 | * @param bool $load_only |
355 | 355 | * @return EEM_Base |
356 | 356 | */ |
357 | - public function load_model ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
358 | - $paths = apply_filters('FHEE__EE_Registry__load_model__paths',array( |
|
357 | + public function load_model($class_name, $arguments = array(), $load_only = FALSE) { |
|
358 | + $paths = apply_filters('FHEE__EE_Registry__load_model__paths', array( |
|
359 | 359 | EE_MODELS, |
360 | 360 | EE_CORE |
361 | 361 | )); |
362 | 362 | // retrieve instantiated class |
363 | - return $this->_load( $paths, 'EEM_' , $class_name, 'model', $arguments, FALSE, TRUE, $load_only ); |
|
363 | + return $this->_load($paths, 'EEM_', $class_name, 'model', $arguments, FALSE, TRUE, $load_only); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | |
@@ -373,15 +373,15 @@ discard block |
||
373 | 373 | * @param bool $load_only |
374 | 374 | * @return mixed |
375 | 375 | */ |
376 | - public function load_model_class ( $class_name, $arguments = array(), $load_only = TRUE ) { |
|
376 | + public function load_model_class($class_name, $arguments = array(), $load_only = TRUE) { |
|
377 | 377 | $paths = array( |
378 | - EE_MODELS . 'fields' . DS, |
|
379 | - EE_MODELS . 'helpers' . DS, |
|
380 | - EE_MODELS . 'relations' . DS, |
|
381 | - EE_MODELS . 'strategies' . DS |
|
378 | + EE_MODELS.'fields'.DS, |
|
379 | + EE_MODELS.'helpers'.DS, |
|
380 | + EE_MODELS.'relations'.DS, |
|
381 | + EE_MODELS.'strategies'.DS |
|
382 | 382 | ); |
383 | 383 | // retrieve instantiated class |
384 | - return $this->_load( $paths, 'EE_' , $class_name, '', $arguments, FALSE, TRUE, $load_only ); |
|
384 | + return $this->_load($paths, 'EE_', $class_name, '', $arguments, FALSE, TRUE, $load_only); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | |
@@ -393,8 +393,8 @@ discard block |
||
393 | 393 | * @param string $model_name like Event, Attendee, Question_Group_Question, etc. |
394 | 394 | * @return boolean |
395 | 395 | */ |
396 | - public function is_model_name( $model_name ){ |
|
397 | - return isset( $this->models[ $model_name ] ) ? TRUE : FALSE; |
|
396 | + public function is_model_name($model_name) { |
|
397 | + return isset($this->models[$model_name]) ? TRUE : FALSE; |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | |
@@ -409,9 +409,9 @@ discard block |
||
409 | 409 | * @param bool $load_only |
410 | 410 | * @return mixed |
411 | 411 | */ |
412 | - public function load_file ( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE ) { |
|
412 | + public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE) { |
|
413 | 413 | // retrieve instantiated class |
414 | - return $this->_load( $path_to_file, '', $file_name, $type, $arguments, FALSE, TRUE, $load_only ); |
|
414 | + return $this->_load($path_to_file, '', $file_name, $type, $arguments, FALSE, TRUE, $load_only); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | |
@@ -426,9 +426,9 @@ discard block |
||
426 | 426 | * @param bool $load_only |
427 | 427 | * @return EE_Addon |
428 | 428 | */ |
429 | - public function load_addon ( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE ) { |
|
429 | + public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE) { |
|
430 | 430 | // retrieve instantiated class |
431 | - return $this->_load( $path_to_file, 'addon', $class_name, $type, $arguments, FALSE, TRUE, $load_only ); |
|
431 | + return $this->_load($path_to_file, 'addon', $class_name, $type, $arguments, FALSE, TRUE, $load_only); |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | |
@@ -446,15 +446,15 @@ discard block |
||
446 | 446 | * @internal param string $file_path - file path including file name |
447 | 447 | * @return bool | object |
448 | 448 | */ |
449 | - private function _load ( $file_paths = array(), $class_prefix = 'EE_', $class_name = FALSE, $type = 'class', $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) { |
|
449 | + private function _load($file_paths = array(), $class_prefix = 'EE_', $class_name = FALSE, $type = 'class', $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE) { |
|
450 | 450 | // strip php file extension |
451 | - $class_name = str_replace( '.php', '', trim( $class_name )); |
|
451 | + $class_name = str_replace('.php', '', trim($class_name)); |
|
452 | 452 | // does the class have a prefix ? |
453 | - if ( ! empty( $class_prefix ) && $class_prefix != 'addon' ) { |
|
453 | + if ( ! empty($class_prefix) && $class_prefix != 'addon') { |
|
454 | 454 | // make sure $class_prefix is uppercase |
455 | - $class_prefix = strtoupper( trim( $class_prefix )); |
|
455 | + $class_prefix = strtoupper(trim($class_prefix)); |
|
456 | 456 | // add class prefix ONCE!!! |
457 | - $class_name = $class_prefix . str_replace( $class_prefix, '', $class_name ); |
|
457 | + $class_name = $class_prefix.str_replace($class_prefix, '', $class_name); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | $class_abbreviations = array( |
@@ -466,61 +466,61 @@ discard block |
||
466 | 466 | 'EE_Capabilities' => 'CAP' |
467 | 467 | ); |
468 | 468 | |
469 | - $class_abbreviation = isset( $class_abbreviations[ $class_name ] ) |
|
470 | - ? $class_abbreviations[ $class_name ] |
|
469 | + $class_abbreviation = isset($class_abbreviations[$class_name]) |
|
470 | + ? $class_abbreviations[$class_name] |
|
471 | 471 | : ''; |
472 | 472 | // check if class has already been loaded, and return it if it has been |
473 | - if ( $class_abbreviation !== '' && ! is_null( $this->{$class_abbreviation} ) |
|
473 | + if ($class_abbreviation !== '' && ! is_null($this->{$class_abbreviation} ) |
|
474 | 474 | ) { |
475 | 475 | return $this->{$class_abbreviation}; |
476 | - } else if ( isset ( $this->{$class_name} ) ) { |
|
476 | + } else if (isset ($this->{$class_name} )) { |
|
477 | 477 | return $this->{$class_name}; |
478 | - } else if ( isset ( $this->LIB->{$class_name} ) ) { |
|
478 | + } else if (isset ($this->LIB->{$class_name} )) { |
|
479 | 479 | return $this->LIB->{$class_name}; |
480 | - } else if ( $class_prefix == 'addon' && isset ( $this->addons->{$class_name} ) ) { |
|
480 | + } else if ($class_prefix == 'addon' && isset ($this->addons->{$class_name} )) { |
|
481 | 481 | return $this->addons->{$class_name}; |
482 | 482 | } |
483 | 483 | |
484 | 484 | // assume all paths lead nowhere |
485 | 485 | $path = FALSE; |
486 | 486 | // make sure $file_paths is an array |
487 | - $file_paths = is_array( $file_paths ) ? $file_paths : array( $file_paths ); |
|
487 | + $file_paths = is_array($file_paths) ? $file_paths : array($file_paths); |
|
488 | 488 | // cycle thru paths |
489 | - foreach ( $file_paths as $key => $file_path ) { |
|
489 | + foreach ($file_paths as $key => $file_path) { |
|
490 | 490 | // convert all separators to proper DS, if no filepath, then use EE_CLASSES |
491 | - $file_path = $file_path ? str_replace( array( '/', '\\' ), DS, $file_path ) : EE_CLASSES; |
|
491 | + $file_path = $file_path ? str_replace(array('/', '\\'), DS, $file_path) : EE_CLASSES; |
|
492 | 492 | // prep file type |
493 | - $type = ! empty( $type ) ? trim( $type, '.' ) . '.' : ''; |
|
493 | + $type = ! empty($type) ? trim($type, '.').'.' : ''; |
|
494 | 494 | // build full file path |
495 | - $file_paths[ $key ] = rtrim( $file_path, DS ) . DS . $class_name . '.' . $type . 'php'; |
|
495 | + $file_paths[$key] = rtrim($file_path, DS).DS.$class_name.'.'.$type.'php'; |
|
496 | 496 | //does the file exist and can be read ? |
497 | - if ( is_readable( $file_paths[ $key ] )) { |
|
498 | - $path = $file_paths[ $key ]; |
|
497 | + if (is_readable($file_paths[$key])) { |
|
498 | + $path = $file_paths[$key]; |
|
499 | 499 | break; |
500 | 500 | } |
501 | 501 | } |
502 | 502 | // don't give up! you gotta... |
503 | 503 | try { |
504 | 504 | //does the file exist and can it be read ? |
505 | - if ( ! $path ) { |
|
505 | + if ( ! $path) { |
|
506 | 506 | // so sorry, can't find the file |
507 | - throw new EE_Error ( |
|
508 | - sprintf ( |
|
509 | - __('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s','event_espresso'), |
|
510 | - trim( $type, '.' ), |
|
507 | + throw new EE_Error( |
|
508 | + sprintf( |
|
509 | + __('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso'), |
|
510 | + trim($type, '.'), |
|
511 | 511 | $class_name, |
512 | - '<br />' . implode( ',<br />', $file_paths ) |
|
512 | + '<br />'.implode(',<br />', $file_paths) |
|
513 | 513 | ) |
514 | 514 | ); |
515 | 515 | } |
516 | 516 | // get the file |
517 | - require_once( $path ); |
|
517 | + require_once($path); |
|
518 | 518 | // if the class isn't already declared somewhere |
519 | - if ( class_exists( $class_name, FALSE ) === FALSE ) { |
|
519 | + if (class_exists($class_name, FALSE) === FALSE) { |
|
520 | 520 | // so sorry, not a class |
521 | 521 | throw new EE_Error( |
522 | 522 | sprintf( |
523 | - __('The %s file %s does not appear to contain the %s Class.','event_espresso'), |
|
523 | + __('The %s file %s does not appear to contain the %s Class.', 'event_espresso'), |
|
524 | 524 | $type, |
525 | 525 | $path, |
526 | 526 | $class_name |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | ); |
529 | 529 | } |
530 | 530 | |
531 | - } catch ( EE_Error $e ) { |
|
531 | + } catch (EE_Error $e) { |
|
532 | 532 | $e->get_error(); |
533 | 533 | } |
534 | 534 | |
@@ -536,38 +536,38 @@ discard block |
||
536 | 536 | // don't give up! you gotta... |
537 | 537 | try { |
538 | 538 | // create reflection |
539 | - $reflector = new ReflectionClass( $class_name ); |
|
539 | + $reflector = new ReflectionClass($class_name); |
|
540 | 540 | // instantiate the class and add to the LIB array for tracking |
541 | 541 | // EE_Base_Classes are instantiated via new_instance by default (models call them via new_instance_from_db) |
542 | - if ( $reflector->getConstructor() === NULL || $reflector->isAbstract() || $load_only ) { |
|
542 | + if ($reflector->getConstructor() === NULL || $reflector->isAbstract() || $load_only) { |
|
543 | 543 | // $instantiation_mode = 0; |
544 | 544 | // no constructor = static methods only... nothing to instantiate, loading file was enough |
545 | 545 | return TRUE; |
546 | - } else if ( $from_db && method_exists( $class_name, 'new_instance_from_db' ) ) { |
|
546 | + } else if ($from_db && method_exists($class_name, 'new_instance_from_db')) { |
|
547 | 547 | // $instantiation_mode = 1; |
548 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance_from_db' ), $arguments ); |
|
549 | - } else if ( method_exists( $class_name, 'new_instance' ) ) { |
|
548 | + $class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments); |
|
549 | + } else if (method_exists($class_name, 'new_instance')) { |
|
550 | 550 | // $instantiation_mode = 2; |
551 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance' ), $arguments ); |
|
552 | - } else if ( method_exists( $class_name, 'instance' )) { |
|
551 | + $class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments); |
|
552 | + } else if (method_exists($class_name, 'instance')) { |
|
553 | 553 | // $instantiation_mode = 3; |
554 | - $class_obj = call_user_func_array( array( $class_name, 'instance' ), $arguments ); |
|
555 | - } else if ( $reflector->isInstantiable() ) { |
|
554 | + $class_obj = call_user_func_array(array($class_name, 'instance'), $arguments); |
|
555 | + } else if ($reflector->isInstantiable()) { |
|
556 | 556 | // $instantiation_mode = 4; |
557 | - $class_obj = $reflector->newInstance( $arguments ); |
|
558 | - } else if ( ! $load_only ) { |
|
557 | + $class_obj = $reflector->newInstance($arguments); |
|
558 | + } else if ( ! $load_only) { |
|
559 | 559 | // heh ? something's not right ! |
560 | 560 | // $instantiation_mode = 5; |
561 | 561 | throw new EE_Error( |
562 | 562 | sprintf( |
563 | - __('The %s file %s could not be instantiated.','event_espresso'), |
|
563 | + __('The %s file %s could not be instantiated.', 'event_espresso'), |
|
564 | 564 | $type, |
565 | 565 | $class_name |
566 | 566 | ) |
567 | 567 | ); |
568 | 568 | } |
569 | 569 | |
570 | - } catch ( EE_Error $e ) { |
|
570 | + } catch (EE_Error $e) { |
|
571 | 571 | $e->get_error(); |
572 | 572 | } |
573 | 573 | |
@@ -579,15 +579,15 @@ discard block |
||
579 | 579 | // EEH_Debug_Tools::printr( $class_obj, '$class_obj <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
580 | 580 | |
581 | 581 | |
582 | - if ( isset( $class_obj )) { |
|
582 | + if (isset($class_obj)) { |
|
583 | 583 | // return newly instantiated class |
584 | - if ( $class_abbreviation !== '' ) { |
|
584 | + if ($class_abbreviation !== '') { |
|
585 | 585 | $this->{$class_abbreviation} = $class_obj; |
586 | - } else if ( EEH_Class_Tools::has_property( $this, $class_name )) { |
|
586 | + } else if (EEH_Class_Tools::has_property($this, $class_name)) { |
|
587 | 587 | $this->{$class_name} = $class_obj; |
588 | - } else if ( $class_prefix == 'addon' && $cache ) { |
|
588 | + } else if ($class_prefix == 'addon' && $cache) { |
|
589 | 589 | $this->addons->{$class_name} = $class_obj; |
590 | - } else if ( !$from_db && $cache ) { |
|
590 | + } else if ( ! $from_db && $cache) { |
|
591 | 591 | $this->LIB->{$class_name} = $class_obj; |
592 | 592 | } |
593 | 593 | return $class_obj; |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | * @param $a |
612 | 612 | * @param $b |
613 | 613 | */ |
614 | - final function __call($a,$b) {} |
|
614 | + final function __call($a, $b) {} |
|
615 | 615 | |
616 | 616 | |
617 | 617 | |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | * @param $a |
627 | 627 | * @param $b |
628 | 628 | */ |
629 | - final function __set($a,$b) {} |
|
629 | + final function __set($a, $b) {} |
|
630 | 630 | |
631 | 631 | |
632 | 632 | |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | * @param $a |
667 | 667 | * @param $b |
668 | 668 | */ |
669 | - final static function __callStatic($a,$b) {} |
|
669 | + final static function __callStatic($a, $b) {} |
|
670 | 670 | |
671 | 671 | /** |
672 | 672 | * Gets the addon by its name/slug (not classname. For that, just |
@@ -674,9 +674,9 @@ discard block |
||
674 | 674 | * @param string $name |
675 | 675 | * @return EE_Addon |
676 | 676 | */ |
677 | - public function get_addon_by_name( $name ){ |
|
678 | - foreach($this->addons as $addon){ |
|
679 | - if( $addon->name() == $name){ |
|
677 | + public function get_addon_by_name($name) { |
|
678 | + foreach ($this->addons as $addon) { |
|
679 | + if ($addon->name() == $name) { |
|
680 | 680 | return $addon; |
681 | 681 | } |
682 | 682 | } |
@@ -687,10 +687,10 @@ discard block |
||
687 | 687 | * |
688 | 688 | * @return EE_Addon[] where the KEYS are the addon's name() |
689 | 689 | */ |
690 | - public function get_addons_by_name(){ |
|
690 | + public function get_addons_by_name() { |
|
691 | 691 | $addons = array(); |
692 | - foreach($this->addons as $addon){ |
|
693 | - $addons[ $addon->name() ] = $addon; |
|
692 | + foreach ($this->addons as $addon) { |
|
693 | + $addons[$addon->name()] = $addon; |
|
694 | 694 | } |
695 | 695 | return $addons; |
696 | 696 | } |
@@ -705,14 +705,14 @@ discard block |
||
705 | 705 | * @return EEM_Base |
706 | 706 | * @throws EE_Error |
707 | 707 | */ |
708 | - public function reset_model( $model_name ){ |
|
709 | - $model = $this->load_model( $model_name ); |
|
710 | - $model_class_name = get_class( $model ); |
|
708 | + public function reset_model($model_name) { |
|
709 | + $model = $this->load_model($model_name); |
|
710 | + $model_class_name = get_class($model); |
|
711 | 711 | //get that model reset it and make sure we nuke the old reference to it |
712 | - if ( $model instanceof $model_class_name && is_callable( array( $model_class_name, 'reset' ))) { |
|
712 | + if ($model instanceof $model_class_name && is_callable(array($model_class_name, 'reset'))) { |
|
713 | 713 | $this->LIB->{$model_class_name} = $model::reset(); |
714 | - }else{ |
|
715 | - throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) ); |
|
714 | + } else { |
|
715 | + throw new EE_Error(sprintf(__('Model %s does not have a method "reset"', 'event_espresso'), $model_name)); |
|
716 | 716 | } |
717 | 717 | return $this->LIB->{$model_class_name}; |
718 | 718 | } |
@@ -728,14 +728,14 @@ discard block |
||
728 | 728 | * currently reinstantiate the singletons at the moment) |
729 | 729 | * @return EE_Registry |
730 | 730 | */ |
731 | - public static function reset( $hard = FALSE, $reinstantiate = TRUE ){ |
|
731 | + public static function reset($hard = FALSE, $reinstantiate = TRUE) { |
|
732 | 732 | $instance = self::instance(); |
733 | 733 | EEH_Activation::reset(); |
734 | - $instance->CFG = EE_Config::reset( $hard, $reinstantiate ); |
|
734 | + $instance->CFG = EE_Config::reset($hard, $reinstantiate); |
|
735 | 735 | $instance->LIB->EE_Data_Migration_Manager = EE_Data_Migration_Manager::reset(); |
736 | 736 | $instance->LIB = new stdClass(); |
737 | - foreach( array_keys( $instance->non_abstract_db_models ) as $model_name ){ |
|
738 | - $instance->reset_model( $model_name ); |
|
737 | + foreach (array_keys($instance->non_abstract_db_models) as $model_name) { |
|
738 | + $instance->reset_model($model_name); |
|
739 | 739 | } |
740 | 740 | return $instance; |
741 | 741 | } |
@@ -746,9 +746,9 @@ discard block |
||
746 | 746 | */ |
747 | 747 | public function cpt_models() { |
748 | 748 | $cpt_models = array(); |
749 | - foreach( $this->non_abstract_db_models as $shortname => $classname ) { |
|
750 | - if( is_subclass_of( $classname, 'EEM_CPT_Base' ) ) { |
|
751 | - $cpt_models[ $shortname ] = $classname; |
|
749 | + foreach ($this->non_abstract_db_models as $shortname => $classname) { |
|
750 | + if (is_subclass_of($classname, 'EEM_CPT_Base')) { |
|
751 | + $cpt_models[$shortname] = $classname; |
|
752 | 752 | } |
753 | 753 | } |
754 | 754 | return $cpt_models; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return string |
141 | 141 | */ |
142 | 142 | function column_TXN_ID( EE_Transaction $item ){ |
143 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
143 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
144 | 144 | $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
145 | 145 | |
146 | 146 | //txn timestamp |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | * @param \EE_Transaction $item |
284 | 284 | * @return string|void |
285 | 285 | */ |
286 | - function column_event_name( EE_Transaction $item ){ |
|
287 | - $actions = array(); |
|
286 | + function column_event_name( EE_Transaction $item ){ |
|
287 | + $actions = array(); |
|
288 | 288 | $event = $item->primary_registration()->get_first_related('Event'); |
289 | 289 | if ( !empty( $event ) ) { |
290 | 290 | $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
@@ -308,13 +308,13 @@ discard block |
||
308 | 308 | * @param \EE_Transaction $item |
309 | 309 | * @return string |
310 | 310 | */ |
311 | - function column_actions( EE_Transaction $item ){ |
|
311 | + function column_actions( EE_Transaction $item ){ |
|
312 | 312 | |
313 | - $registration = $item->primary_registration(); |
|
314 | - $attendee = $registration->attendee(); |
|
313 | + $registration = $item->primary_registration(); |
|
314 | + $attendee = $registration->attendee(); |
|
315 | 315 | EE_Registry::instance()->load_helper( 'MSG_Template' ); |
316 | 316 | |
317 | - //Build row actions |
|
317 | + //Build row actions |
|
318 | 318 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
319 | 319 | $dl_invoice_lnk_url = $registration->invoice_url(); |
320 | 320 | $dl_receipt_lnk_url = $registration->receipt_url(); |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | $dl_receipt_lnk = ''; |
355 | 355 | } |
356 | 356 | |
357 | - //only show payment reminder link if the message type is active. |
|
358 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
357 | + //only show payment reminder link if the message type is active. |
|
358 | + if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
359 | 359 | $send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? ' |
360 | 360 | <li> |
361 | 361 | <a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text"> |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | </li>' : ''; |
376 | 376 | |
377 | 377 | return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
378 | - } |
|
378 | + } |
|
379 | 379 | |
380 | 380 | |
381 | 381 | } |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | * @param \EE_Admin_Page $admin_page |
34 | 34 | * @return EE_Admin_Transactions_List_Table |
35 | 35 | */ |
36 | - function __construct( EE_Admin_Page $admin_page ){ |
|
37 | - parent::__construct( $admin_page ); |
|
36 | + function __construct(EE_Admin_Page $admin_page) { |
|
37 | + parent::__construct($admin_page); |
|
38 | 38 | $this->_status = $this->_admin_page->get_transaction_status_array(); |
39 | 39 | |
40 | 40 | } |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | |
45 | 45 | |
46 | 46 | protected function _setup_data() { |
47 | - $this->_data = $this->_admin_page->get_transactions( $this->_per_page ); |
|
48 | - $status = ! empty( $this->_req_data['status'] )? $this->_req_data['status'] : 'all'; |
|
49 | - $this->_all_data_count = $this->_admin_page->get_transactions( $this->_per_page, TRUE, $status ); |
|
47 | + $this->_data = $this->_admin_page->get_transactions($this->_per_page); |
|
48 | + $status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all'; |
|
49 | + $this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, TRUE, $status); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -65,20 +65,20 @@ discard block |
||
65 | 65 | ); |
66 | 66 | |
67 | 67 | $this->_columns = array( |
68 | - 'TXN_ID' => __( 'ID', 'event_espresso' ), |
|
69 | - 'TXN_timestamp' => __( 'Transaction Date', 'event_espresso' ), |
|
70 | - 'TXN_total' => __( 'Total', 'event_espresso' ), |
|
71 | - 'TXN_paid' => __( 'Paid', 'event_espresso' ), |
|
72 | - 'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ), |
|
73 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
74 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
68 | + 'TXN_ID' => __('ID', 'event_espresso'), |
|
69 | + 'TXN_timestamp' => __('Transaction Date', 'event_espresso'), |
|
70 | + 'TXN_total' => __('Total', 'event_espresso'), |
|
71 | + 'TXN_paid' => __('Paid', 'event_espresso'), |
|
72 | + 'ATT_fname' => __('Primary Registrant', 'event_espresso'), |
|
73 | + 'event_name' => __('Event', 'event_espresso'), |
|
74 | + 'actions' => __('Actions', 'event_espresso') |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | $this->_sortable_columns = array( |
78 | - 'TXN_ID' => array( 'TXN_ID' => FALSE ), |
|
79 | - 'event_name' => array( 'event_name'=> FALSE ), |
|
80 | - 'ATT_fname' => array( 'ATT_fname'=> FALSE ), |
|
81 | - 'TXN_timestamp' => array( 'TXN_timestamp'=> TRUE ) //true means its already sorted |
|
78 | + 'TXN_ID' => array('TXN_ID' => FALSE), |
|
79 | + 'event_name' => array('event_name'=> FALSE), |
|
80 | + 'ATT_fname' => array('ATT_fname'=> FALSE), |
|
81 | + 'TXN_timestamp' => array('TXN_timestamp'=> TRUE) //true means its already sorted |
|
82 | 82 | ); |
83 | 83 | |
84 | 84 | $this->_primary_column = 'TXN_ID'; |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | |
89 | 89 | |
90 | 90 | |
91 | - protected function _get_row_class( $item ) { |
|
92 | - $class = parent::_get_row_class( $item ); |
|
91 | + protected function _get_row_class($item) { |
|
92 | + $class = parent::_get_row_class($item); |
|
93 | 93 | //add status class |
94 | - $class .= ' ee-status-strip txn-status-' . $item->status_ID(); |
|
95 | - if ( $this->_has_checkbox_column ) { |
|
94 | + $class .= ' ee-status-strip txn-status-'.$item->status_ID(); |
|
95 | + if ($this->_has_checkbox_column) { |
|
96 | 96 | $class .= ' has-checkbox-column'; |
97 | 97 | } |
98 | 98 | return $class; |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | */ |
110 | 110 | protected function _get_table_filters() { |
111 | 111 | $filters = array(); |
112 | - $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' )); |
|
113 | - $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' ); |
|
112 | + $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year')); |
|
113 | + $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y'); |
|
114 | 114 | ob_start(); |
115 | 115 | ?> |
116 | 116 | <label for="txn-filter-start-date">Display Transactions from </label> |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | |
129 | 129 | |
130 | 130 | protected function _add_view_counts() { |
131 | - $this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' ); |
|
132 | - $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' ); |
|
133 | - $this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' ); |
|
131 | + $this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all'); |
|
132 | + $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned'); |
|
133 | + $this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed'); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
@@ -139,29 +139,29 @@ discard block |
||
139 | 139 | * @param \EE_Transaction $item |
140 | 140 | * @return string |
141 | 141 | */ |
142 | - function column_TXN_ID( EE_Transaction $item ){ |
|
143 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
144 | - $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
|
142 | + function column_TXN_ID(EE_Transaction $item) { |
|
143 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
144 | + $content = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>'; |
|
145 | 145 | |
146 | 146 | //txn timestamp |
147 | - $content .= ' <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp( $item ) . '</span>'; |
|
147 | + $content .= ' <span class="show-on-mobile-view-only">'.$this->_get_txn_timestamp($item).'</span>'; |
|
148 | 148 | return $content; |
149 | 149 | } |
150 | 150 | |
151 | 151 | |
152 | 152 | |
153 | - protected function _get_txn_timestamp( EE_Transaction $item ) { |
|
153 | + protected function _get_txn_timestamp(EE_Transaction $item) { |
|
154 | 154 | //txn timestamp |
155 | 155 | // is TXN less than 2 hours old ? |
156 | 156 | if ( |
157 | - ( ( time() - EE_Registry::instance()->SSN->lifespan() ) |
|
158 | - < $item->datetime( false, true ) |
|
157 | + ((time() - EE_Registry::instance()->SSN->lifespan()) |
|
158 | + < $item->datetime(false, true) |
|
159 | 159 | ) |
160 | - && ( $item->failed() || $item->is_abandoned() ) |
|
160 | + && ($item->failed() || $item->is_abandoned()) |
|
161 | 161 | ) { |
162 | - $timestamp = __( 'TXN in progress...', 'event_espresso' ); |
|
162 | + $timestamp = __('TXN in progress...', 'event_espresso'); |
|
163 | 163 | } else { |
164 | - $timestamp = $item->get_i18n_datetime( 'TXN_timestamp' ); |
|
164 | + $timestamp = $item->get_i18n_datetime('TXN_timestamp'); |
|
165 | 165 | } |
166 | 166 | return $timestamp; |
167 | 167 | } |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @param \EE_Transaction $item |
174 | 174 | * @return string |
175 | 175 | */ |
176 | - function column_cb($item ){ |
|
177 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
176 | + function column_cb($item) { |
|
177 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | * @param \EE_Transaction $item |
186 | 186 | * @return string |
187 | 187 | */ |
188 | - function column_TXN_timestamp( EE_Transaction $item ){ |
|
189 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
190 | - $txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $this->_get_txn_timestamp( $item ) . '</a>'; |
|
188 | + function column_TXN_timestamp(EE_Transaction $item) { |
|
189 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
190 | + $txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$this->_get_txn_timestamp($item).'</a>'; |
|
191 | 191 | //status |
192 | - $txn_date .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
192 | + $txn_date .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
193 | 193 | return $txn_date; |
194 | 194 | } |
195 | 195 | |
@@ -199,11 +199,11 @@ discard block |
||
199 | 199 | * @param \EE_Transaction $item |
200 | 200 | * @return string |
201 | 201 | */ |
202 | - function column_TXN_total( EE_Transaction $item ){ |
|
203 | - if ( $item->get('TXN_total') > 0 ) { |
|
204 | - return '<span class="txn-pad-rght">' . apply_filters( 'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item ) . '</span>'; |
|
202 | + function column_TXN_total(EE_Transaction $item) { |
|
203 | + if ($item->get('TXN_total') > 0) { |
|
204 | + return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item).'</span>'; |
|
205 | 205 | } else { |
206 | - return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
206 | + return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>'; |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -213,19 +213,19 @@ discard block |
||
213 | 213 | * @param \EE_Transaction $item |
214 | 214 | * @return mixed|string |
215 | 215 | */ |
216 | - function column_TXN_paid( EE_Transaction $item ){ |
|
216 | + function column_TXN_paid(EE_Transaction $item) { |
|
217 | 217 | $transaction_total = $item->get('TXN_total'); |
218 | 218 | $transaction_paid = $item->get('TXN_paid'); |
219 | 219 | |
220 | - if (( $transaction_total > 0 ) && ( $transaction_paid >= $transaction_total )) { |
|
220 | + if (($transaction_total > 0) && ($transaction_paid >= $transaction_total)) { |
|
221 | 221 | // paid in full |
222 | 222 | $span_class = 'txn-overview-full-payment-spn'; |
223 | 223 | |
224 | - } elseif (( $transaction_total > 0 ) && ( $transaction_paid > 0 )) { |
|
224 | + } elseif (($transaction_total > 0) && ($transaction_paid > 0)) { |
|
225 | 225 | // monies owing |
226 | 226 | $span_class = 'txn-overview-part-payment-spn'; |
227 | 227 | |
228 | - } elseif (( $transaction_total > 0 ) && ( $transaction_paid == 0 )) { |
|
228 | + } elseif (($transaction_total > 0) && ($transaction_paid == 0)) { |
|
229 | 229 | // no payments made |
230 | 230 | $span_class = 'txn-overview-no-payment-spn'; |
231 | 231 | |
@@ -235,11 +235,11 @@ discard block |
||
235 | 235 | } |
236 | 236 | |
237 | 237 | $payment_method = $item->payment_method(); |
238 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
238 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
239 | 239 | |
240 | - $content = '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>'; |
|
241 | - if ( $transaction_paid > 0 ) { |
|
242 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
240 | + $content = '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>'; |
|
241 | + if ($transaction_paid > 0) { |
|
242 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
243 | 243 | } |
244 | 244 | return $content; |
245 | 245 | } |
@@ -250,13 +250,13 @@ discard block |
||
250 | 250 | * @param \EE_Transaction $item |
251 | 251 | * @return string|void |
252 | 252 | */ |
253 | - function column_ATT_fname( EE_Transaction $item ){ |
|
253 | + function column_ATT_fname(EE_Transaction $item) { |
|
254 | 254 | $primary_reg = $item->primary_registration(); |
255 | 255 | $attendee = $primary_reg->get_first_related('Attendee'); |
256 | - if ( $attendee instanceof EE_Attendee ) { |
|
257 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL ); |
|
258 | - $content = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee->full_name() . '</a>' : $attendee->full_name(); |
|
259 | - $content .= '<br>' . $attendee->email(); |
|
256 | + if ($attendee instanceof EE_Attendee) { |
|
257 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL); |
|
258 | + $content = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name(); |
|
259 | + $content .= '<br>'.$attendee->email(); |
|
260 | 260 | return $content; |
261 | 261 | } |
262 | 262 | return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
@@ -268,10 +268,10 @@ discard block |
||
268 | 268 | * @param \EE_Transaction $item |
269 | 269 | * @return string|void |
270 | 270 | */ |
271 | - function column_ATT_email( EE_Transaction $item ){ |
|
271 | + function column_ATT_email(EE_Transaction $item) { |
|
272 | 272 | $attendee = $item->primary_registration()->get_first_related('Attendee'); |
273 | - if ( !empty( $attendee ) ) |
|
274 | - return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>'; |
|
273 | + if ( ! empty($attendee)) |
|
274 | + return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>'; |
|
275 | 275 | else |
276 | 276 | return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
277 | 277 | ; |
@@ -283,20 +283,20 @@ discard block |
||
283 | 283 | * @param \EE_Transaction $item |
284 | 284 | * @return string|void |
285 | 285 | */ |
286 | - function column_event_name( EE_Transaction $item ){ |
|
286 | + function column_event_name(EE_Transaction $item) { |
|
287 | 287 | $actions = array(); |
288 | 288 | $event = $item->primary_registration()->get_first_related('Event'); |
289 | - if ( !empty( $event ) ) { |
|
290 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
|
289 | + if ( ! empty($event)) { |
|
290 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL); |
|
291 | 291 | $event_name = $event->get('EVT_name'); |
292 | 292 | |
293 | 293 | //filter this view by transactions for this event |
294 | - $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) ); |
|
295 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) { |
|
296 | - $actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event', 'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>'; |
|
294 | + $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID())); |
|
295 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) { |
|
296 | + $actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event', 'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>'; |
|
297 | 297 | } |
298 | 298 | |
299 | - return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ? '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Edit Event: %s', 'event_espresso' ), $event->get('EVT_name') ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ), $this->row_actions($actions) ); |
|
299 | + return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s', 'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions)); |
|
300 | 300 | } else { |
301 | 301 | return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso'); |
302 | 302 | } |
@@ -308,32 +308,32 @@ discard block |
||
308 | 308 | * @param \EE_Transaction $item |
309 | 309 | * @return string |
310 | 310 | */ |
311 | - function column_actions( EE_Transaction $item ){ |
|
311 | + function column_actions(EE_Transaction $item) { |
|
312 | 312 | |
313 | 313 | $registration = $item->primary_registration(); |
314 | 314 | $attendee = $registration->attendee(); |
315 | 315 | |
316 | 316 | //Build row actions |
317 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
317 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
318 | 318 | $dl_invoice_lnk_url = $registration->invoice_url(); |
319 | 319 | $dl_receipt_lnk_url = $registration->receipt_url(); |
320 | - $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
|
321 | - $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
320 | + $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL); |
|
321 | + $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
322 | 322 | |
323 | 323 | //Build row actions |
324 | 324 | $view_lnk = ' |
325 | 325 | <li> |
326 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text"> |
|
326 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text"> |
|
327 | 327 | <span class="dashicons dashicons-cart"></span> |
328 | 328 | </a> |
329 | 329 | </li>'; |
330 | 330 | |
331 | 331 | |
332 | 332 | //only show invoice link if message type is active. |
333 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
333 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) { |
|
334 | 334 | $dl_invoice_lnk = ' |
335 | 335 | <li> |
336 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
336 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
337 | 337 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
338 | 338 | </a> |
339 | 339 | </li>'; |
@@ -342,10 +342,10 @@ discard block |
||
342 | 342 | } |
343 | 343 | |
344 | 344 | //only show receipt link if message type is active. |
345 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) { |
|
345 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) { |
|
346 | 346 | $dl_receipt_lnk = ' |
347 | 347 | <li> |
348 | - <a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
348 | + <a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
349 | 349 | <span class="dashicons dashicons-media-default ee-icon-size-18"></span> |
350 | 350 | </a> |
351 | 351 | </li>'; |
@@ -354,10 +354,10 @@ discard block |
||
354 | 354 | } |
355 | 355 | |
356 | 356 | //only show payment reminder link if the message type is active. |
357 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
358 | - $send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? ' |
|
357 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
358 | + $send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder') ? ' |
|
359 | 359 | <li> |
360 | - <a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text"> |
|
360 | + <a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text"> |
|
361 | 361 | <span class="dashicons dashicons-email-alt"></span> |
362 | 362 | </a> |
363 | 363 | </li>' : ''; |
@@ -366,14 +366,14 @@ discard block |
||
366 | 366 | $send_pay_lnk = ''; |
367 | 367 | } |
368 | 368 | |
369 | - $view_reg_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? ' |
|
369 | + $view_reg_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? ' |
|
370 | 370 | <li> |
371 | - <a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
371 | + <a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
372 | 372 | <span class="dashicons dashicons-clipboard"></span> |
373 | 373 | </a> |
374 | 374 | </li>' : ''; |
375 | 375 | |
376 | - return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
|
376 | + return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul'); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * Event List |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage /modules/feeds/ |
|
20 | - * @author Brent Christensen |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * Event List |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage /modules/feeds/ |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | class EED_Feeds extends EED_Module { |
25 | 25 | |
26 | 26 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Feeds |
30 | 30 | */ |
31 | 31 | public static function instance() { |
32 | - return parent::get_instance( __CLASS__ ); |
|
32 | + return parent::get_instance(__CLASS__); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | * @return void |
42 | 42 | */ |
43 | 43 | public static function set_hooks() { |
44 | - add_action( 'parse_request', array( 'EED_Feeds', 'parse_request' ), 10 ); |
|
45 | - add_filter( 'default_feed', array( 'EED_Feeds', 'default_feed' ), 10, 1 ); |
|
46 | - add_filter( 'comment_feed_join', array( 'EED_Feeds', 'comment_feed_join' ), 10, 2 ); |
|
47 | - add_filter( 'comment_feed_where', array( 'EED_Feeds', 'comment_feed_where' ), 10, 2 ); |
|
44 | + add_action('parse_request', array('EED_Feeds', 'parse_request'), 10); |
|
45 | + add_filter('default_feed', array('EED_Feeds', 'default_feed'), 10, 1); |
|
46 | + add_filter('comment_feed_join', array('EED_Feeds', 'comment_feed_join'), 10, 2); |
|
47 | + add_filter('comment_feed_where', array('EED_Feeds', 'comment_feed_where'), 10, 2); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @access public |
65 | 65 | * @return void |
66 | 66 | */ |
67 | - public function run( $WP ) { |
|
67 | + public function run($WP) { |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param type rss2, atom, rss, rdf, rssjs |
77 | 77 | * @return string |
78 | 78 | */ |
79 | - public static function default_feed( $type = 'rss2' ) { |
|
79 | + public static function default_feed($type = 'rss2') { |
|
80 | 80 | //rss2, atom, rss, rdf, rssjs |
81 | 81 | $type = 'rss2'; |
82 | 82 | return $type; |
@@ -92,24 +92,24 @@ discard block |
||
92 | 92 | * @return void |
93 | 93 | */ |
94 | 94 | public static function parse_request() { |
95 | - if ( EE_Registry::instance()->REQ->is_set( 'post_type' )) { |
|
95 | + if (EE_Registry::instance()->REQ->is_set('post_type')) { |
|
96 | 96 | // define path to templates |
97 | - define( 'RSS_FEEDS_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
97 | + define('RSS_FEEDS_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
98 | 98 | // what kinda post_type are we dealing with ? |
99 | - switch( EE_Registry::instance()->REQ->get( 'post_type' )) { |
|
99 | + switch (EE_Registry::instance()->REQ->get('post_type')) { |
|
100 | 100 | case 'espresso_events' : |
101 | 101 | // for rss2, atom, rss, rdf |
102 | - add_filter( 'the_excerpt_rss', array( 'EED_Feeds', 'the_event_feed' ), 10, 1 ); |
|
103 | - add_filter( 'the_content_feed', array( 'EED_Feeds', 'the_event_feed' ), 10, 1 ); |
|
102 | + add_filter('the_excerpt_rss', array('EED_Feeds', 'the_event_feed'), 10, 1); |
|
103 | + add_filter('the_content_feed', array('EED_Feeds', 'the_event_feed'), 10, 1); |
|
104 | 104 | // for json ( also uses the above filter ) |
105 | - add_filter( 'rssjs_feed_item', array( 'EED_Feeds', 'the_event_rssjs_feed' ), 10, 1 ); |
|
105 | + add_filter('rssjs_feed_item', array('EED_Feeds', 'the_event_rssjs_feed'), 10, 1); |
|
106 | 106 | break; |
107 | 107 | case 'espresso_venues' : |
108 | 108 | // for rss2, atom, rss, rdf |
109 | - add_filter( 'the_excerpt_rss', array( 'EED_Feeds', 'the_venue_feed' ), 10, 1 ); |
|
110 | - add_filter( 'the_content_feed', array( 'EED_Feeds', 'the_venue_feed' ), 10, 1 ); |
|
109 | + add_filter('the_excerpt_rss', array('EED_Feeds', 'the_venue_feed'), 10, 1); |
|
110 | + add_filter('the_content_feed', array('EED_Feeds', 'the_venue_feed'), 10, 1); |
|
111 | 111 | // for json ( also uses the above filter ) |
112 | - add_filter( 'rssjs_feed_item', array( 'EED_Feeds', 'the_venue_rssjs_feed' ), 10, 1 ); |
|
112 | + add_filter('rssjs_feed_item', array('EED_Feeds', 'the_venue_rssjs_feed'), 10, 1); |
|
113 | 113 | break; |
114 | 114 | } |
115 | 115 | } |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | * @param string $SQL the JOIN clause for the comment feed query |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - public static function comment_feed_join( $SQL ) { |
|
130 | + public static function comment_feed_join($SQL) { |
|
131 | 131 | global $wpdb; |
132 | 132 | // check for wp_posts table in JOIN clause |
133 | - if ( strpos( $SQL, $wpdb->posts ) !== FALSE ) { |
|
134 | - add_filter( 'EED_Feeds__comment_feed_where__espresso_attendees', '__return_true' ); |
|
133 | + if (strpos($SQL, $wpdb->posts) !== FALSE) { |
|
134 | + add_filter('EED_Feeds__comment_feed_where__espresso_attendees', '__return_true'); |
|
135 | 135 | } |
136 | 136 | return $SQL; |
137 | 137 | } |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | * @param string $SQL the WHERE clause for the comment feed query |
149 | 149 | * @return void |
150 | 150 | */ |
151 | - public static function comment_feed_where( $SQL ) { |
|
151 | + public static function comment_feed_where($SQL) { |
|
152 | 152 | global $wp_query, $wpdb; |
153 | - if ( $wp_query->is_comment_feed && apply_filters( 'EED_Feeds__comment_feed_where__espresso_attendees', FALSE )) { |
|
153 | + if ($wp_query->is_comment_feed && apply_filters('EED_Feeds__comment_feed_where__espresso_attendees', FALSE)) { |
|
154 | 154 | $SQL .= " AND $wpdb->posts.post_type != 'espresso_attendees'"; |
155 | 155 | } |
156 | 156 | return $SQL; |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | * @param string $content |
167 | 167 | * @return void |
168 | 168 | */ |
169 | - public static function the_event_feed( $content ) { |
|
170 | - if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php' )) { |
|
169 | + public static function the_event_feed($content) { |
|
170 | + if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php')) { |
|
171 | 171 | global $post; |
172 | 172 | $template_args = array( |
173 | 173 | 'EVT_ID' => $post->ID, |
174 | 174 | 'event_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content |
175 | 175 | ); |
176 | - $content = EEH_Template::display_template( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php', $template_args, TRUE ); |
|
176 | + $content = EEH_Template::display_template(RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php', $template_args, TRUE); |
|
177 | 177 | } |
178 | 178 | return $content; |
179 | 179 | } |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | * @param object $item |
189 | 189 | * @return void |
190 | 190 | */ |
191 | - public static function the_event_rssjs_feed( $item ) { |
|
192 | - if ( is_feed() && isset( $item->description )) { |
|
193 | - $item->description = EED_Feeds::the_event_feed( $item->description ); |
|
191 | + public static function the_event_rssjs_feed($item) { |
|
192 | + if (is_feed() && isset($item->description)) { |
|
193 | + $item->description = EED_Feeds::the_event_feed($item->description); |
|
194 | 194 | } |
195 | 195 | return $item; |
196 | 196 | } |
@@ -205,14 +205,14 @@ discard block |
||
205 | 205 | * @param string $content |
206 | 206 | * @return void |
207 | 207 | */ |
208 | - public static function the_venue_feed( $content ) { |
|
209 | - if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php' )) { |
|
208 | + public static function the_venue_feed($content) { |
|
209 | + if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php')) { |
|
210 | 210 | global $post; |
211 | 211 | $template_args = array( |
212 | 212 | 'VNU_ID' => $post->ID, |
213 | 213 | 'venue_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content |
214 | 214 | ); |
215 | - $content = EEH_Template::display_template( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php', $template_args, TRUE ); |
|
215 | + $content = EEH_Template::display_template(RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php', $template_args, TRUE); |
|
216 | 216 | } |
217 | 217 | return $content; |
218 | 218 | } |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | * @param object $item |
228 | 228 | * @return void |
229 | 229 | */ |
230 | - public static function the_venue_rssjs_feed( $item ) { |
|
231 | - if ( is_feed() && isset( $item->description )) { |
|
232 | - $item->description = EED_Feeds::the_venue_feed( $item->description ); |
|
230 | + public static function the_venue_rssjs_feed($item) { |
|
231 | + if (is_feed() && isset($item->description)) { |
|
232 | + $item->description = EED_Feeds::the_venue_feed($item->description); |
|
233 | 233 | } |
234 | 234 | return $item; |
235 | 235 | } |
@@ -1,26 +1,26 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * Datetime Model |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage includes/models/ |
|
20 | - * @author Brent Christensen |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * Datetime Model |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage includes/models/ |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
25 | 25 | require_once ( EE_CLASSES . 'EE_Datetime.class.php' ); |
26 | 26 | |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | |
76 | 76 | |
77 | 77 | /** |
78 | - * create new blank datetime |
|
79 | - * |
|
80 | - * @access public |
|
81 | - * @return EE_Datetime[] array on success, FALSE on fail |
|
82 | - */ |
|
78 | + * create new blank datetime |
|
79 | + * |
|
80 | + * @access public |
|
81 | + * @return EE_Datetime[] array on success, FALSE on fail |
|
82 | + */ |
|
83 | 83 | public function create_new_blank_datetime() { |
84 | 84 | $blank_datetime = EE_Datetime::new_instance( |
85 | 85 | array( |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | |
101 | 101 | |
102 | 102 | /** |
103 | - * get event start date from db |
|
104 | - * |
|
105 | - * @access public |
|
106 | - * @param int $EVT_ID |
|
107 | - * @return EE_Datetime[] array on success, FALSE on fail |
|
108 | - */ |
|
103 | + * get event start date from db |
|
104 | + * |
|
105 | + * @access public |
|
106 | + * @param int $EVT_ID |
|
107 | + * @return EE_Datetime[] array on success, FALSE on fail |
|
108 | + */ |
|
109 | 109 | public function get_all_event_dates( $EVT_ID = 0 ) { |
110 | 110 | if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0 |
111 | 111 | return $this->create_new_blank_datetime(); |
@@ -250,14 +250,14 @@ discard block |
||
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
253 | - * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered |
|
254 | - * only by start date |
|
255 | - * @param int $TKT_ID |
|
256 | - * @param boolean $include_expired |
|
257 | - * @param boolean $include_deleted |
|
258 | - * @param int $limit |
|
259 | - * @return EE_Datetime[] |
|
260 | - */ |
|
253 | + * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered |
|
254 | + * only by start date |
|
255 | + * @param int $TKT_ID |
|
256 | + * @param boolean $include_expired |
|
257 | + * @param boolean $include_deleted |
|
258 | + * @param int $limit |
|
259 | + * @return EE_Datetime[] |
|
260 | + */ |
|
261 | 261 | public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){ |
262 | 262 | //sanitize TKT_ID |
263 | 263 | $TKT_ID = intval( $TKT_ID ); |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once ( EE_CLASSES . 'EE_Datetime.class.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once (EE_CLASSES.'EE_Datetime.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Datetime extends EEM_Soft_Delete_Base { |
28 | 28 | |
@@ -35,27 +35,27 @@ discard block |
||
35 | 35 | * @access private |
36 | 36 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
37 | 37 | */ |
38 | - protected function __construct( $timezone ) { |
|
39 | - $this->singular_item = __('Datetime','event_espresso'); |
|
40 | - $this->plural_item = __('Datetimes','event_espresso'); |
|
38 | + protected function __construct($timezone) { |
|
39 | + $this->singular_item = __('Datetime', 'event_espresso'); |
|
40 | + $this->plural_item = __('Datetimes', 'event_espresso'); |
|
41 | 41 | |
42 | 42 | $this->_tables = array( |
43 | 43 | 'Datetime'=> new EE_Primary_Table('esp_datetime', 'DTT_ID') |
44 | 44 | ); |
45 | 45 | $this->_fields = array( |
46 | 46 | 'Datetime'=>array( |
47 | - 'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID','event_espresso')), |
|
48 | - 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'), |
|
47 | + 'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')), |
|
48 | + 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'), |
|
49 | 49 | 'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''), |
50 | 50 | 'DTT_description' => new EE_Full_HTML_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''), |
51 | - 'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event','event_espresso'), false, time(), $timezone ), |
|
52 | - 'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event','event_espresso'), false, time(), $timezone ), |
|
53 | - 'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time','event_espresso'), true, EE_INF), |
|
54 | - 'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0 ), |
|
55 | - 'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false,false), |
|
51 | + 'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, time(), $timezone), |
|
52 | + 'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, time(), $timezone), |
|
53 | + 'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, EE_INF), |
|
54 | + 'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0), |
|
55 | + 'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false), |
|
56 | 56 | 'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0), |
57 | - 'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0 ), |
|
58 | - 'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ), |
|
57 | + 'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0), |
|
58 | + 'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false), |
|
59 | 59 | )); |
60 | 60 | $this->_model_relations = array( |
61 | 61 | 'Ticket'=>new EE_HABTM_Relation('Datetime_Ticket'), |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | ); |
65 | 65 | $this->_model_chain_to_wp_user = 'Event'; |
66 | 66 | //this model is generally available for reading |
67 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' ); |
|
68 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' ); |
|
69 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' ); |
|
70 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit ); |
|
71 | - parent::__construct( $timezone ); |
|
67 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event'); |
|
68 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event'); |
|
69 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event'); |
|
70 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit); |
|
71 | + parent::__construct($timezone); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -83,16 +83,16 @@ discard block |
||
83 | 83 | public function create_new_blank_datetime() { |
84 | 84 | $blank_datetime = EE_Datetime::new_instance( |
85 | 85 | array( |
86 | - 'DTT_EVT_start' => $this->current_time_for_query( 'DTT_EVT_start', true ) + (60 * 60 * 24 * 30), |
|
87 | - 'DTT_EVT_end' => $this->current_time_for_query( 'DTT_EVT_end', true ) + (60 * 60 * 24 * 30), |
|
86 | + 'DTT_EVT_start' => $this->current_time_for_query('DTT_EVT_start', true) + (60 * 60 * 24 * 30), |
|
87 | + 'DTT_EVT_end' => $this->current_time_for_query('DTT_EVT_end', true) + (60 * 60 * 24 * 30), |
|
88 | 88 | 'DTT_order' => 1, |
89 | 89 | 'DTT_reg_limit' => EE_INF |
90 | 90 | ), |
91 | 91 | $this->_timezone |
92 | 92 | ); |
93 | - $blank_datetime->set_start_time( $this->convert_datetime_for_query( 'DTT_EVT_start', '8am', 'ga', $this->_timezone ) ); |
|
94 | - $blank_datetime->set_end_time( $this->convert_datetime_for_query( 'DTT_EVT_end', '5pm', 'ga', $this->_timezone ) ); |
|
95 | - return array( $blank_datetime ); |
|
93 | + $blank_datetime->set_start_time($this->convert_datetime_for_query('DTT_EVT_start', '8am', 'ga', $this->_timezone)); |
|
94 | + $blank_datetime->set_end_time($this->convert_datetime_for_query('DTT_EVT_end', '5pm', 'ga', $this->_timezone)); |
|
95 | + return array($blank_datetime); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | * @param int $EVT_ID |
107 | 107 | * @return EE_Datetime[] array on success, FALSE on fail |
108 | 108 | */ |
109 | - public function get_all_event_dates( $EVT_ID = 0 ) { |
|
110 | - if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0 |
|
109 | + public function get_all_event_dates($EVT_ID = 0) { |
|
110 | + if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0 |
|
111 | 111 | return $this->create_new_blank_datetime(); |
112 | 112 | } |
113 | - $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID); |
|
113 | + $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID); |
|
114 | 114 | |
115 | - if ( empty( $results ) ) { |
|
115 | + if (empty($results)) { |
|
116 | 116 | return $this->create_new_blank_datetime(); |
117 | 117 | } |
118 | 118 | |
@@ -133,26 +133,26 @@ discard block |
||
133 | 133 | * the given number |
134 | 134 | * @return EE_Datetime[] |
135 | 135 | */ |
136 | - public function get_datetimes_for_event_ordered_by_DTT_order( $EVT_ID, $include_expired = TRUE, $include_deleted= TRUE, $limit = NULL ) { |
|
136 | + public function get_datetimes_for_event_ordered_by_DTT_order($EVT_ID, $include_expired = TRUE, $include_deleted = TRUE, $limit = NULL) { |
|
137 | 137 | |
138 | 138 | //sanitize EVT_ID |
139 | - $EVT_ID = intval( $EVT_ID ); |
|
139 | + $EVT_ID = intval($EVT_ID); |
|
140 | 140 | |
141 | 141 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
142 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
143 | - $where_params = array( 'Event.EVT_ID' => $EVT_ID ); |
|
142 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
143 | + $where_params = array('Event.EVT_ID' => $EVT_ID); |
|
144 | 144 | |
145 | - $query_params = ! empty( $limit ) ? array( $where_params, 'limit' => $limit, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ) : array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ); |
|
145 | + $query_params = ! empty($limit) ? array($where_params, 'limit' => $limit, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none') : array($where_params, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none'); |
|
146 | 146 | |
147 | - if( ! $include_expired){ |
|
148 | - $query_params[0]['DTT_EVT_end'] = array( '>=', current_time( 'mysql', TRUE ) ); |
|
147 | + if ( ! $include_expired) { |
|
148 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
149 | 149 | } |
150 | - if( $include_deleted){ |
|
151 | - $query_params[0]['DTT_deleted'] = array( 'IN', array( TRUE, FALSE )); |
|
150 | + if ($include_deleted) { |
|
151 | + $query_params[0]['DTT_deleted'] = array('IN', array(TRUE, FALSE)); |
|
152 | 152 | } |
153 | 153 | |
154 | - $result = $this->get_all( $query_params ); |
|
155 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
154 | + $result = $this->get_all($query_params); |
|
155 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
156 | 156 | return $result; |
157 | 157 | } |
158 | 158 | |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * @param int $limit |
168 | 168 | * @return EE_Datetime[] |
169 | 169 | */ |
170 | - public function get_datetimes_for_event_ordered_by_importance( $EVT_ID = 0, $limit = NULL){ |
|
171 | - return $this->get_all( array(array('Event.EVT_ID'=>$EVT_ID), |
|
170 | + public function get_datetimes_for_event_ordered_by_importance($EVT_ID = 0, $limit = NULL) { |
|
171 | + return $this->get_all(array(array('Event.EVT_ID'=>$EVT_ID), |
|
172 | 172 | 'limit'=>$limit, |
173 | 173 | 'order_by'=>array('DTT_EVT_start'=>'ASC'), |
174 | 174 | 'default_where_conditions' => 'none')); |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | * @param boolean $include_deleted |
184 | 184 | * @return EE_Datetime |
185 | 185 | */ |
186 | - public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false,$include_deleted = false){ |
|
187 | - $results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1); |
|
188 | - if($results){ |
|
186 | + public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false) { |
|
187 | + $results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1); |
|
188 | + if ($results) { |
|
189 | 189 | return array_shift($results); |
190 | - }else{ |
|
190 | + } else { |
|
191 | 191 | return NULL; |
192 | 192 | } |
193 | 193 | } |
@@ -201,16 +201,16 @@ discard block |
||
201 | 201 | * @param bool $try_to_exclude_deleted |
202 | 202 | * @return \EE_Datetime |
203 | 203 | */ |
204 | - public function get_primary_datetime_for_event($EVT_ID,$try_to_exclude_expired = true, $try_to_exclude_deleted = true){ |
|
205 | - if($try_to_exclude_expired){ |
|
206 | - $non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false,false); |
|
207 | - if($non_expired){ |
|
204 | + public function get_primary_datetime_for_event($EVT_ID, $try_to_exclude_expired = true, $try_to_exclude_deleted = true) { |
|
205 | + if ($try_to_exclude_expired) { |
|
206 | + $non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false); |
|
207 | + if ($non_expired) { |
|
208 | 208 | return $non_expired; |
209 | 209 | } |
210 | 210 | } |
211 | - if($try_to_exclude_deleted){ |
|
211 | + if ($try_to_exclude_deleted) { |
|
212 | 212 | $expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true); |
213 | - if($expired_even){ |
|
213 | + if ($expired_even) { |
|
214 | 214 | return $expired_even; |
215 | 215 | } |
216 | 216 | } |
@@ -229,23 +229,23 @@ discard block |
||
229 | 229 | * @param int $limit |
230 | 230 | * @return EE_Datetime[] |
231 | 231 | */ |
232 | - public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted= true, $limit = NULL ){ |
|
232 | + public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
233 | 233 | //sanitize EVT_ID |
234 | - $EVT_ID = intval( $EVT_ID ); |
|
234 | + $EVT_ID = intval($EVT_ID); |
|
235 | 235 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
236 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
237 | - $query_params =array(array('Event.EVT_ID'=>$EVT_ID),'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
238 | - if( ! $include_expired){ |
|
239 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
236 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
237 | + $query_params = array(array('Event.EVT_ID'=>$EVT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
238 | + if ( ! $include_expired) { |
|
239 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
240 | 240 | } |
241 | - if( $include_deleted){ |
|
242 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
241 | + if ($include_deleted) { |
|
242 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
243 | 243 | } |
244 | - if($limit){ |
|
244 | + if ($limit) { |
|
245 | 245 | $query_params['limit'] = $limit; |
246 | 246 | } |
247 | - $result = $this->get_all( $query_params ); |
|
248 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
247 | + $result = $this->get_all($query_params); |
|
248 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
249 | 249 | return $result; |
250 | 250 | } |
251 | 251 | |
@@ -258,23 +258,23 @@ discard block |
||
258 | 258 | * @param int $limit |
259 | 259 | * @return EE_Datetime[] |
260 | 260 | */ |
261 | - public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){ |
|
261 | + public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
262 | 262 | //sanitize TKT_ID |
263 | - $TKT_ID = intval( $TKT_ID ); |
|
263 | + $TKT_ID = intval($TKT_ID); |
|
264 | 264 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
265 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
266 | - $query_params =array(array('Ticket.TKT_ID'=>$TKT_ID),'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
267 | - if( ! $include_expired){ |
|
268 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
265 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
266 | + $query_params = array(array('Ticket.TKT_ID'=>$TKT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
267 | + if ( ! $include_expired) { |
|
268 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
269 | 269 | } |
270 | - if( $include_deleted){ |
|
271 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
270 | + if ($include_deleted) { |
|
271 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
272 | 272 | } |
273 | - if($limit){ |
|
273 | + if ($limit) { |
|
274 | 274 | $query_params['limit'] = $limit; |
275 | 275 | } |
276 | - $result = $this->get_all( $query_params ); |
|
277 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
276 | + $result = $this->get_all($query_params); |
|
277 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
278 | 278 | return $result; |
279 | 279 | } |
280 | 280 | |
@@ -290,24 +290,24 @@ discard block |
||
290 | 290 | * that number |
291 | 291 | * @return EE_Datetime[] |
292 | 292 | */ |
293 | - public function get_datetimes_for_ticket_ordered_by_DTT_order( $TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL ) { |
|
293 | + public function get_datetimes_for_ticket_ordered_by_DTT_order($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
294 | 294 | //sanitize id. |
295 | - $TKT_ID = intval( $TKT_ID ); |
|
295 | + $TKT_ID = intval($TKT_ID); |
|
296 | 296 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
297 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
298 | - $where_params = array( 'Ticket.TKT_ID' => $TKT_ID ); |
|
299 | - $query_params = array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ) ); |
|
300 | - if( ! $include_expired){ |
|
301 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
297 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
298 | + $where_params = array('Ticket.TKT_ID' => $TKT_ID); |
|
299 | + $query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC')); |
|
300 | + if ( ! $include_expired) { |
|
301 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
302 | 302 | } |
303 | - if( $include_deleted){ |
|
304 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
303 | + if ($include_deleted) { |
|
304 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
305 | 305 | } |
306 | - if($limit){ |
|
306 | + if ($limit) { |
|
307 | 307 | $query_params['limit'] = $limit; |
308 | 308 | } |
309 | - $result = $this->get_all( $query_params ); |
|
310 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
309 | + $result = $this->get_all($query_params); |
|
310 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
311 | 311 | return $result; |
312 | 312 | } |
313 | 313 | |
@@ -318,11 +318,11 @@ discard block |
||
318 | 318 | * @param int $EVT_ID |
319 | 319 | * @return EE_Datetime |
320 | 320 | */ |
321 | - public function get_most_important_datetime_for_event($EVT_ID){ |
|
321 | + public function get_most_important_datetime_for_event($EVT_ID) { |
|
322 | 322 | $results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1); |
323 | - if($results){ |
|
323 | + if ($results) { |
|
324 | 324 | return array_shift($results); |
325 | - }else{ |
|
325 | + } else { |
|
326 | 326 | return null; |
327 | 327 | } |
328 | 328 | } |
@@ -341,77 +341,77 @@ discard block |
||
341 | 341 | * - inactive = Events that are either not published. |
342 | 342 | * @return wpdb results array |
343 | 343 | */ |
344 | - public function get_dtt_months_and_years( $where_params, $evt_active_status = '' ) { |
|
345 | - $current_time_for_DTT_EVT_start = $this->current_time_for_query( 'DTT_EVT_start' ); |
|
346 | - $current_time_for_DTT_EVT_end = $this->current_time_for_query( 'DTT_EVT_end' ); |
|
344 | + public function get_dtt_months_and_years($where_params, $evt_active_status = '') { |
|
345 | + $current_time_for_DTT_EVT_start = $this->current_time_for_query('DTT_EVT_start'); |
|
346 | + $current_time_for_DTT_EVT_end = $this->current_time_for_query('DTT_EVT_end'); |
|
347 | 347 | |
348 | - switch ( $evt_active_status ) { |
|
348 | + switch ($evt_active_status) { |
|
349 | 349 | case 'upcoming' : |
350 | 350 | $where_params['Event.status'] = 'publish'; |
351 | 351 | //if there are already query_params matching DTT_EVT_start then we need to modify that to add them. |
352 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
352 | + if (isset($where_params['DTT_EVT_start'])) { |
|
353 | 353 | $where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start']; |
354 | 354 | } |
355 | - $where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start ); |
|
355 | + $where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start); |
|
356 | 356 | break; |
357 | 357 | |
358 | 358 | case 'expired' : |
359 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
359 | + if (isset($where_params['Event.status'])) unset($where_params['Event.status']); |
|
360 | 360 | //get events to exclude |
361 | - $exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $current_time_for_DTT_EVT_end ) ) ); |
|
361 | + $exclude_query[0] = array_merge($where_params, array('DTT_EVT_end' => array('>', $current_time_for_DTT_EVT_end))); |
|
362 | 362 | //first get all events that have datetimes where its not expired. |
363 | - $event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Datetime.EVT_ID' ); |
|
364 | - $event_ids = array_keys( $event_ids ); |
|
363 | + $event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Datetime.EVT_ID'); |
|
364 | + $event_ids = array_keys($event_ids); |
|
365 | 365 | |
366 | - if ( isset( $where_params['DTT_EVT_end'] ) ) { |
|
366 | + if (isset($where_params['DTT_EVT_end'])) { |
|
367 | 367 | $where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
368 | 368 | } |
369 | - $where_params['DTT_EVT_end'] = array( '<', $current_time_for_DTT_EVT_end ); |
|
370 | - $where_params['Event.EVT_ID'] = array( 'NOT IN', $event_ids ); |
|
369 | + $where_params['DTT_EVT_end'] = array('<', $current_time_for_DTT_EVT_end); |
|
370 | + $where_params['Event.EVT_ID'] = array('NOT IN', $event_ids); |
|
371 | 371 | break; |
372 | 372 | |
373 | 373 | case 'active' : |
374 | 374 | $where_params['Event.status'] = 'publish'; |
375 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
375 | + if (isset($where_params['DTT_EVT_start'])) { |
|
376 | 376 | $where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start']; |
377 | 377 | } |
378 | - if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) { |
|
378 | + if (isset($where_params['Datetime.DTT_EVT_end'])) { |
|
379 | 379 | $where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end']; |
380 | 380 | } |
381 | - $where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start ); |
|
382 | - $where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end ); |
|
381 | + $where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start); |
|
382 | + $where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end); |
|
383 | 383 | break; |
384 | 384 | |
385 | 385 | case 'inactive' : |
386 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
387 | - if ( isset( $where_params['OR'] ) ) { |
|
386 | + if (isset($where_params['Event.status'])) unset($where_params['Event.status']); |
|
387 | + if (isset($where_params['OR'])) { |
|
388 | 388 | $where_params['AND']['OR'] = $where_params['OR']; |
389 | 389 | } |
390 | - if ( isset( $where_params['DTT_EVT_end'] ) ) { |
|
390 | + if (isset($where_params['DTT_EVT_end'])) { |
|
391 | 391 | $where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
392 | - unset( $where_params['DTT_EVT_end'] ); |
|
392 | + unset($where_params['DTT_EVT_end']); |
|
393 | 393 | } |
394 | 394 | |
395 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
395 | + if (isset($where_params['DTT_EVT_start'])) { |
|
396 | 396 | $where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start']; |
397 | - unset( $where_params['DTT_EVT_start'] ); |
|
397 | + unset($where_params['DTT_EVT_start']); |
|
398 | 398 | } |
399 | - $where_params['AND']['Event.status'] = array( '!=', 'publish' ); |
|
399 | + $where_params['AND']['Event.status'] = array('!=', 'publish'); |
|
400 | 400 | break; |
401 | 401 | } |
402 | 402 | |
403 | 403 | $query_params[0] = $where_params; |
404 | 404 | $query_params['group_by'] = array('dtt_year', 'dtt_month'); |
405 | - $query_params['order_by'] = array( 'DTT_EVT_start' => 'DESC' ); |
|
405 | + $query_params['order_by'] = array('DTT_EVT_start' => 'DESC'); |
|
406 | 406 | |
407 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'DTT_EVT_start' ); |
|
407 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'DTT_EVT_start'); |
|
408 | 408 | |
409 | 409 | $columns_to_select = array( |
410 | - 'dtt_year' => array('YEAR(' . $query_interval . ')', '%s'), |
|
411 | - 'dtt_month' => array('MONTHNAME(' . $query_interval . ')', '%s'), |
|
412 | - 'dtt_month_num' => array('MONTH(' . $query_interval .')', '%s') |
|
410 | + 'dtt_year' => array('YEAR('.$query_interval.')', '%s'), |
|
411 | + 'dtt_month' => array('MONTHNAME('.$query_interval.')', '%s'), |
|
412 | + 'dtt_month_num' => array('MONTH('.$query_interval.')', '%s') |
|
413 | 413 | ); |
414 | - return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select ); |
|
414 | + return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
@@ -419,8 +419,8 @@ discard block |
||
419 | 419 | * for the tickets for each datetime) |
420 | 420 | * @param EE_Datetime[] $datetimes |
421 | 421 | */ |
422 | - public function update_sold($datetimes){ |
|
423 | - foreach($datetimes as $datetime){ |
|
422 | + public function update_sold($datetimes) { |
|
423 | + foreach ($datetimes as $datetime) { |
|
424 | 424 | $datetime->update_sold(); |
425 | 425 | } |
426 | 426 | } |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | * @param array $query_params |
436 | 436 | * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF, IF there are NO tickets attached to datetime then FALSE is returned. |
437 | 437 | */ |
438 | - public function sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params = array() ) { |
|
439 | - $datetime = $this->get_one_by_ID( $DTT_ID ); |
|
440 | - if ( $datetime instanceof EE_Datetime ) { |
|
441 | - return $datetime->tickets_remaining( $query_params ); |
|
438 | + public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) { |
|
439 | + $datetime = $this->get_one_by_ID($DTT_ID); |
|
440 | + if ($datetime instanceof EE_Datetime) { |
|
441 | + return $datetime->tickets_remaining($query_params); |
|
442 | 442 | } |
443 | 443 | return 0; |
444 | 444 | } |
@@ -460,36 +460,36 @@ discard block |
||
460 | 460 | * EE_Datetime::upcoming |
461 | 461 | * EE_Datetime::expired |
462 | 462 | */ |
463 | - public function get_datetime_counts_by_status( $stati_to_include = array(), $query_params = array() ) { |
|
463 | + public function get_datetime_counts_by_status($stati_to_include = array(), $query_params = array()) { |
|
464 | 464 | //only accept where conditions for this query. |
465 | - $_where = isset( $query_params[0] ) ? $query_params[0] : array(); |
|
465 | + $_where = isset($query_params[0]) ? $query_params[0] : array(); |
|
466 | 466 | $status_query_args = array( |
467 | 467 | EE_Datetime::active => array_merge( |
468 | 468 | $_where, |
469 | - array( 'DTT_EVT_start' => array( '<', time() ), 'DTT_EVT_end' => array( '>', time() ) ) |
|
469 | + array('DTT_EVT_start' => array('<', time()), 'DTT_EVT_end' => array('>', time())) |
|
470 | 470 | ), |
471 | 471 | EE_Datetime::upcoming => array_merge( |
472 | 472 | $_where, |
473 | - array( 'DTT_EVT_start' => array( '>', time() ) ) |
|
473 | + array('DTT_EVT_start' => array('>', time())) |
|
474 | 474 | ), |
475 | 475 | EE_Datetime::expired => array_merge( |
476 | 476 | $_where, |
477 | - array( 'DTT_EVT_end' => array('<', time() ) ) |
|
477 | + array('DTT_EVT_end' => array('<', time())) |
|
478 | 478 | ) |
479 | 479 | ); |
480 | 480 | |
481 | - if ( ! empty( $stati_to_include ) ) { |
|
482 | - foreach( array_keys( $status_query_args ) as $status ) { |
|
483 | - if ( ! in_array( $status, $stati_to_include ) ) { |
|
484 | - unset( $status_query_args[$status] ); |
|
481 | + if ( ! empty($stati_to_include)) { |
|
482 | + foreach (array_keys($status_query_args) as $status) { |
|
483 | + if ( ! in_array($status, $stati_to_include)) { |
|
484 | + unset($status_query_args[$status]); |
|
485 | 485 | } |
486 | 486 | } |
487 | 487 | } |
488 | 488 | |
489 | 489 | //loop through and query counts for each stati. |
490 | 490 | $status_query_results = array(); |
491 | - foreach( $status_query_args as $status => $status_where_conditions ) { |
|
492 | - $status_query_results[ $status ] = EEM_Datetime::count( array( $status_where_conditions ), 'DTT_ID', true ); |
|
491 | + foreach ($status_query_args as $status => $status_where_conditions) { |
|
492 | + $status_query_results[$status] = EEM_Datetime::count(array($status_where_conditions), 'DTT_ID', true); |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | return $status_query_results; |
@@ -503,9 +503,9 @@ discard block |
||
503 | 503 | * @param array $query_params |
504 | 504 | * @return int |
505 | 505 | */ |
506 | - public function get_datetime_count_for_status( $status = EE_Datetime::active, $query_params = array() ) { |
|
507 | - $count = $this->get_datetime_counts_by_status( array( $status ), $query_params ); |
|
508 | - return ! empty( $count[$status] ) ? $count[$status] : 0; |
|
506 | + public function get_datetime_count_for_status($status = EE_Datetime::active, $query_params = array()) { |
|
507 | + $count = $this->get_datetime_counts_by_status(array($status), $query_params); |
|
508 | + return ! empty($count[$status]) ? $count[$status] : 0; |
|
509 | 509 | } |
510 | 510 | |
511 | 511 |
@@ -1,28 +1,28 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + */ |
|
15 | 15 | /** |
16 | - * ------------------------------------------------------------------------ |
|
17 | - * |
|
18 | - * EEH_Event_View Helper |
|
19 | - * |
|
20 | - * @package Event Espresso |
|
21 | - * @subpackage /core/ |
|
22 | - * @author Brent Christensen |
|
23 | - * |
|
24 | - * ------------------------------------------------------------------------ |
|
25 | - */ |
|
16 | + * ------------------------------------------------------------------------ |
|
17 | + * |
|
18 | + * EEH_Event_View Helper |
|
19 | + * |
|
20 | + * @package Event Espresso |
|
21 | + * @subpackage /core/ |
|
22 | + * @author Brent Christensen |
|
23 | + * |
|
24 | + * ------------------------------------------------------------------------ |
|
25 | + */ |
|
26 | 26 | class EEH_Event_View extends EEH_Base { |
27 | 27 | |
28 | 28 | /** |
@@ -40,27 +40,27 @@ discard block |
||
40 | 40 | * @param int $EVT_ID |
41 | 41 | * @return object |
42 | 42 | */ |
43 | - public static function get_event( $EVT_ID = 0 ) { |
|
44 | - $EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint( $EVT_ID ); |
|
43 | + public static function get_event($EVT_ID = 0) { |
|
44 | + $EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint($EVT_ID); |
|
45 | 45 | // do we already have the Event you are looking for? |
46 | - if ( EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID ) { |
|
46 | + if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) { |
|
47 | 47 | return EEH_Event_View::$_event; |
48 | 48 | } |
49 | 49 | EEH_Event_View::$_event = NULL; |
50 | 50 | // international newspaper? |
51 | 51 | global $post; |
52 | 52 | // if this is being called from an EE_Event post, then we can just grab the attached EE_Event object |
53 | - if ( isset( $post->post_type ) && $post->post_type == 'espresso_events' || $EVT_ID ) { |
|
53 | + if (isset($post->post_type) && $post->post_type == 'espresso_events' || $EVT_ID) { |
|
54 | 54 | // d( $post ); |
55 | 55 | // grab the event we're looking for |
56 | - if ( isset( $post->EE_Event ) && ( $EVT_ID == 0 || ( $EVT_ID == $post->ID ))) { |
|
56 | + if (isset($post->EE_Event) && ($EVT_ID == 0 || ($EVT_ID == $post->ID))) { |
|
57 | 57 | EEH_Event_View::$_event = $post->EE_Event; |
58 | 58 | // d( EEH_Event_View::$_event ); |
59 | 59 | } |
60 | 60 | // now if we STILL do NOT have an EE_Event model object, BUT we have an Event ID... |
61 | - if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID ) { |
|
61 | + if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
62 | 62 | // sigh... pull it from the db |
63 | - EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
63 | + EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
64 | 64 | // d( EEH_Event_View::$_event ); |
65 | 65 | } |
66 | 66 | } |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * @param int $EVT_ID |
77 | 77 | * @return boolean |
78 | 78 | */ |
79 | - public static function display_ticket_selector( $EVT_ID = 0 ) { |
|
80 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
79 | + public static function display_ticket_selector($EVT_ID = 0) { |
|
80 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
81 | 81 | return $event instanceof EE_Event ? $event->display_ticket_selector() : FALSE; |
82 | 82 | } |
83 | 83 | |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | * @param int $EVT_ID |
91 | 91 | * @return string |
92 | 92 | */ |
93 | - public static function event_status( $EVT_ID = 0 ) { |
|
94 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
95 | - return $event instanceof EE_Event ? $event->pretty_active_status( FALSE ) : ''; |
|
93 | + public static function event_status($EVT_ID = 0) { |
|
94 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
95 | + return $event instanceof EE_Event ? $event->pretty_active_status(FALSE) : ''; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param int $EVT_ID |
105 | 105 | * @return string |
106 | 106 | */ |
107 | - public static function event_active_status( $EVT_ID = 0 ) { |
|
108 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
107 | + public static function event_active_status($EVT_ID = 0) { |
|
108 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
109 | 109 | return $event instanceof EE_Event ? $event->pretty_active_status() : 'inactive'; |
110 | 110 | } |
111 | 111 | |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | * @param int $EVT_ID |
119 | 119 | * @return string |
120 | 120 | */ |
121 | - public static function event_has_content_or_excerpt( $EVT_ID = 0 ) { |
|
122 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
121 | + public static function event_has_content_or_excerpt($EVT_ID = 0) { |
|
122 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
123 | 123 | $has_content_or_excerpt = FALSE; |
124 | - if ( $event instanceof EE_Event ) { |
|
125 | - $has_content_or_excerpt = $event->description() != '' || $event->short_description( NULL, NULL, TRUE ) != '' ? TRUE : FALSE; |
|
124 | + if ($event instanceof EE_Event) { |
|
125 | + $has_content_or_excerpt = $event->description() != '' || $event->short_description(NULL, NULL, TRUE) != '' ? TRUE : FALSE; |
|
126 | 126 | } |
127 | - if ( is_archive() && ! ( espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list() )) { |
|
127 | + if (is_archive() && ! (espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list())) { |
|
128 | 128 | $has_content_or_excerpt = FALSE; |
129 | 129 | } |
130 | 130 | return $has_content_or_excerpt; |
@@ -140,45 +140,45 @@ discard block |
||
140 | 140 | * @param null $more |
141 | 141 | * @return string |
142 | 142 | */ |
143 | - public static function event_content_or_excerpt( $num_words = NULL, $more = NULL ) { |
|
143 | + public static function event_content_or_excerpt($num_words = NULL, $more = NULL) { |
|
144 | 144 | global $post; |
145 | 145 | |
146 | 146 | ob_start(); |
147 | - if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) { |
|
147 | + if ((is_single()) || (is_archive() && espresso_display_full_description_in_event_list())) { |
|
148 | 148 | |
149 | 149 | // admin has chosen "full description" for the "Event Espresso - Events > Templates > Display Description" option |
150 | 150 | the_content(); |
151 | 151 | |
152 | - } else if (( is_archive() && has_excerpt( $post->ID ) && espresso_display_excerpt_in_event_list() ) ) { |
|
152 | + } else if ((is_archive() && has_excerpt($post->ID) && espresso_display_excerpt_in_event_list())) { |
|
153 | 153 | |
154 | 154 | // admin has chosen "excerpt (short desc)" for the "Event Espresso - Events > Templates > Display Description" option |
155 | 155 | // AND an excerpt actually exists |
156 | 156 | the_excerpt(); |
157 | 157 | |
158 | - } else if (( is_archive() && ! has_excerpt( $post->ID ) && espresso_display_excerpt_in_event_list() )) { |
|
158 | + } else if ((is_archive() && ! has_excerpt($post->ID) && espresso_display_excerpt_in_event_list())) { |
|
159 | 159 | |
160 | 160 | // admin has chosen "excerpt (short desc)" for the "Event Espresso - Events > Templates > Display Description" option |
161 | 161 | // but NO excerpt actually exists, so we need to create one |
162 | - if ( ! empty( $num_words )) { |
|
163 | - if ( empty( $more )) { |
|
164 | - $more_link_text = __( '(more…)' ); |
|
165 | - $more = ' <a href="' . get_permalink() . '" class="more-link">' . $more_link_text . '</a>'; |
|
166 | - $more = apply_filters( 'the_content_more_link', $more, $more_link_text ); |
|
162 | + if ( ! empty($num_words)) { |
|
163 | + if (empty($more)) { |
|
164 | + $more_link_text = __('(more…)'); |
|
165 | + $more = ' <a href="'.get_permalink().'" class="more-link">'.$more_link_text.'</a>'; |
|
166 | + $more = apply_filters('the_content_more_link', $more, $more_link_text); |
|
167 | 167 | } |
168 | - $content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' )); |
|
168 | + $content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK')); |
|
169 | 169 | |
170 | - $content = wp_trim_words( $content, $num_words, ' ' ) . $more; |
|
170 | + $content = wp_trim_words($content, $num_words, ' ').$more; |
|
171 | 171 | } else { |
172 | - $content = get_the_content(); |
|
172 | + $content = get_the_content(); |
|
173 | 173 | } |
174 | 174 | global $allowedtags; |
175 | - $content = wp_kses( $content, $allowedtags ); |
|
176 | - $content = strip_shortcodes( $content ); |
|
177 | - echo apply_filters( 'the_content', $content ); |
|
175 | + $content = wp_kses($content, $allowedtags); |
|
176 | + $content = strip_shortcodes($content); |
|
177 | + echo apply_filters('the_content', $content); |
|
178 | 178 | |
179 | 179 | } else { |
180 | 180 | // admin has chosen "none" for the "Event Espresso - Events > Templates > Display Description" option |
181 | - echo apply_filters( 'the_content', '' ); |
|
181 | + echo apply_filters('the_content', ''); |
|
182 | 182 | } |
183 | 183 | return ob_get_clean(); |
184 | 184 | } |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | * @param int $EVT_ID |
193 | 193 | * @return EE_Ticket[] |
194 | 194 | */ |
195 | - public static function event_tickets_available( $EVT_ID = 0 ) { |
|
196 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
195 | + public static function event_tickets_available($EVT_ID = 0) { |
|
196 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
197 | 197 | $tickets_available_for_purchase = array(); |
198 | - if( $event instanceof EE_Event ) { |
|
199 | - $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, FALSE ); |
|
200 | - foreach( $datetimes as $datetime ) { |
|
201 | - $tickets_available_for_purchase = array_merge( $tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase() ); |
|
198 | + if ($event instanceof EE_Event) { |
|
199 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, FALSE); |
|
200 | + foreach ($datetimes as $datetime) { |
|
201 | + $tickets_available_for_purchase = array_merge($tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase()); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | return $tickets_available_for_purchase; |
@@ -214,22 +214,22 @@ discard block |
||
214 | 214 | * @param bool $hide_uncategorized |
215 | 215 | * @return string |
216 | 216 | */ |
217 | - public static function event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE ) { |
|
217 | + public static function event_categories($EVT_ID = 0, $hide_uncategorized = TRUE) { |
|
218 | 218 | $category_links = array(); |
219 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
220 | - if ( $event instanceof EE_Event ) { |
|
221 | - $event_categories = get_the_terms( $event->ID(), 'espresso_event_categories' ); |
|
222 | - if ( $event_categories ) { |
|
219 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
220 | + if ($event instanceof EE_Event) { |
|
221 | + $event_categories = get_the_terms($event->ID(), 'espresso_event_categories'); |
|
222 | + if ($event_categories) { |
|
223 | 223 | // loop thru terms and create links |
224 | - foreach ( $event_categories as $term ) { |
|
225 | - $url = get_term_link( $term, 'espresso_venue_categories' ); |
|
226 | - if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) { |
|
227 | - $category_links[] = '<a href="' . esc_url( $url ) . '" rel="tag">' . $term->name . '</a>'; |
|
224 | + foreach ($event_categories as $term) { |
|
225 | + $url = get_term_link($term, 'espresso_venue_categories'); |
|
226 | + if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) { |
|
227 | + $category_links[] = '<a href="'.esc_url($url).'" rel="tag">'.$term->name.'</a>'; |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | } |
231 | 231 | } |
232 | - return implode( ', ', $category_links ); |
|
232 | + return implode(', ', $category_links); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | |
@@ -243,10 +243,10 @@ discard block |
||
243 | 243 | * @param int $EVT_ID |
244 | 244 | * @return string |
245 | 245 | */ |
246 | - public static function the_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
247 | - $datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
248 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
249 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) : ''; |
|
246 | + public static function the_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
247 | + $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
248 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
249 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : ''; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | * @param int $EVT_ID |
261 | 261 | * @return string |
262 | 262 | */ |
263 | - public static function the_event_end_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
264 | - $datetime = EEH_Event_View::get_last_date_obj( $EVT_ID ); |
|
265 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
266 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : ''; |
|
263 | + public static function the_event_end_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
264 | + $datetime = EEH_Event_View::get_last_date_obj($EVT_ID); |
|
265 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
266 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : ''; |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -277,10 +277,10 @@ discard block |
||
277 | 277 | * @param int $EVT_ID |
278 | 278 | * @return string |
279 | 279 | */ |
280 | - public static function the_earliest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
281 | - $datetime = EEH_Event_View::get_earliest_date_obj( $EVT_ID ); |
|
282 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
283 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) : ''; |
|
280 | + public static function the_earliest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
281 | + $datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID); |
|
282 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
283 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : ''; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | |
@@ -294,10 +294,10 @@ discard block |
||
294 | 294 | * @param int $EVT_ID |
295 | 295 | * @return string |
296 | 296 | */ |
297 | - public static function the_latest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
298 | - $datetime = EEH_Event_View::get_last_date_obj( $EVT_ID ); |
|
299 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
300 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : ''; |
|
297 | + public static function the_latest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
298 | + $datetime = EEH_Event_View::get_last_date_obj($EVT_ID); |
|
299 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
300 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : ''; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | |
@@ -309,13 +309,13 @@ discard block |
||
309 | 309 | * @param int $EVT_ID |
310 | 310 | * @return string |
311 | 311 | */ |
312 | - public static function event_date_as_calendar_page( $EVT_ID = 0 ) { |
|
313 | - $datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
314 | - if ( $datetime instanceof EE_Datetime ) { |
|
312 | + public static function event_date_as_calendar_page($EVT_ID = 0) { |
|
313 | + $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
314 | + if ($datetime instanceof EE_Datetime) { |
|
315 | 315 | ?> |
316 | 316 | <div class="event-date-calendar-page-dv"> |
317 | - <div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime( 'DTT_EVT_start', 'M' );?></div> |
|
318 | - <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date( 'd' );?></div> |
|
317 | + <div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime('DTT_EVT_start', 'M'); ?></div> |
|
318 | + <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date('d'); ?></div> |
|
319 | 319 | </div> |
320 | 320 | <?php |
321 | 321 | } |
@@ -330,17 +330,17 @@ discard block |
||
330 | 330 | * @param int $EVT_ID |
331 | 331 | * @return string |
332 | 332 | */ |
333 | - public static function get_primary_date_obj( $EVT_ID = 0 ) { |
|
334 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
335 | - if ( $event instanceof EE_Event ) { |
|
333 | + public static function get_primary_date_obj($EVT_ID = 0) { |
|
334 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
335 | + if ($event instanceof EE_Event) { |
|
336 | 336 | $datetimes = $event->get_many_related( |
337 | 337 | 'Datetime', |
338 | 338 | array( |
339 | 339 | 'limit' => 1, |
340 | - 'order_by' => array( 'DTT_order' => 'ASC' ) |
|
340 | + 'order_by' => array('DTT_order' => 'ASC') |
|
341 | 341 | ) |
342 | 342 | ); |
343 | - return reset( $datetimes ); |
|
343 | + return reset($datetimes); |
|
344 | 344 | } else { |
345 | 345 | return FALSE; |
346 | 346 | } |
@@ -355,17 +355,17 @@ discard block |
||
355 | 355 | * @param int $EVT_ID |
356 | 356 | * @return string |
357 | 357 | */ |
358 | - public static function get_last_date_obj( $EVT_ID = 0 ) { |
|
359 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
360 | - if ( $event instanceof EE_Event ) { |
|
358 | + public static function get_last_date_obj($EVT_ID = 0) { |
|
359 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
360 | + if ($event instanceof EE_Event) { |
|
361 | 361 | $datetimes = $event->get_many_related( |
362 | 362 | 'Datetime', |
363 | 363 | array( |
364 | 364 | 'limit' => 1, |
365 | - 'order_by' => array( 'DTT_order' => 'DESC' ) |
|
365 | + 'order_by' => array('DTT_order' => 'DESC') |
|
366 | 366 | ) |
367 | 367 | ); |
368 | - return end( $datetimes ); |
|
368 | + return end($datetimes); |
|
369 | 369 | } else { |
370 | 370 | return FALSE; |
371 | 371 | } |
@@ -380,17 +380,17 @@ discard block |
||
380 | 380 | * @param int $EVT_ID |
381 | 381 | * @return string |
382 | 382 | */ |
383 | - public static function get_earliest_date_obj( $EVT_ID = 0 ) { |
|
384 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
385 | - if ( $event instanceof EE_Event ) { |
|
383 | + public static function get_earliest_date_obj($EVT_ID = 0) { |
|
384 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
385 | + if ($event instanceof EE_Event) { |
|
386 | 386 | $datetimes = $event->get_many_related( |
387 | 387 | 'Datetime', |
388 | 388 | array( |
389 | 389 | 'limit' => 1, |
390 | - 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) |
|
390 | + 'order_by' => array('DTT_EVT_start' => 'ASC') |
|
391 | 391 | ) |
392 | 392 | ); |
393 | - return reset( $datetimes ); |
|
393 | + return reset($datetimes); |
|
394 | 394 | } else { |
395 | 395 | return FALSE; |
396 | 396 | } |
@@ -405,17 +405,17 @@ discard block |
||
405 | 405 | * @param int $EVT_ID |
406 | 406 | * @return string |
407 | 407 | */ |
408 | - public static function get_latest_date_obj( $EVT_ID = 0 ) { |
|
409 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
410 | - if ( $event instanceof EE_Event ) { |
|
408 | + public static function get_latest_date_obj($EVT_ID = 0) { |
|
409 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
410 | + if ($event instanceof EE_Event) { |
|
411 | 411 | $datetimes = $event->get_many_related( |
412 | 412 | 'Datetime', |
413 | 413 | array( |
414 | 414 | 'limit' => 1, |
415 | - 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) |
|
415 | + 'order_by' => array('DTT_EVT_start' => 'DESC') |
|
416 | 416 | ) |
417 | 417 | ); |
418 | - return end( $datetimes ); |
|
418 | + return end($datetimes); |
|
419 | 419 | } else { |
420 | 420 | return FALSE; |
421 | 421 | } |
@@ -433,17 +433,17 @@ discard block |
||
433 | 433 | * @param null $limit |
434 | 434 | * @return EE_Datetime[] |
435 | 435 | */ |
436 | - public static function get_all_date_obj( $EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL ) { |
|
437 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
438 | - if($include_expired === null){ |
|
439 | - if($event instanceof EE_Event && $event->is_expired()){ |
|
436 | + public static function get_all_date_obj($EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL) { |
|
437 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
438 | + if ($include_expired === null) { |
|
439 | + if ($event instanceof EE_Event && $event->is_expired()) { |
|
440 | 440 | $include_expired = true; |
441 | - }else{ |
|
441 | + } else { |
|
442 | 442 | $include_expired = false; |
443 | 443 | } |
444 | 444 | } |
445 | 445 | |
446 | - if ( $event instanceof EE_Event ) { |
|
446 | + if ($event instanceof EE_Event) { |
|
447 | 447 | return $event->datetimes_ordered($include_expired, $include_deleted, $limit); |
448 | 448 | } else { |
449 | 449 | return array(); |
@@ -459,11 +459,11 @@ discard block |
||
459 | 459 | * @param int $EVT_ID |
460 | 460 | * @return string |
461 | 461 | */ |
462 | - public static function event_link_url( $EVT_ID = 0 ) { |
|
463 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
464 | - if ( $event instanceof EE_Event ) { |
|
465 | - $url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink( $event->ID() ); |
|
466 | - return preg_match( "~^(?:f|ht)tps?://~i", $url ) ? $url : 'http://' . $url; |
|
462 | + public static function event_link_url($EVT_ID = 0) { |
|
463 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
464 | + if ($event instanceof EE_Event) { |
|
465 | + $url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink($event->ID()); |
|
466 | + return preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'http://'.$url; |
|
467 | 467 | } |
468 | 468 | return NULL; |
469 | 469 | } |
@@ -477,10 +477,10 @@ discard block |
||
477 | 477 | * @param int $EVT_ID |
478 | 478 | * @return string |
479 | 479 | */ |
480 | - public static function event_phone( $EVT_ID = 0 ) { |
|
481 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
482 | - if ( $event instanceof EE_Event ) { |
|
483 | - return EEH_Schema::telephone( $event->phone() ); |
|
480 | + public static function event_phone($EVT_ID = 0) { |
|
481 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
482 | + if ($event instanceof EE_Event) { |
|
483 | + return EEH_Schema::telephone($event->phone()); |
|
484 | 484 | } |
485 | 485 | return NULL; |
486 | 486 | } |
@@ -497,23 +497,23 @@ discard block |
||
497 | 497 | * @param string $after |
498 | 498 | * @return string |
499 | 499 | */ |
500 | - public static function edit_event_link( $EVT_ID = 0, $link = '', $before = '', $after = '' ) { |
|
501 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
502 | - if ( $event instanceof EE_Event ) { |
|
500 | + public static function edit_event_link($EVT_ID = 0, $link = '', $before = '', $after = '') { |
|
501 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
502 | + if ($event instanceof EE_Event) { |
|
503 | 503 | // can the user edit this post ? |
504 | - if ( current_user_can( 'edit_post', $event->ID() )) { |
|
504 | + if (current_user_can('edit_post', $event->ID())) { |
|
505 | 505 | // set link text |
506 | - $link = ! empty( $link ) ? $link : __('edit this event'); |
|
506 | + $link = ! empty($link) ? $link : __('edit this event'); |
|
507 | 507 | // generate nonce |
508 | - $nonce = wp_create_nonce( 'edit_nonce' ); |
|
508 | + $nonce = wp_create_nonce('edit_nonce'); |
|
509 | 509 | // generate url to event editor for this event |
510 | - $url = add_query_arg( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce ), admin_url() ); |
|
510 | + $url = add_query_arg(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce), admin_url()); |
|
511 | 511 | // get edit CPT text |
512 | - $post_type_obj = get_post_type_object( 'espresso_events' ); |
|
512 | + $post_type_obj = get_post_type_object('espresso_events'); |
|
513 | 513 | // build final link html |
514 | - $link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( $post_type_obj->labels->edit_item ) . '">' . $link . '</a>'; |
|
514 | + $link = '<a class="post-edit-link" href="'.$url.'" title="'.esc_attr($post_type_obj->labels->edit_item).'">'.$link.'</a>'; |
|
515 | 515 | // put it all together |
516 | - return $before . apply_filters( 'edit_post_link', $link, $event->ID() ) . $after; |
|
516 | + return $before.apply_filters('edit_post_link', $link, $event->ID()).$after; |
|
517 | 517 | } |
518 | 518 | } |
519 | 519 | return ''; |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * Event Details |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage /modules/event_details/ |
|
20 | - * @author Brent Christensen |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * Event Details |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage /modules/event_details/ |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | class EED_Event_Single extends EED_Module { |
25 | 25 | |
26 | 26 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @return EED_Event_Single |
41 | 41 | */ |
42 | 42 | public static function instance() { |
43 | - return parent::get_instance( __CLASS__ ); |
|
43 | + return parent::get_instance(__CLASS__); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @return void |
53 | 53 | */ |
54 | 54 | public static function set_hooks() { |
55 | - add_filter( 'FHEE_run_EE_wp', '__return_true' ); |
|
56 | - add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 ); |
|
57 | - EE_Config::register_route( __( 'event', 'event_espresso' ), 'Event_Single', 'run' ); |
|
55 | + add_filter('FHEE_run_EE_wp', '__return_true'); |
|
56 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
57 | + EE_Config::register_route(__('event', 'event_espresso'), 'Event_Single', 'run'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return void |
65 | 65 | */ |
66 | 66 | public static function set_hooks_admin() { |
67 | - add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 ); |
|
67 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * @return void |
79 | 79 | */ |
80 | 80 | public static function set_definitions() { |
81 | - define( 'EVENT_SINGLE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
82 | - define( 'EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS ); |
|
81 | + define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
82 | + define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @void |
91 | 91 | */ |
92 | - protected function set_config(){ |
|
93 | - $this->set_config_section( 'template_settings' ); |
|
94 | - $this->set_config_class( 'EE_Event_Single_Config' ); |
|
95 | - $this->set_config_name( 'EED_Event_Single' ); |
|
92 | + protected function set_config() { |
|
93 | + $this->set_config_section('template_settings'); |
|
94 | + $this->set_config_class('EE_Event_Single_Config'); |
|
95 | + $this->set_config_name('EED_Event_Single'); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -105,35 +105,35 @@ discard block |
||
105 | 105 | * @param \EE_Event_Single_Config $config |
106 | 106 | * @return \EE_Template_Part_Manager |
107 | 107 | */ |
108 | - public function initialize_template_parts( EE_Event_Single_Config $config = null ) { |
|
108 | + public function initialize_template_parts(EE_Event_Single_Config $config = null) { |
|
109 | 109 | $config = $config instanceof EE_Event_Single_Config ? $config : $this->config(); |
110 | 110 | EEH_Autoloader::instance()->register_template_part_autoloaders(); |
111 | 111 | $template_parts = new EE_Template_Part_Manager(); |
112 | 112 | $template_parts->add_template_part( |
113 | 113 | 'tickets', |
114 | - __( 'Ticket Selector', 'event_espresso' ), |
|
114 | + __('Ticket Selector', 'event_espresso'), |
|
115 | 115 | 'content-espresso_events-tickets.php', |
116 | 116 | $config->display_order_tickets |
117 | 117 | ); |
118 | 118 | $template_parts->add_template_part( |
119 | 119 | 'datetimes', |
120 | - __( 'Dates and Times', 'event_espresso' ), |
|
120 | + __('Dates and Times', 'event_espresso'), |
|
121 | 121 | 'content-espresso_events-datetimes.php', |
122 | 122 | $config->display_order_datetimes |
123 | 123 | ); |
124 | 124 | $template_parts->add_template_part( |
125 | 125 | 'event', |
126 | - __( 'Event Description', 'event_espresso' ), |
|
126 | + __('Event Description', 'event_espresso'), |
|
127 | 127 | 'content-espresso_events-details.php', |
128 | 128 | $config->display_order_event |
129 | 129 | ); |
130 | 130 | $template_parts->add_template_part( |
131 | 131 | 'venue', |
132 | - __( 'Venue Information', 'event_espresso' ), |
|
132 | + __('Venue Information', 'event_espresso'), |
|
133 | 133 | 'content-espresso_events-venues.php', |
134 | 134 | $config->display_order_venue |
135 | 135 | ); |
136 | - do_action( 'AHEE__EED_Event_Single__initialize_template_parts', $template_parts ); |
|
136 | + do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts); |
|
137 | 137 | return $template_parts; |
138 | 138 | } |
139 | 139 | |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | * @param WP $WP |
148 | 148 | * @return void |
149 | 149 | */ |
150 | - public function run( $WP ) { |
|
150 | + public function run($WP) { |
|
151 | 151 | // ensure valid EE_Events_Single_Config() object exists |
152 | 152 | $this->set_config(); |
153 | 153 | // check what template is loaded |
154 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
155 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
154 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
155 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
156 | 156 | // load css |
157 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
157 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -166,27 +166,27 @@ discard block |
||
166 | 166 | * @param string $template |
167 | 167 | * @return string |
168 | 168 | */ |
169 | - public function template_include( $template ) { |
|
169 | + public function template_include($template) { |
|
170 | 170 | global $post; |
171 | 171 | /** @type EE_Event_Single_Config $config */ |
172 | 172 | $config = $this->config(); |
173 | - if ( $config->display_status_banner_single ) { |
|
174 | - add_filter( 'the_title', array( 'EED_Event_Single', 'the_title' ), 100, 2 ); |
|
173 | + if ($config->display_status_banner_single) { |
|
174 | + add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2); |
|
175 | 175 | } |
176 | 176 | // not a custom template? |
177 | 177 | if ( |
178 | 178 | EE_Front_Controller::instance()->get_selected_template() != 'single-espresso_events.php' |
179 | - || apply_filters( 'FHEE__EED_Event_Single__template_include__allow_custom_selected_template', FALSE ) |
|
180 | - && ! post_password_required( $post ) |
|
179 | + || apply_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template', FALSE) |
|
180 | + && ! post_password_required($post) |
|
181 | 181 | ) { |
182 | 182 | EEH_Template::load_espresso_theme_functions(); |
183 | 183 | // then add extra event data via hooks |
184 | - add_action( 'loop_start', array( 'EED_Event_Single', 'loop_start' )); |
|
185 | - add_filter( 'get_the_excerpt', array( 'EED_Event_Single', 'get_the_excerpt' ), 1, 1 ); |
|
186 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
187 | - add_action( 'loop_end', array( 'EED_Event_Single', 'loop_end' )); |
|
184 | + add_action('loop_start', array('EED_Event_Single', 'loop_start')); |
|
185 | + add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1); |
|
186 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
187 | + add_action('loop_end', array('EED_Event_Single', 'loop_end')); |
|
188 | 188 | // don't display entry meta because the existing theme will take car of that |
189 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
189 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
190 | 190 | } |
191 | 191 | return $template; |
192 | 192 | } |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | * @param array $wp_query_array an array containing the WP_Query object |
201 | 201 | * @return void |
202 | 202 | */ |
203 | - public static function loop_start( $wp_query_array ) { |
|
203 | + public static function loop_start($wp_query_array) { |
|
204 | 204 | global $post; |
205 | - do_action( 'AHEE_event_details_before_post', $post, $wp_query_array ); |
|
205 | + do_action('AHEE_event_details_before_post', $post, $wp_query_array); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | * @param int $id |
216 | 216 | * @return string |
217 | 217 | */ |
218 | - public static function the_title( $title = '', $id = 0 ) { |
|
218 | + public static function the_title($title = '', $id = 0) { |
|
219 | 219 | global $post; |
220 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
220 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | * @param string $excerpt |
230 | 230 | * @return string |
231 | 231 | */ |
232 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
232 | + public static function get_the_excerpt($excerpt = '') { |
|
233 | 233 | EED_Event_Single::$using_get_the_excerpt = true; |
234 | - add_filter( 'wp_trim_excerpt', array( 'EED_Event_Single', 'end_get_the_excerpt' ), 999, 1 ); |
|
234 | + add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1); |
|
235 | 235 | return $excerpt; |
236 | 236 | } |
237 | 237 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @param string $text |
245 | 245 | * @return string |
246 | 246 | */ |
247 | - public static function end_get_the_excerpt( $text = '' ) { |
|
247 | + public static function end_get_the_excerpt($text = '') { |
|
248 | 248 | EED_Event_Single::$using_get_the_excerpt = false; |
249 | 249 | return $text; |
250 | 250 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @param string $content |
259 | 259 | * @return string |
260 | 260 | */ |
261 | - public static function event_details( $content ) { |
|
261 | + public static function event_details($content) { |
|
262 | 262 | global $post; |
263 | 263 | static $current_post_ID = 0; |
264 | 264 | if ( |
@@ -273,15 +273,15 @@ discard block |
||
273 | 273 | // We want to allow those plugins to still do their thing and have access to our content, but depending on |
274 | 274 | // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
275 | 275 | // so the following allows this filter to be applied multiple times, but only once for real |
276 | - $current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0; |
|
277 | - if ( EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order ) { |
|
276 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
277 | + if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) { |
|
278 | 278 | // we need to first remove this callback from being applied to the_content() |
279 | 279 | // (otherwise it will recurse and blow up the interweb) |
280 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
280 | + remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
281 | 281 | EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts(); |
282 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
283 | - $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters( $content ); |
|
284 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
282 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
283 | + $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content); |
|
284 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
285 | 285 | } else { |
286 | 286 | $content = EED_Event_Single::use_filterable_display_order(); |
287 | 287 | } |
@@ -302,19 +302,19 @@ discard block |
||
302 | 302 | // it uses the_content() for displaying the $post->post_content |
303 | 303 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
304 | 304 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
305 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
305 | + remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
306 | 306 | //now add additional content |
307 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110, 1 ); |
|
308 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120, 1 ); |
|
309 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130, 1 ); |
|
310 | - do_action( 'AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters' ); |
|
307 | + add_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110, 1); |
|
308 | + add_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120, 1); |
|
309 | + add_filter('the_content', array('EED_Event_Single', 'event_venues'), 130, 1); |
|
310 | + do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters'); |
|
311 | 311 | // now load our template |
312 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
312 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
313 | 313 | //now add our filter back in, plus some others |
314 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
315 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110 ); |
|
316 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120 ); |
|
317 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130 ); |
|
314 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
315 | + remove_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110); |
|
316 | + remove_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120); |
|
317 | + remove_filter('the_content', array('EED_Event_Single', 'event_venues'), 130); |
|
318 | 318 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
319 | 319 | return $content; |
320 | 320 | } |
@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | * @param string $content |
329 | 329 | * @return string |
330 | 330 | */ |
331 | - public static function event_datetimes( $content ) { |
|
332 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
331 | + public static function event_datetimes($content) { |
|
332 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | * @param string $content |
342 | 342 | * @return string |
343 | 343 | */ |
344 | - public static function event_tickets( $content ) { |
|
345 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
344 | + public static function event_tickets($content) { |
|
345 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | * @param string $content |
355 | 355 | * @return string |
356 | 356 | */ |
357 | - public static function event_venue( $content ) { |
|
358 | - return EED_Event_Single::event_venues( $content ); |
|
357 | + public static function event_venue($content) { |
|
358 | + return EED_Event_Single::event_venues($content); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | * @param string $content |
368 | 368 | * @return string |
369 | 369 | */ |
370 | - public static function event_venues( $content ) { |
|
371 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
370 | + public static function event_venues($content) { |
|
371 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | |
@@ -380,9 +380,9 @@ discard block |
||
380 | 380 | * @param array $wp_query_array an array containing the WP_Query object |
381 | 381 | * @return void |
382 | 382 | */ |
383 | - public static function loop_end( $wp_query_array ) { |
|
383 | + public static function loop_end($wp_query_array) { |
|
384 | 384 | global $post; |
385 | - do_action( 'AHEE_event_details_after_post', $post, $wp_query_array ); |
|
385 | + do_action('AHEE_event_details_after_post', $post, $wp_query_array); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -395,16 +395,16 @@ discard block |
||
395 | 395 | */ |
396 | 396 | public function wp_enqueue_scripts() { |
397 | 397 | // get some style |
398 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && apply_filters( 'FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE )) { |
|
398 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE)) { |
|
399 | 399 | // first check uploads folder |
400 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
401 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
400 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
401 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
402 | 402 | } else { |
403 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
403 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
404 | 404 | } |
405 | - wp_enqueue_script( $this->theme ); |
|
406 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
407 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
405 | + wp_enqueue_script($this->theme); |
|
406 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
407 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
408 | 408 | } |
409 | 409 | } |
410 | 410 | } |
@@ -425,9 +425,9 @@ discard block |
||
425 | 425 | public static function display_venue() { |
426 | 426 | /** @type EE_Event_Single_Config $config */ |
427 | 427 | $config = EED_Event_Single::instance()->config(); |
428 | - $display_venue= isset( $config->display_venue ) ? $config->display_venue : TRUE; |
|
428 | + $display_venue = isset($config->display_venue) ? $config->display_venue : TRUE; |
|
429 | 429 | $venue_name = EEH_Venue_View::venue_name(); |
430 | - return $display_venue && ! empty( $venue_name ) ? TRUE : FALSE; |
|
430 | + return $display_venue && ! empty($venue_name) ? TRUE : FALSE; |
|
431 | 431 | } |
432 | 432 | |
433 | 433 |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * |
|
4 | - * EED_Ticket_Selector_Caff |
|
5 | - * |
|
6 | - * @package Event Espresso |
|
7 | - * @subpackage /modules/events_archive_caff/ |
|
8 | - * @author Brent Christensen |
|
9 | - * |
|
10 | - * ------------------------------------------------------------------------ |
|
11 | - */ |
|
3 | + * |
|
4 | + * EED_Ticket_Selector_Caff |
|
5 | + * |
|
6 | + * @package Event Espresso |
|
7 | + * @subpackage /modules/events_archive_caff/ |
|
8 | + * @author Brent Christensen |
|
9 | + * |
|
10 | + * ------------------------------------------------------------------------ |
|
11 | + */ |
|
12 | 12 | class EED_Ticket_Selector_Caff extends EED_Ticket_Selector { |
13 | 13 | |
14 | 14 |