本文整理汇总了PHP中GFAPI::get_entry方法的典型用法代码示例。如果您正苦于以下问题:PHP GFAPI::get_entry方法的具体用法?PHP GFAPI::get_entry怎么用?PHP GFAPI::get_entry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFAPI
的用法示例。
在下文中一共展示了GFAPI::get_entry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pre_submission_handler
function pre_submission_handler($form)
{
if ($_SERVER["REDIRECT_URL"] == "/edit-page/") {
//submitted new values that need to be used to update the original entry via $success = GFAPI::update_entry( $entry );
//var_dump($_POST);
//Get original entry id
parse_str($_SERVER["QUERY_STRING"]);
//will be stored in $entry
//get the actual entry we want to edit
$editentry = GFAPI::get_entry($entry);
//make changes to it from new values in $_POST, this shows only the first field update
$editentry[1] = $_POST["input_1"];
//update it
$updateit = GFAPI::update_entry($editentry);
if (is_wp_error($updateit)) {
echo "Error.";
} else {
//success, so redirect
header("Location: http://domain.com/confirmation/");
}
//dont process and create new entry
die;
} else {
//any other code you want in this hook for regular entry submit
}
}
示例2: set_post_categories
/**
* Update the post categories based on all post category fields
*
* @since 1.17
*
* @param array $form Gravity Forms form array
* @param int $entry_id Numeric ID of the entry that was updated
*
* @return array|false|WP_Error Array of term taxonomy IDs of affected categories. WP_Error or false on failure. false if there are no post category fields or connected post.
*/
public function set_post_categories($form = array(), $entry_id = 0)
{
$entry = GFAPI::get_entry($entry_id);
$post_id = rgar($entry, 'post_id');
if (empty($post_id)) {
return false;
}
$return = false;
$post_category_fields = GFAPI::get_fields_by_type($form, 'post_category');
if ($post_category_fields) {
$updated_categories = array();
foreach ($post_category_fields as $field) {
// Get the value of the field, including $_POSTed value
$field_cats = RGFormsModel::get_field_value($field);
$field_cats = is_array($field_cats) ? array_values($field_cats) : (array) $field_cats;
$field_cats = gv_map_deep($field_cats, 'intval');
$updated_categories = array_merge($updated_categories, array_values($field_cats));
}
// Remove `0` values from intval()
$updated_categories = array_filter($updated_categories);
/**
* @filter `gravityview/edit_entry/post_categories/append` Should post categories be added to or replaced?
* @since 1.17
* @param bool $append If `true`, don't delete existing categories, just add on. If `false`, replace the categories with the submitted categories. Default: `false`
*/
$append = apply_filters('gravityview/edit_entry/post_categories/append', false);
$return = wp_set_post_categories($post_id, $updated_categories, $append);
}
return $return;
}
示例3: initialise_form_edit
public static function initialise_form_edit()
{
/*
* If we aren't editing our form, don't do anything
*/
if (empty($_GET['action']) || empty($_GET['lid']) || !is_user_logged_in()) {
return false;
}
$lid = isset($_GET['lid']) ? (int) $_GET['lid'] : 0;
self::$lead = $lead = GFAPI::get_entry($lid);
self::$form = $form = GFAPI::get_form(self::$lead['form_id']);
if (!self::check_user_permission(self::$lead)) {
return false;
}
self::$allowed_edit = true;
if (!class_exists('GFFormDisplay')) {
require_once GFCommon::get_base_path() . "/form_display.php";
}
$field_values = RGForms::post("gform_field_values");
/*
* Include appropriate css/javascript here...
*/
GFFormDisplay::enqueue_form_scripts($form, false);
GFFormDisplay::add_init_script($form["id"], "conditional_logic", GFFormDisplay::ON_PAGE_RENDER, self::get_conditional_logic($form, $field_values));
GFFormDisplay::add_init_script($form["id"], "pricing", GFFormDisplay::ON_PAGE_RENDER, GFFormDisplay::get_pricing_init_script($form));
$chosen_script = GFFormDisplay::get_chosen_init_script($form);
GFFormDisplay::add_init_script($form["id"], "chosen", GFFormDisplay::ON_PAGE_RENDER, $chosen_script);
GFFormDisplay::add_init_script($form["id"], "chosen", GFFormDisplay::ON_CONDITIONAL_LOGIC, $chosen_script);
GFFormDisplay::add_init_script($form['id'], 'input_mask', GFFormDisplay::ON_PAGE_RENDER, GFFormDisplay::get_input_mask_init_script($form));
GFFormDisplay::add_init_script($form['id'], 'calculation', GFFormDisplay::ON_PAGE_RENDER, GFFormDisplay::get_calculations_init_script($form));
GFFormDisplay::add_init_script($form['id'], 'currency_format', GFFormDisplay::ON_PAGE_RENDER, GFFormDisplay::get_currency_format_init_script($form));
return true;
}
示例4: post_entries_assignees
/**
* Processes a status update for a specified assignee of the current step of the specified entry.
*
* @param $entry_id
* @param string $assignee_key
*/
function post_entries_assignees($entry_id, $assignee_key = null)
{
global $HTTP_RAW_POST_DATA;
$capability = apply_filters('gravityflow_web_api_capability_post_entries_assignees', 'gravityflow_create_steps');
$this->authorize($capability);
if (empty($assignee_key)) {
$this->end(400, 'Bad request');
}
$entry = GFAPI::get_entry($entry_id);
if (empty($entry)) {
$this->end(404, 'Entry not found');
}
$form_id = absint($entry['form_id']);
$api = new Gravity_Flow_API($form_id);
$step = $api->get_current_step($entry);
$assignee = new Gravity_Flow_Assignee($assignee_key, $step);
if (!isset($HTTP_RAW_POST_DATA)) {
$HTTP_RAW_POST_DATA = file_get_contents('php://input');
}
$data = json_decode($HTTP_RAW_POST_DATA, true);
$new_status = $data['status'];
$form = GFAPI::get_form($form_id);
$step->process_assignee_status($assignee, $new_status, $form);
$api->process_workflow($entry_id);
$response = 'Status updated successfully';
$this->end(200, $response);
}
示例5: update_user
/**
* Update the WordPress user profile based on the GF User Registration create feed
*
* @since 1.11
*
* @param array $form Gravity Forms form array
* @param string $entry_id Gravity Forms entry ID
* @return void
*/
public function update_user($form = array(), $entry_id = 0)
{
if (!class_exists('GFAPI') || !class_exists('GFUser') || empty($entry_id)) {
return;
}
$entry = GFAPI::get_entry($entry_id);
/**
* @filter `gravityview/edit_entry/user_registration/entry` Modify entry details before updating the user via User Registration add-on
* @since 1.11
* @param array $entry Gravity Forms entry
* @param array $form Gravity Forms form
*/
$entry = apply_filters('gravityview/edit_entry/user_registration/entry', $entry, $form);
/**
* @since 1.14
*/
$config = GFUser::get_active_config($form, $entry);
/**
* @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration
* @since 1.14
* @param[in,out] array $config Gravity Forms User Registration feed configuration for the form
* @param[in] array $form Gravity Forms form array
* @param[in] array $entry Gravity Forms entry being edited
*/
$config = apply_filters('gravityview/edit_entry/user_registration/config', $config, $form, $entry);
$this->_user_before_update = get_userdata($entry['created_by']);
// The priority is set to 3 so that default priority (10) will still override it
add_filter('send_password_change_email', '__return_false', 3);
add_filter('send_email_change_email', '__return_false', 3);
// Trigger the User Registration update user method
GFUser::update_user($entry, $form, $config);
remove_filter('send_password_change_email', '__return_false', 3);
remove_filter('send_email_change_email', '__return_false', 3);
}
示例6: update_user
/**
* Update the WordPress user profile based on the GF User Registration create feed
*
* @since 1.11
*
* @param array $form Gravity Forms form array
* @param string $entry_id Gravity Forms entry ID
* @return void
*/
public function update_user($form = array(), $entry_id = 0)
{
if (!class_exists('GFAPI') || !class_exists('GFUser') || empty($entry_id)) {
return;
}
$entry = GFAPI::get_entry($entry_id);
/**
* @filter `gravityview/edit_entry/user_registration/entry` Modify entry details before updating the user via User Registration add-on
* @since 1.11
* @param array $entry Gravity Forms entry
* @param array $form Gravity Forms form
*/
$entry = apply_filters('gravityview/edit_entry/user_registration/entry', $entry, $form);
/**
* @since 1.14
*/
$config = GFUser::get_active_config($form, $entry);
/**
* @filter `gravityview/edit_entry/user_registration/preserve_role` Keep the current user role or override with the role defined in the Create feed
* @since 1.15
* @param[in,out] boolean $preserve_role Preserve current user role Default: true
* @param[in] array $config Gravity Forms User Registration feed configuration for the form
* @param[in] array $form Gravity Forms form array
* @param[in] array $entry Gravity Forms entry being edited
*/
$preserve_role = apply_filters('gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry);
if ($preserve_role) {
$config['meta']['role'] = 'gfur_preserve_role';
}
/**
* Make sure the current display name is not changed with the update user method.
* @since 1.15
*/
$config['meta']['displayname'] = $this->match_current_display_name($entry['created_by']);
/**
* @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration
* @since 1.14
* @param[in,out] array $config Gravity Forms User Registration feed configuration for the form
* @param[in] array $form Gravity Forms form array
* @param[in] array $entry Gravity Forms entry being edited
*/
$config = apply_filters('gravityview/edit_entry/user_registration/config', $config, $form, $entry);
$is_create_feed = $config && rgars($config, 'meta/feed_type') === 'create';
// Only update if it's a create feed
if (!$is_create_feed) {
return;
}
// The priority is set to 3 so that default priority (10) will still override it
add_filter('send_password_change_email', '__return_false', 3);
add_filter('send_email_change_email', '__return_false', 3);
// Trigger the User Registration update user method
GFUser::update_user($entry, $form, $config);
remove_filter('send_password_change_email', '__return_false', 3);
remove_filter('send_email_change_email', '__return_false', 3);
}
示例7: entry_status_changed
/**
* Force refreshing a cache when an entry is deleted.
*
* The `gform_delete_lead` action is called before the lead is deleted; we fetch the entry to find out the form ID so it can be added to the blacklist.
*
* @since 1.5.1
*
* @param int $lead_id Entry ID
* @param string $property_value Previous value of the lead status passed by gform_update_status hook
* @param string $previous_value Previous value of the lead status passed by gform_update_status hook
*
* @return void
*/
public function entry_status_changed($lead_id, $property_value = '', $previous_value = '')
{
/** @var array $entry */
$entry = GFAPI::get_entry($lead_id);
if (is_wp_error($entry)) {
/** @var WP_Error $entry */
do_action('gravityview_log_error', __METHOD__ . ' Could not retrieve entry ' . $lead_id . ' to delete it: ' . $entry->get_error_message());
return;
}
do_action('gravityview_log_debug', __METHOD__ . ' adding form ' . $entry['form_id'] . ' to blacklist because entry #' . $lead_id . ' was deleted', array('value' => $property_value, 'previous' => $previous_value));
$this->blacklist_add($entry['form_id']);
}
示例8: edit_entry_field_input
/**
* The Signature Addon only displays the output in the editable form if it thinks it's in the Admin or a form has been submitted
*
* @since 1.17
*
* @param string $field_content Always empty. Returning not-empty overrides the input.
* @param GF_Field $field
* @param string|array $value If array, it's a field with multiple inputs. If string, single input.
* @param int $lead_id Lead ID. Always 0 for the `gform_field_input` filter.
* @param int $form_id Form ID
*
* @return string Empty string forces Gravity Forms to use the $_POST values
*/
function edit_entry_field_input($field_content = '', $field, $value = '', $lead_id = 0, $form_id = 0)
{
$context = function_exists('gravityview_get_context') ? gravityview_get_context() : '';
if ('signature' !== $field->type || 'edit' !== $context) {
return $field_content;
}
// We need to fetch a fresh version of the entry, since the saved entry hasn't refreshed in GV yet.
$entry = GravityView_View::getInstance()->getCurrentEntry();
$entry = GFAPI::get_entry($entry['id']);
$entry_value = rgar($entry, $field->id);
$_POST["input_{$field->id}"] = $entry_value;
// Used when Edit Entry form *is* submitted
$_POST["input_{$form_id}_{$field->id}_signature_filename"] = $entry_value;
// Used when Edit Entry form *is not* submitted
return '';
// Return empty string to force using $_POST values instead
}
开发者ID:mgratch,项目名称:GravityView,代码行数:30,代码来源:class-gravityview-plugin-hooks-gravity-forms-signature.php
示例9: update_user
/**
*
* Update the WordPress user profile based on the GF User Registration create feed
*
* @since 1.11
*
* @param array $form Gravity Forms form array
* @param string $entry_id Gravity Forms entry ID
*/
public function update_user($form = array(), $entry_id = 0)
{
if (!class_exists('GFAPI') || !class_exists('GFUser') || empty($entry_id)) {
return;
}
$entry = GFAPI::get_entry($entry_id);
/**
* Modify the entry details before updating the user
*
* @since 1.11
* @param array $entry GF entry
* @param array $form GF form
*/
$entry = apply_filters('gravityview/edit_entry/user_registration/entry', $entry, $form);
// Trigger the User Registration update user method
GFUser::update_user($entry, $form);
}
示例10: save
/**
* Save function stores class data as Wordpress meta data
* @return boolean true on success and false on failure
*
*/
public function save()
{
throw new NotImplementedException();
if (!defined('WPINC') || !$this->_post_id || !class_exists('GFAPI')) {
return false;
}
$lead = GFAPI::get_entry($this->_post_id);
$form = GFAPI::get_form($lead['form_id']);
$values = array();
foreach ($form['fields'] as $field) {
$key = $field['adminLabel'] ? $field['adminLabel'] : strtolower($field['label']);
$value = $lead[$field['id']];
$values[$key] = $value;
}
$success = GFAPI::update_entry($this->_data, $this->_post_id);
return $success;
}
示例11: load
public function load()
{
// you only need this if creating custom posts form the form
// Get this post to also load in related gravity form data
if (parent::load()) {
$config_meta = self::CONFIG_META;
$config = get_post_meta($this->_post_id, $config_meta, true);
$this->config($config);
if (!is_numeric($this->lead_id)) {
$this->lead_id = get_post_custom_values('lead_id');
}
$lead = \GFAPI::get_entry($this->lead_id);
if (is_wp_error($lead)) {
return false;
}
$this->load_form_data($lead, $lead['form_id']);
}
}
示例12: gravityforms_send_entry_to_jdb
public static function gravityforms_send_entry_to_jdb($id)
{
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
error_log('gravityforms_send_entry_to_jdb');
$entry_id = $id;
$entry = GFAPI::get_entry($entry_id);
$form = GFAPI::get_form($entry['form_id']);
//$jdb_encoded_entry = gravityforms_to_jdb_record($entry,$row[0],$row[1]);
$jdb_encoded_entry = http_build_query(self::gravityforms_to_jdb_record($entry, $entry_id, $form));
$synccontents = '"' . $mysqli->real_escape_string($jdb_encoded_entry) . '"';
$results_on_send = self::gravityforms_send_record_to_jdb($entry_id, $jdb_encoded_entry);
$results_on_send_prepared = '"' . $mysqli->real_escape_string($results_on_send) . '"';
// MySqli Insert Query
$insert_row = $mysqli->query("INSERT INTO `wp_rg_lead_jdb_sync`(`lead_id`, `synccontents`, `jdb_response`) VALUES ({$entry_id},{$synccontents}, {$results_on_send_prepared})");
if ($insert_row) {
error_log('Success! Response from JDB was: ' . $results_on_send . '<br />');
} else {
die('Error : (' . $mysqli->errno . ') ' . $mysqli->error);
}
}
示例13: get_lead_row
public static function get_lead_row($lid, $atts, $fields)
{
ob_start();
/*
* Get our lead information
*/
$lead = GFAPI::get_entry($lid);
/*
* Update the created by date
*/
$lead['date_created_usa'] = date('m/d/Y', strtotime($lead['date_created']));
$lead['date_created'] = date('d/m/Y', strtotime($lead['date_created']));
/*
* Loop through the columns
*/
foreach ($atts['columns'] as $cid) {
?>
<td class="gfpdfe_<?php
echo $cid;
?>
">
<?php
if (is_numeric($cid)) {
$value = RGFormsModel::get_lead_field_value($lead, $fields[$cid]);
echo GFPDFEntryDetail::pdf_get_lead_field_display($fields[$cid], $value, $lead['currency']);
} else {
echo array_key_exists($cid, $lead) ? $lead[$cid] : '';
}
?>
</td>
<?php
}
$html = ob_get_contents();
ob_end_flush();
return $html;
}
示例14: get_entry
/**
* Return a single entry object
*
* Since 1.4, supports custom entry slugs. The way that GravityView fetches an entry based on the custom slug is by searching `gravityview_unique_id` meta. The `$entry_slug` is fetched by getting the current query var set by `is_single_entry()`
*
* @access public
* @param mixed $entry_id
* @param boolean $force_allow_ids Force the get_entry() method to allow passed entry IDs, even if the `gravityview_custom_entry_slug_allow_id` filter returns false.
* @return object or false
*/
public static function get_entry($entry_slug, $force_allow_ids = false)
{
if (class_exists('GFAPI') && !empty($entry_slug)) {
/**
* @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs.
* @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default)
*/
$custom_slug = apply_filters('gravityview_custom_entry_slug', false);
/**
* @filter `gravityview_custom_entry_slug_allow_id` When using a custom slug, allow access to the entry using the original slug (the Entry ID).
* - If disabled (default), only allow access to an entry using the custom slug value. (example: `/entry/custom-slug/` NOT `/entry/123/`)
* - If enabled, you could access using the custom slug OR the entry id (example: `/entry/custom-slug/` OR `/entry/123/`)
* @param boolean $custom_slug_id_access True: allow accessing the slug by ID; False: only use the slug passed to the method.
*/
$custom_slug_id_access = $force_allow_ids || apply_filters('gravityview_custom_entry_slug_allow_id', false);
/**
* If we're using custom entry slugs, we do a meta value search
* instead of doing a straightup ID search.
*/
if ($custom_slug) {
$entry_id = self::get_entry_id_from_slug($entry_slug);
}
// If custom slug is off, search using the entry ID
// ID allow ID access is on, also use entry ID as a backup
if (empty($custom_slug) || !empty($custom_slug_id_access)) {
// Search for IDs matching $entry_slug
$entry_id = $entry_slug;
}
if (empty($entry_id)) {
return false;
}
// fetch the entry
$entry = GFAPI::get_entry($entry_id);
// Is the entry allowed
$entry = self::check_entry_display($entry);
return $entry;
}
return false;
}
示例15: ajax_cancel_subscription
public function ajax_cancel_subscription()
{
check_ajax_referer('gaddon_cancel_subscription', 'gaddon_cancel_subscription');
$entry_id = $_POST['entry_id'];
$entry = GFAPI::get_entry($entry_id);
$form = GFAPI::get_form($entry['form_id']);
$feed = $this->get_payment_feed($entry, $form);
if ($this->cancel($entry, $feed)) {
$this->cancel_subscription($entry, $feed);
die('1');
} else {
die('0');
}
}