Changeset 2621 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
- Timestamp:
- 02/25/2016 10:49:24 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r2611 r2621 5 5 * Various helpers to retrieve data not stored within WordPress. 6 6 * 7 * @package WordPressdotorg _Plugin_Directory7 * @package WordPressdotorg\Plugin_Directory 8 8 */ 9 9 class Template { … … 53 53 */ 54 54 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; 57 57 58 58 $default_sections = array( … … 71 71 $raw_sections = array_unique( array_merge( $raw_sections, $default_sections ) ); 72 72 73 $sections = array();74 $title = '';75 $permalink = get_permalink();73 $sections = array(); 74 $title = $url = ''; 75 $permalink = get_permalink(); 76 76 77 77 foreach ( $raw_sections as $section_slug ) { … … 145 145 * Retrieve the Plugin Icon details for a plugin. 146 146 * 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. 148 148 * @return mixed 149 149 */ … … 163 163 $icon_2x = self::get_asset_url( $plugin_slug, $info ); 164 164 break; 165 165 166 case '128x128': 166 167 $icon = self::get_asset_url( $plugin_slug, $info ); 167 168 break; 169 168 170 case false && 'icon.svg' == $file: 169 $icon = self::get_asset_url( $plugin_slug, $info );171 $icon = self::get_asset_url( $plugin_slug, $info ); 170 172 $vector = true; 171 173 break; … … 191 193 switch ( $output ) { 192 194 case 'html': 193 $id = "plugin-icon-{$plugin_slug}";195 $id = "plugin-icon-{$plugin_slug}"; 194 196 $html = "<style type='text/css'>"; 195 197 $html .= "#{$id} { width:128px; height:128px; background-image: url('{$icon}'); background-size:128px 128px; }"; … … 202 204 return $html; 203 205 break; 206 204 207 case 'raw': 205 208 default: … … 211 214 * Retrieve the Plugin Icon details for a plugin. 212 215 * 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. 214 217 * @return mixed 215 218 */ … … 229 232 $banner_2x = self::get_asset_url( $plugin_slug, $info ); 230 233 break; 234 231 235 case '772x250': 232 236 $banner = self::get_asset_url( $plugin_slug, $info ); … … 246 250 } 247 251 252 /** 253 * @param $plugin 254 * @param $asset 255 * @return string 256 */ 248 257 static function get_asset_url( $plugin, $asset ) { 249 258 if ( ! empty( $asset['location'] ) && 'plugin' == $asset['location'] ) {
Note: See TracChangeset
for help on using the changeset viewer.