本文整理汇总了PHP中fw_aks函数的典型用法代码示例。如果您正苦于以下问题:PHP fw_aks函数的具体用法?PHP fw_aks怎么用?PHP fw_aks使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fw_aks函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: set
/**
* @param string $meta_type
* @param int $object_id
* @param string $multi_key 'abc' or 'ab/c/def'
* @param array|string|int|bool $set_value
*/
public static function set($meta_type, $object_id, $multi_key, $set_value)
{
if (empty($multi_key)) {
trigger_error('Key not specified', E_USER_WARNING);
return;
}
$multi_key = explode('/', $multi_key);
$key = array_shift($multi_key);
$multi_key = implode('/', $multi_key);
// Make sure meta is added to the post, not a revision.
if ($meta_type === 'post' && ($the_post = wp_is_post_revision($object_id))) {
$object_id = $the_post;
}
$cache_key = self::$cache_key . '/' . $meta_type . '/' . $object_id . '/' . $key;
if (empty($multi_key) && $multi_key !== '0') {
/** Replace entire meta */
fw_update_metadata($meta_type, $object_id, $key, $set_value);
FW_Cache::del($cache_key);
} else {
/** Change only specified key */
$values = array();
$values['original'] = self::get($meta_type, $object_id, $key, true);
$values['prepared'] = self::get($meta_type, $object_id, $key, false);
fw_aks($multi_key, $set_value, $values['original']);
fw_aks($multi_key, fw_prepare_option_value($set_value), $values['prepared']);
FW_Cache::set($cache_key, $values);
fw_update_metadata($meta_type, $object_id, $key, $values['original']);
}
}
开发者ID:floq-design,项目名称:Unyson,代码行数:35,代码来源:class-fw-wp-meta.php
示例2: set
/**
* @param int $post_id
* @param string $multi_key 'abc' or 'ab/c/def'
* @param array|string|int|bool $set_value
*/
public static function set($post_id, $multi_key, $set_value)
{
if (empty($multi_key)) {
trigger_error('Key not specified', E_USER_WARNING);
return;
}
$multi_key = explode('/', $multi_key);
$key = array_shift($multi_key);
$multi_key = implode('/', $multi_key);
$cache_key = self::$cache_key . '/' . $post_id . '/' . $key;
if (empty($multi_key) && $multi_key !== '0') {
/** Replace entire meta */
fw_update_post_meta($post_id, $key, $set_value);
FW_Cache::del($cache_key);
} else {
/** Change only specified key */
$values = array();
$values['original'] = self::get($post_id, $key, true);
$values['prepared'] = self::get($post_id, $key, false);
fw_aks($multi_key, $set_value, $values['original']);
fw_aks($multi_key, fw_prepare_option_value($set_value), $values['prepared']);
FW_Cache::set($cache_key, $values);
fw_update_post_meta($post_id, $key, $values['original']);
}
}
开发者ID:AdsonCicilioti,项目名称:Unyson,代码行数:30,代码来源:class-fw-wp-post-meta.php
示例3: get_set_key
protected static function get_set_key($multikey = null, $set_value = null, &$value)
{
$multikey = self::prepare_key($multikey);
if ($set_value === null) {
// get
return fw_stripslashes_deep_keys($multikey === null ? $value : fw_akg($multikey, $value));
} else {
// set
fw_aks($multikey, fw_addslashes_deep_keys($set_value), $value);
}
}
开发者ID:AdsonCicilioti,项目名称:Unyson,代码行数:11,代码来源:class-fw-request.php
示例4: set
/**
* Alternative for update_option()
* @param string $option_name
* @param string|null $specific_multi_key
* @param array|string|int|bool $set_value
*/
public static function set($option_name, $specific_multi_key = null, $set_value)
{
if ($specific_multi_key === null) {
// Replace entire option
update_option($option_name, $set_value, false);
} else {
// Change only specified key
$value = self::get($option_name, null, true);
fw_aks($specific_multi_key, $set_value, $value);
update_option($option_name, $value, false);
}
}
开发者ID:puriwp,项目名称:Theme-Framework,代码行数:18,代码来源:class-fw-wp-option.php
示例5: sanitize
public function sanitize($value)
{
$value = json_decode($value, true);
if (is_null($value) || !is_array($value)) {
return null;
}
$POST = array();
foreach ($value as $var) {
fw_aks(fw_html_attr_name_to_array_multi_key($var['name'], true), $var['value'], $POST);
}
$value = fw()->backend->option_type($this->fw_option['type'])->get_value_from_input($this->fw_option, fw_akg(fw_html_attr_name_to_array_multi_key($this->id), $POST));
return $value;
}
开发者ID:puriwp,项目名称:Theme-Framework,代码行数:13,代码来源:class--fw-customizer-setting-option.php
示例6: 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
示例7: _save
/**
* {@inheritdoc}
*/
protected function _save($id, array $option, $value, array $params)
{
if ($wp_option = $this->get_wp_option($option, $params)) {
if (isset($option['fw-storage']['key'])) {
$wp_option_value = get_option($wp_option, array());
fw_aks($option['fw-storage']['key'], $value, $wp_option_value);
update_option($wp_option, $wp_option_value, false);
unset($wp_option_value);
} else {
update_option($wp_option, $value, false);
}
return fw()->backend->option_type($option['type'])->get_value_from_input(array('type' => $option['type']), null);
} else {
return $value;
}
}
开发者ID:cristeamdev,项目名称:Unyson,代码行数:19,代码来源:class-fw-option-storage-type-wp-option.php
示例8: _save
/**
* {@inheritdoc}
*/
protected function _save($id, array $option, $value, array $params)
{
if ($post_id = $this->get_post_id($option, $params)) {
$meta_id = $this->get_meta_id($id, $option, $params);
if (isset($option['fw-storage']['key'])) {
$meta_value = get_post_meta($post_id, $meta_id, true);
fw_aks($option['fw-storage']['key'], $value, $meta_value);
fw_update_post_meta($post_id, $meta_id, $meta_value);
unset($meta_value);
} else {
fw_update_post_meta($post_id, $meta_id, $value);
}
return fw()->backend->option_type($option['type'])->get_value_from_input(array('type' => $option['type']), null);
} else {
return $value;
}
}
开发者ID:puriwp,项目名称:Theme-Framework,代码行数:20,代码来源:class-fw-option-storage-type-post-meta.php
示例9: set
/**
* Alternative for update_option()
* @param string $option_name
* @param string|null $specific_multi_key
* @param array|string|int|bool $set_value
*/
public static function set($option_name, $specific_multi_key = null, $set_value)
{
$cache_key = self::$cache_key . '/' . $option_name;
if ($specific_multi_key === null) {
/** Replace entire option */
update_option($option_name, $set_value, false);
FW_Cache::del($cache_key);
} else {
/** Change only specified key */
$values = array();
$values['original'] = self::get($option_name, null, true);
$values['prepared'] = self::get($option_name, null, false);
fw_aks($specific_multi_key, $set_value, $values['original']);
fw_aks($specific_multi_key, fw_prepare_option_value($set_value), $values['prepared']);
FW_Cache::set($cache_key, $values);
update_option($option_name, $values['original'], false);
}
}
开发者ID:cristeamdev,项目名称:Unyson,代码行数:24,代码来源:class-fw-wp-option.php
示例10: set
/**
* @param string $meta_type
* @param int $object_id
* @param string $multi_key 'abc' or 'ab/c/def'
* @param array|string|int|bool $set_value
*/
public static function set($meta_type, $object_id, $multi_key, $set_value)
{
if (empty($multi_key)) {
trigger_error('Key not specified', E_USER_WARNING);
return;
}
$multi_key = explode('/', $multi_key);
$key = array_shift($multi_key);
$multi_key = implode('/', $multi_key);
if (empty($multi_key) && $multi_key !== '0') {
// Replace entire meta
fw_update_metadata($meta_type, $object_id, $key, $set_value);
} else {
// Change only specified key
$value = self::get($meta_type, $object_id, $key, true);
fw_aks($multi_key, $set_value, $value);
fw_update_metadata($meta_type, $object_id, $key, $value);
}
}
开发者ID:puriwp,项目名称:Theme-Framework,代码行数:25,代码来源:class-fw-wp-meta.php
示例11: set
/**
* @param $keys
* @param $value
* @param $keys_delimiter
*/
public static function set($keys, $value, $keys_delimiter = '/')
{
fw_aks($keys, $value, self::$cache, $keys_delimiter);
self::free_memory();
// call it every time to take care about memory
}
开发者ID:AdsonCicilioti,项目名称:Unyson,代码行数:11,代码来源:class-fw-cache.php
示例12: fw_set_db_customizer_option
/**
* Set a theme customizer option value in database
*
* @param null $option_id Specific option id (accepts multikey). null - all options
* @param mixed $value
*/
function fw_set_db_customizer_option($option_id = null, $value)
{
$db_value = get_theme_mod(FW_Option_Type::get_default_name_prefix(), array());
if (is_null($option_id)) {
$db_value = $value;
} else {
fw_aks($option_id, $value, $db_value);
}
set_theme_mod(FW_Option_Type::get_default_name_prefix(), $db_value);
}
开发者ID:isatrio,项目名称:Unyson,代码行数:16,代码来源:database.php
示例13: set
public final function set($item_id = null, $option_id = null, $value, array $extra_data = array())
{
FW_Cache::del($cache_key_values = $this->get_cache_key('values', $item_id, $extra_data));
FW_Cache::del($cache_key_values_processed = $this->get_cache_key('values:processed', $item_id, $extra_data));
try {
$options = FW_Cache::get($cache_key = $this->get_cache_key('options', $item_id, $extra_data));
} catch (FW_Cache_Not_Found_Exception $e) {
FW_Cache::set($cache_key, array());
// prevent recursion
FW_Cache::set($cache_key, $options = fw_extract_only_options($this->get_options($item_id, $extra_data)));
}
$sub_keys = null;
if ($option_id) {
$option_id = explode('/', $option_id);
// 'option_id/sub/keys'
$_option_id = array_shift($option_id);
// 'option_id'
$sub_keys = empty($option_id) ? null : implode('/', $option_id);
// 'sub/keys'
$option_id = $_option_id;
unset($_option_id);
$old_values = is_array($old_values = $this->get_values($item_id, $extra_data)) ? $old_values : array();
$old_value = isset($old_values[$option_id]) ? $old_values[$option_id] : null;
if ($sub_keys) {
// update sub_key in old_value and use the entire value
$new_value = $old_value;
fw_aks($sub_keys, $value, $new_value);
$value = $new_value;
unset($new_value);
$old_value = fw_akg($sub_keys, $old_value);
}
if (isset($options[$option_id])) {
$value = fw()->backend->option_type($options[$option_id]['type'])->storage_save($option_id, $options[$option_id], $value, $this->get_fw_storage_params($item_id, $extra_data));
}
$old_values[$option_id] = $value;
$this->set_values($item_id, $old_values, $extra_data);
unset($old_values);
} else {
$old_value = is_array($old_values = $this->get_values($item_id, $extra_data)) ? $old_values : array();
if (!is_array($value)) {
$value = array();
}
foreach ($value as $_option_id => $_option_value) {
if (isset($options[$_option_id])) {
$value[$_option_id] = fw()->backend->option_type($options[$_option_id]['type'])->storage_save($_option_id, $options[$_option_id], $_option_value, $this->get_fw_storage_params($item_id, $extra_data));
}
}
$this->set_values($item_id, $value, $extra_data);
}
FW_Cache::del($cache_key_values);
// fixes https://github.com/ThemeFuse/Unyson/issues/1538
FW_Cache::del($cache_key_values_processed);
$this->_after_set($item_id, $option_id, $sub_keys, $old_value, $extra_data);
}
开发者ID:puriwp,项目名称:Theme-Framework,代码行数:54,代码来源:class-fw-db-options-model.php
示例14: _fw_update_adapter
private function _fw_update_adapter($allowed_places)
{
$db = $this->get_db();
fw_aks('allowed_places', $allowed_places, $db);
update_option($this->wp_option_sidebar_settings, $db, false);
}
开发者ID:northpen,项目名称:project_12,代码行数:6,代码来源:class-fw-extension-sidebars-backend.php
示例15: fw_set_db_extension_user_data
/**
* @param int $user_id
* @param string $extension_name
* @param mixed $value
* @param string $keys
*
* In case the extension doesn't exist or is disabled, or the value is equal to previous, returns false
*
* @return bool|int
*/
function fw_set_db_extension_user_data($user_id, $extension_name, $value, $keys = null)
{
if (!fw()->extensions->get($extension_name)) {
trigger_error('Invalid extension: ' . $extension_name, E_USER_WARNING);
return false;
}
$data = get_user_meta($user_id, 'fw_data', true);
if ($keys == null) {
fw_aks($extension_name, $value, $data);
} else {
fw_aks($extension_name . '/' . $keys, $value, $data);
}
return fw_update_user_meta($user_id, 'fw_data', $data);
}
开发者ID:puriwp,项目名称:Theme-Framework,代码行数:24,代码来源:database.php
示例16: set
/**
* @param $keys
* @param $value
* @param $keys_delimiter
*/
public static function set($keys, $value, $keys_delimiter = '/')
{
if (!self::is_enabled()) {
return;
}
self::free_memory();
fw_aks($keys, $value, self::$cache, $keys_delimiter);
self::free_memory();
}
开发者ID:puriwp,项目名称:Theme-Framework,代码行数:14,代码来源:class-fw-cache.php
示例17: set
public static function set($key, $value)
{
self::start_session();
fw_aks($key, $value, $_SESSION);
}
开发者ID:AdsonCicilioti,项目名称:Unyson,代码行数:5,代码来源:class-fw-session.php
示例18: fw_aks
/**
* Set (or create if not exists) value for specified key in some array level
*
* @param string $keys 'a/b/c', or 'a/b/c/' equivalent to: $arr['a']['b']['c'][] = $val;
* @param mixed $value
* @param array|object $array_or_object
* @param string $keys_delimiter
*/
function fw_aks($keys, $value, &$array_or_object, $keys_delimiter = '/')
{
if (!is_array($keys)) {
$keys = explode($keys_delimiter, (string) $keys);
}
$key_or_property = array_shift($keys);
if ($key_or_property === null) {
return;
}
$is_object = is_object($array_or_object);
if ($is_object) {
if (!property_exists($array_or_object, $key_or_property) || !(is_array($array_or_object->{$key_or_property}) || is_object($array_or_object->{$key_or_property}))) {
if ($key_or_property === '') {
// this happens when use 'empty keys' like: abc/d/e////i/j//foo/
trigger_error('Cannot push value to object like in array ($arr[] = $val)', E_USER_WARNING);
} else {
$array_or_object->{$key_or_property} = array();
}
}
} else {
if (!is_array($array_or_object)) {
$array_or_object = array();
}
if (!array_key_exists($key_or_property, $array_or_object) || !is_array($array_or_object[$key_or_property])) {
if ($key_or_property === '') {
// this happens when use 'empty keys' like: abc.d.e....i.j..foo.
$array_or_object[] = array();
// get auto created key (last)
end($array_or_object);
$key_or_property = key($array_or_object);
} else {
$array_or_object[$key_or_property] = array();
}
}
}
if (isset($keys[0])) {
// not used count() for performance reasons
if ($is_object) {
fw_aks($keys, $value, $array_or_object->{$key_or_property});
} else {
fw_aks($keys, $value, $array_or_object[$key_or_property]);
}
} else {
if ($is_object) {
$array_or_object->{$key_or_property} = $value;
} else {
$array_or_object[$key_or_property] = $value;
}
}
}
开发者ID:joelgarciajr84,项目名称:Unyson,代码行数:58,代码来源:general.php
示例19: update_preset
/**
* Save settings for specific pages/grouped pages/conditional tags
*/
public function update_preset($preset)
{
$db = $this->get_db();
$path = 'settings/' . $preset['type'] . '/' . $preset['sub_type'];
$value['position'] = $preset['position'];
$value['sidebars'] = $preset['sidebars'];
$value['timestamp'] = time();
if (is_array($preset['ids']) and !empty($preset['ids'])) {
$value['ids'] = $preset['ids'];
}
if (is_array($preset['ids'])) {
$path .= '/by_ids/' . $preset['preset'];
} else {
$path .= '/common';
}
fw_aks($path, $value, $db);
if (is_array($preset['ids'])) {
$this->recalculate_saved_ids($db, $preset['type'], $preset['sub_type']);
$this->clean_unused_arrays($db, $preset['type'], $preset['sub_type']);
$saved_presets = fw_akg('settings/saved_presets', $db, array());
if (!in_array($preset['preset'], $saved_presets)) {
$saved_presets[] = $preset['preset'];
fw_aks('settings/saved_presets', $saved_presets, $db);
}
}
update_option($this->wp_option_sidebar_settings, $db);
return true;
}
开发者ID:AdsonCicilioti,项目名称:Unyson,代码行数:31,代码来源:class-fw-extension-sidebars-backend.php
注:本文中的fw_aks函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论