PluginProbe
WP Coder – Insert & Manage Code Snippets / 2.3.2
WP Coder – Insert & Manage Code Snippets v2.3.2
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 +116 -177 3.02.3.2 View file →
@@ -1,177 +1,116 @@
1 -<?php
2 -/**
3 - * Plugin Name: WP Coder
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/
9 - * License: GPL-2.0+
10 - * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
11 - * Text Domain: wpcoder
12 - * Requires at least: 5.4
13 - * Requires PHP: 7.4
14 - */
15 -
16 -namespace WPCoder;
17 -
18 -// Exit if accessed directly.
19 -use WPCoder\Dashboard\DBManager;
20 -use WPCoder\Dashboard\FolderManager;
21 -use WPCoder\Update\UpdateDB;
22 -
23 -defined( 'ABSPATH' ) || exit;
24 -
25 -if ( ! class_exists( 'WOW_Plugin' ) ) :
26 -
27 - final class WOW_Plugin {
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';
35 -
36 - // Plugin slug
37 - public const SLUG = 'wp-coder';
38 -
39 - // Plugin prefix
40 - public const PREFIX = 'wow_coder';
41 -
42 - public const FOLDER = 'wp-coder';
43 -
44 - public const SHORTCODE = 'WP-Coder';
45 -
46 - // Plugin ULR
47 - public const PluginURL = 'https://wordpress.org/plugins/wp-coder/';
48 -
49 - private static $instance;
50 - /**
51 - * @var Autoloader
52 - */
53 - private $autoloader;
54 - /**
55 - * @var Wow_Dashboard
56 - */
57 - private $dashboard;
58 -
59 - public static function instance(): WOW_Plugin {
60 - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WOW_Plugin ) ) {
61 - self::$instance = new self;
62 -
63 - self::$instance->includes();
64 - self::$instance->autoloader = new Autoloader( 'WPCoder' );
65 - self::$instance->dashboard = new WOWP_Dashboard();
66 - self::$instance->public = new WOWP_Public();
67 -
68 - register_activation_hook( __FILE__, [ self::$instance, 'plugin_activate' ] );
69 - add_action( 'plugins_loaded', [ self::$instance, 'loaded' ] );
70 - }
71 -
72 -
73 - return self::$instance;
74 - }
75 -
76 - // Plugin Root File.
77 - public static function file(): string {
78 - return __FILE__;
79 - }
80 -
81 - // Plugin Base Name.
82 - public static function basename(): string {
83 - return plugin_basename( __FILE__ );
84 - }
85 -
86 - // Plugin Folder Path.
87 - public static function dir(): string {
88 - return plugin_dir_path( __FILE__ );
89 - }
90 -
91 - // Plugin Folder URL.
92 - public static function url(): string {
93 - return plugin_dir_url( __FILE__ );
94 - }
95 -
96 - /**
97 - * Include required files.
98 - *
99 - * @access private
100 - * @since 1.0
101 - */
102 - private function includes(): void {
103 - if ( ! class_exists( 'Wow_Company' ) ) {
104 - require_once self::dir() . 'includes/class-wow-company.php';
105 - }
106 -
107 - require_once self::dir() . 'classes/Autoloader.php';
108 - require_once self::dir() . 'includes/class-wowp-dashboard.php';
109 - require_once self::dir() . 'includes/class-wowp-public.php';
110 - }
111 -
112 - /**
113 - * Throw error on object clone.
114 - * The whole idea of the singleton design pattern is that there is a single
115 - * object therefore, we don't want the object to be cloned.
116 - *
117 - * @return void
118 - * @access protected
119 - */
120 - public function __clone() {
121 - // Cloning instances of the class is forbidden.
122 - _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'wpcoder' ), '1.0' );
123 - }
124 -
125 - /**
126 - * Disable unserializing of the class.
127 - *
128 - * @return void
129 - * @access protected
130 - */
131 - public function __wakeup() {
132 - // Unserializing instances of the class is forbidden.
133 - _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'wpcoder' ), '1.0' );
134 - }
135 -
136 - public function plugin_activate(): void {
137 - $columns = "
138 - id mediumint(9) NOT NULL AUTO_INCREMENT,
139 - title VARCHAR(200) NOT NULL,
140 - html_code LONGTEXT,
141 - css_code LONGTEXT,
142 - js_code LONGTEXT,
143 - param LONGTEXT,
144 - status BOOLEAN,
145 - mode BOOLEAN,
146 - tag TEXT,
147 - UNIQUE KEY id (id)
148 - ";
149 - DBManager::create( $columns );
150 - FolderManager::create();
151 -
152 - include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
153 - if ( is_plugin_active( 'wp-coder-pro/wp-coder-pro.php' ) ) {
154 - deactivate_plugins( 'wp-coder-pro/wp-coder-pro.php' );
155 - }
156 - }
157 -
158 - /**
159 - * Download the folder with languages.
160 - *
161 - * @access Publisher
162 - * @return void
163 - */
164 - public function loaded(): void {
165 - UpdateDB::init();
166 - $languages_folder = dirname( plugin_basename( __FILE__ ) ) . '/languages/';
167 - load_plugin_textdomain( 'wpcoder', false, $languages_folder );
168 - }
169 - }
170 -
171 -endif;
172 -
173 -function wow_plugin_run() {
174 - return WOW_Plugin::instance();
175 -}
176 -
177 -wow_plugin_run();
1 +<?php
2 + /**
3 + * Plugin Name: WP Coder
4 + * Plugin URI: https://wordpress.org/plugins/wp-coder/
5 + * Description: Add custom CSS, HTML, JavaScript on your website page
6 + * Version: 2.3.2
7 + * Author: Wow-Company
8 + * Author URI: https://wow-estore.com/
9 + * License: GPL-2.0+
10 + * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
11 + * Text Domain: wpcoder
12 + */
13 +
14 + namespace wpcoder;
15 +
16 + if ( ! defined( 'ABSPATH' ) ) exit;
17 +
18 +
19 + if( !class_exists( 'Wow_Plugin_Class' ) ) {
20 +
21 + final class Wow_Plugin_Class {
22 +
23 + private static $instance;
24 +
25 + const PREF = 'coder';
26 +
27 + public static function instance() {
28 +
29 + if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Wow_Plugin_Class ) ) {
30 +
31 + $info = array(
32 + 'plugin_name' => 'WP Coder',
33 + 'plugin_menu' => 'WP Coder',
34 + 'plugin_home_url' => 'https://wordpress.org/plugins/wp-coder/',
35 + 'plugin_version' => '2.3.2',
36 + 'plugin_file' => basename( __FILE__ ),
37 + 'plugin_slug' => dirname( plugin_basename( __FILE__ ) ),
38 + 'plugin_dir' => plugin_dir_path( __FILE__ ),
39 + 'plugin_url' => plugin_dir_url( __FILE__ ),
40 + 'plugin_pref' => self::PREF,
41 + 'author_url' => 'https://wow-estore.com',
42 + 'pro_url' => 'https://wow-estore.com/item/wp-coder-extension/',
43 + 'shortcode' => 'WP-Coder',
44 + );
45 +
46 + self::$instance = new Wow_Plugin_Class;
47 +
48 + register_activation_hook( __FILE__, array( self::$instance, 'plugin_activate' ) );
49 + register_deactivation_hook( __FILE__, array( self::$instance, 'plugin_deactivate' ) );
50 +
51 + add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
52 +
53 + add_action('admin_init', array( self::$instance, 'create_field') );
54 +
55 + self::$instance->includes();
56 +
57 + self::$instance->admin = new Wow_Admin_Class( $info );
58 + self::$instance->public = new Wow_Public_Class( $info );
59 +
60 +
61 + }
62 + return self::$instance;
63 + }
64 +
65 + public function __clone() {
66 + // Cloning instances of the class is forbidden.
67 + _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'wpcoder' ), '1.0' );
68 + }
69 +
70 + public function __wakeup() {
71 + // Unserializing instances of the class is forbidden.
72 + _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'wpcoder' ), '1.0' );
73 + }
74 +
75 +
76 + private function includes() {
77 + require_once plugin_dir_path( __FILE__ ) . 'includes/class-js-packer.php';
78 + require_once plugin_dir_path( __FILE__ ) . 'includes/class-db-update.php';
79 + require_once plugin_dir_path( __FILE__ ) . 'admin/class-admin.php';
80 + require_once plugin_dir_path( __FILE__ ) . 'public/class-public.php';
81 + }
82 +
83 + public function plugin_activate() {
84 + $field = dirname( plugin_basename( __FILE__ ) );
85 + require_once plugin_dir_path( __FILE__ ) . 'includes/activator.php';
86 + }
87 + public function plugin_deactivate() {
88 + require_once plugin_dir_path( __FILE__ ) . 'includes/deactivator.php';
89 + }
90 +
91 + public function create_field() {
92 + if( get_option( 'wp_coder_create_field') === false ) {
93 + $upload = wp_upload_dir();
94 + $field = dirname( plugin_basename( __FILE__ ) );
95 + $basedir = $upload['basedir'] . '/' . $field . '/';
96 + if ( !file_exists( $basedir ) ) {
97 + wp_mkdir_p( $basedir );
98 + }
99 + update_option( 'wp_coder_create_field', '2.0' );
100 + }
101 + }
102 +
103 + public function load_textdomain() {
104 + load_plugin_textdomain( self::PREF, FALSE, dirname( plugin_basename(__FILE__) ).'/languages/' );
105 + }
106 +
107 + }
108 +
109 + }
110 +
111 + function wow_plugin_run() {
112 + return Wow_Plugin_Class::instance();
113 + }
114 +
115 + // Get Running.
116 + wow_plugin_run();