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


PHP DatabaseFactory::commit方法代码示例

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


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

示例1: translate

 /**
  * Translates the string in correct language
  * @param string $string The string to translate
  * @param array $paramList The param list to be replaced in the string
  * @param int $quantity The quantity to pluralize the string
  * @param string $category The translation's category
  * @return string The translated string
  */
 public function translate($string, $paramList = NULL, $quantity = NULL, $category = NULL)
 {
     // Checks if string has to be pluralized
     if ($quantity !== NULL && $quantity !== 1) {
         $string .= '_PLURAL';
     }
     // Set silent mode to avoid every translation log
     LogTool::getInstance()->setSilentMode();
     return $string;
     // Gets string from database
     try {
         if ($category !== NULL) {
             $category = ' AND translation_category = \'' . $category . '\'';
         } else {
             $category = '';
         }
         $translation = ElementFactory::getElement('Translation', NULL, 'translation_language = \'' . $this->getLocale() . '\' AND translation_text = \'' . $string . '\'' . $category);
         LogTool::getInstance()->unsetSilentMode();
         if ($paramList === NULL) {
             return $translation->value;
         }
         // String has params "%1" to be replaced
         if (!is_array($paramList)) {
             $paramList = array($paramList);
         }
         // Sets pattern to be replaced
         $patternList = array();
         for ($paramNumber = 1; $paramNumber <= count($paramList); ++$paramNumber) {
             $patternList[] = '/%' . $paramNumber . '(?![0-9])/';
         }
         return preg_replace($patternList, $paramList, $translation->value);
     } catch (ElementNoResultException $e) {
         // String is not localized
         try {
             $warningTracking = new WarningTracking();
             $warningTracking->addTracking("Missing " . $this->getLocale() . " translation on " . $string);
             // TODO : Get template.
             DatabaseFactory::commit();
         } catch (Exception $e) {
         }
         LogTool::getInstance()->unsetSilentMode();
         return 'TO_BE_LOCALIZED(' . $string . ')';
     }
 }
开发者ID:jonathan-vallet,项目名称:craftanat,代码行数:52,代码来源:TranslationTool.class.php

示例2:

<?php

// ends transaction
DatabaseFactory::commit();
开发者ID:jonathan-vallet,项目名称:craftanat,代码行数:4,代码来源:endAjax.inc.php


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