]> git.mxchange.org Git - friendica.git/blobdiff - include/plugin.php
Bugfix: API: No extra encoding for the status text - makes it more compatible to...
[friendica.git] / include / plugin.php
index 3b6faa072a5071d93eb9b19f6232c575297a8ab1..ffa562273fb6b3ee8637148867abe8896aae5308 100644 (file)
@@ -353,4 +353,50 @@ function service_class_allows($uid,$property,$usage = false) {
                        return true;
                return (((intval($usage)) < intval($arr[$property])) ? true : false);
        }
-}
\ No newline at end of file
+}
+
+
+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');
+       if(! $l)
+               return '';
+       if($bbcode)
+               $t = sprintf('[url=%s]' . t('Click here to upgrade.') . '[/url]', $l);
+       else
+               $t = sprintf('<a href="%s">' . t('Click here to upgrade.') . '</div>', $l);
+       return $t;
+}
+
+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 : '') ;
+}