array( 'plugin' => 'Jetpack Protect', ), ); return $slugs; } ); add_action( 'admin_notices', function () { if ( get_current_screen()->id !== 'plugins' ) { return; } $message = sprintf( wp_kses( /* translators: Placeholder is a link to a support document. */ __( 'Your installation of Jetpack Protect is incomplete. If you installed Jetpack Protect from GitHub, please refer to this document to set up your development environment. Jetpack Protect must have Composer dependencies installed and built via the build command.', 'jetpack-protect' ), array( 'a' => array( 'href' => array(), 'target' => array(), 'rel' => array(), ), ) ), 'https://github.com/Automattic/jetpack/blob/trunk/docs/development-environment.md#building-your-project' ); wp_admin_notice( $message, array( 'type' => 'error', 'dismissible' => true, ) ); } ); return; } // Redirect to plugin page when the plugin is activated. add_action( 'activated_plugin', 'jetpack_protect_plugin_activation' ); /** * Redirects to plugin page when the plugin is activated * * @param string $plugin Path to the plugin file relative to the plugins directory. */ function jetpack_protect_plugin_activation( $plugin ) { if ( JETPACK_PROTECT_ROOT_FILE_RELATIVE_PATH === $plugin && ( new \Automattic\Jetpack\Paths() )->is_current_request_activating_plugin_from_plugins_screen( JETPACK_PROTECT_ROOT_FILE_RELATIVE_PATH ) ) { wp_safe_redirect( esc_url( admin_url( 'admin.php?page=jetpack-protect' ) ) ); exit; } } // Add "Settings" link to plugins page. add_filter( 'plugin_action_links_' . JETPACK_PROTECT_FOLDER . '/jetpack-protect.php', function ( $actions ) { $settings_link = '' . __( 'Dashboard', 'jetpack-protect' ) . ''; array_unshift( $actions, $settings_link ); return $actions; } ); register_activation_hook( __FILE__, array( 'Jetpack_Protect', 'plugin_activation' ) ); register_deactivation_hook( __FILE__, array( 'Jetpack_Protect', 'plugin_deactivation' ) ); // Main plugin class. new Jetpack_Protect();