@@ -25,32 +25,32 @@ discard block |
||
25 | 25 | * ------------------------------------------------------------------------ |
26 | 26 | */ |
27 | 27 | // defined some new constants related to caffeinated folder |
28 | -define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/' ); |
|
29 | -define('EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS); |
|
30 | -define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS); |
|
31 | -define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS ); |
|
28 | +define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/'); |
|
29 | +define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS); |
|
30 | +define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS); |
|
31 | +define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS); |
|
32 | 32 | class EE_Brewing_Regular extends EE_Base { |
33 | 33 | |
34 | 34 | public function __construct() { |
35 | - if ( defined( 'EE_CAFF_PATH' )) { |
|
35 | + if (defined('EE_CAFF_PATH')) { |
|
36 | 36 | // activation |
37 | - add_action( 'AHEE__EEH_Activation__initialize_db_content', array( $this, 'initialize_caf_db_content' )); |
|
37 | + add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content')); |
|
38 | 38 | // load caff init |
39 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'caffeinated_init' )); |
|
39 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init')); |
|
40 | 40 | // make it so the PDF receipt doesn't show our shameless plug |
41 | - add_filter( 'FHEE_Invoice__send_invoice__shameless_plug', '__return_false' ); |
|
41 | + add_filter('FHEE_Invoice__send_invoice__shameless_plug', '__return_false'); |
|
42 | 42 | // add caffeinated modules |
43 | - add_filter( 'FHEE__EE_Config__register_modules__modules_to_register', array( $this, 'caffeinated_modules_to_register' )); |
|
43 | + add_filter('FHEE__EE_Config__register_modules__modules_to_register', array($this, 'caffeinated_modules_to_register')); |
|
44 | 44 | // load caff scripts |
45 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_caffeinated_scripts'), 10 ); |
|
45 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10); |
|
46 | 46 | |
47 | - add_filter( 'FHEE__EE_Registry__load_helper__helper_paths', array( $this, 'caf_helper_paths' ), 10 ); |
|
47 | + add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
48 | 48 | |
49 | - add_filter( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array( $this, 'caf_payment_methods' ) ); |
|
49 | + add_filter('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array($this, 'caf_payment_methods')); |
|
50 | 50 | // caffeinated constructed |
51 | - do_action( 'AHEE__EE_Brewing_Regular__construct__complete' ); |
|
51 | + do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
52 | 52 | //seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer |
53 | - add_filter( 'FHEE__ee_show_affiliate_links', '__return_false' ); |
|
53 | + add_filter('FHEE__ee_show_affiliate_links', '__return_false'); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | * @param array $paths original helper paths array |
61 | 61 | * @return array new array of paths |
62 | 62 | */ |
63 | - public function caf_helper_paths( $paths ) { |
|
64 | - $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
63 | + public function caf_helper_paths($paths) { |
|
64 | + $paths[] = EE_CAF_CORE.'helpers'.DS; |
|
65 | 65 | return $paths; |
66 | 66 | } |
67 | 67 | |
@@ -77,22 +77,22 @@ discard block |
||
77 | 77 | * Right now, we ASSUME the only price types in the system are default ones |
78 | 78 | * @global type $wpdb |
79 | 79 | */ |
80 | - function initialize_caf_db_content(){ |
|
80 | + function initialize_caf_db_content() { |
|
81 | 81 | // echo "initialize caf db content!"; |
82 | 82 | global $wpdb; |
83 | 83 | |
84 | 84 | //use same method of getting creator id as the version introducing the change |
85 | - $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id',get_current_user_id()); |
|
85 | + $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
86 | 86 | |
87 | 87 | $price_type_table = $wpdb->prefix."esp_price_type"; |
88 | 88 | $price_table = $wpdb->prefix."esp_price"; |
89 | 89 | |
90 | - if ( EEH_Activation::table_exists( $price_type_table ) ) { |
|
90 | + if (EEH_Activation::table_exists($price_type_table)) { |
|
91 | 91 | |
92 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';//include trashed price types |
|
93 | - $tax_price_type_count = $wpdb->get_var( $SQL ); |
|
92 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; //include trashed price types |
|
93 | + $tax_price_type_count = $wpdb->get_var($SQL); |
|
94 | 94 | |
95 | - if ( $tax_price_type_count <= 1) { |
|
95 | + if ($tax_price_type_count <= 1) { |
|
96 | 96 | $result = $wpdb->insert($price_type_table, |
97 | 97 | array( |
98 | 98 | 'PRT_name'=> __("Regional Tax", "event_espresso"), |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | 'PRT_wp_user' => $default_creator_id |
104 | 104 | ), |
105 | 105 | array( |
106 | - '%s',//PRT_name |
|
107 | - '%d',//PBT_id |
|
108 | - '%d',//PRT_is_percent |
|
109 | - '%d',//PRT_order |
|
110 | - '%d',//PRT_deleted |
|
106 | + '%s', //PRT_name |
|
107 | + '%d', //PBT_id |
|
108 | + '%d', //PRT_is_percent |
|
109 | + '%d', //PRT_order |
|
110 | + '%d', //PRT_deleted |
|
111 | 111 | '%d', //PRT_wp_user |
112 | 112 | )); |
113 | 113 | //federal tax |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | 'PRT_wp_user' => $default_creator_id, |
122 | 122 | ), |
123 | 123 | array( |
124 | - '%s',//PRT_name |
|
125 | - '%d',//PBT_id |
|
126 | - '%d',//PRT_is_percent |
|
127 | - '%d',//PRT_order |
|
128 | - '%d',//PRT_deleted |
|
124 | + '%s', //PRT_name |
|
125 | + '%d', //PBT_id |
|
126 | + '%d', //PRT_is_percent |
|
127 | + '%d', //PRT_order |
|
128 | + '%d', //PRT_deleted |
|
129 | 129 | '%d' //PRT_wp_user |
130 | 130 | )); |
131 | - if( $result){ |
|
131 | + if ($result) { |
|
132 | 132 | $wpdb->insert($price_table, |
133 | 133 | array( |
134 | 134 | 'PRT_ID'=>$wpdb->insert_id, |
@@ -143,15 +143,15 @@ discard block |
||
143 | 143 | 'PRC_wp_user' => $default_creator_id |
144 | 144 | ), |
145 | 145 | array( |
146 | - '%d',//PRT_id |
|
147 | - '%f',//PRC_amount |
|
148 | - '%s',//PRC_name |
|
149 | - '%s',//PRC_desc |
|
150 | - '%d',//PRC_is_default |
|
151 | - '%d',//PRC_overrides |
|
152 | - '%d',//PRC_deleted |
|
153 | - '%d',//PRC_order |
|
154 | - '%d',//PRC_parent |
|
146 | + '%d', //PRT_id |
|
147 | + '%f', //PRC_amount |
|
148 | + '%s', //PRC_name |
|
149 | + '%s', //PRC_desc |
|
150 | + '%d', //PRC_is_default |
|
151 | + '%d', //PRC_overrides |
|
152 | + '%d', //PRC_deleted |
|
153 | + '%d', //PRC_order |
|
154 | + '%d', //PRC_parent |
|
155 | 155 | '%d' //PRC_wp_user |
156 | 156 | )); |
157 | 157 | } |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | * @param array $modules_to_register |
172 | 172 | * @return array |
173 | 173 | */ |
174 | - public function caffeinated_modules_to_register( $modules_to_register = array() ){ |
|
175 | - if ( is_readable( EE_CAFF_PATH . 'modules' )) { |
|
176 | - $caffeinated_modules_to_register = glob( EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR ); |
|
177 | - if ( is_array( $caffeinated_modules_to_register ) && ! empty( $caffeinated_modules_to_register )) { |
|
178 | - $modules_to_register = array_merge( $modules_to_register, $caffeinated_modules_to_register ); |
|
174 | + public function caffeinated_modules_to_register($modules_to_register = array()) { |
|
175 | + if (is_readable(EE_CAFF_PATH.'modules')) { |
|
176 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR); |
|
177 | + if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
178 | + $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | return $modules_to_register; |
@@ -183,19 +183,19 @@ discard block |
||
183 | 183 | |
184 | 184 | |
185 | 185 | |
186 | - public function caffeinated_init(){ |
|
186 | + public function caffeinated_init() { |
|
187 | 187 | // EE_Register_CPTs hooks |
188 | - add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array( $this, 'filter_taxonomies' ), 10 ); |
|
189 | - add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array( $this, 'filter_cpts' ), 10 ); |
|
190 | - add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array( $this, 'nav_metabox_items' ), 10 ); |
|
191 | - EE_Registry::instance()->load_file( EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE ); |
|
188 | + add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array($this, 'filter_taxonomies'), 10); |
|
189 | + add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array($this, 'filter_cpts'), 10); |
|
190 | + add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array($this, 'nav_metabox_items'), 10); |
|
191 | + EE_Registry::instance()->load_file(EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE); |
|
192 | 192 | // caffeinated_init__complete hook |
193 | - do_action( 'AHEE__EE_Brewing_Regular__caffeinated_init__complete' ); |
|
193 | + do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
197 | 197 | |
198 | - public function enqueue_caffeinated_scripts(){ |
|
198 | + public function enqueue_caffeinated_scripts() { |
|
199 | 199 | // sound of crickets... |
200 | 200 | } |
201 | 201 | |
@@ -204,23 +204,23 @@ discard block |
||
204 | 204 | * callbacks below here |
205 | 205 | */ |
206 | 206 | |
207 | - public function filter_taxonomies( $taxonomy_array ) { |
|
207 | + public function filter_taxonomies($taxonomy_array) { |
|
208 | 208 | $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = TRUE; |
209 | 209 | return $taxonomy_array; |
210 | 210 | } |
211 | 211 | |
212 | 212 | |
213 | 213 | |
214 | - public function filter_cpts( $cpt_array ) { |
|
214 | + public function filter_cpts($cpt_array) { |
|
215 | 215 | $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = TRUE; |
216 | 216 | return $cpt_array; |
217 | 217 | } |
218 | 218 | |
219 | 219 | |
220 | - public function nav_metabox_items( $menuitems ) { |
|
220 | + public function nav_metabox_items($menuitems) { |
|
221 | 221 | $menuitems[] = array( |
222 | 222 | 'title' => __('Venue List', 'event_espresso'), |
223 | - 'url' => get_post_type_archive_link( 'espresso_venues' ), |
|
223 | + 'url' => get_post_type_archive_link('espresso_venues'), |
|
224 | 224 | 'description' => __('Archive page for all venues.', 'event_espresso') |
225 | 225 | ); |
226 | 226 | return $menuitems; |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | * @param array $payment_method_paths |
232 | 232 | * @return array values are folder paths to payment method folders |
233 | 233 | */ |
234 | - public function caf_payment_methods( $payment_method_paths ) { |
|
235 | - $caf_payment_methods_paths = glob( EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR ); |
|
236 | - $payment_method_paths = array_merge( $payment_method_paths, $caf_payment_methods_paths ); |
|
234 | + public function caf_payment_methods($payment_method_paths) { |
|
235 | + $caf_payment_methods_paths = glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR); |
|
236 | + $payment_method_paths = array_merge($payment_method_paths, $caf_payment_methods_paths); |
|
237 | 237 | return $payment_method_paths; |
238 | 238 | } |
239 | 239 | } |
@@ -1,1 +1,1 @@ |
||
1 | -<?php printf( esc_html__('Authorize.Net AIM is an on-site payment method for accepting credit and debit card payments and is available to event organizers in the United States, Canada, United Kingdom, and Australia. An account with Authorize.Net is required to accept payments. Need an Authorize.Net account? %1$sClick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/authorizenetaim/" target="_blank">','</a>' ); |
|
2 | 1 | \ No newline at end of file |
2 | +<?php printf(esc_html__('Authorize.Net AIM is an on-site payment method for accepting credit and debit card payments and is available to event organizers in the United States, Canada, United Kingdom, and Australia. An account with Authorize.Net is required to accept payments. Need an Authorize.Net account? %1$sClick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/authorizenetaim/" target="_blank">', '</a>'); |
|
3 | 3 | \ No newline at end of file |
@@ -1,1 +1,1 @@ |
||
1 | -<?php printf( esc_html__('Mijireh is an off-site payment method for accepting payments online through over 80+ payment gateways and is available to event organizers in many countries. An account with Mijireh is required to accept payments. Need a Mijireh account? %1$sClick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/mijireh/" target="_blank">','</a>' ); |
|
2 | 1 | \ No newline at end of file |
2 | +<?php printf(esc_html__('Mijireh is an off-site payment method for accepting payments online through over 80+ payment gateways and is available to event organizers in many countries. An account with Mijireh is required to accept payments. Need a Mijireh account? %1$sClick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/mijireh/" target="_blank">', '</a>'); |
|
3 | 3 | \ No newline at end of file |
@@ -1,1 +1,1 @@ |
||
1 | -<?php printf( esc_html__('PayPal Pro (Website Payments Pro) is an on-site payment method for accepting credit and debit cards and is available to event organizers in the United States, United Kingdom, and Canada. An account with PayPal is required to accept payments. Need a PayPal Pro account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/paypalpro/" target="_blank">','</a>' ); |
|
2 | 1 | \ No newline at end of file |
2 | +<?php printf(esc_html__('PayPal Pro (Website Payments Pro) is an on-site payment method for accepting credit and debit cards and is available to event organizers in the United States, United Kingdom, and Canada. An account with PayPal is required to accept payments. Need a PayPal Pro account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/paypalpro/" target="_blank">', '</a>'); |
|
3 | 3 | \ 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 | /** |
@@ -30,25 +30,25 @@ discard block |
||
30 | 30 | class Extend_Events_Admin_Page extends Events_Admin_Page { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( $routing = TRUE ) { |
|
34 | - parent::__construct( $routing ); |
|
35 | - define( 'EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/'); |
|
36 | - define( 'EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/'); |
|
37 | - define( 'EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/'); |
|
33 | + public function __construct($routing = TRUE) { |
|
34 | + parent::__construct($routing); |
|
35 | + define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'events/templates/'); |
|
36 | + define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'events/assets/'); |
|
37 | + define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'events/assets/'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
41 | 41 | protected function _extend_page_config() { |
42 | 42 | |
43 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events'; |
|
43 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'events'; |
|
44 | 44 | $default_espresso_boxes = $this->_default_espresso_metaboxes; |
45 | 45 | |
46 | 46 | //is there a evt_id in the request? |
47 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0; |
|
48 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
47 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0; |
|
48 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
49 | 49 | |
50 | 50 | //tkt_id? |
51 | - $tkt_id = !empty( $this->_req_data['TKT_ID'] ) && ! is_array( $this->_req_data['TKT_ID'] ) ? $this->_req_data['TKT_ID'] : 0; |
|
51 | + $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) ? $this->_req_data['TKT_ID'] : 0; |
|
52 | 52 | |
53 | 53 | $new_page_routes = array( |
54 | 54 | 'duplicate_event' => array( |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | 'capability' => 'ee_delete_default_ticket', |
67 | 67 | 'obj_id' => $tkt_id, |
68 | 68 | 'noheader' => TRUE, |
69 | - 'args' => array( 'trash' => TRUE ) |
|
69 | + 'args' => array('trash' => TRUE) |
|
70 | 70 | ), |
71 | 71 | 'trash_tickets' => array( |
72 | 72 | 'func' => '_trash_or_restore_ticket', |
73 | 73 | 'capability' => 'ee_delete_default_tickets', |
74 | 74 | 'noheader' => TRUE, |
75 | - 'args' => array( 'trash' => TRUE ) |
|
75 | + 'args' => array('trash' => TRUE) |
|
76 | 76 | ), |
77 | 77 | 'restore_ticket' => array( |
78 | 78 | 'func' => '_trash_or_restore_ticket', |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | ) |
133 | 133 | ); |
134 | 134 | |
135 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
135 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
136 | 136 | |
137 | 137 | |
138 | 138 | //partial route/config override |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | $this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table'; |
145 | 145 | |
146 | 146 | //add tickets tab but only if there are more than one default ticket! |
147 | - $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array( array('TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ); |
|
148 | - if ( $tkt_count > 1 ) { |
|
147 | + $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE); |
|
148 | + if ($tkt_count > 1) { |
|
149 | 149 | $new_page_config = array( |
150 | 150 | 'ticket_list_table' => array( |
151 | 151 | 'nav' => array( |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | 'label' => esc_html__('Templates', 'event_espresso'), |
165 | 165 | 'order' => 30 |
166 | 166 | ), |
167 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
167 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
168 | 168 | 'help_tabs' => array( |
169 | 169 | 'general_settings_templates_help_tab' => array( |
170 | 170 | 'title' => __('Templates', 'event_espresso'), |
171 | 171 | 'filename' => 'general_settings_templates' |
172 | 172 | ) |
173 | 173 | ), |
174 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
174 | + 'help_tour' => array('Templates_Help_Tour'), |
|
175 | 175 | 'require_nonce' => FALSE |
176 | 176 | ); |
177 | 177 | |
@@ -190,26 +190,26 @@ discard block |
||
190 | 190 | // 'metaboxes' => $default_espresso_boxes, |
191 | 191 | // 'require_nonce' => FALSE |
192 | 192 | // ); |
193 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
193 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
194 | 194 | |
195 | 195 | //add filters and actions |
196 | 196 | //modifying _views |
197 | - add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array( $this, 'add_additional_datetime_button' ), 10, 2 ); |
|
198 | - add_filter('FHEE_event_datetime_metabox_clone_button_template', array( $this, 'add_datetime_clone_button' ), 10, 2 ); |
|
199 | - add_filter('FHEE_event_datetime_metabox_timezones_template', array( $this, 'datetime_timezones_template'), 10, 2 ); |
|
197 | + add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array($this, 'add_additional_datetime_button'), 10, 2); |
|
198 | + add_filter('FHEE_event_datetime_metabox_clone_button_template', array($this, 'add_datetime_clone_button'), 10, 2); |
|
199 | + add_filter('FHEE_event_datetime_metabox_timezones_template', array($this, 'datetime_timezones_template'), 10, 2); |
|
200 | 200 | |
201 | 201 | |
202 | 202 | //filters for event list table |
203 | - add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array( $this, 'list_table_filters'), 10, 2); |
|
204 | - add_filter('FHEE__Events_Admin_List_Table__column_actions__action_links', array( $this, 'extra_list_table_actions'), 10, 2 ); |
|
203 | + add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array($this, 'list_table_filters'), 10, 2); |
|
204 | + add_filter('FHEE__Events_Admin_List_Table__column_actions__action_links', array($this, 'extra_list_table_actions'), 10, 2); |
|
205 | 205 | |
206 | 206 | //legend item |
207 | - add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array( $this, 'additional_legend_items') ); |
|
207 | + add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array($this, 'additional_legend_items')); |
|
208 | 208 | |
209 | - add_action('admin_init', array( $this, 'admin_init') ); |
|
209 | + add_action('admin_init', array($this, 'admin_init')); |
|
210 | 210 | |
211 | 211 | //heartbeat stuff |
212 | - add_filter( 'heartbeat_received', array( $this, 'heartbeat_response' ), 10, 2 ); |
|
212 | + add_filter('heartbeat_received', array($this, 'heartbeat_response'), 10, 2); |
|
213 | 213 | |
214 | 214 | } |
215 | 215 | |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | EE_Registry::$i18n_js_strings = array_merge( |
223 | 223 | EE_Registry::$i18n_js_strings, |
224 | 224 | array( |
225 | - 'image_confirm' => __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' ), |
|
226 | - 'event_starts_on' => __( 'Event Starts on', 'event_espresso' ), |
|
227 | - 'event_ends_on' => __( 'Event Ends on', 'event_espresso' ), |
|
228 | - 'event_datetime_actions' => __( 'Actions', 'event_espresso' ), |
|
229 | - 'event_clone_dt_msg' => __( 'Clone this Event Date and Time', 'event_espresso' ), |
|
230 | - 'remove_event_dt_msg' => __( 'Remove this Event Time', 'event_espresso' ) |
|
225 | + 'image_confirm' => __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso'), |
|
226 | + 'event_starts_on' => __('Event Starts on', 'event_espresso'), |
|
227 | + 'event_ends_on' => __('Event Ends on', 'event_espresso'), |
|
228 | + 'event_datetime_actions' => __('Actions', 'event_espresso'), |
|
229 | + 'event_clone_dt_msg' => __('Clone this Event Date and Time', 'event_espresso'), |
|
230 | + 'remove_event_dt_msg' => __('Remove this Event Time', 'event_espresso') |
|
231 | 231 | ) |
232 | 232 | ); |
233 | 233 | } |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @return array possibly appended response. |
244 | 244 | */ |
245 | - public function heartbeat_response( $response, $data ) { |
|
245 | + public function heartbeat_response($response, $data) { |
|
246 | 246 | /** |
247 | 247 | * check whether count of tickets is approaching the potential |
248 | 248 | * limits for the server. |
249 | 249 | */ |
250 | - if ( ! empty( $data['input_count'] ) ) { |
|
250 | + if ( ! empty($data['input_count'])) { |
|
251 | 251 | $response['max_input_vars_check'] = EE_Registry::instance()->CFG->environment->max_input_vars_limit_check($data['input_count']); |
252 | 252 | } |
253 | 253 | |
@@ -262,13 +262,13 @@ discard block |
||
262 | 262 | |
263 | 263 | |
264 | 264 | |
265 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
266 | - $return = parent::extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ); |
|
265 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
266 | + $return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug); |
|
267 | 267 | //make sure this is only when editing |
268 | - if ( !empty( $id ) ) { |
|
269 | - $href = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url ); |
|
268 | + if ( ! empty($id)) { |
|
269 | + $href = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url); |
|
270 | 270 | $title = esc_attr__('Duplicate Event', 'event_espresso'); |
271 | - $return .= '<a href="' . $href . '" title="' . $title . '" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">' . $title . '</button>'; |
|
271 | + $return .= '<a href="'.$href.'" title="'.$title.'" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">'.$title.'</button>'; |
|
272 | 272 | } |
273 | 273 | return $return; |
274 | 274 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | 'label' => __('Trash', 'event_espresso'), |
292 | 292 | 'count' => 0, |
293 | 293 | 'bulk_action' => array( |
294 | - 'restore_tickets' => __('Restore from Trash' , 'event_espresso'), |
|
294 | + 'restore_tickets' => __('Restore from Trash', 'event_espresso'), |
|
295 | 295 | 'delete_tickets' => __('Delete Permanently', 'event_espresso') |
296 | 296 | ) |
297 | 297 | ) |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | |
303 | 303 | public function load_scripts_styles_edit() { |
304 | - wp_register_script( 'ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js', array( 'ee_admin_js', 'heartbeat' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
304 | + wp_register_script('ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL.'event-editor-heartbeat.js', array('ee_admin_js', 'heartbeat'), EVENT_ESPRESSO_VERSION, TRUE); |
|
305 | 305 | |
306 | 306 | /** |
307 | 307 | * load accounting js. |
@@ -320,20 +320,20 @@ discard block |
||
320 | 320 | |
321 | 321 | |
322 | 322 | |
323 | - public function add_additional_datetime_button( $template, $template_args ) { |
|
324 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php', $template_args, TRUE); |
|
323 | + public function add_additional_datetime_button($template, $template_args) { |
|
324 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_add_additional_time.template.php', $template_args, TRUE); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | |
328 | 328 | |
329 | - public function add_datetime_clone_button( $template, $template_args ) { |
|
330 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php', $template_args, TRUE ); |
|
329 | + public function add_datetime_clone_button($template, $template_args) { |
|
330 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_metabox_clone_button.template.php', $template_args, TRUE); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
334 | 334 | |
335 | - public function datetime_timezones_template( $template, $template_args ) { |
|
336 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php', $template_args, TRUE ); |
|
335 | + public function datetime_timezones_template($template, $template_args) { |
|
336 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_timezones.template.php', $template_args, TRUE); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | protected function _set_list_table_views_default() { |
343 | 343 | parent::_set_list_table_views_default(); |
344 | 344 | $export_label = __('Export Events', 'event_espresso'); |
345 | - if ( EE_Registry::instance()->CAP->current_user_can( 'export', 'espresso_events_export' ) ) { |
|
345 | + if (EE_Registry::instance()->CAP->current_user_can('export', 'espresso_events_export')) { |
|
346 | 346 | // $this->_views['all']['bulk_action']['export_events'] = $export_label; |
347 | 347 | // $this->_views['draft']['bulk_action']['export_events'] = $export_label; |
348 | 348 | |
349 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
349 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
350 | 350 | // $this->_views['trash']['bulk_action']['export_events'] = $export_label; |
351 | 351 | } |
352 | 352 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | ) |
373 | 373 | ); |
374 | 374 | |
375 | - $this->_views = array_merge( $this->_views, $new_views); |
|
375 | + $this->_views = array_merge($this->_views, $new_views); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -386,17 +386,17 @@ discard block |
||
386 | 386 | |
387 | 387 | |
388 | 388 | |
389 | - public function extra_list_table_actions( $actionlinks, $event ) { |
|
390 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports', $event->ID() ) ) { |
|
389 | + public function extra_list_table_actions($actionlinks, $event) { |
|
390 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports', $event->ID())) { |
|
391 | 391 | $reports_query_args = array( |
392 | 392 | 'action' => 'reports', |
393 | 393 | 'EVT_ID' => $event->ID() |
394 | 394 | ); |
395 | - $reports_link = EE_Admin_Page::add_query_args_and_nonce( $reports_query_args, REG_ADMIN_URL ); |
|
396 | - $actionlinks[] = '<a href="' . $reports_link . '" title="' . esc_attr__('View Report', 'event_espresso') . '"><div class="dashicons dashicons-chart-bar"></div></a>' . "\n\t"; |
|
395 | + $reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL); |
|
396 | + $actionlinks[] = '<a href="'.$reports_link.'" title="'.esc_attr__('View Report', 'event_espresso').'"><div class="dashicons dashicons-chart-bar"></div></a>'."\n\t"; |
|
397 | 397 | } |
398 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
399 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
398 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
399 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
400 | 400 | $actionlinks[] = EEH_MSG_Template::get_message_action_link( |
401 | 401 | 'see_notifications_for', |
402 | 402 | null, |
@@ -411,15 +411,15 @@ discard block |
||
411 | 411 | |
412 | 412 | |
413 | 413 | public function additional_legend_items($items) { |
414 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports' ) ) { |
|
414 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports')) { |
|
415 | 415 | $items['reports'] = array( |
416 | 416 | 'class' => 'dashicons dashicons-chart-bar', |
417 | 417 | 'desc' => __('Event Reports', 'event_espresso') |
418 | 418 | ); |
419 | 419 | } |
420 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
421 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
422 | - if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) { |
|
420 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
421 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
422 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
423 | 423 | $items['view_related_messages'] = array( |
424 | 424 | 'class' => $related_for_icon['css_class'], |
425 | 425 | 'desc' => $related_for_icon['label'], |
@@ -444,17 +444,17 @@ discard block |
||
444 | 444 | */ |
445 | 445 | protected function _duplicate_event() { |
446 | 446 | //first make sure the ID for the event is in the request. If it isnt' then we need to bail and redirect back to overview list table (cause how did we get here?) |
447 | - if ( !isset( $this->_req_data['EVT_ID'] ) ) { |
|
448 | - EE_Error::add_error( __('In order to duplicate an event an Event ID is required. None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
449 | - $this->_redirect_after_action( FALSE, '', '', array(), TRUE ); |
|
447 | + if ( ! isset($this->_req_data['EVT_ID'])) { |
|
448 | + EE_Error::add_error(__('In order to duplicate an event an Event ID is required. None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
449 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
450 | 450 | return; |
451 | 451 | } |
452 | 452 | |
453 | 453 | //k we've got EVT_ID so let's use that to get the event we'll duplicate |
454 | - $orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] ); |
|
454 | + $orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']); |
|
455 | 455 | |
456 | - if ( ! $orig_event instanceof EE_Event ) |
|
457 | - throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), $this->_req_data['EVT_ID'] ) ); |
|
456 | + if ( ! $orig_event instanceof EE_Event) |
|
457 | + throw new EE_Error(sprintf(__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), $this->_req_data['EVT_ID'])); |
|
458 | 458 | |
459 | 459 | //k now let's clone the $orig_event before getting relations |
460 | 460 | $new_event = clone $orig_event; |
@@ -467,43 +467,43 @@ discard block |
||
467 | 467 | |
468 | 468 | |
469 | 469 | //reset the ID and modify other details to make it clear this is a dupe |
470 | - $new_event->set( 'EVT_ID', 0 ); |
|
471 | - $new_name = $new_event->name() . ' ' . __('**DUPLICATE**', 'event_espresso'); |
|
472 | - $new_event->set( 'EVT_name', $new_name ); |
|
473 | - $new_event->set( 'EVT_slug', wp_unique_post_slug( sanitize_title( $orig_event->name() ), 0, 'publish', 'espresso_events', 0 ) ); |
|
474 | - $new_event->set( 'status', 'draft' ); |
|
470 | + $new_event->set('EVT_ID', 0); |
|
471 | + $new_name = $new_event->name().' '.__('**DUPLICATE**', 'event_espresso'); |
|
472 | + $new_event->set('EVT_name', $new_name); |
|
473 | + $new_event->set('EVT_slug', wp_unique_post_slug(sanitize_title($orig_event->name()), 0, 'publish', 'espresso_events', 0)); |
|
474 | + $new_event->set('status', 'draft'); |
|
475 | 475 | |
476 | 476 | //duplicate discussion settings |
477 | - $new_event->set( 'comment_status', $orig_event->get('comment_status') ); |
|
478 | - $new_event->set( 'ping_status', $orig_event->get( 'ping_status' ) ); |
|
477 | + $new_event->set('comment_status', $orig_event->get('comment_status')); |
|
478 | + $new_event->set('ping_status', $orig_event->get('ping_status')); |
|
479 | 479 | |
480 | 480 | //save the new event |
481 | 481 | $new_event->save(); |
482 | 482 | |
483 | 483 | //venues |
484 | - foreach( $orig_ven as $ven ) { |
|
485 | - $new_event->_add_relation_to( $ven, 'Venue' ); |
|
484 | + foreach ($orig_ven as $ven) { |
|
485 | + $new_event->_add_relation_to($ven, 'Venue'); |
|
486 | 486 | } |
487 | 487 | $new_event->save(); |
488 | 488 | |
489 | 489 | |
490 | 490 | //now we need to get the question group relations and handle that |
491 | 491 | //first primary question groups |
492 | - $orig_primary_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 1 ) ) ); |
|
493 | - if ( !empty( $orig_primary_qgs ) ) { |
|
494 | - foreach ( $orig_primary_qgs as $id => $obj ) { |
|
495 | - if ( $obj instanceof EE_Question_Group ) { |
|
496 | - $new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 1 ) ); |
|
492 | + $orig_primary_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 1))); |
|
493 | + if ( ! empty($orig_primary_qgs)) { |
|
494 | + foreach ($orig_primary_qgs as $id => $obj) { |
|
495 | + if ($obj instanceof EE_Question_Group) { |
|
496 | + $new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 1)); |
|
497 | 497 | } |
498 | 498 | } |
499 | 499 | } |
500 | 500 | |
501 | 501 | //next additional attendee question groups |
502 | - $orig_additional_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 0 ) ) ); |
|
503 | - if ( !empty( $orig_additional_qgs ) ) { |
|
504 | - foreach ( $orig_additional_qgs as $id => $obj ) { |
|
505 | - if ( $obj instanceof EE_Question_Group ) { |
|
506 | - $new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 0 ) ); |
|
502 | + $orig_additional_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0))); |
|
503 | + if ( ! empty($orig_additional_qgs)) { |
|
504 | + foreach ($orig_additional_qgs as $id => $obj) { |
|
505 | + if ($obj instanceof EE_Question_Group) { |
|
506 | + $new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 0)); |
|
507 | 507 | } |
508 | 508 | } |
509 | 509 | } |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | |
515 | 515 | //k now that we have the new event saved we can loop through the datetimes and start adding relations. |
516 | 516 | $cloned_tickets = array(); |
517 | - foreach ( $orig_datetimes as $orig_dtt ) { |
|
517 | + foreach ($orig_datetimes as $orig_dtt) { |
|
518 | 518 | $new_dtt = clone $orig_dtt; |
519 | 519 | $orig_tkts = $orig_dtt->tickets(); |
520 | 520 | |
@@ -522,22 +522,22 @@ discard block |
||
522 | 522 | $new_dtt->set('DTT_ID', 0); |
523 | 523 | $new_dtt->set('DTT_sold', 0); |
524 | 524 | $new_dtt->save(); |
525 | - $new_event->_add_relation_to( $new_dtt, 'Datetime'); |
|
525 | + $new_event->_add_relation_to($new_dtt, 'Datetime'); |
|
526 | 526 | $new_event->save(); |
527 | 527 | |
528 | 528 | //now let's get the ticket relations setup. |
529 | - foreach ( (array) $orig_tkts as $orig_tkt ) { |
|
529 | + foreach ((array) $orig_tkts as $orig_tkt) { |
|
530 | 530 | //it's possible a datetime will have no tickets so let's verify we HAVE a ticket first. |
531 | - if ( ! $orig_tkt instanceof EE_Ticket ) |
|
531 | + if ( ! $orig_tkt instanceof EE_Ticket) |
|
532 | 532 | continue; |
533 | 533 | |
534 | 534 | //is this ticket archived? If it is then let's skip |
535 | - if ( $orig_tkt->get( 'TKT_deleted' ) ) { |
|
535 | + if ($orig_tkt->get('TKT_deleted')) { |
|
536 | 536 | continue; |
537 | 537 | } |
538 | 538 | |
539 | 539 | //does this original ticket already exist in the clone_tickets cache? If so we'll just use the new ticket from it. |
540 | - if ( isset( $cloned_tickets[$orig_tkt->ID()] ) ) { |
|
540 | + if (isset($cloned_tickets[$orig_tkt->ID()])) { |
|
541 | 541 | $new_tkt = $cloned_tickets[$orig_tkt->ID()]; |
542 | 542 | } else { |
543 | 543 | $new_tkt = clone $orig_tkt; |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | $new_tkt->save(); //make sure new ticket has ID. |
550 | 550 | |
551 | 551 | //price relations on new ticket need to be setup. |
552 | - foreach ( $orig_prices as $orig_price ) { |
|
552 | + foreach ($orig_prices as $orig_price) { |
|
553 | 553 | $new_price = clone $orig_price; |
554 | 554 | $new_price->set('PRC_ID', 0); |
555 | 555 | $new_price->save(); |
@@ -566,39 +566,39 @@ discard block |
||
566 | 566 | } |
567 | 567 | |
568 | 568 | //clone taxonomy information |
569 | - $taxonomies_to_clone_with = apply_filters( 'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array( 'espresso_event_categories', 'espresso_event_type', 'post_tag' ) ); |
|
569 | + $taxonomies_to_clone_with = apply_filters('FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array('espresso_event_categories', 'espresso_event_type', 'post_tag')); |
|
570 | 570 | |
571 | 571 | //get terms for original event (notice) |
572 | - $orig_terms = wp_get_object_terms( $orig_event->ID(), $taxonomies_to_clone_with ); |
|
572 | + $orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with); |
|
573 | 573 | |
574 | 574 | //loop through terms and add them to new event. |
575 | - foreach ( $orig_terms as $term ) { |
|
576 | - wp_set_object_terms( $new_event->ID(), $term->term_id, $term->taxonomy, true ); |
|
575 | + foreach ($orig_terms as $term) { |
|
576 | + wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true); |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | |
580 | - do_action( 'AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event ); |
|
580 | + do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event); |
|
581 | 581 | |
582 | 582 | //now let's redirect to the edit page for this duplicated event if we have a new event id. |
583 | - if ( $new_event->ID() ) { |
|
583 | + if ($new_event->ID()) { |
|
584 | 584 | $redirect_args = array( |
585 | 585 | 'post' => $new_event->ID(), |
586 | 586 | 'action' => 'edit' |
587 | 587 | ); |
588 | - EE_Error::add_success( __('Event successfully duplicated. Please review the details below and make any necessary edits', 'event_espresso') ); |
|
588 | + EE_Error::add_success(__('Event successfully duplicated. Please review the details below and make any necessary edits', 'event_espresso')); |
|
589 | 589 | } else { |
590 | 590 | $redirect_args = array( |
591 | 591 | 'action' => 'default' |
592 | 592 | ); |
593 | - EE_Error::add_error( __('Not able to duplicate event. Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
593 | + EE_Error::add_error(__('Not able to duplicate event. Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
594 | 594 | } |
595 | 595 | |
596 | - $this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE ); |
|
596 | + $this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | |
600 | 600 | |
601 | - protected function _import_page(){ |
|
601 | + protected function _import_page() { |
|
602 | 602 | |
603 | 603 | $title = __('Import', 'event_espresso'); |
604 | 604 | $intro = __('If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ', 'event_espresso'); |
@@ -606,8 +606,8 @@ discard block |
||
606 | 606 | $action = 'import_events'; |
607 | 607 | $type = 'csv'; |
608 | 608 | $this->_template_args['form'] = EE_Import::instance()->upload_form($title, $intro, $form_url, $action, $type); |
609 | - $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'),$this->_admin_base_url); |
|
610 | - $content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php',$this->_template_args,true); |
|
609 | + $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'), $this->_admin_base_url); |
|
610 | + $content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'import_page.template.php', $this->_template_args, true); |
|
611 | 611 | |
612 | 612 | |
613 | 613 | $this->_template_args['admin_page_content'] = $content; |
@@ -620,9 +620,9 @@ discard block |
||
620 | 620 | * @return string html |
621 | 621 | */ |
622 | 622 | protected function _import_events() { |
623 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
623 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
624 | 624 | $success = EE_Import::instance()->import(); |
625 | - $this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'),true); |
|
625 | + $this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'), true); |
|
626 | 626 | |
627 | 627 | } |
628 | 628 | |
@@ -636,23 +636,23 @@ discard block |
||
636 | 636 | * @return file |
637 | 637 | */ |
638 | 638 | protected function _events_export() { |
639 | - if(isset($this->_req_data['EVT_ID'])){ |
|
639 | + if (isset($this->_req_data['EVT_ID'])) { |
|
640 | 640 | $event_ids = $this->_req_data['EVT_ID']; |
641 | - }elseif(isset($this->_req_data['EVT_IDs'])){ |
|
641 | + }elseif (isset($this->_req_data['EVT_IDs'])) { |
|
642 | 642 | $event_ids = $this->_req_data['EVT_IDs']; |
643 | - }else{ |
|
643 | + } else { |
|
644 | 644 | $event_ids = NULL; |
645 | 645 | } |
646 | 646 | //todo: I don't like doing this but it'll do until we modify EE_Export Class. |
647 | 647 | $new_request_args = array( |
648 | 648 | 'export' => 'report', |
649 | 649 | 'action' => 'all_event_data', |
650 | - 'EVT_ID' => $event_ids , |
|
650 | + 'EVT_ID' => $event_ids, |
|
651 | 651 | ); |
652 | 652 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
653 | 653 | |
654 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
655 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
654 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
655 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
656 | 656 | $EE_Export = EE_Export::instance($this->_req_data); |
657 | 657 | $EE_Export->export(); |
658 | 658 | } |
@@ -674,11 +674,11 @@ discard block |
||
674 | 674 | 'category_ids' => $this->_req_data['EVT_CAT_ID'] |
675 | 675 | ); |
676 | 676 | |
677 | - $this->_req_data = array_merge( $this->_req_data, $new_request_args ); |
|
677 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
678 | 678 | |
679 | - if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) { |
|
680 | - require_once( EE_CLASSES . 'EE_Export.class.php'); |
|
681 | - $EE_Export = EE_Export::instance( $this->_req_data ); |
|
679 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
680 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
681 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
682 | 682 | $EE_Export->export(); |
683 | 683 | } |
684 | 684 | |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | /** |
690 | 690 | * Creates a sample CSV file for importing |
691 | 691 | */ |
692 | - protected function _sample_export_file(){ |
|
692 | + protected function _sample_export_file() { |
|
693 | 693 | // require_once(EE_CLASSES . 'EE_Export.class.php'); |
694 | 694 | EE_Export::instance()->export_sample(); |
695 | 695 | } |
@@ -706,10 +706,10 @@ discard block |
||
706 | 706 | * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
707 | 707 | * from General_Settings_Admin_Page to here. |
708 | 708 | */ |
709 | - $this->_template_args = apply_filters( 'FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args ); |
|
710 | - $this->_set_add_edit_form_tags( 'update_template_settings' ); |
|
711 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
712 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php', $this->_template_args, TRUE ); |
|
709 | + $this->_template_args = apply_filters('FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args); |
|
710 | + $this->_set_add_edit_form_tags('update_template_settings'); |
|
711 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
712 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'template_settings.template.php', $this->_template_args, TRUE); |
|
713 | 713 | $this->display_admin_page_with_sidebar(); |
714 | 714 | } |
715 | 715 | |
@@ -721,24 +721,24 @@ discard block |
||
721 | 721 | * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
722 | 722 | * from General_Settings_Admin_Page to here. |
723 | 723 | */ |
724 | - EE_Registry::instance()->CFG->template_settings = apply_filters( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data ); |
|
724 | + EE_Registry::instance()->CFG->template_settings = apply_filters('FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data); |
|
725 | 725 | |
726 | 726 | |
727 | 727 | //update custom post type slugs and detect if we need to flush rewrite rules |
728 | 728 | $old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug; |
729 | - EE_Registry::instance()->CFG->core->event_cpt_slug = empty( $this->_req_data['event_cpt_slug'] ) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes( $this->_req_data['event_cpt_slug'] ); |
|
729 | + EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug']) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes($this->_req_data['event_cpt_slug']); |
|
730 | 730 | |
731 | 731 | |
732 | 732 | $what = 'Template Settings'; |
733 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__ ); |
|
733 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__); |
|
734 | 734 | |
735 | 735 | |
736 | - if ( EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug ) { |
|
737 | - update_option( 'ee_flush_rewrite_rules', true ); |
|
736 | + if (EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug) { |
|
737 | + update_option('ee_flush_rewrite_rules', true); |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | |
741 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'template_settings' ) ); |
|
741 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'template_settings')); |
|
742 | 742 | |
743 | 743 | } |
744 | 744 | |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | |
757 | 757 | $this->verify_cpt_object(); |
758 | 758 | |
759 | - add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array( $this, 'registration_options_meta_box' ), $this->page_slug, 'side', 'core'); |
|
759 | + add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array($this, 'registration_options_meta_box'), $this->page_slug, 'side', 'core'); |
|
760 | 760 | //add_meta_box('espresso_event_types', __('Event Type', 'event_espresso'), array( $this, 'event_type_meta_box' ), $this->page_slug, 'side', 'default' ); //add this back in when the feature is ready. |
761 | 761 | |
762 | 762 | //todo feature in progress |
@@ -780,16 +780,16 @@ discard block |
||
780 | 780 | array('id' => true, 'text' => __('Yes', 'event_espresso')), |
781 | 781 | array('id' => false, 'text' => __('No', 'event_espresso')) |
782 | 782 | ); |
783 | - $default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete ), TRUE); |
|
783 | + $default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete), TRUE); |
|
784 | 784 | $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(FALSE); |
785 | 785 | $template_args['_event'] = $this->_cpt_model_obj; |
786 | 786 | $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit(); |
787 | 787 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
788 | 788 | $template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description()); |
789 | 789 | $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false); |
790 | - $template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status() ); |
|
791 | - $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 ); |
|
792 | - $templatepath = EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php'; |
|
790 | + $template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
|
791 | + $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); |
|
792 | + $templatepath = EVENTS_CAF_TEMPLATE_PATH.'event_registration_options.template.php'; |
|
793 | 793 | EEH_Template::display_template($templatepath, $template_args); |
794 | 794 | } |
795 | 795 | |
@@ -802,9 +802,9 @@ discard block |
||
802 | 802 | * @param array $box metabox args |
803 | 803 | * @return string metabox contents |
804 | 804 | */ |
805 | - public function event_type_meta_box( $post, $box ) { |
|
806 | - $template_args['radio_list'] = $this->wp_terms_radio($post->ID, array( 'taxonomy' => 'espresso_event_type' ) ); |
|
807 | - $template = EVENTS_CAF_TEMPLATE_PATH . 'event_type_metabox_contents.template.php'; |
|
805 | + public function event_type_meta_box($post, $box) { |
|
806 | + $template_args['radio_list'] = $this->wp_terms_radio($post->ID, array('taxonomy' => 'espresso_event_type')); |
|
807 | + $template = EVENTS_CAF_TEMPLATE_PATH.'event_type_metabox_contents.template.php'; |
|
808 | 808 | EEH_Template::display_template($template, $template_args); |
809 | 809 | } |
810 | 810 | |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | |
815 | 815 | |
816 | 816 | |
817 | - public function wp_terms_radio( $post_id = 0, $args = array() ) { |
|
817 | + public function wp_terms_radio($post_id = 0, $args = array()) { |
|
818 | 818 | $defaults = array( |
819 | 819 | 'descendants_and_self' => 0, |
820 | 820 | 'selected_cats' => false, |
@@ -823,11 +823,11 @@ discard block |
||
823 | 823 | 'taxonomy' => 'category', |
824 | 824 | 'checked_ontop' => true |
825 | 825 | ); |
826 | - $args = apply_filters( 'wp_terms_checklist_args', $args, $post_id ); |
|
826 | + $args = apply_filters('wp_terms_checklist_args', $args, $post_id); |
|
827 | 827 | |
828 | - extract( wp_parse_args($args, $defaults), EXTR_SKIP ); |
|
828 | + extract(wp_parse_args($args, $defaults), EXTR_SKIP); |
|
829 | 829 | |
830 | - if ( empty($walker) || !is_a($walker, 'Walker') ) |
|
830 | + if (empty($walker) || ! is_a($walker, 'Walker')) |
|
831 | 831 | $walker = new Walker_Radio_Checklist; |
832 | 832 | |
833 | 833 | $descendants_and_self = (int) $descendants_and_self; |
@@ -835,37 +835,37 @@ discard block |
||
835 | 835 | $args = array('taxonomy' => $taxonomy); |
836 | 836 | |
837 | 837 | $tax = get_taxonomy($taxonomy); |
838 | - $args['disabled'] = !current_user_can($tax->cap->assign_terms); |
|
838 | + $args['disabled'] = ! current_user_can($tax->cap->assign_terms); |
|
839 | 839 | |
840 | - if ( is_array( $selected_cats ) ) |
|
840 | + if (is_array($selected_cats)) |
|
841 | 841 | $args['selected_cats'] = $selected_cats; |
842 | - elseif ( $post_id ) |
|
842 | + elseif ($post_id) |
|
843 | 843 | $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); |
844 | 844 | else |
845 | 845 | $args['selected_cats'] = array(); |
846 | 846 | |
847 | - if ( is_array( $popular_cats ) ) |
|
847 | + if (is_array($popular_cats)) |
|
848 | 848 | $args['popular_cats'] = $popular_cats; |
849 | 849 | else |
850 | - $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); |
|
850 | + $args['popular_cats'] = get_terms($taxonomy, array('fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false)); |
|
851 | 851 | |
852 | - if ( $descendants_and_self ) { |
|
853 | - $categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) ); |
|
854 | - $self = get_term( $descendants_and_self, $taxonomy ); |
|
855 | - array_unshift( $categories, $self ); |
|
852 | + if ($descendants_and_self) { |
|
853 | + $categories = (array) get_terms($taxonomy, array('child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0)); |
|
854 | + $self = get_term($descendants_and_self, $taxonomy); |
|
855 | + array_unshift($categories, $self); |
|
856 | 856 | } else { |
857 | 857 | $categories = (array) get_terms($taxonomy, array('get' => 'all')); |
858 | 858 | } |
859 | 859 | |
860 | - if ( $checked_ontop ) { |
|
860 | + if ($checked_ontop) { |
|
861 | 861 | // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache) |
862 | 862 | $checked_categories = array(); |
863 | - $keys = array_keys( $categories ); |
|
863 | + $keys = array_keys($categories); |
|
864 | 864 | |
865 | - foreach( $keys as $k ) { |
|
866 | - if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) { |
|
865 | + foreach ($keys as $k) { |
|
866 | + if (in_array($categories[$k]->term_id, $args['selected_cats'])) { |
|
867 | 867 | $checked_categories[] = $categories[$k]; |
868 | - unset( $categories[$k] ); |
|
868 | + unset($categories[$k]); |
|
869 | 869 | } |
870 | 870 | } |
871 | 871 | |
@@ -890,18 +890,18 @@ discard block |
||
890 | 890 | * @param array $list_table_obj the list table object |
891 | 891 | * @return array new filters |
892 | 892 | */ |
893 | - public function list_table_filters( $oldfilters, $list_table_obj ) { |
|
893 | + public function list_table_filters($oldfilters, $list_table_obj) { |
|
894 | 894 | $filters = array(); |
895 | 895 | |
896 | 896 | //first month/year filters |
897 | 897 | $filters[] = $this->espresso_event_months_dropdown(); |
898 | 898 | |
899 | 899 | |
900 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
900 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
901 | 901 | |
902 | 902 | //active status dropdown |
903 | - if ( $status !== 'draft' ) |
|
904 | - $filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' ); |
|
903 | + if ($status !== 'draft') |
|
904 | + $filter[] = $this->active_status_dropdown(isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : ''); |
|
905 | 905 | |
906 | 906 | //category filter |
907 | 907 | $filters[] = $this->category_dropdown(); |
@@ -923,17 +923,17 @@ discard block |
||
923 | 923 | */ |
924 | 924 | public function espresso_event_months_dropdown() { |
925 | 925 | //what we need to do is get all PRIMARY datetimes for all events to filter on. Note we need to include any other filters that are set! |
926 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
926 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
927 | 927 | |
928 | 928 | //categories? |
929 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
929 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
930 | 930 | |
931 | 931 | //active status? |
932 | - $active_status = isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : NULL; |
|
932 | + $active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : NULL; |
|
933 | 933 | |
934 | 934 | $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
935 | 935 | |
936 | - return EEH_Form_Fields::generate_event_months_dropdown( $cur_date, $status, $category, $active_status ); |
|
936 | + return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status); |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | |
@@ -944,12 +944,12 @@ discard block |
||
944 | 944 | * @param string $current_value whatever the ucrrent active status is |
945 | 945 | * @return string html dropdown. |
946 | 946 | */ |
947 | - public function active_status_dropdown( $current_value = '' ) { |
|
947 | + public function active_status_dropdown($current_value = '') { |
|
948 | 948 | $select_name = 'active_status'; |
949 | - $values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso') ); |
|
949 | + $values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso')); |
|
950 | 950 | $id = 'id="espresso-active-status-dropdown-filter"'; |
951 | 951 | $class = 'wide'; |
952 | - echo EEH_Form_Fields::select_input( $select_name, $values, $current_value, $id, $class ); |
|
952 | + echo EEH_Form_Fields::select_input($select_name, $values, $current_value, $id, $class); |
|
953 | 953 | } |
954 | 954 | |
955 | 955 | |
@@ -961,9 +961,9 @@ discard block |
||
961 | 961 | * @return string html |
962 | 962 | */ |
963 | 963 | public function category_dropdown() { |
964 | - $cur_cat = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1; |
|
964 | + $cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
965 | 965 | |
966 | - return EEH_Form_Fields::generate_event_category_dropdown( $cur_cat ); |
|
966 | + return EEH_Form_Fields::generate_event_category_dropdown($cur_cat); |
|
967 | 967 | } |
968 | 968 | |
969 | 969 | |
@@ -975,14 +975,14 @@ discard block |
||
975 | 975 | * @return int |
976 | 976 | */ |
977 | 977 | public function total_events_today() { |
978 | - $start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 00:00:00', 'Y-m-d H:i:s', 'UTC' ); |
|
979 | - $end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' ); |
|
978 | + $start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 00:00:00', 'Y-m-d H:i:s', 'UTC'); |
|
979 | + $end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 23:59:59', 'Y-m-d H:i:s', 'UTC'); |
|
980 | 980 | |
981 | 981 | $where = array( |
982 | - 'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) ) |
|
982 | + 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)) |
|
983 | 983 | ); |
984 | 984 | |
985 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
985 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
986 | 986 | return $count; |
987 | 987 | } |
988 | 988 | |
@@ -997,14 +997,14 @@ discard block |
||
997 | 997 | $this_year_r = date('Y'); |
998 | 998 | $this_month_r = date('m'); |
999 | 999 | $days_this_month = date('t'); |
1000 | - $start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-01 00:00:00', 'Y-m-d H:i:s', 'UTC' ); |
|
1001 | - $end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' ); |
|
1000 | + $start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-01 00:00:00', 'Y-m-d H:i:s', 'UTC'); |
|
1001 | + $end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' 23:59:59', 'Y-m-d H:i:s', 'UTC'); |
|
1002 | 1002 | |
1003 | 1003 | $where = array( |
1004 | - 'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) ) |
|
1004 | + 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)) |
|
1005 | 1005 | ); |
1006 | 1006 | |
1007 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
1007 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
1008 | 1008 | return $count; |
1009 | 1009 | } |
1010 | 1010 | |
@@ -1021,53 +1021,53 @@ discard block |
||
1021 | 1021 | |
1022 | 1022 | |
1023 | 1023 | |
1024 | - public function get_default_tickets( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
1024 | + public function get_default_tickets($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
1025 | 1025 | |
1026 | - $orderby= empty( $this->_req_data['orderby'] ) ? 'TKT_name' : $this->_req_data['orderby']; |
|
1027 | - $order = empty( $this->_req_data['order'] ) ? 'ASC' : $this->_req_data['order']; |
|
1026 | + $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby']; |
|
1027 | + $order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order']; |
|
1028 | 1028 | |
1029 | - switch ( $orderby ) { |
|
1029 | + switch ($orderby) { |
|
1030 | 1030 | case 'TKT_name' : |
1031 | - $orderby = array( 'TKT_name' => $order ); |
|
1031 | + $orderby = array('TKT_name' => $order); |
|
1032 | 1032 | break; |
1033 | 1033 | |
1034 | 1034 | case 'TKT_price' : |
1035 | - $orderby = array( 'TKT_price' => $order ); |
|
1035 | + $orderby = array('TKT_price' => $order); |
|
1036 | 1036 | break; |
1037 | 1037 | |
1038 | 1038 | case 'TKT_uses' : |
1039 | - $orderby = array( 'TKT_uses' => $order ); |
|
1039 | + $orderby = array('TKT_uses' => $order); |
|
1040 | 1040 | break; |
1041 | 1041 | |
1042 | 1042 | case 'TKT_min' : |
1043 | - $orderby = array( 'TKT_min' => $order ); |
|
1043 | + $orderby = array('TKT_min' => $order); |
|
1044 | 1044 | break; |
1045 | 1045 | |
1046 | 1046 | case 'TKT_max' : |
1047 | - $orderby = array( 'TKT_max' => $order ); |
|
1047 | + $orderby = array('TKT_max' => $order); |
|
1048 | 1048 | break; |
1049 | 1049 | |
1050 | 1050 | case 'TKT_qty' : |
1051 | - $orderby = array( 'TKT_qty' => $order ); |
|
1051 | + $orderby = array('TKT_qty' => $order); |
|
1052 | 1052 | break; |
1053 | 1053 | } |
1054 | 1054 | |
1055 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1056 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1055 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1056 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1057 | 1057 | |
1058 | 1058 | $_where = array( |
1059 | 1059 | 'TKT_is_default' => 1, |
1060 | 1060 | 'TKT_deleted' => $trashed |
1061 | 1061 | ); |
1062 | 1062 | |
1063 | - $offset = ($current_page-1)*$per_page; |
|
1064 | - $limit = array( $offset, $per_page ); |
|
1063 | + $offset = ($current_page - 1) * $per_page; |
|
1064 | + $limit = array($offset, $per_page); |
|
1065 | 1065 | |
1066 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1067 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1066 | + if (isset($this->_req_data['s'])) { |
|
1067 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1068 | 1068 | $_where['OR'] = array( |
1069 | - 'TKT_name' => array('LIKE',$sstr ), |
|
1070 | - 'TKT_description' => array('LIKE',$sstr ) |
|
1069 | + 'TKT_name' => array('LIKE', $sstr), |
|
1070 | + 'TKT_description' => array('LIKE', $sstr) |
|
1071 | 1071 | ); |
1072 | 1072 | } |
1073 | 1073 | |
@@ -1078,9 +1078,9 @@ discard block |
||
1078 | 1078 | 'group_by'=>'TKT_ID' |
1079 | 1079 | ); |
1080 | 1080 | |
1081 | - if($count){ |
|
1081 | + if ($count) { |
|
1082 | 1082 | return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
1083 | - }else{ |
|
1083 | + } else { |
|
1084 | 1084 | return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
1085 | 1085 | } |
1086 | 1086 | |
@@ -1090,35 +1090,35 @@ discard block |
||
1090 | 1090 | |
1091 | 1091 | |
1092 | 1092 | |
1093 | - protected function _trash_or_restore_ticket( $trash = FALSE ) { |
|
1093 | + protected function _trash_or_restore_ticket($trash = FALSE) { |
|
1094 | 1094 | $success = 1; |
1095 | 1095 | |
1096 | 1096 | $TKT = EEM_Ticket::instance(); |
1097 | 1097 | |
1098 | 1098 | //checkboxes? |
1099 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
1099 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1100 | 1100 | //if array has more than one element then success message should be plural |
1101 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1101 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1102 | 1102 | |
1103 | 1103 | //cycle thru the boxes |
1104 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
1105 | - if ( $trash ) { |
|
1106 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1104 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1105 | + if ($trash) { |
|
1106 | + if ( ! $TKT->delete_by_ID($TKT_ID)) |
|
1107 | 1107 | $success = 0; |
1108 | 1108 | } else { |
1109 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1109 | + if ( ! $TKT->restore_by_ID($TKT_ID)) |
|
1110 | 1110 | $success = 0; |
1111 | 1111 | } |
1112 | 1112 | } |
1113 | 1113 | } else { |
1114 | 1114 | //grab single id and trash |
1115 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
1115 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1116 | 1116 | |
1117 | - if ( $trash ) { |
|
1118 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1117 | + if ($trash) { |
|
1118 | + if ( ! $TKT->delete_by_ID($TKT_ID)) |
|
1119 | 1119 | $success = 0; |
1120 | 1120 | } else { |
1121 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1121 | + if ( ! $TKT->restore_by_ID($TKT_ID)) |
|
1122 | 1122 | $success = 0; |
1123 | 1123 | } |
1124 | 1124 | } |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | 'action' => 'ticket_list_table', |
1129 | 1129 | 'status' => $trash ? '' : 'trashed' |
1130 | 1130 | ); |
1131 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
|
1131 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | |
@@ -1141,21 +1141,21 @@ discard block |
||
1141 | 1141 | $TKT = EEM_Ticket::instance(); |
1142 | 1142 | |
1143 | 1143 | //checkboxes? |
1144 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
1144 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1145 | 1145 | //if array has more than one element then success message should be plural |
1146 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1146 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1147 | 1147 | |
1148 | 1148 | //cycle thru the boxes |
1149 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
1149 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1150 | 1150 | //delete |
1151 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
1151 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
1152 | 1152 | $success = 0; |
1153 | 1153 | } |
1154 | 1154 | } |
1155 | 1155 | } else { |
1156 | 1156 | //grab single id and trash |
1157 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
1158 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
1157 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1158 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
1159 | 1159 | $success = 0; |
1160 | 1160 | } |
1161 | 1161 | } |
@@ -1167,16 +1167,16 @@ discard block |
||
1167 | 1167 | ); |
1168 | 1168 | |
1169 | 1169 | //failsafe. If the default ticket count === 1 then we need to redirect to event overview. |
1170 | - if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) ) |
|
1170 | + if (EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE)) |
|
1171 | 1171 | $query_args = array(); |
1172 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
|
1172 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1173 | 1173 | } |
1174 | 1174 | |
1175 | 1175 | |
1176 | 1176 | |
1177 | 1177 | |
1178 | - protected function _delete_the_ticket( $TKT_ID ) { |
|
1179 | - $tkt = EEM_Ticket::instance()->get_one_by_ID( $TKT_ID ); |
|
1178 | + protected function _delete_the_ticket($TKT_ID) { |
|
1179 | + $tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
|
1180 | 1180 | $tkt->_remove_relations('Datetime'); |
1181 | 1181 | //delete all related prices first |
1182 | 1182 | $tkt->delete_related_permanently('Price'); |
@@ -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 |
@@ -453,8 +454,9 @@ discard block |
||
453 | 454 | //k we've got EVT_ID so let's use that to get the event we'll duplicate |
454 | 455 | $orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] ); |
455 | 456 | |
456 | - if ( ! $orig_event instanceof EE_Event ) |
|
457 | - throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), $this->_req_data['EVT_ID'] ) ); |
|
457 | + if ( ! $orig_event instanceof EE_Event ) { |
|
458 | + throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), $this->_req_data['EVT_ID'] ) ); |
|
459 | + } |
|
458 | 460 | |
459 | 461 | //k now let's clone the $orig_event before getting relations |
460 | 462 | $new_event = clone $orig_event; |
@@ -528,8 +530,9 @@ discard block |
||
528 | 530 | //now let's get the ticket relations setup. |
529 | 531 | foreach ( (array) $orig_tkts as $orig_tkt ) { |
530 | 532 | //it's possible a datetime will have no tickets so let's verify we HAVE a ticket first. |
531 | - if ( ! $orig_tkt instanceof EE_Ticket ) |
|
532 | - continue; |
|
533 | + if ( ! $orig_tkt instanceof EE_Ticket ) { |
|
534 | + continue; |
|
535 | + } |
|
533 | 536 | |
534 | 537 | //is this ticket archived? If it is then let's skip |
535 | 538 | if ( $orig_tkt->get( 'TKT_deleted' ) ) { |
@@ -638,9 +641,9 @@ discard block |
||
638 | 641 | protected function _events_export() { |
639 | 642 | if(isset($this->_req_data['EVT_ID'])){ |
640 | 643 | $event_ids = $this->_req_data['EVT_ID']; |
641 | - }elseif(isset($this->_req_data['EVT_IDs'])){ |
|
644 | + } elseif(isset($this->_req_data['EVT_IDs'])){ |
|
642 | 645 | $event_ids = $this->_req_data['EVT_IDs']; |
643 | - }else{ |
|
646 | + } else{ |
|
644 | 647 | $event_ids = NULL; |
645 | 648 | } |
646 | 649 | //todo: I don't like doing this but it'll do until we modify EE_Export Class. |
@@ -827,8 +830,9 @@ discard block |
||
827 | 830 | |
828 | 831 | extract( wp_parse_args($args, $defaults), EXTR_SKIP ); |
829 | 832 | |
830 | - if ( empty($walker) || !is_a($walker, 'Walker') ) |
|
831 | - $walker = new Walker_Radio_Checklist; |
|
833 | + if ( empty($walker) || !is_a($walker, 'Walker') ) { |
|
834 | + $walker = new Walker_Radio_Checklist; |
|
835 | + } |
|
832 | 836 | |
833 | 837 | $descendants_and_self = (int) $descendants_and_self; |
834 | 838 | |
@@ -837,17 +841,19 @@ discard block |
||
837 | 841 | $tax = get_taxonomy($taxonomy); |
838 | 842 | $args['disabled'] = !current_user_can($tax->cap->assign_terms); |
839 | 843 | |
840 | - if ( is_array( $selected_cats ) ) |
|
841 | - $args['selected_cats'] = $selected_cats; |
|
842 | - elseif ( $post_id ) |
|
843 | - $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); |
|
844 | - else |
|
845 | - $args['selected_cats'] = array(); |
|
844 | + if ( is_array( $selected_cats ) ) { |
|
845 | + $args['selected_cats'] = $selected_cats; |
|
846 | + } elseif ( $post_id ) { |
|
847 | + $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); |
|
848 | + } else { |
|
849 | + $args['selected_cats'] = array(); |
|
850 | + } |
|
846 | 851 | |
847 | - if ( is_array( $popular_cats ) ) |
|
848 | - $args['popular_cats'] = $popular_cats; |
|
849 | - else |
|
850 | - $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); |
|
852 | + if ( is_array( $popular_cats ) ) { |
|
853 | + $args['popular_cats'] = $popular_cats; |
|
854 | + } else { |
|
855 | + $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); |
|
856 | + } |
|
851 | 857 | |
852 | 858 | if ( $descendants_and_self ) { |
853 | 859 | $categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) ); |
@@ -900,8 +906,9 @@ discard block |
||
900 | 906 | $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
901 | 907 | |
902 | 908 | //active status dropdown |
903 | - if ( $status !== 'draft' ) |
|
904 | - $filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' ); |
|
909 | + if ( $status !== 'draft' ) { |
|
910 | + $filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' ); |
|
911 | + } |
|
905 | 912 | |
906 | 913 | //category filter |
907 | 914 | $filters[] = $this->category_dropdown(); |
@@ -1080,7 +1087,7 @@ discard block |
||
1080 | 1087 | |
1081 | 1088 | if($count){ |
1082 | 1089 | return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
1083 | - }else{ |
|
1090 | + } else{ |
|
1084 | 1091 | return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
1085 | 1092 | } |
1086 | 1093 | |
@@ -1103,11 +1110,13 @@ discard block |
||
1103 | 1110 | //cycle thru the boxes |
1104 | 1111 | while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
1105 | 1112 | if ( $trash ) { |
1106 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1107 | - $success = 0; |
|
1113 | + if ( ! $TKT->delete_by_ID( $TKT_ID ) ) { |
|
1114 | + $success = 0; |
|
1115 | + } |
|
1108 | 1116 | } else { |
1109 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1110 | - $success = 0; |
|
1117 | + if ( ! $TKT->restore_by_ID( $TKT_ID ) ) { |
|
1118 | + $success = 0; |
|
1119 | + } |
|
1111 | 1120 | } |
1112 | 1121 | } |
1113 | 1122 | } else { |
@@ -1115,11 +1124,13 @@ discard block |
||
1115 | 1124 | $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
1116 | 1125 | |
1117 | 1126 | if ( $trash ) { |
1118 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1119 | - $success = 0; |
|
1127 | + if ( ! $TKT->delete_by_ID( $TKT_ID ) ) { |
|
1128 | + $success = 0; |
|
1129 | + } |
|
1120 | 1130 | } else { |
1121 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1122 | - $success = 0; |
|
1131 | + if ( ! $TKT->restore_by_ID( $TKT_ID ) ) { |
|
1132 | + $success = 0; |
|
1133 | + } |
|
1123 | 1134 | } |
1124 | 1135 | } |
1125 | 1136 | |
@@ -1167,8 +1178,9 @@ discard block |
||
1167 | 1178 | ); |
1168 | 1179 | |
1169 | 1180 | //failsafe. If the default ticket count === 1 then we need to redirect to event overview. |
1170 | - if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) ) |
|
1171 | - $query_args = array(); |
|
1181 | + if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) ) { |
|
1182 | + $query_args = array(); |
|
1183 | + } |
|
1172 | 1184 | $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
1173 | 1185 | } |
1174 | 1186 |
@@ -1,69 +1,69 @@ |
||
1 | 1 | <?php |
2 | 2 | //echo '<br/><h6 style="color:#2EA2CC;">'. __FILE__ . ' <span style="font-weight:normal;color:#E76700"> Line #: ' . __LINE__ . '</span></h6>'; |
3 | 3 | if ( |
4 | - ( is_single() && espresso_display_venue_in_event_details() ) |
|
5 | - || ( is_archive() && espresso_display_venue_in_event_list() ) |
|
4 | + (is_single() && espresso_display_venue_in_event_details()) |
|
5 | + || (is_archive() && espresso_display_venue_in_event_list()) |
|
6 | 6 | ) : |
7 | 7 | global $post; |
8 | - do_action( 'AHEE_event_details_before_venue_details', $post ); |
|
9 | - $venue_name = espresso_venue_name( 0, 'details', FALSE ); |
|
10 | - if ( empty( $venue_name ) && espresso_is_venue_private() ) { |
|
11 | - do_action( 'AHEE_event_details_after_venue_details', $post ); |
|
8 | + do_action('AHEE_event_details_before_venue_details', $post); |
|
9 | + $venue_name = espresso_venue_name(0, 'details', FALSE); |
|
10 | + if (empty($venue_name) && espresso_is_venue_private()) { |
|
11 | + do_action('AHEE_event_details_after_venue_details', $post); |
|
12 | 12 | return ''; |
13 | 13 | } |
14 | 14 | ?> |
15 | 15 | |
16 | 16 | <div class="espresso-venue-dv<?php echo espresso_is_venue_private() ? ' espresso-private-venue-dv' : ''; ?>"> |
17 | 17 | <h3 class="event-venues-h3 ee-event-h3"> |
18 | - <?php _e( 'Location', 'event_espresso' ); ?> |
|
18 | + <?php _e('Location', 'event_espresso'); ?> |
|
19 | 19 | </h3> |
20 | - <h4><strong><?php _e( 'Venue:', 'event_espresso' ); ?></strong> <strong> <?php echo $venue_name; ?></strong></h4> |
|
20 | + <h4><strong><?php _e('Venue:', 'event_espresso'); ?></strong> <strong> <?php echo $venue_name; ?></strong></h4> |
|
21 | 21 | <p><span class="smaller-text tags-links"><?php echo espresso_venue_categories(); ?></span></p> |
22 | -<?php if ( $venue_phone = espresso_venue_phone( $post->ID, FALSE )) : ?> |
|
22 | +<?php if ($venue_phone = espresso_venue_phone($post->ID, FALSE)) : ?> |
|
23 | 23 | <p> |
24 | - <span class="small-text"><strong><?php _e( 'Venue Phone:', 'event_espresso' ); ?></strong></span> <?php echo $venue_phone; ?> |
|
24 | + <span class="small-text"><strong><?php _e('Venue Phone:', 'event_espresso'); ?></strong></span> <?php echo $venue_phone; ?> |
|
25 | 25 | </p> |
26 | -<?php endif; ?> |
|
27 | -<?php if ( $venue_website = espresso_venue_website( $post->ID, FALSE )) : ?> |
|
26 | +<?php endif; ?> |
|
27 | +<?php if ($venue_website = espresso_venue_website($post->ID, FALSE)) : ?> |
|
28 | 28 | <p> |
29 | - <span class="small-text"><strong><?php _e( 'Venue Website:', 'event_espresso' ); ?></strong></span> <?php echo $venue_website; ?> |
|
29 | + <span class="small-text"><strong><?php _e('Venue Website:', 'event_espresso'); ?></strong></span> <?php echo $venue_website; ?> |
|
30 | 30 | </p> |
31 | 31 | <?php endif; ?> |
32 | -<?php if ( espresso_venue_has_address( $post->ID )) : ?> |
|
33 | - <strong><span class="dashicons dashicons-location-alt"></span><?php _e( 'Address:', 'event_espresso' ); ?></strong> |
|
34 | - <?php espresso_venue_address( 'inline' ); ?> |
|
35 | - <?php espresso_venue_gmap( $post->ID ); ?> |
|
32 | +<?php if (espresso_venue_has_address($post->ID)) : ?> |
|
33 | + <strong><span class="dashicons dashicons-location-alt"></span><?php _e('Address:', 'event_espresso'); ?></strong> |
|
34 | + <?php espresso_venue_address('inline'); ?> |
|
35 | + <?php espresso_venue_gmap($post->ID); ?> |
|
36 | 36 | <div class="clear"><br/></div> |
37 | -<?php endif; ?> |
|
37 | +<?php endif; ?> |
|
38 | 38 | |
39 | - <?php $VNU_ID = espresso_venue_id( $post->ID ); ?> |
|
40 | - <?php if ( is_single() ) : ?> |
|
41 | - <?php $venue_description = espresso_venue_description( $VNU_ID, FALSE ); ?> |
|
42 | - <?php if ( $venue_description ) : ?> |
|
39 | + <?php $VNU_ID = espresso_venue_id($post->ID); ?> |
|
40 | + <?php if (is_single()) : ?> |
|
41 | + <?php $venue_description = espresso_venue_description($VNU_ID, FALSE); ?> |
|
42 | + <?php if ($venue_description) : ?> |
|
43 | 43 | <p> |
44 | - <strong><?php _e( 'Description:', 'event_espresso' ); ?></strong><br/> |
|
45 | - <?php echo do_shortcode( $venue_description ); ?> |
|
44 | + <strong><?php _e('Description:', 'event_espresso'); ?></strong><br/> |
|
45 | + <?php echo do_shortcode($venue_description); ?> |
|
46 | 46 | </p> |
47 | - <?php endif; ?> |
|
47 | + <?php endif; ?> |
|
48 | 48 | <?php else : ?> |
49 | - <?php $venue_excerpt = espresso_venue_excerpt( $VNU_ID, FALSE ); ?> |
|
50 | - <?php if ( $venue_excerpt ) : ?> |
|
49 | + <?php $venue_excerpt = espresso_venue_excerpt($VNU_ID, FALSE); ?> |
|
50 | + <?php if ($venue_excerpt) : ?> |
|
51 | 51 | <p> |
52 | - <strong><?php _e( 'Description:', 'event_espresso' ); ?></strong><br/> |
|
52 | + <strong><?php _e('Description:', 'event_espresso'); ?></strong><br/> |
|
53 | 53 | <?php echo $venue_excerpt; ?> |
54 | 54 | </p> |
55 | - <?php endif; ?> |
|
56 | - <?php endif; ?> |
|
55 | + <?php endif; ?> |
|
56 | + <?php endif; ?> |
|
57 | 57 | </div> |
58 | 58 | <!-- .espresso-venue-dv --> |
59 | 59 | <?php |
60 | -do_action( 'AHEE_event_details_after_venue_details', $post ); |
|
60 | +do_action('AHEE_event_details_after_venue_details', $post); |
|
61 | 61 | else : |
62 | - if ( espresso_venue_is_password_protected() ) : |
|
62 | + if (espresso_venue_is_password_protected()) : |
|
63 | 63 | ?> |
64 | 64 | <div class="espresso-venue-dv espresso-password-protected-venue-dv" > |
65 | 65 | <h3 class="event-venues-h3 ee-event-h3"> |
66 | - <?php _e( 'Location', 'event_espresso' );?> |
|
66 | + <?php _e('Location', 'event_espresso'); ?> |
|
67 | 67 | </h3> |
68 | 68 | <?php echo espresso_password_protected_venue_form(); ?> |
69 | 69 | </div> |
@@ -2,7 +2,7 @@ |
||
2 | 2 | $closing_tag = '</a>'; |
3 | 3 | //if this is decaf, which is put on WordPress.org, we need to inform users that |
4 | 4 | //we just put an affiliate link there. See https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/ section 12 |
5 | -if( apply_filters( 'FHEE__ee_show_affiliate_links', true ) ) { |
|
6 | - $closing_tag .= esc_html__( ' (affiliate link)', 'event_espresso' ); |
|
5 | +if (apply_filters('FHEE__ee_show_affiliate_links', true)) { |
|
6 | + $closing_tag .= esc_html__(' (affiliate link)', 'event_espresso'); |
|
7 | 7 | } |
8 | -printf( esc_html__('PayPal Standard (PayPal Payments Standard) is an off-site payment method and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/paypalstandard/" target="_blank">', $closing_tag ); |
|
9 | 8 | \ No newline at end of file |
9 | +printf(esc_html__('PayPal Standard (PayPal Payments Standard) is an off-site payment method and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/paypalstandard/" target="_blank">', $closing_tag); |
|
10 | 10 | \ 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 | |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * ------------------------------------------------------------------------ |
32 | 32 | */ |
33 | 33 | |
34 | -if ( ! class_exists( 'WP_List_Table' )) { |
|
35 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
34 | +if ( ! class_exists('WP_List_Table')) { |
|
35 | + require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | abstract class EE_Admin_List_Table extends WP_List_Table { |
@@ -244,16 +244,16 @@ discard block |
||
244 | 244 | * constructor |
245 | 245 | * @param EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table. |
246 | 246 | */ |
247 | - public function __construct( EE_Admin_Page $admin_page ) { |
|
247 | + public function __construct(EE_Admin_Page $admin_page) { |
|
248 | 248 | $this->_admin_page = $admin_page; |
249 | 249 | $this->_req_data = $this->_admin_page->get_request_data(); |
250 | 250 | $this->_view = $this->_admin_page->get_view(); |
251 | - $this->_views = empty( $this->_views ) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
251 | + $this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
252 | 252 | $this->_current_page = $this->get_pagenum(); |
253 | - $this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view(); |
|
254 | - $this->_yes_no = array( __('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
253 | + $this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view(); |
|
254 | + $this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
255 | 255 | |
256 | - $this->_per_page = $this->get_items_per_page( $this->_screen . '_per_page', 10 ); |
|
256 | + $this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 10); |
|
257 | 257 | |
258 | 258 | $this->_setup_data(); |
259 | 259 | $this->_add_view_counts(); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $this->_set_properties(); |
264 | 264 | |
265 | 265 | //set primary column |
266 | - add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ) ); |
|
266 | + add_filter('list_table_primary_column', array($this, 'set_primary_column')); |
|
267 | 267 | |
268 | 268 | //set parent defaults |
269 | 269 | parent::__construct($this->_wp_list_args); |
@@ -339,17 +339,17 @@ discard block |
||
339 | 339 | * @return string |
340 | 340 | */ |
341 | 341 | protected function _get_hidden_fields() { |
342 | - $action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : ''; |
|
343 | - $action = empty( $action ) && isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : $action; |
|
342 | + $action = isset($this->_req_data['route']) ? $this->_req_data['route'] : ''; |
|
343 | + $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action; |
|
344 | 344 | //if action is STILL empty, then we set it to default |
345 | - $action = empty( $action ) ? 'default' : $action; |
|
346 | - $field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n"; |
|
347 | - $field .= '<input type="hidden" name="route" value="'. $action .'" />' . "\n";/**/ |
|
348 | - $field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n"; |
|
345 | + $action = empty($action) ? 'default' : $action; |
|
346 | + $field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n"; |
|
347 | + $field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/ |
|
348 | + $field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n"; |
|
349 | 349 | |
350 | 350 | $bulk_actions = $this->_get_bulk_actions(); |
351 | - foreach ( $bulk_actions as $bulk_action => $label ) { |
|
352 | - $field .= '<input type="hidden" name="' . $bulk_action . '_nonce" value="' . wp_create_nonce ( $bulk_action . '_nonce' ) . '" />' . "\n"; |
|
351 | + foreach ($bulk_actions as $bulk_action => $label) { |
|
352 | + $field .= '<input type="hidden" name="'.$bulk_action.'_nonce" value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n"; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | return $field; |
@@ -379,15 +379,15 @@ discard block |
||
379 | 379 | * |
380 | 380 | * @var array |
381 | 381 | */ |
382 | - $_sortable = apply_filters( "FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen ); |
|
382 | + $_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen); |
|
383 | 383 | |
384 | 384 | $sortable = array(); |
385 | - foreach ( $_sortable as $id => $data ) { |
|
386 | - if ( empty( $data ) ) |
|
385 | + foreach ($_sortable as $id => $data) { |
|
386 | + if (empty($data)) |
|
387 | 387 | continue; |
388 | 388 | |
389 | 389 | //fix for offset errors with WP_List_Table default get_columninfo() |
390 | - if ( is_array($data) ) { |
|
390 | + if (is_array($data)) { |
|
391 | 391 | $_data[0] = key($data); |
392 | 392 | $_data[1] = isset($data[1]) ? $data[1] : false; |
393 | 393 | } else { |
@@ -396,14 +396,14 @@ discard block |
||
396 | 396 | |
397 | 397 | $data = (array) $data; |
398 | 398 | |
399 | - if ( !isset( $data[1] ) ) |
|
399 | + if ( ! isset($data[1])) |
|
400 | 400 | $_data[1] = false; |
401 | 401 | |
402 | 402 | |
403 | 403 | $sortable[$id] = $_data; |
404 | 404 | } |
405 | 405 | $primary = $this->get_primary_column_name(); |
406 | - $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); |
|
406 | + $this->_column_headers = array($columns, $hidden, $sortable, $primary); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | |
@@ -412,8 +412,8 @@ discard block |
||
412 | 412 | * @return string |
413 | 413 | */ |
414 | 414 | protected function get_primary_column_name() { |
415 | - foreach( class_parents( $this ) as $parent ) { |
|
416 | - if ( method_exists( $parent, 'get_primary_column_name' ) && $parent == 'WP_List_Table' ) { |
|
415 | + foreach (class_parents($this) as $parent) { |
|
416 | + if (method_exists($parent, 'get_primary_column_name') && $parent == 'WP_List_Table') { |
|
417 | 417 | return parent::get_primary_column_name(); |
418 | 418 | } |
419 | 419 | } |
@@ -430,10 +430,10 @@ discard block |
||
430 | 430 | * @param string $primary |
431 | 431 | * @return string |
432 | 432 | */ |
433 | - protected function handle_row_actions( $item, $column_name, $primary ) { |
|
434 | - foreach( class_parents( $this ) as $parent ) { |
|
435 | - if ( method_exists( $parent, 'handle_row_actions' ) && $parent == 'WP_List_Table' ) { |
|
436 | - return parent::handle_row_actions( $item, $column_name, $primary ); |
|
433 | + protected function handle_row_actions($item, $column_name, $primary) { |
|
434 | + foreach (class_parents($this) as $parent) { |
|
435 | + if (method_exists($parent, 'handle_row_actions') && $parent == 'WP_List_Table') { |
|
436 | + return parent::handle_row_actions($item, $column_name, $primary); |
|
437 | 437 | } |
438 | 438 | } |
439 | 439 | return ''; |
@@ -451,11 +451,11 @@ discard block |
||
451 | 451 | protected function _get_bulk_actions() { |
452 | 452 | $actions = array(); |
453 | 453 | //the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table(); |
454 | - foreach ( $this->_views as $view => $args) { |
|
455 | - if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view ) |
|
454 | + foreach ($this->_views as $view => $args) { |
|
455 | + if (isset($args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view) |
|
456 | 456 | //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
457 | - foreach ( $args['bulk_action'] as $route =>$label ) { |
|
458 | - if ( $this->_admin_page->check_user_access( $route, true ) ) { |
|
457 | + foreach ($args['bulk_action'] as $route =>$label) { |
|
458 | + if ($this->_admin_page->check_user_access($route, true)) { |
|
459 | 459 | $actions[$route] = $label; |
460 | 460 | } |
461 | 461 | } |
@@ -473,18 +473,18 @@ discard block |
||
473 | 473 | */ |
474 | 474 | private function _filters() { |
475 | 475 | $classname = get_class($this); |
476 | - $filters = apply_filters( "FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen ); |
|
476 | + $filters = apply_filters("FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen); |
|
477 | 477 | |
478 | - if ( empty( $filters )) { |
|
478 | + if (empty($filters)) { |
|
479 | 479 | return; |
480 | 480 | } |
481 | - foreach ( $filters as $filter ) { |
|
481 | + foreach ($filters as $filter) { |
|
482 | 482 | echo $filter; |
483 | 483 | } |
484 | 484 | //add filter button at end |
485 | - echo '<input type="submit" class="button-secondary" value="' . __('Filter', 'event_espresso') . '" id="post-query-submit" />'; |
|
485 | + echo '<input type="submit" class="button-secondary" value="'.__('Filter', 'event_espresso').'" id="post-query-submit" />'; |
|
486 | 486 | //add reset filters button at end |
487 | - echo '<a class="button button-secondary" href="' . $this->_admin_page->get_current_page_view_url() . '" style="display:inline-block">' . __('Reset Filters', 'event_espresso') . '</a>'; |
|
487 | + echo '<a class="button button-secondary" href="'.$this->_admin_page->get_current_page_view_url().'" style="display:inline-block">'.__('Reset Filters', 'event_espresso').'</a>'; |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | |
@@ -498,8 +498,8 @@ discard block |
||
498 | 498 | * @param string $column_name |
499 | 499 | * @return string |
500 | 500 | */ |
501 | - public function set_primary_column( $column_name ) { |
|
502 | - return ! empty( $this->_primary_column ) ? $this->_primary_column : $column_name; |
|
501 | + public function set_primary_column($column_name) { |
|
502 | + return ! empty($this->_primary_column) ? $this->_primary_column : $column_name; |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | array( |
519 | 519 | 'total_items' => $total_items, |
520 | 520 | 'per_page' => $this->_per_page, |
521 | - 'total_pages' => ceil($total_items / $this->_per_page ) |
|
521 | + 'total_pages' => ceil($total_items / $this->_per_page) |
|
522 | 522 | ) |
523 | 523 | ); |
524 | 524 | } |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * |
535 | 535 | * @return string html content for the column |
536 | 536 | */ |
537 | - public function column_default( $item, $column_name ) { |
|
537 | + public function column_default($item, $column_name) { |
|
538 | 538 | /** |
539 | 539 | * Dynamic hook allowing for adding additional column content in this list table. |
540 | 540 | * Note that $this->screen->id is in the format |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | * hook prefix ("event-espresso") will be different. |
545 | 545 | * |
546 | 546 | */ |
547 | - do_action( 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, $item, $this->_screen ); |
|
547 | + do_action('AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, $item, $this->_screen); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | * |
561 | 561 | * @var array |
562 | 562 | */ |
563 | - $columns = apply_filters( 'FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen ); |
|
563 | + $columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen); |
|
564 | 564 | return $columns; |
565 | 565 | } |
566 | 566 | |
@@ -572,18 +572,18 @@ discard block |
||
572 | 572 | $views = $this->get_views(); |
573 | 573 | $assembled_views = ''; |
574 | 574 | |
575 | - if ( empty( $views )) { |
|
575 | + if (empty($views)) { |
|
576 | 576 | return; |
577 | 577 | } |
578 | 578 | echo "<ul class='subsubsub'>\n"; |
579 | - foreach ( $views as $view ) { |
|
580 | - $count = isset($view['count'] ) && !empty($view['count']) ? absint( $view['count'] ) : 0; |
|
581 | - if ( isset( $view['slug'] ) && isset( $view['class'] ) && isset( $view['url'] ) && isset( $view['label']) ) { |
|
582 | - $assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" . '<a href="' . $view['url'] . '">' . $view['label'] . '</a> <span class="count">(' . $count . ')</span>'; |
|
579 | + foreach ($views as $view) { |
|
580 | + $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0; |
|
581 | + if (isset($view['slug']) && isset($view['class']) && isset($view['url']) && isset($view['label'])) { |
|
582 | + $assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>".'<a href="'.$view['url'].'">'.$view['label'].'</a> <span class="count">('.$count.')</span>'; |
|
583 | 583 | } |
584 | 584 | } |
585 | 585 | |
586 | - echo is_array( $assembled_views) && ! empty( $assembled_views ) ? implode( " |</li>\n", $assembled_views ) . "</li>\n" : ''; |
|
586 | + echo is_array($assembled_views) && ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : ''; |
|
587 | 587 | echo "</ul>"; |
588 | 588 | } |
589 | 589 | |
@@ -596,10 +596,10 @@ discard block |
||
596 | 596 | * |
597 | 597 | * @param object $item The current item |
598 | 598 | */ |
599 | - public function single_row( $item ) { |
|
600 | - $row_class = $this->_get_row_class( $item ); |
|
601 | - echo '<tr class="' . esc_attr( $row_class ) . '">'; |
|
602 | - $this->single_row_columns( $item ); |
|
599 | + public function single_row($item) { |
|
600 | + $row_class = $this->_get_row_class($item); |
|
601 | + echo '<tr class="'.esc_attr($row_class).'">'; |
|
602 | + $this->single_row_columns($item); |
|
603 | 603 | echo '</tr>'; |
604 | 604 | } |
605 | 605 | |
@@ -610,13 +610,13 @@ discard block |
||
610 | 610 | * @param object $item the current item |
611 | 611 | * @return string |
612 | 612 | */ |
613 | - protected function _get_row_class( $item ) { |
|
613 | + protected function _get_row_class($item) { |
|
614 | 614 | static $row_class = ''; |
615 | - $row_class = ( $row_class == '' ? 'alternate' : '' ); |
|
615 | + $row_class = ($row_class == '' ? 'alternate' : ''); |
|
616 | 616 | |
617 | 617 | $new_row_class = $row_class; |
618 | 618 | |
619 | - if ( !empty($this->_ajax_sorting_callback) ) { |
|
619 | + if ( ! empty($this->_ajax_sorting_callback)) { |
|
620 | 620 | $new_row_class .= ' rowsortable'; |
621 | 621 | } |
622 | 622 | |
@@ -635,13 +635,13 @@ discard block |
||
635 | 635 | |
636 | 636 | public function get_hidden_columns() { |
637 | 637 | $user_id = get_current_user_id(); |
638 | - $has_default = get_user_option('default'. $this->screen->id . 'columnshidden', $user_id); |
|
639 | - if ( empty( $has_default ) && !empty($this->_hidden_columns ) ) { |
|
640 | - update_user_option($user_id, 'default'.$this->screen->id . 'columnshidden', TRUE); |
|
641 | - update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, TRUE ); |
|
638 | + $has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id); |
|
639 | + if (empty($has_default) && ! empty($this->_hidden_columns)) { |
|
640 | + update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', TRUE); |
|
641 | + update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, TRUE); |
|
642 | 642 | } |
643 | - $ref = 'manage' . $this->screen->id . 'columnshidden'; |
|
644 | - $saved_columns = (array) get_user_option( $ref, $user_id ); |
|
643 | + $ref = 'manage'.$this->screen->id.'columnshidden'; |
|
644 | + $saved_columns = (array) get_user_option($ref, $user_id); |
|
645 | 645 | return $saved_columns; |
646 | 646 | } |
647 | 647 | |
@@ -656,47 +656,47 @@ discard block |
||
656 | 656 | * |
657 | 657 | * @param object $item The current item |
658 | 658 | */ |
659 | - public function single_row_columns( $item ) { |
|
660 | - list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); |
|
659 | + public function single_row_columns($item) { |
|
660 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
661 | 661 | |
662 | 662 | global $wp_version; |
663 | - $use_hidden_class = version_compare( $wp_version, '4.3-RC', '>=' ); |
|
663 | + $use_hidden_class = version_compare($wp_version, '4.3-RC', '>='); |
|
664 | 664 | |
665 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
665 | + foreach ($columns as $column_name => $column_display_name) { |
|
666 | 666 | |
667 | 667 | /** |
668 | 668 | * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns are |
669 | 669 | * hidden or not instead of using "display:none;". This bit of code provides backward compat. |
670 | 670 | */ |
671 | - $hidden_class = $use_hidden_class && in_array( $column_name, $hidden ) ? ' hidden' : ''; |
|
672 | - $style = ! $use_hidden_class && in_array( $column_name, $hidden ) ? ' style="display:none;"' : ''; |
|
671 | + $hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : ''; |
|
672 | + $style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : ''; |
|
673 | 673 | |
674 | - $classes = $column_name . ' column-' . $column_name.$hidden_class; |
|
675 | - if ( $primary == $column_name ) { |
|
674 | + $classes = $column_name.' column-'.$column_name.$hidden_class; |
|
675 | + if ($primary == $column_name) { |
|
676 | 676 | $classes .= ' has-row-actions column-primary'; |
677 | 677 | } |
678 | 678 | |
679 | - $data = ' data-colname="' . wp_strip_all_tags( $column_display_name ) . '"'; |
|
679 | + $data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"'; |
|
680 | 680 | |
681 | 681 | $class = "class='$classes'"; |
682 | 682 | |
683 | 683 | $attributes = "$class$style$data"; |
684 | 684 | |
685 | - if ( 'cb' === $column_name ) { |
|
685 | + if ('cb' === $column_name) { |
|
686 | 686 | echo '<th scope="row" class="check-column">'; |
687 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
|
687 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb($item), $item, $this); |
|
688 | 688 | echo '</th>'; |
689 | 689 | } |
690 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
690 | + elseif (method_exists($this, 'column_'.$column_name)) { |
|
691 | 691 | echo "<td $attributes>"; |
692 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
|
693 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
692 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content', call_user_func(array($this, 'column_'.$column_name), $item), $item, $this); |
|
693 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
694 | 694 | echo "</td>"; |
695 | 695 | } |
696 | 696 | else { |
697 | 697 | echo "<td $attributes>"; |
698 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
|
699 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
698 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default($item, $column_name), $item, $column_name, $this); |
|
699 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
700 | 700 | echo "</td>"; |
701 | 701 | } |
702 | 702 | } |
@@ -704,19 +704,19 @@ discard block |
||
704 | 704 | |
705 | 705 | |
706 | 706 | |
707 | - public function extra_tablenav( $which ) { |
|
708 | - if ( $which == 'top' ) { |
|
707 | + public function extra_tablenav($which) { |
|
708 | + if ($which == 'top') { |
|
709 | 709 | $this->_filters(); |
710 | 710 | echo $this->_get_hidden_fields(); |
711 | 711 | echo '<br class="clear">'; |
712 | - }else{ |
|
712 | + } else { |
|
713 | 713 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
714 | - foreach($this->_bottom_buttons as $type => $action){ |
|
715 | - $route = isset( $action['route'] ) ? $action['route'] : ''; |
|
716 | - $extra_request = isset( $action['extra_request'] ) ? $action['extra_request'] : ''; |
|
714 | + foreach ($this->_bottom_buttons as $type => $action) { |
|
715 | + $route = isset($action['route']) ? $action['route'] : ''; |
|
716 | + $extra_request = isset($action['extra_request']) ? $action['extra_request'] : ''; |
|
717 | 717 | echo $this->_admin_page->get_action_link_or_button($route, $type, $extra_request); |
718 | 718 | } |
719 | - do_action( 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen ); |
|
719 | + do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen); |
|
720 | 720 | echo '</div>'; |
721 | 721 | } |
722 | 722 | //echo $this->_entries_per_page_dropdown; |
@@ -766,13 +766,13 @@ discard block |
||
766 | 766 | * |
767 | 767 | * @return string The assembled action elements container. |
768 | 768 | */ |
769 | - protected function _action_string( $action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '' ) { |
|
769 | + protected function _action_string($action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '') { |
|
770 | 770 | $content = ''; |
771 | - $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : ''; |
|
772 | - $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : ''; |
|
773 | - $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
|
774 | - $content .= apply_filters( 'FHEE__EE_Admin_List_Table___action_string__action_items', $action_items, $item, $this ); |
|
775 | - $content .= ! empty( $action_container ) ? '</' . $action_container . '>' : ''; |
|
771 | + $action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : ''; |
|
772 | + $action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : ''; |
|
773 | + $content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : ''; |
|
774 | + $content .= apply_filters('FHEE__EE_Admin_List_Table___action_string__action_items', $action_items, $item, $this); |
|
775 | + $content .= ! empty($action_container) ? '</'.$action_container.'>' : ''; |
|
776 | 776 | return $content; |
777 | 777 | } |
778 | 778 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | */ |
59 | 59 | public function processCapCheck($cap_check) |
60 | 60 | { |
61 | - if (is_array($cap_check)){ |
|
61 | + if (is_array($cap_check)) { |
|
62 | 62 | foreach ($cap_check as $check) { |
63 | 63 | $this->processCapCheck($check); |
64 | 64 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | use EventEspresso\core\exceptions\InvalidClassException; |
6 | 6 | |
7 | 7 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
8 | - exit('No direct script access allowed'); |
|
8 | + exit('No direct script access allowed'); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | |
@@ -21,89 +21,89 @@ discard block |
||
21 | 21 | class CapabilitiesChecker |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * @type \EE_Capabilities $capabilities |
|
26 | - */ |
|
27 | - private $capabilities; |
|
28 | - |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * CapabilitiesChecker constructor |
|
33 | - * |
|
34 | - * @param \EE_Capabilities $capabilities |
|
35 | - */ |
|
36 | - public function __construct(\EE_Capabilities $capabilities) |
|
37 | - { |
|
38 | - $this->capabilities = $capabilities; |
|
39 | - } |
|
40 | - |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @return \EE_Capabilities |
|
45 | - */ |
|
46 | - protected function capabilities() |
|
47 | - { |
|
48 | - return $this->capabilities; |
|
49 | - } |
|
50 | - |
|
51 | - |
|
52 | - |
|
53 | - /** |
|
54 | - * Verifies that the current user has ALL of the capabilities listed in the CapCheck DTO. |
|
55 | - * If any of the individual capability checks fails, then the command will NOT be executed. |
|
56 | - * |
|
57 | - * @param CapCheckInterface|CapCheckInterface[] $cap_check |
|
58 | - * @return bool |
|
59 | - * @throws InvalidClassException |
|
60 | - * @throws InsufficientPermissionsException |
|
61 | - */ |
|
62 | - public function processCapCheck($cap_check) |
|
63 | - { |
|
64 | - if (is_array($cap_check)){ |
|
65 | - foreach ($cap_check as $check) { |
|
66 | - $this->processCapCheck($check); |
|
67 | - } |
|
68 | - return true; |
|
69 | - } |
|
70 | - // at this point, $cap_check should be an individual instance of CapCheck |
|
71 | - if ( ! $cap_check instanceof CapCheckInterface) { |
|
72 | - throw new InvalidClassException( |
|
73 | - '\EventEspresso\core\domain\services\capabilities\CapCheckInterface' |
|
74 | - ); |
|
75 | - } |
|
76 | - // sometimes cap checks are conditional, and no capabilities are required |
|
77 | - if ($cap_check instanceof PublicCapabilities) { |
|
78 | - return true; |
|
79 | - } |
|
80 | - $capabilities = (array) $cap_check->capability(); |
|
81 | - foreach ($capabilities as $capability) { |
|
82 | - if ( |
|
83 | - ! $this->capabilities()->current_user_can( |
|
84 | - $capability, |
|
85 | - $cap_check->context(), |
|
86 | - $cap_check->ID() |
|
87 | - ) |
|
88 | - ) { |
|
89 | - throw new InsufficientPermissionsException($cap_check->context()); |
|
90 | - } |
|
91 | - } |
|
92 | - return true; |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * @param string $capability - the capability to be checked, like: 'ee_edit_registrations' |
|
99 | - * @param string $context - what the user is attempting to do, like: 'Edit Registration' |
|
100 | - * @param int $ID - (optional) ID for item where current_user_can is being called from |
|
101 | - * @return bool |
|
102 | - */ |
|
103 | - public function process($capability, $context, $ID = 0) |
|
104 | - { |
|
105 | - return $this->processCapCheck(new CapCheck($capability, $context, $ID)); |
|
106 | - } |
|
24 | + /** |
|
25 | + * @type \EE_Capabilities $capabilities |
|
26 | + */ |
|
27 | + private $capabilities; |
|
28 | + |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * CapabilitiesChecker constructor |
|
33 | + * |
|
34 | + * @param \EE_Capabilities $capabilities |
|
35 | + */ |
|
36 | + public function __construct(\EE_Capabilities $capabilities) |
|
37 | + { |
|
38 | + $this->capabilities = $capabilities; |
|
39 | + } |
|
40 | + |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @return \EE_Capabilities |
|
45 | + */ |
|
46 | + protected function capabilities() |
|
47 | + { |
|
48 | + return $this->capabilities; |
|
49 | + } |
|
50 | + |
|
51 | + |
|
52 | + |
|
53 | + /** |
|
54 | + * Verifies that the current user has ALL of the capabilities listed in the CapCheck DTO. |
|
55 | + * If any of the individual capability checks fails, then the command will NOT be executed. |
|
56 | + * |
|
57 | + * @param CapCheckInterface|CapCheckInterface[] $cap_check |
|
58 | + * @return bool |
|
59 | + * @throws InvalidClassException |
|
60 | + * @throws InsufficientPermissionsException |
|
61 | + */ |
|
62 | + public function processCapCheck($cap_check) |
|
63 | + { |
|
64 | + if (is_array($cap_check)){ |
|
65 | + foreach ($cap_check as $check) { |
|
66 | + $this->processCapCheck($check); |
|
67 | + } |
|
68 | + return true; |
|
69 | + } |
|
70 | + // at this point, $cap_check should be an individual instance of CapCheck |
|
71 | + if ( ! $cap_check instanceof CapCheckInterface) { |
|
72 | + throw new InvalidClassException( |
|
73 | + '\EventEspresso\core\domain\services\capabilities\CapCheckInterface' |
|
74 | + ); |
|
75 | + } |
|
76 | + // sometimes cap checks are conditional, and no capabilities are required |
|
77 | + if ($cap_check instanceof PublicCapabilities) { |
|
78 | + return true; |
|
79 | + } |
|
80 | + $capabilities = (array) $cap_check->capability(); |
|
81 | + foreach ($capabilities as $capability) { |
|
82 | + if ( |
|
83 | + ! $this->capabilities()->current_user_can( |
|
84 | + $capability, |
|
85 | + $cap_check->context(), |
|
86 | + $cap_check->ID() |
|
87 | + ) |
|
88 | + ) { |
|
89 | + throw new InsufficientPermissionsException($cap_check->context()); |
|
90 | + } |
|
91 | + } |
|
92 | + return true; |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * @param string $capability - the capability to be checked, like: 'ee_edit_registrations' |
|
99 | + * @param string $context - what the user is attempting to do, like: 'Edit Registration' |
|
100 | + * @param int $ID - (optional) ID for item where current_user_can is being called from |
|
101 | + * @return bool |
|
102 | + */ |
|
103 | + public function process($capability, $context, $ID = 0) |
|
104 | + { |
|
105 | + return $this->processCapCheck(new CapCheck($capability, $context, $ID)); |
|
106 | + } |
|
107 | 107 | |
108 | 108 | |
109 | 109 |