严格的标准:只有变量应该通过引用传递字preSS /可湿性粉剂包含/类oembed.php线116上 [英] Strict Standards: Only variables should be passed by reference in wordpress/wp-includes/class-oembed.php on line 116
问题描述
我看了一下了很多类似的问题,我没有得到它,关于我的code。
的错误:
严格的标准:只有变量应该通过引用传递字preSS /可湿性粉剂包含/类oembed.php线116上
和这里是我的code ....
//获取就绪显示音频
$ embedCheck =阵列(<嵌入,< ifram); //只检查对第6
$ mykey_values = get_post_custom_values('_ format_audio_embed');
$ content_oembed ='';//检查是否使用的音频metabox
如果(使用isset($ mykey_values)及&放大器;!空($ mykey_values)){
//遍历值传递
的foreach($ mykey_values为$关键=> $值){
$ URL = $价值;
$ WTF = wp_oembed_get($网址);
如果(!空($网址)){
$ firstCar = SUBSTR($网址,0,6); //获得第6字符。 //如果一个HTTP(S)。
如果(strpos($ firstCar,HTTP:/)== ||假strpos($ firstCar,https:开头!)== FALSE){
//发送到wp_oembed以查看是否链路透过oEmbed启用。
$ content_oembed =($ WTF!== FALSE)
? ('< DIV CLASS =声音的风格=宽度:100%;溢出:隐藏;>'。$ WTF'< / DIV>')
('<音频SRC ='。$网址preLOAD =无TYPE =音频/ MPEG>< /音频>');
} //如果上面定义其嵌入code,我们的阵列相匹配。
否则,如果(audio_strpos_arr($ firstCar,$ embedCheck)!== FALSE){
$ content_oembed ='< DIV CLASS =视频的风格=宽度:100%;溢出:隐藏;>' 。$网址。 '< / DIV>'; }
}
}; //结束的foreach
} // END条件
如果我删除在有条件的注释下面的部分发送到wp_oembed,看看是否链接透过oEmbed启用。,但奇怪的是,如果我传递一个的SoundCloud链接 - 没有错误,但如果它是一个本地托管文件不言而喻山雀起来。
任何帮助将大大AP preciated。
有点fidling后 - 看来问题与此相关的功能 HTTP ://$c$cx.word$p$pss.org/Function_Reference/wp_oembed_get
和什么那在incldued类oembed.php引用说上线116以下
112功能发现($网址){
113 $提供商=阵列();
114
115 //获取URL内容
如果116($ HTML = wp_remote_retrieve_body(wp_safe_remote_get($网址))){
暂时我使用wp_oembed_get完全避免由swopping我的条件语句,如果它不是一个iframe或使用,这似乎决定其是否在本地以下托管,或透过oEmbed链接自动地....
全球$ wp_embed;
$ post_embed = $ wp_embed-> run_short code('[嵌入]'$ URL'[/嵌入]');
然后echo'ing $ post_embed
I've had a look at a lot of the similar questions and I'm not getting it, with regards to my code.
The Error :
Strict Standards: Only variables should be passed by reference in wordpress/wp-includes/class-oembed.php on line 116
and here is my code....
// Get Ready Display the Audio
$embedCheck = array("<embed", "<ifram");// only checking against the first 6
$mykey_values = get_post_custom_values('_format_audio_embed');
$content_oembed = '';
// check if the audio metabox is used
if ( isset($mykey_values) && !empty($mykey_values) ) {
// iterate over values passed
foreach ( $mykey_values as $key => $value ) {
$url = $value;
$wtf = wp_oembed_get($url);
if ( !empty($url) ) {
$firstCar = substr($url, 0, 6); // get the first 6 char.
// if its a http(s).
if ( strpos($firstCar, "http:/" ) !== false || strpos($firstCar, "https:" ) !== false ) {
// send it to wp_oembed to see if the link is oembed enabled.
$content_oembed = ($wtf !==false)
? ('"<div class="audio" style="width:100%; overflow:hidden;">' .$wtf.'</div>')
: ('<audio src="'.$url.'" preload="none" type="audio/mpeg"></audio>');
}
// if its the embed code that matches our array defined above.
else if ( audio_strpos_arr($firstCar, $embedCheck ) !== false ) {
$content_oembed = '<div class="video" style="width:100%; overflow:hidden;">' .$url. '</div>';
}
}
}; // end foreach
} // end conditional
If I remove the section in the conditional below the comment "send it to wp_oembed to see if the link is oembed enabled.", but stranger still if I pass it a soundcloud link - no error, but if its a locally hosted file it goes tits up.
Any Help would be greatly appreciated.
after a bit of fidling - seems the problem is related to this function http://codex.wordpress.org/Function_Reference/wp_oembed_get
and what thats referencing in the incldued class-oembed.php says the following on line 116
112 function discover( $url ) {
113 $providers = array();
114
115 // Fetch URL content
116 if ( $html = wp_remote_retrieve_body( wp_safe_remote_get( $url ) ) ) {
for the time being I'm avoided using wp_oembed_get altogether by swopping my conditionals and if its not an iframe or using the following which seems to determine whether its a locally hosted, or oembed link automagically....
global $wp_embed;
$post_embed = $wp_embed->run_shortcode('[embed]'.$url.'[/embed]');
and then echo'ing $post_embed
这篇关于严格的标准:只有变量应该通过引用传递字preSS /可湿性粉剂包含/类oembed.php线116上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!