@@ -256,7 +256,7 @@ |
||
256 | 256 | * @param int $ID |
257 | 257 | * @param $shortcode_class |
258 | 258 | * @param $shortcode_posts |
259 | - * @param $page_for_posts |
|
259 | + * @param string $page_for_posts |
|
260 | 260 | * @param bool $update_post_shortcodes |
261 | 261 | * @return bool |
262 | 262 | */ |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\admin; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -28,31 +28,31 @@ discard block |
||
28 | 28 | public static function set_hooks_admin() { |
29 | 29 | add_action( |
30 | 30 | 'save_post', |
31 | - array( 'EventEspresso\core\admin\PostShortcodeTracking', 'parse_post_content_on_save' ), |
|
31 | + array('EventEspresso\core\admin\PostShortcodeTracking', 'parse_post_content_on_save'), |
|
32 | 32 | 10, |
33 | 33 | 2 |
34 | 34 | ); |
35 | 35 | add_action( |
36 | 36 | 'delete_post', |
37 | - array( 'EventEspresso\core\admin\PostShortcodeTracking', 'unset_post_shortcodes_on_delete' ), |
|
37 | + array('EventEspresso\core\admin\PostShortcodeTracking', 'unset_post_shortcodes_on_delete'), |
|
38 | 38 | 100, |
39 | 39 | 1 |
40 | 40 | ); |
41 | 41 | add_action( |
42 | 42 | 'add_option_page_for_posts', |
43 | - array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_initial_set' ), |
|
43 | + array('EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_initial_set'), |
|
44 | 44 | 100, |
45 | 45 | 2 |
46 | 46 | ); |
47 | 47 | add_action( |
48 | 48 | 'update_option', |
49 | - array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_change' ), |
|
49 | + array('EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_change'), |
|
50 | 50 | 100, |
51 | 51 | 3 |
52 | 52 | ); |
53 | 53 | add_action( |
54 | 54 | 'delete_option', |
55 | - array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_delete' ), |
|
55 | + array('EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_delete'), |
|
56 | 56 | 100, |
57 | 57 | 1 |
58 | 58 | ); |
@@ -72,64 +72,64 @@ discard block |
||
72 | 72 | * @param \WP_Post $post |
73 | 73 | * @return void |
74 | 74 | */ |
75 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
75 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
76 | 76 | // if the post is trashed, then let's remove our post shortcode tracking |
77 | - if ( $post instanceof \WP_Post && $post->post_status === 'trash' ) { |
|
78 | - PostShortcodeTracking::unset_post_shortcodes_on_delete( $post_ID ); |
|
77 | + if ($post instanceof \WP_Post && $post->post_status === 'trash') { |
|
78 | + PostShortcodeTracking::unset_post_shortcodes_on_delete($post_ID); |
|
79 | 79 | return; |
80 | 80 | } |
81 | 81 | // default post types |
82 | 82 | $post_types = (array) apply_filters( |
83 | 83 | 'FHEE__EventEspresso_core_admin_PostShortcodeTracking__parse_post_content_on_save__default_post_types', |
84 | - array( 'post' => 0, 'page' => 1 ) |
|
84 | + array('post' => 0, 'page' => 1) |
|
85 | 85 | ); |
86 | 86 | // add CPTs |
87 | 87 | $CPTs = \EE_Register_CPTs::get_CPTs(); |
88 | - $post_types = array_merge( $post_types, $CPTs ); |
|
88 | + $post_types = array_merge($post_types, $CPTs); |
|
89 | 89 | // for default or CPT posts... |
90 | - if ( isset( $post_types[ $post->post_type ] ) ) { |
|
90 | + if (isset($post_types[$post->post_type])) { |
|
91 | 91 | // post on frontpage ? |
92 | 92 | $page_for_posts = \EE_Config::get_page_for_posts(); |
93 | - if ( $post->post_name === $page_for_posts ) { |
|
94 | - PostShortcodeTracking::set_post_shortcodes_for_posts_page( $page_for_posts ); |
|
93 | + if ($post->post_name === $page_for_posts) { |
|
94 | + PostShortcodeTracking::set_post_shortcodes_for_posts_page($page_for_posts); |
|
95 | 95 | return; |
96 | 96 | } |
97 | 97 | // array of shortcodes indexed by post name |
98 | - \EE_Registry::CFG()->core->post_shortcodes = isset( \EE_Registry::CFG()->core->post_shortcodes ) |
|
98 | + \EE_Registry::CFG()->core->post_shortcodes = isset(\EE_Registry::CFG()->core->post_shortcodes) |
|
99 | 99 | ? \EE_Registry::CFG()->core->post_shortcodes |
100 | 100 | : array(); |
101 | 101 | // whether to proceed with update |
102 | 102 | $update_post_shortcodes = false; |
103 | 103 | // empty both arrays |
104 | - \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ] = array(); |
|
104 | + \EE_Registry::CFG()->core->post_shortcodes[$post->post_name] = array(); |
|
105 | 105 | // check that posts page is already being tracked |
106 | - if ( ! isset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] ) ) { |
|
106 | + if ( ! isset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts])) { |
|
107 | 107 | // if not, then ensure that it is properly added |
108 | - \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] = array(); |
|
108 | + \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts] = array(); |
|
109 | 109 | } |
110 | 110 | // loop thru shortcodes |
111 | - foreach ( \EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) { |
|
111 | + foreach (\EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) { |
|
112 | 112 | // convert to UPPERCASE to get actual shortcode |
113 | - $EES_Shortcode = strtoupper( $EES_Shortcode ); |
|
113 | + $EES_Shortcode = strtoupper($EES_Shortcode); |
|
114 | 114 | // is the shortcode in the post_content ? |
115 | - if ( strpos( $post->post_content, $EES_Shortcode ) !== false ) { |
|
115 | + if (strpos($post->post_content, $EES_Shortcode) !== false) { |
|
116 | 116 | // map shortcode to post names and post IDs |
117 | - \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID; |
|
117 | + \EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID; |
|
118 | 118 | // and add this shortcode to the tracking for the blog page |
119 | - PostShortcodeTracking::set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID ); |
|
119 | + PostShortcodeTracking::set_post_shortcode_for_posts_page($page_for_posts, $EES_Shortcode, $post_ID); |
|
120 | 120 | $update_post_shortcodes = true; |
121 | 121 | } else { |
122 | 122 | // shortcode is not present in post content, so check if we were tracking it previously |
123 | 123 | // stop tracking if shortcode is not used in this specific post |
124 | - if ( isset( \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] ) ) { |
|
125 | - unset( \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] ); |
|
124 | + if (isset(\EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode])) { |
|
125 | + unset(\EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode]); |
|
126 | 126 | $update_post_shortcodes = true; |
127 | 127 | } |
128 | 128 | // make sure that something is set for the shortcode posts (even though we may remove this) |
129 | 129 | $shortcode_posts = isset( |
130 | - \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] |
|
130 | + \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] |
|
131 | 131 | ) |
132 | - ? \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] |
|
132 | + ? \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] |
|
133 | 133 | : array(); |
134 | 134 | // and stop tracking for this shortcode on the blog page if it is not used |
135 | 135 | $update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post( |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | : $update_post_shortcodes; |
144 | 144 | } |
145 | 145 | } |
146 | - if ( $update_post_shortcodes ) { |
|
147 | - PostShortcodeTracking::update_post_shortcodes( $page_for_posts ); |
|
146 | + if ($update_post_shortcodes) { |
|
147 | + PostShortcodeTracking::update_post_shortcodes($page_for_posts); |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | } |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | * @param string $page_for_posts |
162 | 162 | * @return void |
163 | 163 | */ |
164 | - protected static function set_post_shortcodes_for_posts_page( $page_for_posts ) { |
|
165 | - \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] = array(); |
|
164 | + protected static function set_post_shortcodes_for_posts_page($page_for_posts) { |
|
165 | + \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts] = array(); |
|
166 | 166 | // loop thru shortcodes |
167 | - foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) { |
|
168 | - foreach ( $post_shortcodes as $EES_Shortcode => $post_ID ) { |
|
169 | - PostShortcodeTracking::set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID ); |
|
167 | + foreach (\EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes) { |
|
168 | + foreach ($post_shortcodes as $EES_Shortcode => $post_ID) { |
|
169 | + PostShortcodeTracking::set_post_shortcode_for_posts_page($page_for_posts, $EES_Shortcode, $post_ID); |
|
170 | 170 | } |
171 | 171 | } |
172 | - PostShortcodeTracking::update_post_shortcodes( $page_for_posts ); |
|
172 | + PostShortcodeTracking::update_post_shortcodes($page_for_posts); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | |
@@ -184,24 +184,24 @@ discard block |
||
184 | 184 | * @param $EES_Shortcode |
185 | 185 | * @param $post_ID |
186 | 186 | */ |
187 | - protected static function set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID ) { |
|
187 | + protected static function set_post_shortcode_for_posts_page($page_for_posts, $EES_Shortcode, $post_ID) { |
|
188 | 188 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
189 | 189 | $critical_shortcodes = \EE_Registry::CFG()->core->get_critical_pages_shortcodes_array(); |
190 | 190 | // if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE |
191 | - if ( in_array( $EES_Shortcode, $critical_shortcodes ) ) { |
|
191 | + if (in_array($EES_Shortcode, $critical_shortcodes)) { |
|
192 | 192 | return; |
193 | 193 | } |
194 | 194 | // add shortcode to "Posts page" tracking |
195 | - if ( isset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] ) ) { |
|
195 | + if (isset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode])) { |
|
196 | 196 | // make sure tracking is in form of an array |
197 | - if ( ! is_array( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] ) ) { |
|
198 | - \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = array( |
|
199 | - \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] => true |
|
197 | + if ( ! is_array(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode])) { |
|
198 | + \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = array( |
|
199 | + \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] => true |
|
200 | 200 | ); |
201 | 201 | } |
202 | - \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] += array( $post_ID => true ); |
|
202 | + \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] += array($post_ID => true); |
|
203 | 203 | } else { |
204 | - \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = array( $post_ID => true ); |
|
204 | + \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = array($post_ID => true); |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
@@ -214,16 +214,16 @@ discard block |
||
214 | 214 | * @param int $ID |
215 | 215 | * @return void |
216 | 216 | */ |
217 | - public static function unset_post_shortcodes_on_delete( $ID ) { |
|
217 | + public static function unset_post_shortcodes_on_delete($ID) { |
|
218 | 218 | $update_post_shortcodes = false; |
219 | 219 | // post on frontpage ? |
220 | 220 | $page_for_posts = \EE_Config::get_page_for_posts(); |
221 | 221 | // looking for any references to this post |
222 | - foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) { |
|
222 | + foreach (\EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes) { |
|
223 | 223 | // is this the "Posts Page" (blog) ? |
224 | - if ( $post_name === $page_for_posts ) { |
|
224 | + if ($post_name === $page_for_posts) { |
|
225 | 225 | // loop thru shortcodes registered for the posts page |
226 | - foreach ( $post_shortcodes as $shortcode_class => $shortcode_posts ) { |
|
226 | + foreach ($post_shortcodes as $shortcode_class => $shortcode_posts) { |
|
227 | 227 | $update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post( |
228 | 228 | $ID, |
229 | 229 | $shortcode_class, |
@@ -236,17 +236,17 @@ discard block |
||
236 | 236 | } |
237 | 237 | } else { |
238 | 238 | // loop thru shortcodes registered for each page |
239 | - foreach ( $post_shortcodes as $shortcode_class => $post_ID ) { |
|
239 | + foreach ($post_shortcodes as $shortcode_class => $post_ID) { |
|
240 | 240 | // if this is page is being deleted, then don't track any post shortcodes for it |
241 | - if ( $post_ID === $ID ) { |
|
242 | - unset( \EE_Registry::CFG()->core->post_shortcodes[ $post_name ] ); |
|
241 | + if ($post_ID === $ID) { |
|
242 | + unset(\EE_Registry::CFG()->core->post_shortcodes[$post_name]); |
|
243 | 243 | $update_post_shortcodes = true; |
244 | 244 | } |
245 | 245 | } |
246 | 246 | } |
247 | 247 | } |
248 | - if ( $update_post_shortcodes ) { |
|
249 | - PostShortcodeTracking::update_post_shortcodes( $page_for_posts ); |
|
248 | + if ($update_post_shortcodes) { |
|
249 | + PostShortcodeTracking::update_post_shortcodes($page_for_posts); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
@@ -271,20 +271,20 @@ discard block |
||
271 | 271 | $update_post_shortcodes = false |
272 | 272 | ) { |
273 | 273 | // make sure that an array of post IDs is being tracked for each shortcode |
274 | - if ( ! is_array( $shortcode_posts ) ) { |
|
275 | - \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] = array( |
|
274 | + if ( ! is_array($shortcode_posts)) { |
|
275 | + \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class] = array( |
|
276 | 276 | $shortcode_posts => true |
277 | 277 | ); |
278 | 278 | $update_post_shortcodes = true; |
279 | 279 | } |
280 | 280 | // now if the ID of the post being deleted is in the $shortcode_posts array |
281 | - if ( is_array( $shortcode_posts ) && isset( $shortcode_posts[ $ID ] ) ) { |
|
282 | - unset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ][ $ID ] ); |
|
281 | + if (is_array($shortcode_posts) && isset($shortcode_posts[$ID])) { |
|
282 | + unset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class][$ID]); |
|
283 | 283 | $update_post_shortcodes = true; |
284 | 284 | } |
285 | 285 | // if nothing is registered for that shortcode anymore, then delete the shortcode altogether |
286 | - if ( empty( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] ) ) { |
|
287 | - unset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] ); |
|
286 | + if (empty(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class])) { |
|
287 | + unset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class]); |
|
288 | 288 | $update_post_shortcodes = true; |
289 | 289 | } |
290 | 290 | return $update_post_shortcodes; |
@@ -299,9 +299,9 @@ discard block |
||
299 | 299 | * @param $page_for_posts |
300 | 300 | * @return void |
301 | 301 | */ |
302 | - public static function update_post_shortcodes( $page_for_posts = '' ) { |
|
302 | + public static function update_post_shortcodes($page_for_posts = '') { |
|
303 | 303 | // make sure page_for_posts is set |
304 | - $page_for_posts = ! empty( $page_for_posts ) |
|
304 | + $page_for_posts = ! empty($page_for_posts) |
|
305 | 305 | ? $page_for_posts |
306 | 306 | : \EE_Config::get_page_for_posts(); |
307 | 307 | // allow others to mess stuff up :D |
@@ -317,45 +317,45 @@ discard block |
||
317 | 317 | $page_for_posts |
318 | 318 | ); |
319 | 319 | // verify that post_shortcodes is set |
320 | - \EE_Config::instance()->core->post_shortcodes = isset( \EE_Config::instance()->core->post_shortcodes ) |
|
321 | - && is_array( \EE_Config::instance()->core->post_shortcodes ) |
|
320 | + \EE_Config::instance()->core->post_shortcodes = isset(\EE_Config::instance()->core->post_shortcodes) |
|
321 | + && is_array(\EE_Config::instance()->core->post_shortcodes) |
|
322 | 322 | ? \EE_Config::instance()->core->post_shortcodes |
323 | 323 | : array(); |
324 | 324 | // cycle thru post_shortcodes |
325 | - foreach ( \EE_Config::instance()->core->post_shortcodes as $post_name => $shortcodes ) { |
|
325 | + foreach (\EE_Config::instance()->core->post_shortcodes as $post_name => $shortcodes) { |
|
326 | 326 | // are there any shortcodes to track ? |
327 | - if ( ! empty( $shortcodes ) ) { |
|
327 | + if ( ! empty($shortcodes)) { |
|
328 | 328 | // loop thru list of tracked shortcodes |
329 | - foreach ( $shortcodes as $shortcode => $post_id ) { |
|
329 | + foreach ($shortcodes as $shortcode => $post_id) { |
|
330 | 330 | // if shortcode is for a critical page, |
331 | 331 | // BUT this is NOT the corresponding critical page for that shortcode |
332 | - if ( $post_name === $page_for_posts ) { |
|
332 | + if ($post_name === $page_for_posts) { |
|
333 | 333 | continue; |
334 | 334 | } |
335 | 335 | // skip the posts page, because we want all shortcodes registered for it |
336 | - if ( $post_name === $page_for_posts ) { |
|
336 | + if ($post_name === $page_for_posts) { |
|
337 | 337 | continue; |
338 | 338 | } |
339 | 339 | // make sure post still exists |
340 | - $post = get_post( $post_id ); |
|
340 | + $post = get_post($post_id); |
|
341 | 341 | // check that the post name matches what we have saved |
342 | - if ( $post && $post->post_name === $post_name ) { |
|
342 | + if ($post && $post->post_name === $post_name) { |
|
343 | 343 | // if so, then break before hitting the unset below |
344 | 344 | continue; |
345 | 345 | } |
346 | 346 | // we don't like missing posts around here >:( |
347 | - unset( \EE_Config::instance()->core->post_shortcodes[ $post_name ] ); |
|
347 | + unset(\EE_Config::instance()->core->post_shortcodes[$post_name]); |
|
348 | 348 | } |
349 | 349 | } else { |
350 | 350 | // you got no shortcodes to keep track of ! |
351 | - unset( \EE_Config::instance()->core->post_shortcodes[ $post_name ] ); |
|
351 | + unset(\EE_Config::instance()->core->post_shortcodes[$post_name]); |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
355 | 355 | $critical_shortcodes = \EE_Config::instance()->core->get_critical_pages_shortcodes_array(); |
356 | - $critical_shortcodes = array_flip( $critical_shortcodes ); |
|
357 | - foreach ( $critical_shortcodes as $critical_shortcode ) { |
|
358 | - unset( \EE_Config::instance()->core->post_shortcodes[ $page_for_posts ][ $critical_shortcode ] ); |
|
356 | + $critical_shortcodes = array_flip($critical_shortcodes); |
|
357 | + foreach ($critical_shortcodes as $critical_shortcode) { |
|
358 | + unset(\EE_Config::instance()->core->post_shortcodes[$page_for_posts][$critical_shortcode]); |
|
359 | 359 | } |
360 | 360 | //only show errors |
361 | 361 | \EE_Config::instance()->update_espresso_config(); |
@@ -375,8 +375,8 @@ discard block |
||
375 | 375 | * @param string $value |
376 | 376 | * @return void |
377 | 377 | */ |
378 | - public static function reset_page_for_posts_on_initial_set( $option, $value ) { |
|
379 | - PostShortcodeTracking::reset_page_for_posts_on_change( $option, '', $value ); |
|
378 | + public static function reset_page_for_posts_on_initial_set($option, $value) { |
|
379 | + PostShortcodeTracking::reset_page_for_posts_on_change($option, '', $value); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | |
@@ -393,13 +393,13 @@ discard block |
||
393 | 393 | * @param string $value |
394 | 394 | * @return void |
395 | 395 | */ |
396 | - public static function reset_page_for_posts_on_change( $option, $old_value = '', $value = '' ) { |
|
397 | - if ( $option === 'page_for_posts' ) { |
|
396 | + public static function reset_page_for_posts_on_change($option, $old_value = '', $value = '') { |
|
397 | + if ($option === 'page_for_posts') { |
|
398 | 398 | global $wpdb; |
399 | 399 | $table = $wpdb->posts; |
400 | 400 | $SQL = "SELECT post_name from $table WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
401 | - $new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value ) ) : 'posts'; |
|
402 | - PostShortcodeTracking::set_post_shortcodes_for_posts_page( $new_page_for_posts ); |
|
401 | + $new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts'; |
|
402 | + PostShortcodeTracking::set_post_shortcodes_for_posts_page($new_page_for_posts); |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
@@ -415,9 +415,9 @@ discard block |
||
415 | 415 | * @param string $option |
416 | 416 | * @return void |
417 | 417 | */ |
418 | - public static function reset_page_for_posts_on_delete( $option ) { |
|
419 | - if ( $option === 'page_for_posts' ) { |
|
420 | - PostShortcodeTracking::set_post_shortcodes_for_posts_page( 'posts' ); |
|
418 | + public static function reset_page_for_posts_on_delete($option) { |
|
419 | + if ($option === 'page_for_posts') { |
|
420 | + PostShortcodeTracking::set_post_shortcodes_for_posts_page('posts'); |
|
421 | 421 | } |
422 | 422 | } |
423 | 423 |