| 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’ huh?', 'wpcoder' ), '1.0' ); |
| 68 |
} |
| 69 |
|
| 70 |
public function __wakeup() { |
| 71 |
// Unserializing instances of the class is forbidden. |
| 72 |
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ 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(); |