Completed
Pull Request — develop (#1596)
by David
01:36 queued 16s
created
src/modules/food-kg/includes/admin/Full_Page_Delegate.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@
 block discarded – undo
4 4
 
5 5
 class Full_Page_Delegate implements Page_Delegate {
6 6
 
7
-	public function render() {
8
-		include WL_FOOD_KG_DIR_PATH . '/includes/admin/partials/main_ingredient.php';
9
-	}
7
+    public function render() {
8
+        include WL_FOOD_KG_DIR_PATH . '/includes/admin/partials/main_ingredient.php';
9
+    }
10 10
 
11
-	public function admin_enqueue_scripts() {
12
-		wp_enqueue_style( 'thickbox' );
13
-		wp_enqueue_script( 'plugin-install' );
14
-	}
11
+    public function admin_enqueue_scripts() {
12
+        wp_enqueue_style( 'thickbox' );
13
+        wp_enqueue_script( 'plugin-install' );
14
+    }
15 15
 
16 16
 }
Please login to merge, or discard this patch.
src/modules/food-kg/includes/admin/Page.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -4,55 +4,55 @@
 block discarded – undo
4 4
 
5 5
 class Page {
6 6
 
7
-	/**
8
-	 * @var Page_Delegate
9
-	 */
10
-	private $delegate;
11
-
12
-	/**
13
-	 * @param Page_Delegate $full_page_delegate
14
-	 * @param Page_Delegate $modal_page_delegate
15
-	 */
16
-	public function __construct( $full_page_delegate, $modal_page_delegate ) {
17
-		$this->delegate = isset( $_GET['modal_window'] ) ? $modal_page_delegate : $full_page_delegate; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
18
-	}
19
-
20
-	public function register_hooks() {
21
-		add_action( 'admin_menu', array( $this, 'admin_menu' ) );
22
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
23
-		if ( isset( $_GET['modal_window'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
24
-			add_action( 'in_admin_header', array( $this, 'remove_notices' ), 99 );
25
-		}
26
-	}
27
-
28
-	/**
29
-	 * Remove notices from ingredients modal.
30
-	 */
31
-	public function remove_notices() {
32
-		remove_all_actions( 'admin_notices' );
33
-		remove_all_actions( 'all_admin_notices' );
34
-	}
35
-
36
-	public function admin_menu() {
37
-		add_submenu_page(
38
-			'wl_admin_menu',
39
-			__( 'Ingredients', 'wordlift' ),
40
-			__( 'Ingredients', 'wordlift' ),
41
-			'manage_options',
42
-			'wl_ingredients',
43
-			array( $this, 'render' )
44
-		);
45
-	}
46
-
47
-	public function render() {
48
-		$this->delegate->render();
49
-	}
50
-
51
-	public function admin_enqueue_scripts() {
52
-		// Check that we are on the right screen
53
-		if ( get_current_screen()->id === 'wordlift_page_wl_ingredients' ) {
54
-			$this->delegate->admin_enqueue_scripts();
55
-		}
56
-	}
7
+    /**
8
+     * @var Page_Delegate
9
+     */
10
+    private $delegate;
11
+
12
+    /**
13
+     * @param Page_Delegate $full_page_delegate
14
+     * @param Page_Delegate $modal_page_delegate
15
+     */
16
+    public function __construct( $full_page_delegate, $modal_page_delegate ) {
17
+        $this->delegate = isset( $_GET['modal_window'] ) ? $modal_page_delegate : $full_page_delegate; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
18
+    }
19
+
20
+    public function register_hooks() {
21
+        add_action( 'admin_menu', array( $this, 'admin_menu' ) );
22
+        add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
23
+        if ( isset( $_GET['modal_window'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
24
+            add_action( 'in_admin_header', array( $this, 'remove_notices' ), 99 );
25
+        }
26
+    }
27
+
28
+    /**
29
+     * Remove notices from ingredients modal.
30
+     */
31
+    public function remove_notices() {
32
+        remove_all_actions( 'admin_notices' );
33
+        remove_all_actions( 'all_admin_notices' );
34
+    }
35
+
36
+    public function admin_menu() {
37
+        add_submenu_page(
38
+            'wl_admin_menu',
39
+            __( 'Ingredients', 'wordlift' ),
40
+            __( 'Ingredients', 'wordlift' ),
41
+            'manage_options',
42
+            'wl_ingredients',
43
+            array( $this, 'render' )
44
+        );
45
+    }
46
+
47
+    public function render() {
48
+        $this->delegate->render();
49
+    }
50
+
51
+    public function admin_enqueue_scripts() {
52
+        // Check that we are on the right screen
53
+        if ( get_current_screen()->id === 'wordlift_page_wl_ingredients' ) {
54
+            $this->delegate->admin_enqueue_scripts();
55
+        }
56
+    }
57 57
 
58 58
 }
Please login to merge, or discard this patch.
src/modules/food-kg/includes/admin/partials/main_ingredient.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@
 block discarded – undo
11 11
 	<hr class="wp-header-end">
12 12
 	<?php
13 13
 
14
-	// Prepare Table of elements
15
-	$main_ingredient_list_table = new Main_Ingredient_List_Table();
16
-	$main_ingredient_list_table->prepare_items();
17
-	$main_ingredient_list_table->display();
18
-	?>
14
+    // Prepare Table of elements
15
+    $main_ingredient_list_table = new Main_Ingredient_List_Table();
16
+    $main_ingredient_list_table->prepare_items();
17
+    $main_ingredient_list_table->display();
18
+    ?>
19 19
 </div>
Please login to merge, or discard this patch.
include-exclude/includes/admin/partials/exclude-include-urls-page.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@
 block discarded – undo
2 2
 	<h2><?php echo esc_html__( 'Exclude / Include URLs', 'wordlift' ); ?></h2>
3 3
 	<form action='options.php' method='post'>
4 4
 		<?php
5
-		settings_fields( 'wl_exclude_include_urls_settings_group' );
6
-		do_settings_sections( 'wl_exclude_include_urls_settings_page' );
7
-		submit_button();
8
-		?>
5
+        settings_fields( 'wl_exclude_include_urls_settings_group' );
6
+        do_settings_sections( 'wl_exclude_include_urls_settings_page' );
7
+        submit_button();
8
+        ?>
9 9
 	</form>
10 10
 </div>
Please login to merge, or discard this patch.
src/modules/include-exclude/includes/admin/partials/field-1.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <p>
2 2
 	<label for="wl_exclude_include_urls_settings_urls">
3 3
 		<?php
4
-		echo sprintf(
5
-			'%s <code>%s</code>',
6
-			esc_html__( 'One relative or absolute URL per line. Relative URLs will be converted to absolute in context of', 'wordlift' ),
7
-			esc_url( site_url() )
8
-		);
9
-		?>
4
+        echo sprintf(
5
+            '%s <code>%s</code>',
6
+            esc_html__( 'One relative or absolute URL per line. Relative URLs will be converted to absolute in context of', 'wordlift' ),
7
+            esc_url( site_url() )
8
+        );
9
+        ?>
10 10
 	</label>
11 11
 </p>
12 12
 <p>
Please login to merge, or discard this patch.
src/modules/include-exclude/includes/admin/Settings.php 1 patch
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -14,89 +14,89 @@
 block discarded – undo
14 14
  */
15 15
 class Settings {
16 16
 
17
-	/**
18
-	 * Register hooks.
19
-	 */
20
-	public function register_hooks() {
21
-		if ( is_admin() ) {
22
-			add_action(
23
-				'plugins_loaded',
24
-				function () {
25
-					add_action( 'admin_menu', array( $this, 'register_sub_menu' ) );
26
-					add_action( 'admin_init', array( $this, 'register_setting' ) );
27
-				}
28
-			);
29
-		}
30
-	}
17
+    /**
18
+     * Register hooks.
19
+     */
20
+    public function register_hooks() {
21
+        if ( is_admin() ) {
22
+            add_action(
23
+                'plugins_loaded',
24
+                function () {
25
+                    add_action( 'admin_menu', array( $this, 'register_sub_menu' ) );
26
+                    add_action( 'admin_init', array( $this, 'register_setting' ) );
27
+                }
28
+            );
29
+        }
30
+    }
31 31
 
32
-	/**
33
-	 * Register submenu.
34
-	 */
35
-	public function register_sub_menu() {
36
-		add_submenu_page(
37
-			'wl_admin_menu',
38
-			__( 'Exclude Include URLs', 'wordlift' ),
39
-			__( 'Exclude Include URLs', 'wordlift' ),
40
-			'manage_options',
41
-			'wl_exclude_include_urls_menu',
42
-			array( $this, 'submenu_page_callback' )
43
-		);
44
-	}
32
+    /**
33
+     * Register submenu.
34
+     */
35
+    public function register_sub_menu() {
36
+        add_submenu_page(
37
+            'wl_admin_menu',
38
+            __( 'Exclude Include URLs', 'wordlift' ),
39
+            __( 'Exclude Include URLs', 'wordlift' ),
40
+            'manage_options',
41
+            'wl_exclude_include_urls_menu',
42
+            array( $this, 'submenu_page_callback' )
43
+        );
44
+    }
45 45
 
46
-	/**
47
-	 * Register settings.
48
-	 */
49
-	public function register_setting() {
50
-		register_setting( 'wl_exclude_include_urls_settings_group', 'wl_exclude_include_urls_settings' );
51
-		add_settings_section(
52
-			'wl_exclude_include_urls_settings_section_0',
53
-			__( 'URL filter type, list of URLs', 'wordlift' ),
54
-			array( $this, 'settings_section_callback' ),
55
-			'wl_exclude_include_urls_settings_page'
56
-		);
46
+    /**
47
+     * Register settings.
48
+     */
49
+    public function register_setting() {
50
+        register_setting( 'wl_exclude_include_urls_settings_group', 'wl_exclude_include_urls_settings' );
51
+        add_settings_section(
52
+            'wl_exclude_include_urls_settings_section_0',
53
+            __( 'URL filter type, list of URLs', 'wordlift' ),
54
+            array( $this, 'settings_section_callback' ),
55
+            'wl_exclude_include_urls_settings_page'
56
+        );
57 57
 
58
-		add_settings_field(
59
-			'wl_exclude_include_urls_field_0',
60
-			__( 'URLs filter type', 'wordlift' ),
61
-			array( $this, 'settings_field_0_render' ),
62
-			'wl_exclude_include_urls_settings_page',
63
-			'wl_exclude_include_urls_settings_section_0'
64
-		);
58
+        add_settings_field(
59
+            'wl_exclude_include_urls_field_0',
60
+            __( 'URLs filter type', 'wordlift' ),
61
+            array( $this, 'settings_field_0_render' ),
62
+            'wl_exclude_include_urls_settings_page',
63
+            'wl_exclude_include_urls_settings_section_0'
64
+        );
65 65
 
66
-		add_settings_field(
67
-			'wl_exclude_include_urls_field_1',
68
-			__( 'List of URLs', 'wordlift' ),
69
-			array( $this, 'settings_field_1_render' ),
70
-			'wl_exclude_include_urls_settings_page',
71
-			'wl_exclude_include_urls_settings_section_0'
72
-		);
73
-	}
66
+        add_settings_field(
67
+            'wl_exclude_include_urls_field_1',
68
+            __( 'List of URLs', 'wordlift' ),
69
+            array( $this, 'settings_field_1_render' ),
70
+            'wl_exclude_include_urls_settings_page',
71
+            'wl_exclude_include_urls_settings_section_0'
72
+        );
73
+    }
74 74
 
75
-	public function settings_section_callback() {
76
-		echo esc_html__( 'Select a URL filter type, and add list of URLs to selective active from WordLift\'s JSON-LD', 'wordlift' );
77
-	}
75
+    public function settings_section_callback() {
76
+        echo esc_html__( 'Select a URL filter type, and add list of URLs to selective active from WordLift\'s JSON-LD', 'wordlift' );
77
+    }
78 78
 
79
-	/**
80
-	 * Callback function for settings field rendering.
81
-	 */
82
-	public function settings_field_0_render() {
83
-		$options = get_option( 'wl_exclude_include_urls_settings' ); // phpcs:ignore
84
-		include plugin_dir_path( __FILE__ ) . 'partials/field-0.php';
85
-	}
79
+    /**
80
+     * Callback function for settings field rendering.
81
+     */
82
+    public function settings_field_0_render() {
83
+        $options = get_option( 'wl_exclude_include_urls_settings' ); // phpcs:ignore
84
+        include plugin_dir_path( __FILE__ ) . 'partials/field-0.php';
85
+    }
86 86
 
87
-	/**
88
-	 * Callback function for settings field rendering.
89
-	 */
90
-	public function settings_field_1_render() {
91
-		$options = get_option( 'wl_exclude_include_urls_settings' ); // phpcs:ignore
92
-		include plugin_dir_path( __FILE__ ) . 'partials/field-1.php';
93
-	}
87
+    /**
88
+     * Callback function for settings field rendering.
89
+     */
90
+    public function settings_field_1_render() {
91
+        $options = get_option( 'wl_exclude_include_urls_settings' ); // phpcs:ignore
92
+        include plugin_dir_path( __FILE__ ) . 'partials/field-1.php';
93
+    }
94 94
 
95
-	/**
96
-	 * Callback function for Exclude Include URLs submenu page.
97
-	 */
98
-	public function submenu_page_callback() {
99
-		include plugin_dir_path( __FILE__ ) . 'partials/exclude-include-urls-page.php';
100
-	}
95
+    /**
96
+     * Callback function for Exclude Include URLs submenu page.
97
+     */
98
+    public function submenu_page_callback() {
99
+        include plugin_dir_path( __FILE__ ) . 'partials/exclude-include-urls-page.php';
100
+    }
101 101
 
102 102
 }
Please login to merge, or discard this patch.
src/modules/food-kg/load.php 1 patch
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -20,83 +20,83 @@
 block discarded – undo
20 20
 use Wordlift\Task\Background\Background_Task_Route;
21 21
 
22 22
 if ( ! defined( 'ABSPATH' ) ) {
23
-	exit;
23
+    exit;
24 24
 }
25 25
 
26 26
 define( 'WL_FOOD_KG_FILE', __FILE__ );
27 27
 define( 'WL_FOOD_KG_DIR_PATH', dirname( WL_FOOD_KG_FILE ) );
28 28
 
29 29
 function __wl_foodkg__load() {
30
-	// Autoloader for dependencies.
31
-	if ( file_exists( WL_FOOD_KG_DIR_PATH . '/third-party/vendor/scoper-autoload.php' ) ) {
32
-		require WL_FOOD_KG_DIR_PATH . '/third-party/vendor/scoper-autoload.php';
33
-	}
34
-
35
-	// Autoloader for plugin itself.
36
-	if ( file_exists( WL_FOOD_KG_DIR_PATH . '/includes/vendor/autoload.php' ) ) {
37
-		require WL_FOOD_KG_DIR_PATH . '/includes/vendor/autoload.php';
38
-	}
39
-
40
-	$container_builder = new ContainerBuilder();
41
-	$loader            = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) );
42
-	$loader->load( 'services.yml' );
43
-	$container_builder->compile();
44
-
45
-	$notices = $container_builder->get( 'Wordlift\Modules\Food_Kg\Notices' );
46
-	$notices->register_hooks();
47
-
48
-	/**
49
-	 * @var Preconditions $preconditions
50
-	 */
51
-	$preconditions = $container_builder->get( 'Wordlift\Modules\Food_Kg\Preconditions' );
52
-	if ( ! $preconditions->pass() ) {
53
-		return;
54
-	}
55
-
56
-	// Meta Box.
57
-	$meta_box = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Meta_Box' );
58
-	$meta_box->register_hooks();
59
-
60
-	$module = $container_builder->get( 'Wordlift\Modules\Food_Kg\Module' );
61
-	$module->register_hooks();
62
-
63
-	/** @var Jsonld $jsonld */
64
-	$jsonld = $container_builder->get( 'Wordlift\Modules\Food_Kg\Jsonld' );
65
-	$jsonld->register_hooks();
66
-
67
-	/**
68
-	 * Ingredients API.
69
-	 */
70
-	$ingredients_api = $container_builder->get( 'Wordlift\Modules\Food_Kg\Ingredients_API' );
71
-	$ingredients_api->register_hooks();
72
-
73
-	/** @var Main_Ingredient_Jsonld $jsonld */
74
-	$main_ingredient_jsonld = $container_builder->get( 'Wordlift\Modules\Food_Kg\Main_Ingredient_Jsonld' );
75
-	$main_ingredient_jsonld->register_hooks();
76
-
77
-	/** Prepare the background task. */
78
-	$main_ingredient_recipe_lift = $container_builder->get( 'Wordlift\Modules\Food_Kg\Main_Ingredient_Recipe_Lift_Strategy' );
79
-	$task                        = new All_Posts_Task(
80
-		array(
81
-			$main_ingredient_recipe_lift,
82
-			'process',
83
-		),
84
-		'wprm_recipe',
85
-		'sync-main-ingredient'
86
-	);
87
-	$background_task             = Background_Task::create( $task );
88
-	$background_task_route       = Background_Task_Route::create( $background_task, '/main-ingredient' );
89
-	Background_Task_Page::create( __( 'Synchronize Main Ingredient', 'wordlift' ), 'sync-main-ingredient', $background_task_route );
90
-
91
-	if ( is_admin() ) {
92
-		$page = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Page' );
93
-		$page->register_hooks();
94
-
95
-		// Download Ingredients Data.
96
-		$download_ingredients_data = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Download_Ingredients_Data' );
97
-		$download_ingredients_data->register_hooks();
98
-
99
-	}
30
+    // Autoloader for dependencies.
31
+    if ( file_exists( WL_FOOD_KG_DIR_PATH . '/third-party/vendor/scoper-autoload.php' ) ) {
32
+        require WL_FOOD_KG_DIR_PATH . '/third-party/vendor/scoper-autoload.php';
33
+    }
34
+
35
+    // Autoloader for plugin itself.
36
+    if ( file_exists( WL_FOOD_KG_DIR_PATH . '/includes/vendor/autoload.php' ) ) {
37
+        require WL_FOOD_KG_DIR_PATH . '/includes/vendor/autoload.php';
38
+    }
39
+
40
+    $container_builder = new ContainerBuilder();
41
+    $loader            = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) );
42
+    $loader->load( 'services.yml' );
43
+    $container_builder->compile();
44
+
45
+    $notices = $container_builder->get( 'Wordlift\Modules\Food_Kg\Notices' );
46
+    $notices->register_hooks();
47
+
48
+    /**
49
+     * @var Preconditions $preconditions
50
+     */
51
+    $preconditions = $container_builder->get( 'Wordlift\Modules\Food_Kg\Preconditions' );
52
+    if ( ! $preconditions->pass() ) {
53
+        return;
54
+    }
55
+
56
+    // Meta Box.
57
+    $meta_box = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Meta_Box' );
58
+    $meta_box->register_hooks();
59
+
60
+    $module = $container_builder->get( 'Wordlift\Modules\Food_Kg\Module' );
61
+    $module->register_hooks();
62
+
63
+    /** @var Jsonld $jsonld */
64
+    $jsonld = $container_builder->get( 'Wordlift\Modules\Food_Kg\Jsonld' );
65
+    $jsonld->register_hooks();
66
+
67
+    /**
68
+     * Ingredients API.
69
+     */
70
+    $ingredients_api = $container_builder->get( 'Wordlift\Modules\Food_Kg\Ingredients_API' );
71
+    $ingredients_api->register_hooks();
72
+
73
+    /** @var Main_Ingredient_Jsonld $jsonld */
74
+    $main_ingredient_jsonld = $container_builder->get( 'Wordlift\Modules\Food_Kg\Main_Ingredient_Jsonld' );
75
+    $main_ingredient_jsonld->register_hooks();
76
+
77
+    /** Prepare the background task. */
78
+    $main_ingredient_recipe_lift = $container_builder->get( 'Wordlift\Modules\Food_Kg\Main_Ingredient_Recipe_Lift_Strategy' );
79
+    $task                        = new All_Posts_Task(
80
+        array(
81
+            $main_ingredient_recipe_lift,
82
+            'process',
83
+        ),
84
+        'wprm_recipe',
85
+        'sync-main-ingredient'
86
+    );
87
+    $background_task             = Background_Task::create( $task );
88
+    $background_task_route       = Background_Task_Route::create( $background_task, '/main-ingredient' );
89
+    Background_Task_Page::create( __( 'Synchronize Main Ingredient', 'wordlift' ), 'sync-main-ingredient', $background_task_route );
90
+
91
+    if ( is_admin() ) {
92
+        $page = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Page' );
93
+        $page->register_hooks();
94
+
95
+        // Download Ingredients Data.
96
+        $download_ingredients_data = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Download_Ingredients_Data' );
97
+        $download_ingredients_data->register_hooks();
98
+
99
+    }
100 100
 }
101 101
 
102 102
 add_action( 'plugins_loaded', '__wl_foodkg__load' );
Please login to merge, or discard this patch.
src/modules/food-kg/includes/services/Ingredients.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -9,18 +9,18 @@  discard block
 block discarded – undo
9 9
 
10 10
 class Ingredients {
11 11
 
12
-	/**
13
-	 * Get Ingredients Data.
14
-	 *
15
-	 * @param int $limit The number of items to return.
16
-	 * @param int $offset The offset.
17
-	 */
18
-	public function get_data( $limit = 20, $offset = 0 ) {
19
-		global $wpdb;
12
+    /**
13
+     * Get Ingredients Data.
14
+     *
15
+     * @param int $limit The number of items to return.
16
+     * @param int $offset The offset.
17
+     */
18
+    public function get_data( $limit = 20, $offset = 0 ) {
19
+        global $wpdb;
20 20
 
21
-		$ingredients = $wpdb->get_results(
22
-			$wpdb->prepare(
23
-				"SELECT p1.ID AS recipe_ID,
21
+        $ingredients = $wpdb->get_results(
22
+            $wpdb->prepare(
23
+                "SELECT p1.ID AS recipe_ID,
24 24
 						p1.post_title AS recipe_name,
25 25
 						p2.ID AS post_ID,
26 26
 						p2.post_title
@@ -30,39 +30,39 @@  discard block
 block discarded – undo
30 30
 							INNER JOIN $wpdb->postmeta pm2
31 31
 								ON pm2.post_ID = pm1.post_ID AND pm2.meta_key = 'wprm_parent_post_id'
32 32
 							INNER JOIN $wpdb->posts p2"
33
-				// The following ignore rule is used against the `LIKE CONCAT`. We only have const values.
34
-				// phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.LikeWildcardsInQuery
35
-				. " ON p2.post_status = 'publish' AND p2.ID = pm2.meta_value
33
+                // The following ignore rule is used against the `LIKE CONCAT`. We only have const values.
34
+                // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.LikeWildcardsInQuery
35
+                . " ON p2.post_status = 'publish' AND p2.ID = pm2.meta_value
36 36
 							WHERE pm1.meta_key = '_wl_main_ingredient_jsonld'
37 37
 					LIMIT %d
38 38
 					OFFSET %d",
39
-				$limit,
40
-				$offset
41
-			)
42
-		);
39
+                $limit,
40
+                $offset
41
+            )
42
+        );
43 43
 
44
-		if ( empty( $ingredients ) ) {
45
-			return new \WP_Error( 'no_ingredients', __( 'No ingredients found.', 'wordlift' ), array( 'status' => 404 ) );
46
-		}
44
+        if ( empty( $ingredients ) ) {
45
+            return new \WP_Error( 'no_ingredients', __( 'No ingredients found.', 'wordlift' ), array( 'status' => 404 ) );
46
+        }
47 47
 
48
-		$data = array();
49
-		foreach ( $ingredients as $ingredient ) {
50
-			$recipe_json_ld = get_post_meta( $ingredient->recipe_ID, '_wl_main_ingredient_jsonld', true ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
51
-			$recipe         = json_decode( $recipe_json_ld, true );
48
+        $data = array();
49
+        foreach ( $ingredients as $ingredient ) {
50
+            $recipe_json_ld = get_post_meta( $ingredient->recipe_ID, '_wl_main_ingredient_jsonld', true ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
51
+            $recipe         = json_decode( $recipe_json_ld, true );
52 52
 
53
-			// phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
54
-			$data[] = array(
55
-				'main_ingredient_item_id' => $recipe ? $recipe['@id'] : null,
56
-				'main_ingredient_name'    => $recipe ? $recipe['name'] : null,
57
-				'recipe_id'               => (int) $ingredient->recipe_ID,
58
-				'recipe_name'             => htmlspecialchars_decode( $ingredient->recipe_name ),
59
-				'post_id'                 => (int) $ingredient->post_ID,
60
-				'post_name'               => $ingredient->post_title,
61
-				'post_url'                => get_the_permalink( $ingredient->post_ID ),
62
-			);
63
-			// phpcs:enable
64
-		}
53
+            // phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
54
+            $data[] = array(
55
+                'main_ingredient_item_id' => $recipe ? $recipe['@id'] : null,
56
+                'main_ingredient_name'    => $recipe ? $recipe['name'] : null,
57
+                'recipe_id'               => (int) $ingredient->recipe_ID,
58
+                'recipe_name'             => htmlspecialchars_decode( $ingredient->recipe_name ),
59
+                'post_id'                 => (int) $ingredient->post_ID,
60
+                'post_name'               => $ingredient->post_title,
61
+                'post_url'                => get_the_permalink( $ingredient->post_ID ),
62
+            );
63
+            // phpcs:enable
64
+        }
65 65
 
66
-		return $data;
67
-	}
66
+        return $data;
67
+    }
68 68
 }
Please login to merge, or discard this patch.
src/wordlift/no-editor-analysis/class-no-editor-analysis-feature.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -11,56 +11,56 @@
 block discarded – undo
11 11
 
12 12
 class No_Editor_Analysis_Feature {
13 13
 
14
-	public static function can_no_editor_analysis_be_used( $post_id ) {
15
-		// If post id is falsy then dont do other checks, this necessary because get_post_type will return false
16
-		// when the post_id is 0  and inverting it would turn on this feature.
17
-		if ( ! $post_id ) {
18
-			return false;
19
-		}
14
+    public static function can_no_editor_analysis_be_used( $post_id ) {
15
+        // If post id is falsy then dont do other checks, this necessary because get_post_type will return false
16
+        // when the post_id is 0  and inverting it would turn on this feature.
17
+        if ( ! $post_id ) {
18
+            return false;
19
+        }
20 20
 
21
-		// phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
22
-		return apply_filters( 'wl_feature__enable__no-editor-analysis', false )
23
-			&& (
24
-				// If the post doesnt have `editor` attribute
25
-				Post_Type::is_no_editor_analysis_enabled_for_post_type( get_post_type( $post_id ) )
26
-				// check if Divi is enabled, then we can use no editor analysis.
27
-				|| self::is_divi_page_builder_enabled( $post_id )
28
-				// Check if elementor is enabled, then we can use no editor analysis.
29
-				|| self::is_elementor_enabled( $post_id )
30
-				// Check if WP Bakery is enabled, then we can use no editor analysis.
31
-				|| self::is_wp_bakery_enabled( $post_id )
32
-				// Custom builders can hook in to this filter to enable no editor analysis.
33
-				/**
34
-				* @param $post_id
35
-				*
36
-				* @return bool | False by default.
37
-				* @since 3.33.0
38
-				* Filter name : wl_no_editor_analysis_should_be_enabled_for_post_id
39
-				*/
40
-				|| apply_filters( 'wl_no_editor_analysis_should_be_enabled_for_post_id', false, $post_id )
41
-			);
42
-	}
21
+        // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
22
+        return apply_filters( 'wl_feature__enable__no-editor-analysis', false )
23
+            && (
24
+                // If the post doesnt have `editor` attribute
25
+                Post_Type::is_no_editor_analysis_enabled_for_post_type( get_post_type( $post_id ) )
26
+                // check if Divi is enabled, then we can use no editor analysis.
27
+                || self::is_divi_page_builder_enabled( $post_id )
28
+                // Check if elementor is enabled, then we can use no editor analysis.
29
+                || self::is_elementor_enabled( $post_id )
30
+                // Check if WP Bakery is enabled, then we can use no editor analysis.
31
+                || self::is_wp_bakery_enabled( $post_id )
32
+                // Custom builders can hook in to this filter to enable no editor analysis.
33
+                /**
34
+                 * @param $post_id
35
+                 *
36
+                 * @return bool | False by default.
37
+                 * @since 3.33.0
38
+                 * Filter name : wl_no_editor_analysis_should_be_enabled_for_post_id
39
+                 */
40
+                || apply_filters( 'wl_no_editor_analysis_should_be_enabled_for_post_id', false, $post_id )
41
+            );
42
+    }
43 43
 
44
-	private static function is_divi_page_builder_enabled( $post_id ) {
45
-		return function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id );
46
-	}
44
+    private static function is_divi_page_builder_enabled( $post_id ) {
45
+        return function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id );
46
+    }
47 47
 
48
-	private static function is_elementor_enabled( $post_id ) {
49
-		return defined( 'ELEMENTOR_VERSION' ) && get_post_meta( $post_id, '_elementor_edit_mode', true ) === 'builder';
50
-	}
48
+    private static function is_elementor_enabled( $post_id ) {
49
+        return defined( 'ELEMENTOR_VERSION' ) && get_post_meta( $post_id, '_elementor_edit_mode', true ) === 'builder';
50
+    }
51 51
 
52
-	private static function is_wp_bakery_enabled( $post_id ) {
53
-		$post_type = get_post_type( $post_id );
52
+    private static function is_wp_bakery_enabled( $post_id ) {
53
+        $post_type = get_post_type( $post_id );
54 54
 
55
-		if ( ! function_exists( 'vc_editor_post_types' ) ) {
56
-			return false;
57
-		}
55
+        if ( ! function_exists( 'vc_editor_post_types' ) ) {
56
+            return false;
57
+        }
58 58
 
59
-		try {
60
-			return in_array( $post_type, vc_editor_post_types(), true );
61
-		} catch ( \Exception $e ) {
62
-			return false;
63
-		}
64
-	}
59
+        try {
60
+            return in_array( $post_type, vc_editor_post_types(), true );
61
+        } catch ( \Exception $e ) {
62
+            return false;
63
+        }
64
+    }
65 65
 
66 66
 }
Please login to merge, or discard this patch.