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