[ Index ] |
MailPress 7.2 |
[ Index ] [ Classes ] [ Functions ] [ Variables ] [ Constants ] [ Statistics ] |
[Summary view] [Print] [Text view]
1 <?php /* comment */ 2 if ( class_exists( 'MailPress' ) && class_exists( 'MailPress_comment' ) ) 3 { 4 class MP_WP_Privacy_exporter_comment extends MP_WP_privacy_exporter_ 5 { 6 const per_page = 100; 7 8 var $priority = 41; 9 10 function exporter( $email, $page = 1 ) 11 { 12 $mp_user = $this->get_user( $email ); 13 if ( !$mp_user ) return $this->export; 14 15 /* */ 16 17 $start = ( $page - 1 ) * self::per_page; 18 19 $items = $this->get_items(); 20 21 if ( !$items ) return $this->export; 22 23 $comments = array_slice( $items, $start, self::per_page, true ); 24 25 $total = count( $items ); 26 $current = $start + count( $comments ); 27 28 /* */ 29 30 $properties = array( 31 'post_id' => __( 'Post id', 'MailPress' ), 32 'post_title' => __( 'Post Title', 'MailPress' ), 33 ); 34 35 foreach ( (array) $comments as $comment ) 36 { 37 $data = array(); 38 39 foreach ( $properties as $key => $name ) 40 { 41 $value = ''; 42 43 switch ( $key ) 44 { 45 case 'post_id': 46 case 'post_title': 47 $value = $comment->{$key}; 48 break; 49 }; 50 51 if ( empty( $value ) ) continue; 52 53 $data[] = array( 'name' => $name, 'value' => $value, ); 54 } 55 56 $this->export['data'][] = array( 57 'group_id' => 'mp_comments', 58 'group_label' => _n( 'Subscriber > Comment', 'Subscriber > Comments', $total, 'MailPress' ), 59 'group_description' => _n( 'Subscriber’s comment subscription.', 'Subscriber’s comment subscriptions.', $total, 'MailPress' ), 60 'item_id' => "mp_user-{$mp_user->id}-{$comment->post_id}", 61 'data' => $data, 62 ); 63 } 64 65 $this->export['done'] = ( $total == $current ); 66 67 return $this->export; 68 } 69 70 function get_items() 71 { 72 return MailPress_comment::get_subscriptions( $this->mp_user_id ); 73 } 74 } 75 new MP_WP_Privacy_exporter_comment( __( 'MailPress comments', 'MailPress' ) ); 76 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue May 19 15:55:14 2020 | Cross-referenced by PHPXref 0.7.1 |