attachments.php
6 years ago
blocks.php
1 month ago
common.php
4 months ago
maxmegamenu.php
1 month ago
meow_gallery.php
3 months ago
metaslider.php
1 month ago
my-calendar.php
1 month ago
woocommerce.php
1 month ago
wpseo.php
3 years ago
my-calendar.php
49 lines
| 1 | <?php |
| 2 | |
| 3 | // My Calendar (https://wordpress.org/plugins/my-calendar/) |
| 4 | // Added by Mike Meinz |
| 5 | // |
| 6 | |
| 7 | add_action( 'wpmc_scan_widgets', 'wpmc_scan_widgets_mycalendar' ); |
| 8 | |
| 9 | function wpmc_scan_widgets_mycalendar() { |
| 10 | global $wpmc; |
| 11 | global $wpdb; |
| 12 | $table = $wpdb->prefix . 'my_calendar'; |
| 13 | $wpmc->run_paged_parser( 'my-calendar-events', function( $cursor, $limit ) use ( $wpdb, $table ) { |
| 14 | return $wpdb->get_results( $wpdb->prepare( "SELECT event_id, event_desc, event_short, event_link, event_url, event_image FROM {$table} WHERE |
| 15 | (LOWER(event_desc) like '%%http%%' or |
| 16 | LOWER(event_short) like '%%http%%' or |
| 17 | LOWER(event_link) like 'http%%' or |
| 18 | LOWER(event_image) like 'http%%' or |
| 19 | LOWER(event_url) like 'http%%') AND event_id > %d ORDER BY event_id ASC LIMIT %d", $cursor, $limit ) ); |
| 20 | }, function( $rows ) use ( $wpmc ) { |
| 21 | $eventurls = array(); |
| 22 | foreach ( $rows as $row ) { |
| 23 | if ( !empty($row->event_desc) ) { |
| 24 | $urls = $wpmc->get_urls_from_html( $row->event_desc ); |
| 25 | $eventurls = array_merge( $eventurls, $urls); |
| 26 | } |
| 27 | if ( !empty($row->event_short) ) { |
| 28 | $urls = $wpmc->get_urls_from_html( $row->event_short ); |
| 29 | $eventurls = array_merge( $eventurls, $urls); |
| 30 | } |
| 31 | if ( !empty($row->event_link) ) { |
| 32 | array_push( $eventurls, $wpmc->clean_url( $row->event_link ) ); |
| 33 | } |
| 34 | if ( !empty($row->event_url) ) { |
| 35 | array_push( $eventurls, $wpmc->clean_url( $row->event_url ) ); |
| 36 | } |
| 37 | if ( !empty($row->event_image) ) { |
| 38 | array_push( $eventurls, $wpmc->clean_url( $row->event_image ) ); |
| 39 | } |
| 40 | } |
| 41 | if ( !empty( $eventurls ) ) $wpmc->add_reference_url( $eventurls, 'CALENDAR (URL)' ); |
| 42 | }, 100, function( $rows, $cursor ) { |
| 43 | $last = end( $rows ); |
| 44 | return $last ? (int) $last->event_id : $cursor; |
| 45 | } ); |
| 46 | } |
| 47 | |
| 48 | ?> |
| 49 |