PluginProbe
Image Optimization – Compress Images and Convert to WebP or AVIF / 1.6.5
Image Optimization – Compress Images and Convert to WebP or AVIF v1.6.5
1.7.6 1.7.5 1.7.4 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 All 32 releases
image-optimization / modules / optimization / classes / route-base.php

route-base.php in Image Optimization – Compress Images and Convert to WebP or AVIF 1.6.5, at modules/optimization/classes/route-base.php

42 lines 892 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ImageOptimization\Modules\Optimization\Classes;
4
5 use ImageOptimization\Classes\Route;
6 use WP_REST_Request;
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly.
10 }
11
12 class Route_Base extends Route {
13 protected $auth = true;
14 protected string $path = '';
15
16 public function get_methods(): array {
17 return [];
18 }
19
20 public function get_endpoint(): string {
21 return 'optimize/' . $this->get_path();
22 }
23
24 public function get_path(): string {
25 return $this->path;
26 }
27
28 public function get_name(): string {
29 return '';
30 }
31
32 public function post_permission_callback( WP_REST_Request $request ): bool {
33 return $this->get_permission_callback( $request );
34 }
35
36 public function get_permission_callback( WP_REST_Request $request ): bool {
37 $valid = $this->permission_callback( $request );
38
39 return $valid && user_can( $this->current_user_id, 'manage_options' );
40 }
41 }
42