aboutsummaryrefslogtreecommitdiffstats
path: root/include/plugin.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/plugin.php')
-rw-r--r--include/plugin.php40
1 files changed, 22 insertions, 18 deletions
diff --git a/include/plugin.php b/include/plugin.php
index bbfeab988..b5f9959b9 100644
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -5,6 +5,7 @@
* @brief Some functions to handle addons and themes.
*/
+use Zotlabs\Lib\Config;
/**
* @brief Handle errors in plugin calls.
@@ -25,7 +26,7 @@ function handleerrors_plugin($plugin, $notice, $log, $uninstall = false){
$idx = array_search($plugin, \App::$plugins);
unset(\App::$plugins[$idx]);
uninstall_plugin($plugin);
- set_config("system", "addon", implode(", ", \App::$plugins));
+ Config::Set("system", "addon", implode(", ", \App::$plugins));
}
}
@@ -187,7 +188,7 @@ function plugin_is_installed($name) {
* @brief Reload all updated plugins.
*/
function reload_plugins() {
- $plugins = get_config('system', 'addon');
+ $plugins = Config::Get('system', 'addon');
if(strlen($plugins)) {
$r = dbq("SELECT * FROM addon WHERE installed = 1");
if($r)
@@ -266,7 +267,7 @@ function plugins_sync() {
$installed = plugins_installed_list();
- $plugins = get_config('system', 'addon', '');
+ $plugins = Config::Get('system', 'addon', '');
$plugins_arr = explode(',', $plugins);
@@ -487,18 +488,19 @@ function call_hooks($name, &$data = null) {
@include_once($hook[0]);
}
- if(preg_match('|^a:[0-9]+:{.*}$|s', $hook[1])) {
- $hook[1] = unserialize($hook[1]);
- }
- elseif(strpos($hook[1],'::')) {
- // We shouldn't need to do this, but it appears that PHP
- // isn't able to directly execute a string variable with a class
- // method in the manner we are attempting it, so we'll
- // turn it into an array.
- $hook[1] = explode('::',$hook[1]);
+ if(is_string($hook[1])) {
+ if (preg_match('|^a:[0-9]+:{.*}$|s', $hook[1])) {
+ $hook[1] = unserialize($hook[1]);
+ }
+ elseif(strpos($hook[1],'::')) {
+ // We shouldn't need to do this, but it appears that PHP
+ // isn't able to directly execute a string variable with a class
+ // method in the manner we are attempting it, so we'll
+ // turn it into an array.
+ $hook[1] = explode('::',$hook[1]);
+ }
}
-
if(is_callable($hook[1])) {
$func = $hook[1];
$func($data);
@@ -719,7 +721,7 @@ function check_plugin_versions($info) {
continue;
if(strpos($test,'.')) {
$conf = explode('.',$test);
- if(get_config(trim($conf[0]),trim($conf[1])))
+ if(Config::Get(trim($conf[0]),trim($conf[1])))
return true;
else
return false;
@@ -985,12 +987,13 @@ function format_css_if_exists($source) {
}
} else {
// It's a file from the theme
- $path = theme_include($script);
+ $theme_include = theme_include($script);
+ $path = (($theme_include) ? '/' . $theme_include : '');
}
if($path) {
$qstring = ((parse_url($path, PHP_URL_QUERY)) ? '&' : '?') . 'v=' . STD_VERSION;
- return '<link rel="stylesheet" href="' . $path_prefix . '/' . $path . $qstring . '" type="text/css" media="' . $source[1] . '">' . "\r\n";
+ return '<link rel="stylesheet" href="' . $path_prefix . $path . $qstring . '" type="text/css" media="' . $source[1] . '">' . "\r\n";
}
}
@@ -1057,11 +1060,12 @@ function format_js_if_exists($source) {
}
else {
// It's a file from the theme
- $path = theme_include($source);
+ $theme_include = theme_include($source);
+ $path = (($theme_include) ? '/' . $theme_include : '');
}
if($path) {
$qstring = ((parse_url($path, PHP_URL_QUERY)) ? '&' : '?') . 'v=' . STD_VERSION;
- return '<script src="' . $path_prefix . '/' . $path . $qstring . '" ></script>' . "\r\n" ;
+ return '<script src="' . $path_prefix . $path . $qstring . '"></script>' . "\r\n" ;
}
}