Completed
Pull Request — develop (#1596)
by David
01:36 queued 16s
created
src/modules/include-exclude/vendor/composer/ClassLoader.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function getPrefixes()
115 115
     {
116
-        if (!empty($this->prefixesPsr0)) {
116
+        if ( ! empty($this->prefixesPsr0)) {
117 117
             return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
118 118
         }
119 119
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      */
184 184
     public function add($prefix, $paths, $prepend = false)
185 185
     {
186
-        if (!$prefix) {
186
+        if ( ! $prefix) {
187 187
             if ($prepend) {
188 188
                 $this->fallbackDirsPsr0 = array_merge(
189 189
                     (array) $paths,
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         }
201 201
 
202 202
         $first = $prefix[0];
203
-        if (!isset($this->prefixesPsr0[$first][$prefix])) {
203
+        if ( ! isset($this->prefixesPsr0[$first][$prefix])) {
204 204
             $this->prefixesPsr0[$first][$prefix] = (array) $paths;
205 205
 
206 206
             return;
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      */
233 233
     public function addPsr4($prefix, $paths, $prepend = false)
234 234
     {
235
-        if (!$prefix) {
235
+        if ( ! $prefix) {
236 236
             // Register directories for the root namespace.
237 237
             if ($prepend) {
238 238
                 $this->fallbackDirsPsr4 = array_merge(
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                     (array) $paths
246 246
                 );
247 247
             }
248
-        } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
248
+        } elseif ( ! isset($this->prefixDirsPsr4[$prefix])) {
249 249
             // Register directories for a new namespace.
250 250
             $length = strlen($prefix);
251 251
             if ('\\' !== $prefix[$length - 1]) {
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
      */
280 280
     public function set($prefix, $paths)
281 281
     {
282
-        if (!$prefix) {
282
+        if ( ! $prefix) {
283 283
             $this->fallbackDirsPsr0 = (array) $paths;
284 284
         } else {
285 285
             $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
      */
300 300
     public function setPsr4($prefix, $paths)
301 301
     {
302
-        if (!$prefix) {
302
+        if ( ! $prefix) {
303 303
             $this->fallbackDirsPsr4 = (array) $paths;
304 304
         } else {
305 305
             $length = strlen($prefix);
@@ -493,18 +493,18 @@  discard block
 block discarded – undo
493 493
     private function findFileWithExtension($class, $ext)
494 494
     {
495 495
         // PSR-4 lookup
496
-        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
496
+        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext;
497 497
 
498 498
         $first = $class[0];
499 499
         if (isset($this->prefixLengthsPsr4[$first])) {
500 500
             $subPath = $class;
501 501
             while (false !== $lastPos = strrpos($subPath, '\\')) {
502 502
                 $subPath = substr($subPath, 0, $lastPos);
503
-                $search = $subPath . '\\';
503
+                $search = $subPath.'\\';
504 504
                 if (isset($this->prefixDirsPsr4[$search])) {
505
-                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
505
+                    $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1);
506 506
                     foreach ($this->prefixDirsPsr4[$search] as $dir) {
507
-                        if (file_exists($file = $dir . $pathEnd)) {
507
+                        if (file_exists($file = $dir.$pathEnd)) {
508 508
                             return $file;
509 509
                         }
510 510
                     }
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 
515 515
         // PSR-4 fallback dirs
516 516
         foreach ($this->fallbackDirsPsr4 as $dir) {
517
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
517
+            if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) {
518 518
                 return $file;
519 519
             }
520 520
         }
@@ -526,14 +526,14 @@  discard block
 block discarded – undo
526 526
                 . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
527 527
         } else {
528 528
             // PEAR-like class name
529
-            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
529
+            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext;
530 530
         }
531 531
 
532 532
         if (isset($this->prefixesPsr0[$first])) {
533 533
             foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
534 534
                 if (0 === strpos($class, $prefix)) {
535 535
                     foreach ($dirs as $dir) {
536
-                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
536
+                        if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) {
537 537
                             return $file;
538 538
                         }
539 539
                     }
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 
544 544
         // PSR-0 fallback dirs
545 545
         foreach ($this->fallbackDirsPsr0 as $dir) {
546
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
546
+            if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) {
547 547
                 return $file;
548 548
             }
549 549
         }
Please login to merge, or discard this patch.
src/modules/include-exclude/vendor/composer/platform_check.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,23 +4,23 @@
 block discarded – undo
4 4
 
5 5
 $issues = array();
6 6
 
7
-if (!(PHP_VERSION_ID >= 50600)) {
8
-    $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.';
7
+if ( ! (PHP_VERSION_ID >= 50600)) {
8
+    $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running '.PHP_VERSION.'.';
9 9
 }
10 10
 
11 11
 if ($issues) {
12
-    if (!headers_sent()) {
12
+    if ( ! headers_sent()) {
13 13
         header('HTTP/1.1 500 Internal Server Error');
14 14
     }
15
-    if (!ini_get('display_errors')) {
15
+    if ( ! ini_get('display_errors')) {
16 16
         if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
17
-            fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
18
-        } elseif (!headers_sent()) {
19
-            echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
17
+            fwrite(STDERR, 'Composer detected issues in your platform:'.PHP_EOL.PHP_EOL.implode(PHP_EOL, $issues).PHP_EOL.PHP_EOL);
18
+        } elseif ( ! headers_sent()) {
19
+            echo 'Composer detected issues in your platform:'.PHP_EOL.PHP_EOL.str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)).PHP_EOL.PHP_EOL;
20 20
         }
21 21
     }
22 22
     trigger_error(
23
-        'Composer detected issues in your platform: ' . implode(' ', $issues),
23
+        'Composer detected issues in your platform: '.implode(' ', $issues),
24 24
         E_USER_ERROR
25 25
     );
26 26
 }
Please login to merge, or discard this patch.
src/modules/include-exclude/vendor/composer/autoload_static.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,27 +6,27 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInitea9f09a268eac98657b6e4638a5b4856
8 8
 {
9
-    public static $prefixLengthsPsr4 = array (
9
+    public static $prefixLengthsPsr4 = array(
10 10
         'W' => 
11
-        array (
11
+        array(
12 12
             'Wordlift\\Modules\\Include_Exclude\\' => 33,
13 13
         ),
14 14
     );
15 15
 
16
-    public static $prefixDirsPsr4 = array (
16
+    public static $prefixDirsPsr4 = array(
17 17
         'Wordlift\\Modules\\Include_Exclude\\' => 
18
-        array (
19
-            0 => __DIR__ . '/../..' . '/includes',
18
+        array(
19
+            0 => __DIR__.'/../..'.'/includes',
20 20
         ),
21 21
     );
22 22
 
23
-    public static $classMap = array (
24
-        'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
23
+    public static $classMap = array(
24
+        'Composer\\InstalledVersions' => __DIR__.'/..'.'/composer/InstalledVersions.php',
25 25
     );
26 26
 
27 27
     public static function getInitializer(ClassLoader $loader)
28 28
     {
29
-        return \Closure::bind(function () use ($loader) {
29
+        return \Closure::bind(function() use ($loader) {
30 30
             $loader->prefixLengthsPsr4 = ComposerStaticInitea9f09a268eac98657b6e4638a5b4856::$prefixLengthsPsr4;
31 31
             $loader->prefixDirsPsr4 = ComposerStaticInitea9f09a268eac98657b6e4638a5b4856::$prefixDirsPsr4;
32 32
             $loader->classMap = ComposerStaticInitea9f09a268eac98657b6e4638a5b4856::$classMap;
Please login to merge, or discard this patch.
src/modules/include-exclude/vendor/composer/autoload_real.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     public static function loadClassLoader($class)
10 10
     {
11 11
         if ('Composer\Autoload\ClassLoader' === $class) {
12
-            require __DIR__ . '/ClassLoader.php';
12
+            require __DIR__.'/ClassLoader.php';
13 13
         }
14 14
     }
15 15
 
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
             return self::$loader;
23 23
         }
24 24
 
25
-        require __DIR__ . '/platform_check.php';
25
+        require __DIR__.'/platform_check.php';
26 26
 
27 27
         spl_autoload_register(array('ComposerAutoloaderInitea9f09a268eac98657b6e4638a5b4856', 'loadClassLoader'), true, true);
28 28
         self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
29 29
         spl_autoload_unregister(array('ComposerAutoloaderInitea9f09a268eac98657b6e4638a5b4856', 'loadClassLoader'));
30 30
 
31
-        require __DIR__ . '/autoload_static.php';
31
+        require __DIR__.'/autoload_static.php';
32 32
         call_user_func(\Composer\Autoload\ComposerStaticInitea9f09a268eac98657b6e4638a5b4856::getInitializer($loader));
33 33
 
34 34
         $loader->register(true);
Please login to merge, or discard this patch.
src/modules/include-exclude/vendor/composer/autoload_classmap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 $baseDir = dirname($vendorDir);
7 7
 
8 8
 return array(
9
-    'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
9
+    'Composer\\InstalledVersions' => $vendorDir.'/composer/InstalledVersions.php',
10 10
 );
Please login to merge, or discard this patch.
src/modules/include-exclude/vendor/composer/InstalledVersions.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     public static function getVersionRanges($packageName)
138 138
     {
139 139
         foreach (self::getInstalled() as $installed) {
140
-            if (!isset($installed['versions'][$packageName])) {
140
+            if ( ! isset($installed['versions'][$packageName])) {
141 141
                 continue;
142 142
             }
143 143
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
             return implode(' || ', $ranges);
159 159
         }
160 160
 
161
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
161
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
162 162
     }
163 163
 
164 164
     /**
@@ -168,18 +168,18 @@  discard block
 block discarded – undo
168 168
     public static function getVersion($packageName)
169 169
     {
170 170
         foreach (self::getInstalled() as $installed) {
171
-            if (!isset($installed['versions'][$packageName])) {
171
+            if ( ! isset($installed['versions'][$packageName])) {
172 172
                 continue;
173 173
             }
174 174
 
175
-            if (!isset($installed['versions'][$packageName]['version'])) {
175
+            if ( ! isset($installed['versions'][$packageName]['version'])) {
176 176
                 return null;
177 177
             }
178 178
 
179 179
             return $installed['versions'][$packageName]['version'];
180 180
         }
181 181
 
182
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
182
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
183 183
     }
184 184
 
185 185
     /**
@@ -189,18 +189,18 @@  discard block
 block discarded – undo
189 189
     public static function getPrettyVersion($packageName)
190 190
     {
191 191
         foreach (self::getInstalled() as $installed) {
192
-            if (!isset($installed['versions'][$packageName])) {
192
+            if ( ! isset($installed['versions'][$packageName])) {
193 193
                 continue;
194 194
             }
195 195
 
196
-            if (!isset($installed['versions'][$packageName]['pretty_version'])) {
196
+            if ( ! isset($installed['versions'][$packageName]['pretty_version'])) {
197 197
                 return null;
198 198
             }
199 199
 
200 200
             return $installed['versions'][$packageName]['pretty_version'];
201 201
         }
202 202
 
203
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
203
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
204 204
     }
205 205
 
206 206
     /**
@@ -210,18 +210,18 @@  discard block
 block discarded – undo
210 210
     public static function getReference($packageName)
211 211
     {
212 212
         foreach (self::getInstalled() as $installed) {
213
-            if (!isset($installed['versions'][$packageName])) {
213
+            if ( ! isset($installed['versions'][$packageName])) {
214 214
                 continue;
215 215
             }
216 216
 
217
-            if (!isset($installed['versions'][$packageName]['reference'])) {
217
+            if ( ! isset($installed['versions'][$packageName]['reference'])) {
218 218
                 return null;
219 219
             }
220 220
 
221 221
             return $installed['versions'][$packageName]['reference'];
222 222
         }
223 223
 
224
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
224
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
225 225
     }
226 226
 
227 227
     /**
@@ -231,14 +231,14 @@  discard block
 block discarded – undo
231 231
     public static function getInstallPath($packageName)
232 232
     {
233 233
         foreach (self::getInstalled() as $installed) {
234
-            if (!isset($installed['versions'][$packageName])) {
234
+            if ( ! isset($installed['versions'][$packageName])) {
235 235
                 continue;
236 236
             }
237 237
 
238 238
             return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
239 239
         }
240 240
 
241
-        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
241
+        throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed');
242 242
     }
243 243
 
244 244
     /**
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
             // only require the installed.php file if this file is loaded from its dumped location,
268 268
             // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
269 269
             if (substr(__DIR__, -8, 1) !== 'C') {
270
-                self::$installed = include __DIR__ . '/installed.php';
270
+                self::$installed = include __DIR__.'/installed.php';
271 271
             } else {
272 272
                 self::$installed = array();
273 273
             }
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             // only require the installed.php file if this file is loaded from its dumped location,
341 341
             // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
342 342
             if (substr(__DIR__, -8, 1) !== 'C') {
343
-                self::$installed = require __DIR__ . '/installed.php';
343
+                self::$installed = require __DIR__.'/installed.php';
344 344
             } else {
345 345
                 self::$installed = array();
346 346
             }
Please login to merge, or discard this patch.
src/modules/include-exclude/vendor/composer/installed.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
         'version' => 'dev-develop',
6 6
         'reference' => '55bcad7417f59a42dfbbd428552068805f488d30',
7 7
         'type' => 'wordpress-plugin',
8
-        'install_path' => __DIR__ . '/../../',
8
+        'install_path' => __DIR__.'/../../',
9 9
         'aliases' => array(),
10 10
         'dev' => true,
11 11
     ),
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
             'version' => 'dev-develop',
16 16
             'reference' => '55bcad7417f59a42dfbbd428552068805f488d30',
17 17
             'type' => 'wordpress-plugin',
18
-            'install_path' => __DIR__ . '/../../',
18
+            'install_path' => __DIR__.'/../../',
19 19
             'aliases' => array(),
20 20
             'dev_requirement' => false,
21 21
         ),
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/services/Ingredients.php 2 patches
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.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	 * @param int $limit The number of items to return.
16 16
 	 * @param int $offset The offset.
17 17
 	 */
18
-	public function get_data( $limit = 20, $offset = 0 ) {
18
+	public function get_data($limit = 20, $offset = 0) {
19 19
 		global $wpdb;
20 20
 
21 21
 		$ingredients = $wpdb->get_results(
@@ -41,24 +41,24 @@  discard block
 block discarded – undo
41 41
 			)
42 42
 		);
43 43
 
44
-		if ( empty( $ingredients ) ) {
45
-			return new \WP_Error( 'no_ingredients', __( 'No ingredients found.', 'wordlift' ), array( 'status' => 404 ) );
44
+		if (empty($ingredients)) {
45
+			return new \WP_Error('no_ingredients', __('No ingredients found.', 'wordlift'), array('status' => 404));
46 46
 		}
47 47
 
48 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 );
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 53
 			// phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
54 54
 			$data[] = array(
55 55
 				'main_ingredient_item_id' => $recipe ? $recipe['@id'] : null,
56 56
 				'main_ingredient_name'    => $recipe ? $recipe['name'] : null,
57 57
 				'recipe_id'               => (int) $ingredient->recipe_ID,
58
-				'recipe_name'             => htmlspecialchars_decode( $ingredient->recipe_name ),
58
+				'recipe_name'             => htmlspecialchars_decode($ingredient->recipe_name),
59 59
 				'post_id'                 => (int) $ingredient->post_ID,
60 60
 				'post_name'               => $ingredient->post_title,
61
-				'post_url'                => get_the_permalink( $ingredient->post_ID ),
61
+				'post_url'                => get_the_permalink($ingredient->post_ID),
62 62
 			);
63 63
 			// phpcs:enable
64 64
 		}
Please login to merge, or discard this patch.