本文整理汇总了PHP中RGFormsModel::get_form_unique_id方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::get_form_unique_id方法的具体用法?PHP RGFormsModel::get_form_unique_id怎么用?PHP RGFormsModel::get_form_unique_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGFormsModel
的用法示例。
在下文中一共展示了RGFormsModel::get_form_unique_id方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gform_footer
private static function gform_footer($form, $class, $ajax, $field_values, $previous_button, $display_title, $display_description)
{
$form_id = $form["id"];
$footer = "\n <div class='" . $class . "'>";
$button_input = self::get_form_button($form["id"], "gform_submit_button_{$form["id"]}", $form["button"], __("Submit", "gravityforms"), "button gform_button", __("Submit", "gravityforms"), 0);
$button_input = apply_filters("gform_submit_button", $button_input, $form);
$button_input = apply_filters("gform_submit_button_{$form_id}", $button_input, $form);
$footer .= $previous_button . " " . $button_input;
if ($ajax) {
$footer .= "<input type='hidden' name='gform_ajax' value='" . esc_attr("form_id={$form_id}&title={$display_title}&description={$display_description}") . "' />";
}
$current_page = self::get_current_page($form_id);
$next_page = $current_page + 1;
$next_page = $next_page > self::get_max_page_number($form) ? 0 : $next_page;
$field_values_str = is_array($field_values) ? http_build_query($field_values) : $field_values;
$files_input = "";
if (!empty(RGFormsModel::$uploaded_files[$form_id])) {
$files = GFCommon::json_encode(RGFormsModel::$uploaded_files[$form_id]);
$files_input = "<input type='hidden' name='gform_uploaded_files' id='gform_uploaded_files_{$form_id}' value='" . str_replace("'", "'", $files) . "' />";
}
$footer .= "\n <input type='hidden' class='gform_hidden' name='is_submit_{$form_id}' value='1' />\n <input type='hidden' class='gform_hidden' name='gform_submit' value='{$form_id}' />\n <input type='hidden' class='gform_hidden' name='gform_unique_id' value='" . esc_attr(RGFormsModel::get_form_unique_id($form_id)) . "' />\n <input type='hidden' class='gform_hidden' name='state_{$form_id}' value='" . self::get_state($form, $field_values) . "' />\n <input type='hidden' class='gform_hidden' name='gform_target_page_number_{$form_id}' id='gform_target_page_number_{$form_id}' value='" . $next_page . "' />\n <input type='hidden' class='gform_hidden' name='gform_source_page_number_{$form_id}' id='gform_source_page_number_{$form_id}' value='" . $current_page . "' />\n <input type='hidden' name='gform_field_values' value='" . esc_attr($field_values_str) . "' />\n {$files_input}\n </div>";
return $footer;
}
示例2: hasFormBeenProcessed
/**
* check whether this form entry's unique ID has already been used; if so, we've already done a payment attempt.
* @param array $form
* @return boolean
*/
protected function hasFormBeenProcessed($form)
{
global $wpdb;
$unique_id = RGFormsModel::get_form_unique_id($form['id']);
$sql = "select lead_id from {$wpdb->prefix}rg_lead_meta where meta_key='gfeway_unique_id' and meta_value = %s";
$lead_id = $wpdb->get_var($wpdb->prepare($sql, $unique_id));
return !empty($lead_id);
}
示例3: gform_footer
private static function gform_footer($form, $class, $ajax, $field_values, $previous_button, $display_title, $display_description)
{
$form_id = $form["id"];
$footer = "\n <div class='" . $class . "'>";
$button_input = self::get_form_button($form["id"], "gform_submit_button_{$form["id"]}", $form["button"], __("Submit", "gravityforms"), "button gform_button", __("Submit", "gravityforms"), 0);
$button_input = apply_filters("gform_submit_button", $button_input, $form);
$button_input = apply_filters("gform_submit_button_{$form_id}", $button_input, $form);
$footer .= $previous_button . " " . $button_input;
if (current_user_can("gform_full_access")) {
$footer .= "<div class='gform_edit_link'><a href='" . get_bloginfo("wpurl") . "/wp-admin/admin.php?page=gf_edit_forms&id=" . $form_id . "'>" . __("Edit this form", "gravityforms") . "</a></div>";
}
if ($ajax) {
$footer .= "<input type='hidden' name='gform_ajax' value='form_id={$form_id}&title={$display_title}&description={$display_description}' />";
}
$current_page = self::get_current_page($form_id);
$next_page = $current_page + 1;
$next_page = $next_page > self::get_max_page_number($form) ? 0 : $next_page;
$field_values_str = is_array($field_values) ? http_build_query($field_values) : "";
$files_input = "";
if (!empty(RGFormsModel::$uploaded_files[$form_id])) {
$files = GFCommon::json_encode(RGFormsModel::$uploaded_files[$form_id]);
$files_input = "<input type='hidden' name='gform_uploaded_files' id='gform_uploaded_files_{$form_id}' value='" . str_replace("'", "'", $files) . "' />";
}
$footer .= "\n <input type='hidden' class='gform_hidden' name='is_submit_{$form_id}' value='1' />\n <input type='hidden' class='gform_hidden' name='gform_submit' value='{$form_id}' />\n <input type='hidden' class='gform_hidden' name='gform_unique_id' value='" . RGFormsModel::get_form_unique_id($form_id) . "' />\n\n <input type='hidden' class='gform_hidden' name='state_{$form_id}' value='" . self::get_state($form, $field_values) . "' />\n <input type='hidden' class='gform_hidden' name='gform_target_page_number_{$form_id}' id='gform_target_page_number_{$form_id}' value='" . $next_page . "' />\n <input type='hidden' class='gform_hidden' name='gform_source_page_number_{$form_id}' id='gform_source_page_number_{$form_id}' value='" . $current_page . "' />\n <input type='hidden' name='gform_field_values' value='{$field_values_str}' />\n {$files_input}\n </div>";
return $footer;
}
示例4: simulate_post
//.........这里部分代码省略.........
$path_parts = pathinfo($upath);
$source = str_replace('//', '/', $upath);
$upload_arr[$input] = basename($value);
$upload_copy[$input] = $source;
RGFormsModel::$uploaded_files[$form_id][$input] = $upload_arr[$input];
$_POST[$input] = "";
continue;
}
$field = RGFormsModel::get_field($form, $key);
switch ($field['type']) {
case 'post_image':
/**
* We don't support this field-types
*/
break;
case 'date':
/**
* If we get a blank date-value from MySQL
* we have to make it empty
*/
if ($value == '0000-00-00') {
$value = '';
}
$_POST[$input] = GFCommon::get_lead_field_display($field, $value, $lead["currency"]);
break;
case 'number':
/**
* If we get a zero value from MySQL
* we have to make it empty
*/
if ($value == 0) {
$value = '';
}
$_POST[$input] = GFCommon::get_lead_field_display($field, $value, $lead["currency"]);
break;
case 'list':
/**
* GF stored this as a serialized array
*/
$i = 0;
$values = unserialize($value);
foreach ((array) $values as $rowValue) {
foreach ((array) $rowValue as $colValue) {
$_POST[$input][$i] = $colValue;
$i++;
}
}
break;
case 'post_category':
/**
* GF stored this as {category_name}:{category_id}
*/
$category = explode(':', $value);
$_POST[$input] = $category[1];
break;
case 'post_custom_field':
/**
* GF stored custom-post list fields a little bit different
* from normal list-fields.
*/
if ($field['inputType'] == 'list') {
/**
* GF stored this as a serialized array
*/
$i = 0;
$values = unserialize($value);
foreach ((array) $values as $rowValue) {
foreach ((array) $rowValue as $colValue) {
$_POST[$input][$i] = $colValue;
$i++;
}
}
} else {
$_POST[$input] = $value;
}
break;
default:
$_POST[$input] = $value;
break;
}
}
if (sizeof($upload_arr) > 0) {
$_POST['gform_uploaded_files'] = addslashes(GFCommon::json_encode($upload_arr));
}
$_POST['gform_target_page1_number_' . $form_id] = '0';
$_POST['gform_source_page_number_' . $form_id] = '1';
$_POST['is_submit_' . $form_id] = '1';
$form_unique_id = RGFormsModel::get_form_unique_id($form_id);
$_POST['gform_submit'] = $form_id;
$_POST['gform_unique_id'] = $form_unique_id;
foreach ($upload_copy as $key => $value) {
$path_parts = pathinfo($value);
$dest_dir = str_replace('//', '/', $target_path . '/');
if (!is_dir($dest_dir)) {
mkdir($dest_dir);
}
$dest = $dest_dir . $form_unique_id . '_' . $key . '.' . $path_parts['extension'];
copy($value, $dest);
}
}
示例5: simulate_post
public static function simulate_post($lead, $meta)
{
$form_id = $lead['form_id'];
$upload_ids = array();
foreach ($meta["fields"] as $m) {
if ($m['type'] == 'fileupload') {
$upload_ids[] = $m['id'];
}
}
$upload_arr = array();
$upload_copy = array();
$upload_target = array();
$target_path = RGFormsModel::get_upload_path($form_id) . "/tmp/";
foreach ($lead as $key => $value) {
$input = "input_" . str_replace('.', '_', strval($key));
if (in_array($key, $upload_ids) && $value != "") {
if (!isset(RGFormsModel::$uploaded_files[$form_id])) {
RGFormsModel::$uploaded_files[$form_id] = array();
}
$upath = $_SERVER['DOCUMENT_ROOT'] . parse_url($value, PHP_URL_PATH);
$path_parts = pathinfo($upath);
$source = str_replace('//', '/', $upath);
$upload_arr[$input] = basename($value);
$upload_copy[$input] = $source;
RGFormsModel::$uploaded_files[$form_id][$input] = $upload_arr[$input];
$_POST[$input] = "";
continue;
}
$_POST[$input] = $value;
}
if (sizeof($upload_arr) > 0) {
$_POST["gform_uploaded_files"] = addslashes(GFCommon::json_encode($upload_arr));
}
$_POST['gform_target_page1_number_' . $form_id] = '0';
$_POST['gform_source_page_number_' . $form_id] = '1';
$_POST["is_submit_" . $form_id] = '1';
$form_unique_id = RGFormsModel::get_form_unique_id($form_id);
$_POST["gform_submit"] = $form_id;
$_POST["gform_unique_id"] = $form_unique_id;
foreach ($upload_copy as $key => $value) {
$path_parts = pathinfo($value);
$dest_dir = str_replace('//', '/', $target_path . '/');
mkdir($dest_dir);
$dest = $dest_dir . $form_unique_id . '_' . $key . '.' . $path_parts['extension'];
copy($value, $dest);
}
}