From: Adam Magness Date: Tue, 30 Oct 2018 18:51:45 +0000 (-0400) Subject: Update function calls X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d9b558a8ede11be1c486d562dfe0495902b57e6e;p=friendica.git Update function calls update function calls to new class. --- diff --git a/mod/editpost.php b/mod/editpost.php index 780145ed3f..83fcdca566 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -8,6 +8,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; +use Friendcia\Model\FileTag; use Friendica\Model\Item; use Friendica\Database\DBA; @@ -118,7 +119,7 @@ function editpost_content(App $a) '$jotnets' => $jotnets, '$title' => htmlspecialchars($item['title']), '$placeholdertitle' => L10n::t('Set title'), - '$category' => file_tag_file_to_list($item['file'], 'category'), + '$category' => FileTag::fileToList($item['file'], 'category'), '$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? L10n::t("Categories \x28comma-separated list\x29") : ''), '$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'), '$lockstate' => $lockstate, diff --git a/mod/filer.php b/mod/filer.php index cd2a41dfd3..050fa70633 100644 --- a/mod/filer.php +++ b/mod/filer.php @@ -6,6 +6,7 @@ use Friendica\App; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; +use Friendica\Model\FileTag; require_once 'include/items.php'; @@ -22,11 +23,11 @@ function filer_content(App $a) if ($item_id && strlen($term)) { // file item - file_tag_save_file(local_user(), $item_id, $term); + FileTag::saveFile(local_user(), $item_id, $term); } else { // return filer dialog $filetags = PConfig::get(local_user(), 'system', 'filetags'); - $filetags = file_tag_file_to_list($filetags, 'file'); + $filetags = FileTag::fileToList($filetags, 'file'); $filetags = explode(",", $filetags); $tpl = get_markup_template("filer_dialog.tpl"); diff --git a/mod/filerm.php b/mod/filerm.php index 18908c3bbd..d899d8f3f2 100644 --- a/mod/filerm.php +++ b/mod/filerm.php @@ -3,10 +3,12 @@ use Friendica\App; use Friendica\Core\Logger; use Friendica\Core\System; +use Friendica\Model\FileTag; -function filerm_content(App $a) { - - if (! local_user()) { +function filerm_content(App $a) +{ + if (! local_user()) + { killme(); } @@ -14,7 +16,9 @@ function filerm_content(App $a) { $cat = unxmlify(trim($_GET['cat'])); $category = (($cat) ? true : false); - if ($category) { + + if ($category) + { $term = $cat; } @@ -22,11 +26,10 @@ function filerm_content(App $a) { Logger::log('filerm: tag ' . $term . ' item ' . $item_id); - if ($item_id && strlen($term)) { - file_tag_unsave_file(local_user(),$item_id,$term, $category); + if ($item_id && strlen($term)) + { + FileTag::unsaveFile(local_user(), $item_id, $term, $category); } - //$a->internalRedirect('network'); - killme(); } diff --git a/mod/item.php b/mod/item.php index 6e7e86fe7a..c7dbfd21c6 100644 --- a/mod/item.php +++ b/mod/item.php @@ -29,6 +29,7 @@ use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Conversation; +use Friendica\Model\FileTag; use Friendica\Model\Item; use Friendica\Protocol\Diaspora; use Friendica\Protocol\Email; @@ -291,17 +292,21 @@ function item_post(App $a) { } } - if (!empty($categories)) { + if (!empty($categories)) + { // get the "fileas" tags for this post - $filedas = file_tag_file_to_list($categories, 'file'); + $filedas = FileTag::fileToList($categories, 'file'); } + // save old and new categories, so we can determine what needs to be deleted from pconfig $categories_old = $categories; - $categories = file_tag_list_to_file(trim(defaults($_REQUEST, 'category', '')), 'category'); + $categories = FileTag::listToFile(trim(defaults($_REQUEST, 'category', '')), 'category'); $categories_new = $categories; - if (!empty($filedas)) { + + if (!empty($filedas)) + { // append the fileas stuff to the new categories list - $categories .= file_tag_list_to_file($filedas, 'file'); + $categories .= FileTag::listToFile($filedas, 'file'); } // get contact info for poster @@ -712,7 +717,7 @@ function item_post(App $a) { Item::update($fields, ['id' => $post_id]); // update filetags in pconfig - file_tag_update_pconfig($uid,$categories_old,$categories_new,'category'); + FileTag::updatePconfig($uid, $categories_old, $categories_new, 'category'); if (!empty($_REQUEST['return']) && strlen($return_path)) { Logger::log('return: ' . $return_path); @@ -749,7 +754,7 @@ function item_post(App $a) { } // update filetags in pconfig - file_tag_update_pconfig($uid, $categories_old, $categories_new, 'category'); + FileTag::updatePconfig($uid, $categories_old, $categories_new, 'category'); // These notifications are sent if someone else is commenting other your wall if ($parent) { diff --git a/src/Content/Widget.php b/src/Content/Widget.php index faba55b7a8..8dd71b8bfc 100644 --- a/src/Content/Widget.php +++ b/src/Content/Widget.php @@ -14,6 +14,7 @@ use Friendica\Core\Protocol; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Contact; +use Friendica\Model\FileTag; use Friendica\Model\GContact; use Friendica\Model\Profile; @@ -185,8 +186,9 @@ class Widget $terms = array(); $cnt = preg_match_all('/\[(.*?)\]/', $saved, $matches, PREG_SET_ORDER); if ($cnt) { - foreach ($matches as $mtch) { - $unescaped = xmlify(file_tag_decode($mtch[1])); + foreach ($matches as $mtch) + { + $unescaped = xmlify(FileTag::decode($mtch[1])); $terms[] = array('name' => $unescaped, 'selected' => (($selected == $unescaped) ? 'selected' : '')); } } @@ -226,7 +228,7 @@ class Widget if ($cnt) { foreach ($matches as $mtch) { - $unescaped = xmlify(file_tag_decode($mtch[1])); + $unescaped = xmlify(FileTag::decode($mtch[1])); $terms[] = array('name' => $unescaped, 'selected' => (($selected == $unescaped) ? 'selected' : '')); } } diff --git a/src/Model/Item.php b/src/Model/Item.php index 4e854e45c4..8e0a397e24 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -18,6 +18,7 @@ use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\Model\Contact; +use Friendica\Model\FileTag; use Friendica\Model\PermissionSet; use Friendica\Model\ItemURI; use Friendica\Object\Image; @@ -1002,18 +1003,24 @@ class Item extends BaseObject $matches = false; $cnt = preg_match_all('/<(.*?)>/', $item['file'], $matches, PREG_SET_ORDER); - if ($cnt) { - foreach ($matches as $mtch) { - file_tag_unsave_file($item['uid'], $item['id'], $mtch[1],true); + + if ($cnt) + { + foreach ($matches as $mtch) + { + FileTag::unsaveFile($item['uid'], $item['id'], $mtch[1],true); } } $matches = false; $cnt = preg_match_all('/\[(.*?)\]/', $item['file'], $matches, PREG_SET_ORDER); - if ($cnt) { - foreach ($matches as $mtch) { - file_tag_unsave_file($item['uid'], $item['id'], $mtch[1],false); + + if ($cnt) + { + foreach ($matches as $mtch) + { + FileTag::unsaveFile($item['uid'], $item['id'], $mtch[1],false); } } diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index b48dc0a8d8..07a56cf240 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -245,7 +245,7 @@ class DFRN intval(TERM_CATEGORY), intval($owner_id) ); - //$sql_extra .= file_tag_file_query('item',$category,'category'); + //$sql_extra .= FileTag::fileQuery('item',$category,'category'); } if ($public_feed && ! $converse) {