WordPress.org

Making WordPress.org

Changeset 2555


Ignore:
Timestamp:
02/23/2016 04:12:32 AM (4 years ago)
Author:
dd32
Message:

Plugins Directory: Implement basic Banner & Icon support (including porting the autotomatically generated icons plugin over) to give plugins a bit of individuality.
See #1584

Location:
sites/trunk/wordpress.org/public_html/wp-content
Files:
15 added
6 edited

Legend:

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

    r2554 r2555  
    135135        return $sections;
    136136    }
     137
     138    /**
     139     * Retrieve the Plugin Icon details for a plugin.
     140     *
     141     * @param WP_Post|string $plugin An instance of a Plugin post, or the plugin slug.
     142     * @return mixed
     143     */
     144    static function get_plugin_icon( $plugin, $output = 'raw' ) {
     145        global $wporg_plugin_directory;
     146        $plugin = $wporg_plugin_directory->get_or_create_plugin_post( $plugin );
     147        if ( is_wp_error( $plugin ) ) {
     148            return false;
     149        }
     150        $plugin_slug = $plugin->post_name;
     151
     152        $raw_icons = get_post_meta( $plugin->ID, 'assets_icons', true );
     153
     154        $icon = $icon_2x = $vector = $generated = false;
     155        foreach ( $raw_icons as $file => $info ) {
     156            switch ( $info['resolution'] ) {
     157                case '256x256':
     158                    $icon_2x = self::get_asset_url( $plugin_slug, $info );
     159                    break;
     160                case '128x128':
     161                    $icon = self::get_asset_url( $plugin_slug, $info );
     162                    break;
     163                case false && 'icon.svg' == $file:
     164                    $icon = self::get_asset_url( $plugin_slug, $info );
     165                    $vector = true;
     166                    break;
     167            }
     168        }
     169
     170        if ( ! $icon ) {
     171            $generated = true;
     172            if ( ! class_exists( 'WPorg_Plugin_Geopattern' ) ) {
     173                include __DIR__ . '/class-wporg-plugin-geopattern.php';
     174            }
     175            $icon = new WPorg_Plugin_Geopattern;
     176            $icon->setString( $plugin->post_name );
     177
     178            // Use the average color of the first known banner as the icon background color
     179            if ( $color = get_post_meta( $plugin->ID, 'assets_banners_color', true ) ) {
     180                if ( strlen( $color ) == 6 && strspn( $color, 'abcdef0123456789' ) == 6 ) {
     181                    $icon->setColor( '#' . $color );
     182                }
     183            }
     184
     185            $icon = $icon->toDataURI();
     186        }
     187
     188        switch ( $output ) {
     189            case 'html':
     190                $id = "plugin-icon-{$plugin_slug}";
     191                $html = "<style type='text/css'>";
     192                $html .= "#{$id} { width:128px; height:128px; background-image: url('{$icon}'); background-size:128px 128px; }";
     193                if ( ! empty( $icon_2x ) && ! $generated ) {
     194                    $html .= "@media only screen and (-webkit-min-device-pixel-ratio: 1.5) { #{$id} { background-image: url('{$icon_2x}'); } }";
     195                }
     196                $html .= "</style>";
     197                $html .= "<div class='plugin-icon' id='{$id}'></div>";
     198
     199                return $html;
     200                break;
     201            case 'raw':
     202            default:
     203                return compact( 'icon', 'icon_2x', 'vector', 'generated' );
     204        }
     205    }
     206
     207    /**
     208     * Retrieve the Plugin Icon details for a plugin.
     209     *
     210     * @param WP_Post|string $plugin An instance of a Plugin post, or the plugin slug.
     211     * @return mixed
     212     */
     213    static function get_plugin_banner( $plugin, $output = 'raw' ) {
     214        global $wporg_plugin_directory;
     215        $plugin = $wporg_plugin_directory->get_or_create_plugin_post( $plugin );
     216        if ( is_wp_error( $plugin ) ) {
     217            return false;
     218        }
     219        $plugin_slug = $plugin->post_name;
     220
     221        $raw_banners = get_post_meta( $plugin->ID, 'assets_banners', true );
     222
     223        $banner = $banner_2x = false;
     224        foreach ( $raw_banners as $file => $info ) {
     225            switch ( $info['resolution'] ) {
     226                case '1544x500':
     227                    $banner_2x = self::get_asset_url( $plugin_slug, $info );
     228                    break;
     229                case '772x250':
     230                    $banner = self::get_asset_url( $plugin_slug, $info );
     231                    break;
     232            }
     233        }
     234
     235        if ( ! $banner ) {
     236            return false;
     237        }
     238
     239        switch ( $output ) {
     240            case 'raw':
     241            default:
     242                return compact( 'banner', 'banner_2x' );
     243        }
     244    }
     245
     246    static function get_asset_url( $plugin, $asset ) {
     247        return esc_url( sprintf(
     248            'https://ps.w.org/%s/assets/%s?rev=%s',
     249            $plugin,
     250            $asset['filename'],
     251            $asset['revision']
     252        ) );
     253    }
    137254}
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-tools.php

    r2501 r2555  
    2424
    2525        // Sanitize contributors.
    26         var_dump($data);
    2726        foreach ( $data->contributors as $i => $name ) {
    2827            if ( get_user_by( 'login', $name ) ) {
     
    3837        return $data;
    3938    }
     39
     40    /**
     41     * Retrieve the average color of a specified image.
     42     * This currently relies upon the Jetpack libraries.
     43     *
     44     * @param $file_location string URL or filepath of image
     45     * @return string|bool Average color as a hex value, False on failure
     46     */
     47    static function get_image_average_color( $file_location ) {
     48        if ( ! class_exists( 'Tonesque' ) && function_exists( 'jetpack_require_lib' ) ) {
     49            jetpack_require_lib( 'tonesque' );
     50        }
     51        if ( ! class_exists( 'Tonesque' ) ) {
     52            return false;
     53        }
     54
     55        $tonesque = new Tonesque( $file_location );
     56        if ( $tonesque ) {
     57            return $tonesque->color();
     58        }
     59
     60        return false;
     61    }
    4062}
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory.php

    r2501 r2555  
    236236        $_pages        = preg_split( "#<!--section=(.+?)-->#", $content, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
    237237        $content_pages = array(
    238             'stats'      => '[wporg-plugins-stats]',
    239             'developers' => '[wporg-plugins-developer]',
     238            'screenshots' => '[wporg-plugins-screenshots]',
     239            'stats'       => '[wporg-plugins-stats]',
     240            'developers'  => '[wporg-plugins-developer]',
    240241        );
    241242
     
    250251        return $content_pages;
    251252    }
     253
     254    /**
     255     * Retrieve the WP_Post object representing a given plugin.
     256     *
     257     * @param $plugin_slug string|WP_Post The slug of the plugin to retrieve.
     258     * @return WP_Post|WP_Error
     259     */
     260    public function get_or_create_plugin_post( $plugin_slug ) {
     261        if ( $plugin_slug instanceof WP_Post ) {
     262            return $plugin_slug;
     263        }
     264
     265        // get_post_by_slug();
     266        $posts = get_posts( array( 'post_type' => 'plugin', 'name' => $plugin_slug, 'post_status' => 'any', 'fields' => 'ids' ) );
     267
     268        if ( $posts ) {
     269            $id = reset( $posts );
     270        } else {
     271            $id = wp_insert_post( array(
     272                'post_type' => 'plugin',
     273                'post_status' => 'pending',
     274                'post_name' => $plugin_slug,
     275                'post_title' => $plugin_slug,
     276                'post_content' => '',
     277            ), true );
     278
     279            if ( is_wp_error( $id ) ) {
     280                return $id;
     281            }
     282        }
     283
     284        $plugin = get_post( $id );
     285        return $plugin;
     286    }
    252287}
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/plugin-card.php

    r2499 r2555  
    22     <div class="plugin-card-top">
    33
    4          <a href="<?php the_permalink(); ?>" class="plugin-icon"><style>#plugin-icon-<?php echo esc_attr( $post->post_name ); ?> { width:128px; height:128px; background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMTEiIGhlaWdodD0iMTI5IiB2aWV3Ym94PSIwIDAgMTExIDEyOSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0icmdiKDI0MSwgMjQxLCAyNDEpIiAvPjxyZWN0IHg9Ii0xMS44MzMzMzMzMzMzMzMiIHk9Ii0xMS44MzMzMzMzMzMzMzMiIHdpZHRoPSIyMy42NjY2NjY2NjY2NjciIGhlaWdodD0iMjMuNjY2NjY2NjY2NjY3IiBzdHJva2U9IiMwMDAiIHN0cm9rZS1vcGFjaXR5PSIwLjAyIiBmaWxsPSIjZGRkIiBmaWxsLW9wYWNpdHk9IjAuMDg5MzMzMzMzMzMzMzMzIiBzdHJva2Utd2lkdGg9IjEiIC8+PHJlY3QgeD0iMTAwLjE1ODUzNTc3OTEzIiB5PSItMTEuODMzMzMzMzMzMzMzIiB3aWR0aD0iMjMuNjY2NjY2NjY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IgeT0iMCIgd2lkdGg9IjIzLjY2NjY2NjY2NjY2NyIgaGVpZ2h0PSIyMy42NjY2NjY2NjY2NjciIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLW9wYWNpdHk9IjAuMDIiIGZpbGw9IiMyMjIiIGZpbGwtb3BhY2l0eT0iMC4xNSIgc3Ryb2tlLXdpZHRoPSIxIiB0cmFuc2Zvcm09InNjYWxlKDEsIC0xKSB0cmFuc2xhdGUoMTEuODMzMzMzMzMzMzMzLCAtMTE3LjQ4MzczODIyNDkzKSByb3RhdGUoLTMwLCAwLCAwKSIgLz48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMjMuNjY2NjY2NjY2NjY3IiBoZWlnaHQ9IjIzLjY2NjY2NjY2NjY2NyIgc3Ryb2tlPSIjMDAwIiBzdHJva2Utb3BhY2l0eT0iMC4wMiIgZmlsbD0iIzIyMiIgZmlsbC1vcGFjaXR5PSIwLjA0NiIgc3Ryb2tlLXdpZHRoPSIxIiB0cmFuc2Zvcm09InNjYWxlKC0xLCAtMSkgdHJhbnNsYXRlKC0xMDAuMTU4NTM1Nzc5MTMsIC0xMTcuNDgzNzM4MjI0OTMpIHJvdGF0ZSgtMzAsIDAsIDApIiAvPjwvc3ZnPg==); background-size:128px 128px; }</style><div class='plugin-icon' id='plugin-icon-<?php echo esc_attr( $post->post_name ); ?>' style='float:left; margin: 3px 6px 6px 0px;'></div></a>
     4         <a href="<?php the_permalink(); ?>" class="plugin-icon">
     5            <?php echo WPorg_Plugin_Directory_Template::get_plugin_icon( $post->post_name, 'html' ); ?>
     6         </a>
    57         <div class="name column-name">
    68             <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/single-plugin.php

    r2502 r2555  
    1 <?php the_post(); ?>
    2 <?php get_header(); ?>
     1<?php
     2the_post();
     3get_header();
     4$plugin_banners = WPorg_Plugin_Directory_Template::get_plugin_banner( $post );
     5
     6?>
    37
    48<div class="wrapper">
     
    610    <div style="width: 772px; margin: 0 auto;" itemscope itemtype="http://schema.org/SoftwareApplication">
    711
    8         <div id="plugin-head" class="plugin-head-with-banner">
     12        <div id="plugin-head" class="<?php echo $plugin_banners ? 'plugin-head-with-banner' : 'plugin-head-without-banner'; ?>">
    913
     14        <?php if ( $plugin_banners ): ?>
    1015            <div id="plugin-title" class="with-banner">
    1116                <div class="vignette"></div>
    1217                <style type="text/css">
    13                 #plugin-title { width:772px; height:250px; background-size:772px 250px; background-image: url(//ps.w.org/debug-bar/assets/banner-772x250.png?rev=478338); }
     18                    #plugin-title { width:772px; height:250px; background-size:772px 250px; background-image: url('<?php echo esc_url( $plugin_banners['banner'] ); ?>'); }
     19                    <?php if ( ! empty( $plugin_banners['banner_2x'] ) ): ?>
     20                    @media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 15/10), only screen and (min-resolution: 144dpi), only screen and (min-resolution: 1.5dppx) {
     21                        #plugin-title { background-image: url('<?php echo esc_url( $plugin_banners['banner_2x'] ); ?>'); }
     22                    }
     23                    <?php endif; ?>
    1424                </style>
    1525
    1626                <h2 itemprop="name"><?php the_title(); ?></h2>
    1727            </div>
     28        <?php else: ?>
     29            <div id="plugin-title"><h2 itemprop="name"><?php the_title(); ?></h2></div>
     30        <?php endif; ?>
    1831
    1932            <div id="plugin-description">
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/style.css

    r2499 r2555  
    277277    font-size: 24px;
    278278    font-weight: bold;
     279    margin: 0.5em;
    279280}
    280281
     
    287288    bottom: 20px;
    288289    padding: 8px 15px;
     290    margin: 0;
    289291    margin-bottom: 4px;
    290292
     
    10741076    top: 10px;
    10751077    left: 10px;
     1078}
     1079.plugin-icon .plugin-icon {
     1080    float:left;
     1081    margin: 3px 6px 6px 0px;
    10761082}
    10771083
Note: See TracChangeset for help on using the changeset viewer.