X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FWidget.php;h=139fd8ebb6131b9566d62c33fbd9bcac2b4ba253;hb=3d64c3031bd79ed9162774f945ffe169954c4785;hp=f4a9fbe1f1b33eddf02422c16b8270e2c367fd80;hpb=20649dd00e1a3bdfb73e4537bd9acd0a5335c39d;p=friendica.git diff --git a/src/Content/Widget.php b/src/Content/Widget.php index f4a9fbe1f1..139fd8ebb6 100644 --- a/src/Content/Widget.php +++ b/src/Content/Widget.php @@ -1,6 +1,6 @@ get(local_user(), 'system', 'filetags'); - if (!strlen($saved)) { - return; - } - $terms = []; - foreach (FileTag::fileToArray($saved) as $savedFolderName) { + foreach (Post\Category::getArray(local_user(), Post\Category::FILE) as $savedFolderName) { $terms[] = ['ref' => $savedFolderName, 'name' => $savedFolderName]; } - - usort($terms, function ($a, $b) { - return strcmp($a['name'], $b['name']); - }); return self::filter( 'file', @@ -348,13 +340,8 @@ class Widget return ''; } - $saved = DI::pConfig()->get($uid, 'system', 'filetags'); - if (!strlen($saved)) { - return; - } - $terms = array(); - foreach (FileTag::fileToArray($saved, 'category') as $savedFolderName) { + foreach (Post\Category::getArray(local_user(), Post\Category::CATEGORY) as $savedFolderName) { $terms[] = ['ref' => $savedFolderName, 'name' => $savedFolderName]; } @@ -409,7 +396,7 @@ class Widget $entries = []; foreach ($commonContacts as $contact) { $entries[] = [ - 'url' => Contact::magicLink($contact['url']), + 'url' => Contact::magicLinkByContact($contact), 'name' => $contact['name'], 'photo' => Contact::getThumb($contact), ]; @@ -474,7 +461,13 @@ class Widget $ret = []; - $dthen = Item::firstPostDate($uid, $wall); + $cachekey = 'Widget::postedByYear' . $uid . '-' . (int)$wall; + $dthen = DI::cache()->get($cachekey); + if (empty($dthen)) { + $dthen = Item::firstPostDate($uid, $wall); + DI::cache()->set($cachekey, $dthen, Duration::HOUR); + } + if ($dthen) { // Set the start and end date to the beginning of the month $dnow = substr($dnow, 0, 8) . '01';