当前位置: 首页>>代码示例>>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;未经允许,请勿转载。