Completed
Pull Request — develop (#1596)
by
unknown
01:10
created
src/modules/food-kg/includes/vendor/composer/autoload_static.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -6,36 +6,36 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInitbaaf547b24d2757395578581da934187
8 8
 {
9
-    public static $classMap = array (
10
-        'ComposerAutoloaderInitbaaf547b24d2757395578581da934187' => __DIR__ . '/..' . '/composer/autoload_real.php',
11
-        'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
12
-        'Wordlift\\Modules\\Food_Kg\\Admin\\Download_Ingredients_Data' => __DIR__ . '/../..' . '/admin/Download_Ingredients_Data.php',
13
-        'Wordlift\\Modules\\Food_Kg\\Admin\\Full_Page_Delegate' => __DIR__ . '/../..' . '/admin/Full_Page_Delegate.php',
14
-        'Wordlift\\Modules\\Food_Kg\\Admin\\Ingredients_List_Table' => __DIR__ . '/../..' . '/admin/Ingredients_List_Table.php',
15
-        'Wordlift\\Modules\\Food_Kg\\Admin\\Ingredients_Modal_Page_Delegate' => __DIR__ . '/../..' . '/admin/Ingredients_Modal_Page_Delegate.php',
16
-        'Wordlift\\Modules\\Food_Kg\\Admin\\Main_Ingredient_List_Table' => __DIR__ . '/../..' . '/admin/Main_Ingredient_List_Table.php',
17
-        'Wordlift\\Modules\\Food_Kg\\Admin\\Main_Ingredient_Modal_Page_Delegate' => __DIR__ . '/../..' . '/admin/Main_Ingredient_Modal_Page_Delegate.php',
18
-        'Wordlift\\Modules\\Food_Kg\\Admin\\Meta_Box' => __DIR__ . '/../..' . '/admin/Meta_Box.php',
19
-        'Wordlift\\Modules\\Food_Kg\\Admin\\Page' => __DIR__ . '/../..' . '/admin/Page.php',
20
-        'Wordlift\\Modules\\Food_Kg\\Admin\\Page_Delegate' => __DIR__ . '/../..' . '/admin/Page_Delegate.php',
21
-        'Wordlift\\Modules\\Food_Kg\\Ingredients' => __DIR__ . '/../..' . '/Ingredients.php',
22
-        'Wordlift\\Modules\\Food_Kg\\Ingredients_API' => __DIR__ . '/../..' . '/Ingredients_API.php',
23
-        'Wordlift\\Modules\\Food_Kg\\Ingredients_Client' => __DIR__ . '/../..' . '/Ingredients_Client.php',
24
-        'Wordlift\\Modules\\Food_Kg\\Ingredients_Taxonomy_Recipe_Lift_Strategy' => __DIR__ . '/../..' . '/Ingredients_Taxonomy_Recipe_Lift_Strategy.php',
25
-        'Wordlift\\Modules\\Food_Kg\\Jsonld' => __DIR__ . '/../..' . '/Jsonld.php',
26
-        'Wordlift\\Modules\\Food_Kg\\Main_Ingredient_Jsonld' => __DIR__ . '/../..' . '/Main_Ingredient_Jsonld.php',
27
-        'Wordlift\\Modules\\Food_Kg\\Main_Ingredient_Recipe_Lift_Strategy' => __DIR__ . '/../..' . '/Main_Ingredient_Recipe_Lift_Strategy.php',
28
-        'Wordlift\\Modules\\Food_Kg\\Module' => __DIR__ . '/../..' . '/Module.php',
29
-        'Wordlift\\Modules\\Food_Kg\\Notices' => __DIR__ . '/../..' . '/Notices.php',
30
-        'Wordlift\\Modules\\Food_Kg\\Preconditions' => __DIR__ . '/../..' . '/Preconditions.php',
31
-        'Wordlift\\Modules\\Food_Kg\\Recipe_Lift_Strategy' => __DIR__ . '/../..' . '/Recipe_Lift_Strategy.php',
32
-        'Wordlift_Modules_Food_Kg_Composer\\Autoload\\ClassLoader' => __DIR__ . '/..' . '/composer/ClassLoader.php',
33
-        'Wordlift_Modules_Food_Kg_Composer\\Autoload\\ComposerStaticInitbaaf547b24d2757395578581da934187' => __DIR__ . '/..' . '/composer/autoload_static.php',
9
+    public static $classMap = array(
10
+        'ComposerAutoloaderInitbaaf547b24d2757395578581da934187' => __DIR__.'/..'.'/composer/autoload_real.php',
11
+        'Composer\\InstalledVersions' => __DIR__.'/..'.'/composer/InstalledVersions.php',
12
+        'Wordlift\\Modules\\Food_Kg\\Admin\\Download_Ingredients_Data' => __DIR__.'/../..'.'/admin/Download_Ingredients_Data.php',
13
+        'Wordlift\\Modules\\Food_Kg\\Admin\\Full_Page_Delegate' => __DIR__.'/../..'.'/admin/Full_Page_Delegate.php',
14
+        'Wordlift\\Modules\\Food_Kg\\Admin\\Ingredients_List_Table' => __DIR__.'/../..'.'/admin/Ingredients_List_Table.php',
15
+        'Wordlift\\Modules\\Food_Kg\\Admin\\Ingredients_Modal_Page_Delegate' => __DIR__.'/../..'.'/admin/Ingredients_Modal_Page_Delegate.php',
16
+        'Wordlift\\Modules\\Food_Kg\\Admin\\Main_Ingredient_List_Table' => __DIR__.'/../..'.'/admin/Main_Ingredient_List_Table.php',
17
+        'Wordlift\\Modules\\Food_Kg\\Admin\\Main_Ingredient_Modal_Page_Delegate' => __DIR__.'/../..'.'/admin/Main_Ingredient_Modal_Page_Delegate.php',
18
+        'Wordlift\\Modules\\Food_Kg\\Admin\\Meta_Box' => __DIR__.'/../..'.'/admin/Meta_Box.php',
19
+        'Wordlift\\Modules\\Food_Kg\\Admin\\Page' => __DIR__.'/../..'.'/admin/Page.php',
20
+        'Wordlift\\Modules\\Food_Kg\\Admin\\Page_Delegate' => __DIR__.'/../..'.'/admin/Page_Delegate.php',
21
+        'Wordlift\\Modules\\Food_Kg\\Ingredients' => __DIR__.'/../..'.'/Ingredients.php',
22
+        'Wordlift\\Modules\\Food_Kg\\Ingredients_API' => __DIR__.'/../..'.'/Ingredients_API.php',
23
+        'Wordlift\\Modules\\Food_Kg\\Ingredients_Client' => __DIR__.'/../..'.'/Ingredients_Client.php',
24
+        'Wordlift\\Modules\\Food_Kg\\Ingredients_Taxonomy_Recipe_Lift_Strategy' => __DIR__.'/../..'.'/Ingredients_Taxonomy_Recipe_Lift_Strategy.php',
25
+        'Wordlift\\Modules\\Food_Kg\\Jsonld' => __DIR__.'/../..'.'/Jsonld.php',
26
+        'Wordlift\\Modules\\Food_Kg\\Main_Ingredient_Jsonld' => __DIR__.'/../..'.'/Main_Ingredient_Jsonld.php',
27
+        'Wordlift\\Modules\\Food_Kg\\Main_Ingredient_Recipe_Lift_Strategy' => __DIR__.'/../..'.'/Main_Ingredient_Recipe_Lift_Strategy.php',
28
+        'Wordlift\\Modules\\Food_Kg\\Module' => __DIR__.'/../..'.'/Module.php',
29
+        'Wordlift\\Modules\\Food_Kg\\Notices' => __DIR__.'/../..'.'/Notices.php',
30
+        'Wordlift\\Modules\\Food_Kg\\Preconditions' => __DIR__.'/../..'.'/Preconditions.php',
31
+        'Wordlift\\Modules\\Food_Kg\\Recipe_Lift_Strategy' => __DIR__.'/../..'.'/Recipe_Lift_Strategy.php',
32
+        'Wordlift_Modules_Food_Kg_Composer\\Autoload\\ClassLoader' => __DIR__.'/..'.'/composer/ClassLoader.php',
33
+        'Wordlift_Modules_Food_Kg_Composer\\Autoload\\ComposerStaticInitbaaf547b24d2757395578581da934187' => __DIR__.'/..'.'/composer/autoload_static.php',
34 34
     );
35 35
 
36 36
     public static function getInitializer(ClassLoader $loader)
37 37
     {
38
-        return \Closure::bind(function () use ($loader) {
38
+        return \Closure::bind(function() use ($loader) {
39 39
             $loader->classMap = ComposerStaticInitbaaf547b24d2757395578581da934187::$classMap;
40 40
 
41 41
         }, null, ClassLoader::class);
Please login to merge, or discard this patch.
src/modules/food-kg/includes/vendor/composer/autoload_classmap.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -6,28 +6,28 @@
 block discarded – undo
6 6
 $baseDir = dirname($vendorDir);
7 7
 
8 8
 return array(
9
-    'ComposerAutoloaderInitbaaf547b24d2757395578581da934187' => $vendorDir . '/composer/autoload_real.php',
10
-    'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
11
-    'Wordlift\\Modules\\Food_Kg\\Admin\\Download_Ingredients_Data' => $baseDir . '/admin/Download_Ingredients_Data.php',
12
-    'Wordlift\\Modules\\Food_Kg\\Admin\\Full_Page_Delegate' => $baseDir . '/admin/Full_Page_Delegate.php',
13
-    'Wordlift\\Modules\\Food_Kg\\Admin\\Ingredients_List_Table' => $baseDir . '/admin/Ingredients_List_Table.php',
14
-    'Wordlift\\Modules\\Food_Kg\\Admin\\Ingredients_Modal_Page_Delegate' => $baseDir . '/admin/Ingredients_Modal_Page_Delegate.php',
15
-    'Wordlift\\Modules\\Food_Kg\\Admin\\Main_Ingredient_List_Table' => $baseDir . '/admin/Main_Ingredient_List_Table.php',
16
-    'Wordlift\\Modules\\Food_Kg\\Admin\\Main_Ingredient_Modal_Page_Delegate' => $baseDir . '/admin/Main_Ingredient_Modal_Page_Delegate.php',
17
-    'Wordlift\\Modules\\Food_Kg\\Admin\\Meta_Box' => $baseDir . '/admin/Meta_Box.php',
18
-    'Wordlift\\Modules\\Food_Kg\\Admin\\Page' => $baseDir . '/admin/Page.php',
19
-    'Wordlift\\Modules\\Food_Kg\\Admin\\Page_Delegate' => $baseDir . '/admin/Page_Delegate.php',
20
-    'Wordlift\\Modules\\Food_Kg\\Ingredients' => $baseDir . '/Ingredients.php',
21
-    'Wordlift\\Modules\\Food_Kg\\Ingredients_API' => $baseDir . '/Ingredients_API.php',
22
-    'Wordlift\\Modules\\Food_Kg\\Ingredients_Client' => $baseDir . '/Ingredients_Client.php',
23
-    'Wordlift\\Modules\\Food_Kg\\Ingredients_Taxonomy_Recipe_Lift_Strategy' => $baseDir . '/Ingredients_Taxonomy_Recipe_Lift_Strategy.php',
24
-    'Wordlift\\Modules\\Food_Kg\\Jsonld' => $baseDir . '/Jsonld.php',
25
-    'Wordlift\\Modules\\Food_Kg\\Main_Ingredient_Jsonld' => $baseDir . '/Main_Ingredient_Jsonld.php',
26
-    'Wordlift\\Modules\\Food_Kg\\Main_Ingredient_Recipe_Lift_Strategy' => $baseDir . '/Main_Ingredient_Recipe_Lift_Strategy.php',
27
-    'Wordlift\\Modules\\Food_Kg\\Module' => $baseDir . '/Module.php',
28
-    'Wordlift\\Modules\\Food_Kg\\Notices' => $baseDir . '/Notices.php',
29
-    'Wordlift\\Modules\\Food_Kg\\Preconditions' => $baseDir . '/Preconditions.php',
30
-    'Wordlift\\Modules\\Food_Kg\\Recipe_Lift_Strategy' => $baseDir . '/Recipe_Lift_Strategy.php',
31
-    'Wordlift_Modules_Food_Kg_Composer\\Autoload\\ClassLoader' => $vendorDir . '/composer/ClassLoader.php',
32
-    'Wordlift_Modules_Food_Kg_Composer\\Autoload\\ComposerStaticInitbaaf547b24d2757395578581da934187' => $vendorDir . '/composer/autoload_static.php',
9
+    'ComposerAutoloaderInitbaaf547b24d2757395578581da934187' => $vendorDir.'/composer/autoload_real.php',
10
+    'Composer\\InstalledVersions' => $vendorDir.'/composer/InstalledVersions.php',
11
+    'Wordlift\\Modules\\Food_Kg\\Admin\\Download_Ingredients_Data' => $baseDir.'/admin/Download_Ingredients_Data.php',
12
+    'Wordlift\\Modules\\Food_Kg\\Admin\\Full_Page_Delegate' => $baseDir.'/admin/Full_Page_Delegate.php',
13
+    'Wordlift\\Modules\\Food_Kg\\Admin\\Ingredients_List_Table' => $baseDir.'/admin/Ingredients_List_Table.php',
14
+    'Wordlift\\Modules\\Food_Kg\\Admin\\Ingredients_Modal_Page_Delegate' => $baseDir.'/admin/Ingredients_Modal_Page_Delegate.php',
15
+    'Wordlift\\Modules\\Food_Kg\\Admin\\Main_Ingredient_List_Table' => $baseDir.'/admin/Main_Ingredient_List_Table.php',
16
+    'Wordlift\\Modules\\Food_Kg\\Admin\\Main_Ingredient_Modal_Page_Delegate' => $baseDir.'/admin/Main_Ingredient_Modal_Page_Delegate.php',
17
+    'Wordlift\\Modules\\Food_Kg\\Admin\\Meta_Box' => $baseDir.'/admin/Meta_Box.php',
18
+    'Wordlift\\Modules\\Food_Kg\\Admin\\Page' => $baseDir.'/admin/Page.php',
19
+    'Wordlift\\Modules\\Food_Kg\\Admin\\Page_Delegate' => $baseDir.'/admin/Page_Delegate.php',
20
+    'Wordlift\\Modules\\Food_Kg\\Ingredients' => $baseDir.'/Ingredients.php',
21
+    'Wordlift\\Modules\\Food_Kg\\Ingredients_API' => $baseDir.'/Ingredients_API.php',
22
+    'Wordlift\\Modules\\Food_Kg\\Ingredients_Client' => $baseDir.'/Ingredients_Client.php',
23
+    'Wordlift\\Modules\\Food_Kg\\Ingredients_Taxonomy_Recipe_Lift_Strategy' => $baseDir.'/Ingredients_Taxonomy_Recipe_Lift_Strategy.php',
24
+    'Wordlift\\Modules\\Food_Kg\\Jsonld' => $baseDir.'/Jsonld.php',
25
+    'Wordlift\\Modules\\Food_Kg\\Main_Ingredient_Jsonld' => $baseDir.'/Main_Ingredient_Jsonld.php',
26
+    'Wordlift\\Modules\\Food_Kg\\Main_Ingredient_Recipe_Lift_Strategy' => $baseDir.'/Main_Ingredient_Recipe_Lift_Strategy.php',
27
+    'Wordlift\\Modules\\Food_Kg\\Module' => $baseDir.'/Module.php',
28
+    'Wordlift\\Modules\\Food_Kg\\Notices' => $baseDir.'/Notices.php',
29
+    'Wordlift\\Modules\\Food_Kg\\Preconditions' => $baseDir.'/Preconditions.php',
30
+    'Wordlift\\Modules\\Food_Kg\\Recipe_Lift_Strategy' => $baseDir.'/Recipe_Lift_Strategy.php',
31
+    'Wordlift_Modules_Food_Kg_Composer\\Autoload\\ClassLoader' => $vendorDir.'/composer/ClassLoader.php',
32
+    'Wordlift_Modules_Food_Kg_Composer\\Autoload\\ComposerStaticInitbaaf547b24d2757395578581da934187' => $vendorDir.'/composer/autoload_static.php',
33 33
 );
Please login to merge, or discard this patch.
src/modules/food-kg/load.php 2 patches
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.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -19,63 +19,63 @@  discard block
 block discarded – undo
19 19
 use Wordlift\Task\Background\Background_Task_Page;
20 20
 use Wordlift\Task\Background\Background_Task_Route;
21 21
 
22
-if ( ! defined( 'ABSPATH' ) ) {
22
+if ( ! defined('ABSPATH')) {
23 23
 	exit;
24 24
 }
25 25
 
26
-define( 'WL_FOOD_KG_FILE', __FILE__ );
27
-define( 'WL_FOOD_KG_DIR_PATH', dirname( WL_FOOD_KG_FILE ) );
26
+define('WL_FOOD_KG_FILE', __FILE__);
27
+define('WL_FOOD_KG_DIR_PATH', dirname(WL_FOOD_KG_FILE));
28 28
 
29 29
 function __wl_foodkg__load() {
30 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';
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 33
 	}
34 34
 
35 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';
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 38
 	}
39 39
 
40 40
 	$container_builder = new ContainerBuilder();
41
-	$loader            = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) );
42
-	$loader->load( 'services.yml' );
41
+	$loader            = new YamlFileLoader($container_builder, new FileLocator(__DIR__));
42
+	$loader->load('services.yml');
43 43
 	$container_builder->compile();
44 44
 
45
-	$notices = $container_builder->get( 'Wordlift\Modules\Food_Kg\Notices' );
45
+	$notices = $container_builder->get('Wordlift\Modules\Food_Kg\Notices');
46 46
 	$notices->register_hooks();
47 47
 
48 48
 	/**
49 49
 	 * @var Preconditions $preconditions
50 50
 	 */
51
-	$preconditions = $container_builder->get( 'Wordlift\Modules\Food_Kg\Preconditions' );
52
-	if ( ! $preconditions->pass() ) {
51
+	$preconditions = $container_builder->get('Wordlift\Modules\Food_Kg\Preconditions');
52
+	if ( ! $preconditions->pass()) {
53 53
 		return;
54 54
 	}
55 55
 
56 56
 	// Meta Box.
57
-	$meta_box = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Meta_Box' );
57
+	$meta_box = $container_builder->get('Wordlift\Modules\Food_Kg\Admin\Meta_Box');
58 58
 	$meta_box->register_hooks();
59 59
 
60
-	$module = $container_builder->get( 'Wordlift\Modules\Food_Kg\Module' );
60
+	$module = $container_builder->get('Wordlift\Modules\Food_Kg\Module');
61 61
 	$module->register_hooks();
62 62
 
63 63
 	/** @var Jsonld $jsonld */
64
-	$jsonld = $container_builder->get( 'Wordlift\Modules\Food_Kg\Jsonld' );
64
+	$jsonld = $container_builder->get('Wordlift\Modules\Food_Kg\Jsonld');
65 65
 	$jsonld->register_hooks();
66 66
 
67 67
 	/**
68 68
 	 * Ingredients API.
69 69
 	 */
70
-	$ingredients_api = $container_builder->get( 'Wordlift\Modules\Food_Kg\Ingredients_API' );
70
+	$ingredients_api = $container_builder->get('Wordlift\Modules\Food_Kg\Ingredients_API');
71 71
 	$ingredients_api->register_hooks();
72 72
 
73 73
 	/** @var Main_Ingredient_Jsonld $jsonld */
74
-	$main_ingredient_jsonld = $container_builder->get( 'Wordlift\Modules\Food_Kg\Main_Ingredient_Jsonld' );
74
+	$main_ingredient_jsonld = $container_builder->get('Wordlift\Modules\Food_Kg\Main_Ingredient_Jsonld');
75 75
 	$main_ingredient_jsonld->register_hooks();
76 76
 
77 77
 	/** Prepare the background task. */
78
-	$main_ingredient_recipe_lift = $container_builder->get( 'Wordlift\Modules\Food_Kg\Main_Ingredient_Recipe_Lift_Strategy' );
78
+	$main_ingredient_recipe_lift = $container_builder->get('Wordlift\Modules\Food_Kg\Main_Ingredient_Recipe_Lift_Strategy');
79 79
 	$task                        = new All_Posts_Task(
80 80
 		array(
81 81
 			$main_ingredient_recipe_lift,
@@ -84,20 +84,20 @@  discard block
 block discarded – undo
84 84
 		'wprm_recipe',
85 85
 		'sync-main-ingredient'
86 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 );
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 90
 
91
-	if ( is_admin() ) {
92
-		$page = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Page' );
91
+	if (is_admin()) {
92
+		$page = $container_builder->get('Wordlift\Modules\Food_Kg\Admin\Page');
93 93
 		$page->register_hooks();
94 94
 
95 95
 		// Download Ingredients Data.
96
-		$download_ingredients_data = $container_builder->get( 'Wordlift\Modules\Food_Kg\Admin\Download_Ingredients_Data' );
96
+		$download_ingredients_data = $container_builder->get('Wordlift\Modules\Food_Kg\Admin\Download_Ingredients_Data');
97 97
 		$download_ingredients_data->register_hooks();
98 98
 
99 99
 	}
100 100
 }
101 101
 
102
-add_action( 'plugins_loaded', '__wl_foodkg__load' );
102
+add_action('plugins_loaded', '__wl_foodkg__load');
103 103
 
Please login to merge, or discard this patch.
src/modules/food-kg/includes/Ingredients_API.php 2 patches
Indentation   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -4,61 +4,61 @@  discard block
 block discarded – undo
4 4
 
5 5
 class Ingredients_API {
6 6
 
7
-	public function register_hooks() {
8
-		add_action( 'rest_api_init', array( $this, 'register_routes' ) );
9
-	}
10
-
11
-	public function register_routes() {
12
-		register_rest_route(
13
-			WL_REST_ROUTE_DEFAULT_NAMESPACE,
14
-			'/ingredients',
15
-			array(
16
-				'methods'             => \WP_REST_Server::READABLE,
17
-				'callback'            => array( $this, 'get_ingredients' ),
18
-				'permission_callback' => '__return_true',
19
-				// 'permission_callback' => function () {
20
-				//     return current_user_can( 'manage_options' );
21
-				// },
22
-				'args'                => array(
23
-					'per_page' => array(
24
-						'type'              => 'integer',
25
-						'validate_callback' => 'rest_validate_request_arg',
26
-						'default'           => 20,
27
-						'minimum'           => 1,
28
-						'maximum'           => 100,
29
-						'sanitize_callback' => 'absint',
30
-					),
31
-					'page'     => array(
32
-						'type'              => 'integer',
33
-						'validate_callback' => 'rest_validate_request_arg',
34
-						'default'           => 1,
35
-						'sanitize_callback' => 'absint',
36
-					),
37
-					'offset'   => array(
38
-						'type'              => 'integer',
39
-						'validate_callback' => 'rest_validate_request_arg',
40
-						'sanitize_callback' => 'absint',
41
-					),
42
-				),
43
-			)
44
-		);
45
-	}
46
-
47
-	public function get_ingredients( \WP_REST_Request $request ) {
48
-		$per_page = $request['per_page'];
49
-		$page     = $request['page'];
50
-		$offset   = $request['offset'];
51
-
52
-		global $wpdb;
53
-
54
-		if ( isset( $offset ) ) {
55
-			$offset = (int) $offset;
56
-		} else {
57
-			$offset = ( $page - 1 ) * $per_page;
58
-		}
59
-
60
-		$sql =
61
-			"SELECT p1.ID AS recipe_id,
7
+    public function register_hooks() {
8
+        add_action( 'rest_api_init', array( $this, 'register_routes' ) );
9
+    }
10
+
11
+    public function register_routes() {
12
+        register_rest_route(
13
+            WL_REST_ROUTE_DEFAULT_NAMESPACE,
14
+            '/ingredients',
15
+            array(
16
+                'methods'             => \WP_REST_Server::READABLE,
17
+                'callback'            => array( $this, 'get_ingredients' ),
18
+                'permission_callback' => '__return_true',
19
+                // 'permission_callback' => function () {
20
+                //     return current_user_can( 'manage_options' );
21
+                // },
22
+                'args'                => array(
23
+                    'per_page' => array(
24
+                        'type'              => 'integer',
25
+                        'validate_callback' => 'rest_validate_request_arg',
26
+                        'default'           => 20,
27
+                        'minimum'           => 1,
28
+                        'maximum'           => 100,
29
+                        'sanitize_callback' => 'absint',
30
+                    ),
31
+                    'page'     => array(
32
+                        'type'              => 'integer',
33
+                        'validate_callback' => 'rest_validate_request_arg',
34
+                        'default'           => 1,
35
+                        'sanitize_callback' => 'absint',
36
+                    ),
37
+                    'offset'   => array(
38
+                        'type'              => 'integer',
39
+                        'validate_callback' => 'rest_validate_request_arg',
40
+                        'sanitize_callback' => 'absint',
41
+                    ),
42
+                ),
43
+            )
44
+        );
45
+    }
46
+
47
+    public function get_ingredients( \WP_REST_Request $request ) {
48
+        $per_page = $request['per_page'];
49
+        $page     = $request['page'];
50
+        $offset   = $request['offset'];
51
+
52
+        global $wpdb;
53
+
54
+        if ( isset( $offset ) ) {
55
+            $offset = (int) $offset;
56
+        } else {
57
+            $offset = ( $page - 1 ) * $per_page;
58
+        }
59
+
60
+        $sql =
61
+            "SELECT p1.ID AS recipe_id,
62 62
 					p1.post_title AS recipe_name,
63 63
 					p2.ID AS post_id,
64 64
 					p2.post_title,
@@ -67,66 +67,66 @@  discard block
 block discarded – undo
67 67
 					INNER JOIN {$wpdb->postmeta} pm1 ON pm1.post_ID = p1.ID
68 68
 						AND pm1.meta_key = '_wl_main_ingredient_jsonld'
69 69
 					INNER JOIN {$wpdb->posts} p2"
70
-			// The following ignore rule is used against the `LIKE CONCAT`. We only have const values.
71
-			// phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.LikeWildcardsInQuery
72
-			. " ON p2.post_content LIKE CONCAT( '%<!--WPRM Recipe ', p1.ID,'-->%' )
70
+            // The following ignore rule is used against the `LIKE CONCAT`. We only have const values.
71
+            // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.LikeWildcardsInQuery
72
+            . " ON p2.post_content LIKE CONCAT( '%<!--WPRM Recipe ', p1.ID,'-->%' )
73 73
 				AND p2.post_status = 'publish'
74 74
 				WHERE p1.post_type = 'wprm_recipe'" . $this->limit( $per_page ) . $this->offset( $offset );
75 75
 
76
-		$ingredients = $wpdb->get_results( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
77
-
78
-		if ( empty( $ingredients ) ) {
79
-			return new \WP_Error( 'no_ingredients', __( 'No ingredients found.', 'wordlift' ), array( 'status' => 404 ) );
80
-		}
81
-
82
-		$data = array();
83
-		foreach ( $ingredients as $ingredient ) {
84
-			$recipe_json_ld = get_post_meta( $ingredient->recipe_ID, '_wl_main_ingredient_jsonld', true ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
85
-			$recipe         = json_decode( $recipe_json_ld, true );
86
-			$data[]         = array(
87
-				'ingredient_id'   => $ingredient->recipe_id,
88
-				'ingredient_name' => $recipe ? $recipe['name'] : 'null',
89
-				'recipe_id'       => $ingredient->recipe_id,
90
-				'recipe_name'     => $ingredient->recipe_name,
91
-				'post_id'         => $ingredient->post_id,
92
-				'post_name'       => $ingredient->post_title,
93
-				'post_url'        => esc_url( get_the_permalink( $ingredient->post_id ) ),
94
-			);
95
-		}
96
-
97
-		return rest_ensure_response( $data );
98
-
99
-	}
100
-
101
-	/**
102
-	 * Add the limit clause if specified.
103
-	 *
104
-	 * @param null|int $limit The maximum number of results.
105
-	 *
106
-	 * @return string The limit clause (empty if no limit has been specified).
107
-	 */
108
-	private function limit( $limit = null ) {
109
-
110
-		if ( null === $limit || ! is_numeric( $limit ) ) {
111
-			return '';
112
-		}
113
-
114
-		return " LIMIT $limit";
115
-	}
116
-
117
-	/**
118
-	 * Add the OFFSET clause if specified.
119
-	 *
120
-	 * @param null|int $offset The number of results to skip.
121
-	 *
122
-	 * @return string The offset clause (empty if no offset has been specified).
123
-	 */
124
-	private function offset( $offset = null ) {
125
-
126
-		if ( null === $offset || ! is_numeric( $offset ) ) {
127
-			return '';
128
-		}
129
-
130
-		return " OFFSET $offset";
131
-	}
76
+        $ingredients = $wpdb->get_results( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
77
+
78
+        if ( empty( $ingredients ) ) {
79
+            return new \WP_Error( 'no_ingredients', __( 'No ingredients found.', 'wordlift' ), array( 'status' => 404 ) );
80
+        }
81
+
82
+        $data = array();
83
+        foreach ( $ingredients as $ingredient ) {
84
+            $recipe_json_ld = get_post_meta( $ingredient->recipe_ID, '_wl_main_ingredient_jsonld', true ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
85
+            $recipe         = json_decode( $recipe_json_ld, true );
86
+            $data[]         = array(
87
+                'ingredient_id'   => $ingredient->recipe_id,
88
+                'ingredient_name' => $recipe ? $recipe['name'] : 'null',
89
+                'recipe_id'       => $ingredient->recipe_id,
90
+                'recipe_name'     => $ingredient->recipe_name,
91
+                'post_id'         => $ingredient->post_id,
92
+                'post_name'       => $ingredient->post_title,
93
+                'post_url'        => esc_url( get_the_permalink( $ingredient->post_id ) ),
94
+            );
95
+        }
96
+
97
+        return rest_ensure_response( $data );
98
+
99
+    }
100
+
101
+    /**
102
+     * Add the limit clause if specified.
103
+     *
104
+     * @param null|int $limit The maximum number of results.
105
+     *
106
+     * @return string The limit clause (empty if no limit has been specified).
107
+     */
108
+    private function limit( $limit = null ) {
109
+
110
+        if ( null === $limit || ! is_numeric( $limit ) ) {
111
+            return '';
112
+        }
113
+
114
+        return " LIMIT $limit";
115
+    }
116
+
117
+    /**
118
+     * Add the OFFSET clause if specified.
119
+     *
120
+     * @param null|int $offset The number of results to skip.
121
+     *
122
+     * @return string The offset clause (empty if no offset has been specified).
123
+     */
124
+    private function offset( $offset = null ) {
125
+
126
+        if ( null === $offset || ! is_numeric( $offset ) ) {
127
+            return '';
128
+        }
129
+
130
+        return " OFFSET $offset";
131
+    }
132 132
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 class Ingredients_API {
6 6
 
7 7
 	public function register_hooks() {
8
-		add_action( 'rest_api_init', array( $this, 'register_routes' ) );
8
+		add_action('rest_api_init', array($this, 'register_routes'));
9 9
 	}
10 10
 
11 11
 	public function register_routes() {
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 			'/ingredients',
15 15
 			array(
16 16
 				'methods'             => \WP_REST_Server::READABLE,
17
-				'callback'            => array( $this, 'get_ingredients' ),
17
+				'callback'            => array($this, 'get_ingredients'),
18 18
 				'permission_callback' => '__return_true',
19 19
 				// 'permission_callback' => function () {
20 20
 				//     return current_user_can( 'manage_options' );
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
 		);
45 45
 	}
46 46
 
47
-	public function get_ingredients( \WP_REST_Request $request ) {
47
+	public function get_ingredients(\WP_REST_Request $request) {
48 48
 		$per_page = $request['per_page'];
49 49
 		$page     = $request['page'];
50 50
 		$offset   = $request['offset'];
51 51
 
52 52
 		global $wpdb;
53 53
 
54
-		if ( isset( $offset ) ) {
54
+		if (isset($offset)) {
55 55
 			$offset = (int) $offset;
56 56
 		} else {
57
-			$offset = ( $page - 1 ) * $per_page;
57
+			$offset = ($page - 1) * $per_page;
58 58
 		}
59 59
 
60 60
 		$sql =
@@ -71,18 +71,18 @@  discard block
 block discarded – undo
71 71
 			// phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.LikeWildcardsInQuery
72 72
 			. " ON p2.post_content LIKE CONCAT( '%<!--WPRM Recipe ', p1.ID,'-->%' )
73 73
 				AND p2.post_status = 'publish'
74
-				WHERE p1.post_type = 'wprm_recipe'" . $this->limit( $per_page ) . $this->offset( $offset );
74
+				WHERE p1.post_type = 'wprm_recipe'" . $this->limit($per_page).$this->offset($offset);
75 75
 
76
-		$ingredients = $wpdb->get_results( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
76
+		$ingredients = $wpdb->get_results($sql); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
77 77
 
78
-		if ( empty( $ingredients ) ) {
79
-			return new \WP_Error( 'no_ingredients', __( 'No ingredients found.', 'wordlift' ), array( 'status' => 404 ) );
78
+		if (empty($ingredients)) {
79
+			return new \WP_Error('no_ingredients', __('No ingredients found.', 'wordlift'), array('status' => 404));
80 80
 		}
81 81
 
82 82
 		$data = array();
83
-		foreach ( $ingredients as $ingredient ) {
84
-			$recipe_json_ld = get_post_meta( $ingredient->recipe_ID, '_wl_main_ingredient_jsonld', true ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
85
-			$recipe         = json_decode( $recipe_json_ld, true );
83
+		foreach ($ingredients as $ingredient) {
84
+			$recipe_json_ld = get_post_meta($ingredient->recipe_ID, '_wl_main_ingredient_jsonld', true); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
85
+			$recipe         = json_decode($recipe_json_ld, true);
86 86
 			$data[]         = array(
87 87
 				'ingredient_id'   => $ingredient->recipe_id,
88 88
 				'ingredient_name' => $recipe ? $recipe['name'] : 'null',
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 				'recipe_name'     => $ingredient->recipe_name,
91 91
 				'post_id'         => $ingredient->post_id,
92 92
 				'post_name'       => $ingredient->post_title,
93
-				'post_url'        => esc_url( get_the_permalink( $ingredient->post_id ) ),
93
+				'post_url'        => esc_url(get_the_permalink($ingredient->post_id)),
94 94
 			);
95 95
 		}
96 96
 
97
-		return rest_ensure_response( $data );
97
+		return rest_ensure_response($data);
98 98
 
99 99
 	}
100 100
 
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @return string The limit clause (empty if no limit has been specified).
107 107
 	 */
108
-	private function limit( $limit = null ) {
108
+	private function limit($limit = null) {
109 109
 
110
-		if ( null === $limit || ! is_numeric( $limit ) ) {
110
+		if (null === $limit || ! is_numeric($limit)) {
111 111
 			return '';
112 112
 		}
113 113
 
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 	 *
122 122
 	 * @return string The offset clause (empty if no offset has been specified).
123 123
 	 */
124
-	private function offset( $offset = null ) {
124
+	private function offset($offset = null) {
125 125
 
126
-		if ( null === $offset || ! is_numeric( $offset ) ) {
126
+		if (null === $offset || ! is_numeric($offset)) {
127 127
 			return '';
128 128
 		}
129 129
 
Please login to merge, or discard this patch.