本文整理汇总了PHP中fw_get_options_values_from_input函数的典型用法代码示例。如果您正苦于以下问题:PHP fw_get_options_values_from_input函数的具体用法?PHP fw_get_options_values_from_input怎么用?PHP fw_get_options_values_from_input使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fw_get_options_values_from_input函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _settings_form_save
public function _settings_form_save($data)
{
fw_set_db_settings_option(null, array_merge((array) fw_get_db_settings_option(), fw_get_options_values_from_input(fw()->theme->get_settings_options())));
FW_Flash_Messages::add('fw_settings_form_saved', __('Options successfuly saved', 'fw'), 'success');
$data['redirect'] = fw_current_url();
return $data;
}
示例2: _get_value_from_input
/**
* @internal
*
* @param array $option
* @param array|null|string $input_value
*
* @return array|bool|int|string
*/
protected function _get_value_from_input($option, $input_value)
{
if (is_array($input_value) && !empty($input_value)) {
fw_ext('mailer')->set_db_settings_option(null, fw_get_options_values_from_input($this->get_inner_options(), $input_value));
}
return fw_ext('mailer')->get_db_settings_option();
}
示例3: enqueue_static
public function enqueue_static()
{
wp_enqueue_style('fw-builder-' . $this->get_builder_type() . '-item-' . $this->get_type(), $this->get_uri('/static/css/styles.css'));
wp_enqueue_script('fw-builder-' . $this->get_builder_type() . '-item-' . $this->get_type(), $this->get_uri('/static/js/scripts.js'), array('fw-events'), false, true);
wp_localize_script('fw-builder-' . $this->get_builder_type() . '-item-' . $this->get_type(), 'fw_form_builder_item_type_' . $this->get_type(), array('options' => $this->get_options(), 'l10n' => array('item_title' => __('Recaptcha', 'fw'), 'label' => __('Label', 'fw'), 'edit_label' => __('Edit Label', 'fw'), 'edit' => __('Edit', 'fw'), 'delete' => __('Delete', 'fw'), 'site_key' => __('Set site key', 'fw'), 'secret_key' => __('Set secret key', 'fw')), 'defaults' => array('type' => $this->get_type(), 'options' => fw_get_options_values_from_input($this->get_options(), array()))));
fw()->backend->enqueue_options_static($this->get_options());
}
示例4: _form_save
/**
* @internal
*/
public function _form_save($data)
{
fw_set_db_extension_data($this->get_name(), 'options', fw_get_options_values_from_input($this->get_settings_options()));
do_action('fw_' . $this->get_name() . '_form_save');
$data['redirect'] = fw_current_url();
return $data;
}
示例5: _admin_action_wp_ajax_backup_settings_save
/**
* @internal
*/
public function _admin_action_wp_ajax_backup_settings_save()
{
if (!current_user_can('manage_options')) {
wp_send_json_error();
}
$settings = $this->backup()->settings();
$values = fw_get_options_values_from_input($settings->get_options(), FW_Request::POST('values'));
$settings->save($values);
wp_send_json_success();
}
示例6: get_fixed_attributes
protected function get_fixed_attributes($attributes)
{
// do not allow sub items
unset($attributes['_items']);
$default_attributes = array('type' => $this->get_type(), 'shortcode' => false, 'width' => '', 'options' => array());
// remove unknown attributes
$attributes = array_intersect_key($attributes, $default_attributes);
$attributes = array_merge($default_attributes, $attributes);
$attributes['options'] = fw_get_options_values_from_input($this->get_options(), $attributes['options']);
return $attributes;
}
开发者ID:alireza--noori,项目名称:initial-portfolio-website-test-,代码行数:11,代码来源:class-fw-option-type-form-builder-item-email.php
示例7: get_fixed_attributes
protected function get_fixed_attributes($attributes)
{
// do not allow sub items
unset($attributes['_items']);
$default_attributes = array('type' => $this->get_type(), 'shortcode' => false, 'width' => '', 'options' => array());
// remove unknown attributes
$attributes = array_intersect_key($attributes, $default_attributes);
$attributes = array_merge($default_attributes, $attributes);
$attributes['options'] = fw_get_options_values_from_input($this->get_options(), $attributes['options']);
$constraints = $attributes['options']['constraints'];
if (!empty($constraints['constraint'])) {
$constraint = $constraints['constraint'];
$constraint_data = $constraints[$constraint];
switch ($constraint) {
case 'digits':
if (!empty($constraint_data['min'])) {
$constraint_data['min'] = intval($constraint_data['min']);
if ($constraint_data['min'] < 0) {
$constraint_data['min'] = 0;
}
}
if (!empty($constraint_data['max'])) {
$constraint_data['max'] = intval($constraint_data['max']);
if ($constraint_data['max'] < 0 || $constraint_data['max'] < $constraint_data['min']) {
$constraint_data['max'] = null;
}
}
break;
case 'value':
if ($constraint_data['min'] === '' || !preg_match($this->number_regex, $constraint_data['min'])) {
$constraint_data['min'] = null;
} else {
$constraint_data['min'] = doubleval($constraint_data['min']);
}
if ($constraint_data['max'] === '' || !preg_match($this->number_regex, $constraint_data['max'])) {
$constraint_data['max'] = null;
} else {
$constraint_data['max'] = doubleval($constraint_data['max']);
}
if (!is_null($constraint_data['max']) && !is_null($constraint_data['min'])) {
if ($constraint_data['max'] < $constraint_data['min']) {
$constraint_data['max'] = null;
}
}
break;
default:
trigger_error('Invalid constraint: ' . $constraint, E_USER_WARNING);
$attributes['options']['constraints']['constraint'] = '';
}
$attributes['options']['constraints'][$constraint] = $constraint_data;
}
return $attributes;
}
开发者ID:alireza--noori,项目名称:initial-portfolio-website-test-,代码行数:53,代码来源:class-fw-option-type-form-builder-item-number.php
示例8: setting_sanitize_callback
public function setting_sanitize_callback($input)
{
$input = json_decode($input, true);
if (is_null($input)) {
return null;
}
$POST = array();
foreach ($input as $var) {
fw_aks(fw_html_attr_name_to_array_multi_key($var['name']), $var['value'], $POST);
}
$value = fw_get_options_values_from_input(array($this->id => $this->fw_option), fw_akg(FW_Option_Type::get_default_name_prefix(), $POST));
$value = array_pop($value);
return $value;
}
开发者ID:alireza--noori,项目名称:initial-portfolio-website-test-,代码行数:14,代码来源:class--fw-customizer-control-option-wrapper.php
示例9: get_fixed_attributes
protected function get_fixed_attributes($attributes)
{
// do not allow sub items
unset($attributes['_items']);
$default_attributes = array('type' => $this->get_type(), 'shortcode' => false, 'width' => '', 'options' => array());
// remove unknown attributes
$attributes = array_intersect_key($attributes, $default_attributes);
$attributes = array_merge($default_attributes, $attributes);
$only_options = array();
foreach (fw_extract_only_options($this->get_options()) as $option_id => $option) {
if (array_key_exists($option_id, $attributes['options'])) {
$option['value'] = $attributes['options'][$option_id];
}
$only_options[$option_id] = $option;
}
$attributes['options'] = fw_get_options_values_from_input($only_options, array());
unset($only_options, $option_id, $option);
$constraints = $attributes['options']['constraints'];
if (!empty($constraints['constraint'])) {
$constraint = $constraints['constraint'];
$constraint_data = $constraints[$constraint];
switch ($constraint) {
case 'characters':
case 'words':
if (!empty($constraint_data['min'])) {
$constraint_data['min'] = intval($constraint_data['min']);
if ($constraint_data['min'] < 0) {
$constraint_data['min'] = 0;
}
}
if (!empty($constraint_data['max'])) {
$constraint_data['max'] = intval($constraint_data['max']);
if ($constraint_data['max'] < 0 || $constraint_data['max'] < $constraint_data['min']) {
$constraint_data['max'] = null;
}
}
break;
default:
trigger_error('Invalid constraint: ' . $constraint, E_USER_WARNING);
$attributes['options']['constraints']['constraint'] = '';
}
$attributes['options']['constraints'][$constraint] = $constraint_data;
}
return $attributes;
}
示例10: get_fixed_attributes
protected function get_fixed_attributes($attributes)
{
// do not allow sub items
unset($attributes['_items']);
$default_attributes = array('type' => $this->get_type(), 'shortcode' => 'form-header-title', 'width' => '', 'options' => array());
// remove unknown attributes
$attributes = array_intersect_key($attributes, $default_attributes);
$attributes = array_merge($default_attributes, $attributes);
$only_options = array();
foreach (fw_extract_only_options($this->get_options()) as $option_id => $option) {
if (array_key_exists($option_id, $attributes['options'])) {
$option['value'] = $attributes['options'][$option_id];
}
$only_options[$option_id] = $option;
}
$attributes['options'] = fw_get_options_values_from_input($only_options, array());
unset($only_options, $option_id, $option);
return $attributes;
}
开发者ID:northpen,项目名称:northpen,代码行数:19,代码来源:class-fw-option-type-form-builder-item-form-header-title.php
示例11: _action_ajax_cache_slide
/**
* @internal
*/
public static function _action_ajax_cache_slide()
{
$output = '';
$attr_data = json_decode(FW_Request::POST('option'), true);
$option = $attr_data['option'];
$id = $attr_data['id'];
$data = $attr_data['data'];
parse_str(FW_Request::POST('values'), $values);
if (isset($values)) {
$options_values_cache = $values['fw_options']['custom-slides'];
$options_values = array_pop($options_values_cache);
$valid_values = fw_get_options_values_from_input($option['slides_options'], $options_values);
foreach ($values['fw_options']['custom-slides'] as $key => $value) {
$output .= "<div class='fw-slide slide-" . $key . "' data-order='" . $key . "'>";
$output .= fw()->backend->render_options($option['slides_options'], $valid_values, array('id_prefix' => $data['id_prefix'] . $id . '-' . $key . '-', 'name_prefix' => $data['name_prefix'] . '[' . $id . '][' . $key . ']'));
$output .= "</div>";
}
}
wp_send_json($output);
}
示例12: _get_value_from_input
/**
* @internal
*/
protected function _get_value_from_input($option, $input_value)
{
if (is_null($input_value)) {
return $option['value'];
} else {
$value = fw_get_options_values_from_input($this->internal_options, $input_value);
//remove time, if all_day selected
$all_day = fw_akg('event_durability', $value);
if ($all_day === 'yes') {
foreach ($value['event_datetime'] as $key => &$row) {
if (isset($row['event_date_range']['from'])) {
$row['event_date_range']['from'] = date($this->only_date_format, strtotime($row['event_date_range']['from']));
}
if (isset($row['event_date_range']['to'])) {
$row['event_date_range']['to'] = date($this->only_date_format, strtotime($row['event_date_range']['to']));
}
}
}
return $value;
}
}
示例13: _get_value_from_input
/**
* @internal
*
* @param array $option
* @param array|null|string $input_value
*
* @return array|bool|int|string
*/
protected function _get_value_from_input($option, $input_value)
{
if (is_array($input_value) && !empty($input_value)) {
/**
* Doing a database save in get_value_from_input() is wrong
* because this is not an actual save.
* But this option type use is limited, it's used only in one place
* and it works, so we decided to not create a new "deep save trigger" mechanism
* just for one option.
* When such mechanism will be needed for general use, then we will figure out something.
*/
fw_ext('mailer')->set_db_settings_option(null, fw_get_options_values_from_input($this->get_inner_options(), $input_value));
}
/**
* Return "nothing"
* Prevent private smtp data to be saved/duplicated in post meta (somewhere else)
*/
return array('time' => time());
}
示例14: _get_value_from_input
/**
* Extract correct value for $option['value'] from input array
* If input value is empty, will be returned $option['value']
*
* @param array $option
* @param array|string|null $input_value
*
* @return string|array|int|bool Correct value
* @internal
*/
protected function _get_value_from_input($option, $input_value)
{
if (empty($input_value)) {
if (empty($option['popup-options'])) {
return array();
}
/**
* $option['value'] has DB format (not $input_value HTML format)
* so it can't be used as second parameter in fw_get_options_values_from_input()
* thus we need to move each option value in option array default values
*/
$popup_options = array();
foreach (fw_extract_only_options($option['popup-options']) as $popup_option_id => $popup_option) {
if (isset($option['value'][$popup_option_id])) {
$popup_option['value'] = $option['value'][$popup_option_id];
}
$popup_options[$popup_option_id] = $popup_option;
}
$values = fw_get_options_values_from_input($popup_options, array());
} else {
if (is_array($input_value)) {
/**
* Don't decode if we have already an array
*/
$values = fw_get_options_values_from_input($option['popup-options'], $input_value);
} else {
$values = fw_get_options_values_from_input($option['popup-options'], json_decode($input_value, true));
}
}
return $values;
}
示例15: fw_get_db_ext_settings_option
/**
* Get extension's settings option value from the database
*
* @param string $extension_name
* @param string|null $option_id
* @param null|mixed $default_value If no option found in the database, this value will be returned
* @param null|bool $get_original_value Original value is that with no translations and other changes
*
* @return mixed|null
*/
function fw_get_db_ext_settings_option($extension_name, $option_id = null, $default_value = null, $get_original_value = null)
{
if (!($extension = fw()->extensions->get($extension_name))) {
trigger_error('Invalid extension: ' . $extension_name, E_USER_WARNING);
return null;
}
$value = FW_WP_Option::get('fw_ext_settings_options:' . $extension_name, $option_id, $default_value, $get_original_value);
if (is_null($value)) {
/**
* Maybe the options was never saved or the given option id does not exists
* Extract the default values from the options array and try to find there the option id
*/
$cache_key = 'fw_default_options_values/ext_settings:' . $extension_name;
try {
$all_options_values = FW_Cache::get($cache_key);
} catch (FW_Cache_Not_Found_Exception $e) {
// extract the default values from options array
$all_options_values = fw_get_options_values_from_input($extension->get_settings_options(), array());
FW_Cache::set($cache_key, $all_options_values);
}
if (empty($option_id)) {
// option id not specified, return all options values
return $all_options_values;
} else {
return fw_akg($option_id, $all_options_values, $default_value);
}
} else {
return $value;
}
}