diff options
-rw-r--r-- | Zotlabs/Lib/Apps.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Opensearch.php | 24 | ||||
-rwxr-xr-x | boot.php | 9 | ||||
-rw-r--r-- | doc/hooklist.bb | 3 | ||||
-rwxr-xr-x | include/plugin.php | 32 | ||||
-rwxr-xr-x | view/tpl/head.tpl | 4 | ||||
-rwxr-xr-x | view/tpl/opensearch.tpl | 13 |
7 files changed, 44 insertions, 43 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 4b95a9f5d..595cf33ee 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -159,6 +159,8 @@ class Apps { if(array_key_exists('version',$ret)) $ret['version'] = str_replace(array('\'','"'),array(''','&dquot;'),$ret['version']); + if(array_key_exists('categories',$ret)) + $ret['categories'] = str_replace(array('\'','"'),array(''','&dquot;'),$ret['categories']); if(array_key_exists('requires',$ret)) { $requires = explode(',',$ret['requires']); diff --git a/Zotlabs/Module/Opensearch.php b/Zotlabs/Module/Opensearch.php deleted file mode 100644 index 8e76038c9..000000000 --- a/Zotlabs/Module/Opensearch.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php -namespace Zotlabs\Module; - - -class Opensearch extends \Zotlabs\Web\Controller { - - function init() { - - $tpl = get_markup_template('opensearch.tpl'); - - header("Content-type: application/opensearchdescription+xml"); - - $o = replace_macros($tpl, array( - '$baseurl' => z_root(), - '$nodename' => \App::get_hostname(), - )); - - echo $o; - - killme(); - - } - -} @@ -802,6 +802,7 @@ class App { public static $identities; public static $css_sources = array(); public static $js_sources = array(); + public static $linkrel = array(); public static $theme_info = array(); public static $is_sys = false; public static $nav_sel; @@ -1164,6 +1165,11 @@ class App { self::$meta->set('generator', Zotlabs\Lib\System::get_platform_name()); + head_add_link(['rel' => 'shortcut icon', 'href' => head_get_icon()]); + + $x = [ 'header' => '' ]; + call_hooks('build_pagehead',$x); + /* put the head template at the beginning of page['htmlhead'] * since the code added by the modules frequently depends on it * being first @@ -1176,11 +1182,12 @@ class App { '$baseurl' => self::get_baseurl(), '$local_channel' => local_channel(), '$metas' => self::$meta->get(), + '$plugins' => $x['header'], '$update_interval' => $interval, 'osearch' => sprintf( t('Search %1$s (%2$s)','opensearch'), Zotlabs\Lib\System::get_site_name(), t('$Projectname','opensearch')), - '$icon' => head_get_icon(), '$head_css' => head_get_css(), '$head_js' => head_get_js(), + '$linkrel' => head_get_links(), '$js_strings' => js_strings(), '$zid' => get_my_address(), '$channel_id' => self::$profile['uid'], diff --git a/doc/hooklist.bb b/doc/hooklist.bb index 59d370117..5c78a2795 100644 --- a/doc/hooklist.bb +++ b/doc/hooklist.bb @@ -76,6 +76,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the [zrl=[baseurl]/help/hook/bb_translate_video]bb_translate_video[/zrl] Called when extracting embedded services from bbcode video elements (rarely used) +[zrl=[baseurl]/help/hook/build_pagehead]build_pagehead[/zrl] + Called when creating the HTML page header + [zrl=[baseurl]/help/hook/change_channel]change_channel[/zrl] Called when logging in to a channel (either during login or afterward through the channel manager) diff --git a/include/plugin.php b/include/plugin.php index 80c303b42..3a64f67cc 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -556,21 +556,47 @@ function head_add_css($src, $media = 'screen') { function head_remove_css($src, $media = 'screen') { $index = array_search(array($src, $media), App::$css_sources); - if ($index !== false) + if($index !== false) unset(App::$css_sources[$index]); } function head_get_css() { $str = ''; $sources = App::$css_sources; - if (count($sources)) { - foreach ($sources as $source) + if(count($sources)) { + foreach($sources as $source) $str .= format_css_if_exists($source); } return $str; } +function head_add_link($arr) { + if($arr) { + App::$linkrel[] = $arr; + } +} + +function head_get_links() { + $str = ''; + $sources = App::$linkrel; + if(count($sources)) { + foreach($sources as $source) { + if(is_array($source) && count($source)) { + $str .= '<link'; + foreach($source as $k => $v) { + $str .= ' ' . $k . '="' . $v . '"'; + } + $str .= ' />' . "\r\n"; + + } + } + } + + return $str; +} + + function format_css_if_exists($source) { $path_prefix = script_path() . '/'; diff --git a/view/tpl/head.tpl b/view/tpl/head.tpl index 7e7155fec..a300a702f 100755 --- a/view/tpl/head.tpl +++ b/view/tpl/head.tpl @@ -5,8 +5,8 @@ {{$head_css}} {{$js_strings}} {{$head_js}} -<link rel="shortcut icon" href="{{$icon}}" /> -<link rel="search" href="{{$baseurl}}/opensearch" type="application/opensearchdescription+xml" title="{{$osearch}}" /> +{{$linkrel}} +{{$plugins}} <link rel="EditURI" type="application/rsd+xml" href="{{$baseurl}}/rsd.xml" /> <script> var updateInterval = {{$update_interval}}; diff --git a/view/tpl/opensearch.tpl b/view/tpl/opensearch.tpl deleted file mode 100755 index f247e3401..000000000 --- a/view/tpl/opensearch.tpl +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> - <ShortName>Hubzilla@{{$nodename}}</ShortName> - <Description>Search in Hubzilla@{{$nodename}}</Description> - <Contact>http://github.com/redmatrix/hubzilla/</Contact> - <Image height="16" width="16" type="image/png">{{$baseurl}}/images/hz-16.png</Image> - <Image height="64" width="64" type="image/png">{{$baseurl}}/images/hz-64.png</Image> - <Url type="text/html" - template="{{$baseurl}}/search?search={searchTerms}"/> - <Url type="application/opensearchdescription+xml" - rel="self" - template="{{$baseurl}}/opensearch" /> -</OpenSearchDescription> |