| 1271 | * Customize Active Theme Control class. |
| 1272 | * |
| 1273 | * @since 4.2.0 |
| 1274 | * |
| 1275 | * @see WP_Customize_Control |
| 1276 | */ |
| 1277 | class WP_Customize_Active_Theme_Control extends WP_Customize_Control { |
| 1278 | |
| 1279 | /** |
| 1280 | * Customize control type. |
| 1281 | * |
| 1282 | * @since 4.2.0 |
| 1283 | * @access public |
| 1284 | * @var string |
| 1285 | */ |
| 1286 | public $type = 'active_theme'; |
| 1287 | |
| 1288 | /** |
| 1289 | * Theme object. |
| 1290 | * |
| 1291 | * @since 4.2.0 |
| 1292 | * @access public |
| 1293 | * @var WP_Theme |
| 1294 | */ |
| 1295 | public $theme; |
| 1296 | |
| 1297 | /** |
| 1298 | * Render control's content from PHP. |
| 1299 | * |
| 1300 | * @since 4.2.0 |
| 1301 | * @access public |
| 1302 | */ |
| 1303 | public function render_content() { |
| 1304 | $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); |
| 1305 | $preview_url = esc_url( remove_query_arg( 'theme', $current_url ) ); |
| 1306 | $aria_action = esc_attr( $this->theme['id'] . '-action' ); |
| 1307 | $aria_name = esc_attr( $this->theme['id'] . '-name' ); |
| 1308 | ?> |
| 1309 | <div class="theme active" tabindex="0" data-preview-url="<?php echo esc_attr( $preview_url ); ?>" aria-describedby="<?php echo $aria_action . ' ' . $aria_name; ?>"> |
| 1310 | <?php if ( ! empty( $this->theme['screenshot'][0] ) ) { ?> |
| 1311 | <div class="theme-screenshot"> |
| 1312 | <img src="<?php echo $this->theme['screenshot'][0]; ?>" alt="" /> |
| 1313 | </div> |
| 1314 | <?php } else { ?> |
| 1315 | <div class="theme-screenshot blank"></div> |
| 1316 | <?php } ?> |
| 1317 | <span class="more-details" id="<?php echo $aria_action; ?>"><?php _e( 'Customize' ); ?></span> |
| 1318 | <div class="theme-author"><?php printf( __( 'By %s' ), $this->theme['author'] ); ?></div> |
| 1319 | |
| 1320 | <h3 class="theme-name" id="<?php echo $aria_name; ?>"> |
| 1321 | <?php |
| 1322 | /* translators: %s: theme name */ |
| 1323 | printf( __( '<span>Active:</span> %s' ), $this->theme['name'] ); |
| 1324 | ?> |
| 1325 | </h3> |
| 1326 | </div> |
| 1327 | <?php |
| 1328 | } |
| 1329 | } |
| 1330 | |
| 1331 | /** |