@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' ); |
|
3 | -EE_Registry::instance()->load_helper( 'Event_View' ); |
|
4 | -EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
2 | +add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
3 | +EE_Registry::instance()->load_helper('Event_View'); |
|
4 | +EE_Registry::instance()->load_helper('Form_Fields'); |
|
5 | 5 | $values = EEH_Form_Fields::prep_answer_options( |
6 | 6 | array( |
7 | - array( 'id' => 1, 'text' => __( 'Yes', 'event_espresso' ) ), |
|
8 | - array( 'id' => 0, 'text' => __( 'No', 'event_espresso' ) ) |
|
7 | + array('id' => 1, 'text' => __('Yes', 'event_espresso')), |
|
8 | + array('id' => 0, 'text' => __('No', 'event_espresso')) |
|
9 | 9 | ) |
10 | 10 | ); |
11 | 11 | ?> |
@@ -24,27 +24,27 @@ discard block |
||
24 | 24 | </label> |
25 | 25 | </th> |
26 | 26 | <td> |
27 | - <?php echo EEH_Form_Fields::select( 'display_status_banner_single', $display_status_banner_single, $values, 'display_status_banner_single', 'display_status_banner_single' ); ?> |
|
28 | - <p class="description"><?php _e( 'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the single event page.', 'event_espresso' ); ?></p> |
|
27 | + <?php echo EEH_Form_Fields::select('display_status_banner_single', $display_status_banner_single, $values, 'display_status_banner_single', 'display_status_banner_single'); ?> |
|
28 | + <p class="description"><?php _e('Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the single event page.', 'event_espresso'); ?></p> |
|
29 | 29 | </td> |
30 | 30 | </tr> |
31 | 31 | |
32 | 32 | <tr> |
33 | 33 | <th> |
34 | 34 | <label for="display_venue"> |
35 | - <?php _e( 'Display Venue Details', 'event_espresso' ); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info');?> |
|
35 | + <?php _e('Display Venue Details', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info'); ?> |
|
36 | 36 | </label> |
37 | 37 | </th> |
38 | 38 | <td> |
39 | - <?php echo EEH_Form_Fields::select( 'display_venue', $display_venue, $values, 'display_venue', 'display_venue' ); ?> |
|
40 | - <p class="description"><?php _e( 'Do not use this if you are using the venue shortcodes in your event description.', 'event_espresso' ); ?></p> |
|
39 | + <?php echo EEH_Form_Fields::select('display_venue', $display_venue, $values, 'display_venue', 'display_venue'); ?> |
|
40 | + <p class="description"><?php _e('Do not use this if you are using the venue shortcodes in your event description.', 'event_espresso'); ?></p> |
|
41 | 41 | </td> |
42 | 42 | </tr> |
43 | 43 | |
44 | 44 | <tr> |
45 | 45 | <th> |
46 | 46 | <label for="EED_Events_Single_use_sortable_display_order"> |
47 | - <?php _e( 'Use Custom Display Order?', 'event_espresso' ); ?> |
|
47 | + <?php _e('Use Custom Display Order?', 'event_espresso'); ?> |
|
48 | 48 | </label> |
49 | 49 | </th> |
50 | 50 | <td> |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | <p class="description "> |
61 | 61 | <?php |
62 | 62 | echo sprintf( |
63 | - __( '%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Single page display, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso' ), |
|
63 | + __('%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Single page display, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso'), |
|
64 | 64 | '<span class="important-notice">', |
65 | 65 | '</span>', |
66 | 66 | '<br />' |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | |
73 | 73 | <tr> |
74 | 74 | <th> |
75 | - <?php _e('Display Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info');?> |
|
75 | + <?php _e('Display Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info'); ?> |
|
76 | 76 | </th> |
77 | 77 | <td> |
78 | 78 | |
79 | - <?php wp_nonce_field( 'espresso_update_event_single_order', 'espresso_update_event_single_order_nonce', false ); ?> |
|
79 | + <?php wp_nonce_field('espresso_update_event_single_order', 'espresso_update_event_single_order_nonce', false); ?> |
|
80 | 80 | <?php echo $event_single_display_order; ?> |
81 | 81 | |
82 | 82 | <p class="description"><?php _e('Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the single event page.', 'event_espresso'); ?></p> |
@@ -1,17 +1,17 @@ discard block |
||
1 | 1 | <?php |
2 | -add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' ); |
|
3 | -EE_Registry::instance()->load_helper( 'Event_View' ); |
|
4 | -EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
2 | +add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
3 | +EE_Registry::instance()->load_helper('Event_View'); |
|
4 | +EE_Registry::instance()->load_helper('Form_Fields'); |
|
5 | 5 | |
6 | -$values = EEH_Form_Fields::prep_answer_options( array( |
|
7 | - array( 'id' => 1, 'text' => __('Yes', 'event_espresso')), |
|
8 | - array( 'id' => 0, 'text' => __('No', 'event_espresso')) |
|
6 | +$values = EEH_Form_Fields::prep_answer_options(array( |
|
7 | + array('id' => 1, 'text' => __('Yes', 'event_espresso')), |
|
8 | + array('id' => 0, 'text' => __('No', 'event_espresso')) |
|
9 | 9 | )); |
10 | 10 | |
11 | -$description = EEH_Form_Fields::prep_answer_options( array( |
|
12 | - array( 'id' => 0, 'text' => __('none', 'event_espresso')), |
|
13 | - array( 'id' => 1, 'text' => __('excerpt (short desc)', 'event_espresso')), |
|
14 | - array( 'id' => 2, 'text' => __('full description', 'event_espresso')) |
|
11 | +$description = EEH_Form_Fields::prep_answer_options(array( |
|
12 | + array('id' => 0, 'text' => __('none', 'event_espresso')), |
|
13 | + array('id' => 1, 'text' => __('excerpt (short desc)', 'event_espresso')), |
|
14 | + array('id' => 2, 'text' => __('full description', 'event_espresso')) |
|
15 | 15 | )); |
16 | 16 | |
17 | 17 | ?> |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | <tr> |
30 | 30 | <th> |
31 | 31 | <label for="event_listings_url"> |
32 | - <?php _e('Event Listings URL', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('event_listings_url_info');?> |
|
32 | + <?php _e('Event Listings URL', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('event_listings_url_info'); ?> |
|
33 | 33 | </label> |
34 | 34 | </th> |
35 | 35 | <td> |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | </label> |
45 | 45 | </th> |
46 | 46 | <td> |
47 | - <p><?php echo site_url() . '/ ' . EEH_Form_Fields::text( 'not_used', EE_Registry::instance()->CFG->core->event_cpt_slug, 'event_cpt_slug', 'event_cpt_slug', 'regular' ); ?></p> |
|
47 | + <p><?php echo site_url().'/ '.EEH_Form_Fields::text('not_used', EE_Registry::instance()->CFG->core->event_cpt_slug, 'event_cpt_slug', 'event_cpt_slug', 'regular'); ?></p> |
|
48 | 48 | <p class="description"><?php _e('This allows you to configure what slug is used for the url of all event pages.', 'event_espresso'); ?></p> |
49 | - <?php if ( has_filter( 'FHEE__EE_Register_CPTs__register_CPT__rewrite' ) ) : ?> |
|
49 | + <?php if (has_filter('FHEE__EE_Register_CPTs__register_CPT__rewrite')) : ?> |
|
50 | 50 | <p class="important-notice"> |
51 | 51 | <?php |
52 | 52 | sprintf( |
53 | - __( 'Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected. Please be aware that while this filter is being used, this setting has no affect.', 'event_espresso' ), |
|
53 | + __('Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected. Please be aware that while this filter is being used, this setting has no affect.', 'event_espresso'), |
|
54 | 54 | '<code>', |
55 | 55 | '</code>' |
56 | 56 | ); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | </label> |
68 | 68 | </th> |
69 | 69 | <td> |
70 | - <?php echo EEH_Form_Fields::select( 'display_status_banner', $display_status_banner, $values, 'EED_Events_Archive_display_status_banner', 'EED_Events_Archive_display_status_banner' );?> |
|
70 | + <?php echo EEH_Form_Fields::select('display_status_banner', $display_status_banner, $values, 'EED_Events_Archive_display_status_banner', 'EED_Events_Archive_display_status_banner'); ?> |
|
71 | 71 | <p class="description"><?php _e('Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the events archive page.', 'event_espresso'); ?></p> |
72 | 72 | </td> |
73 | 73 | </tr> |
@@ -75,55 +75,55 @@ discard block |
||
75 | 75 | <tr> |
76 | 76 | <th> |
77 | 77 | <label for="EED_Events_Archive_display_description"> |
78 | - <?php _e('Display Description', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_description_info');?> |
|
78 | + <?php _e('Display Description', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_description_info'); ?> |
|
79 | 79 | </label> |
80 | 80 | </th> |
81 | 81 | <td> |
82 | - <?php echo EEH_Form_Fields::select( 'description', $display_description, $description, 'EED_Events_Archive_display_description', 'EED_Events_Archive_display_description' );?> |
|
82 | + <?php echo EEH_Form_Fields::select('description', $display_description, $description, 'EED_Events_Archive_display_description', 'EED_Events_Archive_display_description'); ?> |
|
83 | 83 | </td> |
84 | 84 | </tr> |
85 | 85 | |
86 | 86 | <tr> |
87 | 87 | <th> |
88 | 88 | <label for="EED_Events_Archive_display_ticket_selector"> |
89 | - <?php _e('Display Ticket Selector', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_ticket_selector_info');?> |
|
89 | + <?php _e('Display Ticket Selector', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_ticket_selector_info'); ?> |
|
90 | 90 | </label> |
91 | 91 | </th> |
92 | 92 | <td> |
93 | - <?php echo EEH_Form_Fields::select( 'ticket_selector', $display_ticket_selector, $values, 'EED_Events_Archive_display_ticket_selector', 'EED_Events_Archive_display_ticket_selector' );?> |
|
93 | + <?php echo EEH_Form_Fields::select('ticket_selector', $display_ticket_selector, $values, 'EED_Events_Archive_display_ticket_selector', 'EED_Events_Archive_display_ticket_selector'); ?> |
|
94 | 94 | </td> |
95 | 95 | </tr> |
96 | 96 | |
97 | 97 | <tr> |
98 | 98 | <th> |
99 | 99 | <label for="EED_Events_Archive_display_datetimes"> |
100 | - <?php _e('Display Datetimes', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_datetimes_info');?> |
|
100 | + <?php _e('Display Datetimes', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_datetimes_info'); ?> |
|
101 | 101 | </label> |
102 | 102 | </th> |
103 | 103 | <td> |
104 | - <?php echo EEH_Form_Fields::select( 'venue_details', $display_datetimes, $values, 'EED_Events_Archive_display_datetimes', 'EED_Events_Archive_display_datetimes' );?> |
|
104 | + <?php echo EEH_Form_Fields::select('venue_details', $display_datetimes, $values, 'EED_Events_Archive_display_datetimes', 'EED_Events_Archive_display_datetimes'); ?> |
|
105 | 105 | </td> |
106 | 106 | </tr> |
107 | 107 | |
108 | 108 | <tr> |
109 | 109 | <th> |
110 | 110 | <label for="EED_Events_Archive_display_venue"> |
111 | - <?php _e('Display Venue Details', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_venue_details_info');?> |
|
111 | + <?php _e('Display Venue Details', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_venue_details_info'); ?> |
|
112 | 112 | </label> |
113 | 113 | </th> |
114 | 114 | <td> |
115 | - <?php echo EEH_Form_Fields::select( 'display_venue', $display_venue, $values, 'EED_Events_Archive_display_venue', 'EED_Events_Archive_display_venue' );?> |
|
115 | + <?php echo EEH_Form_Fields::select('display_venue', $display_venue, $values, 'EED_Events_Archive_display_venue', 'EED_Events_Archive_display_venue'); ?> |
|
116 | 116 | </td> |
117 | 117 | </tr> |
118 | 118 | |
119 | 119 | <tr> |
120 | 120 | <th> |
121 | 121 | <label for="EED_Events_Archive_display_expired_events"> |
122 | - <?php _e('Display Expired Events', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_expired_events_info');?> |
|
122 | + <?php _e('Display Expired Events', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_expired_events_info'); ?> |
|
123 | 123 | </label> |
124 | 124 | </th> |
125 | 125 | <td> |
126 | - <?php echo EEH_Form_Fields::select( 'expired_events', $display_expired_events, $values, 'EED_Events_Archive_display_expired_events', 'EED_Events_Archive_display_expired_events' );?> |
|
126 | + <?php echo EEH_Form_Fields::select('expired_events', $display_expired_events, $values, 'EED_Events_Archive_display_expired_events', 'EED_Events_Archive_display_expired_events'); ?> |
|
127 | 127 | </td> |
128 | 128 | </tr> |
129 | 129 | |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | </label> |
135 | 135 | </th> |
136 | 136 | <td> |
137 | - <?php echo EEH_Form_Fields::select( 'use_sortable_display_order', $use_sortable_display_order, $values, 'EED_Events_Archive_use_sortable_display_order', 'EED_Events_Archive_use_sortable_display_order' );?> |
|
137 | + <?php echo EEH_Form_Fields::select('use_sortable_display_order', $use_sortable_display_order, $values, 'EED_Events_Archive_use_sortable_display_order', 'EED_Events_Archive_use_sortable_display_order'); ?> |
|
138 | 138 | <p class="description "> |
139 | 139 | <?php |
140 | 140 | echo sprintf( |
141 | - __( '%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Archive listings, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso' ), |
|
141 | + __('%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Archive listings, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso'), |
|
142 | 142 | '<span class="important-notice">', |
143 | 143 | '</span>', |
144 | 144 | '<br />' |
@@ -150,14 +150,14 @@ discard block |
||
150 | 150 | |
151 | 151 | <tr> |
152 | 152 | <th> |
153 | - <?php _e( 'Display Order', 'event_espresso' ); ?><?php //echo EEH_Template::get_help_tab_link( 'event_archive_order_info' ); ?> |
|
153 | + <?php _e('Display Order', 'event_espresso'); ?><?php //echo EEH_Template::get_help_tab_link( 'event_archive_order_info' ); ?> |
|
154 | 154 | </th> |
155 | 155 | <td> |
156 | 156 | |
157 | - <?php wp_nonce_field( 'espresso_update_event_archive_order', 'espresso_update_event_archive_order_nonce', false ); ?> |
|
157 | + <?php wp_nonce_field('espresso_update_event_archive_order', 'espresso_update_event_archive_order_nonce', false); ?> |
|
158 | 158 | <?php echo $event_archive_display_order; ?> |
159 | 159 | |
160 | - <p class="description"><?php _e( 'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.', 'event_espresso' ); ?></p> |
|
160 | + <p class="description"><?php _e('Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.', 'event_espresso'); ?></p> |
|
161 | 161 | |
162 | 162 | </td> |
163 | 163 | </tr> |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | <tr> |
166 | 166 | <th> |
167 | 167 | <label for="EED_Events_Archive_reset_event_list_settings"> |
168 | - <?php _e( 'Reset Event List Settings', 'event_espresso' ); ?> |
|
168 | + <?php _e('Reset Event List Settings', 'event_espresso'); ?> |
|
169 | 169 | </label> |
170 | 170 | </th> |
171 | 171 | <td> |
172 | - <?php echo EEH_Form_Fields::select( 'reset_event_list_settings', 0, $values, 'EED_Events_Archive_reset_event_list_settings', 'EED_Events_Archive_reset_event_list_settings' ); ?> |
|
172 | + <?php echo EEH_Form_Fields::select('reset_event_list_settings', 0, $values, 'EED_Events_Archive_reset_event_list_settings', 'EED_Events_Archive_reset_event_list_settings'); ?> |
|
173 | 173 | </td> |
174 | 174 | </tr> |
175 | 175 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @return EED_Ticket_Selector_Caff |
17 | 17 | */ |
18 | 18 | public static function instance() { |
19 | - return parent::get_instance( __CLASS__ ); |
|
19 | + return parent::get_instance(__CLASS__); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -37,24 +37,24 @@ discard block |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | public static function set_hooks_admin() { |
40 | - define( 'TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
41 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Ticket_Selector_Caff', 'template_settings_form' ), 10 ); |
|
42 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Ticket_Selector_Caff', 'update_template_settings' ), 10, 2 ); |
|
40 | + define('TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
41 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Ticket_Selector_Caff', 'template_settings_form'), 10); |
|
42 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Ticket_Selector_Caff', 'update_template_settings'), 10, 2); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
46 | 46 | //just required because of abstract declaration |
47 | - public function run( $WP ) { |
|
47 | + public function run($WP) { |
|
48 | 48 | $this->set_config(); |
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | - protected function set_config(){ |
|
55 | - $this->set_config_section( 'template_settings' ); |
|
56 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
57 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
54 | + protected function set_config() { |
|
55 | + $this->set_config_section('template_settings'); |
|
56 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
57 | + $this->set_config_name('EED_Ticket_Selector'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | 'FHEE__EED_Ticket_Selector_Caff___ticket_selector_settings_form__form_subsections', |
90 | 90 | array( |
91 | 91 | 'appearance_settings_hdr' => new EE_Form_Section_HTML( |
92 | - EEH_HTML::br(2) . |
|
93 | - EEH_HTML::h2( __( 'Ticket Selector Template Settings', 'event_espresso' )) |
|
92 | + EEH_HTML::br(2). |
|
93 | + EEH_HTML::h2(__('Ticket Selector Template Settings', 'event_espresso')) |
|
94 | 94 | ), |
95 | 95 | 'appearance_settings' => EED_Ticket_Selector_Caff::_ticket_selector_appearance_settings() |
96 | 96 | ) |
@@ -114,25 +114,25 @@ discard block |
||
114 | 114 | 'FHEE__EED_Ticket_Selector_Caff___ticket_selector_appearance_settings__form_subsections', array( |
115 | 115 | 'show_ticket_details' => new EE_Yes_No_Input( |
116 | 116 | array( |
117 | - 'html_label_text' => __('Show Ticket Details?', 'event_espresso' ), |
|
118 | - 'html_help_text' => __( 'This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'), |
|
119 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true, |
|
117 | + 'html_label_text' => __('Show Ticket Details?', 'event_espresso'), |
|
118 | + 'html_help_text' => __('This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'), |
|
119 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true, |
|
120 | 120 | 'display_html_label_text' => false |
121 | 121 | ) |
122 | 122 | ), |
123 | 123 | 'show_ticket_sale_columns' => new EE_Yes_No_Input( |
124 | 124 | array( |
125 | - 'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso' ), |
|
126 | - 'html_help_text' => __( 'This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'), |
|
127 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true, |
|
125 | + 'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso'), |
|
126 | + 'html_help_text' => __('This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'), |
|
127 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true, |
|
128 | 128 | 'display_html_label_text' => false |
129 | 129 | ) |
130 | 130 | ), |
131 | 131 | 'show_expired_tickets' => new EE_Yes_No_Input( |
132 | 132 | array( |
133 | - 'html_label_text' => __( 'Show Expired Tickets?', 'event_espresso' ), |
|
134 | - 'html_help_text' => __( 'Indicate whether to show expired tickets in the ticket selector', 'event_espresso' ), |
|
135 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true, |
|
133 | + 'html_label_text' => __('Show Expired Tickets?', 'event_espresso'), |
|
134 | + 'html_help_text' => __('Indicate whether to show expired tickets in the ticket selector', 'event_espresso'), |
|
135 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true, |
|
136 | 136 | 'display_html_label_text' => false |
137 | 137 | ) |
138 | 138 | ) |
@@ -155,21 +155,21 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return void |
157 | 157 | */ |
158 | - public static function update_template_settings( EE_Template_Config $CFG, $REQ ) { |
|
159 | - if ( ! isset( $CFG->EED_Ticket_Selector ) ) { |
|
158 | + public static function update_template_settings(EE_Template_Config $CFG, $REQ) { |
|
159 | + if ( ! isset($CFG->EED_Ticket_Selector)) { |
|
160 | 160 | $CFG->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
161 | 161 | } |
162 | 162 | try { |
163 | 163 | $ticket_selector_form = EED_Ticket_Selector_Caff::_ticket_selector_settings_form(); |
164 | 164 | |
165 | 165 | //check for form submission |
166 | - if ( $ticket_selector_form->was_submitted() ) { |
|
166 | + if ($ticket_selector_form->was_submitted()) { |
|
167 | 167 | |
168 | 168 | //capture form data |
169 | 169 | $ticket_selector_form->receive_form_submission(); |
170 | 170 | |
171 | 171 | //validate form data |
172 | - if ( $ticket_selector_form->is_valid() ) { |
|
172 | + if ($ticket_selector_form->is_valid()) { |
|
173 | 173 | |
174 | 174 | //grab validated data from form |
175 | 175 | $valid_data = $ticket_selector_form->valid_data(); |
@@ -179,13 +179,13 @@ discard block |
||
179 | 179 | $CFG->EED_Ticket_Selector->show_ticket_details = $valid_data['appearance_settings']['show_ticket_details']; |
180 | 180 | $CFG->EED_Ticket_Selector->show_expired_tickets = $valid_data['appearance_settings']['show_expired_tickets']; |
181 | 181 | } else { |
182 | - if ( $ticket_selector_form->submission_error_message() != '' ) { |
|
183 | - EE_Error::add_error( $ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
182 | + if ($ticket_selector_form->submission_error_message() != '') { |
|
183 | + EE_Error::add_error($ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | 187 | } |
188 | - } catch( EE_Error $e ) { |
|
188 | + } catch (EE_Error $e) { |
|
189 | 189 | $e->get_error(); |
190 | 190 | } |
191 | 191 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | <?php _e('Adjust the settings for the Authorize.net AIM payment gateway.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | 5 | <p> |
6 | -<?php printf( __( 'See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso' ), "<a href='http://www.authorize.net/international/' target='_blank'>","</a>" ); ?> |
|
6 | +<?php printf(__('See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso'), "<a href='http://www.authorize.net/international/' target='_blank'>", "</a>"); ?> |
|
7 | 7 | </p> |
8 | 8 | <h3><?php _e('Authorize.net AIM Settings', 'event_espresso'); ?></h3> |
9 | 9 | <ul> |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | <?php _e('By logging into Authorize.net, you can change which payment fields are required by Authorize.net when processing payments. These settings affect both the Advanced Integration Method (AIM, this) and the Simple Integration Method (SIM, different). The payment method settings "Excluded Payment Form Fields" and "Required Payment Form Fields" allow you to change the billing form in Event Espresso to reflect your payment form settings in Authorize.net.', 'event_espresso'); ?> |
29 | 29 | <br> |
30 | 30 | <?php printf( |
31 | - __( 'To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.'), |
|
31 | + __('To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.'), |
|
32 | 32 | '<a href="http://authorize.net" target="_blank">', |
33 | 33 | '</a>', |
34 | 34 | '<a href="https://monosnap.com/file/nebVteOkEXcdDIos88SojStWOifP23" target="_blank">', |
35 | 35 | '<a href="https://monosnap.com/file/WyxGJtev87TcDmdGBEZ2oi1xaBIQAm" target="_blank">', |
36 | - '<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank">');?> |
|
36 | + '<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank">'); ?> |
|
37 | 37 | </li> |
38 | 38 | <li> |
39 | 39 | <strong><?php _e('Button Image URL', 'event_espresso'); ?></strong><br /> |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public static function instance() { |
80 | 80 | // check if class object is instantiated |
81 | - if ( ! self::$_instance instanceof EE_CPT_Strategy ) { |
|
81 | + if ( ! self::$_instance instanceof EE_CPT_Strategy) { |
|
82 | 82 | self::$_instance = new self(); |
83 | 83 | } |
84 | 84 | return self::$_instance; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | // d( $this->_CPT_endpoints ); |
102 | 102 | // d( $this->_CPT_taxonomies ); |
103 | 103 | |
104 | - add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 5 ); |
|
104 | + add_action('pre_get_posts', array($this, 'pre_get_posts'), 5); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | */ |
115 | 115 | private function _set_CPT_endpoints() { |
116 | 116 | $_CPT_endpoints = array(); |
117 | - if ( is_array( $this->_CPTs )) { |
|
118 | - foreach ( $this->_CPTs as $CPT_type => $CPT ) { |
|
119 | - $_CPT_endpoints [ $CPT['plural_slug'] ] = $CPT_type; |
|
117 | + if (is_array($this->_CPTs)) { |
|
118 | + foreach ($this->_CPTs as $CPT_type => $CPT) { |
|
119 | + $_CPT_endpoints [$CPT['plural_slug']] = $CPT_type; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | return $_CPT_endpoints; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param WP_Query $WP_Query |
132 | 132 | * @return void |
133 | 133 | */ |
134 | - private function _set_EE_tags_on_WP_Query( WP_Query $WP_Query) { |
|
134 | + private function _set_EE_tags_on_WP_Query(WP_Query $WP_Query) { |
|
135 | 135 | $WP_Query->is_espresso_event_single = FALSE; |
136 | 136 | $WP_Query->is_espresso_event_archive = FALSE; |
137 | 137 | $WP_Query->is_espresso_event_taxonomy = FALSE; |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | */ |
159 | 159 | private function _set_CPT_taxonomies() { |
160 | 160 | // check if taxonomies have already been set |
161 | - if ( empty( $this->_CPT_taxonomies )) { |
|
161 | + if (empty($this->_CPT_taxonomies)) { |
|
162 | 162 | // and that this CPT has taxonomies registered for it |
163 | - if ( isset( $this->CPT['args'] ) && isset( $this->CPT['args']['taxonomies'] )) { |
|
163 | + if (isset($this->CPT['args']) && isset($this->CPT['args']['taxonomies'])) { |
|
164 | 164 | // if so then grab them, but we want the taxonomy name as the key |
165 | - $taxonomies = array_flip( $this->CPT['args']['taxonomies'] ); |
|
165 | + $taxonomies = array_flip($this->CPT['args']['taxonomies']); |
|
166 | 166 | // then grab the list of ALL taxonomies |
167 | 167 | $all_taxonomies = EE_Register_CPTs::get_taxonomies(); |
168 | - foreach ( $taxonomies as $taxonomy => $details ) { |
|
168 | + foreach ($taxonomies as $taxonomy => $details) { |
|
169 | 169 | // add details to our taxonomies if they exist |
170 | - $taxonomies[ $taxonomy ] = isset( $all_taxonomies[ $taxonomy ] ) ? $all_taxonomies[ $taxonomy ] : NULL; |
|
170 | + $taxonomies[$taxonomy] = isset($all_taxonomies[$taxonomy]) ? $all_taxonomies[$taxonomy] : NULL; |
|
171 | 171 | } |
172 | 172 | $this->_CPT_taxonomies = $taxonomies; |
173 | 173 | } |
@@ -192,10 +192,10 @@ discard block |
||
192 | 192 | * @return void |
193 | 193 | */ |
194 | 194 | private function _set_CPT_terms() { |
195 | - if ( empty( $this->_CPT_terms )) { |
|
195 | + if (empty($this->_CPT_terms)) { |
|
196 | 196 | $terms = EEM_Term::instance()->get_all_CPT_post_tags(); |
197 | - foreach ( $terms as $term ) { |
|
198 | - $this->_CPT_terms[ $term->slug() ] = $term; |
|
197 | + foreach ($terms as $term) { |
|
198 | + $this->_CPT_terms[$term->slug()] = $term; |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | } |
@@ -209,24 +209,24 @@ discard block |
||
209 | 209 | * @param $WP_Query |
210 | 210 | * @return void |
211 | 211 | */ |
212 | - private function _set_post_type_for_terms( WP_Query $WP_Query ) { |
|
212 | + private function _set_post_type_for_terms(WP_Query $WP_Query) { |
|
213 | 213 | // is a tag set ? |
214 | - if ( isset( $WP_Query->query['tag'] )) { |
|
214 | + if (isset($WP_Query->query['tag'])) { |
|
215 | 215 | // set post_tags |
216 | 216 | $this->_set_CPT_terms(); |
217 | 217 | // is this tag archive term in the list of terms used by our CPTs ? |
218 | - $term = isset ( $this->_CPT_terms[ $WP_Query->query['tag'] ] ) ? $this->_CPT_terms[ $WP_Query->query['tag'] ] : NULL; |
|
218 | + $term = isset ($this->_CPT_terms[$WP_Query->query['tag']]) ? $this->_CPT_terms[$WP_Query->query['tag']] : NULL; |
|
219 | 219 | // verify the term |
220 | - if ( $term instanceof EE_Term ) { |
|
221 | - $term->post_type = array_merge( array( 'post', 'page' ), (array)$term->post_type ); |
|
222 | - $term->post_type = apply_filters( 'FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term ); |
|
220 | + if ($term instanceof EE_Term) { |
|
221 | + $term->post_type = array_merge(array('post', 'page'), (array) $term->post_type); |
|
222 | + $term->post_type = apply_filters('FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term); |
|
223 | 223 | // if a post type is already set |
224 | - if ( isset( $WP_Query->query_vars['post_type'] )) { |
|
224 | + if (isset($WP_Query->query_vars['post_type'])) { |
|
225 | 225 | // add to existing array |
226 | - $term->post_type = array_merge ( (array)$WP_Query->query_vars['post_type'], $term->post_type ); |
|
226 | + $term->post_type = array_merge((array) $WP_Query->query_vars['post_type'], $term->post_type); |
|
227 | 227 | } |
228 | 228 | // just set post_type to our CPT |
229 | - $WP_Query->set( 'post_type', $term->post_type ); |
|
229 | + $WP_Query->set('post_type', $term->post_type); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | } |
@@ -241,17 +241,17 @@ discard block |
||
241 | 241 | * in order for is_archive() and is_single() methods to work properly. |
242 | 242 | * @return void |
243 | 243 | */ |
244 | - public function _possibly_set_ee_request_var(){ |
|
244 | + public function _possibly_set_ee_request_var() { |
|
245 | 245 | // check if ee action var has been set |
246 | - if ( ! EE_Registry::instance()->REQ->is_set( 'ee' )) { |
|
246 | + if ( ! EE_Registry::instance()->REQ->is_set('ee')) { |
|
247 | 247 | // check that route exists for CPT archive slug |
248 | - if ( is_archive() && EE_Config::get_route( $this->CPT['plural_slug'] )) { |
|
248 | + if (is_archive() && EE_Config::get_route($this->CPT['plural_slug'])) { |
|
249 | 249 | // ie: set "ee" to "events" |
250 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['plural_slug'] ); |
|
250 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['plural_slug']); |
|
251 | 251 | // or does it match a single page CPT like /event/ |
252 | - } else if ( is_single() && EE_Config::get_route( $this->CPT['singular_slug'] )) { |
|
252 | + } else if (is_single() && EE_Config::get_route($this->CPT['singular_slug'])) { |
|
253 | 253 | // ie: set "ee" to "event" |
254 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] ); |
|
254 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']); |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 | } |
@@ -265,11 +265,11 @@ discard block |
||
265 | 265 | * @param WP_Query $WP_Query |
266 | 266 | * @return void |
267 | 267 | */ |
268 | - public function _set_paging( $WP_Query ) { |
|
269 | - if ( $WP_Query->is_main_query() && apply_filters( 'FHEE__EE_CPT_Strategy___set_paging', TRUE )) { |
|
270 | - $page = ( get_query_var('page') ) ? get_query_var('page') : NULL; |
|
271 | - $paged = ( get_query_var('paged') ) ? get_query_var('paged') : $page; |
|
272 | - $WP_Query->set( 'paged', $paged ); |
|
268 | + public function _set_paging($WP_Query) { |
|
269 | + if ($WP_Query->is_main_query() && apply_filters('FHEE__EE_CPT_Strategy___set_paging', TRUE)) { |
|
270 | + $page = (get_query_var('page')) ? get_query_var('page') : NULL; |
|
271 | + $paged = (get_query_var('paged')) ? get_query_var('paged') : $page; |
|
272 | + $WP_Query->set('paged', $paged); |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
@@ -286,35 +286,35 @@ discard block |
||
286 | 286 | * @param WP_Query $WP_Query |
287 | 287 | * @return void |
288 | 288 | */ |
289 | - public function pre_get_posts( $WP_Query ) { |
|
289 | + public function pre_get_posts($WP_Query) { |
|
290 | 290 | // check that post-type is set |
291 | - if ( ! $WP_Query instanceof WP_Query ) { |
|
291 | + if ( ! $WP_Query instanceof WP_Query) { |
|
292 | 292 | return; |
293 | 293 | } |
294 | 294 | |
295 | 295 | // add our conditionals |
296 | - $this->_set_EE_tags_on_WP_Query( $WP_Query ); |
|
296 | + $this->_set_EE_tags_on_WP_Query($WP_Query); |
|
297 | 297 | // check for terms |
298 | - $this->_set_post_type_for_terms( $WP_Query ); |
|
298 | + $this->_set_post_type_for_terms($WP_Query); |
|
299 | 299 | // make sure paging is always set |
300 | - $this->_set_paging( $WP_Query ); |
|
300 | + $this->_set_paging($WP_Query); |
|
301 | 301 | |
302 | 302 | // is a taxonomy set ? |
303 | - if ( $WP_Query->is_tax ) { |
|
303 | + if ($WP_Query->is_tax) { |
|
304 | 304 | // loop thru our taxonomies |
305 | - foreach ( $this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details ) { |
|
305 | + foreach ($this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details) { |
|
306 | 306 | // check if one of our taxonomies is set as a query var |
307 | - if ( isset( $WP_Query->query[ $CPT_taxonomy ] )) { |
|
307 | + if (isset($WP_Query->query[$CPT_taxonomy])) { |
|
308 | 308 | // but which CPT does that correspond to??? hmmm... guess we gotta go looping |
309 | - foreach ( $this->_CPTs as $post_type => $CPT ) { |
|
309 | + foreach ($this->_CPTs as $post_type => $CPT) { |
|
310 | 310 | // verify our CPT has args, is public and has taxonomies set |
311 | - if ( isset( $CPT['args'] ) && $CPT['args']['public'] && ! empty( $CPT['args']['taxonomies'] )) { |
|
311 | + if (isset($CPT['args']) && $CPT['args']['public'] && ! empty($CPT['args']['taxonomies'])) { |
|
312 | 312 | // does the captured taxonomy belong to this CPT ? |
313 | - if ( in_array( $CPT_taxonomy, $CPT['args']['taxonomies'] )) { |
|
313 | + if (in_array($CPT_taxonomy, $CPT['args']['taxonomies'])) { |
|
314 | 314 | // if so, then add this CPT post_type to the current query's array of post_types' |
315 | - $WP_Query->query_vars['post_type'] = isset( $WP_Query->query_vars['post_type'] ) ? (array)$WP_Query->query_vars['post_type'] : array(); |
|
315 | + $WP_Query->query_vars['post_type'] = isset($WP_Query->query_vars['post_type']) ? (array) $WP_Query->query_vars['post_type'] : array(); |
|
316 | 316 | $WP_Query->query_vars['post_type'][] = $post_type; |
317 | - switch( $post_type ) { |
|
317 | + switch ($post_type) { |
|
318 | 318 | case 'espresso_events' : |
319 | 319 | $WP_Query->is_espresso_event_taxonomy = TRUE; |
320 | 320 | break; |
@@ -335,24 +335,24 @@ discard block |
||
335 | 335 | // d( $CPT_taxonomy ); |
336 | 336 | // d( $WP_Query ); |
337 | 337 | |
338 | - if ( isset( $WP_Query->query_vars['post_type'] )) { |
|
338 | + if (isset($WP_Query->query_vars['post_type'])) { |
|
339 | 339 | // loop thru post_types as array |
340 | - foreach ( (array)$WP_Query->query_vars['post_type'] as $post_type ) { |
|
340 | + foreach ((array) $WP_Query->query_vars['post_type'] as $post_type) { |
|
341 | 341 | |
342 | 342 | // is current query for an EE CPT ? |
343 | - if ( isset( $this->_CPTs[ $post_type ] )) { |
|
343 | + if (isset($this->_CPTs[$post_type])) { |
|
344 | 344 | // is EE on or off ? |
345 | - if ( EE_Maintenance_Mode::instance()->level() ) { |
|
345 | + if (EE_Maintenance_Mode::instance()->level()) { |
|
346 | 346 | // reroute CPT template view to maintenance_mode.template.php |
347 | - if( ! has_filter( 'template_include',array( 'EE_Maintenance_Mode', 'template_include' ))){ |
|
348 | - add_filter( 'template_include', array( 'EE_Maintenance_Mode', 'template_include' ), 99999 ); |
|
347 | + if ( ! has_filter('template_include', array('EE_Maintenance_Mode', 'template_include'))) { |
|
348 | + add_filter('template_include', array('EE_Maintenance_Mode', 'template_include'), 99999); |
|
349 | 349 | } |
350 | 350 | return; |
351 | 351 | } |
352 | 352 | // load EE_Request_Handler (this was added as a result of https://events.codebasehq.com/projects/event-espresso/tickets/9037 |
353 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
353 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
354 | 354 | // grab details for the CPT the current query is for |
355 | - $this->CPT = $this->_CPTs[ $post_type ]; |
|
355 | + $this->CPT = $this->_CPTs[$post_type]; |
|
356 | 356 | // set post type |
357 | 357 | $this->CPT['post_type'] = $post_type; |
358 | 358 | // set taxonomies |
@@ -360,27 +360,27 @@ discard block |
||
360 | 360 | // the post or category or term that is triggering EE |
361 | 361 | $this->CPT['espresso_page'] = EE_Registry::instance()->REQ->is_espresso_page(); |
362 | 362 | // requested post name |
363 | - $this->CPT['post_name'] = EE_Registry::instance()->REQ->get( 'post_name' ); |
|
363 | + $this->CPT['post_name'] = EE_Registry::instance()->REQ->get('post_name'); |
|
364 | 364 | //d( $this->CPT ); |
365 | 365 | // add support for viewing 'private', 'draft', or 'pending' posts |
366 | - if ( is_user_logged_in() && isset( $WP_Query->query_vars['p'] ) && $WP_Query->query_vars['p'] != 0 && current_user_can( 'edit_post', $WP_Query->query_vars['p'] )) { |
|
366 | + if (is_user_logged_in() && isset($WP_Query->query_vars['p']) && $WP_Query->query_vars['p'] != 0 && current_user_can('edit_post', $WP_Query->query_vars['p'])) { |
|
367 | 367 | // we can just inject directly into the WP_Query object |
368 | - $WP_Query->query['post_status'] = array( 'publish', 'private', 'draft', 'pending' ); |
|
368 | + $WP_Query->query['post_status'] = array('publish', 'private', 'draft', 'pending'); |
|
369 | 369 | // now set the main 'ee' request var so that the appropriate module can load the appropriate template(s) |
370 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] ); |
|
370 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']); |
|
371 | 371 | } |
372 | - $this->_possibly_set_ee_request_var( $post_type ); |
|
372 | + $this->_possibly_set_ee_request_var($post_type); |
|
373 | 373 | // convert post_type to model name |
374 | - $model_name = str_replace( 'EE_', '', $this->CPT['class_name'] ); |
|
374 | + $model_name = str_replace('EE_', '', $this->CPT['class_name']); |
|
375 | 375 | // get CPT table data via CPT Model |
376 | - $this->CPT_model = EE_Registry::instance()->load_model( $model_name ); |
|
376 | + $this->CPT_model = EE_Registry::instance()->load_model($model_name); |
|
377 | 377 | $this->CPT['tables'] = $this->CPT_model->get_tables(); |
378 | 378 | // is there a Meta Table for this CPT? |
379 | - $this->CPT['meta_table'] = isset( $this->CPT['tables'][ $model_name . '_Meta' ] ) ? $this->CPT['tables'][ $model_name . '_Meta' ] : FALSE; |
|
379 | + $this->CPT['meta_table'] = isset($this->CPT['tables'][$model_name.'_Meta']) ? $this->CPT['tables'][$model_name.'_Meta'] : FALSE; |
|
380 | 380 | // creates classname like: CPT_Event_Strategy |
381 | - $CPT_Strategy_class_name = 'CPT_' . $model_name . '_Strategy'; |
|
381 | + $CPT_Strategy_class_name = 'CPT_'.$model_name.'_Strategy'; |
|
382 | 382 | // load and instantiate |
383 | - $CPT_Strategy = EE_Registry::instance()->load_core ( $CPT_Strategy_class_name, array( 'WP_Query' => $WP_Query, 'CPT' => $this->CPT )); |
|
383 | + $CPT_Strategy = EE_Registry::instance()->load_core($CPT_Strategy_class_name, array('WP_Query' => $WP_Query, 'CPT' => $this->CPT)); |
|
384 | 384 | |
385 | 385 | // !!!!!!!!!! IMPORTANT !!!!!!!!!!!! |
386 | 386 | // here's the list of available filters in the WP_Query object |
@@ -392,13 +392,13 @@ discard block |
||
392 | 392 | // 'post_limits' |
393 | 393 | // 'posts_fields' |
394 | 394 | // 'posts_join' |
395 | - add_filter( 'posts_fields', array( $this, 'posts_fields' )); |
|
396 | - add_filter( 'posts_join', array( $this, 'posts_join' )); |
|
397 | - add_filter( 'get_' . $this->CPT['post_type'] . '_metadata', array( $CPT_Strategy, 'get_EE_post_type_metadata' ), 1, 4 ); |
|
398 | - add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 1 ); |
|
399 | - add_filter( 'get_edit_post_link', array( $this, 'get_edit_post_link' ), 10, 2 ); |
|
395 | + add_filter('posts_fields', array($this, 'posts_fields')); |
|
396 | + add_filter('posts_join', array($this, 'posts_join')); |
|
397 | + add_filter('get_'.$this->CPT['post_type'].'_metadata', array($CPT_Strategy, 'get_EE_post_type_metadata'), 1, 4); |
|
398 | + add_filter('the_posts', array($this, 'the_posts'), 1, 1); |
|
399 | + add_filter('get_edit_post_link', array($this, 'get_edit_post_link'), 10, 2); |
|
400 | 400 | |
401 | - $this->_do_template_filters( $WP_Query ); |
|
401 | + $this->_do_template_filters($WP_Query); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | } |
@@ -413,13 +413,13 @@ discard block |
||
413 | 413 | * @param $SQL |
414 | 414 | * @return string |
415 | 415 | */ |
416 | - public function posts_fields( $SQL ) { |
|
416 | + public function posts_fields($SQL) { |
|
417 | 417 | // does this CPT have a meta table ? |
418 | - if ( ! empty( $this->CPT['meta_table'] )) { |
|
418 | + if ( ! empty($this->CPT['meta_table'])) { |
|
419 | 419 | // adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement |
420 | - $SQL .= ', ' . $this->CPT['meta_table']->get_table_name() . '.* ' ; |
|
420 | + $SQL .= ', '.$this->CPT['meta_table']->get_table_name().'.* '; |
|
421 | 421 | } |
422 | - remove_filter( 'posts_fields', array( $this, 'posts_fields' )); |
|
422 | + remove_filter('posts_fields', array($this, 'posts_fields')); |
|
423 | 423 | return $SQL; |
424 | 424 | } |
425 | 425 | |
@@ -432,14 +432,14 @@ discard block |
||
432 | 432 | * @param $SQL |
433 | 433 | * @return string |
434 | 434 | */ |
435 | - public function posts_join( $SQL ) { |
|
435 | + public function posts_join($SQL) { |
|
436 | 436 | // does this CPT have a meta table ? |
437 | - if ( ! empty( $this->CPT['meta_table'] )) { |
|
437 | + if ( ! empty($this->CPT['meta_table'])) { |
|
438 | 438 | global $wpdb; |
439 | 439 | // adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement |
440 | - $SQL .= ' LEFT JOIN ' . $this->CPT['meta_table']->get_table_name() . ' ON ( ' . $this->CPT['meta_table']->get_table_name() . '.' . $this->CPT['meta_table']->get_fk_on_table() . ' = ' . $wpdb->posts . '.ID ) '; |
|
440 | + $SQL .= ' LEFT JOIN '.$this->CPT['meta_table']->get_table_name().' ON ( '.$this->CPT['meta_table']->get_table_name().'.'.$this->CPT['meta_table']->get_fk_on_table().' = '.$wpdb->posts.'.ID ) '; |
|
441 | 441 | } |
442 | - remove_filter( 'posts_join', array( $this, 'posts_join' )); |
|
442 | + remove_filter('posts_join', array($this, 'posts_join')); |
|
443 | 443 | return $SQL; |
444 | 444 | } |
445 | 445 | |
@@ -452,18 +452,18 @@ discard block |
||
452 | 452 | * @param \WP_Post[] $posts |
453 | 453 | * @return \WP_Post[] |
454 | 454 | */ |
455 | - public function the_posts( $posts ) { |
|
455 | + public function the_posts($posts) { |
|
456 | 456 | // d( $posts ); |
457 | 457 | $CPT_class = $this->CPT['class_name']; |
458 | 458 | // loop thru posts |
459 | - if ( is_array( $posts )) { |
|
460 | - foreach( $posts as $key => $post ) { |
|
461 | - if ( isset( $this->_CPTs[ $post->post_type ] )) { |
|
462 | - $post->$CPT_class = $this->CPT_model->instantiate_class_from_post_object( $post ); |
|
459 | + if (is_array($posts)) { |
|
460 | + foreach ($posts as $key => $post) { |
|
461 | + if (isset($this->_CPTs[$post->post_type])) { |
|
462 | + $post->$CPT_class = $this->CPT_model->instantiate_class_from_post_object($post); |
|
463 | 463 | } |
464 | 464 | } |
465 | 465 | } |
466 | - remove_filter( 'the_posts', array( $this, 'the_posts' ), 1, 1 ); |
|
466 | + remove_filter('the_posts', array($this, 'the_posts'), 1, 1); |
|
467 | 467 | return $posts; |
468 | 468 | } |
469 | 469 | |
@@ -474,17 +474,17 @@ discard block |
||
474 | 474 | * @param $ID |
475 | 475 | * @return string |
476 | 476 | */ |
477 | - function get_edit_post_link( $url, $ID ) { |
|
477 | + function get_edit_post_link($url, $ID) { |
|
478 | 478 | //need to make sure we only edit links if our cpt |
479 | 479 | global $post; |
480 | - if ( ! isset( $this->_CPTs[ $post->post_type ] )) { |
|
480 | + if ( ! isset($this->_CPTs[$post->post_type])) { |
|
481 | 481 | return $url; |
482 | 482 | } |
483 | 483 | //k made it here so all is good. |
484 | 484 | $scheme = is_ssl() ? 'https' : 'http'; |
485 | - $url = get_admin_url( EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme ); |
|
485 | + $url = get_admin_url(EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme); |
|
486 | 486 | // http://example.com/wp-admin/admin.php?page=espresso_events&action=edit&post=205&edit_nonce=0d403530d6 |
487 | - return wp_nonce_url( add_query_arg( array( 'page' => $this->CPT['post_type'], 'post' =>$ID, 'action' =>'edit' ), $url ), 'edit', 'edit_nonce' ); |
|
487 | + return wp_nonce_url(add_query_arg(array('page' => $this->CPT['post_type'], 'post' =>$ID, 'action' =>'edit'), $url), 'edit', 'edit_nonce'); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | |
@@ -498,11 +498,11 @@ discard block |
||
498 | 498 | * @param WP_Query $WP_Query |
499 | 499 | * @return void |
500 | 500 | */ |
501 | - protected function _do_template_filters( WP_Query $WP_Query ) { |
|
501 | + protected function _do_template_filters(WP_Query $WP_Query) { |
|
502 | 502 | // if it's the main query and requested cpt supports page_templates, |
503 | - if ( $WP_Query->is_main_query() && ! empty( $this->CPT['args']['page_templates'] ) ) { |
|
503 | + if ($WP_Query->is_main_query() && ! empty($this->CPT['args']['page_templates'])) { |
|
504 | 504 | // then let's hook into the appropriate query_template hook |
505 | - add_filter( 'single_template', array( $this, 'single_cpt_template' ) ); |
|
505 | + add_filter('single_template', array($this, 'single_cpt_template')); |
|
506 | 506 | } |
507 | 507 | } |
508 | 508 | |
@@ -516,17 +516,17 @@ discard block |
||
516 | 516 | * @param string $current_template Existing default template path derived for this page call. |
517 | 517 | * @return string the path to the full template file. |
518 | 518 | */ |
519 | - public function single_cpt_template( $current_template ) { |
|
519 | + public function single_cpt_template($current_template) { |
|
520 | 520 | $object = get_queried_object(); |
521 | 521 | //does this called object HAVE a page template set that is something other than the default. |
522 | - $template = get_post_meta( $object->ID, '_wp_page_template', true ); |
|
522 | + $template = get_post_meta($object->ID, '_wp_page_template', true); |
|
523 | 523 | |
524 | 524 | //exit early if default or not set or invalid path (accounts for theme changes) |
525 | - if ( $template == 'default' || empty( $template ) || ! is_readable( get_stylesheet_directory() . '/' . $template ) ) { |
|
525 | + if ($template == 'default' || empty($template) || ! is_readable(get_stylesheet_directory().'/'.$template)) { |
|
526 | 526 | return $current_template; |
527 | 527 | } |
528 | 528 | //made it here so we SHOULD be able to just locate the template and then return it. |
529 | - $template = locate_template( array($template) ); |
|
529 | + $template = locate_template(array($template)); |
|
530 | 530 | |
531 | 531 | return $template; |
532 | 532 | } |
@@ -574,9 +574,9 @@ discard block |
||
574 | 574 | * @param array $arguments |
575 | 575 | * @return \EE_CPT_Default_Strategy |
576 | 576 | */ |
577 | - public function __construct( $arguments = array() ) { |
|
578 | - $this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL; |
|
579 | - $WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL; |
|
577 | + public function __construct($arguments = array()) { |
|
578 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL; |
|
579 | + $WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL; |
|
580 | 580 | //EEH_Debug_Tools::printr( $this->CPT, '$this->CPT <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
581 | 581 | // add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ), 999 ); |
582 | 582 | // add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 ); |
@@ -591,9 +591,9 @@ discard block |
||
591 | 591 | * @param \WP_Query $WP_Query |
592 | 592 | * @return \WP_Query |
593 | 593 | */ |
594 | - public function pre_get_posts( WP_Query $WP_Query ) { |
|
594 | + public function pre_get_posts(WP_Query $WP_Query) { |
|
595 | 595 | //EEH_Debug_Tools::printr( $WP_Query, '$WP_Query <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
596 | - if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive() ) { |
|
596 | + if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
597 | 597 | return $WP_Query; |
598 | 598 | } |
599 | 599 | // $WP_Query->set( 'post_type', array( $this->CPT['post_type'] )); |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | * @param \WP_Query $WP_Query |
612 | 612 | * @return \WP_Post[] |
613 | 613 | */ |
614 | - public function the_posts( $posts, WP_Query $WP_Query ) { |
|
614 | + public function the_posts($posts, WP_Query $WP_Query) { |
|
615 | 615 | return $posts; |
616 | 616 | } |
617 | 617 | |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | * @param string $single |
628 | 628 | * @return mixed |
629 | 629 | */ |
630 | - public function get_EE_post_type_metadata( $meta_value = NULL, $post_id, $meta_key, $single ) { |
|
630 | + public function get_EE_post_type_metadata($meta_value = NULL, $post_id, $meta_key, $single) { |
|
631 | 631 | return $meta_value; |
632 | 632 | } |
633 | 633 |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | |
43 | 43 | public function __construct() { |
44 | 44 | // construct request stack and run middleware apps as soon as all WP plugins are loaded |
45 | - add_action( 'plugins_loaded', array( $this, 'run_request_stack' ), 0 ); |
|
45 | + add_action('plugins_loaded', array($this, 'run_request_stack'), 0); |
|
46 | 46 | // set framework for the rest of EE to hook into when loading |
47 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'load_espresso_addons' ), 1 ); |
|
48 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'detect_activations_or_upgrades' ), 3 ); |
|
49 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'load_core_configuration' ), 5 ); |
|
50 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
51 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'brew_espresso' ), 9 ); |
|
47 | + add_action('plugins_loaded', array('EE_Bootstrap', 'load_espresso_addons'), 1); |
|
48 | + add_action('plugins_loaded', array('EE_Bootstrap', 'detect_activations_or_upgrades'), 3); |
|
49 | + add_action('plugins_loaded', array('EE_Bootstrap', 'load_core_configuration'), 5); |
|
50 | + add_action('plugins_loaded', array('EE_Bootstrap', 'register_shortcodes_modules_and_widgets'), 7); |
|
51 | + add_action('plugins_loaded', array('EE_Bootstrap', 'brew_espresso'), 9); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | new EE_Load_Espresso_Core() |
66 | 66 | ); |
67 | 67 | $this->_request_stack->handle_request( |
68 | - new EE_Request( $_REQUEST ), |
|
68 | + new EE_Request($_REQUEST), |
|
69 | 69 | new EE_Response() |
70 | 70 | ); |
71 | 71 | $this->_request_stack->handle_response(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | protected function load_autoloader() { |
80 | 80 | // load interfaces |
81 | - espresso_load_required( 'EEH_Autoloader', EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php' ); |
|
81 | + espresso_load_required('EEH_Autoloader', EE_CORE.'helpers'.DS.'EEH_Autoloader.helper.php'); |
|
82 | 82 | EEH_Autoloader::instance(); |
83 | 83 | } |
84 | 84 | |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function set_autoloaders_for_required_files() { |
91 | 91 | // load interfaces |
92 | - espresso_load_required( 'EEI_Interfaces', EE_CORE . 'interfaces' . DS . 'EEI_Interfaces.php' ); |
|
92 | + espresso_load_required('EEI_Interfaces', EE_CORE.'interfaces'.DS.'EEI_Interfaces.php'); |
|
93 | 93 | // load helpers |
94 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_HELPERS ); |
|
94 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
95 | 95 | // load request stack |
96 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'request_stack' . DS ); |
|
96 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'request_stack'.DS); |
|
97 | 97 | // load middleware |
98 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'middleware' . DS ); |
|
98 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'middleware'.DS); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | ) |
119 | 119 | ); |
120 | 120 | // load middleware onto stack : FILO (First In Last Out) |
121 | - foreach ( (array)$stack_apps as $stack_app ) { |
|
121 | + foreach ((array) $stack_apps as $stack_app) { |
|
122 | 122 | //$request_stack_builder->push( $stack_app ); |
123 | - $request_stack_builder->unshift( $stack_app ); |
|
123 | + $request_stack_builder->unshift($stack_app); |
|
124 | 124 | } |
125 | 125 | return apply_filters( |
126 | 126 | 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * no other logic should be performed at this point |
138 | 138 | */ |
139 | 139 | public static function load_espresso_addons() { |
140 | - do_action( 'AHEE__EE_Bootstrap__load_espresso_addons' ); |
|
140 | + do_action('AHEE__EE_Bootstrap__load_espresso_addons'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * we can determine if anything needs activating or upgrading |
150 | 150 | */ |
151 | 151 | public static function detect_activations_or_upgrades() { |
152 | - do_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades' ); |
|
152 | + do_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * we can load and set all of the system configurations |
162 | 162 | */ |
163 | 163 | public static function load_core_configuration() { |
164 | - do_action( 'AHEE__EE_Bootstrap__load_core_configuration' ); |
|
164 | + do_action('AHEE__EE_Bootstrap__load_core_configuration'); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * so that they are ready to be used throughout the system |
174 | 174 | */ |
175 | 175 | public static function register_shortcodes_modules_and_widgets() { |
176 | - do_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets' ); |
|
176 | + do_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets'); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * so let the fun begin... |
186 | 186 | */ |
187 | 187 | public static function brew_espresso() { |
188 | - do_action( 'AHEE__EE_Bootstrap__brew_espresso' ); |
|
188 | + do_action('AHEE__EE_Bootstrap__brew_espresso'); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @param EE_Response $response |
51 | 51 | * @return EE_Response |
52 | 52 | */ |
53 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
53 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
54 | 54 | $this->request = $request; |
55 | 55 | $this->response = $response; |
56 | 56 | // central repository for classes |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | // workarounds for PHP < 5.3 |
59 | 59 | $this->_load_class_tools(); |
60 | 60 | // PSR4 Autoloaders |
61 | - EE_Registry::instance()->load_core( 'EE_Psr4AutoloaderInit' ); |
|
61 | + EE_Registry::instance()->load_core('EE_Psr4AutoloaderInit'); |
|
62 | 62 | // deprecated functions |
63 | - espresso_load_required( 'EE_Deprecated', EE_CORE . 'EE_Deprecated.core.php' ); |
|
63 | + espresso_load_required('EE_Deprecated', EE_CORE.'EE_Deprecated.core.php'); |
|
64 | 64 | // load interfaces |
65 | - espresso_load_required( 'EEI_Payment_Method_Interfaces', EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php' ); |
|
65 | + espresso_load_required('EEI_Payment_Method_Interfaces', EE_LIBRARIES.'payment_methods'.DS.'EEI_Payment_Method_Interfaces.php'); |
|
66 | 66 | //// WP cron jobs |
67 | - EE_Registry::instance()->load_core( 'Cron_Tasks' ); |
|
68 | - EE_Registry::instance()->load_core( 'EE_System' ); |
|
67 | + EE_Registry::instance()->load_core('Cron_Tasks'); |
|
68 | + EE_Registry::instance()->load_core('EE_System'); |
|
69 | 69 | |
70 | 70 | return $this->response; |
71 | 71 | } |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | private function _load_registry() { |
82 | - if ( is_readable( EE_CORE . 'EE_Registry.core.php' )) { |
|
83 | - require_once( EE_CORE . 'EE_Registry.core.php' ); |
|
82 | + if (is_readable(EE_CORE.'EE_Registry.core.php')) { |
|
83 | + require_once(EE_CORE.'EE_Registry.core.php'); |
|
84 | 84 | } else { |
85 | - $msg = __( 'The EE_Registry core class could not be loaded.', 'event_espresso' ); |
|
86 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
87 | - wp_die( EE_Error::get_notices() ); |
|
85 | + $msg = __('The EE_Registry core class could not be loaded.', 'event_espresso'); |
|
86 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
87 | + wp_die(EE_Error::get_notices()); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | * @return void |
97 | 97 | */ |
98 | 98 | private function _load_class_tools() { |
99 | - if ( is_readable( EE_HELPERS . 'EEH_Class_Tools.helper.php' )) { |
|
100 | - require_once( EE_HELPERS . 'EEH_Class_Tools.helper.php' ); |
|
99 | + if (is_readable(EE_HELPERS.'EEH_Class_Tools.helper.php')) { |
|
100 | + require_once(EE_HELPERS.'EEH_Class_Tools.helper.php'); |
|
101 | 101 | } else { |
102 | - $msg = __( 'The EEH_Class_Tools helper could not be loaded.', 'event_espresso' ); |
|
103 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
102 | + $msg = __('The EEH_Class_Tools helper could not be loaded.', 'event_espresso'); |
|
103 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @param \EE_Request $request |
116 | 116 | * @param \EE_Response $response |
117 | 117 | */ |
118 | - public function handle_response( EE_Request $request, EE_Response $response ) { |
|
118 | + public function handle_response(EE_Request $request, EE_Response $response) { |
|
119 | 119 | //EEH_Debug_Tools::printr( $request, '$request', __FILE__, __LINE__ ); |
120 | 120 | //EEH_Debug_Tools::printr( $response, '$response', __FILE__, __LINE__ ); |
121 | 121 | //die(); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public static function instance() { |
158 | 158 | // check if class object is instantiated |
159 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Registry )) { |
|
159 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Registry)) { |
|
160 | 160 | self::$_instance = new self(); |
161 | 161 | } |
162 | 162 | return self::$_instance; |
@@ -171,14 +171,14 @@ discard block |
||
171 | 171 | * @return EE_Registry |
172 | 172 | */ |
173 | 173 | private function __construct() { |
174 | - $this->load_core( 'Base' ); |
|
174 | + $this->load_core('Base'); |
|
175 | 175 | // class library |
176 | 176 | $this->LIB = new StdClass(); |
177 | 177 | $this->addons = new StdClass(); |
178 | 178 | $this->modules = new StdClass(); |
179 | 179 | $this->shortcodes = new StdClass(); |
180 | 180 | $this->widgets = new StdClass(); |
181 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'init' )); |
|
181 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init')); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function init() { |
193 | 193 | // Get current page protocol |
194 | - $protocol = isset( $_SERVER['HTTPS'] ) ? 'https://' : 'http://'; |
|
194 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
195 | 195 | // Output admin-ajax.php URL with same protocol as current page |
196 | - self::$i18n_js_strings['ajax_url'] = admin_url( 'admin-ajax.php', $protocol ); |
|
197 | - self::$i18n_js_strings['wp_debug'] = defined( 'WP_DEBUG' ) ? WP_DEBUG : FALSE; |
|
196 | + self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol); |
|
197 | + self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : FALSE; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -205,14 +205,14 @@ discard block |
||
205 | 205 | * @return string |
206 | 206 | */ |
207 | 207 | public static function localize_i18n_js_strings() { |
208 | - $i18n_js_strings = (array)EE_Registry::$i18n_js_strings; |
|
209 | - foreach ( $i18n_js_strings as $key => $value ) { |
|
210 | - if ( is_scalar( $value ) ) { |
|
211 | - $i18n_js_strings[ $key ] = html_entity_decode( (string)$value, ENT_QUOTES, 'UTF-8' ); |
|
208 | + $i18n_js_strings = (array) EE_Registry::$i18n_js_strings; |
|
209 | + foreach ($i18n_js_strings as $key => $value) { |
|
210 | + if (is_scalar($value)) { |
|
211 | + $i18n_js_strings[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
215 | - return "/* <![CDATA[ */ var eei18n = " . wp_json_encode( $i18n_js_strings ) . '; /* ]]> */'; |
|
215 | + return "/* <![CDATA[ */ var eei18n = ".wp_json_encode($i18n_js_strings).'; /* ]]> */'; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -220,15 +220,15 @@ discard block |
||
220 | 220 | /** |
221 | 221 | * @param mixed string | EED_Module $module |
222 | 222 | */ |
223 | - public function add_module( $module ) { |
|
224 | - if ( $module instanceof EED_Module ) { |
|
225 | - $module_class = get_class( $module ); |
|
223 | + public function add_module($module) { |
|
224 | + if ($module instanceof EED_Module) { |
|
225 | + $module_class = get_class($module); |
|
226 | 226 | $this->modules->{$module_class} = $module; |
227 | 227 | } else { |
228 | - if ( ! class_exists( 'EE_Module_Request_Router' )) { |
|
229 | - $this->load_core( 'Module_Request_Router' ); |
|
228 | + if ( ! class_exists('EE_Module_Request_Router')) { |
|
229 | + $this->load_core('Module_Request_Router'); |
|
230 | 230 | } |
231 | - $this->modules->{$module} = EE_Module_Request_Router::module_factory( $module ); |
|
231 | + $this->modules->{$module} = EE_Module_Request_Router::module_factory($module); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | * @param string $module_name |
239 | 239 | * @return mixed EED_Module | NULL |
240 | 240 | */ |
241 | - public function get_module( $module_name = '' ) { |
|
242 | - return isset( $this->modules->{$module_name} ) ? $this->modules->{$module_name} : NULL; |
|
241 | + public function get_module($module_name = '') { |
|
242 | + return isset($this->modules->{$module_name} ) ? $this->modules->{$module_name} : NULL; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | |
@@ -252,18 +252,18 @@ discard block |
||
252 | 252 | * @param bool $load_only |
253 | 253 | * @return mixed |
254 | 254 | */ |
255 | - public function load_core ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
255 | + public function load_core($class_name, $arguments = array(), $load_only = FALSE) { |
|
256 | 256 | $core_paths = apply_filters( |
257 | 257 | 'FHEE__EE_Registry__load_core__core_paths', |
258 | 258 | array( |
259 | 259 | EE_CORE, |
260 | 260 | EE_ADMIN, |
261 | 261 | EE_CPTS, |
262 | - EE_CORE . 'data_migration_scripts' . DS |
|
262 | + EE_CORE.'data_migration_scripts'.DS |
|
263 | 263 | ) |
264 | 264 | ); |
265 | 265 | // retrieve instantiated class |
266 | - return $this->_load( $core_paths, 'EE_' , $class_name, 'core', $arguments, FALSE, TRUE, $load_only ); |
|
266 | + return $this->_load($core_paths, 'EE_', $class_name, 'core', $arguments, FALSE, TRUE, $load_only); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -276,9 +276,9 @@ discard block |
||
276 | 276 | * @param mixed $arguments |
277 | 277 | * @return EE_Data_Migration_Script_Base |
278 | 278 | */ |
279 | - public function load_dms ( $class_name, $arguments = array() ) { |
|
279 | + public function load_dms($class_name, $arguments = array()) { |
|
280 | 280 | // retrieve instantiated class |
281 | - return $this->_load( EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_' , $class_name, 'dms', $arguments, FALSE, FALSE, FALSE ); |
|
281 | + return $this->_load(EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, FALSE, FALSE, FALSE); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -293,14 +293,14 @@ discard block |
||
293 | 293 | * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default) |
294 | 294 | * @return EE_Base_Class |
295 | 295 | */ |
296 | - public function load_class ( $class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) { |
|
297 | - $paths = apply_filters('FHEE__EE_Registry__load_class__paths',array( |
|
296 | + public function load_class($class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE) { |
|
297 | + $paths = apply_filters('FHEE__EE_Registry__load_class__paths', array( |
|
298 | 298 | EE_CORE, |
299 | 299 | EE_CLASSES, |
300 | 300 | EE_BUSINESS |
301 | 301 | )); |
302 | 302 | // retrieve instantiated class |
303 | - return $this->_load( $paths, 'EE_' , $class_name, 'class', $arguments, $from_db, $cache, $load_only ); |
|
303 | + return $this->_load($paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -314,10 +314,10 @@ discard block |
||
314 | 314 | * @param bool $load_only |
315 | 315 | * @return EEH_Base |
316 | 316 | */ |
317 | - public function load_helper ( $class_name, $arguments = array(), $load_only = TRUE ) { |
|
318 | - $helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS ) ); |
|
317 | + public function load_helper($class_name, $arguments = array(), $load_only = TRUE) { |
|
318 | + $helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS)); |
|
319 | 319 | // retrieve instantiated class |
320 | - return $this->_load( $helper_paths, 'EEH_', $class_name, 'helper', $arguments, FALSE, TRUE, $load_only ); |
|
320 | + return $this->_load($helper_paths, 'EEH_', $class_name, 'helper', $arguments, FALSE, TRUE, $load_only); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | |
@@ -331,16 +331,16 @@ discard block |
||
331 | 331 | * @param bool $load_only |
332 | 332 | * @return mixed |
333 | 333 | */ |
334 | - public function load_lib ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
334 | + public function load_lib($class_name, $arguments = array(), $load_only = FALSE) { |
|
335 | 335 | $paths = array( |
336 | 336 | EE_LIBRARIES, |
337 | - EE_LIBRARIES . 'messages' . DS, |
|
338 | - EE_LIBRARIES . 'shortcodes' . DS, |
|
339 | - EE_LIBRARIES . 'qtips' . DS, |
|
340 | - EE_LIBRARIES . 'payment_methods' . DS, |
|
337 | + EE_LIBRARIES.'messages'.DS, |
|
338 | + EE_LIBRARIES.'shortcodes'.DS, |
|
339 | + EE_LIBRARIES.'qtips'.DS, |
|
340 | + EE_LIBRARIES.'payment_methods'.DS, |
|
341 | 341 | ); |
342 | 342 | // retrieve instantiated class |
343 | - return $this->_load( $paths, 'EE_' , $class_name, 'lib', $arguments, FALSE, TRUE, $load_only ); |
|
343 | + return $this->_load($paths, 'EE_', $class_name, 'lib', $arguments, FALSE, TRUE, $load_only); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -353,13 +353,13 @@ discard block |
||
353 | 353 | * @param bool $load_only |
354 | 354 | * @return EEM_Base |
355 | 355 | */ |
356 | - public function load_model ( $class_name, $arguments = array(), $load_only = FALSE ) { |
|
357 | - $paths = apply_filters('FHEE__EE_Registry__load_model__paths',array( |
|
356 | + public function load_model($class_name, $arguments = array(), $load_only = FALSE) { |
|
357 | + $paths = apply_filters('FHEE__EE_Registry__load_model__paths', array( |
|
358 | 358 | EE_MODELS, |
359 | 359 | EE_CORE |
360 | 360 | )); |
361 | 361 | // retrieve instantiated class |
362 | - return $this->_load( $paths, 'EEM_' , $class_name, 'model', $arguments, FALSE, TRUE, $load_only ); |
|
362 | + return $this->_load($paths, 'EEM_', $class_name, 'model', $arguments, FALSE, TRUE, $load_only); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -372,15 +372,15 @@ discard block |
||
372 | 372 | * @param bool $load_only |
373 | 373 | * @return mixed |
374 | 374 | */ |
375 | - public function load_model_class ( $class_name, $arguments = array(), $load_only = TRUE ) { |
|
375 | + public function load_model_class($class_name, $arguments = array(), $load_only = TRUE) { |
|
376 | 376 | $paths = array( |
377 | - EE_MODELS . 'fields' . DS, |
|
378 | - EE_MODELS . 'helpers' . DS, |
|
379 | - EE_MODELS . 'relations' . DS, |
|
380 | - EE_MODELS . 'strategies' . DS |
|
377 | + EE_MODELS.'fields'.DS, |
|
378 | + EE_MODELS.'helpers'.DS, |
|
379 | + EE_MODELS.'relations'.DS, |
|
380 | + EE_MODELS.'strategies'.DS |
|
381 | 381 | ); |
382 | 382 | // retrieve instantiated class |
383 | - return $this->_load( $paths, 'EE_' , $class_name, '', $arguments, FALSE, TRUE, $load_only ); |
|
383 | + return $this->_load($paths, 'EE_', $class_name, '', $arguments, FALSE, TRUE, $load_only); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
@@ -392,8 +392,8 @@ discard block |
||
392 | 392 | * @param string $model_name like Event, Attendee, Question_Group_Question, etc. |
393 | 393 | * @return boolean |
394 | 394 | */ |
395 | - public function is_model_name( $model_name ){ |
|
396 | - return isset( $this->models[ $model_name ] ) ? TRUE : FALSE; |
|
395 | + public function is_model_name($model_name) { |
|
396 | + return isset($this->models[$model_name]) ? TRUE : FALSE; |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | |
@@ -408,9 +408,9 @@ discard block |
||
408 | 408 | * @param bool $load_only |
409 | 409 | * @return mixed |
410 | 410 | */ |
411 | - public function load_file ( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE ) { |
|
411 | + public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE) { |
|
412 | 412 | // retrieve instantiated class |
413 | - return $this->_load( $path_to_file, '', $file_name, $type, $arguments, FALSE, TRUE, $load_only ); |
|
413 | + return $this->_load($path_to_file, '', $file_name, $type, $arguments, FALSE, TRUE, $load_only); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | |
@@ -425,9 +425,9 @@ discard block |
||
425 | 425 | * @param bool $load_only |
426 | 426 | * @return EE_Addon |
427 | 427 | */ |
428 | - public function load_addon ( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE ) { |
|
428 | + public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE) { |
|
429 | 429 | // retrieve instantiated class |
430 | - return $this->_load( $path_to_file, 'addon', $class_name, $type, $arguments, FALSE, TRUE, $load_only ); |
|
430 | + return $this->_load($path_to_file, 'addon', $class_name, $type, $arguments, FALSE, TRUE, $load_only); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | |
@@ -445,15 +445,15 @@ discard block |
||
445 | 445 | * @internal param string $file_path - file path including file name |
446 | 446 | * @return bool | object |
447 | 447 | */ |
448 | - private function _load ( $file_paths = array(), $class_prefix = 'EE_', $class_name = FALSE, $type = 'class', $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) { |
|
448 | + private function _load($file_paths = array(), $class_prefix = 'EE_', $class_name = FALSE, $type = 'class', $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE) { |
|
449 | 449 | // strip php file extension |
450 | - $class_name = str_replace( '.php', '', trim( $class_name )); |
|
450 | + $class_name = str_replace('.php', '', trim($class_name)); |
|
451 | 451 | // does the class have a prefix ? |
452 | - if ( ! empty( $class_prefix ) && $class_prefix != 'addon' ) { |
|
452 | + if ( ! empty($class_prefix) && $class_prefix != 'addon') { |
|
453 | 453 | // make sure $class_prefix is uppercase |
454 | - $class_prefix = strtoupper( trim( $class_prefix )); |
|
454 | + $class_prefix = strtoupper(trim($class_prefix)); |
|
455 | 455 | // add class prefix ONCE!!! |
456 | - $class_name = $class_prefix . str_replace( $class_prefix, '', $class_name ); |
|
456 | + $class_name = $class_prefix.str_replace($class_prefix, '', $class_name); |
|
457 | 457 | } |
458 | 458 | |
459 | 459 | $class_abbreviations = array( |
@@ -466,56 +466,56 @@ discard block |
||
466 | 466 | ); |
467 | 467 | |
468 | 468 | // check if class has already been loaded, and return it if it has been |
469 | - if ( isset( $class_abbreviations[ $class_name ] ) && ! is_null( $this->$class_abbreviations[ $class_name ] )) { |
|
470 | - return $this->$class_abbreviations[ $class_name ]; |
|
471 | - } else if ( isset ( $this->{$class_name} )) { |
|
469 | + if (isset($class_abbreviations[$class_name]) && ! is_null($this->$class_abbreviations[$class_name])) { |
|
470 | + return $this->$class_abbreviations[$class_name]; |
|
471 | + } else if (isset ($this->{$class_name} )) { |
|
472 | 472 | return $this->{$class_name}; |
473 | - } else if ( isset ( $this->LIB->$class_name )) { |
|
473 | + } else if (isset ($this->LIB->$class_name)) { |
|
474 | 474 | return $this->LIB->$class_name; |
475 | - } else if ( $class_prefix == 'addon' && isset ( $this->addons->$class_name )) { |
|
475 | + } else if ($class_prefix == 'addon' && isset ($this->addons->$class_name)) { |
|
476 | 476 | return $this->addons->$class_name; |
477 | 477 | } |
478 | 478 | |
479 | 479 | // assume all paths lead nowhere |
480 | 480 | $path = FALSE; |
481 | 481 | // make sure $file_paths is an array |
482 | - $file_paths = is_array( $file_paths ) ? $file_paths : array( $file_paths ); |
|
482 | + $file_paths = is_array($file_paths) ? $file_paths : array($file_paths); |
|
483 | 483 | // cycle thru paths |
484 | - foreach ( $file_paths as $key => $file_path ) { |
|
484 | + foreach ($file_paths as $key => $file_path) { |
|
485 | 485 | // convert all separators to proper DS, if no filepath, then use EE_CLASSES |
486 | - $file_path = $file_path ? str_replace( array( '/', '\\' ), DS, $file_path ) : EE_CLASSES; |
|
486 | + $file_path = $file_path ? str_replace(array('/', '\\'), DS, $file_path) : EE_CLASSES; |
|
487 | 487 | // prep file type |
488 | - $type = ! empty( $type ) ? trim( $type, '.' ) . '.' : ''; |
|
488 | + $type = ! empty($type) ? trim($type, '.').'.' : ''; |
|
489 | 489 | // build full file path |
490 | - $file_paths[ $key ] = rtrim( $file_path, DS ) . DS . $class_name . '.' . $type . 'php'; |
|
490 | + $file_paths[$key] = rtrim($file_path, DS).DS.$class_name.'.'.$type.'php'; |
|
491 | 491 | //does the file exist and can be read ? |
492 | - if ( is_readable( $file_paths[ $key ] )) { |
|
493 | - $path = $file_paths[ $key ]; |
|
492 | + if (is_readable($file_paths[$key])) { |
|
493 | + $path = $file_paths[$key]; |
|
494 | 494 | break; |
495 | 495 | } |
496 | 496 | } |
497 | 497 | // don't give up! you gotta... |
498 | 498 | try { |
499 | 499 | //does the file exist and can it be read ? |
500 | - if ( ! $path ) { |
|
500 | + if ( ! $path) { |
|
501 | 501 | // so sorry, can't find the file |
502 | - throw new EE_Error ( |
|
503 | - sprintf ( |
|
504 | - __('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s','event_espresso'), |
|
505 | - trim( $type, '.' ), |
|
502 | + throw new EE_Error( |
|
503 | + sprintf( |
|
504 | + __('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso'), |
|
505 | + trim($type, '.'), |
|
506 | 506 | $class_name, |
507 | - '<br />' . implode( ',<br />', $file_paths ) |
|
507 | + '<br />'.implode(',<br />', $file_paths) |
|
508 | 508 | ) |
509 | 509 | ); |
510 | 510 | } |
511 | 511 | // get the file |
512 | - require_once( $path ); |
|
512 | + require_once($path); |
|
513 | 513 | // if the class isn't already declared somewhere |
514 | - if ( class_exists( $class_name, FALSE ) === FALSE ) { |
|
514 | + if (class_exists($class_name, FALSE) === FALSE) { |
|
515 | 515 | // so sorry, not a class |
516 | 516 | throw new EE_Error( |
517 | 517 | sprintf( |
518 | - __('The %s file %s does not appear to contain the %s Class.','event_espresso'), |
|
518 | + __('The %s file %s does not appear to contain the %s Class.', 'event_espresso'), |
|
519 | 519 | $type, |
520 | 520 | $path, |
521 | 521 | $class_name |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | ); |
524 | 524 | } |
525 | 525 | |
526 | - } catch ( EE_Error $e ) { |
|
526 | + } catch (EE_Error $e) { |
|
527 | 527 | $e->get_error(); |
528 | 528 | } |
529 | 529 | |
@@ -531,38 +531,38 @@ discard block |
||
531 | 531 | // don't give up! you gotta... |
532 | 532 | try { |
533 | 533 | // create reflection |
534 | - $reflector = new ReflectionClass( $class_name ); |
|
534 | + $reflector = new ReflectionClass($class_name); |
|
535 | 535 | // instantiate the class and add to the LIB array for tracking |
536 | 536 | // EE_Base_Classes are instantiated via new_instance by default (models call them via new_instance_from_db) |
537 | - if ( $reflector->getConstructor() === NULL || $reflector->isAbstract() || $load_only ) { |
|
537 | + if ($reflector->getConstructor() === NULL || $reflector->isAbstract() || $load_only) { |
|
538 | 538 | // $instantiation_mode = 0; |
539 | 539 | // no constructor = static methods only... nothing to instantiate, loading file was enough |
540 | 540 | return TRUE; |
541 | - } else if ( $from_db && method_exists( $class_name, 'new_instance_from_db' ) ) { |
|
541 | + } else if ($from_db && method_exists($class_name, 'new_instance_from_db')) { |
|
542 | 542 | // $instantiation_mode = 1; |
543 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance_from_db' ), $arguments ); |
|
544 | - } else if ( method_exists( $class_name, 'new_instance' ) ) { |
|
543 | + $class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments); |
|
544 | + } else if (method_exists($class_name, 'new_instance')) { |
|
545 | 545 | // $instantiation_mode = 2; |
546 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance' ), $arguments ); |
|
547 | - } else if ( method_exists( $class_name, 'instance' )) { |
|
546 | + $class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments); |
|
547 | + } else if (method_exists($class_name, 'instance')) { |
|
548 | 548 | // $instantiation_mode = 3; |
549 | - $class_obj = call_user_func_array( array( $class_name, 'instance' ), $arguments ); |
|
550 | - } else if ( $reflector->isInstantiable() ) { |
|
549 | + $class_obj = call_user_func_array(array($class_name, 'instance'), $arguments); |
|
550 | + } else if ($reflector->isInstantiable()) { |
|
551 | 551 | // $instantiation_mode = 4; |
552 | - $class_obj = $reflector->newInstance( $arguments ); |
|
553 | - } else if ( ! $load_only ) { |
|
552 | + $class_obj = $reflector->newInstance($arguments); |
|
553 | + } else if ( ! $load_only) { |
|
554 | 554 | // heh ? something's not right ! |
555 | 555 | // $instantiation_mode = 5; |
556 | 556 | throw new EE_Error( |
557 | 557 | sprintf( |
558 | - __('The %s file %s could not be instantiated.','event_espresso'), |
|
558 | + __('The %s file %s could not be instantiated.', 'event_espresso'), |
|
559 | 559 | $type, |
560 | 560 | $class_name |
561 | 561 | ) |
562 | 562 | ); |
563 | 563 | } |
564 | 564 | |
565 | - } catch ( EE_Error $e ) { |
|
565 | + } catch (EE_Error $e) { |
|
566 | 566 | $e->get_error(); |
567 | 567 | } |
568 | 568 | |
@@ -574,15 +574,15 @@ discard block |
||
574 | 574 | // EEH_Debug_Tools::printr( $class_obj, '$class_obj <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
575 | 575 | |
576 | 576 | |
577 | - if ( isset( $class_obj )) { |
|
577 | + if (isset($class_obj)) { |
|
578 | 578 | // return newly instantiated class |
579 | - if ( isset( $class_abbreviations[ $class_name ] )) { |
|
580 | - $this->$class_abbreviations[ $class_name ] = $class_obj; |
|
581 | - } else if ( EEH_Class_Tools::has_property( $this, $class_name )) { |
|
579 | + if (isset($class_abbreviations[$class_name])) { |
|
580 | + $this->$class_abbreviations[$class_name] = $class_obj; |
|
581 | + } else if (EEH_Class_Tools::has_property($this, $class_name)) { |
|
582 | 582 | $this->{$class_name} = $class_obj; |
583 | - } else if ( $class_prefix == 'addon' && $cache ) { |
|
583 | + } else if ($class_prefix == 'addon' && $cache) { |
|
584 | 584 | $this->addons->$class_name = $class_obj; |
585 | - } else if ( !$from_db && $cache ) { |
|
585 | + } else if ( ! $from_db && $cache) { |
|
586 | 586 | $this->LIB->$class_name = $class_obj; |
587 | 587 | } |
588 | 588 | return $class_obj; |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | * @param $a |
608 | 608 | * @param $b |
609 | 609 | */ |
610 | - final function __call($a,$b) {} |
|
610 | + final function __call($a, $b) {} |
|
611 | 611 | |
612 | 612 | |
613 | 613 | |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | * @param $a |
623 | 623 | * @param $b |
624 | 624 | */ |
625 | - final function __set($a,$b) {} |
|
625 | + final function __set($a, $b) {} |
|
626 | 626 | |
627 | 627 | |
628 | 628 | |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | * @param $a |
663 | 663 | * @param $b |
664 | 664 | */ |
665 | - final static function __callStatic($a,$b) {} |
|
665 | + final static function __callStatic($a, $b) {} |
|
666 | 666 | |
667 | 667 | /** |
668 | 668 | * Gets the addon by its name/slug (not classname. For that, just |
@@ -670,9 +670,9 @@ discard block |
||
670 | 670 | * @param string $name |
671 | 671 | * @return EE_Addon |
672 | 672 | */ |
673 | - public function get_addon_by_name( $name ){ |
|
674 | - foreach($this->addons as $addon){ |
|
675 | - if( $addon->name() == $name){ |
|
673 | + public function get_addon_by_name($name) { |
|
674 | + foreach ($this->addons as $addon) { |
|
675 | + if ($addon->name() == $name) { |
|
676 | 676 | return $addon; |
677 | 677 | } |
678 | 678 | } |
@@ -683,10 +683,10 @@ discard block |
||
683 | 683 | * |
684 | 684 | * @return EE_Addon[] where the KEYS are the addon's name() |
685 | 685 | */ |
686 | - public function get_addons_by_name(){ |
|
686 | + public function get_addons_by_name() { |
|
687 | 687 | $addons = array(); |
688 | - foreach($this->addons as $addon){ |
|
689 | - $addons[ $addon->name() ] = $addon; |
|
688 | + foreach ($this->addons as $addon) { |
|
689 | + $addons[$addon->name()] = $addon; |
|
690 | 690 | } |
691 | 691 | return $addons; |
692 | 692 | } |
@@ -701,14 +701,14 @@ discard block |
||
701 | 701 | * @return EEM_Base |
702 | 702 | * @throws EE_Error |
703 | 703 | */ |
704 | - public function reset_model( $model_name ){ |
|
705 | - $model = $this->load_model( $model_name ); |
|
706 | - $model_class_name = get_class( $model ); |
|
704 | + public function reset_model($model_name) { |
|
705 | + $model = $this->load_model($model_name); |
|
706 | + $model_class_name = get_class($model); |
|
707 | 707 | //get that model reset it and make sure we nuke the old reference to it |
708 | - if ( $model instanceof $model_class_name && is_callable( array( $model_class_name, 'reset' ))) { |
|
708 | + if ($model instanceof $model_class_name && is_callable(array($model_class_name, 'reset'))) { |
|
709 | 709 | $this->LIB->$model_class_name = $model::reset(); |
710 | - }else{ |
|
711 | - throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) ); |
|
710 | + } else { |
|
711 | + throw new EE_Error(sprintf(__('Model %s does not have a method "reset"', 'event_espresso'), $model_name)); |
|
712 | 712 | } |
713 | 713 | return $this->LIB->$model_class_name; |
714 | 714 | } |
@@ -724,15 +724,15 @@ discard block |
||
724 | 724 | * currently reinstantiate the singletons at the moment) |
725 | 725 | * @return EE_Registry |
726 | 726 | */ |
727 | - public static function reset( $hard = FALSE, $reinstantiate = TRUE ){ |
|
727 | + public static function reset($hard = FALSE, $reinstantiate = TRUE) { |
|
728 | 728 | $instance = self::instance(); |
729 | 729 | $instance->load_helper('Activation'); |
730 | 730 | EEH_Activation::reset(); |
731 | - $instance->CFG = EE_Config::reset( $hard, $reinstantiate ); |
|
731 | + $instance->CFG = EE_Config::reset($hard, $reinstantiate); |
|
732 | 732 | $instance->LIB->EE_Data_Migration_Manager = EE_Data_Migration_Manager::reset(); |
733 | 733 | $instance->LIB = new stdClass(); |
734 | - foreach( array_keys( $instance->non_abstract_db_models ) as $model_name ){ |
|
735 | - $instance->reset_model( $model_name ); |
|
734 | + foreach (array_keys($instance->non_abstract_db_models) as $model_name) { |
|
735 | + $instance->reset_model($model_name); |
|
736 | 736 | } |
737 | 737 | return $instance; |
738 | 738 | } |
@@ -743,9 +743,9 @@ discard block |
||
743 | 743 | */ |
744 | 744 | public function cpt_models() { |
745 | 745 | $cpt_models = array(); |
746 | - foreach( $this->non_abstract_db_models as $shortname => $classname ) { |
|
747 | - if( is_subclass_of( $classname, 'EEM_CPT_Base' ) ) { |
|
748 | - $cpt_models[ $shortname ] = $classname; |
|
746 | + foreach ($this->non_abstract_db_models as $shortname => $classname) { |
|
747 | + if (is_subclass_of($classname, 'EEM_CPT_Base')) { |
|
748 | + $cpt_models[$shortname] = $classname; |
|
749 | 749 | } |
750 | 750 | } |
751 | 751 | return $cpt_models; |
@@ -11,25 +11,25 @@ discard block |
||
11 | 11 | final class EE_Registry { |
12 | 12 | |
13 | 13 | /** |
14 | - * EE_Registry Object |
|
15 | - * @var EE_Registry $_instance |
|
16 | - * @access private |
|
17 | - */ |
|
14 | + * EE_Registry Object |
|
15 | + * @var EE_Registry $_instance |
|
16 | + * @access private |
|
17 | + */ |
|
18 | 18 | private static $_instance = NULL; |
19 | 19 | |
20 | 20 | |
21 | 21 | /** |
22 | - * EE_Cart Object |
|
23 | - * @access public |
|
24 | - * @var EE_Cart $CART |
|
25 | - */ |
|
22 | + * EE_Cart Object |
|
23 | + * @access public |
|
24 | + * @var EE_Cart $CART |
|
25 | + */ |
|
26 | 26 | public $CART = NULL; |
27 | 27 | |
28 | 28 | /** |
29 | - * EE_Config Object |
|
30 | - * @access public |
|
31 | - * @var EE_Config $CFG |
|
32 | - */ |
|
29 | + * EE_Config Object |
|
30 | + * @access public |
|
31 | + * @var EE_Config $CFG |
|
32 | + */ |
|
33 | 33 | public $CFG = NULL; |
34 | 34 | |
35 | 35 | |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | |
45 | 45 | |
46 | 46 | /** |
47 | - * StdClass object for storing library classes in |
|
48 | - * @public LIB |
|
49 | - */ |
|
47 | + * StdClass object for storing library classes in |
|
48 | + * @public LIB |
|
49 | + */ |
|
50 | 50 | public $LIB = NULL; |
51 | 51 | |
52 | 52 | /** |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | public $REQ = NULL; |
58 | 58 | |
59 | 59 | /** |
60 | - * EE_Session Object |
|
61 | - * @access public |
|
62 | - * @var EE_Session $SSN |
|
63 | - */ |
|
60 | + * EE_Session Object |
|
61 | + * @access public |
|
62 | + * @var EE_Session $SSN |
|
63 | + */ |
|
64 | 64 | public $SSN = NULL; |
65 | 65 | |
66 | 66 | |
@@ -127,21 +127,21 @@ discard block |
||
127 | 127 | |
128 | 128 | |
129 | 129 | /** |
130 | - * $i18n_js_strings - internationalization for JS strings |
|
131 | - * usage: EE_Registry::i18n_js_strings['string_key'] = __( 'string to translate.', 'event_espresso' ); |
|
132 | - * in js file: var translatedString = eei18n.string_key; |
|
133 | - * |
|
134 | - * @access public |
|
135 | - * @var array |
|
136 | - */ |
|
130 | + * $i18n_js_strings - internationalization for JS strings |
|
131 | + * usage: EE_Registry::i18n_js_strings['string_key'] = __( 'string to translate.', 'event_espresso' ); |
|
132 | + * in js file: var translatedString = eei18n.string_key; |
|
133 | + * |
|
134 | + * @access public |
|
135 | + * @var array |
|
136 | + */ |
|
137 | 137 | public static $i18n_js_strings = array(); |
138 | 138 | |
139 | 139 | /** |
140 | - * $main_file - path to espresso.php |
|
141 | - * |
|
142 | - * @access public |
|
143 | - * @var array |
|
144 | - */ |
|
140 | + * $main_file - path to espresso.php |
|
141 | + * |
|
142 | + * @access public |
|
143 | + * @var array |
|
144 | + */ |
|
145 | 145 | public $main_file; |
146 | 146 | |
147 | 147 |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param object $post The post object of the cpt that was saved. |
114 | 114 | * @return void |
115 | 115 | */ |
116 | - abstract protected function _insert_update_cpt_item( $post_id, $post ); |
|
116 | + abstract protected function _insert_update_cpt_item($post_id, $post); |
|
117 | 117 | |
118 | 118 | |
119 | 119 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param string $post_id The ID of the cpt that was trashed |
127 | 127 | * @return void |
128 | 128 | */ |
129 | - abstract public function trash_cpt_item( $post_id ); |
|
129 | + abstract public function trash_cpt_item($post_id); |
|
130 | 130 | |
131 | 131 | |
132 | 132 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param string $post_id theID of the cpt that was untrashed |
138 | 138 | * @return void |
139 | 139 | */ |
140 | - abstract public function restore_cpt_item( $post_id ); |
|
140 | + abstract public function restore_cpt_item($post_id); |
|
141 | 141 | |
142 | 142 | |
143 | 143 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param string $post_id the ID of the cpt that was deleted |
149 | 149 | * @return void |
150 | 150 | */ |
151 | - abstract public function delete_cpt_item( $post_id ); |
|
151 | + abstract public function delete_cpt_item($post_id); |
|
152 | 152 | |
153 | 153 | |
154 | 154 | |
@@ -161,32 +161,32 @@ discard block |
||
161 | 161 | */ |
162 | 162 | protected function _before_page_setup() { |
163 | 163 | |
164 | - $page = isset( $this->_req_data['page'] ) ? $this->_req_data['page'] : $this->page_slug; |
|
164 | + $page = isset($this->_req_data['page']) ? $this->_req_data['page'] : $this->page_slug; |
|
165 | 165 | |
166 | - $this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes ); |
|
166 | + $this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes); |
|
167 | 167 | |
168 | 168 | //let's see if the current route has a value for cpt_object_slug if it does we use that instead of the page |
169 | - $this->_cpt_object = isset($this->_req_data['action']) && isset( $this->_cpt_routes[$this->_req_data['action']] ) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object( $page ); |
|
169 | + $this->_cpt_object = isset($this->_req_data['action']) && isset($this->_cpt_routes[$this->_req_data['action']]) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object($page); |
|
170 | 170 | |
171 | 171 | //tweak pagenow for page loading. |
172 | - if( ! $this->_pagenow_map ) { |
|
172 | + if ( ! $this->_pagenow_map) { |
|
173 | 173 | $this->_pagenow_map = array( |
174 | 174 | 'create_new' => 'post-new.php', |
175 | 175 | 'edit' => 'post.php', |
176 | 176 | 'trash' => 'post.php' |
177 | 177 | ); |
178 | 178 | } |
179 | - add_action( 'current_screen', array( $this, 'modify_pagenow') ); |
|
179 | + add_action('current_screen', array($this, 'modify_pagenow')); |
|
180 | 180 | |
181 | 181 | |
182 | 182 | //TODO the below will need to be reworked to account for the cpt routes that are NOT based off of page but action param. |
183 | 183 | //get current page from autosave |
184 | - $current_page = isset( $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] ) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL; |
|
185 | - $this->_current_page = isset( $this->_req_data['current_page'] ) ? $this->_req_data['current_page'] : $current_page; |
|
184 | + $current_page = isset($this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page']) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL; |
|
185 | + $this->_current_page = isset($this->_req_data['current_page']) ? $this->_req_data['current_page'] : $current_page; |
|
186 | 186 | |
187 | 187 | |
188 | 188 | //autosave... make sure its only for the correct page |
189 | - if ( !empty($this->_current_page ) && $this->_current_page == $this->page_slug ) { |
|
189 | + if ( ! empty($this->_current_page) && $this->_current_page == $this->page_slug) { |
|
190 | 190 | //setup autosave ajax hook |
191 | 191 | //add_action('wp_ajax_ee-autosave', array( $this, 'do_extra_autosave_stuff' ), 10 ); //TODO reactivate when 4.2 autosave is implemented |
192 | 192 | } |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return void |
204 | 204 | */ |
205 | - public function modify_pagenow( $current_screen ) { |
|
205 | + public function modify_pagenow($current_screen) { |
|
206 | 206 | global $pagenow; |
207 | 207 | //possibly reset pagenow. |
208 | - if ( ! empty( $this->_req_data['page'] ) && $this->_req_data['page'] == $this->page_slug && !empty( $this->_req_data['action'] ) && isset( $this->_pagenow_map[$this->_req_data['action'] ] ) ) { |
|
208 | + if ( ! empty($this->_req_data['page']) && $this->_req_data['page'] == $this->page_slug && ! empty($this->_req_data['action']) && isset($this->_pagenow_map[$this->_req_data['action']])) { |
|
209 | 209 | $pagenow = $this->_pagenow_map[$this->_req_data['action']]; |
210 | 210 | } |
211 | 211 | } |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | * @param array $ids an array of ids for containers that hold form inputs we want autosave to pickup. Typically you would send along the id of a metabox container. |
221 | 221 | * @return void |
222 | 222 | */ |
223 | - protected function _register_autosave_containers( $ids ) { |
|
224 | - $this->_autosave_containers = array_merge( $this->_autosave_fields, (array) $ids ); |
|
223 | + protected function _register_autosave_containers($ids) { |
|
224 | + $this->_autosave_containers = array_merge($this->_autosave_fields, (array) $ids); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | |
@@ -236,22 +236,22 @@ discard block |
||
236 | 236 | |
237 | 237 | $containers = array(); |
238 | 238 | |
239 | - if ( empty( $wp_meta_boxes ) ) |
|
239 | + if (empty($wp_meta_boxes)) |
|
240 | 240 | return; |
241 | 241 | |
242 | - $current_metaboxes = isset( $wp_meta_boxes[$this->page_slug] ) ? $wp_meta_boxes[$this->page_slug] : array(); |
|
242 | + $current_metaboxes = isset($wp_meta_boxes[$this->page_slug]) ? $wp_meta_boxes[$this->page_slug] : array(); |
|
243 | 243 | |
244 | - foreach ( $current_metaboxes as $box_context ) { |
|
245 | - foreach ( $box_context as $box_details ) { |
|
246 | - foreach ( $box_details as $box ) { |
|
247 | - if ( is_array( $box['callback'] ) && ( $box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks ) ){ |
|
244 | + foreach ($current_metaboxes as $box_context) { |
|
245 | + foreach ($box_context as $box_details) { |
|
246 | + foreach ($box_details as $box) { |
|
247 | + if (is_array($box['callback']) && ($box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks)) { |
|
248 | 248 | $containers[] = $box['id']; |
249 | 249 | } |
250 | 250 | } |
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
254 | - $this->_autosave_containers = array_merge( $this->_autosave_containers, $containers ); |
|
254 | + $this->_autosave_containers = array_merge($this->_autosave_containers, $containers); |
|
255 | 255 | |
256 | 256 | //add hidden inputs container |
257 | 257 | $this->_autosave_containers[] = 'ee-cpt-hidden-inputs'; |
@@ -268,13 +268,13 @@ discard block |
||
268 | 268 | wp_enqueue_script('cpt-autosave');/**/ //todo re-enable when we start doing autosave again in 4.2 |
269 | 269 | |
270 | 270 | //filter _autosave_containers |
271 | - $containers = apply_filters( 'FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this ); |
|
272 | - $containers = apply_filters( 'FHEE__EE_Admin_Page_CPT__' . get_class($this) . '___load_autosave_scripts_styles__containers', $containers, $this ); |
|
271 | + $containers = apply_filters('FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this); |
|
272 | + $containers = apply_filters('FHEE__EE_Admin_Page_CPT__'.get_class($this).'___load_autosave_scripts_styles__containers', $containers, $this); |
|
273 | 273 | |
274 | - wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers ); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave" |
|
274 | + wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave" |
|
275 | 275 | |
276 | 276 | $unsaved_data_msg = array( |
277 | - 'eventmsg' => sprintf( __("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
277 | + 'eventmsg' => sprintf(__("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
278 | 278 | 'inputChanged' => 0 |
279 | 279 | ); |
280 | 280 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | public function load_page_dependencies() { |
287 | 287 | try { |
288 | 288 | $this->_load_page_dependencies(); |
289 | - } catch ( EE_Error $e ) { |
|
289 | + } catch (EE_Error $e) { |
|
290 | 290 | $e->get_error(); |
291 | 291 | } |
292 | 292 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | protected function _load_page_dependencies() { |
303 | 303 | |
304 | 304 | //we only add stuff if this is a cpt_route! |
305 | - if ( !$this->_cpt_route ) { |
|
305 | + if ( ! $this->_cpt_route) { |
|
306 | 306 | parent::_load_page_dependencies(); |
307 | 307 | return; |
308 | 308 | } |
@@ -312,72 +312,72 @@ discard block |
||
312 | 312 | |
313 | 313 | //the following filters are for setting all the redirects on DEFAULT WP custom post type actions |
314 | 314 | //let's add a hidden input to the post-edit form so we know when we have to trigger our custom redirects! Otherwise the redirects will happen on ALL post saves which wouldn't be good of course! |
315 | - add_action('edit_form_after_title', array( $this, 'cpt_post_form_hidden_input') ); |
|
315 | + add_action('edit_form_after_title', array($this, 'cpt_post_form_hidden_input')); |
|
316 | 316 | |
317 | 317 | //inject our Admin page nav tabs... |
318 | 318 | //let's make sure the nav tabs are set if they aren't already |
319 | 319 | //if ( empty( $this->_nav_tabs ) ) $this->_set_nav_tabs(); |
320 | - add_action('post_edit_form_tag', array( $this, 'inject_nav_tabs' ) ); |
|
320 | + add_action('post_edit_form_tag', array($this, 'inject_nav_tabs')); |
|
321 | 321 | |
322 | 322 | //modify the post_updated messages array |
323 | - add_action('post_updated_messages', array( $this, 'post_update_messages' ), 10 ); |
|
323 | + add_action('post_updated_messages', array($this, 'post_update_messages'), 10); |
|
324 | 324 | |
325 | 325 | //add shortlink button to cpt edit screens. We can do this as a universal thing BECAUSE, cpts use the same format for shortlinks as posts! |
326 | - add_filter( 'pre_get_shortlink', array( $this, 'add_shortlink_button_to_editor' ), 10, 4 ); |
|
326 | + add_filter('pre_get_shortlink', array($this, 'add_shortlink_button_to_editor'), 10, 4); |
|
327 | 327 | |
328 | 328 | //This basically allows us to change the title of the "publish" metabox area on CPT pages by setting a 'publishbox' value in the $_labels property array in the child class. |
329 | - if ( !empty($this->_labels['publishbox'] ) ) { |
|
329 | + if ( ! empty($this->_labels['publishbox'])) { |
|
330 | 330 | |
331 | - $box_label = is_array( $this->_labels['publishbox'] ) && isset( $this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
331 | + $box_label = is_array($this->_labels['publishbox']) && isset($this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
332 | 332 | |
333 | - remove_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
334 | - add_meta_box( 'submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
333 | + remove_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
334 | + add_meta_box('submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | //let's add page_templates metabox if this cpt added support for it. |
338 | - if ( $this->_supports_page_templates($this->_cpt_object->name) ) { |
|
339 | - add_meta_box( 'page_templates', __('Page Template', 'event_espresso' ), array( $this, 'page_template_meta_box' ), $this->_cpt_routes[$this->_req_action], 'side', 'default' ); |
|
338 | + if ($this->_supports_page_templates($this->_cpt_object->name)) { |
|
339 | + add_meta_box('page_templates', __('Page Template', 'event_espresso'), array($this, 'page_template_meta_box'), $this->_cpt_routes[$this->_req_action], 'side', 'default'); |
|
340 | 340 | }/**/ |
341 | 341 | |
342 | 342 | |
343 | 343 | //this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form |
344 | - if ( method_exists( $this, 'extra_permalink_field_buttons' ) ) |
|
345 | - add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 ); |
|
344 | + if (method_exists($this, 'extra_permalink_field_buttons')) |
|
345 | + add_filter('get_sample_permalink_html', array($this, 'extra_permalink_field_buttons'), 10, 4); |
|
346 | 346 | |
347 | 347 | //add preview button |
348 | - add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4 ); |
|
348 | + add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4); |
|
349 | 349 | |
350 | 350 | |
351 | 351 | //insert our own post_stati dropdown |
352 | - add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown' ), 10 ); |
|
352 | + add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown'), 10); |
|
353 | 353 | |
354 | 354 | //This allows adding additional information to the publish post submitbox on the wp post edit form |
355 | - if ( method_exists( $this, 'extra_misc_actions_publish_box' ) ) |
|
356 | - add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 ); |
|
355 | + if (method_exists($this, 'extra_misc_actions_publish_box')) |
|
356 | + add_action('post_submitbox_misc_actions', array($this, 'extra_misc_actions_publish_box'), 10); |
|
357 | 357 | |
358 | 358 | //This allows for adding additional stuff after the title field on the wp post edit form. This is also before the wp_editor for post description field. |
359 | - if ( method_exists( $this, 'edit_form_after_title' ) ) |
|
360 | - add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 ); |
|
359 | + if (method_exists($this, 'edit_form_after_title')) |
|
360 | + add_action('edit_form_after_title', array($this, 'edit_form_after_title'), 10); |
|
361 | 361 | |
362 | 362 | |
363 | 363 | /** |
364 | 364 | * Filtering WP's esc_url to capture urls pointing to core wp routes so they point to our route. |
365 | 365 | */ |
366 | - add_filter( 'clean_url', array( $this, 'switch_core_wp_urls_with_ours' ), 10, 3 ); |
|
366 | + add_filter('clean_url', array($this, 'switch_core_wp_urls_with_ours'), 10, 3); |
|
367 | 367 | |
368 | 368 | |
369 | 369 | parent::_load_page_dependencies(); |
370 | 370 | |
371 | 371 | //notice we are ALSO going to load the pagenow hook set for this route (see _before_page_setup for the reset of the pagenow global ). This is for any plugins that are doing things properly and hooking into the load page hook for core wp cpt routes. |
372 | 372 | global $pagenow; |
373 | - do_action( 'load-' . $pagenow ); |
|
373 | + do_action('load-'.$pagenow); |
|
374 | 374 | |
375 | 375 | $this->modify_current_screen(); |
376 | - add_action( 'admin_enqueue_scripts', array( $this, 'setup_autosave_hooks'), 30 ); |
|
376 | + add_action('admin_enqueue_scripts', array($this, 'setup_autosave_hooks'), 30); |
|
377 | 377 | //we route REALLY early. |
378 | 378 | try { |
379 | 379 | $this->_route_admin_request(); |
380 | - } catch ( EE_Error $e ) { |
|
380 | + } catch (EE_Error $e) { |
|
381 | 381 | $e->get_error(); |
382 | 382 | } |
383 | 383 | } |
@@ -396,21 +396,21 @@ discard block |
||
396 | 396 | * |
397 | 397 | * @return string possibly a new url for our route. |
398 | 398 | */ |
399 | - public function switch_core_wp_urls_with_ours( $good_protocol_url, $original_url, $_context ) { |
|
399 | + public function switch_core_wp_urls_with_ours($good_protocol_url, $original_url, $_context) { |
|
400 | 400 | $routes_to_match = array( |
401 | 401 | 0 => array( |
402 | 402 | 'edit.php?post_type=espresso_attendees', |
403 | 403 | 'admin.php?page=espresso_registrations&action=contact_list' |
404 | 404 | ), |
405 | 405 | 1 => array( |
406 | - 'edit.php?post_type=' . $this->_cpt_object->name, |
|
407 | - 'admin.php?page=' . $this->_cpt_object->name |
|
406 | + 'edit.php?post_type='.$this->_cpt_object->name, |
|
407 | + 'admin.php?page='.$this->_cpt_object->name |
|
408 | 408 | ) |
409 | 409 | ); |
410 | 410 | |
411 | - foreach( $routes_to_match as $route_matches ) { |
|
412 | - if ( strpos( $good_protocol_url, $route_matches[0] ) !== false ) { |
|
413 | - return str_replace( $route_matches[0], $route_matches[1], $good_protocol_url ); |
|
411 | + foreach ($routes_to_match as $route_matches) { |
|
412 | + if (strpos($good_protocol_url, $route_matches[0]) !== false) { |
|
413 | + return str_replace($route_matches[0], $route_matches[1], $good_protocol_url); |
|
414 | 414 | |
415 | 415 | } |
416 | 416 | } |
@@ -426,10 +426,10 @@ discard block |
||
426 | 426 | * @param string $cpt_name The cpt slug we're checking on. |
427 | 427 | * @return bool True supported, false not. |
428 | 428 | */ |
429 | - private function _supports_page_templates( $cpt_name ) { |
|
429 | + private function _supports_page_templates($cpt_name) { |
|
430 | 430 | $cpt_args = EE_Register_CPTs::get_CPTs(); |
431 | - $cpt_args = isset( $cpt_args[$cpt_name] ) ? $cpt_args[$cpt_name]['args'] : array(); |
|
432 | - return ! empty( $cpt_args['page_templates'] ) ? TRUE : FALSE; |
|
431 | + $cpt_args = isset($cpt_args[$cpt_name]) ? $cpt_args[$cpt_name]['args'] : array(); |
|
432 | + return ! empty($cpt_args['page_templates']) ? TRUE : FALSE; |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -444,9 +444,9 @@ discard block |
||
444 | 444 | public function page_template_meta_box() { |
445 | 445 | global $post; |
446 | 446 | $template = ''; |
447 | - if ( count( get_page_templates( $post ) ) != 0 ) { |
|
448 | - $page_template = get_post_meta( $post->ID, '_wp_page_template', TRUE ); |
|
449 | - $template = !empty( $page_template ) ? $page_template : ''; |
|
447 | + if (count(get_page_templates($post)) != 0) { |
|
448 | + $page_template = get_post_meta($post->ID, '_wp_page_template', TRUE); |
|
449 | + $template = ! empty($page_template) ? $page_template : ''; |
|
450 | 450 | } |
451 | 451 | ?> |
452 | 452 | <p><strong><?php _e('Template') ?></strong></p> |
@@ -470,10 +470,10 @@ discard block |
||
470 | 470 | * @param string $new_slug what the slug is |
471 | 471 | * @return string The new html string for the permalink area |
472 | 472 | */ |
473 | - public function preview_button_html( $return, $id, $new_title, $new_slug ) { |
|
474 | - $post = get_post( $id ); |
|
475 | - if ( 'publish' != get_post_status( $post ) ) { |
|
476 | - $return .= '<span_id="view-post-btn"><a href="' . wp_get_shortlink($id, 'post') . '" class="button button-small">' . __('Preview', 'event_espresso') . '</a></span>' . "\n"; |
|
473 | + public function preview_button_html($return, $id, $new_title, $new_slug) { |
|
474 | + $post = get_post($id); |
|
475 | + if ('publish' != get_post_status($post)) { |
|
476 | + $return .= '<span_id="view-post-btn"><a href="'.wp_get_shortlink($id, 'post').'" class="button button-small">'.__('Preview', 'event_espresso').'</a></span>'."\n"; |
|
477 | 477 | } |
478 | 478 | return $return; |
479 | 479 | } |
@@ -493,18 +493,18 @@ discard block |
||
493 | 493 | 'cur_status' => $this->_cpt_model_obj->status(), |
494 | 494 | 'statuses' => $statuses, |
495 | 495 | 'cur_status_label' => $cur_status_label, |
496 | - 'localized_status_save' => sprintf( __('Save %s', 'event_espresso'), $cur_status_label ) |
|
496 | + 'localized_status_save' => sprintf(__('Save %s', 'event_espresso'), $cur_status_label) |
|
497 | 497 | ); |
498 | 498 | |
499 | 499 | //we'll add a trash post status (WP doesn't add one for some reason) |
500 | - if ( $this->_cpt_model_obj->status() == 'trash' ) { |
|
500 | + if ($this->_cpt_model_obj->status() == 'trash') { |
|
501 | 501 | $template_args['cur_status_label'] = __('Trashed', 'event_espresso'); |
502 | 502 | $statuses['trash'] = __('Trashed', 'event_espresso'); |
503 | 503 | $template_args['statuses'] = $statuses; |
504 | 504 | } |
505 | 505 | |
506 | - $template = EE_ADMIN_TEMPLATE . 'status_dropdown.template.php'; |
|
507 | - EEH_Template::display_template( $template, $template_args ); |
|
506 | + $template = EE_ADMIN_TEMPLATE.'status_dropdown.template.php'; |
|
507 | + EEH_Template::display_template($template, $template_args); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -543,22 +543,22 @@ discard block |
||
543 | 543 | public function do_extra_autosave_stuff() { |
544 | 544 | |
545 | 545 | //next let's check for the autosave nonce (we'll use _verify_nonce ) |
546 | - $nonce = isset( $this->_req_data['autosavenonce'] ) ? $this->_req_data['autosavenonce'] : NULL; |
|
547 | - $this->_verify_nonce( $nonce, 'autosave' ); |
|
546 | + $nonce = isset($this->_req_data['autosavenonce']) ? $this->_req_data['autosavenonce'] : NULL; |
|
547 | + $this->_verify_nonce($nonce, 'autosave'); |
|
548 | 548 | |
549 | 549 | |
550 | 550 | //make sure we define doing autosave (cause WP isn't triggering this we want to make sure we define it) |
551 | - if ( !defined('DOING_AUTOSAVE') ) define('DOING_AUTOSAVE', true); |
|
551 | + if ( ! defined('DOING_AUTOSAVE')) define('DOING_AUTOSAVE', true); |
|
552 | 552 | |
553 | 553 | //if we made it here then the nonce checked out. Let's run our methods and actions |
554 | - if ( method_exists( $this, '_ee_autosave_' . $this->_current_view ) ) { |
|
555 | - call_user_func( array( $this, '_ee_autosave_' . $this->_current_view ) ); |
|
554 | + if (method_exists($this, '_ee_autosave_'.$this->_current_view)) { |
|
555 | + call_user_func(array($this, '_ee_autosave_'.$this->_current_view)); |
|
556 | 556 | } else { |
557 | 557 | $this->_template_args['success'] = TRUE; |
558 | 558 | } |
559 | 559 | |
560 | - do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this ); |
|
561 | - do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_' . get_class( $this ), $this ); |
|
560 | + do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this); |
|
561 | + do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_'.get_class($this), $this); |
|
562 | 562 | |
563 | 563 | //now let's return json |
564 | 564 | $this->_return_json(); |
@@ -578,18 +578,18 @@ discard block |
||
578 | 578 | protected function _extend_page_config_for_cpt() { |
579 | 579 | |
580 | 580 | //before doing anything we need to make sure this runs ONLY when the loaded page matches the set page_slug |
581 | - if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) ) |
|
581 | + if ((isset($this->_req_data['page']) && $this->_req_data['page'] != $this->page_slug)) |
|
582 | 582 | return; |
583 | 583 | |
584 | 584 | //set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes |
585 | - if ( !empty( $this->_cpt_object ) ) { |
|
586 | - $this->_page_routes = array_merge( array( |
|
585 | + if ( ! empty($this->_cpt_object)) { |
|
586 | + $this->_page_routes = array_merge(array( |
|
587 | 587 | 'create_new' => '_create_new_cpt_item', |
588 | 588 | 'edit' => '_edit_cpt_item' |
589 | - ), $this->_page_routes ); |
|
589 | + ), $this->_page_routes); |
|
590 | 590 | |
591 | 591 | |
592 | - $this->_page_config = array_merge( array( |
|
592 | + $this->_page_config = array_merge(array( |
|
593 | 593 | 'create_new' => array( |
594 | 594 | 'nav' => array( |
595 | 595 | 'label' => $this->_cpt_object->labels->add_new_item, |
@@ -611,23 +611,23 @@ discard block |
||
611 | 611 | } |
612 | 612 | |
613 | 613 | //load the next section only if this is a matching cpt route as set in the cpt routes array. |
614 | - if ( !isset( $this->_cpt_routes[$this->_req_action] ) ) |
|
614 | + if ( ! isset($this->_cpt_routes[$this->_req_action])) |
|
615 | 615 | return; |
616 | 616 | |
617 | 617 | |
618 | - $this->_cpt_route = isset( $this->_cpt_routes[$this->_req_action] ) ? TRUE : FALSE; |
|
618 | + $this->_cpt_route = isset($this->_cpt_routes[$this->_req_action]) ? TRUE : FALSE; |
|
619 | 619 | //add_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', array( $this, 'modify_current_screen') ); |
620 | 620 | |
621 | 621 | |
622 | - if ( empty( $this->_cpt_object ) ) { |
|
623 | - $msg = sprintf( __('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this: 1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this) ); |
|
624 | - throw new EE_Error( $msg ); |
|
622 | + if (empty($this->_cpt_object)) { |
|
623 | + $msg = sprintf(__('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this: 1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this)); |
|
624 | + throw new EE_Error($msg); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | |
628 | - if ( $this->_cpt_route ) { |
|
629 | - $id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL; |
|
630 | - $this->_set_model_object( $id ); |
|
628 | + if ($this->_cpt_route) { |
|
629 | + $id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL; |
|
630 | + $this->_set_model_object($id); |
|
631 | 631 | } |
632 | 632 | |
633 | 633 | } |
@@ -643,17 +643,17 @@ discard block |
||
643 | 643 | * @param int $id The id to retrieve the model object for. If empty we set a default object. |
644 | 644 | * @return void |
645 | 645 | */ |
646 | - protected function _set_model_object( $id = NULL ) { |
|
646 | + protected function _set_model_object($id = NULL) { |
|
647 | 647 | |
648 | - if ( empty( $this->_cpt_model_names ) || ! isset( $this->_cpt_routes[ $this->_req_action ] ) || ( is_object( $this->_cpt_model_obj ) && $this->_cpt_model_obj->ID() == $id )) { |
|
648 | + if (empty($this->_cpt_model_names) || ! isset($this->_cpt_routes[$this->_req_action]) || (is_object($this->_cpt_model_obj) && $this->_cpt_model_obj->ID() == $id)) { |
|
649 | 649 | //get out cuz we either don't have a model name OR the object has already been set and it has the same id as what has been sent. |
650 | 650 | return; |
651 | 651 | } |
652 | 652 | // load CPT object model |
653 | - $model = EE_Registry::instance()->load_model( $this->_cpt_model_names[$this->_req_action] ); |
|
654 | - $this->_cpt_model_obj = ! empty( $id ) ? $model->get_one_by_ID( $id ) : $model->create_default_object(); |
|
653 | + $model = EE_Registry::instance()->load_model($this->_cpt_model_names[$this->_req_action]); |
|
654 | + $this->_cpt_model_obj = ! empty($id) ? $model->get_one_by_ID($id) : $model->create_default_object(); |
|
655 | 655 | //d( $this->_cpt_model_obj ); |
656 | - do_action( 'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object' ); |
|
656 | + do_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object'); |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | |
@@ -667,47 +667,47 @@ discard block |
||
667 | 667 | */ |
668 | 668 | public function admin_init_global() { |
669 | 669 | |
670 | - $post = isset( $this->_req_data['post'] ) ? get_post( $this->_req_data['post'] ) : NULL; |
|
670 | + $post = isset($this->_req_data['post']) ? get_post($this->_req_data['post']) : NULL; |
|
671 | 671 | |
672 | 672 | //its possible this is a new save so let's catch that instead |
673 | - $post = isset( $this->_req_data['post_ID'] ) ? get_post( $this->_req_data['post_ID'] ) : $post; |
|
673 | + $post = isset($this->_req_data['post_ID']) ? get_post($this->_req_data['post_ID']) : $post; |
|
674 | 674 | $post_type = $post ? $post->post_type : false; |
675 | 675 | |
676 | 676 | $current_route = isset($this->_req_data['current_route']) ? $this->_req_data['current_route'] : 'shouldneverwork'; |
677 | 677 | |
678 | - $route_to_check = $post_type && isset( $this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : ''; |
|
678 | + $route_to_check = $post_type && isset($this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : ''; |
|
679 | 679 | |
680 | - add_filter( 'get_delete_post_link', array( $this, 'modify_delete_post_link'), 10, 3 ); |
|
681 | - add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link'), 10, 3 ); |
|
680 | + add_filter('get_delete_post_link', array($this, 'modify_delete_post_link'), 10, 3); |
|
681 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3); |
|
682 | 682 | |
683 | 683 | |
684 | - if ( $post_type === $route_to_check ) { |
|
685 | - add_filter('redirect_post_location', array( $this, 'cpt_post_location_redirect'), 10, 2 ); |
|
684 | + if ($post_type === $route_to_check) { |
|
685 | + add_filter('redirect_post_location', array($this, 'cpt_post_location_redirect'), 10, 2); |
|
686 | 686 | //catch trashed wp redirect |
687 | - add_filter('wp_redirect', array( $this, 'cpt_trash_post_location_redirect' ), 10, 2 ); |
|
687 | + add_filter('wp_redirect', array($this, 'cpt_trash_post_location_redirect'), 10, 2); |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | //now let's filter redirect if we're on a revision page and the revision is for an event CPT. |
691 | - $revision = isset( $this->_req_data['revision'] ) ? $this->_req_data['revision'] : NULL; |
|
691 | + $revision = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL; |
|
692 | 692 | |
693 | 693 | /**var_dump($this->_req_data); |
694 | 694 | exit();/**/ |
695 | 695 | |
696 | - if ( !empty( $revision ) ) { |
|
697 | - $action = isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : NULL; |
|
696 | + if ( ! empty($revision)) { |
|
697 | + $action = isset($this->_req_data['action']) ? $this->_req_data['action'] : NULL; |
|
698 | 698 | |
699 | 699 | //doing a restore? |
700 | - if ( !empty( $action ) && $action == 'restore' ) { |
|
700 | + if ( ! empty($action) && $action == 'restore') { |
|
701 | 701 | |
702 | 702 | //get post for revision |
703 | - $rev_post = get_post( $revision ); |
|
704 | - $rev_parent = get_post( $rev_post->post_parent ); |
|
703 | + $rev_post = get_post($revision); |
|
704 | + $rev_parent = get_post($rev_post->post_parent); |
|
705 | 705 | |
706 | 706 | //only do our redirect filter AND our restore revision action if the post_type for the parent is one of our cpts. |
707 | - if ( $rev_parent && $rev_parent->post_type == $this->page_slug ) { |
|
708 | - add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2 ); |
|
707 | + if ($rev_parent && $rev_parent->post_type == $this->page_slug) { |
|
708 | + add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2); |
|
709 | 709 | //restores of revisions |
710 | - add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2 ); |
|
710 | + add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2); |
|
711 | 711 | } |
712 | 712 | } |
713 | 713 | |
@@ -716,15 +716,15 @@ discard block |
||
716 | 716 | //NOTE we ONLY want to run these hooks if we're on the right class for the given post type. Otherwise we could see some really freaky things happen! |
717 | 717 | |
718 | 718 | |
719 | - if ( $post_type && $post_type === $route_to_check ) { |
|
719 | + if ($post_type && $post_type === $route_to_check) { |
|
720 | 720 | //$post_id, $post |
721 | - add_action('save_post', array( $this, 'insert_update'), 10, 2 ); |
|
721 | + add_action('save_post', array($this, 'insert_update'), 10, 2); |
|
722 | 722 | |
723 | 723 | //$post_id |
724 | - add_action('trashed_post', array( $this, 'trash_cpt_item' ), 10 ); |
|
725 | - add_action('trashed_post', array( $this, 'dont_permanently_delete_ee_cpts'), 10 ); |
|
726 | - add_action('untrashed_post', array( $this, 'restore_cpt_item'), 10 ); |
|
727 | - add_action('after_delete_post', array( $this, 'delete_cpt_item'), 10 ); |
|
724 | + add_action('trashed_post', array($this, 'trash_cpt_item'), 10); |
|
725 | + add_action('trashed_post', array($this, 'dont_permanently_delete_ee_cpts'), 10); |
|
726 | + add_action('untrashed_post', array($this, 'restore_cpt_item'), 10); |
|
727 | + add_action('after_delete_post', array($this, 'delete_cpt_item'), 10); |
|
728 | 728 | } |
729 | 729 | |
730 | 730 | } |
@@ -739,15 +739,15 @@ discard block |
||
739 | 739 | * @return void |
740 | 740 | */ |
741 | 741 | public function verify_cpt_object() { |
742 | - $label = !empty( $this->_cpt_object ) ? $this->_cpt_object->labels->singular_name : $this->page_label; |
|
742 | + $label = ! empty($this->_cpt_object) ? $this->_cpt_object->labels->singular_name : $this->page_label; |
|
743 | 743 | // verify event object |
744 | - if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base ) { |
|
745 | - throw new EE_Error( sprintf( __('Something has gone wrong with the page load because we are unable to set up the object for the %1$s. This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso' ), $label ) ); |
|
744 | + if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) { |
|
745 | + throw new EE_Error(sprintf(__('Something has gone wrong with the page load because we are unable to set up the object for the %1$s. This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso'), $label)); |
|
746 | 746 | } |
747 | 747 | //if auto-draft then throw an error |
748 | - if ( $this->_cpt_model_obj->get('status') == 'auto-draft' ) { |
|
748 | + if ($this->_cpt_model_obj->get('status') == 'auto-draft') { |
|
749 | 749 | EE_Error::overwrite_errors(); |
750 | - EE_Error::add_error( sprintf( __('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly. All autodrafts will show up in the "draft" view of your event list table. You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label ), __FILE__, __FUNCTION__, __LINE__ ); |
|
750 | + EE_Error::add_error(sprintf(__('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly. All autodrafts will show up in the "draft" view of your event list table. You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label), __FILE__, __FUNCTION__, __LINE__); |
|
751 | 751 | } |
752 | 752 | } |
753 | 753 | |
@@ -776,22 +776,22 @@ discard block |
||
776 | 776 | public function load_global_scripts_styles() { |
777 | 777 | parent::load_global_scripts_styles(); |
778 | 778 | |
779 | - if ( $this->_cpt_model_obj instanceof EE_CPT_Base ) { |
|
779 | + if ($this->_cpt_model_obj instanceof EE_CPT_Base) { |
|
780 | 780 | //setup custom post status object for localize script but only if we've got a cpt object |
781 | 781 | $statuses = $this->_cpt_model_obj->get_custom_post_statuses(); |
782 | 782 | |
783 | - if ( !empty($statuses) ) { |
|
783 | + if ( ! empty($statuses)) { |
|
784 | 784 | //get ALL statuses! |
785 | 785 | $statuses = $this->_cpt_model_obj->get_all_post_statuses(); |
786 | 786 | //setup object |
787 | 787 | $ee_cpt_statuses = array(); |
788 | - foreach ( $statuses as $status => $label ) { |
|
788 | + foreach ($statuses as $status => $label) { |
|
789 | 789 | $ee_cpt_statuses[$status] = array( |
790 | 790 | 'label' => $label, |
791 | - 'save_label' => sprintf( __('Save as %s', 'event_espresso'), $label ) |
|
791 | + 'save_label' => sprintf(__('Save as %s', 'event_espresso'), $label) |
|
792 | 792 | ); |
793 | 793 | } |
794 | - wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses ); |
|
794 | + wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses); |
|
795 | 795 | } |
796 | 796 | } |
797 | 797 | } |
@@ -805,10 +805,10 @@ discard block |
||
805 | 805 | * @param WP_Post $post Post object from WP |
806 | 806 | * @return void |
807 | 807 | */ |
808 | - public function insert_update( $post_id, $post ) { |
|
808 | + public function insert_update($post_id, $post) { |
|
809 | 809 | |
810 | 810 | //make sure that if this is a revision OR trash action that we don't do any updates! |
811 | - if ( isset( $this->_req_data['action'] ) && ( $this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash' ) ) |
|
811 | + if (isset($this->_req_data['action']) && ($this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash')) |
|
812 | 812 | return; |
813 | 813 | |
814 | 814 | //check for autosave and update our req_data property accordingly. |
@@ -823,19 +823,19 @@ discard block |
||
823 | 823 | }/**/ //TODO reactivate after autosave is implemented in 4.2 |
824 | 824 | |
825 | 825 | //take care of updating any selected page_template IF this cpt supports it. |
826 | - if ( $this->_supports_page_templates($post->post_type ) && !empty( $this->_req_data['page_template'] ) ) { |
|
826 | + if ($this->_supports_page_templates($post->post_type) && ! empty($this->_req_data['page_template'])) { |
|
827 | 827 | $post->page_template = $this->_req_data['page_template']; |
828 | - $page_templates = wp_get_theme()->get_page_templates( $post ); |
|
829 | - if ( 'default' != $this->_req_data['page_template'] && ! isset( $page_templates[ $this->_req_data['page_template'] ] ) ) { |
|
830 | - EE_Error::add_error( __('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
828 | + $page_templates = wp_get_theme()->get_page_templates($post); |
|
829 | + if ('default' != $this->_req_data['page_template'] && ! isset($page_templates[$this->_req_data['page_template']])) { |
|
830 | + EE_Error::add_error(__('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
831 | 831 | } else { |
832 | - update_post_meta( $post_id, '_wp_page_template', $this->_req_data['page_template'] ); |
|
832 | + update_post_meta($post_id, '_wp_page_template', $this->_req_data['page_template']); |
|
833 | 833 | } |
834 | 834 | } |
835 | 835 | |
836 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) |
|
836 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) |
|
837 | 837 | return; //TODO we'll remove this after reimplementing autosave in 4.2 |
838 | - $this->_insert_update_cpt_item( $post_id, $post ); |
|
838 | + $this->_insert_update_cpt_item($post_id, $post); |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | |
@@ -848,8 +848,8 @@ discard block |
||
848 | 848 | * @param int $post_id ID of the post |
849 | 849 | * @return void |
850 | 850 | */ |
851 | - public function dont_permanently_delete_ee_cpts( $post_id ) { |
|
852 | - delete_post_meta( $post_id, '_wp_trash_meta_status' ); |
|
851 | + public function dont_permanently_delete_ee_cpts($post_id) { |
|
852 | + delete_post_meta($post_id, '_wp_trash_meta_status'); |
|
853 | 853 | delete_post_meta($post_id, '_wp_trash_meta_time'); |
854 | 854 | |
855 | 855 | //our cpts may have comments so let's take care of that too |
@@ -868,14 +868,14 @@ discard block |
||
868 | 868 | * @param int $revision_id ID of revision being restored |
869 | 869 | * @return void |
870 | 870 | */ |
871 | - public function restore_revision( $post_id, $revision_id ) { |
|
872 | - $this->_restore_cpt_item( $post_id, $revision_id ); |
|
871 | + public function restore_revision($post_id, $revision_id) { |
|
872 | + $this->_restore_cpt_item($post_id, $revision_id); |
|
873 | 873 | |
874 | 874 | //global action |
875 | - do_action( 'AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id); |
|
875 | + do_action('AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id); |
|
876 | 876 | |
877 | 877 | //class specific action so you can limit hooking into a specific page. |
878 | - do_action( 'AHEE_EE_Admin_Page_CPT_' . get_class($this) . '__restore_revision', $post_id, $revision_id ); |
|
878 | + do_action('AHEE_EE_Admin_Page_CPT_'.get_class($this).'__restore_revision', $post_id, $revision_id); |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | * @param int $revision_id ID of revision for item |
887 | 887 | * @return void |
888 | 888 | */ |
889 | - abstract protected function _restore_cpt_item( $post_id, $revision_id ); |
|
889 | + abstract protected function _restore_cpt_item($post_id, $revision_id); |
|
890 | 890 | |
891 | 891 | |
892 | 892 | |
@@ -905,9 +905,9 @@ discard block |
||
905 | 905 | */ |
906 | 906 | public function modify_current_screen() { |
907 | 907 | //ONLY do this if the current page_route IS a cpt route |
908 | - if ( !$this->_cpt_route ) return; |
|
908 | + if ( ! $this->_cpt_route) return; |
|
909 | 909 | //routing things REALLY early b/c this is a cpt admin page |
910 | - set_current_screen( $this->_cpt_routes[$this->_req_action]); |
|
910 | + set_current_screen($this->_cpt_routes[$this->_req_action]); |
|
911 | 911 | $this->_current_screen = get_current_screen(); |
912 | 912 | $this->_current_screen->base = 'event-espresso'; |
913 | 913 | $this->_add_help_tabs(); //we make sure we add any help tabs back in! |
@@ -928,8 +928,8 @@ discard block |
||
928 | 928 | * @param string $title The new title (or existing if there is no editor_title defined) |
929 | 929 | * @return string |
930 | 930 | */ |
931 | - public function add_custom_editor_default_title( $title ) { |
|
932 | - return isset( $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] ) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title; |
|
931 | + public function add_custom_editor_default_title($title) { |
|
932 | + return isset($this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]]) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title; |
|
933 | 933 | } |
934 | 934 | |
935 | 935 | |
@@ -942,11 +942,11 @@ discard block |
||
942 | 942 | * @param bool $allow_slugs Whether to allow post slugs in the shortlink. |
943 | 943 | * @return string |
944 | 944 | */ |
945 | - public function add_shortlink_button_to_editor( $shortlink, $id, $context, $allow_slugs ) { |
|
946 | - if ( !empty( $id ) && '' != get_option('permalink_structure') ) { |
|
947 | - $post = get_post( $id ); |
|
948 | - if ( isset($post->post_type) && $this->page_slug == $post->post_type ) |
|
949 | - $shortlink = home_url('?p=' . $post->ID); |
|
945 | + public function add_shortlink_button_to_editor($shortlink, $id, $context, $allow_slugs) { |
|
946 | + if ( ! empty($id) && '' != get_option('permalink_structure')) { |
|
947 | + $post = get_post($id); |
|
948 | + if (isset($post->post_type) && $this->page_slug == $post->post_type) |
|
949 | + $shortlink = home_url('?p='.$post->ID); |
|
950 | 950 | } |
951 | 951 | return $shortlink; |
952 | 952 | } |
@@ -959,10 +959,10 @@ discard block |
||
959 | 959 | * @return void |
960 | 960 | */ |
961 | 961 | public function route_admin_request() { |
962 | - if ( $this->_cpt_route ) return; |
|
962 | + if ($this->_cpt_route) return; |
|
963 | 963 | try { |
964 | 964 | $this->_route_admin_request(); |
965 | - } catch ( EE_Error $e ) { |
|
965 | + } catch (EE_Error $e) { |
|
966 | 966 | $e->get_error(); |
967 | 967 | } |
968 | 968 | } |
@@ -975,12 +975,12 @@ discard block |
||
975 | 975 | * @return string html |
976 | 976 | */ |
977 | 977 | public function cpt_post_form_hidden_input() { |
978 | - echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="' . $this->_admin_base_url . '" />'; |
|
978 | + echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="'.$this->_admin_base_url.'" />'; |
|
979 | 979 | |
980 | 980 | //we're also going to add the route value and the current page so we can direct autosave parsing correctly |
981 | 981 | echo '<div id="ee-cpt-hidden-inputs">'; |
982 | - echo '<input type="hidden" id="current_route" name="current_route" value="' . $this->_current_view . '" />'; |
|
983 | - echo '<input type="hidden" id="current_page" name="current_page" value="' . $this->page_slug . '" />'; |
|
982 | + echo '<input type="hidden" id="current_route" name="current_route" value="'.$this->_current_view.'" />'; |
|
983 | + echo '<input type="hidden" id="current_page" name="current_page" value="'.$this->page_slug.'" />'; |
|
984 | 984 | echo '</div>'; |
985 | 985 | } |
986 | 986 | |
@@ -993,12 +993,12 @@ discard block |
||
993 | 993 | * @param int $status Status for http header |
994 | 994 | * @return string new (or original) url to redirect to. |
995 | 995 | */ |
996 | - public function revision_redirect( $location, $status ) { |
|
996 | + public function revision_redirect($location, $status) { |
|
997 | 997 | //get revision |
998 | 998 | $rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL; |
999 | 999 | |
1000 | 1000 | //can't do anything without revision so let's get out if not present |
1001 | - if ( empty( $rev_id ) ) |
|
1001 | + if (empty($rev_id)) |
|
1002 | 1002 | return $location; |
1003 | 1003 | |
1004 | 1004 | //get rev_post_data |
@@ -1012,8 +1012,8 @@ discard block |
||
1012 | 1012 | 'message' => 5 |
1013 | 1013 | ); |
1014 | 1014 | |
1015 | - $this->_process_notices( $query_args, TRUE ); |
|
1016 | - return self::add_query_args_and_nonce( $query_args, $admin_url ); |
|
1015 | + $this->_process_notices($query_args, TRUE); |
|
1016 | + return self::add_query_args_and_nonce($query_args, $admin_url); |
|
1017 | 1017 | } |
1018 | 1018 | |
1019 | 1019 | |
@@ -1026,16 +1026,16 @@ discard block |
||
1026 | 1026 | * @param string $context optional, defaults to display. How to write the '&' |
1027 | 1027 | * @return string the link |
1028 | 1028 | */ |
1029 | - public function modify_edit_post_link( $link, $id, $context ) { |
|
1030 | - $post = get_post( $id ); |
|
1031 | - if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) |
|
1029 | + public function modify_edit_post_link($link, $id, $context) { |
|
1030 | + $post = get_post($id); |
|
1031 | + if ( ! isset($this->_req_data['action']) || ! isset($this->_cpt_routes[$this->_req_data['action']]) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']]) |
|
1032 | 1032 | return $link; |
1033 | 1033 | $query_args = array( |
1034 | 1034 | 'action' => isset($this->_cpt_edit_routes[$post->post_type]) ? $this->_cpt_edit_routes[$post->post_type] : 'edit', |
1035 | 1035 | 'post' => $id |
1036 | 1036 | ); |
1037 | 1037 | |
1038 | - return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1038 | + return self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | |
@@ -1047,12 +1047,12 @@ discard block |
||
1047 | 1047 | * @param bool $force_delete whether this is forcing a hard delete instead of trash |
1048 | 1048 | * @return string new delete link |
1049 | 1049 | */ |
1050 | - public function modify_delete_post_link( $delete_link, $post_id, $force_delete ) { |
|
1050 | + public function modify_delete_post_link($delete_link, $post_id, $force_delete) { |
|
1051 | 1051 | $post = get_post($post_id); |
1052 | - if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) ) |
|
1052 | + if ( ! isset($this->_req_data['action']) || (isset($this->_cpt_routes[$this->_req_data['action']]) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']])) |
|
1053 | 1053 | return $delete_link; |
1054 | 1054 | |
1055 | - return add_query_arg( array('current_route' => 'trash' ), $delete_link ); |
|
1055 | + return add_query_arg(array('current_route' => 'trash'), $delete_link); |
|
1056 | 1056 | } |
1057 | 1057 | |
1058 | 1058 | |
@@ -1063,16 +1063,16 @@ discard block |
||
1063 | 1063 | * @param string $status status |
1064 | 1064 | * @return string url to redirect to |
1065 | 1065 | */ |
1066 | - public function cpt_trash_post_location_redirect( $location, $status ) { |
|
1067 | - if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) ) |
|
1066 | + public function cpt_trash_post_location_redirect($location, $status) { |
|
1067 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] !== 'trash' && empty($this->_req_data['post'])) |
|
1068 | 1068 | return $location; |
1069 | 1069 | |
1070 | - $post = get_post( $this->_req_data['post'] ); |
|
1071 | - $query_args = array( 'action' => 'default' ); |
|
1070 | + $post = get_post($this->_req_data['post']); |
|
1071 | + $query_args = array('action' => 'default'); |
|
1072 | 1072 | $this->_cpt_object = get_post_type_object($post->post_type); |
1073 | - EE_Error::add_success( sprintf( __('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name) ); |
|
1074 | - $this->_process_notices( $query_args, TRUE ); |
|
1075 | - return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1073 | + EE_Error::add_success(sprintf(__('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name)); |
|
1074 | + $this->_process_notices($query_args, TRUE); |
|
1075 | + return self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | * @param string $post_id This is the 'ID' value of the wp_posts table |
1088 | 1088 | * @return string the new location to redirect to |
1089 | 1089 | */ |
1090 | - public function cpt_post_location_redirect( $location, $post_id ) { |
|
1090 | + public function cpt_post_location_redirect($location, $post_id) { |
|
1091 | 1091 | //we DO have a match so let's setup the url |
1092 | 1092 | |
1093 | 1093 | //we have to get the post to determine our route |
@@ -1095,14 +1095,14 @@ discard block |
||
1095 | 1095 | $edit_route = $this->_cpt_edit_routes[$post->post_type]; |
1096 | 1096 | |
1097 | 1097 | //shared query_args |
1098 | - $query_args = array( 'action' => $edit_route, 'post' => $post_id ); |
|
1098 | + $query_args = array('action' => $edit_route, 'post' => $post_id); |
|
1099 | 1099 | $admin_url = $this->_admin_base_url; |
1100 | 1100 | // $append = ''; |
1101 | 1101 | |
1102 | - if ( isset( $this->_req_data['save'] ) || isset( $this->_req_data['publish'] ) ) { |
|
1103 | - $status = get_post_status( $post_id ); |
|
1104 | - if ( isset( $this->_req_data['publish'] ) ) { |
|
1105 | - switch ( $status ) { |
|
1102 | + if (isset($this->_req_data['save']) || isset($this->_req_data['publish'])) { |
|
1103 | + $status = get_post_status($post_id); |
|
1104 | + if (isset($this->_req_data['publish'])) { |
|
1105 | + switch ($status) { |
|
1106 | 1106 | case 'pending': |
1107 | 1107 | $message = 8; |
1108 | 1108 | break; |
@@ -1115,13 +1115,13 @@ discard block |
||
1115 | 1115 | } else { |
1116 | 1116 | $message = 'draft' == $status ? 10 : 1; |
1117 | 1117 | } |
1118 | - } else if ( isset( $this->_req_data['addmeta']) && $this->_req_data['addmeta'] ) { |
|
1118 | + } else if (isset($this->_req_data['addmeta']) && $this->_req_data['addmeta']) { |
|
1119 | 1119 | $message = 2; |
1120 | 1120 | // $append = '#postcustom'; |
1121 | - } else if ( isset( $this->_req_data['deletemeta']) && $this->_req_data['deletemeta'] ) { |
|
1121 | + } else if (isset($this->_req_data['deletemeta']) && $this->_req_data['deletemeta']) { |
|
1122 | 1122 | $message = 3; |
1123 | 1123 | // $append = '#postcustom'; |
1124 | - } elseif ( $this->_req_data['action'] == 'post-quickpress-save-cont' ) { |
|
1124 | + } elseif ($this->_req_data['action'] == 'post-quickpress-save-cont') { |
|
1125 | 1125 | $message = 7; |
1126 | 1126 | } else { |
1127 | 1127 | $message = 4; |
@@ -1129,12 +1129,12 @@ discard block |
||
1129 | 1129 | |
1130 | 1130 | //change the message if the post type is not viewable on the frontend |
1131 | 1131 | $this->_cpt_object = get_post_type_object($post->post_type); |
1132 | - $message = $message === 1 && !$this->_cpt_object->publicly_queryable ? 4 : $message; |
|
1132 | + $message = $message === 1 && ! $this->_cpt_object->publicly_queryable ? 4 : $message; |
|
1133 | 1133 | |
1134 | - $query_args = array_merge( array( 'message' => $message ), $query_args ); |
|
1134 | + $query_args = array_merge(array('message' => $message), $query_args); |
|
1135 | 1135 | |
1136 | - $this->_process_notices( $query_args, TRUE ); |
|
1137 | - return self::add_query_args_and_nonce( $query_args, $admin_url ); |
|
1136 | + $this->_process_notices($query_args, TRUE); |
|
1137 | + return self::add_query_args_and_nonce($query_args, $admin_url); |
|
1138 | 1138 | } |
1139 | 1139 | |
1140 | 1140 | |
@@ -1166,10 +1166,10 @@ discard block |
||
1166 | 1166 | * @param array $messages the original messages array |
1167 | 1167 | * @return array the new messages array |
1168 | 1168 | */ |
1169 | - public function post_update_messages( $messages ) { |
|
1169 | + public function post_update_messages($messages) { |
|
1170 | 1170 | global $post; |
1171 | - $id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL; |
|
1172 | - $id = empty( $id ) && is_object( $post ) ? $post->ID : NULL; |
|
1171 | + $id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL; |
|
1172 | + $id = empty($id) && is_object($post) ? $post->ID : NULL; |
|
1173 | 1173 | |
1174 | 1174 | // $post_type = $post ? $post->post_type : false; |
1175 | 1175 | |
@@ -1182,9 +1182,9 @@ discard block |
||
1182 | 1182 | 0 => '', //Unused. Messages start at index 1. |
1183 | 1183 | |
1184 | 1184 | 1 => sprintf( |
1185 | - __( '%1$s updated. %2$sView %1$s%3$s', 'event_espresso'), |
|
1185 | + __('%1$s updated. %2$sView %1$s%3$s', 'event_espresso'), |
|
1186 | 1186 | $this->_cpt_object->labels->singular_name, |
1187 | - '<a href="' . esc_url( get_permalink( $id )) . '">', |
|
1187 | + '<a href="'.esc_url(get_permalink($id)).'">', |
|
1188 | 1188 | '</a>' |
1189 | 1189 | ), |
1190 | 1190 | |
@@ -1192,38 +1192,38 @@ discard block |
||
1192 | 1192 | |
1193 | 1193 | 3 => __('Custom field deleted.'), |
1194 | 1194 | |
1195 | - 4 => sprintf( __( '%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name ), |
|
1195 | + 4 => sprintf(__('%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
1196 | 1196 | |
1197 | - 5 => isset( $_GET['revision'] ) ? sprintf( __('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title( (int) $_GET['revision'], FALSE ) ) : FALSE, |
|
1197 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], FALSE)) : FALSE, |
|
1198 | 1198 | |
1199 | 1199 | 6 => sprintf( |
1200 | - __( '%1$s published. %2$sView %1$s%3$s', 'event_espresso'), |
|
1200 | + __('%1$s published. %2$sView %1$s%3$s', 'event_espresso'), |
|
1201 | 1201 | $this->_cpt_object->labels->singular_name, |
1202 | - '<a href="' . esc_url( get_permalink( $id )) . '">', |
|
1202 | + '<a href="'.esc_url(get_permalink($id)).'">', |
|
1203 | 1203 | '</a>' |
1204 | 1204 | ), |
1205 | 1205 | |
1206 | - 7 => sprintf( __( '%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name ), |
|
1206 | + 7 => sprintf(__('%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name), |
|
1207 | 1207 | |
1208 | 1208 | 8 => sprintf( |
1209 | 1209 | __('%1$s submitted. %2$sPreview %1$s%3$s', 'event_espresso'), |
1210 | 1210 | $this->_cpt_object->labels->singular_name, |
1211 | - '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) . '">', |
|
1211 | + '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))).'">', |
|
1212 | 1212 | '</a>' |
1213 | 1213 | ), |
1214 | 1214 | |
1215 | 1215 | 9 => sprintf( |
1216 | - __( '%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'), |
|
1216 | + __('%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'), |
|
1217 | 1217 | $this->_cpt_object->labels->singular_name, |
1218 | - '<strong>' . date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date )) . '</strong>', |
|
1219 | - '<a target="_blank" href="' . esc_url( get_permalink( $id )), |
|
1218 | + '<strong>'.date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)).'</strong>', |
|
1219 | + '<a target="_blank" href="'.esc_url(get_permalink($id)), |
|
1220 | 1220 | '</a>' |
1221 | 1221 | ), |
1222 | 1222 | |
1223 | 1223 | 10 => sprintf( |
1224 | 1224 | __('%1$s draft updated. %2$s">Preview page%3$s', 'event_espresso'), |
1225 | 1225 | $this->_cpt_object->labels->singular_name, |
1226 | - '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) , |
|
1226 | + '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))), |
|
1227 | 1227 | '</a>' |
1228 | 1228 | ) |
1229 | 1229 | ); |
@@ -1250,24 +1250,24 @@ discard block |
||
1250 | 1250 | $post_type_object = $this->_cpt_object; |
1251 | 1251 | $title = $post_type_object->labels->add_new_item; |
1252 | 1252 | $editing = TRUE; |
1253 | - wp_enqueue_script( 'autosave' ); |
|
1254 | - $post = $post = get_default_post_to_edit( $this->_cpt_routes[$this->_req_action], TRUE ); |
|
1253 | + wp_enqueue_script('autosave'); |
|
1254 | + $post = $post = get_default_post_to_edit($this->_cpt_routes[$this->_req_action], TRUE); |
|
1255 | 1255 | $post_ID = $post->ID; |
1256 | 1256 | $is_IE = $is_IE; |
1257 | 1257 | |
1258 | - add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) ); |
|
1258 | + add_action('admin_print_styles', array($this, 'add_new_admin_page_global')); |
|
1259 | 1259 | |
1260 | 1260 | //modify the default editor title field with default title. |
1261 | - add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 ); |
|
1261 | + add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10); |
|
1262 | 1262 | |
1263 | - include_once WP_ADMIN_PATH . 'edit-form-advanced.php'; |
|
1263 | + include_once WP_ADMIN_PATH.'edit-form-advanced.php'; |
|
1264 | 1264 | } |
1265 | 1265 | |
1266 | 1266 | |
1267 | 1267 | |
1268 | 1268 | |
1269 | 1269 | public function add_new_admin_page_global() { |
1270 | - $admin_page = !empty( $this->_req_data['post'] ) ? 'post-php' : 'post-new-php'; |
|
1270 | + $admin_page = ! empty($this->_req_data['post']) ? 'post-php' : 'post-new-php'; |
|
1271 | 1271 | ?> |
1272 | 1272 | <script type="text/javascript"> |
1273 | 1273 | adminpage = '<?php echo $admin_page; ?>'; |
@@ -1289,16 +1289,16 @@ discard block |
||
1289 | 1289 | */ |
1290 | 1290 | protected function _edit_cpt_item() { |
1291 | 1291 | global $post, $title, $is_IE, $post_type, $post_type_object; |
1292 | - $post_id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL; |
|
1293 | - $post = !empty( $post_id ) ? get_post( $post_id, OBJECT, 'edit' ) : NULL; |
|
1292 | + $post_id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL; |
|
1293 | + $post = ! empty($post_id) ? get_post($post_id, OBJECT, 'edit') : NULL; |
|
1294 | 1294 | |
1295 | - if ( empty ( $post ) ) { |
|
1296 | - wp_die( __('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?') ); |
|
1295 | + if (empty ($post)) { |
|
1296 | + wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?')); |
|
1297 | 1297 | } |
1298 | 1298 | |
1299 | - if ( ! empty( $_GET['get-post-lock'] ) ) { |
|
1300 | - wp_set_post_lock( $post_id ); |
|
1301 | - wp_redirect( get_edit_post_link( $post_id, 'url' ) ); |
|
1299 | + if ( ! empty($_GET['get-post-lock'])) { |
|
1300 | + wp_set_post_lock($post_id); |
|
1301 | + wp_redirect(get_edit_post_link($post_id, 'url')); |
|
1302 | 1302 | exit(); |
1303 | 1303 | } |
1304 | 1304 | |
@@ -1310,32 +1310,32 @@ discard block |
||
1310 | 1310 | $post_type_object = $this->_cpt_object; |
1311 | 1311 | $is_IE = $is_IE; |
1312 | 1312 | |
1313 | - if ( ! wp_check_post_lock( $post->ID ) ) { |
|
1314 | - $active_post_lock = wp_set_post_lock( $post->ID ); |
|
1313 | + if ( ! wp_check_post_lock($post->ID)) { |
|
1314 | + $active_post_lock = wp_set_post_lock($post->ID); |
|
1315 | 1315 | //wp_enqueue_script('autosave'); |
1316 | 1316 | } |
1317 | 1317 | |
1318 | 1318 | $title = $this->_cpt_object->labels->edit_item; |
1319 | 1319 | |
1320 | - add_action('admin_footer', '_admin_notice_post_locked' ); |
|
1320 | + add_action('admin_footer', '_admin_notice_post_locked'); |
|
1321 | 1321 | |
1322 | - if ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && !isset( $this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']] ) ) { |
|
1323 | - $create_new_action = apply_filters( 'FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this ); |
|
1322 | + if (isset($this->_cpt_routes[$this->_req_data['action']]) && ! isset($this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']])) { |
|
1323 | + $create_new_action = apply_filters('FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this); |
|
1324 | 1324 | |
1325 | - $post_new_file = EE_Admin_Page::add_query_args_and_nonce( array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php' ); |
|
1325 | + $post_new_file = EE_Admin_Page::add_query_args_and_nonce(array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php'); |
|
1326 | 1326 | } |
1327 | 1327 | |
1328 | - if ( post_type_supports($this->_cpt_routes[$this->_req_action], 'comments') ) { |
|
1328 | + if (post_type_supports($this->_cpt_routes[$this->_req_action], 'comments')) { |
|
1329 | 1329 | wp_enqueue_script('admin-comments'); |
1330 | 1330 | enqueue_comment_hotkeys_js(); |
1331 | 1331 | } |
1332 | 1332 | |
1333 | - add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) ); |
|
1333 | + add_action('admin_print_styles', array($this, 'add_new_admin_page_global')); |
|
1334 | 1334 | |
1335 | 1335 | //modify the default editor title field with default title. |
1336 | - add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 ); |
|
1336 | + add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10); |
|
1337 | 1337 | |
1338 | - include_once WP_ADMIN_PATH . 'edit-form-advanced.php'; |
|
1338 | + include_once WP_ADMIN_PATH.'edit-form-advanced.php'; |
|
1339 | 1339 | |
1340 | 1340 | } |
1341 | 1341 |