/** * @access public * @param string $meta_object_type Type of object metadata is for (e.g., variation. cart, etc) * @return string Name of the custom meta table defined in $wpdb, or the name as it would be defined * @deprecated since 3.8.13.4 */ function wpsc_meta_table_name($meta_object_type) { _wpsc_deprecated_function(__FUNCTION__, '3.8.14', '_wpsc_meta_table_name'); return _wpsc_meta_table_name($meta_object_type); }
/** * Get the meta ids associated with a specific meta type, object id and meta key * the timestamp of the newest record is returned * * @acess private * @since 3.8.14 * * @param string $meta_object_type Type of object metadata is for (e.g., variation. cart, etc) * @param int $meta_id ID for a specific meta row * @return array array of meta ids */ function _wpsc_get_meta_ids($meta_object_type, $object_id, $meta_key) { global $wpdb; $meta_item_ids = array(); $object_id = intval($object_id); if (!empty($meta_object_type) && !empty($object_id) && !empty($meta_key)) { $meta_table_name = _wpsc_meta_table_name($meta_object_type); if (!empty($meta_table_name)) { $sql = 'SELECT meta_id ' . ' FROM ' . $meta_table_name . ' WHERE `' . _wpsc_meta_key_name($meta_object_type) . '` = %d ' . ' AND meta_key = %s'; $sql = $wpdb->prepare($sql, $object_id, $meta_key); $meta_item_ids = $wpdb->get_col($sql, 0); if (!empty($meta_item_ids)) { $meta_item_ids = array_map('intval', $meta_item_ids); } } } return $meta_item_ids; }