X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fplugin.php;h=8f6d6ea9858ee03fc9855e2c47811e1fd5aee31f;hb=7c5f5f3113067c5259f8c47467b9d5d2aa11b185;hp=89715485ee63be69a0ec41694795bb4bf012ae9b;hpb=ad6c82bdea11e4c35284e18608f78ad4c355405d;p=friendica.git
diff --git a/include/plugin.php b/include/plugin.php
index 89715485ee..8f6d6ea985 100644
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -111,7 +111,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 +121,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 +146,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 +256,7 @@ function get_theme_info($theme){
'author' => array(),
'maintainer' => array(),
'version' => "",
+ 'credits' => "",
'experimental' => false,
'unsupported' => false
);
@@ -355,15 +357,48 @@ function service_class_allows($uid,$property,$usage = false) {
}
}
-function upgrade_link() {
+
+function service_class_fetch($uid,$property) {
+
+ if($uid == local_user()) {
+ $service_class = $a->user['service_class'];
+ }
+ else {
+ $r = q("select service_class from user where uid = %d limit 1",
+ intval($uid)
+ );
+ if($r !== false and count($r)) {
+ $service_class = $r[0]['service_class'];
+ }
+ }
+ if(! x($service_class))
+ return false; // everything is allowed
+
+ $arr = get_config('service_class',$service_class);
+ if(! is_array($arr) || (! count($arr)))
+ return false;
+
+ return((array_key_exists($property,$arr)) ? $arr[$property] : false);
+
+}
+
+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($bbcode = false) {
+ $x = upgrade_link($bbcode);
+ return t('This action is not available under your subscription plan.') . (($x) ? ' ' . $x : '') ;
+}