本文整理汇总了PHP中cmb_Meta_Box::update_option方法的典型用法代码示例。如果您正苦于以下问题:PHP cmb_Meta_Box::update_option方法的具体用法?PHP cmb_Meta_Box::update_option怎么用?PHP cmb_Meta_Box::update_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmb_Meta_Box
的用法示例。
在下文中一共展示了cmb_Meta_Box::update_option方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hijack_oembed_cache_set
/**
* Hijacks saving of cached oEmbed.
* Saves cached data to relevant object metadata (vs postmeta)
*
* @since 0.9.5
* @param boolean $check Whether to continue setting postmeta
* @param int $object_id Object ID to get postmeta from
* @param string $meta_key Postmeta's key
* @param mixed $meta_value Value of the postmeta to be saved
* @return boolean Whether to continue setting
*/
public static function hijack_oembed_cache_set($check, $object_id, $meta_key, $meta_value)
{
if (!self::$hijack || self::$object_id != $object_id && 1987645321 !== $object_id) {
return $check;
}
// Cache the result to our metadata
if ('options-page' === self::$object_type) {
// Set the option
cmb_Meta_Box::update_option(self::$object_id, self::$embed_args['cache_key'], $meta_value, array('type' => 'oembed'));
// Save the option
cmb_Meta_Box::save_option(self::$object_id);
} else {
update_metadata(self::$object_type, self::$object_id, $meta_key, $meta_value);
}
// Anything other than `null` to cancel saving to postmeta
return true;
}
示例2: update_data
/**
* Updates metadata/option data
* @since 1.0.1
* @param mixed $value Value to update data with
* @param bool $single Whether data is an array (add_metadata)
*/
public function update_data($new_value, $single = true)
{
extract($this->data_args(array('new_value' => $new_value, 'single' => $single)));
$new_value = $repeat ? array_values($new_value) : $new_value;
if ('options-page' === $type) {
return cmb_Meta_Box::update_option($id, $field_id, $new_value, $single);
}
if (!$single) {
return add_metadata($type, $id, $field_id, $new_value, false);
}
return update_metadata($type, $id, $field_id, $new_value);
}
示例3: oembed_cache_set
/**
* Saves the cached oEmbed value to relevant object metadata (vs postmeta)
*
* @since 1.3.0
* @param string $meta_key Postmeta's key
* @param mixed $meta_value Value of the postmeta to be saved
*/
public static function oembed_cache_set($meta_key, $meta_value)
{
// Cache the result to our metadata
if ('options-page' === self::$object_type) {
// Set the option
cmb_Meta_Box::update_option(self::$object_id, self::$embed_args['cache_key'], $meta_value, array('type' => 'oembed'));
// Save the option
cmb_Meta_Box::save_option(self::$object_id);
} else {
update_metadata(self::$object_type, self::$object_id, $meta_key, $meta_value);
}
}