public function __construct($id, $label, $options, $value, $page_no = 1, $is_primary = false, $extra_opts = null) { if (isset($options['value'])) { if (!is_array($options['value'])) { $options['value'] = RM_Utilities::trim_array(explode(',', $options['value'])); } else { $options['value'] = $options['value']; } } parent::__construct($id, 'Select', $label, $options, $value, $page_no, $is_primary, $extra_opts); if (isset($options['multiple'])) { $multiple = $options['multiple']; } else { $multiple = ''; } $options = array(); if (!is_array($value)) { $tmp_options = RM_Utilities::trim_array(explode(',', $value)); } else { $tmp_options = $value; } foreach ($tmp_options as $val) { $options[$val] = trim($val); } if ($multiple == 'multiple') { $options = array(null => RM_UI_Strings::get('SELECT_FIELD_MULTI_OPTION')) + $options; } else { $options = array(null => RM_UI_Strings::get('SELECT_FIELD_FIRST_OPTION')) + $options; } $this->field_value = $options; }
/** * Sanitizes the request variable * * @since 1.0.0 */ public static function sanitize_request($req) { $request = RM_Utilities::trim_array($req); if (isset($_GET['page']) && is_array($request) && is_string($_GET['page'])) { $request['page'] = trim(filter_var($_GET['page'], FILTER_SANITIZE_STRING)); } return $request; }
} require_once __DIR__ . '/template_rm_register.php'; } foreach ($data->fields_data as $field_data) { if ($field_data->field_type !== 'Password' || !$data->is_auto_generate) { $element_class = "Element_" . $field_data->field_type; $label = $field_data->field_label; if ($field_data->field_type == 'Price') { $name = $field_data->field_type . "_" . $field_data->field_id . "_" . $field_data->field_value; } else { $name = $field_data->field_type . "_" . $field_data->field_id; } if (isset($field_data->field_value)) { if ($field_data->field_type == 'Select') { $options = array(); $tmp_options = RM_Utilities::trim_array(explode(',', $field_data->field_value)); foreach ($tmp_options as $val) { $options[$val] = $val; } } elseif ($field_data->field_type == 'Radio' || $field_data->field_type == 'Checkbox' || $field_data->field_type == 'Terms') { $options = maybe_unserialize($field_data->field_value); } else { $options = $field_data->field_value; } } else { $options = null; } if (isset($field_data->field_options)) { $field_data->field_options = maybe_unserialize($field_data->field_options); } //var_dump($data->form->form_options);die;
public function setValues(array $values) { $values = RM_Utilities::trim_array($values); $this->_values = array_merge($this->_values, $values); }
/** * Sanitizes the request variable * * @since 1.0.0 */ public static function sanitize_request($req) { $request = RM_Utilities::trim_array($req); return $request; }