'stream-cherry-pick/stream-cherry-pick.php', 'WP_Stream_Data_Exporter' => 'stream-data-exporter/stream-data-exporter.php', 'WP_Stream_Notifications' => 'stream-notifications/stream-notifications.php', 'WP_Stream_Reports' => 'stream-reports/stream-reports.php', ); /** * Class constructor */ private function __construct() { define( 'WP_STREAM_PLUGIN', plugin_basename( __FILE__ ) ); define( 'WP_STREAM_DIR', plugin_dir_path( __FILE__ ) ); define( 'WP_STREAM_URL', plugin_dir_url( __FILE__ ) ); define( 'WP_STREAM_INC_DIR', WP_STREAM_DIR . 'includes/' ); define( 'WP_STREAM_CLASS_DIR', WP_STREAM_DIR . 'classes/' ); define( 'WP_STREAM_EXTENSIONS_DIR', WP_STREAM_DIR . 'extensions/' ); spl_autoload_register( array( $this, 'autoload' ) ); // Load helper functions require_once WP_STREAM_INC_DIR . 'functions.php'; // Load DB helper interface/class $driver = 'WP_Stream_DB'; if ( class_exists( $driver ) ) { self::$db = new $driver; } if ( ! self::$db ) { wp_die( __( 'Stream: Could not load chosen DB driver.', 'stream' ), 'Stream DB Error' ); } /** * Filter allows a custom Stream API class to be instantiated * * @return object The API class object */ self::$api = apply_filters( 'wp_stream_api_class', new WP_Stream_API ); // Install the plugin add_action( 'wp_stream_before_db_notices', array( __CLASS__, 'install' ) ); // Load languages add_action( 'plugins_loaded', array( __CLASS__, 'i18n' ) ); // Load settings, enabling extensions to hook in add_action( 'init', array( 'WP_Stream_Settings', 'load' ), 9 ); // Load logger class add_action( 'plugins_loaded', array( 'WP_Stream_Log', 'load' ) ); // Load connectors after widgets_init, but before the default of 10 add_action( 'init', array( 'WP_Stream_Connectors', 'load' ), 9 ); // Load extensions foreach ( glob( WP_STREAM_EXTENSIONS_DIR . '*' ) as $extension ) { require_once sprintf( '%s/class-wp-stream-%s.php', $extension, basename( $extension ) ); } // Load support for feeds add_action( 'init', array( 'WP_Stream_Feeds', 'load' ) ); // Add frontend indicator add_action( 'wp_head', array( $this, 'frontend_indicator' ) ); if ( is_admin() ) { add_action( 'plugins_loaded', array( 'WP_Stream_Admin', 'load' ) ); add_action( 'plugins_loaded', array( 'WP_Stream_Dashboard_Widget', 'load' ) ); add_action( 'plugins_loaded', array( 'WP_Stream_Live_Update', 'load' ) ); add_action( 'plugins_loaded', array( 'WP_Stream_Pointers', 'load' ) ); add_action( 'plugins_loaded', array( 'WP_Stream_Migrate', 'load' ) ); } } /** * Invoked when the PHP version check fails. Load up the translations and * add the error message to the admin notices */ public static function fail_php_version() { add_action( 'plugins_loaded', array( __CLASS__, 'i18n' ) ); self::notice( __( 'Stream requires PHP version 5.3+, plugin is currently NOT ACTIVE.', 'stream' ) ); } /** * */ public static function deprecated_plugins_exist() { foreach ( self::$deprecated_extensions as $class => $dir ) { if ( class_exists( $class ) ) { return true; } } return false; } /** * */ public static function deprecated_plugins_notice() { add_action( 'plugins_loaded', array( __CLASS__, 'i18n' ) ); if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $message = null; foreach ( self::$deprecated_extensions as $class => $dir ) { if ( class_exists( $class ) ) { $data = get_plugin_data( sprintf( '%s/%s', WP_PLUGIN_DIR, $dir ) ); $name = isset( $data['Name'] ) ? $data['Name'] : $dir; $message .= sprintf( '
Stream :