[ Index ]

MailPress 7.0.1

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

title

Body

[close]

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

   1  <?php
   2  if ( class_exists( 'MailPress' ) && !class_exists( 'MailPress_import' ) && ( is_admin() ) )
   3  {
   4  /*
   5  Plugin Name: MailPress_import
   6  Plugin URI: http://blog.mailpress.org/tutorials/add-ons/import/
   7  Description: Users : Import/Export mp users from/into files
   8  Version: 7.0
   9  */
  10  
  11  // 3.
  12  
  13  /** for admin plugin pages */
  14  define ( 'MailPress_page_import', 'mailpress_import' );
  15  
  16  /** for admin plugin urls */
  17  $mp_file = 'admin.php';
  18  define ( 'MailPress_import',    add_query_arg( 'page', MailPress_page_import,     $mp_file ) );
  19  
  20  class MailPress_import
  21  {
  22      const log_name = 'import';
  23  
  24  	function __construct()
  25      {
  26  // for wp admin
  27          if ( is_admin() )
  28          {
  29          // for install
  30              register_activation_hook( plugin_basename( __FILE__ ),     array( __CLASS__, 'install' ) );
  31          // for link on plugin page
  32              add_filter( 'plugin_action_links',         array( __CLASS__, 'plugin_action_links' ), 10, 2 );
  33          // for role & capabilities
  34              add_filter( 'MailPress_capabilities',     array( __CLASS__, 'capabilities' ), 1, 1 );
  35          // for settings
  36              add_action( 'MailPress_settings_logs_form',     array( __CLASS__, 'settings_logs_form' ), 40, 1 );
  37  
  38          // for load admin page
  39              add_filter( 'MailPress_load_admin_page',     array( __CLASS__, 'load_admin_page' ), 10, 1 );
  40          }
  41      }
  42  
  43  ////  ADMIN  ////
  44  ////  ADMIN  ////
  45  ////  ADMIN  ////
  46  ////  ADMIN  ////
  47  
  48  // install
  49  	public static function install() 
  50      {
  51          MP_Log::set_option( self::log_name );
  52      }
  53  
  54  // for link on plugin page
  55  	public static function plugin_action_links( $links, $file )
  56      {
  57          return MailPress::plugin_links( $links, $file, plugin_basename( __FILE__ ), 'logs' );
  58      }
  59  
  60  // for role & capabilities
  61  	public static function capabilities( $capabilities ) 
  62      {
  63          $capabilities['MailPress_import'] = array(     'name'  => __( 'Import', 'MailPress' ), 
  64                                  'group' => 'admin', 
  65                                  'menu'  => 65, 
  66                                  'parent'        => false, 
  67                                  'page_title'    => __( 'MailPress Import/Export', 'MailPress' ), 
  68                                  'menu_title'       => '&#160;' . __( 'Import/Export', 'MailPress' ), 
  69                                  'page'          => MailPress_page_import, 
  70                                  'func'          => array( 'MP_AdminPage', 'body' )
  71                               );
  72          return $capabilities;
  73      }
  74  
  75  // for settings
  76  	public static function settings_logs_form( $logs )
  77      {
  78          MP_AdminPage::logs_sub_form( self::log_name, $logs, __( 'Import/Export', 'MailPress' ) );
  79      }
  80  
  81  // for load admin page
  82  	public static function load_admin_page( $hub )
  83      {
  84          $hub[MailPress_page_import] = 'import';
  85          return $hub;
  86      }
  87  }
  88  new MailPress_import();
  89  }


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