PluginProbe
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions / trunk
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions vtrunk
260913 260909 260829 260814 260805 110710 110731 110812 110815 110912 110913 110915 110926 110927 111002 111003 111011 111017 111029 111105 111206 111216 111220 120213 120219 All 188 releases
s2member / src / includes / classes / utils-gets.inc.php

utils-gets.inc.php in s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions trunk, at src/includes/classes/utils-gets.inc.php

437 lines 21.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // @codingStandardsIgnoreFile
3 /**
4 * Get utilities.
5 *
6 * Copyright: © 2009-2011
7 * {@link http://websharks-inc.com/ WebSharks, Inc.}
8 * (coded in the USA)
9 *
10 * Released under the terms of the GNU General Public License.
11 * You should have received a copy of the GNU General Public License,
12 * along with this software. In the main directory, see: /licensing/
13 * If not, see: {@link http://www.gnu.org/licenses/}.
14 *
15 * @package s2Member\Utilities
16 * @since 3.5
17 */
18 if(!defined('WPINC')) // MUST have WordPress.
19 exit ('Do not access this file directly.');
20
21 if(!class_exists('c_ws_plugin__s2member_utils_gets'))
22 {
23 /**
24 * Get utilities.
25 *
26 * @package s2Member\Utilities
27 * @since 3.5
28 */
29 class c_ws_plugin__s2member_utils_gets
30 {
31 /**
32 * Retrieves a unique array of all Category IDs in the database.
33 *
34 * @package s2Member\Utilities
35 * @since 3.5
36 *
37 * @uses {@link http://codex.wordpress.org/Function_Reference/get_terms get_terms()}
38 *
39 * @return array Unique array of all Category IDs *(as integers)*.
40 */
41 public static function get_all_category_ids()
42 {
43 if(!($category_ids = wp_cache_get('all_category_ids', 'category')))
44 {
45 $category_ids = get_terms('category', array('fields' => 'ids', 'get' => 'all'));
46 wp_cache_add('all_category_ids', $category_ids, 'category');
47 }
48 if(is_array($category_ids)) // Use a WP function for this.
49 $category_ids = c_ws_plugin__s2member_utils_arrays::force_integers((array)$category_ids);
50
51 return (!empty($category_ids) && is_array($category_ids)) ? array_unique($category_ids) : array();
52 }
53
54 /**
55 * Retrieves a unique array of all child Category IDs, within a specific parent Category.
56 *
57 * @package s2Member\Utilities
58 * @since 3.5
59 *
60 * @param int|string $parent_category A numeric Category ID.
61 *
62 * @return array Unique array of all Category IDs *(as integers)* in ``$parent_category``.
63 */
64 public static function get_all_child_category_ids($parent_category = 0)
65 {
66 if(is_numeric($parent_category) && $parent_category && is_array($child_categories = get_categories('child_of='.$parent_category.'&hide_empty=0')))
67 foreach($child_categories as $child_category) // Go through child Categories.
68 $child_category_ids[] = (int)$child_category->term_id;
69
70 return (!empty($child_category_ids) && is_array($child_category_ids)) ? array_unique($child_category_ids) : array();
71 }
72
73 /**
74 * Retrieves a unique array of all Tag IDs in the database.
75 *
76 * @package s2Member\Utilities
77 * @since 3.5
78 *
79 * @return array Unique array of all Tag IDs *(as integers)*.
80 */
81 public static function get_all_tag_ids()
82 {
83 foreach((array)get_tags('hide_empty=0') as $tag)
84 $tag_ids[] = (int)$tag->term_id; // Collect Tag's ID.
85
86 return (!empty($tag_ids) && is_array($tag_ids)) ? array_unique($tag_ids) : array();
87 }
88
89 /**
90 * Converts a comma-delimited list of: Tag slugs/names/ids, into a unique array of all IDs.
91 *
92 * @package s2Member\Utilities
93 * @since 111101
94 *
95 * @param string $tags Tag slugs/names/IDs; comma-delimited.
96 *
97 * @return array Unique array of Tag IDs *(as integers)*. With Tag slugs/names converted to IDs.
98 */
99 public static function get_tags_converted_to_ids($tags = '')
100 {
101 foreach(preg_split('/['."\r\n\t".';,]+/', (string)$tags) as $tag)
102 {
103 if(($tag = trim($tag)) && is_numeric($tag)) // Force integers.
104 $tag_ids[] = ($tag_id = (int)$tag); // Force integer values here.
105
106 else if($tag && is_string($tag)) // A string (i.e., a tag name or a tag slug)?
107 {
108 if(is_object($term = get_term_by('name', $tag, 'post_tag')))
109 $tag_ids[] = (int)$term->term_id;
110
111 else if(is_object($term = get_term_by('slug', $tag, 'post_tag')))
112 $tag_ids[] = (int)$term->term_id;
113 }
114 }
115 return (!empty($tag_ids) && is_array($tag_ids)) ? array_unique($tag_ids) : array();
116 }
117
118 /**
119 * Retrieves a unique array of all published Post IDs in the database.
120 *
121 * @package s2Member\Utilities
122 * @since 3.5
123 *
124 * @param string $post_type Optional. If provided, return all Post IDs of a specific Post Type.
125 * Otherwise, return all Post IDs that are NOT of these Post Types: `page|attachment|nav_menu_item|revision`.
126 *
127 * @return array Unique array of all Post IDs *(as integers)*, including Custom Post Types; or all Post IDs of a specific Post Type.
128 */
129 public static function get_all_post_ids($post_type = '')
130 {
131 /** @var wpdb $wpdb WordPress DB object instance. */
132 global $wpdb; // Global DB object reference.
133
134 if(is_array($post_ids = $wpdb->get_col("SELECT `ID` FROM `".$wpdb->posts."` WHERE `post_status` = 'publish' AND ".(($post_type) ? "`post_type` = '".esc_sql((string)$post_type)."'" : "`post_type` NOT IN('page','attachment','nav_menu_item','revision')"))))
135 $post_ids = c_ws_plugin__s2member_utils_arrays::force_integers($post_ids);
136
137 return (!empty($post_ids) && is_array($post_ids)) ? array_unique($post_ids) : array();
138 }
139
140 /**
141 * Retrieves a unique array of all published Child Post IDs in the database.
142 *
143 * @package s2Member\Utilities
144 * @since 3.5
145 *
146 * @param int|string|array $parent_ids One or more parent IDs to collect children for.
147 *
148 * @param string $post_type Optional. If provided, return all Post IDs of a specific Post Type.
149 * Otherwise, return all Post IDs that are NOT of these Post Types: `page|attachment|nav_menu_item|revision`.
150 *
151 * @return array Unique array of all Child Post IDs *(as integers)*, including Custom Post Types; or all Child Post IDs of a specific Post Type.
152 */
153 public static function get_all_child_post_ids($parent_ids = array(), $post_type = '')
154 {
155 /** @var wpdb $wpdb WordPress DB object instance. */
156 global $wpdb; // Global DB object reference.
157
158 if(($parent_ids = (array)$parent_ids)) // Force an array value.
159 if(is_array($post_ids = $wpdb->get_col("SELECT `ID` FROM `".$wpdb->posts."` WHERE `post_status` = 'publish'".
160 " AND ".($post_type ? "`post_type` = '".esc_sql((string)$post_type)."'" : "`post_type` NOT IN('page','attachment','nav_menu_item','revision')").
161 " AND `post_parent` IN('".implode("','", $parent_ids)."')"))
162 ) $post_ids = c_ws_plugin__s2member_utils_arrays::force_integers($post_ids);
163
164 return (!empty($post_ids) && is_array($post_ids)) ? array_unique($post_ids) : array();
165 }
166
167 /**
168 * Retrieves a unique array of all published Page IDs in the database.
169 *
170 * @package s2Member\Utilities
171 * @since 3.5
172 *
173 * @return array Unique array of all Page IDs *(as integers)*.
174 */
175 public static function get_all_page_ids()
176 {
177 /** @var wpdb $wpdb WordPress DB object instance. */
178 global $wpdb; // Global DB object reference.
179
180 if(is_array($page_ids = $wpdb->get_col("SELECT `ID` FROM `".$wpdb->posts."` WHERE `post_status` = 'publish' AND `post_type` = 'page'")))
181 $page_ids = c_ws_plugin__s2member_utils_arrays::force_integers($page_ids);
182
183 return (!empty($page_ids) && is_array($page_ids)) ? array_unique($page_ids) : array();
184 }
185
186 /**
187 * Retrieves a unique array of all Singular IDs in the database that require Custom Capabilities.
188 *
189 * @package s2Member\Utilities
190 * @since 111101
191 *
192 * @return array Unique array of all Singular IDs *(as integers)* that require Custom Capabilities.
193 */
194 public static function get_all_singular_ids_with_ccaps()
195 {
196 /** @var wpdb $wpdb WordPress DB object instance. */
197 global $wpdb; // Global DB object reference.
198
199 if(is_array($singular_ids = $wpdb->get_col("SELECT `post_id` FROM `".$wpdb->postmeta."` WHERE `meta_key` = 's2member_ccaps_req' AND `meta_value` != ''")))
200 $singular_ids = c_ws_plugin__s2member_utils_arrays::force_integers($singular_ids);
201
202 return (!empty($singular_ids) && is_array($singular_ids)) ? array_unique($singular_ids) : array();
203 }
204
205 /**
206 * Retrieves a unique array of unavailable Singular IDs that require Custom Capabilities.
207 *
208 * Only returns Singular IDs that require Custom Capabilities;
209 * and ONLY those which are NOT satisfied by ``$user``.
210 *
211 * @package s2Member\Utilities
212 * @since 111101
213 *
214 * @param WP_User $user Optional. A `WP_User` object. If this is a valid `WP_User` object, test against this ``$user``, else all are unavailable.
215 *
216 * @return array Unique array of all Singular IDs *(as integers)* NOT available to ``$user``, due to Custom Capability Restrictions.
217 */
218 public static function get_unavailable_singular_ids_with_ccaps($user = NULL)
219 {
220 /** @var wpdb $wpdb WordPress DB object instance. */
221 global $wpdb; // Global DB object reference.
222
223 static $_results = array(), $_meta_changes = array();
224 $_cache_key = $wpdb->posts.'|'.$wpdb->postmeta;
225 $_changes = did_action('added_post_meta') + did_action('updated_post_meta') + did_action('deleted_post_meta');
226 if(!isset($_results[$_cache_key]) || !isset($_meta_changes[$_cache_key]) || $_meta_changes[$_cache_key] !== $_changes)
227 {
228 $_results[$_cache_key] = $wpdb->get_results("SELECT `".$wpdb->postmeta."`.`post_id`, `".$wpdb->postmeta."`.`meta_value`, `".$wpdb->posts."`.`post_type`".
229 " FROM `".$wpdb->posts."`, `".$wpdb->postmeta."` WHERE `".$wpdb->posts."`.`ID` = `".$wpdb->postmeta."`.`post_id`".
230 " AND `".$wpdb->postmeta."`.`meta_key` = 's2member_ccaps_req' AND `".$wpdb->postmeta."`.`meta_value` != ''");
231 $_meta_changes[$_cache_key] = $_changes;
232 }
233 $results = $_results[$_cache_key]; unset($_cache_key, $_changes); //260901 Request-local SQL cache.
234
235 if(is_array($results))
236 {
237 $bbpress_restrictions_enable = apply_filters('ws_plugin__s2member_bbpress_restrictions_enable', TRUE);
238 $bbpress_installed = c_ws_plugin__s2member_utils_conds::bbp_is_installed(); // bbPress is installed?
239 $bbpress_forum_post_type = $bbpress_installed ? bbp_get_forum_post_type() : ''; // Acquire the current post type for forums.
240 $bbpress_topic_post_type = $bbpress_installed ? bbp_get_topic_post_type() : ''; // Acquire the current post type for topics.
241
242 foreach($results as $r) // Now we need to check Custom Capabilities against ``$user``. If ``$user`` is a valid `WP_User` object, else all are unavailable.
243 {
244 if(!is_object($user) || empty($user->ID)) // No ``$user`` object? Maybe not logged-in?.
245 $singular_ids[] = (int)$r->post_id; // It's NOT available. There is no ``$user``.
246
247 else if(is_array($ccaps = c_ws_plugin__s2member_utils_arrays::maybe_unserialize($r->meta_value))) // Make sure we unserialize.
248 {
249 foreach($ccaps as $ccap) // Test for Custom Capability Restrictions now.
250 if(strlen($ccap) && !$user->has_cap('access_s2member_ccap_'.$ccap))
251 {
252 $singular_ids[] = (int)$r->post_id; // It's NOT available.
253 break; // Break now, no need to continue in this loop.
254 }
255 }
256 if($bbpress_restrictions_enable && $bbpress_installed && $r->post_type === $bbpress_forum_post_type)
257 if(!empty($singular_ids) && in_array((int)$r->post_id, $singular_ids, TRUE))
258 {
259 if(is_array($child_results = $wpdb->get_results("SELECT `".$wpdb->posts."`.`ID` as `post_id` FROM `".$wpdb->posts."`".
260 " WHERE `".$wpdb->posts."`.`post_parent` = '".esc_sql($r->post_id)."'".
261 " AND `".$wpdb->posts."`.`post_type` = '".esc_sql($bbpress_topic_post_type)."'")))
262 foreach($child_results as $child_r) $singular_ids[] = (int)$child_r->post_id;
263 }
264 }
265 }
266 return (!empty($singular_ids) && is_array($singular_ids)) ? array_unique($singular_ids) : array();
267 }
268
269 /**
270 * Retrieves a unique array of all Singular IDs that require Specific Post/Page Access.
271 *
272 * @package s2Member\Utilities
273 * @since 111101
274 *
275 * @param bool $exclude_conflicts Optional. Defaults to false. If true, return ONLY those which are NOT in conflict with any other Restriction Types.
276 * The ``$exclude_conflicts`` argument should be used whenever we introduce a list of option values to a site owner. Helping them avoid mishaps.
277 * Please note, the ``$exclude_conflicts`` argument implements a resource-intensive processing routine.
278 *
279 * @return array Unique array of all Singular IDs *(as integers)* that require Specific Post/Page Access.
280 */
281 public static function get_all_singular_ids_with_sp($exclude_conflicts = FALSE)
282 {
283 if(is_array(($singular_ids = ($GLOBALS['WS_PLUGIN__']['s2member']['o']['specific_ids'] && is_array($singular_ids = preg_split('/['."\r\n\t".'\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['specific_ids']))) ? $singular_ids : array())))
284 $singular_ids = c_ws_plugin__s2member_utils_arrays::force_integers($singular_ids);
285
286 if(!empty($singular_ids) && is_array($singular_ids) && $exclude_conflicts /* Return ONLY those which are NOT in conflict with other Restrictions? */)
287 {
288 $x_ids = array($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page'], $GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_options_page'], $GLOBALS['WS_PLUGIN__']['s2member']['o']['file_download_limit_exceeded_page']);
289
290 $x_ids = array_merge($x_ids, c_ws_plugin__s2member_utils_gets::get_all_singular_ids_with_ccaps());
291
292 for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++)
293 {
294 if($GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$n.'_catgs'] === 'all')
295 {
296 $catgs = c_ws_plugin__s2member_utils_gets::get_all_category_ids();
297 $x_ids = array_merge($x_ids, c_ws_plugin__s2member_utils_gets::get_singular_ids_in_terms($catgs));
298 continue; // Continue. The `all` specification is absolute. There's nothing more.
299 }
300 foreach(($catgs = preg_split('/['."\r\n\t".'\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$n.'_catgs'])) as $catg)
301 $catgs = array_merge($catgs, c_ws_plugin__s2member_utils_gets::get_all_child_category_ids($catg));
302
303 $x_ids = array_merge($x_ids, c_ws_plugin__s2member_utils_gets::get_singular_ids_in_terms($catgs));
304 unset ($catgs, $catg); // Just a little housekeeping here.
305 }
306 for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++)
307 {
308 if($GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$n.'_ptags'] === 'all')
309 {
310 $tags = c_ws_plugin__s2member_utils_gets::get_all_tag_ids();
311 $x_ids = array_merge($x_ids, c_ws_plugin__s2member_utils_gets::get_singular_ids_in_terms($tags));
312 continue; // Continue. The `all` specification is absolute. There's nothing more.
313 }
314 $tags = c_ws_plugin__s2member_utils_gets::get_tags_converted_to_ids($GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$n.'_ptags']);
315
316 $x_ids = array_merge($x_ids, c_ws_plugin__s2member_utils_gets::get_singular_ids_in_terms($tags));
317 unset ($tags); // Just a little housekeeping here.
318 }
319 for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++)
320 {
321 if($GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$n.'_posts'] === 'all')
322 {
323 $x_ids = array_merge($x_ids, c_ws_plugin__s2member_utils_gets::get_all_post_ids());
324 continue; // Continue. The `all` specification is absolute. There's nothing more.
325 }
326 foreach(($posts = preg_split('/['."\r\n\t".'\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$n.'_posts'])) as $p)
327 if(strpos($p, 'all-') === 0 && preg_match('/^all-(.+)$/', $p, $m) /* Protecting `all-` of a specific Post Type? */)
328 if((is_array($p_of_type = c_ws_plugin__s2member_utils_gets::get_all_post_ids($m[1])) || (substr($m[1], -1) === 's' && is_array($_p_of_type = c_ws_plugin__s2member_utils_gets::get_all_post_ids(substr($m[1], 0, -1))))) && !empty($p_of_type))
329 $x_ids = array_merge($x_ids, $p_of_type); // Merge all Posts of this Post Type.
330
331 $x_ids = array_merge($x_ids, $posts); // Merge together.
332 unset ($posts, $p, $m, $p_of_type); // Just a little housekeeping here.
333 }
334 for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++)
335 {
336 if($GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$n.'_pages'] === 'all')
337 {
338 $x_ids = array_merge($x_ids, c_ws_plugin__s2member_utils_gets::get_all_page_ids());
339 continue; // Continue. The `all` specification is absolute. There's nothing more.
340 }
341 $pages = preg_split('/['."\r\n\t".'\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$n.'_pages']);
342
343 $x_ids = array_merge($x_ids, $pages); // Merge.
344 unset ($pages); // Just a little housekeeping here.
345 }
346 $x_ids = array_unique(c_ws_plugin__s2member_utils_arrays::force_integers($x_ids));
347 $singular_ids = array_diff($singular_ids, $x_ids);
348 }
349 return (!empty($singular_ids) && is_array($singular_ids)) ? array_unique($singular_ids) : array();
350 }
351
352 /**
353 * Retrieves a unique array of unavailable Singular IDs that require Specific Post/Page Access.
354 *
355 * Only returns Singular IDs that require Specific Post/Page Access;
356 * and ONLY those which are NOT satisfied by the current Visitor.
357 *
358 * @package s2Member\Utilities
359 * @since 111101
360 *
361 * @param bool $exclude_conflicts Optional. Defaults to false. If true, return ONLY those which are NOT in conflict with any other Restriction Types.
362 * The ``$exclude_conflicts`` argument should be used whenever we introduce a list of option values to a site owner. Helping them avoid mishaps.
363 * Please note, the ``$exclude_conflicts`` argument implements a resource-intensive processing routine.
364 *
365 * @return array Unique array of all Singular IDs *(as integers)* NOT available to current Visitor, due to Specific Post/Page Restrictions.
366 */
367 public static function get_unavailable_singular_ids_with_sp($exclude_conflicts = FALSE)
368 {
369 if($GLOBALS['WS_PLUGIN__']['s2member']['o']['specific_ids'] && is_array($_singular_ids = preg_split('/['."\r\n\t".'\s;,]+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['specific_ids'])))
370 foreach($_singular_ids as $_singular_id) // Now check access to this Singular, against the current Visitor, via read-only ``c_ws_plugin__s2member_sp_access::sp_access()``.
371 if(is_numeric($_singular_id) && !c_ws_plugin__s2member_sp_access::sp_access($_singular_id, 'read-only'))
372 $singular_ids[] = (int)$_singular_id;
373
374 if(!empty($singular_ids) && is_array($singular_ids) && $exclude_conflicts)
375 {
376 $all_singular_ids_not_conflicting = c_ws_plugin__s2member_utils_gets::get_all_singular_ids_with_sp('exclude-conflicts');
377 foreach($singular_ids as $s => $singular_id) // Weed out anything that's in conflict here.
378 if(!in_array($singular_id, $all_singular_ids_not_conflicting))
379 unset($singular_ids[$s]); // Housekeeping.
380 }
381 return (!empty($singular_ids) && is_array($singular_ids)) ? array_unique($singular_ids) : array();
382 }
383
384 /**
385 * Retrieves a unique array of all published Singulars, protected with Specific Post/Page Access.
386 *
387 * @package s2Member\Utilities
388 * @since 111101
389 *
390 * @uses {@link http://codex.wordpress.org/Function_Reference/get_posts get_posts()}
391 *
392 * @param bool $exclude_conflicts Optional. Defaults to false. If true, return ONLY those which are NOT in conflict with any other Restriction Types.
393 * The ``$exclude_conflicts`` argument should be used whenever we introduce a list of option values to a site owner. Helping them avoid mishaps.
394 * Please note, the ``$exclude_conflicts`` argument implements a resource-intensive processing routine.
395 *
396 * @return array Unique array of all Singulars *(i.e., Posts/Pages )* protected with Specific Post/Page Access.
397 * Includes Custom Post Types also, as specified by site owner's Specific Post/Page Restrictions.
398 */
399 public static function get_all_singulars_with_sp($exclude_conflicts = FALSE)
400 {
401 $singulars = ($GLOBALS['WS_PLUGIN__']['s2member']['o']['specific_ids'] && is_array($singulars = get_posts('post_status=publish&post_type=any&include='.$GLOBALS['WS_PLUGIN__']['s2member']['o']['specific_ids']))) ? $singulars : array();
402
403 if(!empty($singulars) && is_array($singulars) && $exclude_conflicts)
404 {
405 $all_singular_ids_not_conflicting = c_ws_plugin__s2member_utils_gets::get_all_singular_ids_with_sp('exclude-conflicts');
406 foreach($singulars as $s => $singular) // Weed out anything that's in conflict here.
407 if(!in_array($singular->ID, $all_singular_ids_not_conflicting))
408 unset($singulars[$s]); // Housekeeping.
409 }
410 return (!empty($singulars) && is_array($singulars)) ? c_ws_plugin__s2member_utils_arrays::array_unique($singulars) : array();
411 }
412
413 /**
414 * Retrieves a unique array of Singular IDs in the database, within specific term IDs.
415 *
416 * Only returns Singular IDs that are within the ``$terms`` passed through this function.
417 *
418 * @package s2Member\Utilities
419 * @since 110912
420 *
421 * @param array $terms Required. An array of term IDs.
422 *
423 * @return array Unique array of all Singular IDs *(as integers)* within the ``$terms`` passed through this function.
424 */
425 public static function get_singular_ids_in_terms($terms = array())
426 {
427 /** @var wpdb $wpdb WordPress DB object instance. */
428 global $wpdb; // Global DB object reference.
429
430 if(!empty($terms) && is_array($terms) && is_array($singular_ids = $wpdb->get_col("SELECT `object_id` FROM `".$wpdb->term_relationships."` WHERE `term_taxonomy_id` IN (SELECT `term_taxonomy_id` FROM `".$wpdb->term_taxonomy."` WHERE `term_id` IN('".implode("','", $terms)."'))")))
431 $singular_ids = c_ws_plugin__s2member_utils_arrays::force_integers($singular_ids);
432
433 return (!empty($singular_ids) && is_array($singular_ids)) ? array_unique($singular_ids) : array();
434 }
435 }
436 }
437