[ Index ]

MailPress 7.1

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

title

Body

[close]

/mp-includes/class/options/tracking/metaboxes/user/ -> u002all.php (source)

   1  <?php
   2  class MP_Tracking_metabox_u002all extends MP_tracking_metabox_
   3  {
   4      var $id    = 'u002all';
   5      var $context= 'side';
   6      var $file     = __FILE__;
   7  
   8  	function __construct( $title )
   9      {
  10          add_filter( 'MailPress_scripts', array( $this, 'scripts' ), 8, 2 );
  11          add_filter( 'MailPress_styles',  array( $this, 'styles' ),  8, 2 );
  12          parent::__construct( $title );
  13      }
  14  
  15  	function styles( $styles ) 
  16      {
  17          $styles[] = 'thickbox';
  18          return $styles;
  19      }
  20  
  21  	function scripts( $scripts )
  22      {
  23          wp_register_script( 'mp-thickbox',         '/' . MP_PATH . 'mp-includes/js/mp_thickbox.js', array( 'thickbox' ), false, 1 );
  24          $scripts[] = 'mp-thickbox';
  25          return $scripts;
  26      }
  27  
  28  	function meta_box( $mp_user )
  29      {
  30          global $wpdb;
  31          $x = new MP_Mail();
  32  
  33          $tracks = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->mp_usermeta WHERE mp_user_id = %d AND meta_key = %s ORDER BY meta_id DESC;", $mp_user->id, '_MailPress_mail_sent' ) );
  34          if ( $tracks )
  35          {
  36              $out = '<div class="mp_scroll"><table>';
  37              foreach( $tracks as $track )
  38              {
  39                  $mail = $wpdb->get_results( $wpdb->prepare( "SELECT subject, created, sent FROM $wpdb->mp_mails WHERE id = %d ;", $track->meta_value ) );
  40                  foreach( $mail as $mail ) 
  41                  {
  42                      $subject = $mail->subject;
  43                      $date = ( '0000-00-00 00:00:00' == $mail->sent ) ? $mail->created : $mail->sent;
  44                  }
  45  
  46                  if ( isset( $subject ) )
  47                  {
  48                      $subject     = $x->viewsubject( $subject, $track->meta_value, $track->meta_value, $mp_user->id );
  49                                          
  50                      $args = array( 'id' => $track->meta_value, 'mp_user_id' => $mp_user->id, 'key' => $mp_user->confkey , 'action' => 'mp_ajax', 'mp_action' => 'iview', 'TB_iframe' => 'true' );
  51                      $view_url = esc_url( add_query_arg( $args, admin_url( 'admin-ajax.php' ) ) );    
  52  
  53                      $track->meta_value = '<a href="' . $view_url . '" class="thickbox thickbox-preview" title="' . esc_attr( sprintf( __( 'View &#8220;%1$s&#8221;', 'MailPress' ) , $subject ) ) . '">' . $track->meta_value . '</a>';
  54                  }
  55                  else
  56                  {
  57                      $date = '';
  58                      $subject = __( '(deleted)', 'MailPress' );
  59                  }
  60                  $out .= '<tr><td><abbr title="' . $date . '">' . substr( $date, 0, 10 ) . '</abbr></td><td class="tracking_tac">' . $track->meta_value . '</td><td>' . ( ( strlen( $subject ) > 45 ) ? substr( $subject, 0, 45 ) . '...' : $subject ) . '</td></tr>';
  61              }
  62              $out .= '</table></div>'; 
  63  
  64              echo $out;
  65          }
  66      }
  67  }
  68  new MP_Tracking_metabox_u002all( __( 'All mails',  'MailPress' ) );


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