@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * Loads the class file for a given class name. |
112 | 112 | * |
113 | 113 | * @param string $class The fully-qualified class name. |
114 | - * @return mixed The mapped file name on success, or boolean false on |
|
114 | + * @return string|false The mapped file name on success, or boolean false on |
|
115 | 115 | * failure. |
116 | 116 | */ |
117 | 117 | public function loadClass( $class ) { |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @param string $prefix The namespace prefix. |
146 | 146 | * @param string $relative_class The relative class name. |
147 | - * @return mixed Boolean false if no mapped file can be loaded, or the |
|
147 | + * @return false|string Boolean false if no mapped file can be loaded, or the |
|
148 | 148 | * name of the mapped file that was loaded. |
149 | 149 | */ |
150 | 150 | protected function loadMappedFile( $prefix, $relative_class ) { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @return void |
73 | 73 | */ |
74 | 74 | public function register() { |
75 | - spl_autoload_register( array( $this, 'loadClass' ) ); |
|
75 | + spl_autoload_register(array($this, 'loadClass')); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
@@ -88,20 +88,20 @@ discard block |
||
88 | 88 | * than last. |
89 | 89 | * @return void |
90 | 90 | */ |
91 | - public function addNamespace( $prefix, $base_dir, $prepend = false ) { |
|
91 | + public function addNamespace($prefix, $base_dir, $prepend = false) { |
|
92 | 92 | // normalize namespace prefix |
93 | - $prefix = trim( $prefix, '\\' ) . '\\'; |
|
93 | + $prefix = trim($prefix, '\\').'\\'; |
|
94 | 94 | // normalize the base directory with a trailing separator |
95 | - $base_dir = rtrim( $base_dir, DIRECTORY_SEPARATOR ) . '/'; |
|
95 | + $base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR).'/'; |
|
96 | 96 | // initialize the namespace prefix array |
97 | - if ( isset( $this->prefixes[ $prefix ] ) === false ) { |
|
98 | - $this->prefixes[ $prefix ] = array(); |
|
97 | + if (isset($this->prefixes[$prefix]) === false) { |
|
98 | + $this->prefixes[$prefix] = array(); |
|
99 | 99 | } |
100 | 100 | // retain the base directory for the namespace prefix |
101 | - if ( $prepend ) { |
|
102 | - array_unshift( $this->prefixes[ $prefix ], $base_dir ); |
|
101 | + if ($prepend) { |
|
102 | + array_unshift($this->prefixes[$prefix], $base_dir); |
|
103 | 103 | } else { |
104 | - array_push( $this->prefixes[ $prefix ], $base_dir ); |
|
104 | + array_push($this->prefixes[$prefix], $base_dir); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
@@ -114,24 +114,24 @@ discard block |
||
114 | 114 | * @return mixed The mapped file name on success, or boolean false on |
115 | 115 | * failure. |
116 | 116 | */ |
117 | - public function loadClass( $class ) { |
|
117 | + public function loadClass($class) { |
|
118 | 118 | // the current namespace prefix |
119 | 119 | $prefix = $class; |
120 | 120 | // work backwards through the namespace names of the fully-qualified |
121 | 121 | // class name to find a mapped file name |
122 | - while ( false !== $pos = strrpos( $prefix, '\\' ) ) { |
|
122 | + while (false !== $pos = strrpos($prefix, '\\')) { |
|
123 | 123 | // retain the trailing namespace separator in the prefix |
124 | - $prefix = substr( $class, 0, $pos + 1 ); |
|
124 | + $prefix = substr($class, 0, $pos + 1); |
|
125 | 125 | // the rest is the relative class name |
126 | - $relative_class = substr( $class, $pos + 1 ); |
|
126 | + $relative_class = substr($class, $pos + 1); |
|
127 | 127 | // try to load a mapped file for the prefix and relative class |
128 | - $mapped_file = $this->loadMappedFile( $prefix, $relative_class ); |
|
129 | - if ( $mapped_file ) { |
|
128 | + $mapped_file = $this->loadMappedFile($prefix, $relative_class); |
|
129 | + if ($mapped_file) { |
|
130 | 130 | return $mapped_file; |
131 | 131 | } |
132 | 132 | // remove the trailing namespace separator for the next iteration |
133 | 133 | // of strrpos() |
134 | - $prefix = rtrim( $prefix, '\\' ); |
|
134 | + $prefix = rtrim($prefix, '\\'); |
|
135 | 135 | } |
136 | 136 | // never found a mapped file |
137 | 137 | return false; |
@@ -147,21 +147,21 @@ discard block |
||
147 | 147 | * @return mixed Boolean false if no mapped file can be loaded, or the |
148 | 148 | * name of the mapped file that was loaded. |
149 | 149 | */ |
150 | - protected function loadMappedFile( $prefix, $relative_class ) { |
|
150 | + protected function loadMappedFile($prefix, $relative_class) { |
|
151 | 151 | // are there any base directories for this namespace prefix? |
152 | - if ( isset( $this->prefixes[ $prefix ] ) === false ) { |
|
152 | + if (isset($this->prefixes[$prefix]) === false) { |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | // look through base directories for this namespace prefix |
156 | - foreach ( $this->prefixes[ $prefix ] as $base_dir ) { |
|
156 | + foreach ($this->prefixes[$prefix] as $base_dir) { |
|
157 | 157 | // replace the namespace prefix with the base directory, |
158 | 158 | // replace namespace separators with directory separators |
159 | 159 | // in the relative class name, append with .php |
160 | 160 | $file = $base_dir |
161 | - . str_replace( '\\', '/', $relative_class ) |
|
161 | + . str_replace('\\', '/', $relative_class) |
|
162 | 162 | . '.php'; |
163 | 163 | // if the mapped file exists, require it |
164 | - if ( $this->requireFile( $file ) ) { |
|
164 | + if ($this->requireFile($file)) { |
|
165 | 165 | // yes, we're done |
166 | 166 | return $file; |
167 | 167 | } |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | * @param string $file The file to require. |
179 | 179 | * @return bool True if the file exists, false if not. |
180 | 180 | */ |
181 | - protected function requireFile( $file ) { |
|
182 | - if ( file_exists( $file ) ) { |
|
181 | + protected function requireFile($file) { |
|
182 | + if (file_exists($file)) { |
|
183 | 183 | require $file; |
184 | 184 | return true; |
185 | 185 | } |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -1199,7 +1200,9 @@ discard block |
||
1199 | 1200 | |
1200 | 1201 | |
1201 | 1202 | //if no postid then get out cause we need it for stuff in here |
1202 | - if ( empty( $postid ) ) return; |
|
1203 | + if ( empty( $postid ) ) { |
|
1204 | + return; |
|
1205 | + } |
|
1203 | 1206 | |
1204 | 1207 | |
1205 | 1208 | //handle datetime saves |
@@ -1440,10 +1443,11 @@ discard block |
||
1440 | 1443 | //get the earliest datetime (if present); |
1441 | 1444 | $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
1442 | 1445 | |
1443 | - if ( !empty( $earliest_dtt ) ) |
|
1444 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
|
1445 | - else |
|
1446 | - $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1446 | + if ( !empty( $earliest_dtt ) ) { |
|
1447 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
|
1448 | + } else { |
|
1449 | + $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1450 | + } |
|
1447 | 1451 | } |
1448 | 1452 | |
1449 | 1453 | $template_args = array_merge( $template_args, $price_args ); |
@@ -1674,8 +1678,9 @@ discard block |
||
1674 | 1678 | } |
1675 | 1679 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1676 | 1680 | |
1677 | - if ( $redirect_after ) |
|
1678 | - $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
1681 | + if ( $redirect_after ) { |
|
1682 | + $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
1683 | + } |
|
1679 | 1684 | } |
1680 | 1685 | |
1681 | 1686 | /** |
@@ -1800,8 +1805,9 @@ discard block |
||
1800 | 1805 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1801 | 1806 | } |
1802 | 1807 | |
1803 | - if ( $redirect_after ) |
|
1804 | - $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
|
1808 | + if ( $redirect_after ) { |
|
1809 | + $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
|
1810 | + } |
|
1805 | 1811 | } |
1806 | 1812 | |
1807 | 1813 | /** |
@@ -2033,8 +2039,10 @@ discard block |
||
2033 | 2039 | * @return void |
2034 | 2040 | */ |
2035 | 2041 | private function _set_category_object() { |
2036 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
2037 | - return; //already have the category object so get out. |
|
2042 | + if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) { |
|
2043 | + return; |
|
2044 | + } |
|
2045 | + //already have the category object so get out. |
|
2038 | 2046 | |
2039 | 2047 | //set default category object |
2040 | 2048 | $this->_set_empty_category_object(); |
@@ -1345,7 +1345,7 @@ |
||
1345 | 1345 | * This just returns whatever is set as the _event object property |
1346 | 1346 | * |
1347 | 1347 | * //todo this will become obsolete once the models are in place |
1348 | - * @return object |
|
1348 | + * @return EE_CPT_Base |
|
1349 | 1349 | */ |
1350 | 1350 | public function get_event_object() { |
1351 | 1351 | return $this->_cpt_model_obj; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 'espresso_events' => 'edit' |
68 | 68 | ); |
69 | 69 | |
70 | - add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) ); |
|
70 | + add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | protected function _ajax_hooks() { |
@@ -93,20 +93,20 @@ discard block |
||
93 | 93 | 'edit' => __('Update Event', 'event_espresso'), |
94 | 94 | 'add_category' => __('Save New Category', 'event_espresso'), |
95 | 95 | 'edit_category' => __('Update Category', 'event_espresso'), |
96 | - 'template_settings' => __( 'Update Settings', 'event_espresso' ) |
|
96 | + 'template_settings' => __('Update Settings', 'event_espresso') |
|
97 | 97 | ) |
98 | 98 | ); |
99 | 99 | } |
100 | 100 | |
101 | 101 | protected function _set_page_routes() { |
102 | 102 | //load formatter helper |
103 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
103 | + EE_Registry::instance()->load_helper('Formatter'); |
|
104 | 104 | //load field generator helper |
105 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
105 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
106 | 106 | |
107 | 107 | //is there a evt_id in the request? |
108 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0; |
|
109 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
108 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0; |
|
109 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
110 | 110 | |
111 | 111 | |
112 | 112 | $this->_page_routes = array( |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | 'help_tour' => array( |
321 | 321 | 'Event_Editor_Help_Tour' |
322 | 322 | ), |
323 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
323 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
324 | 324 | 'require_nonce' => FALSE |
325 | 325 | ), |
326 | 326 | 'edit' => array( |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | 'help_tour' => array( |
377 | 377 | 'Event_Edit_Help_Tour' |
378 | 378 | ), |
379 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
379 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
380 | 380 | 'require_nonce' => FALSE |
381 | 381 | ), |
382 | 382 | 'default_event_settings' => array( |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | 'filename' => 'events_default_settings_status' |
399 | 399 | ) |
400 | 400 | ), |
401 | - 'help_tour' => array( 'Event_Default_Settings_Help_Tour'), |
|
401 | + 'help_tour' => array('Event_Default_Settings_Help_Tour'), |
|
402 | 402 | 'require_nonce' => FALSE |
403 | 403 | ), |
404 | 404 | //template settings |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | 'filename' => 'general_settings_templates' |
415 | 415 | ) |
416 | 416 | ), |
417 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
417 | + 'help_tour' => array('Templates_Help_Tour'), |
|
418 | 418 | 'require_nonce' => FALSE |
419 | 419 | ), |
420 | 420 | //event category stuff |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | 'label' => __('Edit Category', 'event_espresso'), |
439 | 439 | 'order' => 15, |
440 | 440 | 'persistent' => FALSE, |
441 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
441 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
442 | 442 | ), |
443 | 443 | 'help_tabs' => array( |
444 | 444 | 'edit_category_help_tab' => array( |
@@ -508,14 +508,14 @@ discard block |
||
508 | 508 | |
509 | 509 | public function load_scripts_styles() { |
510 | 510 | |
511 | - wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
512 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
511 | + wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
512 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
513 | 513 | wp_enqueue_style('events-admin-css'); |
514 | 514 | wp_enqueue_style('ee-cat-admin'); |
515 | 515 | //todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details |
516 | 516 | //registers for all views |
517 | 517 | //scripts |
518 | - wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE); |
|
518 | + wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | /** |
@@ -533,11 +533,11 @@ discard block |
||
533 | 533 | public function load_scripts_styles_edit() { |
534 | 534 | //styles |
535 | 535 | wp_enqueue_style('espresso-ui-theme'); |
536 | - wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
536 | + wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
537 | 537 | wp_enqueue_style('event-editor-css'); |
538 | 538 | |
539 | 539 | //scripts |
540 | - wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION ); |
|
540 | + wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION); |
|
541 | 541 | wp_enqueue_script('event-datetime-metabox'); |
542 | 542 | |
543 | 543 | } |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | |
573 | 573 | |
574 | 574 | public function admin_init() { |
575 | - EE_Registry::$i18n_js_strings[ 'image_confirm' ] = __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' ); |
|
575 | + EE_Registry::$i18n_js_strings['image_confirm'] = __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso'); |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | |
@@ -593,35 +593,35 @@ discard block |
||
593 | 593 | */ |
594 | 594 | public function verify_event_edit($event = NULL) { |
595 | 595 | // no event? |
596 | - if ( empty( $event )) { |
|
596 | + if (empty($event)) { |
|
597 | 597 | // set event |
598 | 598 | $event = $this->_cpt_model_obj; |
599 | 599 | } |
600 | 600 | // STILL no event? |
601 | - if ( empty ( $event )) { |
|
601 | + if (empty ($event)) { |
|
602 | 602 | return; |
603 | 603 | } |
604 | 604 | // first check if event is active. |
605 | - if ( $event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed ) { |
|
605 | + if ($event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed) { |
|
606 | 606 | return; |
607 | 607 | } |
608 | 608 | $orig_status = $event->status(); |
609 | 609 | //made it here so it IS active... next check that any of the tickets are sold. |
610 | - if ( $event->is_sold_out() || $event->is_sold_out(TRUE ) ) { |
|
611 | - if ( $event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out ) { |
|
612 | - EE_Error::add_attention( sprintf( |
|
613 | - __( 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You can change the status back to something else before updating if you wish.', 'event_espresso' ), |
|
614 | - EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' ) |
|
610 | + if ($event->is_sold_out() || $event->is_sold_out(TRUE)) { |
|
611 | + if ($event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out) { |
|
612 | + EE_Error::add_attention(sprintf( |
|
613 | + __('Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You can change the status back to something else before updating if you wish.', 'event_espresso'), |
|
614 | + EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence') |
|
615 | 615 | )); |
616 | 616 | } |
617 | 617 | return; |
618 | 618 | } |
619 | 619 | //now we need to determine if the event has any tickets on sale. If not then we dont' show the error |
620 | - if ( ! $event->tickets_on_sale() ) { |
|
620 | + if ( ! $event->tickets_on_sale()) { |
|
621 | 621 | return; |
622 | 622 | } |
623 | 623 | //made it here so show warning |
624 | - EE_Error::add_attention( $this->_edit_event_warning() ); |
|
624 | + EE_Error::add_attention($this->_edit_event_warning()); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | ), |
662 | 662 | ); |
663 | 663 | |
664 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
664 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
665 | 665 | $this->_views['trash'] = array( |
666 | 666 | 'slug' => 'trash', |
667 | 667 | 'label' => __('Trash', 'event_espresso'), |
@@ -691,39 +691,39 @@ discard block |
||
691 | 691 | 'desc' => __('View Registrations for Event', 'event_espresso') |
692 | 692 | ) |
693 | 693 | ); |
694 | - $items = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items ); |
|
694 | + $items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items); |
|
695 | 695 | $statuses = array( |
696 | 696 | 'sold_out_status' => array( |
697 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out, |
|
698 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' ) |
|
697 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out, |
|
698 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence') |
|
699 | 699 | ), |
700 | 700 | 'active_status' => array( |
701 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active, |
|
702 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' ) |
|
701 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active, |
|
702 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence') |
|
703 | 703 | ), |
704 | 704 | 'upcoming_status' => array( |
705 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming, |
|
706 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' ) |
|
705 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming, |
|
706 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence') |
|
707 | 707 | ), |
708 | 708 | 'postponed_status' => array( |
709 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed, |
|
710 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' ) |
|
709 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed, |
|
710 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence') |
|
711 | 711 | ), |
712 | 712 | 'cancelled_status' => array( |
713 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled, |
|
714 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' ) |
|
713 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled, |
|
714 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence') |
|
715 | 715 | ), |
716 | 716 | 'expired_status' => array( |
717 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired, |
|
718 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' ) |
|
717 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired, |
|
718 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence') |
|
719 | 719 | ), |
720 | 720 | 'inactive_status' => array( |
721 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive, |
|
722 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' ) |
|
721 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive, |
|
722 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence') |
|
723 | 723 | ) |
724 | 724 | ); |
725 | - $statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses ); |
|
726 | - return array_merge( $items, $statuses ); |
|
725 | + $statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses); |
|
726 | + return array_merge($items, $statuses); |
|
727 | 727 | } |
728 | 728 | |
729 | 729 | |
@@ -735,8 +735,8 @@ discard block |
||
735 | 735 | * @return EEM_Event |
736 | 736 | */ |
737 | 737 | private function _event_model() { |
738 | - if ( ! $this->_event_model instanceof EEM_Event ) { |
|
739 | - $this->_event_model = EE_Registry::instance()->load_model( 'Event' ); |
|
738 | + if ( ! $this->_event_model instanceof EEM_Event) { |
|
739 | + $this->_event_model = EE_Registry::instance()->load_model('Event'); |
|
740 | 740 | } |
741 | 741 | return $this->_event_model; |
742 | 742 | } |
@@ -755,12 +755,12 @@ discard block |
||
755 | 755 | * @param string $new_slug what the slug is |
756 | 756 | * @return string The new html string for the permalink area |
757 | 757 | */ |
758 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
758 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
759 | 759 | //make sure this is only when editing |
760 | - if ( !empty( $id ) ) { |
|
761 | - $post = get_post( $id ); |
|
762 | - $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> '; |
|
763 | - $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=\'' . $post->ID . '\']"">'; |
|
760 | + if ( ! empty($id)) { |
|
761 | + $post = get_post($id); |
|
762 | + $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> '; |
|
763 | + $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=\''.$post->ID.'\']"">'; |
|
764 | 764 | } |
765 | 765 | return $return; |
766 | 766 | } |
@@ -776,8 +776,8 @@ discard block |
||
776 | 776 | * @return string html for generated table |
777 | 777 | */ |
778 | 778 | protected function _events_overview_list_table() { |
779 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
780 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button' ) . |
|
779 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
780 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button'). |
|
781 | 781 | $this->_display_legend($this->_event_legend_items()); |
782 | 782 | $this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
783 | 783 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -795,51 +795,51 @@ discard block |
||
795 | 795 | |
796 | 796 | |
797 | 797 | |
798 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
798 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
799 | 799 | |
800 | - if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) { |
|
800 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') { |
|
801 | 801 | //getout we're not processing an event save. |
802 | 802 | return; |
803 | 803 | } |
804 | 804 | |
805 | 805 | $event_values = array( |
806 | - 'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0, |
|
807 | - 'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0, |
|
806 | + 'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0, |
|
807 | + 'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0, |
|
808 | 808 | 'EVT_additional_limit' => min( |
809 | - apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ), |
|
810 | - !empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ), |
|
811 | - 'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID, |
|
812 | - 'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0, |
|
813 | - 'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0, |
|
814 | - 'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL, |
|
815 | - 'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL, |
|
816 | - 'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL |
|
809 | + apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255), |
|
810 | + ! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ), |
|
811 | + 'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID, |
|
812 | + 'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0, |
|
813 | + 'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0, |
|
814 | + 'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL, |
|
815 | + 'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL, |
|
816 | + 'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL |
|
817 | 817 | ); |
818 | 818 | |
819 | 819 | //update event |
820 | - $success = $this->_event_model()->update_by_ID( $event_values, $post_id ); |
|
820 | + $success = $this->_event_model()->update_by_ID($event_values, $post_id); |
|
821 | 821 | |
822 | 822 | |
823 | 823 | //get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
824 | - $get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
825 | - $event = $this->_event_model()->get_one( array($get_one_where) ); |
|
824 | + $get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
825 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
826 | 826 | |
827 | 827 | |
828 | 828 | //the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons. |
829 | - $event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) ); |
|
829 | + $event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update'))); |
|
830 | 830 | |
831 | 831 | $att_success = TRUE; |
832 | 832 | |
833 | - foreach ( $event_update_callbacks as $e_callback ) { |
|
834 | - $_succ = call_user_func_array( $e_callback, array( $event, $this->_req_data ) ); |
|
835 | - $att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
833 | + foreach ($event_update_callbacks as $e_callback) { |
|
834 | + $_succ = call_user_func_array($e_callback, array($event, $this->_req_data)); |
|
835 | + $att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
836 | 836 | } |
837 | 837 | |
838 | 838 | //any errors? |
839 | - if ( $success && FALSE === $att_success ) { |
|
840 | - EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
841 | - } else if ( $success === FALSE ) { |
|
842 | - EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
839 | + if ($success && FALSE === $att_success) { |
|
840 | + EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
841 | + } else if ($success === FALSE) { |
|
842 | + EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
843 | 843 | } |
844 | 844 | } |
845 | 845 | |
@@ -849,14 +849,14 @@ discard block |
||
849 | 849 | /** |
850 | 850 | * @see parent::restore_item() |
851 | 851 | */ |
852 | - protected function _restore_cpt_item( $post_id, $revision_id ) { |
|
852 | + protected function _restore_cpt_item($post_id, $revision_id) { |
|
853 | 853 | //copy existing event meta to new post |
854 | 854 | $post_evt = $this->_event_model()->get_one_by_ID($post_id); |
855 | - if ( $post_evt instanceof EE_Event ) { |
|
855 | + if ($post_evt instanceof EE_Event) { |
|
856 | 856 | //meta revision restore |
857 | - $post_evt->restore_revision( $revision_id ); |
|
857 | + $post_evt->restore_revision($revision_id); |
|
858 | 858 | //related objs restore |
859 | - $post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) ); |
|
859 | + $post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price')); |
|
860 | 860 | } |
861 | 861 | } |
862 | 862 | |
@@ -869,52 +869,52 @@ discard block |
||
869 | 869 | * @param array $data The request data from the form |
870 | 870 | * @return bool Success or fail. |
871 | 871 | */ |
872 | - protected function _default_venue_update( $evtobj, $data ) { |
|
873 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
872 | + protected function _default_venue_update($evtobj, $data) { |
|
873 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
874 | 874 | $venue_model = EE_Registry::instance()->load_model('Venue'); |
875 | 875 | $rows_affected = NULL; |
876 | - $venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL; |
|
876 | + $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL; |
|
877 | 877 | |
878 | 878 | // very important. If we don't have a venue name... |
879 | 879 | // then we'll get out because not necessary to create empty venue |
880 | - if ( empty( $data['venue_title'] ) ) { |
|
880 | + if (empty($data['venue_title'])) { |
|
881 | 881 | return false; |
882 | 882 | } |
883 | 883 | |
884 | 884 | $venue_array = array( |
885 | 885 | 'VNU_wp_user' => $evtobj->get('EVT_wp_user'), |
886 | - 'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL, |
|
887 | - 'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL, |
|
888 | - 'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL, |
|
889 | - 'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL, |
|
890 | - 'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL, |
|
891 | - 'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL, |
|
892 | - 'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL, |
|
893 | - 'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL, |
|
894 | - 'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL, |
|
895 | - 'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL, |
|
896 | - 'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL, |
|
897 | - 'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL, |
|
898 | - 'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL, |
|
899 | - 'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL, |
|
900 | - 'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL, |
|
901 | - 'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0, |
|
886 | + 'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL, |
|
887 | + 'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL, |
|
888 | + 'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL, |
|
889 | + 'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL, |
|
890 | + 'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL, |
|
891 | + 'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL, |
|
892 | + 'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL, |
|
893 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL, |
|
894 | + 'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL, |
|
895 | + 'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL, |
|
896 | + 'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL, |
|
897 | + 'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL, |
|
898 | + 'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL, |
|
899 | + 'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL, |
|
900 | + 'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL, |
|
901 | + 'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0, |
|
902 | 902 | 'status' => 'publish' |
903 | 903 | ); |
904 | 904 | |
905 | 905 | |
906 | 906 | //if we've got the venue_id then we're just updating the existing venue so let's do that and then get out. |
907 | - if ( !empty( $venue_id ) ) { |
|
908 | - $update_where = array( $venue_model->primary_key_name() => $venue_id ); |
|
909 | - $rows_affected = $venue_model->update( $venue_array, array( $update_where ) ); |
|
907 | + if ( ! empty($venue_id)) { |
|
908 | + $update_where = array($venue_model->primary_key_name() => $venue_id); |
|
909 | + $rows_affected = $venue_model->update($venue_array, array($update_where)); |
|
910 | 910 | //we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present. |
911 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
911 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
912 | 912 | return $rows_affected > 0 ? TRUE : FALSE; |
913 | 913 | } else { |
914 | 914 | //we insert the venue |
915 | - $venue_id = $venue_model->insert( $venue_array ); |
|
916 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
917 | - return !empty( $venue_id ) ? TRUE : FALSE; |
|
915 | + $venue_id = $venue_model->insert($venue_array); |
|
916 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
917 | + return ! empty($venue_id) ? TRUE : FALSE; |
|
918 | 918 | } |
919 | 919 | //when we have the ancestor come in it's already been handled by the revision save. |
920 | 920 | } |
@@ -928,55 +928,55 @@ discard block |
||
928 | 928 | * @param array $data The request data from the form |
929 | 929 | * @return bool success or fail |
930 | 930 | */ |
931 | - protected function _default_tickets_update( EE_Event $evtobj, $data ) { |
|
931 | + protected function _default_tickets_update(EE_Event $evtobj, $data) { |
|
932 | 932 | $success = true; |
933 | 933 | $saved_dtt = null; |
934 | 934 | $saved_tickets = array(); |
935 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
935 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
936 | 936 | |
937 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
937 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
938 | 938 | //trim all values to ensure any excess whitespace is removed. |
939 | - $dtt = array_map( 'trim', $dtt ); |
|
940 | - $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
939 | + $dtt = array_map('trim', $dtt); |
|
940 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
941 | 941 | $datetime_values = array( |
942 | - 'DTT_ID' => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL, |
|
942 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL, |
|
943 | 943 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
944 | 944 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
945 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'], |
|
945 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
946 | 946 | 'DTT_order' => $row, |
947 | 947 | ); |
948 | 948 | |
949 | 949 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
950 | 950 | |
951 | - if ( !empty( $dtt['DTT_ID'] ) ) { |
|
952 | - $DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] ); |
|
953 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
954 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
955 | - foreach ( $datetime_values as $field => $value ) { |
|
956 | - $DTM->set( $field, $value ); |
|
951 | + if ( ! empty($dtt['DTT_ID'])) { |
|
952 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']); |
|
953 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
954 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
955 | + foreach ($datetime_values as $field => $value) { |
|
956 | + $DTM->set($field, $value); |
|
957 | 957 | } |
958 | 958 | |
959 | 959 | //make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. We need to do this so we dont' TRASH the parent DTT. |
960 | 960 | $saved_dtts[$DTM->ID()] = $DTM; |
961 | 961 | } else { |
962 | - $DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE ); |
|
963 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
964 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
965 | - $DTM->set_timezone( $evtobj->get_timezone() ); |
|
966 | - foreach ( $datetime_values as $field => $value ) { |
|
967 | - $DTM->set( $field, $value ); |
|
962 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE); |
|
963 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
964 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
965 | + $DTM->set_timezone($evtobj->get_timezone()); |
|
966 | + foreach ($datetime_values as $field => $value) { |
|
967 | + $DTM->set($field, $value); |
|
968 | 968 | } |
969 | 969 | } |
970 | 970 | $DTM->save(); |
971 | 971 | |
972 | - $DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' ); |
|
972 | + $DTT = $evtobj->_add_relation_to($DTM, 'Datetime'); |
|
973 | 973 | |
974 | 974 | //load DTT helper |
975 | 975 | EE_Registry::instance()->load_helper('DTT_Helper'); |
976 | 976 | |
977 | 977 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
978 | - if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) { |
|
979 | - $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') ); |
|
978 | + if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) { |
|
979 | + $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start')); |
|
980 | 980 | $DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days'); |
981 | 981 | $DTT->save(); |
982 | 982 | } |
@@ -984,45 +984,45 @@ discard block |
||
984 | 984 | //now we got to make sure we add the new DTT_ID to the $saved_dtts array because it is possible there was a new one created for the autosave. |
985 | 985 | $saved_dtt = $DTT; |
986 | 986 | |
987 | - $success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
987 | + $success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | //no dtts get deleted so we don't do any of that logic here. |
991 | 991 | //update tickets next |
992 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array(); |
|
993 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
994 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
992 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
993 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
994 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
995 | 995 | $update_prices = false; |
996 | - $ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
996 | + $ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
997 | 997 | |
998 | 998 | // trim inputs to ensure any excess whitespace is removed. |
999 | - $tkt = array_map( 'trim', $tkt ); |
|
999 | + $tkt = array_map('trim', $tkt); |
|
1000 | 1000 | |
1001 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
1001 | + if (empty($tkt['TKT_start_date'])) { |
|
1002 | 1002 | //let's use now in the set timezone. |
1003 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
1004 | - $tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] ); |
|
1003 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
1004 | + $tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]); |
|
1005 | 1005 | } |
1006 | 1006 | |
1007 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
1007 | + if (empty($tkt['TKT_end_date'])) { |
|
1008 | 1008 | //use the start date of the first datetime |
1009 | 1009 | $dtt = $evtobj->first_datetime(); |
1010 | - $tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] ); |
|
1010 | + $tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]); |
|
1011 | 1011 | } |
1012 | 1012 | |
1013 | 1013 | $TKT_values = array( |
1014 | - 'TKT_ID' => !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL, |
|
1015 | - 'TTM_ID' => !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
1016 | - 'TKT_name' => !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
1017 | - 'TKT_description' => !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '', |
|
1014 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL, |
|
1015 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
1016 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
1017 | + 'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '', |
|
1018 | 1018 | 'TKT_start_date' => $tkt['TKT_start_date'], |
1019 | 1019 | 'TKT_end_date' => $tkt['TKT_end_date'], |
1020 | - 'TKT_qty' => ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1021 | - 'TKT_uses' => ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ], |
|
1022 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
1023 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'], |
|
1020 | + 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1021 | + 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
1022 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
1023 | + 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
1024 | 1024 | 'TKT_row' => $row, |
1025 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row, |
|
1025 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row, |
|
1026 | 1026 | 'TKT_price' => $ticket_price |
1027 | 1027 | ); |
1028 | 1028 | |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | |
1031 | 1031 | |
1032 | 1032 | //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well. |
1033 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
1033 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
1034 | 1034 | $TKT_values['TKT_ID'] = 0; |
1035 | 1035 | $TKT_values['TKT_is_default'] = 0; |
1036 | 1036 | $TKT_values['TKT_price'] = $ticket_price; |
@@ -1041,58 +1041,58 @@ discard block |
||
1041 | 1041 | //we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified. |
1042 | 1042 | //keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
1043 | 1043 | |
1044 | - if ( !empty( $tkt['TKT_ID'] ) ) { |
|
1045 | - $TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] ); |
|
1046 | - if ( $TKT instanceof EE_Ticket ) { |
|
1047 | - $ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false; |
|
1044 | + if ( ! empty($tkt['TKT_ID'])) { |
|
1045 | + $TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']); |
|
1046 | + if ($TKT instanceof EE_Ticket) { |
|
1047 | + $ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false; |
|
1048 | 1048 | //let's just check the total price for the existing ticket and determine if it matches the new total price. if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket. |
1049 | - $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false; |
|
1050 | - $TKT->set_date_format( $incoming_date_formats[ 0 ] ); |
|
1051 | - $TKT->set_time_format( $incoming_date_formats[ 1 ] ); |
|
1049 | + $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false; |
|
1050 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1051 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1052 | 1052 | //set new values |
1053 | - foreach ( $TKT_values as $field => $value ) { |
|
1054 | - if ( $field == 'TKT_qty' ) { |
|
1055 | - $TKT->set_qty( $value ); |
|
1053 | + foreach ($TKT_values as $field => $value) { |
|
1054 | + if ($field == 'TKT_qty') { |
|
1055 | + $TKT->set_qty($value); |
|
1056 | 1056 | } else { |
1057 | - $TKT->set( $field, $value ); |
|
1057 | + $TKT->set($field, $value); |
|
1058 | 1058 | } |
1059 | 1059 | } |
1060 | 1060 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
1061 | - if ( $create_new_TKT ) { |
|
1061 | + if ($create_new_TKT) { |
|
1062 | 1062 | //archive the old ticket first |
1063 | - $TKT->set( 'TKT_deleted', 1 ); |
|
1063 | + $TKT->set('TKT_deleted', 1); |
|
1064 | 1064 | $TKT->save(); |
1065 | 1065 | //make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine. |
1066 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
1066 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
1067 | 1067 | //create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it. |
1068 | 1068 | $TKT = clone $TKT; |
1069 | - $TKT->set( 'TKT_ID', 0 ); |
|
1070 | - $TKT->set( 'TKT_deleted', 0 ); |
|
1071 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1072 | - $TKT->set( 'TKT_sold', 0 ); |
|
1069 | + $TKT->set('TKT_ID', 0); |
|
1070 | + $TKT->set('TKT_deleted', 0); |
|
1071 | + $TKT->set('TKT_price', $ticket_price); |
|
1072 | + $TKT->set('TKT_sold', 0); |
|
1073 | 1073 | //now we need to make sure that $new prices are created as well and attached to new ticket. |
1074 | 1074 | $update_prices = true; |
1075 | 1075 | } |
1076 | 1076 | //make sure price is set if it hasn't been already |
1077 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1077 | + $TKT->set('TKT_price', $ticket_price); |
|
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | } else { |
1081 | 1081 | //no TKT_id so a new TKT |
1082 | 1082 | $TKT_values['TKT_price'] = $ticket_price; |
1083 | - $TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE ); |
|
1084 | - if ( $TKT instanceof EE_Ticket ) { |
|
1083 | + $TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE); |
|
1084 | + if ($TKT instanceof EE_Ticket) { |
|
1085 | 1085 | //need to reset values to properly account for the date formats |
1086 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1087 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1088 | - $TKT->set_timezone( $evtobj->get_timezone() ); |
|
1086 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1087 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1088 | + $TKT->set_timezone($evtobj->get_timezone()); |
|
1089 | 1089 | |
1090 | 1090 | //set new values |
1091 | - foreach ( $TKT_values as $field => $value ) { |
|
1092 | - if ( $field == 'TKT_qty' ) { |
|
1093 | - $TKT->set_qty( $value ); |
|
1091 | + foreach ($TKT_values as $field => $value) { |
|
1092 | + if ($field == 'TKT_qty') { |
|
1093 | + $TKT->set_qty($value); |
|
1094 | 1094 | } else { |
1095 | - $TKT->set( $field, $value ); |
|
1095 | + $TKT->set($field, $value); |
|
1096 | 1096 | } |
1097 | 1097 | } |
1098 | 1098 | |
@@ -1100,32 +1100,32 @@ discard block |
||
1100 | 1100 | } |
1101 | 1101 | } |
1102 | 1102 | // cap ticket qty by datetime reg limits |
1103 | - $TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) ); |
|
1103 | + $TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit'))); |
|
1104 | 1104 | //update ticket. |
1105 | 1105 | $TKT->save(); |
1106 | 1106 | |
1107 | 1107 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
1108 | - if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) { |
|
1109 | - $TKT->set('TKT_end_date', $TKT->get('TKT_start_date') ); |
|
1108 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
1109 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
1110 | 1110 | EE_Registry::instance()->load_helper('DTT_Helper'); |
1111 | 1111 | $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
1112 | 1112 | $TKT->save(); |
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | //initially let's add the ticket to the dtt |
1116 | - $saved_dtt->_add_relation_to( $TKT, 'Ticket' ); |
|
1116 | + $saved_dtt->_add_relation_to($TKT, 'Ticket'); |
|
1117 | 1117 | |
1118 | 1118 | $saved_tickets[$TKT->ID()] = $TKT; |
1119 | 1119 | |
1120 | 1120 | //add prices to ticket |
1121 | - $this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices ); |
|
1121 | + $this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices); |
|
1122 | 1122 | } |
1123 | 1123 | //however now we need to handle permanently deleting tickets via the ui. Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold. However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db. |
1124 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1125 | - $tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) ); |
|
1124 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1125 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
1126 | 1126 | |
1127 | - foreach ( $tickets_removed as $id ) { |
|
1128 | - $id = absint( $id ); |
|
1127 | + foreach ($tickets_removed as $id) { |
|
1128 | + $id = absint($id); |
|
1129 | 1129 | |
1130 | 1130 | //get the ticket for this id |
1131 | 1131 | $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
@@ -1133,7 +1133,7 @@ discard block |
||
1133 | 1133 | //need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold) |
1134 | 1134 | $dtts = $tkt_to_remove->get_many_related('Datetime'); |
1135 | 1135 | |
1136 | - foreach( $dtts as $dtt ) { |
|
1136 | + foreach ($dtts as $dtt) { |
|
1137 | 1137 | $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
1138 | 1138 | } |
1139 | 1139 | |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | //finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships) |
1145 | 1145 | $tkt_to_remove->delete_permanently(); |
1146 | 1146 | } |
1147 | - return array( $saved_dtt, $saved_tickets ); |
|
1147 | + return array($saved_dtt, $saved_tickets); |
|
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | |
@@ -1159,31 +1159,31 @@ discard block |
||
1159 | 1159 | * @param bool $new_prices Whether attach existing incoming prices or create new ones. |
1160 | 1160 | * @return void |
1161 | 1161 | */ |
1162 | - private function _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) { |
|
1163 | - foreach ( $prices as $row => $prc ) { |
|
1162 | + private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) { |
|
1163 | + foreach ($prices as $row => $prc) { |
|
1164 | 1164 | $PRC_values = array( |
1165 | - 'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL, |
|
1166 | - 'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL, |
|
1167 | - 'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
1168 | - 'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
1169 | - 'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
1165 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL, |
|
1166 | + 'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL, |
|
1167 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
1168 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
1169 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
1170 | 1170 | 'PRC_is_default' => 0, //make sure prices are NOT set as default from this context |
1171 | 1171 | 'PRC_order' => $row |
1172 | 1172 | ); |
1173 | 1173 | |
1174 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
1174 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
1175 | 1175 | $PRC_values['PRC_ID'] = 0; |
1176 | - $PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE); |
|
1176 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE); |
|
1177 | 1177 | } else { |
1178 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
1178 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
1179 | 1179 | //update this price with new values |
1180 | - foreach ( $PRC_values as $field => $newprc ) { |
|
1181 | - $PRC->set( $field, $newprc ); |
|
1180 | + foreach ($PRC_values as $field => $newprc) { |
|
1181 | + $PRC->set($field, $newprc); |
|
1182 | 1182 | } |
1183 | 1183 | $PRC->save(); |
1184 | 1184 | } |
1185 | 1185 | |
1186 | - $ticket->_add_relation_to( $PRC, 'Price' ); |
|
1186 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
1187 | 1187 | } |
1188 | 1188 | } |
1189 | 1189 | |
@@ -1206,33 +1206,33 @@ discard block |
||
1206 | 1206 | |
1207 | 1207 | return; //TEMPORARILY EXITING CAUSE THIS IS A TODO |
1208 | 1208 | |
1209 | - $postid = isset( $this->_req_data['post_ID'] ) ? $this->_req_data['post_ID'] : NULL; |
|
1209 | + $postid = isset($this->_req_data['post_ID']) ? $this->_req_data['post_ID'] : NULL; |
|
1210 | 1210 | |
1211 | 1211 | |
1212 | 1212 | //if no postid then get out cause we need it for stuff in here |
1213 | - if ( empty( $postid ) ) return; |
|
1213 | + if (empty($postid)) return; |
|
1214 | 1214 | |
1215 | 1215 | |
1216 | 1216 | //handle datetime saves |
1217 | 1217 | $items = array(); |
1218 | 1218 | |
1219 | - $get_one_where = array( $this->_event_model()->primary_key_name() => $postid ); |
|
1220 | - $event = $this->_event_model()->get_one( array($get_one_where) ); |
|
1219 | + $get_one_where = array($this->_event_model()->primary_key_name() => $postid); |
|
1220 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
1221 | 1221 | |
1222 | 1222 | //now let's get the attached datetimes from the most recent autosave |
1223 | 1223 | $dtts = $event->get_many_related('Datetime'); |
1224 | 1224 | |
1225 | 1225 | $dtt_ids = array(); |
1226 | - foreach( $dtts as $dtt ) { |
|
1226 | + foreach ($dtts as $dtt) { |
|
1227 | 1227 | $dtt_ids[] = $dtt->ID(); |
1228 | 1228 | $order = $dtt->order(); |
1229 | 1229 | $this->_template_args['data']['items']['ID-'.$order] = $dtt->ID(); |
1230 | 1230 | } |
1231 | - $this->_template_args['data']['items']['datetime_IDS'] = serialize( $dtt_ids ); |
|
1231 | + $this->_template_args['data']['items']['datetime_IDS'] = serialize($dtt_ids); |
|
1232 | 1232 | |
1233 | 1233 | //handle DECAF venues |
1234 | 1234 | //we need to make sure that the venue_id gets updated in the form so that future autosaves will properly conntect that venue to the event. |
1235 | - if ( $do_venue_autosaves = apply_filters( 'FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE ) ) { |
|
1235 | + if ($do_venue_autosaves = apply_filters('FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE)) { |
|
1236 | 1236 | $venue = $event->get_first_related('Venue'); |
1237 | 1237 | $this->_template_args['data']['items']['venue-id'] = $venue->ID(); |
1238 | 1238 | } |
@@ -1243,23 +1243,23 @@ discard block |
||
1243 | 1243 | |
1244 | 1244 | $ticket_ids = array(); |
1245 | 1245 | $price_ids = array(); |
1246 | - foreach ( $tickets as $ticket ) { |
|
1246 | + foreach ($tickets as $ticket) { |
|
1247 | 1247 | $ticket_ids[] = $price->ID(); |
1248 | 1248 | $ticket_order = $price->get('TKT_order'); |
1249 | - $this->_template_args['data']['items']['edit-ticket-id-' . $ticket_order] = $ticket->ID(); |
|
1250 | - $this->_template_args['data']['items']['edit-ticket-event-id-' . $order] = $event->ID(); |
|
1249 | + $this->_template_args['data']['items']['edit-ticket-id-'.$ticket_order] = $ticket->ID(); |
|
1250 | + $this->_template_args['data']['items']['edit-ticket-event-id-'.$order] = $event->ID(); |
|
1251 | 1251 | |
1252 | 1252 | //now we have to make sure the prices are updated appropriately |
1253 | 1253 | $prices = $ticket->get_many_related('Prices'); |
1254 | 1254 | |
1255 | - foreach ( $prices as $price ) { |
|
1255 | + foreach ($prices as $price) { |
|
1256 | 1256 | $price_ids[] = $price->ID(); |
1257 | 1257 | $price_order = $price->get('PRC_order'); |
1258 | - $this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-' . $ticket_order . '-' . $price_order] = $price->ID(); |
|
1259 | - $this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-' . $ticket_row . '-' . $price_row] = $price->ID(); |
|
1260 | - $this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-' . $ticket_row . '-' . $price_row] = $price->get('PRC_is_default'); |
|
1258 | + $this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-'.$ticket_order.'-'.$price_order] = $price->ID(); |
|
1259 | + $this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-'.$ticket_row.'-'.$price_row] = $price->ID(); |
|
1260 | + $this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-'.$ticket_row.'-'.$price_row] = $price->get('PRC_is_default'); |
|
1261 | 1261 | } |
1262 | - $this->_template_args['data']['items']['price-IDs-ticketrow-' . $ticket_row] = implode(',', $price_ids); |
|
1262 | + $this->_template_args['data']['items']['price-IDs-ticketrow-'.$ticket_row] = implode(',', $price_ids); |
|
1263 | 1263 | } |
1264 | 1264 | $this->_template_args['data']['items']['ticket-IDs'] = implode(',', $ticket_ids); |
1265 | 1265 | } |
@@ -1277,12 +1277,12 @@ discard block |
||
1277 | 1277 | private function _generate_publish_box_extra_content() { |
1278 | 1278 | |
1279 | 1279 | //load formatter helper |
1280 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1280 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1281 | 1281 | |
1282 | 1282 | //args for getting related registrations |
1283 | - $approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) ); |
|
1284 | - $not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) ); |
|
1285 | - $pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) ); |
|
1283 | + $approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved)); |
|
1284 | + $not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved)); |
|
1285 | + $pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment)); |
|
1286 | 1286 | |
1287 | 1287 | |
1288 | 1288 | // publish box |
@@ -1311,9 +1311,9 @@ discard block |
||
1311 | 1311 | ), |
1312 | 1312 | REG_ADMIN_URL |
1313 | 1313 | ), |
1314 | - 'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ), |
|
1315 | - 'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ), |
|
1316 | - 'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ), |
|
1314 | + 'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args), |
|
1315 | + 'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args), |
|
1316 | + 'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args), |
|
1317 | 1317 | 'misc_pub_section_class' => apply_filters( |
1318 | 1318 | 'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class', |
1319 | 1319 | 'misc-pub-section' |
@@ -1332,9 +1332,9 @@ discard block |
||
1332 | 1332 | 'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add', |
1333 | 1333 | $this->_cpt_model_obj |
1334 | 1334 | ); |
1335 | - $publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean(); |
|
1335 | + $publish_box_extra_args['event_editor_overview_add'] = ob_get_clean(); |
|
1336 | 1336 | // load template |
1337 | - EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args ); |
|
1337 | + EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args); |
|
1338 | 1338 | } |
1339 | 1339 | |
1340 | 1340 | |
@@ -1366,16 +1366,16 @@ discard block |
||
1366 | 1366 | $this->verify_cpt_object(); |
1367 | 1367 | add_meta_box( |
1368 | 1368 | 'espresso_event_editor_tickets', |
1369 | - __( 'Event Datetime & Ticket', 'event_espresso' ), |
|
1370 | - array( $this, 'ticket_metabox' ), |
|
1369 | + __('Event Datetime & Ticket', 'event_espresso'), |
|
1370 | + array($this, 'ticket_metabox'), |
|
1371 | 1371 | $this->page_slug, |
1372 | 1372 | 'normal', |
1373 | 1373 | 'high' |
1374 | 1374 | ); |
1375 | 1375 | add_meta_box( |
1376 | 1376 | 'espresso_event_editor_event_options', |
1377 | - __( 'Event Registration Options', 'event_espresso' ), |
|
1378 | - array( $this, 'registration_options_meta_box' ), |
|
1377 | + __('Event Registration Options', 'event_espresso'), |
|
1378 | + array($this, 'registration_options_meta_box'), |
|
1379 | 1379 | $this->page_slug, |
1380 | 1380 | 'side', |
1381 | 1381 | 'default' |
@@ -1405,38 +1405,38 @@ discard block |
||
1405 | 1405 | 'disabled' => '' |
1406 | 1406 | ); |
1407 | 1407 | |
1408 | - $event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL; |
|
1408 | + $event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL; |
|
1409 | 1409 | |
1410 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1410 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1411 | 1411 | |
1412 | 1412 | /** |
1413 | 1413 | * 1. Start with retrieving Datetimes |
1414 | 1414 | * 2. Fore each datetime get related tickets |
1415 | 1415 | * 3. For each ticket get related prices |
1416 | 1416 | */ |
1417 | - $times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id ); |
|
1418 | - EE_Registry::instance()->load_helper('DTT_Helper' ); |
|
1417 | + $times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id); |
|
1418 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
1419 | 1419 | /** @type EE_Datetime $first_datetime */ |
1420 | - $first_datetime = array_slice( $times, 0, 1 ); |
|
1420 | + $first_datetime = array_slice($times, 0, 1); |
|
1421 | 1421 | //do we get related tickets? |
1422 | - if ( $first_datetime[ 0 ]->get( 'DTT_ID' ) !== 0 ) { |
|
1423 | - foreach ( $times as $time ) { |
|
1424 | - if ( $time instanceof EE_Datetime ) { |
|
1422 | + if ($first_datetime[0]->get('DTT_ID') !== 0) { |
|
1423 | + foreach ($times as $time) { |
|
1424 | + if ($time instanceof EE_Datetime) { |
|
1425 | 1425 | $existing_datetime_ids[] = $time->get('DTT_ID'); |
1426 | 1426 | $template_args['time'] = $time; |
1427 | 1427 | $related_tickets = $time->tickets( |
1428 | 1428 | array( |
1429 | - array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), |
|
1429 | + array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), |
|
1430 | 1430 | 'default_where_conditions' => 'none' |
1431 | 1431 | ) |
1432 | 1432 | ); |
1433 | 1433 | |
1434 | - if ( !empty($related_tickets) ) { |
|
1434 | + if ( ! empty($related_tickets)) { |
|
1435 | 1435 | $template_args['total_ticket_rows'] = count($related_tickets); |
1436 | 1436 | $row = 0; |
1437 | - foreach ( $related_tickets as $ticket ) { |
|
1437 | + foreach ($related_tickets as $ticket) { |
|
1438 | 1438 | $existing_ticket_ids[] = $ticket->get('TKT_ID'); |
1439 | - $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row ); |
|
1439 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row); |
|
1440 | 1440 | |
1441 | 1441 | $row++; |
1442 | 1442 | } |
@@ -1444,7 +1444,7 @@ discard block |
||
1444 | 1444 | $template_args['total_ticket_rows'] = 1; |
1445 | 1445 | /** @type EE_Ticket $ticket */ |
1446 | 1446 | $ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object(); |
1447 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket ); |
|
1447 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket); |
|
1448 | 1448 | } |
1449 | 1449 | } |
1450 | 1450 | } |
@@ -1452,7 +1452,7 @@ discard block |
||
1452 | 1452 | $template_args['time'] = $times[0]; |
1453 | 1453 | /** @type EE_Ticket $ticket */ |
1454 | 1454 | $ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
1455 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] ); |
|
1455 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]); |
|
1456 | 1456 | // NOTE: we're just sending the first default row |
1457 | 1457 | // (decaf can't manage default tickets so this should be sufficient); |
1458 | 1458 | } |
@@ -1461,8 +1461,8 @@ discard block |
||
1461 | 1461 | $template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info'); |
1462 | 1462 | $template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
1463 | 1463 | $template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
1464 | - $template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE ); |
|
1465 | - $template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' ); |
|
1464 | + $template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE); |
|
1465 | + $template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'); |
|
1466 | 1466 | EEH_Template::display_template($template, $template_args); |
1467 | 1467 | } |
1468 | 1468 | |
@@ -1477,21 +1477,21 @@ discard block |
||
1477 | 1477 | * @param int $row |
1478 | 1478 | * @return string generated html for the ticket row. |
1479 | 1479 | */ |
1480 | - private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) { |
|
1480 | + private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) { |
|
1481 | 1481 | $template_args = array( |
1482 | - 'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(), |
|
1483 | - 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '', |
|
1482 | + 'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(), |
|
1483 | + 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '', |
|
1484 | 1484 | 'ticketrow' => $skeleton ? 'TICKETNUM' : $row, |
1485 | 1485 | 'TKT_ID' => $ticket->get('TKT_ID'), |
1486 | 1486 | 'TKT_name' => $ticket->get('TKT_name'), |
1487 | 1487 | 'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'), |
1488 | 1488 | 'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'), |
1489 | 1489 | 'TKT_is_default' => $ticket->get('TKT_is_default'), |
1490 | - 'TKT_qty' => $ticket->get_pretty('TKT_qty','input'), |
|
1490 | + 'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'), |
|
1491 | 1491 | 'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets', |
1492 | 1492 | 'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'), |
1493 | - 'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
|
1494 | - 'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled' |
|
1493 | + 'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
|
1494 | + 'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled' |
|
1495 | 1495 | ); |
1496 | 1496 | |
1497 | 1497 | $price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object(); |
@@ -1507,23 +1507,23 @@ discard block |
||
1507 | 1507 | |
1508 | 1508 | //make sure we have default start and end dates if skeleton |
1509 | 1509 | //handle rows that should NOT be empty |
1510 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1510 | + if (empty($template_args['TKT_start_date'])) { |
|
1511 | 1511 | //if empty then the start date will be now. |
1512 | 1512 | $template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp')); |
1513 | 1513 | } |
1514 | 1514 | |
1515 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1515 | + if (empty($template_args['TKT_end_date'])) { |
|
1516 | 1516 | //get the earliest datetime (if present); |
1517 | - $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
|
1517 | + $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL; |
|
1518 | 1518 | |
1519 | - if ( !empty( $earliest_dtt ) ) |
|
1519 | + if ( ! empty($earliest_dtt)) |
|
1520 | 1520 | $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
1521 | 1521 | else |
1522 | - $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1522 | + $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y"))); |
|
1523 | 1523 | } |
1524 | 1524 | |
1525 | - $template_args = array_merge( $template_args, $price_args ); |
|
1526 | - $template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket); |
|
1525 | + $template_args = array_merge($template_args, $price_args); |
|
1526 | + $template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket); |
|
1527 | 1527 | return EEH_Template::display_template($template, $template_args, TRUE); |
1528 | 1528 | } |
1529 | 1529 | |
@@ -1552,8 +1552,8 @@ discard block |
||
1552 | 1552 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
1553 | 1553 | $template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description()); |
1554 | 1554 | $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false); |
1555 | - $template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values ); |
|
1556 | - $templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php'; |
|
1555 | + $template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values); |
|
1556 | + $templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php'; |
|
1557 | 1557 | EEH_Template::display_template($templatepath, $template_args); |
1558 | 1558 | } |
1559 | 1559 | |
@@ -1581,21 +1581,21 @@ discard block |
||
1581 | 1581 | $EEME = $this->_event_model(); |
1582 | 1582 | |
1583 | 1583 | $offset = ($current_page - 1) * $per_page; |
1584 | - $limit = $count ? NULL : $offset . ',' . $per_page; |
|
1584 | + $limit = $count ? NULL : $offset.','.$per_page; |
|
1585 | 1585 | $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID'; |
1586 | 1586 | $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC"; |
1587 | 1587 | |
1588 | 1588 | if (isset($this->_req_data['month_range'])) { |
1589 | 1589 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
1590 | - $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1591 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
1590 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1591 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1592 | 1592 | } |
1593 | 1593 | |
1594 | 1594 | $where = array(); |
1595 | 1595 | |
1596 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
1596 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
1597 | 1597 | //determine what post_status our condition will have for the query. |
1598 | - switch ( $status ) { |
|
1598 | + switch ($status) { |
|
1599 | 1599 | case 'month' : |
1600 | 1600 | case 'today' : |
1601 | 1601 | case NULL : |
@@ -1603,7 +1603,7 @@ discard block |
||
1603 | 1603 | break; |
1604 | 1604 | |
1605 | 1605 | case 'draft' : |
1606 | - $where['status'] = array( 'IN', array('draft', 'auto-draft') ); |
|
1606 | + $where['status'] = array('IN', array('draft', 'auto-draft')); |
|
1607 | 1607 | break; |
1608 | 1608 | |
1609 | 1609 | default : |
@@ -1611,43 +1611,43 @@ discard block |
||
1611 | 1611 | } |
1612 | 1612 | |
1613 | 1613 | //categories? |
1614 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
1614 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
1615 | 1615 | |
1616 | - if ( !empty ( $category ) ) { |
|
1616 | + if ( ! empty ($category)) { |
|
1617 | 1617 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
1618 | 1618 | $where['Term_Taxonomy.term_id'] = $category; |
1619 | 1619 | } |
1620 | 1620 | |
1621 | 1621 | //date where conditions |
1622 | - $start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' ); |
|
1622 | + $start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start'); |
|
1623 | 1623 | if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') { |
1624 | - $DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) ); |
|
1625 | - $start = $DateTime->format( implode( ' ', $start_formats ) ); |
|
1626 | - $end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) ); |
|
1627 | - $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) ); |
|
1624 | + $DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone())); |
|
1625 | + $start = $DateTime->format(implode(' ', $start_formats)); |
|
1626 | + $end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1627 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1628 | 1628 | } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') { |
1629 | - $DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1630 | - $start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) ); |
|
1631 | - $end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1632 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1633 | - } else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) { |
|
1634 | - $now = date( 'Y-m-01' ); |
|
1635 | - $DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1636 | - $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
|
1637 | - $end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1638 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1629 | + $DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1630 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1631 | + $end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1632 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1633 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') { |
|
1634 | + $now = date('Y-m-01'); |
|
1635 | + $DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1636 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1637 | + $end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1638 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1639 | 1639 | } |
1640 | 1640 | |
1641 | 1641 | |
1642 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1643 | - $where['EVT_wp_user'] = get_current_user_id(); |
|
1642 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1643 | + $where['EVT_wp_user'] = get_current_user_id(); |
|
1644 | 1644 | } else { |
1645 | - if ( ! isset( $where['status'] ) ) { |
|
1646 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) { |
|
1645 | + if ( ! isset($where['status'])) { |
|
1646 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
1647 | 1647 | $where['OR'] = array( |
1648 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1648 | + 'status*restrict_private' => array('!=', 'private'), |
|
1649 | 1649 | 'AND' => array( |
1650 | - 'status*inclusive' => array( '=', 'private' ), |
|
1650 | + 'status*inclusive' => array('=', 'private'), |
|
1651 | 1651 | 'EVT_wp_user' => get_current_user_id() |
1652 | 1652 | ) |
1653 | 1653 | ); |
@@ -1655,16 +1655,16 @@ discard block |
||
1655 | 1655 | } |
1656 | 1656 | } |
1657 | 1657 | |
1658 | - if ( isset( $this->_req_data['EVT_wp_user'] ) ) { |
|
1659 | - if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1658 | + if (isset($this->_req_data['EVT_wp_user'])) { |
|
1659 | + if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1660 | 1660 | $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user']; |
1661 | 1661 | } |
1662 | 1662 | } |
1663 | 1663 | |
1664 | 1664 | |
1665 | 1665 | //search query handling |
1666 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1667 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1666 | + if (isset($this->_req_data['s'])) { |
|
1667 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1668 | 1668 | $where['OR'] = array( |
1669 | 1669 | 'EVT_name' => array('LIKE', $search_string), |
1670 | 1670 | 'EVT_desc' => array('LIKE', $search_string), |
@@ -1673,32 +1673,32 @@ discard block |
||
1673 | 1673 | } |
1674 | 1674 | |
1675 | 1675 | |
1676 | - $where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data ); |
|
1677 | - $query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data ); |
|
1676 | + $where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data); |
|
1677 | + $query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data); |
|
1678 | 1678 | |
1679 | 1679 | |
1680 | 1680 | //let's first check if we have special requests coming in. |
1681 | - if ( isset( $this->_req_data['active_status'] ) ) { |
|
1682 | - switch ( $this->_req_data['active_status'] ) { |
|
1681 | + if (isset($this->_req_data['active_status'])) { |
|
1682 | + switch ($this->_req_data['active_status']) { |
|
1683 | 1683 | case 'upcoming' : |
1684 | - return $EEME->get_upcoming_events( $query_params, $count ); |
|
1684 | + return $EEME->get_upcoming_events($query_params, $count); |
|
1685 | 1685 | break; |
1686 | 1686 | |
1687 | 1687 | case 'expired' : |
1688 | - return $EEME->get_expired_events( $query_params, $count ); |
|
1688 | + return $EEME->get_expired_events($query_params, $count); |
|
1689 | 1689 | break; |
1690 | 1690 | |
1691 | 1691 | case 'active' : |
1692 | - return $EEME->get_active_events( $query_params, $count ); |
|
1692 | + return $EEME->get_active_events($query_params, $count); |
|
1693 | 1693 | break; |
1694 | 1694 | |
1695 | 1695 | case 'inactive' : |
1696 | - return $EEME->get_inactive_events( $query_params, $count ); |
|
1696 | + return $EEME->get_inactive_events($query_params, $count); |
|
1697 | 1697 | break; |
1698 | 1698 | } |
1699 | 1699 | } |
1700 | 1700 | |
1701 | - $events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params ); |
|
1701 | + $events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params); |
|
1702 | 1702 | |
1703 | 1703 | return $events; |
1704 | 1704 | } |
@@ -1707,23 +1707,23 @@ discard block |
||
1707 | 1707 | |
1708 | 1708 | |
1709 | 1709 | //handling for WordPress CPT actions (trash, restore, delete) |
1710 | - public function trash_cpt_item( $post_id ) { |
|
1710 | + public function trash_cpt_item($post_id) { |
|
1711 | 1711 | $this->_req_data['EVT_ID'] = $post_id; |
1712 | - $this->_trash_or_restore_event( 'trash', FALSE ); |
|
1712 | + $this->_trash_or_restore_event('trash', FALSE); |
|
1713 | 1713 | } |
1714 | 1714 | |
1715 | 1715 | |
1716 | 1716 | |
1717 | 1717 | |
1718 | - public function restore_cpt_item( $post_id ) { |
|
1718 | + public function restore_cpt_item($post_id) { |
|
1719 | 1719 | $this->_req_data['EVT_ID'] = $post_id; |
1720 | - $this->_trash_or_restore_event( 'draft', FALSE ); |
|
1720 | + $this->_trash_or_restore_event('draft', FALSE); |
|
1721 | 1721 | } |
1722 | 1722 | |
1723 | 1723 | |
1724 | - public function delete_cpt_item( $post_id ) { |
|
1724 | + public function delete_cpt_item($post_id) { |
|
1725 | 1725 | $this->_req_data['EVT_ID'] = $post_id; |
1726 | - $this->_delete_event( FALSE ); |
|
1726 | + $this->_delete_event(FALSE); |
|
1727 | 1727 | } |
1728 | 1728 | |
1729 | 1729 | |
@@ -1735,7 +1735,7 @@ discard block |
||
1735 | 1735 | * @param string $event_status |
1736 | 1736 | * @return void |
1737 | 1737 | */ |
1738 | - protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) { |
|
1738 | + protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) { |
|
1739 | 1739 | //determine the event id and set to array. |
1740 | 1740 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE; |
1741 | 1741 | // loop thru events |
@@ -1743,7 +1743,7 @@ discard block |
||
1743 | 1743 | // clean status |
1744 | 1744 | $event_status = sanitize_key($event_status); |
1745 | 1745 | // grab status |
1746 | - if (!empty($event_status)) { |
|
1746 | + if ( ! empty($event_status)) { |
|
1747 | 1747 | $success = $this->_change_event_status($EVT_ID, $event_status); |
1748 | 1748 | } else { |
1749 | 1749 | $success = FALSE; |
@@ -1757,7 +1757,7 @@ discard block |
||
1757 | 1757 | } |
1758 | 1758 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1759 | 1759 | |
1760 | - if ( $redirect_after ) |
|
1760 | + if ($redirect_after) |
|
1761 | 1761 | $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
1762 | 1762 | } |
1763 | 1763 | |
@@ -1772,7 +1772,7 @@ discard block |
||
1772 | 1772 | // clean status |
1773 | 1773 | $event_status = sanitize_key($event_status); |
1774 | 1774 | // grab status |
1775 | - if (!empty($event_status)) { |
|
1775 | + if ( ! empty($event_status)) { |
|
1776 | 1776 | $success = TRUE; |
1777 | 1777 | //determine the event id and set to array. |
1778 | 1778 | $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
@@ -1807,15 +1807,15 @@ discard block |
||
1807 | 1807 | * @param string $event_status |
1808 | 1808 | * @return bool |
1809 | 1809 | */ |
1810 | - private function _change_event_status( $EVT_ID = 0, $event_status = '') { |
|
1810 | + private function _change_event_status($EVT_ID = 0, $event_status = '') { |
|
1811 | 1811 | // grab event id |
1812 | - if (!$EVT_ID) { |
|
1812 | + if ( ! $EVT_ID) { |
|
1813 | 1813 | $msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso'); |
1814 | 1814 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1815 | 1815 | return FALSE; |
1816 | 1816 | } |
1817 | 1817 | |
1818 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1818 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1819 | 1819 | |
1820 | 1820 | // clean status |
1821 | 1821 | $event_status = sanitize_key($event_status); |
@@ -1841,7 +1841,7 @@ discard block |
||
1841 | 1841 | $hook = FALSE; |
1842 | 1842 | } |
1843 | 1843 | //use class to change status |
1844 | - $this->_cpt_model_obj->set_status( $event_status ); |
|
1844 | + $this->_cpt_model_obj->set_status($event_status); |
|
1845 | 1845 | $success = $this->_cpt_model_obj->save(); |
1846 | 1846 | |
1847 | 1847 | if ($success === FALSE) { |
@@ -1863,15 +1863,15 @@ discard block |
||
1863 | 1863 | * @access protected |
1864 | 1864 | * @param bool $redirect_after |
1865 | 1865 | */ |
1866 | - protected function _delete_event( $redirect_after = TRUE ) { |
|
1866 | + protected function _delete_event($redirect_after = TRUE) { |
|
1867 | 1867 | //determine the event id and set to array. |
1868 | 1868 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL; |
1869 | - $EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID; |
|
1869 | + $EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID; |
|
1870 | 1870 | |
1871 | 1871 | |
1872 | 1872 | // loop thru events |
1873 | 1873 | if ($EVT_ID) { |
1874 | - $success = $this->_permanently_delete_event( $EVT_ID ); |
|
1874 | + $success = $this->_permanently_delete_event($EVT_ID); |
|
1875 | 1875 | // get list of events with no prices |
1876 | 1876 | $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
1877 | 1877 | // remove this event from the list of events with no prices |
@@ -1885,7 +1885,7 @@ discard block |
||
1885 | 1885 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1886 | 1886 | } |
1887 | 1887 | |
1888 | - if ( $redirect_after ) |
|
1888 | + if ($redirect_after) |
|
1889 | 1889 | $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
1890 | 1890 | } |
1891 | 1891 | |
@@ -1903,12 +1903,12 @@ discard block |
||
1903 | 1903 | $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
1904 | 1904 | // loop thru events |
1905 | 1905 | foreach ($EVT_IDs as $EVT_ID) { |
1906 | - $EVT_ID = absint( $EVT_ID ); |
|
1907 | - if ( $EVT_ID ) { |
|
1908 | - $results = $this->_permanently_delete_event( $EVT_ID ); |
|
1906 | + $EVT_ID = absint($EVT_ID); |
|
1907 | + if ($EVT_ID) { |
|
1908 | + $results = $this->_permanently_delete_event($EVT_ID); |
|
1909 | 1909 | $success = $results !== FALSE ? $success : FALSE; |
1910 | 1910 | // remove this event from the list of events with no prices |
1911 | - unset( $espresso_no_ticket_prices[ $EVT_ID ] ); |
|
1911 | + unset($espresso_no_ticket_prices[$EVT_ID]); |
|
1912 | 1912 | } else { |
1913 | 1913 | $success = FALSE; |
1914 | 1914 | $msg = __('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso'); |
@@ -1928,21 +1928,21 @@ discard block |
||
1928 | 1928 | * @param int $EVT_ID |
1929 | 1929 | * @return bool |
1930 | 1930 | */ |
1931 | - private function _permanently_delete_event( $EVT_ID = 0 ) { |
|
1931 | + private function _permanently_delete_event($EVT_ID = 0) { |
|
1932 | 1932 | // grab event id |
1933 | - if ( ! $EVT_ID ) { |
|
1933 | + if ( ! $EVT_ID) { |
|
1934 | 1934 | $msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso'); |
1935 | 1935 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1936 | 1936 | return FALSE; |
1937 | 1937 | } |
1938 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1938 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1939 | 1939 | |
1940 | 1940 | //need to delete related tickets and prices first. |
1941 | 1941 | $datetimes = $this->_cpt_model_obj->get_many_related('Datetime'); |
1942 | - foreach ( $datetimes as $datetime ) { |
|
1942 | + foreach ($datetimes as $datetime) { |
|
1943 | 1943 | $this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime'); |
1944 | 1944 | $tickets = $datetime->get_many_related('Ticket'); |
1945 | - foreach ( $tickets as $ticket ) { |
|
1945 | + foreach ($tickets as $ticket) { |
|
1946 | 1946 | $ticket->_remove_relation_to($datetime, 'Datetime'); |
1947 | 1947 | $ticket->delete_related_permanently('Price'); |
1948 | 1948 | $ticket->delete_permanently(); |
@@ -1952,14 +1952,14 @@ discard block |
||
1952 | 1952 | |
1953 | 1953 | //what about related venues or terms? |
1954 | 1954 | $venues = $this->_cpt_model_obj->get_many_related('Venue'); |
1955 | - foreach ( $venues as $venue ) { |
|
1955 | + foreach ($venues as $venue) { |
|
1956 | 1956 | $this->_cpt_model_obj->_remove_relation_to($venue, 'Venue'); |
1957 | 1957 | } |
1958 | 1958 | |
1959 | 1959 | //any attached question groups? |
1960 | 1960 | $question_groups = $this->_cpt_model_obj->get_many_related('Question_Group'); |
1961 | - if ( !empty( $question_groups ) ) { |
|
1962 | - foreach ( $question_groups as $question_group ) { |
|
1961 | + if ( ! empty($question_groups)) { |
|
1962 | + foreach ($question_groups as $question_group) { |
|
1963 | 1963 | $this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group'); |
1964 | 1964 | } |
1965 | 1965 | } |
@@ -1968,12 +1968,12 @@ discard block |
||
1968 | 1968 | |
1969 | 1969 | |
1970 | 1970 | //Message Template Groups |
1971 | - $this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' ); |
|
1971 | + $this->_cpt_model_obj->_remove_relations('Message_Template_Group'); |
|
1972 | 1972 | |
1973 | 1973 | /** @type EE_Term_Taxonomy[] $term_taxonomies */ |
1974 | 1974 | $term_taxonomies = $this->_cpt_model_obj->term_taxonomies(); |
1975 | 1975 | |
1976 | - foreach ( $term_taxonomies as $term_taxonomy ) { |
|
1976 | + foreach ($term_taxonomies as $term_taxonomy) { |
|
1977 | 1977 | $this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy); |
1978 | 1978 | } |
1979 | 1979 | |
@@ -1987,7 +1987,7 @@ discard block |
||
1987 | 1987 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1988 | 1988 | return FALSE; |
1989 | 1989 | } |
1990 | - do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted' ); |
|
1990 | + do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted'); |
|
1991 | 1991 | return TRUE; |
1992 | 1992 | } |
1993 | 1993 | |
@@ -2004,7 +2004,7 @@ discard block |
||
2004 | 2004 | */ |
2005 | 2005 | public function total_events() { |
2006 | 2006 | |
2007 | - $count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2007 | + $count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true); |
|
2008 | 2008 | return $count; |
2009 | 2009 | } |
2010 | 2010 | |
@@ -2019,10 +2019,10 @@ discard block |
||
2019 | 2019 | */ |
2020 | 2020 | public function total_events_draft() { |
2021 | 2021 | $where = array( |
2022 | - 'status' => array( 'IN', array('draft', 'auto-draft' ) ) |
|
2022 | + 'status' => array('IN', array('draft', 'auto-draft')) |
|
2023 | 2023 | ); |
2024 | 2024 | |
2025 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2025 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2026 | 2026 | return $count; |
2027 | 2027 | } |
2028 | 2028 | |
@@ -2041,7 +2041,7 @@ discard block |
||
2041 | 2041 | 'status' => 'trash' |
2042 | 2042 | ); |
2043 | 2043 | |
2044 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2044 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2045 | 2045 | return $count; |
2046 | 2046 | } |
2047 | 2047 | |
@@ -2069,11 +2069,11 @@ discard block |
||
2069 | 2069 | // translated |
2070 | 2070 | TRUE |
2071 | 2071 | ); |
2072 | - $this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment; |
|
2072 | + $this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment; |
|
2073 | 2073 | |
2074 | 2074 | $this->_set_add_edit_form_tags('update_default_event_settings'); |
2075 | 2075 | $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
2076 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE); |
|
2076 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE); |
|
2077 | 2077 | $this->display_admin_page_with_sidebar(); |
2078 | 2078 | } |
2079 | 2079 | |
@@ -2099,9 +2099,9 @@ discard block |
||
2099 | 2099 | |
2100 | 2100 | protected function _template_settings() { |
2101 | 2101 | $this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso'); |
2102 | - $this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />'; |
|
2103 | - $this->_template_args['preview_text'] = '<strong>'.__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>'; |
|
2104 | - $this->display_admin_caf_preview_page( 'template_settings_tab' ); |
|
2102 | + $this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />'; |
|
2103 | + $this->_template_args['preview_text'] = '<strong>'.__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>'; |
|
2104 | + $this->display_admin_caf_preview_page('template_settings_tab'); |
|
2105 | 2105 | } |
2106 | 2106 | |
2107 | 2107 | |
@@ -2114,22 +2114,22 @@ discard block |
||
2114 | 2114 | * @return void |
2115 | 2115 | */ |
2116 | 2116 | private function _set_category_object() { |
2117 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
2117 | + if (isset($this->_category->id) && ! empty($this->_category->id)) |
|
2118 | 2118 | return; //already have the category object so get out. |
2119 | 2119 | |
2120 | 2120 | //set default category object |
2121 | 2121 | $this->_set_empty_category_object(); |
2122 | 2122 | |
2123 | 2123 | //only set if we've got an id |
2124 | - if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) { |
|
2124 | + if ( ! isset($this->_req_data['EVT_CAT_ID'])) { |
|
2125 | 2125 | return; |
2126 | 2126 | } |
2127 | 2127 | |
2128 | 2128 | $category_id = absint($this->_req_data['EVT_CAT_ID']); |
2129 | 2129 | |
2130 | - $term = get_term( $category_id, 'espresso_event_categories' ); |
|
2130 | + $term = get_term($category_id, 'espresso_event_categories'); |
|
2131 | 2131 | |
2132 | - if ( !empty( $term ) ) { |
|
2132 | + if ( ! empty($term)) { |
|
2133 | 2133 | $this->_category->category_name = $term->name; |
2134 | 2134 | $this->_category->category_identifier = $term->slug; |
2135 | 2135 | $this->_category->category_desc = $term->description; |
@@ -2143,13 +2143,13 @@ discard block |
||
2143 | 2143 | |
2144 | 2144 | private function _set_empty_category_object() { |
2145 | 2145 | $this->_category = new stdClass(); |
2146 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
2146 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
2147 | 2147 | $this->_category->id = $this->_category->parent = 0; |
2148 | 2148 | } |
2149 | 2149 | |
2150 | 2150 | |
2151 | 2151 | protected function _category_list_table() { |
2152 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2152 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2153 | 2153 | $this->_search_btn_label = __('Categories', 'event_espresso'); |
2154 | 2154 | $this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2'); |
2155 | 2155 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -2159,22 +2159,22 @@ discard block |
||
2159 | 2159 | protected function _category_details($view) { |
2160 | 2160 | |
2161 | 2161 | //load formatter helper |
2162 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
2162 | + EE_Registry::instance()->load_helper('Formatter'); |
|
2163 | 2163 | //load field generator helper |
2164 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
2164 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
2165 | 2165 | |
2166 | 2166 | $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
2167 | 2167 | $this->_set_add_edit_form_tags($route); |
2168 | 2168 | |
2169 | 2169 | $this->_set_category_object(); |
2170 | - $id = !empty($this->_category->id) ? $this->_category->id : ''; |
|
2170 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
2171 | 2171 | |
2172 | 2172 | $delete_action = 'delete_category'; |
2173 | 2173 | |
2174 | 2174 | //custom redirect |
2175 | - $redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url ); |
|
2175 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
2176 | 2176 | |
2177 | - $this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect ); |
|
2177 | + $this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect); |
|
2178 | 2178 | |
2179 | 2179 | //take care of contents |
2180 | 2180 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
@@ -2188,25 +2188,25 @@ discard block |
||
2188 | 2188 | 'type' => 'wp_editor', |
2189 | 2189 | 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
2190 | 2190 | 'class' => 'my_editor_custom', |
2191 | - 'wpeditor_args' => array('media_buttons' => FALSE ) |
|
2191 | + 'wpeditor_args' => array('media_buttons' => FALSE) |
|
2192 | 2192 | ); |
2193 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
2193 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
2194 | 2194 | |
2195 | - $all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) ); |
|
2195 | + $all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id))); |
|
2196 | 2196 | |
2197 | 2197 | //setup category select for term parents. |
2198 | 2198 | $category_select_values[] = array( |
2199 | 2199 | 'text' => __('No Parent', 'event_espresso'), |
2200 | 2200 | 'id' => 0 |
2201 | 2201 | ); |
2202 | - foreach ( $all_terms as $term ) { |
|
2202 | + foreach ($all_terms as $term) { |
|
2203 | 2203 | $category_select_values[] = array( |
2204 | 2204 | 'text' => $term->name, |
2205 | 2205 | 'id' => $term->term_id |
2206 | 2206 | ); |
2207 | 2207 | } |
2208 | 2208 | |
2209 | - $category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent ); |
|
2209 | + $category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent); |
|
2210 | 2210 | |
2211 | 2211 | $template_args = array( |
2212 | 2212 | 'category' => $this->_category, |
@@ -2216,15 +2216,15 @@ discard block |
||
2216 | 2216 | 'disable' => '', |
2217 | 2217 | 'disabled_message' => FALSE |
2218 | 2218 | ); |
2219 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
2220 | - return EEH_Template::display_template($template, $template_args, TRUE ); |
|
2219 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
2220 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
2221 | 2221 | } |
2222 | 2222 | |
2223 | 2223 | |
2224 | 2224 | protected function _delete_categories() { |
2225 | - $cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
2225 | + $cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
2226 | 2226 | |
2227 | - foreach ( $cat_ids as $cat_id ) { |
|
2227 | + foreach ($cat_ids as $cat_id) { |
|
2228 | 2228 | $this->_delete_category($cat_id); |
2229 | 2229 | } |
2230 | 2230 | |
@@ -2232,7 +2232,7 @@ discard block |
||
2232 | 2232 | $query_args = array( |
2233 | 2233 | 'action' => 'category_list' |
2234 | 2234 | ); |
2235 | - $this->_redirect_after_action(0,'','',$query_args); |
|
2235 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
2236 | 2236 | |
2237 | 2237 | } |
2238 | 2238 | |
@@ -2242,61 +2242,61 @@ discard block |
||
2242 | 2242 | |
2243 | 2243 | protected function _delete_category($cat_id) { |
2244 | 2244 | global $wpdb; |
2245 | - $cat_id = absint( $cat_id ); |
|
2246 | - wp_delete_term( $cat_id, 'espresso_event_categories' ); |
|
2245 | + $cat_id = absint($cat_id); |
|
2246 | + wp_delete_term($cat_id, 'espresso_event_categories'); |
|
2247 | 2247 | } |
2248 | 2248 | |
2249 | 2249 | |
2250 | 2250 | |
2251 | 2251 | protected function _insert_or_update_category($new_category) { |
2252 | 2252 | |
2253 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE ); |
|
2253 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE); |
|
2254 | 2254 | $success = 0; //we already have a success message so lets not send another. |
2255 | 2255 | |
2256 | - if ( $cat_id ) { |
|
2256 | + if ($cat_id) { |
|
2257 | 2257 | $query_args = array( |
2258 | 2258 | 'action' => 'edit_category', |
2259 | 2259 | 'EVT_CAT_ID' => $cat_id |
2260 | 2260 | ); |
2261 | 2261 | } else { |
2262 | - $query_args = array( 'action' => 'add_category' ); |
|
2262 | + $query_args = array('action' => 'add_category'); |
|
2263 | 2263 | } |
2264 | - $this->_redirect_after_action( $success, '','', $query_args, TRUE ); |
|
2264 | + $this->_redirect_after_action($success, '', '', $query_args, TRUE); |
|
2265 | 2265 | |
2266 | 2266 | } |
2267 | 2267 | |
2268 | 2268 | |
2269 | 2269 | |
2270 | - private function _insert_category( $update = FALSE ) { |
|
2270 | + private function _insert_category($update = FALSE) { |
|
2271 | 2271 | $cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : ''; |
2272 | - $category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
2273 | - $category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
2274 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
2272 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
2273 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
2274 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
2275 | 2275 | |
2276 | - if ( empty( $category_name ) ) { |
|
2277 | - $msg = __( 'You must add a name for the category.', 'event_espresso' ); |
|
2278 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2276 | + if (empty($category_name)) { |
|
2277 | + $msg = __('You must add a name for the category.', 'event_espresso'); |
|
2278 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2279 | 2279 | return false; |
2280 | 2280 | } |
2281 | 2281 | |
2282 | - $term_args=array( |
|
2282 | + $term_args = array( |
|
2283 | 2283 | 'name'=>$category_name, |
2284 | 2284 | 'description'=>$category_desc, |
2285 | 2285 | 'parent'=>$category_parent |
2286 | 2286 | ); |
2287 | 2287 | //was the category_identifier input disabled? |
2288 | - if(isset($this->_req_data['category_identifier'])){ |
|
2288 | + if (isset($this->_req_data['category_identifier'])) { |
|
2289 | 2289 | $term_args['slug'] = $this->_req_data['category_identifier']; |
2290 | 2290 | } |
2291 | - $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args ); |
|
2291 | + $insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args); |
|
2292 | 2292 | |
2293 | - if ( !is_array( $insert_ids ) ) { |
|
2294 | - $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
2295 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2293 | + if ( ! is_array($insert_ids)) { |
|
2294 | + $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
2295 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2296 | 2296 | } else { |
2297 | 2297 | $cat_id = $insert_ids['term_id']; |
2298 | - $msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name ); |
|
2299 | - EE_Error::add_success( $msg ); |
|
2298 | + $msg = sprintf(__('The category %s was successfuly saved', 'event_espresso'), $category_name); |
|
2299 | + EE_Error::add_success($msg); |
|
2300 | 2300 | } |
2301 | 2301 | |
2302 | 2302 | return $cat_id; |
@@ -2305,32 +2305,32 @@ discard block |
||
2305 | 2305 | |
2306 | 2306 | |
2307 | 2307 | |
2308 | - public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
2308 | + public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) { |
|
2309 | 2309 | global $wpdb; |
2310 | 2310 | |
2311 | 2311 | //testing term stuff |
2312 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2313 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
2314 | - $limit = ($current_page-1)*$per_page; |
|
2312 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2313 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
2314 | + $limit = ($current_page - 1) * $per_page; |
|
2315 | 2315 | |
2316 | - $where = array( 'taxonomy' => 'espresso_event_categories' ); |
|
2316 | + $where = array('taxonomy' => 'espresso_event_categories'); |
|
2317 | 2317 | |
2318 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2319 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2318 | + if (isset($this->_req_data['s'])) { |
|
2319 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2320 | 2320 | $where['OR'] = array( |
2321 | - 'Term.name' => array( 'LIKE', $sstr), |
|
2322 | - 'description' => array( 'LIKE', $sstr ) |
|
2321 | + 'Term.name' => array('LIKE', $sstr), |
|
2322 | + 'description' => array('LIKE', $sstr) |
|
2323 | 2323 | ); |
2324 | 2324 | } |
2325 | 2325 | |
2326 | 2326 | $query_params = array( |
2327 | - $where , |
|
2328 | - 'order_by' => array( $orderby => $order ), |
|
2329 | - 'limit' => $limit . ',' . $per_page, |
|
2327 | + $where, |
|
2328 | + 'order_by' => array($orderby => $order), |
|
2329 | + 'limit' => $limit.','.$per_page, |
|
2330 | 2330 | 'force_join' => array('Term') |
2331 | 2331 | ); |
2332 | 2332 | |
2333 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
2333 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
2334 | 2334 | |
2335 | 2335 | return $categories; |
2336 | 2336 | } |
@@ -3,5 +3,5 @@ |
||
3 | 3 | <?php _e('A venue is the place or location that is hosting your event. This setting is optional which means that you are not required to select a venue for your event.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | 5 | <p> |
6 | -<?php echo sprintf(__('Venues can be managed through the %sVenues page%s.', 'event_espresso'),'<a href="admin.php?page=espresso_venues">','</a>'); ?> |
|
6 | +<?php echo sprintf(__('Venues can be managed through the %sVenues page%s.', 'event_espresso'), '<a href="admin.php?page=espresso_venues">', '</a>'); ?> |
|
7 | 7 | </p> |
8 | 8 | \ No newline at end of file |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php do_action( 'AHEE__event_tickets_metabox_main__before_content' ); ?> |
|
1 | +<?php do_action('AHEE__event_tickets_metabox_main__before_content'); ?> |
|
2 | 2 | <div id="event-and-ticket-form-content"> |
3 | 3 | <h4 class="event-tickets-datetimes-title"><?php _e('Event Datetime', 'event_espresso'); ?></h4><?php echo $event_datetime_help_link; ?> |
4 | 4 | <div class="event-datetimes-container"> |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | </td> |
30 | 30 | <td class="event-datetime-column reg-limit-column"> |
31 | 31 | <?php |
32 | - $reg_limit = $time->get_pretty('DTT_reg_limit','input'); |
|
32 | + $reg_limit = $time->get_pretty('DTT_reg_limit', 'input'); |
|
33 | 33 | ?> |
34 | 34 | <input type="text" name="edit_event_datetimes[1][DTT_reg_limit]" id="event-datetime-DTT_reg_limit-1" class="ee-small-text-inp ee-inp-right event-datetime-DTT_reg_limit" value="<?php echo $reg_limit; ?>"> |
35 | 35 | </td> |
36 | - <td class="datetime-tickets-sold"><?php printf( __('Tickets Sold: %s', 'event_espresso'), $time->get('DTT_sold') ); ?></td> |
|
36 | + <td class="datetime-tickets-sold"><?php printf(__('Tickets Sold: %s', 'event_espresso'), $time->get('DTT_sold')); ?></td> |
|
37 | 37 | </tr> |
38 | 38 | </tbody> |
39 | 39 | </table> |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | <div style="clear:both"></div> |
72 | 72 | </div> <!-- end #event-and-ticket-form-content --> |
73 | 73 | |
74 | -<?php do_action( 'AHEE__event_tickets_metabox_main__after_content' ); ?> |
|
74 | +<?php do_action('AHEE__event_tickets_metabox_main__after_content'); ?> |
|
75 | 75 | |
76 | 76 | <table id="new-ticket-row-form" class="hidden"> |
77 | 77 | <tbody><?php echo $ticket_js_structure; ?></tbody> |
@@ -6,41 +6,41 @@ |
||
6 | 6 | <ul> |
7 | 7 | <li> |
8 | 8 | <strong><?php _e('Registration Checkout Page', 'event_espresso'); ?></strong><br /> |
9 | -<?php printf( __('This page displays all your events and is required. It is important that this page always contain the %s shortcode. It is not required to be in your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_CHECKOUT]</strong>' ); ?> |
|
9 | +<?php printf(__('This page displays all your events and is required. It is important that this page always contain the %s shortcode. It is not required to be in your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_CHECKOUT]</strong>'); ?> |
|
10 | 10 | </li> |
11 | 11 | <li> |
12 | 12 | <strong><?php _e('Transactions Page', 'event_espresso'); ?></strong><br /> |
13 | -<?php printf( __('This page processes the payments and is required. It should only contain the %s shortcode. No other content should be added and it should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_TXN_PAGE]</strong>' ); ?> |
|
13 | +<?php printf(__('This page processes the payments and is required. It should only contain the %s shortcode. No other content should be added and it should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_TXN_PAGE]</strong>'); ?> |
|
14 | 14 | </li> |
15 | 15 | <li> |
16 | 16 | <strong><?php _e('Thank You Page', 'event_espresso'); ?></strong><br /> |
17 | -<?php printf( __('This page is displayed after a successful transaction and is required. It should contain the %s shortcode. Additionally, you may customize this page by adding extra content to the page. It should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_THANK_YOU]</strong>' ); ?> |
|
17 | +<?php printf(__('This page is displayed after a successful transaction and is required. It should contain the %s shortcode. Additionally, you may customize this page by adding extra content to the page. It should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_THANK_YOU]</strong>'); ?> |
|
18 | 18 | </li> |
19 | 19 | <li> |
20 | 20 | <strong><?php _e('Cancel / Return Page', 'event_espresso'); ?></strong><br /> |
21 | -<?php printf( __('This page is displayed after an unsuccessful transaction and is required. It should contain the %s shortcode. Additionally, you may customize this page by adding extra content to the page. It should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_CANCELLED]</strong>' ); ?> |
|
21 | +<?php printf(__('This page is displayed after an unsuccessful transaction and is required. It should contain the %s shortcode. Additionally, you may customize this page by adding extra content to the page. It should be hidden from your navigation menu.', 'event_espresso'), '<strong>[ESPRESSO_CANCELLED]</strong>'); ?> |
|
22 | 22 | </li> |
23 | 23 | <li> |
24 | 24 | <strong><?php _e('Event List', 'event_espresso'); ?></strong><br /> |
25 | -<?php printf(__('If you would like to style the look of your events archive page, then follow the WordPress instructions for %1$screating a custom template for archive pages%2$s.', 'event_espresso'), '<a href="http://codex.wordpress.org/Post_Type_Templates">','</a>'); ?> |
|
25 | +<?php printf(__('If you would like to style the look of your events archive page, then follow the WordPress instructions for %1$screating a custom template for archive pages%2$s.', 'event_espresso'), '<a href="http://codex.wordpress.org/Post_Type_Templates">', '</a>'); ?> |
|
26 | 26 | <ul> |
27 | 27 | <li style="list-style-type: circle;"> |
28 | -<?php printf( __('Build a template for your events - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>archive-espresso_events.php</strong>','wp-content/themes/twenty-fourteen' ); ?> |
|
28 | +<?php printf(__('Build a template for your events - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>archive-espresso_events.php</strong>', 'wp-content/themes/twenty-fourteen'); ?> |
|
29 | 29 | </li> |
30 | 30 | <li style="list-style-type: circle;"> |
31 | -<?php printf( __('Build a template for a single event - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>single-espresso_events.php</strong>','wp-content/themes/twenty-fourteen' ); ?> |
|
31 | +<?php printf(__('Build a template for a single event - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>single-espresso_events.php</strong>', 'wp-content/themes/twenty-fourteen'); ?> |
|
32 | 32 | </li> |
33 | 33 | </ul> |
34 | 34 | </li> |
35 | 35 | <li> |
36 | 36 | <strong><?php _e('Venue List', 'event_espresso'); ?></strong><br /> |
37 | -<?php printf(__('If you would like to style the look of your venues archive page, then follow the WordPress instructions for %1$screating a custom template for archive pages%2$s.', 'event_espresso'), '<a href="http://codex.wordpress.org/Post_Type_Templates">','</a>'); ?> |
|
37 | +<?php printf(__('If you would like to style the look of your venues archive page, then follow the WordPress instructions for %1$screating a custom template for archive pages%2$s.', 'event_espresso'), '<a href="http://codex.wordpress.org/Post_Type_Templates">', '</a>'); ?> |
|
38 | 38 | <ul> |
39 | 39 | <li style="list-style-type: circle;"> |
40 | -<?php printf( __('Build a template for your events - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>archive-espresso_venues.php</strong>','wp-content/themes/twenty-fourteen' ); ?> |
|
40 | +<?php printf(__('Build a template for your events - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>archive-espresso_venues.php</strong>', 'wp-content/themes/twenty-fourteen'); ?> |
|
41 | 41 | </li> |
42 | 42 | <li style="list-style-type: circle;"> |
43 | -<?php printf( __('Build a template for a single event - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>single-espresso_venues.php</strong>','wp-content/themes/twenty-fourteen' ); ?> |
|
43 | +<?php printf(__('Build a template for a single event - create a theme template named %1$s Then place it in your theme\'s root directory. For the default WordPress Twenty Thirteen theme, this location will be %2$s.', 'event_espresso'), '<strong>single-espresso_venues.php</strong>', 'wp-content/themes/twenty-fourteen'); ?> |
|
44 | 44 | </li> |
45 | 45 | </ul> |
46 | 46 | </li> |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | </strong> |
25 | 25 | <?php echo EEH_Template::get_help_tab_link('registration_page_info'); ?> |
26 | 26 | <br /> |
27 | - <?php echo General_Settings_Admin_Page::edit_view_links( $reg_page_id );?> |
|
27 | + <?php echo General_Settings_Admin_Page::edit_view_links($reg_page_id); ?> |
|
28 | 28 | </label> |
29 | 29 | </th> |
30 | 30 | <td> |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | <option value="0"> |
33 | 33 | <?php _e('Main Page', 'event_espresso'); ?> |
34 | 34 | </option> |
35 | - <?php General_Settings_Admin_Page::page_settings_dropdown( $reg_page_id ); ?> |
|
35 | + <?php General_Settings_Admin_Page::page_settings_dropdown($reg_page_id); ?> |
|
36 | 36 | </select> |
37 | 37 | <span> |
38 | - <?php echo General_Settings_Admin_Page::page_and_shortcode_status( $reg_page_obj, '[ESPRESSO_CHECKOUT]' ); ?> |
|
38 | + <?php echo General_Settings_Admin_Page::page_and_shortcode_status($reg_page_obj, '[ESPRESSO_CHECKOUT]'); ?> |
|
39 | 39 | </span> |
40 | 40 | <br /> |
41 | 41 | <p class="description"> |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | <?php echo EEH_Template::get_help_tab_link('notify_url_info'); ?> |
60 | 60 | <br /> |
61 | 61 | <span class="lt-grey-text"><?php _e('Notify URL (processes payments)', 'event_espresso'); ?></span><br/> |
62 | - <?php echo General_Settings_Admin_Page::edit_view_links( $txn_page_id );?> |
|
62 | + <?php echo General_Settings_Admin_Page::edit_view_links($txn_page_id); ?> |
|
63 | 63 | </label> |
64 | 64 | </th> |
65 | 65 | <td> |
@@ -67,16 +67,16 @@ discard block |
||
67 | 67 | <option value="0"> |
68 | 68 | <?php _e('Main Page', 'event_espresso'); ?> |
69 | 69 | </option> |
70 | - <?php General_Settings_Admin_Page::page_settings_dropdown( $txn_page_id ); ?> |
|
70 | + <?php General_Settings_Admin_Page::page_settings_dropdown($txn_page_id); ?> |
|
71 | 71 | </select> |
72 | 72 | <span> |
73 | - <?php echo General_Settings_Admin_Page::page_and_shortcode_status( $txn_page_obj, '[ESPRESSO_TXN_PAGE]' ); ?> |
|
73 | + <?php echo General_Settings_Admin_Page::page_and_shortcode_status($txn_page_obj, '[ESPRESSO_TXN_PAGE]'); ?> |
|
74 | 74 | </span> |
75 | 75 | <br /> |
76 | 76 | <p class="description"> |
77 | 77 | <?php |
78 | 78 | echo sprintf( |
79 | - __( 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain the %s shortcode.', 'event_espresso' ), |
|
79 | + __('This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain the %s shortcode.', 'event_espresso'), |
|
80 | 80 | '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_TXN_PAGE]</span>' |
81 | 81 | ); |
82 | 82 | ?> |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | </strong> |
94 | 94 | <?php echo EEH_Template::get_help_tab_link('return_url_info'); ?> |
95 | 95 | <br /> |
96 | - <?php echo General_Settings_Admin_Page::edit_view_links( $thank_you_page_id );?> |
|
96 | + <?php echo General_Settings_Admin_Page::edit_view_links($thank_you_page_id); ?> |
|
97 | 97 | </label> |
98 | 98 | </th> |
99 | 99 | <td> |
@@ -101,16 +101,16 @@ discard block |
||
101 | 101 | <option value="0"> |
102 | 102 | <?php _e('Main Page', 'event_espresso'); ?> |
103 | 103 | </option> |
104 | - <?php General_Settings_Admin_Page::page_settings_dropdown( $thank_you_page_id ); ?> |
|
104 | + <?php General_Settings_Admin_Page::page_settings_dropdown($thank_you_page_id); ?> |
|
105 | 105 | </select> |
106 | 106 | <span> |
107 | - <?php echo General_Settings_Admin_Page::page_and_shortcode_status( $thank_you_page_obj, '[ESPRESSO_THANK_YOU]' ); ?> |
|
107 | + <?php echo General_Settings_Admin_Page::page_and_shortcode_status($thank_you_page_obj, '[ESPRESSO_THANK_YOU]'); ?> |
|
108 | 108 | </span> |
109 | 109 | <br /> |
110 | 110 | <p class="description"> |
111 | 111 | <?php |
112 | 112 | echo sprintf( |
113 | - __( 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain the %s shortcode.', 'event_espresso' ), |
|
113 | + __('This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain the %s shortcode.', 'event_espresso'), |
|
114 | 114 | '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_THANK_YOU]</span>' |
115 | 115 | ); |
116 | 116 | ?> |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | </strong> |
128 | 128 | <?php echo EEH_Template::get_help_tab_link('cancel_return_info'); ?> |
129 | 129 | <br /> |
130 | - <?php echo General_Settings_Admin_Page::edit_view_links( $cancel_page_id );?> |
|
130 | + <?php echo General_Settings_Admin_Page::edit_view_links($cancel_page_id); ?> |
|
131 | 131 | </label> |
132 | 132 | </th> |
133 | 133 | <td> |
@@ -135,16 +135,16 @@ discard block |
||
135 | 135 | <option value="0"> |
136 | 136 | <?php _e('Main Page', 'event_espresso'); ?> |
137 | 137 | </option> |
138 | - <?php General_Settings_Admin_Page::page_settings_dropdown( $cancel_page_id ); ?> |
|
138 | + <?php General_Settings_Admin_Page::page_settings_dropdown($cancel_page_id); ?> |
|
139 | 139 | </select> |
140 | 140 | <span> |
141 | - <?php echo General_Settings_Admin_Page::page_and_shortcode_status( $cancel_page_obj, '[ESPRESSO_CANCELLED]' ); ?> |
|
141 | + <?php echo General_Settings_Admin_Page::page_and_shortcode_status($cancel_page_obj, '[ESPRESSO_CANCELLED]'); ?> |
|
142 | 142 | </span> |
143 | 143 | <br /> |
144 | 144 | <p class="description"> |
145 | 145 | <?php |
146 | 146 | echo sprintf( |
147 | - __( 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain a "cancelled transaction" message and the %s shortcode.', 'event_espresso' ), |
|
147 | + __('This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain a "cancelled transaction" message and the %s shortcode.', 'event_espresso'), |
|
148 | 148 | '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_CANCELLED]</span>' |
149 | 149 | ); |
150 | 150 | ?> |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | </strong> |
162 | 162 | <?php echo EEH_Template::get_help_tab_link('event_list_cpt_info'); ?> |
163 | 163 | <br /> |
164 | - <a href='<?php echo get_post_type_archive_link('espresso_events') ?>'><?php _e('View', 'event_espresso');?></a> |
|
164 | + <a href='<?php echo get_post_type_archive_link('espresso_events') ?>'><?php _e('View', 'event_espresso'); ?></a> |
|
165 | 165 | </label> |
166 | 166 | </th> |
167 | 167 | <td> |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | <?php echo __('Events are custom post types and use WordPress\' normal archive pages for displaying events.', 'event_espresso') ?> |
170 | 170 | </p> |
171 | 171 | <p class="description"> |
172 | - <?php printf(__('If you would still like your events on a page like in Event Espresso 3.1 or earlier, simply create a page and place a shortcode to display them on the page, as described %s here %s', 'event_espresso'),'<a href="admin.php?page=espresso_support">','</a>') ?> |
|
172 | + <?php printf(__('If you would still like your events on a page like in Event Espresso 3.1 or earlier, simply create a page and place a shortcode to display them on the page, as described %s here %s', 'event_espresso'), '<a href="admin.php?page=espresso_support">', '</a>') ?> |
|
173 | 173 | </p> |
174 | 174 | <br/><br/> |
175 | 175 | </td> |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | </strong> |
184 | 184 | <?php echo EEH_Template::get_help_tab_link('venue_list_cpt_info'); ?> |
185 | 185 | <br /> |
186 | - <a href='<?php echo get_post_type_archive_link('espresso_venues') ?>'><?php _e('View', 'event_espresso');?></a> |
|
186 | + <a href='<?php echo get_post_type_archive_link('espresso_venues') ?>'><?php _e('View', 'event_espresso'); ?></a> |
|
187 | 187 | </label> |
188 | 188 | </th> |
189 | 189 | <td> |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | <?php echo __('Venues are custom post types and use WordPress\' normal archive pages for displaying events.', 'event_espresso') ?> |
192 | 192 | </p> |
193 | 193 | <p class="description"> |
194 | - <?php printf(__('If you would still like your venues on a page like in Event Espresso 3.1 or earlier, simply create a page and place a shortcode to display them on the page, as described %s here %s', 'event_espresso'),'<a href="admin.php?page=espresso_support">','</a>') ?> |
|
194 | + <?php printf(__('If you would still like your venues on a page like in Event Espresso 3.1 or earlier, simply create a page and place a shortcode to display them on the page, as described %s here %s', 'event_espresso'), '<a href="admin.php?page=espresso_support">', '</a>') ?> |
|
195 | 195 | </p> |
196 | 196 | </td> |
197 | 197 | </tr> |
@@ -7,14 +7,14 @@ |
||
7 | 7 | * @type string $fieldname The name of the field the chooser is associated with. |
8 | 8 | * @type string $linked_input_id The name of the input that the shortcode gets inserted to. |
9 | 9 | */ |
10 | -if ( ! empty( $shortcodes ) ) : ?> |
|
10 | +if ( ! empty($shortcodes)) : ?> |
|
11 | 11 | <span class="ee-messages-shortcodes-chooser js-open-list-trigger dashicons dashicons-menu"> |
12 | 12 | <ul id="ee_shortcode_chooser_<?php echo $fieldname; ?>" class="ee_shortcode_chooser_container hidden"> |
13 | - <?php foreach( $shortcodes as $shortcode => $label ) : ?> |
|
13 | + <?php foreach ($shortcodes as $shortcode => $label) : ?> |
|
14 | 14 | <li> |
15 | - <span class="js-shortcode-selection" data-value="<?php echo esc_attr( $shortcode ); ?>" data-linked-input-id="<?php echo esc_attr( $linked_input_id ); ?>"><?php echo $shortcode; ?></span> |
|
15 | + <span class="js-shortcode-selection" data-value="<?php echo esc_attr($shortcode); ?>" data-linked-input-id="<?php echo esc_attr($linked_input_id); ?>"><?php echo $shortcode; ?></span> |
|
16 | 16 | </li> |
17 | 17 | <?php endforeach; ?> |
18 | 18 | </ul> |
19 | 19 | </span> |
20 | -<?php endif ; ?> |
|
21 | 20 | \ No newline at end of file |
21 | +<?php endif; ?> |
|
22 | 22 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | |
36 | 36 | |
37 | 37 | protected function _setup_data() { |
38 | - $this->_data = $this->_admin_page->get_categories( $this->_per_page, $this->_current_page); |
|
39 | - $this->_all_data_count = $this->_admin_page->get_categories( $this->_per_page, $this->_current_page, TRUE ); |
|
38 | + $this->_data = $this->_admin_page->get_categories($this->_per_page, $this->_current_page); |
|
39 | + $this->_all_data_count = $this->_admin_page->get_categories($this->_per_page, $this->_current_page, TRUE); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | |
46 | 46 | protected function _set_properties() { |
47 | 47 | $this->_wp_list_args = array( |
48 | - 'singular' => __('venue category', 'event_espresso' ), |
|
49 | - 'plural' => __('venue categories', 'event_espresso' ), |
|
48 | + 'singular' => __('venue category', 'event_espresso'), |
|
49 | + 'plural' => __('venue categories', 'event_espresso'), |
|
50 | 50 | 'ajax' => TRUE, //for now, |
51 | 51 | 'screen' => $this->_admin_page->get_current_screen()->id |
52 | 52 | ); |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | ); |
61 | 61 | |
62 | 62 | $this->_sortable_columns = array( |
63 | - 'id' => array( 'Term.term_id' => true ), |
|
64 | - 'name' => array( 'Term.slug' => false ), |
|
65 | - 'count' => array( 'term_count' => false ) |
|
63 | + 'id' => array('Term.term_id' => true), |
|
64 | + 'name' => array('Term.slug' => false), |
|
65 | + 'count' => array('term_count' => false) |
|
66 | 66 | ); |
67 | 67 | |
68 | 68 | $this->_hidden_columns = array(); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | |
94 | 94 | public function column_cb($item) { |
95 | - return sprintf( '<input type="checkbox" name="VEN_CAT_ID[]" value="%s" />', $item->get('term_id') ); |
|
95 | + return sprintf('<input type="checkbox" name="VEN_CAT_ID[]" value="%s" />', $item->get('term_id')); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | public function column_id($item) { |
104 | 104 | $content = $item->get('term_id'); |
105 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->get_first_related('Term')->get('name') . '</span>'; |
|
105 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->get_first_related('Term')->get('name').'</span>'; |
|
106 | 106 | return $content; |
107 | 107 | } |
108 | 108 | |
@@ -122,17 +122,17 @@ discard block |
||
122 | 122 | 'VEN_CAT_ID' => $item->get('term_id') |
123 | 123 | ); |
124 | 124 | |
125 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EE_VENUES_ADMIN_URL ); |
|
126 | - $delete_link = EE_Admin_Page::add_query_args_and_nonce( $delete_query_args, EE_VENUES_ADMIN_URL ); |
|
125 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL); |
|
126 | + $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_VENUES_ADMIN_URL); |
|
127 | 127 | |
128 | 128 | $actions = array( |
129 | - 'edit' => '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Category', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>' |
|
129 | + 'edit' => '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Category', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>' |
|
130 | 130 | ); |
131 | 131 | |
132 | 132 | |
133 | - $actions['delete'] = '<a href="' . $delete_link . '" title="' . esc_attr__('Delete Category', 'event_espresso') . '">' . __('Delete', 'event_espresso') . '</a>'; |
|
133 | + $actions['delete'] = '<a href="'.$delete_link.'" title="'.esc_attr__('Delete Category', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>'; |
|
134 | 134 | |
135 | - $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->get_first_related('Term')->get('name') . '</a></strong>'; |
|
135 | + $content = '<strong><a class="row-title" href="'.$edit_link.'">'.$item->get_first_related('Term')->get('name').'</a></strong>'; |
|
136 | 136 | $content .= $this->row_actions($actions); |
137 | 137 | return $content; |
138 | 138 | } |
@@ -141,20 +141,20 @@ discard block |
||
141 | 141 | |
142 | 142 | |
143 | 143 | public function column_shortcode($item) { |
144 | - $content = '[EVENT_ESPRESSO_CATEGORY category_id="' . $item->get_first_related('Term')->get('slug') . '"]'; |
|
144 | + $content = '[EVENT_ESPRESSO_CATEGORY category_id="'.$item->get_first_related('Term')->get('slug').'"]'; |
|
145 | 145 | return $content; |
146 | 146 | } |
147 | 147 | |
148 | 148 | |
149 | 149 | |
150 | 150 | |
151 | - public function column_count( $item ) { |
|
151 | + public function column_count($item) { |
|
152 | 152 | $e_args = array( |
153 | 153 | 'action' => 'default', |
154 | 154 | 'category' => $item->get_first_related('Term')->ID() |
155 | 155 | ); |
156 | - $e_link = EE_Admin_Page::add_query_args_and_nonce( $e_args, EE_VENUES_ADMIN_URL ); |
|
157 | - $content = '<a href="' . $e_link . '">' . $item->get('term_count') . '</a>'; |
|
156 | + $e_link = EE_Admin_Page::add_query_args_and_nonce($e_args, EE_VENUES_ADMIN_URL); |
|
157 | + $content = '<a href="'.$e_link.'">'.$item->get('term_count').'</a>'; |
|
158 | 158 | return $content; |
159 | 159 | } |
160 | 160 | } |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | class Venues_Admin_List_Table extends EE_Admin_List_Table { |
33 | 33 | |
34 | - public function __construct( $admin_page ) { |
|
34 | + public function __construct($admin_page) { |
|
35 | 35 | parent::__construct($admin_page); |
36 | 36 | } |
37 | 37 | |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | |
40 | 40 | |
41 | 41 | protected function _setup_data() { |
42 | - $this->_data = $this->_admin_page->get_venues( $this->_per_page); |
|
43 | - $this->_all_data_count = $this->_admin_page->get_venues( $this->_per_page, TRUE ); |
|
42 | + $this->_data = $this->_admin_page->get_venues($this->_per_page); |
|
43 | + $this->_all_data_count = $this->_admin_page->get_venues($this->_per_page, TRUE); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | |
50 | 50 | protected function _set_properties() { |
51 | 51 | $this->_wp_list_args = array( |
52 | - 'singular' => __('Event Venue', 'event_espresso' ), |
|
53 | - 'plural' => __('Event Venues', 'event_espresso' ), |
|
52 | + 'singular' => __('Event Venue', 'event_espresso'), |
|
53 | + 'plural' => __('Event Venues', 'event_espresso'), |
|
54 | 54 | 'ajax' => TRUE, //for now, |
55 | 55 | 'screen' => $this->_admin_page->get_current_screen()->id |
56 | 56 | ); |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | ); |
67 | 67 | |
68 | 68 | $this->_sortable_columns = array( |
69 | - 'id' => array( 'id' => true ), |
|
70 | - 'name' => array( 'name' => false ), |
|
71 | - 'city' => array( 'city' => false ), |
|
72 | - 'capacity' => array( 'capacity' => false ) |
|
69 | + 'id' => array('id' => true), |
|
70 | + 'name' => array('name' => false), |
|
71 | + 'city' => array('city' => false), |
|
72 | + 'capacity' => array('capacity' => false) |
|
73 | 73 | ); |
74 | 74 | |
75 | 75 | $this->_hidden_columns = array(); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | protected function _add_view_counts() { |
93 | 93 | $this->_views['all']['count'] = EEM_Venue::instance()->count(); |
94 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) { |
|
94 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
95 | 95 | $this->_views['trash']['count'] = EEM_Venue::instance()->count_deleted(); |
96 | 96 | } |
97 | 97 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | public function column_cb($item) { |
105 | 105 | |
106 | - return $item->count_related('Event') > 0 && $item->get( 'status' ) === 'trash' ? '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="venue_id[]" value="%s" />', $item->ID()); |
|
106 | + return $item->count_related('Event') > 0 && $item->get('status') === 'trash' ? '<span class="ee-lock-icon"></span>' : sprintf('<input type="checkbox" name="venue_id[]" value="%s" />', $item->ID()); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | public function column_id($item) { |
113 | 113 | $content = $item->ID(); |
114 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
114 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->name().'</span>'; |
|
115 | 115 | return $content; |
116 | 116 | } |
117 | 117 | |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | 'post' => $item->ID() |
123 | 123 | ); |
124 | 124 | |
125 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EE_VENUES_ADMIN_URL ); |
|
125 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL); |
|
126 | 126 | |
127 | 127 | $statuses = EEM_Venue::instance()->get_status_array(); |
128 | - $actions = $this->_column_name_action_setup( $item ); |
|
129 | - $content = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_venue', 'espresso_venues_edit', $item->ID() ) ? '<strong><a class="row-title" href="' . $edit_link . '">' . stripslashes_deep($item->name()) . '</a></strong>' : $item->name(); |
|
130 | - $content .= $item->status() == 'draft' ? ' - <span class="post-state">' . $statuses['draft'] . '</span>' : ''; |
|
128 | + $actions = $this->_column_name_action_setup($item); |
|
129 | + $content = EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $item->ID()) ? '<strong><a class="row-title" href="'.$edit_link.'">'.stripslashes_deep($item->name()).'</a></strong>' : $item->name(); |
|
130 | + $content .= $item->status() == 'draft' ? ' - <span class="post-state">'.$statuses['draft'].'</span>' : ''; |
|
131 | 131 | $content .= $this->row_actions($actions); |
132 | 132 | return $content; |
133 | 133 | } |
@@ -138,59 +138,59 @@ discard block |
||
138 | 138 | * @param EE_Venue $item |
139 | 139 | * @return array() |
140 | 140 | */ |
141 | - protected function _column_name_action_setup( EE_Venue $item ) { |
|
141 | + protected function _column_name_action_setup(EE_Venue $item) { |
|
142 | 142 | $actions = array(); |
143 | 143 | |
144 | - if ( EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $item->ID() ) ) { |
|
144 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $item->ID())) { |
|
145 | 145 | $edit_query_args = array( |
146 | 146 | 'action' => 'edit', |
147 | 147 | 'post' => $item->ID() |
148 | 148 | ); |
149 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EE_VENUES_ADMIN_URL ); |
|
150 | - $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Venue', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>'; |
|
149 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL); |
|
150 | + $actions['edit'] = '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Venue', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'; |
|
151 | 151 | |
152 | 152 | } |
153 | 153 | |
154 | 154 | |
155 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venue', 'espresso_venues_trash_venue', $item->ID() ) ) { |
|
155 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venue', 'espresso_venues_trash_venue', $item->ID())) { |
|
156 | 156 | $trash_event_query_arg = array( |
157 | 157 | 'action' => 'trash_venue', |
158 | 158 | 'VNU_ID' => $item->ID() |
159 | 159 | ); |
160 | - $trash_venue_link = EE_Admin_Page::add_query_args_and_nonce( $trash_event_query_arg, EE_VENUES_ADMIN_URL ); |
|
160 | + $trash_venue_link = EE_Admin_Page::add_query_args_and_nonce($trash_event_query_arg, EE_VENUES_ADMIN_URL); |
|
161 | 161 | } |
162 | 162 | |
163 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venue', 'espresso_venues_restore_venue', $item->ID() ) ) { |
|
163 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venue', 'espresso_venues_restore_venue', $item->ID())) { |
|
164 | 164 | $restore_venue_query_args = array( |
165 | 165 | 'action' => 'restore_venue', |
166 | 166 | 'VNU_ID' => $item->ID() |
167 | 167 | ); |
168 | - $restore_venue_link = EE_Admin_Page::add_query_args_and_nonce( $restore_venue_query_args, EE_VENUES_ADMIN_URL ); |
|
168 | + $restore_venue_link = EE_Admin_Page::add_query_args_and_nonce($restore_venue_query_args, EE_VENUES_ADMIN_URL); |
|
169 | 169 | } |
170 | 170 | |
171 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venue', 'espresso_venues_delete_venue', $item->ID() ) ) { |
|
171 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venue', 'espresso_venues_delete_venue', $item->ID())) { |
|
172 | 172 | $delete_venue_query_args = array( |
173 | 173 | 'action' => 'delete_venue', |
174 | 174 | 'VNU_ID' => $item->ID() |
175 | 175 | ); |
176 | - $delete_venue_link = EE_Admin_Page::add_query_args_and_nonce( $delete_venue_query_args, EE_VENUES_ADMIN_URL ); |
|
176 | + $delete_venue_link = EE_Admin_Page::add_query_args_and_nonce($delete_venue_query_args, EE_VENUES_ADMIN_URL); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | $view_link = get_permalink($item->ID()); |
180 | 180 | |
181 | - switch ( $item->get( 'status' ) ) { |
|
181 | + switch ($item->get('status')) { |
|
182 | 182 | case 'trash' : |
183 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venue', 'espresso_venues_restore_venue', $item->ID() ) ) { |
|
184 | - $actions['restore_from_trash'] = '<a href="' . $restore_venue_link . '" title="' . esc_attr__('Restore from Trash', 'event_espresso') . '">' . __('Restore from Trash', 'event_espresso') . '</a>'; |
|
183 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venue', 'espresso_venues_restore_venue', $item->ID())) { |
|
184 | + $actions['restore_from_trash'] = '<a href="'.$restore_venue_link.'" title="'.esc_attr__('Restore from Trash', 'event_espresso').'">'.__('Restore from Trash', 'event_espresso').'</a>'; |
|
185 | 185 | } |
186 | - if ( $item->count_related('Event') === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venue', 'espresso_venues_delete_venue', $item->ID() ) ) { |
|
187 | - $actions['delete permanently'] = '<a href="' . $delete_venue_link . '" title="' . esc_attr__('Delete Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
186 | + if ($item->count_related('Event') === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_venue', 'espresso_venues_delete_venue', $item->ID())) { |
|
187 | + $actions['delete permanently'] = '<a href="'.$delete_venue_link.'" title="'.esc_attr__('Delete Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
188 | 188 | } |
189 | 189 | break; |
190 | 190 | default : |
191 | - $actions['view'] = '<a href="' . $view_link . '" title="' . esc_attr__('View Venue', 'event_espresso') . '">' . __('View', 'event_espresso') . '</a>'; |
|
192 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venue', 'espresso_venues_trash_venue', $item->ID() ) ) { |
|
193 | - $actions['move to trash'] = '<a href="' . $trash_venue_link . '" title="' . esc_attr__('Trash Event', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
191 | + $actions['view'] = '<a href="'.$view_link.'" title="'.esc_attr__('View Venue', 'event_espresso').'">'.__('View', 'event_espresso').'</a>'; |
|
192 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venue', 'espresso_venues_trash_venue', $item->ID())) { |
|
193 | + $actions['move to trash'] = '<a href="'.$trash_venue_link.'" title="'.esc_attr__('Trash Event', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | return $actions; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | |
218 | 218 | |
219 | 219 | public function column_shortcode($item) { |
220 | - $content = '[ESPRESSO_VENUE id=' . $item->ID() . ']'; |
|
220 | + $content = '[ESPRESSO_VENUE id='.$item->ID().']'; |
|
221 | 221 | return $content; |
222 | 222 | } |
223 | 223 |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |