- Timestamp:
- 03/07/2012 06:24:34 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-theme-install-list-table.php
r20138 r20140 152 152 153 153 foreach ( $theme_names as $theme_name ) { 154 $class = array( 'available-theme' );155 154 ?> 156 <div class=" <?php echo join( ' ', $class ); ?>"><?php155 <div class="available-theme installable-theme"><?php 157 156 if ( isset( $themes[$theme_name] ) ) 158 157 display_theme( $themes[$theme_name] ); … … 160 159 <?php } // end foreach $theme_names 161 160 161 $this->theme_installer(); 162 } 163 164 165 166 /* 167 * Prints a theme from the WordPress.org API. 168 * 169 * @param object $theme An object that contains theme data returned by the WordPress.org API. 170 * 171 * Example theme data: 172 * object(stdClass)[59] 173 * public 'name' => string 'Magazine Basic' (length=14) 174 * public 'slug' => string 'magazine-basic' (length=14) 175 * public 'version' => string '1.1' (length=3) 176 * public 'author' => string 'tinkerpriest' (length=12) 177 * public 'preview_url' => string 'http://wp-themes.com/?magazine-basic' (length=36) 178 * public 'screenshot_url' => string 'http://wp-themes.com/wp-content/themes/magazine-basic/screenshot.png' (length=68) 179 * public 'rating' => float 80 180 * public 'num_ratings' => int 1 181 * public 'homepage' => string 'http://wordpress.org/extend/themes/magazine-basic' (length=49) 182 * public 'description' => string 'A basic magazine style layout with a fully customizable layout through a backend interface. Designed by <a href="http://bavotasan.com">c.bavota</a> of <a href="http://tinkerpriestmedia.com">Tinker Priest Media</a>.' (length=214) 183 * public 'download_link' => string 'http://wordpress.org/extend/themes/download/magazine-basic.1.1.zip' (length=66) 184 */ 185 function single_row( $theme ) { 186 global $themes_allowedtags; 187 188 if ( empty( $theme ) ) 189 return; 190 191 $name = wp_kses( $theme->name, $themes_allowedtags ); 192 $author = wp_kses( $theme->author, $themes_allowedtags ); 193 194 $preview_title = sprintf( __('Preview “%s”'), $name ); 195 $preview_url = add_query_arg( array( 196 'tab' => 'theme-information', 197 'theme' => $theme->slug, 198 ) ); 199 200 ?> 201 <a class="screenshot" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>"> 202 <img src='<?php echo esc_url( $theme->screenshot_url ); ?>' width='150' /> 203 </a> 204 205 <h3><?php 206 /* translators: 1: theme name, 2: author name */ 207 printf( __( '%1$s <span>by %2$s</span>' ), $name, $author ); 208 ?></h3> 209 210 <?php 211 $this->install_theme_info( $theme ); 212 } 213 214 /* 215 * Prints the wrapper for the theme installer. 216 */ 217 function theme_installer() { 162 218 ?> 163 219 <div id="theme-installer" class="wp-full-overlay"> … … 173 229 } 174 230 231 /* 232 * Prints the wrapper for the theme installer with a provided theme's data. 233 * Used to make the theme installer work for no-js. 234 * 235 * @param object $theme - A WordPress.org Theme API object. 236 */ 237 function theme_installer_single( $theme ) { 238 $class = 'wp-full-overlay'; 239 if ( $theme ) 240 $class .= ' single-theme'; 241 242 ?> 243 <div id="theme-installer" class="wp-full-overlay single-theme"> 244 <div class="wp-full-overlay-sidebar"> 245 <?php $this->install_theme_info( $theme ); ?> 246 </div> 247 <div class="wp-full-overlay-main"> 248 <iframe src="<?php echo esc_url( $theme->preview_url ); ?>"></iframe> 249 </div> 250 </div> 251 <?php 252 } 253 254 /* 255 * Prints the info for a theme (to be used in the theme installer modal). 256 * 257 * @param object $theme - A WordPress.org Theme API object. 258 */ 259 function install_theme_info( $theme ) { 260 global $themes_allowedtags; 261 262 if ( empty( $theme ) ) 263 return; 264 265 $name = wp_kses( $theme->name, $themes_allowedtags ); 266 $author = wp_kses( $theme->author, $themes_allowedtags ); 267 268 $num_ratings = sprintf( _n( '(based on %s rating)', '(based on %s ratings)', $theme->num_ratings ), number_format_i18n( $theme->num_ratings ) ); 269 270 $install_url = add_query_arg( array( 271 'action' => 'install-theme', 272 'theme' => $theme->slug, 273 ), self_admin_url( 'update.php' ) ); 274 275 ?> 276 <div class="install-theme-info"> 277 <a class="theme-install button-primary" href="<?php echo wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ); ?>"><?php _e( 'Install' ); ?></a> 278 <h3 class="theme-name"><?php echo $name; ?></h3> 279 <span class="theme-by"><?php printf( __( 'By %s' ), $author ); ?></span> 280 <?php if ( isset( $theme->screenshot_url ) ): ?> 281 <img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url ); ?>" /> 282 <?php endif; ?> 283 <div class="theme-rating" title="<?php echo esc_attr( $num_ratings ); ?>"> 284 <div style="width:<?php echo esc_attr( intval( $theme->rating ) . 'px' ); ?>;"></div> 285 </div> 286 <div class="theme-version"> 287 <strong><?php _e('Version:') ?> </strong> 288 <?php echo wp_kses( $theme->version, $themes_allowedtags ); ?> 289 </div> 290 <div class="theme-description"> 291 <?php echo wp_kses( $theme->description, $themes_allowedtags ); ?> 292 </div> 293 <input class="theme-preview-url" type="hidden" value="<?php echo esc_url( $theme->preview_url ); ?>" /> 294 </div> 295 <?php 296 } 297 175 298 /** 176 299 * Send required variables to JavaScript land
Note: See TracChangeset
for help on using the changeset viewer.