admin
5 years ago
register-hooks
7 years ago
class-wpel-front-ignore.php
7 years ago
class-wpel-front.php
5 years ago
class-wpel-link.php
7 years ago
class-wpel-linkhero.php
5 years ago
class-wpel-plugin.php
5 years ago
class-wpel-register-scripts.php
5 years ago
class-wpel-template-tags.php
7 years ago
class-wpel-update.php
5 years ago
index.php
6 years ago
class-wpel-register-scripts.php
100 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 | |
| 38 | // set style font awesome icons |
| 39 | wp_register_style( |
| 40 | 'font-awesome', |
| 41 | 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css', |
| 42 | array(), |
| 43 | $plugin_version |
| 44 | ); |
| 45 | |
| 46 | // front style |
| 47 | wp_register_style( |
| 48 | 'wpel-style', |
| 49 | plugins_url('/public/css/wpel.css', WPEL_Plugin::get_plugin_file()), |
| 50 | array(), |
| 51 | $plugin_version |
| 52 | ); |
| 53 | |
| 54 | // set admin style |
| 55 | wp_register_style( |
| 56 | 'wpel-admin-style', |
| 57 | plugins_url('/public/css/wpel-admin.css', WPEL_Plugin::get_plugin_file()), |
| 58 | array(), |
| 59 | $plugin_version |
| 60 | ); |
| 61 | |
| 62 | // set admin global style |
| 63 | wp_register_style( |
| 64 | 'wpel-admin-global-style', |
| 65 | plugins_url('/public/css/wpel-admin-global.css', WPEL_Plugin::get_plugin_file()), |
| 66 | array(), |
| 67 | $plugin_version |
| 68 | ); |
| 69 | |
| 70 | $linkhero = get_option('wpel-linkhero', array('checker' => array(), 'enabled' => false)); |
| 71 | if(!isset($linkhero['enabled'])){ |
| 72 | $linkhero['enabled'] = false; |
| 73 | } |
| 74 | $wpel_js = array( |
| 75 | 'nonce_ajax' => wp_create_nonce('wpel_run_tool'), |
| 76 | 'loader' => admin_url('/images/spinner.gif'), |
| 77 | 'link_checking_enabled' => false |
| 78 | ); |
| 79 | |
| 80 | $wpel_js['lh_url'] = WPEL_LinkHero::$lh_url; |
| 81 | |
| 82 | if(!WPEL_LinkHero::is_localhost()){ |
| 83 | $wpel_js['link_checking_enabled'] = $linkhero['enabled']; |
| 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 | |
| 99 | /*?>*/ |
| 100 |