move opensearch to plugins
This commit is contained in:
parent
e2ee565f05
commit
2daafe80a5
@ -159,6 +159,8 @@ class Apps {
|
|||||||
if(array_key_exists('version',$ret))
|
if(array_key_exists('version',$ret))
|
||||||
$ret['version'] = str_replace(array('\'','"'),array(''','&dquot;'),$ret['version']);
|
$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)) {
|
if(array_key_exists('requires',$ret)) {
|
||||||
$requires = explode(',',$ret['requires']);
|
$requires = explode(',',$ret['requires']);
|
||||||
|
@ -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();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
9
boot.php
9
boot.php
@ -802,6 +802,7 @@ class App {
|
|||||||
public static $identities;
|
public static $identities;
|
||||||
public static $css_sources = array();
|
public static $css_sources = array();
|
||||||
public static $js_sources = array();
|
public static $js_sources = array();
|
||||||
|
public static $linkrel = array();
|
||||||
public static $theme_info = array();
|
public static $theme_info = array();
|
||||||
public static $is_sys = false;
|
public static $is_sys = false;
|
||||||
public static $nav_sel;
|
public static $nav_sel;
|
||||||
@ -1164,6 +1165,11 @@ class App {
|
|||||||
|
|
||||||
self::$meta->set('generator', Zotlabs\Lib\System::get_platform_name());
|
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']
|
/* put the head template at the beginning of page['htmlhead']
|
||||||
* since the code added by the modules frequently depends on it
|
* since the code added by the modules frequently depends on it
|
||||||
* being first
|
* being first
|
||||||
@ -1176,11 +1182,12 @@ class App {
|
|||||||
'$baseurl' => self::get_baseurl(),
|
'$baseurl' => self::get_baseurl(),
|
||||||
'$local_channel' => local_channel(),
|
'$local_channel' => local_channel(),
|
||||||
'$metas' => self::$meta->get(),
|
'$metas' => self::$meta->get(),
|
||||||
|
'$plugins' => $x['header'],
|
||||||
'$update_interval' => $interval,
|
'$update_interval' => $interval,
|
||||||
'osearch' => sprintf( t('Search %1$s (%2$s)','opensearch'), Zotlabs\Lib\System::get_site_name(), t('$Projectname','opensearch')),
|
'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_css' => head_get_css(),
|
||||||
'$head_js' => head_get_js(),
|
'$head_js' => head_get_js(),
|
||||||
|
'$linkrel' => head_get_links(),
|
||||||
'$js_strings' => js_strings(),
|
'$js_strings' => js_strings(),
|
||||||
'$zid' => get_my_address(),
|
'$zid' => get_my_address(),
|
||||||
'$channel_id' => self::$profile['uid'],
|
'$channel_id' => self::$profile['uid'],
|
||||||
|
@ -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]
|
[zrl=[baseurl]/help/hook/bb_translate_video]bb_translate_video[/zrl]
|
||||||
Called when extracting embedded services from bbcode video elements (rarely used)
|
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]
|
[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)
|
Called when logging in to a channel (either during login or afterward through the channel manager)
|
||||||
|
|
||||||
|
@ -556,21 +556,47 @@ function head_add_css($src, $media = 'screen') {
|
|||||||
function head_remove_css($src, $media = 'screen') {
|
function head_remove_css($src, $media = 'screen') {
|
||||||
|
|
||||||
$index = array_search(array($src, $media), App::$css_sources);
|
$index = array_search(array($src, $media), App::$css_sources);
|
||||||
if ($index !== false)
|
if($index !== false)
|
||||||
unset(App::$css_sources[$index]);
|
unset(App::$css_sources[$index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function head_get_css() {
|
function head_get_css() {
|
||||||
$str = '';
|
$str = '';
|
||||||
$sources = App::$css_sources;
|
$sources = App::$css_sources;
|
||||||
if (count($sources)) {
|
if(count($sources)) {
|
||||||
foreach ($sources as $source)
|
foreach($sources as $source)
|
||||||
$str .= format_css_if_exists($source);
|
$str .= format_css_if_exists($source);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $str;
|
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) {
|
function format_css_if_exists($source) {
|
||||||
$path_prefix = script_path() . '/';
|
$path_prefix = script_path() . '/';
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
{{$head_css}}
|
{{$head_css}}
|
||||||
{{$js_strings}}
|
{{$js_strings}}
|
||||||
{{$head_js}}
|
{{$head_js}}
|
||||||
<link rel="shortcut icon" href="{{$icon}}" />
|
{{$linkrel}}
|
||||||
<link rel="search" href="{{$baseurl}}/opensearch" type="application/opensearchdescription+xml" title="{{$osearch}}" />
|
{{$plugins}}
|
||||||
<link rel="EditURI" type="application/rsd+xml" href="{{$baseurl}}/rsd.xml" />
|
<link rel="EditURI" type="application/rsd+xml" href="{{$baseurl}}/rsd.xml" />
|
||||||
<script>
|
<script>
|
||||||
var updateInterval = {{$update_interval}};
|
var updateInterval = {{$update_interval}};
|
||||||
|
@ -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>
|
|
Reference in New Issue
Block a user