false ) ); } /** * Change order of menu item so the About page menu item is below Site Stats. * * @param array $menu_order List of menu slugs. It's unaffected. This filter is used to reorder the Jetpack submenu items. * * @return array */ public function submenu_order( $menu_order ) { global $submenu; $stats_key = null; $about_key = null; foreach ( $submenu['jetpack'] as $index => $menu_item ) { if ( false !== array_search( 'stats', $menu_item, true ) ) { $stats_key = $index; } if ( false !== array_search( 'jetpack_about', $menu_item, true ) ) { $about_key = $index; } } if ( $stats_key && $about_key ) { $temp = $submenu['jetpack'][ $stats_key ]; $submenu['jetpack'][ $stats_key ] = $submenu['jetpack'][ $about_key ]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $submenu['jetpack'][ $about_key ] = $temp; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited } return $menu_order; } /** * Render the page content */ public function page_render() { ?>
    display_gravatars(); ?>

Automattic Creed.', 'jetpack' ), array( 'a' => array( 'href' => array(), 'class' => array(), 'target' => array(), 'rel' => array(), 'data-jptracks-name' => array(), ), ) ); ?>

take a look at our WordPress.org profile.', 'jetpack' ), array( 'a' => array( 'href' => array(), 'target' => array(), 'rel' => array(), 'class' => array(), 'data-jptracks-name' => array(), ), ) ); ?>

array( 'href' => array(), 'title' => array(), 'target' => array(), ), 'abbr' => array( 'title' => array() ), 'acronym' => array( 'title' => array() ), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array(), ); // slugs for plugins we want to display. $a8c_plugins = array( 'woocommerce', 'wp-super-cache', 'wp-job-manager', 'co-authors-plus', ); // need this to access the plugins_api() function. include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; $plugins = array(); foreach ( $a8c_plugins as $slug ) { $args = array( 'slug' => $slug, 'fields' => array( 'added' => false, 'author' => false, 'author_profile' => false, 'banners' => false, 'contributors' => false, 'donate_link' => false, 'homepage' => false, 'reviews' => false, 'screenshots' => false, 'support_threads' => false, 'support_threads_resolved' => false, 'sections' => false, 'tags' => false, 'versions' => false, 'compatibility' => true, 'downloaded' => true, 'downloadlink' => true, 'icons' => true, 'last_updated' => true, 'num_ratings' => true, 'rating' => true, 'requires' => true, 'requires_php' => true, 'short_description' => true, 'tested' => true, ), ); // should probably add some error checking here too. $api = plugins_api( 'plugin_information', $args ); $plugins[] = $api; } foreach ( $plugins as $plugin ) { if ( is_object( $plugin ) ) { $plugin = (array) $plugin; } $title = wp_kses( $plugin['name'], $plugins_allowedtags ); $version = wp_kses( $plugin['version'], $plugins_allowedtags ); $name = wp_strip_all_tags( $title . ' ' . $version ); // Remove any HTML from the description. $description = wp_strip_all_tags( $plugin['short_description'] ); $wp_version = get_bloginfo( 'version' ); $compatible_php = ( empty( $plugin['requires_php'] ) || version_compare( phpversion(), $plugin['requires_php'], '>=' ) ); $compatible_wp = ( empty( $plugin['requires'] ) || version_compare( $wp_version, $plugin['requires'], '>=' ) ); $action_links = array(); // install button. if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) { $status = install_plugin_install_status( $plugin ); switch ( $status['status'] ) { case 'install': if ( $status['url'] ) { if ( $compatible_php && $compatible_wp ) { $action_links[] = sprintf( '%5$s', esc_attr( $plugin['slug'] ), esc_url( $status['url'] ), /* translators: %s: plugin name and version */ esc_attr( sprintf( __( 'Install %s now', 'jetpack' ), $name ) ), esc_attr( $name ), esc_html__( 'Install Now', 'jetpack' ) ); } else { $action_links[] = sprintf( '', _x( 'Cannot Install', 'plugin', 'jetpack' ) ); } } break; case 'update_available': if ( $status['url'] ) { $action_links[] = sprintf( '%6$s', esc_attr( $status['file'] ), esc_attr( $plugin['slug'] ), esc_url( $status['url'] ), /* translators: %s: plugin name and version */ esc_attr( sprintf( __( 'Update %s now', 'jetpack' ), $name ) ), esc_attr( $name ), __( 'Update Now', 'jetpack' ) ); } break; case 'latest_installed': case 'newer_installed': if ( is_plugin_active( $status['file'] ) ) { $action_links[] = sprintf( '', _x( 'Active', 'plugin', 'jetpack' ) ); } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) { $button_text = __( 'Activate', 'jetpack' ); /* translators: %s: plugin name */ $button_label = _x( 'Activate %s', 'plugin', 'jetpack' ); $activate_url = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ), 'action' => 'activate', 'plugin' => $status['file'], ), network_admin_url( 'plugins.php' ) ); if ( is_network_admin() ) { $button_text = __( 'Network Activate', 'jetpack' ); /* translators: %s: plugin name */ $button_label = _x( 'Network Activate %s', 'plugin', 'jetpack' ); $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url ); } $action_links[] = sprintf( '%4$s', esc_url( $activate_url ), esc_attr( sprintf( $button_label, $plugin['name'] ) ), esc_attr( $plugin['name'] ), $button_text ); } else { $action_links[] = sprintf( '', _x( 'Installed', 'plugin', 'jetpack' ) ); } break; } } $plugin_install = "plugin-install.php?tab=plugin-information&plugin={$plugin['slug']}&TB_iframe=true&width=600&height=550"; $details_link = is_multisite() ? network_admin_url( $plugin_install ) : admin_url( $plugin_install ); if ( ! empty( $plugin['icons']['svg'] ) ) { $plugin_icon_url = $plugin['icons']['svg']; } elseif ( ! empty( $plugin['icons']['2x'] ) ) { $plugin_icon_url = $plugin['icons']['2x']; } elseif ( ! empty( $plugin['icons']['1x'] ) ) { $plugin_icon_url = $plugin['icons']['1x']; } else { $plugin_icon_url = $plugin['icons']['default']; } ?>
  • '; if ( ! $compatible_php && ! $compatible_wp ) { esc_html_e( 'This plugin doesn’t work with your versions of WordPress and PHP.', 'jetpack' ); if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { printf( /* translators: 1: "Update WordPress" screen URL, 2: "Update PHP" page URL */ ' ' . wp_kses( __( 'Please update WordPress, and then learn more about updating PHP.', 'jetpack' ), array( 'a' => array( 'href' => true ) ) ), esc_url( self_admin_url( 'update-core.php' ) ), esc_url( $this->jp_get_update_php_url() ) ); $this->jp_update_php_annotation(); } elseif ( current_user_can( 'update_core' ) ) { printf( /* translators: %s: "Update WordPress" screen URL */ ' ' . wp_kses( __( 'Please update WordPress.', 'jetpack' ), array( 'a' => array( 'href' => true ) ) ), esc_url( self_admin_url( 'update-core.php' ) ) ); } elseif ( current_user_can( 'update_php' ) ) { printf( /* translators: %s: "Update PHP" page URL */ ' ' . wp_kses( __( 'Learn more about updating PHP.', 'jetpack' ), array( 'a' => array( 'href' => true ) ) ), esc_url( $this->jp_get_update_php_url() ) ); $this->jp_update_php_annotation(); } } elseif ( ! $compatible_wp ) { esc_html_e( 'This plugin doesn’t work with your version of WordPress.', 'jetpack' ); if ( current_user_can( 'update_core' ) ) { printf( /* translators: %s: "Update WordPress" screen URL */ ' ' . wp_kses( __( 'Please update WordPress.', 'jetpack' ), array( 'a' => array( 'href' => true ) ) ), esc_url( self_admin_url( 'update-core.php' ) ) ); } } elseif ( ! $compatible_php ) { esc_html_e( 'This plugin doesn’t work with your version of PHP.', 'jetpack' ); if ( current_user_can( 'update_php' ) ) { printf( /* translators: %s: "Update PHP" page URL */ ' ' . wp_kses( __( 'Learn more about updating PHP.', 'jetpack' ), array( 'a' => array( 'href' => true ) ) ), esc_url( $this->jp_get_update_php_url() ) ); $this->jp_update_php_annotation(); } } echo '

    '; } ?>

    $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'], ) ); ?>
    = 1000000 ) { $active_installs_millions = floor( $plugin['active_installs'] / 1000000 ); $active_installs_text = sprintf( /* translators: number of millions of installs. */ _nx( '%s+ Million', '%s+ Million', $active_installs_millions, 'Active plugin installations', 'jetpack' ), number_format_i18n( $active_installs_millions ) ); } elseif ( 0 === $plugin['active_installs'] ) { $active_installs_text = _x( 'Less Than 10', 'Active plugin installations', 'jetpack' ); } else { $active_installs_text = number_format_i18n( $plugin['active_installs'] ) . '+'; } /* translators: number of active installs */ printf( esc_html__( '%s Active Installations', 'jetpack' ), esc_html( $active_installs_text ) ); ?>
  • ' . implode( '
  • ', $action_links ) . '
  • '; } ?> ' . "\n"; } echo wp_kses( $output, array( 'li' => true, 'img' => array( 'src' => true, ), ) ); } // The following methods jp_get_update_php_url, jp_get_default_update_php_url, and jp_update_php_annotation, // are copies of functions introduced in WP 5.1 // At the time of releasing this, we're still supporting WP 5.0, so we needed // to have them here to avoid fatal errors in old installations. /** * Gets the URL to learn more about updating the PHP version the site is running on. * * This URL can be overridden by specifying an environment variable `WP_UPDATE_PHP_URL` or by using the * {@see 'wp_update_php_url'} filter. Providing an empty string is not allowed and will result in the * default URL being used. Furthermore the page the URL links to should preferably be localized in the * site language. * * @todo: Remove when 5.1 is minimum WP version. * @since 5.1.0 * * @return string URL to learn more about updating PHP. */ private function jp_get_update_php_url() { $default_url = $this->jp_get_default_update_php_url(); $update_url = $default_url; if ( false !== getenv( 'WP_UPDATE_PHP_URL' ) ) { $update_url = getenv( 'WP_UPDATE_PHP_URL' ); } /** * Filters the URL to learn more about updating the PHP version the site is running on. * * Providing an empty string is not allowed and will result in the default URL being used. Furthermore * the page the URL links to should preferably be localized in the site language. * * @since 5.1.0 * * @param string $update_url URL to learn more about updating PHP. */ $update_url = apply_filters( 'wp_update_php_url', $update_url ); if ( empty( $update_url ) ) { $update_url = $default_url; } return $update_url; } /** * Gets the default URL to learn more about updating the PHP version the site is running on. * * Do not use this function to retrieve this URL. Instead, use {@see wp_get_update_php_url()} when relying on the URL. * This function does not allow modifying the returned URL, and is only used to compare the actually used URL with the * default one. * * @todo: Remove when 5.1 is minimum WP version. * @since 5.1.0 * @access private * * @return string Default URL to learn more about updating PHP. */ private function jp_get_default_update_php_url() { return _x( 'https://wordpress.org/support/update-php/', 'localized PHP upgrade information page', 'jetpack' ); } /** * Prints the default annotation for the web host altering the "Update PHP" page URL. * * This function is to be used after {@see wp_get_update_php_url()} to display a consistent * annotation if the web host has altered the default "Update PHP" page URL. * * @todo: Remove when 5.1 is minimum WP version. * @since 5.1.0 */ private function jp_update_php_annotation() { $update_url = $this->jp_get_update_php_url(); $default_url = $this->jp_get_default_update_php_url(); if ( $update_url === $default_url ) { return; } echo '

    '; printf( wp_kses( /* translators: %s: default Update PHP page URL */ __( 'This resource is provided by your web host, and is specific to your site. For more information, see the official WordPress documentation.', 'jetpack' ), array( 'a' => array( 'href' => true, 'rel' => true, ), ) ), esc_url( $default_url ) ); echo '

    '; } }