;
}
$ocd = $this->options->get( 'optimize_css_delivery', 0 );
$whitelabel = rocket_get_constant( 'WP_ROCKET_WHITE_LABEL_ACCOUNT', false );
$expired_since = ( time() - $this->user->get_license_expiration() ) / DAY_IN_SECONDS;
$message = ' ';
if (
(
$whitelabel
&&
15 > $expired_since
&&
$ocd
)
||
(
! $whitelabel
&&
$this->user->is_auto_renew()
&&
4 > $expired_since
)
||
(
$whitelabel
&&
$this->user->is_auto_renew()
&&
4 > $expired_since
&&
! $ocd
)
) {
return $args;
} elseif (
! $whitelabel
&&
15 > $expired_since
&&
$ocd
) {
$message .= sprintf(
// translators: %1$s = , %2$s = .
__( 'You need a valid license to continue using this feature. %1$sRenew now%2$s before losing access.', 'rocket' ),
'',
''
);
} elseif (
(
! $whitelabel
&&
15 < $expired_since
)
||
(
! $whitelabel
&&
15 > $expired_since
&&
! $ocd
)
) {
$message .= sprintf(
// translators: %1$s = , %2$s = .
__( 'You need an active license to enable this option. %1$sRenew now%2$s.', 'rocket' ),
'',
''
);
} elseif (
(
$whitelabel
&&
15 < $expired_since
)
||
(
$whitelabel
&&
15 > $expired_since
&&
! $ocd
)
) {
$doc = 'https://docs.wp-rocket.me/article/1711-what-happens-if-my-license-expires';
$locale = current( array_slice( explode( '_', get_user_locale() ), 0, 1 ) );
if ( 'fr' === $locale ) {
$doc = 'https://fr.docs.wp-rocket.me/article/1712-que-se-passe-t-il-si-ma-licence-expire';
}
$message .= sprintf(
// translators: %1$s = , %2$s = .
__( 'You need an active license to enable this option. %1$sMore info%2$s.', 'rocket' ),
'',
''
);
}
$message .= '';
$args['label'] = $args['label'] . $message;
return $args;
}
/**
* Adds the notification bubble to WP Rocket menu item when expired
*
* @param string $menu_title Menu title.
*
* @return string
*/
public function add_expired_bubble( $menu_title ): string {
if ( rocket_get_constant( 'WP_ROCKET_WHITE_LABEL_ACCOUNT', false ) ) {
return $menu_title;
}
if ( ! $this->user->is_license_expired() ) {
return $menu_title;
}
if ( false !== get_transient( 'wpr_dashboard_seen_' . get_current_user_id() ) ) {
return $menu_title;
}
$expired_since = ( time() - $this->user->get_license_expiration() ) / DAY_IN_SECONDS;
$auto_renew = $this->user->is_auto_renew();
$ocd_enabled = $this->options->get( 'optimize_css_delivery', 0 );
if (
$ocd_enabled
&&
$auto_renew
&&
4 > $expired_since
) {
return $menu_title;
}
if (
! $auto_renew
&&
! $ocd_enabled
&&
4 < $expired_since
) {
return $menu_title;
}
if (
$auto_renew
&&
! $ocd_enabled
&&
(
4 > $expired_since
||
15 < $expired_since
)
) {
return $menu_title;
}
return $menu_title . ' !';
}
/**
* Sets the dashboard seen transient to hide the expired bubble
*
* @return void
*/
public function set_dashboard_seen_transient() {
if ( ! $this->user->is_license_expired() ) {
return;
}
if ( ! $this->options->get( 'optimize_css_delivery', 0 ) ) {
return;
}
$current_user = get_current_user_id();
if ( false !== get_transient( "wpr_dashboard_seen_{$current_user}" ) ) {
return;
}
$expired_since = ( time() - $this->user->get_license_expiration() ) / DAY_IN_SECONDS;
if ( 15 > $expired_since ) {
set_transient( "wpr_dashboard_seen_{$current_user}", 1, 15 * DAY_IN_SECONDS );
} elseif ( 15 < $expired_since ) {
set_transient( "wpr_dashboard_seen_{$current_user}", 1, YEAR_IN_SECONDS );
}
}
/**
* Disable optimize CSS delivery setting
*
* @param array $args Array of setting field arguments.
*
* @return array
*/
public function maybe_disable_ocd( $args ) {
if ( 'optimize_css_delivery' !== $args['id'] ) {
return $args;
}
if ( ! $this->user->is_license_expired() ) {
return $args;
}
$expired_since = ( time() - $this->user->get_license_expiration() ) / DAY_IN_SECONDS;
if (
15 > $expired_since
||
(
$this->user->is_auto_renew()
&&
4 > $expired_since
)
) {
return $args;
}
$args['value'] = 0;
if (
isset( $args['container_class'] )
&&
! in_array( 'wpr-isDisabled', $args['container_class'], true )
) {
$args['container_class'][] = 'wpr-isDisabled';
}
$args['input_attr']['disabled'] = 1;
return $args;
}
/**
* Disables the RUCSS & Async CSS options if license is expired since more than 15 days
*
* @param mixed $value Current option value.
*
* @return mixed
*/
public function maybe_disable_option( $value ) {
$expired_since = ( time() - $this->user->get_license_expiration() ) / DAY_IN_SECONDS;
if ( 15 > $expired_since ) {
return $value;
}
return 0;
}
}
Fatal error: Uncaught TypeError: Argument 2 passed to WP_Rocket\Engine\License\Subscriber::__construct() must be an instance of WP_Rocket\Engine\License\Renewal, string given in /home/merciket/public_html/wp-content/plugins/wp-rocket/inc/Engine/License/Subscriber.php:29
Stack trace:
#0 [internal function]: WP_Rocket\Engine\License\Subscriber->__construct(Object(WP_Rocket\Engine\License\Upgrade), 'WP_Rocket\\Engin...')
#1 /home/merciket/public_html/wp-content/plugins/wp-rocket/inc/Dependencies/League/Container/Definition/Definition.php(256): ReflectionClass->newInstanceArgs(Array)
#2 /home/merciket/public_html/wp-content/plugins/wp-rocket/inc/Dependencies/League/Container/Definition/Definition.php(212): WP_Rocket\Dependencies\League\Container\Definition\Definition->resolveClass('WP_Rocket\\Engin...')
#3 /home/merciket/public_html/wp-content/plugins/wp-rocket/inc/Dependencies/League/Container/Definition/DefinitionAggregate.php(94): WP_Rocket\Dependencies\League\Container\Definition\Definition->resolve(false)
#4 /home/mercik in /home/merciket/public_html/wp-content/plugins/wp-rocket/inc/Engine/License/Subscriber.php on line 29