[ Index ]

MailPress 544

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

title

Body

[close]

/mp-includes/class/ -> MP_adminpage_.class.php (source)

   1  <?php
   2  abstract class MP_adminpage_ extends MP_
   3  {
   4  	function __construct()
   5      {
   6          if ( !current_user_can(MP_AdminPage::capability) ) 
   7              wp_die(__('You do not have sufficient permissions to access this page.'));
   8  
   9          add_action('admin_init',              array('MP_AdminPage', 'redirect'));
  10          add_action('admin_init',              array('MP_AdminPage', 'title'));
  11  
  12          add_action('admin_head',              array('MP_AdminPage', 'screen_meta'));
  13          add_filter('screen_meta_screen',         array('MP_AdminPage', 'screen_meta_screen'));
  14          add_filter('current_screen',             array('MP_AdminPage', 'current_screen'), 8, 1);
  15  
  16          add_action('admin_print_styles',         array('MP_AdminPage', 'print_styles'));
  17          add_action('admin_print_scripts' ,         array('MP_AdminPage', 'print_header_scripts'));
  18          add_action('admin_print_footer_scripts' , array('MP_AdminPage', 'print_footer_scripts'));
  19  
  20          add_action('wp_print_scripts',         array('MP_AdminPage', 'deregister_scripts'), 100);
  21          add_action('wp_print_footer_scripts',     array('MP_AdminPage', 'deregister_scripts'), 100);
  22      }
  23  
  24  ////  Redirect  ////
  25  
  26  	public static function redirect() {}
  27  
  28  ////  Title  ////
  29  
  30  	public static function title() {}
  31  
  32  //// Screen Options ////
  33  
  34  	public static function screen_meta() 
  35      {
  36          global $current_screen;
  37  
  38          $current_screen->add_help_tab( array(
  39              'id'        => 'overview',
  40              'title'        => __('Overview'),
  41              'content'    =>
  42                    '<p><strong>' . __( 'For more information:' ) . '</strong></p>'
  43                  . '<p>' . sprintf(__('<a href="%1$s" target="_blank">Tutorials</a>', MP_TXTDOM), (MP_AdminPage::help_url) ? MP_AdminPage::help_url : 'http://blog.mailpress.org/tutorials/' ) . '</p>'
  44                  . '<p>' . sprintf(__('<a href="%1$s" target="_blank">Support Forum</a>', MP_TXTDOM), 'http://groups.google.com/group/mailpress') . '</p>'
  45              )
  46          );
  47  
  48          $badge = (rand(0, 1)) ? 'mailpress_badge.gif' : 'logo_lmailpress_admin.png" style="width:125px;';
  49  
  50          $current_screen->set_help_sidebar(
  51                '<p><strong>' . __( 'Please Donate :', MP_TXTDOM ) . '</strong></p>'
  52              . '<div style="text-align:center;">'
  53              . '<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_s-xclick" /><input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHLwYJKoZIhvcNAQcEoIIHIDCCBxwCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYAcDHC7s1oHkGbDrzpD/0p5LV7wn6+MxkkGcA++TAlnmRgokbVW4DdscOFfnTPCYl0jqSS7NkYwT35UQBUNVygkRy5xwTZJDtZCqpZf4pmeSMKi1gwNzt83PhEsoVqWKLDN4EYQPs26TXytH2ASmSjHo3xwcXl0SQK8/ASi1CCtRzELMAkGBSsOAwIaBQAwgawGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIVfM9DQYPN4uAgYiqDDojfQYW4Aji2OzOemlzVXelJqjBzowMdnWQjZHWvSvjBbSi7lDgVgsqQoniZulSdCUIy1s8o5ikVNs18bLMq2zdr4z3/B8f8fKWh6Q07IA39rKOg4WMl50No9qZr8kSWk5nVTdL8Fw19k0EfnLsXYH+Q4GvvMbxecz7Nj5MDdJK3mz9hysroIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEU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zFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTEwODA4MTQzNjQ3WjAjBgkqhkiG9w0BCQQxFgQUy94gTQXbcFxhOAXCwuda78s29N4wDQYJKoZIhvcNAQEBBQAEgYBmil057NAHbTUidyZO635F0jOVQ9xlbLcsYr9COb1vyGkkRW8JIE+lnlDycfhBwjjKC2/1qK0DDYQ2C4iX1OqYuZMKGWdI8pSzz0nQvIqZ82UmOVu+a1W7D+b6QtxXIhi2D4zqI3wa/DlTj5drJVozetlipkTfsFYmjhF6FCzN2A==-----END PKCS7-----" /><input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" /><img alt="" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1" /></form>' 
  54              . '</div>'
  55              . '<p>' . __('and support', MP_TXTDOM ) . '</p>'
  56              . '<div style="text-align:center;">'
  57              . '<img src="' . site_url() . '/' . MP_PATH . 'mp-includes/images/' . $badge . '" alt="" />'
  58              . '</div>'
  59          );
  60      }
  61  
  62  	public static function screen_meta_screen()
  63      {
  64          return MP_AdminPage::screen;
  65      }
  66  
  67  	public static function current_screen($current_screen)
  68      {
  69          $current_screen->id = MP_AdminPage::screen;
  70          $current_screen->post_type = '';
  71          return $current_screen;
  72      }
  73  
  74  //// Styles ////
  75  
  76  	public static function print_styles($styles = array()) 
  77      {
  78          $styles = apply_filters('MailPress_styles', $styles, MP_AdminPage::screen);
  79          if (is_array($styles)) foreach ($styles as $style) wp_enqueue_style($style);
  80      }
  81  
  82  //// Scripts ////
  83  
  84  	public static function print_header_scripts() { MP_AdminPage::print_scripts(array(), false); }
  85  	public static function print_footer_scripts() { MP_AdminPage::print_scripts(array(), true); }
  86  
  87  	public static function print_scripts($scripts = array()) 
  88      {
  89          $scripts = apply_filters('MailPress_scripts', $scripts, MP_AdminPage::screen);
  90          if (is_array($scripts)) foreach ($scripts as $script)    wp_enqueue_script($script);
  91      }
  92  
  93  	public static function deregister_scripts()
  94      {
  95          $root = MP_CONTENT_DIR . 'advanced/scripts';
  96          $root = apply_filters('MailPress_advanced_scripts_root', $root);
  97          $file    = "$root/deregister.xml";
  98  
  99          $y = '';
 100  
 101          if (is_file($file))
 102          {
 103              $x = file_get_contents($file);
 104              if ($xml = simplexml_load_string($x))
 105              {
 106                  foreach ($xml->script as $script)
 107                  {
 108                      wp_deregister_script((string) $script);
 109                      $y .= (!empty($y)) ? ", $script" : $script;
 110                  }
 111              }
 112              echo "\n<!-- MailPress_deregister_scripts : $y -->\n";
 113          }
 114      }
 115  
 116  ////  Body  ////
 117  
 118  	public static function body() { include(MP_ABSPATH . 'mp-admin/includes/' . basename(MP_AdminPage::file)); }
 119  
 120  //// Html ////
 121  
 122  	public static function get_url_parms($parms = array('mode', 'status', 's', 'paged', 'author', 'startwith'))
 123      {
 124          $url_parms = array();
 125          foreach ($parms as $parm) if (isset($_REQUEST[$parm]))
 126          {
 127              if (isset($_REQUEST[$parm]))
 128              {
 129                  $url_parms[$parm] = trim(stripslashes($_REQUEST[$parm]));
 130                  switch ($parm)
 131                  {
 132                      case 'startwith' :
 133                          if (-1 == $url_parms[$parm])     unset($url_parms[$parm]);
 134                      break;
 135                      case 'paged' :
 136                          if (1 >= $url_parms[$parm])     unset($url_parms[$parm]);
 137                      case 's' :
 138                      case 'author' :
 139                      case 'mailinglist' :
 140                      case 'newsletter' :
 141                          if (empty($url_parms[$parm])) unset($url_parms[$parm]);
 142                      break;
 143                  }
 144              }
 145          }
 146          return $url_parms;
 147      }
 148  
 149  	public static function post_url_parms($url_parms, $parms = array('mode', 'status', 's', 'paged', 'author'))
 150      {
 151          foreach ($parms as $key)
 152              if (isset($url_parms[$key]))
 153                  echo "<input type='hidden' name='$key' value=\"" . $url_parms[$key] . "\" />\n";
 154      }
 155  
 156  	public static function message($s, $b = true)
 157      {
 158          if ( $b )     echo "<div id='message' class='updated fade'><p>$s</p></div>";
 159           else         echo "<div id='message' class='error'><p>$s</p></div>";
 160      }
 161  }


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