1
0
Fork 0

Features to src

Move Features to class in Friendica\Content namespace. Update function calls and references.
This commit is contained in:
Adam Magness 2017-12-04 08:33:49 -05:00
commit 2f0da29c75
24 changed files with 241 additions and 211 deletions

View file

@ -1,11 +1,11 @@
<?php
/**
* @file mod/admin.php
*
* @brief Friendica admin
*/
use Friendica\App;
use Friendica\Content\Features;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Core\Worker;
@ -2291,7 +2291,7 @@ function admin_page_features_post(App $a)
logger('postvars: ' . print_r($_POST, true), LOGGER_DATA);
$arr = array();
$features = get_features(false);
$features = Features::get(false);
foreach ($features as $fname => $fdata) {
foreach (array_slice($fdata, 1) as $f) {
@ -2336,7 +2336,7 @@ function admin_page_features(App $a)
{
if ((argc() > 1) && (argv(1) === 'features')) {
$arr = array();
$features = get_features(false);
$features = Features::get(false);
foreach ($features as $fname => $fdata) {
$arr[$fname] = array();

View file

@ -5,8 +5,8 @@
* This calendar is for profile visitors and contains only the events
* of the profile owner
*/
use Friendica\App;
use Friendica\Content\Features;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\System;
@ -301,7 +301,7 @@ function cal_content(App $a) {
// Test permissions
// Respect the export feature setting for all other /cal pages if it's not the own profile
if( ((local_user() !== intval($owner_uid))) && ! feature_enabled($owner_uid, "export_calendar")) {
if( ((local_user() !== intval($owner_uid))) && ! Features::isEnabled($owner_uid, "export_calendar")) {
notice( t('Permission denied.') . EOL);
goaway('cal/' . $nick);
}

View file

@ -1,6 +1,9 @@
<?php
/**
* @file mod/editpost.php
*/
use Friendica\App;
use Friendica\Content\Features;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Database\DBM;
@ -131,7 +134,7 @@ function editpost_content(App $a) {
'$title' => htmlspecialchars($itm[0]['title']),
'$placeholdertitle' => t('Set title'),
'$category' => file_tag_file_to_list($itm[0]['file'], 'category'),
'$placeholdercategory' => (feature_enabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''),
'$placeholdercategory' => (Features::isEnabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''),
'$emtitle' => t('Example: bob@example.com, mary@example.com'),
'$lockstate' => $lockstate,
'$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)),

View file

@ -3,6 +3,7 @@
* @file mod/network.php
*/
use Friendica\App;
use Friendica\Content\Features;
use Friendica\Content\ForumManager;
use Friendica\Core\System;
use Friendica\Core\Config;
@ -156,8 +157,8 @@ function network_init(App $a) {
$a->page['aside'] = '';
}
$a->page['aside'] .= (feature_enabled(local_user(),'groups') ? group_side('network/0','network','standard',$group_id) : '');
$a->page['aside'] .= (feature_enabled(local_user(), 'forumlist_widget') ? ForumManager::widget(local_user(), $cid) : '');
$a->page['aside'] .= (Features::isEnabled(local_user(),'groups') ? group_side('network/0','network','standard',$group_id) : '');
$a->page['aside'] .= (Features::isEnabled(local_user(), 'forumlist_widget') ? ForumManager::widget(local_user(), $cid) : '');
$a->page['aside'] .= posted_date_widget('network',local_user(),false);
$a->page['aside'] .= networks_widget('network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
$a->page['aside'] .= saved_searches($search);
@ -166,7 +167,7 @@ function network_init(App $a) {
function saved_searches($search) {
if (!feature_enabled(local_user(),'savedsearch')) {
if (!Features::isEnabled(local_user(),'savedsearch')) {
return '';
}
@ -918,7 +919,7 @@ function network_tabs(App $a)
),
);
if (feature_enabled(local_user(),'personal_tab')) {
if (Features::isEnabled(local_user(),'personal_tab')) {
$tabs[] = array(
'label' => t('Personal'),
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1',
@ -929,7 +930,7 @@ function network_tabs(App $a)
);
}
if (feature_enabled(local_user(),'new_tab')) {
if (Features::isEnabled(local_user(),'new_tab')) {
$tabs[] = array(
'label' => t('New'),
'url' => 'network/new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''),
@ -940,7 +941,7 @@ function network_tabs(App $a)
);
}
if (feature_enabled(local_user(),'link_tab')) {
if (Features::isEnabled(local_user(),'link_tab')) {
$tabs[] = array(
'label' => t('Shared Links'),
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1',
@ -951,7 +952,7 @@ function network_tabs(App $a)
);
}
if (feature_enabled(local_user(),'star_posts')) {
if (Features::isEnabled(local_user(),'star_posts')) {
$tabs[] = array(
'label' => t('Starred'),
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1',

View file

@ -3,6 +3,7 @@
* @file mod/photos.php
*/
use Friendica\App;
use Friendica\Content\Features;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Core\Worker;
@ -895,7 +896,7 @@ function photos_post(App $a) {
/// @TODO merge these 2 if() into one?
if ($exif && $exif['GPS']) {
if (feature_enabled($channel_id,'photo_location')) {
if (Features::isEnabled($channel_id,'photo_location')) {
$lat = getGps($exif['GPS']['GPSLatitude'], $exif['GPS']['GPSLatitudeRef']);
$lon = getGps($exif['GPS']['GPSLongitude'], $exif['GPS']['GPSLongitudeRef']);
}
@ -1584,7 +1585,7 @@ function photos_content(App $a) {
$likebuttons = replace_macros($like_tpl, array(
'$id' => $link_item['id'],
'$likethis' => t("I like this \x28toggle\x29"),
'$nolike' => (feature_enabled(local_user(), 'dislike') ? t("I don't like this \x28toggle\x29") : ''),
'$nolike' => (Features::isEnabled(local_user(), 'dislike') ? t("I don't like this \x28toggle\x29") : ''),
'$wait' => t('Please wait'),
'$return_path' => $a->query_string,
));
@ -1735,7 +1736,7 @@ function photos_content(App $a) {
$response_verbs = array('like');
if (feature_enabled($owner_uid, 'dislike')) {
if (Features::isEnabled($owner_uid, 'dislike')) {
$response_verbs[] = 'dislike';
}
$responses = get_responses($conv_responses,$response_verbs, '', $link_item);

View file

@ -3,6 +3,7 @@
* @file include/ping.php
*/
use Friendica\App;
use Friendica\Content\Features;
use Friendica\Content\ForumManager;
use Friendica\Core\Cache;
use Friendica\Core\System;
@ -149,7 +150,7 @@ function ping_init(App $a)
}
if ($network_count) {
if (intval(feature_enabled(local_user(), 'groups'))) {
if (intval(Features::isEnabled(local_user(), 'groups'))) {
// Find out how unseen network posts are spread across groups
$group_counts = groups_count_unseen();
if (DBM::is_result($group_counts)) {
@ -161,7 +162,7 @@ function ping_init(App $a)
}
}
if (intval(feature_enabled(local_user(), 'forumlist_widget'))) {
if (intval(Features::isEnabled(local_user(), 'forumlist_widget'))) {
$forum_counts = ForumManager::countUnseenItems();
if (DBM::is_result($forums_counts)) {
foreach ($forums_counts as $forum_count) {

View file

@ -3,6 +3,7 @@
* @file mod/profiles.php
*/
use Friendica\App;
use Friendica\Content\Features;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\System;
@ -673,10 +674,10 @@ function profiles_content(App $a) {
array(t('No'), t('Yes')) //Off - On strings
),
'$multi_profiles' => feature_enabled(local_user(), 'multi_profiles'),
'$multi_profiles' => Features::isEnabled(local_user(), 'multi_profiles'),
'$form_security_token' => get_form_security_token("profile_edit"),
'$form_security_token_photo' => get_form_security_token("profile_photo"),
'$profile_clone_link' => ((feature_enabled(local_user(), 'multi_profiles')) ? 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone") : ""),
'$profile_clone_link' => ((Features::isEnabled(local_user(), 'multi_profiles')) ? 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone") : ""),
'$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"),
'$profile_action' => t('Profile Actions'),
@ -754,7 +755,7 @@ function profiles_content(App $a) {
return $o;
} else {
// If we don't support multi profiles, don't display this list.
if (!feature_enabled(local_user(), 'multi_profiles')) {
if (!Features::isEnabled(local_user(), 'multi_profiles')) {
$r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1",
local_user()
);

View file

@ -1,20 +1,23 @@
<?php
/**
* @file mod/search.php
*/
use Friendica\App;
use Friendica\Content\Features;
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Database\DBM;
require_once("include/bbcode.php");
require_once('include/security.php');
require_once('include/conversation.php');
require_once('mod/dirfind.php');
require_once "include/bbcode.php";
require_once 'include/security.php';
require_once 'include/conversation.php';
require_once 'mod/dirfind.php';
function search_saved_searches() {
$o = '';
if (! feature_enabled(local_user(),'savedsearch'))
if (! Features::isEnabled(local_user(),'savedsearch'))
return $o;
$r = q("SELECT `id`,`term` FROM `search` WHERE `uid` = %d",

View file

@ -3,6 +3,7 @@
* @file mod/settings.php
*/
use Friendica\App;
use Friendica\Content\Features;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Core\Config;
@ -52,7 +53,7 @@ function settings_init(App $a) {
),
);
if (get_features()) {
if (Features::get()) {
$tabs[] = array(
'label' => t('Additional features'),
'url' => 'settings/features',
@ -784,12 +785,12 @@ function settings_content(App $a) {
if (($a->argc > 1) && ($a->argv[1] === 'features')) {
$arr = array();
$features = get_features();
$features = Features::get();
foreach ($features as $fname => $fdata) {
$arr[$fname] = array();
$arr[$fname][0] = $fdata[0];
foreach (array_slice($fdata,1) as $f) {
$arr[$fname][1][] = array('feature_' .$f[0], $f[1],((intval(feature_enabled(local_user(), $f[0]))) ? "1" : ''), $f[2],array(t('Off'), t('On')));
$arr[$fname][1][] = array('feature_' .$f[0], $f[1],((intval(Features::isEnabled(local_user(), $f[0]))) ? "1" : ''), $f[2],array(t('Off'), t('On')));
}
}