*/ const PLUGINS = array( '360-orbit-media-cleaner' => array( 'name' => '360 Orbit Media Cleaner', 'basename' => '360-orbit-media-cleaner/360-orbit-media-cleaner.php', 'page' => 'wp360-media-cleaner', 'version_constant' => 'WP360_MC_VERSION', ), '360-orbit-nocookie-analytics' => array( 'name' => '360 Orbit NoCookie Analytics', 'basename' => '360-orbit-nocookie-analytics/360-orbit-nocookie-analytics.php', 'page' => 'wp360-nca-stats', 'version_constant' => 'WP360_NCA_VERSION', ), '360-orbit-header-security' => array( 'name' => '360 Orbit Header Security', 'basename' => '360-orbit-header-security/360-orbit-header-security.php', 'page' => 'wp360-header-security', 'version_constant' => 'WP360_HS_VERSION', ), '360-orbit-speed-optimizer' => array( 'name' => '360 Orbit Speed Optimizer', 'basename' => '360-orbit-speed-optimizer/360-orbit-speed-optimizer.php', 'page' => 'wp360-speed-optimizer', 'version_constant' => 'WP360_SO_VERSION', ), '360-orbit-login-guard' => array( 'name' => '360 Orbit Login Guard', 'basename' => '360-orbit-login-guard/360-orbit-login-guard.php', 'page' => 'wp360-login-guard', 'version_constant' => 'WP360_LG_VERSION', ), '360-orbit-security-digest' => array( 'name' => '360 Orbit Security Digest', 'basename' => '360-orbit-security-digest/360-orbit-security-digest.php', 'page' => 'wp360-security-digest', 'version_constant' => 'WP360_SD_VERSION', ), '360-orbit-privacy-toolkit' => array( 'name' => '360 Orbit Privacy Toolkit', 'basename' => '360-orbit-privacy-toolkit/360-orbit-privacy-toolkit.php', 'page' => 'wp360-privacy-toolkit', 'version_constant' => 'WP360_PT_VERSION', ), '360-orbit-database-cleaner' => array( 'name' => '360 Orbit Database Cleaner', 'basename' => '360-orbit-database-cleaner/360-orbit-database-cleaner.php', 'page' => 'wp360-database-cleaner', 'version_constant' => 'WP360_DC_VERSION', ), ); /** * Kurzbeschreibungen der Suite-Plugins (uebersetzbar, deshalb keine Konstante). * * @return array */ private static function descriptions() { return array( '360-orbit-media-cleaner' => __( 'Finds unused media files and outdated image sizes.', '360-orbit-speed-optimizer' ), '360-orbit-nocookie-analytics' => __( 'Cookieless website statistics.', '360-orbit-speed-optimizer' ), '360-orbit-header-security' => __( 'HTTP security headers with guided setup.', '360-orbit-speed-optimizer' ), '360-orbit-speed-optimizer' => __( 'Caching, compression and cleanup via .htaccess.', '360-orbit-speed-optimizer' ), '360-orbit-login-guard' => __( 'Protects the login area from brute-force attacks.', '360-orbit-speed-optimizer' ), '360-orbit-security-digest' => __( 'A weekly digest email instead of constant update notices.', '360-orbit-speed-optimizer' ), '360-orbit-privacy-toolkit' => __( 'Anonymizes comment IPs and helps with the privacy policy.', '360-orbit-speed-optimizer' ), '360-orbit-database-cleaner' => __( 'Relieves the database: autoloaded options, expired transients and old revisions.', '360-orbit-speed-optimizer' ), ); } /** * Meldet dieses Plugin an der Uebersicht an (Filter 'wp360_orbit_plugins'). * * @param mixed $plugins Bisher angemeldete Plugins: Slug => Eintrag. * @return array */ public static function register_self( $plugins ) { if ( ! is_array( $plugins ) ) { $plugins = array(); } $plugins['360-orbit-speed-optimizer'] = array( 'name' => '360 Orbit Speed Optimizer', 'basename' => '360-orbit-speed-optimizer/360-orbit-speed-optimizer.php', 'page' => 'wp360-speed-optimizer', 'version_constant' => 'WP360_SO_VERSION', 'description' => __( 'Caching, compression and cleanup via .htaccess.', '360-orbit-speed-optimizer' ), ); return $plugins; } /** * Alle Plugins der Suite fuer die Uebersicht: der feste Bestand und alle, die sich * per Filter angemeldet haben (deren Angaben gehen vor). * * @return array> */ public static function all_plugins() { $plugins = self::PLUGINS; $registered = apply_filters( 'wp360_orbit_plugins', array() ); if ( ! is_array( $registered ) ) { return $plugins; } foreach ( $registered as $slug => $entry ) { $clean = self::clean_entry( $slug, $entry ); if ( null === $clean ) { continue; } $plugins[ $slug ] = isset( $plugins[ $slug ] ) ? array_merge( $plugins[ $slug ], $clean ) : $clean; } return $plugins; } /** * Prueft einen angemeldeten Eintrag. Ein Plugin darf sich nur unter seinem eigenen * Ordner anmelden, der Rest sind Namen und Seitenkennung. * * @param mixed $slug Schluessel (Ordnername des Plugins). * @param mixed $entry Angaben des Plugins. * @return array|null Bereinigter Eintrag oder null. */ public static function clean_entry( $slug, $entry ) { if ( ! is_string( $slug ) || 1 !== preg_match( '/^360-orbit-[a-z0-9-]+$/', $slug ) || ! is_array( $entry ) ) { return null; } $text = static function ( $value, $max ) { return is_string( $value ) ? trim( substr( preg_replace( '/[\x00-\x1F\x7F<>]/', '', $value ), 0, $max ) ) : ''; }; $name = $text( isset( $entry['name'] ) ? $entry['name'] : '', 80 ); $page = isset( $entry['page'] ) && is_string( $entry['page'] ) ? $entry['page'] : ''; $constant = isset( $entry['version_constant'] ) && is_string( $entry['version_constant'] ) ? $entry['version_constant'] : ''; if ( '' === $name || $slug . '/' . $slug . '.php' !== ( isset( $entry['basename'] ) ? $entry['basename'] : '' ) || 1 !== preg_match( '/^[a-z0-9_-]{1,64}$/', $page ) || 1 !== preg_match( '/^[A-Z][A-Z0-9_]{0,63}$/', $constant ) ) { return null; } $clean = array( 'name' => $name, 'basename' => $slug . '/' . $slug . '.php', 'page' => $page, 'version_constant' => $constant, ); $description = $text( isset( $entry['description'] ) ? $entry['description'] : '', 300 ); if ( '' !== $description ) { $clean['description'] = $description; } return $clean; } public static function init() { add_action( 'admin_menu', array( __CLASS__, 'register_parent' ), 5 ); add_filter( 'wp360_orbit_plugins', array( __CLASS__, 'register_self' ) ); } public static function register_parent() { global $admin_page_hooks; if ( isset( $admin_page_hooks[ self::SLUG ] ) ) { return; } add_menu_page( '360 WP Orbit', '360 WP Orbit', 'manage_options', self::SLUG, array( __CLASS__, 'render_overview' ), self::ICON, 58 ); // Denselben Slug wie add_menu_page als erste Unterseite registrieren -- // sonst legt WP dort automatisch einen Duplikat-Eintrag "360 WP Orbit" // an, statt ihn wie hier in "Uebersicht" umzubenennen. add_submenu_page( self::SLUG, __( '360 WP Orbit – Overview', '360-orbit-speed-optimizer' ), __( 'Overview', '360-orbit-speed-optimizer' ), 'manage_options', self::SLUG, array( __CLASS__, 'render_overview' ) ); } public static function render_overview() { if ( ! function_exists( 'is_plugin_active' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $descriptions = self::descriptions(); ?>

360 WP Orbit

$plugin ) : ?>
·