Browse Source

Adapt naming convention

pull/7765/head
Philipp Holzer 2 years ago
parent
commit
c9e1098dd2
No known key found for this signature in database GPG Key ID: D8365C3D36B77D90
7 changed files with 28 additions and 30 deletions
  1. +4
    -4
      mod/events.php
  2. +4
    -4
      mod/item.php
  3. +9
    -11
      mod/photos.php
  4. +4
    -4
      mod/settings.php
  5. +3
    -3
      src/Model/Item.php
  6. +3
    -3
      src/Util/ACLFormatter.php
  7. +1
    -1
      tests/src/Util/ACLFormaterTest.php

+ 4
- 4
mod/events.php View File

@ -152,10 +152,10 @@ function events_post(App $a)
/** @var ACLFormatter $aclFormatter */
$aclFormatter = BaseObject::getClass(ACLFormatter::class);
$str_group_allow = $aclFormatter->aclToString($_POST['group_allow'] ?? '');
$str_contact_allow = $aclFormatter->aclToString($_POST['contact_allow'] ?? '');
$str_group_deny = $aclFormatter->aclToString($_POST['group_deny'] ?? '');
$str_contact_deny = $aclFormatter->aclToString($_POST['contact_deny'] ?? '');
$str_group_allow = $aclFormatter->toString($_POST['group_allow'] ?? '');
$str_contact_allow = $aclFormatter->toString($_POST['contact_allow'] ?? '');
$str_group_deny = $aclFormatter->toString($_POST['group_deny'] ?? '');
$str_contact_deny = $aclFormatter->toString($_POST['contact_deny'] ?? '');
// Undo the pseudo-contact of self, since there are real contacts now
if (strpos($str_contact_allow, '<' . $self . '>') !== false) {


+ 4
- 4
mod/item.php View File

@ -275,10 +275,10 @@ function item_post(App $a) {
/** @var ACLFormatter $aclFormatter */
$aclFormatter = BaseObject::getClass(ACLFormatter::class);
$str_group_allow = $aclFormatter->aclToString($_REQUEST['group_allow'] ?? '');
$str_contact_allow = $aclFormatter->aclToString($_REQUEST['contact_allow'] ?? '');
$str_group_deny = $aclFormatter->aclToString($_REQUEST['group_deny'] ?? '');
$str_contact_deny = $aclFormatter->aclToString($_REQUEST['contact_deny'] ?? '');
$str_group_allow = $aclFormatter->toString($_REQUEST['group_allow'] ?? '');
$str_contact_allow = $aclFormatter->toString($_REQUEST['contact_allow'] ?? '');
$str_group_deny = $aclFormatter->toString($_REQUEST['group_deny'] ?? '');
$str_contact_deny = $aclFormatter->toString($_REQUEST['contact_deny'] ?? '');
}
$title = Strings::escapeTags(trim($_REQUEST['title'] ?? ''));


+ 9
- 11
mod/photos.php View File

@ -15,18 +15,16 @@ use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\Photo;
use Friendica\Model\Profile;
use Friendica\Model\User;
use Friendica\Network\Probe;
use Friendica\Object\Image;
use Friendica\Protocol\DFRN;
use Friendica\Util\ACLFormatter;
use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat;
@ -301,10 +299,10 @@ function photos_post(App $a)
/** @var ACLFormatter $aclFormatter */
$aclFormatter = BaseObject::getClass(ACLFormatter::class);
$str_group_allow = !empty($_POST['group_allow']) ? $aclFormatter->aclToString($_POST['group_allow']) : '';
$str_contact_allow = !empty($_POST['contact_allow']) ? $aclFormatter->aclToString($_POST['contact_allow']) : '';
$str_group_deny = !empty($_POST['group_deny']) ? $aclFormatter->aclToString($_POST['group_deny']) : '';
$str_contact_deny = !empty($_POST['contact_deny']) ? $aclFormatter->aclToString($_POST['contact_deny']) : '';
$str_group_allow = !empty($_POST['group_allow']) ? $aclFormatter->toString($_POST['group_allow']) : '';
$str_contact_allow = !empty($_POST['contact_allow']) ? $aclFormatter->toString($_POST['contact_allow']) : '';
$str_group_deny = !empty($_POST['group_deny']) ? $aclFormatter->toString($_POST['group_deny']) : '';
$str_contact_deny = !empty($_POST['contact_deny']) ? $aclFormatter->toString($_POST['contact_deny']) : '';
$resource_id = $a->argv[3];
@ -643,10 +641,10 @@ function photos_post(App $a)
/** @var ACLFormatter $aclFormatter */
$aclFormatter = BaseObject::getClass(ACLFormatter::class);
$str_group_allow = $aclFormatter->aclToString(is_array($group_allow) ? $group_allow : explode(',', $group_allow));
$str_contact_allow = $aclFormatter->aclToString(is_array($contact_allow) ? $contact_allow : explode(',', $contact_allow));
$str_group_deny = $aclFormatter->aclToString(is_array($group_deny) ? $group_deny : explode(',', $group_deny));
$str_contact_deny = $aclFormatter->aclToString(is_array($contact_deny) ? $contact_deny : explode(',', $contact_deny));
$str_group_allow = $aclFormatter->toString(is_array($group_allow) ? $group_allow : explode(',', $group_allow));
$str_contact_allow = $aclFormatter->toString(is_array($contact_allow) ? $contact_allow : explode(',', $contact_allow));
$str_group_deny = $aclFormatter->toString(is_array($group_deny) ? $group_deny : explode(',', $group_deny));
$str_contact_deny = $aclFormatter->toString(is_array($contact_deny) ? $contact_deny : explode(',', $contact_deny));
$ret = ['src' => '', 'filename' => '', 'filesize' => 0, 'type' => ''];


+ 4
- 4
mod/settings.php View File

@ -538,10 +538,10 @@ function settings_post(App $a)
/** @var ACLFormatter $aclFormatter */
$aclFormatter = BaseObject::getClass(ACLFormatter::class);
$str_group_allow = !empty($_POST['group_allow']) ? $aclFormatter->aclToString($_POST['group_allow']) : '';
$str_contact_allow = !empty($_POST['contact_allow']) ? $aclFormatter->aclToString($_POST['contact_allow']) : '';
$str_group_deny = !empty($_POST['group_deny']) ? $aclFormatter->aclToString($_POST['group_deny']) : '';
$str_contact_deny = !empty($_POST['contact_deny']) ? $aclFormatter->aclToString($_POST['contact_deny']) : '';
$str_group_allow = !empty($_POST['group_allow']) ? $aclFormatter->toString($_POST['group_allow']) : '';
$str_contact_allow = !empty($_POST['contact_allow']) ? $aclFormatter->toString($_POST['contact_allow']) : '';
$str_group_deny = !empty($_POST['group_deny']) ? $aclFormatter->toString($_POST['group_deny']) : '';
$str_contact_deny = !empty($_POST['contact_deny']) ? $aclFormatter->toString($_POST['contact_deny']) : '';
$openidserver = $a->user['openidserver'];
//$openid = Strings::normaliseOpenID($openid);


+ 3
- 3
src/Model/Item.php View File

@ -17,8 +17,8 @@ use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Protocol\Activity;
@ -3350,7 +3350,7 @@ class Item extends BaseObject
|| $rendered_hash != hash("md5", $item["body"])
|| Config::get("system", "ignore_cache")
) {
self::addRedirLinkToImageLinks($item);
self::addRedirToImageTags($item);
$item["rendered-html"] = BBCode::convert($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
*/
private static function addRedirLinkToImageLinks(array &$item)
private static function addRedirToImageTags(array &$item)
{
$app = self::getApp();


+ 3
- 3
src/Util/ACLFormatter.php View File

@ -30,7 +30,7 @@ final class ACLFormatter
*
* @param string $item The item to sanitise
*/
private function sanitiseAcl(string &$item) {
private function sanitize(string &$item) {
if (intval($item)) {
$item = '<' . intval(Strings::escapeTags(trim($item))) . '>';
} elseif (in_array($item, [Group::FOLLOWERS, Group::MUTUALS])) {
@ -50,7 +50,7 @@ final class ACLFormatter
*
* @return string
*/
function aclToString($permissions) {
function toString($permissions) {
$return = '';
if (is_array($permissions)) {
$item = $permissions;
@ -59,7 +59,7 @@ final class ACLFormatter
}
if (is_array($item)) {
array_walk($item, [$this, 'sanitiseAcl']);
array_walk($item, [$this, 'sanitize']);
$return = implode('', $item);
}
return $return;


+ 1
- 1
tests/src/Util/ACLFormaterTest.php View File

@ -195,6 +195,6 @@ class ACLFormaterTest extends TestCase
{
$aclFormatter = new ACLFormatter();
$this->assertEquals($assert, $aclFormatter->aclToString($input));
$this->assertEquals($assert, $aclFormatter->toString($input));
}
}

Loading…
Cancel
Save