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


PHP Translation::exists方法代码示例

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


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

示例1: setName

 /**
  * Set the type name for the given language.  A new entry in
  * the database will be created if the language did not exist.
  *
  * @param int $p_languageId
  * @param string $p_value
  *
  * @return boolean
  */
 public function setName($p_languageId, $p_value)
 {
     global $g_ado_db;
     if (!is_numeric($p_languageId)) {
         return false;
     }
     // if the string is empty, nuke it
     if (!is_string($p_value) || $p_value == '') {
         if ($phrase_id = $this->translationExists($p_languageId)) {
             $trans = new Translation($p_languageId, $phrase_id);
             $trans->delete();
             $changed = true;
         } else {
             $changed = false;
         }
     } else {
         $description = new Translation($p_languageId, $this->getProperty('fk_phrase_id'));
         if ($description->exists()) {
             $changed = $description->setText($p_value);
         } else {
             $changed = $description->create($p_value);
             if ($changed && is_null($this->getProperty('fk_phrase_id'))) {
                 $this->setProperty('fk_phrase_id', $description->getPhraseId());
             }
         }
     }
     return $changed;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:37,代码来源:ArticleTypeField.php

示例2: SetPhrase

 /**
  * Enter description here...
  *
  * @param int $p_phraseId
  * @param int $p_languageId
  * @param string $p_text
  */
 public static function SetPhrase($p_languageId, $p_phraseId, $p_text)
 {
     if (!is_numeric($p_languageId) || !is_numeric($p_phraseId) || !is_string($p_text)) {
         return false;
     }
     $translation = new Translation($p_languageId, $p_phraseId);
     if ($translation->exists()) {
         return $translation->setText($p_text);
     } else {
         return $translation->create($p_text);
     }
 }
开发者ID:sourcefabric,项目名称:newscoop,代码行数:19,代码来源:Translation.php

示例3: setName

	/**
	 * Set the type name for the given language.  A new entry in
	 * the database will be created if the language did not exist.
	 *
	 * @param int $p_languageId
	 * @param string $p_value
	 *
	 * @return boolean
	 */
	public function setName($p_languageId, $p_value)
	{
		global $g_ado_db;
		if (!is_numeric($p_languageId)) {
			return false;
		}
		// if the string is empty, nuke it
		if (!is_string($p_value) || $p_value == '') {
			if ($phrase_id = $this->translationExists($p_languageId)) {
			    $trans = new Translation($p_languageId, $phrase_id);
			    $trans->delete();
				$changed = true;
			} else {
			    $changed = false;
			}
		} else {
			$description = new Translation($p_languageId, $this->getProperty('fk_phrase_id'));
			if ($description->exists()) {
                $changed = $description->setText($p_value);
			} else {
				$changed = $description->create($p_value);
				if ($changed && is_null($this->getProperty('fk_phrase_id'))) {
					$this->setProperty('fk_phrase_id', $description->getPhraseId());
				}
			}
		}

		if ($changed) {
			if (function_exists("camp_load_translation_strings")) {
			    camp_load_translation_strings("api");
			}
			$logtext = getGS('Field "$1" updated', $this->m_data['field_name']);
			Log::Message($logtext, null, 143);
		}

		return $changed;
	} // fn setName
开发者ID:nistormihai,项目名称:Newscoop,代码行数:46,代码来源:ArticleTypeField.php

示例4: translationExists

 /**
  * A quick lookup to see if the current language was already translated
  * for this article type: used by delete and update in setName.
  * Returns 0 if no translation or the phrase_id if there is one.
  *
  * @param int p_languageId
  *
  * @return 0 or phrase_id
  **/
 public function translationExists($p_languageId)
 {
     if ($this->m_metadata->getPhraseId() != -1) {
         $translation = new Translation($p_languageId, $this->m_metadata->getPhraseId());
         if ($translation->exists()) {
             return $translation->getPhraseId();
         }
     }
     return 0;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:19,代码来源:ArticleType.php


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