<!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>[17720] trunk/wp-content/themes/twentyeleven: Twenty Eleven: move widgets.
 php into /inc - see #17198</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/17720">17720</a></dd>
<dt>Author</dt> <dd>lancewillett</dd>
<dt>Date</dt> <dd>2011-04-26 21:05:43 +0000 (Tue, 26 Apr 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Twenty Eleven: move widgets.php into /inc - see <a href="http://trac.wordpress.org/ticket/17198">#17198</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpcontentthemestwentyelevenfunctionsphp">trunk/wp-content/themes/twentyeleven/functions.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/wp-content/themes/twentyeleven/inc/</li>
<li><a href="#trunkwpcontentthemestwentyelevenincwidgetsphp">trunk/wp-content/themes/twentyeleven/inc/widgets.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkwpcontentthemestwentyelevenwidgetsphp">trunk/wp-content/themes/twentyeleven/widgets.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpcontentthemestwentyelevenfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-content/themes/twentyeleven/functions.php (17719 => 17720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-content/themes/twentyeleven/functions.php        2011-04-26 18:59:32 UTC (rev 17719)
+++ trunk/wp-content/themes/twentyeleven/functions.php        2011-04-26 21:05:43 UTC (rev 17720)
</span><span class="lines">@@ -311,7 +311,7 @@
</span><span class="cx"> /**
</span><span class="cx">  * Grab Twenty Eleven's Custom Widgets
</span><span class="cx">  */
</span><del>-require( dirname( __FILE__ ) . '/widgets.php' );
</del><ins>+require( dirname( __FILE__ ) . '/inc/widgets.php' );
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * Display navigation to next/previous pages when applicable
</span></span></pre></div>
<a id="trunkwpcontentthemestwentyelevenincwidgetsphpfromrev17719trunkwpcontentthemestwentyelevenwidgetsphp"></a>
<div class="copfile"><h4>Copied: trunk/wp-content/themes/twentyeleven/inc/widgets.php (from rev 17719, trunk/wp-content/themes/twentyeleven/widgets.php) (0 => 17720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-content/themes/twentyeleven/inc/widgets.php                                (rev 0)
+++ trunk/wp-content/themes/twentyeleven/inc/widgets.php        2011-04-26 21:05:43 UTC (rev 17720)
</span><span class="lines">@@ -0,0 +1,167 @@
</span><ins>+&lt;?php
+/**
+ * new WordPress Widget format
+ * Wordpress 2.8 and above
+ * @see http://codex.wordpress.org/Widgets_API#Developing_Widgets
+ */
+class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
+
+        /**
+         * Constructor
+         *
+         * @return void
+         **/
+        function Twenty_Eleven_Ephemera_Widget() {
+                $widget_ops = array( 'classname' =&gt; 'widget_twentyeleven_ephemera', 'description' =&gt; __( 'Use this widget to list your recent Aside, Status, Quote, and Link posts', 'twentyeleven' ) );
+                $this-&gt;WP_Widget( 'widget_twentyeleven_ephemera', __( 'Twenty Eleven Ephemera', 'twentyeleven' ), $widget_ops );
+                $this-&gt;alt_option_name = 'widget_twentyeleven_ephemera';
+
+                add_action( 'save_post', array(&amp;$this, 'flush_widget_cache' ) );
+                add_action( 'deleted_post', array(&amp;$this, 'flush_widget_cache' ) );
+                add_action( 'switch_theme', array(&amp;$this, 'flush_widget_cache' ) );
+
+        }
+
+        /**
+         * Outputs the HTML for this widget.
+         *
+         * @param array An array of standard parameters for widgets in this theme
+         * @param array An array of settings for this widget instance
+         * @return void Echoes it's output
+         **/
+        function widget( $args, $instance ) {
+                $cache = wp_cache_get( 'widget_twentyeleven_ephemera', 'widget' );
+
+                if ( !is_array($cache) )
+                        $cache = array();
+
+                if ( ! isset( $args['widget_id'] ) )
+                        $args['widget_id'] = null;
+
+                if ( isset($cache[$args['widget_id']]) ) {
+                        echo $cache[$args['widget_id']];
+                        return;
+                }
+
+                ob_start();
+                extract( $args, EXTR_SKIP );
+
+                $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Ephemera' ) : $instance['title'], $instance, $this-&gt;id_base);
+
+                if ( ! isset( $instance['number'] ) )
+                        $instance['number'] = '10';
+
+                if ( ! $number = absint( $instance['number'] ) )
+                         $number = 10;
+
+                $ephemera_args = array(
+                        'order' =&gt; 'DESC',
+                        'posts_per_page' =&gt; $number,
+                        'nopaging' =&gt; 0,
+                        'post_status' =&gt; 'publish',
+                        'post__not_in' =&gt; get_option( 'sticky_posts' ),
+                        'tax_query' =&gt; array(
+                                array(
+                                        'taxonomy' =&gt; 'post_format',
+                                        'terms' =&gt; array( 'post-format-aside', 'post-format-link', 'post-format-status', 'post-format-quote' ),
+                                        'field' =&gt; 'slug',
+                                        'operator' =&gt; 'IN',
+                                ),
+                        ),
+                );
+                $ephemera = new WP_Query();
+                $ephemera-&gt;query( $ephemera_args );
+
+                if ( $ephemera-&gt;have_posts() ) :
+
+                echo $before_widget;
+                echo $before_title;
+                echo $title; // Can set this with a widget option, or omit altogether
+                echo $after_title;
+
+                global $post;
+
+                ?&gt;
+                &lt;ol&gt;
+                &lt;?php while ( $ephemera-&gt;have_posts() ) : $ephemera-&gt;the_post(); ?&gt;
+
+                        &lt;?php if ( 'link' != get_post_format( $post-&gt;ID ) ) : ?&gt;
+
+                        &lt;li class=&quot;entry-title&quot;&gt;
+                                &lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;&lt;?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?&gt;&quot; rel=&quot;bookmark&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;
+                                &lt;span class=&quot;comments-link&quot;&gt;
+                                        &lt;?php comments_popup_link( __( '0 &lt;span class=&quot;reply&quot;&gt;comments &amp;rarr;&lt;/span&gt;', 'twentyeleven' ), __( '1 &lt;span class=&quot;reply&quot;&gt;comment &amp;rarr;&lt;/span&gt;', 'twentyeleven' ), __( '% &lt;span class=&quot;reply&quot;&gt;comments &amp;rarr;&lt;/span&gt;', 'twentyeleven' ) ); ?&gt;
+                                &lt;/span&gt;
+                        &lt;/li&gt;
+
+                        &lt;?php else : ?&gt;
+
+                        &lt;li class=&quot;entry-title&quot;&gt;
+                                &lt;?php
+                                        $link_url = get_permalink();
+
+                                        if ( false != twentyeleven_url_grabber() )
+                                                $link_url = twentyeleven_url_grabber();
+                                ?&gt;
+                                &lt;a href=&quot;&lt;?php echo $link_url; ?&gt;&quot; title=&quot;&lt;?php printf( esc_attr__( 'Link to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?&gt;&quot; rel=&quot;bookmark&quot;&gt;&lt;?php the_title(); ?&gt;&amp;nbsp;&lt;span&gt;&amp;rarr;&lt;/span&gt;&lt;/a&gt;
+                                &lt;span class=&quot;comments-link&quot;&gt;
+                                        &lt;?php comments_popup_link( __( '0 &lt;span class=&quot;reply&quot;&gt;comments &amp;rarr;&lt;/span&gt;', 'twentyeleven' ), __( '1 &lt;span class=&quot;reply&quot;&gt;comment &amp;rarr;&lt;/span&gt;', 'twentyeleven' ), __( '% &lt;span class=&quot;reply&quot;&gt;comments &amp;rarr;&lt;/span&gt;', 'twentyeleven' ) ); ?&gt;
+                                &lt;/span&gt;
+                        &lt;/li&gt;
+
+                        &lt;?php endif; ?&gt;
+
+                &lt;?php endwhile; ?&gt;
+                &lt;/ol&gt;
+                &lt;?php
+
+                echo $after_widget;
+
+                // Reset the global $the_post as this query will have stomped on it
+                wp_reset_postdata();
+
+                // end check for ephemeral posts
+                endif;
+
+                $cache[$args['widget_id']] = ob_get_flush();
+                wp_cache_set( 'widget_twentyeleven_ephemera', $cache, 'widget' );
+        }
+
+        /**
+         * Deals with the settings when they are saved by the admin. Here is
+         * where any validation should be dealt with.
+         **/
+        function update( $new_instance, $old_instance ) {
+                $instance = $old_instance;
+                $instance['title'] = strip_tags($new_instance['title']);
+                $instance['number'] = (int) $new_instance['number'];
+                $this-&gt;flush_widget_cache();
+
+                $alloptions = wp_cache_get( 'alloptions', 'options' );
+                if ( isset($alloptions['widget_twentyeleven_ephemera']) )
+                        delete_option( 'widget_twentyeleven_ephemera' );
+
+                return $instance;
+        }
+
+        function flush_widget_cache() {
+                wp_cache_delete( 'widget_twentyeleven_ephemera', 'widget' );
+        }
+
+        /**
+         * Displays the form for this widget on the Widgets page of the WP Admin area.
+         **/
+        function form( $instance ) {
+                                $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
+                                $number = isset($instance['number']) ? absint($instance['number']) : 10;
+                ?&gt;
+                                &lt;p&gt;&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id( 'title' ); ?&gt;&quot;&gt;&lt;?php _e( 'Title:', 'twentyeleven' ); ?&gt;&lt;/label&gt;
+                                &lt;input class=&quot;widefat&quot; id=&quot;&lt;?php echo $this-&gt;get_field_id( 'title' ); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name( 'title' ); ?&gt;&quot; type=&quot;text&quot; value=&quot;&lt;?php echo $title; ?&gt;&quot; /&gt;&lt;/p&gt;
+
+                                &lt;p&gt;&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id( 'number' ); ?&gt;&quot;&gt;&lt;?php _e( 'Number of posts to show:', 'twentyeleven' ); ?&gt;&lt;/label&gt;
+                                &lt;input id=&quot;&lt;?php echo $this-&gt;get_field_id( 'number' ); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name( 'number' ); ?&gt;&quot; type=&quot;text&quot; value=&quot;&lt;?php echo $number; ?&gt;&quot; size=&quot;3&quot; /&gt;&lt;/p&gt;
+                &lt;?php
+        }
+}
+
+add_action( 'widgets_init', create_function( '', &quot;register_widget( 'Twenty_Eleven_Ephemera_Widget' );&quot; ) );
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpcontentthemestwentyelevenwidgetsphp"></a>
<div class="delfile"><h4>Deleted: trunk/wp-content/themes/twentyeleven/widgets.php (17719 => 17720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-content/themes/twentyeleven/widgets.php        2011-04-26 18:59:32 UTC (rev 17719)
+++ trunk/wp-content/themes/twentyeleven/widgets.php        2011-04-26 21:05:43 UTC (rev 17720)
</span><span class="lines">@@ -1,167 +0,0 @@
</span><del>-&lt;?php
-/**
- * new WordPress Widget format
- * Wordpress 2.8 and above
- * @see http://codex.wordpress.org/Widgets_API#Developing_Widgets
- */
-class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
-
-        /**
-         * Constructor
-         *
-         * @return void
-         **/
-        function Twenty_Eleven_Ephemera_Widget() {
-                $widget_ops = array( 'classname' =&gt; 'widget_twentyeleven_ephemera', 'description' =&gt; __( 'Use this widget to list your recent Aside, Status, Quote, and Link posts', 'twentyeleven' ) );
-                $this-&gt;WP_Widget( 'widget_twentyeleven_ephemera', __( 'Twenty Eleven Ephemera', 'twentyeleven' ), $widget_ops );
-                $this-&gt;alt_option_name = 'widget_twentyeleven_ephemera';
-
-                add_action( 'save_post', array(&amp;$this, 'flush_widget_cache' ) );
-                add_action( 'deleted_post', array(&amp;$this, 'flush_widget_cache' ) );
-                add_action( 'switch_theme', array(&amp;$this, 'flush_widget_cache' ) );
-
-        }
-
-        /**
-         * Outputs the HTML for this widget.
-         *
-         * @param array An array of standard parameters for widgets in this theme
-         * @param array An array of settings for this widget instance
-         * @return void Echoes it's output
-         **/
-        function widget( $args, $instance ) {
-                $cache = wp_cache_get( 'widget_twentyeleven_ephemera', 'widget' );
-
-                if ( !is_array($cache) )
-                        $cache = array();
-
-                if ( ! isset( $args['widget_id'] ) )
-                        $args['widget_id'] = null;
-
-                if ( isset($cache[$args['widget_id']]) ) {
-                        echo $cache[$args['widget_id']];
-                        return;
-                }
-
-                ob_start();
-                extract( $args, EXTR_SKIP );
-
-                $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Ephemera' ) : $instance['title'], $instance, $this-&gt;id_base);
-
-                if ( ! isset( $instance['number'] ) )
-                        $instance['number'] = '10';
-
-                if ( ! $number = absint( $instance['number'] ) )
-                         $number = 10;
-
-                $ephemera_args = array(
-                        'order' =&gt; 'DESC',
-                        'posts_per_page' =&gt; $number,
-                        'nopaging' =&gt; 0,
-                        'post_status' =&gt; 'publish',
-                        'post__not_in' =&gt; get_option( 'sticky_posts' ),
-                        'tax_query' =&gt; array(
-                                array(
-                                        'taxonomy' =&gt; 'post_format',
-                                        'terms' =&gt; array( 'post-format-aside', 'post-format-link', 'post-format-status', 'post-format-quote' ),
-                                        'field' =&gt; 'slug',
-                                        'operator' =&gt; 'IN',
-                                ),
-                        ),
-                );
-                $ephemera = new WP_Query();
-                $ephemera-&gt;query( $ephemera_args );
-
-                if ( $ephemera-&gt;have_posts() ) :
-
-                echo $before_widget;
-                echo $before_title;
-                echo $title; // Can set this with a widget option, or omit altogether
-                echo $after_title;
-
-                global $post;
-
-                ?&gt;
-                &lt;ol&gt;
-                &lt;?php while ( $ephemera-&gt;have_posts() ) : $ephemera-&gt;the_post(); ?&gt;
-
-                        &lt;?php if ( 'link' != get_post_format( $post-&gt;ID ) ) : ?&gt;
-
-                        &lt;li class=&quot;entry-title&quot;&gt;
-                                &lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;&lt;?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?&gt;&quot; rel=&quot;bookmark&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;
-                                &lt;span class=&quot;comments-link&quot;&gt;
-                                        &lt;?php comments_popup_link( __( '0 &lt;span class=&quot;reply&quot;&gt;comments &amp;rarr;&lt;/span&gt;', 'twentyeleven' ), __( '1 &lt;span class=&quot;reply&quot;&gt;comment &amp;rarr;&lt;/span&gt;', 'twentyeleven' ), __( '% &lt;span class=&quot;reply&quot;&gt;comments &amp;rarr;&lt;/span&gt;', 'twentyeleven' ) ); ?&gt;
-                                &lt;/span&gt;
-                        &lt;/li&gt;
-
-                        &lt;?php else : ?&gt;
-
-                        &lt;li class=&quot;entry-title&quot;&gt;
-                                &lt;?php
-                                        $link_url = get_permalink();
-
-                                        if ( false != twentyeleven_url_grabber() )
-                                                $link_url = twentyeleven_url_grabber();
-                                ?&gt;
-                                &lt;a href=&quot;&lt;?php echo $link_url; ?&gt;&quot; title=&quot;&lt;?php printf( esc_attr__( 'Link to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?&gt;&quot; rel=&quot;bookmark&quot;&gt;&lt;?php the_title(); ?&gt;&amp;nbsp;&lt;span&gt;&amp;rarr;&lt;/span&gt;&lt;/a&gt;
-                                &lt;span class=&quot;comments-link&quot;&gt;
-                                        &lt;?php comments_popup_link( __( '0 &lt;span class=&quot;reply&quot;&gt;comments &amp;rarr;&lt;/span&gt;', 'twentyeleven' ), __( '1 &lt;span class=&quot;reply&quot;&gt;comment &amp;rarr;&lt;/span&gt;', 'twentyeleven' ), __( '% &lt;span class=&quot;reply&quot;&gt;comments &amp;rarr;&lt;/span&gt;', 'twentyeleven' ) ); ?&gt;
-                                &lt;/span&gt;
-                        &lt;/li&gt;
-
-                        &lt;?php endif; ?&gt;
-
-                &lt;?php endwhile; ?&gt;
-                &lt;/ol&gt;
-                &lt;?php
-
-                echo $after_widget;
-
-                // Reset the global $the_post as this query will have stomped on it
-                wp_reset_postdata();
-
-                // end check for ephemeral posts
-                endif;
-
-                $cache[$args['widget_id']] = ob_get_flush();
-                wp_cache_set( 'widget_twentyeleven_ephemera', $cache, 'widget' );
-        }
-
-        /**
-         * Deals with the settings when they are saved by the admin. Here is
-         * where any validation should be dealt with.
-         **/
-        function update( $new_instance, $old_instance ) {
-                $instance = $old_instance;
-                $instance['title'] = strip_tags($new_instance['title']);
-                $instance['number'] = (int) $new_instance['number'];
-                $this-&gt;flush_widget_cache();
-
-                $alloptions = wp_cache_get( 'alloptions', 'options' );
-                if ( isset($alloptions['widget_twentyeleven_ephemera']) )
-                        delete_option( 'widget_twentyeleven_ephemera' );
-
-                return $instance;
-        }
-
-        function flush_widget_cache() {
-                wp_cache_delete( 'widget_twentyeleven_ephemera', 'widget' );
-        }
-
-        /**
-         * Displays the form for this widget on the Widgets page of the WP Admin area.
-         **/
-        function form( $instance ) {
-                                $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
-                                $number = isset($instance['number']) ? absint($instance['number']) : 10;
-                ?&gt;
-                                &lt;p&gt;&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id( 'title' ); ?&gt;&quot;&gt;&lt;?php _e( 'Title:', 'twentyeleven' ); ?&gt;&lt;/label&gt;
-                                &lt;input class=&quot;widefat&quot; id=&quot;&lt;?php echo $this-&gt;get_field_id( 'title' ); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name( 'title' ); ?&gt;&quot; type=&quot;text&quot; value=&quot;&lt;?php echo $title; ?&gt;&quot; /&gt;&lt;/p&gt;
-
-                                &lt;p&gt;&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id( 'number' ); ?&gt;&quot;&gt;&lt;?php _e( 'Number of posts to show:', 'twentyeleven' ); ?&gt;&lt;/label&gt;
-                                &lt;input id=&quot;&lt;?php echo $this-&gt;get_field_id( 'number' ); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name( 'number' ); ?&gt;&quot; type=&quot;text&quot; value=&quot;&lt;?php echo $number; ?&gt;&quot; size=&quot;3&quot; /&gt;&lt;/p&gt;
-                &lt;?php
-        }
-}
-
-add_action( 'widgets_init', create_function( '', &quot;register_widget( 'Twenty_Eleven_Ephemera_Widget' );&quot; ) );
</del><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>