Rename functions and calls

Rename functions and update calls
This commit is contained in:
Adam Magness 2018-01-15 09:50:06 -05:00
parent 0409aae719
commit 6cf6029ff5
10 changed files with 73 additions and 48 deletions

View File

@ -4,12 +4,12 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Content\Feature; use Friendica\Content\Feature;
use Friendica\Content\Widget;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\GContact; use Friendica\Model\GContact;
require_once "include/contact_widgets.php";
require_once "mod/proxy.php"; require_once "mod/proxy.php";
/** /**
@ -425,7 +425,7 @@ function acl_lookup(App $a, $out_type = 'json')
$group_count = 0; $group_count = 0;
} }
$sql_extra2 .= " ".unavailable_networks(); $sql_extra2 .= " ".Widget::unavailableNetworks();
if ($type == '' || $type == 'c') { if ($type == '' || $type == 'c') {
// autocomplete for editor mentions // autocomplete for editor mentions

View File

@ -4,6 +4,7 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Content\ContactSelector; use Friendica\Content\ContactSelector;
use Friendica\Content\Widget;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -13,7 +14,6 @@ use Friendica\Model\Group;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Network\Probe; use Friendica\Network\Probe;
require_once 'include/contact_widgets.php';
require_once 'mod/proxy.php'; require_once 'mod/proxy.php';
function contacts_init(App $a) function contacts_init(App $a)
@ -63,14 +63,14 @@ function contacts_init(App $a)
$networks_widget = ''; $networks_widget = '';
} else { } else {
$vcard_widget = ''; $vcard_widget = '';
$networks_widget = networks_widget('contacts', $nets); $networks_widget = Widget::networks('contacts', $nets);
if (isset($_GET['add'])) { if (isset($_GET['add'])) {
$follow_widget = follow_widget($_GET['add']); $follow_widget = Widget::follow($_GET['add']);
} else { } else {
$follow_widget = follow_widget(); $follow_widget = Widget::follow();
} }
$findpeople_widget = findpeople_widget(); $findpeople_widget = Widget::findPeople();
} }
$groups_widget = Group::sidebarWidget('contacts', 'group', 'full', 0, $contact_id); $groups_widget = Group::sidebarWidget('contacts', 'group', 'full', 0, $contact_id);
@ -781,7 +781,7 @@ function contacts_content(App $a)
$total = $r[0]['total']; $total = $r[0]['total'];
} }
$sql_extra3 = unavailable_networks(); $sql_extra3 = Widget::unavailableNetworks();
$contacts = array(); $contacts = array();

View File

@ -3,6 +3,7 @@
* @file mod/directory.php * @file mod/directory.php
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Content\Widget;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -12,13 +13,10 @@ function directory_init(App $a) {
$a->set_pager_itemspage(60); $a->set_pager_itemspage(60);
if(local_user()) { if(local_user()) {
require_once('include/contact_widgets.php'); $a->page['aside'] .= Widget::findPeople();
$a->page['aside'] .= findpeople_widget(); $a->page['aside'] .= Widget::follow();
} else {
$a->page['aside'] .= follow_widget();
}
else {
unset($_SESSION['theme']); unset($_SESSION['theme']);
unset($_SESSION['mobile-theme']); unset($_SESSION['mobile-theme']);
} }

View File

@ -4,6 +4,7 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Content\ContactSelector; use Friendica\Content\ContactSelector;
use Friendica\Content\Widget;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
@ -13,7 +14,6 @@ use Friendica\Model\Profile;
use Friendica\Network\Probe; use Friendica\Network\Probe;
use Friendica\Protocol\PortableContact; use Friendica\Protocol\PortableContact;
require_once 'include/contact_widgets.php';
require_once 'mod/contacts.php'; require_once 'mod/contacts.php';
function dirfind_init(App $a) { function dirfind_init(App $a) {
@ -27,9 +27,9 @@ function dirfind_init(App $a) {
$a->page['aside'] = ''; $a->page['aside'] = '';
} }
$a->page['aside'] .= findpeople_widget(); $a->page['aside'] .= Widget::findPeople();
$a->page['aside'] .= follow_widget(); $a->page['aside'] .= Widget::follow();
} }
function dirfind_content(App $a, $prefix = "") { function dirfind_content(App $a, $prefix = "") {

View File

@ -3,6 +3,7 @@
* @file mod/match.php * @file mod/match.php
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Content\Widget;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -10,7 +11,6 @@ use Friendica\Model\Contact;
use Friendica\Model\Profile; use Friendica\Model\Profile;
require_once 'include/text.php'; require_once 'include/text.php';
require_once 'include/contact_widgets.php';
require_once 'mod/proxy.php'; require_once 'mod/proxy.php';
/** /**
@ -30,8 +30,8 @@ function match_content(App $a)
return; return;
} }
$a->page['aside'] .= findpeople_widget(); $a->page['aside'] .= Widget::findPeople();
$a->page['aside'] .= follow_widget(); $a->page['aside'] .= Widget::follow();
$_SESSION['return_url'] = System::baseUrl() . '/' . $a->cmd; $_SESSION['return_url'] = System::baseUrl() . '/' . $a->cmd;

View File

@ -5,6 +5,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Feature; use Friendica\Content\Feature;
use Friendica\Content\ForumManager; use Friendica\Content\ForumManager;
use Friendica\Content\Widget;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
@ -15,7 +16,6 @@ use Friendica\Model\Profile;
use Friendica\Module\Login; use Friendica\Module\Login;
require_once 'include/conversation.php'; require_once 'include/conversation.php';
require_once 'include/contact_widgets.php';
require_once 'include/items.php'; require_once 'include/items.php';
require_once 'include/acl_selectors.php'; require_once 'include/acl_selectors.php';
@ -159,12 +159,12 @@ function network_init(App $a) {
$a->page['aside'] = ''; $a->page['aside'] = '';
} }
$a->page['aside'] .= (Feature::isEnabled(local_user(),'groups') ? Group::sidebarWidget('network/0','network','standard',$group_id) : ''); $a->page['aside'] .= (Feature::isEnabled(local_user(), 'groups') ? Group::sidebarWidget('network/0', 'network', 'standard', $group_id) : '');
$a->page['aside'] .= (Feature::isEnabled(local_user(), 'forumlist_widget') ? ForumManager::widget(local_user(), $cid) : ''); $a->page['aside'] .= (Feature::isEnabled(local_user(), 'forumlist_widget') ? ForumManager::widget(local_user(), $cid) : '');
$a->page['aside'] .= posted_date_widget('network',local_user(),false); $a->page['aside'] .= posted_date_widget('network', local_user(),false);
$a->page['aside'] .= networks_widget('network',(x($_GET, 'nets') ? $_GET['nets'] : '')); $a->page['aside'] .= Widget::networks('network', (x($_GET, 'nets') ? $_GET['nets'] : ''));
$a->page['aside'] .= saved_searches($search); $a->page['aside'] .= saved_searches($search);
$a->page['aside'] .= fileas_widget('network',(x($_GET, 'file') ? $_GET['file'] : '')); $a->page['aside'] .= Widget::fileAs('network', (x($_GET, 'file') ? $_GET['file'] : ''));
} }
function saved_searches($search) { function saved_searches($search) {

View File

@ -3,6 +3,7 @@
* @file mod/profile.php * @file mod/profile.php
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Content\Widget;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
@ -12,8 +13,6 @@ use Friendica\Model\Profile;
use Friendica\Module\Login; use Friendica\Module\Login;
use Friendica\Protocol\DFRN; use Friendica\Protocol\DFRN;
require_once 'include/contact_widgets.php';
function profile_init(App $a) function profile_init(App $a)
{ {
if (!x($a->page, 'aside')) { if (!x($a->page, 'aside')) {
@ -184,7 +183,7 @@ function profile_content(App $a, $update = 0)
return $o; return $o;
} }
$o .= common_friends_visitor_widget($a->profile['profile_uid']); $o .= Widget::commonFriendsVisitor($a->profile['profile_uid']);
if (x($_SESSION, 'new_member') && $is_owner) { if (x($_SESSION, 'new_member') && $is_owner) {
$o .= '<a href="newmember" id="newmember-tips" style="font-size: 1.2em;"><b>' . t('Tips for New Members') . '</b></a>' . EOL; $o .= '<a href="newmember" id="newmember-tips" style="font-size: 1.2em;"><b>' . t('Tips for New Members') . '</b></a>' . EOL;
@ -194,7 +193,7 @@ function profile_content(App $a, $update = 0)
$commvisitor = $commpage && $remote_contact; $commvisitor = $commpage && $remote_contact;
$a->page['aside'] .= posted_date_widget(System::baseUrl(true) . '/profile/' . $a->profile['nickname'], $a->profile['profile_uid'], true); $a->page['aside'] .= posted_date_widget(System::baseUrl(true) . '/profile/' . $a->profile['nickname'], $a->profile['profile_uid'], true);
$a->page['aside'] .= categories_widget(System::baseUrl(true) . '/profile/' . $a->profile['nickname'], (x($category) ? xmlify($category) : '')); $a->page['aside'] .= Widget::categories(System::baseUrl(true) . '/profile/' . $a->profile['nickname'], (x($category) ? xmlify($category) : ''));
$a->page['aside'] .= tagcloud_wall_widget(); $a->page['aside'] .= tagcloud_wall_widget();
if (can_write_wall($a->profile['profile_uid'])) { if (can_write_wall($a->profile['profile_uid'])) {

View File

@ -4,14 +4,13 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Content\ContactSelector; use Friendica\Content\ContactSelector;
use Friendica\Content\Widget;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\GContact; use Friendica\Model\GContact;
use Friendica\Model\Profile; use Friendica\Model\Profile;
require_once 'include/contact_widgets.php';
function suggest_init(App $a) { function suggest_init(App $a) {
if (! local_user()) { if (! local_user()) {
return; return;
@ -51,10 +50,6 @@ function suggest_init(App $a) {
} }
function suggest_content(App $a) { function suggest_content(App $a) {
require_once("mod/proxy.php"); require_once("mod/proxy.php");
@ -67,8 +62,8 @@ function suggest_content(App $a) {
$_SESSION['return_url'] = System::baseUrl() . '/' . $a->cmd; $_SESSION['return_url'] = System::baseUrl() . '/' . $a->cmd;
$a->page['aside'] .= findpeople_widget(); $a->page['aside'] .= Widget::findPeople();
$a->page['aside'] .= follow_widget(); $a->page['aside'] .= Widget::follow();
$r = GContact::suggestionQuery(local_user()); $r = GContact::suggestionQuery(local_user());

View File

@ -17,7 +17,12 @@ require_once 'boot.php';
class Widget class Widget
{ {
function follow_widget($value = "") /**
* Return the follow widget
*
* @param string $value optional, default empty
*/
public static function follow($value = "")
{ {
return replace_macros(get_markup_template('follow.tpl'), array( return replace_macros(get_markup_template('follow.tpl'), array(
'$connect' => t('Add New Contact'), '$connect' => t('Add New Contact'),
@ -28,7 +33,10 @@ class Widget
)); ));
} }
function findpeople_widget() /**
* Return Find People widget
*/
public static function findPeople()
{ {
$a = get_app(); $a = get_app();
$global_dir = Config::get('system', 'directory'); $global_dir = Config::get('system', 'directory');
@ -57,7 +65,10 @@ class Widget
)); ));
} }
function unavailable_networks() /**
* Return unavailable networks
*/
public static function unavailableNetworks()
{ {
$networks = array(); $networks = array();
@ -104,7 +115,13 @@ class Widget
return $network_filter; return $network_filter;
} }
function networks_widget($baseurl, $selected = '') /**
* Return networks widget
*
* @param string $baseurl baseurl
* @param string $selected optional, default empty
*/
public static function networks($baseurl, $selected = '')
{ {
if (!local_user()) { if (!local_user()) {
return ''; return '';
@ -114,7 +131,7 @@ class Widget
return ''; return '';
} }
$extra_sql = unavailable_networks(); $extra_sql = self::unavailableNetworks();
$r = dba::p("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = ? AND `network` != '' $extra_sql ORDER BY `network`", $r = dba::p("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = ? AND `network` != '' $extra_sql ORDER BY `network`",
local_user() local_user()
@ -143,7 +160,13 @@ class Widget
)); ));
} }
function fileas_widget($baseurl, $selected = '') /**
* Return file as widget
*
* @param string $baseurl baseurl
* @param string $selected optional, default empty
*/
public static function fileAs($baseurl, $selected = '')
{ {
if (!local_user()) { if (!local_user()) {
return ''; return '';
@ -178,7 +201,13 @@ class Widget
)); ));
} }
function categories_widget($baseurl, $selected = '') /**
* Return categories widget
*
* @param string $baseurl baseurl
* @param string $selected optional, default empty
*/
public static function categories($baseurl, $selected = '')
{ {
$a = get_app(); $a = get_app();
@ -212,7 +241,12 @@ class Widget
)); ));
} }
function common_friends_visitor_widget($profile_uid) /**
* Return common friends visitor widget
*
* @param string $profile_uid uid
*/
public static function commonFriendsVisitor($profile_uid)
{ {
if (local_user() == $profile_uid) { if (local_user() == $profile_uid) {
return; return;

View File

@ -1,5 +1,4 @@
<?php <?php
/* /*
* Name: frio * Name: frio
* Description: Bootstrap V3 theme. The theme is currently under construction, so it is far from finished. For further information have a look at the <a href="https://github.com/friendica/friendica/tree/develop/view/theme/frio/README.md">ReadMe</a>. * Description: Bootstrap V3 theme. The theme is currently under construction, so it is far from finished. For further information have a look at the <a href="https://github.com/friendica/friendica/tree/develop/view/theme/frio/README.md">ReadMe</a>.
@ -7,8 +6,8 @@
* Author: Rabuzarus <https://friendica.kommune4.de/profile/rabuzarus> * Author: Rabuzarus <https://friendica.kommune4.de/profile/rabuzarus>
* *
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Content\Widget;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
@ -315,7 +314,7 @@ function frio_acl_lookup(App $a, &$results)
$total = $r[0]["total"]; $total = $r[0]["total"];
} }
$sql_extra3 = unavailable_networks(); $sql_extra3 = Widget::unavailableNetworks();
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `pending` $sql_extra $sql_extra3 ORDER BY `name` ASC LIMIT 100 ", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `pending` $sql_extra $sql_extra3 ORDER BY `name` ASC LIMIT 100 ",
intval($_SESSION['uid']) intval($_SESSION['uid'])