当前位置: 首页>>代码示例>>PHP>>正文


PHP CI_Lang::__construct方法代码示例

本文整理汇总了PHP中CI_Lang::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP CI_Lang::__construct方法的具体用法?PHP CI_Lang::__construct怎么用?PHP CI_Lang::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CI_Lang的用法示例。


在下文中一共展示了CI_Lang::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: empty

 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;
     }
 }
开发者ID:kailIII,项目名称:Panel-de-administracion,代码行数:27,代码来源:MY_Lang.php

示例2: header

 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;
     }
 }
开发者ID:anhlethe,项目名称:Share,代码行数:26,代码来源:_MY_Lang.php

示例3: header

 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;
     }
 }
开发者ID:NaszvadiG,项目名称:codeigniter-extended,代码行数:30,代码来源:Lang.php

示例4: header

 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;
         }
     }
 }
开发者ID:postyim,项目名称:greenteathai,代码行数:25,代码来源:MY_Lang.php

示例5: header

 /**
  * __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;
     }
 }
开发者ID:Elangomanii,项目名称:sedarglobal,代码行数:40,代码来源:MY_Lang.php

示例6: isset

 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}");
         }
     }
 }
开发者ID:csiber,项目名称:CodeIgniter-Starter,代码行数:29,代码来源:MY_Lang.php

示例7: empty

 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']);
     }
 }
开发者ID:n3mz77,项目名称:CodeIgniter-multi-lang,代码行数:53,代码来源:MY_Lang.php

示例8:

 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;
     }
 }
开发者ID:Razican,项目名称:MegaPublik,代码行数:12,代码来源:MP_Lang.php

示例9:

 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]);
     }
 }
开发者ID:vanhungpc,项目名称:novaland,代码行数:13,代码来源:MY_Lang.php

示例10: __construct

 /**
  * 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'));
 }
开发者ID:rexcarnation,项目名称:XtraUpload-1,代码行数:27,代码来源:XU_Lang.php

示例11: explode

 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]);
//.........这里部分代码省略.........
开发者ID:ponchov,项目名称:quizzworld,代码行数:101,代码来源:MY_Lang.php

示例12: __construct

 /**
  * Constructor
  *
  * @access  public
  */
 public function __construct()
 {
     parent::__construct();
     log_message('debug', "TOC Language Class Initialized");
 }
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:10,代码来源:TOC_Lang.php

示例13:

 /**
  * The constructor initialize the library
  *
  * @return MY_Lang
  */
 function __construct()
 {
     parent::__construct();
 }
开发者ID:NaszvadiG,项目名称:ImageCMS,代码行数:9,代码来源:MY_Lang.php

示例14:

 function MY_Lang()
 {
     parent::__construct();
 }
开发者ID:ekchanthorn,项目名称:demo_loan,代码行数:4,代码来源:MY_Lang.php

示例15: array

 function __construct()
 {
     $this->_defaults = array('id' => 'id', 'en' => 'us');
     parent::__construct();
 }
开发者ID:rip-projects,项目名称:ark-php,代码行数:5,代码来源:MY_Lang.php


注:本文中的CI_Lang::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。