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


PHP Lang::getDefaultLang方法代码示例

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


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

示例1: setParams

 protected function setParams()
 {
     global $routes;
     $do = $this->request->get('do', '');
     unset($this->request->get['do']);
     unset($this->request->request['do']);
     if (!empty($do) && (preg_match('/^(?P<lang>[a-zA-Z]{2})\\/(?P<target>[a-zA-Z0-9]+)\\/(?P<action>[a-zA-Z0-9]+)\\/?(?P<params>.*?)?\\/?$/', $do, $matches) || preg_match('/^(?P<lang>[a-zA-Z]{2})\\/(?P<target>[a-zA-Z0-9]+)\\/?(?P<params>.*?)?\\/?$/', $do, $matches) || preg_match('/^(?P<target>[a-zA-Z0-9]{3,})\\/(?P<action>[a-zA-Z0-9]+)\\/?(?P<params>.*?)?\\/?$/', $do, $matches) || preg_match('/^(?P<target>[a-zA-Z0-9]{3,})\\/?(?P<params>.*?)?\\/?$/', $do, $matches) || preg_match('/^(?P<lang>[a-zA-Z]{2})\\/?$/', $do, $matches))) {
     }
     $lang = !empty($matches['lang']) ? $matches['lang'] : '';
     $this->target = !empty($matches['target']) ? $matches['target'] : DEFAULT_CONTROLLER_TARGET;
     $this->action = !empty($matches['action']) ? $matches['action'] : DEFAULT_CONTROLLER_ACTION;
     $this->params = !empty($matches['params']) ? explode('/', $matches['params']) : array();
     $router = new Router($lang, $routes);
     $router->dispatch($this);
     $this->route = $this->target . '/' . $this->action . '/' . implode('/', $this->params);
     $this->uri = ROOT_HTTP . $this->target . '/' . $this->action . '/';
     if (empty($lang)) {
         $lang = Lang::getDefaultLang();
     }
     $this->lang = new Lang($lang);
     $this->querystring = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
     $this->querystring = (!empty($this->querystring) ? '?' : '') . $this->querystring;
     if (get_magic_quotes_gpc()) {
         $this->request = Utils::stripslashes($this->request);
         $this->post = Utils::stripslashes($this->post);
         $this->get = Utils::stripslashes($this->get);
     }
     $this->session = !SESSION_DISABLED ? Session::getInstance(SESSION_DEFAULT_NAME) : null;
 }
开发者ID:vincenthib,项目名称:visiteztokyo,代码行数:29,代码来源:Controller.class.php

示例2: init

 public function init()
 {
     $this->app = Yii::app();
     $this->showSearchForm = false;
     $this->defaultLang = Yii::app()->language;
     $this->activeLangs = array($this->defaultLang => $this->defaultLang);
     if (!isFree()) {
         $this->defaultLang = Lang::getDefaultLang();
         $this->activeLangs = Lang::getActiveLangs();
     }
     parent::init();
 }
开发者ID:barricade86,项目名称:raui,代码行数:12,代码来源:MainController.php

示例3: init

 public function init()
 {
     Yii::import('application.modules.notifier.models.NotifierModel');
     $this->lang['admin'] = Lang::getAdminMailLang();
     $this->lang['default'] = Lang::getDefaultLang();
     $this->lang['current'] = Yii::app()->language;
     Yii::app()->setLanguage($this->lang['admin']);
     $this->_adminRules = array('onNewBooking' => array('fields' => array('username', 'comment', 'useremail', 'phone', 'date_start', 'date_end', 'apartment_id', 'ownerEmail'), 'i18nFields' => array('time_inVal', 'time_outVal', 'type'), 'active' => param('module_notifier_adminNewBooking', 1)), 'onNewSimpleBookingForRent' => array('fields' => array('username', 'comment', 'useremail', 'phone', 'date_start', 'date_end'), 'i18nFields' => array('time_inVal', 'time_outVal', 'type'), 'active' => param('module_notifier_adminNewBooking', 1)), 'onNewSimpleBookingForBuy' => array('fields' => array('username', 'comment', 'useremail', 'phone'), 'i18nFields' => array('type'), 'active' => param('module_notifier_adminNewBooking', 1)), 'onNewUser' => array('fields' => array('email', 'username'), 'url' => array('/users/backend/main/admin'), 'active' => param('module_notifier_adminNewUser', 1)), 'onNewContactform' => array('fields' => array('name', 'email', 'phone', 'theme', 'body'), 'active' => param('module_notifier_adminNewContactform', 1)), 'onOfflinePayment' => array('fields' => array('amount', 'currency_charcode'), 'active' => param('module_notifier_adminNewPayment', 1)), 'onRequestProperty' => array('fields' => array('senderName', 'senderEmail', 'senderPhone', 'body', 'ownerName', 'ownerEmail', 'apartmentUrl'), 'active' => param('module_request_property_send_admin', 1)), 'onNewComment' => array('fields' => array('rating', 'user_email', 'body', 'user_name'), 'active' => param('module_notifier_userNewComment', 1)), 'onNewApartment' => array('fields' => array('id'), 'active' => param('module_notifier_adminNewApartment', 1), 'url' => array('/apartments/backend/main/admin')), 'onNewComplain' => array('fields' => array('apartment_id', 'email', 'name', 'body'), 'active' => param('module_notifier_adminNewComplain', 1)), 'onNewReview' => array('fields' => array('name', 'body'), 'active' => param('module_notifier_adminNewReview', 1)));
     Yii::app()->setLanguage($this->lang['current']);
     $this->setLang();
     $this->_userRules = array('onNewBooking' => array('fields' => array('username', 'comment', 'useremail', 'phone', 'date_start', 'date_end', 'apartment_id'), 'i18nFields' => array('time_inVal', 'time_outVal', 'type'), 'active' => param('module_notifier_ownerNewBooking', 1)), 'onNewUser' => array('fields' => array('email', 'password', 'activateLink'), 'url' => array('/usercpanel/main/index'), 'active' => param('module_notifier_userNewUser', 1)), 'onRecoveryPassword' => array('fields' => array('email', 'temprecoverpassword', 'recoverPasswordLink'), 'url' => array('/usercpanel/main/index'), 'active' => 1), 'onNewComment' => array('fields' => array('rating', 'user_email', 'body', 'user_name'), 'active' => param('module_notifier_adminNewComment', 1)), 'onRequestProperty' => array('fields' => array('senderName', 'senderEmail', 'senderPhone', 'body', 'ownerName', 'apartmentUrl', 'ownerEmail'), 'active' => param('module_request_property_send_user', 1)), 'onNewAgent' => array('fields' => array('username', 'email', 'phone'), 'active' => param('module_notifier_new_agent', 1)), 'onNewPrivateMessage' => array('fields' => array('username', 'messageEmailSend'), 'url' => array('/usercpanel/main/index'), 'active' => param('module_messages_private_message', 1)));
     $this->init = 1;
     $this->restoreLang();
 }
开发者ID:barricade86,项目名称:raui,代码行数:14,代码来源:Notifier.php

示例4: init

 public function init()
 {
     Yii::import('application.modules.notifier.models.NotifierModel');
     $this->lang['admin'] = Lang::getAdminMailLang();
     $this->lang['default'] = Lang::getDefaultLang();
     $this->lang['current'] = Yii::app()->language;
     Yii::app()->setLanguage($this->lang['admin']);
     $this->_adminRules = array('onNewBooking' => array('fields' => array('username', 'comment', 'useremail', 'phone', 'date_start', 'date_end', 'apartment_id', 'ownerEmail'), 'i18nFields' => array('time_inVal', 'time_outVal', 'type'), 'active' => param('module_notifier_adminNewBooking', 1)), 'onNewUser' => array('fields' => array('email', 'username'), 'url' => array('/users/backend/main/admin'), 'active' => param('module_notifier_adminNewUser', 1)), 'onNewContactform' => array('fields' => array('name', 'email', 'phone', 'body'), 'subject' => tt('New message (contact form)', 'notifier'), 'body' => tt('New message from ::name (::email ::phone). Message text: ::body', 'notifier') . "\n", 'active' => param('module_notifier_adminNewContactform', 1)), 'onOfflinePayment' => array('fields' => array('amount', 'currency_charcode'), 'subject' => tt('New payment through a bank.', 'notifier'), 'body' => tt('New payment through a bank in the amount of ::amount ::currency_charcode', 'notifier'), 'active' => param('module_notifier_adminNewPayment', 1)), 'onRequestProperty' => array('fields' => array('senderName', 'senderEmail', 'senderPhone', 'body', 'ownerName', 'ownerEmail', 'apartmentUrl'), 'active' => param('module_request_property_send_admin', 1)), 'onNewComment' => array('fields' => array('rating', 'user_email', 'body', 'user_name'), 'active' => param('module_notifier_userNewComment', 1)), 'onNewApartment' => array('fields' => array('id'), 'active' => param('module_notifier_adminNewApartment', 1)), 'onNewComplain' => array('fields' => array('apartment_id', 'email', 'name', 'body'), 'subject' => Yii::t('module_notifier', 'New complain added.'), 'body' => Yii::t('module_notifier', 'New complain was added. From ::name (::email). Complain text: ::body') . "\n" . Yii::t('module_notifier', 'You can view it at') . ' ::host' . Yii::app()->controller->createUrl('/apartmentsComplain/backend/main/admin'), 'active' => param('module_notifier_adminNewComplain', 1)), 'onNewReview' => array('fields' => array('name', 'body'), 'active' => param('module_notifier_adminNewReview', 1)));
     Yii::app()->setLanguage($this->lang['current']);
     $this->setLang();
     $this->_userRules = array('onNewBooking' => array('fields' => array('username', 'comment', 'useremail', 'phone', 'date_start', 'date_end', 'apartment_id'), 'i18nFields' => array('time_inVal', 'time_outVal', 'type'), 'active' => param('module_notifier_ownerNewBooking', 1)), 'onNewUser' => array('fields' => array('email', 'password', 'activateLink'), 'url' => array('/usercpanel/main/index'), 'active' => param('module_notifier_userNewUser', 1)), 'onRecoveryPassword' => array('fields' => array('email', 'temprecoverpassword', 'recoverPasswordLink'), 'url' => array('/usercpanel/main/index'), 'active' => 1), 'onNewComment' => array('fields' => array('rating', 'user_email', 'body', 'user_name'), 'active' => param('module_notifier_adminNewComment', 1)), 'onRequestProperty' => array('fields' => array('senderName', 'senderEmail', 'senderPhone', 'body', 'ownerName', 'apartmentUrl', 'ownerEmail'), 'active' => param('module_request_property_send_user', 1)), 'onNewAgent' => array('fields' => array('username', 'email', 'phone'), 'active' => param('module_notifier_new_agent', 1)));
     $this->init = 1;
     $this->restoreLang();
 }
开发者ID:alexjkitty,项目名称:estate,代码行数:14,代码来源:Notifier.php

示例5: actionError

 public function actionError()
 {
     if (demo()) {
         $defaultLang = Lang::getDefaultLang();
         if ($defaultLang == Yii::app()->request->getPathInfo() && $defaultLang) {
             $this->redirect(array('/site/index'));
         }
     }
     $this->layout = '//layouts/inner';
     if ($error = Yii::app()->errorHandler->error) {
         if (Yii::app()->request->isAjaxRequest) {
             echo $error['message'];
         } else {
             $this->render('error', $error);
         }
     }
 }
开发者ID:barricade86,项目名称:raui,代码行数:17,代码来源:SiteController.php

示例6: setLang

function setLang($lang = null)
{
    if (isFree()) {
        return;
    }
    $app = Yii::app();
    $lang = $lang ? $lang : Lang::getDefaultLang();
    $app->setLanguage($lang);
    $activeLangs = Lang::getActiveLangs();
    if (isset($_GET['lang'])) {
        $tmplang = $_GET['lang'];
        //deb($tmplang);
        if (isset($activeLangs[$tmplang])) {
            $lang = $tmplang;
            $app->setLanguage($lang);
        }
        setLangCookie($lang);
        /*
         * другой код, например обновление кеша некоторых компонентов, которые изменяются при смене языка
         */
    } else {
        $user = $app->user;
        if ($user->hasState('_lang')) {
            $tmplang = $user->getState('_lang');
            if (isset($activeLangs[$tmplang])) {
                $lang = $tmplang;
                $app->setLanguage($lang);
            } else {
                setLangCookie($lang);
            }
        } else {
            if (isset($app->request->cookies['_lang'])) {
                $tmplang = $app->request->cookies['_lang']->value;
                if (isset($activeLangs[$tmplang])) {
                    $lang = $tmplang;
                    $app->setLanguage($lang);
                } else {
                    setLangCookie($lang);
                }
            }
        }
    }
    Lang::getActiveLangs(false, true);
}
开发者ID:barricade86,项目名称:raui,代码行数:44,代码来源:common.php

示例7: actionViewFeed

 public function actionViewFeed()
 {
     $oldLang = Yii::app()->language;
     Controller::disableProfiler();
     $defaultLangs = Lang::getDefaultLang();
     Yii::app()->language = $defaultLangs;
     // если есть русский или украинский языки, но они не дефолтные. установим на время их.
     if ($defaultLangs != 'ru' || $defaultLangs != 'uk') {
         $allLangs = Lang::getActiveLangs();
         if (array_key_exists('ru', $allLangs)) {
             Yii::app()->language = 'ru';
         } elseif (array_key_exists('uk', $allLangs)) {
             Yii::app()->language = 'uk';
         }
     }
     $items = $this->generateFeed();
     if (is_array($items) && count($items) > 0) {
         header('Content-type: text/xml');
         header('Pragma: public');
         header('Cache-control: private');
         header('Expires: -1');
         $xmlWriter = new XMLWriter();
         $xmlWriter->openMemory();
         $xmlWriter->setIndent(true);
         $xmlWriter->startDocument('1.0', 'UTF-8');
         $xmlWriter->startElement('realty-feed');
         $xmlWriter->writeAttribute('xmlns', 'http://webmaster.yandex.ru/schemas/feed/realty/2010-06');
         $xmlWriter->writeElement('generation-date', $this->generationDate);
         foreach ($items as $item) {
             if (isset($item['id'])) {
                 $this->prepareItem($item, $xmlWriter);
             }
         }
         $xmlWriter->endElement();
         // end realty-feed (xmlns)
         echo $xmlWriter->outputMemory();
     } else {
         echo 'no elements';
     }
     // установим обратно пользовательский язык
     Yii::app()->language = $oldLang;
 }
开发者ID:barricade86,项目名称:raui,代码行数:42,代码来源:MainController.php

示例8: init

 public function init()
 {
     parent::init();
     if (isFree()) {
         $this->defLang = Yii::app()->language;
         $this->currLang = Yii::app()->language;
         $this->mask = 'type;priceType;objType;countryName;regionName;cityName;isPricePoa;price;priceTo;numberRooms;floor;floorTotal;square;landSquare;sleeps;title;description;near;location;exchange;bathroom;safety;comfort;kitchen;employment;entertainment;services;terms;photos;lat;lng';
     } else {
         $this->allLangs = Lang::model()->findAll(array('condition' => 'active = 1'));
         $this->mask = 'type;priceType;objType;countryName;regionName;cityName;isPricePoa;price;priceTo;numberRooms;floor;floorTotal;square;landSquare;sleeps';
         $this->defLang = Lang::getDefaultLang();
         $this->currLang = Yii::app()->language;
         if ($this->allLangs) {
             foreach ($this->i18nMaskFields as $i18nMaskField) {
                 foreach ($this->allLangs as $lang) {
                     $this->mask .= ";{$i18nMaskField}_{$lang->name_iso}";
                 }
             }
         }
         $this->mask .= ';bathroom;safety;comfort;kitchen;employment;entertainment;services;terms;photos;lat;lng';
     }
 }
开发者ID:barricade86,项目名称:raui,代码行数:22,代码来源:MainController.php

示例9: setParams

 protected function setParams()
 {
     global $routes;
     $do = $this->request->get('do', '');
     unset($this->request->get['do']);
     unset($this->request->request['do']);
     if (!empty($do) && (preg_match('/^(?P<lang>[a-zA-Z]{2})\\/(?P<target>[a-zA-Z0-9]+)\\/(?P<action>[a-zA-Z0-9]+)\\/?(?P<params>.*?)?\\/?$/', $do, $matches) || preg_match('/^(?P<lang>[a-zA-Z]{2})\\/(?P<target>[a-zA-Z0-9]+)\\/?(?P<params>.*?)?\\/?$/', $do, $matches) || preg_match('/^(?P<target>[a-zA-Z0-9]{3,})\\/(?P<action>[a-zA-Z0-9]+)\\/?(?P<params>.*?)?\\/?$/', $do, $matches) || preg_match('/^(?P<target>[a-zA-Z0-9]{3,})\\/?(?P<params>.*?)?\\/?$/', $do, $matches) || preg_match('/^(?P<lang>[a-zA-Z]{2})\\/?$/', $do, $matches))) {
     }
     $lang = !empty($matches['lang']) ? $matches['lang'] : '';
     $this->target = !empty($matches['target']) ? $matches['target'] : 'home';
     $this->action = !empty($matches['action']) ? $matches['action'] : 'index';
     $this->params = !empty($matches['params']) ? explode('/', $matches['params']) : array();
     /*
     echo 'LANG >> '.$lang.'<br>';
     echo 'TARGET >> '.print_r($this->target, true).'<br>';
     echo 'ACTION >> '.print_r($this->action, true).'<br>';
     echo 'PARAMS >> '.print_r($this->params, true).'<br>';
     */
     $router = new Router($lang, $routes);
     $router->dispatch($this);
     //$path = trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/');
     //$root_path = trim(ROOT_DIR.'/'.(!empty($lang) ? $lang : ''), '/');
     $this->route = $this->target . '/' . $this->action . '/' . implode('/', $this->params);
     $this->uri = ROOT_HTTP . $this->target . '/' . $this->action . '/';
     if (empty($lang)) {
         $lang = Lang::getDefaultLang();
     }
     $this->lang = new Lang($lang);
     $this->querystring = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
     $this->querystring = (!empty($this->querystring) ? '?' : '') . $this->querystring;
     if (get_magic_quotes_gpc()) {
         $this->request = Utils::stripslashes($this->request);
         $this->post = Utils::stripslashes($this->post);
         $this->get = Utils::stripslashes($this->get);
     }
 }
开发者ID:erichub,项目名称:Presence-V-0.1,代码行数:36,代码来源:Controller.class.php

示例10: createUrl

 public function createUrl($route, $params = array(), $ampersand = '&')
 {
     if ($route != 'min/serve' && $route != 'site/uploadimage') {
         $langs = Lang::getActiveLangs();
         $countLangs = count($langs);
         $defaultLang = Lang::getDefaultLang();
         if (isset($params['lang']) && $params['lang'] == $defaultLang && $this->isInstalled) {
             if (!param('useBootstrap')) {
                 unset($params['lang']);
             }
         } else {
             if (Yii::app()->language != $defaultLang && !isFree() && empty($params['lang']) && $countLangs > 1) {
                 $params['lang'] = Yii::app()->language;
             }
         }
         if (!$this->isInstalled && $countLangs == 1 && $route != 'install') {
             $params['lang'] = Yii::app()->language;
         }
         if (!$this->isInstalled && $countLangs > 1 && !isset($params['lang']) && $route != 'install') {
             $params['lang'] = Yii::app()->language;
         }
     }
     return parent::createUrl($route, $params, $ampersand);
 }
开发者ID:barricade86,项目名称:raui,代码行数:24,代码来源:CustomUrlManager.php

示例11: getI18nTimeOut

 public function getI18nTimeOut($time_out)
 {
     $result = array();
     $default = Lang::getDefaultLang();
     $admin = Lang::getAdminMailLang();
     $current = Yii::app()->language;
     $sql = 'SELECT title_' . $default . ' as title FROM {{apartment_times_in}} WHERE id=' . $time_out;
     $result['default'] = Yii::app()->db->createCommand($sql)->queryScalar();
     if ($admin != $default) {
         $sql = 'SELECT title_' . $admin . ' as title FROM {{apartment_times_in}} WHERE id=' . $time_out;
         $result['admin'] = Yii::app()->db->createCommand($sql)->queryScalar();
     } else {
         $result['admin'] = $result['default'];
     }
     if ($current != $default) {
         $sql = 'SELECT title_' . $current . ' as title FROM {{apartment_times_in}} WHERE id=' . $time_out;
         $result['current'] = Yii::app()->db->createCommand($sql)->queryScalar();
     } else {
         $result['current'] = $result['default'];
     }
     return $result;
 }
开发者ID:alexjkitty,项目名称:estate,代码行数:22,代码来源:MainController.php

示例12: preparePosting

 public static function preparePosting(Apartment $model)
 {
     if ($model) {
         $message = '';
         $defaultLang = Lang::getDefaultLang();
         $tmp = 'title_' . $defaultLang;
         if (isset($model->{$tmp})) {
             $message .= $model->{$tmp};
         }
         // vkontakte
         if (SocialpostingModel::getSocialParamValue('useVkontakte')) {
             $vkApId = SocialpostingModel::getSocialParamValue('vkontakteApplicationId');
             $vkToken = SocialpostingModel::getSocialParamValue('vkontakteToken');
             $vkUsId = SocialpostingModel::getSocialParamValue('vkontakteUserId');
             //if ($vkApId && $vkToken && !is_numeric($model->autoVKPostId)) {
             if ($vkApId && $vkToken && utf8_strlen($model->autoVKPostId) < 1) {
                 if ($message) {
                     $imageUrl = null;
                     $res = Images::getMainThumb(300, 200, $model->images);
                     if ($res['link']) {
                         $imageUrl = $res['link'];
                     }
                     $post = self::addPostToVK($message, $vkApId, $vkToken, $vkUsId, $model->getUrl(), $imageUrl);
                     //logs(var_export($post, false));
                     //logs(var_export($post, true));
                     $postId = '0';
                     if ($post && isset($post->response)) {
                         $postId = isset($post->response->post_id) && $post->response->post_id ? $post->response->post_id : 0;
                     }
                     $model->autoVKPostId = $postId;
                     $model->update(array('autoVKPostId'));
                     /*$sql = 'UPDATE {{apartment}} SET autoVKPostId = "'.strip_tags(addslashes($postId)).'" WHERE id = '.$model->id;
                     		Yii::app()->db->createCommand($sql)->execute();*/
                 }
             }
         }
         // twitter
         if (SocialpostingModel::getSocialParamValue('useTwitter')) {
             $twApiKey = SocialpostingModel::getSocialParamValue('twitterApiKey');
             $twApiSecret = SocialpostingModel::getSocialParamValue('twitterApiSecret');
             $twTokenKey = SocialpostingModel::getSocialParamValue('twitterTokenKey');
             $twTokenSecret = SocialpostingModel::getSocialParamValue('twitterTokenSecret');
             //if ($twApiKey && $twApiSecret && $twTokenKey && $twTokenSecret && !is_numeric($model->autoTwitterPostId)) {
             if ($twApiKey && $twApiSecret && $twTokenKey && $twTokenSecret && utf8_strlen($model->autoTwitterPostId) < 1) {
                 if ($message) {
                     $post = self::addPostToTw($message, $twApiKey, $twApiSecret, $twTokenKey, $twTokenSecret, $model->getUrl());
                     //logs(var_export($post, false));
                     //logs(var_export($post, true));
                     $postId = '0';
                     if ($post && isset($post->id_str)) {
                         $postId = $post->id_str ? $post->id_str : 0;
                     }
                     $model->autoTwitterPostId = strip_tags(addslashes($postId));
                     $model->update(array('autoTwitterPostId'));
                     /*$sql = 'UPDATE {{apartment}} SET autoTwitterPostId = "'.strip_tags(addslashes($postId)).'" WHERE id = '.$model->id;
                     		Yii::app()->db->createCommand($sql)->execute();*/
                 }
             }
         }
     }
     return true;
 }
开发者ID:barricade86,项目名称:raui,代码行数:62,代码来源:SocialpostingModel.php

示例13: getForView

 /**
  * @param $url
  * @param $modelName
  * @return SeoFriendlyUrl
  */
 public static function getForView($url, $modelName)
 {
     if (param('urlExtension')) {
         $url = rstrtrim($url, '.html');
     }
     $seo = SeoFriendlyUrl::model()->findByAttributes(array('model_name' => $modelName, 'url_' . Yii::app()->language => $url));
     if ($seo) {
         $activeLangs = Lang::getActiveLangs();
         foreach ($activeLangs as $lang) {
             $field = 'url_' . $lang;
             if (isset(self::$_prefixUrlArray[$modelName]) && isset($seo->{$field})) {
                 $prefix = $seo->direct_url ? '' : ($lang == Lang::getDefaultLang() ? '' : $lang . '/') . self::$_prefixUrlArray[$modelName];
                 if ($seo->{$field}) {
                     self::$seoLangUrls[$lang] = Yii::app()->baseUrl . '/' . $prefix . $seo->{$field} . (param('urlExtension') ? '.html' : '');
                 } else {
                     self::$seoLangUrls[$lang] = Yii::app()->baseUrl . '/' . $prefix . $seo->model_id;
                 }
                 //deb(self::$seoLangUrls);exit;
             }
         }
     }
     return $seo;
 }
开发者ID:barricade86,项目名称:raui,代码行数:28,代码来源:SeoFriendlyUrl.php

示例14: getI18nTypesArray

 /** For Notifier
  * @return array
  */
 public static function getI18nTypesArray()
 {
     $types = array();
     self::fillI18nArray($types, 'current', Yii::app()->language);
     self::fillI18nArray($types, 'default', Lang::getDefaultLang());
     self::fillI18nArray($types, 'admin', Lang::getAdminMailLang());
     return $types;
 }
开发者ID:alexjkitty,项目名称:estate,代码行数:11,代码来源:Apartment.php


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