本文整理汇总了PHP中GFAPI::add_feed方法的典型用法代码示例。如果您正苦于以下问题:PHP GFAPI::add_feed方法的具体用法?PHP GFAPI::add_feed怎么用?PHP GFAPI::add_feed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFAPI
的用法示例。
在下文中一共展示了GFAPI::add_feed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_feeds
public function post_feeds($feeds, $form_id = null)
{
$this->authorize("gravityforms_edit_forms");
$feed_ids = array();
$result = array();
foreach ($feeds as $feed) {
$addon_slug = isset($feed["addon_slug"]) ? $feed["addon_slug"] : rgget("addon");
$f_id = empty($form_id) ? $feed["form_id"] : $form_id;
if (empty($f_id)) {
$result = new WP_Error("missing_form_id", __("Missing form id", "gravityforms"));
break;
}
$result = GFAPI::add_feed($f_id, $feed["meta"], $addon_slug);
if (is_wp_error($result)) {
break;
}
$feed_ids[] = $result;
}
if (is_wp_error($result)) {
$response = $this->get_error_response($result);
$status = $this->get_error_status($result);
} else {
$status = 201;
$response = $feed_ids;
}
$this->end($status, $response);
}
示例2: add_step
/**
* Adds a Workflow step to the form with the given settings. The following settings are required:
* - step_name (string)
* - step_type (string)
* - description (string)
*
* @param $step_settings
*
* @return mixed
*/
public function add_step($step_settings)
{
return GFAPI::add_feed($this->form_id, $step_settings, 'gravityflow');
}
示例3: post_feeds
public function post_feeds($feeds, $form_id = null)
{
$this->log_debug(__METHOD__ . '(): Running.');
$capability = apply_filters('gform_web_api_capability_post_feeds', 'gravityforms_edit_forms');
$this->authorize($capability);
$feed_ids = array();
$result = array();
foreach ($feeds as $feed) {
$addon_slug = isset($feed['addon_slug']) ? $feed['addon_slug'] : rgget('addon');
$f_id = empty($form_id) ? $feed['form_id'] : $form_id;
if (empty($f_id)) {
$result = new WP_Error('missing_form_id', __('Missing form id', 'gravityforms'));
break;
}
$result = GFAPI::add_feed($f_id, $feed['meta'], $addon_slug);
if (is_wp_error($result)) {
break;
}
$feed_ids[] = $result;
}
if (is_wp_error($result)) {
$response = $this->get_error_response($result);
$status = $this->get_error_status($result);
} else {
$status = 201;
$response = $feed_ids;
}
$this->end($status, $response);
}
示例4: import_gravityflow_feeds
public function import_gravityflow_feeds($original_feeds, $new_form_id)
{
$feed_id_mappings = array();
foreach ($original_feeds as $feed) {
$new_feed_id = GFAPI::add_feed($new_form_id, $feed['meta'], 'gravityflow');
if (!$feed['is_active']) {
$this->update_feed_active($new_feed_id, false);
}
$feed_id_mappings[$feed['id']] = $new_feed_id;
}
$new_steps = $this->get_steps($new_form_id);
foreach ($new_steps as $new_step) {
$statuses_configs = $new_step->get_status_config();
$new_step_meta = $new_step->get_feed_meta();
$step_ids_updated = false;
foreach ($statuses_configs as $status_config) {
$destination_key = 'destination_' . $status_config['status'];
$old_destination_step_id = $new_step_meta[$destination_key];
if (!in_array($old_destination_step_id, array('next', 'complete')) && isset($feed_id_mappings[$old_destination_step_id])) {
$new_step_meta[$destination_key] = $feed_id_mappings[$old_destination_step_id];
$step_ids_updated = true;
}
}
if ($new_step->get_type() == 'approval') {
if (!empty($new_step->revert_buttonValue)) {
$new_step_meta['revert_buttonValue'] = $feed_id_mappings[$new_step->revert_buttonValue];
}
}
if ($step_ids_updated) {
$this->update_feed_meta($new_step->get_id(), $new_step_meta);
}
}
}