Making WordPress.org


Ignore:
Timestamp:
02/25/2016 10:49:24 PM (11 years ago)
Author:
obenland
Message:

Plugins Directory: Formatting update.

  • Updates phpdocs throughout the plugin.
  • Breaks out classes into their own files.
  • Some minor namespace-related tweaks.

See #1584.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php

    r2611 r2621  
    55 * Various helpers to retrieve data not stored within WordPress.
    66 *
    7  * @package WordPressdotorg_Plugin_Directory
     7 * @package WordPressdotorg\Plugin_Directory
    88 */
    99class Template {
    … …  
    5353         */
    5454        static function get_plugin_sections() {
    55                 $plugin       = get_post();
    56                 $plugin_slug  = $plugin->post_name;
     55                $plugin      = get_post();
     56                $plugin_slug = $plugin->post_name;
    5757
    5858                $default_sections = array(
    … …  
    7171                $raw_sections = array_unique( array_merge( $raw_sections, $default_sections ) );
    7272
    73                 $sections  = array();
    74                 $title     = '';
    75                 $permalink = get_permalink();
     73                $sections     = array();
     74                $title = $url = '';
     75                $permalink    = get_permalink();
    7676
    7777                foreach ( $raw_sections as $section_slug ) {
    … …  
    145145         * Retrieve the Plugin Icon details for a plugin.
    146146         *
    147          * @param WP_Post|string $plugin An instance of a Plugin post, or the plugin slug.
     147         * @param \WP_Post|string $plugin An instance of a Plugin post, or the plugin slug.
    148148         * @return mixed
    149149         */
    … …  
    163163                                        $icon_2x = self::get_asset_url( $plugin_slug, $info );
    164164                                        break;
     165
    165166                                case '128x128':
    166167                                        $icon = self::get_asset_url( $plugin_slug, $info );
    167168                                        break;
     169
    168170                                case false && 'icon.svg' == $file:
    169                                         $icon = self::get_asset_url( $plugin_slug, $info );
     171                                        $icon   = self::get_asset_url( $plugin_slug, $info );
    170172                                        $vector = true;
    171173                                        break;
    … …  
    191193                switch ( $output ) {
    192194                        case 'html':
    193                                 $id = "plugin-icon-{$plugin_slug}";
     195                                $id   = "plugin-icon-{$plugin_slug}";
    194196                                $html = "<style type='text/css'>";
    195197                                $html .= "#{$id} { width:128px; height:128px; background-image: url('{$icon}'); background-size:128px 128px; }";
    … …  
    202204                                return $html;
    203205                                break;
     206
    204207                        case 'raw':
    205208                        default:
    … …  
    211214         * Retrieve the Plugin Icon details for a plugin.
    212215         *
    213          * @param WP_Post|string $plugin An instance of a Plugin post, or the plugin slug.
     216         * @param \WP_Post|string $plugin An instance of a Plugin post, or the plugin slug.
    214217         * @return mixed
    215218         */
    … …  
    229232                                        $banner_2x = self::get_asset_url( $plugin_slug, $info );
    230233                                        break;
     234
    231235                                case '772x250':
    232236                                        $banner = self::get_asset_url( $plugin_slug, $info );
    … …  
    246250        }
    247251
     252        /**
     253         * @param $plugin
     254         * @param $asset
     255         * @return string
     256         */
    248257        static function get_asset_url( $plugin, $asset ) {
    249258                if ( ! empty( $asset['location'] ) && 'plugin' == $asset['location'] ) {
Note: See TracChangeset for help on using the changeset viewer.