[ Index ]

MailPress 7.0.1

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

title

Body

[close]

/ -> mp-load.php (source)

   1  <?php
   2  /**
   3   * Bootstrap file for 
   4          1. setting some constants
   5          2. loading pluggable functions
   6  
   7   * If the mailpress-config.php file is not found then default constant values apply.
   8  
   9  **/
  10  
  11  // 1.
  12  
  13  /** Plugin version. */
  14  require_once ( ABSPATH . 'wp-admin/includes/plugin.php' );
  15  $plugin_data = get_plugin_data( MP_ABSPATH . 'MailPress.php' );
  16  define ( 'MP_Version',     $plugin_data['Version'] );
  17  
  18  /** Loading optional mailpress-config.php file in current directory or parent directory */
  19  $mp_config = 'mailpress-config.php';
  20  foreach ( array( MP_ABSPATH . $mp_config, dirname( MP_ABSPATH ) . '/' . $mp_config ) as $mp_file )
  21  {
  22      if ( !is_file( $mp_file ) )
  23      {
  24          continue;
  25      }
  26      require_once( $mp_file );
  27      break;
  28  }
  29  
  30  /** enqueue scripts for form widget. */
  31  defined( 'MP_wp_enqueue_script' )     or define ( 'MP_wp_enqueue_script',    true );
  32  
  33  /** Folder name of MailPress 'mp-content'. */
  34  defined( 'MP_CONTENT_FOLDER' )         or define ( 'MP_CONTENT_FOLDER',    'mp-content' );
  35  
  36  /** Absolute path to the MailPress 'mp-content' folder. */
  37  defined( 'MP_CONTENT_DIR' )         or define ( 'MP_CONTENT_DIR',        MP_ABSPATH . MP_CONTENT_FOLDER . '/' );
  38  
  39  /** Relative path to the MailPress 'mp-content' folder. */
  40  defined( 'MP_PATH_CONTENT' )         or define ( 'MP_PATH_CONTENT',        MP_PATH . MP_CONTENT_FOLDER . '/' );
  41  
  42  /** Absolute path to the MailPress Uploads directory. */
  43  global $wpdb;
  44  $uds = wp_upload_dir();
  45  $ubd = $uds['basedir'];
  46  $ubu = $uds['baseurl'];
  47  
  48  $tail = '/sites/' . get_current_blog_id();
  49  if ( strrpos( $ubd, $tail ) && ( strlen( $ubd ) == ( strlen( substr( $ubd, 0, strrpos( $ubd, $tail ) ) ) + strlen( $tail ) ) ) )
  50  {
  51      $ubd = substr( $ubd, 0, strrpos( $ubd, $tail ) );
  52      $ubu = substr( $ubu, 0, strrpos( $ubu, $tail ) );
  53  }
  54  else
  55  {
  56      $tail = '/' . get_current_blog_id();
  57      if ( strrpos( $ubd, $tail ) && ( strlen( $ubd ) == ( strlen( substr( $ubd, 0, strrpos( $ubd, $tail ) ) ) + strlen( $tail ) ) ) )
  58      {
  59          $ubd = substr( $ubd, 0, strrpos( $ubd, $tail ) );
  60          $ubu = substr( $ubu, 0, strrpos( $ubu, $tail ) );
  61      }
  62  }
  63  
  64  define ( 'MP_UPL_ABSPATH',    untrailingslashit( $ubd ) . '/mailpress/' );
  65  define ( 'MP_UPL_URL',    untrailingslashit( $ubu ) . '/mailpress/' );
  66  define ( 'MP_UPL_PATH', str_replace( trailingslashit(  get_option( 'siteurl' ) ), '', MP_UPL_URL ) );
  67  //$paths = array('MP_ABSPATH' =>MP_ABSPATH,'MP_FOLDER' =>MP_FOLDER,'MP_PATH' =>MP_PATH,'MP_CONTENT_FOLDER' =>MP_CONTENT_FOLDER,'MP_CONTENT_DIR' =>MP_CONTENT_DIR,'MP_PATH_CONTENT' =>MP_PATH_CONTENT,'MP_UPL_ABSPATH' =>MP_UPL_ABSPATH,'MP_UPL_PATH' =>MP_UPL_PATH,'MP_UPL_URL' =>MP_UPL_URL,);print_r($paths);
  68  
  69  // 2.
  70  
  71  global $mp_general, $mp_subscriptions;
  72  $mp_general        = get_option( MailPress::option_name_general );
  73  $mp_subscriptions    = get_option( MailPress::option_name_subscriptions );
  74  
  75  if ( isset( $mp_general['wp_mail'] ) )
  76  {
  77      include  ( MP_ABSPATH . 'mp-includes/wp_pluggable.php' );
  78  }
  79  
  80  // 3.
  81  
  82  /* solve tracking links whether active or not */
  83  add_action( 'wp_ajax_mp_tracking',        array( 'MP_Tracking', 'process' ) );
  84  add_action( 'wp_ajax_nopriv_mp_tracking',    array( 'MP_Tracking', 'process' ) );
  85  
  86  // 4.
  87  
  88  /** Debug */
  89  if ( defined( 'WP_DEBUG' ) && WP_DEBUG && !defined( 'MP_DEBUG_LOG' ) ) 
  90      define( 'MP_DEBUG_LOG', true );


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