[ Index ]

MailPress 7.0.1

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

title

Body

[close]

/mp-includes/class/options/dashboard/widgets/ -> mails_activity.php (source)

   1  <?php
   2  class MP_Dashboard_mails_activity extends MP_WP_Dashboard_widget_
   3  {
   4      var $id = 'mp_mails_activity';
   5  
   6  	function widget()
   7      {
   8          global $wpdb, $wp_locale;
   9  
  10          $advanced_path = 'advanced/' . get_current_blog_id() . '/dashboard';
  11  
  12          ob_start();
  13              include( MP_UPL_ABSPATH . $advanced_path . '/mails_activity.xml' );
  14              $xml = trim( ob_get_contents() );
  15          ob_end_clean();
  16          $xml = '<?xml version="1.0" ?>' . $xml;
  17          $xml = simplexml_load_string( $xml, 'SimpleXMLElement', LIBXML_NOCDATA );
  18  
  19          $MASS = array();
  20          foreach ( $xml->group as $group )
  21          {
  22              $a = array();
  23              foreach( $group->templates->children() as $templates ) $a[] = ( string ) $templates;
  24              $MASS[( string ) $group->desc] = $a;
  25          }
  26  
  27          $chd_m = $chl_m = array();
  28          $out = '';
  29          foreach ( $MASS as $k => $MAS )
  30          {
  31              $in   = join( "','",$MAS );
  32              $out .= ( empty( $out ) ) ? $in : "','" . $in;
  33              $x  = $wpdb->get_var( "SELECT sum( scount ) FROM $wpdb->mp_stats WHERE stype = 't' AND slib IN ( '$in' ) ;" );
  34              if ( $x ) 
  35              {
  36                  $chd_m[] = $x;
  37                  $chl_m[] = $k;
  38              }
  39          }    
  40          $x  = $wpdb->get_var( "SELECT sum( scount ) FROM $wpdb->mp_stats WHERE stype = 't' AND slib NOT IN ( '$out' ) ;" );
  41          if ( $x ) 
  42          {
  43              $chd_m[] = $x;
  44              $chl_m[] = __( 'Misc.', 'MailPress' );
  45          }
  46  
  47          if ( empty( $chd_m ) ) return;
  48  
  49          $args = array();
  50          $args['cht']  = 'p3';
  51          $args['chs']  = $this->widget_size( '475x215' );
  52          $args['chl']  = join( '|', $chl_m );
  53          $args['chco'] = '0000ff';
  54  
  55          $sum = array_sum( $chd_m );
  56          foreach( $chd_m as $k => $v ) $chd_m[$k] = round( 100 * $v/$sum );
  57  
  58          $args['chd']  = 't:' . join( ',', $chd_m );
  59          $url = esc_url( add_query_arg( $args, $this->url ) );
  60  
  61          echo '<div style="text-align:center;"><img style="width:100%;" src="' . $url . '" alt="' . __( 'Mails - Activity', 'MailPress' ) . '" /></div>' . "\r\n";
  62      }
  63  }
  64  new MP_Dashboard_mails_activity( __( 'MailPress - Mails activity', 'MailPress' ) );


Generated: Mon Jan 28 00:07:10 2019 Cross-referenced by PHPXref 0.7.1