Code Duplication    Length = 7-21 lines in 2 locations

core/admin/PostShortcodeTracking.php 1 location

@@ 397-403 (lines=7) @@
394
	 * @return void
395
	 */
396
	public static function reset_page_for_posts_on_change( $option, $old_value = '', $value = '' ) {
397
		if ( $option == 'page_for_posts' ) {
398
			global $wpdb;
399
			$table = $wpdb->posts;
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 );
403
		}
404
	}
405
406

core/EE_Front_Controller.core.php 1 location

@@ 256-276 (lines=21) @@
253
		$current_post = apply_filters( 'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', $this->Request_Handler->get( 'post_name' ));
254
		$show_on_front = get_option( 'show_on_front' );
255
		// if it's not set, then check if frontpage is blog
256
		if ( empty( $current_post ) ) {
257
			// yup.. this is the posts page, prepare to load all shortcode modules
258
			$current_post = 'posts';
259
			// unless..
260
			if ( $show_on_front === 'page' ) {
261
				// some other page is set as the homepage
262
				$page_on_front = get_option( 'page_on_front' );
263
				if ( $page_on_front ) {
264
					// k now we need to find the post_name for this page
265
					global $wpdb;
266
					$page_on_front = $wpdb->get_var(
267
						$wpdb->prepare(
268
							"SELECT post_name from $wpdb->posts WHERE post_type='page' AND post_status='publish' AND ID=%d",
269
							$page_on_front
270
						)
271
					);
272
					// set the current post slug to what it actually is
273
					$current_post = $page_on_front ? $page_on_front : $current_post;
274
				}
275
			}
276
		}
277
		// where are posts being displayed ?
278
		$page_for_posts = EE_Config::get_page_for_posts();
279
		// in case $current_post is hierarchical like: /parent-page/current-page