aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfabrixxm <fabrix.xm@gmail.com>2011-10-21 07:32:12 -0700
committerfabrixxm <fabrix.xm@gmail.com>2011-10-21 07:32:12 -0700
commita06c9768be418dc473f492c043ab6dfd1ae46f47 (patch)
treebbf6b2fcf0c0b618eb7e979f045d7fe99cb97ba8 /include
parent6e76c86ad20c5c9ae3f8f2e2c226c8e22b9a8032 (diff)
parentd80c0da3c0bf2ab599f5d013d5c947823d917363 (diff)
downloadvolse-hubzilla-a06c9768be418dc473f492c043ab6dfd1ae46f47.tar.gz
volse-hubzilla-a06c9768be418dc473f492c043ab6dfd1ae46f47.tar.bz2
volse-hubzilla-a06c9768be418dc473f492c043ab6dfd1ae46f47.zip
Merge pull request #34 from fabrixxm/master
fixs to oembed
Diffstat (limited to 'include')
-rw-r--r--include/oembed.php24
1 files changed, 15 insertions, 9 deletions
diff --git a/include/oembed.php b/include/oembed.php
index 06f71a3b3..a8f6636ff 100644
--- a/include/oembed.php
+++ b/include/oembed.php
@@ -81,16 +81,22 @@ function oembed_format_object($j){
}; break;
case "rich": {
// not so safe..
- $ret.= "<blockquote>".$j->html."</blockquote>";
+ $ret.= $j->html;
}; break;
}
- $embedlink = (isset($j->title))?$j->title:$embedurl;
- $ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>";
- if (isset($j->author_name)) $ret.=" by ".$j->author_name;
- if (isset($j->provider_name)) $ret.=" on ".$j->provider_name;
+ // add link to source if not present in "rich" type
+ if ( $j->type!='rich' || !strpos($ret,$embedurl) ){
+ $embedlink = (isset($j->title))?$j->title:$embedurl;
+ $ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>";
+ if (isset($j->author_name)) $ret.=" by ".$j->author_name;
+ if (isset($j->provider_name)) $ret.=" on ".$j->provider_name;
+ } else {
+ // add <a> for html2bbcode conversion
+ $ret .= "<a href='$embedurl' rel='oembed'/>";
+ }
$ret.="<br style='clear:left'></span>";
- return $ret;
+ return mb_convert_encoding($ret, 'HTML-ENTITIES', mb_detect_encoding($ret));
}
function oembed_bbcode2html($text){
@@ -136,8 +142,8 @@ function oembed_html2bbcode($text) {
$xattr = oe_build_xpath("class","oembed");
$entries = $xpath->query("//span[$xattr]");
-
- $xattr = oe_build_xpath("rel","oembed");
+
+ $xattr = "@rel='oembed'";//oe_build_xpath("rel","oembed");
foreach($entries as $e) {
$href = $xpath->evaluate("a[$xattr]/@href", $e)->item(0)->nodeValue;
if(!is_null($href)) $e->parentNode->replaceChild(new DOMText("[embed]".$href."[/embed]"), $e);
@@ -148,4 +154,4 @@ function oembed_html2bbcode($text) {
}
}
-?> \ No newline at end of file
+?>