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


PHP GFAPI::add_forms方法代碼示例

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


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

示例1: import_json

 public static function import_json($forms_json, &$forms = null)
 {
     $forms = json_decode($forms_json, true);
     if (!$forms) {
         GFCommon::log_debug(__METHOD__ . '(): Import Failed. Invalid form objects.');
         return 0;
     } else {
         if (version_compare($forms['version'], self::$min_import_version, '<')) {
             GFCommon::log_debug(__METHOD__ . '(): Import Failed. The JSON version is not compatible with the current Gravity Forms version.');
             return -1;
         }
     }
     //Error. JSON version is not compatible with current Gravity Forms version
     unset($forms['version']);
     $form_ids = GFAPI::add_forms($forms);
     if (is_wp_error($form_ids)) {
         GFCommon::log_debug(__METHOD__ . '(): Import Failed => ' . print_r($form_ids, 1));
         $form_ids = array();
     } else {
         foreach ($form_ids as $key => $form_id) {
             $forms[$key]['id'] = $form_id;
         }
         /**
          * Fires after forms have been imported.
          *
          * Used to perform additional actions after import
          *
          * @param array $forms An array imported form objects.
          *
          */
         do_action('gform_forms_post_import', $forms);
     }
     return sizeof($form_ids);
 }
開發者ID:fjbeteiligung,項目名稱:development,代碼行數:34,代碼來源:export.php

示例2: import_json

 public static function import_json($forms_json, &$forms = null)
 {
     $forms = json_decode($forms_json, true);
     if (!$forms) {
         return 0;
     } else {
         if (version_compare($forms['version'], self::$min_import_version, '<')) {
             return -1;
         }
     }
     //Error. JSON version is not compatible with current Gravity Forms version
     unset($forms['version']);
     $form_ids = GFAPI::add_forms($forms);
     if (is_wp_error($form_ids)) {
         $form_ids = array();
     } else {
         foreach ($form_ids as $key => $form_id) {
             $forms[$key]['id'] = $form_id;
         }
     }
     return sizeof($form_ids);
 }
開發者ID:renztoygwapo,項目名稱:lincoln,代碼行數:22,代碼來源:export.php

示例3: post_forms

 public function post_forms($data)
 {
     $this->authorize("gravityforms_create_form");
     $form_ids = GFAPI::add_forms($data);
     if (is_wp_error($form_ids) || count($form_ids) == 0) {
         $response = $this->get_error_response($form_ids);
         $status = $this->get_error_status($form_ids);
     } else {
         $status = 201;
         $response = $form_ids;
     }
     $this->end($status, $response);
 }
開發者ID:tlandn,項目名稱:akvo-web,代碼行數:13,代碼來源:webapi.php

示例4: post_forms

 public function post_forms($data)
 {
     $this->log_debug(__METHOD__ . '(): Running.');
     $capability = apply_filters('gform_web_api_capability_post_forms', 'gravityforms_create_form');
     $this->authorize($capability);
     $form_ids = GFAPI::add_forms($data);
     if (is_wp_error($form_ids) || count($form_ids) == 0) {
         $response = $this->get_error_response($form_ids);
         $status = $this->get_error_status($form_ids);
     } else {
         $status = 201;
         $response = $form_ids;
     }
     $this->end($status, $response);
 }
開發者ID:SayenkoDesign,項目名稱:ividf,代碼行數:15,代碼來源:webapi.php

示例5: import_json

 public static function import_json($forms_json, &$forms = null)
 {
     $forms = json_decode($forms_json, true);
     if (!$forms) {
         return 0;
     } else {
         if (version_compare($forms['version'], self::$min_import_version, '<')) {
             return -1;
         }
     }
     //Error. JSON version is not compatible with current Gravity Forms version
     unset($forms['version']);
     $form_ids = GFAPI::add_forms($forms);
     if (is_wp_error($form_ids)) {
         $form_ids = array();
     } else {
         foreach ($form_ids as $key => $form_id) {
             $forms[$key]['id'] = $form_id;
         }
         /**
          * Fires after forms have been imported.
          *
          * @param array $forms An array imported form objects.
          *
          */
         do_action('gform_forms_post_import', $forms);
     }
     return sizeof($form_ids);
 }
開發者ID:wesleykepke,項目名稱:ARIA,代碼行數:29,代碼來源:export.php


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