本文整理汇总了PHP中RGFormsModel::is_value_match方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::is_value_match方法的具体用法?PHP RGFormsModel::is_value_match怎么用?PHP RGFormsModel::is_value_match使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGFormsModel
的用法示例。
在下文中一共展示了RGFormsModel::is_value_match方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_condition_true
/**
* Check if the iDEAL condition is true
*
* @param mixed $form
* @param mixed $feed
*/
public static function is_condition_true($form, $feed)
{
if (!$feed->condition_enabled) {
return true;
}
$field = RGFormsModel::get_field($form, $feed->condition_field_id);
// Unknown field
if (empty($field)) {
return true;
}
$is_hidden = RGFormsModel::is_field_hidden($form, $field, array());
// Ignore condition if the field is hidden
if ($is_hidden) {
return false;
}
$value = RGFormsModel::get_field_value($field, array());
$is_match = RGFormsModel::is_value_match($value, $feed->condition_value);
switch ($feed->condition_operator) {
case Pronamic_WP_Pay_Extensions_GravityForms_GravityForms::OPERATOR_IS:
$result = $is_match;
break;
case Pronamic_WP_Pay_Extensions_GravityForms_GravityForms::OPERATOR_IS_NOT:
$result = !$is_match;
break;
default:
$result = true;
}
return $result;
}
示例2: is_condition_true
/**
* Check if the iDEAL condition is true
*
* @param mixed $form
* @param mixed $feed
*/
public static function is_condition_true($form, $feed)
{
$result = true;
if ($feed->condition_enabled) {
$field = RGFormsModel::get_field($form, $feed->condition_field_id);
if (empty($field)) {
// unknown field
$result = true;
} else {
$is_hidden = RGFormsModel::is_field_hidden($form, $field, array());
if ($is_hidden) {
// if conditional is enabled, but the field is hidden, ignore conditional
$result = false;
} else {
$value = RGFormsModel::get_field_value($field, array());
$is_match = RGFormsModel::is_value_match($value, $feed->condition_value);
switch ($feed->condition_operator) {
case Pronamic_WP_Pay_Extensions_GravityForms_GravityForms::OPERATOR_IS:
$result = $is_match;
break;
case Pronamic_WP_Pay_Extensions_GravityForms_GravityForms::OPERATOR_IS_NOT:
$result = !$is_match;
break;
default:
// unknown operator
$result = true;
break;
}
}
}
} else {
// condition is disabled, result is true
$result = true;
}
return $result;
}
示例3: has_paypal_condition
public static function has_paypal_condition($form, $config)
{
$config = $config["meta"];
$operator = isset($config["paypal_conditional_operator"]) ? $config["paypal_conditional_operator"] : "";
$field = RGFormsModel::get_field($form, $config["paypal_conditional_field_id"]);
if (empty($field) || !$config["paypal_conditional_enabled"]) {
return true;
}
// if conditional is enabled, but the field is hidden, ignore conditional
$is_visible = !RGFormsModel::is_field_hidden($form, $field, array());
$field_value = RGFormsModel::get_field_value($field, array());
$is_value_match = RGFormsModel::is_value_match($field_value, $config["paypal_conditional_value"], $operator);
$go_to_paypal = $is_value_match && $is_visible;
return $go_to_paypal;
}
示例4: is_optin
public static function is_optin($form, $settings)
{
$config = $settings["meta"];
$operator = $config["optin_operator"];
$field = RGFormsModel::get_field($form, $config["optin_field_id"]);
$field_value = RGFormsModel::get_field_value($field, array());
$is_value_match = RGFormsModel::is_value_match($field_value, $config["optin_value"]);
return !$config["optin_enabled"] || empty($field) || $operator == "is" && $is_value_match || $operator == "isnot" && !$is_value_match;
}
示例5: send_admin_notification
public static function send_admin_notification($form, $lead, $override_options = false)
{
$form_id = $form["id"];
//handling admin notification email
$subject = GFCommon::replace_variables(rgget("subject", $form["notification"]), $form, $lead, false, false);
$message_format = apply_filters("gform_notification_format_{$form["id"]}", apply_filters("gform_notification_format", "html", "admin", $form, $lead), "admin", $form, $lead);
$message = GFCommon::replace_variables(rgget("message", $form["notification"]), $form, $lead, false, false, !rgget("disableAutoformat", $form["notification"]), $message_format);
$message = do_shortcode($message);
$version_info = self::get_version_info();
$is_expired = !rgempty("expiration_time", $version_info) && $version_info["expiration_time"] < time();
if (!$version_info["is_valid_key"] && $is_expired) {
$message .= "<br/><br/>Your Gravity Forms License Key has expired. In order to continue receiving support and software updates you must renew your license key. You can do so by following the renewal instructions on the Gravity Forms Settings page in your WordPress Dashboard or by <a href='http://www.gravityhelp.com/renew-license/?key=" . self::get_key() . "'>clicking here</a>.";
}
$from = rgempty("fromField", $form["notification"]) ? rgget("from", $form["notification"]) : rgget($form["notification"]["fromField"], $lead);
if (rgempty("fromNameField", $form["notification"])) {
$from_name = rgget("fromName", $form["notification"]);
} else {
$field = RGFormsModel::get_field($form, rgget("fromNameField", $form["notification"]));
$value = RGFormsModel::get_lead_field_value($lead, $field);
$from_name = GFCommon::get_lead_field_display($field, $value);
}
$replyTo = rgempty("replyToField", $form["notification"]) ? rgget("replyTo", $form["notification"]) : rgget($form["notification"]["replyToField"], $lead);
if (rgempty("routing", $form["notification"])) {
$email_to = rgget("to", $form["notification"]);
} else {
$email_to = array();
foreach ($form["notification"]["routing"] as $routing) {
$source_field = RGFormsModel::get_field($form, $routing["fieldId"]);
$field_value = RGFormsModel::get_lead_field_value($lead, $source_field);
$is_value_match = RGFormsModel::is_value_match($field_value, $routing["value"], $routing["operator"], $source_field) && !RGFormsModel::is_field_hidden($form, $source_field, array(), $lead);
if ($is_value_match) {
$email_to[] = $routing["email"];
}
}
$email_to = join(",", $email_to);
}
//Running through variable replacement
$email_to = GFCommon::replace_variables($email_to, $form, $lead, false, false);
$from = GFCommon::replace_variables($from, $form, $lead, false, false);
$bcc = GFCommon::replace_variables(rgget("bcc", $form["notification"]), $form, $lead, false, false);
$reply_to = GFCommon::replace_variables($replyTo, $form, $lead, false, false);
$from_name = GFCommon::replace_variables($from_name, $form, $lead, false, false);
//Filters the admin notification email to address. Allows users to change email address before notification is sent
$to = apply_filters("gform_notification_email_{$form_id}", apply_filters("gform_notification_email", $email_to, $lead), $lead);
// override default values if override options provided
if ($override_options && is_array($override_options)) {
foreach ($override_options as $override_key => $override_value) {
${$override_key} = $override_value;
}
}
$attachments = apply_filters("gform_admin_notification_attachments_{$form_id}", apply_filters("gform_admin_notification_attachments", array(), $lead, $form), $lead, $form);
self::send_email($from, $to, $bcc, $replyTo, $subject, $message, $from_name, $message_format, $attachments);
return compact("to", "from", "bcc", "replyTo", "subject", "message", "from_name", "message_format", "attachments");
}
示例6: send_notification
public static function send_notification($notification, $form, $lead)
{
$notification = apply_filters("gform_notification_{$form["id"]}", apply_filters("gform_notification", $notification, $form, $lead), $form, $lead);
$to_field = "";
if (rgar($notification, "toType") == "field") {
if (rgempty("toField", $notification)) {
$to_field = rgar($notification, "to");
} else {
if (rgempty("to", $notification)) {
$to_field = rgar($notification, "toField");
}
}
}
$email_to = rgar($notification, "to");
//do routing logic if "to" field doesn't have a value (to support legacy notifications what will run routing prior to this method
if (empty($email_to) && rgar($notification, "toType") == "routing") {
$email_to = array();
foreach ($notification["routing"] as $routing) {
$source_field = RGFormsModel::get_field($form, $routing["fieldId"]);
$field_value = RGFormsModel::get_lead_field_value($lead, $source_field);
$is_value_match = RGFormsModel::is_value_match($field_value, $routing["value"], $routing["operator"], $source_field) && !RGFormsModel::is_field_hidden($form, $source_field, array(), $lead);
if ($is_value_match) {
$email_to[] = $routing["email"];
}
}
$email_to = join(",", $email_to);
} else {
if (!empty($to_field)) {
$source_field = RGFormsModel::get_field($form, $to_field);
$email_to = RGFormsModel::get_lead_field_value($lead, $source_field);
}
}
//Running through variable replacement
$to = GFCommon::replace_variables($email_to, $form, $lead, false, false);
$subject = GFCommon::replace_variables(rgar($notification, "subject"), $form, $lead, false, false);
$from = GFCommon::replace_variables(rgar($notification, "from"), $form, $lead, false, false);
$from_name = GFCommon::replace_variables(rgar($notification, "fromName"), $form, $lead, false, false);
$bcc = GFCommon::replace_variables(rgar($notification, "bcc"), $form, $lead, false, false);
$replyTo = GFCommon::replace_variables(rgar($notification, "replyTo"), $form, $lead, false, false);
$message_format = rgempty("message_format", $notification) ? "html" : rgar($notification, "message_format");
$message = GFCommon::replace_variables(rgar($notification, "message"), $form, $lead, false, false, !rgar($notification, "disableAutoformat"), $message_format);
$message = do_shortcode($message);
// allow attachments to be passed as a single path (string) or an array of paths, if string provided, add to array
$attachments = rgar($notification, "attachments");
if (!empty($attachments)) {
$attachments = is_array($attachments) ? $attachments : array($attachments);
} else {
$attachments = array();
}
self::send_email($from, $to, $bcc, $replyTo, $subject, $message, $from_name, $message_format, $attachments);
return compact("to", "from", "bcc", "replyTo", "subject", "message", "from_name", "message_format", "attachments");
}
示例7: is_optin
public static function is_optin($form, $settings, $entry)
{
$config = $settings["meta"];
$field = RGFormsModel::get_field($form, $config["optin_field_id"]);
if (empty($field) || !$config["optin_enabled"]) {
return true;
}
$operator = $config["optin_operator"];
$field_value = RGFormsModel::get_lead_field_value($entry, $field);
$is_value_match = RGFormsModel::is_value_match($field_value, $config["optin_value"]);
$is_visible = !RGFormsModel::is_field_hidden($form, $field, array(), $entry);
$is_match = $is_value_match && $is_visible;
$is_optin = $operator == "is" && $is_match || $operator == "isnot" && !$is_match;
return $is_optin;
}
示例8: send_notification
public static function send_notification($notification, $form, $lead)
{
GFCommon::log_debug("GFCommon::send_notification(): Starting to process notification (#{$notification['id']} - {$notification['name']}).");
$notification = gf_apply_filters('gform_notification', $form['id'], $notification, $form, $lead);
$to_field = '';
if (rgar($notification, 'toType') == 'field') {
$to_field = rgar($notification, 'toField');
if (rgempty('toField', $notification)) {
$to_field = rgar($notification, 'to');
}
}
$email_to = rgar($notification, 'to');
//do routing logic if "to" field doesn't have a value (to support legacy notifications that will run routing prior to this method)
if (empty($email_to) && rgar($notification, 'toType') == 'routing') {
$email_to = array();
foreach ($notification['routing'] as $routing) {
GFCommon::log_debug(__METHOD__ . '(): Evaluating Routing - rule => ' . print_r($routing, 1));
$source_field = RGFormsModel::get_field($form, $routing['fieldId']);
$field_value = RGFormsModel::get_lead_field_value($lead, $source_field);
$is_value_match = RGFormsModel::is_value_match($field_value, $routing['value'], $routing['operator'], $source_field, $routing, $form) && !RGFormsModel::is_field_hidden($form, $source_field, array(), $lead);
if ($is_value_match) {
$email_to[] = $routing['email'];
}
GFCommon::log_debug(__METHOD__ . '(): Evaluating Routing - field value => ' . print_r($field_value, 1));
$is_value_match = $is_value_match ? 'Yes' : 'No';
GFCommon::log_debug(__METHOD__ . '(): Evaluating Routing - is value match? ' . $is_value_match);
}
$email_to = join(',', $email_to);
} else {
if (!empty($to_field)) {
$source_field = RGFormsModel::get_field($form, $to_field);
$email_to = RGFormsModel::get_lead_field_value($lead, $source_field);
}
}
//Running through variable replacement
$to = GFCommon::replace_variables($email_to, $form, $lead, false, false);
$subject = GFCommon::replace_variables(rgar($notification, 'subject'), $form, $lead, false, false, true, 'text');
$from = GFCommon::replace_variables(rgar($notification, 'from'), $form, $lead, false, false);
$from_name = GFCommon::replace_variables(rgar($notification, 'fromName'), $form, $lead, false, false, true, 'text');
$bcc = GFCommon::replace_variables(rgar($notification, 'bcc'), $form, $lead, false, false);
$replyTo = GFCommon::replace_variables(rgar($notification, 'replyTo'), $form, $lead, false, false);
$message_format = rgempty('message_format', $notification) ? 'html' : rgar($notification, 'message_format');
$message = GFCommon::replace_variables(rgar($notification, 'message'), $form, $lead, false, false, !rgar($notification, 'disableAutoformat'), $message_format);
if (apply_filters('gform_enable_shortcode_notification_message', true, $form, $lead)) {
$message = do_shortcode($message);
}
// allow attachments to be passed as a single path (string) or an array of paths, if string provided, add to array
$attachments = rgar($notification, 'attachments');
if (!empty($attachments)) {
$attachments = is_array($attachments) ? $attachments : array($attachments);
} else {
$attachments = array();
}
self::send_email($from, $to, $bcc, $replyTo, $subject, $message, $from_name, $message_format, $attachments);
return compact('to', 'from', 'bcc', 'replyTo', 'subject', 'message', 'from_name', 'message_format', 'attachments');
}
示例9: is_group_condition_met
public static function is_group_condition_met($group, $form, $entry)
{
$field = RGFormsModel::get_field($form, $group['field_id']);
$field_value = RGFormsModel::get_lead_field_value($entry, $field);
$is_value_match = RGFormsModel::is_value_match($field_value, $group['value'], $group['operator'], $field);
if (!$group['enabled']) {
return false;
} else {
if ($group['decision'] == 'always' || empty($field)) {
return true;
} else {
return $is_value_match;
}
}
}
示例10: is_group_condition_met
public function is_group_condition_met($group, $form, $entry)
{
if (!$group['enabled']) {
$this->log_debug(__METHOD__ . '(): Group not enabled. Returning false.');
return false;
} elseif ($group['decision'] == 'always') {
$this->log_debug(__METHOD__ . '(): Group decision is always. Returning true.');
return true;
}
$field = RGFormsModel::get_field($form, $group['field_id']);
if (!is_object($field)) {
$this->log_debug(__METHOD__ . "(): Field #{$group['field_id']} not found. Returning true.");
return true;
} else {
$field_value = RGFormsModel::get_lead_field_value($entry, $field);
$is_value_match = RGFormsModel::is_value_match($field_value, $group['value'], $group['operator'], $field);
$this->log_debug(__METHOD__ . "(): Add to group if field #{$group['field_id']} value {$group['operator']} '{$group['value']}'. Is value match? " . var_export($is_value_match, 1));
return $is_value_match;
}
}
示例11: registration_condition_met
public static function registration_condition_met($form, $config)
{
$config = $config["meta"];
$operator = isset($config["reg_condition_operator"]) ? $config["reg_condition_operator"] : "";
$field = RGFormsModel::get_field($form, $config["reg_condition_field_id"]);
if (empty($field) || !$config["reg_condition_enabled"]) {
return true;
}
$is_visible = !RGFormsModel::is_field_hidden($form, $field, array());
$field_value = RGFormsModel::get_field_value($field, array());
$is_value_match = RGFormsModel::is_value_match($field_value, $config["reg_condition_value"], $operator);
$create_user = $is_value_match && $is_visible;
return $create_user;
}
示例12: registration_condition_met
public static function registration_condition_met($form, $config, $entry)
{
$config = $config["meta"];
$operator = $config["reg_condition_operator"];
$field = RGFormsModel::get_field($form, $config["reg_condition_field_id"]);
if (empty($field) || !$config["reg_condition_enabled"]) {
return true;
}
$is_visible = !RGFormsModel::is_field_hidden($form, $field, array(), $entry);
$field_value = RGFormsModel::get_lead_field_value($entry, $field);
$is_value_match = RGFormsModel::is_value_match($field_value, $config["reg_condition_value"]);
$is_match = $is_value_match && $is_visible;
$create_user = $operator == "is" && $is_match || $operator == "isnot" && !$is_match;
return $create_user;
}
示例13: is_optin
public static function is_optin($form, $settings)
{
$config = $settings["meta"];
$operator = isset($config["optin_operator"]) ? $config["optin_operator"] : "";
$field = RGFormsModel::get_field($form, $config["optin_field_id"]);
$field_value = RGFormsModel::get_field_value($field, array());
if (empty($field) || !$config["optin_enabled"]) {
return true;
}
$is_value_match = RGFormsModel::is_value_match($field_value, rgar($config, "optin_value"), $operator);
return $is_value_match;
}
示例14: has_stripe_condition
/**
* @param $form
* @param $feed
*
* @return bool
*/
public function has_stripe_condition($form, $feed)
{
$feed = $feed['meta'];
$operator = $feed['stripe_conditional_operator'];
$field = RGFormsModel::get_field($form, $feed['stripe_conditional_field_id']);
if (empty($field) || !$feed['stripe_conditional_enabled']) {
return true;
}
// if conditional is enabled, but the field is hidden, ignore conditional
$is_visible = !RGFormsModel::is_field_hidden($form, $field, array());
//TODO: if !is_visible then skip field_value stuff
$field_value = RGFormsModel::get_field_value($field, array());
$is_value_match = RGFormsModel::is_value_match($field_value, $feed['stripe_conditional_value'], $operator);
$do_stripe = $is_value_match && $is_visible;
return $do_stripe;
}
示例15: is_optin
public static function is_optin($form, $settings, $entry)
{
$config = $settings["meta"];
$field = RGFormsModel::get_field($form, $config["optin_field_id"]);
if (empty($field) || !$config["optin_enabled"]) {
return true;
}
$operator = isset($config["optin_operator"]) ? $config["optin_operator"] : "";
$field_value = RGFormsModel::get_field_value($field, array());
$is_value_match = RGFormsModel::is_value_match($field_value, $config["optin_value"], $operator);
$is_visible = !RGFormsModel::is_field_hidden($form, $field, array(), $entry);
$is_optin = $is_value_match && $is_visible;
return $is_optin;
}