Making WordPress.org

Changeset 10147


Ignore:
Timestamp:
08/12/2020 01:23:13 AM (5 years ago)
Author:
coreymckrill
Message:

WP.org Learn: Sync with GitHub

https://github.com/WordPress/learn/compare/826f579465d0a1689ef260161158b585197d6112...fbb4955f0cff52e01350d2ff38e636e1c9c17645

Location:
sites/trunk/wordpress.org/public_html/wp-content
Files:
3 deleted
6 edited

Legend:

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

    r10142 r10147  
    5555}
    5656
     57
     58
     59/**
     60 * Build the html output based on input fields
     61 *
     62 * @param array   $fields
     63 * @return string HTML output.
     64 */
     65function get_workshop_details_html_output( $fields ) {
     66    $output = '<ul class="wp-block-wporg-learn-workshop-details">';
     67
     68    foreach( $fields as $key => $value ) {
     69        $output .= sprintf( '<li><b>%1$s</b><span>%2$s</span></li>', $key, $value );
     70    }
     71
     72    $output .= '</ul>';
     73
     74    return $output;
     75}
     76
    5777/**
    5878 * Render the block content (html) on the frontend of the site.
     
    6080 * @param array  $attributes
    6181 * @param string $content
    62  * @return string HTML output used by the calendar JS.
     82 * @return string HTML output used by the block
    6383 */
    6484function workshop_details_render_callback( $attributes, $content ) {
     
    6888    $captions = get_post_meta( $post->ID, 'video_caption_language' );
    6989
    70     return sprintf(
    71         '<ul class="wp-block-wporg-learn-workshop-details">
    72             <li><b>Length</b><span>%1$s</span></li>
    73             <li><b>Topic</b><span>%2$s</span></li>
    74             <li><b>Level</b><span>%3$s</span></li>
    75             <li><b>Language</b><span>%4$s</span></li>
    76             <li><b>Captions</b><span>%5$s</span></li>
    77         </ul>',
    78         get_workshop_duration( $post, 'string' ),
    79         implode( ', ', array_map( 'esc_html', $topics ) ),
    80         implode( ', ', array_map( 'esc_html', $level ) ),
    81         esc_html( $post->video_language ),
    82         implode( ', ', array_map( 'esc_html', $captions ) )
    83     );
     90    $fields = array(
     91        __( 'Length' , 'wporg-learn') => get_workshop_duration( $post, 'string' ),
     92        __( 'Topic' , 'wporg-learn') => implode( ', ', array_map( 'esc_html', $topics ) ),
     93        __( 'Level' , 'wporg-learn') => implode( ', ', array_map( 'esc_html', $level ) ),
     94        __( 'Language' , 'wporg-learn') => esc_html( $post->video_language ),
     95        __( 'Captions' , 'wporg-learn') => implode( ', ', array_map( 'esc_html', $captions ) ),
     96    );
     97
     98    // Remove empty fields
     99    $fields_to_output = array_filter( $fields );
     100
     101    return get_workshop_details_html_output( $fields_to_output );
    84102}
    85103
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/class-markdown-import.php

    r10130 r10147  
    1313    private static $nonce_name = 'wporg-learn-markdown-source-nonce';
    1414    private static $submit_name = 'wporg-learn-markdown-import';
    15     private static $supported_post_types = 'lesson-plan';
     15    private static $supported_post_type = 'lesson-plan';
    1616    private static $posts_per_page = 100;
    1717
     
    4141        // Fetch all lesson plan posts for comparison
    4242        $q = new WP_Query( array(
    43             'post_type'      => self::$supported_post_types,
     43            'post_type'      => self::$supported_post_type,
    4444            'post_status'    => 'publish',
    4545            'posts_per_page' => self::$posts_per_page,
     
    9494    private static function create_post_from_manifest_doc( $doc, $post_parent = null ) {
    9595        $post_data = array(
    96             'post_type'   => self::$supported_post_types,
     96            'post_type'   => self::$supported_post_type,
    9797            'post_status' => 'publish',
    9898            'post_parent' => $post_parent,
     
    113113    public static function action_wporg_learn_markdown_import() {
    114114        $q = new WP_Query( array(
    115             'post_type'      => self::$supported_post_types,
     115            'post_type'      => self::$supported_post_type,
    116116            'post_status'    => 'publish',
    117117            'fields'         => 'ids',
     
    149149        if ( ! current_user_can( 'edit_post', $post_id )
    150150            || ! wp_verify_nonce( $_GET[ self::$nonce_name ], self::$input_name )
    151             || ! in_array( get_post_type( $post_id ), self::$supported_post_types, true ) ) {
     151            || get_post_type( $post_id ) !== self::$supported_post_type ) {
    152152            return;
    153153        }
     
    166166     */
    167167    public static function action_edit_form_after_title( $post ) {
    168         if ( ! in_array( $post->post_type, self::$supported_post_types, true ) ) {
     168        if ( $post->post_type !== self::$supported_post_type ) {
    169169            return;
    170170        }
     
    197197        if ( ! isset( $_POST[ self::$input_name ] )
    198198            || ! isset( $_POST[ self::$nonce_name ] )
    199             || ! in_array( get_post_type( $post_id ), self::$supported_post_types, true ) ) {
     199            || get_post_type( $post_id ) !== self::$supported_post_type ) {
    200200            return;
    201201        }
     
    286286    /**
    287287     * Replace markdown checkboxes in the post-processed HTML.
    288      * 
     288     *
    289289     * @param string $html The HTML after translation from markup.
    290      * 
     290     *
    291291     * @return string The HTML after potentially replacing markdown checkboxes with HTML ones.
    292292     */
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/post-meta.php

    r10146 r10147  
    8989            break;
    9090        case 'string':
    91             $return = human_readable_duration( $interval->format( '%H:%I:%S' ) );
     91            if ( $interval->d > 0 ) {
     92                $return = human_time_diff( 0, $interval->d * DAY_IN_SECONDS );
     93            } elseif ( $interval->h > 0 ) {
     94                $return = $hours = human_time_diff( 0, $interval->h * HOUR_IN_SECONDS );
     95
     96                if ( $interval->i > 0 ) {
     97                    $minutes = human_time_diff( 0, $interval->i * MINUTE_IN_SECONDS );
     98                    $return = sprintf(
     99                        // translators: 1 is a string like "2 hours". 2 is a string like "20 mins".
     100                        _x( '%1$s, %2$s', 'hours and minutes','wporg-learn' ),
     101                        $hours,
     102                        $minutes
     103                    );
     104                }
     105            } elseif ( $interval->i > 0 ) {
     106                $return = human_time_diff( 0, $interval->i * MINUTE_IN_SECONDS );
     107            } elseif ( $interval->s > 0 ) {
     108                $return = human_time_diff( 0, $interval->s );
     109            }
    92110            break;
    93111        case 'raw':
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/post-type.php

    r10142 r10147  
    8383            array( 'core/button', array(
    8484                'text'         => __( 'Join a Group Discussion', 'wporg-learn' ),
    85                 'url'          => 'https://wordpress.org',
     85                'url'          => 'https://www.meetup.com/learn-wordpress-discussions/events/',
    8686                'borderRadius' => 5,
    8787                'className'    => 'is-style-secondary-full-width',
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/front-page.php

    r10146 r10147  
    6060        </section>
    6161        <hr>
    62 
    63         <section class="lesson-lists clearfix">
    64             <div class="col">
    65                 <h2 class="screen-reader-text"><?php _e( 'Lesson Plans' ); ?></h2>
    66                 <div class="lesson-item">
    67                     <h3 class="h4 title"><?php _e( 'User-oriented Lesson Plans' ); ?></h3>
    68                     <p><?php _e( 'User lessons are targeted towards end-users, those who actually publish content.' ); ?></p>
    69                     <a class="viewmore" href="#"><?php _e( 'View the lesson plans' ); ?></a>
    70                 </div>
    71                 <div class="lesson-item">
    72                     <h3 class="h4 title"><?php _e( 'Theme-oriented Lesson Plans' ); ?></h3>
    73                     <p><?php _e( 'Theme lessons are targeted towards entry-level developers, those who actually write code.' ); ?></p>
    74                     <a class="viewmore" href="#"><?php _e( 'View the lesson plans' ); ?></a>
    75                 </div>
    76                 <div class="lesson-item">
    77                     <h3 class="h4 title"><?php _e( 'Plugin-oriented Lesson Plans' ); ?></h3>
    78                     <p><?php _e( 'Plugin lessons are targeted towards entry-level developers, those who actually write code.' ); ?></p>
    79                     <a class="viewmore" href="#"><?php _e( 'View the lesson plans' ); ?></a>
    80                 </div>
    81             </div>
    82 
    83             <div class="col">
    84                 <h2 class="screen-reader-text"><?php _e( 'Workshop Ideas' ); ?></h2>
    85                 <div class="lesson-item">
    86                     <h3 class="h4 title"><?php _e( 'Half-day Workshop Ideas' ); ?></h3>
    87                     <p><?php _e( 'Concepts and activities for workshops that are only a few hours long.' ); ?></p>
    88                     <a class="viewmore" href="#"><?php _e( 'View the Workshop Ideas' ); ?></a>
    89                 </div>
    90                 <div class="lesson-item">
    91                     <h3 class="h4 title"><?php _e( 'Full-day Workshop Ideas' ); ?></h3>
    92                     <p><?php _e( 'Concepts and activities for workshops that fill the whole day.' ); ?></p>
    93                     <a class="viewmore" href="#"><?php _e( 'View the Workshop Ideas' ); ?></a>
    94                 </div>
    95                 <div class="lesson-item">
    96                     <h3 class="h4 title"><?php _e( 'Multi-day Workshop Ideas' ); ?></h3>
    97                     <p><?php _e( 'Concepts and activities for workshops that span the course of 2 or more days.' ); ?></p>
    98                     <a class="viewmore" href="#"><?php _e( 'View the Workshop Ideas' ); ?></a>
    99                 </div>
    100             </div>
    101 
    102             <div class="col">
    103                 <div class="lesson-item">
    104                     <h2 class="h4 title"><?php _e( 'Want to Help More People Speak at Meetups and WordCamps?' ); ?></h2>
    105                     <p><?php _e( 'WordPress is a built on a community where diversity and inclusion are key to growth. Meetups and WordCamps are the best way to teach others about WordPress on a local level and these resources can help diversify the speakers at these events.' ); ?></p>
    106                     <a class="viewmore" href="#"><?php _e( 'View the Speaker Diversity Lesson plans' ); ?></a>
    107                 </div>
    108                 <div class="lesson-item">
    109                     <h2 class="h4 title"><?php _e( 'Helpful Links' ); ?></h2>
    110                     <a class="viewmore" href="#"><?php _e( 'WordCamp Central' ); ?></a> <br />
    111                     <a class="viewmore" href="#"><?php _e( 'WordPress Meetups' ); ?></a>
    112                 </div>
    113             </div>
    114         </section>
    115 
    116         <hr>
    117 
     62       
    11863        <?php wporg_submit_idea_cta(); ?>
    11964
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/header.php

    r10146 r10147  
    2525wporg_get_global_header();
    2626
    27 if ( is_front_page() ) {
    28     $home_page = 'home ';
    29 }
    3027?>
    3128
    32 <div id="page" class="<?php echo esc_html( $home_page ); ?>site">
     29<div id="page" class="site">
    3330    <a class="skip-link screen-reader-text" href="#main"><?php esc_html_e( 'Skip to content', 'wporg-forums' ); ?></a>
    3431
Note: See TracChangeset for help on using the changeset viewer.