]> git.mxchange.org Git - friendica.git/blobdiff - include/text.php
Merge pull request #4195 from zeroadam/ContactSelector-#3878
[friendica.git] / include / text.php
index 5a24c68ed3b1fe562dae509c4d62a8072135d7d7..7ed561bbbbf0d21aae96885e4c85089d1f863dc5 100644 (file)
@@ -3,6 +3,7 @@
  * @file include/text.php
  */
 use Friendica\App;
+use Friendica\Content\ContactSelector;
 use Friendica\Content\Feature;
 use Friendica\Content\Smilies;
 use Friendica\Core\Config;
@@ -1003,7 +1004,6 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
        $redir = false;
 
        if ($redirect) {
-               $a = get_app();
                $redirect_url = 'redir/' . $contact['id'];
                if (local_user() && ($contact['uid'] == local_user()) && ($contact['network'] === NETWORK_DFRN)) {
                        $redir = true;
@@ -1041,8 +1041,6 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
  * @param boolean $savedsearch show save search button
  */
 function search($s, $id = 'search-box', $url = 'search', $save = false, $aside = true) {
-       $a = get_app();
-
        $values = array(
                        '$s' => htmlspecialchars($s),
                        '$id' => $id,
@@ -1471,9 +1469,8 @@ function prepare_text($text) {
  *       ]
  *  ]
  */
-function get_cats_and_terms($item) {
-
-       $a = get_app();
+function get_cats_and_terms($item)
+{
        $categories = array();
        $folders = array();
 
@@ -1901,9 +1898,10 @@ function file_tag_update_pconfig($uid, $file_old, $file_new, $type = 'file') {
 function file_tag_save_file($uid, $item, $file) {
        require_once "include/files.php";
 
-       $result = false;
-       if (! intval($uid))
+       if (! intval($uid)) {
                return false;
+       }
+
        $r = q("SELECT `file` FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
                intval($item),
                intval($uid)
@@ -1931,9 +1929,9 @@ function file_tag_save_file($uid, $item, $file) {
 function file_tag_unsave_file($uid, $item, $file, $cat = false) {
        require_once "include/files.php";
 
-       $result = false;
-       if (! intval($uid))
+       if (! intval($uid)) {
                return false;
+       }
 
        if ($cat == true) {
                $pattern = '<' . file_tag_encode($file) . '>' ;
@@ -1943,7 +1941,6 @@ function file_tag_unsave_file($uid, $item, $file, $cat = false) {
                $termtype = TERM_FILE;
        }
 
-
        $r = q("SELECT `file` FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
                intval($item),
                intval($uid)
@@ -1964,8 +1961,8 @@ function file_tag_unsave_file($uid, $item, $file, $cat = false) {
                dbesc($file),
                intval(TERM_OBJ_POST),
                intval($termtype),
-               intval($uid));
-
+               intval($uid)
+       );
        if (!DBM::is_result($r)) {
                $saved = PConfig::get($uid, 'system', 'filetags');
                PConfig::set($uid, 'system', 'filetags', str_replace($pattern, '', $saved));
@@ -2052,16 +2049,14 @@ function formatBytes($bytes, $precision = 2) {
  */
 function format_network_name($network, $url = 0) {
        if ($network != "") {
-               require_once 'include/contact_selectors.php';
                if ($url != "") {
-                       $network_name = '<a href="'.$url.'">'.network_to_name($network, $url)."</a>";
+                       $network_name = '<a href="'.$url.'">'.ContactSelector::networkToName($network, $url)."</a>";
                } else {
-                       $network_name = network_to_name($network);
+                       $network_name = ContactSelector::networkToName($network);
                }
 
                return $network_name;
        }
-
 }
 
 /**