當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SitePress::core_tm方法代碼示例

本文整理匯總了PHP中SitePress::core_tm方法的典型用法代碼示例。如果您正苦於以下問題:PHP SitePress::core_tm方法的具體用法?PHP SitePress::core_tm怎麽用?PHP SitePress::core_tm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SitePress的用法示例。


在下文中一共展示了SitePress::core_tm方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: set_defaults

 /**
  * Conditionally set some default values for event related custom fields translation.
  *
  * @return bool `false` if defaults were already set, `true` otherwise.
  */
 public function set_defaults()
 {
     // make this check again has the action is triggered many times in a request lifecycle
     if ($this->has_set_defaults()) {
         return false;
     }
     $fields = $this->get_default_copy_fields();
     foreach ($fields as $field) {
         $this->sitepress->core_tm()->settings['custom_fields_translation'][$field] = WPML_COPY_CUSTOM_FIELD;
     }
     // remove the method to avoid infinite loops
     remove_action('icl_save_settings', array($this, 'set_defaults'));
     // the Translation Management plugin might not be active on this
     // installation, save this option only if Translation Management is active.
     $translation_management = $this->sitepress->core_tm();
     $tm_is_active = !empty($translation_management) && is_a($translation_management, 'TranslationManagement');
     if ($tm_is_active) {
         $translation_management->save_settings();
         Tribe__Settings_Manager::set_option($this->defaults_option_name, true);
         return true;
     }
     return false;
 }
開發者ID:uwmadisoncals,項目名稱:Cluster-Plugins,代碼行數:28,代碼來源:Defaults.php


注:本文中的SitePress::core_tm方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。