aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-03-15 20:11:28 -0700
committerMario Vavti <mario@mariovavti.com>2017-03-29 11:50:03 +0200
commitf60309efa12be3b8d4f5b2c565ebdf7f051a987d (patch)
tree3e5669efa5d3842e7127aa486bb59568be5930f6
parent47f4007951ce3311ee267a863a2cc46085c4892a (diff)
downloadvolse-hubzilla-f60309efa12be3b8d4f5b2c565ebdf7f051a987d.tar.gz
volse-hubzilla-f60309efa12be3b8d4f5b2c565ebdf7f051a987d.tar.bz2
volse-hubzilla-f60309efa12be3b8d4f5b2c565ebdf7f051a987d.zip
more widget migrations
-rw-r--r--Zotlabs/Widget/Appcategories.php49
-rw-r--r--Zotlabs/Widget/Appcloud.php13
-rw-r--r--Zotlabs/Widget/Categories.php22
-rw-r--r--Zotlabs/Widget/Shortprofile.php18
-rw-r--r--include/widgets.php73
5 files changed, 102 insertions, 73 deletions
diff --git a/Zotlabs/Widget/Appcategories.php b/Zotlabs/Widget/Appcategories.php
new file mode 100644
index 000000000..490ec1abc
--- /dev/null
+++ b/Zotlabs/Widget/Appcategories.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+class Appcategories {
+
+ function widget($arr) {
+
+ if(! local_channel())
+ return '';
+
+ $selected = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat'],ENT_COMPAT,'UTF-8') : '');
+
+ // @FIXME ??? $srchurl undefined here - commented out until is reviewed
+ //$srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&');
+ //$srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl);
+
+ // Leaving this line which negates the effect of the two invalid lines prior
+ $srchurl = z_root() . '/apps';
+
+ $terms = array();
+
+ $r = q("select distinct(term.term)
+ from term join app on term.oid = app.id
+ where app_channel = %d
+ and term.uid = app_channel
+ and term.otype = %d
+ and term.term != 'nav_featured_app'
+ order by term.term asc",
+ intval(local_channel()),
+ intval(TERM_OBJ_APP)
+ );
+
+ if($r) {
+ foreach($r as $rr)
+ $terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : ''));
+
+ return replace_macros(get_markup_template('categories_widget.tpl'),array(
+ '$title' => t('Categories'),
+ '$desc' => '',
+ '$sel_all' => (($selected == '') ? 'selected' : ''),
+ '$all' => t('Everything'),
+ '$terms' => $terms,
+ '$base' => $srchurl,
+
+ ));
+ }
+ }
+}
diff --git a/Zotlabs/Widget/Appcloud.php b/Zotlabs/Widget/Appcloud.php
new file mode 100644
index 000000000..2a4671eee
--- /dev/null
+++ b/Zotlabs/Widget/Appcloud.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+class Appcloud {
+
+ function widget($arr) {
+ if(! local_channel())
+ return '';
+ return app_tagblock(z_root() . '/apps');
+ }
+}
+
diff --git a/Zotlabs/Widget/Categories.php b/Zotlabs/Widget/Categories.php
new file mode 100644
index 000000000..82fffccc8
--- /dev/null
+++ b/Zotlabs/Widget/Categories.php
@@ -0,0 +1,22 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+
+class Categories {
+
+ function widget($arr) {
+
+ if((! \App::$profile['profile_uid'])
+ || (! perm_is_allowed(\App::$profile['profile_uid'],get_observer_hash(),'view_stream'))) {
+ return '';
+ }
+
+ $cat = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat'],ENT_COMPAT,'UTF-8') : '');
+ $srchurl = \App::$query_string;
+ $srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&');
+ $srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl);
+
+ return categories_widget($srchurl, $cat);
+ }
+}
diff --git a/Zotlabs/Widget/Shortprofile.php b/Zotlabs/Widget/Shortprofile.php
new file mode 100644
index 000000000..9c2a46e75
--- /dev/null
+++ b/Zotlabs/Widget/Shortprofile.php
@@ -0,0 +1,18 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+class Shortprofile {
+
+ function widget($arr) {
+
+ if(! \App::$profile['profile_uid'])
+ return;
+
+ $block = observer_prohibited();
+
+ return profile_sidebar(\App::$profile, $block, true, true);
+ }
+
+}
+
diff --git a/include/widgets.php b/include/widgets.php
index 3ede4df70..86657fba6 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -13,82 +13,9 @@ require_once('include/attach.php');
-function widget_shortprofile($arr) {
- if(! App::$profile['profile_uid'])
- return;
-
- $block = observer_prohibited();
-
- return profile_sidebar(App::$profile, $block, true, true);
-}
-
-
-function widget_categories($arr) {
-
-
- if(App::$profile['profile_uid'] && (! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'view_stream')))
- return '';
-
- $cat = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat'],ENT_COMPAT,'UTF-8') : '');
- $srchurl = App::$query_string;
- $srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&');
- $srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl);
-
- return categories_widget($srchurl, $cat);
-
-}
-
-function widget_appcategories($arr) {
-
- if(! local_channel())
- return '';
-
- $selected = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat'],ENT_COMPAT,'UTF-8') : '');
- $srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&');
- $srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl);
- $srchurl = z_root() . '/apps';
-
- $terms = array();
-
- $r = q("select distinct(term.term)
- from term join app on term.oid = app.id
- where app_channel = %d
- and term.uid = app_channel
- and term.otype = %d
- and term.term != 'nav_featured_app'
- order by term.term asc",
- intval(local_channel()),
- intval(TERM_OBJ_APP)
- );
- if($r) {
- foreach($r as $rr)
- $terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : ''));
-
- return replace_macros(get_markup_template('categories_widget.tpl'),array(
- '$title' => t('Categories'),
- '$desc' => '',
- '$sel_all' => (($selected == '') ? 'selected' : ''),
- '$all' => t('Everything'),
- '$terms' => $terms,
- '$base' => $srchurl,
-
- ));
- }
-
-
-
-}
-
-
-
-function widget_appcloud($arr) {
- if(! local_channel())
- return '';
- return app_tagblock(z_root() . '/apps');
-}
function widget_tagcloud_wall($arr) {