[ Index ]

MailPress 7.2

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

title

Body

[close]

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

   1  <?php
   2  if ( class_exists( 'MailPress' ) && !class_exists( 'MailPress_privacy' ) && function_exists( 'wp_create_user_request' ) )
   3  {
   4  /*
   5  Plugin Name: MailPress_privacy
   6  Plugin URI: http://blog.mailpress.org
   7  Description: Users : Create Personal Data export/erasure requests from mail sent to a dedicated mailbox with a specific subject
   8  Version: 7.2
   9  */
  10  
  11  class MailPress_privacy
  12  {
  13      const meta_key         = '_MailPress_privacy';
  14      const option_name     = 'MailPress_privacy';
  15      const log_name = 'privacy';
  16  
  17      const process_name        = 'mp_process_privacy';
  18  
  19      const bt = 132;
  20  
  21  	function __construct()
  22      {
  23  // for batch mode
  24          add_action( self::process_name,                    array( __CLASS__, 'process' ) );
  25  
  26          $config = get_option( self::option_name );
  27          if ( 'wpcron' == $config['batch_mode'] )
  28          {    
  29              add_action( 'MailPress_schedule_privacy',        array( __CLASS__, 'schedule' ) );
  30          }
  31  
  32          if ( is_admin() )
  33          {
  34          // for install
  35              register_activation_hook( plugin_basename( __FILE__ ),array( __CLASS__, 'install' ) );
  36              register_deactivation_hook( plugin_basename( __FILE__ ),array( __CLASS__, 'uninstall' ) );
  37          // for link on plugin page
  38              add_filter( 'plugin_action_links',            array( __CLASS__, 'plugin_action_links' ), 10, 2 );
  39  
  40          // for settings
  41              add_filter( 'MailPress_settings_tab',         array( __CLASS__, 'settings_tab' ), 50, 1 );
  42          // for settings logs
  43              add_action( 'MailPress_settings_logs_form',    array( __CLASS__, 'settings_logs_form' ), 30, 1 );
  44          }
  45      }
  46  
  47  // process
  48  	public static function process()
  49      {
  50          MP_::no_abort_limit();
  51  
  52          new MP_Privacy();
  53      }
  54  
  55  // schedule
  56  	public static function schedule()
  57      {
  58          $config = get_option( self::option_name );
  59          $now4cron = current_time( 'timestamp', 'gmt' );
  60  
  61          if ( !wp_next_scheduled( self::process_name ) ) 
  62              wp_schedule_single_event( $now4cron + $config['every'], self::process_name );
  63      }
  64  
  65  // check request subject is one word
  66  	public static function one_word( $w ) 
  67      {
  68          $w = trim( $w );
  69          $words = explode( ' ', $w );
  70          return ( count( $words ) == 1 ) ? $w : false;
  71      }
  72  
  73  ////  ADMIN  ////
  74  ////  ADMIN  ////
  75  ////  ADMIN  ////
  76  ////  ADMIN  ////
  77  
  78  // install
  79  	public static function install() 
  80      {
  81          self::uninstall();
  82  
  83          $options = get_option( self::option_name );
  84          if ( !$options )
  85          {
  86              $pop3 = get_option( 'MailPress_connection_pop3' );
  87              if ( $pop3 )
  88              {
  89                  unset( $pop3['username'], $pop3['password'] );
  90                  $options['pop3'] = $pop3;
  91                  update_option( self::option_name, $options );
  92              }
  93          }
  94  
  95          MP_Log::set_option( self::log_name );
  96  
  97          do_action( 'MailPress_schedule_privacy' );
  98      }
  99  
 100  	public static function uninstall() 
 101      {
 102          wp_clear_scheduled_hook( self::process_name );
 103      }
 104  
 105  // for link on plugin page
 106  	public static function plugin_action_links( $links, $file )
 107      {
 108          return MailPress::plugin_links( $links, $file, plugin_basename( __FILE__ ), 'privacy' );
 109      }
 110  
 111  // for settings
 112  	public static function settings_tab( $tabs )
 113      {
 114          $tabs['privacy'] = __( 'Privacy', 'MailPress' );
 115          return $tabs;
 116      }
 117  
 118  // for settings logs    
 119  	public static function settings_logs_form( $logs )
 120      {
 121          MP_AdminPage::log_form( self::log_name, $logs, __( 'Privacy', 'MailPress' ) );
 122      }
 123  }
 124  new MailPress_privacy();
 125  }


Generated: Tue May 19 15:55:14 2020 Cross-referenced by PHPXref 0.7.1