Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/media.php

    r16865 r17751  
    126126 *
    127127 * @param int $id Attachment ID for image.
    128  * @param string $size Optional, default is 'medium'. Size of image, can be 'thumbnail'.
     128 * @param array|string $size Optional, default is 'medium'. Size of image, either array or string.
    129129 * @return bool|array False on failure, array on success.
    130130 */
     
    251251
    252252    // Set artificially high because GD uses uncompressed images in memory
    253     @ini_set('memory_limit', '256M');
     253    @ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) );
    254254    $image = imagecreatefromstring( file_get_contents( $file ) );
    255255
     
    10261026
    10271027    /**
    1028      * PHP4 constructor
    1029      */
    1030     function WP_Embed() {
    1031         return $this->__construct();
    1032     }
    1033 
    1034     /**
    1035      * PHP5 constructor
     1028     * Constructor
    10361029     */
    10371030    function __construct() {
     
    14071400    $oembed->providers[$format] = array( $provider, $regex );
    14081401}
     1402
     1403/**
     1404 * Determines if default embed handlers should be loaded.
     1405 *
     1406 * Checks to make sure that the embeds library hasn't already been loaded. If
     1407 * it hasn't, then it will load the embeds library.
     1408 *
     1409 * @since 2.9.0
     1410 */
     1411function wp_maybe_load_embeds() {
     1412    if ( ! apply_filters( 'load_default_embeds', true ) )
     1413        return;
     1414    wp_embed_register_handler( 'googlevideo', '#http://video\.google\.([A-Za-z.]{2,5})/videoplay\?docid=([\d-]+)(.*?)#i', 'wp_embed_handler_googlevideo' );
     1415}
     1416
     1417/**
     1418 * The Google Video embed handler callback. Google Video does not support oEmbed.
     1419 *
     1420 * @see WP_Embed::register_handler()
     1421 * @see WP_Embed::shortcode()
     1422 *
     1423 * @param array $matches The regex matches from the provided regex when calling {@link wp_embed_register_handler()}.
     1424 * @param array $attr Embed attributes.
     1425 * @param string $url The original URL that was matched by the regex.
     1426 * @param array $rawattr The original unmodified attributes.
     1427 * @return string The embed HTML.
     1428 */
     1429function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) {
     1430    // If the user supplied a fixed width AND height, use it
     1431    if ( !empty($rawattr['width']) && !empty($rawattr['height']) ) {
     1432        $width  = (int) $rawattr['width'];
     1433        $height = (int) $rawattr['height'];
     1434    } else {
     1435        list( $width, $height ) = wp_expand_dimensions( 425, 344, $attr['width'], $attr['height'] );
     1436    }
     1437
     1438    return apply_filters( 'embed_googlevideo', '<embed type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docid=' . esc_attr($matches[2]) . '&amp;hl=en&amp;fs=true" style="width:' . esc_attr($width) . 'px;height:' . esc_attr($height) . 'px" allowFullScreen="true" allowScriptAccess="always" />', $matches, $attr, $url, $rawattr );
     1439}
     1440
     1441?>
Note: See TracChangeset for help on using the changeset viewer.