@@ -9,8 +9,8 @@ |
||
9 | 9 | /** @var string $after_list_table */ |
10 | 10 | ?> |
11 | 11 | <?php echo $before_list_table; ?> |
12 | -<form id="<?php echo $list_table_class; ?>-table-frm" action="<?php echo $table_url;?>" method="get"> |
|
13 | - <?php $list_table->search_box( $search['btn_label'], $current_page ); ?><br /> |
|
12 | +<form id="<?php echo $list_table_class; ?>-table-frm" action="<?php echo $table_url; ?>" method="get"> |
|
13 | + <?php $list_table->search_box($search['btn_label'], $current_page); ?><br /> |
|
14 | 14 | <?php echo $sortable_list_table_form_fields; ?> |
15 | 15 | <?php $list_table->display_views(); ?> |
16 | 16 | <?php $list_table->display(); ?> |
@@ -41,8 +41,8 @@ |
||
41 | 41 | </div> |
42 | 42 | <span data-context="datetime" data-datetime-row="<?php echo $dtt_row; ?>" class="<?php echo $clone_icon; ?> clickable"></span> |
43 | 43 | <span data-context="datetime" data-datetime-row="<?php echo $dtt_row; ?>" class="<?php echo $trash_icon; ?> clickable"<?php echo $show_trash; ?>></span> |
44 | - <?php if ( $reg_list_url !== '' ) : ?> |
|
45 | - <a href="<?php echo $reg_list_url; ?>" title="<?php _e( 'View registrations for this datetime.', 'event_espresso' );?>" style="text-decoration: none;"> |
|
44 | + <?php if ($reg_list_url !== '') : ?> |
|
45 | + <a href="<?php echo $reg_list_url; ?>" title="<?php _e('View registrations for this datetime.', 'event_espresso'); ?>" style="text-decoration: none;"> |
|
46 | 46 | <span data-context="datetime" data-datetime-row="<?php echo $dtt_row; ?>" class="dashicons dashicons-groups clickable"></span> |
47 | 47 | </a> |
48 | 48 | <?php endif; ?> |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | /** |
32 | 32 | * REG_date |
33 | - */ |
|
33 | + */ |
|
34 | 34 | function column_REG_date(EE_Registration $item){ |
35 | 35 | |
36 | 36 | //Build row actions |
@@ -60,60 +60,60 @@ discard block |
||
60 | 60 | $remove_defaults = array('default_where_conditions' => 'none'); |
61 | 61 | $ticket = $item->ticket(); |
62 | 62 | $datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array(); |
63 | - $EVT_ID = $item->event_ID(); |
|
64 | - $datetime_string = ''; |
|
65 | - foreach( $datetimes as $datetime ){ |
|
66 | - if ( |
|
67 | - EE_Registry::instance()->CAP->current_user_can( |
|
68 | - 'ee_read_checkin', |
|
69 | - 'espresso_registrations_registration_checkins', |
|
70 | - $item->ID() |
|
71 | - ) |
|
72 | - ) { |
|
73 | - // open "a" tag and "href" |
|
74 | - $datetime_string .= '<a href="'; |
|
75 | - // checkin URL |
|
76 | - $datetime_string .= EE_Admin_Page::add_query_args_and_nonce( |
|
77 | - array( |
|
78 | - 'action' => 'event_registrations', |
|
79 | - 'event_id' => $EVT_ID, |
|
80 | - 'DTT_ID' => $datetime->ID(), |
|
81 | - ), |
|
82 | - REG_ADMIN_URL |
|
83 | - ); |
|
84 | - // close "href" |
|
85 | - $datetime_string .= '"'; |
|
86 | - // open "title" tag |
|
87 | - $datetime_string .= ' title="'; |
|
88 | - // link title text |
|
89 | - $datetime_string .= esc_attr__( 'View Checkins for this Event', 'event_espresso' ); |
|
90 | - // close "title" tag and end of "a" tag opening |
|
91 | - $datetime_string .= '">'; |
|
92 | - // link text |
|
93 | - $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
94 | - // close "a" tag |
|
95 | - $datetime_string .= '</a>'; |
|
96 | - } else { |
|
97 | - $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
98 | - } |
|
99 | - // add a "View Registrations" link that filters list by event AND datetime |
|
100 | - $datetime_string .= $this->row_actions( |
|
101 | - array( |
|
102 | - 'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
103 | - array( 'event_id' => $EVT_ID, 'datetime_id' => $datetime->ID() ), |
|
104 | - REG_ADMIN_URL |
|
105 | - ) . '" title="' . sprintf( |
|
106 | - esc_attr__( |
|
107 | - 'Filter this list to only show registrations for this datetime %s', |
|
108 | - 'event_espresso' |
|
109 | - ), |
|
110 | - $datetime->name() |
|
111 | - ) . '">' . __( 'View Registrations', 'event_espresso' ) . '</a>' |
|
112 | - ) |
|
113 | - ); |
|
63 | + $EVT_ID = $item->event_ID(); |
|
64 | + $datetime_string = ''; |
|
65 | + foreach( $datetimes as $datetime ){ |
|
66 | + if ( |
|
67 | + EE_Registry::instance()->CAP->current_user_can( |
|
68 | + 'ee_read_checkin', |
|
69 | + 'espresso_registrations_registration_checkins', |
|
70 | + $item->ID() |
|
71 | + ) |
|
72 | + ) { |
|
73 | + // open "a" tag and "href" |
|
74 | + $datetime_string .= '<a href="'; |
|
75 | + // checkin URL |
|
76 | + $datetime_string .= EE_Admin_Page::add_query_args_and_nonce( |
|
77 | + array( |
|
78 | + 'action' => 'event_registrations', |
|
79 | + 'event_id' => $EVT_ID, |
|
80 | + 'DTT_ID' => $datetime->ID(), |
|
81 | + ), |
|
82 | + REG_ADMIN_URL |
|
83 | + ); |
|
84 | + // close "href" |
|
85 | + $datetime_string .= '"'; |
|
86 | + // open "title" tag |
|
87 | + $datetime_string .= ' title="'; |
|
88 | + // link title text |
|
89 | + $datetime_string .= esc_attr__( 'View Checkins for this Event', 'event_espresso' ); |
|
90 | + // close "title" tag and end of "a" tag opening |
|
91 | + $datetime_string .= '">'; |
|
92 | + // link text |
|
93 | + $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
94 | + // close "a" tag |
|
95 | + $datetime_string .= '</a>'; |
|
96 | + } else { |
|
97 | + $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
98 | + } |
|
99 | + // add a "View Registrations" link that filters list by event AND datetime |
|
100 | + $datetime_string .= $this->row_actions( |
|
101 | + array( |
|
102 | + 'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
103 | + array( 'event_id' => $EVT_ID, 'datetime_id' => $datetime->ID() ), |
|
104 | + REG_ADMIN_URL |
|
105 | + ) . '" title="' . sprintf( |
|
106 | + esc_attr__( |
|
107 | + 'Filter this list to only show registrations for this datetime %s', |
|
108 | + 'event_espresso' |
|
109 | + ), |
|
110 | + $datetime->name() |
|
111 | + ) . '">' . __( 'View Registrations', 'event_espresso' ) . '</a>' |
|
112 | + ) |
|
113 | + ); |
|
114 | 114 | } |
115 | 115 | return $datetime_string; |
116 | - } |
|
116 | + } |
|
117 | 117 | |
118 | 118 | |
119 | 119 |
@@ -31,20 +31,20 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * REG_date |
33 | 33 | */ |
34 | - function column_REG_date(EE_Registration $item){ |
|
34 | + function column_REG_date(EE_Registration $item) { |
|
35 | 35 | |
36 | 36 | //Build row actions |
37 | 37 | $actions = array(); |
38 | 38 | |
39 | 39 | //Build row actions |
40 | - $check_in_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$item->event_ID() ), REG_ADMIN_URL ); |
|
41 | - $actions['check_in'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkin', 'espresso_registrations_registration_checkins', $item->ID() ) ? ' |
|
42 | - <a href="'.$check_in_url.'" title="' . esc_attr__( 'The Check-In List allows you to easily toggle check-in status for this event', 'event_espresso' ) . '">' . __( 'View Check-ins', 'event_espresso' ) . '</a>' : __( 'View Check-ins', 'event_espresso' ); |
|
40 | + $check_in_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$item->event_ID()), REG_ADMIN_URL); |
|
41 | + $actions['check_in'] = EE_Registry::instance()->CAP->current_user_can('ee_read_checkin', 'espresso_registrations_registration_checkins', $item->ID()) ? ' |
|
42 | + <a href="'.$check_in_url.'" title="'.esc_attr__('The Check-In List allows you to easily toggle check-in status for this event', 'event_espresso').'">'.__('View Check-ins', 'event_espresso').'</a>' : __('View Check-ins', 'event_espresso'); |
|
43 | 43 | |
44 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction()->ID() ), TXN_ADMIN_URL ); |
|
45 | - $REG_date = EE_Regisry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
|
44 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction()->ID()), TXN_ADMIN_URL); |
|
45 | + $REG_date = EE_Regisry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date'); |
|
46 | 46 | |
47 | - return sprintf('%1$s %2$s', $REG_date, $this->row_actions($actions) ); |
|
47 | + return sprintf('%1$s %2$s', $REG_date, $this->row_actions($actions)); |
|
48 | 48 | |
49 | 49 | } |
50 | 50 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | * @param \EE_Registration $item |
57 | 57 | * @return string |
58 | 58 | */ |
59 | - public function column_DTT_EVT_start(EE_Registration $item){ |
|
59 | + public function column_DTT_EVT_start(EE_Registration $item) { |
|
60 | 60 | $remove_defaults = array('default_where_conditions' => 'none'); |
61 | 61 | $ticket = $item->ticket(); |
62 | 62 | $datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array(); |
63 | 63 | $EVT_ID = $item->event_ID(); |
64 | 64 | $datetime_string = ''; |
65 | - foreach( $datetimes as $datetime ){ |
|
65 | + foreach ($datetimes as $datetime) { |
|
66 | 66 | if ( |
67 | 67 | EE_Registry::instance()->CAP->current_user_can( |
68 | 68 | 'ee_read_checkin', |
@@ -86,29 +86,29 @@ discard block |
||
86 | 86 | // open "title" tag |
87 | 87 | $datetime_string .= ' title="'; |
88 | 88 | // link title text |
89 | - $datetime_string .= esc_attr__( 'View Checkins for this Event', 'event_espresso' ); |
|
89 | + $datetime_string .= esc_attr__('View Checkins for this Event', 'event_espresso'); |
|
90 | 90 | // close "title" tag and end of "a" tag opening |
91 | 91 | $datetime_string .= '">'; |
92 | 92 | // link text |
93 | - $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
93 | + $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
94 | 94 | // close "a" tag |
95 | 95 | $datetime_string .= '</a>'; |
96 | 96 | } else { |
97 | - $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
97 | + $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
98 | 98 | } |
99 | 99 | // add a "View Registrations" link that filters list by event AND datetime |
100 | 100 | $datetime_string .= $this->row_actions( |
101 | 101 | array( |
102 | - 'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
103 | - array( 'event_id' => $EVT_ID, 'datetime_id' => $datetime->ID() ), |
|
102 | + 'event_datetime_filter' => '<a href="'.EE_Admin_Page::add_query_args_and_nonce( |
|
103 | + array('event_id' => $EVT_ID, 'datetime_id' => $datetime->ID()), |
|
104 | 104 | REG_ADMIN_URL |
105 | - ) . '" title="' . sprintf( |
|
105 | + ).'" title="'.sprintf( |
|
106 | 106 | esc_attr__( |
107 | 107 | 'Filter this list to only show registrations for this datetime %s', |
108 | 108 | 'event_espresso' |
109 | 109 | ), |
110 | 110 | $datetime->name() |
111 | - ) . '">' . __( 'View Registrations', 'event_espresso' ) . '</a>' |
|
111 | + ).'">'.__('View Registrations', 'event_espresso').'</a>' |
|
112 | 112 | ) |
113 | 113 | ); |
114 | 114 | } |
@@ -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 | __( |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * @param string $name |
462 | 462 | * @param string $config_class |
463 | 463 | * @param EE_Config_Base $config_obj |
464 | - * @param array $tests_to_run |
|
464 | + * @param integer[] $tests_to_run |
|
465 | 465 | * @param bool $display_errors |
466 | 466 | * @return bool TRUE on success, FALSE on fail |
467 | 467 | */ |
@@ -1759,7 +1759,7 @@ discard block |
||
1759 | 1759 | |
1760 | 1760 | |
1761 | 1761 | /** |
1762 | - * @return array |
|
1762 | + * @return integer[] |
|
1763 | 1763 | */ |
1764 | 1764 | public function get_critical_pages_array() { |
1765 | 1765 | return array( |
@@ -1773,7 +1773,7 @@ discard block |
||
1773 | 1773 | |
1774 | 1774 | |
1775 | 1775 | /** |
1776 | - * @return array |
|
1776 | + * @return string[] |
|
1777 | 1777 | */ |
1778 | 1778 | public function get_critical_pages_shortcodes_array() { |
1779 | 1779 | return array( |
@@ -2866,7 +2866,7 @@ discard block |
||
2866 | 2866 | * according to max_input_vars |
2867 | 2867 | * |
2868 | 2868 | * @param int $input_count the count of input vars. |
2869 | - * @return array { |
|
2869 | + * @return string { |
|
2870 | 2870 | * An array that represents whether available space and if no available space the error |
2871 | 2871 | * message. |
2872 | 2872 | * @type bool $has_space whether more inputs can be added. |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | use EventEspresso\core\interfaces\ResettableInterface; |
4 | 4 | |
5 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
6 | - exit( 'No direct script access allowed' ); |
|
5 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
6 | + exit('No direct script access allowed'); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public static function instance() { |
127 | 127 | // check if class object is instantiated, and instantiated properly |
128 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
128 | + if ( ! self::$_instance instanceof EE_Config) { |
|
129 | 129 | self::$_instance = new self(); |
130 | 130 | } |
131 | 131 | return self::$_instance; |
@@ -145,20 +145,20 @@ discard block |
||
145 | 145 | * site was put into maintenance mode) |
146 | 146 | * @return EE_Config |
147 | 147 | */ |
148 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
149 | - if ( $hard_reset ) { |
|
148 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
149 | + if ($hard_reset) { |
|
150 | 150 | self::$_instance->_addon_option_names = array(); |
151 | 151 | self::$_instance->_initialize_config(); |
152 | 152 | self::$_instance->update_espresso_config(); |
153 | 153 | } |
154 | - if ( self::$_instance instanceof EE_Config ) { |
|
154 | + if (self::$_instance instanceof EE_Config) { |
|
155 | 155 | self::$_instance->update_addon_option_names(); |
156 | 156 | } |
157 | 157 | self::$_instance = null; |
158 | 158 | //we don't need to reset the static properties imo because those should |
159 | 159 | //only change when a module is added or removed. Currently we don't |
160 | 160 | //support removing a module during a request when it previously existed |
161 | - if ( $reinstantiate ) { |
|
161 | + if ($reinstantiate) { |
|
162 | 162 | return self::instance(); |
163 | 163 | } else { |
164 | 164 | return null; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @access private |
174 | 174 | */ |
175 | 175 | private function __construct() { |
176 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
176 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
177 | 177 | // setup empty config classes |
178 | 178 | $this->_initialize_config(); |
179 | 179 | // load existing EE site settings |
@@ -183,17 +183,17 @@ discard block |
||
183 | 183 | // register shortcodes and modules |
184 | 184 | add_action( |
185 | 185 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
186 | - array( $this, 'register_shortcodes_and_modules' ), |
|
186 | + array($this, 'register_shortcodes_and_modules'), |
|
187 | 187 | 999 |
188 | 188 | ); |
189 | 189 | // initialize shortcodes and modules |
190 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
190 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
191 | 191 | // register widgets |
192 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
192 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
193 | 193 | // shutdown |
194 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
194 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
195 | 195 | // construct__end hook |
196 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
196 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
197 | 197 | // hardcoded hack |
198 | 198 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
199 | 199 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @return string current theme set. |
207 | 207 | */ |
208 | 208 | public static function get_current_theme() { |
209 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
209 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
210 | 210 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
211 | 211 | } |
212 | 212 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | private function _initialize_config() { |
222 | 222 | EE_Config::trim_log(); |
223 | 223 | //set defaults |
224 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
224 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
225 | 225 | $this->addons = new stdClass(); |
226 | 226 | // set _module_route_map |
227 | 227 | EE_Config::$_module_route_map = array(); |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | */ |
242 | 242 | private function _load_core_config() { |
243 | 243 | // load_core_config__start hook |
244 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
244 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
245 | 245 | $espresso_config = $this->get_espresso_config(); |
246 | - foreach ( $espresso_config as $config => $settings ) { |
|
246 | + foreach ($espresso_config as $config => $settings) { |
|
247 | 247 | // load_core_config__start hook |
248 | 248 | $settings = apply_filters( |
249 | 249 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -251,22 +251,22 @@ discard block |
||
251 | 251 | $config, |
252 | 252 | $this |
253 | 253 | ); |
254 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
255 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
254 | + if (is_object($settings) && property_exists($this, $config)) { |
|
255 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
256 | 256 | //call configs populate method to ensure any defaults are set for empty values. |
257 | - if ( method_exists( $settings, 'populate' ) ) { |
|
257 | + if (method_exists($settings, 'populate')) { |
|
258 | 258 | $this->{$config}->populate(); |
259 | 259 | } |
260 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
260 | + if (method_exists($settings, 'do_hooks')) { |
|
261 | 261 | $this->{$config}->do_hooks(); |
262 | 262 | } |
263 | 263 | } |
264 | 264 | } |
265 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
265 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
266 | 266 | $this->update_espresso_config(); |
267 | 267 | } |
268 | 268 | // load_core_config__end hook |
269 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
269 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | |
@@ -281,23 +281,23 @@ discard block |
||
281 | 281 | $this->core = $this->core instanceof EE_Core_Config |
282 | 282 | ? $this->core |
283 | 283 | : new EE_Core_Config(); |
284 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
284 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
285 | 285 | $this->organization = $this->organization instanceof EE_Organization_Config |
286 | 286 | ? $this->organization |
287 | 287 | : new EE_Organization_Config(); |
288 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
288 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
289 | 289 | $this->currency = $this->currency instanceof EE_Currency_Config |
290 | 290 | ? $this->currency |
291 | 291 | : new EE_Currency_Config(); |
292 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
292 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
293 | 293 | $this->registration = $this->registration instanceof EE_Registration_Config |
294 | 294 | ? $this->registration |
295 | 295 | : new EE_Registration_Config(); |
296 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
296 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
297 | 297 | $this->admin = $this->admin instanceof EE_Admin_Config |
298 | 298 | ? $this->admin |
299 | 299 | : new EE_Admin_Config(); |
300 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
300 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
301 | 301 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
302 | 302 | ? $this->template_settings |
303 | 303 | : new EE_Template_Config(); |
@@ -308,15 +308,15 @@ discard block |
||
308 | 308 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
309 | 309 | ? $this->map_settings |
310 | 310 | : new EE_Map_Config(); |
311 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
311 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
312 | 312 | $this->environment = $this->environment instanceof EE_Environment_Config |
313 | 313 | ? $this->environment |
314 | 314 | : new EE_Environment_Config(); |
315 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
315 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
316 | 316 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
317 | 317 | ? $this->gateway |
318 | 318 | : new EE_Gateway_Config(); |
319 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
319 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | // grab espresso configuration |
332 | 332 | return apply_filters( |
333 | 333 | 'FHEE__EE_Config__get_espresso_config__CFG', |
334 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
334 | + get_option(EE_Config::OPTION_NAME, array()) |
|
335 | 335 | ); |
336 | 336 | } |
337 | 337 | |
@@ -345,12 +345,12 @@ discard block |
||
345 | 345 | * @param $old_value |
346 | 346 | * @param $value |
347 | 347 | */ |
348 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
348 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
349 | 349 | // make sure we're checking the ee config |
350 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
350 | + if ($option === EE_Config::OPTION_NAME) { |
|
351 | 351 | // run a loose comparison of the old value against the new value for type and properties, |
352 | 352 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
353 | - if ( $value != $old_value ) { |
|
353 | + if ($value != $old_value) { |
|
354 | 354 | // if they are NOT the same, then remove the hook, |
355 | 355 | // which means the subsequent update results will be based solely on the update query results |
356 | 356 | // the reason we do this is because, as stated above, |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | // the string it sees in the db looks the same as the new one it has been passed!!! |
366 | 366 | // This results in the query returning an "affected rows" value of ZERO, |
367 | 367 | // which gets returned immediately by WP update_option and looks like an error. |
368 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
368 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
369 | 369 | } |
370 | 370 | } |
371 | 371 | } |
@@ -379,11 +379,11 @@ discard block |
||
379 | 379 | */ |
380 | 380 | protected function _reset_espresso_addon_config() { |
381 | 381 | $this->_addon_option_names = array(); |
382 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
383 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
384 | - $config_class = get_class( $addon_config_obj ); |
|
385 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
386 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
382 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
383 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
384 | + $config_class = get_class($addon_config_obj); |
|
385 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
386 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
387 | 387 | } |
388 | 388 | $this->addons->{$addon_name} = null; |
389 | 389 | } |
@@ -399,22 +399,22 @@ discard block |
||
399 | 399 | * @param bool $add_error |
400 | 400 | * @return bool |
401 | 401 | */ |
402 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
402 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
403 | 403 | // don't allow config updates during WP heartbeats |
404 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
404 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
405 | 405 | return false; |
406 | 406 | } |
407 | 407 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
408 | 408 | //$clone = clone( self::$_instance ); |
409 | 409 | //self::$_instance = NULL; |
410 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
410 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
411 | 411 | $this->_reset_espresso_addon_config(); |
412 | 412 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
413 | 413 | // but BEFORE the actual update occurs |
414 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
414 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
415 | 415 | // now update "ee_config" |
416 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
417 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
416 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
417 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
418 | 418 | // if not saved... check if the hook we just added still exists; |
419 | 419 | // if it does, it means one of two things: |
420 | 420 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -425,17 +425,17 @@ discard block |
||
425 | 425 | // but just means no update occurred, so don't display an error to the user. |
426 | 426 | // BUT... if update_option returns FALSE, AND the hook is missing, |
427 | 427 | // then it means that something truly went wrong |
428 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
428 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
429 | 429 | // remove our action since we don't want it in the system anymore |
430 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
431 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
430 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
431 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
432 | 432 | //self::$_instance = $clone; |
433 | 433 | //unset( $clone ); |
434 | 434 | // if config remains the same or was updated successfully |
435 | - if ( $saved ) { |
|
436 | - if ( $add_success ) { |
|
435 | + if ($saved) { |
|
436 | + if ($add_success) { |
|
437 | 437 | EE_Error::add_success( |
438 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
438 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
439 | 439 | __FILE__, |
440 | 440 | __FUNCTION__, |
441 | 441 | __LINE__ |
@@ -443,9 +443,9 @@ discard block |
||
443 | 443 | } |
444 | 444 | return true; |
445 | 445 | } else { |
446 | - if ( $add_error ) { |
|
446 | + if ($add_error) { |
|
447 | 447 | EE_Error::add_error( |
448 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
448 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
449 | 449 | __FILE__, |
450 | 450 | __FUNCTION__, |
451 | 451 | __LINE__ |
@@ -474,16 +474,16 @@ discard block |
||
474 | 474 | $name = '', |
475 | 475 | $config_class = '', |
476 | 476 | $config_obj = null, |
477 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
477 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
478 | 478 | $display_errors = true |
479 | 479 | ) { |
480 | 480 | try { |
481 | - foreach ( $tests_to_run as $test ) { |
|
482 | - switch ( $test ) { |
|
481 | + foreach ($tests_to_run as $test) { |
|
482 | + switch ($test) { |
|
483 | 483 | // TEST #1 : check that section was set |
484 | 484 | case 1 : |
485 | - if ( empty( $section ) ) { |
|
486 | - if ( $display_errors ) { |
|
485 | + if (empty($section)) { |
|
486 | + if ($display_errors) { |
|
487 | 487 | throw new EE_Error( |
488 | 488 | sprintf( |
489 | 489 | __( |
@@ -499,11 +499,11 @@ discard block |
||
499 | 499 | break; |
500 | 500 | // TEST #2 : check that settings section exists |
501 | 501 | case 2 : |
502 | - if ( ! isset( $this->{$section} ) ) { |
|
503 | - if ( $display_errors ) { |
|
502 | + if ( ! isset($this->{$section} )) { |
|
503 | + if ($display_errors) { |
|
504 | 504 | throw new EE_Error( |
505 | 505 | sprintf( |
506 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
506 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
507 | 507 | $section |
508 | 508 | ) |
509 | 509 | ); |
@@ -514,9 +514,9 @@ discard block |
||
514 | 514 | // TEST #3 : check that section is the proper format |
515 | 515 | case 3 : |
516 | 516 | if ( |
517 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
517 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
518 | 518 | ) { |
519 | - if ( $display_errors ) { |
|
519 | + if ($display_errors) { |
|
520 | 520 | throw new EE_Error( |
521 | 521 | sprintf( |
522 | 522 | __( |
@@ -532,8 +532,8 @@ discard block |
||
532 | 532 | break; |
533 | 533 | // TEST #4 : check that config section name has been set |
534 | 534 | case 4 : |
535 | - if ( empty( $name ) ) { |
|
536 | - if ( $display_errors ) { |
|
535 | + if (empty($name)) { |
|
536 | + if ($display_errors) { |
|
537 | 537 | throw new EE_Error( |
538 | 538 | __( |
539 | 539 | 'No name has been provided for the specific configuration section.', |
@@ -546,8 +546,8 @@ discard block |
||
546 | 546 | break; |
547 | 547 | // TEST #5 : check that a config class name has been set |
548 | 548 | case 5 : |
549 | - if ( empty( $config_class ) ) { |
|
550 | - if ( $display_errors ) { |
|
549 | + if (empty($config_class)) { |
|
550 | + if ($display_errors) { |
|
551 | 551 | throw new EE_Error( |
552 | 552 | __( |
553 | 553 | 'No class name has been provided for the specific configuration section.', |
@@ -560,8 +560,8 @@ discard block |
||
560 | 560 | break; |
561 | 561 | // TEST #6 : verify config class is accessible |
562 | 562 | case 6 : |
563 | - if ( ! class_exists( $config_class ) ) { |
|
564 | - if ( $display_errors ) { |
|
563 | + if ( ! class_exists($config_class)) { |
|
564 | + if ($display_errors) { |
|
565 | 565 | throw new EE_Error( |
566 | 566 | sprintf( |
567 | 567 | __( |
@@ -577,11 +577,11 @@ discard block |
||
577 | 577 | break; |
578 | 578 | // TEST #7 : check that config has even been set |
579 | 579 | case 7 : |
580 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
581 | - if ( $display_errors ) { |
|
580 | + if ( ! isset($this->{$section}->{$name} )) { |
|
581 | + if ($display_errors) { |
|
582 | 582 | throw new EE_Error( |
583 | 583 | sprintf( |
584 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
584 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
585 | 585 | $section, |
586 | 586 | $name |
587 | 587 | ) |
@@ -590,13 +590,13 @@ discard block |
||
590 | 590 | return false; |
591 | 591 | } else { |
592 | 592 | // and make sure it's not serialized |
593 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
593 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
594 | 594 | } |
595 | 595 | break; |
596 | 596 | // TEST #8 : check that config is the requested type |
597 | 597 | case 8 : |
598 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
599 | - if ( $display_errors ) { |
|
598 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
599 | + if ($display_errors) { |
|
600 | 600 | throw new EE_Error( |
601 | 601 | sprintf( |
602 | 602 | __( |
@@ -614,12 +614,12 @@ discard block |
||
614 | 614 | break; |
615 | 615 | // TEST #9 : verify config object |
616 | 616 | case 9 : |
617 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
618 | - if ( $display_errors ) { |
|
617 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
618 | + if ($display_errors) { |
|
619 | 619 | throw new EE_Error( |
620 | 620 | sprintf( |
621 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
622 | - print_r( $config_obj, true ) |
|
621 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
622 | + print_r($config_obj, true) |
|
623 | 623 | ) |
624 | 624 | ); |
625 | 625 | } |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | break; |
629 | 629 | } |
630 | 630 | } |
631 | - } catch ( EE_Error $e ) { |
|
631 | + } catch (EE_Error $e) { |
|
632 | 632 | $e->get_error(); |
633 | 633 | } |
634 | 634 | // you have successfully run the gauntlet |
@@ -645,8 +645,8 @@ discard block |
||
645 | 645 | * @param string $name |
646 | 646 | * @return string |
647 | 647 | */ |
648 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
649 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
648 | + private function _generate_config_option_name($section = '', $name = '') { |
|
649 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | |
@@ -660,10 +660,10 @@ discard block |
||
660 | 660 | * @param string $name |
661 | 661 | * @return string |
662 | 662 | */ |
663 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
664 | - return ! empty( $config_class ) |
|
663 | + private function _set_config_class($config_class = '', $name = '') { |
|
664 | + return ! empty($config_class) |
|
665 | 665 | ? $config_class |
666 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
666 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | |
@@ -678,36 +678,36 @@ discard block |
||
678 | 678 | * @param EE_Config_Base $config_obj |
679 | 679 | * @return EE_Config_Base |
680 | 680 | */ |
681 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
681 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
682 | 682 | // ensure config class is set to something |
683 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
683 | + $config_class = $this->_set_config_class($config_class, $name); |
|
684 | 684 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
685 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
685 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
686 | 686 | return null; |
687 | 687 | } |
688 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
688 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
689 | 689 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
690 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
691 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
690 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
691 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
692 | 692 | $this->update_addon_option_names(); |
693 | 693 | } |
694 | 694 | // verify the incoming config object but suppress errors |
695 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
695 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
696 | 696 | $config_obj = new $config_class(); |
697 | 697 | } |
698 | - if ( get_option( $config_option_name ) ) { |
|
699 | - EE_Config::log( $config_option_name ); |
|
700 | - update_option( $config_option_name, $config_obj ); |
|
698 | + if (get_option($config_option_name)) { |
|
699 | + EE_Config::log($config_option_name); |
|
700 | + update_option($config_option_name, $config_obj); |
|
701 | 701 | $this->{$section}->{$name} = $config_obj; |
702 | 702 | return $this->{$section}->{$name}; |
703 | 703 | } else { |
704 | 704 | // create a wp-option for this config |
705 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
706 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
705 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
706 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
707 | 707 | return $this->{$section}->{$name}; |
708 | 708 | } else { |
709 | 709 | EE_Error::add_error( |
710 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
710 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
711 | 711 | __FILE__, |
712 | 712 | __FUNCTION__, |
713 | 713 | __LINE__ |
@@ -730,46 +730,46 @@ discard block |
||
730 | 730 | * @param bool $throw_errors |
731 | 731 | * @return bool |
732 | 732 | */ |
733 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
733 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
734 | 734 | // don't allow config updates during WP heartbeats |
735 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
735 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
736 | 736 | return false; |
737 | 737 | } |
738 | - $config_obj = maybe_unserialize( $config_obj ); |
|
738 | + $config_obj = maybe_unserialize($config_obj); |
|
739 | 739 | // get class name of the incoming object |
740 | - $config_class = get_class( $config_obj ); |
|
740 | + $config_class = get_class($config_obj); |
|
741 | 741 | // run tests 1-5 and 9 to verify config |
742 | 742 | if ( ! $this->_verify_config_params( |
743 | 743 | $section, |
744 | 744 | $name, |
745 | 745 | $config_class, |
746 | 746 | $config_obj, |
747 | - array( 1, 2, 3, 4, 7, 9 ) |
|
747 | + array(1, 2, 3, 4, 7, 9) |
|
748 | 748 | ) |
749 | 749 | ) { |
750 | 750 | return false; |
751 | 751 | } |
752 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
752 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
753 | 753 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
754 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
754 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
755 | 755 | // save new config to db |
756 | - if( $this->set_config( $section, $name, $config_class, $config_obj ) ) { |
|
756 | + if ($this->set_config($section, $name, $config_class, $config_obj)) { |
|
757 | 757 | return true; |
758 | 758 | } |
759 | 759 | } else { |
760 | 760 | // first check if the record already exists |
761 | - $existing_config = get_option( $config_option_name ); |
|
762 | - $config_obj = serialize( $config_obj ); |
|
761 | + $existing_config = get_option($config_option_name); |
|
762 | + $config_obj = serialize($config_obj); |
|
763 | 763 | // just return if db record is already up to date (NOT type safe comparison) |
764 | - if ( $existing_config == $config_obj ) { |
|
764 | + if ($existing_config == $config_obj) { |
|
765 | 765 | $this->{$section}->{$name} = $config_obj; |
766 | 766 | return true; |
767 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
768 | - EE_Config::log( $config_option_name ); |
|
767 | + } else if (update_option($config_option_name, $config_obj)) { |
|
768 | + EE_Config::log($config_option_name); |
|
769 | 769 | // update wp-option for this config class |
770 | 770 | $this->{$section}->{$name} = $config_obj; |
771 | 771 | return true; |
772 | - } elseif ( $throw_errors ) { |
|
772 | + } elseif ($throw_errors) { |
|
773 | 773 | EE_Error::add_error( |
774 | 774 | sprintf( |
775 | 775 | __( |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | 'event_espresso' |
778 | 778 | ), |
779 | 779 | $config_class, |
780 | - 'EE_Config->' . $section . '->' . $name |
|
780 | + 'EE_Config->'.$section.'->'.$name |
|
781 | 781 | ), |
782 | 782 | __FILE__, |
783 | 783 | __FUNCTION__, |
@@ -799,34 +799,34 @@ discard block |
||
799 | 799 | * @param string $config_class |
800 | 800 | * @return mixed EE_Config_Base | NULL |
801 | 801 | */ |
802 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
802 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
803 | 803 | // ensure config class is set to something |
804 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
804 | + $config_class = $this->_set_config_class($config_class, $name); |
|
805 | 805 | // run tests 1-4, 6 and 7 to verify that all params have been set |
806 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
806 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
807 | 807 | return null; |
808 | 808 | } |
809 | 809 | // now test if the requested config object exists, but suppress errors |
810 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
810 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
811 | 811 | // config already exists, so pass it back |
812 | 812 | return $this->{$section}->{$name}; |
813 | 813 | } |
814 | 814 | // load config option from db if it exists |
815 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
815 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
816 | 816 | // verify the newly retrieved config object, but suppress errors |
817 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
817 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
818 | 818 | // config is good, so set it and pass it back |
819 | 819 | $this->{$section}->{$name} = $config_obj; |
820 | 820 | return $this->{$section}->{$name}; |
821 | 821 | } |
822 | 822 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
823 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
823 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
824 | 824 | // verify the newly created config object |
825 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
825 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
826 | 826 | return $this->{$section}->{$name}; |
827 | 827 | } else { |
828 | 828 | EE_Error::add_error( |
829 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
829 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
830 | 830 | __FILE__, |
831 | 831 | __FUNCTION__, |
832 | 832 | __LINE__ |
@@ -844,11 +844,11 @@ discard block |
||
844 | 844 | * @param string $config_option_name |
845 | 845 | * @return mixed EE_Config_Base | FALSE |
846 | 846 | */ |
847 | - public function get_config_option( $config_option_name = '' ) { |
|
847 | + public function get_config_option($config_option_name = '') { |
|
848 | 848 | // retrieve the wp-option for this config class. |
849 | - $config_option = maybe_unserialize( get_option( $config_option_name, array() ) ); |
|
850 | - if ( empty( $config_option ) ) { |
|
851 | - EE_Config::log( $config_option_name . '-NOT-FOUND' ); |
|
849 | + $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
850 | + if (empty($config_option)) { |
|
851 | + EE_Config::log($config_option_name.'-NOT-FOUND'); |
|
852 | 852 | } |
853 | 853 | return $config_option; |
854 | 854 | } |
@@ -860,17 +860,17 @@ discard block |
||
860 | 860 | * |
861 | 861 | * @param string $config_option_name |
862 | 862 | */ |
863 | - public static function log( $config_option_name = '' ) { |
|
864 | - if ( ! empty( $config_option_name ) ) { |
|
865 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
863 | + public static function log($config_option_name = '') { |
|
864 | + if ( ! empty($config_option_name)) { |
|
865 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
866 | 866 | //copy incoming $_REQUEST and sanitize it so we can save it |
867 | 867 | $_request = $_REQUEST; |
868 | - array_walk_recursive( $_request, 'sanitize_text_field' ); |
|
869 | - $config_log[ (string) microtime( true ) ] = array( |
|
868 | + array_walk_recursive($_request, 'sanitize_text_field'); |
|
869 | + $config_log[(string) microtime(true)] = array( |
|
870 | 870 | 'config_name' => $config_option_name, |
871 | 871 | 'request' => $_request, |
872 | 872 | ); |
873 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
873 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
874 | 874 | } |
875 | 875 | } |
876 | 876 | |
@@ -881,12 +881,12 @@ discard block |
||
881 | 881 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
882 | 882 | */ |
883 | 883 | public static function trim_log() { |
884 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
885 | - $log_length = count( $config_log ); |
|
886 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
887 | - ksort( $config_log ); |
|
888 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
889 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
884 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
885 | + $log_length = count($config_log); |
|
886 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
887 | + ksort($config_log); |
|
888 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
889 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
890 | 890 | } |
891 | 891 | } |
892 | 892 | |
@@ -901,14 +901,14 @@ discard block |
||
901 | 901 | * @return string |
902 | 902 | */ |
903 | 903 | public static function get_page_for_posts() { |
904 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
905 | - if ( ! $page_for_posts ) { |
|
904 | + $page_for_posts = get_option('page_for_posts'); |
|
905 | + if ( ! $page_for_posts) { |
|
906 | 906 | return 'posts'; |
907 | 907 | } |
908 | 908 | /** @type WPDB $wpdb */ |
909 | 909 | global $wpdb; |
910 | 910 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
911 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
911 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
912 | 912 | } |
913 | 913 | |
914 | 914 | |
@@ -964,17 +964,17 @@ discard block |
||
964 | 964 | ) |
965 | 965 | ) { |
966 | 966 | // grab list of installed widgets |
967 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
967 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
968 | 968 | // filter list of modules to register |
969 | 969 | $widgets_to_register = apply_filters( |
970 | 970 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
971 | 971 | $widgets_to_register |
972 | 972 | ); |
973 | - if ( ! empty( $widgets_to_register ) ) { |
|
973 | + if ( ! empty($widgets_to_register)) { |
|
974 | 974 | // cycle thru widget folders |
975 | - foreach ( $widgets_to_register as $widget_path ) { |
|
975 | + foreach ($widgets_to_register as $widget_path) { |
|
976 | 976 | // add to list of installed widget modules |
977 | - EE_Config::register_ee_widget( $widget_path ); |
|
977 | + EE_Config::register_ee_widget($widget_path); |
|
978 | 978 | } |
979 | 979 | } |
980 | 980 | // filter list of installed modules |
@@ -994,57 +994,57 @@ discard block |
||
994 | 994 | * @param string $widget_path - full path up to and including widget folder |
995 | 995 | * @return void |
996 | 996 | */ |
997 | - public static function register_ee_widget( $widget_path = null ) { |
|
998 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
997 | + public static function register_ee_widget($widget_path = null) { |
|
998 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
999 | 999 | $widget_ext = '.widget.php'; |
1000 | 1000 | // make all separators match |
1001 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
1001 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
1002 | 1002 | // does the file path INCLUDE the actual file name as part of the path ? |
1003 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
1003 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
1004 | 1004 | // grab and shortcode file name from directory name and break apart at dots |
1005 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
1005 | + $file_name = explode('.', basename($widget_path)); |
|
1006 | 1006 | // take first segment from file name pieces and remove class prefix if it exists |
1007 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
1007 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
1008 | 1008 | // sanitize shortcode directory name |
1009 | - $widget = sanitize_key( $widget ); |
|
1009 | + $widget = sanitize_key($widget); |
|
1010 | 1010 | // now we need to rebuild the shortcode path |
1011 | - $widget_path = explode( DS, $widget_path ); |
|
1011 | + $widget_path = explode(DS, $widget_path); |
|
1012 | 1012 | // remove last segment |
1013 | - array_pop( $widget_path ); |
|
1013 | + array_pop($widget_path); |
|
1014 | 1014 | // glue it back together |
1015 | - $widget_path = implode( DS, $widget_path ); |
|
1015 | + $widget_path = implode(DS, $widget_path); |
|
1016 | 1016 | } else { |
1017 | 1017 | // grab and sanitize widget directory name |
1018 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
1018 | + $widget = sanitize_key(basename($widget_path)); |
|
1019 | 1019 | } |
1020 | 1020 | // create classname from widget directory name |
1021 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
1021 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1022 | 1022 | // add class prefix |
1023 | - $widget_class = 'EEW_' . $widget; |
|
1023 | + $widget_class = 'EEW_'.$widget; |
|
1024 | 1024 | // does the widget exist ? |
1025 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
1025 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
1026 | 1026 | $msg = sprintf( |
1027 | 1027 | __( |
1028 | 1028 | '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', |
1029 | 1029 | 'event_espresso' |
1030 | 1030 | ), |
1031 | 1031 | $widget_class, |
1032 | - $widget_path . DS . $widget_class . $widget_ext |
|
1032 | + $widget_path.DS.$widget_class.$widget_ext |
|
1033 | 1033 | ); |
1034 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1034 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1035 | 1035 | return; |
1036 | 1036 | } |
1037 | 1037 | // load the widget class file |
1038 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
1038 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
1039 | 1039 | // verify that class exists |
1040 | - if ( ! class_exists( $widget_class ) ) { |
|
1041 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
1042 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1040 | + if ( ! class_exists($widget_class)) { |
|
1041 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1042 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1043 | 1043 | return; |
1044 | 1044 | } |
1045 | - register_widget( $widget_class ); |
|
1045 | + register_widget($widget_class); |
|
1046 | 1046 | // add to array of registered widgets |
1047 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
1047 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
1048 | 1048 | } |
1049 | 1049 | |
1050 | 1050 | |
@@ -1057,17 +1057,17 @@ discard block |
||
1057 | 1057 | */ |
1058 | 1058 | private function _register_shortcodes() { |
1059 | 1059 | // grab list of installed shortcodes |
1060 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1060 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1061 | 1061 | // filter list of modules to register |
1062 | 1062 | $shortcodes_to_register = apply_filters( |
1063 | 1063 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
1064 | 1064 | $shortcodes_to_register |
1065 | 1065 | ); |
1066 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1066 | + if ( ! empty($shortcodes_to_register)) { |
|
1067 | 1067 | // cycle thru shortcode folders |
1068 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1068 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1069 | 1069 | // add to list of installed shortcode modules |
1070 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1070 | + EE_Config::register_shortcode($shortcode_path); |
|
1071 | 1071 | } |
1072 | 1072 | } |
1073 | 1073 | // filter list of installed modules |
@@ -1086,64 +1086,64 @@ discard block |
||
1086 | 1086 | * @param string $shortcode_path - full path up to and including shortcode folder |
1087 | 1087 | * @return bool |
1088 | 1088 | */ |
1089 | - public static function register_shortcode( $shortcode_path = null ) { |
|
1090 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
1089 | + public static function register_shortcode($shortcode_path = null) { |
|
1090 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1091 | 1091 | $shortcode_ext = '.shortcode.php'; |
1092 | 1092 | // make all separators match |
1093 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1093 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1094 | 1094 | // does the file path INCLUDE the actual file name as part of the path ? |
1095 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
1095 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
1096 | 1096 | // grab shortcode file name from directory name and break apart at dots |
1097 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
1097 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1098 | 1098 | // take first segment from file name pieces and remove class prefix if it exists |
1099 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
1100 | - ? substr( $shortcode_file[0], 4 ) |
|
1099 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
1100 | + ? substr($shortcode_file[0], 4) |
|
1101 | 1101 | : $shortcode_file[0]; |
1102 | 1102 | // sanitize shortcode directory name |
1103 | - $shortcode = sanitize_key( $shortcode ); |
|
1103 | + $shortcode = sanitize_key($shortcode); |
|
1104 | 1104 | // now we need to rebuild the shortcode path |
1105 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1105 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1106 | 1106 | // remove last segment |
1107 | - array_pop( $shortcode_path ); |
|
1107 | + array_pop($shortcode_path); |
|
1108 | 1108 | // glue it back together |
1109 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1109 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1110 | 1110 | } else { |
1111 | 1111 | // we need to generate the filename based off of the folder name |
1112 | 1112 | // grab and sanitize shortcode directory name |
1113 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
1114 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1113 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1114 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1115 | 1115 | } |
1116 | 1116 | // create classname from shortcode directory or file name |
1117 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
1117 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1118 | 1118 | // add class prefix |
1119 | - $shortcode_class = 'EES_' . $shortcode; |
|
1119 | + $shortcode_class = 'EES_'.$shortcode; |
|
1120 | 1120 | // does the shortcode exist ? |
1121 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
1121 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1122 | 1122 | $msg = sprintf( |
1123 | 1123 | __( |
1124 | 1124 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
1125 | 1125 | 'event_espresso' |
1126 | 1126 | ), |
1127 | 1127 | $shortcode_class, |
1128 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1128 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1129 | 1129 | ); |
1130 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1130 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1131 | 1131 | return false; |
1132 | 1132 | } |
1133 | 1133 | // load the shortcode class file |
1134 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1134 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1135 | 1135 | // verify that class exists |
1136 | - if ( ! class_exists( $shortcode_class ) ) { |
|
1136 | + if ( ! class_exists($shortcode_class)) { |
|
1137 | 1137 | $msg = sprintf( |
1138 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
1138 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
1139 | 1139 | $shortcode_class |
1140 | 1140 | ); |
1141 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1141 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1142 | 1142 | return false; |
1143 | 1143 | } |
1144 | - $shortcode = strtoupper( $shortcode ); |
|
1144 | + $shortcode = strtoupper($shortcode); |
|
1145 | 1145 | // add to array of registered shortcodes |
1146 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1146 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1147 | 1147 | return true; |
1148 | 1148 | } |
1149 | 1149 | |
@@ -1157,22 +1157,22 @@ discard block |
||
1157 | 1157 | */ |
1158 | 1158 | private function _register_modules() { |
1159 | 1159 | // grab list of installed modules |
1160 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1160 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1161 | 1161 | // filter list of modules to register |
1162 | 1162 | $modules_to_register = apply_filters( |
1163 | 1163 | 'FHEE__EE_Config__register_modules__modules_to_register', |
1164 | 1164 | $modules_to_register |
1165 | 1165 | ); |
1166 | - if ( ! empty( $modules_to_register ) ) { |
|
1166 | + if ( ! empty($modules_to_register)) { |
|
1167 | 1167 | // loop through folders |
1168 | - foreach ( $modules_to_register as $module_path ) { |
|
1168 | + foreach ($modules_to_register as $module_path) { |
|
1169 | 1169 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1170 | 1170 | if ( |
1171 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1172 | - && $module_path !== EE_MODULES . 'gateways' |
|
1171 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
1172 | + && $module_path !== EE_MODULES.'gateways' |
|
1173 | 1173 | ) { |
1174 | 1174 | // add to list of installed modules |
1175 | - EE_Config::register_module( $module_path ); |
|
1175 | + EE_Config::register_module($module_path); |
|
1176 | 1176 | } |
1177 | 1177 | } |
1178 | 1178 | } |
@@ -1192,39 +1192,39 @@ discard block |
||
1192 | 1192 | * @param string $module_path - full path up to and including module folder |
1193 | 1193 | * @return bool |
1194 | 1194 | */ |
1195 | - public static function register_module( $module_path = null ) { |
|
1196 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1195 | + public static function register_module($module_path = null) { |
|
1196 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1197 | 1197 | $module_ext = '.module.php'; |
1198 | 1198 | // make all separators match |
1199 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1199 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1200 | 1200 | // does the file path INCLUDE the actual file name as part of the path ? |
1201 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
1201 | + if (strpos($module_path, $module_ext) !== false) { |
|
1202 | 1202 | // grab and shortcode file name from directory name and break apart at dots |
1203 | - $module_file = explode( '.', basename( $module_path ) ); |
|
1203 | + $module_file = explode('.', basename($module_path)); |
|
1204 | 1204 | // now we need to rebuild the shortcode path |
1205 | - $module_path = explode( DS, $module_path ); |
|
1205 | + $module_path = explode(DS, $module_path); |
|
1206 | 1206 | // remove last segment |
1207 | - array_pop( $module_path ); |
|
1207 | + array_pop($module_path); |
|
1208 | 1208 | // glue it back together |
1209 | - $module_path = implode( DS, $module_path ) . DS; |
|
1209 | + $module_path = implode(DS, $module_path).DS; |
|
1210 | 1210 | // take first segment from file name pieces and sanitize it |
1211 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1211 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1212 | 1212 | // ensure class prefix is added |
1213 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1213 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1214 | 1214 | } else { |
1215 | 1215 | // we need to generate the filename based off of the folder name |
1216 | 1216 | // grab and sanitize module name |
1217 | - $module = strtolower( basename( $module_path ) ); |
|
1218 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
1217 | + $module = strtolower(basename($module_path)); |
|
1218 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1219 | 1219 | // like trailingslashit() |
1220 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1220 | + $module_path = rtrim($module_path, DS).DS; |
|
1221 | 1221 | // create classname from module directory name |
1222 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
1222 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1223 | 1223 | // add class prefix |
1224 | - $module_class = 'EED_' . $module; |
|
1224 | + $module_class = 'EED_'.$module; |
|
1225 | 1225 | } |
1226 | 1226 | // does the module exist ? |
1227 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
1227 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1228 | 1228 | $msg = sprintf( |
1229 | 1229 | __( |
1230 | 1230 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1232,19 +1232,19 @@ discard block |
||
1232 | 1232 | ), |
1233 | 1233 | $module |
1234 | 1234 | ); |
1235 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1235 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1236 | 1236 | return false; |
1237 | 1237 | } |
1238 | 1238 | // load the module class file |
1239 | - require_once( $module_path . $module_class . $module_ext ); |
|
1239 | + require_once($module_path.$module_class.$module_ext); |
|
1240 | 1240 | // verify that class exists |
1241 | - if ( ! class_exists( $module_class ) ) { |
|
1242 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1243 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1241 | + if ( ! class_exists($module_class)) { |
|
1242 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1243 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1244 | 1244 | return false; |
1245 | 1245 | } |
1246 | 1246 | // add to array of registered modules |
1247 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1247 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1248 | 1248 | do_action( |
1249 | 1249 | 'AHEE__EE_Config__register_module__complete', |
1250 | 1250 | $module_class, |
@@ -1264,26 +1264,26 @@ discard block |
||
1264 | 1264 | */ |
1265 | 1265 | private function _initialize_shortcodes() { |
1266 | 1266 | // cycle thru shortcode folders |
1267 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1267 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1268 | 1268 | // add class prefix |
1269 | - $shortcode_class = 'EES_' . $shortcode; |
|
1269 | + $shortcode_class = 'EES_'.$shortcode; |
|
1270 | 1270 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1271 | 1271 | // which set hooks ? |
1272 | - if ( is_admin() ) { |
|
1272 | + if (is_admin()) { |
|
1273 | 1273 | // fire immediately |
1274 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
1274 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1275 | 1275 | } else { |
1276 | 1276 | // delay until other systems are online |
1277 | 1277 | add_action( |
1278 | 1278 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1279 | - array( $shortcode_class, 'set_hooks' ) |
|
1279 | + array($shortcode_class, 'set_hooks') |
|
1280 | 1280 | ); |
1281 | 1281 | // convert classname to UPPERCASE and create WP shortcode. |
1282 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1282 | + $shortcode_tag = strtoupper($shortcode); |
|
1283 | 1283 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1284 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
1284 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1285 | 1285 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1286 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
1286 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1287 | 1287 | } |
1288 | 1288 | } |
1289 | 1289 | } |
@@ -1300,17 +1300,17 @@ discard block |
||
1300 | 1300 | */ |
1301 | 1301 | private function _initialize_modules() { |
1302 | 1302 | // cycle thru shortcode folders |
1303 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1303 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1304 | 1304 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1305 | 1305 | // which set hooks ? |
1306 | - if ( is_admin() ) { |
|
1306 | + if (is_admin()) { |
|
1307 | 1307 | // fire immediately |
1308 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
1308 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1309 | 1309 | } else { |
1310 | 1310 | // delay until other systems are online |
1311 | 1311 | add_action( |
1312 | 1312 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1313 | - array( $module_class, 'set_hooks' ) |
|
1313 | + array($module_class, 'set_hooks') |
|
1314 | 1314 | ); |
1315 | 1315 | } |
1316 | 1316 | } |
@@ -1328,29 +1328,29 @@ discard block |
||
1328 | 1328 | * @param string $key - url param key indicating a route is being called |
1329 | 1329 | * @return bool |
1330 | 1330 | */ |
1331 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
1332 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1333 | - $module = str_replace( 'EED_', '', $module ); |
|
1334 | - $module_class = 'EED_' . $module; |
|
1335 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
1336 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1337 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1331 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
1332 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1333 | + $module = str_replace('EED_', '', $module); |
|
1334 | + $module_class = 'EED_'.$module; |
|
1335 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1336 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1337 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1338 | 1338 | return false; |
1339 | 1339 | } |
1340 | - if ( empty( $route ) ) { |
|
1341 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1342 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1340 | + if (empty($route)) { |
|
1341 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1342 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1343 | 1343 | return false; |
1344 | 1344 | } |
1345 | - if ( ! method_exists( 'EED_' . $module, $method_name ) ) { |
|
1345 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1346 | 1346 | $msg = sprintf( |
1347 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
1347 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1348 | 1348 | $route |
1349 | 1349 | ); |
1350 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1350 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1351 | 1351 | return false; |
1352 | 1352 | } |
1353 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1353 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1354 | 1354 | return true; |
1355 | 1355 | } |
1356 | 1356 | |
@@ -1364,11 +1364,11 @@ discard block |
||
1364 | 1364 | * @param string $key - url param key indicating a route is being called |
1365 | 1365 | * @return string |
1366 | 1366 | */ |
1367 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
1368 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
1369 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
1370 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
1371 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1367 | + public static function get_route($route = null, $key = 'ee') { |
|
1368 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1369 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1370 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1371 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1372 | 1372 | } |
1373 | 1373 | return null; |
1374 | 1374 | } |
@@ -1398,49 +1398,49 @@ discard block |
||
1398 | 1398 | * @param string $key - url param key indicating a route is being called |
1399 | 1399 | * @return bool |
1400 | 1400 | */ |
1401 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
1402 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
1403 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1401 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
1402 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1403 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1404 | 1404 | $msg = sprintf( |
1405 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
1405 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1406 | 1406 | $route |
1407 | 1407 | ); |
1408 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1408 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1409 | 1409 | return false; |
1410 | 1410 | } |
1411 | - if ( empty( $forward ) ) { |
|
1412 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1413 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1411 | + if (empty($forward)) { |
|
1412 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1413 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1414 | 1414 | return false; |
1415 | 1415 | } |
1416 | - if ( is_array( $forward ) ) { |
|
1417 | - if ( ! isset( $forward[1] ) ) { |
|
1416 | + if (is_array($forward)) { |
|
1417 | + if ( ! isset($forward[1])) { |
|
1418 | 1418 | $msg = sprintf( |
1419 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
1419 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1420 | 1420 | $route |
1421 | 1421 | ); |
1422 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1422 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1423 | 1423 | return false; |
1424 | 1424 | } |
1425 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
1425 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1426 | 1426 | $msg = sprintf( |
1427 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1427 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1428 | 1428 | $forward[1], |
1429 | 1429 | $route |
1430 | 1430 | ); |
1431 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1431 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1432 | 1432 | return false; |
1433 | 1433 | } |
1434 | - } else if ( ! function_exists( $forward ) ) { |
|
1434 | + } else if ( ! function_exists($forward)) { |
|
1435 | 1435 | $msg = sprintf( |
1436 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1436 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1437 | 1437 | $forward, |
1438 | 1438 | $route |
1439 | 1439 | ); |
1440 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1440 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1441 | 1441 | return false; |
1442 | 1442 | } |
1443 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1443 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1444 | 1444 | return true; |
1445 | 1445 | } |
1446 | 1446 | |
@@ -1456,12 +1456,12 @@ discard block |
||
1456 | 1456 | * @param string $key - url param key indicating a route is being called |
1457 | 1457 | * @return string |
1458 | 1458 | */ |
1459 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
1460 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
1461 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
1459 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
1460 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1461 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1462 | 1462 | return apply_filters( |
1463 | 1463 | 'FHEE__EE_Config__get_forward', |
1464 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1464 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
1465 | 1465 | $route, |
1466 | 1466 | $status |
1467 | 1467 | ); |
@@ -1483,17 +1483,17 @@ discard block |
||
1483 | 1483 | * @param string $key - url param key indicating a route is being called |
1484 | 1484 | * @return bool |
1485 | 1485 | */ |
1486 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
1487 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
1488 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1486 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
1487 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1488 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1489 | 1489 | $msg = sprintf( |
1490 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
1490 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1491 | 1491 | $route |
1492 | 1492 | ); |
1493 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1493 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1494 | 1494 | return false; |
1495 | 1495 | } |
1496 | - if ( ! is_readable( $view ) ) { |
|
1496 | + if ( ! is_readable($view)) { |
|
1497 | 1497 | $msg = sprintf( |
1498 | 1498 | __( |
1499 | 1499 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1501,10 +1501,10 @@ discard block |
||
1501 | 1501 | ), |
1502 | 1502 | $view |
1503 | 1503 | ); |
1504 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1504 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1505 | 1505 | return false; |
1506 | 1506 | } |
1507 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1507 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1508 | 1508 | return true; |
1509 | 1509 | } |
1510 | 1510 | |
@@ -1520,12 +1520,12 @@ discard block |
||
1520 | 1520 | * @param string $key - url param key indicating a route is being called |
1521 | 1521 | * @return string |
1522 | 1522 | */ |
1523 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
1524 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
1525 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
1523 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
1524 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1525 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1526 | 1526 | return apply_filters( |
1527 | 1527 | 'FHEE__EE_Config__get_view', |
1528 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1528 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
1529 | 1529 | $route, |
1530 | 1530 | $status |
1531 | 1531 | ); |
@@ -1536,7 +1536,7 @@ discard block |
||
1536 | 1536 | |
1537 | 1537 | |
1538 | 1538 | public function update_addon_option_names() { |
1539 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
1539 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1540 | 1540 | } |
1541 | 1541 | |
1542 | 1542 | |
@@ -1564,22 +1564,22 @@ discard block |
||
1564 | 1564 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1565 | 1565 | * @throws \EE_Error |
1566 | 1566 | */ |
1567 | - public function get_pretty( $property ) { |
|
1568 | - if ( ! property_exists( $this, $property ) ) { |
|
1567 | + public function get_pretty($property) { |
|
1568 | + if ( ! property_exists($this, $property)) { |
|
1569 | 1569 | throw new EE_Error( |
1570 | 1570 | sprintf( |
1571 | 1571 | __( |
1572 | 1572 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
1573 | 1573 | 'event_espresso' |
1574 | 1574 | ), |
1575 | - get_class( $this ), |
|
1575 | + get_class($this), |
|
1576 | 1576 | $property |
1577 | 1577 | ) |
1578 | 1578 | ); |
1579 | 1579 | } |
1580 | 1580 | //just handling escaping of strings for now. |
1581 | - if ( is_string( $this->{$property} ) ) { |
|
1582 | - return stripslashes( $this->{$property} ); |
|
1581 | + if (is_string($this->{$property} )) { |
|
1582 | + return stripslashes($this->{$property} ); |
|
1583 | 1583 | } |
1584 | 1584 | return $this->{$property}; |
1585 | 1585 | } |
@@ -1588,17 +1588,17 @@ discard block |
||
1588 | 1588 | |
1589 | 1589 | public function populate() { |
1590 | 1590 | //grab defaults via a new instance of this class. |
1591 | - $class_name = get_class( $this ); |
|
1591 | + $class_name = get_class($this); |
|
1592 | 1592 | $defaults = new $class_name; |
1593 | 1593 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1594 | 1594 | //default from our $defaults object. |
1595 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1596 | - if ( $this->{$property} === null ) { |
|
1595 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1596 | + if ($this->{$property} === null) { |
|
1597 | 1597 | $this->{$property} = $value; |
1598 | 1598 | } |
1599 | 1599 | } |
1600 | 1600 | //cleanup |
1601 | - unset( $defaults ); |
|
1601 | + unset($defaults); |
|
1602 | 1602 | } |
1603 | 1603 | |
1604 | 1604 | |
@@ -1614,7 +1614,7 @@ discard block |
||
1614 | 1614 | * @param $a |
1615 | 1615 | * @return bool |
1616 | 1616 | */ |
1617 | - public function __isset( $a ) { |
|
1617 | + public function __isset($a) { |
|
1618 | 1618 | return false; |
1619 | 1619 | } |
1620 | 1620 | |
@@ -1626,7 +1626,7 @@ discard block |
||
1626 | 1626 | * @param $a |
1627 | 1627 | * @return bool |
1628 | 1628 | */ |
1629 | - public function __unset( $a ) { |
|
1629 | + public function __unset($a) { |
|
1630 | 1630 | return false; |
1631 | 1631 | } |
1632 | 1632 | |
@@ -1736,7 +1736,7 @@ discard block |
||
1736 | 1736 | $this->current_blog_id = get_current_blog_id(); |
1737 | 1737 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1738 | 1738 | $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin(); |
1739 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
1739 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1740 | 1740 | $this->post_shortcodes = array(); |
1741 | 1741 | $this->module_route_map = array(); |
1742 | 1742 | $this->module_forward_map = array(); |
@@ -1752,9 +1752,9 @@ discard block |
||
1752 | 1752 | $this->thank_you_page_url = ''; |
1753 | 1753 | $this->cancel_page_url = ''; |
1754 | 1754 | //cpt slugs |
1755 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
1755 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
1756 | 1756 | //ueip constant check |
1757 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1757 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1758 | 1758 | $this->ee_ueip_optin = false; |
1759 | 1759 | $this->ee_ueip_has_notified = true; |
1760 | 1760 | } |
@@ -1797,11 +1797,11 @@ discard block |
||
1797 | 1797 | * @return string |
1798 | 1798 | */ |
1799 | 1799 | public function reg_page_url() { |
1800 | - if ( ! $this->reg_page_url ) { |
|
1800 | + if ( ! $this->reg_page_url) { |
|
1801 | 1801 | $this->reg_page_url = add_query_arg( |
1802 | - array( 'uts' => time() ), |
|
1803 | - get_permalink( $this->reg_page_id ) |
|
1804 | - ) . '#checkout'; |
|
1802 | + array('uts' => time()), |
|
1803 | + get_permalink($this->reg_page_id) |
|
1804 | + ).'#checkout'; |
|
1805 | 1805 | } |
1806 | 1806 | return $this->reg_page_url; |
1807 | 1807 | } |
@@ -1816,12 +1816,12 @@ discard block |
||
1816 | 1816 | * @access public |
1817 | 1817 | * @return string |
1818 | 1818 | */ |
1819 | - public function txn_page_url( $query_args = array() ) { |
|
1820 | - if ( ! $this->txn_page_url ) { |
|
1821 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1819 | + public function txn_page_url($query_args = array()) { |
|
1820 | + if ( ! $this->txn_page_url) { |
|
1821 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1822 | 1822 | } |
1823 | - if ( $query_args ) { |
|
1824 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
1823 | + if ($query_args) { |
|
1824 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1825 | 1825 | } else { |
1826 | 1826 | return $this->txn_page_url; |
1827 | 1827 | } |
@@ -1837,12 +1837,12 @@ discard block |
||
1837 | 1837 | * @access public |
1838 | 1838 | * @return string |
1839 | 1839 | */ |
1840 | - public function thank_you_page_url( $query_args = array() ) { |
|
1841 | - if ( ! $this->thank_you_page_url ) { |
|
1842 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1840 | + public function thank_you_page_url($query_args = array()) { |
|
1841 | + if ( ! $this->thank_you_page_url) { |
|
1842 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1843 | 1843 | } |
1844 | - if ( $query_args ) { |
|
1845 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
1844 | + if ($query_args) { |
|
1845 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1846 | 1846 | } else { |
1847 | 1847 | return $this->thank_you_page_url; |
1848 | 1848 | } |
@@ -1857,8 +1857,8 @@ discard block |
||
1857 | 1857 | * @return string |
1858 | 1858 | */ |
1859 | 1859 | public function cancel_page_url() { |
1860 | - if ( ! $this->cancel_page_url ) { |
|
1861 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1860 | + if ( ! $this->cancel_page_url) { |
|
1861 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1862 | 1862 | } |
1863 | 1863 | return $this->cancel_page_url; |
1864 | 1864 | } |
@@ -1887,22 +1887,22 @@ discard block |
||
1887 | 1887 | */ |
1888 | 1888 | protected function _get_main_ee_ueip_optin() { |
1889 | 1889 | //if this is the main site then we can just bypass our direct query. |
1890 | - if ( is_main_site() ) { |
|
1891 | - return get_option( 'ee_ueip_optin', false ); |
|
1890 | + if (is_main_site()) { |
|
1891 | + return get_option('ee_ueip_optin', false); |
|
1892 | 1892 | } |
1893 | 1893 | |
1894 | 1894 | //is this already cached for this request? If so use it. |
1895 | - if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) { |
|
1895 | + if ( ! empty(EE_Core_Config::$ee_ueip_option)) { |
|
1896 | 1896 | return EE_Core_Config::$ee_ueip_option; |
1897 | 1897 | } |
1898 | 1898 | |
1899 | 1899 | global $wpdb; |
1900 | 1900 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
1901 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1901 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1902 | 1902 | $option = 'ee_ueip_optin'; |
1903 | 1903 | |
1904 | 1904 | //set correct table for query |
1905 | - $table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options'; |
|
1905 | + $table_name = $wpdb->get_blog_prefix($current_main_site_id).'options'; |
|
1906 | 1906 | |
1907 | 1907 | |
1908 | 1908 | //rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because |
@@ -1910,20 +1910,20 @@ discard block |
||
1910 | 1910 | //re-constructed on the blog switch. Note, we are still executing any core wp filters on this option retrieval. |
1911 | 1911 | //this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog |
1912 | 1912 | //for the purpose of caching. |
1913 | - $pre = apply_filters( 'pre_option_' . $option, false, $option ); |
|
1914 | - if ( false !== $pre ) { |
|
1913 | + $pre = apply_filters('pre_option_'.$option, false, $option); |
|
1914 | + if (false !== $pre) { |
|
1915 | 1915 | EE_Core_Config::$ee_ueip_option = $pre; |
1916 | 1916 | return EE_Core_Config::$ee_ueip_option; |
1917 | 1917 | } |
1918 | 1918 | |
1919 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) ); |
|
1920 | - if ( is_object( $row ) ) { |
|
1919 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option)); |
|
1920 | + if (is_object($row)) { |
|
1921 | 1921 | $value = $row->option_value; |
1922 | 1922 | } else { //option does not exist so use default. |
1923 | - return apply_filters( 'default_option_' . $option, false, $option ); |
|
1923 | + return apply_filters('default_option_'.$option, false, $option); |
|
1924 | 1924 | } |
1925 | 1925 | |
1926 | - EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option ); |
|
1926 | + EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option); |
|
1927 | 1927 | return EE_Core_Config::$ee_ueip_option; |
1928 | 1928 | } |
1929 | 1929 | |
@@ -1939,7 +1939,7 @@ discard block |
||
1939 | 1939 | //reset all url properties |
1940 | 1940 | $this->_reset_urls(); |
1941 | 1941 | //return what to save to db |
1942 | - return array_keys( get_object_vars( $this ) ); |
|
1942 | + return array_keys(get_object_vars($this)); |
|
1943 | 1943 | } |
1944 | 1944 | |
1945 | 1945 | } |
@@ -2086,14 +2086,14 @@ discard block |
||
2086 | 2086 | */ |
2087 | 2087 | public function __construct() { |
2088 | 2088 | // set default organization settings |
2089 | - $this->name = get_bloginfo( 'name' ); |
|
2089 | + $this->name = get_bloginfo('name'); |
|
2090 | 2090 | $this->address_1 = '123 Onna Road'; |
2091 | 2091 | $this->address_2 = 'PO Box 123'; |
2092 | 2092 | $this->city = 'Inna City'; |
2093 | 2093 | $this->STA_ID = 4; |
2094 | 2094 | $this->CNT_ISO = 'US'; |
2095 | 2095 | $this->zip = '12345'; |
2096 | - $this->email = get_bloginfo( 'admin_email' ); |
|
2096 | + $this->email = get_bloginfo('admin_email'); |
|
2097 | 2097 | $this->phone = ''; |
2098 | 2098 | $this->vat = '123456789'; |
2099 | 2099 | $this->logo_url = ''; |
@@ -2180,44 +2180,44 @@ discard block |
||
2180 | 2180 | * @access public |
2181 | 2181 | * @param string $CNT_ISO |
2182 | 2182 | */ |
2183 | - public function __construct( $CNT_ISO = '' ) { |
|
2183 | + public function __construct($CNT_ISO = '') { |
|
2184 | 2184 | // get country code from organization settings or use default |
2185 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
2185 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2186 | 2186 | && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
2187 | 2187 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2188 | 2188 | : ''; |
2189 | 2189 | // but override if requested |
2190 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
2190 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2191 | 2191 | // 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 |
2192 | 2192 | if ( |
2193 | - ! empty( $CNT_ISO ) |
|
2193 | + ! empty($CNT_ISO) |
|
2194 | 2194 | && EE_Maintenance_Mode::instance()->models_can_query() |
2195 | - && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
2195 | + && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table()) |
|
2196 | 2196 | ) { |
2197 | 2197 | // retrieve the country settings from the db, just in case they have been customized |
2198 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
2199 | - if ( $country instanceof EE_Country ) { |
|
2200 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2201 | - $this->name = $country->currency_name_single(); // Dollar |
|
2202 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2203 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2204 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2205 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2206 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2207 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2198 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2199 | + if ($country instanceof EE_Country) { |
|
2200 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2201 | + $this->name = $country->currency_name_single(); // Dollar |
|
2202 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2203 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2204 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2205 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2206 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2207 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2208 | 2208 | } |
2209 | 2209 | } |
2210 | 2210 | // fallback to hardcoded defaults, in case the above failed |
2211 | - if ( empty( $this->code ) ) { |
|
2211 | + if (empty($this->code)) { |
|
2212 | 2212 | // set default currency settings |
2213 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2214 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
2215 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
2216 | - $this->sign = '$'; // currency sign: $ |
|
2217 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2218 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2219 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2220 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2213 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2214 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
2215 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
2216 | + $this->sign = '$'; // currency sign: $ |
|
2217 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2218 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2219 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2220 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2221 | 2221 | } |
2222 | 2222 | } |
2223 | 2223 | } |
@@ -2379,7 +2379,7 @@ discard block |
||
2379 | 2379 | * @since 4.8.8.rc.019 |
2380 | 2380 | */ |
2381 | 2381 | public function do_hooks() { |
2382 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
2382 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2383 | 2383 | } |
2384 | 2384 | |
2385 | 2385 | |
@@ -2388,7 +2388,7 @@ discard block |
||
2388 | 2388 | * @return void |
2389 | 2389 | */ |
2390 | 2390 | public function set_default_reg_status_on_EEM_Event() { |
2391 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2391 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2392 | 2392 | } |
2393 | 2393 | |
2394 | 2394 | |
@@ -2492,10 +2492,10 @@ discard block |
||
2492 | 2492 | * @param bool $reset |
2493 | 2493 | * @return string |
2494 | 2494 | */ |
2495 | - public function log_file_name( $reset = false ) { |
|
2496 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2497 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2498 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2495 | + public function log_file_name($reset = false) { |
|
2496 | + if (empty($this->log_file_name) || $reset) { |
|
2497 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
2498 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2499 | 2499 | } |
2500 | 2500 | return $this->log_file_name; |
2501 | 2501 | } |
@@ -2506,10 +2506,10 @@ discard block |
||
2506 | 2506 | * @param bool $reset |
2507 | 2507 | * @return string |
2508 | 2508 | */ |
2509 | - public function debug_file_name( $reset = false ) { |
|
2510 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2511 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2512 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2509 | + public function debug_file_name($reset = false) { |
|
2510 | + if (empty($this->debug_file_name) || $reset) { |
|
2511 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
2512 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2513 | 2513 | } |
2514 | 2514 | return $this->debug_file_name; |
2515 | 2515 | } |
@@ -2691,21 +2691,21 @@ discard block |
||
2691 | 2691 | $this->use_google_maps = true; |
2692 | 2692 | $this->google_map_api_key = ''; |
2693 | 2693 | // for event details pages (reg page) |
2694 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2695 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2696 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2697 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2698 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2699 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2700 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2694 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2695 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2696 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2697 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2698 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2699 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2700 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2701 | 2701 | // for event list pages |
2702 | - $this->event_list_map_width = 300; // ee_map_width |
|
2703 | - $this->event_list_map_height = 185; // ee_map_height |
|
2704 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2705 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2706 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2707 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2708 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2702 | + $this->event_list_map_width = 300; // ee_map_width |
|
2703 | + $this->event_list_map_height = 185; // ee_map_height |
|
2704 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2705 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2706 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2707 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2708 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2709 | 2709 | } |
2710 | 2710 | |
2711 | 2711 | } |
@@ -2858,7 +2858,7 @@ discard block |
||
2858 | 2858 | * @return void |
2859 | 2859 | */ |
2860 | 2860 | protected function _set_php_values() { |
2861 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2861 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2862 | 2862 | $this->php->version = phpversion(); |
2863 | 2863 | } |
2864 | 2864 | |
@@ -2877,10 +2877,10 @@ discard block |
||
2877 | 2877 | * @type string $msg Any message to be displayed. |
2878 | 2878 | * } |
2879 | 2879 | */ |
2880 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2881 | - if ( ! empty( $this->php->max_input_vars ) |
|
2882 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2883 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2880 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2881 | + if ( ! empty($this->php->max_input_vars) |
|
2882 | + && ($input_count >= $this->php->max_input_vars) |
|
2883 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2884 | 2884 | ) { |
2885 | 2885 | return sprintf( |
2886 | 2886 | __( |
@@ -2946,7 +2946,7 @@ discard block |
||
2946 | 2946 | */ |
2947 | 2947 | public function __construct() { |
2948 | 2948 | $this->payment_settings = array(); |
2949 | - $this->active_gateways = array( 'Invoice' => false ); |
|
2949 | + $this->active_gateways = array('Invoice' => false); |
|
2950 | 2950 | } |
2951 | 2951 | } |
2952 | 2952 |
@@ -680,14 +680,12 @@ discard block |
||
680 | 680 | echo '<th scope="row" class="check-column">'; |
681 | 681 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
682 | 682 | echo '</th>'; |
683 | - } |
|
684 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
683 | + } elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
685 | 684 | echo "<td $attributes>"; |
686 | 685 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
687 | 686 | echo $this->handle_row_actions( $item, $column_name, $primary ); |
688 | 687 | echo "</td>"; |
689 | - } |
|
690 | - else { |
|
688 | + } else { |
|
691 | 689 | echo "<td $attributes>"; |
692 | 690 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
693 | 691 | echo $this->handle_row_actions( $item, $column_name, $primary ); |
@@ -709,7 +707,7 @@ discard block |
||
709 | 707 | if ( $which === 'top' ) { |
710 | 708 | $this->_filters(); |
711 | 709 | echo $this->_get_hidden_fields(); |
712 | - }else{ |
|
710 | + } else{ |
|
713 | 711 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
714 | 712 | foreach($this->_bottom_buttons as $type => $action){ |
715 | 713 | $route = isset( $action['route'] ) ? $action['route'] : ''; |
@@ -784,19 +784,19 @@ |
||
784 | 784 | $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : ''; |
785 | 785 | $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : ''; |
786 | 786 | $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
787 | - try { |
|
788 | - $content .= apply_filters( |
|
789 | - 'FHEE__EE_Admin_List_Table___action_string__action_items', |
|
790 | - $action_items, |
|
791 | - $item, |
|
792 | - $this |
|
793 | - ); |
|
794 | - } catch (\Exception $e) { |
|
795 | - if (WP_DEBUG) { |
|
796 | - \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
797 | - } |
|
798 | - $content .= $action_items; |
|
799 | - } |
|
787 | + try { |
|
788 | + $content .= apply_filters( |
|
789 | + 'FHEE__EE_Admin_List_Table___action_string__action_items', |
|
790 | + $action_items, |
|
791 | + $item, |
|
792 | + $this |
|
793 | + ); |
|
794 | + } catch (\Exception $e) { |
|
795 | + if (WP_DEBUG) { |
|
796 | + \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
797 | + } |
|
798 | + $content .= $action_items; |
|
799 | + } |
|
800 | 800 | $content .= ! empty( $action_container ) ? '</' . $action_container . '>' : ''; |
801 | 801 | return $content; |
802 | 802 | } |
@@ -1,9 +1,9 @@ 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 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
6 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
5 | +if ( ! class_exists('WP_List_Table')) { |
|
6 | + require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php'); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | |
@@ -206,16 +206,16 @@ discard block |
||
206 | 206 | /** |
207 | 207 | * @param \EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table |
208 | 208 | */ |
209 | - public function __construct( EE_Admin_Page $admin_page ) { |
|
209 | + public function __construct(EE_Admin_Page $admin_page) { |
|
210 | 210 | $this->_admin_page = $admin_page; |
211 | 211 | $this->_req_data = $this->_admin_page->get_request_data(); |
212 | 212 | $this->_view = $this->_admin_page->get_view(); |
213 | - $this->_views = empty( $this->_views ) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
213 | + $this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
214 | 214 | $this->_current_page = $this->get_pagenum(); |
215 | - $this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view(); |
|
216 | - $this->_yes_no = array( __('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
215 | + $this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view(); |
|
216 | + $this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
217 | 217 | |
218 | - $this->_per_page = $this->get_items_per_page( $this->_screen . '_per_page', 10 ); |
|
218 | + $this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 10); |
|
219 | 219 | |
220 | 220 | $this->_setup_data(); |
221 | 221 | $this->_add_view_counts(); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $this->_set_properties(); |
226 | 226 | |
227 | 227 | //set primary column |
228 | - add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ) ); |
|
228 | + add_filter('list_table_primary_column', array($this, 'set_primary_column')); |
|
229 | 229 | |
230 | 230 | //set parent defaults |
231 | 231 | parent::__construct($this->_wp_list_args); |
@@ -301,17 +301,17 @@ discard block |
||
301 | 301 | * @return string |
302 | 302 | */ |
303 | 303 | protected function _get_hidden_fields() { |
304 | - $action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : ''; |
|
305 | - $action = empty( $action ) && isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : $action; |
|
304 | + $action = isset($this->_req_data['route']) ? $this->_req_data['route'] : ''; |
|
305 | + $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action; |
|
306 | 306 | //if action is STILL empty, then we set it to default |
307 | - $action = empty( $action ) ? 'default' : $action; |
|
308 | - $field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n"; |
|
309 | - $field .= '<input type="hidden" name="route" value="'. $action .'" />' . "\n";/**/ |
|
310 | - $field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n"; |
|
307 | + $action = empty($action) ? 'default' : $action; |
|
308 | + $field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n"; |
|
309 | + $field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/ |
|
310 | + $field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n"; |
|
311 | 311 | |
312 | 312 | $bulk_actions = $this->_get_bulk_actions(); |
313 | - foreach ( $bulk_actions as $bulk_action => $label ) { |
|
314 | - $field .= '<input type="hidden" name="' . $bulk_action . '_nonce" value="' . wp_create_nonce ( $bulk_action . '_nonce' ) . '" />' . "\n"; |
|
313 | + foreach ($bulk_actions as $bulk_action => $label) { |
|
314 | + $field .= '<input type="hidden" name="'.$bulk_action.'_nonce" value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n"; |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | return $field; |
@@ -341,15 +341,15 @@ discard block |
||
341 | 341 | * |
342 | 342 | * @var array |
343 | 343 | */ |
344 | - $_sortable = apply_filters( "FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen ); |
|
344 | + $_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen); |
|
345 | 345 | |
346 | 346 | $sortable = array(); |
347 | - foreach ( $_sortable as $id => $data ) { |
|
348 | - if ( empty( $data ) ) { |
|
347 | + foreach ($_sortable as $id => $data) { |
|
348 | + if (empty($data)) { |
|
349 | 349 | continue; |
350 | 350 | } |
351 | 351 | //fix for offset errors with WP_List_Table default get_columninfo() |
352 | - if ( is_array($data) ) { |
|
352 | + if (is_array($data)) { |
|
353 | 353 | $_data[0] = key($data); |
354 | 354 | $_data[1] = isset($data[1]) ? $data[1] : false; |
355 | 355 | } else { |
@@ -358,14 +358,14 @@ discard block |
||
358 | 358 | |
359 | 359 | $data = (array) $data; |
360 | 360 | |
361 | - if ( !isset( $data[1] ) ) { |
|
361 | + if ( ! isset($data[1])) { |
|
362 | 362 | $_data[1] = false; |
363 | 363 | } |
364 | 364 | |
365 | 365 | $sortable[$id] = $_data; |
366 | 366 | } |
367 | 367 | $primary = $this->get_primary_column_name(); |
368 | - $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); |
|
368 | + $this->_column_headers = array($columns, $hidden, $sortable, $primary); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | |
@@ -374,8 +374,8 @@ discard block |
||
374 | 374 | * @return string |
375 | 375 | */ |
376 | 376 | protected function get_primary_column_name() { |
377 | - foreach( class_parents( $this ) as $parent ) { |
|
378 | - if ( $parent === 'WP_List_Table' && method_exists( $parent, 'get_primary_column_name' ) ) { |
|
377 | + foreach (class_parents($this) as $parent) { |
|
378 | + if ($parent === 'WP_List_Table' && method_exists($parent, 'get_primary_column_name')) { |
|
379 | 379 | return parent::get_primary_column_name(); |
380 | 380 | } |
381 | 381 | } |
@@ -392,10 +392,10 @@ discard block |
||
392 | 392 | * @param string $primary |
393 | 393 | * @return string |
394 | 394 | */ |
395 | - protected function handle_row_actions( $item, $column_name, $primary ) { |
|
396 | - foreach( class_parents( $this ) as $parent ) { |
|
397 | - if ( $parent === 'WP_List_Table' && method_exists( $parent, 'handle_row_actions' ) ) { |
|
398 | - return parent::handle_row_actions( $item, $column_name, $primary ); |
|
395 | + protected function handle_row_actions($item, $column_name, $primary) { |
|
396 | + foreach (class_parents($this) as $parent) { |
|
397 | + if ($parent === 'WP_List_Table' && method_exists($parent, 'handle_row_actions')) { |
|
398 | + return parent::handle_row_actions($item, $column_name, $primary); |
|
399 | 399 | } |
400 | 400 | } |
401 | 401 | return ''; |
@@ -413,11 +413,11 @@ discard block |
||
413 | 413 | protected function _get_bulk_actions() { |
414 | 414 | $actions = array(); |
415 | 415 | //the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table(); |
416 | - foreach ( $this->_views as $view => $args) { |
|
417 | - if ( $this->_view === $view && isset( $args['bulk_action']) && is_array($args['bulk_action']) ) { |
|
416 | + foreach ($this->_views as $view => $args) { |
|
417 | + if ($this->_view === $view && isset($args['bulk_action']) && is_array($args['bulk_action'])) { |
|
418 | 418 | //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
419 | - foreach ( $args['bulk_action'] as $route =>$label ) { |
|
420 | - if ( $this->_admin_page->check_user_access( $route, true ) ) { |
|
419 | + foreach ($args['bulk_action'] as $route =>$label) { |
|
420 | + if ($this->_admin_page->check_user_access($route, true)) { |
|
421 | 421 | $actions[$route] = $label; |
422 | 422 | } |
423 | 423 | } |
@@ -436,18 +436,18 @@ discard block |
||
436 | 436 | */ |
437 | 437 | private function _filters() { |
438 | 438 | $classname = get_class($this); |
439 | - $filters = apply_filters( "FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen ); |
|
439 | + $filters = apply_filters("FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen); |
|
440 | 440 | |
441 | - if ( empty( $filters )) { |
|
441 | + if (empty($filters)) { |
|
442 | 442 | return; |
443 | 443 | } |
444 | - foreach ( $filters as $filter ) { |
|
444 | + foreach ($filters as $filter) { |
|
445 | 445 | echo $filter; |
446 | 446 | } |
447 | 447 | //add filter button at end |
448 | - echo '<input type="submit" class="button-secondary" value="' . __('Filter', 'event_espresso') . '" id="post-query-submit" />'; |
|
448 | + echo '<input type="submit" class="button-secondary" value="'.__('Filter', 'event_espresso').'" id="post-query-submit" />'; |
|
449 | 449 | //add reset filters button at end |
450 | - echo '<a class="button button-secondary" href="' . $this->_admin_page->get_current_page_view_url() . '" style="display:inline-block">' . __('Reset Filters', 'event_espresso') . '</a>'; |
|
450 | + echo '<a class="button button-secondary" href="'.$this->_admin_page->get_current_page_view_url().'" style="display:inline-block">'.__('Reset Filters', 'event_espresso').'</a>'; |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | |
@@ -461,8 +461,8 @@ discard block |
||
461 | 461 | * @param string $column_name |
462 | 462 | * @return string |
463 | 463 | */ |
464 | - public function set_primary_column( $column_name ) { |
|
465 | - return ! empty( $this->_primary_column ) ? $this->_primary_column : $column_name; |
|
464 | + public function set_primary_column($column_name) { |
|
465 | + return ! empty($this->_primary_column) ? $this->_primary_column : $column_name; |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | array( |
483 | 483 | 'total_items' => $total_items, |
484 | 484 | 'per_page' => $this->_per_page, |
485 | - 'total_pages' => ceil($total_items / $this->_per_page ) |
|
485 | + 'total_pages' => ceil($total_items / $this->_per_page) |
|
486 | 486 | ) |
487 | 487 | ); |
488 | 488 | } |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * @param string $column_name The column being called. |
497 | 497 | * @return string html content for the column |
498 | 498 | */ |
499 | - public function column_default( $item, $column_name ) { |
|
499 | + public function column_default($item, $column_name) { |
|
500 | 500 | /** |
501 | 501 | * Dynamic hook allowing for adding additional column content in this list table. |
502 | 502 | * Note that $this->screen->id is in the format |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * hook prefix ("event-espresso") will be different. |
507 | 507 | * |
508 | 508 | */ |
509 | - do_action( 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, $item, $this->_screen ); |
|
509 | + do_action('AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, $item, $this->_screen); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | * |
533 | 533 | * @var array |
534 | 534 | */ |
535 | - $columns = apply_filters( 'FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen ); |
|
535 | + $columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen); |
|
536 | 536 | return $columns; |
537 | 537 | } |
538 | 538 | |
@@ -555,18 +555,18 @@ discard block |
||
555 | 555 | $views = $this->get_views(); |
556 | 556 | $assembled_views = ''; |
557 | 557 | |
558 | - if ( empty( $views )) { |
|
558 | + if (empty($views)) { |
|
559 | 559 | return; |
560 | 560 | } |
561 | 561 | echo "<ul class='subsubsub'>\n"; |
562 | - foreach ( $views as $view ) { |
|
563 | - $count = isset($view['count'] ) && !empty($view['count']) ? absint( $view['count'] ) : 0; |
|
564 | - if ( isset( $view['slug'], $view['class'], $view['url'], $view['label']) ) { |
|
565 | - $assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" . '<a href="' . $view['url'] . '">' . $view['label'] . '</a> <span class="count">(' . $count . ')</span>'; |
|
562 | + foreach ($views as $view) { |
|
563 | + $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0; |
|
564 | + if (isset($view['slug'], $view['class'], $view['url'], $view['label'])) { |
|
565 | + $assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>".'<a href="'.$view['url'].'">'.$view['label'].'</a> <span class="count">('.$count.')</span>'; |
|
566 | 566 | } |
567 | 567 | } |
568 | 568 | |
569 | - echo is_array( $assembled_views) && ! empty( $assembled_views ) ? implode( " |</li>\n", $assembled_views ) . "</li>\n" : ''; |
|
569 | + echo is_array($assembled_views) && ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : ''; |
|
570 | 570 | echo "</ul>"; |
571 | 571 | } |
572 | 572 | |
@@ -578,10 +578,10 @@ discard block |
||
578 | 578 | * @access public |
579 | 579 | * @param EE_Base_Class $item The current item |
580 | 580 | */ |
581 | - public function single_row( $item ) { |
|
582 | - $row_class = $this->_get_row_class( $item ); |
|
583 | - echo '<tr class="' . esc_attr( $row_class ) . '">'; |
|
584 | - $this->single_row_columns( $item ); |
|
581 | + public function single_row($item) { |
|
582 | + $row_class = $this->_get_row_class($item); |
|
583 | + echo '<tr class="'.esc_attr($row_class).'">'; |
|
584 | + $this->single_row_columns($item); |
|
585 | 585 | echo '</tr>'; |
586 | 586 | } |
587 | 587 | |
@@ -593,13 +593,13 @@ discard block |
||
593 | 593 | * @param EE_Base_Class $item the current item |
594 | 594 | * @return string |
595 | 595 | */ |
596 | - protected function _get_row_class( $item ) { |
|
596 | + protected function _get_row_class($item) { |
|
597 | 597 | static $row_class = ''; |
598 | - $row_class = ( $row_class === '' ? 'alternate' : '' ); |
|
598 | + $row_class = ($row_class === '' ? 'alternate' : ''); |
|
599 | 599 | |
600 | 600 | $new_row_class = $row_class; |
601 | 601 | |
602 | - if ( !empty($this->_ajax_sorting_callback) ) { |
|
602 | + if ( ! empty($this->_ajax_sorting_callback)) { |
|
603 | 603 | $new_row_class .= ' rowsortable'; |
604 | 604 | } |
605 | 605 | |
@@ -631,13 +631,13 @@ discard block |
||
631 | 631 | */ |
632 | 632 | public function get_hidden_columns() { |
633 | 633 | $user_id = get_current_user_id(); |
634 | - $has_default = get_user_option('default'. $this->screen->id . 'columnshidden', $user_id); |
|
635 | - if ( empty( $has_default ) && !empty($this->_hidden_columns ) ) { |
|
636 | - update_user_option($user_id, 'default'.$this->screen->id . 'columnshidden', TRUE); |
|
637 | - update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, TRUE ); |
|
634 | + $has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id); |
|
635 | + if (empty($has_default) && ! empty($this->_hidden_columns)) { |
|
636 | + update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', TRUE); |
|
637 | + update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, TRUE); |
|
638 | 638 | } |
639 | - $ref = 'manage' . $this->screen->id . 'columnshidden'; |
|
640 | - return (array) get_user_option( $ref, $user_id ); |
|
639 | + $ref = 'manage'.$this->screen->id.'columnshidden'; |
|
640 | + return (array) get_user_option($ref, $user_id); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | |
@@ -650,47 +650,47 @@ discard block |
||
650 | 650 | * @since 3.1.0 |
651 | 651 | * @param EE_Base_Class $item The current item |
652 | 652 | */ |
653 | - public function single_row_columns( $item ) { |
|
654 | - list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); |
|
653 | + public function single_row_columns($item) { |
|
654 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
655 | 655 | |
656 | 656 | global $wp_version; |
657 | - $use_hidden_class = version_compare( $wp_version, '4.3-RC', '>=' ); |
|
657 | + $use_hidden_class = version_compare($wp_version, '4.3-RC', '>='); |
|
658 | 658 | |
659 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
659 | + foreach ($columns as $column_name => $column_display_name) { |
|
660 | 660 | |
661 | 661 | /** |
662 | 662 | * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns are |
663 | 663 | * hidden or not instead of using "display:none;". This bit of code provides backward compat. |
664 | 664 | */ |
665 | - $hidden_class = $use_hidden_class && in_array( $column_name, $hidden ) ? ' hidden' : ''; |
|
666 | - $style = ! $use_hidden_class && in_array( $column_name, $hidden ) ? ' style="display:none;"' : ''; |
|
665 | + $hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : ''; |
|
666 | + $style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : ''; |
|
667 | 667 | |
668 | - $classes = $column_name . ' column-' . $column_name.$hidden_class; |
|
669 | - if ( $primary === $column_name ) { |
|
668 | + $classes = $column_name.' column-'.$column_name.$hidden_class; |
|
669 | + if ($primary === $column_name) { |
|
670 | 670 | $classes .= ' has-row-actions column-primary'; |
671 | 671 | } |
672 | 672 | |
673 | - $data = ' data-colname="' . wp_strip_all_tags( $column_display_name ) . '"'; |
|
673 | + $data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"'; |
|
674 | 674 | |
675 | 675 | $class = "class='$classes'"; |
676 | 676 | |
677 | 677 | $attributes = "$class$style$data"; |
678 | 678 | |
679 | - if ( $column_name === 'cb' ) { |
|
679 | + if ($column_name === 'cb') { |
|
680 | 680 | echo '<th scope="row" class="check-column">'; |
681 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
|
681 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb($item), $item, $this); |
|
682 | 682 | echo '</th>'; |
683 | 683 | } |
684 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
684 | + elseif (method_exists($this, 'column_'.$column_name)) { |
|
685 | 685 | echo "<td $attributes>"; |
686 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
|
687 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
686 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content', call_user_func(array($this, 'column_'.$column_name), $item), $item, $this); |
|
687 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
688 | 688 | echo "</td>"; |
689 | 689 | } |
690 | 690 | else { |
691 | 691 | echo "<td $attributes>"; |
692 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
|
693 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
692 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default($item, $column_name), $item, $column_name, $this); |
|
693 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
694 | 694 | echo "</td>"; |
695 | 695 | } |
696 | 696 | } |
@@ -705,15 +705,15 @@ discard block |
||
705 | 705 | * @param string $which |
706 | 706 | * @throws \EE_Error |
707 | 707 | */ |
708 | - public function extra_tablenav( $which ) { |
|
709 | - if ( $which === 'top' ) { |
|
708 | + public function extra_tablenav($which) { |
|
709 | + if ($which === 'top') { |
|
710 | 710 | $this->_filters(); |
711 | 711 | echo $this->_get_hidden_fields(); |
712 | - }else{ |
|
712 | + } else { |
|
713 | 713 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
714 | - foreach($this->_bottom_buttons as $type => $action){ |
|
715 | - $route = isset( $action['route'] ) ? $action['route'] : ''; |
|
716 | - $extra_request = isset( $action['extra_request'] ) ? $action['extra_request'] : ''; |
|
714 | + foreach ($this->_bottom_buttons as $type => $action) { |
|
715 | + $route = isset($action['route']) ? $action['route'] : ''; |
|
716 | + $extra_request = isset($action['extra_request']) ? $action['extra_request'] : ''; |
|
717 | 717 | echo $this->_admin_page->get_action_link_or_button( |
718 | 718 | $route, |
719 | 719 | $type, |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | false |
724 | 724 | ); |
725 | 725 | } |
726 | - do_action( 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen ); |
|
726 | + do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen); |
|
727 | 727 | echo '</div>'; |
728 | 728 | } |
729 | 729 | //echo $this->_entries_per_page_dropdown; |
@@ -779,11 +779,11 @@ discard block |
||
779 | 779 | * the actions. |
780 | 780 | * @return string The assembled action elements container. |
781 | 781 | */ |
782 | - protected function _action_string( $action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '' ) { |
|
782 | + protected function _action_string($action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '') { |
|
783 | 783 | $content = ''; |
784 | - $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : ''; |
|
785 | - $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : ''; |
|
786 | - $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
|
784 | + $action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : ''; |
|
785 | + $action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : ''; |
|
786 | + $content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : ''; |
|
787 | 787 | try { |
788 | 788 | $content .= apply_filters( |
789 | 789 | 'FHEE__EE_Admin_List_Table___action_string__action_items', |
@@ -793,11 +793,11 @@ discard block |
||
793 | 793 | ); |
794 | 794 | } catch (\Exception $e) { |
795 | 795 | if (WP_DEBUG) { |
796 | - \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
796 | + \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
797 | 797 | } |
798 | 798 | $content .= $action_items; |
799 | 799 | } |
800 | - $content .= ! empty( $action_container ) ? '</' . $action_container . '>' : ''; |
|
800 | + $content .= ! empty($action_container) ? '</'.$action_container.'>' : ''; |
|
801 | 801 | return $content; |
802 | 802 | } |
803 | 803 | } |
@@ -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 | |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * @param array $arguments |
36 | 36 | * @return \EE_CPT_Default_Strategy |
37 | 37 | */ |
38 | - public function __construct( $arguments = array() ) { |
|
39 | - $this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : null; |
|
38 | + public function __construct($arguments = array()) { |
|
39 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : null; |
|
40 | 40 | // $WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : null; |
41 | 41 | //EEH_Debug_Tools::printr( $this->CPT, '$this->CPT <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
42 | 42 | // add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ), 999 ); |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @param \WP_Query $WP_Query |
53 | 53 | * @return \WP_Query |
54 | 54 | */ |
55 | - public function pre_get_posts( WP_Query $WP_Query ) { |
|
55 | + public function pre_get_posts(WP_Query $WP_Query) { |
|
56 | 56 | //EEH_Debug_Tools::printr( $WP_Query, '$WP_Query <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
57 | - if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive() ) { |
|
57 | + if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
58 | 58 | return $WP_Query; |
59 | 59 | } |
60 | 60 | // $WP_Query->set( 'post_type', array( $this->CPT['post_type'] )); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param \WP_Query $WP_Query |
73 | 73 | * @return \WP_Post[] |
74 | 74 | */ |
75 | - public function the_posts( $posts, WP_Query $WP_Query ) { |
|
75 | + public function the_posts($posts, WP_Query $WP_Query) { |
|
76 | 76 | return $posts; |
77 | 77 | } |
78 | 78 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @param string $single |
89 | 89 | * @return mixed |
90 | 90 | */ |
91 | - public function get_EE_post_type_metadata( $meta_value = null, $post_id, $meta_key, $single ) { |
|
91 | + public function get_EE_post_type_metadata($meta_value = null, $post_id, $meta_key, $single) { |
|
92 | 92 | return $meta_value; |
93 | 93 | } |
94 | 94 |
@@ -447,14 +447,14 @@ |
||
447 | 447 | global $wpdb; |
448 | 448 | // adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement |
449 | 449 | $SQL .= ' LEFT JOIN ' |
450 | - . $this->meta_table->get_table_name() |
|
451 | - . ' ON ( ' |
|
452 | - . $this->meta_table->get_table_name() |
|
453 | - . '.' |
|
454 | - . $this->meta_table->get_fk_on_table() |
|
455 | - . ' = ' |
|
456 | - . $wpdb->posts |
|
457 | - . '.ID ) '; |
|
450 | + . $this->meta_table->get_table_name() |
|
451 | + . ' ON ( ' |
|
452 | + . $this->meta_table->get_table_name() |
|
453 | + . '.' |
|
454 | + . $this->meta_table->get_fk_on_table() |
|
455 | + . ' = ' |
|
456 | + . $wpdb->posts |
|
457 | + . '.ID ) '; |
|
458 | 458 | } |
459 | 459 | remove_filter( 'posts_join', array( $this, 'postsJoin' ) ); |
460 | 460 | return $SQL; |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\CPTs; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | \WP_Query $WP_Query, |
81 | 81 | \EE_Request_Handler $request |
82 | 82 | ) { |
83 | - $this->setRequest( $request ); |
|
84 | - $this->setWpQuery( $WP_Query ); |
|
85 | - $this->setPostType( $post_type ); |
|
86 | - $this->setCptDetails( $cpt_details ); |
|
83 | + $this->setRequest($request); |
|
84 | + $this->setWpQuery($WP_Query); |
|
85 | + $this->setPostType($post_type); |
|
86 | + $this->setCptDetails($cpt_details); |
|
87 | 87 | $this->init(); |
88 | 88 | } |
89 | 89 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * @param string $post_type |
103 | 103 | */ |
104 | - protected function setPostType( $post_type ) { |
|
104 | + protected function setPostType($post_type) { |
|
105 | 105 | $this->post_type = $post_type; |
106 | 106 | } |
107 | 107 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | /** |
120 | 120 | * @param array $cpt_details |
121 | 121 | */ |
122 | - protected function setCptDetails( $cpt_details ) { |
|
122 | + protected function setCptDetails($cpt_details) { |
|
123 | 123 | $this->cpt_details = $cpt_details; |
124 | 124 | } |
125 | 125 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | /** |
138 | 138 | * @param \EE_Table_Base[] $model_tables |
139 | 139 | */ |
140 | - protected function setModelTables( $model_tables ) { |
|
140 | + protected function setModelTables($model_tables) { |
|
141 | 141 | $this->model_tables = $model_tables; |
142 | 142 | } |
143 | 143 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @return array |
148 | 148 | */ |
149 | 149 | public function taxonomies() { |
150 | - if ( empty( $this->taxonomies ) ) { |
|
150 | + if (empty($this->taxonomies)) { |
|
151 | 151 | $this->initializeTaxonomies(); |
152 | 152 | } |
153 | 153 | return $this->taxonomies; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | /** |
159 | 159 | * @param array $taxonomies |
160 | 160 | */ |
161 | - protected function setTaxonomies( array $taxonomies ) { |
|
161 | + protected function setTaxonomies(array $taxonomies) { |
|
162 | 162 | $this->taxonomies = $taxonomies; |
163 | 163 | } |
164 | 164 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | /** |
177 | 177 | * @param \EE_Secondary_Table $meta_table |
178 | 178 | */ |
179 | - public function setMetaTable( \EE_Secondary_Table $meta_table ) { |
|
179 | + public function setMetaTable(\EE_Secondary_Table $meta_table) { |
|
180 | 180 | $this->meta_table = $meta_table; |
181 | 181 | } |
182 | 182 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | /** |
195 | 195 | * @param \EEM_Base $CPT_model |
196 | 196 | */ |
197 | - protected function setModel( \EEM_Base $CPT_model ) { |
|
197 | + protected function setModel(\EEM_Base $CPT_model) { |
|
198 | 198 | $this->model = $CPT_model; |
199 | 199 | } |
200 | 200 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | /** |
213 | 213 | * @param \EE_Request_Handler $request |
214 | 214 | */ |
215 | - protected function setRequest( \EE_Request_Handler $request ) { |
|
215 | + protected function setRequest(\EE_Request_Handler $request) { |
|
216 | 216 | $this->request = $request; |
217 | 217 | } |
218 | 218 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | /** |
231 | 231 | * @param \WP_Query $wp_query |
232 | 232 | */ |
233 | - public function setWpQuery( \WP_Query $wp_query ) { |
|
233 | + public function setWpQuery(\WP_Query $wp_query) { |
|
234 | 234 | $this->wp_query = $wp_query; |
235 | 235 | } |
236 | 236 | |
@@ -245,22 +245,22 @@ discard block |
||
245 | 245 | protected function initializeTaxonomies() { |
246 | 246 | // check if taxonomies have already been set and that this CPT has taxonomies registered for it |
247 | 247 | if ( |
248 | - empty( $this->taxonomies ) |
|
249 | - && isset( $this->cpt_details['args'], $this->cpt_details['args']['taxonomies'] ) |
|
248 | + empty($this->taxonomies) |
|
249 | + && isset($this->cpt_details['args'], $this->cpt_details['args']['taxonomies']) |
|
250 | 250 | ) { |
251 | 251 | // if so then grab them, but we want the taxonomy name as the key |
252 | - $taxonomies = array_flip( $this->cpt_details['args']['taxonomies'] ); |
|
252 | + $taxonomies = array_flip($this->cpt_details['args']['taxonomies']); |
|
253 | 253 | // then grab the list of ALL taxonomies |
254 | 254 | $all_taxonomies = \EE_Register_CPTs::get_taxonomies(); |
255 | - foreach ( $taxonomies as $taxonomy => &$details ) { |
|
255 | + foreach ($taxonomies as $taxonomy => &$details) { |
|
256 | 256 | // add details to our taxonomies if they exist |
257 | - $details = isset( $all_taxonomies[ $taxonomy ] ) |
|
258 | - ? $all_taxonomies[ $taxonomy ] |
|
257 | + $details = isset($all_taxonomies[$taxonomy]) |
|
258 | + ? $all_taxonomies[$taxonomy] |
|
259 | 259 | : array(); |
260 | 260 | } |
261 | 261 | // ALWAYS unset() variables that were passed by reference |
262 | - unset( $details ); |
|
263 | - $this->setTaxonomies( $taxonomies ); |
|
262 | + unset($details); |
|
263 | + $this->setTaxonomies($taxonomies); |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | $this->setAdditionalCptDetails(); |
271 | 271 | $this->setRequestVarsIfCpt(); |
272 | 272 | // convert post_type to model name |
273 | - $model_name = str_replace( 'EE_', '', $this->cpt_details['class_name'] ); |
|
273 | + $model_name = str_replace('EE_', '', $this->cpt_details['class_name']); |
|
274 | 274 | // load all tables related to CPT |
275 | - $this->setupModelsAndTables( $model_name ); |
|
275 | + $this->setupModelsAndTables($model_name); |
|
276 | 276 | // load and instantiate CPT_*_Strategy |
277 | - $CPT_Strategy = $this->cptStrategyClass( $model_name ); |
|
277 | + $CPT_Strategy = $this->cptStrategyClass($model_name); |
|
278 | 278 | // !!!!!!!!!! IMPORTANT !!!!!!!!!!!! |
279 | 279 | // here's the list of available filters in the WP_Query object |
280 | 280 | // 'posts_where_paged' |
@@ -285,17 +285,17 @@ discard block |
||
285 | 285 | // 'post_limits' |
286 | 286 | // 'posts_fields' |
287 | 287 | // 'posts_join' |
288 | - add_filter( 'posts_fields', array( $this, 'postsFields' ) ); |
|
289 | - add_filter( 'posts_join', array( $this, 'postsJoin' ) ); |
|
288 | + add_filter('posts_fields', array($this, 'postsFields')); |
|
289 | + add_filter('posts_join', array($this, 'postsJoin')); |
|
290 | 290 | add_filter( |
291 | - 'get_' . $this->post_type . '_metadata', |
|
292 | - array( $CPT_Strategy, 'get_EE_post_type_metadata' ), |
|
291 | + 'get_'.$this->post_type.'_metadata', |
|
292 | + array($CPT_Strategy, 'get_EE_post_type_metadata'), |
|
293 | 293 | 1, |
294 | 294 | 4 |
295 | 295 | ); |
296 | - add_filter( 'the_posts', array( $this, 'thePosts' ), 1, 1 ); |
|
297 | - if ( $this->wp_query->is_main_query() ) { |
|
298 | - add_filter( 'get_edit_post_link', array( $this, 'getEditPostLink' ), 10, 2 ); |
|
296 | + add_filter('the_posts', array($this, 'thePosts'), 1, 1); |
|
297 | + if ($this->wp_query->is_main_query()) { |
|
298 | + add_filter('get_edit_post_link', array($this, 'getEditPostLink'), 10, 2); |
|
299 | 299 | $this->addTemplateFilters(); |
300 | 300 | } |
301 | 301 | } |
@@ -312,18 +312,18 @@ discard block |
||
312 | 312 | // the post or category or term that is triggering EE |
313 | 313 | $this->cpt_details['espresso_page'] = $this->request->is_espresso_page(); |
314 | 314 | // requested post name |
315 | - $this->cpt_details['post_name'] = $this->request->get( 'post_name' ); |
|
315 | + $this->cpt_details['post_name'] = $this->request->get('post_name'); |
|
316 | 316 | // add support for viewing 'private', 'draft', or 'pending' posts |
317 | 317 | if ( |
318 | - isset( $this->wp_query->query_vars['p'] ) |
|
318 | + isset($this->wp_query->query_vars['p']) |
|
319 | 319 | && $this->wp_query->query_vars['p'] !== 0 |
320 | 320 | && is_user_logged_in() |
321 | - && current_user_can( 'edit_post', $this->wp_query->query_vars['p'] ) |
|
321 | + && current_user_can('edit_post', $this->wp_query->query_vars['p']) |
|
322 | 322 | ) { |
323 | 323 | // we can just inject directly into the WP_Query object |
324 | - $this->wp_query->query['post_status'] = array( 'publish', 'private', 'draft', 'pending' ); |
|
324 | + $this->wp_query->query['post_status'] = array('publish', 'private', 'draft', 'pending'); |
|
325 | 325 | // now set the main 'ee' request var so that the appropriate module can load the appropriate template(s) |
326 | - $this->request->set( 'ee', $this->cpt_details['singular_slug'] ); |
|
326 | + $this->request->set('ee', $this->cpt_details['singular_slug']); |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | |
@@ -340,15 +340,15 @@ discard block |
||
340 | 340 | */ |
341 | 341 | public function setRequestVarsIfCpt() { |
342 | 342 | // check if ee action var has been set |
343 | - if ( ! $this->request->is_set( 'ee' ) ) { |
|
343 | + if ( ! $this->request->is_set('ee')) { |
|
344 | 344 | // check that route exists for CPT archive slug |
345 | - if ( is_archive() && \EE_Config::get_route( $this->cpt_details['plural_slug'] ) ) { |
|
345 | + if (is_archive() && \EE_Config::get_route($this->cpt_details['plural_slug'])) { |
|
346 | 346 | // ie: set "ee" to "events" |
347 | - $this->request->set( 'ee', $this->cpt_details['plural_slug'] ); |
|
347 | + $this->request->set('ee', $this->cpt_details['plural_slug']); |
|
348 | 348 | // or does it match a single page CPT like /event/ |
349 | - } else if ( is_single() && \EE_Config::get_route( $this->cpt_details['singular_slug'] ) ) { |
|
349 | + } else if (is_single() && \EE_Config::get_route($this->cpt_details['singular_slug'])) { |
|
350 | 350 | // ie: set "ee" to "event" |
351 | - $this->request->set( 'ee', $this->cpt_details['singular_slug'] ); |
|
351 | + $this->request->set('ee', $this->cpt_details['singular_slug']); |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | } |
@@ -362,11 +362,11 @@ discard block |
||
362 | 362 | * @param string $model_name |
363 | 363 | * @throws \EE_Error |
364 | 364 | */ |
365 | - protected function setupModelsAndTables( $model_name ) { |
|
365 | + protected function setupModelsAndTables($model_name) { |
|
366 | 366 | // get CPT table data via CPT Model |
367 | - $model = \EE_Registry::instance()->load_model( $model_name ); |
|
368 | - if ( ! $model instanceof \EEM_Base ) { |
|
369 | - throw new \EE_Error ( |
|
367 | + $model = \EE_Registry::instance()->load_model($model_name); |
|
368 | + if ( ! $model instanceof \EEM_Base) { |
|
369 | + throw new \EE_Error( |
|
370 | 370 | sprintf( |
371 | 371 | __( |
372 | 372 | 'The "%1$s" model could not be loaded.', |
@@ -376,14 +376,14 @@ discard block |
||
376 | 376 | ) |
377 | 377 | ); |
378 | 378 | } |
379 | - $this->setModel( $model ); |
|
380 | - $this->setModelTables( $this->model->get_tables() ); |
|
379 | + $this->setModel($model); |
|
380 | + $this->setModelTables($this->model->get_tables()); |
|
381 | 381 | // is there a Meta Table for this CPT? |
382 | 382 | if ( |
383 | - isset( $this->cpt_details['tables'][ $model_name . '_Meta' ] ) |
|
384 | - && $this->cpt_details['tables'][ $model_name . '_Meta' ] instanceof \EE_Secondary_Table |
|
383 | + isset($this->cpt_details['tables'][$model_name.'_Meta']) |
|
384 | + && $this->cpt_details['tables'][$model_name.'_Meta'] instanceof \EE_Secondary_Table |
|
385 | 385 | ) { |
386 | - $this->setMetaTable( $this->cpt_details['tables'][ $model_name . '_Meta' ] ); |
|
386 | + $this->setMetaTable($this->cpt_details['tables'][$model_name.'_Meta']); |
|
387 | 387 | } |
388 | 388 | } |
389 | 389 | |
@@ -396,18 +396,18 @@ discard block |
||
396 | 396 | * @param string $model_name |
397 | 397 | * @return string |
398 | 398 | */ |
399 | - protected function cptStrategyClass( $model_name ) { |
|
399 | + protected function cptStrategyClass($model_name) { |
|
400 | 400 | // creates classname like: CPT_Event_Strategy |
401 | - $CPT_Strategy_class_name = 'CPT_' . $model_name . '_Strategy'; |
|
401 | + $CPT_Strategy_class_name = 'CPT_'.$model_name.'_Strategy'; |
|
402 | 402 | // load and instantiate |
403 | 403 | $CPT_Strategy = \EE_Registry::instance()->load_core( |
404 | 404 | $CPT_Strategy_class_name, |
405 | - array( 'WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details ) |
|
405 | + array('WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details) |
|
406 | 406 | ); |
407 | - if ( $CPT_Strategy === null ) { |
|
407 | + if ($CPT_Strategy === null) { |
|
408 | 408 | $CPT_Strategy = \EE_Registry::instance()->load_core( |
409 | 409 | 'CPT_Default_Strategy', |
410 | - array( 'WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details ) |
|
410 | + array('WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details) |
|
411 | 411 | ); |
412 | 412 | } |
413 | 413 | return $CPT_Strategy; |
@@ -422,13 +422,13 @@ discard block |
||
422 | 422 | * @param $SQL |
423 | 423 | * @return string |
424 | 424 | */ |
425 | - public function postsFields( $SQL ) { |
|
425 | + public function postsFields($SQL) { |
|
426 | 426 | // does this CPT have a meta table ? |
427 | - if ( $this->meta_table instanceof \EE_Secondary_Table ) { |
|
427 | + if ($this->meta_table instanceof \EE_Secondary_Table) { |
|
428 | 428 | // adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement |
429 | - $SQL .= ', ' . $this->meta_table->get_table_name() . '.* '; |
|
429 | + $SQL .= ', '.$this->meta_table->get_table_name().'.* '; |
|
430 | 430 | } |
431 | - remove_filter( 'posts_fields', array( $this, 'postsFields' ) ); |
|
431 | + remove_filter('posts_fields', array($this, 'postsFields')); |
|
432 | 432 | return $SQL; |
433 | 433 | } |
434 | 434 | |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | * @param $SQL |
442 | 442 | * @return string |
443 | 443 | */ |
444 | - public function postsJoin( $SQL ) { |
|
444 | + public function postsJoin($SQL) { |
|
445 | 445 | // does this CPT have a meta table ? |
446 | - if ( $this->meta_table instanceof \EE_Secondary_Table ) { |
|
446 | + if ($this->meta_table instanceof \EE_Secondary_Table) { |
|
447 | 447 | global $wpdb; |
448 | 448 | // adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement |
449 | 449 | $SQL .= ' LEFT JOIN ' |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | . $wpdb->posts |
457 | 457 | . '.ID ) '; |
458 | 458 | } |
459 | - remove_filter( 'posts_join', array( $this, 'postsJoin' ) ); |
|
459 | + remove_filter('posts_join', array($this, 'postsJoin')); |
|
460 | 460 | return $SQL; |
461 | 461 | } |
462 | 462 | |
@@ -469,17 +469,17 @@ discard block |
||
469 | 469 | * @param \WP_Post[] $posts |
470 | 470 | * @return \WP_Post[] |
471 | 471 | */ |
472 | - public function thePosts( $posts ) { |
|
472 | + public function thePosts($posts) { |
|
473 | 473 | $CPT_class = $this->cpt_details['class_name']; |
474 | 474 | // loop thru posts |
475 | - if ( is_array( $posts ) && $this->model instanceof \EEM_CPT_Base ) { |
|
476 | - foreach ( $posts as $key => $post ) { |
|
477 | - if ( $post->post_type === $this->post_type ) { |
|
478 | - $post->{$CPT_class} = $this->model->instantiate_class_from_post_object( $post ); |
|
475 | + if (is_array($posts) && $this->model instanceof \EEM_CPT_Base) { |
|
476 | + foreach ($posts as $key => $post) { |
|
477 | + if ($post->post_type === $this->post_type) { |
|
478 | + $post->{$CPT_class} = $this->model->instantiate_class_from_post_object($post); |
|
479 | 479 | } |
480 | 480 | } |
481 | 481 | } |
482 | - remove_filter( 'the_posts', array( $this, 'thePosts' ), 1 ); |
|
482 | + remove_filter('the_posts', array($this, 'thePosts'), 1); |
|
483 | 483 | return $posts; |
484 | 484 | } |
485 | 485 | |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | * @param $ID |
491 | 491 | * @return string |
492 | 492 | */ |
493 | - public function getEditPostLink( $url, $ID ) { |
|
493 | + public function getEditPostLink($url, $ID) { |
|
494 | 494 | // need to make sure we only edit links if our cpt |
495 | 495 | global $post; |
496 | 496 | //notice if the cpt is registered with `show_ee_ui` set to false, we take that to mean that the WordPress core ui |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | ! $post instanceof \WP_Post |
500 | 500 | || $post->post_type !== $this->post_type |
501 | 501 | || ( |
502 | - isset( $this->cpt_details['args']['show_ee_ui'] ) |
|
502 | + isset($this->cpt_details['args']['show_ee_ui']) |
|
503 | 503 | && ! $this->cpt_details['args']['show_ee_ui'] |
504 | 504 | ) |
505 | 505 | ) { |
@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | //k made it here so all is good. |
509 | 509 | return wp_nonce_url( |
510 | 510 | add_query_arg( |
511 | - array( 'page' => $this->post_type, 'post' => $ID, 'action' => 'edit' ), |
|
512 | - admin_url( 'admin.php' ) |
|
511 | + array('page' => $this->post_type, 'post' => $ID, 'action' => 'edit'), |
|
512 | + admin_url('admin.php') |
|
513 | 513 | ), |
514 | 514 | 'edit', |
515 | 515 | 'edit_nonce' |
@@ -526,9 +526,9 @@ discard block |
||
526 | 526 | */ |
527 | 527 | public function addTemplateFilters() { |
528 | 528 | // if requested cpt supports page_templates and it's the main query |
529 | - if ( ! empty( $this->cpt_details['args']['page_templates'] ) && $this->wp_query->is_main_query() ) { |
|
529 | + if ( ! empty($this->cpt_details['args']['page_templates']) && $this->wp_query->is_main_query()) { |
|
530 | 530 | // then let's hook into the appropriate query_template hook |
531 | - add_filter( 'single_template', array( $this, 'singleCptTemplate' ) ); |
|
531 | + add_filter('single_template', array($this, 'singleCptTemplate')); |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | |
@@ -542,20 +542,20 @@ discard block |
||
542 | 542 | * @param string $current_template Existing default template path derived for this page call. |
543 | 543 | * @return string the path to the full template file. |
544 | 544 | */ |
545 | - public function singleCptTemplate( $current_template ) { |
|
545 | + public function singleCptTemplate($current_template) { |
|
546 | 546 | $object = get_queried_object(); |
547 | 547 | //does this called object HAVE a page template set that is something other than the default. |
548 | - $template = get_post_meta( $object->ID, '_wp_page_template', true ); |
|
548 | + $template = get_post_meta($object->ID, '_wp_page_template', true); |
|
549 | 549 | //exit early if default or not set or invalid path (accounts for theme changes) |
550 | 550 | if ( |
551 | 551 | $template === 'default' |
552 | - || empty( $template ) |
|
553 | - || ! is_readable( get_stylesheet_directory() . '/' . $template ) |
|
552 | + || empty($template) |
|
553 | + || ! is_readable(get_stylesheet_directory().'/'.$template) |
|
554 | 554 | ) { |
555 | 555 | return $current_template; |
556 | 556 | } |
557 | 557 | //made it here so we SHOULD be able to just locate the template and then return it. |
558 | - return locate_template( array( $template ) ); |
|
558 | + return locate_template(array($template)); |
|
559 | 559 | } |
560 | 560 | |
561 | 561 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\Core\Exceptions; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param int $code |
26 | 26 | * @param \Exception $previous |
27 | 27 | */ |
28 | - public function __construct( $class_name, $message = '', $code = 0, \Exception $previous = null ) { |
|
29 | - if ( empty( $message ) ) { |
|
28 | + public function __construct($class_name, $message = '', $code = 0, \Exception $previous = null) { |
|
29 | + if (empty($message)) { |
|
30 | 30 | $message = sprintf( |
31 | - __( 'The "%1$s" Class is either missing or invalid.', 'event_espresso' ), |
|
31 | + __('The "%1$s" Class is either missing or invalid.', 'event_espresso'), |
|
32 | 32 | $class_name |
33 | 33 | ); |
34 | 34 | } |
35 | - parent::__construct( $message, $code, $previous ); |
|
35 | + parent::__construct($message, $code, $previous); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\Core\Exceptions; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | * @param int $code |
27 | 27 | * @param \Exception $previous |
28 | 28 | */ |
29 | - public function __construct( $interface_name, $message = '', $code = 0, \Exception $previous = null ) { |
|
30 | - if ( empty( $message ) ) { |
|
29 | + public function __construct($interface_name, $message = '', $code = 0, \Exception $previous = null) { |
|
30 | + if (empty($message)) { |
|
31 | 31 | $message = sprintf( |
32 | - __( 'The "%1$s" Interface is either missing or invalid.', 'event_espresso' ), |
|
32 | + __('The "%1$s" Interface is either missing or invalid.', 'event_espresso'), |
|
33 | 33 | $interface_name |
34 | 34 | ); |
35 | 35 | } |
36 | - parent::__construct( $message, $code, $previous ); |
|
36 | + parent::__construct($message, $code, $previous); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | } |