X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fplugin.php;h=db3224f29658ff2a1fe1ca8e302388ab77e353b3;hb=c22f65bafa08ea348d55fb1f3c05774b0f320c99;hp=d762e8717f7067e2b0a5f609a26d8a35ca7e7b61;hpb=94f895e98df73efe32a7c986a4b7844b0ab8fc01;p=friendica.git
diff --git a/include/plugin.php b/include/plugin.php
index d762e8717f..db3224f296 100644
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -8,7 +8,7 @@ function uninstall_plugin($plugin){
q("DELETE FROM `addon` WHERE `name` = '%s' ",
dbesc($plugin)
);
-
+
@include_once('addon/' . $plugin . '/' . $plugin . '.php');
if(function_exists($plugin . '_uninstall')) {
$func = $plugin . '_uninstall';
@@ -18,7 +18,6 @@ function uninstall_plugin($plugin){
if (! function_exists('install_plugin')){
function install_plugin($plugin) {
-
// silently fail if plugin was removed
if(! file_exists('addon/' . $plugin . '/' . $plugin . '.php'))
@@ -77,7 +76,7 @@ function reload_plugins() {
$pl = trim($pl);
$fname = 'addon/' . $pl . '/' . $pl . '.php';
-
+
if(file_exists($fname)) {
$t = @filemtime($fname);
foreach($installed as $i) {
@@ -111,7 +110,7 @@ function reload_plugins() {
if(! function_exists('register_hook')) {
-function register_hook($hook,$file,$function) {
+function register_hook($hook,$file,$function,$priority=0) {
$r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `function` = '%s' LIMIT 1",
dbesc($hook),
@@ -121,10 +120,11 @@ function register_hook($hook,$file,$function) {
if(count($r))
return true;
- $r = q("INSERT INTO `hook` (`hook`, `file`, `function`) VALUES ( '%s', '%s', '%s' ) ",
+ $r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`) VALUES ( '%s', '%s', '%s', '%s' ) ",
dbesc($hook),
dbesc($file),
- dbesc($function)
+ dbesc($function),
+ dbesc($priority)
);
return $r;
}}
@@ -145,7 +145,7 @@ if(! function_exists('load_hooks')) {
function load_hooks() {
$a = get_app();
$a->hooks = array();
- $r = q("SELECT * FROM `hook` WHERE 1");
+ $r = q("SELECT * FROM `hook` WHERE 1 ORDER BY `priority` DESC");
if(count($r)) {
foreach($r as $rr) {
if(! array_key_exists($rr['hook'],$a->hooks))
@@ -255,6 +255,7 @@ function get_theme_info($theme){
'author' => array(),
'maintainer' => array(),
'version' => "",
+ 'credits' => "",
'experimental' => false,
'unsupported' => false
);
@@ -380,20 +381,23 @@ function service_class_fetch($uid,$property) {
}
-function upgrade_link() {
+function upgrade_link($bbcode = false) {
$l = get_config('service_class','upgrade_link');
- $t = sprintf('' . t('Click here to upgrade.') . '', $l);
- if($l)
- return $t;
- return '';
+ if(! $l)
+ return '';
+ if($bbcode)
+ $t = sprintf('[url=%s]' . t('Click here to upgrade.') . '[/url]', $l);
+ else
+ $t = sprintf('' . t('Click here to upgrade.') . '', $l);
+ return $t;
}
-function upgrade_message() {
- $x = upgrade_link();
+function upgrade_message($bbcode = false) {
+ $x = upgrade_link($bbcode);
return t('This action exceeds the limits set by your subscription plan.') . (($x) ? ' ' . $x : '') ;
}
-function upgrade_bool_message() {
- $x = upgrade_link();
+function upgrade_bool_message($bbcode = false) {
+ $x = upgrade_link($bbcode);
return t('This action is not available under your subscription plan.') . (($x) ? ' ' . $x : '') ;
}