| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: Easy Code Manager |
| 4 |
Plugin URI: http://easy-code-manager.com/ |
| 5 |
Description: Manage and Execute code in various Languages into Your Wordpress installation, take controll of your site style and functioality |
| 6 |
Version: 1.0.0 |
| 7 |
Text Domain: easy-code-manager |
| 8 |
Domain Path: /locals/languages |
| 9 |
Author: Wipeout Media |
| 10 |
Author URI: http://easy-code-manager.com |
| 11 |
License: |
| 12 |
|
| 13 |
The Software is package as a WordPress¨ plugin. The PHP code associated with the Software is licensed under the GPL version 2.0 license (as found at http://www.gnu.org/licenses/gpl-2.0.txt GNU/GPLv2 or "GPLv2"). You may redistribute, repackage, and modify the PHP code as you see fit and as consistent with GPLv2. |
| 14 |
|
| 15 |
The remaining portions of the Software ("Proprietary Portion"), which includes all images, cascading style sheets, and JavaScript are NOT licensed under GPLv2 and are considered proprietary to Licensor and are solely licensed under the remaining terms of this Agreement. The Proprietary Portion may not be redistributed, repackaged, or otherwise modified. |
| 16 |
*/ |
| 17 |
|
| 18 |
// Disallow direct access. |
| 19 |
defined('ABSPATH') or die(-1); |
| 20 |
|
| 21 |
/** |
| 22 |
* ECM Checker Interface for checking for |
| 23 |
* CJT exisdtance |
| 24 |
* |
| 25 |
*/ |
| 26 |
final class ECMCI |
| 27 |
{ |
| 28 |
|
| 29 |
/** |
| 30 |
* |
| 31 |
*/ |
| 32 |
const DIR = __DIR__; |
| 33 |
|
| 34 |
/** |
| 35 |
* |
| 36 |
*/ |
| 37 |
const DB_VERSION_OPTION_NAME = 'ecm_db_version'; |
| 38 |
|
| 39 |
/** |
| 40 |
* |
| 41 |
*/ |
| 42 |
const FILE = __FILE__; |
| 43 |
|
| 44 |
/** |
| 45 |
* |
| 46 |
*/ |
| 47 |
const VERSION = '1.0.0'; |
| 48 |
|
| 49 |
/** |
| 50 |
* put your comment there... |
| 51 |
* |
| 52 |
* @var mixed |
| 53 |
*/ |
| 54 |
private static $instance; |
| 55 |
|
| 56 |
/** |
| 57 |
* put your comment there... |
| 58 |
* |
| 59 |
*/ |
| 60 |
private function __construct() {} |
| 61 |
|
| 62 |
/** |
| 63 |
* put your comment there... |
| 64 |
* |
| 65 |
*/ |
| 66 |
public function _OnAdminNotice() |
| 67 |
{ |
| 68 |
require __DIR__ . DIRECTORY_SEPARATOR . 'CJTChecker' . |
| 69 |
DIRECTORY_SEPARATOR . 'CJTDetectedNotice.html.php'; |
| 70 |
} |
| 71 |
|
| 72 |
/** |
| 73 |
* put your comment there... |
| 74 |
* |
| 75 |
*/ |
| 76 |
public function _OnCheckCompatibility() |
| 77 |
{ |
| 78 |
|
| 79 |
if (class_exists('CJTPlugin') && |
| 80 |
CJTPlugin::DB_VERSION_OPTION_NAME == 'cjtoolbox_db_version') |
| 81 |
{ |
| 82 |
|
| 83 |
// Show Asdmin notice |
| 84 |
add_action('admin_notices', array($this, '_OnAdminNotice')); |
| 85 |
add_action('network_admin_notices', array($this, '_OnAdminNotice')); |
| 86 |
|
| 87 |
// Enqueue Notice scripts/styles |
| 88 |
add_action('admin_enqueue_scripts', array($this, '_OnCheckerScripts')); |
| 89 |
add_action('admin_print_styles', array($this, '_OnCheckerStyles')); |
| 90 |
|
| 91 |
// Migrate Ajax action |
| 92 |
add_action('wp_ajax_ecm-migrate-cjt', array($this, '_OnMigrate')); |
| 93 |
|
| 94 |
// Dont run ECM as long as CJT is activated/detected |
| 95 |
return; |
| 96 |
} |
| 97 |
|
| 98 |
// Load ECM |
| 99 |
require __DIR__ . DIRECTORY_SEPARATOR . 'Plugin.class.php'; |
| 100 |
} |
| 101 |
|
| 102 |
/** |
| 103 |
* put your comment there... |
| 104 |
* |
| 105 |
*/ |
| 106 |
public function _OnCheckerScripts() |
| 107 |
{ |
| 108 |
wp_enqueue_script('jquery-ui-dialog'); |
| 109 |
wp_enqueue_script('ecm-cjt-checker', plugin_dir_url(__FILE__) . '/CJTChecker/CJTChecker.js'); |
| 110 |
} |
| 111 |
|
| 112 |
/** |
| 113 |
* put your comment there... |
| 114 |
* |
| 115 |
*/ |
| 116 |
public function _OnCheckerStyles() |
| 117 |
{ |
| 118 |
wp_enqueue_style('ecm-cjt-checker-jquery-ui-dialog', plugin_dir_url(__FILE__) . '/CJTChecker/jQueryDialogCSS/jquery-ui.min.css'); |
| 119 |
wp_enqueue_style('ecm-cjt-checker', plugin_dir_url(__FILE__) . '/CJTChecker/CJTChecker.css'); |
| 120 |
} |
| 121 |
|
| 122 |
/** |
| 123 |
* put your comment there... |
| 124 |
* |
| 125 |
*/ |
| 126 |
public function _OnMigrate() |
| 127 |
{ |
| 128 |
|
| 129 |
$nonce = $_POST['nonce']; |
| 130 |
|
| 131 |
if (is_super_admin() && |
| 132 |
wp_verify_nonce($nonce)) |
| 133 |
{ |
| 134 |
|
| 135 |
require __DIR__ . DIRECTORY_SEPARATOR . 'CJTChecker' . |
| 136 |
DIRECTORY_SEPARATOR . 'Migrate.class.php'; |
| 137 |
|
| 138 |
$migrator = new ECMMigrateCJT(); |
| 139 |
|
| 140 |
try |
| 141 |
{ |
| 142 |
$migrator->migrate(); |
| 143 |
} |
| 144 |
catch (Exception $exception) |
| 145 |
{ |
| 146 |
echo $exception->getMessage(); |
| 147 |
} |
| 148 |
|
| 149 |
} |
| 150 |
|
| 151 |
die(); |
| 152 |
} |
| 153 |
|
| 154 |
/** |
| 155 |
* put your comment there... |
| 156 |
* |
| 157 |
*/ |
| 158 |
private function init() |
| 159 |
{ |
| 160 |
|
| 161 |
// admin notice when CJT detected |
| 162 |
add_action('plugins_loaded', array($this, '_OnCheckCompatibility'), 1); |
| 163 |
|
| 164 |
} |
| 165 |
|
| 166 |
/** |
| 167 |
* put your comment there... |
| 168 |
* |
| 169 |
*/ |
| 170 |
public static function & plug() |
| 171 |
{ |
| 172 |
|
| 173 |
if (!self::$instance) |
| 174 |
{ |
| 175 |
self::$instance = new ECMCI(); |
| 176 |
|
| 177 |
self::$instance->init(); |
| 178 |
} |
| 179 |
|
| 180 |
return self::$instance; |
| 181 |
} |
| 182 |
} |
| 183 |
|
| 184 |
|
| 185 |
ECMCI::plug(); |
| 186 |
|