| @@ -1,16 +1,15 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: WP Coder |
| 4 | 4 | * Plugin URI: https://wordpress.org/plugins/wp-coder/ |
| 5 | - * Description: Adding custom HTML, CSS, JavaScript and PHP code to your WordPress site. | |
| 6 | - * Version: 4.5.1 | |
| 7 | - * Author: WPCoder | |
| 8 | - * Author URI: https://wpcoder.pro | |
| 9 | - * Author Email: hey@wow-company.com | |
| 5 | + * Description: Adding custom HTML, CSS, and JavaScript code to your WordPress site. | |
| 6 | + * Version: 3.0.4 | |
| 7 | + * Author: Wow-Company | |
| 8 | + * Author URI: https://wow-estore.com/ | |
| 10 | 9 | * License: GPL-2.0+ |
| 11 | 10 | * License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 12 | - * Text Domain: wp-coder | |
| 11 | + * Text Domain: wpcoder | |
| 13 | 12 | * Requires at least: 5.4 |
| 14 | 13 | * Requires PHP: 7.4 |
| 15 | 14 | */ |
| 16 | 15 | |
| @@ -16,9 +15,8 @@ | ||
| 16 | 15 | |
| 17 | 16 | namespace WPCoder; |
| 18 | 17 | |
| 19 | 18 | // Exit if accessed directly. |
| 20 | -use WPCoder\Block\WPCoder_Block; | |
| 21 | 19 | use WPCoder\Dashboard\DBManager; |
| 22 | 20 | use WPCoder\Dashboard\FolderManager; |
| 23 | 21 | use WPCoder\Update\UpdateDB; |
| 24 | 22 | |
| @@ -23,12 +21,19 @@ | ||
| 23 | 21 | use WPCoder\Update\UpdateDB; |
| 24 | 22 | |
| 25 | 23 | defined( 'ABSPATH' ) || exit; |
| 26 | 24 | |
| 27 | -if ( ! class_exists( 'wpcoder' ) ) : | |
| 25 | +if ( ! class_exists( 'WOW_Plugin' ) ) : | |
| 28 | 26 | |
| 29 | - final class WPCoder { | |
| 27 | + final class WOW_Plugin { | |
| 30 | 28 | |
| 29 | + public const EMAIl = 'yoda@wow-company.com'; | |
| 30 | + // Plugin name | |
| 31 | + public const NAME = 'WP Coder'; | |
| 32 | + | |
| 33 | + // Plugin version | |
| 34 | + public const VERSION = '3.0.4'; | |
| 35 | + | |
| 31 | 36 | // Plugin slug |
| 32 | 37 | public const SLUG = 'wp-coder'; |
| 33 | 38 | |
| 34 | 39 | // Plugin prefix |
| @@ -35,9 +40,9 @@ | ||
| 35 | 40 | public const PREFIX = 'wow_coder'; |
| 36 | 41 | |
| 37 | 42 | public const FOLDER = 'wp-coder'; |
| 38 | 43 | |
| 39 | - public const SHORTCODE = 'wp_code'; | |
| 44 | + public const SHORTCODE = 'WP-Coder'; | |
| 40 | 45 | |
| 41 | 46 | // Plugin ULR |
| 42 | 47 | public const PluginURL = 'https://wordpress.org/plugins/wp-coder/'; |
| 43 | 48 | |
| @@ -49,12 +54,11 @@ | ||
| 49 | 54 | /** |
| 50 | 55 | * @var Wow_Dashboard |
| 51 | 56 | */ |
| 52 | 57 | private $dashboard; |
| 53 | - private $public; | |
| 54 | 58 | |
| 55 | - public static function instance(): WPCoder { | |
| 56 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WPCoder ) ) { | |
| 59 | + public static function instance(): WOW_Plugin { | |
| 60 | + if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WOW_Plugin ) ) { | |
| 57 | 61 | self::$instance = new self; |
| 58 | 62 | |
| 59 | 63 | self::$instance->includes(); |
| 60 | 64 | self::$instance->autoloader = new Autoloader( 'WPCoder' ); |
| @@ -62,8 +66,9 @@ | ||
| 62 | 66 | self::$instance->public = new WOWP_Public(); |
| 63 | 67 | |
| 64 | 68 | register_activation_hook( __FILE__, [ self::$instance, 'plugin_activate' ] ); |
| 65 | 69 | add_action( 'plugins_loaded', [ self::$instance, 'loaded' ] ); |
| 70 | + add_action( 'admin_init', [ self::$instance, 'update'] ); | |
| 66 | 71 | } |
| 67 | 72 | |
| 68 | 73 | |
| 69 | 74 | return self::$instance; |
| @@ -88,24 +93,8 @@ | ||
| 88 | 93 | public static function url(): string { |
| 89 | 94 | return plugin_dir_url( __FILE__ ); |
| 90 | 95 | } |
| 91 | 96 | |
| 92 | - | |
| 93 | - // Get Plugin Info | |
| 94 | - public static function info( $show = '' ): string { | |
| 95 | - $data = [ | |
| 96 | - 'name' => 'Plugin Name', | |
| 97 | - 'version' => 'Version', | |
| 98 | - 'url' => 'Plugin URI', | |
| 99 | - 'author' => 'Author', | |
| 100 | - 'email' => 'Author Email', | |
| 101 | - ]; | |
| 102 | - $plugin_data = get_file_data( __FILE__, $data, false ); | |
| 103 | - $plugin_data['data'] = str_replace( ' ', '-', $plugin_data['name'] ); | |
| 104 | - | |
| 105 | - return $plugin_data[ $show ] ?? ''; | |
| 106 | - } | |
| 107 | - | |
| 108 | 97 | /** |
| 109 | 98 | * Include required files. |
| 110 | 99 | * |
| 111 | 100 | * @access private |
| @@ -111,10 +100,12 @@ | ||
| 111 | 100 | * @access private |
| 112 | 101 | * @since 1.0 |
| 113 | 102 | */ |
| 114 | 103 | private function includes(): void { |
| 115 | - require_once self::dir() . 'includes/safe-mode.php'; | |
| 116 | - require_once self::dir() . 'includes/snippets.php'; | |
| 104 | + if ( ! class_exists( 'Wow_Company' ) ) { | |
| 105 | + require_once self::dir() . 'includes/class-wow-company.php'; | |
| 106 | + } | |
| 107 | + | |
| 117 | 108 | require_once self::dir() . 'classes/Autoloader.php'; |
| 118 | 109 | require_once self::dir() . 'includes/class-wowp-dashboard.php'; |
| 119 | 110 | require_once self::dir() . 'includes/class-wowp-public.php'; |
| 120 | 111 | } |
| @@ -128,9 +119,9 @@ | ||
| 128 | 119 | * @access protected |
| 129 | 120 | */ |
| 130 | 121 | public function __clone() { |
| 131 | 122 | // Cloning instances of the class is forbidden. |
| 132 | - _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin’ huh?', 'wp-coder' ), '1.0' ); | |
| 123 | + _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin’ huh?', 'wpcoder' ), '1.0' ); | |
| 133 | 124 | } |
| 134 | 125 | |
| 135 | 126 | /** |
| 136 | 127 | * Disable unserializing of the class. |
| @@ -139,9 +130,9 @@ | ||
| 139 | 130 | * @access protected |
| 140 | 131 | */ |
| 141 | 132 | public function __wakeup() { |
| 142 | 133 | // Unserializing instances of the class is forbidden. |
| 143 | - _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin’ huh?', 'wp-coder' ), '1.0' ); | |
| 134 | + _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin’ huh?', 'wpcoder' ), '1.0' ); | |
| 144 | 135 | } |
| 145 | 136 | |
| 146 | 137 | public function plugin_activate(): void { |
| 147 | 138 | $columns = " |
| @@ -149,30 +140,21 @@ | ||
| 149 | 140 | title VARCHAR(200) NOT NULL, |
| 150 | 141 | html_code LONGTEXT, |
| 151 | 142 | css_code LONGTEXT, |
| 152 | 143 | js_code LONGTEXT, |
| 153 | - php_code LONGTEXT, | |
| 154 | 144 | param LONGTEXT, |
| 155 | 145 | status BOOLEAN, |
| 156 | 146 | mode BOOLEAN, |
| 157 | 147 | tag TEXT, |
| 158 | - php_include int(11) NOT NULL DEFAULT '0', | |
| 159 | - UNIQUE KEY id (id), | |
| 160 | - INDEX id_index (id) | |
| 148 | + UNIQUE KEY id (id) | |
| 161 | 149 | "; |
| 162 | - | |
| 163 | - | |
| 164 | 150 | DBManager::create( $columns ); |
| 165 | 151 | FolderManager::create(); |
| 166 | - update_option( self::PREFIX . '_db_version', '4.0' ); | |
| 167 | 152 | |
| 168 | 153 | include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 169 | 154 | if ( is_plugin_active( 'wp-coder-pro/wp-coder-pro.php' ) ) { |
| 170 | 155 | deactivate_plugins( 'wp-coder-pro/wp-coder-pro.php' ); |
| 171 | 156 | } |
| 172 | - if ( is_plugin_active( 'wpcoderpro/wpcoderpro.php' ) ) { | |
| 173 | - deactivate_plugins( 'wpcoderpro/wpcoderpro.php' ); | |
| 174 | - } | |
| 175 | 157 | } |
| 176 | 158 | |
| 177 | 159 | /** |
| 178 | 160 | * Download the folder with languages. |
| @@ -180,19 +162,20 @@ | ||
| 180 | 162 | * @access Publisher |
| 181 | 163 | * @return void |
| 182 | 164 | */ |
| 183 | 165 | public function loaded(): void { |
| 184 | - new WPCoder_Block(); | |
| 185 | - UpdateDB::init(); | |
| 186 | 166 | $languages_folder = dirname( plugin_basename( __FILE__ ) ) . '/languages/'; |
| 187 | - load_plugin_textdomain( 'wp-coder', false, $languages_folder ); | |
| 167 | + load_plugin_textdomain( 'wpcoder', false, $languages_folder ); | |
| 188 | 168 | } |
| 189 | 169 | |
| 170 | + public function update(): void { | |
| 171 | + UpdateDB::init(); | |
| 172 | + } | |
| 190 | 173 | } |
| 191 | 174 | |
| 192 | 175 | endif; |
| 193 | 176 | |
| 194 | -function wp_coder_run() { | |
| 195 | - return WPCoder::instance(); | |
| 177 | +function wow_plugin_run() { | |
| 178 | + return WOW_Plugin::instance(); | |
| 196 | 179 | } |
| 197 | 180 | |
| 198 | -wp_coder_run(); | |
| 181 | +wow_plugin_run(); | |