Plugin Directory

Changeset 694698


Ignore:
Timestamp:
04/09/2013 06:08:58 PM (13 years ago)
Author:
nickdaugherty
Message:

Version 1.2, including several UI improvements and new plugins / constants

Location:
developer/trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • developer/trunk/developer.css

    r560881 r694698  
    11.a8c-developer-dialog {
    22    margin: 25px;
     3}
     4
     5.a8c-developer-dialog .recommended-plugins td {
     6    vertical-align: top;
     7    padding-bottom: 10px;
    38}
    49
     
    1217    color: maroon;
    1318}
     19
     20.a8c-developer-action-result.error {
     21    color: red;
     22    font-style: italic;
     23    padding-left: 5px;
     24}
  • developer/trunk/developer.js

    r592210 r694698  
    66                href: href,
    77                title: a8c_developer_i18n.lightbox_title,
    8                 innerWidth: 500,
     8                innerWidth: 650,
    99                maxHeight: '100%',
    1010                transition: transition
     
    6161                .success( function( result ) {
    6262                    if ( '1' === result ) {
    63                         $(button).html( a8c_developer_i18n.installed );
     63                        $( button )
     64                            .html( a8c_developer_i18n.installed )
     65                            .nextAll( '.a8c-developer-action-result' )
     66                            .remove();
     67
    6468                        $(button).unbind('click').prop('disabled', true);
    6569                    } else {
    6670                        alert( result );
    67                         $(button).html( a8c_developer_i18n.error );
    68                     }
    69                 })
    70                 .error( function() {
    71                     $(button).html( a8c_developer_i18n.error );
     71
     72                        $( button )
     73                            .html( a8c_developer_i18n.ERROR )
     74                            .nextAll( '.a8c-developer-action-result' )
     75                            .remove();
     76
     77                        $( button ).after( '<span class="a8c-developer-action-result error">' + result + '</span>' );
     78                    }
     79                })
     80                .error( function( response ) {
     81                    $( button )
     82                        .html( a8c_developer_i18n.ERROR )
     83                        .nextAll( '.a8c-developer-action-result' )
     84                        .remove();
     85
     86                    $( button ).after( '<span class="a8c-developer-action-result error">' + response.statusText + ': ' + response.responseText + '</span>' );
    7287                })
    7388            ;
     
    86101                .success( function( result ) {
    87102                    if ( '1' === result ) {
    88                         $(button).html( a8c_developer_i18n.activated );
     103                        $( button )
     104                            .html( a8c_developer_i18n.activated )
     105                            .nextAll( '.a8c-developer-action-result' )
     106                            .remove();
     107
    89108                        $(button).unbind('click').prop('disabled', true);
    90109                    } else {
    91110                        alert( result );
    92                         $(button).html( a8c_developer_i18n.error );
    93                     }
    94                 })
    95                 .error( function() {
    96                     $(button).html( a8c_developer_i18n.error );
    97                 })
    98             ;
     111
     112                        $( button )
     113                            .html( a8c_developer_i18n.ERROR )
     114                            .nextAll( '.a8c-developer-action-result' )
     115                            .remove();
     116
     117                        $( button ).after( '<span class="a8c-developer-action-result error">' + result + '</span>' );
     118                    }
     119                })
     120                .error( function( response ) {
     121                    $( button )
     122                        .html( a8c_developer_i18n.ERROR )
     123                        .nextAll( '.a8c-developer-action-result' )
     124                        .remove();
     125
     126                    $( button ).after( '<span class="a8c-developer-action-result error">' + response.statusText + ': ' + response.responseText + '</span>' );
     127                })
     128            ;
     129        });
     130
     131        $( '.a8c-developer-button-close' ).on( 'click', function() {
     132            $.colorbox.close();
    99133        });
    100134    })(jQuery);
     
    115149                .success( function( result ) {
    116150                    if ( '1' == result ) {
    117                         $(button).html( a8c_developer_i18n.INSTALLED );
    118                     } else {
    119                         $(button).html( a8c_developer_i18n.ERROR );
    120                     }
    121                 })
    122                 .error( function() {
    123                     $(button).html( a8c_developer_i18n.ERROR );
     151                        $( button )
     152                            .nextAll( '.a8c-developer-action-result' )
     153                            .remove();
     154
     155                        $( button ).replaceWith( "<span class='a8c-developer-active'>" + a8c_developer_i18n.ACTIVE + "</span>" );
     156                    } else {
     157                        $( button )
     158                            .html( a8c_developer_i18n.ERROR )
     159                            .nextAll( '.a8c-developer-action-result' )
     160                            .remove();
     161
     162                        $( button ).after( '<span class="a8c-developer-action-result error">' + result + '</span>' );
     163                    }
     164                })
     165                .error( function( response ) {
     166                    $( button )
     167                        .html( a8c_developer_i18n.ERROR )
     168                        .nextAll( '.a8c-developer-action-result' )
     169                        .remove();
     170
     171                    $( button ).after( '<span class="a8c-developer-action-result error">' + response.statusText + ': ' + response.responseText + '</span>' );
    124172                })
    125173            ;
     
    140188                .success( function( result ) {
    141189                    if ( '1' == result ) {
    142                         $(button).replaceWith("<span class='a8c-developer-active'>" + a8c_developer_i18n.ACTIVE + "</span>");
    143                     } else {
    144                         $(button).html( a8c_developer_i18n.ERROR );
    145                     }
    146                 })
    147                 .error( function() {
    148                     $(button).html( a8c_developer_i18n.ERROR );
     190                        $( button )
     191                            .nextAll( '.a8c-developer-action-result' )
     192                            .remove();
     193
     194                        $( button ).replaceWith( "<span class='a8c-developer-active'>" + a8c_developer_i18n.ACTIVE + "</span>" );
     195                    } else {
     196                        $( button )
     197                            .html( a8c_developer_i18n.ERROR )
     198                            .nextAll( '.a8c-developer-action-result' )
     199                            .remove();
     200
     201                        $( button ).after( '<span class="a8c-developer-action-result error">' + result + '</span>' );
     202                    }
     203                })
     204                .error( function( response ) {
     205                    $( button )
     206                        .html( a8c_developer_i18n.ERROR )
     207                        .nextAll( '.a8c-developer-action-result' )
     208                        .remove();
     209
     210                    $( button ).after( '<span class="a8c-developer-action-result error">' + response.statusText + ': ' + response.responseText + '</span>' );
     211                   
    149212                })
    150213            ;
  • developer/trunk/developer.php

    r660946 r694698  
    66Plugin URI:   http://wordpress.org/extend/plugins/developer/
    77Description:  The first stop for every WordPress developer
    8 Version:      1.1.2
     8Version:      1.2
    99Author:       Automattic
    1010Author URI:   http://automattic.com
     
    2525    public $default_settings       = array();
    2626
    27     const VERSION                  = '1.1.2';
     27    const VERSION                  = '1.1.6';
    2828    const OPTION                   = 'a8c_developer';
    2929    const PAGE_SLUG                = 'a8c_developer';
     
    8282                'active'       => function_exists( 'zt_add_debug_bar_cron_panel' ),
    8383            ),
     84            'debug-bar-extender' => array(
     85                'project_type' => 'all',
     86                'name'         => esc_html__( 'Debug Bar Extender', 'a8c-developer' ),
     87                'active'       => class_exists( 'Debug_Bar_Extender' ),
     88            ),
    8489            'rewrite-rules-inspector' => array(
    8590                'project_type'  => 'all',
     
    9297                'active'       => class_exists( 'Deprecated_Log' ),
    9398            ),
     99            'log-viewer' => array(
     100                'project_type' => 'all',
     101                'name'         => esc_html__( 'Log Viewer', 'a8c-developer' ),
     102                'active'       => class_exists( 'ciLogViewer' ),
     103            ),
    94104            'vip-scanner' => array(
    95105                'project_type' => 'wpcom-vip',
     
    97107                'active'       => class_exists( 'VIP_Scanner' ),
    98108            ),
    99             /*
    100109            'jetpack' => array(
    101110                'project_type' => 'wpcom-vip',
     
    103112                'active'       => class_exists( 'Jetpack' ),
    104113            ),
    105             /**/
    106114            'grunion-contact-form' => array(
    107115                'project_type' => 'wpcom-vip',
     
    156164                'name'         => esc_html__( 'Theme Test Drive', 'a8c-developer' ),
    157165                'active'       => function_exists( 'TTD_filters' ),
     166                'filename'     => 'themedrive.php',
    158167            ),
    159168            'theme-check' => array(
     
    165174
    166175        $this->recommended_constants = array(
    167             'WP_DEBUG'    => __( 'Enables <a href="http://codex.wordpress.org/Debugging_in_WordPress" target="_blank">debug mode</a> which helps identify and resolve issues', 'a8c-developer' ),
    168             'SAVEQUERIES' => esc_html__( 'Logs database queries to an array so you can review them. The Debug Bar plugin will list out database queries if you set this constant.', 'a8c-developer' ),
     176            'WP_DEBUG'    => array(
     177                'project_type'  => 'all',
     178                'description'   => __( 'Enables <a href="http://codex.wordpress.org/Debugging_in_WordPress" target="_blank">debug mode</a> which helps identify and resolve issues', 'a8c-developer' )
     179            ),
     180            'SAVEQUERIES' => array(
     181                'project_type'  => 'all',
     182                'description'   => esc_html__( 'Logs database queries to an array so you can review them. The Debug Bar plugin will list out database queries if you set this constant.', 'a8c-developer' )
     183            ),
     184            'JETPACK_DEV_DEBUG' => array(
     185                'project_type'  => 'wpcom-vip',
     186                'description'   => __( 'Enables <a href="http://jetpack.me/2013/03/28/jetpack-dev-mode-release/">Development Mode</a> in Jetpack for testing features without a connection to WordPress.com.', 'a8c-developer' )
     187            )
    169188        );
    170189
     
    292311                $to_install_or_enable = 0;
    293312
    294                 foreach ( $this->recommended_plugins as $plugin_slug => $plugin_details ) {
    295                     if ( 'all' != $plugin_details['project_type'] && $plugin_details['project_type'] != $this->settings['project_type'] )
    296                         continue;
    297 
     313                $recommended_plugins = $this->get_recommended_plugins();
     314
     315                foreach ( $recommended_plugins as $plugin_slug => $plugin_details ) {
    298316                    if ( ! $plugin_details['active'] ) {
    299317                        $to_install_or_enable++;
     
    309327                echo '<p>' . esc_html__( 'We recommend that you also install and activate the following plugins:', 'a8c-developer' ) . '</p>';
    310328
    311                 echo '<ul>';
    312 
    313                     foreach ( $this->recommended_plugins as $plugin_slug => $plugin_details ) {
    314                         if ( 'all' != $plugin_details['project_type'] && $plugin_details['project_type'] != $this->settings['project_type'] )
    315                             continue;
    316 
     329                echo '<table class="recommended-plugins">';
     330
     331                    foreach ( $recommended_plugins as $plugin_slug => $plugin_details ) {
    317332                        if ( $plugin_details['active'] )
    318333                            continue;
    319334
     335                        echo '<tr>';
     336
     337                        $details = $this->get_plugin_details( $plugin_slug );
     338
     339                        if ( is_wp_error( $details ) )
     340                            $details = array();
     341
     342                        $plugin_details = array_merge( (array) $details, array( 'slug' => $plugin_slug ), $plugin_details );
     343
     344                        echo '<td><strong>' . $plugin_details['name'] . '</strong></td>';
     345
     346                        echo '<td>';
     347
    320348                        if ( $this->is_recommended_plugin_installed( $plugin_slug ) ) {
    321349                            $path = $this->get_path_for_recommended_plugin( $plugin_slug );
    322                             echo '<li>' . $plugin_details['name'] . ' <button type="button" class="a8c-developer-button-activate" data-path="' . esc_attr( $path ) . '" data-nonce="' . wp_create_nonce( 'a8c_developer_activate_plugin_' . $path ) . '">' . esc_html__( 'Activate', 'a8c-developer' ) . '</button></li>';
     350
     351                            echo '<button type="button" class="a8c-developer-button-activate" data-path="' . esc_attr( $path ) . '" data-nonce="' . wp_create_nonce( 'a8c_developer_activate_plugin_' . $path ) . '">' . esc_html__( 'Activate', 'a8c-developer' ) . '</button>';
    323352                        } else {
    324                             echo '<li>' . $plugin_details['name'] . ' <button type="button" class="a8c-developer-button-install" data-pluginslug="' . esc_attr( $plugin_slug ) . '" data-nonce="' . wp_create_nonce( 'a8c_developer_install_plugin_' . $plugin_slug ) . '">' . esc_html__( 'Install', 'a8c-developer' ) . '</button></li>';
     353                            echo '<button type="button" class="a8c-developer-button-install" data-pluginslug="' . esc_attr( $plugin_slug ) . '" data-nonce="' . wp_create_nonce( 'a8c_developer_install_plugin_' . $plugin_slug ) . '">' . esc_html__( 'Install', 'a8c-developer' ) . '</button>';
    325354                        }
     355
     356                        if ( ! empty( $plugin_details['short_description'] ) )
     357                                echo '<br /><span class="description">' . esc_html__( $plugin_details['short_description'] ) . '</span>';
     358
     359                        echo '</td>';
     360
     361                        echo '</tr>';
    326362                    }
    327363
    328                 echo '</ul>';
     364                echo '<tr><td colspan="2"><button type="button" class="button button-primary a8c-developer-button-close">' . esc_html__( 'Get Developing!', 'a8c-developer' ) . '</button></td></tr>';
     365
     366                echo '</table>';
    329367
    330368                echo '<script type="text/javascript">a8c_developer_bind_events();</script>';
     
    346384
    347385                if ( is_wp_error( $api ) )
    348                     die( sprintf( __( 'ERROR: Error fetching plugin information: %s', 'a8c-developer' ), $api->get_error_message( $api ) ) );
     386                    die( sprintf( __( 'ERROR: Error fetching plugin information: %s', 'a8c-developer' ), $api->get_error_message() ) );
    349387
    350388                $upgrader = new Plugin_Upgrader( new Automattic_Developer_Empty_Upgrader_Skin( array(
     
    357395
    358396                if ( ! $install_result || is_wp_error( $install_result ) )
    359                     die( sprintf( __( 'ERROR: Failed to install plugin: %s', 'a8c-developer' ), $install_result->get_error_message( $install_result ) ) );
     397                    die( sprintf( __( 'ERROR: Failed to install plugin: %s', 'a8c-developer' ), $install_result->get_error_message() ) );
    360398
    361399                $activate_result = activate_plugin( $this->get_path_for_recommended_plugin( $_POST['plugin_slug'] ) );
    362400
    363401                if ( is_wp_error( $activate_result ) )
    364                     die( sprintf( __( 'ERROR: Failed to activate plugin: %s', 'a8c-developer' ), $activate_result->get_error_message( $activate_result ) ) );
     402                    die( sprintf( __( 'ERROR: Failed to activate plugin: %s', 'a8c-developer' ), $activate_result->get_error_message() ) );
    365403
    366404                exit( '1' );
     
    378416
    379417                if ( is_wp_error( $activate_result ) )
    380                     die( sprintf( __( 'ERROR: Failed to activate plugin: %s', 'a8c-developer' ), $activate_result->get_error_message( $activate_result ) ) );
     418                    die( sprintf( __( 'ERROR: Failed to activate plugin: %s', 'a8c-developer' ), $activate_result->get_error_message() ) );
    381419
    382420                exit( '1' );
     
    403441        // Plugins
    404442        add_settings_section( 'a8c_developer_plugins', esc_html__( 'Plugins', 'a8c-developer' ), array( $this, 'settings_section_plugins' ), self::PAGE_SLUG . '_status' );
    405         foreach ( $this->recommended_plugins as $plugin_slug => $plugin_details ) {
    406             if ( 'all' != $plugin_details['project_type'] && $plugin_details['project_type'] != $this->settings['project_type'] )
    407                 continue;
    408 
    409             $plugin_details = array_merge( array( 'slug' => $plugin_slug ), $plugin_details );
    410             add_settings_field( 'a8c_developer_plugin_' . $plugin_slug, $plugin_details['name'], array( $this, 'settings_field_plugin' ), self::PAGE_SLUG . '_status', 'a8c_developer_plugins', $plugin_details );
     443
     444        wp_enqueue_script( 'plugin-install' );
     445
     446        add_thickbox();
     447
     448        $recommended_plugins = $this->get_recommended_plugins();
     449
     450        foreach ( $recommended_plugins as $plugin_slug => $plugin_details ) {
     451            $details = $this->get_plugin_details( $plugin_slug );
     452
     453            if ( is_wp_error( $details ) )
     454                $details = array();
     455
     456            $plugin_details = array_merge( (array) $details, array( 'slug' => $plugin_slug ), $plugin_details );
     457
     458            $label = '<strong>' . esc_html( $plugin_details['name'] ) . '</strong>';
     459
     460            $label .= '<br /><a href="' . self_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin_slug .
     461                                '&amp;TB_iframe=true&amp;width=600&amp;height=550' ) . '" class="thickbox" title="' .
     462                                esc_attr( sprintf( __( 'More information about %s' ), $plugin_details['name'] ) ) . '">' . __( 'Details' ) . '</a>';
     463
     464            add_settings_field( 'a8c_developer_plugin_' . $plugin_slug, $label, array( $this, 'settings_field_plugin' ), self::PAGE_SLUG . '_status', 'a8c_developer_plugins', $plugin_details );
    411465        }
    412466
    413467        // Constants
    414468        add_settings_section( 'a8c_developer_constants', esc_html__( 'Constants', 'a8c-developer' ), array( $this, 'settings_section_constants' ), self::PAGE_SLUG . '_status' );
    415         foreach ( $this->recommended_constants as $constant => $description ) {
     469       
     470        $recommended_constants = $this->get_recommended_constants();
     471
     472        foreach ( $recommended_constants as $constant => $constant_details ) {
    416473            add_settings_field( 'a8c_developer_constant_' . $constant, $constant, array( $this, 'settings_field_constant' ), self::PAGE_SLUG . '_status', 'a8c_developer_constants', array(
    417474                'constant'    => $constant,
    418                 'description' => $description,
     475                'description' => $constant_details['description'],
    419476            ) );
    420477        }
     
    434491
    435492        if ( 'wpcom-vip' == $this->settings['project_type'] )
    436             add_settings_field( 'a8c_developer_setting_vip_lobby', esc_html__( 'VIP Lobby', 'a8c-developer' ), array( $this, 'settings_field_setting_resource_vip_lobby' ), self::PAGE_SLUG . '_status', 'a8c_developer_resources' );
     493            add_settings_field( 'a8c_developer_setting_vip_docs', esc_html__( 'VIP Docs', 'a8c-developer' ), array( $this, 'settings_field_setting_resource_vip_docs' ), self::PAGE_SLUG . '_status', 'a8c_developer_resources' );
    437494
    438495        if ( in_array( $this->settings['project_type'], array( 'wporg-theme', 'wpcom-vip' ) ) )
     
    504561            if ( current_user_can('activate_plugins') ) {
    505562                $path = $this->get_path_for_recommended_plugin( $args['slug'] );
    506                 echo '<a class="a8c-developer-notactive a8c-developer-button-activate" href="' . esc_url( wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $path ), 'activate-plugin_' . $path ) ) . '" data-path="' . esc_attr( $path ) . '" data-nonce="' . wp_create_nonce( 'a8c_developer_activate_plugin_' . $path ) . '" title="' . esc_attr__( 'Click here to activate', 'a8c-developer' ) . '">' . esc_html__( 'INACTIVE', 'a8c-developer' ) . '</a>';
     563                echo '<a class="a8c-developer-notactive a8c-developer-button-activate" href="' . esc_url( wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $path ), 'activate-plugin_' . $path ) ) . '" data-path="' . esc_attr( $path ) . '" data-nonce="' . wp_create_nonce( 'a8c_developer_activate_plugin_' . $path ) . '" title="' . esc_attr__( 'Click here to activate', 'a8c-developer' ) . '">' . esc_html__( 'INACTIVE', 'a8c-developer' ) . ' - <em>' . esc_html__( 'Click to Activate', 'a8c-developer' ) . '</em></a>';
    507564            } else {
    508565                echo '<span class="a8c-developer-notactive">' . esc_html__( 'INACTIVE', 'a8c-developer' ) . '</span>';
     
    511568            // Needs to be installed
    512569            if ( current_user_can('install_plugins') ) {
    513                 echo '<a class="a8c-developer-notactive a8c-developer-button-install" href="' . esc_url( wp_nonce_url( admin_url( 'update.php?action=install-plugin&plugin=' . $args['slug'] ), 'install-plugin_' . $args['slug'] ) ) . '" data-pluginslug="' . esc_attr( $args['slug'] ) . '" data-nonce="' . wp_create_nonce( 'a8c_developer_install_plugin_' . $args['slug'] ) . '" title="' . esc_attr__( 'Click here to install', 'a8c-developer' ) . '">' . esc_html__( 'NOT INSTALLED', 'a8c-developer' ) . '</a>';
     570                echo '<a class="a8c-developer-notactive a8c-developer-button-install" href="' . esc_url( wp_nonce_url( admin_url( 'update.php?action=install-plugin&plugin=' . $args['slug'] ), 'install-plugin_' . $args['slug'] ) ) . '" data-pluginslug="' . esc_attr( $args['slug'] ) . '" data-nonce="' . wp_create_nonce( 'a8c_developer_install_plugin_' . $args['slug'] ) . '" title="' . esc_attr__( 'Click here to install', 'a8c-developer' ) . '">' . esc_html__( 'NOT INSTALLED', 'a8c-developer' ) . ' - <em>' . esc_html__( 'Click to Install', 'a8c-developer' ) . '</em></a>';
    514571            } else {
    515572                echo '<span class="a8c-developer-notactive">' . esc_html__( 'NOT INSTALLED', 'a8c-developer' ) . '</span>';
    516573            }
    517574        }
     575
     576        if ( ! empty( $args['short_description'] ) )
     577            echo '<br /><span class="description">' . $args['short_description']  . '</span>';
    518578    }
    519579
     
    560620            echo '<span class="a8c-developer-active">' . esc_html__( 'ENABLED', 'a8c-developer' ) . '</span>';
    561621        } else {
    562             echo '<a href="http://lobby.vip.wordpress.com/getting-started/development-environment/#plugins-and-helper-functions" class="a8c-developer-notactive">' . esc_html__( 'DISABLED', 'a8c-developer' ) . '</a>';
     622            echo '<a href="http://vip.wordpress.com/documentation/development-environment/#plugins-and-helper-functions" class="a8c-developer-notactive">' . esc_html__( 'DISABLED', 'a8c-developer' ) . '</a>';
    563623        }
    564624    }
     
    570630    }
    571631
    572     public function settings_field_setting_resource_vip_lobby() {
    573         _e( "The <a href='http://lobby.vip.wordpress.com'>VIP Lobby</a> is a technical documentation resource for developing sites on WordPress.com including best practices and helpful tips to help you code better, faster, and stronger.", 'a8c-developer' );
     632    public function settings_field_setting_resource_vip_docs() {
     633        _e( "The <a href='http://vip.wordpress.com/documentation/'>VIP Documentation</a> is a technical resource for developing sites on WordPress.com including best practices and helpful tips to help you code better, faster, and stronger.", 'a8c-developer' );
    574634    }
    575635
     
    618678        if ( $this->is_recommended_plugin_active( $slug ) || file_exists( WP_PLUGIN_DIR . '/' . $this->get_path_for_recommended_plugin( $slug ) ) )
    619679            return true;
     680
     681        return false;
     682    }
     683
     684    /**
     685     * Retrieve plugin information for a given $slug
     686     *
     687     * Note that this does not use plugins_api(), as the .org api does not return
     688     * short descriptions in POST requests (that api endpoint is different from this one)
     689     *
     690     * @param string $slug The plugin slug
     691     * @return object The response object containing plugin details
     692     */
     693    public function get_plugin_details( $slug ){
     694        $cache_key = 'a8c_developer_plugin_details_' . $slug;
     695
     696        if ( false === ( $details = get_transient( $cache_key ) ) ) {
     697            $request = wp_remote_get( 'http://api.wordpress.org/plugins/info/1.0/' . esc_url( $slug ), array( 'timeout' => 15 ) );
     698       
     699            if ( is_wp_error( $request ) ) {
     700                $details = new WP_Error('a8c_developer_plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.' ), $request->get_error_message() );
     701            } else {
     702                $details = maybe_unserialize( wp_remote_retrieve_body( $request ) );
     703
     704                if ( ! is_object( $details ) && ! is_array( $details ) )
     705                    $details = new WP_Error('a8c_developer_plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.' ), wp_remote_retrieve_body( $request ) );
     706                else
     707                    set_transient( $cache_key, $details, WEEK_IN_SECONDS );
     708            }
     709        }
     710
     711        return $details;
     712    }
     713
     714    /**
     715     * Return an array of all plugins recommended for the current project type
     716     *
     717     * Only returns plugins that have been recommended for the project type defined
     718     * in $this->settings['project_type']
     719     *
     720     * @return array An array of plugins recommended for the current project type
     721     */
     722    public function get_recommended_plugins() {
     723        return $this->get_recommended_plugins_by_type( $this->settings['project_type'] );
     724    }
     725
     726    /**
     727     * Return an array of all plugins recommended for the given project type
     728     *
     729     * @param  string $type The project type to return plugins for
     730     * @return array An associative array of plugins for the project type
     731     */
     732    public function get_recommended_plugins_by_type( $type ) {
     733        $plugins_by_type = array();
     734
     735        foreach( $this->recommended_plugins as $plugin_slug => $plugin_details ) {
     736            if ( ! $this->plugin_is_recommended_for_project_type( $plugin_slug, $type ) )
     737                continue;
     738
     739            $plugins_by_type[ $plugin_slug ] = $plugin_details;
     740        }
     741
     742        return $plugins_by_type;
     743    }
     744
     745    /**
     746     * Should the given plugin be recommended for the given project type?
     747     *
     748     * Determines whether or not a given $plugin_slug is recommended for a given $project_type
     749     * by checking the project types defined for it
     750     *
     751     * @param  string $plugin_slug The plugin slug to check
     752     * @param  string $project_type The project type to check the plugin against
     753     * @return bool Boolean indicating if the plugin is recommended for the project type
     754     */
     755    public function plugin_is_recommended_for_project_type( $plugin_slug, $project_type = null ) {
     756        if ( null == $project_type )
     757            $project_type = $this->settings['project_type'];
     758
     759        $plugin_details = $this->recommended_plugins[ $plugin_slug ];
     760
     761        if ( 'all' === $plugin_details['project_type'] ||
     762            $plugin_details['project_type'] === $project_type ||
     763            ( is_array( $plugin_details['project_type'] ) && in_array( $project_type, $plugin_details['project_type'] ) ) )
     764                return true;
     765
     766        return false;
     767    }
     768
     769    /**
     770     * Return an array of all constants recommended for the current project type
     771     *
     772     * Only returns constants that have been recommended for the project type defined
     773     * in $this->settings['project_type']
     774     *
     775     * @return array An array of constants recommended for the current project type
     776     */
     777    public function get_recommended_constants() {
     778        return $this->get_recommended_constants_by_type( $this->settings['project_type'] );
     779    }
     780
     781    /**
     782     * Return an array of all constants recommended for the given project type
     783     *
     784     * @param  string $type The project type to return constants for
     785     * @return array An associative array of constants for the project type
     786     */
     787    public function get_recommended_constants_by_type( $type ) {
     788        $constants_by_type = array();
     789
     790        foreach( $this->recommended_constants as $constant => $constant_details ) {
     791            if ( ! $this->constant_is_recommended_for_project_type( $constant, $type ) )
     792                continue;
     793
     794            $constants_by_type[ $constant ] = $constant_details;
     795        }
     796
     797        return $constants_by_type;
     798    }
     799
     800    /**
     801     * Should the given constant be recommended for the given project type?
     802     *
     803     * Determines whether or not a given $constant is recommended for a given $project_type
     804     * by checking the project types defined for it
     805     *
     806     * @param  string $constant The constant to check
     807     * @param  string $project_type The project type to check the constant against
     808     * @return bool Boolean indicating if the constant is recommended for the project type
     809     */
     810    public function constant_is_recommended_for_project_type( $constant, $project_type = null ) {
     811        if ( null == $project_type )
     812            $project_type = $this->settings['project_type'];
     813
     814        $constant_details = $this->recommended_constants[ $constant ];
     815
     816        if ( 'all' === $constant_details['project_type'] ||
     817            $constant_details['project_type'] === $project_type ||
     818            ( is_array( $constant_details['project_type'] ) && in_array( $project_type, $constant_details['project_type'] ) ) )
     819                return true;
    620820
    621821        return false;
  • developer/trunk/languages/a8c-developer-fr_FR.po

    r660946 r694698  
    22msgstr ""
    33"Project-Id-Version: Developer\n"
    4 "Report-Msgid-Bugs-To: \n"
    5 "POT-Creation-Date: 2013-01-14 08:08+0100\n"
    6 "PO-Revision-Date: 2013-01-15 09:46+0100\n"
     4"Report-Msgid-Bugs-To: http://wordpress.org/tag/developer\n"
     5"POT-Creation-Date: 2013-01-13 22:21:53+00:00\n"
     6"PO-Revision-Date: 2013-02-04 15:14+0100\n"
    77"Last-Translator: FxB <fx@fxbenard.com>\n"
    88"Language-Team: FxB <fx@fxbenard.com>\n"
     
    1919"X-Poedit-SearchPath-0: .\n"
    2020
    21 #: developer.php:78
     21#: developer.php:70
    2222msgid "Debug Bar"
    2323msgstr "Debug Bar"
    2424
    25 #: developer.php:83
     25#: developer.php:75
    2626msgid "Debug Bar Cron"
    2727msgstr "Debug Bar Cron"
    2828
    29 #: developer.php:88
     29#: developer.php:80
    3030msgid "Rewrite Rules Inspector"
    3131msgstr "Rewrite Rules Inspector"
    3232
    33 #: developer.php:93
     33#: developer.php:85
    3434msgid "Log Deprecated Notices"
    3535msgstr "Log Deprecated Notices"
    3636
    37 #: developer.php:98
     37#: developer.php:90
    3838msgid "VIP Scanner"
    3939msgstr "VIP Scanner"
    4040
    41 #: developer.php:110
     41#: developer.php:102
    4242msgid "Grunion Contact Form"
    4343msgstr "Grunion Contact Form"
    4444
    45 #: developer.php:115
     45#: developer.php:107
    4646msgid "Polldaddy Polls & Ratings"
    4747msgstr "Polldaddy Polls & Ratings"
    4848
    49 #: developer.php:120
     49#: developer.php:112
    5050msgid "Monster Widget"
    5151msgstr "Monster Widget"
    5252
    53 #: developer.php:125
     53#: developer.php:117
    5454msgid "User Switching"
    5555msgstr "User Switching"
    5656
    57 #: developer.php:130
     57#: developer.php:122
    5858msgid "Pig Latin"
    5959msgstr "Pig Latin"
    6060
    61 #: developer.php:135
     61#: developer.php:127
    6262msgid "Beta Tester"
    6363msgstr "Beta Tester"
    6464
    65 #: developer.php:143
     65#: developer.php:135
    6666msgid "RTL Tester"
    6767msgstr "RTL Tester"
    6868
    69 #: developer.php:148
     69#: developer.php:140
    7070msgid "Regenerate Thumbnails"
    7171msgstr "Regenerate Thumbnails"
    7272
    73 #: developer.php:153
     73#: developer.php:145
    7474msgid "Reveal IDs"
    7575msgstr "Reveal IDs"
    7676
    77 #: developer.php:158
     77#: developer.php:150
    7878msgid "Theme Test Drive"
    7979msgstr "Theme Test Drive"
    8080
    81 #: developer.php:163
     81#: developer.php:155
    8282msgid "Theme Check"
    8383msgstr "Theme Check"
    8484
    85 #: developer.php:169
     85#: developer.php:161
    8686msgid ""
    8787"Enables <a href=\"http://codex.wordpress.org/Debugging_in_WordPress\" target="
     
    9292"problèmes"
    9393
    94 #: developer.php:170
     94#: developer.php:162
    9595msgid ""
    9696"Logs database queries to an array so you can review them. The Debug Bar "
     
    101101"de bases de données si vous définissez cette constante."
    102102
    103 #: developer.php:179
     103#: developer.php:172
    104104msgid "Developer: Plugin Setup"
    105105msgstr "Developer : Réglages de l'extension"
    106106
    107 #: developer.php:180
     107#: developer.php:173
    108108msgid "Saving..."
    109109msgstr "Enregistrement en cours..."
    110110
    111 #: developer.php:181
     111#: developer.php:174
    112112msgid "Installing..."
    113113msgstr "Installation..."
    114114
    115 #: developer.php:182
     115#: developer.php:175
    116116msgid "Installed"
    117117msgstr "Installé"
    118118
    119 #: developer.php:183
     119#: developer.php:176
    120120msgid "Activating..."
    121121msgstr "Activation..."
    122122
    123 #: developer.php:184
     123#: developer.php:177
    124124msgid "Activated"
    125125msgstr "Activé"
    126126
    127 #: developer.php:185
     127#: developer.php:178
    128128msgid "Error!"
    129129msgstr "Erreur !"
    130130
    131 #: developer.php:186 developer.php:503
     131#: developer.php:179 developer.php:500
    132132msgid "ACTIVE"
    133133msgstr "ACTIVÉ"
    134134
    135 #: developer.php:187
     135#: developer.php:180
    136136msgid "INSTALLED"
    137137msgstr "INSTALLÉ"
    138138
    139 #: developer.php:188
     139#: developer.php:181
    140140msgid "ERROR!"
    141141msgstr "ERREUR !"
    142142
    143 #: developer.php:197
     143#: developer.php:193
    144144msgid "Settings saved."
    145145msgstr "Réglages enregistrés."
    146146
    147 #: developer.php:202
     147#: developer.php:199
    148148msgid "Error saving settings. Please try again."
    149149msgstr ""
     
    151151"réessayer plus tard."
    152152
    153 #: developer.php:211 developer.php:450
     153#: developer.php:208 developer.php:447
    154154msgid "Developer Helper"
    155155msgstr "Developer Helper"
    156156
    157 #: developer.php:211 developer.php:221
     157#. #-#-#-#-#  plugin.pot (Developer 1.1.1)  #-#-#-#-#
     158#. Plugin Name of the plugin/theme
     159#: developer.php:208 developer.php:218
    158160msgid "Developer"
    159161msgstr "Developer"
    160162
    161 #: developer.php:225
     163#: developer.php:222
    162164msgid "View the Developer Helper settings and status page"
    163165msgstr "Afficher les réglages et la page d'état de Developer Helper"
    164166
    165 #: developer.php:251
     167#: developer.php:248
    166168msgid "Thanks for installing the Developer Helper plugin!"
    167169msgstr "Merci d'avoir installé l'extension Developer Helper !"
    168170
    169 #: developer.php:253
     171#: developer.php:250
    170172msgid "Before we begin, what type of website are you developing?"
    171173msgstr "Avant de commencer, quel type de site web developpez-vous ?"
    172174
    173 #: developer.php:309 developer.php:406
     175#: developer.php:306 developer.php:403
    174176msgid "Plugins"
    175177msgstr "Extensions"
    176178
    177 #: developer.php:311
     179#: developer.php:308
    178180msgid "We recommend that you also install and activate the following plugins:"
    179181msgstr ""
     
    181183"suivantes :"
    182184
    183 #: developer.php:324
     185#: developer.php:321
    184186msgid "Activate"
    185187msgstr "Activer"
    186188
    187 #: developer.php:326
     189#: developer.php:323
    188190msgid "Install"
    189191msgstr "Installer"
    190192
    191 #: developer.php:338 developer.php:372
     193#: developer.php:335 developer.php:369
    192194msgid "ERROR: No slug was passed to the AJAX callback."
    193195msgstr "ERREUR : Aucun identifiant n'a été passé au rappel AJAX."
    194196
    195 #: developer.php:343
     197#: developer.php:340
    196198msgid "ERROR: You lack permissions to install and/or activate plugins."
    197199msgstr ""
     
    199201"extensions."
    200202
    201 #: developer.php:350
    202 #, php-format
     203#: developer.php:347
    203204msgid "ERROR: Error fetching plugin information: %s"
    204205msgstr "ERREUR : Erreur de récupération des informations de l'extension :%s"
    205206
    206 #: developer.php:361
    207 #, php-format
     207#: developer.php:358
    208208msgid "ERROR: Failed to install plugin: %s"
    209209msgstr "ERREUR : Impossible d'installer l'extension : %s"
    210210
    211 #: developer.php:366 developer.php:382
    212 #, php-format
     211#: developer.php:363 developer.php:379
    213212msgid "ERROR: Failed to activate plugin: %s"
    214213msgstr "ERREUR : Impossible d'activer l'extension : %s"
    215214
    216 #: developer.php:377
     215#: developer.php:374
    217216msgid "ERROR: You lack permissions to activate plugins."
    218217msgstr "ERREUR : Vous n'avez pas d'autorisation pour installer des extensions."
    219218
    220 #: developer.php:392
     219#: developer.php:389
    221220msgid "Main Configuration"
    222221msgstr "Configuration principale"
    223222
    224 #: developer.php:393
     223#: developer.php:390
    225224msgid "Project Type"
    226225msgstr "Type de projet"
    227226
    228 #: developer.php:416
     227#: developer.php:413
    229228msgid "Constants"
    230229msgstr "Constantes"
    231230
    232 #: developer.php:425
     231#: developer.php:422
    233232msgid "Settings"
    234233msgstr "Réglages"
    235234
    236 #: developer.php:426
     235#: developer.php:423
    237236msgid "Pretty Permalinks"
    238237msgstr "Pretty Permalinks"
    239238
    240 #: developer.php:428
     239#: developer.php:425
    241240msgid "Development Version"
    242241msgstr "Version de Développement"
    243242
    244 #: developer.php:429
     243#: developer.php:426
    245244msgid "Shared Plugins"
    246245msgstr "Extensions partagées"
    247246
    248 #: developer.php:433
     247#: developer.php:430
    249248msgid "Resources"
    250249msgstr "Ressources"
    251250
    252 #: developer.php:435
     251#: developer.php:432
    253252msgid "Codex"
    254253msgstr "Codex"
    255254
    256 #: developer.php:438
     255#: developer.php:435
    257256msgid "VIP Lobby"
    258257msgstr "VIP Lobby"
    259258
    260 #: developer.php:441
     259#: developer.php:438
    261260msgid "Starter Themes"
    262261msgstr "Starter Themes"
    263262
    264 #: developer.php:498
     263#: developer.php:495
    265264msgid "We recommend you have the following plugins installed:"
    266265msgstr "Nous vous recommandons d'avoir installé les extensions suivantes :"
    267266
    268 #: developer.php:508
     267#: developer.php:505
    269268msgid "Click here to activate"
    270269msgstr "Cliquez ici pour activer."
    271270
    272 #: developer.php:508 developer.php:510
     271#: developer.php:505 developer.php:507
    273272msgid "INACTIVE"
    274273msgstr "INACTIF"
    275274
    276 #: developer.php:515
     275#: developer.php:512
    277276msgid "Click here to install"
    278277msgstr "Cliquez ici pour installer."
    279278
    280 #: developer.php:515 developer.php:517
     279#: developer.php:512 developer.php:514
    281280msgid "NOT INSTALLED"
    282281msgstr "NON INSTALLÉ"
    283282
    284 #: developer.php:523
     283#: developer.php:520
    285284msgid ""
    286285"We recommend you set the following constants to <code>true</code> in your "
     
    292291"wordpress.org/Editing_wp-config.php\" target=\"_blank\">Besoin d'aide ?</a>"
    293292
    294 #: developer.php:528
     293#: developer.php:525
    295294msgid "SET"
    296295msgstr "DÉFINI"
    297296
    298 #: developer.php:530
     297#: developer.php:527
    299298msgid "NOT SET"
    300299msgstr "NON CONFIGURÉ"
    301300
    302 #: developer.php:539
     301#: developer.php:536
    303302msgid "We recommend the following settings and configurations."
    304303msgstr "Nous vous recommandons les réglages et configurations suivantes :"
    305304
    306 #: developer.php:544 developer.php:554 developer.php:562
     305#: developer.php:541 developer.php:551 developer.php:559
    307306msgid "ENABLED"
    308307msgstr "ACTIVÉ"
    309308
    310 #: developer.php:546 developer.php:556 developer.php:564
     309#: developer.php:543 developer.php:553 developer.php:561
    311310msgid "DISABLED"
    312311msgstr "DÉSACTIVÉ"
    313312
    314 #: developer.php:546
     313#: developer.php:543
    315314msgid ""
    316315"<a href=\"http://codex.wordpress.org/Using_Permalinks\" target=\"_blank"
     
    320319"\">Besoin d'aide ?</a>"
    321320
    322 #: developer.php:571
     321#: developer.php:568
    323322msgid ""
    324323"The <a href='http://codex.wordpress.org/Developer_Documentation'>Developer "
     
    331330"étendre ou contribuer à WordPress."
    332331
    333 #: developer.php:575
     332#: developer.php:572
    334333msgid ""
    335334"The <a href='http://lobby.vip.wordpress.com'>VIP Lobby</a> is a technical "
     
    342341"coder mieux et plus vite."
    343342
    344 #: developer.php:579
     343#: developer.php:576
    345344msgid ""
    346345"<a href='http://underscores.me'>_s (or underscores)</a>: a starter theme "
     
    352351"pour créer le plus impressionnant prochain thème pour WordPress."
    353352
    354 #: developer.php:628
     353#: developer.php:625
    355354msgid "Plugin for a self-hosted WordPress installation"
    356355msgstr "Extension pour une installation auto-hébergé de WordPress"
    357356
    358 #: developer.php:629
     357#: developer.php:626
    359358msgid "Theme for a self-hosted WordPress installation"
    360359msgstr "Thème pour une installation auto-hébergé de WordPress"
    361360
    362 #: developer.php:630
     361#: developer.php:627
    363362msgid ""
    364363"Theme for a <a href=\"http://vip.wordpress.com\" target=\"_blank\">WordPress."
     
    367366"Theme pour un site <a href=\"http://vip.wordpress.com\" target=\"_blank"
    368367"\">WordPress.com VIP</a>"
     368
     369#. Plugin URI of the plugin/theme
     370msgid "http://wordpress.org/extend/plugins/developer/"
     371msgstr "http://wordpress.org/extend/plugins/developer/"
     372
     373#. Description of the plugin/theme
     374msgid "The first stop for every WordPress developer"
     375msgstr "La première étape pour tous les développeurs WordPress"
     376
     377#. Author of the plugin/theme
     378msgid "Automattic"
     379msgstr "Automattic"
     380
     381#. Author URI of the plugin/theme
     382msgid "http://automattic.com"
     383msgstr "http://automattic.com"
  • developer/trunk/readme.txt

    r694696 r694698  
    11=== Developer ===
    2 Contributors: automattic, batmoo, Viper007Bond, nbachiyski, tott, danielbachhuber, betzster, nprasath002
     2Contributors: automattic, batmoo, Viper007Bond, nbachiyski, tott, danielbachhuber, betzster, nprasath002, nickdaugherty
    33Tags: developer, development, local
    44Requires at least: 3.4
    5 Tested up to: 3.5.1
     5Tested up to: 3.6
    66Stable tag: 1.2
    77License: GPLv2 or later
     
    4141== Changelog ==
    4242
     43= 1.1.6 (2013-04-08) =
     44* Made purpose of activate/install links on Settings page more obvious
     45* Added link to full plugin details on Settings page (opens in Thickbox)
     46
     47= 1.1.5 (2013-04-05) =
     48* Added ability to define multiple project types for plugins
     49* Added ability to define project types for constants
     50* Added Jetpack to recommended plugins and constants
     51
     52= 1.1.4 (2013-04-03) =
     53* Added plugin descriptions to installation and settings pages
     54
     55= 1.1.3 (2013-04-02) =
     56* Added improved error reporting
     57* Added [Log Viewer](http://wordpress.org/extend/plugins/log-viewer/) to recommended plugins. Props to @rockaut for the suggestion
     58
    4359= 1.1.2 (2013-01-29) =
    4460* French localization. Props [fxbenard](https://github.com/fxbenard)
Note: See TracChangeset for help on using the changeset viewer.