当前位置: 首页>>代码示例>>PHP>>正文


PHP GFCommon::get_selection_value方法代码示例

本文整理汇总了PHP中GFCommon::get_selection_value方法的典型用法代码示例。如果您正苦于以下问题:PHP GFCommon::get_selection_value方法的具体用法?PHP GFCommon::get_selection_value怎么用?PHP GFCommon::get_selection_value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GFCommon的用法示例。


在下文中一共展示了GFCommon::get_selection_value方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: is_value_match

 public static function is_value_match($field_value, $target_value, $operation = "is", $source_field = null)
 {
     if ($source_field && $source_field["type"] == "post_category") {
         $field_value = GFCommon::prepare_post_category_value($field_value, $source_field, "conditional_logic");
     }
     if (!empty($field_value) && !is_array($field_value) && $source_field["type"] == "multiselect") {
         //convert the comma-delimited string into an array
         $field_value = explode(",", $field_value);
     }
     if (is_array($field_value)) {
         $field_value = array_values($field_value);
         //returning array values, ignoring keys if array is associative
         $match_count = 0;
         foreach ($field_value as $val) {
             if (self::matches_operation(GFCommon::get_selection_value($val), $target_value, $operation)) {
                 $match_count++;
             }
         }
         //If operation is Is Not, none of the values in the array can match the target value.
         return $operation == "isnot" ? $match_count == count($field_value) : $match_count > 0;
     } else {
         if (self::matches_operation(GFCommon::get_selection_value($field_value), $target_value, $operation)) {
             return true;
         }
     }
     return false;
 }
开发者ID:pwillems,项目名称:mimosa-contents,代码行数:27,代码来源:forms_model.php

示例2: is_value_match

 public static function is_value_match($field_value, $target_value, $operation = 'is', $source_field = null, $rule = null, $form = null)
 {
     $is_match = false;
     if ($source_field && is_subclass_of($source_field, 'GF_Field') && $source_field->type == 'post_category') {
         $field_value = GFCommon::prepare_post_category_value($field_value, $source_field, 'conditional_logic');
     }
     if (!empty($field_value) && !is_array($field_value) && is_subclass_of($source_field, 'GF_Field') && $source_field->type == 'multiselect') {
         $field_value = explode(',', $field_value);
     }
     // convert the comma-delimited string into an array
     $form_id = $source_field instanceof GF_Field ? $source_field->formId : 0;
     $target_value = GFFormsModel::maybe_trim_input($target_value, $form_id, $source_field);
     if (is_array($field_value)) {
         $field_value = array_values($field_value);
         //returning array values, ignoring keys if array is associative
         $match_count = 0;
         foreach ($field_value as $val) {
             $val = GFFormsModel::maybe_trim_input(GFCommon::get_selection_value($val), rgar($source_field, 'formId'), $source_field);
             if (self::matches_operation($val, $target_value, $operation)) {
                 $match_count++;
             }
         }
         // if operation is Is Not, none of the values in the array can match the target value.
         $is_match = $operation == 'isnot' ? $match_count == count($field_value) : $match_count > 0;
     } else {
         if (self::matches_operation(GFFormsModel::maybe_trim_input(GFCommon::get_selection_value($field_value), $form_id, $source_field), $target_value, $operation)) {
             $is_match = true;
         }
     }
     return apply_filters('gform_is_value_match', $is_match, $field_value, $target_value, $operation, $source_field, $rule);
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:31,代码来源:forms_model.php

示例3: is_value_match

 public static function is_value_match($field_value, $target_value, $operation = "is", $source_field = null, $rule = null)
 {
     $is_match = false;
     if ($source_field && $source_field["type"] == "post_category") {
         $field_value = GFCommon::prepare_post_category_value($field_value, $source_field, "conditional_logic");
     }
     if (!empty($field_value) && !is_array($field_value) && $source_field["type"] == "multiselect") {
         $field_value = explode(",", $field_value);
     }
     // convert the comma-delimited string into an array
     $target_value = GFFormsModel::maybe_trim_input($target_value, rgar($source_field, "formId"), $source_field);
     if (is_array($field_value)) {
         $field_value = array_values($field_value);
         //returning array values, ignoring keys if array is associative
         $match_count = 0;
         foreach ($field_value as $val) {
             $val = GFFormsModel::maybe_trim_input(GFCommon::get_selection_value($val), rgar($source_field, "formId"), $source_field);
             if (self::matches_operation($val, $target_value, $operation)) {
                 $match_count++;
             }
         }
         // if operation is Is Not, none of the values in the array can match the target value.
         $is_match = $operation == "isnot" ? $match_count == count($field_value) : $match_count > 0;
     } else {
         if (self::matches_operation(GFFormsModel::maybe_trim_input(GFCommon::get_selection_value($field_value), rgar($source_field, "formId"), $source_field), $target_value, $operation)) {
             $is_match = true;
         }
     }
     return apply_filters('gform_is_value_match', $is_match, $field_value, $target_value, $operation, $source_field, $rule);
 }
开发者ID:danaiser,项目名称:hollandLawns,代码行数:30,代码来源:forms_model.php

示例4: maybe_update_user_role

 /**
  * Maybe update user role of the specified lead and feed
  *
  * @param array $lead
  * @param Feed $feed
  */
 private function maybe_update_user_role($lead, $feed)
 {
     $user = false;
     // Gravity Forms User Registration Add-On
     if (class_exists('GFUserData')) {
         $user = GFUserData::get_user_by_entry_id($lead['id']);
     }
     if (false === $user) {
         $created_by = $lead[Pronamic_WP_Pay_Extensions_GravityForms_LeadProperties::CREATED_BY];
         $user = new WP_User($created_by);
     }
     if ($user && !empty($feed->user_role_field_id) && isset($lead[$feed->user_role_field_id])) {
         $value = $lead[$feed->user_role_field_id];
         $value = GFCommon::get_selection_value($value);
         $user->set_role($value);
     }
 }
开发者ID:daanbakker1995,项目名称:vanteun,代码行数:23,代码来源:Extension.php

示例5: is_value_match

 public static function is_value_match($field_value, $target_value)
 {
     if (is_array($field_value)) {
         foreach ($field_value as $val) {
             if (GFCommon::get_selection_value($val) == $target_value) {
                 return true;
             }
         }
     } else {
         if (GFCommon::get_selection_value($field_value) == $target_value) {
             return true;
         }
     }
     return false;
 }
开发者ID:novuscory,项目名称:ACH,代码行数:15,代码来源:forms_model.php

示例6: is_value_match

 public static function is_value_match($field_value, $target_value, $operation = "is", $source_field = null)
 {
     if ($source_field && $source_field["type"] == "post_category") {
         $field_value = GFCommon::prepare_post_category_value($field_value, $source_field, "conditional_logic");
     }
     if (!empty($field_value) && !is_array($field_value) && $source_field["type"] == "multiselect") {
         //convert the comma-delimited string into an array
         $field_value = explode(",", $field_value);
     }
     if (is_array($field_value)) {
         foreach ($field_value as $val) {
             if (self::matches_operation(GFCommon::get_selection_value($val), $target_value, $operation)) {
                 return true;
             }
         }
     } else {
         if (self::matches_operation(GFCommon::get_selection_value($field_value), $target_value, $operation)) {
             return true;
         }
     }
     return false;
 }
开发者ID:xeyefex,项目名称:Mixd-WordPress-Framework,代码行数:22,代码来源:forms_model.php

示例7: is_value_match

 public static function is_value_match($field_value, $target_value, $operation = "is")
 {
     if (is_array($field_value)) {
         foreach ($field_value as $val) {
             if (self::matches_operation(GFCommon::get_selection_value($val), $target_value, $operation)) {
                 return true;
             }
         }
     } else {
         if (self::matches_operation(GFCommon::get_selection_value($field_value), $target_value, $operation)) {
             return true;
         }
     }
     return false;
 }
开发者ID:rongandat,项目名称:cyarevfoods,代码行数:15,代码来源:forms_model.php


注:本文中的GFCommon::get_selection_value方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。