X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Ftext.php;h=7ed561bbbbf0d21aae96885e4c85089d1f863dc5;hb=05674206ba9a7c70c5e298e3925d95428abff78e;hp=f5a47c9a9635c87783e88b7fcdeb62d50bd6870c;hpb=6e5471def3477e84473bc237e10c7c75c9e6e853;p=friendica.git diff --git a/include/text.php b/include/text.php index f5a47c9a96..7ed561bbbb 100644 --- a/include/text.php +++ b/include/text.php @@ -3,15 +3,16 @@ * @file include/text.php */ use Friendica\App; -use Friendica\Content\Features; +use Friendica\Content\ContactSelector; +use Friendica\Content\Feature; use Friendica\Content\Smilies; use Friendica\Core\Config; use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Database\DBM; +use Friendica\Util\Map; require_once "include/friendica_smarty.php"; -require_once "include/map.php"; require_once "mod/proxy.php"; require_once "include/conversation.php"; @@ -994,7 +995,7 @@ function contact_block() { function micropro($contact, $redirect = false, $class = '', $textmode = false) { // Use the contact URL if no address is available - if ($contact["addr"] == "") { + if (!x($contact, "addr")) { $contact["addr"] = $contact["url"]; } @@ -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; @@ -1020,7 +1020,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { } return replace_macros(get_markup_template(($textmode)?'micropro_txt.tpl':'micropro_img.tpl'),array( - '$click' => (($contact['click']) ? $contact['click'] : ''), + '$click' => defaults($contact, 'click', ''), '$class' => $class, '$url' => $url, '$photo' => proxy_url($contact['thumb'], false, PROXY_SIZE_THUMB), @@ -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, @@ -1068,17 +1066,14 @@ function search($s, $id = 'search-box', $url = 'search', $save = false, $aside = } /** - * Check if $x is a valid email string + * @brief Check for a valid email string * - * @param string $x + * @param string $email_address * @return boolean */ -function valid_email($x){ - - /// @TODO Removed because Fabio told me so. - //if (Config::get('system','disable_email_validation')) - // return true; - return preg_match('/^[_a-zA-Z0-9\-\+]+(\.[_a-zA-Z0-9\-\+]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/', $x); +function valid_email($email_address) +{ + return preg_match('/^[_a-zA-Z0-9\-\+]+(\.[_a-zA-Z0-9\-\+]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/', $email_address); } @@ -1118,40 +1113,6 @@ function get_poke_verbs() { return $arr; } -/** - * Load moods - * @return array index is mood, value is translated mood - * @hook mood_verbs moods array - */ -function get_mood_verbs() { - - $arr = array( - 'happy' => t('happy'), - 'sad' => t('sad'), - 'mellow' => t('mellow'), - 'tired' => t('tired'), - 'perky' => t('perky'), - 'angry' => t('angry'), - 'stupefied' => t('stupified'), - 'puzzled' => t('puzzled'), - 'interested' => t('interested'), - 'bitter' => t('bitter'), - 'cheerful' => t('cheerful'), - 'alive' => t('alive'), - 'annoyed' => t('annoyed'), - 'anxious' => t('anxious'), - 'cranky' => t('cranky'), - 'disturbed' => t('disturbed'), - 'frustrated' => t('frustrated'), - 'motivated' => t('motivated'), - 'relaxed' => t('relaxed'), - 'surprised' => t('surprised'), - ); - - call_hooks('mood_verbs', $arr); - return $arr; -} - /** * @brief Translate days and months names. * @@ -1178,7 +1139,7 @@ function day_translate($s) { */ function day_short_translate($s) { $ret = str_replace(array('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'), - array(t('Mon'), t('Tue'), t('Wed'), t('Thu'), t('Fri'), t('Sat'), t('Sund')), + array(t('Mon'), t('Tue'), t('Wed'), t('Thu'), t('Fri'), t('Sat'), t('Sun')), $s); $ret = str_replace(array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov','Dec'), array(t('Jan'), t('Feb'), t('Mar'), t('Apr'), t('May'), ('Jun'), t('Jul'), t('Aug'), t('Sep'), t('Oct'), t('Nov'), t('Dec')), @@ -1239,11 +1200,15 @@ function redir_private_images($a, &$item) } } -function put_item_in_cache(&$item, $update = false) { - - if (($item["rendered-hash"] != hash("md5", $item["body"])) || ($item["rendered-hash"] == "") || - ($item["rendered-html"] == "") || Config::get("system", "ignore_cache")) { +function put_item_in_cache(&$item, $update = false) +{ + $rendered_hash = defaults($item, 'rendered-hash', ''); + if ($rendered_hash == '' + || $item["rendered-html"] == "" + || $rendered_hash != hash("md5", $item["body"]) + || Config::get("system", "ignore_cache") + ) { // The function "redir_private_images" changes the body. // I'm not sure if we should store it permanently, so we save the old value. $body = $item["body"]; @@ -1409,7 +1374,7 @@ function prepare_body(&$item, $attach = false, $preview = false) { // Map. if (strpos($s, '