if ( 'running' === $subscription_data['subscription_status'] ) {
return;
}
$pricing = $this->api_client->get_pricing_data();
$regular_price = '';
$nopromo_variant = '--no-promo';
$cta_small_class = 'wpr-isHidden';
$cta_big_class = '';
if ( get_user_meta( get_current_user_id(), 'rocket_rocketcdn_cta_hidden', true ) ) {
$cta_small_class = '';
$cta_big_class = 'wpr-isHidden';
}
$small_cta_data = [
'container_class' => $cta_small_class,
];
if ( is_wp_error( $pricing ) ) {
$big_cta_data = [
'container_class' => $cta_big_class,
'nopromo_variant' => $nopromo_variant,
'error' => true,
'message' => $pricing->get_error_message(),
];
} else {
$current_price = number_format_i18n( $pricing['monthly_price'], 2 );
$promotion_campaign = $pricing['discount_campaign_name'];
$promotion_end_date = date_i18n( get_option( 'date_format' ), strtotime( $pricing['end_date'] ) );
if ( $pricing['is_discount_active'] ) {
$regular_price = $current_price;
$current_price = number_format_i18n( $pricing['discounted_price_monthly'], 2 ) . '*';
$nopromo_variant = '';
}
$big_cta_data = [
'container_class' => $cta_big_class,
'promotion_campaign' => $promotion_campaign,
'promotion_end_date' => $promotion_end_date,
'nopromo_variant' => $nopromo_variant,
'regular_price' => $regular_price,
'current_price' => $current_price,
];
}
echo $this->generate( 'cta-small', $small_cta_data ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view.
echo $this->generate( 'cta-big', $big_cta_data ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view.
}
/**
* Toggles display of the RocketCDN CTAs on the settings page
*
* @since 3.5
* @author Remy Perona
*
* @return void
*/
public function toggle_cta() {
check_ajax_referer( 'rocket-ajax', 'nonce', true );
if ( ! current_user_can( 'rocket_manage_options' ) ) {
return;
}
if ( ! isset( $_POST['status'] ) ) {
return;
}
if ( 'big' === $_POST['status'] ) {
delete_user_meta( get_current_user_id(), 'rocket_rocketcdn_cta_hidden' );
} elseif ( 'small' === $_POST['status'] ) {
update_user_meta( get_current_user_id(), 'rocket_rocketcdn_cta_hidden', true );
}
}
/**
* Displays a notice after purging the RocketCDN cache.
*
* @since 3.5
* @author Remy Perona
*
* @return void
*/
public function purge_cache_notice() {
if ( ! current_user_can( 'rocket_manage_options' ) ) {
return;
}
if ( 'settings_page_wprocket' !== get_current_screen()->id ) {
return;
}
$purge_response = get_transient( 'rocketcdn_purge_cache_response' );
if ( false === $purge_response ) {
return;
}
delete_transient( 'rocketcdn_purge_cache_response' );
\rocket_notice_html(
[
'status' => $purge_response['status'],
'message' => $purge_response['message'],
]
);
}
}
Fatal error: Uncaught Error: Call to a member function withArgument() on null in /home/payon/public_html/wp-content/plugins/wp-rocket/inc/classes/ServiceProvider/RocketCDN.php:56
Stack trace:
#0 /home/payon/public_html/wp-content/plugins/wp-rocket/vendor/league/container/src/ServiceProvider/ServiceProviderAggregate.php(84): WP_Rocket\ServiceProvider\RocketCDN->register()
#1 /home/payon/public_html/wp-content/plugins/wp-rocket/vendor/league/container/src/Container.php(88): League\Container\ServiceProvider\ServiceProviderAggregate->register('rocketcdn_rest_...')
#2 /home/payon/public_html/wp-content/plugins/wp-rocket/inc/classes/class-plugin.php(186): League\Container\Container->get('rocketcdn_rest_...')
#3 /home/payon/public_html/wp-content/plugins/wp-rocket/inc/main.php(40): WP_Rocket\Plugin->load()
#4 /home/payon/public_html/wp-includes/class-wp-hook.php(308): rocket_init('')
#5 /home/payon/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
#6 /home/payon/public_html/wp-includes/plugin.ph in /home/payon/public_html/wp-content/plugins/wp-rocket/inc/classes/ServiceProvider/RocketCDN.php on line 56