| @@ -1,13 +1,12 @@ | ||
| 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: 3.2.1 | |
| 7 | - * Author: WPCoder | |
| 8 | - * Author URI: https://wpcoder.pro | |
| 9 | - * Author Email: dev@wpcoder.pro | |
| 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 | 11 | * Text Domain: wpcoder |
| 13 | 12 | * Requires at least: 5.4 |
| @@ -22,12 +21,19 @@ | ||
| 22 | 21 | use WPCoder\Update\UpdateDB; |
| 23 | 22 | |
| 24 | 23 | defined( 'ABSPATH' ) || exit; |
| 25 | 24 | |
| 26 | -if ( ! class_exists( 'WPCoder' ) ) : | |
| 25 | +if ( ! class_exists( 'WOW_Plugin' ) ) : | |
| 27 | 26 | |
| 28 | - final class WPCoder { | |
| 27 | + final class WOW_Plugin { | |
| 29 | 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 | + | |
| 30 | 36 | // Plugin slug |
| 31 | 37 | public const SLUG = 'wp-coder'; |
| 32 | 38 | |
| 33 | 39 | // Plugin prefix |
| @@ -34,9 +40,9 @@ | ||
| 34 | 40 | public const PREFIX = 'wow_coder'; |
| 35 | 41 | |
| 36 | 42 | public const FOLDER = 'wp-coder'; |
| 37 | 43 | |
| 38 | - public const SHORTCODE = 'wp_code'; | |
| 44 | + public const SHORTCODE = 'WP-Coder'; | |
| 39 | 45 | |
| 40 | 46 | // Plugin ULR |
| 41 | 47 | public const PluginURL = 'https://wordpress.org/plugins/wp-coder/'; |
| 42 | 48 | |
| @@ -48,12 +54,11 @@ | ||
| 48 | 54 | /** |
| 49 | 55 | * @var Wow_Dashboard |
| 50 | 56 | */ |
| 51 | 57 | private $dashboard; |
| 52 | - private $public; | |
| 53 | 58 | |
| 54 | - public static function instance(): WPCoder { | |
| 55 | - 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 ) ) { | |
| 56 | 61 | self::$instance = new self; |
| 57 | 62 | |
| 58 | 63 | self::$instance->includes(); |
| 59 | 64 | self::$instance->autoloader = new Autoloader( 'WPCoder' ); |
| @@ -59,11 +64,11 @@ | ||
| 59 | 64 | self::$instance->autoloader = new Autoloader( 'WPCoder' ); |
| 60 | 65 | self::$instance->dashboard = new WOWP_Dashboard(); |
| 61 | 66 | self::$instance->public = new WOWP_Public(); |
| 62 | 67 | |
| 63 | - | |
| 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 | - | |
| 104 | - return $plugin_data[ $show ] ?? ''; | |
| 105 | - | |
| 106 | - } | |
| 107 | - | |
| 108 | 97 | /** |
| 109 | 98 | * Include required files. |
| 110 | 99 | * |
| 111 | 100 | * @access private |
| @@ -111,9 +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'; | |
| 104 | + if ( ! class_exists( 'Wow_Company' ) ) { | |
| 105 | + require_once self::dir() . 'includes/class-wow-company.php'; | |
| 106 | + } | |
| 107 | + | |
| 116 | 108 | require_once self::dir() . 'classes/Autoloader.php'; |
| 117 | 109 | require_once self::dir() . 'includes/class-wowp-dashboard.php'; |
| 118 | 110 | require_once self::dir() . 'includes/class-wowp-public.php'; |
| 119 | 111 | } |
| @@ -142,20 +134,27 @@ | ||
| 142 | 134 | _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin’ huh?', 'wpcoder' ), '1.0' ); |
| 143 | 135 | } |
| 144 | 136 | |
| 145 | 137 | public function plugin_activate(): void { |
| 146 | - DBManager::create(); | |
| 138 | + $columns = " | |
| 139 | + id mediumint(9) NOT NULL AUTO_INCREMENT, | |
| 140 | + title VARCHAR(200) NOT NULL, | |
| 141 | + html_code LONGTEXT, | |
| 142 | + css_code LONGTEXT, | |
| 143 | + js_code LONGTEXT, | |
| 144 | + param LONGTEXT, | |
| 145 | + status BOOLEAN, | |
| 146 | + mode BOOLEAN, | |
| 147 | + tag TEXT, | |
| 148 | + UNIQUE KEY id (id) | |
| 149 | + "; | |
| 150 | + DBManager::create( $columns ); | |
| 147 | 151 | FolderManager::create(); |
| 148 | - update_option( self::PREFIX . '_db_version', '3.2' ); | |
| 149 | 152 | |
| 150 | 153 | include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 151 | 154 | if ( is_plugin_active( 'wp-coder-pro/wp-coder-pro.php' ) ) { |
| 152 | 155 | deactivate_plugins( 'wp-coder-pro/wp-coder-pro.php' ); |
| 153 | 156 | } |
| 154 | - if ( is_plugin_active( 'wpcoderpro/wpcoderpro.php' ) ) { | |
| 155 | - deactivate_plugins( 'wpcoderpro/wpcoderpro.php' ); | |
| 156 | - } | |
| 157 | - | |
| 158 | 157 | } |
| 159 | 158 | |
| 160 | 159 | /** |
| 161 | 160 | * Download the folder with languages. |
| @@ -163,18 +162,20 @@ | ||
| 163 | 162 | * @access Publisher |
| 164 | 163 | * @return void |
| 165 | 164 | */ |
| 166 | 165 | public function loaded(): void { |
| 167 | - UpdateDB::init(); | |
| 168 | 166 | $languages_folder = dirname( plugin_basename( __FILE__ ) ) . '/languages/'; |
| 169 | 167 | load_plugin_textdomain( 'wpcoder', false, $languages_folder ); |
| 170 | 168 | } |
| 171 | 169 | |
| 170 | + public function update(): void { | |
| 171 | + UpdateDB::init(); | |
| 172 | + } | |
| 172 | 173 | } |
| 173 | 174 | |
| 174 | 175 | endif; |
| 175 | 176 | |
| 176 | -function wp_coder_run() { | |
| 177 | - return WPCoder::instance(); | |
| 177 | +function wow_plugin_run() { | |
| 178 | + return WOW_Plugin::instance(); | |
| 178 | 179 | } |
| 179 | 180 | |
| 180 | -wp_coder_run(); | |
| 181 | +wow_plugin_run(); | |