[ Index ]

MailPress 7.1

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/class/options/privacy/exporters/ -> mailinglist.php (source)

   1  <?php /* mailinglist */
   2  if ( class_exists( 'MailPress' ) && class_exists( 'MailPress_mailinglist' ) )
   3  {
   4  class MP_WP_Privacy_exporter_mailinglist extends MP_WP_Privacy_exporter_
   5  {
   6      const per_page = 100;
   7  
   8      var $priority = 42;
   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          $mailinglists = array_slice( $items, $start, self::per_page, true );
  24  
  25          $total = count( $items );
  26          $current = $start + count( $mailinglists );
  27  
  28          /*  */
  29  
  30          $properties = array(
  31              'id' => __( 'Mailinglist Id', 'MailPress' ),
  32              'name' => __( 'Mailinglist Name', 'MailPress' ),
  33          );
  34  
  35          foreach ( (array) $mailinglists as $i => $n )
  36          {
  37              $data = array();
  38  
  39              foreach ( $properties as $key => $name )
  40              {
  41                  $value = '';
  42  
  43                  switch ( $key )
  44                  {
  45                      case 'id':
  46                          $value = $i;
  47                      break;
  48                      case 'name':
  49                          $value = $n;
  50                      break;
  51                  };
  52  
  53  //                if ( empty( $value ) ) continue;
  54  
  55                  $data[] = array( 'name' => $name, 'value' => $value, );
  56              }
  57  
  58              $this->export['data'][] = array(
  59                  'group_id'    => 'mp_mailinglists',
  60                  'group_label' => _n( 'Subscriber > Mailinglist', 'Subscriber > Mailinglists', $total, 'MailPress' ),
  61                  'item_id'     => "mp_user-{$mp_user->id}-{$i}",
  62                  'data'        => $data,
  63              );
  64          }
  65  
  66          $this->export['done'] = ( $total == $current );
  67  
  68          return $this->export;
  69      }
  70  
  71  	function get_items()
  72      {
  73          return MailPress_mailinglist::get_subscriptions( $this->mp_user_id );
  74      }
  75  }
  76  new MP_WP_Privacy_exporter_mailinglist( __( 'MailPress mailinglists', 'MailPress' ) );
  77  }


Generated: Mon Mar 11 18:33:33 2019 Cross-referenced by PHPXref 0.7.1