admin
2 months ago
register-hooks
3 years ago
class-wpel-front-ignore.php
3 years ago
class-wpel-front.php
4 months ago
class-wpel-link.php
3 years ago
class-wpel-plugin.php
1 year ago
class-wpel-register-scripts.php
2 months ago
class-wpel-template-tags.php
3 years ago
class-wpel-update.php
3 years ago
index.php
6 years ago
class-wpel-register-scripts.php
98 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Class WPEL_Register_Scripts |
| 5 | * |
| 6 | * @package WPEL |
| 7 | * @category WordPress Plugin |
| 8 | * @version 2.3 |
| 9 | * @link https://www.webfactoryltd.com/ |
| 10 | * @license Dual licensed under the MIT and GPLv2+ licenses |
| 11 | */ |
| 12 | final class WPEL_Register_Scripts extends WPRun_Base_1x0x0 |
| 13 | { |
| 14 | |
| 15 | /** |
| 16 | * Action for "wp_enqueue_scripts" |
| 17 | */ |
| 18 | protected function action_wp_enqueue_scripts() |
| 19 | { |
| 20 | $this->register_scripts(); |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * Action for "admin_enqueue_scripts" |
| 25 | */ |
| 26 | protected function action_admin_enqueue_scripts() |
| 27 | { |
| 28 | $this->register_scripts(); |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Register styles and scripts |
| 33 | */ |
| 34 | protected function register_scripts() |
| 35 | { |
| 36 | $plugin_version = get_option('wpel-version'); |
| 37 | $pointers = get_option('wpel-pointers', array()); |
| 38 | |
| 39 | if(function_exists('get_current_screen')){ |
| 40 | $current_screen = get_current_screen(); |
| 41 | } |
| 42 | |
| 43 | if (isset($current_screen) && $current_screen->id != 'toplevel_page_wpel-settings-page' && $current_screen->id != 'settings_page_wpel-settings-page') { |
| 44 | if (empty($pointers['hide_welcome_pointer']) && current_user_can('administrator')) { |
| 45 | $pointers['_nonce_dismiss_pointer'] = wp_create_nonce('wpel_dismiss_notice'); |
| 46 | $pointers['welcome'] = array('target' => '#toplevel_page_wpel-settings-page', 'edge' => 'left', 'align' => 'right', 'content' => 'Thank you for installing the <b style="font-weight: 800;">WP External Links</b> plugin!<br>Open <a href="' . admin_url('admin.php?page=wpel-settings-page') . '">WP External Links</a> to manage your links, and configure settings.'); |
| 47 | |
| 48 | wp_enqueue_style('wp-pointer'); |
| 49 | |
| 50 | wp_enqueue_script('wpel-pointers', plugins_url('/public/js/wpel-pointers.js', WPEL_Plugin::get_plugin_file()), array('jquery'), get_option('wpel-version'), true); |
| 51 | wp_enqueue_script('wp-pointer'); |
| 52 | wp_localize_script('wp-pointer', 'wpel_pointers', $pointers); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // set style font awesome icons |
| 57 | wp_register_style( |
| 58 | 'wpel-font-awesome', |
| 59 | plugins_url('/public/css/font-awesome.min.css', WPEL_Plugin::get_plugin_file()), |
| 60 | array(), |
| 61 | $plugin_version |
| 62 | ); |
| 63 | |
| 64 | // front style |
| 65 | wp_register_style( |
| 66 | 'wpel-style', |
| 67 | plugins_url('/public/css/wpel.css', WPEL_Plugin::get_plugin_file()), |
| 68 | array(), |
| 69 | $plugin_version |
| 70 | ); |
| 71 | |
| 72 | // set admin style |
| 73 | wp_register_style( |
| 74 | 'wpel-admin-style', |
| 75 | plugins_url('/public/css/wpel-admin.css', WPEL_Plugin::get_plugin_file()), |
| 76 | array(), |
| 77 | $plugin_version |
| 78 | ); |
| 79 | |
| 80 | $wpel_js = array( |
| 81 | 'nonce_ajax' => wp_create_nonce('wpel_run_tool'), |
| 82 | 'wpcaptcha_install_url' => add_query_arg(array('action' => 'wpel_install_wpcaptcha', '_wpnonce' => wp_create_nonce('install_wpcaptcha'), 'rnd' => wp_rand()), admin_url('admin.php')), |
| 83 | 'loader' => admin_url('/images/spinner.gif') |
| 84 | ); |
| 85 | |
| 86 | // set wpel admin script |
| 87 | wp_register_script( |
| 88 | 'wpel-admin-script', |
| 89 | plugins_url('/public/js/wpel-admin.js', WPEL_Plugin::get_plugin_file()), |
| 90 | array('jquery'), |
| 91 | $plugin_version, |
| 92 | true |
| 93 | ); |
| 94 | |
| 95 | wp_localize_script('wpel-admin-script', 'wpel', $wpel_js); |
| 96 | } |
| 97 | } |
| 98 |