本文整理汇总了PHP中RGFormsModel::get_form方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::get_form方法的具体用法?PHP RGFormsModel::get_form怎么用?PHP RGFormsModel::get_form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGFormsModel
的用法示例。
在下文中一共展示了RGFormsModel::get_form方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: valid_gravity_forms
public static function valid_gravity_forms()
{
$form_id = isset($_POST["gform_submit"]) ? $_POST["gform_submit"] : 0;
if ($form_id) {
$form_info = RGFormsModel::get_form($form_id);
$is_valid_form = $form_info && $form_info->is_active;
if ($is_valid_form) {
return true;
}
}
return false;
}
示例2: get_form
/**
* Returns the form object for a given Form ID.
*
* @access public
* @param mixed $form_id
* @return mixed False: no form ID specified or Gravity Forms isn't active. Array: Form returned from Gravity Forms
*/
public static function get_form($form_id)
{
if (empty($form_id)) {
return false;
}
if (class_exists('GFAPI')) {
return GFAPI::get_form($form_id);
}
if (class_exists('RGFormsModel')) {
return RGFormsModel::get_form($form_id);
}
return false;
}
示例3: cron_tpl_merge_process
function cron_tpl_merge_process($tpls, $entry, $type = "", $invoice_number = "")
{
echo "inside merge process.<br/>";
require_once "D:\\inetpub\\app\\wwwroot\\wp-content\\plugins\\templatemerge\\phpdocx-v4\\classes\\TransformDocAdv.inc";
require_once "D:\\inetpub\\app\\wwwroot\\wp-content\\plugins\\templatemerge\\phpdocx-v4\\classes\\CreateDocx.inc";
$final_doc_url = "";
$formdetail = RGFormsModel::get_form($entry["form_id"]);
$new_xml = array();
$unique_number = date('ymdhis') . "-" . $entry["id"];
$n = str_replace('+', '_', urlencode($formdetail->title)) . ($type != "" ? "_" . $type : "") . "_" . $unique_number . '-cron.docx';
if ($type == "Invoice" && $invoice_number == "") {
$invoice_number = generate_invoice_number();
}
$i = 1;
foreach ($tpls as $tpl) {
$file = $tpl['file'];
$value = $tpl['values'];
$value["Invoice_number"] = $invoice_number;
if (!empty($file['dir_path']) && !empty($file['filepath'])) {
$cookie_file_path = $file['filepath'];
/*echo '<br/>Cookie path: '.$cookie_file_path;
if (!file_exists($cookie_file_path)) {
echo 'file does not exist';
}
else {
echo 'file exists';
}*/
//Create PHPDocx object using the template file defined above.
$docx = new CreateDocxFromTemplate($cookie_file_path);
$variables = array();
$variables_html = array();
foreach ($value as $k => $v) {
$k_val = explode("-", $k);
$e_val = array("SIGNED", "PRESENCE", "LengthContent");
if (count($k_val) > 1 && in_array($k_val[1], $e_val)) {
$variables_html[$k] = $v;
} else {
$variables[$k] = $v;
}
}
//Load the array into the PHPDocx object so that the variable values are inserted into the document template.
$docx->replaceVariableByText($variables);
if (!empty($variables_html)) {
foreach ($variables_html as $hk => $hv) {
if (!empty($hv)) {
$docx->replaceVariableByHTML($hk, 'inline', $hv, array());
} else {
$docx->replaceVariableByText(array($hk => ""));
}
}
}
//echo '<br/>About to check if file exists...';
if (!file_exists($file['dir_path'] . '/doc/temps/cron/')) {
mkdir($file['dir_path'] . '/doc/temps/cron/', 0777, true);
}
//Define the output location and name of the document to be saved (e.g. Saves in 'Output' folder relative to the location
//Of this script, and the name of the file will be 'testDeed'.
$outputWordFileNameAndPath = $file['dir_path'] . '/doc/temps/cron/' . date('ymdhis') . $i . '-cron';
$newfile = $outputWordFileNameAndPath . ".docx";
$newfile_pdf = $outputWordFileNameAndPath . ".pdf";
//Define the base directory
$baseDirectory = '';
//Create the document and save it.
$docx->createDocx($outputWordFileNameAndPath);
//Conver the document to PDF and save.
$docx->transformDocxUsingMSWord($baseDirectory . $outputWordFileNameAndPath . '.docx', $baseDirectory . $outputWordFileNameAndPath . '.pdf');
if (file_exists($newfile_pdf)) {
//chmod($newfile_pdf, 0777);
$new_xml['temp_file'][] = $newfile_pdf;
//chmod($newfile_pdf, 0777);
}
}
$i++;
}
$c = count($new_xml['temp_file']);
if (!file_exists($file['dir_path'] . '/doc/cron/')) {
mkdir($file['dir_path'] . '/doc/cron/', 0777, true);
}
$final_doc = $file['dir_path'] . '/doc/cron/' . $n;
$final_doc = str_replace('.docx', '.pdf', $final_doc);
$final_doc = str_replace("/", "\\", $final_doc);
$final_doc = str_replace("\\", "\\\\", $final_doc);
$final_doc_url = $file['dir_url'] . '/doc/cron/' . $n;
$final_doc_url = str_replace('.docx', '.pdf', $final_doc_url);
if ($c > 1) {
$alldoc = $new_xml['temp_file'];
cron_mergerAllPdf($alldoc, $final_doc);
} else {
copy($new_xml['temp_file'][0], $final_doc);
}
if (file_exists($final_doc)) {
chmod($final_doc, 0777);
foreach ($new_xml['temp_file'] as $y) {
if (file_exists(ConvertDirectoryPath($y))) {
chmod(ConvertDirectoryPath($y), 0777);
}
@unlink(ConvertDirectoryPath($y));
$y = str_replace(".pdf", ".docx", $y);
@unlink(ConvertDirectoryPath($y));
}
//.........这里部分代码省略.........
示例4: update_status
/**
* Update lead status of the specified payment
*
* @param string $payment
*/
public function update_status(Pronamic_Pay_Payment $payment, $can_redirect = false)
{
$lead_id = $payment->get_source_id();
$lead = RGFormsModel::get_lead($lead_id);
if (!$lead) {
return;
}
$form_id = $lead['form_id'];
$form = RGFormsModel::get_form($form_id);
$feed = get_pronamic_gf_pay_feed_by_entry_id($lead_id);
if (!$feed) {
return;
}
$data = new Pronamic_WP_Pay_Extensions_GravityForms_PaymentData($form, $lead, $feed);
switch ($payment->status) {
case Pronamic_WP_Pay_Statuses::CANCELLED:
$lead[Pronamic_WP_Pay_Extensions_GravityForms_LeadProperties::PAYMENT_STATUS] = Pronamic_WP_Pay_Extensions_GravityForms_PaymentStatuses::CANCELLED;
break;
case Pronamic_WP_Pay_Statuses::EXPIRED:
$lead[Pronamic_WP_Pay_Extensions_GravityForms_LeadProperties::PAYMENT_STATUS] = Pronamic_WP_Pay_Extensions_GravityForms_PaymentStatuses::EXPIRED;
break;
case Pronamic_WP_Pay_Statuses::FAILURE:
$lead[Pronamic_WP_Pay_Extensions_GravityForms_LeadProperties::PAYMENT_STATUS] = Pronamic_WP_Pay_Extensions_GravityForms_PaymentStatuses::FAILED;
break;
case Pronamic_WP_Pay_Statuses::SUCCESS:
if (!Pronamic_WP_Pay_Extensions_GravityForms_Entry::is_payment_approved($lead)) {
// Only fullfill order if the payment isn't approved already
$lead[Pronamic_WP_Pay_Extensions_GravityForms_LeadProperties::PAYMENT_STATUS] = Pronamic_WP_Pay_Extensions_GravityForms_PaymentStatuses::APPROVED;
// @see https://github.com/wp-premium/gravityformspaypal/blob/2.3.1/class-gf-paypal.php#L1741-L1742
if ($this->addon) {
$action = array('id' => $payment->get_transaction_id(), 'type' => 'complete_payment', 'transaction_id' => $payment->get_transaction_id(), 'amount' => $payment->get_amount(), 'entry_id' => $lead['id']);
$this->addon->complete_payment($lead, $action);
}
$this->fulfill_order($lead);
}
break;
case Pronamic_WP_Pay_Statuses::OPEN:
default:
// Nothing to do.
break;
}
// Update payment status property of lead
Pronamic_WP_Pay_Extensions_GravityForms_GravityForms::update_entry_property($lead['id'], Pronamic_WP_Pay_Extensions_GravityForms_LeadProperties::PAYMENT_STATUS, $lead[Pronamic_WP_Pay_Extensions_GravityForms_LeadProperties::PAYMENT_STATUS]);
}
示例5: get_form
public static function get_form($form_id, $display_title = true, $display_description = true, $force_display = false, $field_values = null, $ajax = false, $tabindex = 1)
{
//looking up form id by form name
if (!is_numeric($form_id)) {
$form_id = RGFormsModel::get_form_id($form_id);
}
//reading form metadata
$form = RGFormsModel::get_form_meta($form_id, true);
$form = RGFormsModel::add_default_properties($form);
//disable ajax if form has a reCAPTCHA field (not supported).
if ($ajax && self::has_recaptcha_field($form)) {
$ajax = false;
}
$is_postback = false;
$is_valid = true;
$confirmation_message = "";
$page_number = 1;
//If form was submitted, read variables set during form submission procedure
$submission_info = isset(self::$submission[$form_id]) ? self::$submission[$form_id] : false;
if ($submission_info) {
$is_postback = true;
$is_valid = rgar($submission_info, "is_valid") || rgar($submission_info, "is_confirmation");
$form = $submission_info["form"];
$lead = $submission_info["lead"];
$confirmation_message = rgget("confirmation_message", $submission_info);
if ($is_valid && !RGForms::get("is_confirmation", $submission_info)) {
if ($submission_info["page_number"] == 0) {
//post submission hook
do_action("gform_post_submission", $lead, $form);
do_action("gform_post_submission_{$form["id"]}", $lead, $form);
} else {
//change page hook
do_action("gform_post_paging", $form, $submission_info["source_page_number"], $submission_info["page_number"]);
do_action("gform_post_paging_{$form["id"]}", $form, $submission_info["source_page_number"], $submission_info["page_number"]);
}
}
} else {
if (!current_user_can("administrator")) {
RGFormsModel::insert_form_view($form_id, $_SERVER['REMOTE_ADDR']);
}
}
if (rgar($form, "enableHoneypot")) {
$form["fields"][] = self::get_honeypot_field($form);
}
//Fired right before the form rendering process. Allow users to manipulate the form object before it gets displayed in the front end
$form = apply_filters("gform_pre_render_{$form_id}", apply_filters("gform_pre_render", $form, $ajax), $ajax);
if ($form == null) {
return "<p>" . __("Oops! We could not locate your form.", "gravityforms") . "</p>";
}
$has_pages = self::has_pages($form);
//calling tab index filter
GFCommon::$tab_index = apply_filters("gform_tabindex_{$form_id}", apply_filters("gform_tabindex", $tabindex, $form), $form);
//Don't display inactive forms
if (!$force_display && !$is_postback) {
$form_info = RGFormsModel::get_form($form_id);
if (!$form_info->is_active) {
return "";
}
// If form requires login, check if user is logged in
if (rgar($form, "requireLogin")) {
if (!is_user_logged_in()) {
return empty($form["requireLoginMessage"]) ? "<p>" . __("Sorry. You must be logged in to view this form.", "gravityforms") . "</p>" : "<p>" . GFCommon::gform_do_shortcode($form["requireLoginMessage"]) . "</p>";
}
}
}
// show the form regardless of the following validations when force display is set to true
if (!$force_display) {
$form_schedule_validation = self::validate_form_schedule($form);
// if form schedule validation fails AND this is not a postback, display the validation error
// if form schedule validation fails AND this is a postback, make sure is not a valid submission (enables display of confirmation message)
if ($form_schedule_validation && !$is_postback || $form_schedule_validation && $is_postback && !$is_valid) {
return $form_schedule_validation;
}
$entry_limit_validation = self::validate_entry_limit($form);
// refer to form schedule condition notes above
if ($entry_limit_validation && !$is_postback || $entry_limit_validation && $is_postback && !$is_valid) {
return $entry_limit_validation;
}
}
$form_string = "";
//When called via a template, this will enqueue the proper scripts
//When called via a shortcode, this will be ignored (too late to enqueue), but the scripts will be enqueued via the enqueue_scripts event
self::enqueue_form_scripts($form, $ajax);
if (empty($confirmation_message)) {
$wrapper_css_class = GFCommon::get_browser_class() . " gform_wrapper";
if (!$is_valid) {
$wrapper_css_class .= " gform_validation_error";
}
//Hidding entire form if conditional logic is on to prevent "hidden" fields from blinking. Form will be set to visible in the conditional_logic.php after the rules have been applied.
$style = self::has_conditional_logic($form) ? "style='display:none'" : "";
$custom_wrapper_css_class = !empty($form["cssClass"]) ? " {$form["cssClass"]}_wrapper" : "";
$form_string .= "\n <div class='{$wrapper_css_class}{$custom_wrapper_css_class}' id='gform_wrapper_{$form_id}' " . $style . ">";
$action = add_query_arg(array());
$default_anchor = $has_pages || $ajax ? true : false;
$use_anchor = apply_filters("gform_confirmation_anchor_{$form["id"]}", apply_filters("gform_confirmation_anchor", $default_anchor));
if ($use_anchor !== false) {
$form_string .= "<a id='gf_{$form_id}' name='gf_{$form_id}' class='gform_anchor' ></a>";
$action .= "#gf_{$form_id}";
}
$target = $ajax ? "target='gform_ajax_frame_{$form_id}'" : "";
//.........这里部分代码省略.........
示例6: maybe_process_form
public static function maybe_process_form()
{
$form_id = isset($_POST["gform_submit"]) ? $_POST["gform_submit"] : 0;
if ($form_id) {
$form_info = RGFormsModel::get_form($form_id);
$is_valid_form = $form_info && $form_info->is_active;
if ($is_valid_form) {
require_once GFCommon::get_base_path() . "/form_display.php";
GFFormDisplay::process_form($form_id);
}
}
}
示例7: __construct
/**
* Constructor for class
*
* @since 1.0.0
*/
public function __construct()
{
// add admin page
add_action('admin_menu', array($this, 'add_settings_pages'), 25);
// save config
add_action('wp_ajax_frmwks_save_config', array($this, 'save_config'));
// exporter
add_action('init', array($this, 'check_exporter'));
// get forms list
add_filter('formworks_get_forms', array($this, 'get_forms'));
add_action('wp_ajax_frmwks_module_data', array($this, 'module_data_loader'));
if (current_user_can('manage_options')) {
add_action('wp_ajax_frmwks_rebuild_database', array($this, 'rebuild_database'));
//add_action( 'wp_ajax_frmwks_reset_form_stats', array( $this, 'reset_form_stats') );
}
// create new
add_action('wp_ajax_frmwks_create_formworks', array($this, 'create_new_formworks'));
// delete
add_action('wp_ajax_frmwks_delete_formworks', array($this, 'delete_formworks'));
add_filter('formworks_stats_field_name', function ($field, $form_prefix, $form_id) {
switch ($form_prefix) {
case 'caldera':
if (false !== strpos($field, '[')) {
$field = strtok($field, '[');
}
// is CF
$form = \Caldera_Forms::get_form($form_id);
if (empty($form)) {
continue;
}
if (!empty($form['fields'][$field]['label'])) {
$field = $form['fields'][$field]['label'];
}
break;
case 'gform':
//get gravity form
if (!class_exists('RGFormsModel')) {
continue;
}
$form_info = \RGFormsModel::get_form($form_id);
break;
case 'ninja':
//get ninja form
if (!function_exists('Ninja_Forms')) {
continue;
}
$form_name = Ninja_Forms()->form($form_id)->get_setting('form_title');
$form_id = $form_id;
break;
case 'cf7':
//get contact form 7
if (!class_exists('WPCF7_ContactForm')) {
continue;
}
$cf7form = \WPCF7_ContactForm::get_instance($form_id);
$form_name = $cf7form->title();
$form_id = $cf7form->id();
break;
case 'frmid':
if (!class_exists('FrmForm')) {
continue;
}
$field_id = (int) strtok(str_replace('item_meta[', '', $field), ']');
$form_field = \FrmField::getOne($field_id);
$field = $form_field->name;
if (!empty($form_field->description) && $form_field->description != $form_field->name) {
$field .= ':' . $form_field->description;
}
break;
case 'jp':
$form_post = get_post($form_id);
if (empty($form_post)) {
continue;
}
$field = ucwords(str_replace('g' . $form_id . '-', '', $field));
break;
default:
//no idea what this is or the form plugin was disabled.
break;
}
return $field;
}, 10, 3);
}
示例8: get_form
public static function get_form($form_id, $display_title = true, $display_description = true, $force_display = false, $field_values = null, $ajax = false, $tabindex = 1)
{
//looking up form id by form name
if (!is_numeric($form_id)) {
$form_id = RGFormsModel::get_form_id($form_id);
}
//reading form metadata
$form = RGFormsModel::get_form_meta($form_id, true);
$form = RGFormsModel::add_default_properties($form);
//disable ajax if form has a reCAPTCHA field (not supported).
if ($ajax && self::has_recaptcha_field($form)) {
$ajax = false;
}
$is_postback = false;
$is_valid = true;
$confirmation_message = "";
$page_number = 1;
//If form was submitted, read variables set during form submission procedure
$submission_info = isset(self::$submission[$form_id]) ? self::$submission[$form_id] : false;
if ($submission_info) {
$is_postback = true;
$is_valid = $submission_info["is_valid"] || rgget("is_confirmation", $submission_info);
$form = $submission_info["form"];
$lead = $submission_info["lead"];
$confirmation_message = rgget("confirmation_message", $submission_info);
if ($is_valid && !RGForms::get("is_confirmation", $submission_info)) {
if ($submission_info["page_number"] == 0) {
//post submission hook
do_action("gform_post_submission", $lead, $form);
do_action("gform_post_submission_{$form["id"]}", $lead, $form);
} else {
//change page hook
do_action("gform_post_paging", $form, $submission_info["source_page_number"], $submission_info["page_number"]);
do_action("gform_post_paging_{$form["id"]}", $form, $submission_info["source_page_number"], $submission_info["page_number"]);
}
}
} else {
if (!current_user_can("administrator")) {
RGFormsModel::insert_form_view($form_id, $_SERVER['REMOTE_ADDR']);
}
}
if (rgar($form, "enableHoneypot")) {
$form["fields"][] = self::get_honeypot_field($form);
}
//Fired right before the form rendering process. Allow users to manipulate the form object before it gets displayed in the front end
$form = apply_filters("gform_pre_render_{$form_id}", apply_filters("gform_pre_render", $form));
if ($form == null) {
return "<p>" . __("Oops! We could not locate your form.", "gravityforms") . "</p>";
}
$has_pages = self::has_pages($form);
//calling tab index filter
GFCommon::$tab_index = apply_filters("gform_tabindex_{$form_id}", apply_filters("gform_tabindex", $tabindex, $form), $form);
//Don't display inactive forms
if (!$force_display && !$is_postback) {
$form_info = RGFormsModel::get_form($form_id);
if (!$form_info->is_active) {
return "";
}
//If form has a schedule, make sure it is within the configured start and end dates
if (rgar($form, "scheduleForm")) {
$local_time_start = sprintf("%s %02d:%02d %s", $form["scheduleStart"], $form["scheduleStartHour"], $form["scheduleStartMinute"], $form["scheduleStartAmpm"]);
$local_time_end = sprintf("%s %02d:%02d %s", $form["scheduleEnd"], $form["scheduleEndHour"], $form["scheduleEndMinute"], $form["scheduleEndAmpm"]);
$timestamp_start = strtotime($local_time_start . ' +0000');
$timestamp_end = strtotime($local_time_end . ' +0000');
$now = current_time("timestamp");
if (!empty($form["scheduleStart"]) && $now < $timestamp_start || !empty($form["scheduleEnd"]) && $now > $timestamp_end) {
return empty($form["scheduleMessage"]) ? "<p>" . __("Sorry. This form is no longer available.", "gravityforms") . "</p>" : "<p>" . GFCommon::gform_do_shortcode($form["scheduleMessage"]) . "</p>";
}
}
//If form has a limit of entries, check current entry count
if (rgar($form, "limitEntries")) {
$period = rgar($form, "limitEntriesPeriod");
$range = self::get_limit_period_dates($period);
$entry_count = RGFormsModel::get_lead_count($form_id, "", null, null, $range["start_date"], $range["end_date"]);
if ($entry_count >= $form["limitEntriesCount"]) {
return empty($form["limitEntriesMessage"]) ? "<p>" . __("Sorry. This form is no longer accepting new submissions.", "gravityforms") . "</p>" : "<p>" . GFCommon::gform_do_shortcode($form["limitEntriesMessage"]) . "</p>";
}
}
// If form requires login, check if user is logged in
if (rgar($form, "requireLogin")) {
if (!is_user_logged_in()) {
return empty($form["requireLoginMessage"]) ? "<p>" . __("Sorry. You must be logged in to view this form.", "gravityforms") . "</p>" : "<p>" . GFCommon::gform_do_shortcode($form["requireLoginMessage"]) . "</p>";
}
}
}
$form_string = "";
//When called via a template, this will enqueue the proper scripts
//When called via a shortcode, this will be ignored (too late to enqueue), but the scripts will be enqueued via the enqueue_scripts event
self::enqueue_form_scripts($form, $ajax);
if (empty($confirmation_message)) {
$wrapper_css_class = GFCommon::get_browser_class() . " gform_wrapper";
if (!$is_valid) {
$wrapper_css_class .= " gform_validation_error";
}
//Hidding entire form if conditional logic is on to prevent "hidden" fields from blinking. Form will be set to visible in the conditional_logic.php after the rules have been applied.
$style = self::has_conditional_logic($form) ? "style='display:none'" : "";
$form_string .= "\n <div class='{$wrapper_css_class}' id='gform_wrapper_{$form_id}' " . $style . ">";
$action = add_query_arg(array());
$default_anchor = $has_pages || $ajax ? true : false;
$use_anchor = apply_filters("gform_confirmation_anchor_{$form["id"]}", apply_filters("gform_confirmation_anchor", $default_anchor));
//.........这里部分代码省略.........
示例9: _e
<?php
_e("\\'Cancel\\' to stop, \\'OK\\' to delete.", "templatemerge");
?>
')){ DeleteSetting(<?php
echo $tags[$i]["id"];
?>
);}"><?php
_e("Delete", "templatemerge");
?>
</a>
</span>
</div>
</td>
<td class="column-date">
<?php
$data = RGFormsModel::get_form($tags[$i]["form_id"]);
echo $data->title;
?>
</td>
<td class="column-date">
<?php
$field_name = TemplateData::get_field_name($tags[$i]["form_id"], $tags[$i]["form_field"]);
echo $field_name;
?>
</td>
</tr>
<?php
$i++;
}
} else {
?>
示例10: get_form
public static function get_form($form_id, $display_title = true, $display_description = true, $force_display = false, $field_values = null, $ajax = false, $tabindex = 1)
{
// echo "$form_id, $display_title = true, $display_description = true, $force_display = false, $field_values = null, $ajax = false, $tabindex = 1 ";
/**
* @To do tomorrow
* datact if its approved or not => done
* Lacking will find the correct container and hide it.
* /app/wwwroot/wp-content/plugins/gravityforms/includes/fields/class-gf-field-creditcard.php
* /app/wwwroot/wp-content/themes/TPO10/functions.php
* /app/wwwroot/wp-content/plugins/gravityforms/form_display
*/
/**
* STEPS
*
* Find way how to filter if approved or not => done
* Find the actual html of the credit cards fields
*/
// gform_lead_id = 1137
// [gform_edit_id] => 1137
// [input_id] => 1137
// [input_payment_status] => approved
//EDIT
// gform_edit_id = 1137
// input_id = 1137
// [input_form_id] => 75
// [input_payment_status] => approved
// [gform_submit] => 75
//IF CLICK NEXT
/**
* [gform_lead_id] => 1137
* GET DATA BY THAT ID CHECK IF APPROVED OR NOT APPROVED
*/
//IF EDIT
/**
* [input_payment_status] => approved
* [input_id] => 1137
* [gform_edit_id] => 1137
* [input_form_id] => 75
*/
// print_r($_POST);
// echo "total post " . count($_POST) . '<br>';
// if (count($_POST) > 1) {
//
// $form_id_lead = $_POST['gform_edit_id'];
// $form_id = $_POST['input_form_id'];
// if (empty($form_id_lead)) {
// $form_id_lead = $_POST['gform_lead_id'];
// }
// if (empty($form_id)) {
// $form_id = $_POST['gform_submit'];
// }
//
// $paymentStatus = '';
// $isApproved = false;
// if (!empty($form_id) and !empty($form_id_lead)) {
// // echo "form id is not empty <br>";
// global $wpdb;
// $results = $wpdb->get_results("SELECT * FROM wp_rg_lead WHERE form_id = $form_id AND id = $form_id_lead", 'ARRAY_A');
//
// // echo "<pre>";
// // echo "result from db";
// // print_r($results);
// //
// // echo "result from post";
// // print_r($_POST);
// //
// // echo "</pre>";
// // echo "This is the form printed <br> form id " . $form_id;
// // provides the ability to modify the options used to display the form
//
//
//
// if ($_POST['input_payment_status'] == 'approved' || $_POST['input_payment_status'] == 'approve' || $_POST['input_payment_status'] == 'Approved') {
// //echo "approved<br>";
// //add code to hide credit card
// $isApproved = true;
// $paymentStatus = $_POST['input_payment_status'];
//
// }
// if ($results[0]['payment_status'] == 'approved' || $results[0]['payment_status'] == 'approve' || $results[0]['payment_status'] == 'Approved') {
// //echo "approved<br>";
// //add code to hide credit card
// $isApproved = true;
// $paymentStatus = $results[0]['payment_status'];
// } else {
// //do nothing
// // echo "not approved<br>";
// }
//
// // echo "form id " . $form_id . '<br>';
// // echo "lead id " . $form_id_lead . '<br>';
// // echo "status " . $results[0]['payment_status'] . '<br>';
//
// // echo "db status = " . $results[0][0]['payment_status'] . '<br>';
// // echo "form id " . $form_id . '<br>';
// // cho "lead id " . $form_id_lead . '<br>';
//
// } else {
// // echo "form id is empty <br>";
// } // end if
//.........这里部分代码省略.........
示例11: woo_ce_extend_order_items_combined
function woo_ce_extend_order_items_combined( $order ) {
global $export;
// Product Add-ons - http://www.woothemes.com/
$product_addons = woo_ce_get_product_addons();
if( $product_addons && $order->order_items ) {
foreach( $product_addons as $product_addon ) {
foreach( $order->order_items as $order_item ) {
if( isset( $order_item->product_addons[$product_addon->post_name] ) )
$order->{'order_items_product_addon_' . $product_addon->post_name} .= $order_item->product_addons[$product_addon->post_name] . $export->category_separator;
}
if( isset( $order->{'order_items_product_addon_' . $product_addon->post_name} ) )
$order->{'order_items_product_addon_' . $product_addon->post_name} = substr( $order->{'order_items_product_addon_' . $product_addon->post_name}, 0, -1 );
}
}
// Gravity Forms - http://woothemes.com/woocommerce
$gf_fields = woo_ce_get_gravity_form_fields();
if( $gf_fields && $order->order_items ) {
$meta_type = 'order_item';
$order->order_items_gf_form_id = '';
$order->order_items_gf_form_label = '';
foreach( $order->order_items as $order_item ) {
$gravity_forms_history = get_metadata( $meta_type, $order_item->id, '_gravity_forms_history', true );
// Check that Gravity Forms Order item meta isn't empty
if( !empty( $gravity_forms_history ) ) {
if( isset( $gravity_forms_history['_gravity_form_data'] ) ) {
$order->order_items_gf_form_id .= $gravity_forms_history['_gravity_form_data']['id'] . $export->category_separator;
$gravity_form = ( method_exists( 'RGFormsModel', 'get_form' ) ? RGFormsModel::get_form( $gravity_forms_history['_gravity_form_data']['id'] ) : array() );
$order->order_items_gf_form_label .= ( !empty( $gravity_form ) ? $gravity_form->title : '' ) . $export->category_separator;
unset( $gravity_form );
}
}
foreach( $gf_fields as $gf_field ) {
// Check that we only fill export fields for forms that are actually filled
if( $gf_field['formId'] == $gravity_forms_history['_gravity_form_data']['id'] )
$order->{sprintf( 'order_items_gf_%d_%s', $gf_field['formId'], $gf_field['id'] )} .= get_metadata( $meta_type, $order_item->id, $gf_field['label'], true ) . $export->category_separator;
}
unset( $gravity_forms_history );
}
if( isset( $order->order_items_gf_form_id ) )
$order->order_items_gf_form_id = substr( $order->order_items_gf_form_id, 0, -1 );
if( isset( $order->order_items_gf_form_label ) )
$order->order_items_gf_form_label = substr( $order->order_items_gf_form_label, 0, -1 );
if( isset( $order->{sprintf( 'order_items_gf_%d_%s', $gf_field['formId'], $gf_field['id'] )} ) )
$order->{sprintf( 'order_items_gf_%d_%s', $gf_field['formId'], $gf_field['id'] )} = substr( $order->{sprintf( 'order_items_gf_%d_%s', $gf_field['formId'], $gf_field['id'] )}, 0, -1 );
}
// WooCommerce Checkout Add-Ons - http://www.skyverge.com/product/woocommerce-checkout-add-ons/
if( function_exists( 'init_woocommerce_checkout_add_ons' ) && $order->order_items ) {
$meta_type = 'order_item';
foreach( $order->order_items as $order_item ) {
$order->order_items_checkout_addon_id .= $order_item->checkout_addon_id . $export->category_separator;
$order->order_items_checkout_addon_label .= $order_item->checkout_addon_label . $export->category_separator;
$order->order_items_checkout_addon_value .= $order_item->checkout_addon_value . $export->category_separator;
}
if( isset( $order->order_items_checkout_addon_id ) )
$order->order_items_checkout_addon_id = substr( $order->order_items_checkout_addon_id, 0, -1 );
if( isset( $order->order_items_checkout_addon_label ) )
$order->order_items_checkout_addon_label = substr( $order->order_items_checkout_addon_label, 0, -1 );
if( isset( $order->order_items_checkout_addon_value ) )
$order->order_items_checkout_addon_value = substr( $order->order_items_checkout_addon_value, 0, -1 );
}
// WooCommerce Brands Addon - http://woothemes.com/woocommerce/
// WooCommerce Brands - http://proword.net/Woocommerce_Brands/
if( ( class_exists( 'WC_Brands' ) || class_exists( 'woo_brands' ) || taxonomy_exists( apply_filters( 'woo_ce_brand_term_taxonomy', 'product_brand' ) ) ) && $order->order_items ) {
$meta_type = 'order_item';
foreach( $order->order_items as $order_item )
$order->order_items_brand .= woo_ce_get_product_assoc_brands( $order_item->product_id ) . $export->category_separator;
if( isset( $order->order_items_brand ) )
$order->order_items_brand = substr( $order->order_items_brand, 0, -1 );
}
// Product Vendors - http://www.woothemes.com/products/product-vendors/
if( class_exists( 'WooCommerce_Product_Vendors' ) && $order->order_items ) {
$meta_type = 'order_item';
foreach( $order->order_items as $order_item )
$order->order_items_vendor = woo_ce_get_product_assoc_product_vendors( $order_item->product_id ) . $export->category_separator;
if( isset( $order->order_items_vendor ) )
$order->order_items_vendor = substr( $order->order_items_vendor, 0, -1 );
}
// Cost of Goods - http://www.skyverge.com/product/woocommerce-cost-of-goods-tracking/
if( class_exists( 'WC_COG' ) && $order->order_items ) {
$meta_type = 'order_item';
foreach( $order->order_items as $order_item ) {
$order->order_items_cost_of_goods .= woo_ce_format_price( get_metadata( $meta_type, $order_item->id, '_wc_cog_item_cost', true ), $order->order_currency ) . $export->category_separator;
$order->order_items_total_cost_of_goods .= woo_ce_format_price( get_metadata( $meta_type, $order_item->id, '_wc_cog_item_total_cost', true ), $order->order_currency ) . $export->category_separator;
}
if( isset( $order->order_items_cost_of_goods ) )
$order->order_items_cost_of_goods = substr( $order->order_items_cost_of_goods, 0, -1 );
if( isset( $order->order_items_total_cost_of_goods ) )
$order->order_items_total_cost_of_goods = substr( $order->order_items_total_cost_of_goods, 0, -1 );
}
// WooCommerce MSRP Pricing - http://woothemes.com/woocommerce/
if( function_exists( 'woocommerce_msrp_activate' ) && $order->order_items ) {
foreach( $order->order_items as $order_item ) {
//.........这里部分代码省略.........
示例12: get_form
public static function get_form($form_id, $display_title = true, $display_description = true, $force_display = false, $field_values = null)
{
//reading form metadata
$form = RGFormsModel::get_form_meta($form_id);
//Fired right before the form rendering process. Allow users to manipulate the form object before it gets displayed in the front end
$form = apply_filters("gform_pre_render_{$form_id}", apply_filters("gform_pre_render", $form));
if ($form == null) {
return "<p>" . __("Oops! We could not locate your form.", "gravityforms") . "</p>";
}
//Don't display inactive forms
if (!$force_display) {
$form_info = RGFormsModel::get_form($form_id);
if (!$form_info->is_active) {
return "";
}
//If form has a schedule, make sure it is within the configured start and end dates
if ($form["scheduleForm"]) {
$local_time_start = sprintf("%s %02d:%02d %s", $form["scheduleStart"], $form["scheduleStartHour"], $form["scheduleStartMinute"], $form["scheduleStartAmpm"]);
$local_time_end = sprintf("%s %02d:%02d %s", $form["scheduleEnd"], $form["scheduleEndHour"], $form["scheduleEndMinute"], $form["scheduleEndAmpm"]);
$timestamp_start = strtotime($local_time_start . ' +0000');
$timestamp_end = strtotime($local_time_end . ' +0000');
$now = current_time("timestamp");
if (!empty($form["scheduleStart"]) && $now < $timestamp_start || !empty($form["scheduleEnd"]) && $now > $timestamp_end) {
return empty($form["scheduleMessage"]) ? "<p>" . __("Sorry. This form is no longer available.", "gravityforms") . "</p>" : "<p>" . $form["scheduleMessage"] . "</p>";
}
}
//If form has a limit of entries, check current entry count
if ($form["limitEntries"]) {
$entry_count = RGFormsModel::get_lead_count($form_id, "");
if ($entry_count >= $form["limitEntriesCount"]) {
return empty($form["limitEntriesMessage"]) ? "<p>" . __("Sorry. This form is no longer accepting new submissions.", "gravityforms") . "</p>" : "<p>" . $form["limitEntriesMessage"] . "</p>";
}
}
}
$form_string = "";
//When called via a template, this will enqueue the proper scripts
//When called via a shortcode, this will be ignored (too late to enqueue), but the scripts will be enqueued via the enqueue_scripts event
self::enqueue_form_scripts($form);
//handling postback if form was submitted
$is_postback = $_POST["is_submit_" . $form_id];
$is_valid = true;
if ($is_postback) {
$is_valid = self::validate($form, $field_values);
if ($is_valid) {
//pre submission action
do_action("gform_pre_submission", $form);
//pre submission filter
$form = apply_filters("gform_pre_submission_filter", $form);
//handle submission
$lead = array();
$confirmation_message = self::handle_submission($form, $lead);
//post submission hook
do_action("gform_post_submission", $lead, $form);
}
} else {
//recording form view. Ignores views from administrators
if (!current_user_can("administrator")) {
RGFormsModel::insert_form_view($form_id, $_SERVER['REMOTE_ADDR']);
}
}
if (empty($confirmation_message)) {
//Hidding entire form if conditional logic is on to prevent "hidden" fields from blinking. Form will be set to visible in the conditional_logic.php after the rules have been applied.
$style = self::has_conditional_logic($form) ? "style='display:none'" : "";
$form_string .= "\n <div class='gform_wrapper' id='gform_wrapper_{$form_id}' " . $style . ">\n <form method='post' enctype='multipart/form-data' id='gform_{$form_id}' class='" . $form["cssClass"] . "' action=''>";
if ($display_title || $display_description) {
$form_string .= "\n <div class='gform_heading'>";
if ($display_title) {
$form_string .= "\n <h3 class='gform_title'>" . $form['title'] . "</h3>";
}
if ($display_description) {
$form_string .= "\n <span class='gform_description'>" . $form['description'] . "</span>";
}
$form_string .= "\n </div>";
}
if ($is_postback && !$is_valid) {
$validation_message = "<div class='validation_error'>" . __("There was a problem with your submission.", "gravityforms") . "<br /> " . __("Errors have been highlighted below ", "gravityforms") . "</div>";
$form_string .= apply_filters("gform_validation_message", $validation_message, $form);
}
$form_string .= "\n <div class='gform_body'>\n <input type='hidden' class='gform_hidden' name='is_submit_{$form_id}' value='1'/>\n <ul id='gform_fields_{$form_id}' class='gform_fields " . $form['labelPlacement'] . "'>";
if (is_array($form['fields'])) {
foreach ($form['fields'] as $field) {
$field["conditionalLogicFields"] = self::get_conditional_logic_fields($form, $field["id"]);
$form_string .= self::get_field($field, RGFormsModel::get_field_value($field, $field_values), false, $form, $field_values);
}
}
$form_string .= "\n </ul>\n </div>\n <div class='gform_footer " . $form['labelPlacement'] . "'>";
$tabindex = GFCommon::$tab_index++;
if ($form["button"]["type"] == "text" || empty($form["button"]["imageUrl"])) {
$button_text = empty($form["button"]["text"]) ? __("Submit", "gravityforms") : $form["button"]["text"];
$button_input = "<input type='submit' class='button' value='" . esc_attr($button_text) . "' tabindex='{$tabindex}'/>";
} else {
$imageUrl = $form["button"]["imageUrl"];
$button_input = "<input type='image' src='{$imageUrl}' tabindex='{$tabindex}'/>";
}
$button_input = apply_filters("gform_submit_button", $button_input, $form);
$button_input = apply_filters("gform_submit_button_{$form_id}", $button_input, $form);
$form_string .= $button_input;
if (current_user_can("gform_full_access")) {
$form_string .= " <a href='" . get_bloginfo("wpurl") . "/wp-admin/admin.php?page=gf_edit_forms&id=" . $form_id . "'>" . __("Edit this form", "gravityforms") . "</a>";
}
//.........这里部分代码省略.........
示例13: TriggerOrderEmail
function TriggerOrderEmail($lead_id)
{
$where = 'lead_id =' . $lead_id;
$params = array('where' => $where);
$list = TemplateData::getDocumentsList($params);
if (count($list)) {
$data = RGFormsModel::get_form($list[0]["form_id"]);
$to = $list[0]['email'];
//$subject = "Glenister & Co | ".$data->title . " Document";
$subject = "ORDER NO: " . $list[0]['file_id'] . " ";
$message = "";
$message .= "<p>Thank you for your order. This will now be processed and you will receive an email with a PDF of your order together with the link to your documents.<br/></p>";
$message .= "<table style='font-size: 10pt; color: navy;'>\n <tr><td>The SMSF Academy Pty Ltd</td></tr>\n <tr><td>Suite 2, Level 5, 350 Collins Street</td></tr>\n <tr><td>MELBOURNE VIC 3000</td></tr>\n <tr><td>thesmsfacademy.com.au</td></tr>\n </table>";
$message .= "<p style='font-size: 8pt; color: rgb(0, 0, 102);'>Disclaimer:\n This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail from your system. Any unauthorised copying, disclosure, dissemination or distribution of the material in this e-mail is strictly forbidden. The sender and their employer, do not guarantee the integrity of any e-mails or attached files. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any such problems in the contents of this message which arise as a result of e-mail transmission.\n </p>";
$message .= "<p style='font-size: 9pt; font-family: Webdings; color: rgb(0, 176, 80);'> P </p> <p style=\"font-size: 9pt; font-family: 'Trebuchet MS', sans-serif; color: rgb(0, 176, 80);\">Before you print think about the environment</p>";
return true;
//SendEmailTo($to,$subject,$message);
}
return true;
}
示例14: _e
?>
</th> -->
<th scope="col" class="manage-column"><?php
_e("Action", "templatemerge");
?>
</th>
</tr>
</thead>
<tbody class="">
<?php
$docs = TemplateData::get_completed_orders($form_id, $name, $email, $file_id, $paging, $current_user_id);
// print_r($forms);
if (is_array($docs) && sizeof($docs) > 0) {
$i = 0;
foreach ($docs as $doc) {
$data = RGFormsModel::get_form($doc["fid"]);
if ($doc['fid'] == TemplateData::companyform_id()) {
TemplateData::get_certificates($doc['leadid']);
}
?>
<tr class='' valign="top">
<td class="" ><?php
echo ++$i;
?>
</td>
<td class="" ><?php
echo date('d/m/Y', strtotime($doc["date_created"]));
?>
</td>
<td><?php
示例15: get_form_name
/**
* Helper for getting the Form column value.
*
* @param integer $formid The ID the coupon is assigned to or zero for all forms.
*
* @return string
*/
public function get_form_name($formid)
{
if ($formid == '0') {
return esc_html__('Any Form', 'gravityformscoupons');
}
$form = RGFormsModel::get_form($formid);
if (!$form) {
return esc_html__('Invalid Form', 'gravityformscoupons');
}
return $form->title;
}