| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * bbPress Common Engagements. | |
| 4 | + * bbPress Common Engagements | |
| 5 | 5 | * |
| 6 | 6 | * This file contains the common classes and functions for interacting with the |
| 7 | 7 | * bbPress engagements API. See `includes/users/engagements.php` for more. |
| 8 | 8 | * |
| @@ -13,14 +13,14 @@ | ||
| 13 | 13 | // Exit if accessed directly |
| 14 | 14 | defined( 'ABSPATH' ) || exit; |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | - * Return the strategy used for storing user engagements. | |
| 17 | + * Return the strategy used for storing user engagements | |
| 18 | 18 | * |
| 19 | 19 | * @since 2.6.0 bbPress (r6722) |
| 20 | 20 | * |
| 21 | - * @param string $rel_key The key used to index this relationship. | |
| 22 | - * @param string $rel_type The type of meta to look in. | |
| 21 | + * @param string $rel_key The key used to index this relationship | |
| 22 | + * @param string $rel_type The type of meta to look in | |
| 23 | 23 | * |
| 24 | 24 | * @return string |
| 25 | 25 | */ |
| 26 | 26 | function bbp_user_engagements_interface( $rel_key = '', $rel_type = 'post' ) { |
| @@ -44,19 +44,19 @@ | ||
| 44 | 44 | */ |
| 45 | 45 | public $type = ''; |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * Add a user id to an object. | |
| 48 | + * Add a user id to an object | |
| 49 | 49 | * |
| 50 | 50 | * @since 2.6.0 bbPress (r6722) |
| 51 | 51 | * |
| 52 | - * @param int $object_id The object id. | |
| 53 | - * @param int $user_id The user id. | |
| 54 | - * @param string $meta_key The relationship key. | |
| 55 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 56 | - * @param bool $unique Whether meta key should be unique to the object. | |
| 52 | + * @param int $object_id The object id | |
| 53 | + * @param int $user_id The user id | |
| 54 | + * @param string $meta_key The relationship key | |
| 55 | + * @param string $meta_type The relationship type (usually 'post') | |
| 56 | + * @param bool $unique Whether meta key should be unique to the object | |
| 57 | 57 | * |
| 58 | - * @return bool Returns true on success, false on failure. | |
| 58 | + * @return bool Returns true on success, false on failure | |
| 59 | 59 | */ |
| 60 | 60 | public function add_user_to_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post', $unique = false ) { |
| 61 | 61 | // Intentionally empty |
| 62 | 62 | } |
| @@ -61,18 +61,18 @@ | ||
| 61 | 61 | // Intentionally empty |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | - * Remove a user id from an object. | |
| 65 | + * Remove a user id from an object | |
| 66 | 66 | * |
| 67 | 67 | * @since 2.6.0 bbPress (r6722) |
| 68 | 68 | * |
| 69 | - * @param int $object_id The object id. | |
| 70 | - * @param int $user_id The user id. | |
| 71 | - * @param string $meta_key The relationship key. | |
| 72 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 69 | + * @param int $object_id The object id | |
| 70 | + * @param int $user_id The user id | |
| 71 | + * @param string $meta_key The relationship key | |
| 72 | + * @param string $meta_type The relationship type (usually 'post') | |
| 73 | 73 | * |
| 74 | - * @return bool Returns true on success, false on failure. | |
| 74 | + * @return bool Returns true on success, false on failure | |
| 75 | 75 | */ |
| 76 | 76 | public function remove_user_from_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post' ) { |
| 77 | 77 | // Intentionally empty |
| 78 | 78 | } |
| @@ -77,17 +77,17 @@ | ||
| 77 | 77 | // Intentionally empty |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | - * Remove a user id from all objects. | |
| 81 | + * Remove a user id from all objects | |
| 82 | 82 | * |
| 83 | 83 | * @since 2.6.0 bbPress (r6722) |
| 84 | 84 | * |
| 85 | - * @param int $user_id The user id. | |
| 86 | - * @param string $meta_key The relationship key. | |
| 87 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 85 | + * @param int $user_id The user id | |
| 86 | + * @param string $meta_key The relationship key | |
| 87 | + * @param string $meta_type The relationship type (usually 'post') | |
| 88 | 88 | * |
| 89 | - * @return bool Returns true on success, false on failure. | |
| 89 | + * @return bool Returns true on success, false on failure | |
| 90 | 90 | */ |
| 91 | 91 | public function remove_user_from_all_objects( $user_id = 0, $meta_key = '', $meta_type = 'post' ) { |
| 92 | 92 | // Intentionally empty |
| 93 | 93 | } |
| @@ -92,18 +92,18 @@ | ||
| 92 | 92 | // Intentionally empty |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | - * Remove an object from all users. | |
| 96 | + * Remove an object from all users | |
| 97 | 97 | * |
| 98 | 98 | * @since 2.6.0 bbPress (r6722) |
| 99 | 99 | * |
| 100 | - * @param int $object_id The object id. | |
| 101 | - * @param int $user_id The user id. | |
| 102 | - * @param string $meta_key The relationship key. | |
| 103 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 100 | + * @param int $object_id The object id | |
| 101 | + * @param int $user_id The user id | |
| 102 | + * @param string $meta_key The relationship key | |
| 103 | + * @param string $meta_type The relationship type (usually 'post') | |
| 104 | 104 | * |
| 105 | - * @return bool Returns true on success, false on failure. | |
| 105 | + * @return bool Returns true on success, false on failure | |
| 106 | 106 | */ |
| 107 | 107 | public function remove_object_from_all_users( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { |
| 108 | 108 | // Intentionally empty |
| 109 | 109 | } |
| @@ -108,16 +108,16 @@ | ||
| 108 | 108 | // Intentionally empty |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | - * Remove all users from all objects. | |
| 112 | + * Remove all users from all objects | |
| 113 | 113 | * |
| 114 | 114 | * @since 2.6.0 bbPress (r6722) |
| 115 | 115 | * |
| 116 | - * @param string $meta_key The relationship key. | |
| 117 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 116 | + * @param string $meta_key The relationship key | |
| 117 | + * @param string $meta_type The relationship type (usually 'post') | |
| 118 | 118 | * |
| 119 | - * @return bool Returns true on success, false on failure. | |
| 119 | + * @return bool Returns true on success, false on failure | |
| 120 | 120 | */ |
| 121 | 121 | public function remove_all_users_from_all_objects( $meta_key = '', $meta_type = 'post' ) { |
| 122 | 122 | // Intentionally empty |
| 123 | 123 | } |
| @@ -122,17 +122,17 @@ | ||
| 122 | 122 | // Intentionally empty |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | - * Get users of an object. | |
| 126 | + * Get users of an object | |
| 127 | 127 | * |
| 128 | 128 | * @since 2.6.0 bbPress (r6722) |
| 129 | 129 | * |
| 130 | - * @param int $object_id The object id. | |
| 131 | - * @param string $meta_key The key used to index this relationship. | |
| 132 | - * @param string $meta_type The type of meta to look in. | |
| 130 | + * @param int $object_id The object id | |
| 131 | + * @param string $meta_key The key used to index this relationship | |
| 132 | + * @param string $meta_type The type of meta to look in | |
| 133 | 133 | * |
| 134 | - * @return array Returns ids of users. | |
| 134 | + * @return array Returns ids of users | |
| 135 | 135 | */ |
| 136 | 136 | public function get_users_for_object( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { |
| 137 | 137 | // Intentionally empty |
| 138 | 138 | } |
| @@ -153,9 +153,9 @@ | ||
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
| 157 | - * Meta strategy for interfacing with User Engagements. | |
| 157 | + * Meta strategy for interfacing with User Engagements | |
| 158 | 158 | * |
| 159 | 159 | * @since 2.6.0 bbPress (r6722) |
| 160 | 160 | */ |
| 161 | 161 | class BBP_User_Engagements_Meta extends BBP_User_Engagements_Base { |
| @@ -169,19 +169,19 @@ | ||
| 169 | 169 | */ |
| 170 | 170 | public $type = 'meta'; |
| 171 | 171 | |
| 172 | 172 | /** |
| 173 | - * Add a user id to an object. | |
| 173 | + * Add a user id to an object | |
| 174 | 174 | * |
| 175 | 175 | * @since 2.6.0 bbPress (r6722) |
| 176 | 176 | * |
| 177 | - * @param int $object_id The object id. | |
| 178 | - * @param int $user_id The user id. | |
| 179 | - * @param string $meta_key The relationship key. | |
| 180 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 181 | - * @param bool $unique Whether meta key should be unique to the object. | |
| 177 | + * @param int $object_id The object id | |
| 178 | + * @param int $user_id The user id | |
| 179 | + * @param string $meta_key The relationship key | |
| 180 | + * @param string $meta_type The relationship type (usually 'post') | |
| 181 | + * @param bool $unique Whether meta key should be unique to the object | |
| 182 | 182 | * |
| 183 | - * @return bool Returns true on success, false on failure. | |
| 183 | + * @return bool Returns true on success, false on failure | |
| 184 | 184 | */ |
| 185 | 185 | public function add_user_to_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post', $unique = false ) { |
| 186 | 186 | return add_metadata( $meta_type, $object_id, $meta_key, $user_id, $unique ); |
| 187 | 187 | } |
| @@ -186,16 +186,16 @@ | ||
| 186 | 186 | return add_metadata( $meta_type, $object_id, $meta_key, $user_id, $unique ); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | /** |
| 190 | - * Remove a user id from an object. | |
| 190 | + * Remove a user id from an object | |
| 191 | 191 | * |
| 192 | 192 | * @since 2.6.0 bbPress (r6722) |
| 193 | 193 | * |
| 194 | - * @param int $object_id The object id. | |
| 195 | - * @param int $user_id The user id. | |
| 196 | - * @param string $meta_key The relationship key. | |
| 197 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 194 | + * @param int $object_id The object id | |
| 195 | + * @param int $user_id The user id | |
| 196 | + * @param string $meta_key The relationship key | |
| 197 | + * @param string $meta_type The relationship type (usually 'post') | |
| 198 | 198 | * |
| 199 | 199 | * @return bool Returns true on success, false on failure |
| 200 | 200 | */ |
| 201 | 201 | public function remove_user_from_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post' ) { |
| @@ -202,17 +202,17 @@ | ||
| 202 | 202 | return delete_metadata( $meta_type, $object_id, $meta_key, $user_id, false ); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
| 206 | - * Remove a user id from all objects. | |
| 206 | + * Remove a user id from all objects | |
| 207 | 207 | * |
| 208 | 208 | * @since 2.6.0 bbPress (r6722) |
| 209 | 209 | * |
| 210 | - * @param int $user_id The user id. | |
| 211 | - * @param string $meta_key The relationship key. | |
| 212 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 210 | + * @param int $user_id The user id | |
| 211 | + * @param string $meta_key The relationship key | |
| 212 | + * @param string $meta_type The relationship type (usually 'post') | |
| 213 | 213 | * |
| 214 | - * @return bool Returns true on success, false on failure. | |
| 214 | + * @return bool Returns true on success, false on failure | |
| 215 | 215 | */ |
| 216 | 216 | public function remove_user_from_all_objects( $user_id = 0, $meta_key = '', $meta_type = 'post' ) { |
| 217 | 217 | return delete_metadata( $meta_type, null, $meta_key, $user_id, true ); |
| 218 | 218 | } |
| @@ -217,18 +217,18 @@ | ||
| 217 | 217 | return delete_metadata( $meta_type, null, $meta_key, $user_id, true ); |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
| 221 | - * Remove an object from all users. | |
| 221 | + * Remove an object from all users | |
| 222 | 222 | * |
| 223 | 223 | * @since 2.6.0 bbPress (r6722) |
| 224 | 224 | * |
| 225 | - * @param int $object_id The object id. | |
| 226 | - * @param int $user_id The user id. | |
| 227 | - * @param string $meta_key The relationship key. | |
| 228 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 225 | + * @param int $object_id The object id | |
| 226 | + * @param int $user_id The user id | |
| 227 | + * @param string $meta_key The relationship key | |
| 228 | + * @param string $meta_type The relationship type (usually 'post') | |
| 229 | 229 | * |
| 230 | - * @return bool Returns true on success, false on failure. | |
| 230 | + * @return bool Returns true on success, false on failure | |
| 231 | 231 | */ |
| 232 | 232 | public function remove_object_from_all_users( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { |
| 233 | 233 | return delete_metadata( $meta_type, $object_id, $meta_key, null, false ); |
| 234 | 234 | } |
| @@ -233,16 +233,16 @@ | ||
| 233 | 233 | return delete_metadata( $meta_type, $object_id, $meta_key, null, false ); |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
| 237 | - * Remove all users from all objects. | |
| 237 | + * Remove all users from all objects | |
| 238 | 238 | * |
| 239 | 239 | * @since 2.6.0 bbPress (r6722) |
| 240 | 240 | * |
| 241 | - * @param string $meta_key The relationship key. | |
| 242 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 241 | + * @param string $meta_key The relationship key | |
| 242 | + * @param string $meta_type The relationship type (usually 'post') | |
| 243 | 243 | * |
| 244 | - * @return bool Returns true on success, false on failure. | |
| 244 | + * @return bool Returns true on success, false on failure | |
| 245 | 245 | */ |
| 246 | 246 | public function remove_all_users_from_all_objects( $meta_key = '', $meta_type = 'post' ) { |
| 247 | 247 | return delete_metadata( $meta_type, null, $meta_key, null, true ); |
| 248 | 248 | } |
| @@ -247,17 +247,17 @@ | ||
| 247 | 247 | return delete_metadata( $meta_type, null, $meta_key, null, true ); |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | /** |
| 251 | - * Get users of an object. | |
| 251 | + * Get users of an object | |
| 252 | 252 | * |
| 253 | 253 | * @since 2.6.0 bbPress (r6722) |
| 254 | 254 | * |
| 255 | - * @param int $object_id The object id. | |
| 256 | - * @param string $meta_key The key used to index this relationship. | |
| 257 | - * @param string $meta_type The type of meta to look in. | |
| 255 | + * @param int $object_id The object id | |
| 256 | + * @param string $meta_key The key used to index this relationship | |
| 257 | + * @param string $meta_type The type of meta to look in | |
| 258 | 258 | * |
| 259 | - * @return array Returns ids of users. | |
| 259 | + * @return array Returns ids of users | |
| 260 | 260 | */ |
| 261 | 261 | public function get_users_for_object( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { |
| 262 | 262 | return wp_parse_id_list( get_metadata( $meta_type, $object_id, $meta_key, false ) ); |
| 263 | 263 | } |
| @@ -304,9 +304,9 @@ | ||
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | /** |
| 308 | - * Term strategy for interfacing with User Engagements. | |
| 308 | + * Term strategy for interfacing with User Engagements | |
| 309 | 309 | * |
| 310 | 310 | * @since 2.6.0 bbPress (r6737) |
| 311 | 311 | */ |
| 312 | 312 | class BBP_User_Engagements_Term extends BBP_User_Engagements_Base { |
| @@ -320,9 +320,9 @@ | ||
| 320 | 320 | */ |
| 321 | 321 | public $type = 'term'; |
| 322 | 322 | |
| 323 | 323 | /** |
| 324 | - * Register an engagement taxonomy just-in-time for immediate use. | |
| 324 | + * Register an engagement taxonomy just-in-time for immediate use | |
| 325 | 325 | * |
| 326 | 326 | * @since 2.6.0 bbPress (r6737) |
| 327 | 327 | * |
| 328 | 328 | * @param string $tax_key |
| @@ -364,19 +364,19 @@ | ||
| 364 | 364 | ); |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | /** |
| 368 | - * Add a user id to an object. | |
| 368 | + * Add a user id to an object | |
| 369 | 369 | * |
| 370 | 370 | * @since 2.6.0 bbPress (r6737) |
| 371 | 371 | * |
| 372 | - * @param int $object_id The object id. | |
| 373 | - * @param int $user_id The user id. | |
| 374 | - * @param string $meta_key The relationship key. | |
| 375 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 376 | - * @param bool $unique Whether meta key should be unique to the object. | |
| 372 | + * @param int $object_id The object id | |
| 373 | + * @param int $user_id The user id | |
| 374 | + * @param string $meta_key The relationship key | |
| 375 | + * @param string $meta_type The relationship type (usually 'post') | |
| 376 | + * @param bool $unique Whether meta key should be unique to the object | |
| 377 | 377 | * |
| 378 | - * @return bool Returns true on success, false on failure. | |
| 378 | + * @return bool Returns true on success, false on failure | |
| 379 | 379 | */ |
| 380 | 380 | public function add_user_to_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post', $unique = false ) { |
| 381 | 381 | $user_key = "{$meta_key}_user_id_{$user_id}"; |
| 382 | 382 | $tax_key = "{$meta_key}_{$meta_type}"; |
| @@ -385,18 +385,18 @@ | ||
| 385 | 385 | return wp_add_object_terms( $object_id, $user_key, $tax_key ); |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | /** |
| 389 | - * Remove a user id from an object. | |
| 389 | + * Remove a user id from an object | |
| 390 | 390 | * |
| 391 | 391 | * @since 2.6.0 bbPress (r6737) |
| 392 | 392 | * |
| 393 | - * @param int $object_id The object id. | |
| 394 | - * @param int $user_id The user id. | |
| 395 | - * @param string $meta_key The relationship key. | |
| 396 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 393 | + * @param int $object_id The object id | |
| 394 | + * @param int $user_id The user id | |
| 395 | + * @param string $meta_key The relationship key | |
| 396 | + * @param string $meta_type The relationship type (usually 'post') | |
| 397 | 397 | * |
| 398 | - * @return bool Returns true on success, false on failure. | |
| 398 | + * @return bool Returns true on success, false on failure | |
| 399 | 399 | */ |
| 400 | 400 | public function remove_user_from_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post' ) { |
| 401 | 401 | $user_key = "{$meta_key}_user_id_{$user_id}"; |
| 402 | 402 | $tax_key = "{$meta_key}_{$meta_type}"; |
| @@ -405,17 +405,17 @@ | ||
| 405 | 405 | return wp_remove_object_terms( $object_id, $user_key, $tax_key ); |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | /** |
| 409 | - * Remove a user id from all objects. | |
| 409 | + * Remove a user id from all objects | |
| 410 | 410 | * |
| 411 | 411 | * @since 2.6.0 bbPress (r6737) |
| 412 | 412 | * |
| 413 | - * @param int $user_id The user id. | |
| 414 | - * @param string $meta_key The relationship key. | |
| 415 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 413 | + * @param int $user_id The user id | |
| 414 | + * @param string $meta_key The relationship key | |
| 415 | + * @param string $meta_type The relationship type (usually 'post') | |
| 416 | 416 | * |
| 417 | - * @return bool Returns true on success, false on failure. | |
| 417 | + * @return bool Returns true on success, false on failure | |
| 418 | 418 | */ |
| 419 | 419 | public function remove_user_from_all_objects( $user_id = 0, $meta_key = '', $meta_type = 'post' ) { |
| 420 | 420 | $user_key = "{$meta_key}_user_id_{$user_id}"; |
| 421 | 421 | $tax_key = "{$meta_key}_{$meta_type}"; |
| @@ -425,19 +425,19 @@ | ||
| 425 | 425 | return wp_delete_term( $term->term_id, $tax_key ); |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | /** |
| 429 | - * Remove an object from all users. | |
| 429 | + * Remove an object from all users | |
| 430 | 430 | * |
| 431 | 431 | * @since 2.6.0 bbPress (r6737) |
| 432 | 432 | * @since 2.6.17 Limit removal to the requested relationship taxonomy. |
| 433 | 433 | * |
| 434 | - * @param int $object_id The object id. | |
| 435 | - * @param int $user_id The user id. | |
| 436 | - * @param string $meta_key The relationship key. | |
| 437 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 434 | + * @param int $object_id The object id | |
| 435 | + * @param int $user_id The user id | |
| 436 | + * @param string $meta_key The relationship key | |
| 437 | + * @param string $meta_type The relationship type (usually 'post') | |
| 438 | 438 | * |
| 439 | - * @return bool Returns true on success, false on failure. | |
| 439 | + * @return bool Returns true on success, false on failure | |
| 440 | 440 | */ |
| 441 | 441 | public function remove_object_from_all_users( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { |
| 442 | 442 | $tax_key = "{$meta_key}_{$meta_type}"; |
| 443 | 443 | $this->jit_taxonomy( $tax_key ); |
| @@ -445,16 +445,16 @@ | ||
| 445 | 445 | return wp_delete_object_term_relationships( $object_id, $tax_key ); |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | /** |
| 449 | - * Remove all users from all objects. | |
| 449 | + * Remove all users from all objects | |
| 450 | 450 | * |
| 451 | 451 | * @since 2.6.0 bbPress (r6737) |
| 452 | 452 | * |
| 453 | - * @param string $meta_key The relationship key. | |
| 454 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 453 | + * @param string $meta_key The relationship key | |
| 454 | + * @param string $meta_type The relationship type (usually 'post') | |
| 455 | 455 | * |
| 456 | - * @return bool Returns true on success, false on failure. | |
| 456 | + * @return bool Returns true on success, false on failure | |
| 457 | 457 | */ |
| 458 | 458 | public function remove_all_users_from_all_objects( $meta_key = '', $meta_type = 'post' ) { |
| 459 | 459 | // TODO |
| 460 | 460 | } |
| @@ -459,17 +459,17 @@ | ||
| 459 | 459 | // TODO |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | /** |
| 463 | - * Get users of an object. | |
| 463 | + * Get users of an object | |
| 464 | 464 | * |
| 465 | 465 | * @since 2.6.0 bbPress (r6737) |
| 466 | 466 | * |
| 467 | - * @param int $object_id The object id. | |
| 468 | - * @param string $meta_key The key used to index this relationship. | |
| 469 | - * @param string $meta_type The type of meta to look in. | |
| 467 | + * @param int $object_id The object id | |
| 468 | + * @param string $meta_key The key used to index this relationship | |
| 469 | + * @param string $meta_type The type of meta to look in | |
| 470 | 470 | * |
| 471 | - * @return array Returns ids of users. | |
| 471 | + * @return array Returns ids of users | |
| 472 | 472 | */ |
| 473 | 473 | public function get_users_for_object( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { |
| 474 | 474 | $user_key = "{$meta_key}_user_id_"; |
| 475 | 475 | $tax_key = "{$meta_key}_{$meta_type}"; |
| @@ -542,9 +542,9 @@ | ||
| 542 | 542 | } |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | /** |
| 546 | - * User strategy for interfacing with User Engagements. | |
| 546 | + * User strategy for interfacing with User Engagements | |
| 547 | 547 | * |
| 548 | 548 | * This strategy largely exists for backwards compatibility with bbPress 2.5, |
| 549 | 549 | * or installations that have not upgraded their databases to 2.6 or above. |
| 550 | 550 | * |
| @@ -675,9 +675,9 @@ | ||
| 675 | 675 | * |
| 676 | 676 | * @param string $meta_key |
| 677 | 677 | * @param int $object_id |
| 678 | 678 | * |
| 679 | - * @return mixed Results from cache get. | |
| 679 | + * @return mixed Results from cache get | |
| 680 | 680 | */ |
| 681 | 681 | private function cache_get( $meta_key = '', $object_id = 0 ) { |
| 682 | 682 | $cache_key = $this->get_cache_key( $meta_key, $object_id ); |
| 683 | 683 | |
| @@ -694,9 +694,9 @@ | ||
| 694 | 694 | * |
| 695 | 695 | * @param string $meta_key |
| 696 | 696 | * @param int $object_id |
| 697 | 697 | * |
| 698 | - * @return mixed Results from cache set. | |
| 698 | + * @return mixed Results from cache set | |
| 699 | 699 | */ |
| 700 | 700 | private function cache_set( $meta_key = '', $object_id = 0, $user_ids = array() ) { |
| 701 | 701 | $cache_key = $this->get_cache_key( $meta_key, $object_id ); |
| 702 | 702 | $user_ids = $this->parse_comma_list( $user_ids ); |
| @@ -714,9 +714,9 @@ | ||
| 714 | 714 | * |
| 715 | 715 | * @param string $meta_key |
| 716 | 716 | * @param int $object_id |
| 717 | 717 | * |
| 718 | - * @return mixed Results from cache delete. | |
| 718 | + * @return mixed Results from cache delete | |
| 719 | 719 | */ |
| 720 | 720 | private function cache_delete( $meta_key = '', $object_id = 0 ) { |
| 721 | 721 | $cache_key = $this->get_cache_key( $meta_key, $object_id ); |
| 722 | 722 | |
| @@ -735,25 +735,25 @@ | ||
| 735 | 735 | return array_filter( wp_parse_id_list( $results ) ); |
| 736 | 736 | } |
| 737 | 737 | |
| 738 | 738 | /** |
| 739 | - * Add a user id to an object. | |
| 739 | + * Add a user id to an object | |
| 740 | 740 | * |
| 741 | 741 | * @since 2.6.0 bbPress (r6844) |
| 742 | 742 | * |
| 743 | - * @param int $object_id The object id. | |
| 744 | - * @param int $user_id The user id. | |
| 745 | - * @param string $meta_key The relationship key. | |
| 746 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 747 | - * @param bool $unique Whether meta key should be unique to the object. | |
| 743 | + * @param int $object_id The object id | |
| 744 | + * @param int $user_id The user id | |
| 745 | + * @param string $meta_key The relationship key | |
| 746 | + * @param string $meta_type The relationship type (usually 'post') | |
| 747 | + * @param bool $unique Whether meta key should be unique to the object | |
| 748 | 748 | * |
| 749 | - * @return bool Returns true on success, false on failure. | |
| 749 | + * @return bool Returns true on success, false on failure | |
| 750 | 750 | */ |
| 751 | 751 | public function add_user_to_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post', $unique = false ) { |
| 752 | 752 | $retval = false; |
| 753 | 753 | $option_key = $this->get_user_option_key( $meta_key, $object_id ); |
| 754 | 754 | $object_ids = $this->parse_comma_list( get_user_option( $option_key, $user_id ) ); |
| 755 | - $exists = array_search( $object_id, $object_ids, true ); | |
| 755 | + $exists = array_search( $object_id, $object_ids ); | |
| 756 | 756 | |
| 757 | 757 | // Not already added, so add it |
| 758 | 758 | if ( false === $exists ) { |
| 759 | 759 | $object_ids[] = $object_id; |
| @@ -770,24 +770,24 @@ | ||
| 770 | 770 | return $retval; |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | /** |
| 774 | - * Remove a user id from an object. | |
| 774 | + * Remove a user id from an object | |
| 775 | 775 | * |
| 776 | 776 | * @since 2.6.0 bbPress (r6844) |
| 777 | 777 | * |
| 778 | - * @param int $object_id The object id. | |
| 779 | - * @param int $user_id The user id. | |
| 780 | - * @param string $meta_key The relationship key. | |
| 781 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 778 | + * @param int $object_id The object id | |
| 779 | + * @param int $user_id The user id | |
| 780 | + * @param string $meta_key The relationship key | |
| 781 | + * @param string $meta_type The relationship type (usually 'post') | |
| 782 | 782 | * |
| 783 | - * @return bool Returns true on success, false on failure. | |
| 783 | + * @return bool Returns true on success, false on failure | |
| 784 | 784 | */ |
| 785 | 785 | public function remove_user_from_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post' ) { |
| 786 | 786 | $retval = false; |
| 787 | 787 | $option_key = $this->get_user_option_key( $meta_key, $object_id ); |
| 788 | 788 | $object_ids = $this->parse_comma_list( get_user_option( $option_key, $user_id ) ); |
| 789 | - $exists = array_search( $object_id, $object_ids, true ); | |
| 789 | + $exists = array_search( $object_id, $object_ids ); | |
| 790 | 790 | |
| 791 | 791 | // Exists, so remove it |
| 792 | 792 | if ( false !== $exists ) { |
| 793 | 793 | unset( $object_ids[ $exists ] ); |
| @@ -807,17 +807,17 @@ | ||
| 807 | 807 | return $retval; |
| 808 | 808 | } |
| 809 | 809 | |
| 810 | 810 | /** |
| 811 | - * Remove a user id from all objects. | |
| 811 | + * Remove a user id from all objects | |
| 812 | 812 | * |
| 813 | 813 | * @since 2.6.0 bbPress (r6844) |
| 814 | 814 | * |
| 815 | - * @param int $user_id The user id. | |
| 816 | - * @param string $meta_key The relationship key. | |
| 817 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 815 | + * @param int $user_id The user id | |
| 816 | + * @param string $meta_key The relationship key | |
| 817 | + * @param string $meta_type The relationship type (usually 'post') | |
| 818 | 818 | * |
| 819 | - * @return bool Returns true on success, false on failure. | |
| 819 | + * @return bool Returns true on success, false on failure | |
| 820 | 820 | */ |
| 821 | 821 | public function remove_user_from_all_objects( $user_id = 0, $meta_key = '', $meta_type = 'post' ) { |
| 822 | 822 | |
| 823 | 823 | // Get the key |
| @@ -840,18 +840,18 @@ | ||
| 840 | 840 | return $retval; |
| 841 | 841 | } |
| 842 | 842 | |
| 843 | 843 | /** |
| 844 | - * Remove an object from all users. | |
| 844 | + * Remove an object from all users | |
| 845 | 845 | * |
| 846 | 846 | * @since 2.6.0 bbPress (r6844) |
| 847 | 847 | * |
| 848 | - * @param int $object_id The object id. | |
| 849 | - * @param int $user_id The user id. | |
| 850 | - * @param string $meta_key The relationship key. | |
| 851 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 848 | + * @param int $object_id The object id | |
| 849 | + * @param int $user_id The user id | |
| 850 | + * @param string $meta_key The relationship key | |
| 851 | + * @param string $meta_type The relationship type (usually 'post') | |
| 852 | 852 | * |
| 853 | - * @return bool Returns true on success, false on failure. | |
| 853 | + * @return bool Returns true on success, false on failure | |
| 854 | 854 | */ |
| 855 | 855 | public function remove_object_from_all_users( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { |
| 856 | 856 | |
| 857 | 857 | // Query for users |
| @@ -878,16 +878,16 @@ | ||
| 878 | 878 | return ( $r_count === $u_count ); |
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | /** |
| 882 | - * Remove all users from all objects. | |
| 882 | + * Remove all users from all objects | |
| 883 | 883 | * |
| 884 | 884 | * @since 2.6.0 bbPress (r6844) |
| 885 | 885 | * |
| 886 | - * @param string $meta_key The relationship key. | |
| 887 | - * @param string $meta_type The relationship type (usually 'post'). | |
| 886 | + * @param string $meta_key The relationship key | |
| 887 | + * @param string $meta_type The relationship type (usually 'post') | |
| 888 | 888 | * |
| 889 | - * @return bool Returns true on success, false on failure. | |
| 889 | + * @return bool Returns true on success, false on failure | |
| 890 | 890 | */ |
| 891 | 891 | public function remove_all_users_from_all_objects( $meta_key = '', $meta_type = 'post' ) { |
| 892 | 892 | |
| 893 | 893 | // Query for users |
| @@ -916,9 +916,9 @@ | ||
| 916 | 916 | return ( $r_count === $u_count ); |
| 917 | 917 | } |
| 918 | 918 | |
| 919 | 919 | /** |
| 920 | - * Get users of an object. | |
| 920 | + * Get users of an object | |
| 921 | 921 | * |
| 922 | 922 | * The database queries in this function were cached in bbPress versions |
| 923 | 923 | * older than 2.6, but no longer are to avoid cache pollution. |
| 924 | 924 | * |
| @@ -923,13 +923,13 @@ | ||
| 923 | 923 | * older than 2.6, but no longer are to avoid cache pollution. |
| 924 | 924 | * |
| 925 | 925 | * @since 2.6.0 bbPress (r6844) |
| 926 | 926 | * |
| 927 | - * @param int $object_id The object id. | |
| 928 | - * @param string $meta_key The key used to index this relationship. | |
| 929 | - * @param string $meta_type The type of meta to look in. | |
| 927 | + * @param int $object_id The object id | |
| 928 | + * @param string $meta_key The key used to index this relationship | |
| 929 | + * @param string $meta_type The type of meta to look in | |
| 930 | 930 | * |
| 931 | - * @return array Returns ids of users. | |
| 931 | + * @return array Returns ids of users | |
| 932 | 932 | */ |
| 933 | 933 | public function get_users_for_object( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { |
| 934 | 934 | |
| 935 | 935 | // Try to get user IDs from cache |