plugin_file = false; } // Only wire the notice, its assets, and the plugins-list row when a // dependency is actually missing — the same gating the pro plugin uses, // so the red row never lingers once WooCommerce is active. if ( ! file_exists( $plugin_file ) || ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) { $this->required_plugins[] = 'WooCommerce'; add_action( 'admin_notices', array( $this, 'install_plugin_notice' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) ); add_action( 'after_plugin_row_' . plugin_basename( SUBSCRPT_FILE ), array( $this, 'required_plugins_row' ), 10, 2 ); } } /** * Render a warning row below this plugin's row on the plugins list page. * * Mirrors the pro plugin's row: flags that the plugin is not fully active * and lists what it still needs. * * @return void */ public function required_plugins_row() { if ( empty( $this->required_plugins ) ) { return; } $show_auto_updates = function_exists( 'wp_is_auto_update_enabled_for_type' ) && wp_is_auto_update_enabled_for_type( 'plugin' ); ?>

required_plugins ) ) { return; } // Version the installer stylesheet by file mtime so CSS edits bust the // browser cache: the plugin version is a build-time placeholder and does // not change in place, so it cannot do that on its own. $installer_css = SUBSCRPT_PATH . '/assets/css/installer.css'; if ( file_exists( $installer_css ) && wp_style_is( 'sdevs_installer', 'registered' ) ) { wp_styles()->registered['sdevs_installer']->ver = (string) filemtime( $installer_css ); } if ( ! wp_style_is( 'sdevs_installer' ) ) { wp_enqueue_style( 'sdevs_installer' ); } if ( ! wp_script_is( 'sdevs_installer' ) ) { wp_enqueue_script( 'sdevs_installer' ); wp_localize_script( 'sdevs_installer', 'sdevs_installer_helper_obj', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); } } public function install_plugin_notice() { if ( $this->plugin_file ) { $id = 'sdevs-activate-plugin'; $label = __( 'Activate Woocommerce', 'subscription' ); } else { $id = 'sdevs-install-plugin'; $label = __( 'Install Woocommerce', 'subscription' ); } include 'views/required-notice.php'; } }