PluginProbe ʕ •ᴥ•ʔ
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets / 4.9.5
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets v4.9.5
4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.0 2.5.1 3.0.0 3.1.0 3.1.1 4.0.0 4.0.1 4.1.0 4.1.1 4.2.0 4.2.1 4.3.0 4.3.1 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.6.8 4.6.9 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.7.6 4.7.7 4.7.8 4.7.9 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.8.5 4.8.6 4.8.7 4.8.8 4.8.9 trunk 0.1.2-beta 0.1.3-beta 0.1.4-beta 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.5.0 1.5.1 1.6.0 1.6.1 1.7.0 1.8.0 1.8.1 1.9.0
shopengine / utils / onboard / auto-install-tracker.php
shopengine / utils / onboard Last commit date
auto-install-notice.php 1 week ago auto-install-tracker.php 1 week ago plugin-installer.php 1 week ago plugin-skin.php 1 year ago
auto-install-tracker.php
81 lines
1 <?php
2
3 namespace ShopEngine\Utils\Onboard;
4
5 defined( 'ABSPATH' ) || exit;
6
7 /**
8 * Tracks which plugins were silently installed during a wpmet onboarding flow.
9 *
10 * When ShopEngine installs another plugin during onboarding, mark() does two things:
11 * 1. Writes the slug to the shared `wpmet_onboarded_plugins` option (registry).
12 * 2. Directly sets the installed plugin's own onboard status option so its wizard
13 * never appears — even if that plugin hasn't been updated to check the registry.
14 */
15 class Auto_Install_Tracker {
16
17 const OPTION_KEY = 'wpmet_onboarded_plugins';
18
19 /**
20 * Core wpmet plugins that ShopEngine knows about by default.
21 * Each plugin should also register itself via the 'wpmet_onboard_status_map' filter
22 * so no single plugin needs to maintain the full list.
23 *
24 * 'plugin-file' => [ 'option' => 'wp_option_name', 'value' => value_when_done ]
25 */
26 const ONBOARD_STATUS_MAP = [
27 'metform/metform.php' => [ 'option' => 'met_form_onboard_status', 'value' => 'onboarded' ],
28 'elementskit-lite/elementskit-lite.php' => [ 'option' => 'elements_kit_onboard_status', 'value' => 'onboarded' ],
29 'emailkit/EmailKit.php' => [ 'option' => 'emailkit_onboard_status', 'value' => 'onboarded' ],
30 'shopengine/shopengine.php' => [ 'option' => 'shopengine_onboard_status', 'value' => true ],
31 'gutenkit-blocks-addon/gutenkit-blocks-addon.php' => [ 'option' => 'gutenkit_onboard_status', 'value' => 'onboarded' ],
32 'getgenie/getgenie.php' => [ 'option' => 'getgenie_onboard_status', 'value' => 'onboarded' ],
33 'popup-builder-block/popup-builder-block.php' => [ 'option' => 'popupkit_onboard_status', 'value' => 'onboarded' ],
34 ];
35
36 /**
37 * Record a plugin as auto-installed and directly mark its onboarding as complete.
38 *
39 * @param string $plugin_file e.g. 'metform/metform.php'
40 * @param string $installed_by Slug of the plugin that triggered the install.
41 */
42 public static function mark( string $plugin_file, string $installed_by = 'shopengine' ): void {
43 // 1. Write to shared registry.
44 $registry = self::get_registry();
45 if ( ! isset( $registry[ $plugin_file ] ) ) {
46 $registry[ $plugin_file ] = [
47 'installed_by' => $installed_by,
48 'installed_at' => time(),
49 ];
50 update_option( self::OPTION_KEY, $registry, false );
51 }
52
53 // 2. Directly set the installed plugin's own onboard status.
54 // Each plugin registers itself via 'wpmet_onboard_status_map' filter;
55 // ONBOARD_STATUS_MAP is just the fallback for plugins that haven't done so yet.
56 $map = apply_filters( 'wpmet_onboard_status_map', self::ONBOARD_STATUS_MAP );
57 if ( isset( $map[ $plugin_file ] ) && ! get_option( $map[ $plugin_file ]['option'] ) ) {
58 update_option( $map[ $plugin_file ]['option'], $map[ $plugin_file ]['value'], false );
59 }
60 }
61
62 /**
63 * Check whether a plugin was installed during any wpmet onboarding flow.
64 *
65 * @param string $plugin_file e.g. 'metform/metform.php'
66 * @return bool
67 */
68 public static function was_auto_installed( string $plugin_file ): bool {
69 return isset( self::get_registry()[ $plugin_file ] );
70 }
71
72 /**
73 * Return the full registry array.
74 *
75 * @return array<string, array{installed_by: string, installed_at: int}>
76 */
77 public static function get_registry(): array {
78 return (array) get_option( self::OPTION_KEY, [] );
79 }
80 }
81