• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_expand_dimensions函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_expand_dimensions函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_expand_dimensions函数的具体用法?PHP wp_expand_dimensions怎么用?PHP wp_expand_dimensions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wp_expand_dimensions函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: wp_embed_handler_googlevideo

/**
 * The Google Video embed handler callback. Google Video does not support oEmbed.
 *
 * @see WP_Embed::register_handler()
 * @see WP_Embed::shortcode()
 *
 * @param array $matches The regex matches from the provided regex when calling {@link wp_embed_register_handler()}.
 * @param array $attr Embed attributes.
 * @param string $url The original URL that was matched by the regex.
 * @param array $rawattr The original unmodified attributes.
 * @return string The embed HTML.
 */
function wp_embed_handler_googlevideo($matches, $attr, $url, $rawattr)
{
    // If the user supplied a fixed width AND height, use it
    if (!empty($rawattr['width']) && !empty($rawattr['height'])) {
        $width = (int) $rawattr['width'];
        $height = (int) $rawattr['height'];
    } else {
        list($width, $height) = wp_expand_dimensions(425, 344, $attr['width'], $attr['height']);
    }
    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"></embed>', $matches, $attr, $url, $rawattr);
}
开发者ID:ericandrewlewis,项目名称:wordpress-mu,代码行数:23,代码来源:default-embeds.php


示例2: wp_embed_handler_dailymotion

/**
 * The DailyMotion.com embed handler callback. DailyMotion does not support oEmbed.
 *
 * @see WP_Embed::register_handler()
 * @see WP_Embed::shortcode()
 *
 * @param array $matches The regex matches from the provided regex when calling {@link wp_embed_register_handler()}.
 * @param array $attr Embed attributes.
 * @param string $url The original URL that was matched by the regex.
 * @param array $rawattr The original unmodified attributes.
 * @return string The embed HTML.
 */
function wp_embed_handler_dailymotion($matches, $attr, $url, $rawattr)
{
    // If the user supplied a fixed width AND height, use it
    if (!empty($rawattr['width']) && !empty($rawattr['height'])) {
        $width = (int) $rawattr['width'];
        $height = (int) $rawattr['height'];
    } else {
        list($width, $height) = wp_expand_dimensions(480, 291, $attr['width'], $attr['height']);
    }
    return apply_filters('embed_dailymotion', '<object width="' . esc_attr($width) . '" height="' . esc_attr($height) . '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"><param name="movie" value="http://www.dailymotion.com/swf/' . esc_attr($matches[3]) . '&amp;related=0"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.dailymotion.com/swf/' . esc_attr($matches[3]) . '&amp;related=0" type="application/x-shockwave-flash" width="' . esc_attr($width) . '" height="' . esc_attr($height) . '" allowFullScreen="true" allowScriptAccess="always"></embed></object>', $matches, $attr, $url, $rawattr);
}
开发者ID:jao,项目名称:jpcamargo,代码行数:23,代码来源:default-embeds.php


示例3: oembed_handler_brainshark

 /**
  * Copied from Google Video handler in wp-includes/media.php
  */
 public function oembed_handler_brainshark($matches, $attr, $url, $rawattr)
 {
     // If the user supplied a fixed width AND height, use it
     if (!empty($rawattr['width']) && !empty($rawattr['height'])) {
         $width = (int) $rawattr['width'];
         $height = (int) $rawattr['height'];
     } else {
         list($width, $height) = wp_expand_dimensions(440, 366, $attr['width'], $attr['height']);
     }
     $pi = $matches[2];
     $html = '<object width="' . $width . '" height="' . $height . '" id="bsplayer94201" name="bsplayer94201" data="http://www.brainshark.com/brainshark/viewer/getplayer.ashx" type="application/x-shockwave-flash"><param name="movie" value="http://www.brainshark.com/brainshark/viewer/getplayer.ashx" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="flashvars" value="pi=' . $pi . '&dm=5&pause=1" /><a href="http://www.brainshark.com/brainshark/viewer/fallback.ashx?pi=' . $pi . '"><video width="' . $width . '" height="' . $height . '" controls="true" poster="http://www.brainshark.com/brainshark/brainshark.net/common/getimage.ashx?pi=' . $pi . '&w=' . $width . '&h=' . $height . '&sln=1"><source src="http://www.brainshark.com/brainshark/brainshark.net/apppresentation/getmovie.aspx?pi=' . $pi . '&fmt=2" /><img src="http://www.brainshark.com/brainshark/brainshark.net/apppresentation/splash.aspx?pi=' . $pi . '" width="' . $width . '" height="' . $height . '" border="0" /></video></a></object>';
     return apply_filters('embed_brainshark', $html, $matches, $attr, $url, $rawattr);
 }
开发者ID:sabdev1,项目名称:ljcdevsab,代码行数:16,代码来源:page-show-ad.php


示例4: wp_embed_handler_googlevideo

/**
 * The Google Video embed handler callback.
 *
 * Google Video does not support oEmbed.
 *
 * @see WP_Embed::register_handler()
 * @see WP_Embed::shortcode()
 *
 * @param array  $matches The RegEx matches from the provided regex when calling wp_embed_register_handler().
 * @param array  $attr    Embed attributes.
 * @param string $url     The original URL that was matched by the regex.
 * @param array  $rawattr The original unmodified attributes.
 * @return string The embed HTML.
 */
function wp_embed_handler_googlevideo($matches, $attr, $url, $rawattr)
{
    // If the user supplied a fixed width AND height, use it
    if (!empty($rawattr['width']) && !empty($rawattr['height'])) {
        $width = (int) $rawattr['width'];
        $height = (int) $rawattr['height'];
    } else {
        list($width, $height) = wp_expand_dimensions(425, 344, $attr['width'], $attr['height']);
    }
    /**
     * Filter the Google Video embed output.
     *
     * @since 2.9.0
     *
     * @param string $html    Google Video HTML embed markup.
     * @param array  $matches The RegEx matches from the provided regex.
     * @param array  $attr    An array of embed attributes.
     * @param string $url     The original URL that was matched by the regex.
     * @param array  $rawattr The original unmodified attributes.
     */
    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);
}
开发者ID:nxty2011,项目名称:WordPress,代码行数:36,代码来源:embed-functions.php


示例5: filter_dimensions

 /**
  * Method for filtering the media's 'width' and 'height' attributes so that the theme can handle the 
  * dimensions how it sees fit.
  *
  * @since  1.6.0
  * @access public
  * @param  string  $html
  * @return string
  */
 public function filter_dimensions($html)
 {
     $_html = strip_tags($html, '<object><embed><iframe><video>');
     /* Find the attributes of the media. */
     $atts = wp_kses_hair($_html, array('http', 'https'));
     /* Loop through the media attributes and add them in key/value pairs. */
     foreach ($atts as $att) {
         $media_atts[$att['name']] = $att['value'];
     }
     /* If no dimensions are found, just return the HTML. */
     if (empty($media_atts) || !isset($media_atts['width']) || !isset($media_atts['height'])) {
         return $html;
     }
     /* Set the max width. */
     $max_width = $this->args['width'];
     /* Set the max height based on the max width and original width/height ratio. */
     $max_height = round($max_width / ($media_atts['width'] / $media_atts['height']));
     /* Fix for Spotify embeds. */
     if (!empty($media_atts['src']) && preg_match('#https?://(embed)\\.spotify\\.com/.*#i', $media_atts['src'], $matches)) {
         list($max_width, $max_height) = $this->spotify_dimensions($media_atts);
     }
     /* Calculate new media dimensions. */
     $dimensions = wp_expand_dimensions($media_atts['width'], $media_atts['height'], $max_width, $max_height);
     /* Allow devs to filter the final width and height of the media. */
     list($width, $height) = apply_filters('hybrid_media_grabber_dimensions', $dimensions, $media_atts, $this);
     /* Set up the patterns for the 'width' and 'height' attributes. */
     $patterns = array('/(width=[\'"]).+?([\'"])/i', '/(height=[\'"]).+?([\'"])/i', '/(<div.+?style=[\'"].*?width:.+?).+?(px;.+?[\'"].*?>)/i');
     /* Set up the replacements for the 'width' and 'height' attributes. */
     $replacements = array('${1}' . $width . '${2}', '${1}' . $height . '${2}', '${1}' . $width . '${2}');
     /* Filter the dimensions and return the media HTML. */
     return preg_replace($patterns, $replacements, $html);
 }
开发者ID:highergroundstudio,项目名称:hybrid-core,代码行数:41,代码来源:hybrid-media-grabber.php


示例6: wp_embed_handler_qiyi

/**
 * 奇艺嵌入代码
 *
 * @version 0.13.9.3
 * @see WP_Embed::shortcode 参数来源
 *     
 * @param unknown $matches
 * @param unknown $attr
 * @param unknown $url
 * @param unknown $rawattr
 * @return mixed
 */
function wp_embed_handler_qiyi($matches, $attr, $url, $rawattr)
{
    if (!empty($rawattr['width']) && !empty($rawattr['height'])) {
        $width = (int) $rawattr['width'];
        $height = (int) $rawattr['height'];
    } else {
        list($width, $height) = wp_expand_dimensions(425, 230, $attr['width'], $attr['height']);
    }
    $tmp = idea_qiyi($url);
    $swf = $tmp['swf'];
    $id = $tmp['id'];
    $embed = <<<EOT
<embed type="application/x-shockwave-flash" src="{$swf}?vid={$id}" style="width: {$width}px;height:{$height}px" allowFullScreen="true" allowScriptAccess="always" />
EOT;
    return apply_filters('embed_qiyi', $embed, $matches, $attr, $url, $rawattr);
}
开发者ID:023yangbo,项目名称:WordPress,代码行数:28,代码来源:functions.php


示例7: filter_image_resize_dimensions

 public function filter_image_resize_dimensions($default, $orig_w, $orig_h, $dest_w, $dest_h, $crop)
 {
     if ($crop) {
         return null;
     }
     // let the wordpress default function handle this
     // don't crop, just resize using $dest_w x $dest_h as a maximum bounding box
     $crop_w = $orig_w;
     $crop_h = $orig_h;
     $s_x = 0;
     $s_y = 0;
     // note the use of wp_expand_dimensions() instead of wp_constrain_dimensions()
     list($new_w, $new_h) = wp_expand_dimensions($orig_w, $orig_h, $dest_w, $dest_h);
     // the return array matches the parameters to imagecopyresampled()
     return array(0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h);
 }
开发者ID:booklein,项目名称:wpbookle,代码行数:16,代码来源:ToolsPage.php



注:本文中的wp_expand_dimensions函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_explain_nonce函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_exif_frac2dec函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap