PluginProbe
Media Cleaner: Clean your WordPress! / 7.2.7
Media Cleaner: Clean your WordPress! v7.2.7
7.2.7 7.2.6 7.2.5 7.2.4 7.2.3 7.2.2 7.2.1 7.2.0 7.1.1 7.1.0 7.0.9 7.0.8 trunk 3.6.8 3.6.9 3.7.0 3.8.0 3.9.0 4.0.0 4.0.2 4.0.4 4.0.6 4.0.7 4.1.0 4.2.0 All 171 releases
media-cleaner / classes / parsers / metaslider.php
metaslider.php
27 lines 860 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 add_action( 'wpmc_scan_widgets', 'wpmc_scan_widgets_metaslider' );
4
5 function wpmc_scan_widgets_metaslider() {
6 global $wpdb;
7 global $wpmc;
8 $wpmc->run_paged_parser( 'metaslider-images', function( $cursor, $limit ) use ( $wpdb ) {
9 return $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT object_id
10 FROM {$wpdb->term_relationships}
11 WHERE object_id > 0
12 AND object_id > %d
13 AND term_taxonomy_id
14 IN (SELECT term_taxonomy_id FROM {$wpdb->term_taxonomy} WHERE taxonomy = 'ml-slider')
15 ORDER BY object_id ASC LIMIT %d", $cursor, $limit ) );
16 }, function( $rows ) use ( $wpmc ) {
17 $imageIds = wp_list_pluck( $rows, 'object_id' );
18 if ( !empty( $imageIds ) ) {
19 $wpmc->add_reference_id( $imageIds, 'SLIDER (ID)' );
20 }
21 }, 250, function( $rows, $cursor ) {
22 $last = end( $rows );
23 return $last ? (int) $last->object_id : $cursor;
24 } );
25 }
26 ?>
27