/** * Translate a theme header. * * @access private * @since 3.4.0 * * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status. * @param string $value Value to translate. * @return string Translated value. */ private function translate_header($header, $value) { switch ($header) { case 'Name': // Cached for sorting reasons. if (isset($this->name_translated)) { return $this->name_translated; } $this->name_translated = translate($value, $this->get('TextDomain')); return $this->name_translated; case 'Tags': if (empty($value)) { return $value; } static $tags_list; if (!isset($tags_list)) { $tags_list = array(); $feature_list = get_theme_feature_list(false); // No API foreach ($feature_list as $tags) { $tags_list += $tags; } } foreach ($value as &$tag) { if (isset($tags_list[$tag])) { $tag = $tags_list[$tag]; } } return $value; break; default: $value = translate($value, $this->get('TextDomain')); } return $value; }
<a id="filter-click" href="?filter=1"><?php _e('Feature Filter'); ?> </a> </p> <br class="clear"/> <div id="filter-box" style="<?php if (empty($_REQUEST['filter'])) { echo 'display: none;'; } ?> "> <?php $feature_list = get_theme_feature_list(); ?> <div class="feature-filter"> <p class="install-help"><?php _e('Theme filters'); ?> </p> <?php if (!empty($_REQUEST['filter'])) { ?> <input type="hidden" name="filter" value="1" /> <?php } ?> <?php foreach ($feature_list as $feature_name => $features) {
/** * Display tags filter for themes. * * @since 2.8.0 */ function install_themes_dashboard() { install_theme_search_form(); ?> <h4><?php _e('Feature Filter'); ?> </h4> <form method="post" action="<?php echo self_admin_url('theme-install.php?tab=search'); ?> "> <p class="install-help"><?php _e('Find a theme based on specific features'); ?> </p> <?php $feature_list = get_theme_feature_list(); echo '<div class="feature-filter">'; foreach ((array) $feature_list as $feature_name => $features) { $feature_name = esc_html($feature_name); echo '<div class="feature-name">' . $feature_name . '</div>'; echo '<ol class="feature-group">'; foreach ($features as $feature => $feature_name) { $feature_name = esc_html($feature_name); $feature = esc_attr($feature); ?> <li> <input type="checkbox" name="features[<?php echo $feature; ?> ]" id="feature-id-<?php echo $feature; ?> " value="<?php echo $feature; ?> " /> <label for="feature-id-<?php echo $feature; ?> "><?php echo $feature_name; ?> </label> </li> <?php } ?> </ol> <br class="clear" /> <?php } ?> </div> <br class="clear" /> <?php submit_button(__('Find Themes'), 'button', 'search'); ?> </form> <?php }
public static function renderThemesTable($favoritesCallback = '') { if (!mainwp_current_user_can("dashboard", "install_themes")) { mainwp_do_not_have_permissions(__('install themes', 'mainwp')); return; } ?> <a href="#" class="mainwp_action left mainwp_action_down browse-themes" ><?php _e('Search', 'mainwp'); ?> </a><a href="#" class="mainwp_action right upload" ><?php _e('Upload', 'mainwp'); ?> </a> <br class="clear" /><br /> <div class="mainwp_config_box_left" style="width: calc(100% - 290px);"> <div class="error below-h2" style="display: none;" id="ajax-error-zone"></div> <div class="upload-theme"> <?php MainWP_Install_Bulk::renderUpload('Themes'); ?> </div> <div class="wp-filter"> <h3 class="mainwp_box_title"><?php _e('Step 1: Select a Theme', 'mainwp'); ?> </h3> <div class="filter-count"> <span class="count theme-count"></span> </div> <ul class="filter-links"> <li><a href="#" data-sort="featured"><?php _ex('Featured', 'themes'); ?> </a></li> <li><a href="#" data-sort="popular"><?php _ex('Popular', 'themes'); ?> </a></li> <li><a href="#" data-sort="new"><?php _ex('Latest', 'themes'); ?> </a></li> </ul> <a class="drawer-toggle" href="#"><?php _e('Feature Filter', 'mainwp'); ?> </a> <div class="search-form"></div> <div class="filter-drawer"> <div class="buttons"> <a class="apply-filters button button-secondary" href="#"><?php _e('Apply Filters', 'mainwp'); ?> <span></span></a> <a class="clear-filters button button-secondary" href="#"><?php _e('Clear', 'mainwp'); ?> </a> </div> <?php $feature_list = get_theme_feature_list(); foreach ($feature_list as $feature_name => $features) { echo '<div class="filter-group">'; $feature_name = esc_html($feature_name); echo '<h4>' . $feature_name . '</h4>'; echo '<ol class="feature-group">'; foreach ($features as $feature => $feature_name) { $feature = esc_attr($feature); echo '<li><input type="checkbox" id="filter-id-' . $feature . '" value="' . $feature . '" /> '; echo '<label for="filter-id-' . $feature . '">' . $feature_name . '</label></li>'; } echo '</ol>'; echo '</div>'; } ?> <div class="filtered-by"> <span><?php _e('Filtering by:', 'mainwp'); ?> </span> <div class="tags"></div> <a href="#"><?php _e('Edit', 'mainwp'); ?> </a> </div> </div> </div> <div class="theme-browser content-filterable hide-if-upload"></div> <div class="theme-install-overlay wp-full-overlay expanded"></div> <p class="no-themes"><?php _e('No themes found. Try a different search.'); ?> </p> <span class="spinner"></span> <br class="clear" /> </div> <script id="tmpl-theme" type="text/template"> <# if ( data.screenshot_url ) { #> <div class="theme-screenshot"> <img src="{{ data.screenshot_url }}" alt="" /> </div> <# } else { #> <div class="theme-screenshot blank"></div> <# } #> <span class="more-details"><?php _ex('Details & Preview', 'theme'); ?> </span> <div class="theme-author"><?php printf(__('By %s', 'mainwp'), '{{ data.author }}'); ?> </div> <h3 class="theme-name">{{ data.name }}</h3> <!--<div class="theme-actions">--> <!--<a class="button button-secondary preview install-theme-preview" href="#"><?php esc_html_e('Preview', 'mainwp'); ?> </a>--> <!--</div>--> <div class="mainwp-theme-lnks" style=""> <label class="lbl-install-theme" style="font-size: 16px;"><input name="install-theme" type="radio" id="install-theme-{{data.slug}}" title="Install {{data.name}}"><?php esc_html_e('Install this Theme', 'mainwp'); ?> </label> <?php if (!empty($favoritesCallback)) { ?> <div class="favorites-add-link"><a style="font-size: 16px;" class="add-favorites" href="#" id="add-favorite-theme-{{data.slug}}" title="{{data.name}} {{data.version}}"><?php _e('Add To Favorites', 'mainwp'); ?> </a></div> <?php } ?> </div> <# if ( data.installed ) { #> <div class="theme-installed"><?php _ex('Already Installed', 'theme'); ?> </div> <# } #> </script> <script id="tmpl-theme-preview" type="text/template"> <div class="wp-full-overlay-sidebar"> <div class="wp-full-overlay-header"> <a href="#" class="close-full-overlay"><span class="screen-reader-text"><?php _e('Close', 'mainwp'); ?> </span></a> <a href="#" class="previous-theme"><span class="screen-reader-text"><?php _ex('Previous', 'Button label for a theme'); ?> </span></a> <a href="#" class="next-theme"><span class="screen-reader-text"><?php _ex('Next', 'Button label for a theme'); ?> </span></a> <# if ( data.installed ) { #> <a href="#" class="button button-primary theme-install disabled"><?php _ex('Installed', 'theme'); ?> </a> <# } else { #> <a href="{{ data.install_url }}" class="button button-primary theme-install"><?php _e('Install', 'mainwp'); ?> </a> <# } #> </div> <div class="wp-full-overlay-sidebar-content"> <div class="install-theme-info"> <h3 class="theme-name">{{ data.name }}</h3> <span class="theme-by"><?php printf(__('By %s', 'mainwp'), '{{ data.author }}'); ?> </span> <img class="theme-screenshot" src="{{ data.screenshot_url }}" alt="" /> <div class="theme-details"> <# if ( data.rating ) { #> <div class="star-rating rating-{{ Math.round( data.rating / 10 ) * 10 }}"> <span class="one"></span><span class="two"></span><span class="three"></span><span class="four"></span><span class="five"></span> <small class="ratings">{{ data.num_ratings }}</small> </div> <# } else { #> <div class="star-rating"> <small class="ratings"><?php _e('This theme has not been rated yet.'); ?> </small> </div> <# } #> <div class="theme-version"><?php printf(__('Version: %s', 'mainwp'), '{{ data.version }}'); ?> </div> <div class="theme-description">{{{ data.description }}}</div> </div> </div> </div> <div class="wp-full-overlay-footer"> <button type="button" class="collapse-sidebar button-secondary" aria-expanded="true" aria-label="<?php esc_attr_e('Collapse Sidebar', 'mainwp'); ?> "> <span class="collapse-sidebar-arrow"></span> <span class="collapse-sidebar-label"><?php _e('Collapse', 'mainwp'); ?> </span> </button> </div> </div> <div class="wp-full-overlay-main"> <iframe src="{{ data.preview_url }}" title="<?php esc_attr_e('Preview', 'mainwp'); ?> " /> </div> </script> <?php MainWP_UI::select_sites_box(__("Step 2: Select Sites", 'mainwp'), 'checkbox', true, true, 'mainwp_select_sites_box_right'); ?> <div class="mainwp_config_box_right"> <div class="postbox install-theme-settings"> <h3 class="mainwp_box_title"><i class="fa fa-cog"></i> <?php _e('Step 3: Installation Options', 'mainwp'); ?> </h3> <div class="inside"> <input type="checkbox" value="2" checked id="chk_overwrite" /> <label for="chk_overwrite"><?php _e('Overwrite Existing theme, if already installed', 'mainwp'); ?> </label> </div> </div> <input type="button" value="<?php _e("Complete Installation", 'mainwp'); ?> " class="button-primary button button-hero button-right hide-if-upload" id="mainwp_theme_bulk_install_btn" name="bulk-install"> <input type="button" value="<?php _e('Complete Installation', 'mainwp'); ?> " class="button-primary button button-hero button-right show-if-upload" onClick="mainwp_upload_bulk('themes');"> </div> <div style="clear: both;"></div> <?php }
<form class="search-form filter-form" action="" method="get"> <h3 class="available-themes"><?php _e('Available Themes'); ?></h3> <?php if ( !empty( $_REQUEST['s'] ) || !empty( $_REQUEST['features'] ) || $wp_list_table->has_items() ) : ?> <p class="search-box"> <label class="screen-reader-text" for="theme-search-input"><?php _e('Search Installed Themes'); ?>:</label> <input type="search" id="theme-search-input" name="s" value="<?php _admin_search_query(); ?>" /> <?php submit_button( __( 'Search Installed Themes' ), 'button', false, false, array( 'id' => 'search-submit' ) ); ?> <a id="filter-click" href="?filter=1"><?php _e( 'Feature Filter' ); ?></a> </p> <div id="filter-box" style="<?php if ( empty($_REQUEST['filter']) ) echo 'display: none;'; ?>"> <?php $feature_list = get_theme_feature_list(); ?> <div class="feature-filter"> <p class="install-help"><?php _e('Theme filters') ?></p> <?php if ( !empty( $_REQUEST['filter'] ) ) : ?> <input type="hidden" name="filter" value="1" /> <?php endif; ?> <?php foreach ( $feature_list as $feature_name => $features ) : $feature_name = esc_html( $feature_name ); ?> <div class="feature-container"> <div class="feature-name"><?php echo $feature_name ?></div> <ol class="feature-group"> <?php foreach ( $features as $key => $feature ) : $feature_name = $feature; $feature_name = esc_html( $feature_name );
/** * Translate a theme header. * * @since 3.4.0 * @access private * * @staticvar array $tags_list * * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags. * @param string $value Value to translate. * @return string Translated value. */ private function translate_header($header, $value) { switch ($header) { case 'Name': // Cached for sorting reasons. if (isset($this->name_translated)) { return $this->name_translated; } $this->name_translated = translate($value, $this->get('TextDomain')); return $this->name_translated; case 'Tags': if (empty($value) || !function_exists('get_theme_feature_list')) { return $value; } static $tags_list; if (!isset($tags_list)) { $tags_list = array('black' => __('Black'), 'blue' => __('Blue'), 'brown' => __('Brown'), 'gray' => __('Gray'), 'green' => __('Green'), 'orange' => __('Orange'), 'pink' => __('Pink'), 'purple' => __('Purple'), 'red' => __('Red'), 'silver' => __('Silver'), 'tan' => __('Tan'), 'white' => __('White'), 'yellow' => __('Yellow'), 'dark' => __('Dark'), 'light' => __('Light'), 'fixed-layout' => __('Fixed Layout'), 'fluid-layout' => __('Fluid Layout'), 'responsive-layout' => __('Responsive Layout'), 'blavatar' => __('Blavatar'), 'photoblogging' => __('Photoblogging'), 'seasonal' => __('Seasonal')); $feature_list = get_theme_feature_list(false); // No API foreach ($feature_list as $tags) { $tags_list += $tags; } } foreach ($value as &$tag) { if (isset($tags_list[$tag])) { $tag = $tags_list[$tag]; } elseif (isset(self::$tag_map[$tag])) { $tag = $tags_list[self::$tag_map[$tag]]; } } return $value; default: $value = translate($value, $this->get('TextDomain')); } return $value; }