[ Index ]

MailPress 544

[ 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: 5.4.4
   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', $mp_file . '?page=' . MailPress_page_import);
  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',     array(__CLASS__, 'settings_logs'), 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          $logs = get_option(MailPress::option_name_logs);
  52          if (!isset($logs[self::log_name]))
  53          {
  54              $logs[self::log_name] = MailPress::$default_option_logs;
  55              update_option(MailPress::option_name_logs, $logs );
  56          }
  57      }
  58  
  59  // for link on plugin page
  60  	public static function plugin_action_links($links, $file)
  61      {
  62          return MailPress::plugin_links($links, $file, plugin_basename(__FILE__), 'logs');
  63      }
  64  
  65  // for role & capabilities
  66  	public static function capabilities($capabilities) 
  67      {
  68          $capabilities['MailPress_import'] = array(    'name'  => __('Import', MP_TXTDOM), 
  69                                  'group' => 'admin', 
  70                                  'menu'  => 65, 
  71                                  'parent'        => false, 
  72                                  'page_title'    => __('MailPress Import/Export', MP_TXTDOM), 
  73                                  'menu_title'       => '&#160;' . __('Import/Export', MP_TXTDOM), 
  74                                  'page'          => MailPress_page_import, 
  75                                  'func'          => array('MP_AdminPage', 'body')
  76                              );
  77          return $capabilities;
  78      }
  79  
  80  // for settings
  81  	public static function settings_logs($logs)
  82      {
  83          MP_AdminPage::logs_sub_form(self::log_name, $logs, __('Import/Export', MP_TXTDOM));
  84      }
  85  
  86  // for load admin page
  87  	public static function load_admin_page($hub)
  88      {
  89          $hub[MailPress_page_import] = 'import';
  90          return $hub;
  91      }
  92  }
  93  new MailPress_import();
  94  }


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