PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | src/routes/importing-route.php +8 -7 18.5 → trunk View file →
@@ -1,8 +1,9 @@
1 1 <?php
2 2
3 3 namespace Yoast\WP\SEO\Routes;
4 4
5 +use Exception;
5 6 use WP_Error;
6 7 use WP_REST_Response;
7 8 use Yoast\WP\SEO\Actions\Importing\Importing_Action_Interface;
8 9 use Yoast\WP\SEO\Conditionals\No_Conditionals;
@@ -23,9 +24,9 @@
23 24 * The import route constant.
24 25 *
25 26 * @var string
26 27 */
27 - const ROUTE = '/import/(?P<plugin>[\w-]+)/(?P<type>[\w-]+)';
28 + public const ROUTE = '/import/(?P<plugin>[\w-]+)/(?P<type>[\w-]+)';
28 29
29 30 /**
30 31 * List of available importers.
31 32 *
@@ -66,9 +67,9 @@
66 67 [
67 68 'callback' => [ $this, 'execute' ],
68 69 'permission_callback' => [ $this, 'is_user_permitted_to_import' ],
69 70 'methods' => [ 'POST' ],
70 - ]
71 + ],
71 72 );
72 73 }
73 74
74 75 /**
@@ -92,9 +93,9 @@
92 93 'rest_no_route',
93 94 'Requested importer not found',
94 95 [
95 96 'status' => 404,
96 - ]
97 + ],
97 98 );
98 99 }
99 100
100 101 $result = $importer->index();
@@ -104,16 +105,16 @@
104 105 }
105 106
106 107 return $this->respond_with(
107 108 $result,
108 - $next_url
109 + $next_url,
109 110 );
110 - } catch ( \Exception $exception ) {
111 + } catch ( Exception $exception ) {
111 112 if ( $exception instanceof Aioseo_Validation_Exception ) {
112 113 return new WP_Error(
113 114 'wpseo_error_validation',
114 115 $exception->getMessage(),
115 - [ 'stackTrace' => $exception->getTraceAsString() ]
116 + [ 'stackTrace' => $exception->getTraceAsString() ],
116 117 );
117 118 }
118 119
119 120 return new WP_Error(
@@ -118,9 +119,9 @@
118 119
119 120 return new WP_Error(
120 121 'wpseo_error_indexing',
121 122 $exception->getMessage(),
122 - [ 'stackTrace' => $exception->getTraceAsString() ]
123 + [ 'stackTrace' => $exception->getTraceAsString() ],
123 124 );
124 125 }
125 126 }
126 127