Make WordPress Core


Ignore:
Timestamp:
12/14/2018 03:24:35 AM (6 years ago)
Author:
pento
Message:

General: Fix some code formatting issues.

A handful of code formatting issues were introduced in recent commits, runs the auto-fixer on them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/embed.php

    r44154 r44155  
    6262 */
    6363function wp_embed_defaults( $url = '' ) {
    64     if ( ! empty( $GLOBALS['content_width'] ) )
     64    if ( ! empty( $GLOBALS['content_width'] ) ) {
    6565        $width = (int) $GLOBALS['content_width'];
    66 
    67     if ( empty( $width ) )
     66    }
     67
     68    if ( empty( $width ) ) {
    6869        $width = 500;
     70    }
    6971
    7072    $height = min( ceil( $width * 1.5 ), 1000 );
     
    132134function wp_oembed_add_provider( $format, $provider, $regex = false ) {
    133135    if ( did_action( 'plugins_loaded' ) ) {
    134         $oembed = _wp_oembed_get_object();
    135         $oembed->providers[$format] = array( $provider, $regex );
     136        $oembed                       = _wp_oembed_get_object();
     137        $oembed->providers[ $format ] = array( $provider, $regex );
    136138    } else {
    137139        WP_oEmbed::_add_provider_early( $format, $provider, $regex );
     
    227229function wp_embed_handler_youtube( $matches, $attr, $url, $rawattr ) {
    228230    global $wp_embed;
    229     $embed = $wp_embed->autoembed( sprintf( "https://youtube.com/watch?v=%s", urlencode( $matches[2] ) ) );
     231    $embed = $wp_embed->autoembed( sprintf( 'https://youtube.com/watch?v=%s', urlencode( $matches[2] ) ) );
    230232
    231233    /**
     
    396398
    397399    if ( '' !== $permalink ) {
    398         $url = add_query_arg( array(
    399             'url'    => urlencode( $permalink ),
    400             'format' => ( 'json' !== $format ) ? $format : false,
    401         ), $url );
     400        $url = add_query_arg(
     401            array(
     402                'url'    => urlencode( $permalink ),
     403                'format' => ( 'json' !== $format ) ? $format : false,
     404            ),
     405            $url
     406        );
    402407    }
    403408
     
    450455         * and edit wp-embed.js directly.
    451456         */
    452         $output .=<<<JS
     457        $output .= <<<JS
    453458        include "js/wp-embed.min.js"
    454459JS;
     
    518523     * }
    519524     */
    520     $min_max_width = apply_filters( 'oembed_min_max_width', array(
    521         'min' => 200,
    522         'max' => 600
    523     ) );
     525    $min_max_width = apply_filters(
     526        'oembed_min_max_width',
     527        array(
     528            'min' => 200,
     529            'max' => 600,
     530        )
     531    );
    524532
    525533    $width  = min( max( $min_max_width['min'], $width ), $min_max_width['max'] );
     
    570578
    571579    if ( is_multisite() ) {
    572         $url_parts = wp_parse_args( wp_parse_url( $url ), array(
    573             'host'   => '',
     580        $url_parts = wp_parse_args(
     581            wp_parse_url( $url ),
     582            array(
     583                'host' => '',
     584                'path' => '/',
     585            )
     586        );
     587
     588        $qv = array(
     589            'domain' => $url_parts['host'],
    574590            'path'   => '/',
    575         ) );
    576 
    577         $qv = array( 'domain' => $url_parts['host'], 'path' => '/' );
     591        );
    578592
    579593        // In case of subdirectory configs, set the path.
     
    648662        if ( wp_attachment_is_image( $post ) ) {
    649663            $thumbnail_id = $post->ID;
    650         } else if ( wp_attachment_is( 'video', $post ) ) {
     664        } elseif ( wp_attachment_is( 'video', $post ) ) {
    651665            $thumbnail_id = get_post_thumbnail_id( $post );
    652666            $data['type'] = 'video';
     
    656670    if ( $thumbnail_id ) {
    657671        list( $thumbnail_url, $thumbnail_width, $thumbnail_height ) = wp_get_attachment_image_src( $thumbnail_id, array( $width, 99999 ) );
    658         $data['thumbnail_url']    = $thumbnail_url;
    659         $data['thumbnail_width']  = $thumbnail_width;
    660         $data['thumbnail_height'] = $thumbnail_height;
     672        $data['thumbnail_url']                                      = $thumbnail_url;
     673        $data['thumbnail_width']                                    = $thumbnail_width;
     674        $data['thumbnail_height']                                   = $thumbnail_height;
    661675    }
    662676
     
    795809    $allowed_html = array(
    796810        'a'          => array(
    797             'href'         => true,
     811            'href' => true,
    798812        ),
    799813        'blockquote' => array(),
     
    825839
    826840        $url = esc_url( "{$results[2]}#?secret=$secret" );
    827         $q = $results[1];
     841        $q   = $results[1];
    828842
    829843        $html = str_replace( $results[0], ' src=' . $q . $url . $q . ' data-secret=' . $q . $secret . $q, $html );
     
    832846
    833847    $allowed_html['blockquote']['data-secret'] = true;
    834     $allowed_html['iframe']['data-secret'] = true;
     848    $allowed_html['iframe']['data-secret']     = true;
    835849
    836850    $html = wp_kses( $html, $allowed_html );
     
    863877    }
    864878
    865     $link = sprintf( '<a href="%1$s" class="wp-embed-more" target="_top">%2$s</a>',
     879    $link = sprintf(
     880        '<a href="%1$s" class="wp-embed-more" target="_top">%2$s</a>',
    866881        esc_url( get_permalink() ),
    867882        /* translators: %s: Name of current post */
     
    939954    <style type="text/css">
    940955    <?php
    941         if ( SCRIPT_DEBUG ) {
    942             readfile( ABSPATH . WPINC . "/css/wp-embed-template.css" );
    943         } else {
    944             /*
    945             * If you're looking at a src version of this file, you'll see an "include"
    946             * statement below. This is used by the `grunt build` process to directly
    947             * include a minified version of wp-oembed-embed.css, instead of using the
    948             * readfile() method from above.
    949             *
    950             * If you're looking at a build version of this file, you'll see a string of
    951             * minified CSS. If you need to debug it, please turn on SCRIPT_DEBUG
    952             * and edit wp-embed-template.css directly.
    953             */
    954             ?>
     956    if ( SCRIPT_DEBUG ) {
     957        readfile( ABSPATH . WPINC . '/css/wp-embed-template.css' );
     958    } else {
     959        /*
     960        * If you're looking at a src version of this file, you'll see an "include"
     961        * statement below. This is used by the `grunt build` process to directly
     962        * include a minified version of wp-oembed-embed.css, instead of using the
     963        * readfile() method from above.
     964        *
     965        * If you're looking at a build version of this file, you'll see a string of
     966        * minified CSS. If you need to debug it, please turn on SCRIPT_DEBUG
     967        * and edit wp-embed-template.css directly.
     968        */
     969        ?>
    955970            include "css/wp-embed-template.min.css"
    956             <?php
    957         }
     971        <?php
     972    }
    958973    ?>
    959974    </style>
     
    970985    <script type="text/javascript">
    971986    <?php
    972         if ( SCRIPT_DEBUG ) {
    973             readfile( ABSPATH . WPINC . "/js/wp-embed-template.js" );
    974         } else {
    975             /*
    976             * If you're looking at a src version of this file, you'll see an "include"
    977             * statement below. This is used by the `grunt build` process to directly
    978             * include a minified version of wp-embed-template.js, instead of using the
    979             * readfile() method from above.
    980             *
    981             * If you're looking at a build version of this file, you'll see a string of
    982             * minified JavaScript. If you need to debug it, please turn on SCRIPT_DEBUG
    983             * and edit wp-embed-template.js directly.
    984             */
    985             ?>
     987    if ( SCRIPT_DEBUG ) {
     988        readfile( ABSPATH . WPINC . '/js/wp-embed-template.js' );
     989    } else {
     990        /*
     991        * If you're looking at a src version of this file, you'll see an "include"
     992        * statement below. This is used by the `grunt build` process to directly
     993        * include a minified version of wp-embed-template.js, instead of using the
     994        * readfile() method from above.
     995        *
     996        * If you're looking at a build version of this file, you'll see a string of
     997        * minified JavaScript. If you need to debug it, please turn on SCRIPT_DEBUG
     998        * and edit wp-embed-template.js directly.
     999        */
     1000        ?>
    9861001            include "js/wp-embed-template.min.js"
    987             <?php
    988         }
     1002        <?php
     1003    }
    9891004    ?>
    9901005    </script>
Note: See TracChangeset for help on using the changeset viewer.