Adapt naming convention
This commit is contained in:
parent
3eb3e0b5ce
commit
c9e1098dd2
7 changed files with 28 additions and 30 deletions
|
@ -152,10 +152,10 @@ function events_post(App $a)
|
||||||
/** @var ACLFormatter $aclFormatter */
|
/** @var ACLFormatter $aclFormatter */
|
||||||
$aclFormatter = BaseObject::getClass(ACLFormatter::class);
|
$aclFormatter = BaseObject::getClass(ACLFormatter::class);
|
||||||
|
|
||||||
$str_group_allow = $aclFormatter->aclToString($_POST['group_allow'] ?? '');
|
$str_group_allow = $aclFormatter->toString($_POST['group_allow'] ?? '');
|
||||||
$str_contact_allow = $aclFormatter->aclToString($_POST['contact_allow'] ?? '');
|
$str_contact_allow = $aclFormatter->toString($_POST['contact_allow'] ?? '');
|
||||||
$str_group_deny = $aclFormatter->aclToString($_POST['group_deny'] ?? '');
|
$str_group_deny = $aclFormatter->toString($_POST['group_deny'] ?? '');
|
||||||
$str_contact_deny = $aclFormatter->aclToString($_POST['contact_deny'] ?? '');
|
$str_contact_deny = $aclFormatter->toString($_POST['contact_deny'] ?? '');
|
||||||
|
|
||||||
// Undo the pseudo-contact of self, since there are real contacts now
|
// Undo the pseudo-contact of self, since there are real contacts now
|
||||||
if (strpos($str_contact_allow, '<' . $self . '>') !== false) {
|
if (strpos($str_contact_allow, '<' . $self . '>') !== false) {
|
||||||
|
|
|
@ -275,10 +275,10 @@ function item_post(App $a) {
|
||||||
/** @var ACLFormatter $aclFormatter */
|
/** @var ACLFormatter $aclFormatter */
|
||||||
$aclFormatter = BaseObject::getClass(ACLFormatter::class);
|
$aclFormatter = BaseObject::getClass(ACLFormatter::class);
|
||||||
|
|
||||||
$str_group_allow = $aclFormatter->aclToString($_REQUEST['group_allow'] ?? '');
|
$str_group_allow = $aclFormatter->toString($_REQUEST['group_allow'] ?? '');
|
||||||
$str_contact_allow = $aclFormatter->aclToString($_REQUEST['contact_allow'] ?? '');
|
$str_contact_allow = $aclFormatter->toString($_REQUEST['contact_allow'] ?? '');
|
||||||
$str_group_deny = $aclFormatter->aclToString($_REQUEST['group_deny'] ?? '');
|
$str_group_deny = $aclFormatter->toString($_REQUEST['group_deny'] ?? '');
|
||||||
$str_contact_deny = $aclFormatter->aclToString($_REQUEST['contact_deny'] ?? '');
|
$str_contact_deny = $aclFormatter->toString($_REQUEST['contact_deny'] ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = Strings::escapeTags(trim($_REQUEST['title'] ?? ''));
|
$title = Strings::escapeTags(trim($_REQUEST['title'] ?? ''));
|
||||||
|
|
|
@ -15,18 +15,16 @@ use Friendica\Core\Hook;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\System;
|
|
||||||
use Friendica\Core\Session;
|
use Friendica\Core\Session;
|
||||||
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Group;
|
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
use Friendica\Model\Photo;
|
use Friendica\Model\Photo;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Image;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Protocol\DFRN;
|
|
||||||
use Friendica\Util\ACLFormatter;
|
use Friendica\Util\ACLFormatter;
|
||||||
use Friendica\Util\Crypto;
|
use Friendica\Util\Crypto;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
@ -301,10 +299,10 @@ function photos_post(App $a)
|
||||||
/** @var ACLFormatter $aclFormatter */
|
/** @var ACLFormatter $aclFormatter */
|
||||||
$aclFormatter = BaseObject::getClass(ACLFormatter::class);
|
$aclFormatter = BaseObject::getClass(ACLFormatter::class);
|
||||||
|
|
||||||
$str_group_allow = !empty($_POST['group_allow']) ? $aclFormatter->aclToString($_POST['group_allow']) : '';
|
$str_group_allow = !empty($_POST['group_allow']) ? $aclFormatter->toString($_POST['group_allow']) : '';
|
||||||
$str_contact_allow = !empty($_POST['contact_allow']) ? $aclFormatter->aclToString($_POST['contact_allow']) : '';
|
$str_contact_allow = !empty($_POST['contact_allow']) ? $aclFormatter->toString($_POST['contact_allow']) : '';
|
||||||
$str_group_deny = !empty($_POST['group_deny']) ? $aclFormatter->aclToString($_POST['group_deny']) : '';
|
$str_group_deny = !empty($_POST['group_deny']) ? $aclFormatter->toString($_POST['group_deny']) : '';
|
||||||
$str_contact_deny = !empty($_POST['contact_deny']) ? $aclFormatter->aclToString($_POST['contact_deny']) : '';
|
$str_contact_deny = !empty($_POST['contact_deny']) ? $aclFormatter->toString($_POST['contact_deny']) : '';
|
||||||
|
|
||||||
$resource_id = $a->argv[3];
|
$resource_id = $a->argv[3];
|
||||||
|
|
||||||
|
@ -643,10 +641,10 @@ function photos_post(App $a)
|
||||||
/** @var ACLFormatter $aclFormatter */
|
/** @var ACLFormatter $aclFormatter */
|
||||||
$aclFormatter = BaseObject::getClass(ACLFormatter::class);
|
$aclFormatter = BaseObject::getClass(ACLFormatter::class);
|
||||||
|
|
||||||
$str_group_allow = $aclFormatter->aclToString(is_array($group_allow) ? $group_allow : explode(',', $group_allow));
|
$str_group_allow = $aclFormatter->toString(is_array($group_allow) ? $group_allow : explode(',', $group_allow));
|
||||||
$str_contact_allow = $aclFormatter->aclToString(is_array($contact_allow) ? $contact_allow : explode(',', $contact_allow));
|
$str_contact_allow = $aclFormatter->toString(is_array($contact_allow) ? $contact_allow : explode(',', $contact_allow));
|
||||||
$str_group_deny = $aclFormatter->aclToString(is_array($group_deny) ? $group_deny : explode(',', $group_deny));
|
$str_group_deny = $aclFormatter->toString(is_array($group_deny) ? $group_deny : explode(',', $group_deny));
|
||||||
$str_contact_deny = $aclFormatter->aclToString(is_array($contact_deny) ? $contact_deny : explode(',', $contact_deny));
|
$str_contact_deny = $aclFormatter->toString(is_array($contact_deny) ? $contact_deny : explode(',', $contact_deny));
|
||||||
|
|
||||||
$ret = ['src' => '', 'filename' => '', 'filesize' => 0, 'type' => ''];
|
$ret = ['src' => '', 'filename' => '', 'filesize' => 0, 'type' => ''];
|
||||||
|
|
||||||
|
|
|
@ -538,10 +538,10 @@ function settings_post(App $a)
|
||||||
/** @var ACLFormatter $aclFormatter */
|
/** @var ACLFormatter $aclFormatter */
|
||||||
$aclFormatter = BaseObject::getClass(ACLFormatter::class);
|
$aclFormatter = BaseObject::getClass(ACLFormatter::class);
|
||||||
|
|
||||||
$str_group_allow = !empty($_POST['group_allow']) ? $aclFormatter->aclToString($_POST['group_allow']) : '';
|
$str_group_allow = !empty($_POST['group_allow']) ? $aclFormatter->toString($_POST['group_allow']) : '';
|
||||||
$str_contact_allow = !empty($_POST['contact_allow']) ? $aclFormatter->aclToString($_POST['contact_allow']) : '';
|
$str_contact_allow = !empty($_POST['contact_allow']) ? $aclFormatter->toString($_POST['contact_allow']) : '';
|
||||||
$str_group_deny = !empty($_POST['group_deny']) ? $aclFormatter->aclToString($_POST['group_deny']) : '';
|
$str_group_deny = !empty($_POST['group_deny']) ? $aclFormatter->toString($_POST['group_deny']) : '';
|
||||||
$str_contact_deny = !empty($_POST['contact_deny']) ? $aclFormatter->aclToString($_POST['contact_deny']) : '';
|
$str_contact_deny = !empty($_POST['contact_deny']) ? $aclFormatter->toString($_POST['contact_deny']) : '';
|
||||||
|
|
||||||
$openidserver = $a->user['openidserver'];
|
$openidserver = $a->user['openidserver'];
|
||||||
//$openid = Strings::normaliseOpenID($openid);
|
//$openid = Strings::normaliseOpenID($openid);
|
||||||
|
|
|
@ -17,8 +17,8 @@ use Friendica\Core\Logger;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\System;
|
|
||||||
use Friendica\Core\Session;
|
use Friendica\Core\Session;
|
||||||
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Protocol\Activity;
|
use Friendica\Protocol\Activity;
|
||||||
|
@ -3350,7 +3350,7 @@ class Item extends BaseObject
|
||||||
|| $rendered_hash != hash("md5", $item["body"])
|
|| $rendered_hash != hash("md5", $item["body"])
|
||||||
|| Config::get("system", "ignore_cache")
|
|| Config::get("system", "ignore_cache")
|
||||||
) {
|
) {
|
||||||
self::addRedirLinkToImageLinks($item);
|
self::addRedirToImageTags($item);
|
||||||
|
|
||||||
$item["rendered-html"] = BBCode::convert($item["body"]);
|
$item["rendered-html"] = BBCode::convert($item["body"]);
|
||||||
$item["rendered-hash"] = hash("md5", $item["body"]);
|
$item["rendered-hash"] = hash("md5", $item["body"]);
|
||||||
|
@ -3390,7 +3390,7 @@ class Item extends BaseObject
|
||||||
*
|
*
|
||||||
* @param array &$item The field array of an item row
|
* @param array &$item The field array of an item row
|
||||||
*/
|
*/
|
||||||
private static function addRedirLinkToImageLinks(array &$item)
|
private static function addRedirToImageTags(array &$item)
|
||||||
{
|
{
|
||||||
$app = self::getApp();
|
$app = self::getApp();
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ final class ACLFormatter
|
||||||
*
|
*
|
||||||
* @param string $item The item to sanitise
|
* @param string $item The item to sanitise
|
||||||
*/
|
*/
|
||||||
private function sanitiseAcl(string &$item) {
|
private function sanitize(string &$item) {
|
||||||
if (intval($item)) {
|
if (intval($item)) {
|
||||||
$item = '<' . intval(Strings::escapeTags(trim($item))) . '>';
|
$item = '<' . intval(Strings::escapeTags(trim($item))) . '>';
|
||||||
} elseif (in_array($item, [Group::FOLLOWERS, Group::MUTUALS])) {
|
} elseif (in_array($item, [Group::FOLLOWERS, Group::MUTUALS])) {
|
||||||
|
@ -50,7 +50,7 @@ final class ACLFormatter
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function aclToString($permissions) {
|
function toString($permissions) {
|
||||||
$return = '';
|
$return = '';
|
||||||
if (is_array($permissions)) {
|
if (is_array($permissions)) {
|
||||||
$item = $permissions;
|
$item = $permissions;
|
||||||
|
@ -59,7 +59,7 @@ final class ACLFormatter
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($item)) {
|
if (is_array($item)) {
|
||||||
array_walk($item, [$this, 'sanitiseAcl']);
|
array_walk($item, [$this, 'sanitize']);
|
||||||
$return = implode('', $item);
|
$return = implode('', $item);
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
|
|
|
@ -195,6 +195,6 @@ class ACLFormaterTest extends TestCase
|
||||||
{
|
{
|
||||||
$aclFormatter = new ACLFormatter();
|
$aclFormatter = new ACLFormatter();
|
||||||
|
|
||||||
$this->assertEquals($assert, $aclFormatter->aclToString($input));
|
$this->assertEquals($assert, $aclFormatter->toString($input));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue