mirror of
https://github.com/friendica/friendica
synced 2025-04-26 13:10:11 +00:00
Replace deprecated string-bases Model\FileTag calls with array-based ones
This commit is contained in:
parent
6de3449cae
commit
0fadc7730c
4 changed files with 30 additions and 56 deletions
|
@ -8,10 +8,8 @@ use Friendica\Content\Smilies;
|
|||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Model\Contact;
|
||||
|
||||
use Friendica\Model\FileTag;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
/**
|
||||
* Turn user/group ACLs stored as angle bracketed text into arrays
|
||||
|
@ -186,21 +184,17 @@ function get_cats_and_terms($item)
|
|||
{
|
||||
$categories = [];
|
||||
$folders = [];
|
||||
|
||||
$matches = [];
|
||||
$first = true;
|
||||
$cnt = preg_match_all('/<(.*?)>/', $item['file'], $matches, PREG_SET_ORDER);
|
||||
if ($cnt) {
|
||||
foreach ($matches as $mtch) {
|
||||
$categories[] = [
|
||||
'name' => XML::escape(FileTag::decode($mtch[1])),
|
||||
'url' => "#",
|
||||
'removeurl' => ((local_user() == $item['uid'])?'filerm/' . $item['id'] . '?f=&cat=' . XML::escape(FileTag::decode($mtch[1])):""),
|
||||
'first' => $first,
|
||||
'last' => false
|
||||
];
|
||||
$first = false;
|
||||
}
|
||||
|
||||
foreach (FileTag::fileToArray($item['file'], 'category') as $savedFolderName) {
|
||||
$categories[] = [
|
||||
'name' => $savedFolderName,
|
||||
'url' => "#",
|
||||
'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?f=&cat=' . rawurlencode($savedFolderName) : ""),
|
||||
'first' => $first,
|
||||
'last' => false
|
||||
];
|
||||
$first = false;
|
||||
}
|
||||
|
||||
if (count($categories)) {
|
||||
|
@ -208,20 +202,15 @@ function get_cats_and_terms($item)
|
|||
}
|
||||
|
||||
if (local_user() == $item['uid']) {
|
||||
$matches = [];
|
||||
$first = true;
|
||||
$cnt = preg_match_all('/\[(.*?)\]/', $item['file'], $matches, PREG_SET_ORDER);
|
||||
if ($cnt) {
|
||||
foreach ($matches as $mtch) {
|
||||
$folders[] = [
|
||||
'name' => XML::escape(FileTag::decode($mtch[1])),
|
||||
'url' => "#",
|
||||
'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?f=&term=' . XML::escape(FileTag::decode($mtch[1])) : ""),
|
||||
'first' => $first,
|
||||
'last' => false
|
||||
];
|
||||
$first = false;
|
||||
}
|
||||
foreach (FileTag::fileToArray($item['file']) as $savedFolderName) {
|
||||
$folders[] = [
|
||||
'name' => $savedFolderName,
|
||||
'url' => "#",
|
||||
'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?f=&term=' . rawurlencode($savedFolderName) : ""),
|
||||
'first' => $first,
|
||||
'last' => false
|
||||
];
|
||||
$first = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue