X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ftext.php;h=f210bff72100c363ee4355fb0a07eed4a86d90f8;hb=fc250bbc2041b7571e126ec56974221f3c2f789b;hp=a738a281f58423c15d4efc80e1241185548cc2a6;hpb=1053fe91c8a8baf69a74ccb4394442641c7dcc0a;p=friendica.git diff --git a/include/text.php b/include/text.php index a738a281f5..f210bff721 100644 --- a/include/text.php +++ b/include/text.php @@ -19,11 +19,11 @@ function replace_macros($s,$r) { $stamp1 = microtime(true); - // "middleware": inject variables into templates - call_hooks("template_vars", $r); - - $a = get_app(); + + // pass $baseurl to all templates + $r['$baseurl'] = $a->get_baseurl(); + $t = $a->template_engine(); try { @@ -1024,8 +1024,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; @@ -1742,50 +1743,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)