<!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>[10458] sites/trunk/wordpress.org/public_html/wp-content: WordPress.org Learn: Sync with GitHub</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 { white-space: pre-line; 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/10458">10458</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/10458","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>coreymckrill</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2020-11-20 00:07:27 +0000 (Fri, 20 Nov 2020)</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.org Learn: Sync with GitHub

https://github.com/WordPress/learn/compare/a6529c2090ca8a1dcc9e36e27460f6cbb84e02ef...2c9bbc5fc4eefb1f1a367f7bb8afcd3da6ef32b0</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporglearnincpostmetaphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/post-meta.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporglearn2020functionsphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/functions.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporglearn2020templatepartscontentsinglephp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/template-parts/content-single.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporglearnviewsmetaboxlessonplanslidesphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/views/metabox-lesson-plan-slides.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporglearnincpostmetaphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/post-meta.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/post-meta.php    2020-11-18 20:16:23 UTC (rev 10457)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/post-meta.php      2020-11-20 00:07:27 UTC (rev 10458)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,17 +14,53 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * Actions and filters.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'init', __NAMESPACE__ . '\register' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_action( 'add_meta_boxes', __NAMESPACE__ . '\add_lesson_plan_metaboxes' );
</ins><span class="cx" style="display: block; padding: 0 10px"> add_action( 'add_meta_boxes', __NAMESPACE__ . '\add_workshop_metaboxes' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-add_action( 'save_post_wporg_workshop', __NAMESPACE__ . '\save_workshop_metabox_fields', 10, 2 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_action( 'save_post_lesson-plan', __NAMESPACE__ . '\save_lesson_plan_metabox_fields' );
+add_action( 'save_post_wporg_workshop', __NAMESPACE__ . '\save_workshop_metabox_fields' );
</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">  * Register all post meta keys.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function register() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        register_lesson_plan_meta();
</ins><span class="cx" style="display: block; padding: 0 10px">         register_workshop_meta();
</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 post meta keys for lesson plans.
+ */
+function register_lesson_plan_meta() {
+       $post_type = 'lesson-plan';
+
+       register_post_meta(
+               $post_type,
+               'slides_view_url',
+               array(
+                       'description'       => __( 'A URL for viewing lesson plan slides.', 'wporg_learn' ),
+                       'type'              => 'string',
+                       'single'            => true,
+                       'default'           => '',
+                       'sanitize_callback' => 'esc_url_raw',
+                       'show_in_rest'      => true,
+               )
+       );
+
+       register_post_meta(
+               $post_type,
+               'slides_download_url',
+               array(
+                       'description'       => __( 'A URL for downloading lesson plan slides.', 'wporg_learn' ),
+                       'type'              => 'string',
+                       'single'            => true,
+                       'default'           => '',
+                       'sanitize_callback' => 'esc_url_raw',
+                       'show_in_rest'      => true,
+               )
+       );
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Register post meta keys for workshops.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function register_workshop_meta() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -188,6 +224,54 @@
</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">+ * Add meta boxes to the Edit Lesson Plan screen.
+ *
+ * Todo these should be replaced with block editor panels.
+ */
+function add_lesson_plan_metaboxes() {
+       add_meta_box(
+               'lesson-plan-slides',
+               __( 'Slides', 'wporg_learn' ),
+               __NAMESPACE__ . '\render_metabox_lesson_plan_slides',
+               'lesson-plan',
+               'side'
+       );
+}
+
+/**
+ * Render the Lesson Plan Slides metabox.
+ *
+ * @param WP_Post $post
+ */
+function render_metabox_lesson_plan_slides( WP_Post $post ) {
+       // The $post var is used in the include file.
+       require get_views_path() . 'metabox-lesson-plan-slides.php';
+}
+
+/**
+ * Update the post meta values from the meta box fields when the post is saved.
+ *
+ * @param int $post_id
+ */
+function save_lesson_plan_metabox_fields( $post_id ) {
+       if ( wp_is_post_revision( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) {
+               return;
+       }
+
+       // This nonce field is rendered in the Lesson Plan Slides metabox.
+       $nonce = filter_input( INPUT_POST, 'lesson-plan-metabox-nonce' );
+       if ( ! wp_verify_nonce( $nonce, 'lesson-plan-metaboxes' ) ) {
+               return;
+       }
+
+       $view_url = filter_input( INPUT_POST, 'slides-view-url', FILTER_VALIDATE_URL ) ?: '';
+       update_post_meta( $post_id, 'slides_view_url', $view_url );
+
+       $download_url = filter_input( INPUT_POST, 'slides-download-url', FILTER_VALIDATE_URL ) ?: '';
+       update_post_meta( $post_id, 'slides_download_url', $download_url );
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Add meta boxes to the Edit Workshop screen.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * Todo these should be replaced with block editor panels.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -260,10 +344,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Update the post meta values from the meta box fields when the post is saved.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int     $post_id
- * @param WP_Post $post
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $post_id
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function save_workshop_metabox_fields( $post_id, WP_Post $post ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function save_workshop_metabox_fields( $post_id ) {
</ins><span class="cx" style="display: block; padding: 0 10px">         if ( wp_is_post_revision( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                return;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporglearnviewsmetaboxlessonplanslidesphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/views/metabox-lesson-plan-slides.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/views/metabox-lesson-plan-slides.php                         (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/views/metabox-lesson-plan-slides.php   2020-11-20 00:07:27 UTC (rev 10458)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,34 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+namespace WPOrg_Learn\View\Metabox;
+
+use WP_Post;
+
+defined( 'WPINC' ) || die();
+
+/** @var WP_Post $post */
+?>
+
+<p>
+       <label for="lesson-plan-slides-view-url"><?php esc_html_e( 'View URL', 'wporg_learn' ); ?></label>
+       <input
+               type="url"
+               name="slides-view-url"
+               id="lesson-plan-slides-view-url"
+               class="large-text"
+               value="<?php echo esc_attr( $post->slides_view_url ); ?>"
+       />
+</p>
+
+<p>
+       <label for="lesson-plan-slides-download-url"><?php esc_html_e( 'Download URL', 'wporg_learn' ); ?></label>
+       <input
+               type="url"
+               name="slides-download-url"
+               id="lesson-plan-slides-download-url"
+               class="large-text"
+               value="<?php echo esc_attr( $post->slides_download_url ); ?>"
+       />
+</p>
+
+<?php wp_nonce_field( 'lesson-plan-metaboxes', 'lesson-plan-metabox-nonce' ); ?>
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporglearn2020functionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/functions.php        2020-11-18 20:16:23 UTC (rev 10457)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/functions.php  2020-11-20 00:07:27 UTC (rev 10458)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -204,24 +204,6 @@
</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">- * Returns the custom field view_lesson_plan_slides_url, if it doesn't exists returns false
- *
- * @return string|bool
- */
-function wporg_get_slides_url() {
-       return get_post_meta( get_the_ID(), 'view_lesson_plan_slides_url', true );
-}
-
-/**
- * Returns the custom field download_lesson_plan_slides_url, if it doesn't exists returns false
- *
- * @return string|bool
- */
-function wporg_get_download_slides_url() {
-       return get_post_meta( get_the_ID(), 'download_lesson_plan_slides_url', true );
-}
-
-/**
</del><span class="cx" style="display: block; padding: 0 10px">  * Modify the excerpt length for our custom post types.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @param int $length Excerpt length.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -621,3 +603,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        return $siblings[ $index ] ?? false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * Robots "noindex" rules for specific parts of the Learn site.
+ *
+ * @param bool $noindex
+ *
+ * @return bool
+ */
+function wporg_learn_noindex( $noindex ) {
+       if ( is_singular( 'quiz' ) ) {
+               $noindex = true;
+       }
+
+       return $noindex;
+}
+add_filter( 'wporg_noindex_request', 'wporg_learn_noindex' );
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporglearn2020templatepartscontentsinglephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/template-parts/content-single.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/template-parts/content-single.php    2020-11-18 20:16:23 UTC (rev 10457)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/template-parts/content-single.php      2020-11-20 00:07:27 UTC (rev 10458)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7,8 +7,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @package WPBBP
</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">-$slides_url   = wporg_get_slides_url();
-$download_url = wporg_get_download_slides_url();
</del><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"> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -43,21 +41,27 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        </ul>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                        <ul class="lp-links">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-                                       <?php if ( $slides_url ) : ?>
-                                               <li>
-                                                       <a href="<?php echo esc_url( $slides_url ); ?>" target="_blank"><span class="dashicons dashicons-admin-page"></span> <?php esc_html_e( 'View Lesson Plan Slides', 'wporg-learn' ); ?></a>
-                                               </li>
-                                       <?php endif; ?>
-
-                                       <?php if ( $download_url ) : ?>
-                                               <li>
-                                                       <a href="<?php echo esc_url( $download_url ); ?>"><span class="dashicons dashicons-download"></span> <?php esc_html_e( 'Download Lesson Slides', 'wporg-learn' ); ?></a>
-                                               </li>
-                                       <?php endif; ?>
-                       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         <?php if ( $post->slides_view_url ) : ?>
+                                                       <li>
+                                                               <a href="<?php echo esc_attr( $post->slides_view_url ); ?>" target="_blank">
+                                                                       <span class="dashicons dashicons-admin-page"></span>
+                                                                       <?php esc_html_e( 'View Lesson Plan Slides', 'wporg-learn' ); ?>
+                                                               </a>
+                                                       </li>
+                                               <?php endif; ?>
+                                               <?php if ( $post->slides_download_url ) : ?>
+                                                       <li>
+                                                               <a href="<?php echo esc_attr( $post->slides_download_url ); ?>">
+                                                                       <span class="dashicons dashicons-download"></span>
+                                                                       <?php esc_html_e( 'Download Lesson Slides', 'wporg-learn' ); ?>
+                                                               </a>
+                                                       </li>
+                                               <?php endif; ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 <!-- <li>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                        <a href="#" target="_blank"><span class="dashicons dashicons-admin-post"></span> <?php esc_html_e( 'Print Lesson Plan', 'wporg-learn' ); ?></a>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                 <a href="#" target="_blank">
+                                                               <span class="dashicons dashicons-admin-post"></span>
+                                                               <?php esc_html_e( 'Print Lesson Plan', 'wporg-learn' ); ?>
+                                                       </a>
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 </li> -->
</span><span class="cx" style="display: block; padding: 0 10px">                                        </ul>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre>
</div>
</div>

</body>
</html>