| @@ -2,15 +2,15 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: WP Coder |
| 4 | 4 | * Plugin URI: https://wordpress.org/plugins/wp-coder/ |
| 5 | 5 | * Description: Adding custom HTML, CSS, JavaScript and PHP code to your WordPress site. |
| 6 | - * Version: 3.3 | |
| 6 | + * Version: 4.1 | |
| 7 | 7 | * Author: WPCoder |
| 8 | 8 | * Author URI: https://wpcoder.pro |
| 9 | - * Author Email: dev@wpcoder.pro | |
| 9 | + * Author Email: hey@wow-company.com | |
| 10 | 10 | * License: GPL-2.0+ |
| 11 | 11 | * License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 12 | - * Text Domain: wpcoder | |
| 12 | + * Text Domain: wp-coder | |
| 13 | 13 | * Requires at least: 5.4 |
| 14 | 14 | * Requires PHP: 7.4 |
| 15 | 15 | */ |
| 16 | 16 | |
| @@ -22,9 +22,9 @@ | ||
| 22 | 22 | use WPCoder\Update\UpdateDB; |
| 23 | 23 | |
| 24 | 24 | defined( 'ABSPATH' ) || exit; |
| 25 | 25 | |
| 26 | -if ( ! class_exists( 'WPCoder' ) ) : | |
| 26 | +if ( ! class_exists( 'wpcoder' ) ) : | |
| 27 | 27 | |
| 28 | 28 | final class WPCoder { |
| 29 | 29 | |
| 30 | 30 | // Plugin slug |
| @@ -59,9 +59,8 @@ | ||
| 59 | 59 | self::$instance->autoloader = new Autoloader( 'WPCoder' ); |
| 60 | 60 | self::$instance->dashboard = new WOWP_Dashboard(); |
| 61 | 61 | self::$instance->public = new WOWP_Public(); |
| 62 | 62 | |
| 63 | - | |
| 64 | 63 | register_activation_hook( __FILE__, [ self::$instance, 'plugin_activate' ] ); |
| 65 | 64 | add_action( 'plugins_loaded', [ self::$instance, 'loaded' ] ); |
| 66 | 65 | } |
| 67 | 66 | |
| @@ -99,11 +98,11 @@ | ||
| 99 | 98 | 'author' => 'Author', |
| 100 | 99 | 'email' => 'Author Email', |
| 101 | 100 | ]; |
| 102 | 101 | $plugin_data = get_file_data( __FILE__, $data, false ); |
| 102 | + $plugin_data['data'] = str_replace( ' ', '-', $plugin_data['name'] ); | |
| 103 | 103 | |
| 104 | 104 | return $plugin_data[ $show ] ?? ''; |
| 105 | - | |
| 106 | 105 | } |
| 107 | 106 | |
| 108 | 107 | /** |
| 109 | 108 | * Include required files. |
| @@ -112,8 +111,9 @@ | ||
| 112 | 111 | * @since 1.0 |
| 113 | 112 | */ |
| 114 | 113 | private function includes(): void { |
| 115 | 114 | require_once self::dir() . 'includes/safe-mode.php'; |
| 115 | + require_once self::dir() . 'includes/snippets.php'; | |
| 116 | 116 | require_once self::dir() . 'classes/Autoloader.php'; |
| 117 | 117 | require_once self::dir() . 'includes/class-wowp-dashboard.php'; |
| 118 | 118 | require_once self::dir() . 'includes/class-wowp-public.php'; |
| 119 | 119 | } |
| @@ -127,9 +127,9 @@ | ||
| 127 | 127 | * @access protected |
| 128 | 128 | */ |
| 129 | 129 | public function __clone() { |
| 130 | 130 | // Cloning instances of the class is forbidden. |
| 131 | - _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin’ huh?', 'wpcoder' ), '1.0' ); | |
| 131 | + _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin’ huh?', 'wp-coder' ), '1.0' ); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | 135 | * Disable unserializing of the class. |
| @@ -138,15 +138,32 @@ | ||
| 138 | 138 | * @access protected |
| 139 | 139 | */ |
| 140 | 140 | public function __wakeup() { |
| 141 | 141 | // Unserializing instances of the class is forbidden. |
| 142 | - _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin’ huh?', 'wpcoder' ), '1.0' ); | |
| 142 | + _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin’ huh?', 'wp-coder' ), '1.0' ); | |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | public function plugin_activate(): void { |
| 146 | - DBManager::create(); | |
| 146 | + $columns = " | |
| 147 | + id mediumint(9) NOT NULL AUTO_INCREMENT, | |
| 148 | + title VARCHAR(200) NOT NULL, | |
| 149 | + html_code LONGTEXT, | |
| 150 | + css_code LONGTEXT, | |
| 151 | + js_code LONGTEXT, | |
| 152 | + php_code LONGTEXT, | |
| 153 | + param LONGTEXT, | |
| 154 | + status BOOLEAN, | |
| 155 | + mode BOOLEAN, | |
| 156 | + tag TEXT, | |
| 157 | + php_include int(11) NOT NULL DEFAULT '0', | |
| 158 | + UNIQUE KEY id (id), | |
| 159 | + INDEX id_index (id) | |
| 160 | + "; | |
| 161 | + | |
| 162 | + | |
| 163 | + DBManager::create( $columns ); | |
| 147 | 164 | FolderManager::create(); |
| 148 | - update_option( self::PREFIX . '_db_version', '3.2' ); | |
| 165 | + update_option( self::PREFIX . '_db_version', '4.0' ); | |
| 149 | 166 | |
| 150 | 167 | include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 151 | 168 | if ( is_plugin_active( 'wp-coder-pro/wp-coder-pro.php' ) ) { |
| 152 | 169 | deactivate_plugins( 'wp-coder-pro/wp-coder-pro.php' ); |
| @@ -153,9 +170,8 @@ | ||
| 153 | 170 | } |
| 154 | 171 | if ( is_plugin_active( 'wpcoderpro/wpcoderpro.php' ) ) { |
| 155 | 172 | deactivate_plugins( 'wpcoderpro/wpcoderpro.php' ); |
| 156 | 173 | } |
| 157 | - | |
| 158 | 174 | } |
| 159 | 175 | |
| 160 | 176 | /** |
| 161 | 177 | * Download the folder with languages. |
| @@ -165,9 +181,9 @@ | ||
| 165 | 181 | */ |
| 166 | 182 | public function loaded(): void { |
| 167 | 183 | UpdateDB::init(); |
| 168 | 184 | $languages_folder = dirname( plugin_basename( __FILE__ ) ) . '/languages/'; |
| 169 | - load_plugin_textdomain( 'wpcoder', false, $languages_folder ); | |
| 185 | + load_plugin_textdomain( 'wp-coder', false, $languages_folder ); | |
| 170 | 186 | } |
| 171 | 187 | |
| 172 | 188 | } |
| 173 | 189 | |