<!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" />
<title>[1044] sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2: WordPress.tv: Add meta field for presentation slides.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { 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 #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#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>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/1044">1044</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/1044","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>iandunn</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2014-12-15 21:32:58 +0000 (Mon, 15 Dec 2014)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>WordPress.tv: Add meta field for presentation slides.

Fixes <a href="http://meta.trac.wordpress.org/ticket/774">#774</a>
props BrashRebel </pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpresstvpublic_htmlwpcontentthemeswptv2anonuploadtemplatephp">sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/anon-upload-template.php</a></li>
<li><a href="#sitestrunkwordpresstvpublic_htmlwpcontentthemeswptv2functionsphp">sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/functions.php</a></li>
<li><a href="#sitestrunkwordpresstvpublic_htmlwpcontentthemeswptv2pluginswordpresstvanonuploadanonuploadphp">sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/plugins/wordpresstv-anon-upload/anon-upload.php</a></li>
<li><a href="#sitestrunkwordpresstvpublic_htmlwpcontentthemeswptv2sidebarsinglephp">sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/sidebar-single.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpresstvpublic_htmlwpcontentthemeswptv2anonuploadtemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/anon-upload-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/anon-upload-template.php     2014-12-15 19:49:16 UTC (rev 1043)
+++ sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/anon-upload-template.php       2014-12-15 21:32:58 UTC (rev 1044)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -330,6 +330,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                <textarea name="wptv_video_description" id="wptv_video_description" rows="8" cols="40"></textarea>
</span><span class="cx" style="display: block; padding: 0 10px">        </p>
</span><span class="cx" style="display: block; padding: 0 10px">        <p>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                <label for="wptv_slides_url"><?php esc_html_e( 'Slides URL' ); ?></label>
+               <input type="text" name="wptv_slides_url" id="wptv_slides_url" value="" />
+       </p>
+       <p>
</ins><span class="cx" style="display: block; padding: 0 10px">                 <label for="wptv_file"><?php esc_html_e( 'Video file' ); ?><span class="required"> * </span></label>
</span><span class="cx" style="display: block; padding: 0 10px">                <input type="file" name="wptv_file" id="wptv_file" />
</span><span class="cx" style="display: block; padding: 0 10px">        </p>
</span></span></pre></div>
<a id="sitestrunkwordpresstvpublic_htmlwpcontentthemeswptv2functionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/functions.php        2014-12-15 19:49:16 UTC (rev 1043)
+++ sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/functions.php  2014-12-15 21:32:58 UTC (rev 1044)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -27,6 +27,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                add_action( 'pre_get_posts', array( $this, 'posts_per_page' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                add_action( 'init', array( $this, 'improve_search' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                add_action( 'publish_post', array( $this, 'publish_post' ), 10, 1 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
+               add_action( 'save_post', array( $this, 'save_meta_box_fields' ), 10, 2);
</ins><span class="cx" style="display: block; padding: 0 10px">                 add_action( 'wp_footer', array( $this, 'videopress_flash_params' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                add_action( 'transition_post_status', array( $this, 'transition_post_status' ), 10, 2 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -149,6 +151,56 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Register meta boxes
+        */
+       function add_meta_boxes() {
+               add_meta_box( 'video-info', 'Video Info', array( $this, 'render_video_info_metabox' ), 'post', 'normal', 'high' );
+       }
+
+       /**
+        * Render the Video Info box
+        */
+       function render_video_info_metabox() {
+               global $post;
+
+               $slides_url = get_post_meta( $post->ID, '_wptv_slides_url', true );
+               wp_nonce_field( 'edit-video-info', 'video_info_metabox_nonce' );
+
+               ?>
+
+               <p>
+                       <label for="wptv-slides-url">Slides URL</label>
+                       <input type="text" class="widefat" id="wptv-slides-url" name="_wptv_slides_url" value="<?php echo esc_url( $slides_url ); ?>" />
+               </p>
+
+               <?php
+       }
+
+       /**
+        * Save the values of meta box fields
+        *
+        * @param int $post_id
+        * @param WP_Post $post
+        */
+       function save_meta_box_fields( $post_id, $post ) {
+               if ( wp_is_post_revision( $post_id ) || defined( 'DOING_AUTOSAVE' ) || ! current_user_can( 'edit_post', $post_id ) ) {
+                       return;
+               }
+
+               if ( ! isset( $_POST['video_info_metabox_nonce'] ) || ! wp_verify_nonce( $_POST['video_info_metabox_nonce'], 'edit-video-info' ) ) {
+                       return;
+               }
+
+               $slides_url = esc_url_raw( $_POST['_wptv_slides_url'] );
+
+               if ( $slides_url ) {
+                       update_post_meta( $post_id, '_wptv_slides_url', $slides_url );
+               } else {
+                       delete_post_meta( $post_id, '_wptv_slides_url' );
+               }
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Activates the improved search, but not in admin.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        function improve_search() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -175,7 +227,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * Improved Serach: posts_search filter
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * Improved Search: posts_search filter
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * Recreates the search SQL by including a taxonomy search.
</span><span class="cx" style="display: block; padding: 0 10px">         * Relies on various other filters used once.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -750,3 +802,21 @@
</span><span class="cx" style="display: block; padding: 0 10px">        return $title;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'wp_title', 'wptv_wp_title', 10, 2 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * Append the slide URL to the excerpt
+ *
+ * @param string $excerpt
+ *
+ * @return string
+ */
+function wptv_excerpt_slides( $excerpt ) {
+       $slides = get_post_meta( get_the_ID(), '_wptv_slides_url', true );
+
+       if ( ! empty( $slides ) ) {
+               $excerpt .= '<p><a href="' . esc_url( $slides ) . '">Presentation Slides &raquo;</a></p>';
+       }
+
+       return $excerpt;
+}
+add_filter( 'get_the_excerpt', 'wptv_excerpt_slides' );
</ins></span></pre></div>
<a id="sitestrunkwordpresstvpublic_htmlwpcontentthemeswptv2pluginswordpresstvanonuploadanonuploadphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/plugins/wordpresstv-anon-upload/anon-upload.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/plugins/wordpresstv-anon-upload/anon-upload.php      2014-12-15 19:49:16 UTC (rev 1043)
+++ sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/plugins/wordpresstv-anon-upload/anon-upload.php        2014-12-15 21:32:58 UTC (rev 1044)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -50,6 +50,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'wptv_video_producer',
</span><span class="cx" style="display: block; padding: 0 10px">                        'wptv_speakers',
</span><span class="cx" style="display: block; padding: 0 10px">                        'wptv_event',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        'wptv_slides_url'
</ins><span class="cx" style="display: block; padding: 0 10px">                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Normal users won't see the honeypot field, so if there's a value in it, then we can assume the submission is spam from a bot
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -274,6 +275,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $event          = $this->sanitize_text( $_posted['wptv_event'] );
</span><span class="cx" style="display: block; padding: 0 10px">                $description    = $this->sanitize_text( $_posted['wptv_video_description'], false );
</span><span class="cx" style="display: block; padding: 0 10px">                $language       = $this->sanitize_text( $_posted['wptv_language'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $slides         = $this->sanitize_text( $_posted['wptv_slides_url'] );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $ip             = $_SERVER['REMOTE_ADDR'];
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $categories = '';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -297,6 +299,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'language'        => $language,
</span><span class="cx" style="display: block; padding: 0 10px">                        'categories'      => $categories,
</span><span class="cx" style="display: block; padding: 0 10px">                        'description'     => $description,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        'slides'          => $slides,
</ins><span class="cx" style="display: block; padding: 0 10px">                         'ip'              => $ip,
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -332,6 +335,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $embed_args['blog_id'] = get_current_blog_id();
</span><span class="cx" style="display: block; padding: 0 10px">                $embed_args['post_id'] = $meta['attachment_id'];
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                // Add slides index to meta (necessary for posts that were uploaded before the field was added)
+               if ( ! array_key_exists( 'slides', $meta ) ) {
+                       $meta['slides'] = '';
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 ?>
</span><span class="cx" style="display: block; padding: 0 10px">                <div class="stuffbox" id="review-video">
</span><span class="cx" style="display: block; padding: 0 10px">                        <style type="text/css" scoped="scoped">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -487,6 +495,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        </div>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                        <div class="row">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                <p class="label">Slides:</p>
+                                               <p class="data">
+                                                       <input type="text" value="<?php echo esc_attr( $meta['slides'] ); ?>"/>
+                                                       <a class="button-secondary anon-approve" href="#wptv-slides-url">Approve</a>
+                                               </p>
+                                       </div>
+
+                                       <div class="row">
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 <p class="label">Edit attachment:</p>
</span><span class="cx" style="display: block; padding: 0 10px">                                                <p class="data">
</span><span class="cx" style="display: block; padding: 0 10px">                                                        <a href="<?php echo esc_url( get_edit_post_link( $meta['attachment_id'] ) ); ?>" target="_blank"><?php echo esc_html( $attachment_post->post_title ); ?></a>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -523,7 +539,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                if (id.indexOf('#new-tag-') != -1) {
</span><span class="cx" style="display: block; padding: 0 10px">                                                        el.val(target.siblings('input[type="text"]').val());
</span><span class="cx" style="display: block; padding: 0 10px">                                                        el.siblings('.tagadd').click();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                } else if (id == '#title') {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         } else if ('#title' == id  || '#wptv-slides-url' == id) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                                         el.val(target.siblings('input[type="text"]').val());
</span><span class="cx" style="display: block; padding: 0 10px">                                                } else if (id == '#excerpt') {
</span><span class="cx" style="display: block; padding: 0 10px">                                                        el.val(target.siblings('textarea').val());
</span></span></pre></div>
<a id="sitestrunkwordpresstvpublic_htmlwpcontentthemeswptv2sidebarsinglephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/sidebar-single.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/sidebar-single.php   2014-12-15 19:49:16 UTC (rev 1043)
+++ sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/sidebar-single.php     2014-12-15 21:32:58 UTC (rev 1044)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,7 +4,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        <h5>Published</h5>
</span><span class="cx" style="display: block; padding: 0 10px">                        <p class="video-date"><?php echo get_the_date(); ?></p>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <?php if ( $post->post_excerpt ) : ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 <?php if ( get_the_excerpt() ) : ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <div class="video-description"><?php the_excerpt(); ?></div>
</span><span class="cx" style="display: block; padding: 0 10px">                        <?php
</span><span class="cx" style="display: block; padding: 0 10px">                                endif;
</span></span></pre>
</div>
</div>

</body>
</html>