Created
November 27, 2017 10:21
-
-
Save davidwasamrf/6c4509c72c17512809ce64783e278a54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Copyright (c) 2017 Marfeel Solutions (https://www.marfeel.com) | |
* All Rights Reserved.* | |
* NOTICE: All information contained herein is, and remains | |
* the property of Marfeel Solutions S.L and its suppliers, | |
* if any. The intellectual and technical concepts contained | |
* herein are proprietary to Marfeel Solutions S.L and its | |
* suppliers and are protected by trade secret or copyright law. | |
* Dissemination of this information or reproduction of this material | |
* is strictly forbidden unless prior written permission is obtained | |
* from Marfeel Solutions SL. | |
*/ | |
use Base\Marfeel_Press; | |
use Base\Marfeel_Press_Updater; | |
use Base\Marfeel_Press_Activation_Requirements_Checker; | |
use Base\Marfeel_press_activator; | |
use Base\Marfeel_press_deactivator; | |
use Ioc\Marfeel_Press_App; | |
/** | |
* Plugin Name: MarfeelPress | |
* Plugin URI: https://www.marfeel.com | |
* Description: Marfeel version of WordPress. | |
* Author: Marfeel Solutions, S. L. | |
* Author URI: https://www.marfeel.com | |
* Text Domain: marfeel-press | |
* Domain Path: /languages | |
* Version: 0.1.dev | |
* | |
* @package marfeel-press | |
*/ | |
// If this file is called directly, abort. | |
if ( ! defined( 'WPINC' ) ) { | |
die; | |
} | |
spl_autoload_register(function ( $class ) { | |
$dirs = explode("\\", $class); | |
array_splice($dirs, 1, 0, 'src'); | |
$dirs = array_map('from_camel_case', $dirs); | |
end($dirs); | |
$last_id=key($dirs); | |
$dirs[$last_id] = 'class-' . $dirs[$last_id] . '.php'; | |
$path = implode('/', $dirs); | |
$class_path = __MARFEEL_PRESS_DIR . 'includes/' . $path ; | |
$interface_path = str_replace('class-', 'interface-', $class_path ); | |
if( file_exists( $class_path ) ) { | |
require_once( $class_path ); | |
} else if( file_exists( $interface_path ) ) { | |
require_once( $interface_path ); | |
} else { | |
return false; | |
} | |
}); | |
function from_camel_case($input) { | |
$tmp = str_replace('_','-', $input); | |
return strtolower($tmp); | |
} | |
define( 'MIN_PHP_VERSION', '5.3' ); | |
define( 'MIN_WP_VERSION', '4.7' ); | |
define( 'PLUGIN_VERSION', '0.1.dev' ); | |
define( 'MARFEEL_PRESS_MAJOR_VERSION', '0' ); | |
define( 'MARFEEL_PRESS_MINOR_VERSION', '1' ); | |
define( 'MARFEEL_PRESS_BUILD_NUMBER', 'dev' ); | |
// @codingStandardsIgnoreLine | |
if ( file_exists( $composer_autoload = __DIR__ . '/vendor/autoload.php' ) || file_exists( $composer_autoload = WP_CONTENT_DIR . '/vendor/autoload.php' ) ) { | |
require_once( $composer_autoload ); | |
} | |
if ( ! defined( '__MARFEEL_PRESS_DIR' ) ) { | |
define( '__MARFEEL_PRESS_DIR', plugin_dir_path( __FILE__ ) ); | |
} | |
if ( ! defined( '__MARFEEL_PRESS_VENDORS_DIR' ) ) { | |
define( '__MARFEEL_PRESS_VENDOR_DIR', plugin_dir_path( __FILE__ ) . 'vendor/' ); | |
} | |
if ( ! defined( '__MARFEEL_PRESS_RESOURCES_DIR' ) ) { | |
define( '__MARFEEL_PRESS_RESOURCES_DIR', plugin_dir_path( __FILE__ ) . 'includes/base/src/resources/' ); | |
} | |
Marfeel_Press_App::initialize(); | |
require_once( __MARFEEL_PRESS_DIR . 'includes/ioc/src/context.php' ); | |
/** | |
* The code that runs during plugin activation. | |
* This action is documented in includes/class-plugin-name-activator.php | |
* | |
* @return void | |
*/ | |
function activate_marfeel_press() { | |
Marfeel_press_activator::activate(); | |
} | |
/** | |
* The code that runs during plugin deactivation. | |
* This action is documented in includes/class-plugin-name-deactivator.php | |
* | |
* @return void | |
*/ | |
function deactivate_marfeel_press() { | |
Marfeel_press_deactivator::deactivate(); | |
} | |
Marfeel_Press_Updater::should_update(); | |
register_activation_hook( __FILE__, 'activate_marfeel_press', 20 ); | |
register_deactivation_hook( __FILE__, 'deactivate_marfeel_press' ); | |
$plugin = new Marfeel_Press(); | |
$activation_requirements_checker = new Marfeel_Press_Activation_Requirements_Checker(); | |
if ( ! $activation_requirements_checker->is_requirements_met() ) { | |
add_action( 'admin_init', array( $activation_requirements_checker, 'force_disable_plugin' ) ); | |
add_action( 'admin_notices', array( $activation_requirements_checker, 'show_requirements_notice' ) ); | |
} else { | |
add_action( 'admin_init', array( $activation_requirements_checker, 'check_blacklisted_plugin_active' ) ); | |
$plugin->run(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment