当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_embed_defaults函数代码示例

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


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

示例1: get_default_sizes

 function get_default_sizes()
 {
     $wp_embed_defaults = wp_embed_defaults();
     $height = intval(get_option('documentcloud_default_height', $wp_embed_defaults['height']));
     $width = intval(get_option('documentcloud_default_width', $wp_embed_defaults['width']));
     $full_width = intval(get_option('documentcloud_full_width', WP_DocumentCloud::DEFAULT_EMBED_FULL_WIDTH));
     return array('height' => $height, 'width' => $width, 'full_width' => $full_width);
 }
开发者ID:eyeseast,项目名称:wordpress-documentcloud,代码行数:8,代码来源:documentcloud.php

示例2: tamatebako_attachment_text

/**
 * Handles text attachments on their attachment pages.
 * @author Justin Tadlock <justintadlock@gmail.com>
 * @since 3.0.0
 */
function tamatebako_attachment_text($mime = '', $file = '')
{
    $embed_defaults = wp_embed_defaults();
    $text = '<object class="text" type="' . esc_attr($mime) . '" data="' . esc_url($file) . '" width="' . esc_attr($embed_defaults['width']) . '" height="' . esc_attr($embed_defaults['height']) . '">';
    $text .= '<param name="src" value="' . esc_url($file) . '" />';
    $text .= '</object>';
    return $text;
}
开发者ID:WPDevHQ,项目名称:nevertheless,代码行数:13,代码来源:attachment.php

示例3: bootstrap

 /**
  * Bootstrap this plugin
  *
  * @param string $file
  */
 public static function bootstrap($file)
 {
     self::$file = $file;
     Pronamic_Google_Maps_Plugin::bootstrap();
     Pronamic_Google_Maps_Widget::bootstrap();
     Pronamic_Google_Maps_Shortcodes::bootstrap();
     // Actions and hooks
     add_action('init', array(__CLASS__, 'init'));
     add_filter('parse_query', array(__CLASS__, 'parse_query'), 1000);
     // Options
     $embed_size = wp_embed_defaults();
     self::$defaultWidth = $embed_size['width'];
     self::$defaultHeight = $embed_size['height'];
 }
开发者ID:Warpsmith,项目名称:wp-pronamic-google-maps,代码行数:19,代码来源:Maps.php

示例4: shortcode

 function shortcode($attr, $url = '')
 {
     global $rte;
     if (empty($url)) {
         return '';
     }
     $rawattr = $attr;
     $attr = wp_parse_args($attr, wp_embed_defaults());
     // kses converts & into &amp; and we need to undo this
     // See http://core.trac.wordpress.org/ticket/11311
     $url = str_replace('&amp;', '&', $url);
     // Look for known internal handlers
     ksort($this->handlers);
     foreach ($this->handlers as $priority => $handlers) {
         foreach ($handlers as $id => $handler) {
             if (preg_match($handler['regex'], $url, $matches) && is_callable($handler['callback'])) {
                 if (false !== ($return = call_user_func($handler['callback'], $matches, $attr, $url, $rawattr))) {
                     return apply_filters('embed_handler_html', $return, $url, $attr);
                 }
             }
         }
     }
     // Check for a cached result (stored in the post meta)
     $cachekey = '_oembed_' . md5($url . serialize($attr));
     if ($this->usecache) {
         $cache = $this->rte->get_cache($cachekey);
         // Failures are cached
         if ('{{unknown}}' === $cache) {
             return $this->maybe_make_link($url);
         }
         if (!empty($cache)) {
             return apply_filters('embed_oembed_html', $cache, $url, $attr);
         }
     }
     // Use oEmbed to get the HTML
     $attr['discover'] = apply_filters('embed_oembed_discover', false) && current_user_can('unfiltered_html');
     $html = wp_oembed_get($url, $attr);
     // Cache the result
     $cache = $html ? $html : '{{unknown}}';
     $this->rte->set_cache($cachekey, $cache, 3600 * 24 * 7);
     // one week
     // If there was a result, return it
     if ($html) {
         return apply_filters('embed_oembed_html', $html, $url, $attr);
     }
     // Still unknown
     return $this->maybe_make_link($url);
 }
开发者ID:farvig,项目名称:wp-boilerplate,代码行数:48,代码来源:main.php

示例5: render

    protected function render()
    {
        $settings = $this->get_settings();
        if (empty($settings['link'])) {
            return;
        }
        $this->_current_instance = $settings;
        add_filter('oembed_result', [$this, 'filter_oembed_result'], 50, 3);
        $video_html = wp_oembed_get($settings['link']['url'], wp_embed_defaults());
        remove_filter('oembed_result', [$this, 'filter_oembed_result'], 50);
        if ($video_html) {
            ?>
			<div class="elementor-soundcloud-wrapper">
				<?php 
            echo $video_html;
            ?>
			</div>
		<?php 
        }
    }
开发者ID:pojome,项目名称:elementor,代码行数:20,代码来源:audio.php

示例6: test_shortcode_should_cache_failure_in_post_meta_for_known_post

 public function test_shortcode_should_cache_failure_in_post_meta_for_known_post()
 {
     $GLOBALS['post'] = $this->factory()->post->create_and_get();
     $url = 'https://example.com/';
     $expected = '<a href="' . esc_url($url) . '">' . esc_html($url) . '</a>';
     $key_suffix = md5($url . serialize(wp_embed_defaults($url)));
     $cachekey = '_oembed_' . $key_suffix;
     $cachekey_time = '_oembed_time_' . $key_suffix;
     add_filter('pre_oembed_result', '__return_empty_string');
     $actual = $this->wp_embed->shortcode(array(), $url);
     remove_filter('pre_oembed_result', '__return_empty_string');
     $this->assertEquals($expected, $actual);
     $this->assertEquals('{{unknown}}', get_post_meta($GLOBALS['post']->ID, $cachekey, true));
     $this->assertEmpty(get_post_meta($GLOBALS['post']->ID, $cachekey_time, true));
     // Result should be cached.
     $actual = $this->wp_embed->shortcode(array(), $url);
     $this->assertEquals($expected, $actual);
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:18,代码来源:WpEmbed.php

示例7: shortcode

 /**
  * The {@link do_shortcode()} callback function.
  *
  * Attempts to convert a URL into embed HTML. Starts by checking the URL against the regex of the registered embed handlers.
  * If none of the regex matches and it's enabled, then the URL will be given to the {@link WP_oEmbed} class.
  *
  * @uses wp_oembed_get()
  * @uses wp_parse_args()
  * @uses wp_embed_defaults()
  * @uses WP_Embed::maybe_make_link()
  * @uses get_option()
  * @uses current_user_can()
  * @uses wp_cache_get()
  * @uses wp_cache_set()
  * @uses get_post_meta()
  * @uses update_post_meta()
  *
  * @param array $attr Shortcode attributes.
  * @param string $url The URL attempting to be embedded.
  * @return string The embed HTML on success, otherwise the original URL.
  */
 function shortcode($attr, $url = '')
 {
     global $post;
     if (empty($url)) {
         return '';
     }
     $rawattr = $attr;
     $attr = wp_parse_args($attr, wp_embed_defaults());
     // kses converts & into &amp; and we need to undo this
     // See http://core.trac.wordpress.org/ticket/11311
     $url = str_replace('&amp;', '&', $url);
     // Look for known internal handlers
     ksort($this->handlers);
     foreach ($this->handlers as $priority => $handlers) {
         foreach ($handlers as $id => $handler) {
             if (preg_match($handler['regex'], $url, $matches) && is_callable($handler['callback'])) {
                 if (false !== ($return = call_user_func($handler['callback'], $matches, $attr, $url, $rawattr))) {
                     return apply_filters('embed_handler_html', $return, $url, $attr);
                 }
             }
         }
     }
     $post_ID = !empty($post->ID) ? $post->ID : null;
     if (!empty($this->post_ID)) {
         // Potentially set by WP_Embed::cache_oembed()
         $post_ID = $this->post_ID;
     }
     // Unknown URL format. Let oEmbed have a go.
     if ($post_ID) {
         // Check for a cached result (stored in the post meta)
         $cachekey = '_oembed_' . md5($url . serialize($attr));
         if ($this->usecache) {
             $cache = get_post_meta($post_ID, $cachekey, true);
             // Failures are cached
             if ('{{unknown}}' === $cache) {
                 return $this->maybe_make_link($url);
             }
             if (!empty($cache)) {
                 return apply_filters('embed_oembed_html', $cache, $url, $attr, $post_ID);
             }
         }
         // Use oEmbed to get the HTML
         $attr['discover'] = apply_filters('embed_oembed_discover', false) && author_can($post_ID, 'unfiltered_html');
         $html = wp_oembed_get($url, $attr);
         // Cache the result
         $cache = $html ? $html : '{{unknown}}';
         update_post_meta($post_ID, $cachekey, $cache);
         // If there was a result, return it
         if ($html) {
             return apply_filters('embed_oembed_html', $html, $url, $attr, $post_ID);
         }
     }
     // Still unknown
     return $this->maybe_make_link($url);
 }
开发者ID:nzeyimana,项目名称:WordPress,代码行数:76,代码来源:media.php

示例8: shortcode

 /**
  * The {@link do_shortcode()} callback function.
  *
  * Attempts to convert a URL into embed HTML. Starts by checking the URL against the regex of the registered embed handlers.
  * Next, checks the URL against the regex of registered {@link WP_oEmbed} providers if oEmbed discovery is false.
  * If none of the regex matches and it's enabled, then the URL will be passed to {@link BP_Embed::parse_oembed()} for oEmbed parsing.
  *
  * @uses wp_parse_args()
  * @uses wp_embed_defaults()
  * @uses current_user_can()
  * @uses _wp_oembed_get_object()
  * @uses WP_Embed::maybe_make_link()
  *
  * @param array $attr Shortcode attributes.
  * @param string $url The URL attempting to be embeded.
  * @return string The embed HTML on success, otherwise the original URL.
  */
 function shortcode($attr, $url = '')
 {
     if (empty($url)) {
         return '';
     }
     $rawattr = $attr;
     $attr = wp_parse_args($attr, wp_embed_defaults());
     // kses converts & into &amp; and we need to undo this
     // See http://core.trac.wordpress.org/ticket/11311
     $url = str_replace('&amp;', '&', $url);
     // Look for known internal handlers
     ksort($this->handlers);
     foreach ($this->handlers as $priority => $handlers) {
         foreach ($handlers as $hid => $handler) {
             if (preg_match($handler['regex'], $url, $matches) && is_callable($handler['callback'])) {
                 if (false !== ($return = call_user_func($handler['callback'], $matches, $attr, $url, $rawattr))) {
                     return apply_filters('embed_handler_html', $return, $url, $attr);
                 }
             }
         }
     }
     // Get object ID
     $id = apply_filters('embed_post_id', 0);
     // Is oEmbed discovery on?
     $attr['discover'] = apply_filters('bp_embed_oembed_discover', false) && current_user_can('unfiltered_html');
     // Set up a new WP oEmbed object to check URL with registered oEmbed providers
     require_once ABSPATH . WPINC . '/class-oembed.php';
     $oembed_obj = _wp_oembed_get_object();
     // If oEmbed discovery is true, skip oEmbed provider check
     $is_oembed_link = false;
     if (!$attr['discover']) {
         foreach ((array) $oembed_obj->providers as $provider_matchmask => $provider) {
             $regex = ($is_regex = $provider[1]) ? $provider_matchmask : '#' . str_replace('___wildcard___', '(.+)', preg_quote(str_replace('*', '___wildcard___', $provider_matchmask), '#')) . '#i';
             if (preg_match($regex, $url)) {
                 $is_oembed_link = true;
             }
         }
         // If url doesn't match a WP oEmbed provider, stop parsing
         if (!$is_oembed_link) {
             return $this->maybe_make_link($url);
         }
     }
     return $this->parse_oembed($id, $url, $attr, $rawattr);
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:61,代码来源:bp-core-classes.php

示例9: fetch

 /**
  * Connects to a oEmbed provider and returns the result.
  *
  * @param string $provider The URL to the oEmbed provider.
  * @param string $url The URL to the content that is desired to be embedded.
  * @param array $args Optional arguments. Usually passed from a shortcode.
  * @return bool|object False on failure, otherwise the result in the form of an object.
  */
 function fetch($provider, $url, $args = '')
 {
     $args = wp_parse_args($args, wp_embed_defaults());
     $provider = add_query_arg('format', 'json', $provider);
     // JSON is easier to deal with than XML
     $provider = add_query_arg('maxwidth', $args['width'], $provider);
     $provider = add_query_arg('maxheight', $args['height'], $provider);
     $provider = add_query_arg('url', urlencode($url), $provider);
     if (!($result = wp_remote_retrieve_body(wp_remote_get($provider)))) {
         return false;
     }
     $result = trim($result);
     // JSON?
     // Example content: http://vimeo.com/api/oembed.json?url=http%3A%2F%2Fvimeo.com%2F240975
     if ($data = json_decode($result)) {
         return $data;
     } elseif (function_exists('simplexml_load_string')) {
         $errors = libxml_use_internal_errors('true');
         $data = simplexml_load_string($result);
         libxml_use_internal_errors($errors);
         if (is_object($data)) {
             return $data;
         }
     }
     return false;
 }
开发者ID:jao,项目名称:jpcamargo,代码行数:34,代码来源:class-oembed.php

示例10: render

    protected function render()
    {
        $settings = $this->get_settings();
        if ('hosted' !== $settings['video_type']) {
            add_filter('oembed_result', [$this, 'filter_oembed_result'], 50, 3);
            $video_link = 'youtube' === $settings['video_type'] ? $settings['link'] : $settings['vimeo_link'];
            if (empty($video_link)) {
                return;
            }
            $video_html = wp_oembed_get($video_link, wp_embed_defaults());
            remove_filter('oembed_result', [$this, 'filter_oembed_result'], 50);
        } else {
            $video_html = wp_video_shortcode($this->get_hosted_params());
        }
        if ($video_html) {
            ?>
			<div class="elementor-video-wrapper">
				<?php 
            echo $video_html;
            if ($this->has_image_overlay()) {
                ?>
					<div class="elementor-custom-embed-image-overlay" style="background-image: url(<?php 
                echo $settings['image_overlay']['url'];
                ?>
);">
						<?php 
                if ('yes' === $settings['show_play_icon']) {
                    ?>
							<div class="elementor-custom-embed-play">
								<i class="fa fa-play-circle"></i>
							</div>
						<?php 
                }
                ?>
					</div>
				<?php 
            }
            ?>
			</div>
		<?php 
        } else {
            echo $settings['link'];
        }
    }
开发者ID:pojome,项目名称:elementor,代码行数:44,代码来源:video.php

示例11: markdown

 /**
  * A very simple markdown parser.
  *
  * @since 150113 First documented version.
  *
  * @param string $string Input string to convert.
  * @param array  $args   Any additional behavioral args.
  *
  * @return string Markdown converted to HTML markup.
  */
 public function markdown($string, array $args = [])
 {
     if (!($string = trim((string) $string))) {
         return $string;
         // Not possible.
     }
     $default_args = ['oembed' => false, 'breaks' => true, 'no_p' => false];
     $args = array_merge($default_args, $args);
     $args = array_intersect_key($args, $default_args);
     $oembed = (bool) $args['oembed'];
     $breaks = (bool) $args['breaks'];
     $no_p = (bool) $args['no_p'];
     if ($oembed && strpos($string, '://') !== false) {
         $_spcsm = $this->spcsmTokens($string, [], __FUNCTION__);
         $_oembed_args = array_merge(wp_embed_defaults(), ['discover' => false]);
         $_spcsm['string'] = preg_replace_callback('/^\\s*(https?:\\/\\/[^\\s"]+)\\s*$/im', function ($m) use($_oembed_args) {
             $oembed = wp_oembed_get($m[1], $_oembed_args);
             return $oembed ? $oembed : $m[0];
         }, $_spcsm['string']);
         $string = $this->spcsmRestore($_spcsm);
         unset($_spcsm, $_oembed_args);
         // Housekeeping.
     }
     if (is_null($parsedown =& $this->cacheKey(__FUNCTION__, 'parsedown'))) {
         $parsedown = new \ParsedownExtra();
         // Singleton.
     }
     $parsedown->setBreaksEnabled($breaks);
     $html = $parsedown->text($string);
     if ($no_p) {
         // Remove `<p></p>` wrap?
         $html = preg_replace('/^\\<p\\>/i', '', $html);
         $html = preg_replace('/\\<\\/p\\>$/i', '', $html);
     }
     return $html;
     // Gotta love Parsedown :-)
 }
开发者ID:websharks,项目名称:comment-mail,代码行数:47,代码来源:UtilsString.php

示例12: fetch

 /**
  * Connects to a oEmbed provider and returns the result.
  *
  * @param string $provider The URL to the oEmbed provider.
  * @param string $url The URL to the content that is desired to be embedded.
  * @param array $args Optional arguments. Usually passed from a shortcode.
  * @return bool|object False on failure, otherwise the result in the form of an object.
  */
 public function fetch($provider, $url, $args = '')
 {
     $args = wp_parse_args($args, wp_embed_defaults($url));
     $provider = add_query_arg('maxwidth', (int) $args['width'], $provider);
     $provider = add_query_arg('maxheight', (int) $args['height'], $provider);
     $provider = add_query_arg('url', urlencode($url), $provider);
     /**
      * Filter the oEmbed URL to be fetched.
      *
      * @since 2.9.0
      *
      * @param string $provider URL of the oEmbed provider.
      * @param string $url      URL of the content to be embedded.
      * @param array  $args     Optional arguments, usually passed from a shortcode.
      */
     $provider = apply_filters('oembed_fetch_url', $provider, $url, $args);
     foreach (array('json', 'xml') as $format) {
         $result = $this->_fetch_with_format($provider, $format);
         if (is_wp_error($result) && 'not-implemented' == $result->get_error_code()) {
             continue;
         }
         return $result && !is_wp_error($result) ? $result : false;
     }
     return false;
 }
开发者ID:catalinmiron,项目名称:WordPress,代码行数:33,代码来源:class-oembed.php

示例13: shortcode

 /**
  * The {@link do_shortcode()} callback function.
  *
  * Attempts to convert a URL into embed HTML. Starts by checking the
  * URL against the regex of the registered embed handlers. Next, checks
  * the URL against the regex of registered {@link WP_oEmbed} providers
  * if oEmbed discovery is false. If none of the regex matches and it's
  * enabled, then the URL will be passed to {@link BP_Embed::parse_oembed()}
  * for oEmbed parsing.
  *
  * @uses wp_parse_args()
  * @uses wp_embed_defaults()
  * @uses current_user_can()
  * @uses _wp_oembed_get_object()
  * @uses WP_Embed::maybe_make_link()
  *
  * @param array  $attr Shortcode attributes.
  * @param string $url  The URL attempting to be embeded.
  * @return string The embed HTML on success, otherwise the original URL.
  */
 public function shortcode($attr, $url = '')
 {
     if (empty($url)) {
         return '';
     }
     $rawattr = $attr;
     $attr = wp_parse_args($attr, wp_embed_defaults());
     // Use kses to convert & into &amp; and we need to undo this
     // See https://core.trac.wordpress.org/ticket/11311.
     $url = str_replace('&amp;', '&', $url);
     // Look for known internal handlers.
     ksort($this->handlers);
     foreach ($this->handlers as $priority => $handlers) {
         foreach ($handlers as $hid => $handler) {
             if (preg_match($handler['regex'], $url, $matches) && is_callable($handler['callback'])) {
                 if (false !== ($return = call_user_func($handler['callback'], $matches, $attr, $url, $rawattr))) {
                     /**
                      * Filters the oEmbed handler result for the provided URL.
                      *
                      * @since 1.5.0
                      *
                      * @param string $return Handler callback for the oEmbed.
                      * @param string $url    URL attempting to be embedded.
                      * @param array  $attr   Shortcode attributes.
                      */
                     return apply_filters('embed_handler_html', $return, $url, $attr);
                 }
             }
         }
     }
     /**
      * Filters the embed object ID.
      *
      * @since 1.5.0
      *
      * @param int $value Value of zero.
      */
     $id = apply_filters('embed_post_id', 0);
     $unfiltered_html = current_user_can('unfiltered_html');
     $default_discovery = false;
     // Since 4.4, WordPress is now an oEmbed provider.
     if (function_exists('wp_oembed_register_route')) {
         $unfiltered_html = true;
         $default_discovery = true;
     }
     /**
      * Filters whether or not oEmbed discovery is on.
      *
      * @since 1.5.0
      * @since 2.5.0 Default status of oEmbed discovery has been switched
      *              to true to apply changes introduced in WordPress 4.4
      *
      * @param bool $default_discovery Current status of oEmbed discovery.
      */
     $attr['discover'] = apply_filters('bp_embed_oembed_discover', $default_discovery) && $unfiltered_html;
     // Set up a new WP oEmbed object to check URL with registered oEmbed providers.
     require_once ABSPATH . WPINC . '/class-oembed.php';
     $oembed_obj = _wp_oembed_get_object();
     // If oEmbed discovery is true, skip oEmbed provider check.
     $is_oembed_link = false;
     if (!$attr['discover']) {
         foreach ((array) $oembed_obj->providers as $provider_matchmask => $provider) {
             $regex = ($is_regex = $provider[1]) ? $provider_matchmask : '#' . str_replace('___wildcard___', '(.+)', preg_quote(str_replace('*', '___wildcard___', $provider_matchmask), '#')) . '#i';
             if (preg_match($regex, $url)) {
                 $is_oembed_link = true;
             }
         }
         // If url doesn't match a WP oEmbed provider, stop parsing.
         if (!$is_oembed_link) {
             return $this->maybe_make_link($url);
         }
     }
     return $this->parse_oembed($id, $url, $attr, $rawattr);
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:94,代码来源:class-bp-embed.php

示例14: shortcode

 function shortcode($attr, $url = '')
 {
     global $post;
     if (empty($url)) {
         return '';
     }
     $rawattr = $attr;
     $attr = wp_parse_args($attr, wp_embed_defaults());
     // kses converts & into &amp; and we need to undo this
     // See http://core.trac.wordpress.org/ticket/11311
     $url = str_replace('&amp;', '&', $url);
     // Look for known internal handlers
     ksort($this->handlers);
     foreach ($this->handlers as $priority => $handlers) {
         foreach ($handlers as $id => $handler) {
             if (preg_match($handler['regex'], $url, $matches) && is_callable($handler['callback'])) {
                 if (false !== ($return = call_user_func($handler['callback'], $matches, $attr, $url, $rawattr))) {
                     return apply_filters('embed_handler_html', $return, $url, $attr);
                 }
             }
         }
     }
     $transient_name = $this->widget_id . '_' . md5($url);
     // Store the value of the disable_related option.
     // If it changes we need to clear transient data containing the html
     // and update the transient containing the disable_related value
     $related_transient = get_transient($transient_name . '_related');
     if (false !== $related_transient && $related_transient != $this->disable_related) {
         delete_transient($transient_name);
         set_transient($transient_name . '_related', $this->disable_related, 60 * 60 * 12);
     }
     $transient = get_transient($transient_name);
     // return the transient html value if its available
     if (false !== $transient) {
         return apply_filters('embed_oembed_html', $transient, $url, $attr, $post_ID);
     }
     // Use oEmbed to get the HTML
     $attr['discover'] = apply_filters('embed_oembed_discover', false) && author_can($post_ID, 'unfiltered_html');
     $html = wp_oembed_get($url, $attr);
     // If there was a result, return it
     if ($html) {
         // if 'youtube' is found in the html and disable related is true, add rel=0 paramater
         if (false !== strpos($html, 'youtube') && true == $this->disable_related) {
             $html = $this->disable_youtube_related($html);
         }
         set_transient($transient_name, $html, 60 * 60 * 12);
         // We need to know if the disable_related value of this widget changes
         // and clear transient data when it does
         set_transient($transient_name . '_related', $this->disable_related, 60 * 60 * 12);
         return apply_filters('embed_oembed_html', $html, $url, $attr, $post_ID);
     }
     return $this->maybe_make_link($url);
 }
开发者ID:AnushkaKRajasingha,项目名称:confusedgirlinthecity,代码行数:53,代码来源:custom-widget.php

示例15: hybrid_text_attachment

/**
 * Handles text attachments on their attachment pages.  Uses the `<object>` element to embed media
 * in the pages.
 *
 * @since  0.3.0
 * @access public
 * @param  string $mime attachment mime type
 * @param  string $file attachment file URL
 * @return string
 */
function hybrid_text_attachment($mime = '', $file = '')
{
    $embed_defaults = wp_embed_defaults();
    return sprintf('<object type="%1$s" data="%2$s" width="%3$s" height="%4$s"><param name="src" value="%2$s" /></object>', esc_attr($mime), esc_url($file), absint($embed_defaults['width']), absint($embed_defaults['height']));
}
开发者ID:ifte510,项目名称:hybrid-core,代码行数:15,代码来源:template-media.php


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