[ Index ]

MailPress 7.1

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

title

Body

[close]

/mp-content/add-ons/ -> MailPress_view_logs.php (source)

   1  <?php
   2  if ( ( class_exists( 'MailPress' ) ) && !class_exists( 'MailPress_view_logs' ) && ( is_admin() ) )
   3  {
   4  /*
   5  Plugin Name: MailPress_view_logs
   6  Plugin URI: http://blog.mailpress.org/tutorials/add-ons/view_logs/
   7  Description: Logs ( view logs stored in upload folder generated by MailPress in your browser )
   8  Version: 7.1
   9  */
  10  
  11  // 3.
  12  
  13  /** for admin plugin pages */
  14  define ( 'MailPress_page_view_logs',     'mailpress_viewlogs' );
  15  define ( 'MailPress_page_view_log',         MailPress_page_view_logs . '&file=view_log' );
  16  
  17  /** for admin plugin urls */
  18  $mp_file = 'admin.php';
  19  define ( 'MailPress_view_logs',        add_query_arg( 'page', MailPress_page_view_logs,     $mp_file ) );
  20  define ( 'MailPress_view_log',        add_query_arg( 'page', MailPress_page_view_log,     $mp_file ) );
  21  
  22  class MailPress_view_logs
  23  {
  24  	function __construct()
  25      {
  26      // for role & capabilities
  27          add_filter( 'MailPress_capabilities',          array( __CLASS__, 'capabilities' ), 1, 1 );
  28      // for load admin page
  29          add_filter( 'MailPress_load_admin_page',         array( __CLASS__, 'load_admin_page' ), 10, 1 );
  30      // for autorefresh
  31          add_filter( 'MailPress_autorefresh_files_js',    array( __CLASS__, 'autorefresh_js' ), 8, 1 );
  32   
  33      // for wp admin
  34          if ( is_admin() )
  35          {
  36          // for link on plugin page
  37              add_filter( 'plugin_action_links',             array( __CLASS__, 'plugin_action_links' ), 10, 2 );
  38          }
  39      }
  40  
  41  ////  Admin  ////
  42  
  43  // for role & capabilities
  44  	public static function capabilities( $capabilities )
  45      {
  46          $capabilities['MailPress_view_logs'] = array(     'name'    => __( 'Logs', 'MailPress' ),
  47                                          'group'    => 'admin',
  48                                          'menu'    => 99,
  49  
  50                                          'parent'    => false,
  51                                          'page_title'=> __( 'MailPress Logs', 'MailPress' ),
  52                                          'menu_title'=> __( 'Logs', 'MailPress' ),
  53                                          'page'    => MailPress_page_view_logs,
  54                                          'func'    => array( 'MP_AdminPage', 'body' )
  55                                       );
  56          return $capabilities;
  57      }
  58  
  59  // for load admin page
  60  	public static function load_admin_page( $hub )
  61      {
  62          $hub[MailPress_page_view_logs] = 'view_logs';
  63          $hub[MailPress_page_view_log]  = 'view_log';
  64          return $hub;
  65      }
  66  
  67  // for autorefresh
  68  	public static function autorefresh_js( $scripts )
  69      {
  70          return MP_WP_AutoRefresh_js::getInstance( $scripts, true );
  71      }
  72  
  73  // for link on plugin page
  74  	public static function plugin_action_links( $links, $file )
  75      {
  76          return MailPress::plugin_links( $links, $file, plugin_basename( __FILE__ ), 'logs' );
  77      }
  78  }
  79  new MailPress_view_logs();
  80  }


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