Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
This commit is contained in:
commit
4c0378eeae
@ -12,12 +12,12 @@ use \Michelf\MarkdownExtra;
|
|||||||
function get_help_fullpath($path,$suffix=null) {
|
function get_help_fullpath($path,$suffix=null) {
|
||||||
|
|
||||||
$docroot = (\App::$override_helproot) ? \App::$override_helproot : 'doc/';
|
$docroot = (\App::$override_helproot) ? \App::$override_helproot : 'doc/';
|
||||||
$docroot = (substr($docroot,-1)!='/') ? $docroot .= '/' : $docroot;
|
$docroot = (substr($docroot,-1)!='/') ? $docroot .= '/' : $docroot;
|
||||||
|
|
||||||
// Determine the language and modify the path accordingly
|
// Determine the language and modify the path accordingly
|
||||||
$x = determine_help_language();
|
$x = determine_help_language();
|
||||||
$lang = $x['language'];
|
$lang = $x['language'];
|
||||||
$url_idx = ($x['from_url'] ? 1 : 0);
|
|
||||||
// The English translation is at the root of /doc/. Other languages are in
|
// The English translation is at the root of /doc/. Other languages are in
|
||||||
// subfolders named by the language code such as "de", "es", etc.
|
// subfolders named by the language code such as "de", "es", etc.
|
||||||
if($lang !== 'en') {
|
if($lang !== 'en') {
|
||||||
@ -53,15 +53,14 @@ function get_help_fullpath($path,$suffix=null) {
|
|||||||
* @return string|unknown
|
* @return string|unknown
|
||||||
*/
|
*/
|
||||||
function get_help_content($tocpath = false) {
|
function get_help_content($tocpath = false) {
|
||||||
global $lang;
|
|
||||||
|
|
||||||
$doctype = 'markdown';
|
$doctype = 'markdown';
|
||||||
|
|
||||||
$text = '';
|
$text = '';
|
||||||
|
|
||||||
$path = (($tocpath !== false) ? $tocpath : '');
|
$path = (($tocpath !== false) ? $tocpath : '');
|
||||||
$docroot = (\App::$override_helproot) ? \App::$override_helproot : 'doc/';
|
$docroot = (\App::$override_helproot) ? \App::$override_helproot : 'doc/';
|
||||||
$docroot = (substr($docroot,-1)!='/') ? $docroot .= '/' : $docroot;
|
$docroot = (substr($docroot,-1)!='/') ? $docroot .= '/' : $docroot;
|
||||||
|
|
||||||
if($tocpath === false && argc() > 1) {
|
if($tocpath === false && argc() > 1) {
|
||||||
$path = '';
|
$path = '';
|
||||||
@ -74,7 +73,7 @@ function get_help_content($tocpath = false) {
|
|||||||
|
|
||||||
|
|
||||||
if($path) {
|
if($path) {
|
||||||
$fullpath = get_help_fullpath($path);
|
$fullpath = get_help_fullpath($path);
|
||||||
$title = basename($path);
|
$title = basename($path);
|
||||||
if(! $tocpath)
|
if(! $tocpath)
|
||||||
\App::$page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title)));
|
\App::$page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title)));
|
||||||
@ -88,10 +87,10 @@ function get_help_content($tocpath = false) {
|
|||||||
load_doc_file($fullpath . '.md') === '' &&
|
load_doc_file($fullpath . '.md') === '' &&
|
||||||
load_doc_file($fullpath . '.bb') === '' &&
|
load_doc_file($fullpath . '.bb') === '' &&
|
||||||
load_doc_file($fullpath . '.html') === ''
|
load_doc_file($fullpath . '.html') === ''
|
||||||
) {
|
) {
|
||||||
$path = $title;
|
$path = $title;
|
||||||
}
|
}
|
||||||
$fullpath = get_help_fullpath($path);
|
$fullpath = get_help_fullpath($path);
|
||||||
$text = load_doc_file($fullpath . '.md');
|
$text = load_doc_file($fullpath . '.md');
|
||||||
|
|
||||||
if(! $text) {
|
if(! $text) {
|
||||||
@ -111,15 +110,15 @@ function get_help_content($tocpath = false) {
|
|||||||
|
|
||||||
if($tocpath === false) {
|
if($tocpath === false) {
|
||||||
if(! $text) {
|
if(! $text) {
|
||||||
$path = 'Site';
|
$path = 'Site';
|
||||||
$fullpath = get_help_fullpath($path,'.md');
|
$fullpath = get_help_fullpath($path,'.md');
|
||||||
$text = load_doc_file($fullpath . '.md');
|
$text = load_doc_file($fullpath . '.md');
|
||||||
\App::$page['title'] = t('Help');
|
\App::$page['title'] = t('Help');
|
||||||
}
|
}
|
||||||
if(! $text) {
|
if(! $text) {
|
||||||
$doctype = 'bbcode';
|
$doctype = 'bbcode';
|
||||||
$path = 'main';
|
$path = 'main';
|
||||||
$fullpath = get_help_fullpath($path,'.md');
|
$fullpath = get_help_fullpath($path,'.md');
|
||||||
$text = load_doc_file($fullpath . '.bb');
|
$text = load_doc_file($fullpath . '.bb');
|
||||||
goaway('/help/about/about');
|
goaway('/help/about/about');
|
||||||
\App::$page['title'] = t('Help');
|
\App::$page['title'] = t('Help');
|
||||||
@ -219,7 +218,6 @@ function find_doc_file($s) {
|
|||||||
*/
|
*/
|
||||||
function search_doc_files($s) {
|
function search_doc_files($s) {
|
||||||
|
|
||||||
|
|
||||||
\App::set_pager_itemspage(60);
|
\App::set_pager_itemspage(60);
|
||||||
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
|
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
|
||||||
|
|
||||||
@ -351,7 +349,7 @@ function store_doc_file($s) {
|
|||||||
$x = item_store_update($item);
|
$x = item_store_update($item);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$item['uuid'] = $item_message_id();
|
$item['uuid'] = item_message_id();
|
||||||
$item['mid'] = $item['parent_mid'] = z_root() . '/item/' . $item['uuid'];
|
$item['mid'] = $item['parent_mid'] = z_root() . '/item/' . $item['uuid'];
|
||||||
$x = item_store($item);
|
$x = item_store($item);
|
||||||
}
|
}
|
||||||
|
@ -213,8 +213,8 @@ function reload_plugins() {
|
|||||||
try {
|
try {
|
||||||
$func();
|
$func();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
handleerrors_plugin($plugin,"","UNLOAD FAILED (uninstalling) : ".$e->getMessage(),true);
|
handleerrors_plugin($pl, '', 'UNLOAD FAILED (uninstalling) : ' . $e->getMessage(),true);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(function_exists($pl . '_load')) {
|
if(function_exists($pl . '_load')) {
|
||||||
@ -222,8 +222,8 @@ function reload_plugins() {
|
|||||||
try {
|
try {
|
||||||
$func();
|
$func();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
handleerrors_plugin($plugin,"","LOAD FAILED (uninstalling): ".$e->getMessage(),true);
|
handleerrors_plugin($pl, '', 'LOAD FAILED (uninstalling): ' . $e->getMessage(),true);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
q("UPDATE addon SET tstamp = %d WHERE id = %d",
|
q("UPDATE addon SET tstamp = %d WHERE id = %d",
|
||||||
@ -305,7 +305,7 @@ function plugins_sync() {
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function visible_plugin_list() {
|
function visible_plugin_list() {
|
||||||
|
|
||||||
$r = q("select * from addon where hidden = 0 order by aname asc");
|
$r = q("select * from addon where hidden = 0 order by aname asc");
|
||||||
$x = (($r) ? ids_to_array($r,'aname') : array());
|
$x = (($r) ? ids_to_array($r,'aname') : array());
|
||||||
$y = [];
|
$y = [];
|
||||||
@ -315,7 +315,7 @@ function visible_plugin_list() {
|
|||||||
$y[] = $xv;
|
$y[] = $xv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $y;
|
return $y;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,21 +456,21 @@ function insert_hook($hook, $fn, $version = 0, $priority = 0) {
|
|||||||
function call_hooks($name, &$data = null) {
|
function call_hooks($name, &$data = null) {
|
||||||
$a = 0;
|
$a = 0;
|
||||||
|
|
||||||
if (isset(App::$hooks[$name])) {
|
if (isset(App::$hooks[$name])) {
|
||||||
foreach(App::$hooks[$name] as $hook) {
|
foreach(App::$hooks[$name] as $hook) {
|
||||||
|
|
||||||
if ($name != 'permit_hook') { // avoid looping
|
if ($name != 'permit_hook') { // avoid looping
|
||||||
$checkhook = [
|
$checkhook = [
|
||||||
'name'=>$name,
|
'name'=>$name,
|
||||||
'hook'=>$hook,
|
'hook'=>$hook,
|
||||||
'data'=>$data,
|
'data'=>$data,
|
||||||
// Note: Since PHP uses COPY-ON-WRITE
|
// Note: Since PHP uses COPY-ON-WRITE
|
||||||
// for variables, there is no cost to
|
// for variables, there is no cost to
|
||||||
// passing the $data structure (unless
|
// passing the $data structure (unless
|
||||||
// the permit_hook processors change the
|
// the permit_hook processors change the
|
||||||
// information it contains.
|
// information it contains.
|
||||||
'permit'=>true
|
'permit'=>true
|
||||||
];
|
];
|
||||||
call_hooks('permit_hook',$checkhook);
|
call_hooks('permit_hook',$checkhook);
|
||||||
if (!$checkhook['permit']) {
|
if (!$checkhook['permit']) {
|
||||||
continue;
|
continue;
|
||||||
@ -618,7 +618,7 @@ function get_widget_info($widget){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! ($widget_found && $f))
|
if(! ($widget_found && $f))
|
||||||
return $info;
|
return $info;
|
||||||
|
|
||||||
$f = escape_tags($f);
|
$f = escape_tags($f);
|
||||||
@ -1041,7 +1041,7 @@ function get_intltext_template($s, $root = '') {
|
|||||||
if (isset(\App::$override_intltext_templates[$testroot][$s]["content"])) {
|
if (isset(\App::$override_intltext_templates[$testroot][$s]["content"])) {
|
||||||
return \App::$override_intltext_templates[$testroot][$s]["content"];
|
return \App::$override_intltext_templates[$testroot][$s]["content"];
|
||||||
} else {
|
} else {
|
||||||
if (isset(\App::$override_intltext_templates[$testroot][$s]["root"]) &&
|
if (isset(\App::$override_intltext_templates[$testroot][$s]["root"]) &&
|
||||||
isset(\App::$override_intltext_templates[$testroot][$s]["file"])) {
|
isset(\App::$override_intltext_templates[$testroot][$s]["file"])) {
|
||||||
$s = \App::$override_intltext_templates[$testroot][$s]["file"];
|
$s = \App::$override_intltext_templates[$testroot][$s]["file"];
|
||||||
$root = \App::$override_intltext_templates[$testroot][$s]["root"];
|
$root = \App::$override_intltext_templates[$testroot][$s]["root"];
|
||||||
@ -1058,30 +1058,30 @@ function get_intltext_template($s, $root = '') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function get_markup_template($s, $root = '') {
|
function get_markup_template($s, $root = '') {
|
||||||
$testroot = ($root=='') ? $testroot = "ROOT" : $root;
|
$testroot = ($root=='') ? $testroot = "ROOT" : $root;
|
||||||
|
|
||||||
$t = App::template_engine();
|
$t = App::template_engine();
|
||||||
|
|
||||||
if (isset(\App::$override_markup_templates[$testroot][$s]["content"])) {
|
if (isset(\App::$override_markup_templates[$testroot][$s]["content"])) {
|
||||||
return \App::$override_markup_templates[$testroot][$s]["content"];
|
return \App::$override_markup_templates[$testroot][$s]["content"];
|
||||||
} else {
|
} else {
|
||||||
if (isset(\App::$override_markup_templates[$testroot][$s]["root"]) &&
|
if (isset(\App::$override_markup_templates[$testroot][$s]["root"]) &&
|
||||||
isset(\App::$override_markup_templates[$testroot][$s]["file"])) {
|
isset(\App::$override_markup_templates[$testroot][$s]["file"])) {
|
||||||
$root = \App::$override_markup_templates[$testroot][$s]["root"];
|
$root = \App::$override_markup_templates[$testroot][$s]["root"];
|
||||||
$s = \App::$override_markup_templates[$testroot][$s]["file"];
|
$s = \App::$override_markup_templates[$testroot][$s]["file"];
|
||||||
$template = $t->get_markup_template($s, $root);
|
$template = $t->get_markup_template($s, $root);
|
||||||
} elseif (\App::$override_templateroot) {
|
} elseif (\App::$override_templateroot) {
|
||||||
$newroot = \App::$override_templateroot;
|
$newroot = \App::$override_templateroot;
|
||||||
if ($newroot != '' && substr($newroot,-1) != '/' ) {
|
if ($newroot != '' && substr($newroot,-1) != '/' ) {
|
||||||
$newroot .= '/';
|
$newroot .= '/';
|
||||||
}
|
}
|
||||||
$newroot .= $root;
|
$newroot .= $root;
|
||||||
$template = $t->get_markup_template($s, $newroot);
|
$template = $t->get_markup_template($s, $newroot);
|
||||||
} else {
|
} else {
|
||||||
$template = $t->get_markup_template($s, $root);
|
$template = $t->get_markup_template($s, $root);
|
||||||
}
|
}
|
||||||
return $template;
|
return $template;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user