X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ftext.php;h=73c441e26aaaabd8c47d0c46a552214d9c2d07a4;hb=25c0c5d4ad9e155dd5329e197c7a19212d20b578;hp=9a65224af9bfd4e3d8ae19b5f7b97c67734b6038;hpb=26c5c7991af3b27f079b5494def31707bfe1054a;p=friendica.git diff --git a/include/text.php b/include/text.php index 9a65224af9..73c441e26a 100644 --- a/include/text.php +++ b/include/text.php @@ -20,6 +20,10 @@ function replace_macros($s,$r) { $stamp1 = microtime(true); $a = get_app(); + + // pass $baseurl to all templates + $r['$baseurl'] = $a->get_baseurl(); + $t = $a->template_engine(); try { @@ -939,6 +943,9 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { if($class) $class = ' ' . $class; + if ($contact["addr"] == "") + $contact["addr"] = $contact["url"]; + $url = $contact['url']; $sparkle = ''; $redir = false; @@ -962,7 +969,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { . (($click) ? ' fakelink' : '') . '" ' . (($redir) ? ' target="redir" ' : '') . (($url) ? ' href="' . $url . '"' : '') . $click - . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name'] + . '" title="' . $contact['name'] . ' [' . $contact['addr'] . ']" alt="' . $contact['name'] . '" >'. $contact['name'] . '' . "\r\n"; } else { @@ -970,7 +977,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { . (($click) ? ' fakelink' : '') . '" ' . (($redir) ? ' target="redir" ' : '') . (($url) ? ' href="' . $url . '"' : '') . $click . ' >' . $contact['name']
+			. proxy_url($contact['micro'], false, PROXY_SIZE_THUMB) . '' . "\r\n"; } }} @@ -998,12 +1005,15 @@ function search($s,$id='search-box',$url='/search',$save = false, $aside = true) '$savedsearch' => feature_enabled(local_user(),'savedsearch'), ); - if (!$aside) + if (!$aside) { $values['$searchoption'] = array( t("Full Text"), t("Tags"), - t("Contacts"), - t("Forums")); + t("Contacts")); + + if (get_config('system','poco_local_search')) + $values['$searchoption'][] = t("Forums"); + } return replace_macros(get_markup_template('searchbox.tpl'), $values); }} @@ -1017,8 +1027,9 @@ if(! function_exists('valid_email')) { */ function valid_email($x){ - if(get_config('system','disable_email_validation')) - return true; + // Removed because Fabio told me so. + //if(get_config('system','disable_email_validation')) + // return true; if(preg_match('/^[_a-zA-Z0-9\-\+]+(\.[_a-zA-Z0-9\-\+]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/',$x)) return true; @@ -1407,9 +1418,6 @@ function prepare_body(&$item,$attach = false, $preview = false) { put_item_in_cache($item, true); $s = $item["rendered-html"]; - require_once("mod/proxy.php"); - $s = proxy_parse_html($s); - $prep_arr = array('item' => $item, 'html' => $s, 'preview' => $preview); call_hooks('prepare_body', $prep_arr); $s = $prep_arr['html']; @@ -1502,7 +1510,7 @@ function prepare_body(&$item,$attach = false, $preview = false) { if($x) { $s = preg_replace('/\
/','$0' . $x,$s); } - } + } // Look for spoiler @@ -1738,50 +1746,6 @@ function unamp($s) { }} - - -if(! function_exists('lang_selector')) { -/** - * get html for language selector - * @global string $lang - * @return string - * @template lang_selector.tpl - */ -function lang_selector() { - global $lang; - - $langs = glob('view/*/strings.php'); - - $lang_options = array(); - $selected = ""; - - if(is_array($langs) && count($langs)) { - $langs[] = ''; - if(! in_array('view/en/strings.php',$langs)) - $langs[] = 'view/en/'; - asort($langs); - foreach($langs as $l) { - if($l == '') { - $lang_options[""] = t('default'); - continue; - } - $ll = substr($l,5); - $ll = substr($ll,0,strrpos($ll,'/')); - $selected = (($ll === $lang && (x($_SESSION, 'language'))) ? $ll : $selected); - $lang_options[$ll]=$ll; - } - } - - $tpl = get_markup_template("lang_selector.tpl"); - $o = replace_macros($tpl, array( - '$title' => t('Select an alternate language'), - '$langs' => array($lang_options, $selected), - - )); - return $o; -}} - - if(! function_exists('return_bytes')) { /** * return number of bytes in size (K, M, G) @@ -2314,14 +2278,14 @@ function deindent($text, $chr="[\t ]", $count=NULL) { return implode("\n", $lines); } -function formatBytes($bytes, $precision = 2) { - $units = array('B', 'KB', 'MB', 'GB', 'TB'); +function formatBytes($bytes, $precision = 2) { + $units = array('B', 'KB', 'MB', 'GB', 'TB'); - $bytes = max($bytes, 0); - $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); - $pow = min($pow, count($units) - 1); + $bytes = max($bytes, 0); + $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); + $pow = min($pow, count($units) - 1); $bytes /= pow(1024, $pow); - return round($bytes, $precision) . ' ' . $units[$pow]; -} + return round($bytes, $precision) . ' ' . $units[$pow]; +}