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


PHP Phrase::factory方法代码示例

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


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

示例1: get_default

 public static function get_default($phrase, $filter)
 {
     $default = Phrase::factory()->where("phrase", $phrase)->where("filter", $filter)->where_related_language(Language::get_default())->get();
     if (!$default->exists()) {
         $default->phrase = $default->translation = $phrase;
         $default->filter = $filter;
         $default->save(array(Language::get_default()));
     }
     return $default;
 }
开发者ID:jotavejv,项目名称:CMS,代码行数:10,代码来源:phrase.php

示例2: phrase

 public function phrase($phrase, $filter)
 {
     $tr = $this->get_translation($phrase, $filter);
     //var_dump($tr);
     //die;
     if ($tr) {
         return $tr;
     } else {
         //save for curr. language
         if ($this->language->id != Language::get_default()->id) {
             $newphr = Phrase::factory()->where('phrase', $phrase)->where_related_language($this->language)->limit(1)->get();
             $newphr->phrase = $phrase;
             $newphr->filter = $filter;
             $newphr->save($this->language);
         }
         //return default
         return Phrase::get_default($phrase, $filter)->translation;
     }
     /*	$phrase_obj = Phrase::factory()
     			->where("phrase", $phrase)
     			->where("filter", $filter)
     			->where_related_language($this->language)
     			->get();
     
     		if ($phrase_obj->exists())
     		{
     			if (trim($phrase_obj->translation) != "")
     				return $phrase_obj->translation;
     			else
     				return Phrase::get_default($phrase, $filter)->translation;
     		}
     		else
     		{
     			//save for curr. language
     			if ($this->language->id != Language::get_default()->id)
     			{
     				$newphr = new Phrase();
     				$newphr->phrase = $phrase;
     				$newphr->filter = $filter;
     				$newphr->save($this->language);
     			}
     
     			//return default
     			return Phrase::get_default($phrase, $filter)->translation;
     		}//*/
 }
开发者ID:jotavejv,项目名称:CMS,代码行数:46,代码来源:translate.php

示例3: phrases

 public function phrases($lng, $all = false)
 {
     $lng = (int) $lng;
     $lang = Language::factory()->get_by_id($lng);
     $groups = array();
     $filters = Phrase::factory()->distinct()->select('filter')->get();
     $i = 0;
     foreach ($filters as $filter) {
         $groups[$i]['name'] = $filter->filter;
         $groups[$i]['phrases'] = Phrase::factory()->where('filter', $filter->filter)->where_related_language($lang)->order_by('translation')->get();
         $i++;
     }
     $this->templatemanager->assign("groups", $groups);
     //$this->templatemanager->assign("total", count($phrases->all));
     $this->templatemanager->assign("language", $lang);
     $this->templatemanager->assign("filters", $filters);
     $this->templatemanager->show_template("translations_phrases");
 }
开发者ID:jotavejv,项目名称:CMS,代码行数:18,代码来源:translations.php


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