[ Index ]

MailPress 7.1

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

title

Body

[close]

/mp-includes/class/options/tracking/metaboxes/mail/ -> m008ml.php (source)

   1  <?php
   2  if ( class_exists( 'MailPress_mailinglist' ) ) {
   3  class MP_Tracking_metabox_m008ml extends MP_tracking_metabox_
   4  {
   5      var $id    = 'm008ml';
   6      var $context= 'normal';
   7      var $file     = __FILE__;
   8  
   9  	function meta_box( $mail )
  10      {
  11          global $wpdb;
  12          $tracks = $wpdb->get_results( $wpdb->prepare( "SELECT track, count( * ) as count FROM $wpdb->mp_tracks WHERE mail_id = %d GROUP BY 1 ORDER BY 2 DESC, 1 DESC;", $mail->id ) );
  13          if ( $tracks )
  14          {
  15              foreach( $tracks as $track )
  16              {
  17                  $users = $wpdb->get_results( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS DISTINCT user_id FROM $wpdb->mp_tracks WHERE mail_id = %d AND track = %s;", $mail->id, $track->track ) );
  18                  $total = $wpdb->get_var( "SELECT FOUND_ROWS()" );
  19  
  20                  $url = esc_url( add_query_arg( array_map ( 'urlencode', array( 'action' => 'create_tracking_mailinglist', 'mail_id' => $mail->id, 'track' => $track->track ) ), MailPress_users ) );
  21                  $title = sprintf( _n( __( 'create mailinglist with %s user', 'MailPress' ), __( 'create mailinglist with %s users', 'MailPress' ), $total ), $total );
  22              //    echo "( {$track->count} ) " . MailPress_tracking::translate_track( $track->track, $mail->id, 50 ) . '<span style="float:right"><a class="post-com-count" href="' . $url . '" title="' . esc_attr( $title ) . '"><span class="comment-count" style="font-size:12px;">' . $total . '</span></a></span><br /><br />';
  23  
  24                  $lib_url = ( current_user_can( 'MailPress_manage_mailinglists' ) ) ? '<a href="' . $url . '">' . __( 'Create corresponding mailing list', 'MailPress' ) . '</a><br /><br />' : '';
  25                  $lib_url = ( current_user_can( 'MailPress_manage_mailinglists' ) ) ? '<a href="' . $url . '" target="_blank"><span class="mp_icon mp_icon_mailinglist" title="' . esc_attr( __( 'Create corresponding mailing list', 'MailPress' ) ) . '"></span></a><br /><br />' : '';
  26  
  27                  switch( $track->track )
  28                  {
  29                      case MailPress_tracking_openedmail :
  30                          if ( $track->count < 2 )
  31                              if ( $total < 2 )     $lib = __( '%1$s mail opened by %2$s recipient %3$s', 'MailPress' );
  32                              else                 $lib = __( '%1$s mail opened by %2$s recipients %3$s', 'MailPress' );
  33                          else
  34                              if ( $total < 2 )     $lib = __( '%1$s mails opened by %2$s recipient %3$s', 'MailPress' );
  35                              else                 $lib = __( '%1$s mails opened by %2$s recipients %3$s', 'MailPress' );
  36                      break;
  37                      case '!!unsubscribed!!' :
  38                          if ( $track->count < 2 )
  39                              if ( $total < 2 )     $lib = __( '%2$s recipient <b>unsubscribed</b> (%1$s event) %3$s', 'MailPress' );
  40                              else                 $lib = __( '%2$s recipient <b>unsubscribed</b> (%1$s events) %3$s', 'MailPress' );
  41                          else
  42                              if ( $total < 2 )     $lib = __( '%2$s recipients <b>unsubscribed</b> (%1$s event) %3$s', 'MailPress' );
  43                              else                 $lib = __( '%2$s recipients <b>unsubscribed</b> (%1$s events) %3$s', 'MailPress' );
  44                      break;
  45                      default:
  46                          if ( $track->count < 2 )
  47                              if ( $total < 2 )     $lib = __( '%1$s click on link %4$s by %2$s recipient %3$s', 'MailPress' );
  48                              else                 $lib = __( '%1$s click on link %4$s by %2$s recipients %3$s', 'MailPress' );
  49                          else
  50                              if ( $total < 2 )     $lib = __( '%1$s clicks on link %4$s by %2$s recipient %3$s', 'MailPress' );
  51                              else                 $lib = __( '%1$s clicks on link %4$s by %2$s recipients %3$s', 'MailPress' );
  52                          break;
  53                  }
  54  
  55                  printf( $lib, $track->count, $total, $lib_url, MailPress_tracking::translate_track( $track->track, $mail->id, 50 ) );
  56              }
  57          }
  58      }
  59  }
  60  new MP_Tracking_metabox_m008ml( __( 'Most clicked/mailinglists', 'MailPress' ) );
  61  }


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