/** * Hijacks retrieving of cached oEmbed. * Returns cached data from relevant object metadata (vs postmeta) * * @since 0.9.5 * @param boolean $check Whether to retrieve postmeta or override * @param int $object_id Object ID * @param string $meta_key Object metakey * @return mixed Object's oEmbed cached data */ public static function hijack_oembed_cache_get($check, $object_id, $meta_key) { if (!self::$hijack || self::$object_id != $object_id && 1987645321 !== $object_id) { return $check; } // get cached data $data = 'options-page' === self::$object_type ? cmb_Meta_Box::get_option(self::$object_id, self::$embed_args['cache_key']) : get_metadata(self::$object_type, self::$object_id, $meta_key, true); return $data; }
/** * Retrieves metadata/option data * @since 1.0.1 * @param string $field_id Meta key/Option array key * @return mixed Meta/Option value */ public function get_data($field_id = '', $args = array()) { if ($field_id) { $args['field_id'] = $field_id; } else { if ($this->group) { $args['field_id'] = $this->group->id(); } } extract($this->data_args($args)); $data = 'options-page' === $type ? cmb_Meta_Box::get_option($id, $field_id) : get_metadata($type, $id, $field_id, $single || $repeat); if ($this->group && $data) { $data = isset($data[$this->group->args('count')][$this->args('_id')]) ? $data[$this->group->args('count')][$this->args('_id')] : false; } return $data; }
/** * A helper function to get an option from a CMB options array * @since 1.0.1 * @param string $option_key Option key * @param string $field_id Option array field key * @return array Options array or specific field */ function cmb_get_option($option_key, $field_id = '') { return cmb_Meta_Box::get_option($option_key, $field_id); }