<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[15655] trunk/wp-admin/includes: get_theme_feature_list()
  replaces install_themes_feature_list().</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/15655">15655</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-09-24 15:28:28 +0000 (Fri, 24 Sep 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>get_theme_feature_list() replaces install_themes_feature_list().  Does translation and works if feature_list is not accessible from api.wordpress.org. see <a href="http://trac.wordpress.org/ticket/14936">#14936</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesthemeinstallphp">trunk/wp-admin/includes/theme-install.php</a></li>
<li><a href="#trunkwpadminincludesthemephp">trunk/wp-admin/includes/theme.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesthemeinstallphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/theme-install.php (15654 => 15655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/theme-install.php        2010-09-24 14:08:07 UTC (rev 15654)
+++ trunk/wp-admin/includes/theme-install.php        2010-09-24 15:28:28 UTC (rev 15655)
</span><span class="lines">@@ -70,6 +70,8 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 2.8.0
</span><span class="cx">  *
</span><ins>+ * @deprecated since 3.1.0  Use get_theme_feature_list() instead.
+ *
</ins><span class="cx">  * @return array
</span><span class="cx">  */
</span><span class="cx"> function install_themes_feature_list( ) {
</span><span class="lines">@@ -124,30 +126,15 @@
</span><span class="cx"> &lt;form method=&quot;post&quot; action=&quot;&lt;?php echo admin_url( 'theme-install.php?tab=search' ); ?&gt;&quot;&gt;
</span><span class="cx"> &lt;p class=&quot;install-help&quot;&gt;&lt;?php _e('Find a theme based on specific features') ?&gt;&lt;/p&gt;
</span><span class="cx">         &lt;?php
</span><del>-        $feature_list = install_themes_feature_list( );
</del><ins>+        $feature_list = get_theme_feature_list( );
</ins><span class="cx">         echo '&lt;div class=&quot;feature-filter&quot;&gt;';
</span><del>-        $trans = array ('Colors' =&gt; __('Colors'), 'black' =&gt; __('Black'), 'blue' =&gt; __('Blue'), 'brown' =&gt; __('Brown'),
-                'green' =&gt; __('Green'), 'orange' =&gt; __('Orange'), 'pink' =&gt; __('Pink'), 'purple' =&gt; __('Purple'), 'red' =&gt; __('Red'),
-                'silver' =&gt; __('Silver'), 'tan' =&gt; __('Tan'), 'white' =&gt; __('White'), 'yellow' =&gt; __('Yellow'), 'dark' =&gt; __('Dark'),
-                'light' =&gt; __('Light'), 'Columns' =&gt; __('Columns'), 'one-column' =&gt; __('One Column'), 'two-columns' =&gt; __('Two Columns'),
-                'three-columns' =&gt; __('Three Columns'), 'four-columns' =&gt; __('Four Columns'), 'left-sidebar' =&gt; __('Left Sidebar'),
-                'right-sidebar' =&gt; __('Right Sidebar'), 'Width' =&gt; __('Width'), 'fixed-width' =&gt; __('Fixed Width'), 'flexible-width' =&gt; __('Flexible Width'),
-                'Features' =&gt; __('Features'), 'custom-colors' =&gt; __('Custom Colors'), 'custom-header' =&gt; __('Custom Header'), 'theme-options' =&gt; __('Theme Options'),
-                'threaded-comments' =&gt; __('Threaded Comments'), 'sticky-post' =&gt; __('Sticky Post'), 'microformats' =&gt; __('Microformats'),
-                'Subject' =&gt; __('Subject'), 'holiday' =&gt; __('Holiday'), 'photoblogging' =&gt; __('Photoblogging'), 'seasonal' =&gt; __('Seasonal'),
-        );
</del><span class="cx"> 
</span><span class="cx">         foreach ( (array) $feature_list as $feature_name =&gt; $features ) {
</span><del>-                if ( isset($trans[$feature_name]) )
-                         $feature_name = $trans[$feature_name];
</del><span class="cx">                 $feature_name = esc_html( $feature_name );
</span><span class="cx">                 echo '&lt;div class=&quot;feature-name&quot;&gt;' . $feature_name . '&lt;/div&gt;';
</span><span class="cx"> 
</span><span class="cx">                 echo '&lt;ol style=&quot;float: left; width: 725px;&quot; class=&quot;feature-group&quot;&gt;';
</span><del>-                foreach ( $features as $feature ) {
-                        $feature_name = $feature;
-                        if ( isset($trans[$feature]) )
-                                $feature_name = $trans[$feature];
</del><ins>+                foreach ( $features as $feature =&gt; $feature_name ) {
</ins><span class="cx">                         $feature_name = esc_html( $feature_name );
</span><span class="cx">                         $feature = esc_attr($feature);
</span><span class="cx"> ?&gt;
</span></span></pre></div>
<a id="trunkwpadminincludesthemephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/theme.php (15654 => 15655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/theme.php        2010-09-24 14:08:07 UTC (rev 15654)
+++ trunk/wp-admin/includes/theme.php        2010-09-24 15:28:28 UTC (rev 15655)
</span><span class="lines">@@ -250,4 +250,107 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Retrieve list of WordPress theme features (aka theme tags)
+ *
+ * @since 3.1.0
+ *
+ * @return array  Array of features keyed by category with translations keyed by slug.
+ */
+function get_theme_feature_list() {
+        // Hard-coded list is used if api not accessible.
+        $features = array(
+                        __('Colors') =&gt; array(
+                                'black'   =&gt; __( 'Black' ),
+                                'blue'    =&gt; __( 'Blue' ),
+                                'brown'   =&gt; __( 'Brown' ),
+                                'green'   =&gt; __( 'Green' ),
+                                'orange'  =&gt; __( 'Orange' ),
+                                'pink'    =&gt; __( 'Pink' ),
+                                'purple'  =&gt; __( 'Purple' ),
+                                'red'     =&gt; __( 'Red' ),
+                                'silver'  =&gt; __( 'Silver' ),
+                                'tan'     =&gt; __( 'Tan' ),
+                                'white'   =&gt; __( 'White' ),
+                                'yellow'  =&gt; __( 'Yellow' ),
+                                'dark'    =&gt; __( 'Dark' ),
+                                'light'   =&gt; __( 'Light ')
+                        ),
+
+                __('Columns') =&gt; array(
+                        'one-column'    =&gt; __( 'One Column' ),
+                        'two-columns'   =&gt; __( 'Two Columns' ),
+                        'three-columns' =&gt; __( 'Three Columns' ),
+                        'four-columns'  =&gt; __( 'Four Columns' ),
+                        'left-sidebar'  =&gt; __( 'Left Sidebar' ),
+                        'right-sidebar' =&gt; __( 'Right Sidebar' )
+                ),
+
+                __('Width') =&gt; array(
+                        'fixed-width'    =&gt; __( 'Fixed Width' ),
+                        'flexible-width' =&gt; __( 'Flexible Width' )
+                ),
+
+                __( 'Features' ) =&gt; array(
+                        'blavatar'             =&gt; __( 'Blavatar' ),
+                        'buddypress'           =&gt; __( 'BuddyPress' ),
+                        'custom-background'    =&gt; __( 'Custom Background' ),
+                        'custom-colors'        =&gt; __( 'Custom Colors' ),
+                        'custom-header'        =&gt; __( 'Custom Header' ),
+                        'custom-menu'          =&gt; __( 'Custom Menu' ),
+                        'editor-style'         =&gt; __( 'Editor Style' ),
+                        'front-page-post-form' =&gt; __( 'Front Page Posting' ),
+                        'microformats'         =&gt; __( 'Microformats' ),
+                        'sticky-post'          =&gt; __( 'Sticky Post' ),
+                        'theme-options'        =&gt; __( 'Theme Options' ),
+                        'threaded-comments'    =&gt; __( 'Threaded Comments' ),
+                        'translation-ready'    =&gt; __( 'Translation Ready' ),
+                        'rtl-language-support' =&gt; __( 'RTL Language Support' )
+                ),
+
+                __( 'Subject' )  =&gt; array(
+                        'holiday' =&gt; __( 'Holiday' ),
+                        'photoblogging' =&gt; __( 'Photoblogging' ),
+                        'seasonal' =&gt; __( 'Seasonal' )
+                )
+        );
+
+        if ( !current_user_can('install_themes') )
+                return $features;
+
+        if ( !$feature_list = get_site_transient( 'wporg_theme_feature_list' ) )
+                set_site_transient( 'wporg_theme_feature_list', array( ),  10800);
+
+        if ( !$feature_list ) {
+                $feature_list = themes_api( 'feature_list', array( ) );
+                if ( is_wp_error( $feature_list ) )
+                        return $features;
+        }
+
+        if ( !$feature_list )
+                return $features;
+
+        set_site_transient( 'wporg_theme_feature_list', $feature_list, 10800 );
+
+        $category_translations = array( 'Colors' =&gt; __('Colors'), 'Columns' =&gt; __('Columns'), 'Width' =&gt; __('Width'),
+                                                                   'Features' =&gt; __('Features'), 'Subject' =&gt; __('Subject') );
+
+        // Loop over the wporg canonical list and apply translations
+        $wporg_features = array();
+        foreach ( (array) $feature_list as $feature_category =&gt; $feature_items ) {
+                if ( isset($category_translations[$feature_category]) )
+                        $feature_category = $category_translations[$feature_category];
+                $wporg_features[$feature_category] = array();
+
+                foreach ( $feature_items as $feature ) {
+                        if ( isset($features[$feature_category][$feature]) )
+                                $wporg_features[$feature_category][$feature] = $features[$feature_category][$feature];
+                        else
+                                $wporg_features[$feature_category][$feature] = $feature;
+                }
+        }
+
+        return $wporg_features;
+}
+
</ins><span class="cx"> ?&gt;
</span></span></pre>
</div>
</div>

</body>
</html>