Hijri
3 years ago
Processors
1 month ago
QuranADay
2 months ago
StartTime
1 year ago
design
1 month ago
AdminMenu.php
2 years ago
AssetsLoader.php
1 year ago
CustomPluginSettings.php
4 years ago
DPTAjaxHandler.php
4 years ago
DPTHelper.php
1 month ago
DSTemplateLoader.php
2 years ago
DailyShortCode.php
2 months ago
DigitalScreen.php
1 month ago
HijriDate.php
3 years ago
Init.php
4 years ago
MonthlyShortCode.php
2 years ago
MonthlyTimeTable.php
3 years ago
Shortcodes.php
2 months ago
Translator.php
4 years ago
UpdateStyles.php
1 month ago
Validator.php
3 years ago
db.php
2 months ago
dptWidget.php
4 years ago
AssetsLoader.php
69 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' ), DPT_PLUGIN_VERSION); |
| 15 | wp_enqueue_script( 'dpt_bootstrap_js', plugins_url( '../Assets/js/bootstrap.bundle.min.js', __FILE__ ), array( 'jquery' ), DPT_PLUGIN_VERSION); |
| 16 | wp_enqueue_script( 'bs_select_js', plugins_url( '../Assets/js/bootstrap-select.min.js', __FILE__ ), array( 'jquery' ), DPT_PLUGIN_VERSION); |
| 17 | |
| 18 | wp_register_style( 'dpt_bootstrap', plugins_url('../Assets/css/bootstrap.min.css', __FILE__), array(), DPT_PLUGIN_VERSION ); |
| 19 | wp_enqueue_style( 'dpt_bootstrap' ); |
| 20 | |
| 21 | wp_register_style( 'bs_select_css', plugins_url('../Assets/css/bootstrap-select.min.css', __FILE__), array(), DPT_PLUGIN_VERSION ); |
| 22 | wp_enqueue_style( 'bs_select_css' ); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | private function add_scripts() |
| 27 | { |
| 28 | $path = plugin_dir_url( __FILE__ ); // I am in Models |
| 29 | |
| 30 | wp_enqueue_script( 'dpt',$path. '../Assets/js/dpt.js', array( 'jquery' ), DPT_PLUGIN_VERSION, true ); |
| 31 | |
| 32 | $protocol = isset( $_SERVER['HTTPS'] ) ? 'https://' : 'http://'; |
| 33 | $params = array( |
| 34 | 'ajaxurl' => admin_url( 'admin-ajax.php', $protocol ), |
| 35 | 'fajrAdhanUrl' => get_option('fajrAdhanUrl') ?? plugins_url( '../Assets/sounds/fajr.mp3', __FILE__ ), |
| 36 | 'otherAdhanUrl' =>get_option('otherAdhanUrl') ?? plugins_url( '../Assets/sounds/adhan.mp3', __FILE__ ), |
| 37 | 'beep' => plugins_url( '../Assets/sounds/beep.mp3', __FILE__ ), |
| 38 | ); |
| 39 | |
| 40 | |
| 41 | wp_enqueue_script( 'dpt_popper_js', plugins_url( '../Assets/js/popper.min-1.12.9.js', __FILE__ ), array( 'jquery' ), DPT_PLUGIN_VERSION); |
| 42 | wp_enqueue_script("jquery-ui-tabs"); |
| 43 | wp_enqueue_script( 'jquery-ui-dialog' ); |
| 44 | wp_enqueue_script("jquery-cookie", plugins_url( '../Assets/js/jquery.cookie.min-1.4.1.js', __FILE__ ), array( 'jquery' ), DPT_PLUGIN_VERSION ); |
| 45 | wp_enqueue_script("jquery-blockUI", plugins_url( '../Assets/js/jquery.blockUI-2.70.js', __FILE__ ), array( 'jquery' ), DPT_PLUGIN_VERSION ); |
| 46 | wp_enqueue_script("jquery-marquee", plugins_url( '../Assets/js/jquery.marquee.min.js', __FILE__ ), array( 'jquery' ), DPT_PLUGIN_VERSION ); |
| 47 | wp_enqueue_script("dpt-noSleep", plugins_url( '../Assets/js/NoSleep.min.js', __FILE__ ), array( 'jquery' ), DPT_PLUGIN_VERSION ); |
| 48 | wp_enqueue_script("dpt-iconify", plugins_url( '../Assets/js/iconify.min.js', __FILE__ ), array( 'jquery' ), DPT_PLUGIN_VERSION ); |
| 49 | |
| 50 | // Print the script to our page |
| 51 | wp_localize_script( 'dpt', 'timetable_params', $params ); |
| 52 | } |
| 53 | |
| 54 | private function add_stylesheet() { |
| 55 | wp_register_style( 'timetable-style', plugins_url('../Assets/css/styles.css', __FILE__), array(), DPT_PLUGIN_VERSION ); |
| 56 | wp_enqueue_style( 'timetable-style' ); |
| 57 | |
| 58 | wp_register_style( 'verge-style', plugins_url('../Assets/css/vergestyles.css', __FILE__), array(), DPT_PLUGIN_VERSION ); |
| 59 | wp_enqueue_style( 'verge-style' ); |
| 60 | |
| 61 | wp_register_style( 'jquery-ui_css', plugins_url('../Assets/css/jquery-ui-1.12.1.css', __FILE__), array(), DPT_PLUGIN_VERSION ); |
| 62 | wp_enqueue_style( 'jquery-ui_css' ); |
| 63 | |
| 64 | wp_register_style("bootstrap-select", plugins_url('../Assets/css/bootstrap-select.min-1.13.14.css', __FILE__), array(), DPT_PLUGIN_VERSION ); |
| 65 | wp_enqueue_style("bootstrap-select"); |
| 66 | |
| 67 | new UpdateStyles('timetable-style'); |
| 68 | } |
| 69 | } |