| 1 |
<?php |
| 2 |
|
| 3 |
namespace WP_Social; |
| 4 |
|
| 5 |
defined('ABSPATH') || exit; |
| 6 |
|
| 7 |
class Plugin { |
| 8 |
|
| 9 |
private static $instance; |
| 10 |
|
| 11 |
|
| 12 |
public static function instance() { |
| 13 |
if(!self::$instance) { |
| 14 |
self::$instance = new static(); |
| 15 |
} |
| 16 |
|
| 17 |
return self::$instance; |
| 18 |
} |
| 19 |
|
| 20 |
public function __construct() { |
| 21 |
|
| 22 |
} |
| 23 |
|
| 24 |
public function enqueue() { |
| 25 |
|
| 26 |
add_action( 'admin_enqueue_scripts', [$this, 'load_admin_scripts'] ); |
| 27 |
|
| 28 |
add_action( 'wp_enqueue_scripts', [$this, 'load_public_scripts'] ); |
| 29 |
} |
| 30 |
|
| 31 |
|
| 32 |
public function load_admin_scripts() { |
| 33 |
|
| 34 |
wp_register_script( 'xs_login_custom_js1', WSLU_LOGIN_PLUGIN_URL. 'assets/js/admin-login-custom.js', array('jquery')); |
| 35 |
wp_register_script( 'xs_login_custom_js2', WSLU_LOGIN_PLUGIN_URL. 'assets/js/admin-main.js', array('jquery', 'jquery-ui-sortable')); |
| 36 |
|
| 37 |
wp_localize_script('xs_login_custom_js1', 'rest_api_conf', array( |
| 38 |
'siteurl' => get_option('siteurl'), |
| 39 |
'nonce' => wp_create_nonce('wp_rest'), |
| 40 |
'root' => get_rest_url(), |
| 41 |
)); |
| 42 |
|
| 43 |
wp_enqueue_script( 'xs_login_custom_js1' ); |
| 44 |
wp_enqueue_script( 'xs_login_custom_js2' ); |
| 45 |
|
| 46 |
|
| 47 |
wp_register_style( 'xs_login_custom_css1', WSLU_LOGIN_PLUGIN_URL. 'assets/css/admin-login-custom.css'); |
| 48 |
wp_register_style( 'xs_login_custom_css_icon', WSLU_LOGIN_PLUGIN_URL. 'assets/css/font-icon.css'); |
| 49 |
wp_register_style( 'xs_login_custom_css2', WSLU_LOGIN_PLUGIN_URL. 'assets/css/admin-style.css'); |
| 50 |
wp_register_style( 'xs_login_custom_css3', WSLU_LOGIN_PLUGIN_URL. 'assets/css/admin-responsive.css'); |
| 51 |
wp_enqueue_style( 'xs_login_custom_css1' ); |
| 52 |
wp_enqueue_style( 'xs_login_custom_css2' ); |
| 53 |
wp_enqueue_style( 'xs_login_custom_css3' ); |
| 54 |
wp_enqueue_style( 'xs_login_custom_css_icon' ); |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
public function load_public_scripts() { |
| 59 |
|
| 60 |
wp_register_script( 'xs_social_custom', WSLU_LOGIN_PLUGIN_URL. 'assets/js/social-front.js', array('jquery')); |
| 61 |
|
| 62 |
wp_localize_script('xs_social_custom', 'rest_api_conf', array( |
| 63 |
'siteurl' => get_option('siteurl'), |
| 64 |
'nonce' => wp_create_nonce('wp_rest'), |
| 65 |
'root' => get_rest_url(), |
| 66 |
)); |
| 67 |
|
| 68 |
wp_enqueue_script( 'xs_social_custom' ); |
| 69 |
|
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
} |