Completed
Pull Request — develop (#1576)
by Naveen
01:08
created
src/modules/pods/vendor/composer/autoload_psr4.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
-    'Wordlift\\Modules\\Pods\\' => array($baseDir . '/includes'),
9
+    'Wordlift\\Modules\\Pods\\' => array($baseDir.'/includes'),
10 10
 );
Please login to merge, or discard this patch.
src/modules/pods/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-master',
6 6
         'reference' => 'b333eb73cb4a7848d2797684071cc0f7264565da',
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-master',
16 16
             'reference' => 'b333eb73cb4a7848d2797684071cc0f7264565da',
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/pods/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('ComposerAutoloaderInit1fa7477671b8ce4e96024c7b54cda86e', 'loadClassLoader'), true, true);
28 28
         self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
29 29
         spl_autoload_unregister(array('ComposerAutoloaderInit1fa7477671b8ce4e96024c7b54cda86e', 'loadClassLoader'));
30 30
 
31
-        require __DIR__ . '/autoload_static.php';
31
+        require __DIR__.'/autoload_static.php';
32 32
         call_user_func(\Composer\Autoload\ComposerStaticInit1fa7477671b8ce4e96024c7b54cda86e::getInitializer($loader));
33 33
 
34 34
         $loader->register(true);
Please login to merge, or discard this patch.
src/modules/pods/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/pods/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/pods/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 ComposerStaticInit1fa7477671b8ce4e96024c7b54cda86e
8 8
 {
9
-    public static $prefixLengthsPsr4 = array (
9
+    public static $prefixLengthsPsr4 = array(
10 10
         'W' => 
11
-        array (
11
+        array(
12 12
             'Wordlift\\Modules\\Pods\\' => 22,
13 13
         ),
14 14
     );
15 15
 
16
-    public static $prefixDirsPsr4 = array (
16
+    public static $prefixDirsPsr4 = array(
17 17
         'Wordlift\\Modules\\Pods\\' => 
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 = ComposerStaticInit1fa7477671b8ce4e96024c7b54cda86e::$prefixLengthsPsr4;
31 31
             $loader->prefixDirsPsr4 = ComposerStaticInit1fa7477671b8ce4e96024c7b54cda86e::$prefixDirsPsr4;
32 32
             $loader->classMap = ComposerStaticInit1fa7477671b8ce4e96024c7b54cda86e::$classMap;
Please login to merge, or discard this patch.
src/modules/pods/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/core/wordlift-core-entity-api.php 2 patches
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -20,90 +20,90 @@  discard block
 block discarded – undo
20 20
  */
21 21
 function wl_entity_get_by_title( $title, $autocomplete = false, $include_alias = true, $limit = false, $schema_types = array() ) {
22 22
 
23
-	global $wpdb;
24
-
25
-	// Search by substring
26
-	if ( $autocomplete ) {
27
-		$title = '%' . $title . '%';
28
-	}
29
-
30
-	// The title is a LIKE query.
31
-	$query = 'SELECT DISTINCT p.ID AS id, p.post_title AS title, t.name AS schema_type_name, t.slug AS type_slug'
32
-			 . " FROM $wpdb->posts p, $wpdb->term_taxonomy tt, $wpdb->term_relationships tr, $wpdb->terms t"
33
-			 . '  WHERE p.post_title LIKE %s'
34
-			 . '   AND t.term_id = tt.term_id'
35
-			 . '   AND tt.taxonomy = %s'
36
-			 . '   AND tt.term_taxonomy_id = tr.term_taxonomy_id'
37
-			 . '   AND tr.object_id = p.ID'
38
-			 // Ensure we don't load entities from the trash, see https://github.com/insideout10/wordlift-plugin/issues/278.
39
-			 . "   AND p.post_status != 'trash'";
40
-
41
-	$params = array(
42
-		$title,
43
-		Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
44
-	);
45
-
46
-	if ( $schema_types ) {
47
-		$query .= ' AND t.name IN (' . join(
48
-			',',
49
-			array_map(
50
-				function ( $schema_type ) {
51
-					return "'" . esc_sql( $schema_type ) . "'";
52
-				},
53
-				$schema_types
54
-			)
55
-		) . ')';
56
-	}
57
-
58
-	if ( $include_alias ) {
59
-
60
-		$query .= ' UNION'
61
-				  . "  SELECT DISTINCT p.ID AS id, CONCAT( m.meta_value, ' (', p.post_title, ')' ) AS title, t.name AS schema_type_name, t.slug AS type_slug"
62
-				  . "  FROM $wpdb->posts p, $wpdb->term_taxonomy tt, $wpdb->term_relationships tr, $wpdb->terms t, $wpdb->postmeta m"
63
-				  . '   WHERE m.meta_key = %s AND m.meta_value LIKE %s'
64
-				  . '    AND m.post_id = p.ID'
65
-				  . '    AND t.term_id = tt.term_id'
66
-				  . '    AND tt.taxonomy = %s'
67
-				  . '    AND tt.term_taxonomy_id = tr.term_taxonomy_id'
68
-				  . '    AND tr.object_id = p.ID'
69
-				  // Ensure we don't load entities from the trash, see https://github.com/insideout10/wordlift-plugin/issues/278.
70
-				  . "    AND p.post_status != 'trash'";
71
-
72
-		if ( $schema_types ) {
73
-			$query .= ' AND t.name IN (' . join(
74
-					',',
75
-					array_map(
76
-						function ( $schema_type ) {
77
-							return "'" . esc_sql( $schema_type ) . "'";
78
-						},
79
-						$schema_types
80
-					)
81
-				) . ')';
82
-		}
83
-
84
-		$params = array_merge(
85
-			$params,
86
-			array(
87
-				Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY,
88
-				$title,
89
-				Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
90
-			)
91
-		);
92
-
93
-
94
-	}
95
-
96
-	if ( $limit ) {
97
-		$query   .= ' LIMIT %d';
98
-		$params[] = $limit;
99
-	}
100
-
101
-	return $wpdb->get_results(
102
-		$wpdb->prepare(
103
-			$query, // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
104
-			$params
105
-		)
106
-	);
23
+    global $wpdb;
24
+
25
+    // Search by substring
26
+    if ( $autocomplete ) {
27
+        $title = '%' . $title . '%';
28
+    }
29
+
30
+    // The title is a LIKE query.
31
+    $query = 'SELECT DISTINCT p.ID AS id, p.post_title AS title, t.name AS schema_type_name, t.slug AS type_slug'
32
+                . " FROM $wpdb->posts p, $wpdb->term_taxonomy tt, $wpdb->term_relationships tr, $wpdb->terms t"
33
+                . '  WHERE p.post_title LIKE %s'
34
+                . '   AND t.term_id = tt.term_id'
35
+                . '   AND tt.taxonomy = %s'
36
+                . '   AND tt.term_taxonomy_id = tr.term_taxonomy_id'
37
+                . '   AND tr.object_id = p.ID'
38
+                // Ensure we don't load entities from the trash, see https://github.com/insideout10/wordlift-plugin/issues/278.
39
+                . "   AND p.post_status != 'trash'";
40
+
41
+    $params = array(
42
+        $title,
43
+        Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
44
+    );
45
+
46
+    if ( $schema_types ) {
47
+        $query .= ' AND t.name IN (' . join(
48
+            ',',
49
+            array_map(
50
+                function ( $schema_type ) {
51
+                    return "'" . esc_sql( $schema_type ) . "'";
52
+                },
53
+                $schema_types
54
+            )
55
+        ) . ')';
56
+    }
57
+
58
+    if ( $include_alias ) {
59
+
60
+        $query .= ' UNION'
61
+                    . "  SELECT DISTINCT p.ID AS id, CONCAT( m.meta_value, ' (', p.post_title, ')' ) AS title, t.name AS schema_type_name, t.slug AS type_slug"
62
+                    . "  FROM $wpdb->posts p, $wpdb->term_taxonomy tt, $wpdb->term_relationships tr, $wpdb->terms t, $wpdb->postmeta m"
63
+                    . '   WHERE m.meta_key = %s AND m.meta_value LIKE %s'
64
+                    . '    AND m.post_id = p.ID'
65
+                    . '    AND t.term_id = tt.term_id'
66
+                    . '    AND tt.taxonomy = %s'
67
+                    . '    AND tt.term_taxonomy_id = tr.term_taxonomy_id'
68
+                    . '    AND tr.object_id = p.ID'
69
+                    // Ensure we don't load entities from the trash, see https://github.com/insideout10/wordlift-plugin/issues/278.
70
+                    . "    AND p.post_status != 'trash'";
71
+
72
+        if ( $schema_types ) {
73
+            $query .= ' AND t.name IN (' . join(
74
+                    ',',
75
+                    array_map(
76
+                        function ( $schema_type ) {
77
+                            return "'" . esc_sql( $schema_type ) . "'";
78
+                        },
79
+                        $schema_types
80
+                    )
81
+                ) . ')';
82
+        }
83
+
84
+        $params = array_merge(
85
+            $params,
86
+            array(
87
+                Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY,
88
+                $title,
89
+                Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
90
+            )
91
+        );
92
+
93
+
94
+    }
95
+
96
+    if ( $limit ) {
97
+        $query   .= ' LIMIT %d';
98
+        $params[] = $limit;
99
+    }
100
+
101
+    return $wpdb->get_results(
102
+        $wpdb->prepare(
103
+            $query, // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
104
+            $params
105
+        )
106
+    );
107 107
 }
108 108
 
109 109
 /**
@@ -113,43 +113,43 @@  discard block
 block discarded – undo
113 113
  */
114 114
 function wl_entity_ajax_get_by_title() {
115 115
 
116
-	// `wl_entity_metaboxes_utilities.js` still uses `GET`.
117
-	//
118
-	// See https://github.com/insideout10/wordlift-plugin/issues/438.
119
-	// Get the title to search.
120
-	if ( empty( $_POST['title'] ) && empty( $_GET['title'] ) ) {  //phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.NonceVerification.Missing
121
-		// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
122
-		@ob_clean();
123
-		wp_send_json_error( 'The title parameter is required.' );
124
-	}
125
-
126
-	// `wl_entity_metaboxes_utilities.js` still uses `GET`.
127
-	//
128
-	// See https://github.com/insideout10/wordlift-plugin/issues/438.
129
-	$title = sanitize_text_field( wp_unslash( $_POST['title'] ? $_POST['title'] : $_GET['title'] ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.NonceVerification.Missing
130
-
131
-	// Are we searching for a specific title or for a containing title?
132
-	$autocomplete = isset( $_GET['autocomplete'] ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
133
-
134
-	// Are we searching also for the aliases?
135
-	$include_alias = isset( $_GET['alias'] ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
136
-
137
-	// Get the edit link.
138
-	$post_type_object = get_post_type_object( Wordlift_Entity_Service::TYPE_NAME );
139
-	$edit_link        = $post_type_object->_edit_link . '&action=edit';
140
-
141
-	// Prepare the response with the edit link.
142
-	$response = array(
143
-		'edit_link' => $edit_link,
144
-		'results'   => wl_entity_get_by_title( $title, $autocomplete, $include_alias ),
145
-	);
146
-
147
-	// Clean any buffer.
148
-	// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
149
-	@ob_clean();
150
-
151
-	// Send the success response.
152
-	wp_send_json_success( $response );
116
+    // `wl_entity_metaboxes_utilities.js` still uses `GET`.
117
+    //
118
+    // See https://github.com/insideout10/wordlift-plugin/issues/438.
119
+    // Get the title to search.
120
+    if ( empty( $_POST['title'] ) && empty( $_GET['title'] ) ) {  //phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.NonceVerification.Missing
121
+        // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
122
+        @ob_clean();
123
+        wp_send_json_error( 'The title parameter is required.' );
124
+    }
125
+
126
+    // `wl_entity_metaboxes_utilities.js` still uses `GET`.
127
+    //
128
+    // See https://github.com/insideout10/wordlift-plugin/issues/438.
129
+    $title = sanitize_text_field( wp_unslash( $_POST['title'] ? $_POST['title'] : $_GET['title'] ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.NonceVerification.Missing
130
+
131
+    // Are we searching for a specific title or for a containing title?
132
+    $autocomplete = isset( $_GET['autocomplete'] ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
133
+
134
+    // Are we searching also for the aliases?
135
+    $include_alias = isset( $_GET['alias'] ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
136
+
137
+    // Get the edit link.
138
+    $post_type_object = get_post_type_object( Wordlift_Entity_Service::TYPE_NAME );
139
+    $edit_link        = $post_type_object->_edit_link . '&action=edit';
140
+
141
+    // Prepare the response with the edit link.
142
+    $response = array(
143
+        'edit_link' => $edit_link,
144
+        'results'   => wl_entity_get_by_title( $title, $autocomplete, $include_alias ),
145
+    );
146
+
147
+    // Clean any buffer.
148
+    // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
149
+    @ob_clean();
150
+
151
+    // Send the success response.
152
+    wp_send_json_success( $response );
153 153
 
154 154
 }
155 155
 
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
18 18
  *
19 19
  * @return array An array of WP_Post instances.
20 20
  */
21
-function wl_entity_get_by_title( $title, $autocomplete = false, $include_alias = true, $limit = false, $schema_types = array() ) {
21
+function wl_entity_get_by_title($title, $autocomplete = false, $include_alias = true, $limit = false, $schema_types = array()) {
22 22
 
23 23
 	global $wpdb;
24 24
 
25 25
 	// Search by substring
26
-	if ( $autocomplete ) {
27
-		$title = '%' . $title . '%';
26
+	if ($autocomplete) {
27
+		$title = '%'.$title.'%';
28 28
 	}
29 29
 
30 30
 	// The title is a LIKE query.
@@ -43,19 +43,19 @@  discard block
 block discarded – undo
43 43
 		Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
44 44
 	);
45 45
 
46
-	if ( $schema_types ) {
47
-		$query .= ' AND t.name IN (' . join(
46
+	if ($schema_types) {
47
+		$query .= ' AND t.name IN ('.join(
48 48
 			',',
49 49
 			array_map(
50
-				function ( $schema_type ) {
51
-					return "'" . esc_sql( $schema_type ) . "'";
50
+				function($schema_type) {
51
+					return "'".esc_sql($schema_type)."'";
52 52
 				},
53 53
 				$schema_types
54 54
 			)
55
-		) . ')';
55
+		).')';
56 56
 	}
57 57
 
58
-	if ( $include_alias ) {
58
+	if ($include_alias) {
59 59
 
60 60
 		$query .= ' UNION'
61 61
 				  . "  SELECT DISTINCT p.ID AS id, CONCAT( m.meta_value, ' (', p.post_title, ')' ) AS title, t.name AS schema_type_name, t.slug AS type_slug"
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
 				  // Ensure we don't load entities from the trash, see https://github.com/insideout10/wordlift-plugin/issues/278.
70 70
 				  . "    AND p.post_status != 'trash'";
71 71
 
72
-		if ( $schema_types ) {
73
-			$query .= ' AND t.name IN (' . join(
72
+		if ($schema_types) {
73
+			$query .= ' AND t.name IN ('.join(
74 74
 					',',
75 75
 					array_map(
76
-						function ( $schema_type ) {
77
-							return "'" . esc_sql( $schema_type ) . "'";
76
+						function($schema_type) {
77
+							return "'".esc_sql($schema_type)."'";
78 78
 						},
79 79
 						$schema_types
80 80
 					)
81
-				) . ')';
81
+				).')';
82 82
 		}
83 83
 
84 84
 		$params = array_merge(
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
 	}
95 95
 
96
-	if ( $limit ) {
96
+	if ($limit) {
97 97
 		$query   .= ' LIMIT %d';
98 98
 		$params[] = $limit;
99 99
 	}
@@ -117,31 +117,31 @@  discard block
 block discarded – undo
117 117
 	//
118 118
 	// See https://github.com/insideout10/wordlift-plugin/issues/438.
119 119
 	// Get the title to search.
120
-	if ( empty( $_POST['title'] ) && empty( $_GET['title'] ) ) {  //phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.NonceVerification.Missing
120
+	if (empty($_POST['title']) && empty($_GET['title'])) {  //phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.NonceVerification.Missing
121 121
 		// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
122 122
 		@ob_clean();
123
-		wp_send_json_error( 'The title parameter is required.' );
123
+		wp_send_json_error('The title parameter is required.');
124 124
 	}
125 125
 
126 126
 	// `wl_entity_metaboxes_utilities.js` still uses `GET`.
127 127
 	//
128 128
 	// See https://github.com/insideout10/wordlift-plugin/issues/438.
129
-	$title = sanitize_text_field( wp_unslash( $_POST['title'] ? $_POST['title'] : $_GET['title'] ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.NonceVerification.Missing
129
+	$title = sanitize_text_field(wp_unslash($_POST['title'] ? $_POST['title'] : $_GET['title'])); //phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.NonceVerification.Missing
130 130
 
131 131
 	// Are we searching for a specific title or for a containing title?
132
-	$autocomplete = isset( $_GET['autocomplete'] ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
132
+	$autocomplete = isset($_GET['autocomplete']); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
133 133
 
134 134
 	// Are we searching also for the aliases?
135
-	$include_alias = isset( $_GET['alias'] ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
135
+	$include_alias = isset($_GET['alias']); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
136 136
 
137 137
 	// Get the edit link.
138
-	$post_type_object = get_post_type_object( Wordlift_Entity_Service::TYPE_NAME );
139
-	$edit_link        = $post_type_object->_edit_link . '&action=edit';
138
+	$post_type_object = get_post_type_object(Wordlift_Entity_Service::TYPE_NAME);
139
+	$edit_link        = $post_type_object->_edit_link.'&action=edit';
140 140
 
141 141
 	// Prepare the response with the edit link.
142 142
 	$response = array(
143 143
 		'edit_link' => $edit_link,
144
-		'results'   => wl_entity_get_by_title( $title, $autocomplete, $include_alias ),
144
+		'results'   => wl_entity_get_by_title($title, $autocomplete, $include_alias),
145 145
 	);
146 146
 
147 147
 	// Clean any buffer.
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	@ob_clean();
150 150
 
151 151
 	// Send the success response.
152
-	wp_send_json_success( $response );
152
+	wp_send_json_success($response);
153 153
 
154 154
 }
155 155
 
156
-add_action( 'wp_ajax_entity_by_title', 'wl_entity_ajax_get_by_title' );
156
+add_action('wp_ajax_entity_by_title', 'wl_entity_ajax_get_by_title');
Please login to merge, or discard this patch.
src/includes/properties/class-wordlift-entity-property-service.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -11,38 +11,38 @@
 block discarded – undo
11 11
  */
12 12
 class Wordlift_Entity_Property_Service extends Wordlift_Simple_Property_Service {
13 13
 
14
-	/**
15
-	 * {@inheritdoc}
16
-	 */
17
-	public function get( $id, $meta_key, $type ) {
18
-
19
-		$entity_service = Wordlift_Entity_Service::get_instance();
20
-
21
-		// Map each returned value to a Wordlift_Property_Entity_Reference.
22
-		return array_map(
23
-			function ( $item ) use ( $entity_service ) {
24
-
25
-				$regex = '/^(post|term)_(\d+)$/m';
26
-				if ( preg_match( $regex, $item, $matches ) ) {
27
-
28
-					$object_type = Object_Type_Enum::from_string( $matches[1] );
29
-					$identifier  = (int) $matches[2];
30
-					if ( $object_type === Object_Type_Enum::POST ) {
31
-						return is_numeric( $identifier ) && null !== get_post( $identifier )
32
-							? new Wordlift_Property_Entity_Reference( $entity_service->get_uri( $identifier ), (int) $identifier ) : $item;
33
-					} elseif ( $object_type === Object_Type_Enum::TERM ) {
34
-						return new Term_Reference( $identifier );
35
-					}
36
-				}
37
-
38
-				// If the $item is a number and it's an existing post, return the
39
-				// URI of the referenced entity. Otherwise return the value.
40
-				return is_numeric( $item ) && null !== get_post( $item )
41
-				? new Wordlift_Property_Entity_Reference( $entity_service->get_uri( $item ), (int) $item )
42
-				: $item;
43
-			},
44
-			parent::get( $id, $meta_key, $type )
45
-		);
46
-	}
14
+    /**
15
+     * {@inheritdoc}
16
+     */
17
+    public function get( $id, $meta_key, $type ) {
18
+
19
+        $entity_service = Wordlift_Entity_Service::get_instance();
20
+
21
+        // Map each returned value to a Wordlift_Property_Entity_Reference.
22
+        return array_map(
23
+            function ( $item ) use ( $entity_service ) {
24
+
25
+                $regex = '/^(post|term)_(\d+)$/m';
26
+                if ( preg_match( $regex, $item, $matches ) ) {
27
+
28
+                    $object_type = Object_Type_Enum::from_string( $matches[1] );
29
+                    $identifier  = (int) $matches[2];
30
+                    if ( $object_type === Object_Type_Enum::POST ) {
31
+                        return is_numeric( $identifier ) && null !== get_post( $identifier )
32
+                            ? new Wordlift_Property_Entity_Reference( $entity_service->get_uri( $identifier ), (int) $identifier ) : $item;
33
+                    } elseif ( $object_type === Object_Type_Enum::TERM ) {
34
+                        return new Term_Reference( $identifier );
35
+                    }
36
+                }
37
+
38
+                // If the $item is a number and it's an existing post, return the
39
+                // URI of the referenced entity. Otherwise return the value.
40
+                return is_numeric( $item ) && null !== get_post( $item )
41
+                ? new Wordlift_Property_Entity_Reference( $entity_service->get_uri( $item ), (int) $item )
42
+                : $item;
43
+            },
44
+            parent::get( $id, $meta_key, $type )
45
+        );
46
+    }
47 47
 
48 48
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,34 +14,34 @@
 block discarded – undo
14 14
 	/**
15 15
 	 * {@inheritdoc}
16 16
 	 */
17
-	public function get( $id, $meta_key, $type ) {
17
+	public function get($id, $meta_key, $type) {
18 18
 
19 19
 		$entity_service = Wordlift_Entity_Service::get_instance();
20 20
 
21 21
 		// Map each returned value to a Wordlift_Property_Entity_Reference.
22 22
 		return array_map(
23
-			function ( $item ) use ( $entity_service ) {
23
+			function($item) use ($entity_service) {
24 24
 
25 25
 				$regex = '/^(post|term)_(\d+)$/m';
26
-				if ( preg_match( $regex, $item, $matches ) ) {
26
+				if (preg_match($regex, $item, $matches)) {
27 27
 
28
-					$object_type = Object_Type_Enum::from_string( $matches[1] );
28
+					$object_type = Object_Type_Enum::from_string($matches[1]);
29 29
 					$identifier  = (int) $matches[2];
30
-					if ( $object_type === Object_Type_Enum::POST ) {
31
-						return is_numeric( $identifier ) && null !== get_post( $identifier )
32
-							? new Wordlift_Property_Entity_Reference( $entity_service->get_uri( $identifier ), (int) $identifier ) : $item;
33
-					} elseif ( $object_type === Object_Type_Enum::TERM ) {
34
-						return new Term_Reference( $identifier );
30
+					if ($object_type === Object_Type_Enum::POST) {
31
+						return is_numeric($identifier) && null !== get_post($identifier)
32
+							? new Wordlift_Property_Entity_Reference($entity_service->get_uri($identifier), (int) $identifier) : $item;
33
+					} elseif ($object_type === Object_Type_Enum::TERM) {
34
+						return new Term_Reference($identifier);
35 35
 					}
36 36
 				}
37 37
 
38 38
 				// If the $item is a number and it's an existing post, return the
39 39
 				// URI of the referenced entity. Otherwise return the value.
40
-				return is_numeric( $item ) && null !== get_post( $item )
41
-				? new Wordlift_Property_Entity_Reference( $entity_service->get_uri( $item ), (int) $item )
40
+				return is_numeric($item) && null !== get_post($item)
41
+				? new Wordlift_Property_Entity_Reference($entity_service->get_uri($item), (int) $item)
42 42
 				: $item;
43 43
 			},
44
-			parent::get( $id, $meta_key, $type )
44
+			parent::get($id, $meta_key, $type)
45 45
 		);
46 46
 	}
47 47
 
Please login to merge, or discard this patch.