PluginProbe ʕ •ᴥ•ʔ
Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager / 2.9.4
Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager v2.9.4
3.1.9 3.1.8 3.1.7 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 trunk 1.3.7 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.6.9 2.7 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9 2.9.1 2.9.2
folders / includes / plugins.class.php
folders / includes Last commit date
class-affiliate.php 3 years ago class-polylang.php 2 years ago class-review-box.php 2 years ago class-upgrade-box.php 3 years ago class-wpml.php 3 years ago folders.class.php 2 years ago form.class.php 3 years ago media.replace.php 2 years ago plugins.class.php 3 years ago tree.class.php 2 years ago
plugins.class.php
729 lines
1 <?php
2 /**
3 * Class Folders Plugins import/export
4 *
5 * @author : Premio <contact@premio.io>
6 * @license : GPL2
7 * */
8
9 if (! defined('ABSPATH')) {
10 exit;
11 }
12
13 // Free/Pro Class name change
14 class WCP_Folder_Plugins
15 {
16
17 /**
18 * Collection of Plugins to import Data
19 *
20 * @var array $plugins Collection of Plugins
21 * @since 1.0.0
22 * @access public
23 */
24 public $plugins = [];
25
26 /**
27 * Collection of Post types to Import
28 *
29 * @var array $postTypes Post types to import
30 * @since 1.0.0
31 * @access public
32 */
33 public $postTypes = [];
34
35 /**
36 * Check is there any data to import
37 *
38 * @var integer $is_exists 0/1
39 * @since 1.0.0
40 * @access public
41 */
42 public $is_exists = 0;
43
44
45 /**
46 * Define the core functionality of the import data functionality.
47 * Define the core functionality of the import data functionality.
48 *
49 * Import data from other plugins
50 * Remove data from other plugins
51 *
52 * @since 1.0.0
53 */
54 public function __construct()
55 {
56
57 // Import plugin data
58 add_action('wp_ajax_wcp_import_plugin_folders_data', [$this, 'import_plugin_folders_data']);
59 add_action('wp_ajax_wcp_remove_plugin_folders_data', [$this, 'remove_plugin_folders_data']);
60
61 }//end __construct()
62
63
64 /**
65 * Remove data from other plugins
66 *
67 * @since 1.0.0
68 * @access public
69 * @return $response
70 */
71 public function remove_plugin_folders_data()
72 {
73 global $wpdb;
74 $postData = filter_input_array(INPUT_POST);
75
76 $plugin = isset($postData['plugin']) ? sanitize_text_field($postData['plugin']) : "";
77 $nonce = isset($postData['nonce']) ? sanitize_text_field($postData['nonce']) : "";
78 $response = [];
79 $response['status'] = 0;
80 $response['message'] = esc_html__("Invalid request", "folders");
81 $response['data'] = [];
82 $response['data']['plugin'] = $plugin;
83 if (wp_verify_nonce($nonce, "import_data_from_".$plugin)) {
84 $this->get_plugin_information();
85 $folders = isset($this->plugins[$plugin]['folders']) ? $this->plugins[$plugin]['folders'] : [];
86 $attachments = isset($this->plugins[$plugin]['attachments']) ? $this->plugins[$plugin]['attachments'] : [];
87
88 if ($plugin != 'filebird' && $plugin != 'real-media-library') {
89 $deleted = [];
90
91 foreach ($folders as $folder) {
92 $term_id = intval($folder->term_id);
93
94 if ($term_id) {
95 $deleted[$term_id]['term_relationships'] = $wpdb->delete($wpdb->prefix.'term_relationships', ['term_taxonomy_id' => $term_id]);
96 $deleted[$term_id]['term_taxonomy'] = $wpdb->delete($wpdb->prefix.'term_taxonomy', ['term_id' => $term_id]);
97 $deleted[$term_id]['terms'] = $wpdb->delete($wpdb->prefix.'terms', ['term_id' => $term_id]);
98
99 if ($plugin === 'folders') {
100 $deleted[$term_id]['termmeta'] = $wpdb->delete($wpdb->prefix.'termmeta', ['term_id' => $term_id]);
101 }
102 }
103 }
104 } else {
105 if (count($folders)) {
106 if ($plugin === 'filebird') {
107 $wpdb->query('DELETE FROM '.$wpdb->prefix.'fbv');
108 }
109
110 if ($plugin === 'real-media-library') {
111 $wpdb->query('DELETE FROM '.$wpdb->prefix.'realmedialibrary');
112
113 $wpdb->query('DELETE FROM '.$wpdb->prefix.'realmedialibrary_meta');
114 }
115 }
116
117 if (count($attachments)) {
118 if ($plugin === 'filebird') {
119 $wpdb->query('DELETE FROM '.$wpdb->prefix.'fbv_attachment_folder');
120 }
121
122 if ($plugin === 'real-media-library') {
123 $wpdb->query('DELETE FROM '.$wpdb->prefix.'realmedialibrary_posts');
124 }
125 }
126 }//end if
127
128 $response['status'] = 1;
129 }//end if
130
131 echo json_encode($response);
132 exit;
133
134 }//end remove_plugin_folders_data()
135
136
137 public function filter_categories_by_term_id($attachments)
138 {
139 $termsData = [];
140 foreach ($attachments as $attachment) {
141 $termsData[$attachment->folder_id][] = $attachment->attachment_id;
142 }
143
144 return $termsData;
145
146 }//end filter_categories_by_term_id()
147
148
149 public function import_plugin_folders_data()
150 {
151
152 global $wpdb;
153
154 $postData = filter_input_array(INPUT_POST);
155
156 $paged = isset($postData['paged']) && is_numeric($postData['paged']) && $postData['paged'] > 0 ? intval(sanitize_text_field($postData['paged'])) : 1;
157 $attachedItems = isset($postData['attached']) && is_numeric($postData['attached']) && $postData['attached'] > 0 ? intval(sanitize_text_field($postData['attached'])) : 0;
158 $startFrom = (10 * ($paged - 1));
159 $endFolder = (10 * $paged);
160 $totalFolders = 0;
161
162 $plugin = isset($postData['plugin']) ? $postData['plugin'] : "";
163 $nonce = isset($postData['nonce']) ? $postData['nonce'] : "";
164
165 $dataSet = [];
166 $response = [];
167 $response['status'] = 0;
168 $response['message'] = esc_html__("Invalid request", "folders");
169 $response['data'] = [];
170 $response['data']['plugin'] = $plugin;
171 if (wp_verify_nonce($nonce, "import_data_from_".$plugin)) {
172 $this->get_plugin_information();
173 $folders = isset($this->plugins[$plugin]['folders']) ? $this->plugins[$plugin]['folders'] : [];
174 $totalFolders = count($folders);
175 $attachments = isset($this->plugins[$plugin]['attachments']) ? $this->plugins[$plugin]['attachments'] : [];
176
177 $categoryByID = [];
178 $foldersImported = [];
179 $attachmentsImported = [];
180 if ($plugin != 'filebird' && $plugin != 'real-media-library') {
181 $currentFolder = -1;
182 foreach ($folders as $folder) {
183 $currentFolder++;
184 $folder_id = $folder->term_id;
185 $parent = intval($folder->parent);
186
187 $taxonomy = 'media_folder';
188
189 foreach ($this->post_types as $post_type) {
190 if (strpos($folder->taxonomy, $post_type) !== false) {
191 if ($post_type == "post") {
192 $taxonomy = "post_folder";
193 } else if ($post_type == "page") {
194 $taxonomy = "folder";
195 } else if ($post_type == "attachment") {
196 $taxonomy = "media_folder";
197 } else {
198 $taxonomy = $post_type.'_folder';
199 }
200 }
201 }
202
203 if ($parent && isset($categoryByID[$parent]['term_id'])) {
204 $parent = intval($categoryByID[$parent]['term_id']);
205 }
206
207 $new_term = wp_insert_term($folder->name, $taxonomy, ['parent' => $parent]);
208
209 if (is_wp_error($new_term)) {
210 if (isset($new_term->errors['term_exists']) && $new_term->error_data['term_exists']) {
211 $termId = $new_term->error_data['term_exists'];
212 $termData = get_term($termId, "", ARRAY_A);
213 if (!empty($termData)) {
214 $new_term = $termData;
215 } else {
216 continue;
217 }
218 } else {
219 continue;
220 }
221 }
222
223 $arg = [
224 'hide_empty' => false,
225 'parent' => $parent,
226 'hierarchical' => false,
227 'update_count_callback' => '_update_generic_term_count',
228 ];
229 $terms = get_terms($taxonomy, $arg);
230 $position = count($terms);
231
232 if ($plugin == 'mediamatic' || $plugin == 'happyfiles') {
233 $meta_key = "";
234 if ($plugin == 'mediamatic') {
235 $meta_key = "folder_position";
236 } else if ($plugin == 'happyfiles') {
237 $meta_key = "happyfiles_position";
238 }
239
240 if (!empty($meta_key)) {
241 $folder_position = get_term_meta($new_term['term_id'], $meta_key, true);
242 if (empty($folder_position)) {
243 $position = intval($folder_position);
244 }
245 }
246 }
247
248 update_term_meta($new_term['term_id'], 'wcp_custom_order', $position);
249
250 $foldersImported[] = $new_term;
251
252 $categoryByID[$folder_id] = [
253 'term_id' => $new_term['term_id'],
254 'parent' => $parent,
255 'name' => $folder->name,
256 ];
257
258 $newTermID = $new_term['term_id'];
259 $folderItems = 0;
260 $failedItems = 0;
261 $query = "SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d";
262 $query = $wpdb->prepare($query, [$folder->term_taxonomy_id]);
263 $results = $wpdb->get_results($query);
264 $found_results = count($results);
265 if ($currentFolder >= $startFrom && $currentFolder < $endFolder) {
266 if (count($results)) {
267 foreach ($results as $result) {
268 $term_set = wp_set_object_terms($result->object_id, $newTermID, $taxonomy, true);
269
270 if (is_wp_error($term_set)) {
271 $failedItems++;
272 continue;
273 }
274
275 $folderItems++;
276
277 $attachmentsImported[] = [
278 'cat_id' => $newTermID,
279 'term_ids' => $result->object_id,
280 'set' => $term_set,
281 ];
282 }
283 }
284
285 $dataSet[] = [
286 'id' => $newTermID,
287 'old_id' => $folder->term_taxonomy_id,
288 'name' => $folder->name,
289 'items' => $folderItems,
290 'failed' => $failedItems,
291 'results' => $found_results,
292 ];
293 }//end if
294 }//end foreach
295 } else {
296 $attachments = $this->filter_categories_by_term_id($attachments);
297 $currentFolder = -1;
298 foreach ($folders as $folder) {
299 $currentFolder++;
300 $parent = intval($folder->parent);
301 if ($parent == -1) {
302 $parent = 0;
303 }
304
305 $parentID = 0;
306
307 if ($parent && isset($categoryByID[$parent]['term_id'])) {
308 $parentID = $categoryByID[$parent]['term_id'];
309 }
310
311 $new_term = wp_insert_term($folder->name, "media_folder", ['parent' => $parentID]);
312
313 if (is_wp_error($new_term)) {
314 if (isset($new_term->errors['term_exists']) && $new_term->error_data['term_exists']) {
315 $termId = $new_term->error_data['term_exists'];
316 $termData = get_term($termId, "", ARRAY_A);
317 if (!empty($termData)) {
318 $new_term = $termData;
319 } else {
320 continue;
321 }
322 } else {
323 continue;
324 }
325 }
326
327 $taxonomy = 'media_folder';
328
329 $arg = [
330 'hide_empty' => false,
331 'parent' => $parentID,
332 'hierarchical' => false,
333 'update_count_callback' => '_update_generic_term_count',
334 ];
335 $terms = get_terms($taxonomy, $arg);
336 $position = count($terms);
337
338 update_term_meta($new_term['term_id'], 'wcp_custom_order', intval($position));
339
340 $foldersImported[] = $new_term;
341
342 $categoryByID[$folder->id] = [
343 'name' => $folder->name,
344 'parent' => $parent,
345 'term_id' => $new_term['term_id'],
346 ];
347
348 $newTermID = $new_term['term_id'];
349 $folderItems = 0;
350 $failedItems = 0;
351 $found_results = 0;
352 if ($currentFolder >= $startFrom && $currentFolder < $endFolder) {
353 if (isset($attachments[$folder->id]) && count($attachments[$folder->id]) > 0) {
354 foreach ($attachments[$folder->id] as $result) {
355 $term_set = wp_set_object_terms($result, $newTermID, $taxonomy, true);
356
357 if (is_wp_error($term_set)) {
358 $failedItems++;
359 continue;
360 }
361
362 $folderItems++;
363
364 $attachmentsImported[] = [
365 'cat_id' => $newTermID,
366 'term_ids' => $result->object_id,
367 'set' => $term_set,
368 ];
369 }
370
371 $dataSet[] = [
372 'id' => $newTermID,
373 'old_id' => $folder->id,
374 'name' => $folder->name,
375 'items' => $folderItems,
376 'failed' => $failedItems,
377 'results' => $found_results,
378 ];
379 }//end if
380 }//end if
381 }//end foreach
382 }//end if
383
384 delete_transient("premio_folders_without_trash");
385
386 $totalPages = ceil($totalFolders / 10);
387 $response['status'] = 1;
388 $response['data']['imported'] = count($foldersImported);
389 $response['data']['attachments'] = (count($attachmentsImported) + $attachedItems);
390 $response['data']['data_set'] = $dataSet;
391 $response['data']['folders'] = $totalFolders;
392 $response['data']['pages'] = $totalPages;
393 $response['data']['current'] = $paged;
394 $response['data']['plugin'] = $plugin;
395 $response['message'] = sprintf(esc_html__('%s folders imported and %s attachments categorized.', 'folders'), count($foldersImported), (count($attachmentsImported) + $attachedItems));
396 }//end if
397
398 echo json_encode($response);
399 exit;
400
401 }//end import_plugin_folders_data()
402
403
404 /**
405 * Get installed Plugins list
406 *
407 * @since 1.0.0
408 * @access public
409 * @return $plugins
410 */
411 public function get_plugin_information()
412 {
413 $this->get_other_plugins_data();
414 return $this->plugins;
415
416 }//end get_plugin_information()
417
418
419 /**
420 * Get installed Plugins list to Import data
421 *
422 * @since 1.0.0
423 * @access public
424 * @return $plugins
425 */
426 public function get_other_plugins_data()
427 {
428 if (!empty($this->plugins)) {
429 return $this->plugins;
430 }
431
432 $this->plugins = [
433 // FileBird
434 'filebird' => [
435 'name' => 'FileBird (v4)',
436 'taxonomy' => 'filebird',
437 // has custom DB table
438 'folders' => [],
439 'attachments' => [],
440 'total_folders' => 0,
441 'total_attachments' => 0,
442 'is_exists' => 0,
443 ],
444 'enhanced-media-library' => [
445 // Enhanced Media Library
446 'name' => 'Enhanced Media Library',
447 'taxonomy' => 'media_category',
448 'folders' => [],
449 'attachments' => [],
450 'total_folders' => 0,
451 'total_attachments' => 0,
452 'is_exists' => 0,
453 ],
454 'wicked-folders' => [
455 // Wicked Folders
456 'name' => 'Wicked Folders',
457 'taxonomy' => 'wf_attachment_folders',
458 'folders' => [],
459 'attachments' => [],
460 'total_folders' => 0,
461 'total_attachments' => 0,
462 'is_exists' => 0,
463 ],
464 'real-media-library' => [
465 // Real Media Library
466 'name' => 'Real Media Library (by DevOwl)',
467 'taxonomy' => 'rml',
468 // has custom DB table
469 'folders' => [],
470 'attachments' => [],
471 'total_folders' => 0,
472 'total_attachments' => 0,
473 'is_exists' => 0,
474 ],
475 'wp-media-folder' => [
476 // WP Media Folder
477 'name' => 'WP Media Folder (by JoomUnited)',
478 'taxonomy' => 'wpmf-category',
479 'folders' => [],
480 'attachments' => [],
481 'total_folders' => 0,
482 'total_attachments' => 0,
483 'is_exists' => 0,
484 ],
485 'mediamatic' => [
486 // Mediamatic
487 'name' => 'WordPress Media Library Folders | Mediamatic',
488 'taxonomy' => 'mediamatic_wpfolder',
489 'folders' => [],
490 'attachments' => [],
491 'total_folders' => 0,
492 'total_attachments' => 0,
493 'is_exists' => 0,
494 ],
495 'happyfiles' => [
496 // HappyFiles
497 'name' => 'HappyFiles',
498 'taxonomy' => 'happyfiles_category',
499 'folders' => [],
500 'attachments' => [],
501 'total_folders' => 0,
502 'total_attachments' => 0,
503 'is_exists' => 0,
504 ],
505 ];
506 $post_types = get_post_types([]);
507 $this->post_types = array_keys($post_types);
508
509 foreach ($this->plugins as $slug => $plugin_data) {
510 $taxonomy = $plugin_data['taxonomy'];
511
512 if ($slug === 'wicked-folders') {
513 // Run for all registered post types
514 $folders = [];
515
516 foreach ($this->post_types as $post_type) {
517 $wicked_folders = $this->get_plugin_folders('wf_'.$post_type.'_folders', $slug);
518
519 if (is_array($wicked_folders)) {
520 $folders = array_merge($folders, $wicked_folders);
521 }
522 }
523 } else {
524 $folders = $this->get_plugin_folders($taxonomy, $slug);
525 }
526
527 if (in_array($taxonomy, ['filebird', 'rml'])) {
528 $folders = is_array($folders) && count($folders) ? $this->map_plugin_folders($taxonomy, $folders) : [];
529 }
530
531 $this->plugins[$slug]['folders'] = $folders;
532
533 $attachments = is_array($folders) && count($folders) ? $this->get_plugin_attachments($taxonomy, $folders) : [];
534
535 if (in_array($taxonomy, ['filebird', 'rml'])) {
536 $attachments = $this->map_plugin_attachments($taxonomy, $attachments);
537 }
538
539 $this->plugins[$slug]['attachments'] = $attachments;
540 }//end foreach
541
542 foreach ($this->plugins as $key => $plugin) {
543 $folders = isset($plugin['folders'])&&is_array($plugin['folders']) ? $plugin['folders'] : [];
544 $this->plugins[$key]['total_folders'] = count($folders);
545
546 $attachments = isset($plugin['attachments'])&&is_array($plugin['attachments']) ? $plugin['attachments'] : [];
547 $this->plugins[$key]['total_attachments'] = count($attachments);
548
549 if (count($folders) > 0 || count($attachments) > 0) {
550 $this->plugins[$key]['is_exists'] = 1;
551 $this->is_exists = 1;
552 }
553 }
554
555 }//end get_other_plugins_data()
556
557
558 /**
559 * Get Folders Data From Imported Plugins
560 *
561 * @since 1.0.0
562 * @access public
563 * @return $taxonomy
564 */
565 public function get_plugin_folders($taxonomy, $slug)
566 {
567 global $wpdb;
568
569 // FileBird has its own db table
570 if ($taxonomy === 'filebird') {
571 $filebird_folders_table = $wpdb->prefix.'fbv';
572
573 // Get FileBird folders (order by 'parent' to create parent categories first)
574 if ($wpdb->get_var("SHOW TABLES LIKE '$filebird_folders_table'") == $filebird_folders_table) {
575 return $wpdb->get_results("SELECT * FROM $filebird_folders_table ORDER BY parent ASC");
576 }
577 }
578
579 // Real Media Library has its own db table
580 else if ($taxonomy === 'rml') {
581 $rml_folders_table = $wpdb->prefix.'realmedialibrary';
582
583 // Get FileBird folders (order by 'parent' to create parent categories first)
584 if ($wpdb->get_var("SHOW TABLES LIKE '$rml_folders_table'") == $rml_folders_table) {
585 return $wpdb->get_results("SELECT * FROM $rml_folders_table ORDER BY parent ASC");
586 }
587 }
588
589 // Default: Plugins with custom taxonomy terms
590 else {
591 $query = "SELECT * FROM ".$wpdb->term_taxonomy."
592 LEFT JOIN ".$wpdb->terms."
593 ON ".$wpdb->term_taxonomy.".term_id = ".$wpdb->terms.".term_id
594 WHERE ".$wpdb->term_taxonomy.".taxonomy = '%d'
595 ORDER BY parent ASC";
596 $query = $wpdb->prepare($query, $taxonomy);
597 $folders = $wpdb->get_results($query);
598
599 // WP Media Folder (JoomUnited): Remove root folder
600 if ($slug === 'wp-media-folder') {
601 foreach ($folders as $index => $folder) {
602 if ($folder->slug === 'wp-media-folder-root') {
603 unset($folders[$index]);
604 }
605 }
606 }
607
608 return array_values($folders);
609 }
610
611 }//end get_plugin_folders()
612
613
614 /**
615 * Get Folders Data From Imported Plugins
616 *
617 * @since 1.0.0
618 * @access public
619 * @return $taxonomy
620 */
621 public function map_plugin_folders($taxonomy, $folders)
622 {
623 $mapped_folders = [];
624
625 foreach ($folders as $folder) {
626 // FileBird, Real Media Library
627 if ($taxonomy === 'filebird' || $taxonomy === 'rml') {
628 $folderObj = new \stdClass();
629
630 $folderObj->name = $folder->name;
631 $folderObj->id = intval($folder->id);
632 $folderObj->parent = intval($folder->parent);
633 $folderObj->position = intval($folder->ord);
634
635 $mapped_folders[] = $folderObj;
636 }
637 }
638
639 return $mapped_folders;
640
641 }//end map_plugin_folders()
642
643
644 /**
645 * Save Folders and it's attachment Data From Imported Plugins
646 *
647 * @since 1.0.0
648 * @access public
649 * @return $files
650 */
651 public function map_plugin_attachments($taxonomy, $attachments)
652 {
653 $mapped_attachments = [];
654
655 foreach ($attachments as $folder) {
656 // FileBird
657 if ($taxonomy === 'filebird') {
658 $folderObj = new \stdClass();
659
660 $folderObj->folder_id = intval($folder->folder_id);
661 $folderObj->attachment_id = intval($folder->attachment_id);
662
663 $mapped_attachments[] = $folderObj;
664 }
665
666 // Real Media Library
667 if ($taxonomy === 'rml') {
668 $folderObj = new \stdClass();
669
670 $folderObj->folder_id = intval($folder->fid);
671 $folderObj->attachment_id = intval($folder->attachment);
672
673 $mapped_attachments[] = $folderObj;
674 }
675 }//end foreach
676
677 return $mapped_attachments;
678
679 }//end map_plugin_attachments()
680
681
682 /**
683 * Get Folders and it's attachment Data From Imported Plugins
684 *
685 * @since 1.0.0
686 * @access public
687 * @return $files
688 */
689 public function get_plugin_attachments($taxonomy, $folders)
690 {
691 global $wpdb;
692
693 // FileBird has its own db table
694 if ($taxonomy === 'filebird') {
695 $filebirdTable = $wpdb->prefix.'fbv_attachment_folder';
696
697 // Get FileBird attachments
698 if ($wpdb->get_var("SHOW TABLES LIKE '{$filebirdTable}'") == $filebirdTable) {
699 return $wpdb->get_results("SELECT * FROM {$filebirdTable} ORDER BY folder_id ASC");
700 }
701 }
702
703 // Real Media Library has its own db table
704 else if ($taxonomy === 'rml') {
705 $rmlTable = $wpdb->prefix.'realmedialibrary_posts';
706
707 // Get Data from Real Media Library DB Table
708 if ($wpdb->get_var("SHOW TABLES LIKE '{$rmlTable}'") == $rmlTable) {
709 return $wpdb->get_results("SELECT * FROM {$rmlTable} ORDER BY fid ASC");
710 }
711 }
712
713 // Default: Plugins with custom taxonomy terms
714 else {
715 return $wpdb->get_results(
716 "SELECT TR.object_id,
717 TR.term_taxonomy_id
718 FROM ".$wpdb->term_relationships." AS TR
719 WHERE TR.term_taxonomy_id IN (".implode(',', array_column($folders, 'term_taxonomy_id')).")"
720 );
721 }
722
723 }//end get_plugin_attachments()
724
725
726 }//end class
727
728 $WCP_Folder_Plugins = new WCP_Folder_Plugins();
729