/var/www/wordpress/wp-admin/includes/admin.php
/var/www/wordpress/wp-admin/includes/bookmark.php
/var/www/wordpress/wp-admin/includes/class-ftp-pure.php
/var/www/wordpress/wp-admin/includes/class-ftp-sockets.php
/var/www/wordpress/wp-admin/includes/class-ftp.php
/var/www/wordpress/wp-admin/includes/class-pclzip.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-base.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-direct.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-ftpsockets.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-ssh2.php
/var/www/wordpress/wp-admin/includes/class-wp-importer.php
/var/www/wordpress/wp-admin/includes/class-wp-upgrader.php
/var/www/wordpress/wp-admin/includes/comment.php
/var/www/wordpress/wp-admin/includes/continents-cities.php
/var/www/wordpress/wp-admin/includes/dashboard.php
/var/www/wordpress/wp-admin/includes/deprecated.php
/var/www/wordpress/wp-admin/includes/export.php
/var/www/wordpress/wp-admin/includes/file.php
/var/www/wordpress/wp-admin/includes/image-edit.php
/var/www/wordpress/wp-admin/includes/image.php
/var/www/wordpress/wp-admin/includes/import.php
/var/www/wordpress/wp-admin/includes/manifest.php
/var/www/wordpress/wp-admin/includes/media.php
/var/www/wordpress/wp-admin/includes/meta-boxes.php
/var/www/wordpress/wp-admin/includes/misc.php
/var/www/wordpress/wp-admin/includes/ms-deprecated.php
/var/www/wordpress/wp-admin/includes/ms.php
/var/www/wordpress/wp-admin/includes/nav-menu.php
/var/www/wordpress/wp-admin/includes/plugin-install.php
/var/www/wordpress/wp-admin/includes/plugin.php
/var/www/wordpress/wp-admin/includes/post.php
/var/www/wordpress/wp-admin/includes/schema.php
/var/www/wordpress/wp-admin/includes/taxonomy.php
/var/www/wordpress/wp-admin/includes/template.php
/var/www/wordpress/wp-admin/includes/theme-install.php
/var/www/wordpress/wp-admin/includes/theme.php
/var/www/wordpress/wp-admin/includes/update-core.php
/var/www/wordpress/wp-admin/includes/update.php
/var/www/wordpress/wp-admin/includes/upgrade.php
/var/www/wordpress/wp-admin/includes/user.php
/var/www/wordpress/wp-admin/includes/widgets.php
/var/www/wordpress/wp-admin/js/revisions-js.php
/var/www/wordpress/wp-admin/maint/repair.php
/var/www/wordpress/wp-admin/admin-ajax.php
/var/www/wordpress/wp-admin/admin-footer.php
/var/www/wordpress/wp-admin/admin-functions.php
/var/www/wordpress/wp-admin/admin-header.php
/var/www/wordpress/wp-admin/admin-post.php
/var/www/wordpress/wp-admin/admin.php
/var/www/wordpress/wp-admin/async-upload.php
/var/www/wordpress/wp-admin/comment.php
/var/www/wordpress/wp-admin/custom-background.php
/var/www/wordpress/wp-admin/custom-header.php
/var/www/wordpress/wp-admin/edit-attachment-rows.php
/var/www/wordpress/wp-admin/edit-comments.php
/var/www/wordpress/wp-admin/edit-form-advanced.php
/var/www/wordpress/wp-admin/edit-form-comment.php
/var/www/wordpress/wp-admin/edit-link-categories.php
/var/www/wordpress/wp-admin/edit-link-category-form.php
/var/www/wordpress/wp-admin/edit-link-form.php
/var/www/wordpress/wp-admin/edit-post-rows.php
/var/www/wordpress/wp-admin/edit-tag-form.php
/var/www/wordpress/wp-admin/edit-tags.php
/var/www/wordpress/wp-admin/edit.php
/var/www/wordpress/wp-admin/export.php
/var/www/wordpress/wp-admin/gears-manifest.php
/var/www/wordpress/wp-admin/import.php
/var/www/wordpress/wp-admin/index-extra.php
/var/www/wordpress/wp-admin/index.php
/var/www/wordpress/wp-admin/install-helper.php
/var/www/wordpress/wp-admin/install.php
/var/www/wordpress/wp-admin/link-add.php
/var/www/wordpress/wp-admin/link-category.php
/var/www/wordpress/wp-admin/link-manager.php
/var/www/wordpress/wp-admin/link-parse-opml.php
/var/www/wordpress/wp-admin/link.php
/var/www/wordpress/wp-admin/load-scripts.php
/var/www/wordpress/wp-admin/load-styles.php
/var/www/wordpress/wp-admin/media-new.php
/var/www/wordpress/wp-admin/media-upload.php
/var/www/wordpress/wp-admin/media.php
/var/www/wordpress/wp-admin/menu-header.php
/var/www/wordpress/wp-admin/menu.php
/var/www/wordpress/wp-admin/moderation.php
/var/www/wordpress/wp-admin/ms-admin.php
/var/www/wordpress/wp-admin/ms-delete-site.php
/var/www/wordpress/wp-admin/ms-edit.php
/var/www/wordpress/wp-admin/ms-options.php
/var/www/wordpress/wp-admin/ms-sites.php
/var/www/wordpress/wp-admin/ms-themes.php
/var/www/wordpress/wp-admin/ms-upgrade-network.php
/var/www/wordpress/wp-admin/ms-users.php
/var/www/wordpress/wp-admin/my-sites.php
/var/www/wordpress/wp-admin/nav-menus.php
/var/www/wordpress/wp-admin/network.php
/var/www/wordpress/wp-admin/options-discussion.php
/var/www/wordpress/wp-admin/options-general.php
/var/www/wordpress/wp-admin/options-head.php
/var/www/wordpress/wp-admin/options-media.php
/var/www/wordpress/wp-admin/options-permalink.php
/var/www/wordpress/wp-admin/options-privacy.php
/var/www/wordpress/wp-admin/options-reading.php
/var/www/wordpress/wp-admin/options-writing.php
/var/www/wordpress/wp-admin/options.php
/var/www/wordpress/wp-admin/plugin-editor.php
/var/www/wordpress/wp-admin/plugin-install.php
/var/www/wordpress/wp-admin/plugins.php
/var/www/wordpress/wp-admin/post-new.php
/var/www/wordpress/wp-admin/post.php
/var/www/wordpress/wp-admin/press-this.php
/var/www/wordpress/wp-admin/profile.php
/var/www/wordpress/wp-admin/revision.php
/var/www/wordpress/wp-admin/setup-config.php
/var/www/wordpress/wp-admin/sidebar.php
/var/www/wordpress/wp-admin/theme-editor.php
/var/www/wordpress/wp-admin/theme-install.php
/var/www/wordpress/wp-admin/themes.php
/var/www/wordpress/wp-admin/tools.php
/var/www/wordpress/wp-admin/update-core.php
/var/www/wordpress/wp-admin/update.php
/var/www/wordpress/wp-admin/upgrade-functions.php
/var/www/wordpress/wp-admin/upgrade.php
/var/www/wordpress/wp-admin/upload.php
/var/www/wordpress/wp-admin/user-edit.php
/var/www/wordpress/wp-admin/user-new.php
/var/www/wordpress/wp-admin/users.php
/var/www/wordpress/wp-admin/widgets.php
/var/www/wordpress/wp-content/languages/ru_RU.php
/var/www/wordpress/wp-content/plugins/akismet/akismet.php
/var/www/wordpress/wp-content/plugins/rh/rh.php
/var/www/wordpress/wp-content/plugins/hello.php
/var/www/wordpress/wp-content/plugins/index.php
/var/www/wordpress/wp-content/themes/twentyten/404.php
/var/www/wordpress/wp-content/themes/twentyten/archive.php
/var/www/wordpress/wp-content/themes/twentyten/attachment.php
/var/www/wordpress/wp-content/themes/twentyten/author.php
/var/www/wordpress/wp-content/themes/twentyten/category.php
/var/www/wordpress/wp-content/themes/twentyten/comments.php
/var/www/wordpress/wp-content/themes/twentyten/footer.php
/var/www/wordpress/wp-content/themes/twentyten/functions.php
/var/www/wordpress/wp-content/themes/twentyten/header.php
/var/www/wordpress/wp-content/themes/twentyten/index.php
/var/www/wordpress/wp-content/themes/twentyten/loop.php
/var/www/wordpress/wp-content/themes/twentyten/onecolumn-page.php
/var/www/wordpress/wp-content/themes/twentyten/page.php
/var/www/wordpress/wp-content/themes/twentyten/search.php
/var/www/wordpress/wp-content/themes/twentyten/sidebar-footer.php
/var/www/wordpress/wp-content/themes/twentyten/sidebar.php
/var/www/wordpress/wp-content/themes/twentyten/single.php
/var/www/wordpress/wp-content/themes/twentyten/tag.php
/var/www/wordpress/wp-content/themes/index.php
/var/www/wordpress/wp-content/index.php
/var/www/wordpress/wp-includes/js/tinymce/langs/wp-langs.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/EnchantSpell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/includes/general.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/config.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/rpc.php
/var/www/wordpress/wp-includes/js/tinymce/wp-mce-help.php
/var/www/wordpress/wp-includes/js/tinymce/wp-tinymce.php
/var/www/wordpress/wp-includes/pomo/entry.php
/var/www/wordpress/wp-includes/pomo/mo.php
/var/www/wordpress/wp-includes/pomo/po.php
/var/www/wordpress/wp-includes/pomo/streams.php
/var/www/wordpress/wp-includes/pomo/translations.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/native.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/shell.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/string.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/xdiff.php
/var/www/wordpress/wp-includes/Text/Diff/Renderer/inline.php
/var/www/wordpress/wp-includes/Text/Diff/Renderer.php
/var/www/wordpress/wp-includes/Text/Diff.php
/var/www/wordpress/wp-includes/theme-compat/comments-popup.php
/var/www/wordpress/wp-includes/theme-compat/comments.php
/var/www/wordpress/wp-includes/theme-compat/footer.php
/var/www/wordpress/wp-includes/theme-compat/header.php
/var/www/wordpress/wp-includes/theme-compat/sidebar.php
/var/www/wordpress/wp-includes/atomlib.php
/var/www/wordpress/wp-includes/author-template.php
/var/www/wordpress/wp-includes/bookmark-template.php
/var/www/wordpress/wp-includes/bookmark.php
/var/www/wordpress/wp-includes/cache.php
/var/www/wordpress/wp-includes/canonical.php
/var/www/wordpress/wp-includes/capabilities.php
/var/www/wordpress/wp-includes/category-template.php
/var/www/wordpress/wp-includes/category.php
/var/www/wordpress/wp-includes/class-feed.php
/var/www/wordpress/wp-includes/class-http.php
/var/www/wordpress/wp-includes/class-IXR.php
/var/www/wordpress/wp-includes/class-json.php
/var/www/wordpress/wp-includes/class-oembed.php
/var/www/wordpress/wp-includes/class-phpass.php
/var/www/wordpress/wp-includes/class-phpmailer.php
/var/www/wordpress/wp-includes/class-pop3.php
/var/www/wordpress/wp-includes/class-simplepie.php
/var/www/wordpress/wp-includes/class-smtp.php
/var/www/wordpress/wp-includes/class-snoopy.php
/var/www/wordpress/wp-includes/class.wp-dependencies.php
/var/www/wordpress/wp-includes/class.wp-scripts.php
/var/www/wordpress/wp-includes/class.wp-styles.php
/var/www/wordpress/wp-includes/classes.php
/var/www/wordpress/wp-includes/comment-template.php
/var/www/wordpress/wp-includes/comment.php
/var/www/wordpress/wp-includes/compat.php
/var/www/wordpress/wp-includes/cron.php
/var/www/wordpress/wp-includes/default-constants.php
/var/www/wordpress/wp-includes/default-embeds.php
/var/www/wordpress/wp-includes/default-filters.php
/var/www/wordpress/wp-includes/default-widgets.php
/var/www/wordpress/wp-includes/deprecated.php
/var/www/wordpress/wp-includes/feed-atom-comments.php
/var/www/wordpress/wp-includes/feed-atom.php
/var/www/wordpress/wp-includes/feed-rdf.php
/var/www/wordpress/wp-includes/feed-rss.php
/var/www/wordpress/wp-includes/feed-rss2-comments.php
/var/www/wordpress/wp-includes/feed-rss2.php
/var/www/wordpress/wp-includes/feed.php
/var/www/wordpress/wp-includes/formatting.php
/var/www/wordpress/wp-includes/functions.php
/var/www/wordpress/wp-includes/functions.wp-scripts.php
/var/www/wordpress/wp-includes/functions.wp-styles.php
/var/www/wordpress/wp-includes/general-template.php
/var/www/wordpress/wp-includes/http.php
/var/www/wordpress/wp-includes/kses.php
/var/www/wordpress/wp-includes/l10n.php
/var/www/wordpress/wp-includes/link-template.php
/var/www/wordpress/wp-includes/load.php
/var/www/wordpress/wp-includes/locale.php
/var/www/wordpress/wp-includes/media.php
/var/www/wordpress/wp-includes/meta.php
#CodeDescriptions
1<?php
2/**
3 * Metadata API
4 *
5 * Functions for retrieving and manipulating metadata of various WordPress object types. Metadata
6 * for an object is a represented by a simple key-value pair. Objects may contain multiple
7 * metadata entries that share the same key and differ only in their value.
8 *
9 * @package WordPress
10 * @subpackage Meta
11 * @since 2.9.0
12 */
13
14/**
15 * Add metadata for the specified object.
16 *
17 * @since 2.9.0
18 * @uses $wpdb WordPress database object for queries.
19 * @uses do_action() Calls 'added_{$meta_type}_meta' with meta_id of added metadata entry,
20 * object ID, meta key, and meta value
21 *
22 * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)
23 * @param int $object_id ID of the object metadata is for
24 * @param string $meta_key Metadata key
25 * @param string $meta_value Metadata value
26 * @param bool $unique Optional, default is false. Whether the specified metadata key should be
27 * unique for the object. If true, and the object already has a value for the specified
28 * metadata key, no change will be made
29 * @return bool True on successful update, false on failure.
30 */
31function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = false) {
32 if ( !$meta_type || !$meta_key )
33 return false;
34
35 if ( !$object_id = absint($object_id) )
36 return false;
37
38 if ( ! $table = _get_meta_table($meta_type) )
39 return false;
40
41 global $wpdb;
42
43 $column = esc_sql($meta_type . '_id');
44
45 // expected_slashed ($meta_key)
46 $meta_key = stripslashes($meta_key);
47
48 if ( $unique && $wpdb->get_var( $wpdb->prepare(
49 "SELECT COUNT(*) FROM $table WHERE meta_key = %s AND $column = %d",
50 $meta_key, $object_id ) ) )
51 return false;
52
53 $_meta_value = $meta_value;
54 $meta_value = maybe_serialize( stripslashes_deep($meta_value) );
55
56 $wpdb->insert( $table, array(
57 $column => $object_id,
58 'meta_key' => $meta_key,
59 'meta_value' => $meta_value
60 ) );
61
62 wp_cache_delete($object_id, $meta_type . '_meta');
63 // users cache stores usermeta that must be cleared.
64 if ( 'user' == $meta_type )
65 clean_user_cache($object_id);
66
67 do_action( "added_{$meta_type}_meta", $wpdb->insert_id, $object_id, $meta_key, $_meta_value );
68
69 return true;
70}
71
72/**
73 * Update metadata for the specified object. If no value already exists for the specified object
74 * ID and metadata key, the metadata will be added.
75 *
76 * @since 2.9.0
77 * @uses $wpdb WordPress database object for queries.
78 * @uses do_action() Calls 'update_{$meta_type}_meta' before updating metadata with meta_id of
79 * metadata entry to update, object ID, meta key, and meta value
80 * @uses do_action() Calls 'updated_{$meta_type}_meta' after updating metadata with meta_id of
81 * updated metadata entry, object ID, meta key, and meta value
82 *
83 * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)
84 * @param int $object_id ID of the object metadata is for
85 * @param string $meta_key Metadata key
86 * @param string $meta_value Metadata value
87 * @param string $prev_value Optional. If specified, only update existing metadata entries with
88 * the specified value. Otherwise, update all entries.
89 * @return bool True on successful update, false on failure.
90 */
91function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_value = '') {
92 if ( !$meta_type || !$meta_key )
93 return false;
94
95 if ( !$object_id = absint($object_id) )
96 return false;
97
98 if ( ! $table = _get_meta_table($meta_type) )
99 return false;
100
101 global $wpdb;
102
103 $column = esc_sql($meta_type . '_id');
104 $id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
105
106 // expected_slashed ($meta_key)
107 $meta_key = stripslashes($meta_key);
108
109 if ( ! $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ) )
110 return add_metadata($meta_type, $object_id, $meta_key, $meta_value);
111
112 // Compare existing value to new value if no prev value given and the key exists only once.
113 if ( empty($prev_value) ) {
114 $old_value = get_metadata($meta_type, $object_id, $meta_key);
115 if ( count($old_value) == 1 ) {
116 if ( $old_value[0] === $meta_value )
117 return false;
118 }
119 }
120
121 $_meta_value = $meta_value;
122 $meta_value = maybe_serialize( stripslashes_deep($meta_value) );
123
124 $data = compact( 'meta_value' );
125 $where = array( $column => $object_id, 'meta_key' => $meta_key );
126
127 if ( !empty( $prev_value ) ) {
128 $prev_value = maybe_serialize($prev_value);
129 $where['meta_value'] = $prev_value;
130 }
131
132 do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
133
134 $wpdb->update( $table, $data, $where );
135 wp_cache_delete($object_id, $meta_type . '_meta');
136 // users cache stores usermeta that must be cleared.
137 if ( 'user' == $meta_type )
138 clean_user_cache($object_id);
139
140 do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
141
142 return true;
143}
144
145/**
146 * Delete metadata for the specified object.
147 *
148 * @since 2.9.0
149 * @uses $wpdb WordPress database object for queries.
150 * @uses do_action() Calls 'deleted_{$meta_type}_meta' after deleting with meta_id of
151 * deleted metadata entries, object ID, meta key, and meta value
152 *
153 * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)
154 * @param int $object_id ID of the object metadata is for
155 * @param string $meta_key Metadata key
156 * @param string $meta_value Optional. Metadata value. If specified, only delete metadata entries
157 * with this value. Otherwise, delete all entries with the specified meta_key.
158 * @param bool $delete_all Optional, default is false. If true, delete matching metadata entries
159 * for all objects, ignoring the specified object_id. Otherwise, only delete matching
160 * metadata entries for the specified object_id.
161 * @return bool True on successful delete, false on failure.
162 */
163function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false) {
164 if ( !$meta_type || !$meta_key )
165 return false;
166
167 if ( (!$object_id = absint($object_id)) && !$delete_all )
168 return false;
169
170 if ( ! $table = _get_meta_table($meta_type) )
171 return false;
172
173 global $wpdb;
174
175 $type_column = esc_sql($meta_type . '_id');
176 $id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
177 // expected_slashed ($meta_key)
178 $meta_key = stripslashes($meta_key);
179 $meta_value = maybe_serialize( stripslashes_deep($meta_value) );
180
181 $query = $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s", $meta_key );
182
183 if ( !$delete_all )
184 $query .= $wpdb->prepare(" AND $type_column = %d", $object_id );
185
186 if ( $meta_value )
187 $query .= $wpdb->prepare(" AND meta_value = %s", $meta_value );
188
189 $meta_ids = $wpdb->get_col( $query );
190 if ( !count( $meta_ids ) )
191 return false;
192
193 $query = "DELETE FROM $table WHERE $id_column IN( " . implode( ',', $meta_ids ) . " )";
194
195 $count = $wpdb->query($query);
196
197 if ( !$count )
198 return false;
199
200 wp_cache_delete($object_id, $meta_type . '_meta');
201 // users cache stores usermeta that must be cleared.
202 if ( 'user' == $meta_type )
203 clean_user_cache($object_id);
204
205 do_action( "deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $meta_value );
206
207 return true;
208}
209
210/**
211 * Retrieve metadata for the specified object.
212 *
213 * @since 2.9.0
214 *
215 * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)
216 * @param int $object_id ID of the object metadata is for
217 * @param string $meta_key Optional. Metadata key. If not specified, retrieve all metadata for
218 * the specified object.
219 * @param bool $single Optional, default is false. If true, return only the first value of the
220 * specified meta_key. This parameter has no effect if meta_key is not specified.
221 * @return string|array Single metadata value, or array of values
222 */
223function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) {
224 if ( !$meta_type )
225 return false;
226
227 if ( !$object_id = absint($object_id) )
228 return false;
229
230 $meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
231
232 if ( !$meta_cache ) {
233 update_meta_cache($meta_type, $object_id);
234 $meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
235 }
236
237 if ( ! $meta_key )
238 return $meta_cache;
239
240 if ( isset($meta_cache[$meta_key]) ) {
241 if ( $single )
242 return maybe_unserialize( $meta_cache[$meta_key][0] );//Possible Control Flow
243 else
244 return array_map('maybe_unserialize', $meta_cache[$meta_key]);//Possible Control Flow
245 }
246
247 if ($single)
248 return '';
249 else
250 return array();
251}
252
253/**
254 * Update the metadata cache for the specified objects.
255 *
256 * @since 2.9.0
257 * @uses $wpdb WordPress database object for queries.
258 *
259 * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)
260 * @param int|array $object_ids array or comma delimited list of object IDs to update cache for
261 * @return mixed Metadata cache for the specified objects, or false on failure.
262 */
263function update_meta_cache($meta_type, $object_ids) {
264 if ( empty( $meta_type ) || empty( $object_ids ) )
265 return false;
266
267 if ( ! $table = _get_meta_table($meta_type) )
268 return false;
269
270 $column = esc_sql($meta_type . '_id');
271
272 global $wpdb;
273
274 if ( !is_array($object_ids) ) {
275 $object_ids = preg_replace('|[^0-9,]|', '', $object_ids);
276 $object_ids = explode(',', $object_ids);
277 }
278
279 $object_ids = array_map('intval', $object_ids);
280
281 $cache_key = $meta_type . '_meta';
282 $ids = array();
283 foreach ( $object_ids as $id ) {
284 if ( false === wp_cache_get($id, $cache_key) )
285 $ids[] = $id;
286 }
287
288 if ( empty( $ids ) )
289 return false;
290
291 // Get meta info
292 $id_list = join(',', $ids);
293 $cache = array();
294 $meta_list = $wpdb->get_results( $wpdb->prepare("SELECT $column, meta_key, meta_value FROM $table WHERE $column IN ($id_list)",
295 $meta_type), ARRAY_A );
296
297 if ( !empty($meta_list) ) {
298 foreach ( $meta_list as $metarow) {
299 $mpid = intval($metarow[$column]);
300 $mkey = $metarow['meta_key'];
301 $mval = $metarow['meta_value'];
302
303 // Force subkeys to be array type:
304 if ( !isset($cache[$mpid]) || !is_array($cache[$mpid]) )
305 $cache[$mpid] = array();
306 if ( !isset($cache[$mpid][$mkey]) || !is_array($cache[$mpid][$mkey]) )
307 $cache[$mpid][$mkey] = array();
308
309 // Add a value to the current pid/key:
310 $cache[$mpid][$mkey][] = $mval;
311 }
312 }
313
314 foreach ( $ids as $id ) {
315 if ( ! isset($cache[$id]) )
316 $cache[$id] = array();
317 }
318
319 foreach ( array_keys($cache) as $object)
320 wp_cache_set($object, $cache[$object], $cache_key);
321
322 return $cache;
323}
324
325/**
326 * Retrieve the name of the metadata table for the specified object type.
327 *
328 * @since 2.9.0
329 * @uses $wpdb WordPress database object for queries.
330 *
331 * @param string $meta_type Type of object to get metadata table for (e.g., comment, post, or user)
332 * @return mixed Metadata table name, or false if no metadata table exists
333 */
334function _get_meta_table($type) {
335 global $wpdb;
336
337 $table_name = $type . 'meta';
338
339 if ( empty($wpdb->$table_name) )
340 return false;
341
342 return $wpdb->$table_name;
343}
344?>
345
/var/www/wordpress/wp-includes/ms-blogs.php
/var/www/wordpress/wp-includes/ms-default-constants.php
/var/www/wordpress/wp-includes/ms-default-filters.php
/var/www/wordpress/wp-includes/ms-deprecated.php
/var/www/wordpress/wp-includes/ms-files.php
/var/www/wordpress/wp-includes/ms-functions.php
/var/www/wordpress/wp-includes/ms-load.php
/var/www/wordpress/wp-includes/ms-settings.php
/var/www/wordpress/wp-includes/nav-menu-template.php
/var/www/wordpress/wp-includes/nav-menu.php
/var/www/wordpress/wp-includes/pluggable-deprecated.php
/var/www/wordpress/wp-includes/pluggable.php
/var/www/wordpress/wp-includes/plugin.php
/var/www/wordpress/wp-includes/post-template.php
/var/www/wordpress/wp-includes/post-thumbnail-template.php
/var/www/wordpress/wp-includes/post.php
/var/www/wordpress/wp-includes/query.php
/var/www/wordpress/wp-includes/registration-functions.php
/var/www/wordpress/wp-includes/registration.php
/var/www/wordpress/wp-includes/rewrite.php
/var/www/wordpress/wp-includes/rss-functions.php
/var/www/wordpress/wp-includes/rss.php
/var/www/wordpress/wp-includes/script-loader.php
/var/www/wordpress/wp-includes/shortcodes.php
/var/www/wordpress/wp-includes/taxonomy.php
/var/www/wordpress/wp-includes/template-loader.php
/var/www/wordpress/wp-includes/theme.php
/var/www/wordpress/wp-includes/update.php
/var/www/wordpress/wp-includes/user.php
/var/www/wordpress/wp-includes/vars.php
/var/www/wordpress/wp-includes/version.php
/var/www/wordpress/wp-includes/widgets.php
/var/www/wordpress/wp-includes/wp-db.php
/var/www/wordpress/wp-includes/wp-diff.php
/var/www/wordpress/index.php
/var/www/wordpress/wp-activate.php
/var/www/wordpress/wp-app.php
/var/www/wordpress/wp-atom.php
/var/www/wordpress/wp-blog-header.php
/var/www/wordpress/wp-comments-post.php
/var/www/wordpress/wp-commentsrss2.php
/var/www/wordpress/wp-config-sample.php
/var/www/wordpress/wp-cron.php
/var/www/wordpress/wp-feed.php
/var/www/wordpress/wp-links-opml.php
/var/www/wordpress/wp-load.php
/var/www/wordpress/wp-login.php
/var/www/wordpress/wp-mail.php
/var/www/wordpress/wp-pass.php
/var/www/wordpress/wp-rdf.php
/var/www/wordpress/wp-register.php
/var/www/wordpress/wp-rss.php
/var/www/wordpress/wp-rss2.php
/var/www/wordpress/wp-settings.php
/var/www/wordpress/wp-signup.php
/var/www/wordpress/wp-trackback.php
/var/www/wordpress/xmlrpc.php