| Server IP : 89.39.208.18 / Your IP : 216.73.217.74 Web Server : LiteSpeed System : User : ( ) PHP Version : 7.4.33 Disable Function : eval,./,ln,passthru,dl,system,exec,popen,shell_exec,posix_getpwuid,posix_uname,ftp_exec,posix_uname,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,get_current_user,getmyuid,getmygid,listen,chgrp,apache_note,apache_setenv,apache_child_terminate,closelog,debugger_off,debugge_on,ini_restore,netscript,escapeshellarg,cmd,backtick,virtual,show_sourc,show_source,pclose,pcntl_exec,datasec,old_offset,ctrl_dir,ini_alter,leak,listen,chgrp,apache_setenv,define_syslog_variables,root,diskfreespace,disk_free_space,disk_total_space,posix_kill,getmyuid,getmygid,apache_child_terminate,php_ini_scanned_files,ls,ps_aux,chown,getrusage,posixc,posame,chgrp,posix_setuid,posix_setsid,posix_setgid,apache_note,apache_setenv,x_getuid,e_ini_file,nfo,SQL,mysql_li,t_dbs,filegroup,highlight_file,ilegetcontents,get_dir,popen,popens,pfsockopen,dos_conv,apache_get_modules,crack_check,crack_closedict,rar_open,bzopen,bzread,bzwrite,shellcode,posix_isatty,posix_getservbyname,escapeshellarg,hypot,pg_host,pos,posix_access,inurl,posix_times,posix_mknod,pclose,ps_fill,symlink,id,escapeshellcmd,php_uname,phpinfo MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home3/./././mahyarcake/./public_html/wp-content/plugins/wp-rocket/inc/Addon/WebP/ |
Upload File : |
<?php
declare(strict_types=1);
namespace WP_Rocket\Addon\WebP;
use WP_Rocket\Engine\CDN\Subscriber as CDNSubscriber;
use WP_Rocket\Subscriber\Third_Party\Plugins\Images\Webp\Webp_Interface;
abstract class AbstractWebp {
/**
* CDNSubscriber instance.
*
* @var CDNSubscriber
*/
protected $cdn_subscriber;
/**
* Constructor.
*
* @since 3.12.6
*
* @param CDNSubscriber $cdn_subscriber CDNSubscriber instance.
*/
public function __construct( CDNSubscriber $cdn_subscriber ) {
$this->cdn_subscriber = $cdn_subscriber;
}
/**
* Get a list of active plugins that convert and/or serve webp images.
*
* @since 3.12.6
*
* @return array An array of Webp_Interface objects.
*/
protected function get_webp_plugins() {
/**
* Add Webp plugins.
*
* @since 3.4
*
* @param array $webp_plugins An array of Webp_Interface objects.
*/
$webp_plugins = (array) apply_filters( 'rocket_webp_plugins', [] );
if ( ! $webp_plugins ) {
// Somebody probably messed up.
return [];
}
foreach ( $webp_plugins as $plugin_key => $plugin ) {
if ( ! $plugin instanceof Webp_Interface ) {
unset( $webp_plugins[ $plugin_key ] );
continue;
}
if ( ! $this->is_plugin_active( $plugin->get_basename() ) ) {
unset( $webp_plugins[ $plugin_key ] );
}
}
return $webp_plugins;
}
/**
* Tell if a plugin is active.
*
* @since 3.12.6
*
* @param string $plugin_basename A plugin basename.
* @return bool
*/
protected function is_plugin_active( string $plugin_basename ): bool {
if ( doing_action( 'deactivate_' . $plugin_basename ) ) {
return false;
}
if ( doing_action( 'activate_' . $plugin_basename ) ) {
return true;
}
return rocket_is_plugin_active( $plugin_basename );
}
/**
* Tell if WP Rocket uses a CDN for images.
*
* @since 3.12.6
*
* @return bool
*/
protected function is_using_cdn(): bool {
// Don't use `$this->options_data->get( 'cdn' )` here, we need an up-to-date value when the CDN option changes.
$use = get_rocket_option( 'cdn', 0 ) && $this->cdn_subscriber->get_cdn_hosts( [], [ 'all', 'images' ] );
/**
* Filter whether WP Rocket is using a CDN for webp images.
*
* @since 3.4
*
* @param bool $use True if WP Rocket is using a CDN for webp images. False otherwise.
*/
return (bool) apply_filters( 'rocket_webp_is_using_cdn', $use );
}
}