Making WordPress.org


Ignore:
Timestamp:
08/13/2020 11:43:14 PM (6 years ago)
Author:
coreymckrill
Message:

WordPress.org Learn: Sync with GitHub

https://github.com/WordPress/learn/compare/1accd3db38a60230689bdc157f9e82081d35d163...38e7793fd20434d72ca898988d017ba2009fb677

File:
1 edited

Legend:

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

    r10147 r10169  
    8181function get_workshop_duration( WP_Post $workshop, $format = 'raw' ) {
    8282    $raw_duration = $workshop->duration ? absint( $workshop->duration ) : 0;
    83     $interval = date_diff( new DateTime( '@0' ), new DateTime( "@$raw_duration" ) ); // The '@' ignores timezone.
    84     $return = null;
     83    $interval     = date_diff( new DateTime( '@0' ), new DateTime( "@$raw_duration" ) ); // The '@' ignores timezone.
     84    $return       = null;
    8585
    8686    switch ( $format ) {
     
    9292                $return = human_time_diff( 0, $interval->d * DAY_IN_SECONDS );
    9393            } elseif ( $interval->h > 0 ) {
    94                 $return = $hours = human_time_diff( 0, $interval->h * HOUR_IN_SECONDS );
     94                $hours = human_time_diff( 0, $interval->h * HOUR_IN_SECONDS );
     95                $return = $hours;
    9596
    9697                if ( $interval->i > 0 ) {
    9798                    $minutes = human_time_diff( 0, $interval->i * MINUTE_IN_SECONDS );
    98                     $return = sprintf(
     99                    $return  = sprintf(
    99100                        // 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                        _x( '%1$s, %2$s', 'hours and minutes', 'wporg-learn' ),
    101102                        $hours,
    102103                        $minutes
     
    148149function render_metabox_workshop_details( WP_Post $post ) {
    149150    $duration_interval = get_workshop_duration( $post, 'interval' );
    150     $captions = get_post_meta( $post->ID, 'video_caption_language' ) ?: array();
     151    $captions          = get_post_meta( $post->ID, 'video_caption_language' ) ?: array();
    151152
    152153    require dirname( dirname( __FILE__ ) ) . '/views/metabox-workshop-details.php';
     
    167168 * Update the post meta values from the meta box fields when the post is saved.
    168169 *
    169  * @param int $post_id
     170 * @param int     $post_id
    170171 * @param WP_Post $post
    171172 */
     
    182183
    183184    $presenter_wporg_username = filter_input( INPUT_POST, 'presenter-wporg-username' );
    184     $usernames = array_map( 'trim', explode( ',', $presenter_wporg_username ) );
     185    $usernames                = array_map( 'trim', explode( ',', $presenter_wporg_username ) );
    185186    delete_post_meta( $post_id, 'presenter_wporg_username' );
    186     foreach( $usernames as $username ) {
     187    foreach ( $usernames as $username ) {
    187188        add_post_meta( $post_id, 'presenter_wporg_username', $username );
    188189    }
     
    192193
    193194    $video_caption_language = filter_input( INPUT_POST, 'video-caption-language' );
    194     $captions = array_map( 'trim', explode( ',', $video_caption_language ) );
     195    $captions               = array_map( 'trim', explode( ',', $video_caption_language ) );
    195196    delete_post_meta( $post_id, 'video_caption_language' );
    196     foreach( $captions as $caption ) {
     197    foreach ( $captions as $caption ) {
    197198        add_post_meta( $post_id, 'video_caption_language', $caption );
    198199    }
Note: See TracChangeset for help on using the changeset viewer.