kollapsminoriteten/wp-content/plugins/jetpack/class.photon.php

54 lines
1.7 KiB
PHP
Raw Permalink Normal View History

2020-09-15 14:30:05 +02:00
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
/**
* Class for photon functionality.
*
2021-04-27 08:32:47 +02:00
* @package automattic/jetpack
2023-09-26 10:24:36 +02:00
* @deprecated 12.2 Use Automattic\Jetpack\Image_CDN\Image_CDN instead.
2020-09-15 14:30:05 +02:00
*/
2019-11-15 23:26:29 +01:00
2023-09-26 10:24:36 +02:00
use Automattic\Jetpack\Image_CDN\Image_CDN;
2019-11-15 23:26:29 +01:00
2020-09-15 14:30:05 +02:00
/**
* Class Jetpack_Photon
2023-09-26 10:24:36 +02:00
*
* @deprecated 12.2 Use Automattic\Jetpack\Image_CDN\Image_CDN instead.
2020-09-15 14:30:05 +02:00
*/
2019-11-15 23:26:29 +01:00
class Jetpack_Photon {
/**
2023-09-26 10:24:36 +02:00
* Forward all method calls to the Image_CDN class.
2020-09-15 14:30:05 +02:00
*
2023-09-26 10:24:36 +02:00
* @param string $name The name of the method.
* @param array $arguments The arguments to pass to the method.
2020-09-15 14:30:05 +02:00
*
2023-09-26 10:24:36 +02:00
* @throws Exception If the method is not found.
2019-11-15 23:26:29 +01:00
*/
2023-09-26 10:24:36 +02:00
public function __call( $name, $arguments ) {
if ( method_exists( Image_CDN::class, $name ) ) {
_deprecated_function( __CLASS__ . '::' . esc_html( $name ), 'jetpack-12.2', 'Automattic\Jetpack\Image_CDN\Image_CDN::' . esc_html( $name ) );
return Image_CDN::instance()->$name( ...$arguments );
2019-11-15 23:26:29 +01:00
} else {
2023-09-26 10:24:36 +02:00
// Handle cases where the method is not found
throw new Exception( sprintf( 'Undefined method: %s', esc_html( $name ) ) );
2019-11-15 23:26:29 +01:00
}
}
/**
2023-09-26 10:24:36 +02:00
* Forward all static method calls to the Image_CDN class.
2019-11-15 23:26:29 +01:00
*
2023-09-26 10:24:36 +02:00
* @param string $name The name of the method.
* @param array $arguments The arguments to pass to the method.
2020-09-15 14:30:05 +02:00
*
2023-09-26 10:24:36 +02:00
* @throws Exception If the method is not found.
2020-09-15 14:30:05 +02:00
*/
2023-09-26 10:24:36 +02:00
public static function __callStatic( $name, $arguments ) {
if ( method_exists( Image_CDN::class, $name ) ) {
_deprecated_function( __CLASS__ . '::' . esc_html( $name ), 'jetpack-12.2', 'Automattic\Jetpack\Image_CDN\Image_CDN::' . esc_html( $name ) );
return Image_CDN::$name( ...$arguments );
} else {
// Handle cases where the method is not found
throw new Exception( sprintf( 'Undefined static method: %s', esc_html( $name ) ) );
2020-09-15 14:30:05 +02:00
}
2019-11-15 23:26:29 +01:00
}
}