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


PHP TranslationProxy::get_batch_id_from_name方法代码示例

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


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

示例1: rollback_basket_commit

 public function rollback_basket_commit()
 {
     TranslationProxy_Basket::get_basket(true);
     $basket_name = TranslationProxy_Basket::get_basket_name();
     $basket_name = $basket_name ? $basket_name : filter_input(INPUT_POST, 'basket_name', FILTER_SANITIZE_STRING);
     $batch_id = TranslationProxy::get_batch_id_from_name($basket_name);
     if ($batch_id) {
         $batch = new WPML_Translation_Batch($batch_id);
         $batch->cancel_all_remote_jobs();
     }
 }
开发者ID:ryuqing,项目名称:cake,代码行数:11,代码来源:wpml-basket-tab-ajax.class.php

示例2: get_batch_id_from_name

 /**
  * Returns the batch id for a given basket or batch name
  *
  * @param string $basket_name
  *
  * @return int|bool
  */
 private function get_batch_id_from_name($basket_name)
 {
     return TranslationProxy::get_batch_id_from_name($basket_name);
 }
开发者ID:aarongillett,项目名称:B22-151217,代码行数:11,代码来源:wpml-translation-basket.class.php

示例3: get_unique_basket_name

 /**
  * Returns a unique name derived from an input name for a Translation Proxy Basket
  *
  * @param bool     $basket_name
  * @param bool|int $max_length
  *
  * @return bool|string
  */
 public static function get_unique_basket_name($basket_name = false, $max_length = false)
 {
     if (!$max_length) {
         $max_length = TranslationProxy::get_current_service_batch_name_max_length();
     }
     $basket_name_array = explode('|', $basket_name);
     //if we just have some user entered string not in our format we add the information to it
     if (count($basket_name_array) == 1) {
         $basket_name = $basket_name . '|' . self::get_source_language();
     } elseif (!is_numeric($basket_name_array[count($basket_name_array) - 1]) && $basket_name_array[count($basket_name_array) - 1] != self::get_source_language()) {
         //if we do not have a numeric suffix and also do not have the source language as the last entry we add it.
         $basket_name = $basket_name . '|' . self::get_source_language();
     } elseif (is_numeric($basket_name_array[count($basket_name_array) - 1]) && $basket_name_array[count($basket_name_array) - 2] != self::get_source_language()) {
         //if we have a possible suffix we check whether the language has been added in the appropriate place if not we dont see it as a suffix and add our language at the end
         $basket_name = $basket_name . '|' . self::get_source_language();
     }
     if (!$basket_name) {
         self::get_basket();
         if (isset(self::$basket['name'])) {
             $basket_name = self::$basket['name'];
         }
     }
     if (strlen($basket_name) > $max_length) {
         $basket_name = self::sanitize_basket_name($basket_name, $max_length);
     }
     if (TranslationProxy::get_batch_id_from_name($basket_name)) {
         $suffix = 2;
         $basket_name = self::sanitize_basket_name($basket_name, $max_length - strlen((string) $suffix) - 1);
         while (TranslationProxy::get_batch_id_from_name($basket_name . '|' . $suffix)) {
             $suffix++;
             $basket_name = self::sanitize_basket_name($basket_name, $max_length - strlen((string) $suffix) - 1);
         }
         return $basket_name . '|' . $suffix;
     }
     return $basket_name;
 }
开发者ID:ryuqing,项目名称:cake,代码行数:44,代码来源:translationproxy-basket.class.php


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