diff options
author | M. Dent <dentm42@gmail.com> | 2018-09-22 10:44:51 +0200 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2018-09-22 10:44:51 +0200 |
commit | ed00d1b2e3895f5feb0767d1b002f7be08797379 (patch) | |
tree | 0e1d909710a7c7c21073ccd826acd2b1f5e6c03f | |
parent | 2b452ffbd370f52122577910a8b36846d526678d (diff) | |
download | volse-hubzilla-ed00d1b2e3895f5feb0767d1b002f7be08797379.tar.gz volse-hubzilla-ed00d1b2e3895f5feb0767d1b002f7be08797379.tar.bz2 volse-hubzilla-ed00d1b2e3895f5feb0767d1b002f7be08797379.zip |
Page meta properties
-rw-r--r-- | Zotlabs/Web/HttpMeta.php | 15 | ||||
-rwxr-xr-x | boot.php | 8 | ||||
-rw-r--r-- | doc/hook/page_meta.bb | 13 | ||||
-rw-r--r-- | doc/hooklist.bb | 3 |
4 files changed, 35 insertions, 4 deletions
diff --git a/Zotlabs/Web/HttpMeta.php b/Zotlabs/Web/HttpMeta.php index 469a9ed8b..ceaa82162 100644 --- a/Zotlabs/Web/HttpMeta.php +++ b/Zotlabs/Web/HttpMeta.php @@ -54,8 +54,19 @@ class HttpMeta { } } if($this->check_required()) { + $arrayproperties = [ 'og:image' ]; foreach($this->og as $k => $v) { - $o .= '<meta property="' . $k . '" content="' . urlencode($v) . '" />' . "\r\n" ; + if (in_array($k,$arrayproperties)) { + if (is_array($v)) { + foreach ($v as $v2) { + $o .= '<meta property="' . $k . '" content="' . $v2 . '" />' . "\r\n" ; + } + } else { + $o .= '<meta property="' . $k . '" content="' . $v . '" />' . "\r\n" ; + } + } else { + $o .= '<meta property="' . $k . '" content="' . $v . '" />' . "\r\n" ; + } } } if($o) @@ -63,4 +74,4 @@ class HttpMeta { return $o; } -}
\ No newline at end of file +} @@ -1119,8 +1119,12 @@ class App { if(! x(self::$page,'title')) self::$page['title'] = self::$config['system']['sitename']; - if(! self::$meta->get_field('og:title')) - self::$meta->set('og:title',self::$page['title']); + $pagemeta = [ 'og:title' => self::$page['title'] ]; + + call_hooks('page_meta',$pagemeta); + foreach ($pagemeta as $metaproperty => $metavalue) { + self::$meta->set($metaproperty,$metavalue); + } self::$meta->set('generator', Zotlabs\Lib\System::get_platform_name()); diff --git a/doc/hook/page_meta.bb b/doc/hook/page_meta.bb new file mode 100644 index 000000000..30a8f9440 --- /dev/null +++ b/doc/hook/page_meta.bb @@ -0,0 +1,13 @@ +[h2]page_meta[/h2] + +Called before generating the page header. + +[code] + $pagemeta = [ 'og:title' => self::$page['title'] ]; + + call_hooks('page_meta',$pagemeta); + foreach ($pagemeta as $metaproperty => $metavalue) { + self::$meta->set($metaproperty,$metavalue); + } + +[/code] diff --git a/doc/hooklist.bb b/doc/hooklist.bb index 1b48df6e6..d7fe633ba 100644 --- a/doc/hooklist.bb +++ b/doc/hooklist.bb @@ -451,6 +451,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the [zrl=[baseurl]/help/hook/page_header]page_header[/zrl] Called when generating the navigation bar +[zrl=[baseurl]/help/hook/page_header]page_meta[/zrl] + Called when generating the meta data in the page header. + [zrl=[baseurl]/help/hook/parse_atom]parse_atom[/zrl] Called when parsing an atom/RSS feed item |