private static function _get_text($text, $language = null) { if (!$language) { $language = self::get_current_language(); } if (!array_key_exists($language, self::$_texts_cache)) { self::$_texts_cache[$language] = array(); } $text = trim($text); if (strpos($text, self::$_section_separator) === false) { if (!array_key_exists('__default', self::$_texts_cache[$language])) { $iniFile = ZPHP::get_resources_dir() . '/lang/' . $language . '.ini'; self::$_texts_cache[$language]['__default'] = []; @($language_ini_contents = file_get_contents($iniFile)); foreach (explode("\n", $language_ini_contents) as $line) { $line = trim($line); if (!$line || strpos($line, '=') === false) { continue; } list($key, $value) = explode('=', $line, 2); $key = trim($key); $value = trim($value); self::$_texts_cache[$language]['__default'][$key] = $value; } } if (array_key_exists($text, self::$_texts_cache[$language]['__default'])) { return self::$_texts_cache[$language]['__default'][$text]; } $text = self::$_default_section . self::$_section_separator . $text; } list($section, $text) = explode(self::$_section_separator, $text, 2); if (!array_key_exists($section, self::$_texts_cache[$language])) { $path = app_path() . '/../resources/lang/' . $language . '/' . $section . '.php'; if (file_exists($path)) { self::$_texts_cache[$language][$section] = (include $path); } else { self::$_texts_cache[$language][$section] = array(); } } if (array_key_exists($text, self::$_texts_cache[$language][$section])) { return self::$_texts_cache[$language][$section][$text]; } return ''; }
public static function get_html_charset($default = null) { return ZPHP::get_app_charset($default); }
public static function location_error_not_found($not_found_page_url = null) { if (!$not_found_page_url) { $not_found_page_url = ZPHP::get_actual_uri(); } $not_found_page_control_classname = ZPHP::get_config('redirect_control_special_pages_not_found_page_control'); if ($not_found_page_control_classname) { $not_found_page_control = ClassHelper::create_instance($not_found_page_control_classname); } else { $not_found_page_control = null; } header("HTTP/1.0 404 Not Found"); if ($not_found_page_control) { $not_found_page_control->out(); } die; }