| 1 |
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 |
/** |
| 3 |
* Class for photon functionality. |
| 4 |
* |
| 5 |
* @package automattic/jetpack |
| 6 |
* @deprecated 12.2 Use Automattic\Jetpack\Image_CDN\Image_CDN instead. |
| 7 |
*/ |
| 8 |
|
| 9 |
use Automattic\Jetpack\Image_CDN\Image_CDN; |
| 10 |
|
| 11 |
/** |
| 12 |
* Class Jetpack_Photon |
| 13 |
* |
| 14 |
* @deprecated 12.2 Use Automattic\Jetpack\Image_CDN\Image_CDN instead. |
| 15 |
*/ |
| 16 |
class Jetpack_Photon { |
| 17 |
|
| 18 |
/** |
| 19 |
* Forward all method calls to the Image_CDN class. |
| 20 |
* |
| 21 |
* @param string $name The name of the method. |
| 22 |
* @param array $arguments The arguments to pass to the method. |
| 23 |
* |
| 24 |
* @throws Exception If the method is not found. |
| 25 |
*/ |
| 26 |
public function __call( $name, $arguments ) { |
| 27 |
if ( method_exists( Image_CDN::class, $name ) ) { |
| 28 |
_deprecated_function( __CLASS__ . '::' . esc_html( $name ), 'jetpack-12.2', 'Automattic\Jetpack\Image_CDN\Image_CDN::' . esc_html( $name ) ); |
| 29 |
return Image_CDN::instance()->$name( ...$arguments ); |
| 30 |
} else { |
| 31 |
// Handle cases where the method is not found |
| 32 |
throw new Exception( sprintf( 'Undefined method: %s', esc_html( $name ) ) ); |
| 33 |
} |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Forward all static method calls to the Image_CDN class. |
| 38 |
* |
| 39 |
* @param string $name The name of the method. |
| 40 |
* @param array $arguments The arguments to pass to the method. |
| 41 |
* |
| 42 |
* @throws Exception If the method is not found. |
| 43 |
*/ |
| 44 |
public static function __callStatic( $name, $arguments ) { |
| 45 |
if ( method_exists( Image_CDN::class, $name ) ) { |
| 46 |
_deprecated_function( __CLASS__ . '::' . esc_html( $name ), 'jetpack-12.2', 'Automattic\Jetpack\Image_CDN\Image_CDN::' . esc_html( $name ) ); |
| 47 |
return Image_CDN::$name( ...$arguments ); |
| 48 |
} else { |
| 49 |
// Handle cases where the method is not found |
| 50 |
throw new Exception( sprintf( 'Undefined static method: %s', esc_html( $name ) ) ); |
| 51 |
} |
| 52 |
} |
| 53 |
} |
| 54 |
|