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 +41 -12 3.0.1 → 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.
@@ -228,26 +240,43 @@
228 240 */
229 241 public function add_action_links( $links ) {
230 242
231 243 $mylinks = array(
232 - '<a target="_blank" href="' . esc_url( 'https://cartflows.com/docs/?utm_source=plugin-page&utm_medium=free-cartflows&utm_campaign=go-pro' ) . '">' . __( 'Docs', 'cartflows' ) . '</a>',
244 + '<a target="_blank" href="' . esc_url(
245 + Cartflows_Helper::get_kb_doc_link(
246 + 'https://cartflows.com/docs/',
247 + array(
248 + 'utm_source' => 'plugin-page',
249 + 'utm_campaign' => 'go-pro',
250 + )
251 + )
252 + ) . '">' . __( 'Docs', 'cartflows' ) . '</a>',
233 253 );
234 254
235 255 if ( current_user_can( 'cartflows_manage_settings' ) ) {
236 256
237 - $default_url = add_query_arg(
238 - array(
239 - 'page' => CARTFLOWS_SLUG,
240 - 'settings' => true,
241 - ),
242 - admin_url( 'admin.php' )
243 - );
257 + $is_legacy_admin = defined( 'CARTFLOWS_LEGACY_ADMIN' ) && CARTFLOWS_LEGACY_ADMIN;
244 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 +
245 269 array_unshift( $mylinks, '<a href="' . esc_url( $default_url ) . '">' . __( 'Settings', 'cartflows' ) . '</a>' );
246 270 }
247 271
248 272 if ( ! _is_cartflows_pro() ) {
249 - array_push( $mylinks, '<a style="color: #39b54a; font-weight: 700;" target="_blank" href="' . esc_url( 'https://cartflows.com/pricing/?utm_source=plugin-page&utm_medium=free-cartflows&utm_campaign=go-pro' ) . '"> ' . __( 'Get CartFlows Pro', 'cartflows' ) . ' </a>' );
273 + array_push(
274 + $mylinks,
275 + '<a style="color: #39b54a; font-weight: 700;" target="_blank" href="' . esc_url(
276 + Cartflows_Helper::get_upgrade_to_pro_link( 'pricing', '', array( 'utm_source' => 'plugin-page' ) )
277 + ) . '"> ' . __( 'Get CartFlows Pro', 'cartflows' ) . ' </a>'
278 + );
250 279 }
251 280
252 281 return array_merge( $links, $mylinks );
253 282 }
@@ -285,9 +314,9 @@
285 314 public function add_admin_body_class( $classes ) {
286 315
287 316 $classes .= ' cartflows-' . CARTFLOWS_VER;
288 317
289 - 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
290 319 $classes .= ' wcf-debug-page ';
291 320 }
292 321
293 322 return $classes;