| 1 | Index: wp-admin/includes/class-wp-theme-install-list-table.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/includes/class-wp-theme-install-list-table.php (revision 19998) |
|---|
| 4 | +++ wp-admin/includes/class-wp-theme-install-list-table.php (working copy) |
|---|
| 5 | @@ -162,12 +162,8 @@ |
|---|
| 6 | $theme_names = array_keys( $themes ); |
|---|
| 7 | |
|---|
| 8 | foreach ( $theme_names as $theme_name ) { |
|---|
| 9 | - $class = array( 'available-theme' ); |
|---|
| 10 | - ?> |
|---|
| 11 | - <div class="<?php echo join( ' ', $class ); ?>"><?php |
|---|
| 12 | - if ( isset( $themes[$theme_name] ) ) |
|---|
| 13 | - display_theme( $themes[$theme_name] ); |
|---|
| 14 | - ?></div> |
|---|
| 15 | - <?php } // end foreach $theme_names |
|---|
| 16 | + if ( isset( $themes[$theme_name] ) ) |
|---|
| 17 | + display_theme( $themes[$theme_name] ); |
|---|
| 18 | + } // end foreach $theme_names |
|---|
| 19 | } |
|---|
| 20 | } |
|---|
| 21 | Index: wp-admin/includes/theme-install.php |
|---|
| 22 | =================================================================== |
|---|
| 23 | --- wp-admin/includes/theme-install.php (revision 19998) |
|---|
| 24 | +++ wp-admin/includes/theme-install.php (working copy) |
|---|
| 25 | @@ -133,9 +133,17 @@ |
|---|
| 26 | if ( empty($theme) ) |
|---|
| 27 | return; |
|---|
| 28 | |
|---|
| 29 | + $class = array( 'available-theme' ); |
|---|
| 30 | + |
|---|
| 31 | $name = wp_kses($theme->name, $themes_allowedtags); |
|---|
| 32 | $author = wp_kses($theme->author, $themes_allowedtags); |
|---|
| 33 | $desc = wp_kses($theme->description, $themes_allowedtags); |
|---|
| 34 | + $screenshots = (array) $theme->screenshot_url; |
|---|
| 35 | + $num_screenshots = count( $screenshots ); |
|---|
| 36 | + |
|---|
| 37 | + if ( $num_screenshots > 1 ) |
|---|
| 38 | + $class[] = 'has-screenshots'; |
|---|
| 39 | + |
|---|
| 40 | //if ( strlen($desc) > 30 ) |
|---|
| 41 | // $desc = substr($desc, 0, 15) . '<span class="dots">...</span><span>' . substr($desc, -15) . '</span>'; |
|---|
| 42 | |
|---|
| 43 | @@ -151,10 +159,13 @@ |
|---|
| 44 | |
|---|
| 45 | $actions = implode ( ' | ', $actions ); |
|---|
| 46 | ?> |
|---|
| 47 | +<div class="<?php echo join( ' ', $class ); ?>"> |
|---|
| 48 | <a class='thickbox thickbox-preview screenshot' |
|---|
| 49 | href='<?php echo esc_url($preview_link); ?>' |
|---|
| 50 | title='<?php echo esc_attr(sprintf(__('Preview “%s”'), $name)); ?>'> |
|---|
| 51 | -<img src='<?php echo esc_url($theme->screenshot_url); ?>' width='150' /> |
|---|
| 52 | +<?php if ( ! empty ( $screenshots ) && false !== $screenshots[0] ) : ?> |
|---|
| 53 | +<img src='<?php echo esc_url($screenshots[0]); ?>' alt='' data-num-images='<?php echo $num_screenshots; ?>' /> |
|---|
| 54 | +<?php endif; ?> |
|---|
| 55 | </a> |
|---|
| 56 | <h3><?php |
|---|
| 57 | /* translators: 1: theme name, 2: author name */ |
|---|
| 58 | @@ -183,6 +194,7 @@ |
|---|
| 59 | <div class="star star1"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?>" alt="<?php esc_attr_e('1 star') ?>" /></div> |
|---|
| 60 | </div> |
|---|
| 61 | </div> |
|---|
| 62 | +</div> |
|---|
| 63 | <?php } |
|---|
| 64 | /* |
|---|
| 65 | object(stdClass)[59] |
|---|
| 66 | Index: wp-admin/includes/class-wp-themes-list-table.php |
|---|
| 67 | =================================================================== |
|---|
| 68 | --- wp-admin/includes/class-wp-themes-list-table.php (revision 19998) |
|---|
| 69 | +++ wp-admin/includes/class-wp-themes-list-table.php (working copy) |
|---|
| 70 | @@ -130,16 +130,15 @@ |
|---|
| 71 | |
|---|
| 72 | foreach ( $theme_names as $theme_name ) { |
|---|
| 73 | $class = array( 'available-theme' ); |
|---|
| 74 | - ?> |
|---|
| 75 | - <div class="<?php echo join( ' ', $class ); ?>"> |
|---|
| 76 | - <?php if ( !empty( $theme_name ) ) : |
|---|
| 77 | + |
|---|
| 78 | + if ( !empty( $theme_name ) ) : |
|---|
| 79 | $template = $themes[$theme_name]['Template']; |
|---|
| 80 | $stylesheet = $themes[$theme_name]['Stylesheet']; |
|---|
| 81 | $title = $themes[$theme_name]['Title']; |
|---|
| 82 | $version = $themes[$theme_name]['Version']; |
|---|
| 83 | $description = $themes[$theme_name]['Description']; |
|---|
| 84 | $author = $themes[$theme_name]['Author']; |
|---|
| 85 | - $screenshot = $themes[$theme_name]['Screenshot']; |
|---|
| 86 | + $screenshots = (array) $themes[$theme_name]['Screenshot']; |
|---|
| 87 | $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir']; |
|---|
| 88 | $template_dir = $themes[$theme_name]['Template Dir']; |
|---|
| 89 | $parent_theme = $themes[$theme_name]['Parent Theme']; |
|---|
| 90 | @@ -159,10 +158,16 @@ |
|---|
| 91 | $actions = apply_filters( 'theme_action_links', $actions, $themes[$theme_name] ); |
|---|
| 92 | |
|---|
| 93 | $actions = implode ( ' | ', $actions ); |
|---|
| 94 | + |
|---|
| 95 | + $num_screenshots = count( $screenshots ); |
|---|
| 96 | + |
|---|
| 97 | + if ( $num_screenshots > 1 ) |
|---|
| 98 | + $class[] = 'has-screenshots'; |
|---|
| 99 | ?> |
|---|
| 100 | + <div class="<?php echo join( ' ', $class ); ?>"> |
|---|
| 101 | <a href="<?php echo $preview_link; ?>" class="<?php echo $thickbox_class; ?> screenshot"> |
|---|
| 102 | -<?php if ( $screenshot ) : ?> |
|---|
| 103 | - <img src="<?php echo $theme_root_uri . '/' . $stylesheet . '/' . $screenshot; ?>" alt="" /> |
|---|
| 104 | +<?php if ( ! empty ( $screenshots ) && false !== $screenshots[0] ) : ?> |
|---|
| 105 | + <img src="<?php echo $theme_root_uri . '/' . $stylesheet . '/' . $screenshots[0]; ?>" alt="" data-num-images="<?php echo $num_screenshots; ?>" /> |
|---|
| 106 | <?php endif; ?> |
|---|
| 107 | </a> |
|---|
| 108 | <h3><?php |
|---|
| 109 | @@ -182,8 +187,8 @@ |
|---|
| 110 | <?php if ( $tags ) : ?> |
|---|
| 111 | <p><?php _e( 'Tags:' ); ?> <?php echo join( ', ', $tags ); ?></p> |
|---|
| 112 | <?php endif; ?> |
|---|
| 113 | +</div> |
|---|
| 114 | <?php endif; // end if not empty theme_name ?> |
|---|
| 115 | -</div> |
|---|
| 116 | <?php theme_update_available( $themes[$theme_name] ); ?> |
|---|
| 117 | </div> |
|---|
| 118 | <?php } // end foreach $theme_names |
|---|
| 119 | Index: wp-admin/js/theme-preview.dev.js |
|---|
| 120 | =================================================================== |
|---|
| 121 | --- wp-admin/js/theme-preview.dev.js (revision 19998) |
|---|
| 122 | +++ wp-admin/js/theme-preview.dev.js (working copy) |
|---|
| 123 | @@ -54,10 +54,97 @@ |
|---|
| 124 | return false; |
|---|
| 125 | } ); |
|---|
| 126 | |
|---|
| 127 | - // Theme details |
|---|
| 128 | - $('#availablethemes').on('click', 'a.theme-detail', function (event) { |
|---|
| 129 | - $(this).siblings('.themedetaildiv').toggle(); |
|---|
| 130 | + |
|---|
| 131 | + // Toggle Theme Details |
|---|
| 132 | + var currentTheme; |
|---|
| 133 | + $('#availablethemes').on( 'click', 'a.theme-detail', function() { |
|---|
| 134 | + |
|---|
| 135 | + var $this = $(this); |
|---|
| 136 | + |
|---|
| 137 | + if ( currentTheme !== undefined ) { |
|---|
| 138 | + // remove active class/extended details div |
|---|
| 139 | + $('.extended-details').remove(); |
|---|
| 140 | + currentTheme.removeClass( 'active' ); |
|---|
| 141 | + currentTheme.height( 'auto' ); |
|---|
| 142 | + |
|---|
| 143 | + // bail if the link clicked was the same as previously |
|---|
| 144 | + if ( currentTheme[0] === $this.closest( 'div.available-theme' )[0] ) { |
|---|
| 145 | + currentTheme = undefined; |
|---|
| 146 | + return false; |
|---|
| 147 | + } |
|---|
| 148 | + } |
|---|
| 149 | + |
|---|
| 150 | + // reset nextLower - has scope for now to possibly use for window resize reflow |
|---|
| 151 | + var nextLower = undefined, |
|---|
| 152 | + maxMargin = 50, // Max Margin allowed between theme and details div |
|---|
| 153 | + detailsDiv = $('<div class="extended-details"><div class="themedetaildiv"><h4>Theme Details</h4></div><div class="screenshots"></div></div>'); |
|---|
| 154 | + |
|---|
| 155 | + currentTheme = $this.closest( 'div.available-theme' ); |
|---|
| 156 | + var currentPosition = currentTheme.position().top; |
|---|
| 157 | + var currentBottom = currentPosition + currentTheme.height(); |
|---|
| 158 | + |
|---|
| 159 | + currentTheme.addClass( 'active' ); |
|---|
| 160 | + |
|---|
| 161 | + // find the next div.available-theme that has a lower position().top |
|---|
| 162 | + currentTheme.nextAll('div.available-theme').each( function() { |
|---|
| 163 | + var $this = $(this); |
|---|
| 164 | + if( currentPosition < $this.position().top ) { |
|---|
| 165 | + nextLower = $this; |
|---|
| 166 | + return false; |
|---|
| 167 | + } |
|---|
| 168 | + }); |
|---|
| 169 | + |
|---|
| 170 | + // insert the details div |
|---|
| 171 | + if ( nextLower !== undefined ) { |
|---|
| 172 | + nextLower.before( detailsDiv ); |
|---|
| 173 | + } else { |
|---|
| 174 | + $('#availablethemes').append( detailsDiv ); |
|---|
| 175 | + } |
|---|
| 176 | + |
|---|
| 177 | + // now that it's generated, grab top of details div |
|---|
| 178 | + var detailsTop = detailsDiv.position().top; |
|---|
| 179 | + var margin = detailsTop - currentBottom; |
|---|
| 180 | + |
|---|
| 181 | + /** |
|---|
| 182 | + * If the margin between the bottom of the current theme and details div |
|---|
| 183 | + * is greater than maxMargin, extend current theme to avoid whitespace. |
|---|
| 184 | + */ |
|---|
| 185 | + if ( margin > maxMargin) |
|---|
| 186 | + currentTheme.height( currentTheme.height() + ( margin - maxMargin ) ); |
|---|
| 187 | + |
|---|
| 188 | + var themeDetails = $this.siblings( '.themedetaildiv' ).html(); |
|---|
| 189 | + $('.extended-details .themedetaildiv').append(themeDetails); |
|---|
| 190 | + |
|---|
| 191 | + // do more screenshots |
|---|
| 192 | + var screenshot = $('.screenshot img', currentTheme); |
|---|
| 193 | + var src = screenshot.attr( 'src' ); |
|---|
| 194 | + |
|---|
| 195 | + if ( src !== undefined ) { |
|---|
| 196 | + var numScreenshots = screenshot.attr( 'data-num-images' ), |
|---|
| 197 | + screenshots = $('.extended-details .screenshots'); |
|---|
| 198 | + |
|---|
| 199 | + screenshots.append( '<div class="screenshot"><img src="' + src + '" /></div>' ); |
|---|
| 200 | + |
|---|
| 201 | + if ( numScreenshots !== undefined && numScreenshots > 1 ) { |
|---|
| 202 | + var base = src.replace( /screenshot\.(jpg|png)$/, '' ); |
|---|
| 203 | + |
|---|
| 204 | + for ( var i = 2; i <= numScreenshots; i++ ) { |
|---|
| 205 | + screenshots.append( '<div class="screenshot"><img src="' + base + 'screenshot-' + String(i) + '.png" /></div>' ); |
|---|
| 206 | + } |
|---|
| 207 | + } |
|---|
| 208 | + } |
|---|
| 209 | + |
|---|
| 210 | return false; |
|---|
| 211 | }); |
|---|
| 212 | |
|---|
| 213 | + // if we resize, and there's a details div open, close it. |
|---|
| 214 | + $(window).resize( function() { |
|---|
| 215 | + if ( currentTheme !== undefined ) { |
|---|
| 216 | + $('.extended-details').remove(); |
|---|
| 217 | + currentTheme.removeClass( 'active' ); |
|---|
| 218 | + currentTheme.height( 'auto' ); |
|---|
| 219 | + currentTheme = undefined; |
|---|
| 220 | + } |
|---|
| 221 | + }); |
|---|
| 222 | + |
|---|
| 223 | }); |
|---|
| 224 | Index: wp-admin/css/wp-admin.dev.css |
|---|
| 225 | =================================================================== |
|---|
| 226 | --- wp-admin/css/wp-admin.dev.css (revision 19998) |
|---|
| 227 | +++ wp-admin/css/wp-admin.dev.css (working copy) |
|---|
| 228 | @@ -4478,16 +4478,25 @@ |
|---|
| 229 | .available-theme { |
|---|
| 230 | display: inline-block; |
|---|
| 231 | margin-bottom: 10px; |
|---|
| 232 | - margin-right: 25px; |
|---|
| 233 | + margin-right: 10px; |
|---|
| 234 | overflow: hidden; |
|---|
| 235 | padding: 20px; |
|---|
| 236 | vertical-align: top; |
|---|
| 237 | - width: 240px; |
|---|
| 238 | + width: 300px; |
|---|
| 239 | + border-top-left-radius: 3px; |
|---|
| 240 | + border-top-right-radius: 3px; |
|---|
| 241 | + -webkit-border-top-left-radius: 3px; |
|---|
| 242 | + -webkit-border-top-right-radius: 3px; |
|---|
| 243 | } |
|---|
| 244 | |
|---|
| 245 | +.js .available-theme.has-screenshots { |
|---|
| 246 | + background: transparent url(../images/stack.png) no-repeat 26px 5px; |
|---|
| 247 | +} |
|---|
| 248 | + |
|---|
| 249 | .available-theme a.screenshot { |
|---|
| 250 | - width: 240px; |
|---|
| 251 | - height: 180px; |
|---|
| 252 | + width: 300px; |
|---|
| 253 | + height: 225px; |
|---|
| 254 | + margin: 0 auto; |
|---|
| 255 | display: block; |
|---|
| 256 | border-width: 1px; |
|---|
| 257 | border-style: solid; |
|---|
| 258 | @@ -4496,13 +4505,66 @@ |
|---|
| 259 | } |
|---|
| 260 | |
|---|
| 261 | .available-theme img { |
|---|
| 262 | - width: 240px; |
|---|
| 263 | + width: 300px; |
|---|
| 264 | } |
|---|
| 265 | |
|---|
| 266 | .available-theme h3 { |
|---|
| 267 | margin: 15px 0 5px; |
|---|
| 268 | } |
|---|
| 269 | |
|---|
| 270 | +.available-theme.active, |
|---|
| 271 | +.available-theme.has-screenshots.active { |
|---|
| 272 | + background: #efefef; |
|---|
| 273 | +} |
|---|
| 274 | + |
|---|
| 275 | +.extended-details { |
|---|
| 276 | + overflow: hidden; |
|---|
| 277 | + position: relative; |
|---|
| 278 | + margin-top: -13px; |
|---|
| 279 | + margin-bottom: 20px; |
|---|
| 280 | + padding: 5px 20px; |
|---|
| 281 | + padding-left: 330px; |
|---|
| 282 | + background-color: #efefef; |
|---|
| 283 | + border-radius: 3px; |
|---|
| 284 | + -webkit-border-radius: 3px; |
|---|
| 285 | +} |
|---|
| 286 | + |
|---|
| 287 | +#availablethemes .extended-details h4 { |
|---|
| 288 | + margin: 1em 0; |
|---|
| 289 | +} |
|---|
| 290 | + |
|---|
| 291 | +.extended-details .themedetaildiv { |
|---|
| 292 | + position: relative; |
|---|
| 293 | + float: left; |
|---|
| 294 | + width: 280px; |
|---|
| 295 | + right: 310px; |
|---|
| 296 | + margin-right: -100%; |
|---|
| 297 | + margin-bottom: 20px; |
|---|
| 298 | +} |
|---|
| 299 | + |
|---|
| 300 | +.extended-details .screenshots { |
|---|
| 301 | + position: relative; |
|---|
| 302 | + float: left; |
|---|
| 303 | + margin-top: 15px; |
|---|
| 304 | + width: 100%; |
|---|
| 305 | +} |
|---|
| 306 | + |
|---|
| 307 | +.extended-details div.screenshot { |
|---|
| 308 | + overflow: hidden; |
|---|
| 309 | + float: left; |
|---|
| 310 | + margin-right: 20px; |
|---|
| 311 | + margin-bottom: 20px; |
|---|
| 312 | + width: 300px; |
|---|
| 313 | + height: 225px; |
|---|
| 314 | + border: 1px solid #ddd; |
|---|
| 315 | +} |
|---|
| 316 | + |
|---|
| 317 | +.extended-details div.screenshot img { |
|---|
| 318 | + display: block; |
|---|
| 319 | + margin: 0 auto; |
|---|
| 320 | + width: 100%; |
|---|
| 321 | +} |
|---|
| 322 | + |
|---|
| 323 | #current-theme { |
|---|
| 324 | margin: 1em 0 1.5em; |
|---|
| 325 | } |
|---|
| 326 | @@ -7423,8 +7485,7 @@ |
|---|
| 327 | } |
|---|
| 328 | |
|---|
| 329 | |
|---|
| 330 | -#theme-information .available-theme, |
|---|
| 331 | -.available-theme { |
|---|
| 332 | +#theme-information .available-theme { |
|---|
| 333 | padding: 20px 15px; |
|---|
| 334 | } |
|---|
| 335 | |
|---|