本文整理汇总了PHP中Settings::toLatin方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::toLatin方法的具体用法?PHP Settings::toLatin怎么用?PHP Settings::toLatin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings::toLatin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createUrl
public function createUrl($route, $params = array(), $ampersand = '&')
{
if (empty($params['language']) && Yii::app()->language !== 'ru') {
$params['language'] = Yii::app()->language;
}
if (!isset(Yii::app()->controller->module->id)) {
if (!strstr($route, 'register')) {
if (isset($_POST['city'])) {
$cookie = new CHttpCookie('city', $_POST['city']);
Yii::app()->request->cookies['city'] = $cookie;
$cookie->expire = time() + 3600;
$c = City::model()->localized('ru')->findByPk($_POST['city'])->name;
$params['city'] = Settings::toLatin($c);
} elseif (isset(Yii::app()->request->cookies['city'])) {
$c = City::model()->localized('ru')->findByPk(Yii::app()->request->cookies['city']->value)->name;
$params['city'] = Settings::toLatin($c);
} else {
unset($params['city']);
}
} else {
unset($params['city']);
}
}
/*if (!strstr($route,'/')) {
$route = '/cat/'.$route;
}*/
return Yii::app()->request->hostInfo . parent::createUrl($route, $params, $ampersand);
}
示例2: actionIndex
public function actionIndex()
{
$urls = array();
// Actions
$urls[] = $this->createUrl('actions/index');
$actions = Actions::model()->findAll('t.picture != "" AND t.date_end <= ' . date('Y-m-d'));
if (count($actions) > 0) {
foreach ($actions as $action) {
$urls[] = $this->createUrl('actions/view', array('id' => $action->id));
}
}
// Tenders
$urls[] = $this->createUrl('tenders/index');
$tenders = Tenders::model()->findAll('t.date_end <= ' . date('Y-m-d'));
if (count($tenders) > 0) {
foreach ($tenders as $tender) {
$urls[] = $this->createUrl('tenders/view', array('id' => $tender->id));
}
}
// Freefoto
$urls[] = $this->createUrl('freefoto/index');
// Static Pages
$urls[] = $this->createUrl('page/hmagent');
$urls[] = $this->createUrl('page/advertisment');
$urls[] = $this->createUrl('page/help_us');
$urls[] = $this->createUrl('page/about');
$urls[] = $this->createUrl('page/accounts');
// News
$urls[] = $this->createUrl('page/news');
$news = News::model()->findAll('t.title != "" AND t.intro_text != ""');
if (count($news) > 0) {
foreach ($news as $item) {
$urls[] = $this->createUrl('page/news', array('id' => $item->id));
}
}
// Categories
$cats = Occupation::model()->localized('ru')->findAll(array('condition' => 't.name!="" AND t.active=1', 'order' => 't.cat_id ASC'));
if (count($cats) > 0) {
foreach ($cats as $cat) {
$urls[] = $this->createUrl('/cat/view', array('id' => 'c' . $cat->id . '_' . Settings::toLatin($cat->name)));
}
}
// Users
$users = Users::model()->findAll('t.name!="" AND t.activate=1');
if (count($users) > 0) {
foreach ($users as $user) {
if ($user->filesCount >= 4 || $user->videosCount >= 4 || $user->floCount >= 4) {
$urls[] = '/id' . $user->id;
// Photo albums
if ($user->occupation_id == 1) {
$alb = Portfolio::model()->findAllByAttributes(array('uid' => $user->id, 'visible' => 1));
if (count($alb) > 0) {
foreach ($alb as $item) {
if ($item->filesCount > 0) {
$urls[] = $this->createUrl('user/album', array('id' => $item->id));
}
}
}
}
// Video albums
if ($user->occupation_id == 2) {
$vid = Video::model()->findAllByAttributes(array('uid' => $user->id, 'visible' => 1));
if (count($vid) > 0) {
foreach ($vid as $item) {
if ($item->filesCount > 0) {
$urls[] = $this->createUrl('user/videoalbum', array('id' => $item->id));
}
}
}
}
}
}
}
// Photo albums
$users_alb = Users::model()->findAll('t.name!="" AND t.activate=1 AND t.occupation_id=1');
if (count($users_alb) > 0) {
foreach ($users_alb as $user_alb) {
if ($user_alb->filesCount >= 4 || $user->videosCount >= 4 || $user->floCount >= 4) {
$urls[] = '/id' . $user->id;
}
}
}
/*// Страницы
$pages = Page::model()->findAll(array(
'condition' => 't.public = 1';
));
foreach ($posts as $page){
$urls[] = $this->createUrl('page/view', array('alias'=>$page->alias));
}
// Новости
$news = News::model()->findAll(array(
'condition' => 't.public = 1';
));
foreach ($news as $new){
$urls[] = $this->createUrl('news/view', array('id'=>$new->id));
}
// Работы портфолио
$works = Work::model()->findAll(array(
//.........这里部分代码省略.........
示例3: array
<?php
/* @var $this ProfileController */
$this->breadcrumbs = array(Occupation::getName($model->occupation_id) => $this->createUrl('cat/view', array('alias' => Settings::toLatin(Occupation::getName($model->occupation_id)))), $model->name);
if (!Yii::app()->user->isGuest) {
if (Yii::app()->user->id != $model->id) {
Users::addHit($model->id);
}
} else {
Users::addHit($model->id);
}
Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/min/jquery.nanoscroller.min.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/min/jquery.stellar.min.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/min/jquery.fancybox.pack.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/min/jquery.tooltipster.min.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/masked.js');
?>
<script>
$(document).ready(function(){
$("#phone").mask("+38(999) 999-99-99");
$("#phone_user").click(function(){
$.ajax({
url: '<?php
echo $this->createUrl('/user/getphone');
?>
',
type: "POST",
data: {'id':$('#phone_user').attr('data-phone')},
success: function (data) {
示例4: foreach
foreach ($list as $k => $v) {
//if($i%8==0) {
// echo '</ul></li>';
// echo ' <li class="dropdownmenu__item">
// <ul class="dropdownmenu__item__list">';
//}
echo '<li class="dropdownmenu__item__list__item"><h3 class="dropdownmenu__item__list__item__title">' . $v->name . '</h3></li>';
$model = new Occupation();
$list1 = $model->localized('ru')->findAll('cat_id=:cid', array(':cid' => $v->id));
$i = 1;
foreach ($list1 as $k1 => $v1) {
//echo '<li class="dropdownmenu__item__list__item"><a href="" class="dropdownmenu__item__list__item__link">Воздушные акробаты<span class="dropdown__link__col"> (25)</span></a></li>';
if ($v1->alias != '') {
$alias = $v1->alias;
} else {
$alias = Settings::toLatin($v1->name);
Occupation::model()->updateByPk($v1->id, array('alias' => $alias));
}
if (Yii::app()->getRequest()->getParam('id') == $v1->id && Yii::app()->controller->id == 'cat') {
echo '<li class="dropdownmenu__item__list__item"><a href="' . $this->createUrl('/cat/view', array('alias' => $alias)) . '" class="dropdownmenu__item__list__item__link dropdownmenu__item__list__item__link--current">' . $v1->name . '<span class="dropdown__link__col"> (' . Occupation::CalcUsers($v1->id) . ')</span></a></li>';
} else {
echo '<li class="dropdownmenu__item__list__item"><a href="' . $this->createUrl('/cat/view', array('alias' => $alias)) . '" class="dropdownmenu__item__list__item__link">' . $v1->name . '<span class="dropdown__link__col"> (' . Occupation::CalcUsers($v1->id) . ')</span></a></li>';
}
//$i++;
}
}
?>
</ul>
</li>
</ul>
</div>