本文整理汇总了PHP中cmb_Meta_Box::save_option方法的典型用法代码示例。如果您正苦于以下问题:PHP cmb_Meta_Box::save_option方法的具体用法?PHP cmb_Meta_Box::save_option怎么用?PHP cmb_Meta_Box::save_option使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmb_Meta_Box
的用法示例。
在下文中一共展示了cmb_Meta_Box::save_option方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
}