function MY_Lang() { parent::__construct(); global $CFG; global $URI; global $RTR; $this->uri = $URI->uri_string(); $this->default_uri = $RTR->default_controller; $uri_segment = $this->get_uri_lang($this->uri); $this->lang_code = $uri_segment['lang']; $url_ok = false; if (!empty($this->lang_code) && array_key_exists($this->lang_code, $this->languages)) { $language = $this->languages[$this->lang_code]; $CFG->set_item('language', $language); $url_ok = true; } if (!$url_ok && !$this->is_special($uri_segment['parts'][0])) { // set default language $CFG->set_item('language', $this->languages[$this->default_lang()]); $uri = !empty($this->uri) ? $this->uri : $this->default_uri; //OPB - modification to use i18n also without changing the .htaccess (without pretty url) $index_url = empty($CFG->config['index_page']) ? '' : $CFG->config['index_page'] . "/"; $new_url = $CFG->config['base_url'] . $index_url . $this->default_lang() . '/' . $uri; header("Location: " . $new_url, TRUE, 302); exit; } }
function MY_Lang() { parent::__construct(); global $CFG; global $URI; global $RTR; $this->uri = $URI->uri_string(); $this->default_uri = $RTR->default_controller; $uri_segment = $this->get_uri_lang($this->uri); $this->lang_code = $uri_segment['lang']; $url_ok = false; if (!empty($this->lang_code) && array_key_exists($this->lang_code, $this->languages)) { $language = $this->languages[$this->lang_code]; $CFG->set_item('language', $language); $url_ok = true; } if (!$url_ok && !$this->is_special($uri_segment['parts'][0])) { // set default language $CFG->set_item('language', $this->languages[$this->default_lang()]); $uri = !empty($this->uri) ? $this->uri : $this->default_uri; $uri = $uri[0] != '/' ? '/' . $uri : $uri; $new_url = $CFG->config['base_url'] . $this->default_lang(); header("Location: " . $new_url, TRUE, 302); exit; } }
function __construct() { parent::__construct(); global $CFG; global $URI; global $RTR; $this->uri = $URI->uri_string(); $this->default_uri = $RTR->default_controller; $uri_segment = $this->get_uri_lang($this->uri); $this->lang_code = $uri_segment['lang']; $url_ok = false; if (!empty($this->lang_code) && array_key_exists($this->lang_code, $this->languages)) { $language = $this->languages[$this->lang_code]; $CFG->set_item('language', $language); $url_ok = true; } if (!isset($_SERVER['HTTP_HOST'])) { return; } if (!$url_ok && !$this->is_special($uri_segment['parts'][0])) { // set default language $CFG->set_item('language', $this->languages[$this->default_lang()]); $uri = !empty($this->uri) ? $this->uri : $this->default_uri; $uri = $uri[0] != '/' ? '/' . $uri : $uri; $suffix = $CFG->item('url_suffix') == FALSE ? '' : $CFG->item('url_suffix'); $new_url = $CFG->slash_item('base_url') . $CFG->slash_item('index_page') . $this->default_lang() . $uri . $suffix; header("Location: " . $new_url, TRUE, 302); exit; } }
function __construct() { parent::__construct(); global $CFG; global $URI; global $RTR; $segment = $URI->segment(1); if (isset($this->languages[$segment])) { // URI with language -> ok $language = $this->languages[$segment]; $CFG->set_item('language', $language); } else { if ($this->is_special($segment)) { // special URI -> no redirect return; } else { // URI without language -> redirect to default_uri // set default language $CFG->set_item('language', $this->languages[$this->default_lang()]); // redirect header("Location: " . $CFG->site_url($this->localized($this->default_uri)), TRUE, 302); exit; } } }
/** * __construct * * @global mixed $CFG * @global mixed $URI * * @return void */ function MY_Lang() { parent::__construct(); global $CFG; global $URI; require_once APPPATH . "config/language.php"; $this->supported_languages = array_key_exists('supported_languages', $config) && !empty($config['supported_languages']) ? $config['supported_languages'] : $this->supported_languages; $this->current_language = array_key_exists('default_language', $config) && !empty($config['default_language']) ? $config['default_language'] : $this->current_language; $this->detect_language = array_key_exists('detect_language', $config) ? $config['detect_language'] : $this->detect_language; $this->default_uri = array_key_exists('default_uri', $config) ? $config['default_uri'] : $this->default_uri; $this->special_uris = array_key_exists('special_uris', $config) ? $config['special_uris'] : $this->special_uris; $this->uri = $URI->uri_string(); $uri_segment = $this->get_uri_lang($this->uri); $this->lang_code = $uri_segment['lang']; $url_ok = FALSE; if (!empty($this->lang_code) && array_key_exists($this->lang_code, $this->supported_languages)) { $language = $this->supported_languages[$this->lang_code]; $CFG->set_item('language', $language); $this->current_language = $this->lang_code; $url_ok = TRUE; } if (!$url_ok && !$this->is_special($uri_segment['parts'][0])) { // set default language $this->current_language = $this->default_lang(); $CFG->set_item('language', $this->supported_languages[$this->current_language]); $uri = !empty($this->uri) ? $this->uri : $this->default_uri; $uri = $uri[0] != '/' ? '/' . $uri : $uri; $new_url = $CFG->config['base_url'] . $this->default_lang() . $uri; header("Location: " . $new_url, TRUE, 302); exit; } }
function __construct() { parent::__construct(); $config =& get_config(); if (isset($config['languages']) && isset($config['redirect_urls'])) { global $URI, $CFG, $IN; //var_dump($URI); $subdomain = $this->get_subdomain(); $lang = isset($subdomain) ? $subdomain : ''; $uri = $URI->segments; if (strlen($lang) == 2 && array_key_exists($lang, $config['languages']) == true) { $config['language'] = $config['languages'][$lang]; $config['prefix_language'] = $lang; $config['base_url'] = "http://{$lang}." . $config['base_domain']; } elseif ($config['redirect_urls'] == true || strlen($lang) == 2 && array_key_exists($lang, $config['languages']) == false) { //todo: arreglar $url = $config['base_url']; $url .= empty($config['index_page']) ? '' : $config['index_page'] . '/'; $url .= array_search($config['language'], $config['languages']) . '/'; if (strlen($lang) == 2) { array_shift($uri); $url .= implode('/', $uri); } else { $url .= implode('/', $uri); } header("location: {$url}"); } } }
function __construct() { parent::__construct(); global $URI, $CFG, $IN; $config =& $CFG->config; $index_page = $config['index_page']; $lang_ignore = $config['lang_ignore']; $default_abbr = $config['language_abbr']; $lang_uri_abbr = $config['lang_uri_abbr']; $lang_ignore_url = $config['lang_ignore_url']; $uri_abbr = $URI->segment(1); if (in_array($uri_abbr, $lang_ignore_url)) { return; } // ignore url $URI->uri_string = preg_replace("|^\\/?|", '/', $URI->uri_string); if ($lang_ignore) { if (isset($lang_uri_abbr[$uri_abbr])) { $IN->set_cookie('user_lang', $uri_abbr, $config['sess_expiration']); } else { $lang_abbr = $IN->cookie($config['cookie_prefix'] . 'user_lang'); } if (strlen($uri_abbr) == 2) { $index_page .= empty($index_page) ? '' : '/'; $URI->uri_string = preg_replace("|^\\/?{$uri_abbr}\\/?|", '', $URI->uri_string); header('Location: ' . $config['base_url'] . $index_page . $URI->uri_string); exit; } } else { $lang_abbr = $uri_abbr; } if (isset($lang_uri_abbr[$lang_abbr])) { $this->_set_segment(); $URI->uri_string = preg_replace("|^\\/?{$lang_abbr}|", '', $URI->uri_string); $config['language'] = $lang_uri_abbr[$lang_abbr]; $config['language_abbr'] = $lang_abbr; if (!$lang_ignore) { $index_page .= empty($index_page) ? $lang_abbr : "/{$lang_abbr}"; $config['index_page'] = $index_page . '/'; } $IN->set_cookie('user_lang', $lang_abbr, $config['sess_expiration']); } else { if (!$lang_ignore) { $index_page .= empty($index_page) ? $default_abbr : "/{$default_abbr}"; if (strlen($lang_abbr) == 2) { $URI->uri_string = preg_replace("|^\\/?{$lang_abbr}|", '', $URI->uri_string); } header('Location: ' . $config['base_url'] . $index_page . $URI->uri_string); exit; } $IN->set_cookie('user_lang', $default_abbr, $config['sess_expiration']); } }
function __construct() { parent::__construct(); global $CFG, $URI, $RTR; $segment = $URI->segment(1); if (isset($this->languages[$segment])) { $language = $this->languages[$segment]; $CFG->set_item('language', $language); } else { return; } }
function __construct() { global $URI, $CFG; parent::__construct(); $CFG->load('mci_languages'); $this->mci_languages = $CFG->item('mci_languages'); $this->mci_hide_default = $CFG->item('mci_hide_default'); $this->mci_segment = $URI->segment(1, 0); $this->mci_default_language = array_search($CFG->item('language'), $this->mci_languages); if (array_key_exists($this->mci_segment, $this->mci_languages)) { $CFG->set_item('language', $this->mci_languages[$this->mci_segment]); } }
/** * Class constructor * * @return void */ public function __construct() { parent::__construct(); log_message('debug', 'XtraUpload Zend Locale Class Initialized'); try { $this->_default_locale = new Zend_Locale(); } catch (Exception $e) { $this->_default_locale = new Zend_Locale('en_US'); } if (!Zend_Locale::isLocale($this->_default_locale, true, false)) { if (!Zend_Locale::isLocale($this->_default_locale, false, false)) { throw new Zend_Locale_Exception("The locale '{$locale}' is no known locale"); } } $locale = APPPATH . "/language/{$this->_default_locale}/xtraupload.mo"; if (!is_file($locale)) { $this->_default_locale->setLocale('en_US'); } $this->_default_locale = new Zend_Locale($this->_default_locale); $this->_translate = new Zend_Translate('gettext', APPPATH . "/language/{$this->_default_locale}/xtraupload.mo", $this->_default_locale->getLanguage()); $this->_dbtypes = array('db_invalid_connection_str' => $this->lang('Unable to determine the database settings based on the connection string you submitted.'), 'db_unable_to_connect' => $this->lang('Unable to connect to your database server using the provided settings.'), 'db_invalid_query' => $this->lang('The query you submitted is not valid.'), 'db_must_set_table' => $this->lang('You must set the database table to be used with your query.'), 'db_must_use_set' => $this->lang('You must use the "set" method to update an entry.'), 'db_must_use_index' => $this->lang('You must specify an index to match on for batch updates.'), 'db_batch_missing_index' => $this->lang('One or more rows submitted for batch updating is missing the specified index.'), 'db_must_use_where' => $this->lang('Updates are not allowed unless they contain a "where" clause.'), 'db_del_must_use_where' => $this->lang('Deletes are not allowed unless they contain a "where" or "like" clause.'), 'db_field_param_missing' => $this->lang('To fetch fields requires the name of the table as a parameter.'), 'db_unsupported_function' => $this->lang('This feature is not available for the database you are using.'), 'db_transaction_failure' => $this->lang('Transaction failure: Rollback performed.'), 'db_unable_to_drop' => $this->lang('Unable to drop the specified database.'), 'db_unsuported_feature' => $this->lang('Unsupported feature of the database platform you are using.'), 'db_unsuported_compression' => $this->lang('The file compression format you chose is not supported by your server.'), 'db_filepath_error' => $this->lang('Unable to write data to the file path you have submitted.'), 'db_invalid_cache_path' => $this->lang('The cache path you submitted is not valid or writable.'), 'db_table_name_required' => $this->lang('A table name is required for that operation.'), 'db_column_name_required' => $this->lang('A column name is required for that operation.'), 'db_column_definition_required' => $this->lang('A column definition is required for that operation.'), 'db_error_heading' => $this->lang('A Database Error Occurred')); }
function __construct() { parent::__construct(); global $CFG; global $URI; global $RTR; //$_SESSION['dfksl']="dfkjsdlfslkfslk"; //echo "I am here"; //print_r($_SESSION); exit; //echo "I am here"; exit; //$_SESSION['choosen_language']='no'; /*ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1);*/ $this->host = str_replace("www.", "", $_SERVER['HTTP_HOST']); $segment = $URI->segment(1); if (!empty($segment) && !isset($this->languages[$segment]) && !empty($_SESSION['choosen_language']) && $_SESSION['choosen_language'] == 'yes') { //echo "I am here"; exit; return true; } if (isset($segment) && $segment == 'en') { //return true; //----------------------------------$_SESSION['choosen_language']='yes'; //----------------------------------return ; } //------------------- this is for enable en.domainname.com/en /*if(isset($segment) && $segment == 'en') { $url=$CFG->item('root_url'); $_SESSION['choosen_language']='yes'; header("Location: " . $url, TRUE, 302); exit; } else { $_SESSION['choosen_language']='no'; }*/ //print_r($_SESSION); exit; $subdomains = explode('.', $this->host); if (array_key_exists($subdomains[0], $this->languages)) { //echo "I am here"; exit; //echo $this->host; exit; //echo $this->host; //echo "<br>"; $CFG->set_item('base_url', "http://" . $this->host . "/"); $CFG->set_item('language', $this->languages[$subdomains[0]]); return true; } //echo $CFG->item('base_url');exit; //echo $CFG->item('base_url');exit; //echo "dkflsf"; exit; if (!empty($segment) && !isset($this->languages[$segment])) { //echo "I am here"; exit; //--------------------return true; } if (isset($this->languages[$segment])) { //print_r($segment); exit; $language = $this->languages[$segment]; //print_r($language ); exit; $CFG->set_item('language', $language); //echo $segment; exit; //--------------- $subdomains = explode('.', $this->host); //print_r($subdomains); exit; if (!array_key_exists($subdomains[0], $this->languages)) { //echo $CFG->site_url($this->localized($subdomains[0])); exit; //print_r($this->languages); exit; $CFG->set_item('base_url', "http://" . $segment . "." . $this->host . "/"); $final_url = $CFG->site_url(); if ($URI->uri_string) { $final_url .= $URI->uri_string; } //echo $final_url; exit; header("Location: " . $final_url, TRUE, 302); //exit; } //$CFG->set_item('base_url', "http://".$this->host."/"); //print_r($this->host); exit; return; //---------------- } else { if ($this->is_special($segment)) { return; } else { //$browser_lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); //print_r($browser_lang); exit; $subdomains = explode('.', $this->host); //print_r($subdomains); exit; //print_r($subdomains); exit; //print_r($this->languages); exit; if (array_key_exists($subdomains[0], $this->languages)) { //echo $CFG->site_url($this->localized($subdomains[0])); exit; header("Location: " . $CFG->site_url($this->localized($subdomains[0])), TRUE, 302); exit; } //------------- $browser_lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); //print_r($browser_lang); exit; if (array_key_exists($browser_lang, $this->languages)) { $CFG->set_item('language', $this->languages[$browser_lang]); } else { $CFG->set_item('language', $this->languages[$this->default_lang()]); } //--------------------------------if($CFG->item('language') == 'english') return true; //-------------- //echo $CFG->site_url($this->localized($this->default_uri)) ; exit; // set default language //echo $this->default_uri ;exit; // redirect //print_r($URI->uri_string); //echo $this->default_uri; exit; $language_code = array_search($CFG->item('language'), $this->languages); //print_r($subdomains[0]); if (!array_key_exists($subdomains[0], $this->languages)) { //echo "I am here"; exit; $CFG->set_item('base_url', "http://" . $language_code . "." . $this->host . "/"); } //echo $this->host; exit; $final_url = $CFG->site_url($this->localized($this->default_uri)); $final_url = rtrim(trim($final_url), '/'); //print_r($final_url); exit; if ($URI->uri_string) { $final_url .= "/" . $URI->uri_string; } //echo $final_url; exit; header("Location: " . $final_url, TRUE, 302); exit; } } }
/** * Constructor * * @access public */ public function __construct() { parent::__construct(); log_message('debug', "TOC Language Class Initialized"); }
/** * The constructor initialize the library * * @return MY_Lang */ function __construct() { parent::__construct(); }
function MY_Lang() { parent::__construct(); }
function __construct() { $this->_defaults = array('id' => 'id', 'en' => 'us'); parent::__construct(); }
/** * Constructor, creates object and load default idiom from config file. */ public function __construct() { parent::__construct(); $this->load_default_lang_idiom(); }