PluginProbe
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce / 3.3.0
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce v3.3.0
3.3.0 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.1 trunk 1.0.4 1.1.0 1.1.0.1 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 All 162 releases
← All changes | classes/class-cartflows-admin.php +26 -10 3.1.2 → 3.3.0 View file →
@@ -95,9 +95,19 @@
95 95 * @since 2.0.0
96 96 * @return void
97 97 */
98 98 public function run_scheduled_docs_job() {
99 - if ( false === as_next_scheduled_action( 'cartflows_update_knowledge_base_data' ) && ! wp_installing() ) {
99 +
100 + if ( wp_installing() ) {
101 + return;
102 + }
103 +
104 + // Only the legacy admin renders the Knowledge Base screen that consumes this data.
105 + if ( ! defined( 'CARTFLOWS_LEGACY_ADMIN' ) || ! CARTFLOWS_LEGACY_ADMIN ) {
106 + return;
107 + }
108 +
109 + if ( false === as_next_scheduled_action( 'cartflows_update_knowledge_base_data' ) ) {
100 110 as_schedule_recurring_action( time(), WEEK_IN_SECONDS, 'cartflows_update_knowledge_base_data' );
101 111 }
102 112 }
103 113
@@ -108,9 +118,11 @@
108 118 * @return mixed
109 119 */
110 120 public static function cartflows_update_knowledge_base_data() {
111 121 $docs_json = json_decode( wp_remote_retrieve_body( wp_remote_get( 'https://cartflows.com//wp-json/powerful-docs/v1/get-docs' ) ) );
112 - Cartflows_Helper::update_admin_settings_option( 'cartflows_docs_data', $docs_json );
122 +
123 + // Never autoload — this payload runs to hundreds of KB and only the Knowledge Base screen reads it.
124 + update_option( 'cartflows_docs_data', $docs_json, false );
113 125 }
114 126
115 127 /**
116 128 * Init dashboard widgets.
@@ -241,16 +253,20 @@
241 253 );
242 254
243 255 if ( current_user_can( 'cartflows_manage_settings' ) ) {
244 256
245 - $default_url = add_query_arg(
246 - array(
247 - 'page' => CARTFLOWS_SLUG,
248 - 'settings' => true,
249 - ),
250 - admin_url( 'admin.php' )
251 - );
257 + $is_legacy_admin = defined( 'CARTFLOWS_LEGACY_ADMIN' ) && CARTFLOWS_LEGACY_ADMIN;
252 258
259 + $settings_args = array( 'page' => CARTFLOWS_SLUG );
260 +
261 + if ( $is_legacy_admin ) {
262 + $settings_args['settings'] = true;
263 + } else {
264 + $settings_args['path'] = 'settings';
265 + }
266 +
267 + $default_url = add_query_arg( $settings_args, admin_url( 'admin.php' ) );
268 +
253 269 array_unshift( $mylinks, '<a href="' . esc_url( $default_url ) . '">' . __( 'Settings', 'cartflows' ) . '</a>' );
254 270 }
255 271
256 272 if ( ! _is_cartflows_pro() ) {
@@ -298,9 +314,9 @@
298 314 public function add_admin_body_class( $classes ) {
299 315
300 316 $classes .= ' cartflows-' . CARTFLOWS_VER;
301 317
302 - if ( isset( $_GET['action'] ) && in_array( sanitize_text_field( wp_unslash( $_GET['action'] ) ), array( 'wcf-log', 'wcf-license' ) ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
318 + if ( isset( $_GET['action'] ) && 'wcf-license' === sanitize_text_field( wp_unslash( $_GET['action'] ) ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
303 319 $classes .= ' wcf-debug-page ';
304 320 }
305 321
306 322 return $classes;