← All changes
|
classes/async-operation/queries/image-optimization-operation-query.php
+7
-3
1.0.2
→
1.7.7
View file →
| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -namespace ImageOptimizer\Classes\Async_Operation\Queries; | |
| 3 | +namespace ImageOptimization\Classes\Async_Operation\Queries; | |
| 4 | 4 | |
| 5 | -use ImageOptimizer\Classes\Async_Operation\{ | |
| 5 | +use ImageOptimization\Classes\Async_Operation\{ | |
| 6 | 6 | Async_Operation_Hook, |
| 7 | 7 | Async_Operation_Queue, |
| 8 | 8 | Interfaces\Operation_Query_Interface, |
| 9 | 9 | }; |
| @@ -8,14 +8,18 @@ | ||
| 8 | 8 | Interfaces\Operation_Query_Interface, |
| 9 | 9 | }; |
| 10 | 10 | use TypeError; |
| 11 | 11 | |
| 12 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 13 | + exit; // Exit if accessed directly. | |
| 14 | +} | |
| 15 | + | |
| 12 | 16 | class Image_Optimization_Operation_Query implements Operation_Query_Interface { |
| 13 | 17 | private array $query; |
| 14 | 18 | |
| 15 | 19 | public function set_hook( string $hook ): self { |
| 16 | 20 | if ( ! in_array( $hook, Async_Operation_Hook::get_values(), true ) ) { |
| 17 | - throw new TypeError( "Hook $hook is not a part of Async_Operation_Hook values" ); | |
| 21 | + throw new TypeError( esc_html( "Hook $hook is not a part of Async_Operation_Hook values" ) ); | |
| 18 | 22 | } |
| 19 | 23 | |
| 20 | 24 | $this->query['hook'] = $hook; |
| 21 | 25 | |