Processors
4 years ago
StartTime
4 years ago
AdminMenu.php
6 years ago
AssetsLoader.php
4 years ago
DPTAjaxHandler.php
6 years ago
DSTemplateLoader.php
4 years ago
DailyShortCode.php
6 years ago
DigitalScreen.php
4 years ago
HijriDate.php
7 years ago
Init.php
6 years ago
MonthlyShortCode.php
4 years ago
MonthlyTimeTable.php
6 years ago
Shortcodes.php
6 years ago
UpdateStyles.php
7 years ago
Validator.php
4 years ago
db.php
4 years ago
dptWidget.php
4 years ago
AssetsLoader.php
59 lines
| 1 | <?php |
| 2 | class AssetsLoader |
| 3 | { |
| 4 | public function __construct() |
| 5 | { |
| 6 | add_action( 'admin_enqueue_scripts', array( $this, 'load_admin_scripts' ) ); |
| 7 | $this->add_scripts(); |
| 8 | $this->add_stylesheet(); |
| 9 | } |
| 10 | |
| 11 | function load_admin_scripts($hook) |
| 12 | { |
| 13 | if ($hook == 'toplevel_page_dpt') { |
| 14 | wp_enqueue_script('dpt-admin', plugins_url( '../Assets/js/dpt-admin.js', __FILE__ ), array( 'jquery' ), DailyPrayerTime::VERSION); |
| 15 | wp_enqueue_script( 'dpt_bootstrap_js', plugins_url( '../Assets/js/bootstrap.min-5.0.2.js', __FILE__ ), array( 'jquery' ), DailyPrayerTime::VERSION); |
| 16 | |
| 17 | wp_register_style( 'dpt_bootstrap', plugins_url('../Assets/css/bootstrap.min-5.0.2.css', __FILE__), array(), DailyPrayerTime::VERSION ); |
| 18 | wp_enqueue_style( 'dpt_bootstrap' ); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | private function add_scripts() |
| 23 | { |
| 24 | $path = plugin_dir_url( __FILE__ ); // I am in Models |
| 25 | |
| 26 | wp_enqueue_script( 'dpt',$path. '../Assets/js/dpt.js', array( 'jquery' ), DailyPrayerTime::VERSION, true ); |
| 27 | |
| 28 | $protocol = isset( $_SERVER['HTTPS'] ) ? 'https://' : 'http://'; |
| 29 | $params = array( |
| 30 | 'ajaxurl' => admin_url( 'admin-ajax.php', $protocol ), |
| 31 | ); |
| 32 | |
| 33 | // bootstrap js from CDN |
| 34 | wp_enqueue_script( 'dpt_popper_js', plugins_url( '../Assets/js/popper.min-1.12.9.js', __FILE__ ), array( 'jquery' ), DailyPrayerTime::VERSION); |
| 35 | wp_enqueue_script("jquery-ui-tabs"); |
| 36 | wp_enqueue_script( 'jquery-ui-dialog' ); |
| 37 | wp_enqueue_script("jquery-cookie", plugins_url( '../Assets/js/jquery.cookie.min-1.4.1.js', __FILE__ ), array( 'jquery' ), DailyPrayerTime::VERSION ); |
| 38 | wp_enqueue_script("jquery-blockUI", plugins_url( '../Assets/js/jquery.blockUI-2.70.js', __FILE__ ), array( 'jquery' ), DailyPrayerTime::VERSION ); |
| 39 | |
| 40 | // Print the script to our page |
| 41 | wp_localize_script( 'dpt', 'timetable_params', $params ); |
| 42 | } |
| 43 | |
| 44 | private function add_stylesheet() { |
| 45 | wp_register_style( 'timetable-style', plugins_url('../Assets/css/styles.css', __FILE__), array(), DailyPrayerTime::VERSION ); |
| 46 | wp_enqueue_style( 'timetable-style' ); |
| 47 | |
| 48 | wp_register_style( 'verge-style', plugins_url('../Assets/css/vergestyles.css', __FILE__) ); |
| 49 | wp_enqueue_style( 'verge-style' ); |
| 50 | |
| 51 | wp_register_style( 'jquery-ui_css', plugins_url('../Assets/css/jquery-ui-1.12.1.css', __FILE__), array(), DailyPrayerTime::VERSION ); |
| 52 | wp_enqueue_style( 'jquery-ui_css' ); |
| 53 | |
| 54 | wp_register_style("bootstrap-select", plugins_url('../Assets/css/bootstrap-select.min-1.13.14.css', __FILE__), array(), DailyPrayerTime::VERSION ); |
| 55 | wp_enqueue_style("bootstrap-select"); |
| 56 | |
| 57 | new UpdateStyles('timetable-style'); |
| 58 | } |
| 59 | } |