PluginProbe
Extendify / trunk
Extendify vtrunk
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
← All changes | app/Shared/Controllers/PatternPlaceholderController.php +8 -8 3.0.6 → trunk View file →
@@ -52,9 +52,16 @@
52 52 $handlerClass = isset(self::PLUGIN_HANDLERS[$pluginDependency])
53 53 ? self::PLUGIN_HANDLERS[$pluginDependency]
54 54 : null;
55 55 if ($handlerClass && isset($metadata['key'])) {
56 - $pattern['code'] = $handlerClass::create($pattern['code'], $metadata['key'], $newCode);
56 + $code = $handlerClass::create($pattern['code'], $metadata['key'], $newCode);
57 + if (is_wp_error($code)) {
58 + // The caller renders whatever is in code, so leaving it is the fallback.
59 + $pattern['pluginDependencyFailed'] = true;
60 + return $pattern;
61 + }
62 +
63 + $pattern['code'] = $code;
57 64 return $pattern;
58 65 }
59 66
60 67 // We added a feature this version doesn't yet support.
@@ -59,15 +66,8 @@
59 66
60 67 // We added a feature this version doesn't yet support.
61 68 return $pattern;
62 69 }, $patterns);
63 -
64 - // if any of the pattern code is a wp_error, we need to fail.
65 - foreach ($patterns as $pattern) {
66 - if (is_wp_error($pattern['code'])) {
67 - return new \WP_REST_Response($pattern['code'], 422);
68 - }
69 - }
70 70
71 71 return new \WP_REST_Response($patterns);
72 72 }
73 73 }