[ Index ]

MailPress 544

[ 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) foreach($tracks as $track)
  14          {
  15              $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 ) );
  16              $total = $wpdb->get_var( "SELECT FOUND_ROWS()" );
  17  
  18              $url = esc_url(add_query_arg(array_map ( 'urlencode', array('action' => 'create_tracking_mailinglist', 'mail_id' => $mail->id, 'track' => $track->track)), MailPress_users));
  19              $title = sprintf(_n( __('create mailinglist with %s user', MP_TXTDOM), __('create mailinglist with %s users', MP_TXTDOM), $total ), $total );
  20          //    echo "({$track->count}) " . MailPress_tracking::translate_track($track->track, $mail->id, 50) . "<span style='float:right'><a class='post-com-count' href='{$url}' title='{$title}'><span class='comment-count' style='font-size:12px;'>" . $total . "</span></a></span><br /><br />";
  21  
  22              $lib_url = (current_user_can('MailPress_manage_mailinglists')) ? "<a href='{$url}'>" . __('Create corresponding mailing list', MP_TXTDOM) . "</a><br /><br />" : '';
  23  
  24              switch($track->track)
  25              {
  26                  case MailPress_tracking_openedmail :
  27                      if ($track->count < 2)
  28                          if ( $total < 2)     $lib = __('%1$s mail opened by %2$s recipient %3$s', MP_TXTDOM);
  29                          else                 $lib = __('%1$s mail opened by %2$s recipients %3$s', MP_TXTDOM);
  30                      else
  31                          if ( $total < 2)     $lib = __('%1$s mails opened by %2$s recipient %3$s', MP_TXTDOM);
  32                          else                 $lib = __('%1$s mails opened by %2$s recipients %3$s', MP_TXTDOM);
  33                  break;
  34                  case '!!unsubscribed!!' :
  35                      if ($track->count < 2)
  36                          if ( $total < 2)     $lib = __('%2$s recipient <b>unsubscribed</b> (%1$s event) %3$s', MP_TXTDOM);
  37                          else                 $lib = __('%2$s recipient <b>unsubscribed</b> (%1$s events) %3$s', MP_TXTDOM);
  38                      else
  39                          if ( $total < 2)     $lib = __('%2$s recipients <b>unsubscribed</b> (%1$s event) %3$s', MP_TXTDOM);
  40                          else                 $lib = __('%2$s recipients <b>unsubscribed</b> (%1$s events) %3$s', MP_TXTDOM);
  41                  break;
  42                  default:
  43                      if ($track->count < 2)
  44                          if ( $total < 2)     $lib = __('%1$s click on link %4$s by %2$s recipient %3$s', MP_TXTDOM);
  45                          else                 $lib = __('%1$s click on link %4$s by %2$s recipients %3$s', MP_TXTDOM);
  46                      else
  47                          if ( $total < 2)     $lib = __('%1$s clicks on link %4$s by %2$s recipient %3$s', MP_TXTDOM);
  48                          else                 $lib = __('%1$s clicks on link %4$s by %2$s recipients %3$s', MP_TXTDOM);
  49                      break;
  50              }
  51  
  52              printf($lib, $track->count, $total, $lib_url, MailPress_tracking::translate_track($track->track, $mail->id, 50));
  53          }
  54      }
  55  }
  56  new MP_Tracking_metabox_m008ml(__('Most clicked/mailinglists', MP_TXTDOM));
  57  }


Generated: Thu Apr 28 18:38:52 2016 Cross-referenced by PHPXref 0.7.1