@@ -96,7 +96,7 @@ |
||
96 | 96 | $gateway = $payment_method->type_obj()->get_gateway(); |
97 | 97 | if ( |
98 | 98 | $gateway instanceof EE_Offsite_Gateway |
99 | - && $gateway->handle_IPN_in_this_request( |
|
99 | + && $gateway->handle_IPN_in_this_request( |
|
100 | 100 | \EE_Registry::instance()->REQ->params(), |
101 | 101 | true |
102 | 102 | ) |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * EES_Espresso_Txn_Page |
4 | 4 | * |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return void |
28 | 28 | */ |
29 | 29 | public static function set_hooks() { |
30 | - add_action( 'wp_loaded', array( 'EES_Espresso_Txn_Page', 'set_definitions' ), 2 ); |
|
30 | + add_action('wp_loaded', array('EES_Espresso_Txn_Page', 'set_definitions'), 2); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * @return void |
49 | 49 | */ |
50 | 50 | public static function set_definitions() { |
51 | - define( 'TXN_PAGE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
52 | - define( 'TXN_PAGE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
51 | + define('TXN_PAGE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
52 | + define('TXN_PAGE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -66,21 +66,21 @@ discard block |
||
66 | 66 | * @throws \Exception |
67 | 67 | * @throws \EE_Error |
68 | 68 | */ |
69 | - public function run( WP $WP ) { |
|
69 | + public function run(WP $WP) { |
|
70 | 70 | $this->_current_txn = null; |
71 | - if ( EE_Registry::instance()->REQ->is_set('e_reg_url_link' )){ |
|
71 | + if (EE_Registry::instance()->REQ->is_set('e_reg_url_link')) { |
|
72 | 72 | /** @var EEM_Transaction $EEM_Transaction */ |
73 | - $EEM_Transaction = EE_Registry::instance()->load_model( 'Transaction' ); |
|
73 | + $EEM_Transaction = EE_Registry::instance()->load_model('Transaction'); |
|
74 | 74 | $this->_current_txn = $EEM_Transaction->get_transaction_from_reg_url_link(); |
75 | 75 | } |
76 | - if ( $this->_current_txn instanceof EE_Transaction ) { |
|
76 | + if ($this->_current_txn instanceof EE_Transaction) { |
|
77 | 77 | $payment_method = null; |
78 | - $payment_method_slug = EE_Registry::instance()->REQ->get( 'ee_payment_method', null ); |
|
79 | - if( $payment_method_slug ) { |
|
80 | - $payment_method = EEM_Payment_Method::instance()->get_one_by_slug( $payment_method_slug ); |
|
78 | + $payment_method_slug = EE_Registry::instance()->REQ->get('ee_payment_method', null); |
|
79 | + if ($payment_method_slug) { |
|
80 | + $payment_method = EEM_Payment_Method::instance()->get_one_by_slug($payment_method_slug); |
|
81 | 81 | } |
82 | 82 | |
83 | - if ( $payment_method instanceof EE_Payment_Method && $payment_method->is_off_site() ) { |
|
83 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->is_off_site()) { |
|
84 | 84 | $gateway = $payment_method->type_obj()->get_gateway(); |
85 | 85 | if ( |
86 | 86 | $gateway instanceof EE_Offsite_Gateway |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | ) |
91 | 91 | ) { |
92 | 92 | /** @type EE_Payment_Processor $payment_processor */ |
93 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
94 | - $payment_processor->process_ipn( $_REQUEST, $this->_current_txn, $payment_method ); |
|
93 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
94 | + $payment_processor->process_ipn($_REQUEST, $this->_current_txn, $payment_method); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | //allow gateways to add a filter to stop rendering the page |
98 | - if( apply_filters( 'FHEE__EES_Espresso_Txn_Page__run__exit', FALSE ) ){ |
|
98 | + if (apply_filters('FHEE__EES_Espresso_Txn_Page__run__exit', FALSE)) { |
|
99 | 99 | exit; |
100 | 100 | } |
101 | 101 | } |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | * @param array $attributes |
113 | 113 | * @return string |
114 | 114 | */ |
115 | - public function process_shortcode( $attributes = array() ) { |
|
116 | - return __( 'This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso' ); |
|
115 | + public function process_shortcode($attributes = array()) { |
|
116 | + return __('This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso'); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | |
184 | 184 | |
185 | 185 | /** |
186 | - * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
187 | - * |
|
188 | - * @access public |
|
189 | - * @return void |
|
190 | - */ |
|
186 | + * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
187 | + * |
|
188 | + * @access public |
|
189 | + * @return void |
|
190 | + */ |
|
191 | 191 | public function init() { |
192 | 192 | EE_Admin::debug_log( __METHOD__ ); |
193 | 193 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
@@ -474,11 +474,11 @@ discard block |
||
474 | 474 | |
475 | 475 | |
476 | 476 | /** |
477 | - * admin_init |
|
478 | - * |
|
479 | - * @access public |
|
480 | - * @return void |
|
481 | - */ |
|
477 | + * admin_init |
|
478 | + * |
|
479 | + * @access public |
|
480 | + * @return void |
|
481 | + */ |
|
482 | 482 | public function admin_init() { |
483 | 483 | |
484 | 484 | /** |
@@ -631,11 +631,11 @@ discard block |
||
631 | 631 | |
632 | 632 | |
633 | 633 | /** |
634 | - * dismiss_persistent_admin_notice |
|
635 | - * |
|
636 | - * @access public |
|
637 | - * @return void |
|
638 | - */ |
|
634 | + * dismiss_persistent_admin_notice |
|
635 | + * |
|
636 | + * @access public |
|
637 | + * @return void |
|
638 | + */ |
|
639 | 639 | public function dismiss_ee_nag_notice_callback() { |
640 | 640 | EE_Error::dismiss_persistent_admin_notice(); |
641 | 641 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public static function instance() { |
42 | 42 | // check if class object is instantiated |
43 | - if ( ! self::$_instance instanceof EE_Admin ) { |
|
43 | + if ( ! self::$_instance instanceof EE_Admin) { |
|
44 | 44 | self::$_instance = new self(); |
45 | 45 | } |
46 | 46 | return self::$_instance; |
@@ -57,30 +57,30 @@ discard block |
||
57 | 57 | // define global EE_Admin constants |
58 | 58 | $this->_define_all_constants(); |
59 | 59 | // set autoloaders for our admin page classes based on included path information |
60 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN ); |
|
60 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN); |
|
61 | 61 | // admin hooks |
62 | - add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 ); |
|
62 | + add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); |
|
63 | 63 | // load EE_Request_Handler early |
64 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' )); |
|
65 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' )); |
|
64 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request')); |
|
65 | + add_action('AHEE__EE_System__initialize_last', array($this, 'init')); |
|
66 | 66 | // post shortcode tracking |
67 | 67 | add_action( |
68 | 68 | 'AHEE__EE_System__initialize_last', |
69 | - array( 'EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin' ) |
|
69 | + array('EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin') |
|
70 | 70 | ); |
71 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 ); |
|
72 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 ); |
|
73 | - add_action( 'admin_init', array( $this, 'admin_init' ), 100 ); |
|
74 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 ); |
|
75 | - add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
76 | - add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
77 | - add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 ); |
|
78 | - add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' )); |
|
71 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2); |
|
72 | + add_action('wp_loaded', array($this, 'wp_loaded'), 100); |
|
73 | + add_action('admin_init', array($this, 'admin_init'), 100); |
|
74 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20); |
|
75 | + add_action('admin_notices', array($this, 'display_admin_notices'), 10); |
|
76 | + add_action('network_admin_notices', array($this, 'display_admin_notices'), 10); |
|
77 | + add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2); |
|
78 | + add_filter('admin_footer_text', array($this, 'espresso_admin_footer')); |
|
79 | 79 | |
80 | 80 | //reset Environment config (we only do this on admin page loads); |
81 | 81 | EE_Registry::instance()->CFG->environment->recheck_values(); |
82 | 82 | |
83 | - do_action( 'AHEE__EE_Admin__loaded' ); |
|
83 | + do_action('AHEE__EE_Admin__loaded'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | private function _define_all_constants() { |
98 | - define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' ); |
|
99 | - define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' ); |
|
100 | - define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS ); |
|
101 | - define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' ); |
|
102 | - define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' )); |
|
98 | + define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/'); |
|
99 | + define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/'); |
|
100 | + define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS); |
|
101 | + define('WP_ADMIN_PATH', ABSPATH.'wp-admin/'); |
|
102 | + define('WP_AJAX_URL', admin_url('admin-ajax.php')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -112,23 +112,23 @@ discard block |
||
112 | 112 | * @param string $plugin |
113 | 113 | * @return array |
114 | 114 | */ |
115 | - public function filter_plugin_actions( $links, $plugin ) { |
|
115 | + public function filter_plugin_actions($links, $plugin) { |
|
116 | 116 | // set $main_file in stone |
117 | 117 | static $main_file; |
118 | 118 | // if $main_file is not set yet |
119 | - if ( ! $main_file ) { |
|
120 | - $main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE ); |
|
119 | + if ( ! $main_file) { |
|
120 | + $main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE); |
|
121 | 121 | } |
122 | - if ( $plugin === $main_file ) { |
|
122 | + if ($plugin === $main_file) { |
|
123 | 123 | // compare current plugin to this one |
124 | - if ( EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
125 | - $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>'; |
|
126 | - array_unshift( $links, $maintenance_link ); |
|
124 | + if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
125 | + $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>'; |
|
126 | + array_unshift($links, $maintenance_link); |
|
127 | 127 | } else { |
128 | - $org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>'; |
|
129 | - $events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>'; |
|
128 | + $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>'; |
|
129 | + $events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>'; |
|
130 | 130 | // add before other links |
131 | - array_unshift( $links, $org_settings_link, $events_link ); |
|
131 | + array_unshift($links, $org_settings_link, $events_link); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | return $links; |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @return void |
144 | 144 | */ |
145 | 145 | public function get_request() { |
146 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
147 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
146 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
147 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | * @param array $admin_page_folder_names |
157 | 157 | * @return array |
158 | 158 | */ |
159 | - public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){ |
|
159 | + public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) { |
|
160 | 160 | return array( |
161 | - 'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS, |
|
162 | - 'about' => EE_ADMIN_PAGES . 'about' . DS, |
|
163 | - 'support' => EE_ADMIN_PAGES . 'support' . DS |
|
161 | + 'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS, |
|
162 | + 'about' => EE_ADMIN_PAGES.'about'.DS, |
|
163 | + 'support' => EE_ADMIN_PAGES.'support'.DS |
|
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
@@ -174,31 +174,31 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function init() { |
176 | 176 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
177 | - if ( EE_Maintenance_Mode::instance()->models_can_query() ){ |
|
177 | + if (EE_Maintenance_Mode::instance()->models_can_query()) { |
|
178 | 178 | //ok so we want to enable the entire admin |
179 | - add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' )); |
|
180 | - add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
181 | - add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
179 | + add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback')); |
|
180 | + add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
181 | + add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
182 | 182 | //at a glance dashboard widget |
183 | - add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items' ), 10 ); |
|
183 | + add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10); |
|
184 | 184 | //filter for get_edit_post_link used on comments for custom post types |
185 | - add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 2 ); |
|
185 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 2); |
|
186 | 186 | } |
187 | 187 | // run the admin page factory but ONLY if we are doing an ee admin ajax request |
188 | - if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) { |
|
188 | + if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) { |
|
189 | 189 | try { |
190 | 190 | //this loads the controller for the admin pages which will setup routing etc |
191 | - EE_Registry::instance()->load_core( 'Admin_Page_Loader' ); |
|
192 | - } catch ( EE_Error $e ) { |
|
191 | + EE_Registry::instance()->load_core('Admin_Page_Loader'); |
|
192 | + } catch (EE_Error $e) { |
|
193 | 193 | $e->get_error(); |
194 | 194 | } |
195 | 195 | } |
196 | - add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 ); |
|
196 | + add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1); |
|
197 | 197 | //make sure our CPTs and custom taxonomy metaboxes get shown for first time users |
198 | - add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 ); |
|
199 | - add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 ); |
|
198 | + add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10); |
|
199 | + add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10); |
|
200 | 200 | //exclude EE critical pages from all nav menus and wp_list_pages |
201 | - add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 ); |
|
201 | + add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | * @param object $post_type WP post type object |
212 | 212 | * @return object WP post type object |
213 | 213 | */ |
214 | - public function remove_pages_from_nav_menu( $post_type ) { |
|
214 | + public function remove_pages_from_nav_menu($post_type) { |
|
215 | 215 | //if this isn't the "pages" post type let's get out |
216 | - if ( $post_type->name !== 'page' ) { |
|
216 | + if ($post_type->name !== 'page') { |
|
217 | 217 | return $post_type; |
218 | 218 | } |
219 | 219 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
@@ -233,28 +233,28 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function enable_hidden_ee_nav_menu_metaboxes() { |
235 | 235 | global $wp_meta_boxes, $pagenow; |
236 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) { |
|
236 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') { |
|
237 | 237 | return; |
238 | 238 | } |
239 | 239 | $user = wp_get_current_user(); |
240 | 240 | //has this been done yet? |
241 | - if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) { |
|
241 | + if (get_user_option('ee_nav_menu_initialized', $user->ID)) { |
|
242 | 242 | return; |
243 | 243 | } |
244 | 244 | |
245 | - $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID ); |
|
246 | - $initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) ); |
|
245 | + $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID); |
|
246 | + $initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page')); |
|
247 | 247 | |
248 | - if ( is_array( $hidden_meta_boxes ) ) { |
|
249 | - foreach ( $hidden_meta_boxes as $key => $meta_box_id ) { |
|
250 | - if ( in_array( $meta_box_id, $initial_meta_boxes ) ) { |
|
251 | - unset( $hidden_meta_boxes[ $key ] ); |
|
248 | + if (is_array($hidden_meta_boxes)) { |
|
249 | + foreach ($hidden_meta_boxes as $key => $meta_box_id) { |
|
250 | + if (in_array($meta_box_id, $initial_meta_boxes)) { |
|
251 | + unset($hidden_meta_boxes[$key]); |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
257 | - update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true ); |
|
256 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
257 | + update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @return void |
274 | 274 | */ |
275 | 275 | public function register_custom_nav_menu_boxes() { |
276 | - add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' ); |
|
276 | + add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core'); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -289,16 +289,16 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @return string the (maybe) modified link |
291 | 291 | */ |
292 | - public function modify_edit_post_link( $link, $id ) { |
|
293 | - if ( ! $post = get_post( $id ) ){ |
|
292 | + public function modify_edit_post_link($link, $id) { |
|
293 | + if ( ! $post = get_post($id)) { |
|
294 | 294 | return $link; |
295 | 295 | } |
296 | - if ( $post->post_type === 'espresso_attendees' ) { |
|
296 | + if ($post->post_type === 'espresso_attendees') { |
|
297 | 297 | $query_args = array( |
298 | 298 | 'action' => 'edit_attendee', |
299 | 299 | 'post' => $id |
300 | 300 | ); |
301 | - return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') ); |
|
301 | + return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations')); |
|
302 | 302 | } |
303 | 303 | return $link; |
304 | 304 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | global $nav_menu_selected_id; |
311 | 311 | |
312 | 312 | $db_fields = false; |
313 | - $walker = new Walker_Nav_Menu_Checklist( $db_fields ); |
|
313 | + $walker = new Walker_Nav_Menu_Checklist($db_fields); |
|
314 | 314 | $current_tab = 'event-archives'; |
315 | 315 | |
316 | 316 | /*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | ?> |
330 | 330 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
331 | 331 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
332 | - <li <?php echo ( 'event-archives' === $current_tab ? ' class="tabs"' : '' ); ?>> |
|
333 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args)));} ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
334 | - <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
|
332 | + <li <?php echo ('event-archives' === $current_tab ? ' class="tabs"' : ''); ?>> |
|
333 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); } ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
334 | + <?php _e('Event Archive Pages', 'event_espresso'); ?> |
|
335 | 335 | </a> |
336 | 336 | </li> |
337 | 337 | <?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs. |
@@ -349,13 +349,13 @@ discard block |
||
349 | 349 | <?php */ ?> |
350 | 350 | |
351 | 351 | <div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php |
352 | - echo ( 'event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); |
|
352 | + echo ('event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive'); |
|
353 | 353 | ?>"> |
354 | 354 | <ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear"> |
355 | 355 | <?php |
356 | 356 | $pages = $this->_get_extra_nav_menu_pages_items(); |
357 | 357 | $args['walker'] = $walker; |
358 | - echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args ); |
|
358 | + echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args); |
|
359 | 359 | ?> |
360 | 360 | </ul> |
361 | 361 | </div><!-- /.tabs-panel --> |
@@ -363,18 +363,18 @@ discard block |
||
363 | 363 | <p class="button-controls"> |
364 | 364 | <span class="list-controls"> |
365 | 365 | <a href="<?php |
366 | - echo esc_url( add_query_arg( |
|
366 | + echo esc_url(add_query_arg( |
|
367 | 367 | array( |
368 | 368 | 'extra-nav-menu-pages-tab' => 'event-archives', |
369 | 369 | 'selectall' => 1, |
370 | 370 | ), |
371 | - remove_query_arg( $removed_args ) |
|
371 | + remove_query_arg($removed_args) |
|
372 | 372 | )); |
373 | 373 | ?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a> |
374 | 374 | </span> |
375 | 375 | |
376 | 376 | <span class="add-to-menu"> |
377 | - <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" /> |
|
377 | + <input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" /> |
|
378 | 378 | <span class="spinner"></span> |
379 | 379 | </span> |
380 | 380 | </p> |
@@ -395,10 +395,10 @@ discard block |
||
395 | 395 | private function _get_extra_nav_menu_pages_items() { |
396 | 396 | $menuitems[] = array( |
397 | 397 | 'title' => __('Event List', 'event_espresso'), |
398 | - 'url' => get_post_type_archive_link( 'espresso_events' ), |
|
398 | + 'url' => get_post_type_archive_link('espresso_events'), |
|
399 | 399 | 'description' => __('Archive page for all events.', 'event_espresso') |
400 | 400 | ); |
401 | - return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems ); |
|
401 | + return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * @param $menu_item_values |
411 | 411 | * @return stdClass |
412 | 412 | */ |
413 | - private function _setup_extra_nav_menu_pages_items( $menu_item_values ) { |
|
413 | + private function _setup_extra_nav_menu_pages_items($menu_item_values) { |
|
414 | 414 | $menu_item = new stdClass(); |
415 | 415 | $keys = array( |
416 | 416 | 'ID' => 0, |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | 'xfn' => '' |
431 | 431 | ); |
432 | 432 | |
433 | - foreach ( $keys as $key => $value) { |
|
434 | - $menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value; |
|
433 | + foreach ($keys as $key => $value) { |
|
434 | + $menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value; |
|
435 | 435 | } |
436 | 436 | return $menu_item; |
437 | 437 | } |
@@ -470,9 +470,9 @@ discard block |
||
470 | 470 | * - check if doing post processing of one of EE CPTs |
471 | 471 | * - instantiate the corresponding EE CPT model for the post_type being processed. |
472 | 472 | */ |
473 | - if ( isset( $_POST['action'], $_POST['post_type'] ) && $_POST['action'] === 'editpost' ) { |
|
474 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
475 | - EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] ); |
|
473 | + if (isset($_POST['action'], $_POST['post_type']) && $_POST['action'] === 'editpost') { |
|
474 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
475 | + EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | |
@@ -481,8 +481,8 @@ discard block |
||
481 | 481 | * 'options-reading.php' core WordPress admin settings page. This is for user-proofing. |
482 | 482 | */ |
483 | 483 | global $pagenow; |
484 | - if ( $pagenow === 'options-reading.php' ) { |
|
485 | - add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) ); |
|
484 | + if ($pagenow === 'options-reading.php') { |
|
485 | + add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages')); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | } |
@@ -494,25 +494,25 @@ discard block |
||
494 | 494 | * @param string $output Current output. |
495 | 495 | * @return string |
496 | 496 | */ |
497 | - public function modify_dropdown_pages( $output ) { |
|
497 | + public function modify_dropdown_pages($output) { |
|
498 | 498 | //get critical pages |
499 | 499 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
500 | 500 | |
501 | 501 | //split current output by line break for easier parsing. |
502 | - $split_output = explode( "\n", $output ); |
|
502 | + $split_output = explode("\n", $output); |
|
503 | 503 | |
504 | 504 | //loop through to remove any critical pages from the array. |
505 | - foreach ( $critical_pages as $page_id ) { |
|
506 | - $needle = 'value="' . $page_id . '"'; |
|
507 | - foreach( $split_output as $key => $haystack ) { |
|
508 | - if( strpos( $haystack, $needle ) !== false ) { |
|
509 | - unset( $split_output[$key] ); |
|
505 | + foreach ($critical_pages as $page_id) { |
|
506 | + $needle = 'value="'.$page_id.'"'; |
|
507 | + foreach ($split_output as $key => $haystack) { |
|
508 | + if (strpos($haystack, $needle) !== false) { |
|
509 | + unset($split_output[$key]); |
|
510 | 510 | } |
511 | 511 | } |
512 | 512 | } |
513 | 513 | |
514 | 514 | //replace output with the new contents |
515 | - return implode( "\n", $split_output ); |
|
515 | + return implode("\n", $split_output); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | |
@@ -526,36 +526,36 @@ discard block |
||
526 | 526 | public function enqueue_admin_scripts() { |
527 | 527 | // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js. |
528 | 528 | // Note: the intention of this script is to only do TARGETED injections. I.E, only injecting on certain script calls. |
529 | - wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
529 | + wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
530 | 530 | // register cookie script for future dependencies |
531 | - wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE ); |
|
531 | + wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE); |
|
532 | 532 | // jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
533 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
533 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
534 | 534 | // register jQuery Validate |
535 | - wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
535 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
536 | 536 | } |
537 | 537 | //joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' ); |
538 | - if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) { |
|
538 | + if (apply_filters('FHEE_load_joyride', FALSE)) { |
|
539 | 539 | //joyride style |
540 | - wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1'); |
|
541 | - wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION ); |
|
542 | - wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE ); |
|
540 | + wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1'); |
|
541 | + wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION); |
|
542 | + wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE); |
|
543 | 543 | //joyride JS |
544 | - wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE ); |
|
544 | + wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE); |
|
545 | 545 | // wanna go for a joyride? |
546 | 546 | wp_enqueue_style('ee-joyride-css'); |
547 | 547 | wp_enqueue_script('jquery-joyride'); |
548 | 548 | } |
549 | 549 | //qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' ); |
550 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
550 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
551 | 551 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
552 | 552 | } |
553 | 553 | //accounting.js library |
554 | 554 | // @link http://josscrowcroft.github.io/accounting.js/ |
555 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
556 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
557 | - wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE ); |
|
558 | - wp_enqueue_script( 'ee-accounting' ); |
|
555 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
556 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
557 | + wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE); |
|
558 | + wp_enqueue_script('ee-accounting'); |
|
559 | 559 | // array of settings to get converted to JSON array via wp_localize_script |
560 | 560 | $currency_config = array( |
561 | 561 | 'currency' => array( |
@@ -602,11 +602,11 @@ discard block |
||
602 | 602 | public function get_persistent_admin_notices() { |
603 | 603 | // http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30 |
604 | 604 | $args = array( |
605 | - 'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '', |
|
606 | - 'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '', |
|
605 | + 'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '', |
|
606 | + 'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '', |
|
607 | 607 | ); |
608 | - $return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL ); |
|
609 | - echo EE_Error::get_persistent_admin_notices( $return_url ); |
|
608 | + $return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL); |
|
609 | + echo EE_Error::get_persistent_admin_notices($return_url); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | |
@@ -627,26 +627,26 @@ discard block |
||
627 | 627 | * @param $elements |
628 | 628 | * @return array |
629 | 629 | */ |
630 | - public function dashboard_glance_items( $elements ) { |
|
630 | + public function dashboard_glance_items($elements) { |
|
631 | 631 | $events = EEM_Event::instance()->count(); |
632 | - $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') ); |
|
633 | - $items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) ); |
|
632 | + $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php')); |
|
633 | + $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events)); |
|
634 | 634 | $items['events']['title'] = __('Click to view all Events', 'event_espresso'); |
635 | 635 | $registrations = EEM_Registration::instance()->count( |
636 | 636 | array( |
637 | 637 | array( |
638 | - 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) |
|
638 | + 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete) |
|
639 | 639 | ) |
640 | 640 | ) |
641 | 641 | ); |
642 | - $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') ); |
|
643 | - $items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) ); |
|
642 | + $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php')); |
|
643 | + $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations)); |
|
644 | 644 | $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso'); |
645 | 645 | |
646 | - $items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items ); |
|
646 | + $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items); |
|
647 | 647 | |
648 | - foreach ( $items as $type => $item_properties ) { |
|
649 | - $elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] ); |
|
648 | + foreach ($items as $type => $item_properties) { |
|
649 | + $elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']); |
|
650 | 650 | } |
651 | 651 | return $elements; |
652 | 652 | } |
@@ -663,31 +663,31 @@ discard block |
||
663 | 663 | * @throws EE_Error |
664 | 664 | * @return string |
665 | 665 | */ |
666 | - public function check_for_invalid_datetime_formats( $value, $option ) { |
|
666 | + public function check_for_invalid_datetime_formats($value, $option) { |
|
667 | 667 | // check for date_format or time_format |
668 | - switch ( $option ) { |
|
668 | + switch ($option) { |
|
669 | 669 | case 'date_format' : |
670 | - $date_time_format = $value . ' ' . get_option('time_format'); |
|
670 | + $date_time_format = $value.' '.get_option('time_format'); |
|
671 | 671 | break; |
672 | 672 | case 'time_format' : |
673 | - $date_time_format = get_option('date_format') . ' ' . $value; |
|
673 | + $date_time_format = get_option('date_format').' '.$value; |
|
674 | 674 | break; |
675 | 675 | default : |
676 | 676 | $date_time_format = FALSE; |
677 | 677 | } |
678 | 678 | // do we have a date_time format to check ? |
679 | - if ( $date_time_format ) { |
|
680 | - $error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format ); |
|
679 | + if ($date_time_format) { |
|
680 | + $error_msg = EEH_DTT_Helper::validate_format_string($date_time_format); |
|
681 | 681 | |
682 | - if ( is_array( $error_msg ) ) { |
|
683 | - $msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format ) . '</p><p><ul>'; |
|
682 | + if (is_array($error_msg)) { |
|
683 | + $msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>'; |
|
684 | 684 | |
685 | 685 | |
686 | - foreach ( $error_msg as $error ) { |
|
687 | - $msg .= '<li>' . $error . '</li>'; |
|
686 | + foreach ($error_msg as $error) { |
|
687 | + $msg .= '<li>'.$error.'</li>'; |
|
688 | 688 | } |
689 | 689 | |
690 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
690 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
691 | 691 | |
692 | 692 | // trigger WP settings error |
693 | 693 | add_settings_error( |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | ); |
698 | 698 | |
699 | 699 | // set format to something valid |
700 | - switch ( $option ) { |
|
700 | + switch ($option) { |
|
701 | 701 | case 'date_format' : |
702 | 702 | $value = 'F j, Y'; |
703 | 703 | break; |
@@ -719,8 +719,8 @@ discard block |
||
719 | 719 | * @param $content |
720 | 720 | * @return string |
721 | 721 | */ |
722 | - public function its_eSpresso( $content ) { |
|
723 | - return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content ); |
|
722 | + public function its_eSpresso($content) { |
|
723 | + return str_replace('[EXPRESSO_', '[ESPRESSO_', $content); |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | |
@@ -733,9 +733,9 @@ discard block |
||
733 | 733 | */ |
734 | 734 | public function espresso_admin_footer() { |
735 | 735 | return sprintf( |
736 | - __( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ), |
|
736 | + __('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'), |
|
737 | 737 | '<a href="https://eventespresso.com/" title="', |
738 | - '">' . EVENT_ESPRESSO_POWERED_BY . '</a>' |
|
738 | + '">'.EVENT_ESPRESSO_POWERED_BY.'</a>' |
|
739 | 739 | ); |
740 | 740 | } |
741 | 741 | |
@@ -755,12 +755,12 @@ discard block |
||
755 | 755 | * @param array $config |
756 | 756 | * @return void |
757 | 757 | */ |
758 | - public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
|
759 | - EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
|
760 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) { |
|
758 | + public static function register_ee_admin_page($page_basename, $page_path, $config = array()) { |
|
759 | + EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3'); |
|
760 | + if (class_exists('EE_Register_Admin_Page')) { |
|
761 | 761 | $config['page_path'] = $page_path; |
762 | 762 | } |
763 | - EE_Register_Admin_Page::register( $page_basename, $config ); |
|
763 | + EE_Register_Admin_Page::register($page_basename, $config); |
|
764 | 764 | |
765 | 765 | } |
766 | 766 | |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | * @param \WP_Post $post |
774 | 774 | * @return void |
775 | 775 | */ |
776 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
776 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
777 | 777 | EE_Error::doing_it_wrong( |
778 | 778 | __METHOD__, |
779 | 779 | __( |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | ), |
783 | 783 | '4.8.41' |
784 | 784 | ); |
785 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $post_ID, $post ); |
|
785 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($post_ID, $post); |
|
786 | 786 | } |
787 | 787 | |
788 | 788 | |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | * @param $value |
796 | 796 | * @return void |
797 | 797 | */ |
798 | - public function reset_page_for_posts_on_change( $option, $old_value, $value ) { |
|
798 | + public function reset_page_for_posts_on_change($option, $old_value, $value) { |
|
799 | 799 | EE_Error::doing_it_wrong( |
800 | 800 | __METHOD__, |
801 | 801 | __( |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | ), |
805 | 805 | '4.8.41' |
806 | 806 | ); |
807 | - EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change( $option, $old_value, $value ); |
|
807 | + EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change($option, $old_value, $value); |
|
808 | 808 | } |
809 | 809 | |
810 | 810 | } |
@@ -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 |
@@ -1484,10 +1485,11 @@ discard block |
||
1484 | 1485 | //get the earliest datetime (if present); |
1485 | 1486 | $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
1486 | 1487 | |
1487 | - if ( !empty( $earliest_dtt ) ) |
|
1488 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
|
1489 | - else |
|
1490 | - $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1488 | + if ( !empty( $earliest_dtt ) ) { |
|
1489 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
|
1490 | + } else { |
|
1491 | + $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1492 | + } |
|
1491 | 1493 | } |
1492 | 1494 | |
1493 | 1495 | $template_args = array_merge( $template_args, $price_args ); |
@@ -1725,8 +1727,9 @@ discard block |
||
1725 | 1727 | } |
1726 | 1728 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1727 | 1729 | |
1728 | - if ( $redirect_after ) |
|
1729 | - $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
1730 | + if ( $redirect_after ) { |
|
1731 | + $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
1732 | + } |
|
1730 | 1733 | } |
1731 | 1734 | |
1732 | 1735 | /** |
@@ -1853,8 +1856,9 @@ discard block |
||
1853 | 1856 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1854 | 1857 | } |
1855 | 1858 | |
1856 | - if ( $redirect_after ) |
|
1857 | - $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
|
1859 | + if ( $redirect_after ) { |
|
1860 | + $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
|
1861 | + } |
|
1858 | 1862 | } |
1859 | 1863 | |
1860 | 1864 | /** |
@@ -2091,8 +2095,10 @@ discard block |
||
2091 | 2095 | * @return void |
2092 | 2096 | */ |
2093 | 2097 | private function _set_category_object() { |
2094 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
2095 | - return; //already have the category object so get out. |
|
2098 | + if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) { |
|
2099 | + return; |
|
2100 | + } |
|
2101 | + //already have the category object so get out. |
|
2096 | 2102 | |
2097 | 2103 | //set default category object |
2098 | 2104 | $this->_set_empty_category_object(); |
@@ -602,9 +602,9 @@ discard block |
||
602 | 602 | // first check if event is active. |
603 | 603 | if ( |
604 | 604 | $orig_status === EEM_Event::cancelled |
605 | - || $orig_status === EEM_Event::postponed |
|
606 | - || $event->is_expired() |
|
607 | - || $event->is_inactive() |
|
605 | + || $orig_status === EEM_Event::postponed |
|
606 | + || $event->is_expired() |
|
607 | + || $event->is_inactive() |
|
608 | 608 | ) { |
609 | 609 | return; |
610 | 610 | } |
@@ -801,10 +801,10 @@ discard block |
||
801 | 801 | esc_html__("View Event Archive Page", "event_espresso"), |
802 | 802 | 'button' |
803 | 803 | ); |
804 | - $this->_template_args['after_list_table'] .= EventEspresso\core\libraries\iframe_display\Iframe::addEventListIframeEmbedButton(); |
|
805 | - $this->_template_args['after_list_table'] .= $this->_display_legend($this->_event_legend_items()); |
|
804 | + $this->_template_args['after_list_table'] .= EventEspresso\core\libraries\iframe_display\Iframe::addEventListIframeEmbedButton(); |
|
805 | + $this->_template_args['after_list_table'] .= $this->_display_legend($this->_event_legend_items()); |
|
806 | 806 | |
807 | - $this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
807 | + $this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
808 | 808 | $this->display_admin_list_table_page_with_no_sidebar(); |
809 | 809 | } |
810 | 810 |
@@ -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 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->_cpt_edit_routes = array( |
67 | 67 | 'espresso_events' => 'edit' |
68 | 68 | ); |
69 | - add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) ); |
|
69 | + add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit')); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | protected function _ajax_hooks() { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | 'edit' => esc_html__('Update Event', 'event_espresso'), |
93 | 93 | 'add_category' => esc_html__('Save New Category', 'event_espresso'), |
94 | 94 | 'edit_category' => esc_html__('Update Category', 'event_espresso'), |
95 | - 'template_settings' => esc_html__( 'Update Settings', 'event_espresso' ) |
|
95 | + 'template_settings' => esc_html__('Update Settings', 'event_espresso') |
|
96 | 96 | ) |
97 | 97 | ); |
98 | 98 | } |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | //load field generator helper |
103 | 103 | |
104 | 104 | //is there a evt_id in the request? |
105 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0; |
|
106 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
105 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0; |
|
106 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
107 | 107 | |
108 | 108 | |
109 | 109 | $this->_page_routes = array( |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | 'help_tour' => array( |
318 | 318 | 'Event_Editor_Help_Tour' |
319 | 319 | ), |
320 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
320 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
321 | 321 | 'require_nonce' => FALSE |
322 | 322 | ), |
323 | 323 | 'edit' => array( |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | /*'help_tour' => array( |
374 | 374 | 'Event_Edit_Help_Tour' |
375 | 375 | ),*/ |
376 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
376 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
377 | 377 | 'require_nonce' => FALSE |
378 | 378 | ), |
379 | 379 | 'default_event_settings' => array( |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | 'filename' => 'events_default_settings_status' |
396 | 396 | ) |
397 | 397 | ), |
398 | - 'help_tour' => array( 'Event_Default_Settings_Help_Tour'), |
|
398 | + 'help_tour' => array('Event_Default_Settings_Help_Tour'), |
|
399 | 399 | 'require_nonce' => FALSE |
400 | 400 | ), |
401 | 401 | //template settings |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | 'filename' => 'general_settings_templates' |
412 | 412 | ) |
413 | 413 | ), |
414 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
414 | + 'help_tour' => array('Templates_Help_Tour'), |
|
415 | 415 | 'require_nonce' => FALSE |
416 | 416 | ), |
417 | 417 | //event category stuff |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | 'label' => esc_html__('Edit Category', 'event_espresso'), |
436 | 436 | 'order' => 15, |
437 | 437 | 'persistent' => FALSE, |
438 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
438 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
439 | 439 | ), |
440 | 440 | 'help_tabs' => array( |
441 | 441 | 'edit_category_help_tab' => array( |
@@ -505,14 +505,14 @@ discard block |
||
505 | 505 | |
506 | 506 | public function load_scripts_styles() { |
507 | 507 | |
508 | - wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
509 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
508 | + wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
509 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
510 | 510 | wp_enqueue_style('events-admin-css'); |
511 | 511 | wp_enqueue_style('ee-cat-admin'); |
512 | 512 | //todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details |
513 | 513 | //registers for all views |
514 | 514 | //scripts |
515 | - wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE); |
|
515 | + wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | /** |
@@ -530,11 +530,11 @@ discard block |
||
530 | 530 | public function load_scripts_styles_edit() { |
531 | 531 | //styles |
532 | 532 | wp_enqueue_style('espresso-ui-theme'); |
533 | - wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
533 | + wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
534 | 534 | wp_enqueue_style('event-editor-css'); |
535 | 535 | |
536 | 536 | //scripts |
537 | - wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION ); |
|
537 | + wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION); |
|
538 | 538 | wp_enqueue_script('event-datetime-metabox'); |
539 | 539 | |
540 | 540 | } |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | |
570 | 570 | |
571 | 571 | public function admin_init() { |
572 | - EE_Registry::$i18n_js_strings[ 'image_confirm' ] = esc_html__( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' ); |
|
572 | + EE_Registry::$i18n_js_strings['image_confirm'] = esc_html__('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso'); |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | |
@@ -590,12 +590,12 @@ discard block |
||
590 | 590 | */ |
591 | 591 | public function verify_event_edit($event = NULL) { |
592 | 592 | // no event? |
593 | - if ( empty( $event )) { |
|
593 | + if (empty($event)) { |
|
594 | 594 | // set event |
595 | 595 | $event = $this->_cpt_model_obj; |
596 | 596 | } |
597 | 597 | // STILL no event? |
598 | - if ( empty ( $event )) { |
|
598 | + if (empty ($event)) { |
|
599 | 599 | return; |
600 | 600 | } |
601 | 601 | $orig_status = $event->status(); |
@@ -609,27 +609,27 @@ discard block |
||
609 | 609 | return; |
610 | 610 | } |
611 | 611 | //made it here so it IS active... next check that any of the tickets are sold. |
612 | - if ( $event->is_sold_out( true ) ) { |
|
613 | - if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) { |
|
612 | + if ($event->is_sold_out(true)) { |
|
613 | + if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) { |
|
614 | 614 | EE_Error::add_attention( |
615 | 615 | sprintf( |
616 | - esc_html__( 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You can change the status back to something else before updating if you wish.', 'event_espresso' ), |
|
617 | - EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' ) |
|
616 | + esc_html__('Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You can change the status back to something else before updating if you wish.', 'event_espresso'), |
|
617 | + EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence') |
|
618 | 618 | ) |
619 | 619 | ); |
620 | 620 | } |
621 | 621 | return; |
622 | - } else if ( $orig_status === EEM_Event::sold_out ) { |
|
622 | + } else if ($orig_status === EEM_Event::sold_out) { |
|
623 | 623 | EE_Error::add_attention( |
624 | 624 | sprintf( |
625 | - esc_html__( 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets. However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.', |
|
626 | - 'event_espresso' ), |
|
627 | - EEH_Template::pretty_status( $event->status(), false, 'sentence' ) |
|
625 | + esc_html__('Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets. However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.', |
|
626 | + 'event_espresso'), |
|
627 | + EEH_Template::pretty_status($event->status(), false, 'sentence') |
|
628 | 628 | ) |
629 | 629 | ); |
630 | 630 | } |
631 | 631 | //now we need to determine if the event has any tickets on sale. If not then we dont' show the error |
632 | - if ( ! $event->tickets_on_sale() ) { |
|
632 | + if ( ! $event->tickets_on_sale()) { |
|
633 | 633 | return; |
634 | 634 | } |
635 | 635 | //made it here so show warning |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | */ |
649 | 649 | protected function _edit_event_warning() { |
650 | 650 | // we don't want to add warnings during these requests |
651 | - if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) { |
|
651 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') { |
|
652 | 652 | return; |
653 | 653 | } |
654 | 654 | EE_Error::add_attention( |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | ), |
680 | 680 | ); |
681 | 681 | |
682 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
682 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
683 | 683 | $this->_views['trash'] = array( |
684 | 684 | 'slug' => 'trash', |
685 | 685 | 'label' => esc_html__('Trash', 'event_espresso'), |
@@ -709,39 +709,39 @@ discard block |
||
709 | 709 | 'desc' => esc_html__('View Registrations for Event', 'event_espresso') |
710 | 710 | ) |
711 | 711 | ); |
712 | - $items = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items ); |
|
712 | + $items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items); |
|
713 | 713 | $statuses = array( |
714 | 714 | 'sold_out_status' => array( |
715 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out, |
|
716 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' ) |
|
715 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out, |
|
716 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence') |
|
717 | 717 | ), |
718 | 718 | 'active_status' => array( |
719 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active, |
|
720 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' ) |
|
719 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active, |
|
720 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence') |
|
721 | 721 | ), |
722 | 722 | 'upcoming_status' => array( |
723 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming, |
|
724 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' ) |
|
723 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming, |
|
724 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence') |
|
725 | 725 | ), |
726 | 726 | 'postponed_status' => array( |
727 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed, |
|
728 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' ) |
|
727 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed, |
|
728 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence') |
|
729 | 729 | ), |
730 | 730 | 'cancelled_status' => array( |
731 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled, |
|
732 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' ) |
|
731 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled, |
|
732 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence') |
|
733 | 733 | ), |
734 | 734 | 'expired_status' => array( |
735 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired, |
|
736 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' ) |
|
735 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired, |
|
736 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence') |
|
737 | 737 | ), |
738 | 738 | 'inactive_status' => array( |
739 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive, |
|
740 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' ) |
|
739 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive, |
|
740 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence') |
|
741 | 741 | ) |
742 | 742 | ); |
743 | - $statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses ); |
|
744 | - return array_merge( $items, $statuses ); |
|
743 | + $statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses); |
|
744 | + return array_merge($items, $statuses); |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | |
@@ -753,8 +753,8 @@ discard block |
||
753 | 753 | * @return EEM_Event |
754 | 754 | */ |
755 | 755 | private function _event_model() { |
756 | - if ( ! $this->_event_model instanceof EEM_Event ) { |
|
757 | - $this->_event_model = EE_Registry::instance()->load_model( 'Event' ); |
|
756 | + if ( ! $this->_event_model instanceof EEM_Event) { |
|
757 | + $this->_event_model = EE_Registry::instance()->load_model('Event'); |
|
758 | 758 | } |
759 | 759 | return $this->_event_model; |
760 | 760 | } |
@@ -773,12 +773,12 @@ discard block |
||
773 | 773 | * @param string $new_slug what the slug is |
774 | 774 | * @return string The new html string for the permalink area |
775 | 775 | */ |
776 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
776 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
777 | 777 | //make sure this is only when editing |
778 | - if ( !empty( $id ) ) { |
|
779 | - $post = get_post( $id ); |
|
780 | - $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">' . esc_html__('Shortcode', 'event_espresso') . '</a> '; |
|
781 | - $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' . $post->ID . ']">'; |
|
778 | + if ( ! empty($id)) { |
|
779 | + $post = get_post($id); |
|
780 | + $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">'.esc_html__('Shortcode', 'event_espresso').'</a> '; |
|
781 | + $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='.$post->ID.']">'; |
|
782 | 782 | } |
783 | 783 | return $return; |
784 | 784 | } |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | * @throws \EE_Error |
795 | 795 | */ |
796 | 796 | protected function _events_overview_list_table() { |
797 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
797 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
798 | 798 | $this->_template_args['after_list_table'] = '<br />'; |
799 | 799 | $this->_template_args['after_list_table'] .= EEH_Template::get_button_or_link( |
800 | 800 | get_post_type_archive_link('espresso_events'), |
@@ -831,51 +831,51 @@ discard block |
||
831 | 831 | * @param object $post The post object of the cpt that was saved. |
832 | 832 | * @return void |
833 | 833 | */ |
834 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
834 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
835 | 835 | |
836 | - if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) { |
|
836 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') { |
|
837 | 837 | //getout we're not processing an event save. |
838 | 838 | return; |
839 | 839 | } |
840 | 840 | |
841 | 841 | $event_values = array( |
842 | - 'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0, |
|
843 | - 'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0, |
|
842 | + 'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0, |
|
843 | + 'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0, |
|
844 | 844 | 'EVT_additional_limit' => min( |
845 | - apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ), |
|
846 | - !empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ), |
|
847 | - 'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID, |
|
848 | - 'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0, |
|
849 | - 'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0, |
|
850 | - 'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL, |
|
851 | - 'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL, |
|
852 | - 'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL |
|
845 | + apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255), |
|
846 | + ! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ), |
|
847 | + 'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID, |
|
848 | + 'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0, |
|
849 | + 'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0, |
|
850 | + 'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL, |
|
851 | + 'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL, |
|
852 | + 'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL |
|
853 | 853 | ); |
854 | 854 | |
855 | 855 | //update event |
856 | - $success = $this->_event_model()->update_by_ID( $event_values, $post_id ); |
|
856 | + $success = $this->_event_model()->update_by_ID($event_values, $post_id); |
|
857 | 857 | |
858 | 858 | |
859 | 859 | //get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
860 | - $get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
861 | - $event = $this->_event_model()->get_one( array($get_one_where) ); |
|
860 | + $get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
861 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
862 | 862 | |
863 | 863 | |
864 | 864 | //the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons. |
865 | - $event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) ); |
|
865 | + $event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update'))); |
|
866 | 866 | |
867 | 867 | $att_success = TRUE; |
868 | 868 | |
869 | - foreach ( $event_update_callbacks as $e_callback ) { |
|
870 | - $_succ = call_user_func_array( $e_callback, array( $event, $this->_req_data ) ); |
|
871 | - $att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
869 | + foreach ($event_update_callbacks as $e_callback) { |
|
870 | + $_succ = call_user_func_array($e_callback, array($event, $this->_req_data)); |
|
871 | + $att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | //any errors? |
875 | - if ( $success && FALSE === $att_success ) { |
|
876 | - EE_Error::add_error( esc_html__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
877 | - } else if ( $success === FALSE ) { |
|
878 | - EE_Error::add_error( esc_html__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
875 | + if ($success && FALSE === $att_success) { |
|
876 | + EE_Error::add_error(esc_html__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
877 | + } else if ($success === FALSE) { |
|
878 | + EE_Error::add_error(esc_html__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
879 | 879 | } |
880 | 880 | } |
881 | 881 | |
@@ -885,14 +885,14 @@ discard block |
||
885 | 885 | /** |
886 | 886 | * @see parent::restore_item() |
887 | 887 | */ |
888 | - protected function _restore_cpt_item( $post_id, $revision_id ) { |
|
888 | + protected function _restore_cpt_item($post_id, $revision_id) { |
|
889 | 889 | //copy existing event meta to new post |
890 | 890 | $post_evt = $this->_event_model()->get_one_by_ID($post_id); |
891 | - if ( $post_evt instanceof EE_Event ) { |
|
891 | + if ($post_evt instanceof EE_Event) { |
|
892 | 892 | //meta revision restore |
893 | - $post_evt->restore_revision( $revision_id ); |
|
893 | + $post_evt->restore_revision($revision_id); |
|
894 | 894 | //related objs restore |
895 | - $post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) ); |
|
895 | + $post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price')); |
|
896 | 896 | } |
897 | 897 | } |
898 | 898 | |
@@ -905,52 +905,52 @@ discard block |
||
905 | 905 | * @param array $data The request data from the form |
906 | 906 | * @return bool Success or fail. |
907 | 907 | */ |
908 | - protected function _default_venue_update( $evtobj, $data ) { |
|
909 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
908 | + protected function _default_venue_update($evtobj, $data) { |
|
909 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
910 | 910 | $venue_model = EE_Registry::instance()->load_model('Venue'); |
911 | 911 | $rows_affected = NULL; |
912 | - $venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL; |
|
912 | + $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL; |
|
913 | 913 | |
914 | 914 | // very important. If we don't have a venue name... |
915 | 915 | // then we'll get out because not necessary to create empty venue |
916 | - if ( empty( $data['venue_title'] ) ) { |
|
916 | + if (empty($data['venue_title'])) { |
|
917 | 917 | return false; |
918 | 918 | } |
919 | 919 | |
920 | 920 | $venue_array = array( |
921 | 921 | 'VNU_wp_user' => $evtobj->get('EVT_wp_user'), |
922 | - 'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL, |
|
923 | - 'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL, |
|
924 | - 'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL, |
|
925 | - 'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL, |
|
926 | - 'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL, |
|
927 | - 'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL, |
|
928 | - 'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL, |
|
929 | - 'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL, |
|
930 | - 'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL, |
|
931 | - 'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL, |
|
932 | - 'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL, |
|
933 | - 'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL, |
|
934 | - 'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL, |
|
935 | - 'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL, |
|
936 | - 'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL, |
|
937 | - 'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0, |
|
922 | + 'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL, |
|
923 | + 'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL, |
|
924 | + 'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL, |
|
925 | + 'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL, |
|
926 | + 'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL, |
|
927 | + 'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL, |
|
928 | + 'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL, |
|
929 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL, |
|
930 | + 'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL, |
|
931 | + 'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL, |
|
932 | + 'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL, |
|
933 | + 'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL, |
|
934 | + 'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL, |
|
935 | + 'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL, |
|
936 | + 'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL, |
|
937 | + 'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0, |
|
938 | 938 | 'status' => 'publish' |
939 | 939 | ); |
940 | 940 | |
941 | 941 | |
942 | 942 | //if we've got the venue_id then we're just updating the existing venue so let's do that and then get out. |
943 | - if ( !empty( $venue_id ) ) { |
|
944 | - $update_where = array( $venue_model->primary_key_name() => $venue_id ); |
|
945 | - $rows_affected = $venue_model->update( $venue_array, array( $update_where ) ); |
|
943 | + if ( ! empty($venue_id)) { |
|
944 | + $update_where = array($venue_model->primary_key_name() => $venue_id); |
|
945 | + $rows_affected = $venue_model->update($venue_array, array($update_where)); |
|
946 | 946 | //we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present. |
947 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
947 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
948 | 948 | return $rows_affected > 0 ? TRUE : FALSE; |
949 | 949 | } else { |
950 | 950 | //we insert the venue |
951 | - $venue_id = $venue_model->insert( $venue_array ); |
|
952 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
953 | - return !empty( $venue_id ) ? TRUE : FALSE; |
|
951 | + $venue_id = $venue_model->insert($venue_array); |
|
952 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
953 | + return ! empty($venue_id) ? TRUE : FALSE; |
|
954 | 954 | } |
955 | 955 | //when we have the ancestor come in it's already been handled by the revision save. |
956 | 956 | } |
@@ -964,54 +964,54 @@ discard block |
||
964 | 964 | * @param array $data The request data from the form |
965 | 965 | * @return bool success or fail |
966 | 966 | */ |
967 | - protected function _default_tickets_update( EE_Event $evtobj, $data ) { |
|
967 | + protected function _default_tickets_update(EE_Event $evtobj, $data) { |
|
968 | 968 | $success = true; |
969 | 969 | $saved_dtt = null; |
970 | 970 | $saved_tickets = array(); |
971 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
971 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
972 | 972 | |
973 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
973 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
974 | 974 | //trim all values to ensure any excess whitespace is removed. |
975 | - $dtt = array_map( 'trim', $dtt ); |
|
976 | - $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
975 | + $dtt = array_map('trim', $dtt); |
|
976 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
977 | 977 | $datetime_values = array( |
978 | - 'DTT_ID' => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL, |
|
978 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL, |
|
979 | 979 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
980 | 980 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
981 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'], |
|
981 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
982 | 982 | 'DTT_order' => $row, |
983 | 983 | ); |
984 | 984 | |
985 | 985 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
986 | 986 | |
987 | - if ( !empty( $dtt['DTT_ID'] ) ) { |
|
988 | - $DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] ); |
|
989 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
990 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
991 | - foreach ( $datetime_values as $field => $value ) { |
|
992 | - $DTM->set( $field, $value ); |
|
987 | + if ( ! empty($dtt['DTT_ID'])) { |
|
988 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']); |
|
989 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
990 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
991 | + foreach ($datetime_values as $field => $value) { |
|
992 | + $DTM->set($field, $value); |
|
993 | 993 | } |
994 | 994 | |
995 | 995 | //make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. We need to do this so we dont' TRASH the parent DTT. |
996 | 996 | $saved_dtts[$DTM->ID()] = $DTM; |
997 | 997 | } else { |
998 | - $DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE ); |
|
999 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
1000 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
1001 | - $DTM->set_timezone( $evtobj->get_timezone() ); |
|
1002 | - foreach ( $datetime_values as $field => $value ) { |
|
1003 | - $DTM->set( $field, $value ); |
|
998 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE); |
|
999 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
1000 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
1001 | + $DTM->set_timezone($evtobj->get_timezone()); |
|
1002 | + foreach ($datetime_values as $field => $value) { |
|
1003 | + $DTM->set($field, $value); |
|
1004 | 1004 | } |
1005 | 1005 | } |
1006 | 1006 | $DTM->save(); |
1007 | 1007 | |
1008 | - $DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' ); |
|
1008 | + $DTT = $evtobj->_add_relation_to($DTM, 'Datetime'); |
|
1009 | 1009 | |
1010 | 1010 | //load DTT helper |
1011 | 1011 | |
1012 | 1012 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
1013 | - if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) { |
|
1014 | - $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') ); |
|
1013 | + if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) { |
|
1014 | + $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start')); |
|
1015 | 1015 | $DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days'); |
1016 | 1016 | $DTT->save(); |
1017 | 1017 | } |
@@ -1019,45 +1019,45 @@ discard block |
||
1019 | 1019 | //now we got to make sure we add the new DTT_ID to the $saved_dtts array because it is possible there was a new one created for the autosave. |
1020 | 1020 | $saved_dtt = $DTT; |
1021 | 1021 | |
1022 | - $success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
1022 | + $success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | //no dtts get deleted so we don't do any of that logic here. |
1026 | 1026 | //update tickets next |
1027 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array(); |
|
1028 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
1029 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
1027 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
1028 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
1029 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
1030 | 1030 | $update_prices = false; |
1031 | - $ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
1031 | + $ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
1032 | 1032 | |
1033 | 1033 | // trim inputs to ensure any excess whitespace is removed. |
1034 | - $tkt = array_map( 'trim', $tkt ); |
|
1034 | + $tkt = array_map('trim', $tkt); |
|
1035 | 1035 | |
1036 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
1036 | + if (empty($tkt['TKT_start_date'])) { |
|
1037 | 1037 | //let's use now in the set timezone. |
1038 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
1039 | - $tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] ); |
|
1038 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
1039 | + $tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]); |
|
1040 | 1040 | } |
1041 | 1041 | |
1042 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
1042 | + if (empty($tkt['TKT_end_date'])) { |
|
1043 | 1043 | //use the start date of the first datetime |
1044 | 1044 | $dtt = $evtobj->first_datetime(); |
1045 | - $tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] ); |
|
1045 | + $tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]); |
|
1046 | 1046 | } |
1047 | 1047 | |
1048 | 1048 | $TKT_values = array( |
1049 | - 'TKT_ID' => !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL, |
|
1050 | - 'TTM_ID' => !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
1051 | - 'TKT_name' => !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
1052 | - 'TKT_description' => !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '', |
|
1049 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL, |
|
1050 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
1051 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
1052 | + 'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '', |
|
1053 | 1053 | 'TKT_start_date' => $tkt['TKT_start_date'], |
1054 | 1054 | 'TKT_end_date' => $tkt['TKT_end_date'], |
1055 | - 'TKT_qty' => ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1056 | - 'TKT_uses' => ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ], |
|
1057 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
1058 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'], |
|
1055 | + 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1056 | + 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
1057 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
1058 | + 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
1059 | 1059 | 'TKT_row' => $row, |
1060 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row, |
|
1060 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row, |
|
1061 | 1061 | 'TKT_price' => $ticket_price |
1062 | 1062 | ); |
1063 | 1063 | |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | |
1066 | 1066 | |
1067 | 1067 | //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well. |
1068 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
1068 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
1069 | 1069 | $TKT_values['TKT_ID'] = 0; |
1070 | 1070 | $TKT_values['TKT_is_default'] = 0; |
1071 | 1071 | $TKT_values['TKT_price'] = $ticket_price; |
@@ -1076,58 +1076,58 @@ discard block |
||
1076 | 1076 | //we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified. |
1077 | 1077 | //keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
1078 | 1078 | |
1079 | - if ( !empty( $tkt['TKT_ID'] ) ) { |
|
1080 | - $TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] ); |
|
1081 | - if ( $TKT instanceof EE_Ticket ) { |
|
1082 | - $ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false; |
|
1079 | + if ( ! empty($tkt['TKT_ID'])) { |
|
1080 | + $TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']); |
|
1081 | + if ($TKT instanceof EE_Ticket) { |
|
1082 | + $ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false; |
|
1083 | 1083 | //let's just check the total price for the existing ticket and determine if it matches the new total price. if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket. |
1084 | - $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false; |
|
1085 | - $TKT->set_date_format( $incoming_date_formats[ 0 ] ); |
|
1086 | - $TKT->set_time_format( $incoming_date_formats[ 1 ] ); |
|
1084 | + $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false; |
|
1085 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1086 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1087 | 1087 | //set new values |
1088 | - foreach ( $TKT_values as $field => $value ) { |
|
1089 | - if ( $field == 'TKT_qty' ) { |
|
1090 | - $TKT->set_qty( $value ); |
|
1088 | + foreach ($TKT_values as $field => $value) { |
|
1089 | + if ($field == 'TKT_qty') { |
|
1090 | + $TKT->set_qty($value); |
|
1091 | 1091 | } else { |
1092 | - $TKT->set( $field, $value ); |
|
1092 | + $TKT->set($field, $value); |
|
1093 | 1093 | } |
1094 | 1094 | } |
1095 | 1095 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
1096 | - if ( $create_new_TKT ) { |
|
1096 | + if ($create_new_TKT) { |
|
1097 | 1097 | //archive the old ticket first |
1098 | - $TKT->set( 'TKT_deleted', 1 ); |
|
1098 | + $TKT->set('TKT_deleted', 1); |
|
1099 | 1099 | $TKT->save(); |
1100 | 1100 | //make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine. |
1101 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
1101 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
1102 | 1102 | //create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it. |
1103 | 1103 | $TKT = clone $TKT; |
1104 | - $TKT->set( 'TKT_ID', 0 ); |
|
1105 | - $TKT->set( 'TKT_deleted', 0 ); |
|
1106 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1107 | - $TKT->set( 'TKT_sold', 0 ); |
|
1104 | + $TKT->set('TKT_ID', 0); |
|
1105 | + $TKT->set('TKT_deleted', 0); |
|
1106 | + $TKT->set('TKT_price', $ticket_price); |
|
1107 | + $TKT->set('TKT_sold', 0); |
|
1108 | 1108 | //now we need to make sure that $new prices are created as well and attached to new ticket. |
1109 | 1109 | $update_prices = true; |
1110 | 1110 | } |
1111 | 1111 | //make sure price is set if it hasn't been already |
1112 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1112 | + $TKT->set('TKT_price', $ticket_price); |
|
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | } else { |
1116 | 1116 | //no TKT_id so a new TKT |
1117 | 1117 | $TKT_values['TKT_price'] = $ticket_price; |
1118 | - $TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE ); |
|
1119 | - if ( $TKT instanceof EE_Ticket ) { |
|
1118 | + $TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE); |
|
1119 | + if ($TKT instanceof EE_Ticket) { |
|
1120 | 1120 | //need to reset values to properly account for the date formats |
1121 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1122 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1123 | - $TKT->set_timezone( $evtobj->get_timezone() ); |
|
1121 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1122 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1123 | + $TKT->set_timezone($evtobj->get_timezone()); |
|
1124 | 1124 | |
1125 | 1125 | //set new values |
1126 | - foreach ( $TKT_values as $field => $value ) { |
|
1127 | - if ( $field == 'TKT_qty' ) { |
|
1128 | - $TKT->set_qty( $value ); |
|
1126 | + foreach ($TKT_values as $field => $value) { |
|
1127 | + if ($field == 'TKT_qty') { |
|
1128 | + $TKT->set_qty($value); |
|
1129 | 1129 | } else { |
1130 | - $TKT->set( $field, $value ); |
|
1130 | + $TKT->set($field, $value); |
|
1131 | 1131 | } |
1132 | 1132 | } |
1133 | 1133 | |
@@ -1135,31 +1135,31 @@ discard block |
||
1135 | 1135 | } |
1136 | 1136 | } |
1137 | 1137 | // cap ticket qty by datetime reg limits |
1138 | - $TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) ); |
|
1138 | + $TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit'))); |
|
1139 | 1139 | //update ticket. |
1140 | 1140 | $TKT->save(); |
1141 | 1141 | |
1142 | 1142 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
1143 | - if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) { |
|
1144 | - $TKT->set('TKT_end_date', $TKT->get('TKT_start_date') ); |
|
1143 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
1144 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
1145 | 1145 | $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
1146 | 1146 | $TKT->save(); |
1147 | 1147 | } |
1148 | 1148 | |
1149 | 1149 | //initially let's add the ticket to the dtt |
1150 | - $saved_dtt->_add_relation_to( $TKT, 'Ticket' ); |
|
1150 | + $saved_dtt->_add_relation_to($TKT, 'Ticket'); |
|
1151 | 1151 | |
1152 | 1152 | $saved_tickets[$TKT->ID()] = $TKT; |
1153 | 1153 | |
1154 | 1154 | //add prices to ticket |
1155 | - $this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices ); |
|
1155 | + $this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices); |
|
1156 | 1156 | } |
1157 | 1157 | //however now we need to handle permanently deleting tickets via the ui. Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold. However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db. |
1158 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1159 | - $tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) ); |
|
1158 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1159 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
1160 | 1160 | |
1161 | - foreach ( $tickets_removed as $id ) { |
|
1162 | - $id = absint( $id ); |
|
1161 | + foreach ($tickets_removed as $id) { |
|
1162 | + $id = absint($id); |
|
1163 | 1163 | |
1164 | 1164 | //get the ticket for this id |
1165 | 1165 | $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | //need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold) |
1168 | 1168 | $dtts = $tkt_to_remove->get_many_related('Datetime'); |
1169 | 1169 | |
1170 | - foreach( $dtts as $dtt ) { |
|
1170 | + foreach ($dtts as $dtt) { |
|
1171 | 1171 | $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
1172 | 1172 | } |
1173 | 1173 | |
@@ -1178,7 +1178,7 @@ discard block |
||
1178 | 1178 | //finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships) |
1179 | 1179 | $tkt_to_remove->delete_permanently(); |
1180 | 1180 | } |
1181 | - return array( $saved_dtt, $saved_tickets ); |
|
1181 | + return array($saved_dtt, $saved_tickets); |
|
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | |
@@ -1193,31 +1193,31 @@ discard block |
||
1193 | 1193 | * @param bool $new_prices Whether attach existing incoming prices or create new ones. |
1194 | 1194 | * @return void |
1195 | 1195 | */ |
1196 | - private function _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) { |
|
1197 | - foreach ( $prices as $row => $prc ) { |
|
1196 | + private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) { |
|
1197 | + foreach ($prices as $row => $prc) { |
|
1198 | 1198 | $PRC_values = array( |
1199 | - 'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL, |
|
1200 | - 'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL, |
|
1201 | - 'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
1202 | - 'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
1203 | - 'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
1199 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL, |
|
1200 | + 'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL, |
|
1201 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
1202 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
1203 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
1204 | 1204 | 'PRC_is_default' => 0, //make sure prices are NOT set as default from this context |
1205 | 1205 | 'PRC_order' => $row |
1206 | 1206 | ); |
1207 | 1207 | |
1208 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
1208 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
1209 | 1209 | $PRC_values['PRC_ID'] = 0; |
1210 | - $PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE); |
|
1210 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE); |
|
1211 | 1211 | } else { |
1212 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
1212 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
1213 | 1213 | //update this price with new values |
1214 | - foreach ( $PRC_values as $field => $newprc ) { |
|
1215 | - $PRC->set( $field, $newprc ); |
|
1214 | + foreach ($PRC_values as $field => $newprc) { |
|
1215 | + $PRC->set($field, $newprc); |
|
1216 | 1216 | } |
1217 | 1217 | $PRC->save(); |
1218 | 1218 | } |
1219 | 1219 | |
1220 | - $ticket->_add_relation_to( $PRC, 'Price' ); |
|
1220 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
1221 | 1221 | } |
1222 | 1222 | } |
1223 | 1223 | |
@@ -1255,9 +1255,9 @@ discard block |
||
1255 | 1255 | //load formatter helper |
1256 | 1256 | |
1257 | 1257 | //args for getting related registrations |
1258 | - $approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) ); |
|
1259 | - $not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) ); |
|
1260 | - $pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) ); |
|
1258 | + $approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved)); |
|
1259 | + $not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved)); |
|
1260 | + $pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment)); |
|
1261 | 1261 | |
1262 | 1262 | |
1263 | 1263 | // publish box |
@@ -1286,9 +1286,9 @@ discard block |
||
1286 | 1286 | ), |
1287 | 1287 | REG_ADMIN_URL |
1288 | 1288 | ), |
1289 | - 'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ), |
|
1290 | - 'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ), |
|
1291 | - 'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ), |
|
1289 | + 'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args), |
|
1290 | + 'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args), |
|
1291 | + 'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args), |
|
1292 | 1292 | 'misc_pub_section_class' => apply_filters( |
1293 | 1293 | 'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class', |
1294 | 1294 | 'misc-pub-section' |
@@ -1307,9 +1307,9 @@ discard block |
||
1307 | 1307 | 'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add', |
1308 | 1308 | $this->_cpt_model_obj |
1309 | 1309 | ); |
1310 | - $publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean(); |
|
1310 | + $publish_box_extra_args['event_editor_overview_add'] = ob_get_clean(); |
|
1311 | 1311 | // load template |
1312 | - EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args ); |
|
1312 | + EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args); |
|
1313 | 1313 | } |
1314 | 1314 | |
1315 | 1315 | |
@@ -1341,16 +1341,16 @@ discard block |
||
1341 | 1341 | $this->verify_cpt_object(); |
1342 | 1342 | add_meta_box( |
1343 | 1343 | 'espresso_event_editor_tickets', |
1344 | - esc_html__( 'Event Datetime & Ticket', 'event_espresso' ), |
|
1345 | - array( $this, 'ticket_metabox' ), |
|
1344 | + esc_html__('Event Datetime & Ticket', 'event_espresso'), |
|
1345 | + array($this, 'ticket_metabox'), |
|
1346 | 1346 | $this->page_slug, |
1347 | 1347 | 'normal', |
1348 | 1348 | 'high' |
1349 | 1349 | ); |
1350 | 1350 | add_meta_box( |
1351 | 1351 | 'espresso_event_editor_event_options', |
1352 | - esc_html__( 'Event Registration Options', 'event_espresso' ), |
|
1353 | - array( $this, 'registration_options_meta_box' ), |
|
1352 | + esc_html__('Event Registration Options', 'event_espresso'), |
|
1353 | + array($this, 'registration_options_meta_box'), |
|
1354 | 1354 | $this->page_slug, |
1355 | 1355 | 'side', |
1356 | 1356 | 'default' |
@@ -1380,36 +1380,36 @@ discard block |
||
1380 | 1380 | 'disabled' => '' |
1381 | 1381 | ); |
1382 | 1382 | |
1383 | - $event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL; |
|
1383 | + $event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL; |
|
1384 | 1384 | |
1385 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1385 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1386 | 1386 | |
1387 | 1387 | /** |
1388 | 1388 | * 1. Start with retrieving Datetimes |
1389 | 1389 | * 2. Fore each datetime get related tickets |
1390 | 1390 | * 3. For each ticket get related prices |
1391 | 1391 | */ |
1392 | - $times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id ); |
|
1392 | + $times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id); |
|
1393 | 1393 | /** @type EE_Datetime $first_datetime */ |
1394 | - $first_datetime = reset( $times ); |
|
1394 | + $first_datetime = reset($times); |
|
1395 | 1395 | //do we get related tickets? |
1396 | - if ( $first_datetime instanceof EE_Datetime |
|
1397 | - && $first_datetime->ID() !== 0 ) { |
|
1396 | + if ($first_datetime instanceof EE_Datetime |
|
1397 | + && $first_datetime->ID() !== 0) { |
|
1398 | 1398 | $existing_datetime_ids[] = $first_datetime->get('DTT_ID'); |
1399 | 1399 | $template_args['time'] = $first_datetime; |
1400 | 1400 | $related_tickets = $first_datetime->tickets( |
1401 | 1401 | array( |
1402 | - array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), |
|
1402 | + array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), |
|
1403 | 1403 | 'default_where_conditions' => 'none' |
1404 | 1404 | ) |
1405 | 1405 | ); |
1406 | 1406 | |
1407 | - if ( !empty($related_tickets) ) { |
|
1407 | + if ( ! empty($related_tickets)) { |
|
1408 | 1408 | $template_args['total_ticket_rows'] = count($related_tickets); |
1409 | 1409 | $row = 0; |
1410 | - foreach ( $related_tickets as $ticket ) { |
|
1410 | + foreach ($related_tickets as $ticket) { |
|
1411 | 1411 | $existing_ticket_ids[] = $ticket->get('TKT_ID'); |
1412 | - $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row ); |
|
1412 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row); |
|
1413 | 1413 | |
1414 | 1414 | $row++; |
1415 | 1415 | } |
@@ -1417,13 +1417,13 @@ discard block |
||
1417 | 1417 | $template_args['total_ticket_rows'] = 1; |
1418 | 1418 | /** @type EE_Ticket $ticket */ |
1419 | 1419 | $ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object(); |
1420 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket ); |
|
1420 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket); |
|
1421 | 1421 | } |
1422 | 1422 | } else { |
1423 | 1423 | $template_args['time'] = $times[0]; |
1424 | 1424 | /** @type EE_Ticket $ticket */ |
1425 | 1425 | $ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
1426 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] ); |
|
1426 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]); |
|
1427 | 1427 | // NOTE: we're just sending the first default row |
1428 | 1428 | // (decaf can't manage default tickets so this should be sufficient); |
1429 | 1429 | } |
@@ -1432,8 +1432,8 @@ discard block |
||
1432 | 1432 | $template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info'); |
1433 | 1433 | $template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
1434 | 1434 | $template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
1435 | - $template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE ); |
|
1436 | - $template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' ); |
|
1435 | + $template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE); |
|
1436 | + $template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'); |
|
1437 | 1437 | EEH_Template::display_template($template, $template_args); |
1438 | 1438 | } |
1439 | 1439 | |
@@ -1448,21 +1448,21 @@ discard block |
||
1448 | 1448 | * @param int $row |
1449 | 1449 | * @return string generated html for the ticket row. |
1450 | 1450 | */ |
1451 | - private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) { |
|
1451 | + private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) { |
|
1452 | 1452 | $template_args = array( |
1453 | - 'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(), |
|
1454 | - 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '', |
|
1453 | + 'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(), |
|
1454 | + 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '', |
|
1455 | 1455 | 'ticketrow' => $skeleton ? 'TICKETNUM' : $row, |
1456 | 1456 | 'TKT_ID' => $ticket->get('TKT_ID'), |
1457 | 1457 | 'TKT_name' => $ticket->get('TKT_name'), |
1458 | 1458 | 'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'), |
1459 | 1459 | 'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'), |
1460 | 1460 | 'TKT_is_default' => $ticket->get('TKT_is_default'), |
1461 | - 'TKT_qty' => $ticket->get_pretty('TKT_qty','input'), |
|
1461 | + 'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'), |
|
1462 | 1462 | 'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets', |
1463 | 1463 | 'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'), |
1464 | - 'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
|
1465 | - 'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled' |
|
1464 | + 'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
|
1465 | + 'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled' |
|
1466 | 1466 | ); |
1467 | 1467 | |
1468 | 1468 | $price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object(); |
@@ -1478,23 +1478,23 @@ discard block |
||
1478 | 1478 | |
1479 | 1479 | //make sure we have default start and end dates if skeleton |
1480 | 1480 | //handle rows that should NOT be empty |
1481 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1481 | + if (empty($template_args['TKT_start_date'])) { |
|
1482 | 1482 | //if empty then the start date will be now. |
1483 | 1483 | $template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp')); |
1484 | 1484 | } |
1485 | 1485 | |
1486 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1486 | + if (empty($template_args['TKT_end_date'])) { |
|
1487 | 1487 | //get the earliest datetime (if present); |
1488 | - $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
|
1488 | + $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL; |
|
1489 | 1489 | |
1490 | - if ( !empty( $earliest_dtt ) ) |
|
1490 | + if ( ! empty($earliest_dtt)) |
|
1491 | 1491 | $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
1492 | 1492 | else |
1493 | - $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1493 | + $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y"))); |
|
1494 | 1494 | } |
1495 | 1495 | |
1496 | - $template_args = array_merge( $template_args, $price_args ); |
|
1497 | - $template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket); |
|
1496 | + $template_args = array_merge($template_args, $price_args); |
|
1497 | + $template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket); |
|
1498 | 1498 | return EEH_Template::display_template($template, $template_args, TRUE); |
1499 | 1499 | } |
1500 | 1500 | |
@@ -1523,8 +1523,8 @@ discard block |
||
1523 | 1523 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
1524 | 1524 | $template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description()); |
1525 | 1525 | $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false); |
1526 | - $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 ); |
|
1527 | - $templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php'; |
|
1526 | + $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); |
|
1527 | + $templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php'; |
|
1528 | 1528 | EEH_Template::display_template($templatepath, $template_args); |
1529 | 1529 | } |
1530 | 1530 | |
@@ -1552,21 +1552,21 @@ discard block |
||
1552 | 1552 | $EEME = $this->_event_model(); |
1553 | 1553 | |
1554 | 1554 | $offset = ($current_page - 1) * $per_page; |
1555 | - $limit = $count ? NULL : $offset . ',' . $per_page; |
|
1555 | + $limit = $count ? NULL : $offset.','.$per_page; |
|
1556 | 1556 | $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID'; |
1557 | 1557 | $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC"; |
1558 | 1558 | |
1559 | 1559 | if (isset($this->_req_data['month_range'])) { |
1560 | 1560 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
1561 | - $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1562 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
1561 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1562 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1563 | 1563 | } |
1564 | 1564 | |
1565 | 1565 | $where = array(); |
1566 | 1566 | |
1567 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
1567 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
1568 | 1568 | //determine what post_status our condition will have for the query. |
1569 | - switch ( $status ) { |
|
1569 | + switch ($status) { |
|
1570 | 1570 | case 'month' : |
1571 | 1571 | case 'today' : |
1572 | 1572 | case NULL : |
@@ -1574,7 +1574,7 @@ discard block |
||
1574 | 1574 | break; |
1575 | 1575 | |
1576 | 1576 | case 'draft' : |
1577 | - $where['status'] = array( 'IN', array('draft', 'auto-draft') ); |
|
1577 | + $where['status'] = array('IN', array('draft', 'auto-draft')); |
|
1578 | 1578 | break; |
1579 | 1579 | |
1580 | 1580 | default : |
@@ -1582,43 +1582,43 @@ discard block |
||
1582 | 1582 | } |
1583 | 1583 | |
1584 | 1584 | //categories? |
1585 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
1585 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
1586 | 1586 | |
1587 | - if ( !empty ( $category ) ) { |
|
1587 | + if ( ! empty ($category)) { |
|
1588 | 1588 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
1589 | 1589 | $where['Term_Taxonomy.term_id'] = $category; |
1590 | 1590 | } |
1591 | 1591 | |
1592 | 1592 | //date where conditions |
1593 | - $start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' ); |
|
1593 | + $start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start'); |
|
1594 | 1594 | if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') { |
1595 | - $DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) ); |
|
1596 | - $start = $DateTime->format( implode( ' ', $start_formats ) ); |
|
1597 | - $end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) ); |
|
1598 | - $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) ); |
|
1595 | + $DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone())); |
|
1596 | + $start = $DateTime->format(implode(' ', $start_formats)); |
|
1597 | + $end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1598 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1599 | 1599 | } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') { |
1600 | - $DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1601 | - $start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) ); |
|
1602 | - $end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1603 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1604 | - } else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) { |
|
1605 | - $now = date( 'Y-m-01' ); |
|
1606 | - $DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1607 | - $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
|
1608 | - $end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1609 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1600 | + $DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1601 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1602 | + $end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1603 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1604 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') { |
|
1605 | + $now = date('Y-m-01'); |
|
1606 | + $DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1607 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1608 | + $end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1609 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1610 | 1610 | } |
1611 | 1611 | |
1612 | 1612 | |
1613 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1614 | - $where['EVT_wp_user'] = get_current_user_id(); |
|
1613 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1614 | + $where['EVT_wp_user'] = get_current_user_id(); |
|
1615 | 1615 | } else { |
1616 | - if ( ! isset( $where['status'] ) ) { |
|
1617 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) { |
|
1616 | + if ( ! isset($where['status'])) { |
|
1617 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
1618 | 1618 | $where['OR'] = array( |
1619 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1619 | + 'status*restrict_private' => array('!=', 'private'), |
|
1620 | 1620 | 'AND' => array( |
1621 | - 'status*inclusive' => array( '=', 'private' ), |
|
1621 | + 'status*inclusive' => array('=', 'private'), |
|
1622 | 1622 | 'EVT_wp_user' => get_current_user_id() |
1623 | 1623 | ) |
1624 | 1624 | ); |
@@ -1626,16 +1626,16 @@ discard block |
||
1626 | 1626 | } |
1627 | 1627 | } |
1628 | 1628 | |
1629 | - if ( isset( $this->_req_data['EVT_wp_user'] ) ) { |
|
1630 | - if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1629 | + if (isset($this->_req_data['EVT_wp_user'])) { |
|
1630 | + if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1631 | 1631 | $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user']; |
1632 | 1632 | } |
1633 | 1633 | } |
1634 | 1634 | |
1635 | 1635 | |
1636 | 1636 | //search query handling |
1637 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1638 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1637 | + if (isset($this->_req_data['s'])) { |
|
1638 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1639 | 1639 | $where['OR'] = array( |
1640 | 1640 | 'EVT_name' => array('LIKE', $search_string), |
1641 | 1641 | 'EVT_desc' => array('LIKE', $search_string), |
@@ -1644,32 +1644,32 @@ discard block |
||
1644 | 1644 | } |
1645 | 1645 | |
1646 | 1646 | |
1647 | - $where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data ); |
|
1648 | - $query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data ); |
|
1647 | + $where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data); |
|
1648 | + $query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data); |
|
1649 | 1649 | |
1650 | 1650 | |
1651 | 1651 | //let's first check if we have special requests coming in. |
1652 | - if ( isset( $this->_req_data['active_status'] ) ) { |
|
1653 | - switch ( $this->_req_data['active_status'] ) { |
|
1652 | + if (isset($this->_req_data['active_status'])) { |
|
1653 | + switch ($this->_req_data['active_status']) { |
|
1654 | 1654 | case 'upcoming' : |
1655 | - return $EEME->get_upcoming_events( $query_params, $count ); |
|
1655 | + return $EEME->get_upcoming_events($query_params, $count); |
|
1656 | 1656 | break; |
1657 | 1657 | |
1658 | 1658 | case 'expired' : |
1659 | - return $EEME->get_expired_events( $query_params, $count ); |
|
1659 | + return $EEME->get_expired_events($query_params, $count); |
|
1660 | 1660 | break; |
1661 | 1661 | |
1662 | 1662 | case 'active' : |
1663 | - return $EEME->get_active_events( $query_params, $count ); |
|
1663 | + return $EEME->get_active_events($query_params, $count); |
|
1664 | 1664 | break; |
1665 | 1665 | |
1666 | 1666 | case 'inactive' : |
1667 | - return $EEME->get_inactive_events( $query_params, $count ); |
|
1667 | + return $EEME->get_inactive_events($query_params, $count); |
|
1668 | 1668 | break; |
1669 | 1669 | } |
1670 | 1670 | } |
1671 | 1671 | |
1672 | - $events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params ); |
|
1672 | + $events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params); |
|
1673 | 1673 | |
1674 | 1674 | return $events; |
1675 | 1675 | } |
@@ -1678,23 +1678,23 @@ discard block |
||
1678 | 1678 | |
1679 | 1679 | |
1680 | 1680 | //handling for WordPress CPT actions (trash, restore, delete) |
1681 | - public function trash_cpt_item( $post_id ) { |
|
1681 | + public function trash_cpt_item($post_id) { |
|
1682 | 1682 | $this->_req_data['EVT_ID'] = $post_id; |
1683 | - $this->_trash_or_restore_event( 'trash', FALSE ); |
|
1683 | + $this->_trash_or_restore_event('trash', FALSE); |
|
1684 | 1684 | } |
1685 | 1685 | |
1686 | 1686 | |
1687 | 1687 | |
1688 | 1688 | |
1689 | - public function restore_cpt_item( $post_id ) { |
|
1689 | + public function restore_cpt_item($post_id) { |
|
1690 | 1690 | $this->_req_data['EVT_ID'] = $post_id; |
1691 | - $this->_trash_or_restore_event( 'draft', FALSE ); |
|
1691 | + $this->_trash_or_restore_event('draft', FALSE); |
|
1692 | 1692 | } |
1693 | 1693 | |
1694 | 1694 | |
1695 | - public function delete_cpt_item( $post_id ) { |
|
1695 | + public function delete_cpt_item($post_id) { |
|
1696 | 1696 | $this->_req_data['EVT_ID'] = $post_id; |
1697 | - $this->_delete_event( FALSE ); |
|
1697 | + $this->_delete_event(FALSE); |
|
1698 | 1698 | } |
1699 | 1699 | |
1700 | 1700 | |
@@ -1706,7 +1706,7 @@ discard block |
||
1706 | 1706 | * @param string $event_status |
1707 | 1707 | * @return void |
1708 | 1708 | */ |
1709 | - protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) { |
|
1709 | + protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) { |
|
1710 | 1710 | //determine the event id and set to array. |
1711 | 1711 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE; |
1712 | 1712 | // loop thru events |
@@ -1714,7 +1714,7 @@ discard block |
||
1714 | 1714 | // clean status |
1715 | 1715 | $event_status = sanitize_key($event_status); |
1716 | 1716 | // grab status |
1717 | - if (!empty($event_status)) { |
|
1717 | + if ( ! empty($event_status)) { |
|
1718 | 1718 | $success = $this->_change_event_status($EVT_ID, $event_status); |
1719 | 1719 | } else { |
1720 | 1720 | $success = FALSE; |
@@ -1728,7 +1728,7 @@ discard block |
||
1728 | 1728 | } |
1729 | 1729 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1730 | 1730 | |
1731 | - if ( $redirect_after ) |
|
1731 | + if ($redirect_after) |
|
1732 | 1732 | $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
1733 | 1733 | } |
1734 | 1734 | |
@@ -1743,7 +1743,7 @@ discard block |
||
1743 | 1743 | // clean status |
1744 | 1744 | $event_status = sanitize_key($event_status); |
1745 | 1745 | // grab status |
1746 | - if (!empty($event_status)) { |
|
1746 | + if ( ! empty($event_status)) { |
|
1747 | 1747 | $success = TRUE; |
1748 | 1748 | //determine the event id and set to array. |
1749 | 1749 | $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
@@ -1753,7 +1753,7 @@ discard block |
||
1753 | 1753 | $results = $this->_change_event_status($EVT_ID, $event_status); |
1754 | 1754 | $success = $results !== FALSE ? $success : FALSE; |
1755 | 1755 | } else { |
1756 | - $msg = sprintf( esc_html__('An error occurred. Event #%d could not be moved to the trash because a valid event ID was not not supplied.', 'event_espresso'), $EVT_ID); |
|
1756 | + $msg = sprintf(esc_html__('An error occurred. Event #%d could not be moved to the trash because a valid event ID was not not supplied.', 'event_espresso'), $EVT_ID); |
|
1757 | 1757 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1758 | 1758 | $success = FALSE; |
1759 | 1759 | } |
@@ -1778,15 +1778,15 @@ discard block |
||
1778 | 1778 | * @param string $event_status |
1779 | 1779 | * @return bool |
1780 | 1780 | */ |
1781 | - private function _change_event_status( $EVT_ID = 0, $event_status = '') { |
|
1781 | + private function _change_event_status($EVT_ID = 0, $event_status = '') { |
|
1782 | 1782 | // grab event id |
1783 | - if (!$EVT_ID) { |
|
1783 | + if ( ! $EVT_ID) { |
|
1784 | 1784 | $msg = esc_html__('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso'); |
1785 | 1785 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1786 | 1786 | return FALSE; |
1787 | 1787 | } |
1788 | 1788 | |
1789 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1789 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1790 | 1790 | |
1791 | 1791 | // clean status |
1792 | 1792 | $event_status = sanitize_key($event_status); |
@@ -1812,11 +1812,11 @@ discard block |
||
1812 | 1812 | $hook = FALSE; |
1813 | 1813 | } |
1814 | 1814 | //use class to change status |
1815 | - $this->_cpt_model_obj->set_status( $event_status ); |
|
1815 | + $this->_cpt_model_obj->set_status($event_status); |
|
1816 | 1816 | $success = $this->_cpt_model_obj->save(); |
1817 | 1817 | |
1818 | 1818 | if ($success === FALSE) { |
1819 | - $msg = sprintf( esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action); |
|
1819 | + $msg = sprintf(esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action); |
|
1820 | 1820 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1821 | 1821 | return FALSE; |
1822 | 1822 | } |
@@ -1834,15 +1834,15 @@ discard block |
||
1834 | 1834 | * @access protected |
1835 | 1835 | * @param bool $redirect_after |
1836 | 1836 | */ |
1837 | - protected function _delete_event( $redirect_after = TRUE ) { |
|
1837 | + protected function _delete_event($redirect_after = TRUE) { |
|
1838 | 1838 | //determine the event id and set to array. |
1839 | 1839 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL; |
1840 | - $EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID; |
|
1840 | + $EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID; |
|
1841 | 1841 | |
1842 | 1842 | |
1843 | 1843 | // loop thru events |
1844 | 1844 | if ($EVT_ID) { |
1845 | - $success = $this->_permanently_delete_event( $EVT_ID ); |
|
1845 | + $success = $this->_permanently_delete_event($EVT_ID); |
|
1846 | 1846 | // get list of events with no prices |
1847 | 1847 | $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
1848 | 1848 | // remove this event from the list of events with no prices |
@@ -1856,7 +1856,7 @@ discard block |
||
1856 | 1856 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1857 | 1857 | } |
1858 | 1858 | |
1859 | - if ( $redirect_after ) |
|
1859 | + if ($redirect_after) |
|
1860 | 1860 | $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
1861 | 1861 | } |
1862 | 1862 | |
@@ -1874,12 +1874,12 @@ discard block |
||
1874 | 1874 | $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
1875 | 1875 | // loop thru events |
1876 | 1876 | foreach ($EVT_IDs as $EVT_ID) { |
1877 | - $EVT_ID = absint( $EVT_ID ); |
|
1878 | - if ( $EVT_ID ) { |
|
1879 | - $results = $this->_permanently_delete_event( $EVT_ID ); |
|
1877 | + $EVT_ID = absint($EVT_ID); |
|
1878 | + if ($EVT_ID) { |
|
1879 | + $results = $this->_permanently_delete_event($EVT_ID); |
|
1880 | 1880 | $success = $results !== FALSE ? $success : FALSE; |
1881 | 1881 | // remove this event from the list of events with no prices |
1882 | - unset( $espresso_no_ticket_prices[ $EVT_ID ] ); |
|
1882 | + unset($espresso_no_ticket_prices[$EVT_ID]); |
|
1883 | 1883 | } else { |
1884 | 1884 | $success = FALSE; |
1885 | 1885 | $msg = esc_html__('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso'); |
@@ -1899,9 +1899,9 @@ discard block |
||
1899 | 1899 | * @param int $EVT_ID |
1900 | 1900 | * @return bool |
1901 | 1901 | */ |
1902 | - private function _permanently_delete_event( $EVT_ID = 0 ) { |
|
1902 | + private function _permanently_delete_event($EVT_ID = 0) { |
|
1903 | 1903 | // grab event id |
1904 | - if ( ! $EVT_ID ) { |
|
1904 | + if ( ! $EVT_ID) { |
|
1905 | 1905 | $msg = esc_html__('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso'); |
1906 | 1906 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1907 | 1907 | return FALSE; |
@@ -1910,19 +1910,19 @@ discard block |
||
1910 | 1910 | ! $this->_cpt_model_obj instanceof EE_Event |
1911 | 1911 | || $this->_cpt_model_obj->ID() !== $EVT_ID |
1912 | 1912 | ) { |
1913 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1913 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1914 | 1914 | } |
1915 | 1915 | |
1916 | - if ( ! $this->_cpt_model_obj instanceof EE_Event ) { |
|
1916 | + if ( ! $this->_cpt_model_obj instanceof EE_Event) { |
|
1917 | 1917 | return false; |
1918 | 1918 | } |
1919 | 1919 | |
1920 | 1920 | //need to delete related tickets and prices first. |
1921 | 1921 | $datetimes = $this->_cpt_model_obj->get_many_related('Datetime'); |
1922 | - foreach ( $datetimes as $datetime ) { |
|
1922 | + foreach ($datetimes as $datetime) { |
|
1923 | 1923 | $this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime'); |
1924 | 1924 | $tickets = $datetime->get_many_related('Ticket'); |
1925 | - foreach ( $tickets as $ticket ) { |
|
1925 | + foreach ($tickets as $ticket) { |
|
1926 | 1926 | $ticket->_remove_relation_to($datetime, 'Datetime'); |
1927 | 1927 | $ticket->delete_related_permanently('Price'); |
1928 | 1928 | $ticket->delete_permanently(); |
@@ -1932,14 +1932,14 @@ discard block |
||
1932 | 1932 | |
1933 | 1933 | //what about related venues or terms? |
1934 | 1934 | $venues = $this->_cpt_model_obj->get_many_related('Venue'); |
1935 | - foreach ( $venues as $venue ) { |
|
1935 | + foreach ($venues as $venue) { |
|
1936 | 1936 | $this->_cpt_model_obj->_remove_relation_to($venue, 'Venue'); |
1937 | 1937 | } |
1938 | 1938 | |
1939 | 1939 | //any attached question groups? |
1940 | 1940 | $question_groups = $this->_cpt_model_obj->get_many_related('Question_Group'); |
1941 | - if ( !empty( $question_groups ) ) { |
|
1942 | - foreach ( $question_groups as $question_group ) { |
|
1941 | + if ( ! empty($question_groups)) { |
|
1942 | + foreach ($question_groups as $question_group) { |
|
1943 | 1943 | $this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group'); |
1944 | 1944 | } |
1945 | 1945 | } |
@@ -1948,26 +1948,26 @@ discard block |
||
1948 | 1948 | |
1949 | 1949 | |
1950 | 1950 | //Message Template Groups |
1951 | - $this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' ); |
|
1951 | + $this->_cpt_model_obj->_remove_relations('Message_Template_Group'); |
|
1952 | 1952 | |
1953 | 1953 | /** @type EE_Term_Taxonomy[] $term_taxonomies */ |
1954 | 1954 | $term_taxonomies = $this->_cpt_model_obj->term_taxonomies(); |
1955 | 1955 | |
1956 | - foreach ( $term_taxonomies as $term_taxonomy ) { |
|
1956 | + foreach ($term_taxonomies as $term_taxonomy) { |
|
1957 | 1957 | $this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy); |
1958 | 1958 | } |
1959 | 1959 | |
1960 | 1960 | $success = $this->_cpt_model_obj->delete_permanently(); |
1961 | 1961 | // did it all go as planned ? |
1962 | 1962 | if ($success) { |
1963 | - $msg = sprintf( esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID); |
|
1963 | + $msg = sprintf(esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID); |
|
1964 | 1964 | EE_Error::add_success($msg); |
1965 | 1965 | } else { |
1966 | - $msg = sprintf( esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'), $EVT_ID); |
|
1966 | + $msg = sprintf(esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'), $EVT_ID); |
|
1967 | 1967 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1968 | 1968 | return FALSE; |
1969 | 1969 | } |
1970 | - do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID ); |
|
1970 | + do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID); |
|
1971 | 1971 | return TRUE; |
1972 | 1972 | } |
1973 | 1973 | |
@@ -1984,7 +1984,7 @@ discard block |
||
1984 | 1984 | */ |
1985 | 1985 | public function total_events() { |
1986 | 1986 | |
1987 | - $count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
1987 | + $count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true); |
|
1988 | 1988 | return $count; |
1989 | 1989 | } |
1990 | 1990 | |
@@ -1999,10 +1999,10 @@ discard block |
||
1999 | 1999 | */ |
2000 | 2000 | public function total_events_draft() { |
2001 | 2001 | $where = array( |
2002 | - 'status' => array( 'IN', array('draft', 'auto-draft' ) ) |
|
2002 | + 'status' => array('IN', array('draft', 'auto-draft')) |
|
2003 | 2003 | ); |
2004 | 2004 | |
2005 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2005 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2006 | 2006 | return $count; |
2007 | 2007 | } |
2008 | 2008 | |
@@ -2021,7 +2021,7 @@ discard block |
||
2021 | 2021 | 'status' => 'trash' |
2022 | 2022 | ); |
2023 | 2023 | |
2024 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2024 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2025 | 2025 | return $count; |
2026 | 2026 | } |
2027 | 2027 | |
@@ -2049,11 +2049,11 @@ discard block |
||
2049 | 2049 | // translated |
2050 | 2050 | TRUE |
2051 | 2051 | ); |
2052 | - $this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment; |
|
2052 | + $this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment; |
|
2053 | 2053 | |
2054 | 2054 | $this->_set_add_edit_form_tags('update_default_event_settings'); |
2055 | 2055 | $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
2056 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE); |
|
2056 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE); |
|
2057 | 2057 | $this->display_admin_page_with_sidebar(); |
2058 | 2058 | } |
2059 | 2059 | |
@@ -2079,9 +2079,9 @@ discard block |
||
2079 | 2079 | |
2080 | 2080 | protected function _template_settings() { |
2081 | 2081 | $this->_admin_page_title = esc_html__('Template Settings (Preview)', 'event_espresso'); |
2082 | - $this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />'; |
|
2083 | - $this->_template_args['preview_text'] = '<strong>'.esc_html__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>'; |
|
2084 | - $this->display_admin_caf_preview_page( 'template_settings_tab' ); |
|
2082 | + $this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />'; |
|
2083 | + $this->_template_args['preview_text'] = '<strong>'.esc_html__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>'; |
|
2084 | + $this->display_admin_caf_preview_page('template_settings_tab'); |
|
2085 | 2085 | } |
2086 | 2086 | |
2087 | 2087 | |
@@ -2094,22 +2094,22 @@ discard block |
||
2094 | 2094 | * @return void |
2095 | 2095 | */ |
2096 | 2096 | private function _set_category_object() { |
2097 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
2097 | + if (isset($this->_category->id) && ! empty($this->_category->id)) |
|
2098 | 2098 | return; //already have the category object so get out. |
2099 | 2099 | |
2100 | 2100 | //set default category object |
2101 | 2101 | $this->_set_empty_category_object(); |
2102 | 2102 | |
2103 | 2103 | //only set if we've got an id |
2104 | - if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) { |
|
2104 | + if ( ! isset($this->_req_data['EVT_CAT_ID'])) { |
|
2105 | 2105 | return; |
2106 | 2106 | } |
2107 | 2107 | |
2108 | 2108 | $category_id = absint($this->_req_data['EVT_CAT_ID']); |
2109 | 2109 | |
2110 | - $term = get_term( $category_id, 'espresso_event_categories' ); |
|
2110 | + $term = get_term($category_id, 'espresso_event_categories'); |
|
2111 | 2111 | |
2112 | - if ( !empty( $term ) ) { |
|
2112 | + if ( ! empty($term)) { |
|
2113 | 2113 | $this->_category->category_name = $term->name; |
2114 | 2114 | $this->_category->category_identifier = $term->slug; |
2115 | 2115 | $this->_category->category_desc = $term->description; |
@@ -2123,13 +2123,13 @@ discard block |
||
2123 | 2123 | |
2124 | 2124 | private function _set_empty_category_object() { |
2125 | 2125 | $this->_category = new stdClass(); |
2126 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
2126 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
2127 | 2127 | $this->_category->id = $this->_category->parent = 0; |
2128 | 2128 | } |
2129 | 2129 | |
2130 | 2130 | |
2131 | 2131 | protected function _category_list_table() { |
2132 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2132 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2133 | 2133 | $this->_search_btn_label = esc_html__('Categories', 'event_espresso'); |
2134 | 2134 | $this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2'); |
2135 | 2135 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -2145,14 +2145,14 @@ discard block |
||
2145 | 2145 | $this->_set_add_edit_form_tags($route); |
2146 | 2146 | |
2147 | 2147 | $this->_set_category_object(); |
2148 | - $id = !empty($this->_category->id) ? $this->_category->id : ''; |
|
2148 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
2149 | 2149 | |
2150 | 2150 | $delete_action = 'delete_category'; |
2151 | 2151 | |
2152 | 2152 | //custom redirect |
2153 | - $redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url ); |
|
2153 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
2154 | 2154 | |
2155 | - $this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect ); |
|
2155 | + $this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect); |
|
2156 | 2156 | |
2157 | 2157 | //take care of contents |
2158 | 2158 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
@@ -2166,25 +2166,25 @@ discard block |
||
2166 | 2166 | 'type' => 'wp_editor', |
2167 | 2167 | 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
2168 | 2168 | 'class' => 'my_editor_custom', |
2169 | - 'wpeditor_args' => array('media_buttons' => FALSE ) |
|
2169 | + 'wpeditor_args' => array('media_buttons' => FALSE) |
|
2170 | 2170 | ); |
2171 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
2171 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
2172 | 2172 | |
2173 | - $all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) ); |
|
2173 | + $all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id))); |
|
2174 | 2174 | |
2175 | 2175 | //setup category select for term parents. |
2176 | 2176 | $category_select_values[] = array( |
2177 | 2177 | 'text' => esc_html__('No Parent', 'event_espresso'), |
2178 | 2178 | 'id' => 0 |
2179 | 2179 | ); |
2180 | - foreach ( $all_terms as $term ) { |
|
2180 | + foreach ($all_terms as $term) { |
|
2181 | 2181 | $category_select_values[] = array( |
2182 | 2182 | 'text' => $term->name, |
2183 | 2183 | 'id' => $term->term_id |
2184 | 2184 | ); |
2185 | 2185 | } |
2186 | 2186 | |
2187 | - $category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent ); |
|
2187 | + $category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent); |
|
2188 | 2188 | |
2189 | 2189 | $template_args = array( |
2190 | 2190 | 'category' => $this->_category, |
@@ -2194,15 +2194,15 @@ discard block |
||
2194 | 2194 | 'disable' => '', |
2195 | 2195 | 'disabled_message' => FALSE |
2196 | 2196 | ); |
2197 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
2198 | - return EEH_Template::display_template($template, $template_args, TRUE ); |
|
2197 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
2198 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
2199 | 2199 | } |
2200 | 2200 | |
2201 | 2201 | |
2202 | 2202 | protected function _delete_categories() { |
2203 | - $cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
2203 | + $cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
2204 | 2204 | |
2205 | - foreach ( $cat_ids as $cat_id ) { |
|
2205 | + foreach ($cat_ids as $cat_id) { |
|
2206 | 2206 | $this->_delete_category($cat_id); |
2207 | 2207 | } |
2208 | 2208 | |
@@ -2210,7 +2210,7 @@ discard block |
||
2210 | 2210 | $query_args = array( |
2211 | 2211 | 'action' => 'category_list' |
2212 | 2212 | ); |
2213 | - $this->_redirect_after_action(0,'','',$query_args); |
|
2213 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
2214 | 2214 | |
2215 | 2215 | } |
2216 | 2216 | |
@@ -2220,61 +2220,61 @@ discard block |
||
2220 | 2220 | |
2221 | 2221 | protected function _delete_category($cat_id) { |
2222 | 2222 | global $wpdb; |
2223 | - $cat_id = absint( $cat_id ); |
|
2224 | - wp_delete_term( $cat_id, 'espresso_event_categories' ); |
|
2223 | + $cat_id = absint($cat_id); |
|
2224 | + wp_delete_term($cat_id, 'espresso_event_categories'); |
|
2225 | 2225 | } |
2226 | 2226 | |
2227 | 2227 | |
2228 | 2228 | |
2229 | 2229 | protected function _insert_or_update_category($new_category) { |
2230 | 2230 | |
2231 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE ); |
|
2231 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE); |
|
2232 | 2232 | $success = 0; //we already have a success message so lets not send another. |
2233 | 2233 | |
2234 | - if ( $cat_id ) { |
|
2234 | + if ($cat_id) { |
|
2235 | 2235 | $query_args = array( |
2236 | 2236 | 'action' => 'edit_category', |
2237 | 2237 | 'EVT_CAT_ID' => $cat_id |
2238 | 2238 | ); |
2239 | 2239 | } else { |
2240 | - $query_args = array( 'action' => 'add_category' ); |
|
2240 | + $query_args = array('action' => 'add_category'); |
|
2241 | 2241 | } |
2242 | - $this->_redirect_after_action( $success, '','', $query_args, TRUE ); |
|
2242 | + $this->_redirect_after_action($success, '', '', $query_args, TRUE); |
|
2243 | 2243 | |
2244 | 2244 | } |
2245 | 2245 | |
2246 | 2246 | |
2247 | 2247 | |
2248 | - private function _insert_category( $update = FALSE ) { |
|
2248 | + private function _insert_category($update = FALSE) { |
|
2249 | 2249 | $cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : ''; |
2250 | - $category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
2251 | - $category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
2252 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
2250 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
2251 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
2252 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
2253 | 2253 | |
2254 | - if ( empty( $category_name ) ) { |
|
2255 | - $msg = esc_html__( 'You must add a name for the category.', 'event_espresso' ); |
|
2256 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2254 | + if (empty($category_name)) { |
|
2255 | + $msg = esc_html__('You must add a name for the category.', 'event_espresso'); |
|
2256 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2257 | 2257 | return false; |
2258 | 2258 | } |
2259 | 2259 | |
2260 | - $term_args=array( |
|
2260 | + $term_args = array( |
|
2261 | 2261 | 'name'=>$category_name, |
2262 | 2262 | 'description'=>$category_desc, |
2263 | 2263 | 'parent'=>$category_parent |
2264 | 2264 | ); |
2265 | 2265 | //was the category_identifier input disabled? |
2266 | - if(isset($this->_req_data['category_identifier'])){ |
|
2266 | + if (isset($this->_req_data['category_identifier'])) { |
|
2267 | 2267 | $term_args['slug'] = $this->_req_data['category_identifier']; |
2268 | 2268 | } |
2269 | - $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args ); |
|
2269 | + $insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args); |
|
2270 | 2270 | |
2271 | - if ( !is_array( $insert_ids ) ) { |
|
2272 | - $msg = esc_html__( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
2273 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2271 | + if ( ! is_array($insert_ids)) { |
|
2272 | + $msg = esc_html__('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
2273 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2274 | 2274 | } else { |
2275 | 2275 | $cat_id = $insert_ids['term_id']; |
2276 | - $msg = sprintf ( esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name ); |
|
2277 | - EE_Error::add_success( $msg ); |
|
2276 | + $msg = sprintf(esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name); |
|
2277 | + EE_Error::add_success($msg); |
|
2278 | 2278 | } |
2279 | 2279 | |
2280 | 2280 | return $cat_id; |
@@ -2283,32 +2283,32 @@ discard block |
||
2283 | 2283 | |
2284 | 2284 | |
2285 | 2285 | |
2286 | - public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
2286 | + public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) { |
|
2287 | 2287 | global $wpdb; |
2288 | 2288 | |
2289 | 2289 | //testing term stuff |
2290 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2291 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
2292 | - $limit = ($current_page-1)*$per_page; |
|
2290 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2291 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
2292 | + $limit = ($current_page - 1) * $per_page; |
|
2293 | 2293 | |
2294 | - $where = array( 'taxonomy' => 'espresso_event_categories' ); |
|
2294 | + $where = array('taxonomy' => 'espresso_event_categories'); |
|
2295 | 2295 | |
2296 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2297 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2296 | + if (isset($this->_req_data['s'])) { |
|
2297 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2298 | 2298 | $where['OR'] = array( |
2299 | - 'Term.name' => array( 'LIKE', $sstr), |
|
2300 | - 'description' => array( 'LIKE', $sstr ) |
|
2299 | + 'Term.name' => array('LIKE', $sstr), |
|
2300 | + 'description' => array('LIKE', $sstr) |
|
2301 | 2301 | ); |
2302 | 2302 | } |
2303 | 2303 | |
2304 | 2304 | $query_params = array( |
2305 | - $where , |
|
2306 | - 'order_by' => array( $orderby => $order ), |
|
2307 | - 'limit' => $limit . ',' . $per_page, |
|
2305 | + $where, |
|
2306 | + 'order_by' => array($orderby => $order), |
|
2307 | + 'limit' => $limit.','.$per_page, |
|
2308 | 2308 | 'force_join' => array('Term') |
2309 | 2309 | ); |
2310 | 2310 | |
2311 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
2311 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
2312 | 2312 | |
2313 | 2313 | return $categories; |
2314 | 2314 | } |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | * update_espresso_config |
374 | 374 | * |
375 | 375 | * @access public |
376 | - * @return bool |
|
376 | + * @return boolean|null |
|
377 | 377 | */ |
378 | 378 | protected function _reset_espresso_addon_config() { |
379 | 379 | $this->_addon_option_names = array(); |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | * @param string $name |
460 | 460 | * @param string $config_class |
461 | 461 | * @param EE_Config_Base $config_obj |
462 | - * @param array $tests_to_run |
|
462 | + * @param integer[] $tests_to_run |
|
463 | 463 | * @param bool $display_errors |
464 | 464 | * @return bool TRUE on success, FALSE on fail |
465 | 465 | */ |
@@ -1736,7 +1736,7 @@ discard block |
||
1736 | 1736 | |
1737 | 1737 | |
1738 | 1738 | /** |
1739 | - * @return array |
|
1739 | + * @return integer[] |
|
1740 | 1740 | */ |
1741 | 1741 | public function get_critical_pages_array() { |
1742 | 1742 | return array( |
@@ -1750,7 +1750,7 @@ discard block |
||
1750 | 1750 | |
1751 | 1751 | |
1752 | 1752 | /** |
1753 | - * @return array |
|
1753 | + * @return string[] |
|
1754 | 1754 | */ |
1755 | 1755 | public function get_critical_pages_shortcodes_array() { |
1756 | 1756 | return array( |
@@ -2785,7 +2785,7 @@ discard block |
||
2785 | 2785 | * according to max_input_vars |
2786 | 2786 | * |
2787 | 2787 | * @param int $input_count the count of input vars. |
2788 | - * @return array { |
|
2788 | + * @return string { |
|
2789 | 2789 | * An array that represents whether available space and if no available space the error |
2790 | 2790 | * message. |
2791 | 2791 | * @type bool $has_space whether more inputs can be added. |
@@ -2105,7 +2105,7 @@ discard block |
||
2105 | 2105 | public function __construct( $CNT_ISO = '' ) { |
2106 | 2106 | // get country code from organization settings or use default |
2107 | 2107 | $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
2108 | - && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2108 | + && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2109 | 2109 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2110 | 2110 | : ''; |
2111 | 2111 | // but override if requested |
@@ -2794,8 +2794,8 @@ discard block |
||
2794 | 2794 | */ |
2795 | 2795 | public function max_input_vars_limit_check( $input_count = 0 ) { |
2796 | 2796 | if ( ! empty( $this->php->max_input_vars ) |
2797 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2798 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2797 | + && ( $input_count >= $this->php->max_input_vars ) |
|
2798 | + && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2799 | 2799 | ) { |
2800 | 2800 | return sprintf( |
2801 | 2801 | __( |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public static function instance() { |
123 | 123 | // check if class object is instantiated, and instantiated properly |
124 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
124 | + if ( ! self::$_instance instanceof EE_Config) { |
|
125 | 125 | self::$_instance = new self(); |
126 | 126 | } |
127 | 127 | return self::$_instance; |
@@ -141,20 +141,20 @@ discard block |
||
141 | 141 | * site was put into maintenance mode) |
142 | 142 | * @return EE_Config |
143 | 143 | */ |
144 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
145 | - if ( $hard_reset ) { |
|
144 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
145 | + if ($hard_reset) { |
|
146 | 146 | self::$_instance->_addon_option_names = array(); |
147 | 147 | self::$_instance->_initialize_config(); |
148 | 148 | self::$_instance->update_espresso_config(); |
149 | 149 | } |
150 | - if ( self::$_instance instanceof EE_Config ) { |
|
150 | + if (self::$_instance instanceof EE_Config) { |
|
151 | 151 | self::$_instance->update_addon_option_names(); |
152 | 152 | } |
153 | 153 | self::$_instance = null; |
154 | 154 | //we don't need to reset the static properties imo because those should |
155 | 155 | //only change when a module is added or removed. Currently we don't |
156 | 156 | //support removing a module during a request when it previously existed |
157 | - if ( $reinstantiate ) { |
|
157 | + if ($reinstantiate) { |
|
158 | 158 | return self::instance(); |
159 | 159 | } else { |
160 | 160 | return null; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @return \EE_Config |
171 | 171 | */ |
172 | 172 | private function __construct() { |
173 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
173 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
174 | 174 | // setup empty config classes |
175 | 175 | $this->_initialize_config(); |
176 | 176 | // load existing EE site settings |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | // register shortcodes and modules |
181 | 181 | add_action( |
182 | 182 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
183 | - array( $this, 'register_shortcodes_and_modules' ), |
|
183 | + array($this, 'register_shortcodes_and_modules'), |
|
184 | 184 | 999 |
185 | 185 | ); |
186 | 186 | // initialize shortcodes and modules |
187 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
187 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
188 | 188 | // register widgets |
189 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
189 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
190 | 190 | // shutdown |
191 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
191 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
192 | 192 | // construct__end hook |
193 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
193 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
194 | 194 | // hardcoded hack |
195 | 195 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
196 | 196 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return string current theme set. |
204 | 204 | */ |
205 | 205 | public static function get_current_theme() { |
206 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
206 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
207 | 207 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
208 | 208 | } |
209 | 209 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | private function _initialize_config() { |
219 | 219 | EE_Config::trim_log(); |
220 | 220 | //set defaults |
221 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
221 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
222 | 222 | $this->addons = new stdClass(); |
223 | 223 | // set _module_route_map |
224 | 224 | EE_Config::$_module_route_map = array(); |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | */ |
239 | 239 | private function _load_core_config() { |
240 | 240 | // load_core_config__start hook |
241 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
241 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
242 | 242 | $espresso_config = $this->get_espresso_config(); |
243 | - foreach ( $espresso_config as $config => $settings ) { |
|
243 | + foreach ($espresso_config as $config => $settings) { |
|
244 | 244 | // load_core_config__start hook |
245 | 245 | $settings = apply_filters( |
246 | 246 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -248,22 +248,22 @@ discard block |
||
248 | 248 | $config, |
249 | 249 | $this |
250 | 250 | ); |
251 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
252 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
251 | + if (is_object($settings) && property_exists($this, $config)) { |
|
252 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
253 | 253 | //call configs populate method to ensure any defaults are set for empty values. |
254 | - if ( method_exists( $settings, 'populate' ) ) { |
|
254 | + if (method_exists($settings, 'populate')) { |
|
255 | 255 | $this->{$config}->populate(); |
256 | 256 | } |
257 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
257 | + if (method_exists($settings, 'do_hooks')) { |
|
258 | 258 | $this->{$config}->do_hooks(); |
259 | 259 | } |
260 | 260 | } |
261 | 261 | } |
262 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
262 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
263 | 263 | $this->update_espresso_config(); |
264 | 264 | } |
265 | 265 | // load_core_config__end hook |
266 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
266 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -278,23 +278,23 @@ discard block |
||
278 | 278 | $this->core = $this->core instanceof EE_Core_Config |
279 | 279 | ? $this->core |
280 | 280 | : new EE_Core_Config(); |
281 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
281 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
282 | 282 | $this->organization = $this->organization instanceof EE_Organization_Config |
283 | 283 | ? $this->organization |
284 | 284 | : new EE_Organization_Config(); |
285 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
285 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
286 | 286 | $this->currency = $this->currency instanceof EE_Currency_Config |
287 | 287 | ? $this->currency |
288 | 288 | : new EE_Currency_Config(); |
289 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
289 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
290 | 290 | $this->registration = $this->registration instanceof EE_Registration_Config |
291 | 291 | ? $this->registration |
292 | 292 | : new EE_Registration_Config(); |
293 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
293 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
294 | 294 | $this->admin = $this->admin instanceof EE_Admin_Config |
295 | 295 | ? $this->admin |
296 | 296 | : new EE_Admin_Config(); |
297 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
297 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
298 | 298 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
299 | 299 | ? $this->template_settings |
300 | 300 | : new EE_Template_Config(); |
@@ -305,15 +305,15 @@ discard block |
||
305 | 305 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
306 | 306 | ? $this->map_settings |
307 | 307 | : new EE_Map_Config(); |
308 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
308 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
309 | 309 | $this->environment = $this->environment instanceof EE_Environment_Config |
310 | 310 | ? $this->environment |
311 | 311 | : new EE_Environment_Config(); |
312 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
312 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
313 | 313 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
314 | 314 | ? $this->gateway |
315 | 315 | : new EE_Gateway_Config(); |
316 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
316 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | // grab espresso configuration |
329 | 329 | return apply_filters( |
330 | 330 | 'FHEE__EE_Config__get_espresso_config__CFG', |
331 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
331 | + get_option(EE_Config::OPTION_NAME, array()) |
|
332 | 332 | ); |
333 | 333 | } |
334 | 334 | |
@@ -342,12 +342,12 @@ discard block |
||
342 | 342 | * @param $old_value |
343 | 343 | * @param $value |
344 | 344 | */ |
345 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
345 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
346 | 346 | // make sure we're checking the ee config |
347 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
347 | + if ($option === EE_Config::OPTION_NAME) { |
|
348 | 348 | // run a loose comparison of the old value against the new value for type and properties, |
349 | 349 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
350 | - if ( $value != $old_value ) { |
|
350 | + if ($value != $old_value) { |
|
351 | 351 | // if they are NOT the same, then remove the hook, |
352 | 352 | // which means the subsequent update results will be based solely on the update query results |
353 | 353 | // the reason we do this is because, as stated above, |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | // the string it sees in the db looks the same as the new one it has been passed!!! |
363 | 363 | // This results in the query returning an "affected rows" value of ZERO, |
364 | 364 | // which gets returned immediately by WP update_option and looks like an error. |
365 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
365 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 | } |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | */ |
378 | 378 | protected function _reset_espresso_addon_config() { |
379 | 379 | $this->_addon_option_names = array(); |
380 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
381 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
382 | - $config_class = get_class( $addon_config_obj ); |
|
383 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
384 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
380 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
381 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
382 | + $config_class = get_class($addon_config_obj); |
|
383 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
384 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
385 | 385 | } |
386 | 386 | $this->addons->{$addon_name} = null; |
387 | 387 | } |
@@ -397,22 +397,22 @@ discard block |
||
397 | 397 | * @param bool $add_error |
398 | 398 | * @return bool |
399 | 399 | */ |
400 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
400 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
401 | 401 | // don't allow config updates during WP heartbeats |
402 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
402 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
403 | 403 | return false; |
404 | 404 | } |
405 | 405 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
406 | 406 | //$clone = clone( self::$_instance ); |
407 | 407 | //self::$_instance = NULL; |
408 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
408 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
409 | 409 | $this->_reset_espresso_addon_config(); |
410 | 410 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
411 | 411 | // but BEFORE the actual update occurs |
412 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
412 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
413 | 413 | // now update "ee_config" |
414 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
415 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
414 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
415 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
416 | 416 | // if not saved... check if the hook we just added still exists; |
417 | 417 | // if it does, it means one of two things: |
418 | 418 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -423,17 +423,17 @@ discard block |
||
423 | 423 | // but just means no update occurred, so don't display an error to the user. |
424 | 424 | // BUT... if update_option returns FALSE, AND the hook is missing, |
425 | 425 | // then it means that something truly went wrong |
426 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
426 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
427 | 427 | // remove our action since we don't want it in the system anymore |
428 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
429 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
428 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
429 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
430 | 430 | //self::$_instance = $clone; |
431 | 431 | //unset( $clone ); |
432 | 432 | // if config remains the same or was updated successfully |
433 | - if ( $saved ) { |
|
434 | - if ( $add_success ) { |
|
433 | + if ($saved) { |
|
434 | + if ($add_success) { |
|
435 | 435 | EE_Error::add_success( |
436 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
436 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
437 | 437 | __FILE__, |
438 | 438 | __FUNCTION__, |
439 | 439 | __LINE__ |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | } |
442 | 442 | return true; |
443 | 443 | } else { |
444 | - if ( $add_error ) { |
|
444 | + if ($add_error) { |
|
445 | 445 | EE_Error::add_error( |
446 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
446 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
447 | 447 | __FILE__, |
448 | 448 | __FUNCTION__, |
449 | 449 | __LINE__ |
@@ -472,16 +472,16 @@ discard block |
||
472 | 472 | $name = '', |
473 | 473 | $config_class = '', |
474 | 474 | $config_obj = null, |
475 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
475 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
476 | 476 | $display_errors = true |
477 | 477 | ) { |
478 | 478 | try { |
479 | - foreach ( $tests_to_run as $test ) { |
|
480 | - switch ( $test ) { |
|
479 | + foreach ($tests_to_run as $test) { |
|
480 | + switch ($test) { |
|
481 | 481 | // TEST #1 : check that section was set |
482 | 482 | case 1 : |
483 | - if ( empty( $section ) ) { |
|
484 | - if ( $display_errors ) { |
|
483 | + if (empty($section)) { |
|
484 | + if ($display_errors) { |
|
485 | 485 | throw new EE_Error( |
486 | 486 | sprintf( |
487 | 487 | __( |
@@ -497,11 +497,11 @@ discard block |
||
497 | 497 | break; |
498 | 498 | // TEST #2 : check that settings section exists |
499 | 499 | case 2 : |
500 | - if ( ! isset( $this->{$section} ) ) { |
|
501 | - if ( $display_errors ) { |
|
500 | + if ( ! isset($this->{$section} )) { |
|
501 | + if ($display_errors) { |
|
502 | 502 | throw new EE_Error( |
503 | 503 | sprintf( |
504 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
504 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
505 | 505 | $section |
506 | 506 | ) |
507 | 507 | ); |
@@ -512,9 +512,9 @@ discard block |
||
512 | 512 | // TEST #3 : check that section is the proper format |
513 | 513 | case 3 : |
514 | 514 | if ( |
515 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
515 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
516 | 516 | ) { |
517 | - if ( $display_errors ) { |
|
517 | + if ($display_errors) { |
|
518 | 518 | throw new EE_Error( |
519 | 519 | sprintf( |
520 | 520 | __( |
@@ -530,8 +530,8 @@ discard block |
||
530 | 530 | break; |
531 | 531 | // TEST #4 : check that config section name has been set |
532 | 532 | case 4 : |
533 | - if ( empty( $name ) ) { |
|
534 | - if ( $display_errors ) { |
|
533 | + if (empty($name)) { |
|
534 | + if ($display_errors) { |
|
535 | 535 | throw new EE_Error( |
536 | 536 | __( |
537 | 537 | 'No name has been provided for the specific configuration section.', |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | break; |
545 | 545 | // TEST #5 : check that a config class name has been set |
546 | 546 | case 5 : |
547 | - if ( empty( $config_class ) ) { |
|
548 | - if ( $display_errors ) { |
|
547 | + if (empty($config_class)) { |
|
548 | + if ($display_errors) { |
|
549 | 549 | throw new EE_Error( |
550 | 550 | __( |
551 | 551 | 'No class name has been provided for the specific configuration section.', |
@@ -558,8 +558,8 @@ discard block |
||
558 | 558 | break; |
559 | 559 | // TEST #6 : verify config class is accessible |
560 | 560 | case 6 : |
561 | - if ( ! class_exists( $config_class ) ) { |
|
562 | - if ( $display_errors ) { |
|
561 | + if ( ! class_exists($config_class)) { |
|
562 | + if ($display_errors) { |
|
563 | 563 | throw new EE_Error( |
564 | 564 | sprintf( |
565 | 565 | __( |
@@ -575,11 +575,11 @@ discard block |
||
575 | 575 | break; |
576 | 576 | // TEST #7 : check that config has even been set |
577 | 577 | case 7 : |
578 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
579 | - if ( $display_errors ) { |
|
578 | + if ( ! isset($this->{$section}->{$name} )) { |
|
579 | + if ($display_errors) { |
|
580 | 580 | throw new EE_Error( |
581 | 581 | sprintf( |
582 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
582 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
583 | 583 | $section, |
584 | 584 | $name |
585 | 585 | ) |
@@ -588,13 +588,13 @@ discard block |
||
588 | 588 | return false; |
589 | 589 | } else { |
590 | 590 | // and make sure it's not serialized |
591 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
591 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
592 | 592 | } |
593 | 593 | break; |
594 | 594 | // TEST #8 : check that config is the requested type |
595 | 595 | case 8 : |
596 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
597 | - if ( $display_errors ) { |
|
596 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
597 | + if ($display_errors) { |
|
598 | 598 | throw new EE_Error( |
599 | 599 | sprintf( |
600 | 600 | __( |
@@ -612,12 +612,12 @@ discard block |
||
612 | 612 | break; |
613 | 613 | // TEST #9 : verify config object |
614 | 614 | case 9 : |
615 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
616 | - if ( $display_errors ) { |
|
615 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
616 | + if ($display_errors) { |
|
617 | 617 | throw new EE_Error( |
618 | 618 | sprintf( |
619 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
620 | - print_r( $config_obj, true ) |
|
619 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
620 | + print_r($config_obj, true) |
|
621 | 621 | ) |
622 | 622 | ); |
623 | 623 | } |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | break; |
627 | 627 | } |
628 | 628 | } |
629 | - } catch ( EE_Error $e ) { |
|
629 | + } catch (EE_Error $e) { |
|
630 | 630 | $e->get_error(); |
631 | 631 | } |
632 | 632 | // you have successfully run the gauntlet |
@@ -643,8 +643,8 @@ discard block |
||
643 | 643 | * @param string $name |
644 | 644 | * @return string |
645 | 645 | */ |
646 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
647 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
646 | + private function _generate_config_option_name($section = '', $name = '') { |
|
647 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | |
@@ -658,10 +658,10 @@ discard block |
||
658 | 658 | * @param string $name |
659 | 659 | * @return string |
660 | 660 | */ |
661 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
662 | - return ! empty( $config_class ) |
|
661 | + private function _set_config_class($config_class = '', $name = '') { |
|
662 | + return ! empty($config_class) |
|
663 | 663 | ? $config_class |
664 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
664 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | |
@@ -676,36 +676,36 @@ discard block |
||
676 | 676 | * @param EE_Config_Base $config_obj |
677 | 677 | * @return EE_Config_Base |
678 | 678 | */ |
679 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
679 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
680 | 680 | // ensure config class is set to something |
681 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
681 | + $config_class = $this->_set_config_class($config_class, $name); |
|
682 | 682 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
683 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
683 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
684 | 684 | return null; |
685 | 685 | } |
686 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
686 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
687 | 687 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
688 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
689 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
688 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
689 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
690 | 690 | $this->update_addon_option_names(); |
691 | 691 | } |
692 | 692 | // verify the incoming config object but suppress errors |
693 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
693 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
694 | 694 | $config_obj = new $config_class(); |
695 | 695 | } |
696 | - if ( get_option( $config_option_name ) ) { |
|
697 | - EE_Config::log( $config_option_name ); |
|
698 | - update_option( $config_option_name, $config_obj ); |
|
696 | + if (get_option($config_option_name)) { |
|
697 | + EE_Config::log($config_option_name); |
|
698 | + update_option($config_option_name, $config_obj); |
|
699 | 699 | $this->{$section}->{$name} = $config_obj; |
700 | 700 | return $this->{$section}->{$name}; |
701 | 701 | } else { |
702 | 702 | // create a wp-option for this config |
703 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
704 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
703 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
704 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
705 | 705 | return $this->{$section}->{$name}; |
706 | 706 | } else { |
707 | 707 | EE_Error::add_error( |
708 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
708 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
709 | 709 | __FILE__, |
710 | 710 | __FUNCTION__, |
711 | 711 | __LINE__ |
@@ -728,44 +728,44 @@ discard block |
||
728 | 728 | * @param bool $throw_errors |
729 | 729 | * @return bool |
730 | 730 | */ |
731 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
731 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
732 | 732 | // don't allow config updates during WP heartbeats |
733 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
733 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
734 | 734 | return false; |
735 | 735 | } |
736 | - $config_obj = maybe_unserialize( $config_obj ); |
|
736 | + $config_obj = maybe_unserialize($config_obj); |
|
737 | 737 | // get class name of the incoming object |
738 | - $config_class = get_class( $config_obj ); |
|
738 | + $config_class = get_class($config_obj); |
|
739 | 739 | // run tests 1-5 and 9 to verify config |
740 | 740 | if ( ! $this->_verify_config_params( |
741 | 741 | $section, |
742 | 742 | $name, |
743 | 743 | $config_class, |
744 | 744 | $config_obj, |
745 | - array( 1, 2, 3, 4, 7, 9 ) |
|
745 | + array(1, 2, 3, 4, 7, 9) |
|
746 | 746 | ) |
747 | 747 | ) { |
748 | 748 | return false; |
749 | 749 | } |
750 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
750 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
751 | 751 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
752 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
752 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
753 | 753 | // save new config to db |
754 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
754 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
755 | 755 | } else { |
756 | 756 | // first check if the record already exists |
757 | - $existing_config = get_option( $config_option_name ); |
|
758 | - $config_obj = serialize( $config_obj ); |
|
757 | + $existing_config = get_option($config_option_name); |
|
758 | + $config_obj = serialize($config_obj); |
|
759 | 759 | // just return if db record is already up to date (NOT type safe comparison) |
760 | - if ( $existing_config == $config_obj ) { |
|
760 | + if ($existing_config == $config_obj) { |
|
761 | 761 | $this->{$section}->{$name} = $config_obj; |
762 | 762 | return true; |
763 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
764 | - EE_Config::log( $config_option_name ); |
|
763 | + } else if (update_option($config_option_name, $config_obj)) { |
|
764 | + EE_Config::log($config_option_name); |
|
765 | 765 | // update wp-option for this config class |
766 | 766 | $this->{$section}->{$name} = $config_obj; |
767 | 767 | return true; |
768 | - } elseif ( $throw_errors ) { |
|
768 | + } elseif ($throw_errors) { |
|
769 | 769 | EE_Error::add_error( |
770 | 770 | sprintf( |
771 | 771 | __( |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | 'event_espresso' |
774 | 774 | ), |
775 | 775 | $config_class, |
776 | - 'EE_Config->' . $section . '->' . $name |
|
776 | + 'EE_Config->'.$section.'->'.$name |
|
777 | 777 | ), |
778 | 778 | __FILE__, |
779 | 779 | __FUNCTION__, |
@@ -795,34 +795,34 @@ discard block |
||
795 | 795 | * @param string $config_class |
796 | 796 | * @return mixed EE_Config_Base | NULL |
797 | 797 | */ |
798 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
798 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
799 | 799 | // ensure config class is set to something |
800 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
800 | + $config_class = $this->_set_config_class($config_class, $name); |
|
801 | 801 | // run tests 1-4, 6 and 7 to verify that all params have been set |
802 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
802 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
803 | 803 | return null; |
804 | 804 | } |
805 | 805 | // now test if the requested config object exists, but suppress errors |
806 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
806 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
807 | 807 | // config already exists, so pass it back |
808 | 808 | return $this->{$section}->{$name}; |
809 | 809 | } |
810 | 810 | // load config option from db if it exists |
811 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
811 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
812 | 812 | // verify the newly retrieved config object, but suppress errors |
813 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
813 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
814 | 814 | // config is good, so set it and pass it back |
815 | 815 | $this->{$section}->{$name} = $config_obj; |
816 | 816 | return $this->{$section}->{$name}; |
817 | 817 | } |
818 | 818 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
819 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
819 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
820 | 820 | // verify the newly created config object |
821 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
821 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
822 | 822 | return $this->{$section}->{$name}; |
823 | 823 | } else { |
824 | 824 | EE_Error::add_error( |
825 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
825 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
826 | 826 | __FILE__, |
827 | 827 | __FUNCTION__, |
828 | 828 | __LINE__ |
@@ -840,11 +840,11 @@ discard block |
||
840 | 840 | * @param string $config_option_name |
841 | 841 | * @return mixed EE_Config_Base | FALSE |
842 | 842 | */ |
843 | - public function get_config_option( $config_option_name = '' ) { |
|
843 | + public function get_config_option($config_option_name = '') { |
|
844 | 844 | // retrieve the wp-option for this config class. |
845 | - $config_option = maybe_unserialize( get_option( $config_option_name, array() ) ); |
|
846 | - if ( empty( $config_option ) ) { |
|
847 | - EE_Config::log( $config_option_name . '-NOT-FOUND' ); |
|
845 | + $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
846 | + if (empty($config_option)) { |
|
847 | + EE_Config::log($config_option_name.'-NOT-FOUND'); |
|
848 | 848 | } |
849 | 849 | return $config_option; |
850 | 850 | } |
@@ -856,17 +856,17 @@ discard block |
||
856 | 856 | * |
857 | 857 | * @param string $config_option_name |
858 | 858 | */ |
859 | - public static function log( $config_option_name = '' ) { |
|
860 | - if ( ! empty( $config_option_name ) ) { |
|
861 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
859 | + public static function log($config_option_name = '') { |
|
860 | + if ( ! empty($config_option_name)) { |
|
861 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
862 | 862 | //copy incoming $_REQUEST and sanitize it so we can save it |
863 | 863 | $_request = $_REQUEST; |
864 | - array_walk_recursive( $_request, 'sanitize_text_field' ); |
|
865 | - $config_log[ (string) microtime( true ) ] = array( |
|
864 | + array_walk_recursive($_request, 'sanitize_text_field'); |
|
865 | + $config_log[(string) microtime(true)] = array( |
|
866 | 866 | 'config_name' => $config_option_name, |
867 | 867 | 'request' => $_request, |
868 | 868 | ); |
869 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
869 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
870 | 870 | } |
871 | 871 | } |
872 | 872 | |
@@ -877,12 +877,12 @@ discard block |
||
877 | 877 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
878 | 878 | */ |
879 | 879 | public static function trim_log() { |
880 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
881 | - $log_length = count( $config_log ); |
|
882 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
883 | - ksort( $config_log ); |
|
884 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
885 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
880 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
881 | + $log_length = count($config_log); |
|
882 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
883 | + ksort($config_log); |
|
884 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
885 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
886 | 886 | } |
887 | 887 | } |
888 | 888 | |
@@ -897,14 +897,14 @@ discard block |
||
897 | 897 | * @return string |
898 | 898 | */ |
899 | 899 | public static function get_page_for_posts() { |
900 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
901 | - if ( ! $page_for_posts ) { |
|
900 | + $page_for_posts = get_option('page_for_posts'); |
|
901 | + if ( ! $page_for_posts) { |
|
902 | 902 | return 'posts'; |
903 | 903 | } |
904 | 904 | /** @type WPDB $wpdb */ |
905 | 905 | global $wpdb; |
906 | 906 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
907 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
907 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
908 | 908 | } |
909 | 909 | |
910 | 910 | |
@@ -960,17 +960,17 @@ discard block |
||
960 | 960 | ) |
961 | 961 | ) { |
962 | 962 | // grab list of installed widgets |
963 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
963 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
964 | 964 | // filter list of modules to register |
965 | 965 | $widgets_to_register = apply_filters( |
966 | 966 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
967 | 967 | $widgets_to_register |
968 | 968 | ); |
969 | - if ( ! empty( $widgets_to_register ) ) { |
|
969 | + if ( ! empty($widgets_to_register)) { |
|
970 | 970 | // cycle thru widget folders |
971 | - foreach ( $widgets_to_register as $widget_path ) { |
|
971 | + foreach ($widgets_to_register as $widget_path) { |
|
972 | 972 | // add to list of installed widget modules |
973 | - EE_Config::register_ee_widget( $widget_path ); |
|
973 | + EE_Config::register_ee_widget($widget_path); |
|
974 | 974 | } |
975 | 975 | } |
976 | 976 | // filter list of installed modules |
@@ -990,57 +990,57 @@ discard block |
||
990 | 990 | * @param string $widget_path - full path up to and including widget folder |
991 | 991 | * @return void |
992 | 992 | */ |
993 | - public static function register_ee_widget( $widget_path = null ) { |
|
994 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
993 | + public static function register_ee_widget($widget_path = null) { |
|
994 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
995 | 995 | $widget_ext = '.widget.php'; |
996 | 996 | // make all separators match |
997 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
997 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
998 | 998 | // does the file path INCLUDE the actual file name as part of the path ? |
999 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
999 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
1000 | 1000 | // grab and shortcode file name from directory name and break apart at dots |
1001 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
1001 | + $file_name = explode('.', basename($widget_path)); |
|
1002 | 1002 | // take first segment from file name pieces and remove class prefix if it exists |
1003 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
1003 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
1004 | 1004 | // sanitize shortcode directory name |
1005 | - $widget = sanitize_key( $widget ); |
|
1005 | + $widget = sanitize_key($widget); |
|
1006 | 1006 | // now we need to rebuild the shortcode path |
1007 | - $widget_path = explode( DS, $widget_path ); |
|
1007 | + $widget_path = explode(DS, $widget_path); |
|
1008 | 1008 | // remove last segment |
1009 | - array_pop( $widget_path ); |
|
1009 | + array_pop($widget_path); |
|
1010 | 1010 | // glue it back together |
1011 | - $widget_path = implode( DS, $widget_path ); |
|
1011 | + $widget_path = implode(DS, $widget_path); |
|
1012 | 1012 | } else { |
1013 | 1013 | // grab and sanitize widget directory name |
1014 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
1014 | + $widget = sanitize_key(basename($widget_path)); |
|
1015 | 1015 | } |
1016 | 1016 | // create classname from widget directory name |
1017 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
1017 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1018 | 1018 | // add class prefix |
1019 | - $widget_class = 'EEW_' . $widget; |
|
1019 | + $widget_class = 'EEW_'.$widget; |
|
1020 | 1020 | // does the widget exist ? |
1021 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
1021 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
1022 | 1022 | $msg = sprintf( |
1023 | 1023 | __( |
1024 | 1024 | 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', |
1025 | 1025 | 'event_espresso' |
1026 | 1026 | ), |
1027 | 1027 | $widget_class, |
1028 | - $widget_path . DS . $widget_class . $widget_ext |
|
1028 | + $widget_path.DS.$widget_class.$widget_ext |
|
1029 | 1029 | ); |
1030 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1030 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1031 | 1031 | return; |
1032 | 1032 | } |
1033 | 1033 | // load the widget class file |
1034 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
1034 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
1035 | 1035 | // verify that class exists |
1036 | - if ( ! class_exists( $widget_class ) ) { |
|
1037 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
1038 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1036 | + if ( ! class_exists($widget_class)) { |
|
1037 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1038 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1039 | 1039 | return; |
1040 | 1040 | } |
1041 | - register_widget( $widget_class ); |
|
1041 | + register_widget($widget_class); |
|
1042 | 1042 | // add to array of registered widgets |
1043 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
1043 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | |
@@ -1053,17 +1053,17 @@ discard block |
||
1053 | 1053 | */ |
1054 | 1054 | private function _register_shortcodes() { |
1055 | 1055 | // grab list of installed shortcodes |
1056 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1056 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1057 | 1057 | // filter list of modules to register |
1058 | 1058 | $shortcodes_to_register = apply_filters( |
1059 | 1059 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
1060 | 1060 | $shortcodes_to_register |
1061 | 1061 | ); |
1062 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1062 | + if ( ! empty($shortcodes_to_register)) { |
|
1063 | 1063 | // cycle thru shortcode folders |
1064 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1064 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1065 | 1065 | // add to list of installed shortcode modules |
1066 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1066 | + EE_Config::register_shortcode($shortcode_path); |
|
1067 | 1067 | } |
1068 | 1068 | } |
1069 | 1069 | // filter list of installed modules |
@@ -1082,64 +1082,64 @@ discard block |
||
1082 | 1082 | * @param string $shortcode_path - full path up to and including shortcode folder |
1083 | 1083 | * @return bool |
1084 | 1084 | */ |
1085 | - public static function register_shortcode( $shortcode_path = null ) { |
|
1086 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
1085 | + public static function register_shortcode($shortcode_path = null) { |
|
1086 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1087 | 1087 | $shortcode_ext = '.shortcode.php'; |
1088 | 1088 | // make all separators match |
1089 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1089 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1090 | 1090 | // does the file path INCLUDE the actual file name as part of the path ? |
1091 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
1091 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
1092 | 1092 | // grab shortcode file name from directory name and break apart at dots |
1093 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
1093 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1094 | 1094 | // take first segment from file name pieces and remove class prefix if it exists |
1095 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
1096 | - ? substr( $shortcode_file[0], 4 ) |
|
1095 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
1096 | + ? substr($shortcode_file[0], 4) |
|
1097 | 1097 | : $shortcode_file[0]; |
1098 | 1098 | // sanitize shortcode directory name |
1099 | - $shortcode = sanitize_key( $shortcode ); |
|
1099 | + $shortcode = sanitize_key($shortcode); |
|
1100 | 1100 | // now we need to rebuild the shortcode path |
1101 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1101 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1102 | 1102 | // remove last segment |
1103 | - array_pop( $shortcode_path ); |
|
1103 | + array_pop($shortcode_path); |
|
1104 | 1104 | // glue it back together |
1105 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1105 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1106 | 1106 | } else { |
1107 | 1107 | // we need to generate the filename based off of the folder name |
1108 | 1108 | // grab and sanitize shortcode directory name |
1109 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
1110 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1109 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1110 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1111 | 1111 | } |
1112 | 1112 | // create classname from shortcode directory or file name |
1113 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
1113 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1114 | 1114 | // add class prefix |
1115 | - $shortcode_class = 'EES_' . $shortcode; |
|
1115 | + $shortcode_class = 'EES_'.$shortcode; |
|
1116 | 1116 | // does the shortcode exist ? |
1117 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
1117 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1118 | 1118 | $msg = sprintf( |
1119 | 1119 | __( |
1120 | 1120 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
1121 | 1121 | 'event_espresso' |
1122 | 1122 | ), |
1123 | 1123 | $shortcode_class, |
1124 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1124 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1125 | 1125 | ); |
1126 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1126 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1127 | 1127 | return false; |
1128 | 1128 | } |
1129 | 1129 | // load the shortcode class file |
1130 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1130 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1131 | 1131 | // verify that class exists |
1132 | - if ( ! class_exists( $shortcode_class ) ) { |
|
1132 | + if ( ! class_exists($shortcode_class)) { |
|
1133 | 1133 | $msg = sprintf( |
1134 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
1134 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
1135 | 1135 | $shortcode_class |
1136 | 1136 | ); |
1137 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1137 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1138 | 1138 | return false; |
1139 | 1139 | } |
1140 | - $shortcode = strtoupper( $shortcode ); |
|
1140 | + $shortcode = strtoupper($shortcode); |
|
1141 | 1141 | // add to array of registered shortcodes |
1142 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1142 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1143 | 1143 | return true; |
1144 | 1144 | } |
1145 | 1145 | |
@@ -1153,22 +1153,22 @@ discard block |
||
1153 | 1153 | */ |
1154 | 1154 | private function _register_modules() { |
1155 | 1155 | // grab list of installed modules |
1156 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1156 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1157 | 1157 | // filter list of modules to register |
1158 | 1158 | $modules_to_register = apply_filters( |
1159 | 1159 | 'FHEE__EE_Config__register_modules__modules_to_register', |
1160 | 1160 | $modules_to_register |
1161 | 1161 | ); |
1162 | - if ( ! empty( $modules_to_register ) ) { |
|
1162 | + if ( ! empty($modules_to_register)) { |
|
1163 | 1163 | // loop through folders |
1164 | - foreach ( $modules_to_register as $module_path ) { |
|
1164 | + foreach ($modules_to_register as $module_path) { |
|
1165 | 1165 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1166 | 1166 | if ( |
1167 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1168 | - && $module_path !== EE_MODULES . 'gateways' |
|
1167 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
1168 | + && $module_path !== EE_MODULES.'gateways' |
|
1169 | 1169 | ) { |
1170 | 1170 | // add to list of installed modules |
1171 | - EE_Config::register_module( $module_path ); |
|
1171 | + EE_Config::register_module($module_path); |
|
1172 | 1172 | } |
1173 | 1173 | } |
1174 | 1174 | } |
@@ -1188,39 +1188,39 @@ discard block |
||
1188 | 1188 | * @param string $module_path - full path up to and including module folder |
1189 | 1189 | * @return bool |
1190 | 1190 | */ |
1191 | - public static function register_module( $module_path = null ) { |
|
1192 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1191 | + public static function register_module($module_path = null) { |
|
1192 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1193 | 1193 | $module_ext = '.module.php'; |
1194 | 1194 | // make all separators match |
1195 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1195 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1196 | 1196 | // does the file path INCLUDE the actual file name as part of the path ? |
1197 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
1197 | + if (strpos($module_path, $module_ext) !== false) { |
|
1198 | 1198 | // grab and shortcode file name from directory name and break apart at dots |
1199 | - $module_file = explode( '.', basename( $module_path ) ); |
|
1199 | + $module_file = explode('.', basename($module_path)); |
|
1200 | 1200 | // now we need to rebuild the shortcode path |
1201 | - $module_path = explode( DS, $module_path ); |
|
1201 | + $module_path = explode(DS, $module_path); |
|
1202 | 1202 | // remove last segment |
1203 | - array_pop( $module_path ); |
|
1203 | + array_pop($module_path); |
|
1204 | 1204 | // glue it back together |
1205 | - $module_path = implode( DS, $module_path ) . DS; |
|
1205 | + $module_path = implode(DS, $module_path).DS; |
|
1206 | 1206 | // take first segment from file name pieces and sanitize it |
1207 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1207 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1208 | 1208 | // ensure class prefix is added |
1209 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1209 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1210 | 1210 | } else { |
1211 | 1211 | // we need to generate the filename based off of the folder name |
1212 | 1212 | // grab and sanitize module name |
1213 | - $module = strtolower( basename( $module_path ) ); |
|
1214 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
1213 | + $module = strtolower(basename($module_path)); |
|
1214 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1215 | 1215 | // like trailingslashit() |
1216 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1216 | + $module_path = rtrim($module_path, DS).DS; |
|
1217 | 1217 | // create classname from module directory name |
1218 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
1218 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1219 | 1219 | // add class prefix |
1220 | - $module_class = 'EED_' . $module; |
|
1220 | + $module_class = 'EED_'.$module; |
|
1221 | 1221 | } |
1222 | 1222 | // does the module exist ? |
1223 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
1223 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1224 | 1224 | $msg = sprintf( |
1225 | 1225 | __( |
1226 | 1226 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1228,19 +1228,19 @@ discard block |
||
1228 | 1228 | ), |
1229 | 1229 | $module |
1230 | 1230 | ); |
1231 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1231 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1232 | 1232 | return false; |
1233 | 1233 | } |
1234 | 1234 | // load the module class file |
1235 | - require_once( $module_path . $module_class . $module_ext ); |
|
1235 | + require_once($module_path.$module_class.$module_ext); |
|
1236 | 1236 | // verify that class exists |
1237 | - if ( ! class_exists( $module_class ) ) { |
|
1238 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1239 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1237 | + if ( ! class_exists($module_class)) { |
|
1238 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1239 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1240 | 1240 | return false; |
1241 | 1241 | } |
1242 | 1242 | // add to array of registered modules |
1243 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1243 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1244 | 1244 | do_action( |
1245 | 1245 | 'AHEE__EE_Config__register_module__complete', |
1246 | 1246 | $module_class, |
@@ -1260,26 +1260,26 @@ discard block |
||
1260 | 1260 | */ |
1261 | 1261 | private function _initialize_shortcodes() { |
1262 | 1262 | // cycle thru shortcode folders |
1263 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1263 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1264 | 1264 | // add class prefix |
1265 | - $shortcode_class = 'EES_' . $shortcode; |
|
1265 | + $shortcode_class = 'EES_'.$shortcode; |
|
1266 | 1266 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1267 | 1267 | // which set hooks ? |
1268 | - if ( is_admin() ) { |
|
1268 | + if (is_admin()) { |
|
1269 | 1269 | // fire immediately |
1270 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
1270 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1271 | 1271 | } else { |
1272 | 1272 | // delay until other systems are online |
1273 | 1273 | add_action( |
1274 | 1274 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1275 | - array( $shortcode_class, 'set_hooks' ) |
|
1275 | + array($shortcode_class, 'set_hooks') |
|
1276 | 1276 | ); |
1277 | 1277 | // convert classname to UPPERCASE and create WP shortcode. |
1278 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1278 | + $shortcode_tag = strtoupper($shortcode); |
|
1279 | 1279 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1280 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
1280 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1281 | 1281 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1282 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
1282 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1283 | 1283 | } |
1284 | 1284 | } |
1285 | 1285 | } |
@@ -1296,17 +1296,17 @@ discard block |
||
1296 | 1296 | */ |
1297 | 1297 | private function _initialize_modules() { |
1298 | 1298 | // cycle thru shortcode folders |
1299 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1299 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1300 | 1300 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1301 | 1301 | // which set hooks ? |
1302 | - if ( is_admin() ) { |
|
1302 | + if (is_admin()) { |
|
1303 | 1303 | // fire immediately |
1304 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
1304 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1305 | 1305 | } else { |
1306 | 1306 | // delay until other systems are online |
1307 | 1307 | add_action( |
1308 | 1308 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1309 | - array( $module_class, 'set_hooks' ) |
|
1309 | + array($module_class, 'set_hooks') |
|
1310 | 1310 | ); |
1311 | 1311 | } |
1312 | 1312 | } |
@@ -1324,29 +1324,29 @@ discard block |
||
1324 | 1324 | * @param string $key - url param key indicating a route is being called |
1325 | 1325 | * @return bool |
1326 | 1326 | */ |
1327 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
1328 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1329 | - $module = str_replace( 'EED_', '', $module ); |
|
1330 | - $module_class = 'EED_' . $module; |
|
1331 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
1332 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1333 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1327 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
1328 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1329 | + $module = str_replace('EED_', '', $module); |
|
1330 | + $module_class = 'EED_'.$module; |
|
1331 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1332 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1333 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1334 | 1334 | return false; |
1335 | 1335 | } |
1336 | - if ( empty( $route ) ) { |
|
1337 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1338 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1336 | + if (empty($route)) { |
|
1337 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1338 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1339 | 1339 | return false; |
1340 | 1340 | } |
1341 | - if ( ! method_exists( 'EED_' . $module, $method_name ) ) { |
|
1341 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1342 | 1342 | $msg = sprintf( |
1343 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
1343 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1344 | 1344 | $route |
1345 | 1345 | ); |
1346 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1346 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1347 | 1347 | return false; |
1348 | 1348 | } |
1349 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1349 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1350 | 1350 | return true; |
1351 | 1351 | } |
1352 | 1352 | |
@@ -1360,11 +1360,11 @@ discard block |
||
1360 | 1360 | * @param string $key - url param key indicating a route is being called |
1361 | 1361 | * @return string |
1362 | 1362 | */ |
1363 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
1364 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
1365 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
1366 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
1367 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1363 | + public static function get_route($route = null, $key = 'ee') { |
|
1364 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1365 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1366 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1367 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1368 | 1368 | } |
1369 | 1369 | return null; |
1370 | 1370 | } |
@@ -1394,49 +1394,49 @@ discard block |
||
1394 | 1394 | * @param string $key - url param key indicating a route is being called |
1395 | 1395 | * @return bool |
1396 | 1396 | */ |
1397 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
1398 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
1399 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1397 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
1398 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1399 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1400 | 1400 | $msg = sprintf( |
1401 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
1401 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1402 | 1402 | $route |
1403 | 1403 | ); |
1404 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1404 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1405 | 1405 | return false; |
1406 | 1406 | } |
1407 | - if ( empty( $forward ) ) { |
|
1408 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1409 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1407 | + if (empty($forward)) { |
|
1408 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1409 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1410 | 1410 | return false; |
1411 | 1411 | } |
1412 | - if ( is_array( $forward ) ) { |
|
1413 | - if ( ! isset( $forward[1] ) ) { |
|
1412 | + if (is_array($forward)) { |
|
1413 | + if ( ! isset($forward[1])) { |
|
1414 | 1414 | $msg = sprintf( |
1415 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
1415 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1416 | 1416 | $route |
1417 | 1417 | ); |
1418 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1418 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1419 | 1419 | return false; |
1420 | 1420 | } |
1421 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
1421 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1422 | 1422 | $msg = sprintf( |
1423 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1423 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1424 | 1424 | $forward[1], |
1425 | 1425 | $route |
1426 | 1426 | ); |
1427 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1427 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1428 | 1428 | return false; |
1429 | 1429 | } |
1430 | - } else if ( ! function_exists( $forward ) ) { |
|
1430 | + } else if ( ! function_exists($forward)) { |
|
1431 | 1431 | $msg = sprintf( |
1432 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1432 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1433 | 1433 | $forward, |
1434 | 1434 | $route |
1435 | 1435 | ); |
1436 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1436 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1437 | 1437 | return false; |
1438 | 1438 | } |
1439 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1439 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1440 | 1440 | return true; |
1441 | 1441 | } |
1442 | 1442 | |
@@ -1452,12 +1452,12 @@ discard block |
||
1452 | 1452 | * @param string $key - url param key indicating a route is being called |
1453 | 1453 | * @return string |
1454 | 1454 | */ |
1455 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
1456 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
1457 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
1455 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
1456 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1457 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1458 | 1458 | return apply_filters( |
1459 | 1459 | 'FHEE__EE_Config__get_forward', |
1460 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1460 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
1461 | 1461 | $route, |
1462 | 1462 | $status |
1463 | 1463 | ); |
@@ -1479,17 +1479,17 @@ discard block |
||
1479 | 1479 | * @param string $key - url param key indicating a route is being called |
1480 | 1480 | * @return bool |
1481 | 1481 | */ |
1482 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
1483 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
1484 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1482 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
1483 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1484 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1485 | 1485 | $msg = sprintf( |
1486 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
1486 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1487 | 1487 | $route |
1488 | 1488 | ); |
1489 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1489 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1490 | 1490 | return false; |
1491 | 1491 | } |
1492 | - if ( ! is_readable( $view ) ) { |
|
1492 | + if ( ! is_readable($view)) { |
|
1493 | 1493 | $msg = sprintf( |
1494 | 1494 | __( |
1495 | 1495 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1497,10 +1497,10 @@ discard block |
||
1497 | 1497 | ), |
1498 | 1498 | $view |
1499 | 1499 | ); |
1500 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1500 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1501 | 1501 | return false; |
1502 | 1502 | } |
1503 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1503 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1504 | 1504 | return true; |
1505 | 1505 | } |
1506 | 1506 | |
@@ -1516,12 +1516,12 @@ discard block |
||
1516 | 1516 | * @param string $key - url param key indicating a route is being called |
1517 | 1517 | * @return string |
1518 | 1518 | */ |
1519 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
1520 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
1521 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
1519 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
1520 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1521 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1522 | 1522 | return apply_filters( |
1523 | 1523 | 'FHEE__EE_Config__get_view', |
1524 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1524 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
1525 | 1525 | $route, |
1526 | 1526 | $status |
1527 | 1527 | ); |
@@ -1532,7 +1532,7 @@ discard block |
||
1532 | 1532 | |
1533 | 1533 | |
1534 | 1534 | public function update_addon_option_names() { |
1535 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
1535 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1536 | 1536 | } |
1537 | 1537 | |
1538 | 1538 | |
@@ -1560,22 +1560,22 @@ discard block |
||
1560 | 1560 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1561 | 1561 | * @throws \EE_Error |
1562 | 1562 | */ |
1563 | - public function get_pretty( $property ) { |
|
1564 | - if ( ! property_exists( $this, $property ) ) { |
|
1563 | + public function get_pretty($property) { |
|
1564 | + if ( ! property_exists($this, $property)) { |
|
1565 | 1565 | throw new EE_Error( |
1566 | 1566 | sprintf( |
1567 | 1567 | __( |
1568 | 1568 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
1569 | 1569 | 'event_espresso' |
1570 | 1570 | ), |
1571 | - get_class( $this ), |
|
1571 | + get_class($this), |
|
1572 | 1572 | $property |
1573 | 1573 | ) |
1574 | 1574 | ); |
1575 | 1575 | } |
1576 | 1576 | //just handling escaping of strings for now. |
1577 | - if ( is_string( $this->{$property} ) ) { |
|
1578 | - return stripslashes( $this->{$property} ); |
|
1577 | + if (is_string($this->{$property} )) { |
|
1578 | + return stripslashes($this->{$property} ); |
|
1579 | 1579 | } |
1580 | 1580 | return $this->{$property}; |
1581 | 1581 | } |
@@ -1584,17 +1584,17 @@ discard block |
||
1584 | 1584 | |
1585 | 1585 | public function populate() { |
1586 | 1586 | //grab defaults via a new instance of this class. |
1587 | - $class_name = get_class( $this ); |
|
1587 | + $class_name = get_class($this); |
|
1588 | 1588 | $defaults = new $class_name; |
1589 | 1589 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1590 | 1590 | //default from our $defaults object. |
1591 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1592 | - if ( $this->{$property} === null ) { |
|
1591 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1592 | + if ($this->{$property} === null) { |
|
1593 | 1593 | $this->{$property} = $value; |
1594 | 1594 | } |
1595 | 1595 | } |
1596 | 1596 | //cleanup |
1597 | - unset( $defaults ); |
|
1597 | + unset($defaults); |
|
1598 | 1598 | } |
1599 | 1599 | |
1600 | 1600 | |
@@ -1610,7 +1610,7 @@ discard block |
||
1610 | 1610 | * @param $a |
1611 | 1611 | * @return bool |
1612 | 1612 | */ |
1613 | - public function __isset( $a ) { |
|
1613 | + public function __isset($a) { |
|
1614 | 1614 | return false; |
1615 | 1615 | } |
1616 | 1616 | |
@@ -1622,7 +1622,7 @@ discard block |
||
1622 | 1622 | * @param $a |
1623 | 1623 | * @return bool |
1624 | 1624 | */ |
1625 | - public function __unset( $a ) { |
|
1625 | + public function __unset($a) { |
|
1626 | 1626 | return false; |
1627 | 1627 | } |
1628 | 1628 | |
@@ -1733,7 +1733,7 @@ discard block |
||
1733 | 1733 | $this->current_blog_id = get_current_blog_id(); |
1734 | 1734 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1735 | 1735 | $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin(); |
1736 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
1736 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1737 | 1737 | $this->post_shortcodes = array(); |
1738 | 1738 | $this->module_route_map = array(); |
1739 | 1739 | $this->module_forward_map = array(); |
@@ -1749,9 +1749,9 @@ discard block |
||
1749 | 1749 | $this->thank_you_page_url = ''; |
1750 | 1750 | $this->cancel_page_url = ''; |
1751 | 1751 | //cpt slugs |
1752 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
1752 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
1753 | 1753 | //ueip constant check |
1754 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1754 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1755 | 1755 | $this->ee_ueip_optin = false; |
1756 | 1756 | $this->ee_ueip_has_notified = true; |
1757 | 1757 | } |
@@ -1794,8 +1794,8 @@ discard block |
||
1794 | 1794 | * @return string |
1795 | 1795 | */ |
1796 | 1796 | public function reg_page_url() { |
1797 | - if ( ! $this->reg_page_url ) { |
|
1798 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
1797 | + if ( ! $this->reg_page_url) { |
|
1798 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
1799 | 1799 | } |
1800 | 1800 | return $this->reg_page_url; |
1801 | 1801 | } |
@@ -1810,12 +1810,12 @@ discard block |
||
1810 | 1810 | * @access public |
1811 | 1811 | * @return string |
1812 | 1812 | */ |
1813 | - public function txn_page_url( $query_args = array() ) { |
|
1814 | - if ( ! $this->txn_page_url ) { |
|
1815 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1813 | + public function txn_page_url($query_args = array()) { |
|
1814 | + if ( ! $this->txn_page_url) { |
|
1815 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1816 | 1816 | } |
1817 | - if ( $query_args ) { |
|
1818 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
1817 | + if ($query_args) { |
|
1818 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1819 | 1819 | } else { |
1820 | 1820 | return $this->txn_page_url; |
1821 | 1821 | } |
@@ -1831,12 +1831,12 @@ discard block |
||
1831 | 1831 | * @access public |
1832 | 1832 | * @return string |
1833 | 1833 | */ |
1834 | - public function thank_you_page_url( $query_args = array() ) { |
|
1835 | - if ( ! $this->thank_you_page_url ) { |
|
1836 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1834 | + public function thank_you_page_url($query_args = array()) { |
|
1835 | + if ( ! $this->thank_you_page_url) { |
|
1836 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1837 | 1837 | } |
1838 | - if ( $query_args ) { |
|
1839 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
1838 | + if ($query_args) { |
|
1839 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1840 | 1840 | } else { |
1841 | 1841 | return $this->thank_you_page_url; |
1842 | 1842 | } |
@@ -1851,8 +1851,8 @@ discard block |
||
1851 | 1851 | * @return string |
1852 | 1852 | */ |
1853 | 1853 | public function cancel_page_url() { |
1854 | - if ( ! $this->cancel_page_url ) { |
|
1855 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1854 | + if ( ! $this->cancel_page_url) { |
|
1855 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1856 | 1856 | } |
1857 | 1857 | return $this->cancel_page_url; |
1858 | 1858 | } |
@@ -1881,22 +1881,22 @@ discard block |
||
1881 | 1881 | */ |
1882 | 1882 | protected function _get_main_ee_ueip_optin() { |
1883 | 1883 | //if this is the main site then we can just bypass our direct query. |
1884 | - if ( is_main_site() ) { |
|
1885 | - return get_option( 'ee_ueip_optin', false ); |
|
1884 | + if (is_main_site()) { |
|
1885 | + return get_option('ee_ueip_optin', false); |
|
1886 | 1886 | } |
1887 | 1887 | |
1888 | 1888 | //is this already cached for this request? If so use it. |
1889 | - if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) { |
|
1889 | + if ( ! empty(EE_Core_Config::$ee_ueip_option)) { |
|
1890 | 1890 | return EE_Core_Config::$ee_ueip_option; |
1891 | 1891 | } |
1892 | 1892 | |
1893 | 1893 | global $wpdb; |
1894 | 1894 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
1895 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1895 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1896 | 1896 | $option = 'ee_ueip_optin'; |
1897 | 1897 | |
1898 | 1898 | //set correct table for query |
1899 | - $table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options'; |
|
1899 | + $table_name = $wpdb->get_blog_prefix($current_main_site_id).'options'; |
|
1900 | 1900 | |
1901 | 1901 | |
1902 | 1902 | //rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because |
@@ -1904,20 +1904,20 @@ discard block |
||
1904 | 1904 | //re-constructed on the blog switch. Note, we are still executing any core wp filters on this option retrieval. |
1905 | 1905 | //this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog |
1906 | 1906 | //for the purpose of caching. |
1907 | - $pre = apply_filters( 'pre_option_' . $option, false, $option ); |
|
1908 | - if ( false !== $pre ) { |
|
1907 | + $pre = apply_filters('pre_option_'.$option, false, $option); |
|
1908 | + if (false !== $pre) { |
|
1909 | 1909 | EE_Core_Config::$ee_ueip_option = $pre; |
1910 | 1910 | return EE_Core_Config::$ee_ueip_option; |
1911 | 1911 | } |
1912 | 1912 | |
1913 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) ); |
|
1914 | - if ( is_object( $row ) ) { |
|
1913 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option)); |
|
1914 | + if (is_object($row)) { |
|
1915 | 1915 | $value = $row->option_value; |
1916 | 1916 | } else { //option does not exist so use default. |
1917 | - return apply_filters( 'default_option_' . $option, false, $option ); |
|
1917 | + return apply_filters('default_option_'.$option, false, $option); |
|
1918 | 1918 | } |
1919 | 1919 | |
1920 | - EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option ); |
|
1920 | + EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option); |
|
1921 | 1921 | return EE_Core_Config::$ee_ueip_option; |
1922 | 1922 | } |
1923 | 1923 | |
@@ -1933,7 +1933,7 @@ discard block |
||
1933 | 1933 | //reset all url properties |
1934 | 1934 | $this->_reset_urls(); |
1935 | 1935 | //return what to save to db |
1936 | - return array_keys( get_object_vars( $this ) ); |
|
1936 | + return array_keys(get_object_vars($this)); |
|
1937 | 1937 | } |
1938 | 1938 | |
1939 | 1939 | } |
@@ -2081,14 +2081,14 @@ discard block |
||
2081 | 2081 | */ |
2082 | 2082 | public function __construct() { |
2083 | 2083 | // set default organization settings |
2084 | - $this->name = get_bloginfo( 'name' ); |
|
2084 | + $this->name = get_bloginfo('name'); |
|
2085 | 2085 | $this->address_1 = '123 Onna Road'; |
2086 | 2086 | $this->address_2 = 'PO Box 123'; |
2087 | 2087 | $this->city = 'Inna City'; |
2088 | 2088 | $this->STA_ID = 4; |
2089 | 2089 | $this->CNT_ISO = 'US'; |
2090 | 2090 | $this->zip = '12345'; |
2091 | - $this->email = get_bloginfo( 'admin_email' ); |
|
2091 | + $this->email = get_bloginfo('admin_email'); |
|
2092 | 2092 | $this->phone = ''; |
2093 | 2093 | $this->vat = '123456789'; |
2094 | 2094 | $this->logo_url = ''; |
@@ -2176,44 +2176,44 @@ discard block |
||
2176 | 2176 | * @param string $CNT_ISO |
2177 | 2177 | * @return \EE_Currency_Config |
2178 | 2178 | */ |
2179 | - public function __construct( $CNT_ISO = '' ) { |
|
2179 | + public function __construct($CNT_ISO = '') { |
|
2180 | 2180 | // get country code from organization settings or use default |
2181 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
2181 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2182 | 2182 | && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
2183 | 2183 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2184 | 2184 | : ''; |
2185 | 2185 | // but override if requested |
2186 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
2186 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2187 | 2187 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
2188 | 2188 | if ( |
2189 | - ! empty( $CNT_ISO ) |
|
2189 | + ! empty($CNT_ISO) |
|
2190 | 2190 | && EE_Maintenance_Mode::instance()->models_can_query() |
2191 | - && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
2191 | + && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table()) |
|
2192 | 2192 | ) { |
2193 | 2193 | // retrieve the country settings from the db, just in case they have been customized |
2194 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
2195 | - if ( $country instanceof EE_Country ) { |
|
2196 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2197 | - $this->name = $country->currency_name_single(); // Dollar |
|
2198 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2199 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2200 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2201 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2202 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2203 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2194 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2195 | + if ($country instanceof EE_Country) { |
|
2196 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2197 | + $this->name = $country->currency_name_single(); // Dollar |
|
2198 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2199 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2200 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2201 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2202 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2203 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2204 | 2204 | } |
2205 | 2205 | } |
2206 | 2206 | // fallback to hardcoded defaults, in case the above failed |
2207 | - if ( empty( $this->code ) ) { |
|
2207 | + if (empty($this->code)) { |
|
2208 | 2208 | // set default currency settings |
2209 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2210 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
2211 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
2212 | - $this->sign = '$'; // currency sign: $ |
|
2213 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2214 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2215 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2216 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2209 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2210 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
2211 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
2212 | + $this->sign = '$'; // currency sign: $ |
|
2213 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2214 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2215 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2216 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2217 | 2217 | } |
2218 | 2218 | } |
2219 | 2219 | } |
@@ -2376,7 +2376,7 @@ discard block |
||
2376 | 2376 | * @since 4.8.8.rc.019 |
2377 | 2377 | */ |
2378 | 2378 | public function do_hooks() { |
2379 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
2379 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2380 | 2380 | } |
2381 | 2381 | |
2382 | 2382 | |
@@ -2385,7 +2385,7 @@ discard block |
||
2385 | 2385 | * @return void |
2386 | 2386 | */ |
2387 | 2387 | public function set_default_reg_status_on_EEM_Event() { |
2388 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2388 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2389 | 2389 | } |
2390 | 2390 | |
2391 | 2391 | |
@@ -2490,10 +2490,10 @@ discard block |
||
2490 | 2490 | * @param bool $reset |
2491 | 2491 | * @return string |
2492 | 2492 | */ |
2493 | - public function log_file_name( $reset = false ) { |
|
2494 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2495 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2496 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2493 | + public function log_file_name($reset = false) { |
|
2494 | + if (empty($this->log_file_name) || $reset) { |
|
2495 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
2496 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2497 | 2497 | } |
2498 | 2498 | return $this->log_file_name; |
2499 | 2499 | } |
@@ -2504,10 +2504,10 @@ discard block |
||
2504 | 2504 | * @param bool $reset |
2505 | 2505 | * @return string |
2506 | 2506 | */ |
2507 | - public function debug_file_name( $reset = false ) { |
|
2508 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2509 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2510 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2507 | + public function debug_file_name($reset = false) { |
|
2508 | + if (empty($this->debug_file_name) || $reset) { |
|
2509 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
2510 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2511 | 2511 | } |
2512 | 2512 | return $this->debug_file_name; |
2513 | 2513 | } |
@@ -2679,21 +2679,21 @@ discard block |
||
2679 | 2679 | // set default map settings |
2680 | 2680 | $this->use_google_maps = true; |
2681 | 2681 | // for event details pages (reg page) |
2682 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2683 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2684 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2685 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2686 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2687 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2688 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2682 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2683 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2684 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2685 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2686 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2687 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2688 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2689 | 2689 | // for event list pages |
2690 | - $this->event_list_map_width = 300; // ee_map_width |
|
2691 | - $this->event_list_map_height = 185; // ee_map_height |
|
2692 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2693 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2694 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2695 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2696 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2690 | + $this->event_list_map_width = 300; // ee_map_width |
|
2691 | + $this->event_list_map_height = 185; // ee_map_height |
|
2692 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2693 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2694 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2695 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2696 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2697 | 2697 | } |
2698 | 2698 | |
2699 | 2699 | } |
@@ -2846,7 +2846,7 @@ discard block |
||
2846 | 2846 | * @return void |
2847 | 2847 | */ |
2848 | 2848 | protected function _set_php_values() { |
2849 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2849 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2850 | 2850 | $this->php->version = phpversion(); |
2851 | 2851 | } |
2852 | 2852 | |
@@ -2865,10 +2865,10 @@ discard block |
||
2865 | 2865 | * @type string $msg Any message to be displayed. |
2866 | 2866 | * } |
2867 | 2867 | */ |
2868 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2869 | - if ( ! empty( $this->php->max_input_vars ) |
|
2870 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2871 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2868 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2869 | + if ( ! empty($this->php->max_input_vars) |
|
2870 | + && ($input_count >= $this->php->max_input_vars) |
|
2871 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2872 | 2872 | ) { |
2873 | 2873 | return sprintf( |
2874 | 2874 | __( |
@@ -2934,7 +2934,7 @@ discard block |
||
2934 | 2934 | */ |
2935 | 2935 | public function __construct() { |
2936 | 2936 | $this->payment_settings = array(); |
2937 | - $this->active_gateways = array( 'Invoice' => false ); |
|
2937 | + $this->active_gateways = array('Invoice' => false); |
|
2938 | 2938 | } |
2939 | 2939 | } |
2940 | 2940 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -14,31 +14,31 @@ discard block |
||
14 | 14 | * @author Mike Nelson |
15 | 15 | * |
16 | 16 | */ |
17 | -class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form{ |
|
17 | +class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * |
21 | 21 | * @param EE_Payment_Method $payment_method |
22 | 22 | * @param array $options_array @see EE_Form_Section_Proper::__construct() |
23 | 23 | */ |
24 | - public function __construct( EE_Payment_Method $payment_method, $options_array= array()){ |
|
24 | + public function __construct(EE_Payment_Method $payment_method, $options_array = array()) { |
|
25 | 25 | $options_array['subsections'] = array_merge( |
26 | 26 | array( |
27 | - 'first_name' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __( 'First Name', 'event_espresso' ) ) ), |
|
28 | - 'last_name' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __( 'Last Name', 'event_espresso' ) ) ), |
|
29 | - 'email' => new EE_Email_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __( 'Email', 'event_espresso' ) ) ), |
|
30 | - 'address' => new EE_Text_Input( array( 'html_label_text'=> __( 'Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address' )), |
|
31 | - 'address2' => new EE_Text_Input( array( 'html_label_text'=> __( 'Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2' )), |
|
32 | - 'city' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __( 'City', 'event_espresso' ) ) ), |
|
33 | - 'state' => apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __( 'State', 'event_espresso' ) ) ) ), |
|
34 | - 'country' => apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __( 'Country', 'event_espresso' ) ) ) ), |
|
35 | - 'zip' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __( 'Zip', 'event_espresso' ) ) ), |
|
36 | - 'phone' => new EE_Text_Input( array( 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __( 'Phone', 'event_espresso' ) )), |
|
27 | + 'first_name' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __('First Name', 'event_espresso'))), |
|
28 | + 'last_name' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __('Last Name', 'event_espresso'))), |
|
29 | + 'email' => new EE_Email_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso'))), |
|
30 | + 'address' => new EE_Text_Input(array('html_label_text'=> __('Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address')), |
|
31 | + 'address2' => new EE_Text_Input(array('html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2')), |
|
32 | + 'city' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso'))), |
|
33 | + 'state' => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __('State', 'event_espresso')))), |
|
34 | + 'country' => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __('Country', 'event_espresso')))), |
|
35 | + 'zip' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso'))), |
|
36 | + 'phone' => new EE_Text_Input(array('html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso'))), |
|
37 | 37 | ), |
38 | - isset( $options_array['subsections'] ) ? $options_array['subsections'] : array() |
|
38 | + isset($options_array['subsections']) ? $options_array['subsections'] : array() |
|
39 | 39 | ); |
40 | 40 | |
41 | - parent::__construct( $payment_method, $options_array ); |
|
41 | + parent::__construct($payment_method, $options_array); |
|
42 | 42 | |
43 | 43 | } |
44 | 44 | |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | * Sets the defaults for the billing form according to the attendee's details |
47 | 47 | * @param EE_Attendee $attendee |
48 | 48 | */ |
49 | - public function populate_from_attendee( $attendee ){ |
|
49 | + public function populate_from_attendee($attendee) { |
|
50 | 50 | $attendee = EEM_Attendee::instance()->ensure_is_obj($attendee); |
51 | 51 | /** @var $attendee EE_Attendee */ |
52 | 52 | $this->populate_defaults( |
53 | - apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee', |
|
53 | + apply_filters('FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee', |
|
54 | 54 | array( |
55 | 55 | 'first_name'=>$attendee->fname(), |
56 | 56 | 'last_name'=>$attendee->lname(), |
@@ -78,48 +78,48 @@ discard block |
||
78 | 78 | * @param \EE_Attendee $attendee - the attendee object to copy details to |
79 | 79 | * @return \EE_Attendee |
80 | 80 | */ |
81 | - public function copy_billing_form_data_to_attendee( EE_Attendee $attendee ){ |
|
81 | + public function copy_billing_form_data_to_attendee(EE_Attendee $attendee) { |
|
82 | 82 | // grab billing form data |
83 | 83 | $data = $this->valid_data(); |
84 | 84 | // copy first_name |
85 | - if ( ! empty( $data['first_name'] )) { |
|
86 | - $attendee->set_fname( $data['first_name'] ); |
|
85 | + if ( ! empty($data['first_name'])) { |
|
86 | + $attendee->set_fname($data['first_name']); |
|
87 | 87 | } |
88 | 88 | // copy last_name |
89 | - if ( ! empty( $data['last_name'] )) { |
|
90 | - $attendee->set_lname( $data['last_name'] ); |
|
89 | + if ( ! empty($data['last_name'])) { |
|
90 | + $attendee->set_lname($data['last_name']); |
|
91 | 91 | } |
92 | 92 | // copy email |
93 | - if ( ! empty( $data['email'] )) { |
|
94 | - $attendee->set_email( $data['email'] ); |
|
93 | + if ( ! empty($data['email'])) { |
|
94 | + $attendee->set_email($data['email']); |
|
95 | 95 | } |
96 | 96 | // copy address |
97 | - if ( ! empty( $data['address'] )) { |
|
98 | - $attendee->set_address( $data['address'] ); |
|
97 | + if ( ! empty($data['address'])) { |
|
98 | + $attendee->set_address($data['address']); |
|
99 | 99 | } |
100 | 100 | // copy address2 |
101 | - if ( ! empty( $data['address2'] )) { |
|
102 | - $attendee->set_address2( $data['address2'] ); |
|
101 | + if ( ! empty($data['address2'])) { |
|
102 | + $attendee->set_address2($data['address2']); |
|
103 | 103 | } |
104 | 104 | // copy city |
105 | - if ( ! empty( $data['city'] )) { |
|
106 | - $attendee->set_city( $data['city'] ); |
|
105 | + if ( ! empty($data['city'])) { |
|
106 | + $attendee->set_city($data['city']); |
|
107 | 107 | } |
108 | 108 | // copy state |
109 | - if ( ! empty( $data['state'] )) { |
|
110 | - $attendee->set_state( $data['state'] ); |
|
109 | + if ( ! empty($data['state'])) { |
|
110 | + $attendee->set_state($data['state']); |
|
111 | 111 | } |
112 | 112 | // copy country |
113 | - if ( ! empty( $data['country'] )) { |
|
114 | - $attendee->set_country( $data['country'] ); |
|
113 | + if ( ! empty($data['country'])) { |
|
114 | + $attendee->set_country($data['country']); |
|
115 | 115 | } |
116 | 116 | // copy zip |
117 | - if ( ! empty( $data['zip'] )) { |
|
118 | - $attendee->set_zip( $data['zip'] ); |
|
117 | + if ( ! empty($data['zip'])) { |
|
118 | + $attendee->set_zip($data['zip']); |
|
119 | 119 | } |
120 | 120 | // copy phone |
121 | - if ( ! empty( $data['phone'] )) { |
|
122 | - $attendee->set_phone( $data['phone'] ); |
|
121 | + if ( ! empty($data['phone'])) { |
|
122 | + $attendee->set_phone($data['phone']); |
|
123 | 123 | } |
124 | 124 | return $attendee; |
125 | 125 | } |
@@ -130,20 +130,20 @@ discard block |
||
130 | 130 | * uses info from the billing form to create a new attendee |
131 | 131 | * @return \EE_Attendee |
132 | 132 | */ |
133 | - public function create_attendee_from_billing_form_data(){ |
|
133 | + public function create_attendee_from_billing_form_data() { |
|
134 | 134 | // grab billing form data |
135 | 135 | $data = $this->valid_data(); |
136 | - return EE_Attendee::new_instance( array( |
|
137 | - 'ATT_fname' => ! empty( $data['first_name'] ) ? $data['first_name'] : '', |
|
138 | - 'ATT_lname' => ! empty( $data['last_name'] ) ? $data['last_name'] : '', |
|
139 | - 'ATT_email' => ! empty( $data['email'] ) ? $data['email'] : '', |
|
140 | - 'ATT_address' => ! empty( $data['address'] ) ? $data['address'] : '', |
|
141 | - 'ATT_address2' => ! empty( $data['address2'] ) ? $data['address2'] : '', |
|
142 | - 'ATT_city' => ! empty( $data['city'] ) ? $data['city'] : '', |
|
143 | - 'STA_ID' => ! empty( $data['state'] ) ? $data['state'] : '', |
|
144 | - 'CNT_ISO' => ! empty( $data['country'] ) ? $data['country'] : '', |
|
145 | - 'ATT_zip' => ! empty( $data['zip'] ) ? $data['zip'] : '', |
|
146 | - 'ATT_phone' => ! empty( $data['phone'] ) ? $data['phone'] : '', |
|
136 | + return EE_Attendee::new_instance(array( |
|
137 | + 'ATT_fname' => ! empty($data['first_name']) ? $data['first_name'] : '', |
|
138 | + 'ATT_lname' => ! empty($data['last_name']) ? $data['last_name'] : '', |
|
139 | + 'ATT_email' => ! empty($data['email']) ? $data['email'] : '', |
|
140 | + 'ATT_address' => ! empty($data['address']) ? $data['address'] : '', |
|
141 | + 'ATT_address2' => ! empty($data['address2']) ? $data['address2'] : '', |
|
142 | + 'ATT_city' => ! empty($data['city']) ? $data['city'] : '', |
|
143 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : '', |
|
144 | + 'CNT_ISO' => ! empty($data['country']) ? $data['country'] : '', |
|
145 | + 'ATT_zip' => ! empty($data['zip']) ? $data['zip'] : '', |
|
146 | + 'ATT_phone' => ! empty($data['phone']) ? $data['phone'] : '', |
|
147 | 147 | )); |
148 | 148 | } |
149 | 149 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Conditionally_Required_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
11 | +class EE_Conditionally_Required_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Array describing conditions necessary to make the input required. |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | * @param string $validation_error_message |
25 | 25 | * @param array $requirement_conditions |
26 | 26 | */ |
27 | - public function __construct( $validation_error_message = null, $requirement_conditions = array() ) { |
|
28 | - if( ! $validation_error_message ){ |
|
27 | + public function __construct($validation_error_message = null, $requirement_conditions = array()) { |
|
28 | + if ( ! $validation_error_message) { |
|
29 | 29 | $validation_error_message = __("This field is required.", "event_espresso"); |
30 | 30 | } |
31 | - $this->set_requirement_conditions( $requirement_conditions ); |
|
32 | - parent::__construct( $validation_error_message ); |
|
31 | + $this->set_requirement_conditions($requirement_conditions); |
|
32 | + parent::__construct($validation_error_message); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @throws \EE_Validation_Error |
45 | 45 | */ |
46 | 46 | public function validate($normalized_value) { |
47 | - if( |
|
47 | + if ( |
|
48 | 48 | ( |
49 | 49 | $normalized_value === '' |
50 | 50 | || $normalized_value === null |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | ) |
53 | 53 | && $this->_input_is_required_server_side() |
54 | 54 | ) { |
55 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'required'); |
|
56 | - }else{ |
|
55 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
56 | + } else { |
|
57 | 57 | return true; |
58 | 58 | } |
59 | 59 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return array |
65 | 65 | * @throws \EE_Error |
66 | 66 | */ |
67 | - public function get_jquery_validation_rule_array(){ |
|
67 | + public function get_jquery_validation_rule_array() { |
|
68 | 68 | return array( |
69 | 69 | 'required'=> $this->_get_jquery_requirement_value(), |
70 | 70 | 'messages' => array( |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @param array $requirement_conditions |
84 | 84 | */ |
85 | - public function set_requirement_conditions( $requirement_conditions ) { |
|
85 | + public function set_requirement_conditions($requirement_conditions) { |
|
86 | 86 | $this->requirement_conditions = (array) $requirement_conditions; |
87 | 87 | } |
88 | 88 | |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | protected function _get_jquery_requirement_value() { |
109 | 109 | $requirement_value = ''; |
110 | 110 | $conditions = $this->get_requirement_conditions(); |
111 | - if( ! is_array( $conditions ) ){ |
|
111 | + if ( ! is_array($conditions)) { |
|
112 | 112 | EE_Error::throw_exception_if_debugging( |
113 | 113 | sprintf( |
114 | - __( 'Input requirement conditions must be an array. You provided %1$s', 'event_espresso' ), |
|
114 | + __('Input requirement conditions must be an array. You provided %1$s', 'event_espresso'), |
|
115 | 115 | $this->_input->name() |
116 | 116 | ), |
117 | 117 | __FILE__, |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | ); |
121 | 121 | return true; |
122 | 122 | } |
123 | - if( count( $conditions ) > 1 ) { |
|
123 | + if (count($conditions) > 1) { |
|
124 | 124 | EE_Error::throw_exception_if_debugging( |
125 | 125 | sprintf( |
126 | - __( 'Required Validation Strategy does not yet support multiple conditions. You should add it! The related input is %1$s', 'event_espresso' ), |
|
126 | + __('Required Validation Strategy does not yet support multiple conditions. You should add it! The related input is %1$s', 'event_espresso'), |
|
127 | 127 | $this->_input->name() |
128 | 128 | ), |
129 | 129 | __FILE__, |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | __LINE__ |
132 | 132 | ); |
133 | 133 | } |
134 | - foreach( $conditions as $input_path => $op_and_value ) { |
|
135 | - $input = $this->_input->find_section_from_path( $input_path ); |
|
136 | - if( ! $input instanceof EE_Form_Input_Base ) { |
|
134 | + foreach ($conditions as $input_path => $op_and_value) { |
|
135 | + $input = $this->_input->find_section_from_path($input_path); |
|
136 | + if ( ! $input instanceof EE_Form_Input_Base) { |
|
137 | 137 | EE_Error::throw_exception_if_debugging( |
138 | 138 | sprintf( |
139 | - __( 'Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'), |
|
139 | + __('Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'), |
|
140 | 140 | $this->_input->name(), |
141 | 141 | $input_path |
142 | 142 | ), |
@@ -146,14 +146,14 @@ discard block |
||
146 | 146 | ); |
147 | 147 | return false; |
148 | 148 | } |
149 | - list( $op, $value ) = $this->_validate_op_and_value( $op_and_value ); |
|
149 | + list($op, $value) = $this->_validate_op_and_value($op_and_value); |
|
150 | 150 | //ok now the jquery dependency expression depends on the input's display strategy. |
151 | - if( ! $input->get_display_strategy() instanceof EE_Select_Display_Strategy ) { |
|
151 | + if ( ! $input->get_display_strategy() instanceof EE_Select_Display_Strategy) { |
|
152 | 152 | EE_Error::throw_exception_if_debugging( |
153 | 153 | sprintf( |
154 | - __( 'Required Validation Strategy can only depend on another input which uses the EE_Select_Display_Strategy, but you specified a field "%1$s" that uses display strategy "%2$s". If you need others, please add support for it! The related input is %3$s', 'event_espresso' ), |
|
154 | + __('Required Validation Strategy can only depend on another input which uses the EE_Select_Display_Strategy, but you specified a field "%1$s" that uses display strategy "%2$s". If you need others, please add support for it! The related input is %3$s', 'event_espresso'), |
|
155 | 155 | $input->name(), |
156 | - get_class( $input->get_display_strategy() ), |
|
156 | + get_class($input->get_display_strategy()), |
|
157 | 157 | $this->_input->name() |
158 | 158 | ), |
159 | 159 | __FILE__, |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | __LINE__ |
162 | 162 | ); |
163 | 163 | } |
164 | - $requirement_value = $input->html_id( true ) . ' option[value="' . $value . '"]:selected'; |
|
164 | + $requirement_value = $input->html_id(true).' option[value="'.$value.'"]:selected'; |
|
165 | 165 | } |
166 | 166 | return $requirement_value; |
167 | 167 | } |
@@ -179,12 +179,12 @@ discard block |
||
179 | 179 | protected function _input_is_required_server_side() { |
180 | 180 | $meets_all_requirements = true; |
181 | 181 | $conditions = $this->get_requirement_conditions(); |
182 | - foreach( $conditions as $input_path => $op_and_value ) { |
|
183 | - $input = $this->_input->find_section_from_path( $input_path ); |
|
184 | - if( ! $input instanceof EE_Form_Input_Base ) { |
|
182 | + foreach ($conditions as $input_path => $op_and_value) { |
|
183 | + $input = $this->_input->find_section_from_path($input_path); |
|
184 | + if ( ! $input instanceof EE_Form_Input_Base) { |
|
185 | 185 | EE_Error::throw_exception_if_debugging( |
186 | 186 | sprintf( |
187 | - __( 'Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'), |
|
187 | + __('Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'), |
|
188 | 188 | $this->_input->name(), |
189 | 189 | $input_path |
190 | 190 | ), |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | ); |
195 | 195 | return false; |
196 | 196 | } |
197 | - list( $op, $value ) = $this->_validate_op_and_value( $op_and_value ); |
|
198 | - switch( $op ) { |
|
197 | + list($op, $value) = $this->_validate_op_and_value($op_and_value); |
|
198 | + switch ($op) { |
|
199 | 199 | case '=': |
200 | 200 | default: |
201 | 201 | $meets_all_requirements = $input->normalized_value() === $value; |
202 | 202 | } |
203 | - if( ! $meets_all_requirements ) { |
|
203 | + if ( ! $meets_all_requirements) { |
|
204 | 204 | break; |
205 | 205 | } |
206 | 206 | } |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | * @return array |
218 | 218 | * @throws \EE_Error |
219 | 219 | */ |
220 | - protected function _validate_op_and_value( $op_and_value ) { |
|
221 | - if( ! isset( $op_and_value[ 0 ], $op_and_value[ 1 ] ) ) { |
|
220 | + protected function _validate_op_and_value($op_and_value) { |
|
221 | + if ( ! isset($op_and_value[0], $op_and_value[1])) { |
|
222 | 222 | EE_Error::throw_exception_if_debugging( |
223 | 223 | sprintf( |
224 | - __( 'Required Validation Strategy conditions array\'s value must be an array with two elements: an operator, and a value. It didn\'t. The related input is %1$s', 'event_espresso' ), |
|
224 | + __('Required Validation Strategy conditions array\'s value must be an array with two elements: an operator, and a value. It didn\'t. The related input is %1$s', 'event_espresso'), |
|
225 | 225 | $this->_input->name() |
226 | 226 | ), |
227 | 227 | __FILE__, |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | __LINE__ |
230 | 230 | ); |
231 | 231 | } |
232 | - $operator = $op_and_value[ 0 ]; |
|
233 | - $value = (string) $op_and_value[ 1 ]; |
|
234 | - if( $operator !== '=' ) { |
|
232 | + $operator = $op_and_value[0]; |
|
233 | + $value = (string) $op_and_value[1]; |
|
234 | + if ($operator !== '=') { |
|
235 | 235 | EE_Error::throw_exception_if_debugging( |
236 | 236 | sprintf( |
237 | - __( 'Required Validation Strategy conditions can currently only use the equals operator. If you need others, please add support for it! The related input is %1$s', 'event_espresso' ), |
|
237 | + __('Required Validation Strategy conditions can currently only use the equals operator. If you need others, please add support for it! The related input is %1$s', 'event_espresso'), |
|
238 | 238 | $this->_input->name() |
239 | 239 | ), |
240 | 240 | __FILE__, |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | __LINE__ |
243 | 243 | ); |
244 | 244 | } |
245 | - return array( $operator, $value ); |
|
245 | + return array($operator, $value); |
|
246 | 246 | |
247 | 247 | } |
248 | 248 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | ! isset( $input_settings['include_whats_this_link'] ) |
34 | 34 | || ( |
35 | 35 | isset( $input_settings['include_whats_this_link'] ) |
36 | - && $input_settings['include_whats_this_link'] === true |
|
36 | + && $input_settings['include_whats_this_link'] === true |
|
37 | 37 | ) |
38 | 38 | ) { |
39 | 39 | $this->_html_label_text = sprintf( |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage |
9 | 9 | * @author Mike Nelson |
10 | 10 | */ |
11 | -class EE_CVV_Input extends EE_Text_Input{ |
|
11 | +class EE_CVV_Input extends EE_Text_Input { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param array $input_settings { |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | $this->set_sensitive_data_removal_strategy(new EE_CCV_Sensitive_Data_Removal()); |
20 | 20 | $this->_add_validation_strategy( |
21 | 21 | new EE_Text_Validation_Strategy( |
22 | - isset( $input_settings[ 'validation_error_message' ] ) |
|
23 | - ? $input_settings[ 'validation_error_message' ] |
|
22 | + isset($input_settings['validation_error_message']) |
|
23 | + ? $input_settings['validation_error_message'] |
|
24 | 24 | : __( |
25 | 25 | 'The CVV is either a 3 digit number on the back of your card, or 4 digit number on the front', |
26 | 26 | 'event_espresso' |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | ) |
30 | 30 | ); |
31 | 31 | parent::__construct($input_settings); |
32 | - if( |
|
33 | - ! isset( $input_settings['include_whats_this_link'] ) |
|
32 | + if ( |
|
33 | + ! isset($input_settings['include_whats_this_link']) |
|
34 | 34 | || ( |
35 | - isset( $input_settings['include_whats_this_link'] ) |
|
35 | + isset($input_settings['include_whats_this_link']) |
|
36 | 36 | && $input_settings['include_whats_this_link'] === true |
37 | 37 | ) |
38 | 38 | ) { |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @throws \EE_Error |
152 | 152 | */ |
153 | 153 | public function column_TXN_ID( EE_Transaction $item ){ |
154 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
154 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
155 | 155 | $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
156 | 156 | |
157 | 157 | //txn timestamp |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * @throws \EE_Error |
322 | 322 | */ |
323 | 323 | public function column_event_name( EE_Transaction $item ){ |
324 | - $actions = array(); |
|
324 | + $actions = array(); |
|
325 | 325 | $event = $item->primary_registration()->get_first_related('Event'); |
326 | 326 | if ( !empty( $event ) ) { |
327 | 327 | $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
@@ -350,18 +350,18 @@ discard block |
||
350 | 350 | */ |
351 | 351 | public function column_actions( EE_Transaction $item ){ |
352 | 352 | |
353 | - $registration = $item->primary_registration(); |
|
354 | - $attendee = $registration->attendee(); |
|
353 | + $registration = $item->primary_registration(); |
|
354 | + $attendee = $registration->attendee(); |
|
355 | 355 | |
356 | - //Build row actions |
|
356 | + //Build row actions |
|
357 | 357 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
358 | 358 | $dl_invoice_lnk_url = $registration->invoice_url(); |
359 | 359 | $dl_receipt_lnk_url = $registration->receipt_url(); |
360 | 360 | $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
361 | 361 | $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
362 | - $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
363 | - 'TXN_ID' => $item->ID() |
|
364 | - )); |
|
362 | + $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
363 | + 'TXN_ID' => $item->ID() |
|
364 | + )); |
|
365 | 365 | |
366 | 366 | //Build row actions |
367 | 367 | $view_lnk = ' |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | } |
435 | 435 | |
436 | 436 | return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
437 | - } |
|
437 | + } |
|
438 | 438 | |
439 | 439 | |
440 | 440 | } |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * @param \Transactions_Admin_Page $admin_page |
33 | 33 | */ |
34 | - public function __construct( \Transactions_Admin_Page $admin_page ){ |
|
35 | - parent::__construct( $admin_page ); |
|
34 | + public function __construct(\Transactions_Admin_Page $admin_page) { |
|
35 | + parent::__construct($admin_page); |
|
36 | 36 | $this->_status = $this->_admin_page->get_transaction_status_array(); |
37 | 37 | } |
38 | 38 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | *_setup_data |
43 | 43 | */ |
44 | 44 | protected function _setup_data() { |
45 | - $this->_data = $this->_admin_page->get_transactions( $this->_per_page ); |
|
46 | - $status = ! empty( $this->_req_data['status'] )? $this->_req_data['status'] : 'all'; |
|
47 | - $this->_all_data_count = $this->_admin_page->get_transactions( $this->_per_page, TRUE, $status ); |
|
45 | + $this->_data = $this->_admin_page->get_transactions($this->_per_page); |
|
46 | + $status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all'; |
|
47 | + $this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, TRUE, $status); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -59,25 +59,25 @@ discard block |
||
59 | 59 | 'ajax' => TRUE, |
60 | 60 | 'screen' => $this->_admin_page->get_current_screen()->id |
61 | 61 | ); |
62 | - $ID_column_name = __( 'ID', 'event_espresso' ); |
|
62 | + $ID_column_name = __('ID', 'event_espresso'); |
|
63 | 63 | $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">'; |
64 | - $ID_column_name .= __( 'Transaction Date', 'event_espresso' ); |
|
64 | + $ID_column_name .= __('Transaction Date', 'event_espresso'); |
|
65 | 65 | $ID_column_name .= '</span> '; |
66 | 66 | $this->_columns = array( |
67 | 67 | 'TXN_ID' => $ID_column_name, |
68 | - 'TXN_timestamp' => __( 'Transaction Date', 'event_espresso' ), |
|
69 | - 'TXN_total' => __( 'Total', 'event_espresso' ), |
|
70 | - 'TXN_paid' => __( 'Paid', 'event_espresso' ), |
|
71 | - 'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ), |
|
72 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
73 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
68 | + 'TXN_timestamp' => __('Transaction Date', 'event_espresso'), |
|
69 | + 'TXN_total' => __('Total', 'event_espresso'), |
|
70 | + 'TXN_paid' => __('Paid', 'event_espresso'), |
|
71 | + 'ATT_fname' => __('Primary Registrant', 'event_espresso'), |
|
72 | + 'event_name' => __('Event', 'event_espresso'), |
|
73 | + 'actions' => __('Actions', 'event_espresso') |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | $this->_sortable_columns = array( |
77 | - 'TXN_ID' => array( 'TXN_ID' => FALSE ), |
|
78 | - 'event_name' => array( 'event_name'=> FALSE ), |
|
79 | - 'ATT_fname' => array( 'ATT_fname'=> FALSE ), |
|
80 | - 'TXN_timestamp' => array( 'TXN_timestamp'=> TRUE ) //true means its already sorted |
|
77 | + 'TXN_ID' => array('TXN_ID' => FALSE), |
|
78 | + 'event_name' => array('event_name'=> FALSE), |
|
79 | + 'ATT_fname' => array('ATT_fname'=> FALSE), |
|
80 | + 'TXN_timestamp' => array('TXN_timestamp'=> TRUE) //true means its already sorted |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | $this->_primary_column = 'TXN_ID'; |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * @return string |
96 | 96 | * @throws \EE_Error |
97 | 97 | */ |
98 | - protected function _get_row_class( $item ) { |
|
99 | - $class = parent::_get_row_class( $item ); |
|
98 | + protected function _get_row_class($item) { |
|
99 | + $class = parent::_get_row_class($item); |
|
100 | 100 | //add status class |
101 | - $class .= ' ee-status-strip txn-status-' . $item->status_ID(); |
|
102 | - if ( $this->_has_checkbox_column ) { |
|
101 | + $class .= ' ee-status-strip txn-status-'.$item->status_ID(); |
|
102 | + if ($this->_has_checkbox_column) { |
|
103 | 103 | $class .= ' has-checkbox-column'; |
104 | 104 | } |
105 | 105 | return $class; |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | */ |
117 | 117 | protected function _get_table_filters() { |
118 | 118 | $filters = array(); |
119 | - $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' )); |
|
120 | - $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' ); |
|
119 | + $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year')); |
|
120 | + $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y'); |
|
121 | 121 | ob_start(); |
122 | 122 | ?> |
123 | 123 | <label for="txn-filter-start-date">Display Transactions from </label> |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | *_add_view_counts |
137 | 137 | */ |
138 | 138 | protected function _add_view_counts() { |
139 | - $this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' ); |
|
140 | - $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' ); |
|
141 | - $this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' ); |
|
139 | + $this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all'); |
|
140 | + $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned'); |
|
141 | + $this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed'); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | * @return string |
151 | 151 | * @throws \EE_Error |
152 | 152 | */ |
153 | - public function column_TXN_ID( EE_Transaction $item ){ |
|
154 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
155 | - $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
|
153 | + public function column_TXN_ID(EE_Transaction $item) { |
|
154 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
155 | + $content = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>'; |
|
156 | 156 | |
157 | 157 | //txn timestamp |
158 | - $content .= ' <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp( $item ) . '</span>'; |
|
158 | + $content .= ' <span class="show-on-mobile-view-only">'.$this->_get_txn_timestamp($item).'</span>'; |
|
159 | 159 | return $content; |
160 | 160 | } |
161 | 161 | |
@@ -166,18 +166,18 @@ discard block |
||
166 | 166 | * @return mixed|string|void |
167 | 167 | * @throws \EE_Error |
168 | 168 | */ |
169 | - protected function _get_txn_timestamp( EE_Transaction $item ) { |
|
169 | + protected function _get_txn_timestamp(EE_Transaction $item) { |
|
170 | 170 | //txn timestamp |
171 | 171 | // is TXN less than 2 hours old ? |
172 | 172 | if ( |
173 | - ( $item->failed() || $item->is_abandoned() ) |
|
173 | + ($item->failed() || $item->is_abandoned()) |
|
174 | 174 | && ( |
175 | - ( time() - EE_Registry::instance()->SSN->lifespan() ) < $item->datetime( false, true ) |
|
175 | + (time() - EE_Registry::instance()->SSN->lifespan()) < $item->datetime(false, true) |
|
176 | 176 | ) |
177 | 177 | ) { |
178 | - $timestamp = __( 'TXN in progress...', 'event_espresso' ); |
|
178 | + $timestamp = __('TXN in progress...', 'event_espresso'); |
|
179 | 179 | } else { |
180 | - $timestamp = $item->get_i18n_datetime( 'TXN_timestamp' ); |
|
180 | + $timestamp = $item->get_i18n_datetime('TXN_timestamp'); |
|
181 | 181 | } |
182 | 182 | return $timestamp; |
183 | 183 | } |
@@ -191,8 +191,8 @@ discard block |
||
191 | 191 | * @return string |
192 | 192 | * @throws \EE_Error |
193 | 193 | */ |
194 | - public function column_cb($item ){ |
|
195 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
194 | + public function column_cb($item) { |
|
195 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | * @return string |
205 | 205 | * @throws \EE_Error |
206 | 206 | */ |
207 | - public function column_TXN_timestamp( EE_Transaction $item ){ |
|
208 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
209 | - $txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $this->_get_txn_timestamp( $item ) . '</a>'; |
|
207 | + public function column_TXN_timestamp(EE_Transaction $item) { |
|
208 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
209 | + $txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$this->_get_txn_timestamp($item).'</a>'; |
|
210 | 210 | //status |
211 | - $txn_date .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
211 | + $txn_date .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
212 | 212 | return $txn_date; |
213 | 213 | } |
214 | 214 | |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | * @return string |
222 | 222 | * @throws \EE_Error |
223 | 223 | */ |
224 | - public function column_TXN_total( EE_Transaction $item ){ |
|
225 | - if ( $item->get('TXN_total') > 0 ) { |
|
226 | - return '<span class="txn-pad-rght">' . apply_filters( 'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item ) . '</span>'; |
|
224 | + public function column_TXN_total(EE_Transaction $item) { |
|
225 | + if ($item->get('TXN_total') > 0) { |
|
226 | + return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item).'</span>'; |
|
227 | 227 | } else { |
228 | - return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
228 | + return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>'; |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
@@ -238,17 +238,17 @@ discard block |
||
238 | 238 | * @return mixed|string |
239 | 239 | * @throws \EE_Error |
240 | 240 | */ |
241 | - public function column_TXN_paid( EE_Transaction $item ){ |
|
241 | + public function column_TXN_paid(EE_Transaction $item) { |
|
242 | 242 | $transaction_total = $item->get('TXN_total'); |
243 | 243 | $transaction_paid = $item->get('TXN_paid'); |
244 | 244 | |
245 | - if ( \EEH_Money::compare_floats( $transaction_total, 0,'>' ) ) { |
|
245 | + if (\EEH_Money::compare_floats($transaction_total, 0, '>')) { |
|
246 | 246 | // monies owing |
247 | 247 | $span_class = 'txn-overview-part-payment-spn'; |
248 | - if ( \EEH_Money::compare_floats( $transaction_paid, $transaction_total, '>=' ) ) { |
|
248 | + if (\EEH_Money::compare_floats($transaction_paid, $transaction_total, '>=')) { |
|
249 | 249 | // paid in full |
250 | 250 | $span_class = 'txn-overview-full-payment-spn'; |
251 | - } elseif ( \EEH_Money::compare_floats( $transaction_paid, 0, '==' ) ) { |
|
251 | + } elseif (\EEH_Money::compare_floats($transaction_paid, 0, '==')) { |
|
252 | 252 | // no payments made |
253 | 253 | $span_class = 'txn-overview-no-payment-spn'; |
254 | 254 | } |
@@ -258,11 +258,11 @@ discard block |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | $payment_method = $item->payment_method(); |
261 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
261 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
262 | 262 | |
263 | - $content = '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>'; |
|
264 | - if ( $transaction_paid > 0 ) { |
|
265 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
263 | + $content = '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>'; |
|
264 | + if ($transaction_paid > 0) { |
|
265 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
266 | 266 | } |
267 | 267 | return $content; |
268 | 268 | } |
@@ -276,13 +276,13 @@ discard block |
||
276 | 276 | * @return string|void |
277 | 277 | * @throws \EE_Error |
278 | 278 | */ |
279 | - public function column_ATT_fname( EE_Transaction $item ){ |
|
279 | + public function column_ATT_fname(EE_Transaction $item) { |
|
280 | 280 | $primary_reg = $item->primary_registration(); |
281 | 281 | $attendee = $primary_reg->get_first_related('Attendee'); |
282 | - if ( $attendee instanceof EE_Attendee ) { |
|
283 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL ); |
|
284 | - $content = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee->full_name() . '</a>' : $attendee->full_name(); |
|
285 | - $content .= '<br>' . $attendee->email(); |
|
282 | + if ($attendee instanceof EE_Attendee) { |
|
283 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL); |
|
284 | + $content = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name(); |
|
285 | + $content .= '<br>'.$attendee->email(); |
|
286 | 286 | return $content; |
287 | 287 | } |
288 | 288 | return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
@@ -297,13 +297,13 @@ discard block |
||
297 | 297 | * @return string|void |
298 | 298 | * @throws \EE_Error |
299 | 299 | */ |
300 | - public function column_ATT_email( EE_Transaction $item ){ |
|
300 | + public function column_ATT_email(EE_Transaction $item) { |
|
301 | 301 | $attendee = $item->primary_registration()->get_first_related('Attendee'); |
302 | - if ( ! empty( $attendee ) ) { |
|
303 | - return '<a href="mailto:' . $attendee->get( 'ATT_email' ) . '">' . $attendee->get( 'ATT_email' ) . '</a>'; |
|
302 | + if ( ! empty($attendee)) { |
|
303 | + return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>'; |
|
304 | 304 | } else { |
305 | 305 | return $item->failed() || $item->is_abandoned() |
306 | - ? __( 'no contact record.', 'event_espresso' ) |
|
306 | + ? __('no contact record.', 'event_espresso') |
|
307 | 307 | : __( |
308 | 308 | 'No contact record, because the transaction was abandoned or the registration process failed.', |
309 | 309 | 'event_espresso' |
@@ -320,20 +320,20 @@ discard block |
||
320 | 320 | * @return string|void |
321 | 321 | * @throws \EE_Error |
322 | 322 | */ |
323 | - public function column_event_name( EE_Transaction $item ){ |
|
323 | + public function column_event_name(EE_Transaction $item) { |
|
324 | 324 | $actions = array(); |
325 | 325 | $event = $item->primary_registration()->get_first_related('Event'); |
326 | - if ( !empty( $event ) ) { |
|
327 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
|
326 | + if ( ! empty($event)) { |
|
327 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL); |
|
328 | 328 | $event_name = $event->get('EVT_name'); |
329 | 329 | |
330 | 330 | //filter this view by transactions for this event |
331 | - $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) ); |
|
332 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) { |
|
333 | - $actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event', 'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>'; |
|
331 | + $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID())); |
|
332 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) { |
|
333 | + $actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event', 'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>'; |
|
334 | 334 | } |
335 | 335 | |
336 | - return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ? '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Edit Event: %s', 'event_espresso' ), $event->get('EVT_name') ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ), $this->row_actions($actions) ); |
|
336 | + return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s', 'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions)); |
|
337 | 337 | } else { |
338 | 338 | return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso'); |
339 | 339 | } |
@@ -348,35 +348,35 @@ discard block |
||
348 | 348 | * @return string |
349 | 349 | * @throws \EE_Error |
350 | 350 | */ |
351 | - public function column_actions( EE_Transaction $item ){ |
|
351 | + public function column_actions(EE_Transaction $item) { |
|
352 | 352 | |
353 | 353 | $registration = $item->primary_registration(); |
354 | 354 | $attendee = $registration->attendee(); |
355 | 355 | |
356 | 356 | //Build row actions |
357 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
357 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
358 | 358 | $dl_invoice_lnk_url = $registration->invoice_url(); |
359 | 359 | $dl_receipt_lnk_url = $registration->receipt_url(); |
360 | - $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
|
361 | - $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
362 | - $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
360 | + $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL); |
|
361 | + $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
362 | + $related_messages_link = EEH_MSG_Template::get_message_action_link('see_notifications_for', null, array( |
|
363 | 363 | 'TXN_ID' => $item->ID() |
364 | 364 | )); |
365 | 365 | |
366 | 366 | //Build row actions |
367 | 367 | $view_lnk = ' |
368 | 368 | <li> |
369 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text"> |
|
369 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text"> |
|
370 | 370 | <span class="dashicons dashicons-cart"></span> |
371 | 371 | </a> |
372 | 372 | </li>'; |
373 | 373 | |
374 | 374 | $dl_invoice_lnk = ''; |
375 | 375 | //only show invoice link if message type is active. |
376 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
376 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) { |
|
377 | 377 | $dl_invoice_lnk = ' |
378 | 378 | <li> |
379 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
379 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
380 | 380 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
381 | 381 | </a> |
382 | 382 | </li>'; |
@@ -384,17 +384,17 @@ discard block |
||
384 | 384 | |
385 | 385 | $dl_receipt_lnk = ''; |
386 | 386 | //only show receipt link if message type is active. |
387 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) { |
|
387 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) { |
|
388 | 388 | $dl_receipt_lnk = ' |
389 | 389 | <li> |
390 | - <a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
390 | + <a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
391 | 391 | <span class="dashicons dashicons-media-default ee-icon-size-18"></span> |
392 | 392 | </a> |
393 | 393 | </li>'; |
394 | 394 | } |
395 | 395 | |
396 | 396 | //only show payment reminder link if the message type is active. |
397 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
397 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
398 | 398 | $send_pay_lnk = $attendee instanceof EE_Attendee |
399 | 399 | && EE_Registry::instance()->CAP->current_user_can( |
400 | 400 | 'ee_send_message', |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | ) |
403 | 403 | ? ' |
404 | 404 | <li> |
405 | - <a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text"> |
|
405 | + <a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text"> |
|
406 | 406 | <span class="dashicons dashicons-email-alt"></span> |
407 | 407 | </a> |
408 | 408 | </li>' |
@@ -422,18 +422,18 @@ discard block |
||
422 | 422 | ) |
423 | 423 | ? ' |
424 | 424 | <li> |
425 | - <a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
425 | + <a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
426 | 426 | <span class="dashicons dashicons-clipboard"></span> |
427 | 427 | </a> |
428 | 428 | </li>' |
429 | 429 | : ''; |
430 | 430 | |
431 | 431 | $view_related_messages_lnk = ''; |
432 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
433 | - $view_related_messages_lnk = '<li>' . $related_messages_link . '</li>'; |
|
432 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
433 | + $view_related_messages_lnk = '<li>'.$related_messages_link.'</li>'; |
|
434 | 434 | } |
435 | 435 | |
436 | - return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
|
436 | + return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk.$view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul'); |
|
437 | 437 | } |
438 | 438 | |
439 | 439 |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | * @return string |
371 | 371 | * @throws \EE_Error |
372 | 372 | */ |
373 | - public function column_cb($item){ |
|
373 | + public function column_cb($item){ |
|
374 | 374 | /** checkbox/lock **/ |
375 | 375 | $transaction = $item->get_first_related( 'Transaction' ); |
376 | 376 | $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
377 | - return $payment_count > 0 |
|
378 | - ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) |
|
379 | - . '<span class="ee-lock-icon"></span>' |
|
380 | - : sprintf( |
|
381 | - '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', |
|
382 | - $item->ID() |
|
383 | - ); |
|
384 | - } |
|
377 | + return $payment_count > 0 |
|
378 | + ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) |
|
379 | + . '<span class="ee-lock-icon"></span>' |
|
380 | + : sprintf( |
|
381 | + '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', |
|
382 | + $item->ID() |
|
383 | + ); |
|
384 | + } |
|
385 | 385 | |
386 | 386 | |
387 | 387 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | */ |
418 | 418 | public function column__REG_date(EE_Registration $item){ |
419 | 419 | $this->_set_related_details($item); |
420 | - //Build row actions |
|
420 | + //Build row actions |
|
421 | 421 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
422 | 422 | $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
423 | 423 | $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | } else { |
472 | 472 | return __( 'There is no ticket on this registration', 'event_espresso' ); |
473 | 473 | } |
474 | - } |
|
474 | + } |
|
475 | 475 | |
476 | 476 | |
477 | 477 | |
@@ -494,14 +494,14 @@ discard block |
||
494 | 494 | $t = $item->get_first_related('Transaction'); |
495 | 495 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
496 | 496 | |
497 | - //append group count to name |
|
498 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
497 | + //append group count to name |
|
498 | + $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
499 | 499 | |
500 | - //append reg_code |
|
501 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
500 | + //append reg_code |
|
501 | + $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
502 | 502 | |
503 | - //reg status text for accessibility |
|
504 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
503 | + //reg status text for accessibility |
|
504 | + $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
505 | 505 | |
506 | 506 | //trash/restore/delete actions |
507 | 507 | $actions = array(); |
@@ -731,14 +731,14 @@ discard block |
||
731 | 731 | //message list table link (filtered by REG_ID |
732 | 732 | if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_messages', 'view_filtered_messages' ) ) { |
733 | 733 | $filtered_messages_link = '<li>' |
734 | - . EEH_MSG_Template::get_message_action_link( |
|
734 | + . EEH_MSG_Template::get_message_action_link( |
|
735 | 735 | 'see_notifications_for', |
736 | 736 | null, |
737 | 737 | array( |
738 | 738 | '_REG_ID' => $item->ID() |
739 | 739 | ) |
740 | 740 | ) |
741 | - . '</li>'; |
|
741 | + . '</li>'; |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk . $dl_invoice_lnk . $filtered_messages_link, $item, 'ul', 'reg-overview-actions-ul' ); |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | /** |
55 | 55 | * @param \Registrations_Admin_Page $admin_page |
56 | 56 | */ |
57 | - public function __construct( Registrations_Admin_Page $admin_page ){ |
|
58 | - if ( ! empty( $_GET['event_id'] ) ) { |
|
57 | + public function __construct(Registrations_Admin_Page $admin_page) { |
|
58 | + if ( ! empty($_GET['event_id'])) { |
|
59 | 59 | $extra_query_args = array(); |
60 | - foreach ( $admin_page->get_views() as $key => $view_details ) { |
|
61 | - $extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] ); |
|
60 | + foreach ($admin_page->get_views() as $key => $view_details) { |
|
61 | + $extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']); |
|
62 | 62 | } |
63 | - $this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args ); |
|
63 | + $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
64 | 64 | } |
65 | 65 | parent::__construct($admin_page); |
66 | 66 | $this->_status = $this->_admin_page->get_registration_status_array(); |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @return void |
76 | 76 | */ |
77 | 77 | protected function _setup_data() { |
78 | - $this->_data = $this->_admin_page->get_registrations( $this->_per_page ); |
|
79 | - $this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE ); |
|
78 | + $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
79 | + $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -93,30 +93,30 @@ discard block |
||
93 | 93 | 'ajax' => TRUE, |
94 | 94 | 'screen' => $this->_admin_page->get_current_screen()->id |
95 | 95 | ); |
96 | - $ID_column_name = __( 'ID', 'event_espresso' ); |
|
96 | + $ID_column_name = __('ID', 'event_espresso'); |
|
97 | 97 | $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">'; |
98 | - $ID_column_name .= __( 'Registrant Name', 'event_espresso' ); |
|
98 | + $ID_column_name .= __('Registrant Name', 'event_espresso'); |
|
99 | 99 | $ID_column_name .= '</span> '; |
100 | - if ( isset( $_GET['event_id'] )) { |
|
100 | + if (isset($_GET['event_id'])) { |
|
101 | 101 | $this->_columns = array( |
102 | 102 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
103 | 103 | '_REG_ID' => $ID_column_name, |
104 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
104 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
105 | 105 | 'ATT_email' => __('Email', 'event_espresso'), |
106 | - '_REG_date' => __( 'Reg Date', 'event_espresso' ), |
|
107 | - 'PRC_amount' => __( 'TKT Price', 'event_espresso' ), |
|
108 | - '_REG_final_price' => __( 'Final Price', 'event_espresso' ), |
|
109 | - 'TXN_total' => __( 'Total Txn', 'event_espresso' ), |
|
106 | + '_REG_date' => __('Reg Date', 'event_espresso'), |
|
107 | + 'PRC_amount' => __('TKT Price', 'event_espresso'), |
|
108 | + '_REG_final_price' => __('Final Price', 'event_espresso'), |
|
109 | + 'TXN_total' => __('Total Txn', 'event_espresso'), |
|
110 | 110 | 'TXN_paid' => __('Paid', 'event_espresso'), |
111 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
111 | + 'actions' => __('Actions', 'event_espresso') |
|
112 | 112 | ); |
113 | 113 | $this->_bottom_buttons = array( |
114 | 114 | 'report'=> array( |
115 | 115 | 'route' => 'registrations_report', |
116 | 116 | 'extra_request' => |
117 | 117 | array( |
118 | - 'EVT_ID'=> isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null, |
|
119 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) |
|
118 | + 'EVT_ID'=> isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, |
|
119 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") |
|
120 | 120 | ) |
121 | 121 | ), |
122 | 122 | ); |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | $this->_columns = array( |
125 | 125 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
126 | 126 | '_REG_ID' => $ID_column_name, |
127 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
128 | - '_REG_date' => __( 'TXN Date', 'event_espresso' ), |
|
129 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
130 | - 'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ), |
|
131 | - '_REG_final_price' => __( 'Price', 'event_espresso' ), |
|
132 | - '_REG_paid' => __( 'Paid', 'event_espresso' ), |
|
133 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
127 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
128 | + '_REG_date' => __('TXN Date', 'event_espresso'), |
|
129 | + 'event_name' => __('Event', 'event_espresso'), |
|
130 | + 'DTT_EVT_start' => __('Event Date', 'event_espresso'), |
|
131 | + '_REG_final_price' => __('Price', 'event_espresso'), |
|
132 | + '_REG_paid' => __('Paid', 'event_espresso'), |
|
133 | + 'actions' => __('Actions', 'event_espresso') |
|
134 | 134 | ); |
135 | 135 | $this->_bottom_buttons = array( |
136 | 136 | 'report_all'=> array( |
137 | 137 | 'route' => 'registrations_report', |
138 | 138 | 'extra_request' => array( |
139 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) |
|
139 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
140 | 140 | ), |
141 | 141 | ); |
142 | 142 | } |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | $this->_primary_column = '_REG_ID'; |
145 | 145 | |
146 | 146 | $this->_sortable_columns = array( |
147 | - '_REG_date' => array( '_REG_date' => TRUE ), //true means its already sorted |
|
148 | - 'ATT_fname' => array( 'ATT_fname' => FALSE ), |
|
149 | - 'event_name' => array( 'event_name' => FALSE ), |
|
150 | - 'DTT_EVT_start' => array( 'DTT_EVT_start' => FALSE ), |
|
151 | - '_REG_ID' => array( '_REG_ID' => FALSE ), |
|
147 | + '_REG_date' => array('_REG_date' => TRUE), //true means its already sorted |
|
148 | + 'ATT_fname' => array('ATT_fname' => FALSE), |
|
149 | + 'event_name' => array('event_name' => FALSE), |
|
150 | + 'DTT_EVT_start' => array('DTT_EVT_start' => FALSE), |
|
151 | + '_REG_ID' => array('_REG_ID' => FALSE), |
|
152 | 152 | ); |
153 | 153 | |
154 | 154 | $this->_hidden_columns = array(); |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | * @param EE_Registration $item the current item |
163 | 163 | * @return string |
164 | 164 | */ |
165 | - protected function _get_row_class( $item ) { |
|
166 | - $class = parent::_get_row_class( $item ); |
|
165 | + protected function _get_row_class($item) { |
|
166 | + $class = parent::_get_row_class($item); |
|
167 | 167 | //add status class |
168 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
169 | - if ( $this->_has_checkbox_column ) { |
|
168 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
169 | + if ($this->_has_checkbox_column) { |
|
170 | 170 | $class .= ' has-checkbox-column'; |
171 | 171 | } |
172 | 172 | return $class; |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | * @param EE_Registration $registration |
181 | 181 | * @throws \EE_Error |
182 | 182 | */ |
183 | - protected function _set_related_details( EE_Registration $registration ) { |
|
183 | + protected function _set_related_details(EE_Registration $registration) { |
|
184 | 184 | |
185 | - $transaction = $registration->get_first_related( 'Transaction' ); |
|
185 | + $transaction = $registration->get_first_related('Transaction'); |
|
186 | 186 | $status = $transaction instanceof EE_Transaction |
187 | 187 | ? $transaction->status_ID() |
188 | 188 | : EEM_Transaction::failed_status_code; |
@@ -191,8 +191,8 @@ discard block |
||
191 | 191 | 'status' => $status, |
192 | 192 | 'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0, |
193 | 193 | 'title_attr' => sprintf( |
194 | - __( 'View Transaction Details (%s)', 'event_espresso' ), |
|
195 | - EEH_Template::pretty_status( $status, false, 'sentence' ) |
|
194 | + __('View Transaction Details (%s)', 'event_espresso'), |
|
195 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
196 | 196 | ) |
197 | 197 | ); |
198 | 198 | |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | 'status' => $status, |
204 | 204 | 'id' => $event instanceof EE_Event ? $event->ID() : 0, |
205 | 205 | 'title_attr' => sprintf( |
206 | - __( 'Edit Event (%s)', 'event_espresso' ), |
|
207 | - EEH_Template::pretty_status( $status, false, 'sentence' ) |
|
206 | + __('Edit Event (%s)', 'event_espresso'), |
|
207 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
208 | 208 | ) |
209 | 209 | ); |
210 | 210 | } |
@@ -221,30 +221,30 @@ discard block |
||
221 | 221 | |
222 | 222 | //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods. |
223 | 223 | |
224 | - $cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : ''; |
|
225 | - $cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1; |
|
226 | - $reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : ''; |
|
224 | + $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
225 | + $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
226 | + $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : ''; |
|
227 | 227 | |
228 | - $filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category ); |
|
229 | - $filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category ); |
|
228 | + $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
229 | + $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
230 | 230 | |
231 | 231 | $status = array(); |
232 | - $status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') ); |
|
233 | - foreach ( $this->_status as $key => $value ) { |
|
234 | - $status[] = array( 'id' => $key, 'text' => $value ); |
|
232 | + $status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso')); |
|
233 | + foreach ($this->_status as $key => $value) { |
|
234 | + $status[] = array('id' => $key, 'text' => $value); |
|
235 | 235 | } |
236 | - if ( $this->_view !== 'incomplete' ) { |
|
236 | + if ($this->_view !== 'incomplete') { |
|
237 | 237 | $filters[] = EEH_Form_Fields::select_input( |
238 | 238 | '_reg_status', |
239 | 239 | $status, |
240 | - isset( $this->_req_data['_reg_status'] ) |
|
241 | - ? strtoupper( sanitize_key( $this->_req_data['_reg_status'] )) |
|
240 | + isset($this->_req_data['_reg_status']) |
|
241 | + ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) |
|
242 | 242 | : '' |
243 | 243 | ); |
244 | 244 | } |
245 | 245 | |
246 | - if ( isset( $this->_req_data['event_id'] ) ) { |
|
247 | - $filters[] = EEH_Form_Fields::hidden_input( 'event_id', $this->_req_data['event_id'], 'reg_event_id' ); |
|
246 | + if (isset($this->_req_data['event_id'])) { |
|
247 | + $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | return $filters; |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | $this->_views['all']['count'] = $this->_total_registrations(); |
264 | 264 | $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
265 | 265 | $this->_views['today']['count'] = $this->_total_registrations_today(); |
266 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) { |
|
267 | - $this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' ); |
|
268 | - $this->_views['trash']['count'] = $this->_total_registrations( 'trash' ); |
|
266 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) { |
|
267 | + $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
268 | + $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
269 | 269 | } |
270 | 270 | } |
271 | 271 | |
@@ -279,23 +279,23 @@ discard block |
||
279 | 279 | * @return int |
280 | 280 | * @throws \EE_Error |
281 | 281 | */ |
282 | - protected function _total_registrations( $view = '' ){ |
|
282 | + protected function _total_registrations($view = '') { |
|
283 | 283 | $_where = array(); |
284 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
285 | - if( $EVT_ID ) { |
|
284 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
285 | + if ($EVT_ID) { |
|
286 | 286 | $_where['EVT_ID'] = $EVT_ID; |
287 | 287 | } |
288 | - switch ( $view ) { |
|
288 | + switch ($view) { |
|
289 | 289 | case 'trash' : |
290 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
290 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
291 | 291 | break; |
292 | 292 | case 'incomplete' : |
293 | 293 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
294 | 294 | break; |
295 | 295 | default : |
296 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
296 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
297 | 297 | } |
298 | - return EEM_Registration::instance()->count( array( $_where )); |
|
298 | + return EEM_Registration::instance()->count(array($_where)); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | |
@@ -307,32 +307,32 @@ discard block |
||
307 | 307 | * @return int |
308 | 308 | * @throws \EE_Error |
309 | 309 | */ |
310 | - protected function _total_registrations_this_month(){ |
|
311 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
312 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
310 | + protected function _total_registrations_this_month() { |
|
311 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
312 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
313 | 313 | $this_year_r = date('Y', current_time('timestamp')); |
314 | 314 | $time_start = ' 00:00:00'; |
315 | 315 | $time_end = ' 23:59:59'; |
316 | 316 | $this_month_r = date('m', current_time('timestamp')); |
317 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
317 | + $days_this_month = date('t', current_time('timestamp')); |
|
318 | 318 | //setup date query. |
319 | 319 | $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
320 | 320 | 'REG_date', |
321 | - $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
321 | + $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, |
|
322 | 322 | 'Y-m-d H:i:s' |
323 | 323 | ); |
324 | 324 | $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
325 | 325 | 'REG_date', |
326 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
326 | + $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, |
|
327 | 327 | 'Y-m-d H:i:s' |
328 | 328 | ); |
329 | - $_where['REG_date']= array('BETWEEN', |
|
329 | + $_where['REG_date'] = array('BETWEEN', |
|
330 | 330 | array( |
331 | 331 | $beginning_string, |
332 | 332 | $end_string |
333 | 333 | )); |
334 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
335 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
334 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
335 | + return EEM_Registration::instance()->count(array($_where)); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | |
@@ -344,20 +344,20 @@ discard block |
||
344 | 344 | * @return int |
345 | 345 | * @throws \EE_Error |
346 | 346 | */ |
347 | - protected function _total_registrations_today(){ |
|
347 | + protected function _total_registrations_today() { |
|
348 | 348 | |
349 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
350 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
349 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
350 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
351 | 351 | $current_date = date('Y-m-d', current_time('timestamp')); |
352 | 352 | $time_start = ' 00:00:00'; |
353 | 353 | $time_end = ' 23:59:59'; |
354 | - $_where['REG_date']= array('BETWEEN', |
|
354 | + $_where['REG_date'] = array('BETWEEN', |
|
355 | 355 | array( |
356 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ), |
|
357 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' ) |
|
356 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'), |
|
357 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s') |
|
358 | 358 | )); |
359 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
360 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
359 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
360 | + return EEM_Registration::instance()->count(array($_where)); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
@@ -370,12 +370,12 @@ discard block |
||
370 | 370 | * @return string |
371 | 371 | * @throws \EE_Error |
372 | 372 | */ |
373 | - public function column_cb($item){ |
|
373 | + public function column_cb($item) { |
|
374 | 374 | /** checkbox/lock **/ |
375 | - $transaction = $item->get_first_related( 'Transaction' ); |
|
376 | - $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
|
375 | + $transaction = $item->get_first_related('Transaction'); |
|
376 | + $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0; |
|
377 | 377 | return $payment_count > 0 |
378 | - ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) |
|
378 | + ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()) |
|
379 | 379 | . '<span class="ee-lock-icon"></span>' |
380 | 380 | : sprintf( |
381 | 381 | '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', |
@@ -393,14 +393,14 @@ discard block |
||
393 | 393 | * @return string |
394 | 394 | * @throws \EE_Error |
395 | 395 | */ |
396 | - public function column__REG_ID(EE_Registration $item){ |
|
396 | + public function column__REG_ID(EE_Registration $item) { |
|
397 | 397 | $attendee = $item->attendee(); |
398 | 398 | $content = $item->ID(); |
399 | 399 | $content .= '<div class="show-on-mobile-view-only">'; |
400 | 400 | $content .= '<br>'; |
401 | 401 | $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
402 | - $content .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
403 | - $content .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
402 | + $content .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
403 | + $content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
404 | 404 | $content .= '</div>'; |
405 | 405 | return $content; |
406 | 406 | } |
@@ -415,12 +415,12 @@ discard block |
||
415 | 415 | * @return string |
416 | 416 | * @throws \EE_Error |
417 | 417 | */ |
418 | - public function column__REG_date(EE_Registration $item){ |
|
418 | + public function column__REG_date(EE_Registration $item) { |
|
419 | 419 | $this->_set_related_details($item); |
420 | 420 | //Build row actions |
421 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
422 | - $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
|
423 | - $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
|
421 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL); |
|
422 | + $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date'); |
|
423 | + $view_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence').'</span>'; |
|
424 | 424 | return $view_link; |
425 | 425 | } |
426 | 426 | |
@@ -434,18 +434,18 @@ discard block |
||
434 | 434 | * @return string |
435 | 435 | * @throws \EE_Error |
436 | 436 | */ |
437 | - public function column_event_name(EE_Registration $item){ |
|
438 | - $this->_set_related_details( $item ); |
|
437 | + public function column_event_name(EE_Registration $item) { |
|
438 | + $this->_set_related_details($item); |
|
439 | 439 | // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 |
440 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$item->event_ID() ), EVENTS_ADMIN_URL ); |
|
440 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$item->event_ID()), EVENTS_ADMIN_URL); |
|
441 | 441 | $event_name = $item->event_name(); |
442 | 442 | $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); |
443 | - $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID() ) ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr( $this->_event_details['title_attr'] ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ) ; |
|
443 | + $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID()) ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'); |
|
444 | 444 | |
445 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'event_id'=>$item->event_ID() ), REG_ADMIN_URL ); |
|
446 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Filter this list to only show registrations for %s', 'event_espresso' ), $event_name ) .'">' . __( 'View Registrations', 'event_espresso' ) . '</a>'; |
|
445 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id'=>$item->event_ID()), REG_ADMIN_URL); |
|
446 | + $actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), $event_name).'">'.__('View Registrations', 'event_espresso').'</a>'; |
|
447 | 447 | |
448 | - return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) ); |
|
448 | + return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | |
@@ -458,18 +458,18 @@ discard block |
||
458 | 458 | * @return string |
459 | 459 | * @throws \EE_Error |
460 | 460 | */ |
461 | - public function column_DTT_EVT_start(EE_Registration $item){ |
|
461 | + public function column_DTT_EVT_start(EE_Registration $item) { |
|
462 | 462 | $datetime_strings = array(); |
463 | - $ticket = $item->ticket( TRUE ); |
|
464 | - if ( $ticket instanceof EE_Ticket ) { |
|
463 | + $ticket = $item->ticket(TRUE); |
|
464 | + if ($ticket instanceof EE_Ticket) { |
|
465 | 465 | $remove_defaults = array('default_where_conditions' => 'none'); |
466 | 466 | $datetimes = $ticket->datetimes($remove_defaults); |
467 | - foreach($datetimes as $datetime){ |
|
468 | - $datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
467 | + foreach ($datetimes as $datetime) { |
|
468 | + $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
469 | 469 | } |
470 | - return implode("<br />",$datetime_strings); |
|
470 | + return implode("<br />", $datetime_strings); |
|
471 | 471 | } else { |
472 | - return __( 'There is no ticket on this registration', 'event_espresso' ); |
|
472 | + return __('There is no ticket on this registration', 'event_espresso'); |
|
473 | 473 | } |
474 | 474 | } |
475 | 475 | |
@@ -483,45 +483,45 @@ discard block |
||
483 | 483 | * @return string |
484 | 484 | * @throws \EE_Error |
485 | 485 | */ |
486 | - public function column_ATT_fname(EE_Registration $item){ |
|
486 | + public function column_ATT_fname(EE_Registration $item) { |
|
487 | 487 | $attendee = $item->attendee(); |
488 | 488 | |
489 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
489 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
490 | 490 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
491 | - $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' : $attendee_name; |
|
491 | + $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' : $attendee_name; |
|
492 | 492 | $link .= $item->count() === 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : ''; |
493 | 493 | |
494 | 494 | $t = $item->get_first_related('Transaction'); |
495 | 495 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
496 | 496 | |
497 | 497 | //append group count to name |
498 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
498 | + $link .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
499 | 499 | |
500 | 500 | //append reg_code |
501 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
501 | + $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
502 | 502 | |
503 | 503 | //reg status text for accessibility |
504 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
504 | + $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
505 | 505 | |
506 | 506 | //trash/restore/delete actions |
507 | 507 | $actions = array(); |
508 | - if ( $this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) { |
|
509 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
510 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>'; |
|
511 | - } elseif ( $this->_view === 'trash' ) { |
|
508 | + if ($this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) { |
|
509 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
510 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
511 | + } elseif ($this->_view === 'trash') { |
|
512 | 512 | // restore registration link |
513 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) { |
|
514 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
515 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
513 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) { |
|
514 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
515 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
516 | 516 | } |
517 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) { |
|
518 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
517 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) { |
|
518 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
519 | 519 | |
520 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>'; |
|
520 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>'; |
|
521 | 521 | } |
522 | 522 | } |
523 | 523 | |
524 | - return sprintf('%1$s %2$s', $link, $this->row_actions($actions) ); |
|
524 | + return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * @return string |
535 | 535 | * @throws \EE_Error |
536 | 536 | */ |
537 | - public function column_ATT_email( EE_Registration $item ) { |
|
537 | + public function column_ATT_email(EE_Registration $item) { |
|
538 | 538 | $attendee = $item->get_first_related('Attendee'); |
539 | 539 | return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email(); |
540 | 540 | } |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | * @param \EE_Registration $item |
549 | 549 | * @return string |
550 | 550 | */ |
551 | - public function column__REG_count(EE_Registration $item){ |
|
552 | - return sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size()); |
|
551 | + public function column__REG_count(EE_Registration $item) { |
|
552 | + return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size()); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | |
@@ -561,16 +561,16 @@ discard block |
||
561 | 561 | * @param \EE_Registration $item |
562 | 562 | * @return string |
563 | 563 | */ |
564 | - public function column_PRC_amount(EE_Registration $item){ |
|
564 | + public function column_PRC_amount(EE_Registration $item) { |
|
565 | 565 | $ticket = $item->ticket(); |
566 | 566 | |
567 | - $content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : ''; |
|
567 | + $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : ''; |
|
568 | 568 | |
569 | - if ( $item->final_price() > 0 ) { |
|
570 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
569 | + if ($item->final_price() > 0) { |
|
570 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
571 | 571 | } else { |
572 | 572 | // free event |
573 | - $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
573 | + $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>'; |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | return $content; |
@@ -586,11 +586,11 @@ discard block |
||
586 | 586 | * @param \EE_Registration $item |
587 | 587 | * @return string |
588 | 588 | */ |
589 | - public function column__REG_final_price(EE_Registration $item){ |
|
589 | + public function column__REG_final_price(EE_Registration $item) { |
|
590 | 590 | $ticket = $item->ticket(); |
591 | - $content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />'; |
|
591 | + $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />'; |
|
592 | 592 | |
593 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
593 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
594 | 594 | return $content; |
595 | 595 | |
596 | 596 | } |
@@ -604,13 +604,13 @@ discard block |
||
604 | 604 | * @param \EE_Registration $item |
605 | 605 | * @return string |
606 | 606 | */ |
607 | - public function column__REG_paid(EE_Registration $item){ |
|
607 | + public function column__REG_paid(EE_Registration $item) { |
|
608 | 608 | $payment_method = $item->payment_method(); |
609 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
609 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
610 | 610 | |
611 | - $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
612 | - if ( $item->paid() > 0 ) { |
|
613 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
611 | + $content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>'; |
|
612 | + if ($item->paid() > 0) { |
|
613 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
614 | 614 | } |
615 | 615 | return $content; |
616 | 616 | } |
@@ -625,11 +625,11 @@ discard block |
||
625 | 625 | * @return string |
626 | 626 | * @throws \EE_Error |
627 | 627 | */ |
628 | - public function column_TXN_total(EE_Registration $item){ |
|
629 | - if($item->transaction()){ |
|
630 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
631 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
632 | - }else{ |
|
628 | + public function column_TXN_total(EE_Registration $item) { |
|
629 | + if ($item->transaction()) { |
|
630 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
631 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>'; |
|
632 | + } else { |
|
633 | 633 | return __("None", "event_espresso"); |
634 | 634 | } |
635 | 635 | } |
@@ -644,15 +644,15 @@ discard block |
||
644 | 644 | * @return string |
645 | 645 | * @throws \EE_Error |
646 | 646 | */ |
647 | - public function column_TXN_paid(EE_Registration $item){ |
|
647 | + public function column_TXN_paid(EE_Registration $item) { |
|
648 | 648 | |
649 | - if ( $item->count() === 1 ) { |
|
649 | + if ($item->count() === 1) { |
|
650 | 650 | $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance(); |
651 | - if ( $transaction->paid() >= $transaction->total() ) { |
|
651 | + if ($transaction->paid() >= $transaction->total()) { |
|
652 | 652 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
653 | 653 | } else { |
654 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
655 | - return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
654 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
655 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
656 | 656 | } |
657 | 657 | } |
658 | 658 | |
@@ -672,44 +672,44 @@ discard block |
||
672 | 672 | */ |
673 | 673 | public function column_actions(EE_Registration $item) { |
674 | 674 | $attendee = $item->attendee(); |
675 | - $this->_set_related_details( $item ); |
|
675 | + $this->_set_related_details($item); |
|
676 | 676 | |
677 | 677 | //Build row actions |
678 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
679 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL ); |
|
678 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
679 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL); |
|
680 | 680 | |
681 | 681 | // page=attendees&event_admin_reports=resend_email®istration_id=43653465634&event_id=2&form_action=resend_email |
682 | 682 | //$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID ); |
683 | - $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true ); |
|
683 | + $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true); |
|
684 | 684 | |
685 | 685 | |
686 | 686 | //Build row actions |
687 | - $view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? ' |
|
687 | + $view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? ' |
|
688 | 688 | <li> |
689 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
689 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
690 | 690 | <div class="dashicons dashicons-clipboard"></div> |
691 | 691 | </a> |
692 | 692 | </li>' : ''; |
693 | 693 | |
694 | - $edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) && $attendee instanceof EE_Attendee ?' |
|
694 | + $edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? ' |
|
695 | 695 | <li> |
696 | - <a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text"> |
|
696 | + <a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text"> |
|
697 | 697 | <div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div> |
698 | 698 | </a> |
699 | 699 | </li>' : ''; |
700 | 700 | |
701 | - $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? ' |
|
701 | + $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? ' |
|
702 | 702 | <li> |
703 | - <a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
703 | + <a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text"> |
|
704 | 704 | <div class="dashicons dashicons-email-alt"></div> |
705 | 705 | </a> |
706 | 706 | </li>' : ''; |
707 | 707 | |
708 | 708 | // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb |
709 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
710 | - $view_txn_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? ' |
|
709 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL); |
|
710 | + $view_txn_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? ' |
|
711 | 711 | <li> |
712 | - <a class="ee-status-color-' . $this->_transaction_details['status'] . ' tiny-text" href="'.$view_txn_lnk_url.'" title="' . $this->_transaction_details['title_attr'] . '"> |
|
712 | + <a class="ee-status-color-' . $this->_transaction_details['status'].' tiny-text" href="'.$view_txn_lnk_url.'" title="'.$this->_transaction_details['title_attr'].'"> |
|
713 | 713 | <div class="dashicons dashicons-cart"></div> |
714 | 714 | </a> |
715 | 715 | </li>' : ''; |
@@ -718,10 +718,10 @@ discard block |
||
718 | 718 | $dl_invoice_lnk = ''; |
719 | 719 | $dl_invoice_lnk_url = $item->invoice_url(); |
720 | 720 | //only show invoice link if message type is active. |
721 | - if ( $attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
721 | + if ($attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active('invoice')) { |
|
722 | 722 | $dl_invoice_lnk = ' |
723 | 723 | <li> |
724 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
724 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
725 | 725 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
726 | 726 | </a> |
727 | 727 | </li>'; |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | |
730 | 730 | $filtered_messages_link = ''; |
731 | 731 | //message list table link (filtered by REG_ID |
732 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
732 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
733 | 733 | $filtered_messages_link = '<li>' |
734 | 734 | . EEH_MSG_Template::get_message_action_link( |
735 | 735 | 'see_notifications_for', |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | . '</li>'; |
742 | 742 | } |
743 | 743 | |
744 | - return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk . $dl_invoice_lnk . $filtered_messages_link, $item, 'ul', 'reg-overview-actions-ul' ); |
|
744 | + return $this->_action_string($view_lnk.$edit_lnk.$resend_reg_lnk.$view_txn_lnk.$dl_invoice_lnk.$filtered_messages_link, $item, 'ul', 'reg-overview-actions-ul'); |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | } |