From a7079d4327b47cb3fed429ac12ed7c72c0adfe2e Mon Sep 17 00:00:00 2001
From: Michael Vogel
Date: Sun, 26 Jan 2014 09:58:41 +0100
Subject: [PATCH 1/2] Adding metadata in the schema.org format.
---
mod/display.php | 12 ++++++++++--
view/default.php | 2 +-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/mod/display.php b/mod/display.php
index efae937e1..75e51d5a9 100644
--- a/mod/display.php
+++ b/mod/display.php
@@ -99,7 +99,7 @@ function display_content(&$a, $update = 0) {
notice( t('Access to this profile has been restricted.') . EOL);
return;
}
-
+
if ($is_owner) {
$celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
@@ -216,12 +216,20 @@ function display_content(&$a, $update = 0) {
$a->page['htmlhead'] .= ''."\n";
$a->page['htmlhead'] .= ''."\n";
+ // Schema.org microdata
+ $a->page['htmlhead'] .= ''."\n";
+ $a->page['htmlhead'] .= ''."\n";
+ $a->page['htmlhead'] .= ''."\n";
+ $a->page['htmlhead'] .= ''."\n";
+
+ // Dublin Core
$a->page['htmlhead'] .= ''."\n";
$a->page['htmlhead'] .= ''."\n";
+ // Open Graph
$a->page['htmlhead'] .= ''."\n";
$a->page['htmlhead'] .= ''."\n";
- //
+ $a->page['htmlhead'] .= ''."\n";
$a->page['htmlhead'] .= ''."\n";
$a->page['htmlhead'] .= ''."\n";
$a->page['htmlhead'] .= ''."\n";
diff --git a/view/default.php b/view/default.php
index 792b2fbbc..78ca97ac9 100644
--- a/view/default.php
+++ b/view/default.php
@@ -1,5 +1,5 @@
-
+
From a0de28c4918d76e1e39b551e805d7929df3f1224 Mon Sep 17 00:00:00 2001
From: Michael Vogel
Date: Sun, 26 Jan 2014 09:59:20 +0100
Subject: [PATCH 2/2] oembed: Option to disallow displaying of "rich" content
and some beautification for titles that are only links
---
include/oembed.php | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/include/oembed.php b/include/oembed.php
index d598b41ce..982f659d8 100755
--- a/include/oembed.php
+++ b/include/oembed.php
@@ -82,7 +82,7 @@ function oembed_format_object($j){
$th=120; $tw = $th*$tr;
$tpl=get_markup_template('oembed_video.tpl');
$ret.=replace_macros($tpl, array(
- '$baseurl' => $a->get_baseurl(),
+ '$baseurl' => $a->get_baseurl(),
'$embedurl'=>$embedurl,
'$escapedhtml'=>base64_encode($jhtml),
'$tw'=>$tw,
@@ -105,16 +105,34 @@ function oembed_format_object($j){
}; break;
case "rich": {
// not so safe..
- $ret.= $jhtml;
+ if (!get_config("system","no_oembed_rich_content"))
+ $ret.= $jhtml;
}; break;
}
// add link to source if not present in "rich" type
if ($j->type!='rich' || !strpos($j->html,$embedurl) ){
- if (isset($j->provider_name)) $ret .= $j->provider_name.": ";
- $embedlink = (isset($j->title))?$j->title:$embedurl;
- $ret .= "$embedlink";
- if (isset($j->author_name)) $ret.=" (".$j->author_name.")";
+ if (isset($j->title)) {
+ if (isset($j->provider_name))
+ $ret .= $j->provider_name.": ";
+
+ $embedlink = (isset($j->title))?$j->title:$embedurl;
+ $ret .= "$embedlink";
+ if (isset($j->author_name))
+ $ret.=" (".$j->author_name.")";
+ } elseif (isset($j->provider_name) OR isset($j->author_name)) {
+ $embedlink = "";
+ if (isset($j->provider_name))
+ $embedlink .= $j->provider_name;
+
+ if (isset($j->author_name)) {
+ if ($embedlink != "")
+ $embedlink .= ": ";
+
+ $embedlink .= $j->author_name;
+ }
+ $ret .= "$embedlink";
+ }
//if (isset($j->author_name)) $ret.=" by ".$j->author_name;
//if (isset($j->provider_name)) $ret.=" on ".$j->provider_name;
} else {