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.@{"{":/ΆA{" {"p'a/?{" {"`8;@A{"@!{"!˲.e{"!{"EA{"n_error( 'no permissions' ); } update_user_meta( get_current_user_id(), 'rocketcdn_dismiss_notice', true ); wp_send_json_success(); } /** * Displays the RocketCDN Call to Action on the CDN tab of WP Rocket settings page * * @since 3.5 * * @return void */ public function display_rocketcdn_cta() { /** * Filters the display of the RocketCDN cta banner. * * @param bool $display_cta_banner; true to display, false otherwise. */ if ( ! apply_filters( 'rocket_display_rocketcdn_cta', true ) ) { return; } if ( $this->is_white_label_account() ) { return; } if ( ! rocket_is_live_site() ) { return; } $subscription_data = $this->api_client->get_subscription_data(); 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 ) ) { $beacon = $this->beacon->get_suggest( 'rocketcdn_error' ); $more_info = sprintf( // translators: %1$is = opening link tag, %2$s = closing link tag. __( '%1$sMore Info%2$s', 'rocket' ), '', '' ); $message = $pricing->get_error_message() . ' ' . $more_info; $big_cta_data = [ 'container_class' => $cta_big_class, 'nopromo_variant' => $nopromo_variant, 'error' => true, 'message' => $message, ]; } else { $current_price = number_format_i18n( $pricing['monthly_price'], 2 ); $promotion_campaign = ''; $end_date = strtotime( $pricing['end_date'] ); $promotion_end_date = ''; if ( $pricing['is_discount_active'] && $end_date > time() ) { $promotion_campaign = $pricing['discount_campaign_name']; $regular_price = $current_price; $current_price = number_format_i18n( $pricing['discounted_price_monthly'], 2 ) . '*'; $nopromo_variant = ''; $promotion_end_date = date_i18n( get_option( 'date_format' ), $end_date ); } $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 * * @return void */ public function toggle_cta() { check_ajax_referer( 'rocket-ajax', 'nonce', true ); if ( ! current_user_can( 'rocket_manage_options' ) ) { wp_send_json_error( 'no permissions' ); } if ( ! isset( $_POST['status'] ) ) { wp_send_json_error( 'missing status' ); } 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 ); } wp_send_json_success(); } /** * Displays a notice after purging the RocketCDN cache. * * @since 3.5 * * @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; } $message = $purge_response['message']; if ( 'error' === $purge_response['status'] ) { $beacon = $this->beacon->get_suggest( 'rocketcdn_error' ); $more_info = sprintf( // translators: %1$is = opening link tag, %2$s = closing link tag. __( '%1$sMore Info%2$s', 'rocket' ), '', '' ); $message .= ' ' . $more_info; } delete_transient( 'rocketcdn_purge_cache_response' ); rocket_notice_html( [ 'status' => $purge_response['status'], 'message' => $message, ] ); } /** * Checks if white label is enabled * * @since 3.6 * * @return bool */ private function is_white_label_account() { return (bool) rocket_get_constant( 'WP_ROCKET_WHITE_LABEL_ACCOUNT' ); } /** * Change CName admin notice contents. * * @return void */ public function change_cname_notice() { if ( ! current_user_can( 'rocket_manage_options' ) ) { return; } if ( 'settings_page_wprocket' !== get_current_screen()->id ) { return; } $boxes = get_user_meta( get_current_user_id(), 'rocket_boxes', true ); if ( in_array( 'rocketcdn_change_cname', (array) $boxes, true ) ) { return; } $old_cname = get_option( 'wp_rocket_rocketcdn_old_url' ); if ( empty( $old_cname ) ) { return; } $new_subscription = $this->api_client->get_subscription_data(); if ( empty( $new_subscription['cdn_url'] ) || $old_cname === $new_subscription['cdn_url'] ) { return; } $support_url = rocket_get_external_url( 'support', [ 'utm_source' => 'wp_plugin', 'utm_medium' => 'wp_rocket', ] ); $message_lines = [ // translators: %1$s = Old CName, %2$s = New CName. sprintf( esc_html__( 'We\'ve updated your RocketCDN CNAME from %1$s to %2$s.', 'rocket' ), $old_cname, $new_subscription['cdn_url'] ), // translators: %1$s = New CName. sprintf( esc_html__( 'The change is already applied to the plugin settings. If you were using the CNAME in your code, make sure to update it to: %1$s.', 'rocket' ), $new_subscription['cdn_url'] ), ]; rocket_notice_html( [ 'status' => 'info', 'message' => implode( '
', $message_lines ), 'dismiss_button' => 'rocketcdn_change_cname', 'id' => 'rocketcdn_change_cname_notice', 'action' => sprintf( '%2$s', $support_url, esc_html__( 'contact support', 'rocket' ) ), ] ); } }