本文整理汇总了PHP中WP_oEmbed::get_html方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_oEmbed::get_html方法的具体用法?PHP WP_oEmbed::get_html怎么用?PHP WP_oEmbed::get_html使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_oEmbed
的用法示例。
在下文中一共展示了WP_oEmbed::get_html方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_wp_filter_pre_oembed_result_non_existent_post
public function test_wp_filter_pre_oembed_result_non_existent_post()
{
$post_id = self::factory()->post->create();
$permalink = get_permalink($post_id);
$this->go_to($permalink);
$this->assertQueryTrue('is_single', 'is_singular');
add_filter('pre_oembed_result', array($this, '_filter_pre_oembed_result'));
$actual = $this->oembed->get_html('https://example.com/');
remove_filter('pre_oembed_result', array($this, '_filter_pre_oembed_result'));
$this->assertTrue(false !== $this->pre_oembed_result_filtered);
$this->assertFalse($actual);
}
示例2: get_html
/**
* The do-it-all function that takes a URL and attempts to return the HTML.
*
* @see WP_oEmbed::discover()
* @see WP_oEmbed::fetch()
* @see WP_oEmbed::data2html()
*
* @param string $url The URL to the content that should be attempted to be embedded.
* @param array $args Optional arguments. Usually passed from a shortcode.
* @return bool|string False on failure, otherwise the UNSANITIZED (and potentially unsafe) HTML that should be used to embed.
*/
public function get_html($strURL, $arrArgs = array())
{
if (isset($GLOBALS['arrFetchTweets_oEmbed'][$strURL])) {
return $GLOBALS['arrFetchTweets_oEmbed'][$strURL];
}
$strHTML = parent::get_html($strURL, $arrArgs);
// Store the result in the global array.
$GLOBALS['arrFetchTweets_oEmbed'][$strURL] = $strHTML;
return $strHTML;
}