Making WordPress.org


Ignore:
Timestamp:
10/19/2016 02:30:54 AM (9 years ago)
Author:
dd32
Message:

Plugin Directory: Move the Stats from wp-admin to the front-end /$plugin/admin/ screen.
This also implements the capabilities required for access to the plugin admin screen for each plugin.

See #2111

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/functions.php

    r3834 r4260  
    8383    ) );
    8484
     85    if ( get_query_var( 'plugin_admin' ) ) {
     86        wp_enqueue_script( 'google-jsapi', 'https://www.google.com/jsapi', array(), false, true );
     87        wp_enqueue_script( 'wporg-plugins-stats', get_template_directory_uri() . '/js/stats.js', array( 'jquery', 'google-jsapi' ), '20161019', true );
     88
     89
     90        wp_localize_script( 'wporg-plugins-stats', 'pluginStats', array(
     91            'slug' => is_singular( 'plugin' ) ? get_queried_object()->post_name : '',
     92            'l10n' => array(
     93                'date'      => __( 'Date', 'wporg-plugins' ),
     94                'downloads' => __( 'Downloads', 'wporg-plugins' ),
     95                'noData'    => __( 'No data yet', 'wporg-plugins' ),
     96                'today'     => __( 'Today', 'wporg-plugins' ),
     97                'yesterday' => __( 'Yesterday', 'wporg-plugins' ),
     98                'last_week' => __( 'Last Week', 'wporg-plugins' ),
     99                'all_time'  => __( 'All Time', 'wporg-plugins' ),
     100            ),
     101        ) );
     102
     103    }
     104
    85105    if ( isset( $_REQUEST['react'] ) ) {
    86106        wp_enqueue_script( 'wporg-plugins-client', get_template_directory_uri() . '/js/theme.js', array(), false, true );
Note: See TracChangeset for help on using the changeset viewer.