PluginProbe
Elementor Website Builder – more than just a page builder / 3.2.3
Elementor Website Builder – more than just a page builder v3.2.3
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | data/base/endpoint.php +20 -18 4.2.23.2.3 View file →
@@ -45,15 +45,17 @@
45 45
46 46 /**
47 47 * Endpoint constructor.
48 48 *
49 + * run `$this->>register()`.
50 + *
49 51 * @param \Elementor\Data\Base\Controller $controller
50 52 *
51 - * @throws \Exception If invalid controller.
53 + * @throws \Exception
52 54 */
53 55 public function __construct( $controller ) {
54 56 if ( ! ( $controller instanceof Controller ) ) {
55 - throw new \Exception( 'Invalid controller.' );
57 + throw new \Exception( 'Invalid controller' );
56 58 }
57 59
58 60 $this->controller = $controller;
59 61 $this->register();
@@ -89,9 +91,9 @@
89 91 * Register the endpoint.
90 92 *
91 93 * By default: register get items route.
92 94 *
93 - * @throws \Exception If invalid endpoint registered.
95 + * @throws \Exception
94 96 */
95 97 protected function register() {
96 98 $this->register_items_route();
97 99 }
@@ -102,9 +104,9 @@
102 104 * @param string $route
103 105 * @param string $endpoint_class
104 106 *
105 107 * @return \Elementor\Data\Base\SubEndpoint
106 - * @throws \Exception If invalid sub endpoint registered.
108 + * @throws \Exception
107 109 */
108 110 protected function register_sub_endpoint( $route, $endpoint_class ) {
109 111 $endpoint_instance = new $endpoint_class( $route, $this );
110 112
@@ -134,14 +136,14 @@
134 136 * Base callback.
135 137 *
136 138 * All reset requests from the client should pass this function.
137 139 *
138 - * @param string $methods
140 + * @param string $methods
139 141 * @param \WP_REST_Request $request
140 - * @param bool $is_multi
142 + * @param bool $is_multi
141 143 *
142 144 * @return mixed|\WP_Error|\WP_HTTP_Response|\WP_REST_Response
143 - * @throws \Exception If invalid method.
145 + * @throws \Exception
144 146 */
145 147 public function base_callback( $methods, $request, $is_multi = false ) {
146 148 // TODO: Find better solution.
147 149 $json_params = $request->get_json_params();
@@ -188,9 +190,9 @@
188 190
189 191 /**
190 192 * Retrieves one item from the collection.
191 193 *
192 - * @param string $id
194 + * @param string $id
193 195 * @param \WP_REST_Request $request Full data about the request.
194 196 *
195 197 * @return \WP_Error|\WP_REST_Response Response object on success, or WP_Error object on failure.
196 198 */
@@ -213,9 +215,9 @@
213 215
214 216 /**
215 217 * Creates one item.
216 218 *
217 - * @param string $id id of request item.
219 + * @param string $id id of request item.
218 220 * @param \WP_REST_Request $request Full data about the request.
219 221 *
220 222 * @return \WP_Error|\WP_REST_Response Response object on success, or WP_Error object on failure.
221 223 */
@@ -236,9 +238,9 @@
236 238
237 239 /**
238 240 * Updates one item.
239 241 *
240 - * @param string $id id of request item.
242 + * @param string $id id of request item.
241 243 * @param \WP_REST_Request $request Full data about the request.
242 244 *
243 245 * @return \WP_Error|\WP_REST_Response Response object on success, or WP_Error object on failure.
244 246 */
@@ -259,9 +261,9 @@
259 261
260 262 /**
261 263 * Delete one item.
262 264 *
263 - * @param string $id id of request item.
265 + * @param string $id id of request item.
264 266 * @param \WP_REST_Request $request Full data about the request.
265 267 *
266 268 * @return \WP_Error|\WP_REST_Response Response object on success, or WP_Error object on failure.
267 269 */
@@ -282,13 +284,13 @@
282 284
283 285 /**
284 286 * Register item route.
285 287 *
288 + * @param array $args
289 + * @param string $route
286 290 * @param string $methods
287 - * @param array $args
288 - * @param string $route
289 291 *
290 - * @throws \Exception If invalid method.
292 + * @throws \Exception
291 293 */
292 294 public function register_item_route( $methods = WP_REST_Server::READABLE, $args = [], $route = '/' ) {
293 295 $args = array_merge( [
294 296 'id' => [
@@ -310,9 +312,9 @@
310 312 * Register items route.
311 313 *
312 314 * @param string $methods
313 315 *
314 - * @throws \Exception If invalid method.
316 + * @throws \Exception
315 317 */
316 318 public function register_items_route( $methods = WP_REST_Server::READABLE ) {
317 319 $this->register_route( '', $methods, function ( $request ) use ( $methods ) {
318 320 return $this->base_callback( $methods, $request, true );
@@ -323,13 +325,13 @@
323 325 * Register route.
324 326 *
325 327 * @param string $route
326 328 * @param string $methods
327 - * @param null $callback
328 - * @param array $args
329 + * @param null $callback
330 + * @param array $args
329 331 *
330 332 * @return bool
331 - * @throws \Exception If invalid method.
333 + * @throws \Exception
332 334 */
333 335 public function register_route( $route = '', $methods = WP_REST_Server::READABLE, $callback = null, $args = [] ) {
334 336 if ( ! in_array( $methods, self::AVAILABLE_METHODS, true ) ) {
335 337 throw new \Exception( 'Invalid method.' );