diff --git a/scripts/patch-catalog-labels.php b/scripts/patch-catalog-labels.php new file mode 100644 index 0000000..7b52843 --- /dev/null +++ b/scripts/patch-catalog-labels.php @@ -0,0 +1,74 @@ +plugin-name + * map so the Tools-tab "locked" catalog groups read with real plugin names. Over-inclusive is + * safe: a guard not actually used by any batch simply never appears. + * Usage: php patch-catalog-labels.php [ABS_PATH_TO/includes] + */ + +$base = $argv[1] ?? '/var/www/html/wp-content/plugins/advanced-mcp-plugin/includes'; +$admin = $base . '/Core/AdminMenu.php'; +$src = file_get_contents($admin); +if ($src === false) { fwrite(STDERR, "cannot read $admin\n"); exit(1); } +if (strpos($src, 'amp-labels v2') !== false) { echo "labels already v2\n"; exit(0); } + +$new = <<<'PHP' + private function ampPluginLabels(): array { + /* amp-labels v2 */ + return [ + 'WPB_VC_VERSION' => ['WPBakery Page Builder', 'js_composer'], + 'ELEMENTOR_VERSION' => ['Elementor', 'elementor'], + 'WooCommerce' => ['WooCommerce', 'woocommerce'], + 'WOOCOMMERCE_VERSION' => ['WooCommerce', 'woocommerce'], + 'ICL_SITEPRESS_VERSION' => ['WPML', 'wpml'], + 'WPSEO_VERSION' => ['Yoast SEO', 'wordpress-seo'], + 'WORDFENCE_VERSION' => ['Wordfence Security', 'wordfence'], + 'LSCWP_V' => ['LiteSpeed Cache', 'litespeed-cache'], + 'LSCWP_CUR_V' => ['LiteSpeed Cache', 'litespeed-cache'], + 'WP_ROCKET_VERSION' => ['WP Rocket', 'wp-rocket'], + 'RANK_MATH_VERSION' => ['Rank Math SEO', 'seo-by-rank-math'], + 'AIOSEO_VERSION' => ['All in One SEO', 'all-in-one-seo-pack'], + 'SEOPRESS_VERSION' => ['SEOPress', 'wp-seopress'], + 'WPCF7_VERSION' => ['Contact Form 7', 'contact-form-7'], + 'GFAPI' => ['Gravity Forms', 'gravityforms'], + 'FLUENTFORM_VERSION' => ['Fluent Forms', 'fluentform'], + 'WPFORMS_VERSION' => ['WPForms', 'wpforms-lite'], + 'Ninja_Forms' => ['Ninja Forms', 'ninja-forms'], + 'FrmForm' => ['Formidable Forms', 'formidable'], + 'Forminator_API' => ['Forminator', 'forminator'], + 'METFORM_VERSION' => ['MetForm', 'metform'], + 'SRFM_VER' => ['SureForms', 'sureforms'], + 'TUTOR_VERSION' => ['Tutor LMS', 'tutor'], + 'LLMS_VERSION' => ['LifterLMS', 'lifterlms'], + 'Tribe__Events__Main' => ['The Events Calendar', 'the-events-calendar'], + 'AMELIA_VERSION' => ['Amelia', 'ameliabooking'], + 'FLUENTCRM' => ['FluentCRM', 'fluent-crm'], + 'FLUENTCRM_PLUGIN_VERSION' => ['FluentCRM', 'fluent-crm'], + 'MAILPOET_VERSION' => ['MailPoet', 'mailpoet'], + 'WFFN_VERSION' => ['FunnelKit', 'funnel-builder'], + 'MC4WP_VERSION' => ['Mailchimp for WordPress', 'mailchimp-for-wp'], + 'POLYLANG_VERSION' => ['Polylang', 'polylang'], + 'TRP_PLUGIN_VERSION' => ['TranslatePress', 'translatepress-multilingual'], + 'TablePress' => ['TablePress', 'tablepress'], + 'ACF' => ['Advanced Custom Fields', 'advanced-custom-fields'], + 'ET_CORE_VERSION' => ['Divi', 'divi'], + 'BRICKS_VERSION' => ['Bricks', 'bricks'], + 'CT_VERSION' => ['Oxygen', 'oxygen'], + 'FL_BUILDER_VERSION' => ['Beaver Builder', 'beaver-builder-lite-version'], + '__BREAKDANCE_VERSION' => ['Breakdance', 'breakdance'], + 'TVE_VERSION' => ['Thrive Architect', 'thrive-visual-editor'], + 'VCV_VERSION' => ['Visual Composer', 'visualcomposer'], + 'GENERATEBLOCKS_VERSION' => ['GenerateBlocks', 'generateblocks'], + 'BLOCKSY_COMPANION_VERSION' => ['Blocksy Companion', 'blocksy-companion'], + 'KIRKI_VERSION' => ['Kirki', 'kirki'], + 'OTTER_BLOCKS_VERSION' => ['Otter Blocks', 'otter-blocks'], + 'MOYASAR_VERSION' => ['Moyasar', 'moyasar'], + ]; + } +PHP; + +$pat = '/private function ampPluginLabels\(\): array \{.*?\n \}/s'; +$out = preg_replace($pat, $new, $src, 1, $cnt); +if ($cnt !== 1) { fwrite(STDERR, "ampPluginLabels anchor not matched (cnt=$cnt); aborting\n"); exit(2); } +if (file_put_contents($admin, $out) === false) { fwrite(STDERR, "write failed\n"); exit(3); } +echo "labels updated to v2\n";