Making WordPress.org

Changeset 10866


Ignore:
Timestamp:
04/01/2021 09:01:06 PM (5 years ago)
Author:
iandunn
Message:

Learn Plugin: Sync with Git.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/post-meta.php

    r10461 r10866  
    6666function register_workshop_meta() {
    6767    $post_type = 'wporg_workshop';
     68
     69    register_post_meta(
     70        $post_type,
     71        'video_url',
     72        array(
     73            'description'       => __( "The URL of the Workshop's video.", 'wporg_learn' ),
     74            'type'              => 'string',
     75            'single'            => true,
     76            'sanitize_callback' => 'esc_url_raw',
     77            'show_in_rest'      => true,
     78        )
     79    );
    6880
    6981    register_post_meta(
     
    377389    }
    378390
     391    $video_url = filter_input( INPUT_POST, 'video-url', FILTER_SANITIZE_URL );
     392    update_post_meta( $post_id, 'video_url', $video_url );
     393
    379394    $duration = filter_input( INPUT_POST, 'duration', FILTER_SANITIZE_NUMBER_INT, FILTER_REQUIRE_ARRAY );
    380395    if ( isset( $duration['h'], $duration['m'], $duration['s'] ) ) {
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/post-type.php

    r10422 r10866  
    138138        'capability_type'     => 'page',
    139139        'show_in_rest'        => true,
    140         'template_lock'       => 'all',
    141140        'rewrite'             => array( 'slug' => 'workshop' ),
    142141        'template'            => generate_workshop_template_structure(),
     
    149148 * Create an array representation of a workshop's content template.
    150149 *
    151  * Note that if this template structure changes, the content in views/content-workshop.php
     150 * ⚠️ Note that if this template structure changes, the content in views/content-workshop.php
    152151 * will also need to be updated.
    153152 *
     
    157156    $template = array(
    158157        array(
    159             'core/embed',
    160             array(
    161                 'className'        => 'workshop-page_video',
    162                 'providerNameSlug' => 'wordpress-tv',
    163             ),
    164         ),
    165         array(
    166             'core/columns',
    167             array( 'className' => 'workshop-page_content' ),
    168             array(
    169                 array(
    170                     'core/column',
    171                     array( 'width' => '66.66%' ),
    172                     array(
    173                         array(
    174                             'core/paragraph',
    175                             array(
    176                                 'placeholder' => __( 'Describe what the workshop is about.', 'wporg-learn' ),
    177                             ),
    178                         ),
    179                         array(
    180                             'core/heading',
    181                             array(
    182                                 'level'   => '2',
    183                                 'content' => __( 'Learning outcomes', 'wporg-learn' ),
    184                             ),
    185                         ),
    186                         array(
    187                             'core/list',
    188                             array(
    189                                 'className' => 'workshop-page_list',
    190                                 'ordered'   => true,
    191                             ),
    192                         ),
    193                         array(
    194                             'core/heading',
    195                             array(
    196                                 'level'   => '2',
    197                                 'content' => __( 'Comprehension questions', 'wporg-learn' ),
    198                             ),
    199                         ),
    200                         array(
    201                             'core/list',
    202                             array(
    203                                 'className' => 'workshop-page_list',
    204                             ),
    205                         ),
    206                     ),
    207                 ), // End column block.
    208                 array(
    209                     'core/column',
    210                     array(
    211                         'className' => 'workshop-page_sidebar',
    212                         'width'     => '33.333%',
    213                     ),
    214                     array(
    215                         array( 'wporg-learn/workshop-details' ),
    216                         array(
    217                             'core/button',
    218                             array(
    219                                 'className'    => 'is-style-secondary-full-width',
    220                                 'text'         => __( 'Join a Group Discussion', 'wporg-learn' ),
    221                                 'url'          => 'https://www.meetup.com/learn-wordpress-discussions/events/',
    222                                 'borderRadius' => 5,
    223                             ),
    224                         ),
    225                         array(
    226                             'core/paragraph',
    227                             array(
    228                                 'className' => 'terms',
    229                                 'content'   => sprintf(
    230                                     __( 'You must agree to our <a href="%s">Code of Conduct</a> in order to participate.', 'wporg-learn' ),
    231                                     'https://learn.wordpress.org/code-of-conduct/'
    232                                 ),
    233                             ),
    234                         ),
    235                     ),
    236                 ), // End column block.
    237             ),
    238         ), // End columns block.
    239         array( 'core/separator' ),
     158            'core/paragraph',
     159            array(
     160                'placeholder' => __( 'Describe what the workshop is about.', 'wporg-learn' ),
     161            ),
     162        ),
     163
     164        // Learning outcomes
     165        array(
     166            'core/heading',
     167            array(
     168                'level'   => '2',
     169                'content' => __( 'Learning outcomes', 'wporg-learn' ),
     170            ),
     171        ),
     172        array(
     173            'core/list',
     174            array(
     175                'className' => 'workshop-page_list',
     176                'ordered'   => true,
     177            ),
     178        ),
     179
     180        // Comprehension questions
     181        array(
     182            'core/heading',
     183            array(
     184                'level'   => '2',
     185                'content' => __( 'Comprehension questions', 'wporg-learn' ),
     186            ),
     187        ),
     188        array(
     189            'core/list',
     190            array(
     191                'className' => 'workshop-page_list',
     192            ),
     193        ),
    240194    );
    241195
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/views/content-workshop.php

    r10376 r10866  
    11<?php
     2
    23/**
    34 * Content for auto-generated workshop posts.
    45 *
    5  * Note that if the template for the workshop post type changes, this will need to be updated as well.
     6 * ⚠️ Note that if the template for the workshop post type changes, this will need to be updated as well.
     7 *
     8 * phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped -- The data from this file is being saved to
     9 * the database rather than output; therefore it should be validated rather than escaped. It's validated by
     10 * `validate_workshop_application_form_submission()`, which strips all HTML tags.
    611 */
    712
    813/** @var array $blurbs */
     14
    915?>
    10 <!-- wp:core-embed/wordpress-tv {"className":"workshop-page_video"} /-->
    1116
    12 <!-- wp:columns {"className":"workshop-page_content"} -->
    13 <div class="wp-block-columns workshop-page_content">
    14     <!-- wp:column {"width":66.66} -->
    15     <div class="wp-block-column" style="flex-basis:66.66%">
    16         <?php echo $blurbs['description']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
     17<?php echo $blurbs['description']; ?>
    1718
    18         <!-- wp:heading {"level":"2"} -->
    19         <h2><?php esc_html_e( 'Learning outcomes', 'wporg-learn' ); ?></h2>
    20         <!-- /wp:heading -->
     19<!-- wp:heading {"level":"2"} -->
     20<h2><?php esc_html_e( 'Learning outcomes', 'wporg-learn' ); ?></h2>
     21<!-- /wp:heading -->
    2122
    22         <!-- wp:list {"ordered":true,"className":"workshop-page_list"} -->
    23         <ol class="workshop-page_list">
    24             <?php echo $blurbs['learning-objectives']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
    25         </ol>
    26         <!-- /wp:list -->
     23<!-- wp:list {"ordered":true,"className":"workshop-page_list"} -->
     24<ol class="workshop-page_list">
     25    <?php echo $blurbs['learning-objectives']; ?>
     26</ol>
     27<!-- /wp:list -->
    2728
    28         <!-- wp:heading {"level":"2"} -->
    29         <h2><?php esc_html_e( 'Comprehension questions', 'wporg-learn' ); ?></h2>
    30         <!-- /wp:heading -->
     29<!-- wp:heading {"level":"2"} -->
     30<h2><?php esc_html_e( 'Comprehension questions', 'wporg-learn' ); ?></h2>
     31<!-- /wp:heading -->
    3132
    32         <!-- wp:list {"className":"workshop-page_list"} -->
    33         <ul class="workshop-page_list">
    34             <?php echo $blurbs['comprehension-questions']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
    35         </ul>
    36         <!-- /wp:list -->
    37     </div>
    38     <!-- /wp:column -->
    39 
    40     <!-- wp:column {"width":33.333,"className":"workshop-page_sidebar"} -->
    41     <div class="wp-block-column workshop-page_sidebar" style="flex-basis:33.333%">
    42         <!-- wp:wporg-learn/workshop-details /-->
    43 
    44         <!-- wp:button {"borderRadius":5,"className":"is-style-secondary-full-width"} -->
    45         <div class="wp-block-button is-style-secondary-full-width">
    46             <a class="wp-block-button__link" href="https://www.meetup.com/learn-wordpress-discussions/events/" style="border-radius:5px">
    47                 <?php esc_html_e( 'Join a Group Discussion', 'wporg-learn' ); ?>
    48             </a>
    49         </div>
    50         <!-- /wp:button -->
    51 
    52         <!-- wp:paragraph {"className":"terms"} -->
    53         <p class="terms">
    54             <?php
    55             printf(
    56                 wp_kses_post( __( 'You must agree to our <a href="%s">Code of Conduct</a> in order to participate.', 'wporg-learn' ) ),
    57                 'https://learn.wordpress.org/code-of-conduct/'
    58             );
    59             ?>
    60         </p>
    61         <!-- /wp:paragraph -->
    62     </div>
    63     <!-- /wp:column -->
    64 </div>
    65 <!-- /wp:columns -->
    66 
    67 <!-- wp:separator -->
    68 <hr class="wp-block-separator"/>
    69 <!-- /wp:separator -->
     33<!-- wp:list {"className":"workshop-page_list"} -->
     34<ul class="workshop-page_list">
     35    <?php echo $blurbs['comprehension-questions']; ?>
     36</ul>
     37<!-- /wp:list -->
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/views/metabox-workshop-details.php

    r10461 r10866  
    1313
    1414<p>
     15    <label><?php esc_html_e( 'WordPress.tv URL', 'wporg_learn' ); ?></label><br />
     16    <label for="workshop-video-url">
     17        <textarea
     18            id="workshop-video-url"
     19            name="video-url"
     20            class="large-text"
     21            rows="4"
     22        ><?php echo esc_url( $post->video_url ); ?></textarea>
     23    </label>
     24</p>
     25
     26<p>
    1527    <label><?php esc_html_e( 'Duration', 'wporg_learn' ); ?></label><br />
    1628    <label for="workshop-duration-hours">
     
    2133            type="number"
    2234            value="<?php echo absint( $duration_interval->h ); ?>"
     35            min="0"
    2336            max="23"
    2437        />
     
    3245            type="number"
    3346            value="<?php echo absint( $duration_interval->i ); ?>"
     47            min="0"
    3448            max="59"
    3549        />
     
    4357                type="number"
    4458                value="<?php echo absint( $duration_interval->s ); ?>"
     59                min="0"
    4560                max="59"
    4661        />
Note: See TracChangeset for help on using the changeset viewer.