childFile = __FILE__; add_filter( 'mainwp_getextensions', array( &$this, 'get_this_extension' ) ); $this->mainwpMainActivated = apply_filters( 'mainwp_activated_check', false ); if ( $this->mainwpMainActivated !== false ) { $this->activate_this_plugin(); } else { add_action( 'mainwp_activated', array( &$this, 'activate_this_plugin' ) ); } add_action( 'admin_notices', array( &$this, 'mainwp_error_notice' ) ); } /** * Add your extension to MainWP via the 'mainwp_getextensions' filter. * * @param array $params Array containing the extensions info. * * @return array $params Updated array containing the extensions info. */ public function get_this_extension( $params ) { $params[] = array( 'plugin' => __FILE__, 'api' => $this->plugin_handle, 'mainwp' => false, 'callback' => array( &$this, 'settings' ), 'apiManager' => false, ); return $params; } /** * Displays the extension page with an adequate header and footer. */ public function settings() { do_action( 'mainwp_pageheader_extensions', __FILE__ ); ?>

mainwpMainActivated = apply_filters( 'mainwp_activated_check', $this->mainwpMainActivated ); $this->childEnabled = apply_filters( 'mainwp_extension_enabled_check', __FILE__ ); $this->childKey = $this->childEnabled['key']; } /** * Get the extension key. * * @return string */ public function get_child_key() { return $this->childKey; } /** * Get the extension file. * * @return string */ public function get_child_file() { return $this->childFile; } /** * Render the warning notice if the MainWP Dashboard plugin is not activated. */ public function mainwp_error_notice() { global $current_screen; if ( $current_screen->parent_base == 'plugins' && $this->mainwpMainActivated == false ) { echo '

MainWP Hello World Extension ' . __( 'requires MainWP Dashboard Plugin to be activated in order to work. Please install and activate MainWP Dashboard Plugin first.', 'mainwp' ) . '

'; } } } global $mainWPHelloWorldExtensionActivator; $mainWPHelloWorldExtensionActivator = new MainWP_HelloWorld_Extension_Activator();