basename = plugin_basename( __FILE__ ); $this->url = plugin_dir_url( __FILE__ ); $this->path = plugin_dir_path( __FILE__ ); } /** * Attach other plugin classes to the base plugin class. * * @since 0.0.0 */ public function plugin_classes() { $this->wp_admin = new PD_Wp_Admin( $this ); } // END OF PLUGIN CLASSES FUNCTION /** * Add hooks and filters. * Priority needs to be * < 10 for CPT_Core, * < 5 for Taxonomy_Core, * and 0 for Widgets because widgets_init runs at init priority 1. * * @since 0.0.0 */ public function hooks() { add_action( 'init', array( $this, 'init' ), 0 ); } /** * Activate the plugin. * * @since 0.0.0 */ public function _activate() { // Bail early if requirements aren't met. if ( ! $this->check_requirements() ) { return; } // Make sure any rewrite functionality has been loaded. flush_rewrite_rules(); } /** * Deactivate the plugin. * Uninstall routines should be in uninstall.php. * * @since 0.0.0 */ public function _deactivate() { // Add deactivation cleanup functionality here. } /** * Init hooks * * @since 0.0.0 */ public function init() { // Bail early if requirements aren't met. if ( ! $this->check_requirements() ) { return; } // Load translated strings for plugin. load_plugin_textdomain( 'plugin-detective', false, dirname( $this->basename ) . '/languages/' ); // Initialize plugin classes. $this->plugin_classes(); } /** * Check if the plugin meets requirements and * disable it if they are not present. * * @since 0.0.0 * * @return boolean True if requirements met, false if not. */ public function check_requirements() { // Bail early if plugin meets requirements. if ( $this->meets_requirements() ) { return true; } // Add a dashboard notice. add_action( 'all_admin_notices', array( $this, 'requirements_not_met_notice' ) ); // Deactivate our plugin. add_action( 'admin_init', array( $this, 'deactivate_me' ) ); // Didn't meet the requirements. return false; } /** * Deactivates this plugin, hook this function on admin_init. * * @since 0.0.0 */ public function deactivate_me() { // We do a check for deactivate_plugins before calling it, to protect // any developers from accidentally calling it too early and breaking things. if ( function_exists( 'deactivate_plugins' ) ) { deactivate_plugins( $this->basename ); } } /** * Check that all plugin requirements are met. * * @since 0.0.0 * * @return boolean True if requirements are met. */ public function meets_requirements() { // Do checks for required classes / functions or similar. // Add detailed messages to $this->activation_errors array. if ( defined( 'MULTISITE' ) && MULTISITE || ( function_exists( 'is_multsite' ) && is_multsite() ) ) { $this->activation_errors[] = '
Unfortunately we don\'t support multisite yet. We wanted to get Plugin Detective out there for people to use as soon as possible, but there’s a good amount of work to do before it will support multisite. As you may know, multisite can get a bit complicated.
With a single install, it’s easy to determine which plugins are active and manipulate them. With a multisite, there are network-activated plugins and plugins at the site level. And theoretically Plugin Detective could be run the whole network, or just looking at a single site. And there are permission differences between a network admin and a site admin. So it will take some work for us to support all that. We want to see how much interest there is in supporting multisite, and get some feedback from multisite users to understand what would be most useful for them and how they’d use it.
If you\'re reading this, you likely want to use Plugin Detective to troubleshoot multisite installs. Please send us an email (support@tylerdigital.com) to let us know you\'re interested and answer a few questions to help us build this the right way:
Would this just be a tool for you (the network admin)?
Or would you want your site admins to be able to run it (and I assume they could only test their site-activated plugins, not disable any that you’ve network-activated?)
Thanks,
Nathan & Natalie