| 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/Engine/Plugin/ |
Upload File : |
<?php
declare(strict_types=1);
namespace WP_Rocket\Engine\Plugin;
use WP_Rocket\Abstract_Render;
use WP_Rocket\Engine\License\API\User;
class RenewalNotice extends Abstract_Render {
/**
* User instance
*
* @var User
*/
private $user;
/**
* Constructor
*
* @param User $user User instance.
* @param string $template_path Template path.
*/
public function __construct( User $user, string $template_path ) {
parent::__construct( $template_path );
$this->user = $user;
}
/**
* Display the renewal notice on plugins page
*
* @param string $version Latest version number.
*
* @return void
*/
public function renewal_notice( $version ) {
if ( ! $this->user->is_license_expired() ) {
return;
}
if ( ! $this->is_major_version_available( $version ) ) {
return;
}
$major = $this->extract_major( $version );
$data = [
'version' => $major,
'release_url' => 'https://wp-rocket.me/blog/wp-rocket-' . str_replace( '.', '-', $major ) . '/',
'renew_url' => $this->user->get_renewal_url(),
];
echo $this->generate( 'update-renewal-expired-notice', $data ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Adds styles for expired banner
*
* @param string $version Latest version number.
*
* @return void
*/
public function add_expired_styles( $version ) {
if ( ! $this->user->is_license_expired() ) {
return;
}
if ( ! $this->is_major_version_available( $version ) ) {
return;
}
echo '<style>.plugins tr[data-slug=wp-rocket] th, .plugins tr[data-slug=wp-rocket] td {box-shadow: none !important;}.notice.wp-rocket-update{border-color:#d63638;background-color:#fbf9e8;}.plugin-update .notice.wp-rocket-update a{color:#2782ad;}.wp-rocket-update p::before{display: inline-block;font: normal 20px/1 dashicons;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;vertical-align: top;color: #d63638;content: "\f534";}@media screen and (max-width: 782px){.plugins tr[data-slug=wp-rocket].active + .plugin-update-tr::before {background-color: #f0f6fc;border-left: 4px solid #72aee6;}}</style>';
}
/**
* Checks if a new major version is available
*
* @param string $version Version available from the API.
*
* @return bool
*/
private function is_major_version_available( $version ): bool {
$current_version = rocket_get_constant( 'WP_ROCKET_VERSION', '' );
$current_major = $this->extract_major( $current_version );
$version_major = $this->extract_major( $version );
return version_compare( $current_major, $version_major, '<' );
}
/**
* Extracts the major version number from the provided version
*
* @param string $version Version number.
*
* @return string
*/
private function extract_major( $version ): string {
$parts = explode( '.', $version );
return $parts[0] . '.' . $parts[1];
}
}