當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。