PluginProbe
Hostinger Tools / 1.9.1
Hostinger Tools v1.9.1
3.0.77 3.0.76 3.0.75 3.0.74 3.0.73 3.0.72 3.0.71 3.0.70 3.0.69 3.0.68 3.0.67 3.0.66 1.8.1 1.8.2 1.8.3 1.9.1 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.4 All 108 releases
hostinger / includes / admin / class-hostinger-admin-assets.php

class-hostinger-admin-assets.php in Hostinger Tools 1.9.1, at includes/admin/class-hostinger-admin-assets.php

36 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 class Hostinger_Admin_Assets {
8 public function __construct() {
9 add_action( 'admin_enqueue_scripts', [ $this, 'admin_styles' ] );
10 add_action( 'admin_enqueue_scripts', [ $this, 'admin_scripts' ] );
11 }
12
13 public function admin_styles(): void {
14 $helper = new Hostinger_Helper();
15 wp_enqueue_style( 'hostinger_main_styles', HOSTINGER_ASSETS_URL . '/css/main.css', [], HOSTINGER_VERSION );
16
17 if( $helper->is_preview_domain() && is_user_logged_in() ) {
18 wp_enqueue_style( 'hostinger-preview-styles', HOSTINGER_ASSETS_URL . '/css/hts-preview.css', [], HOSTINGER_VERSION );
19 }
20 }
21
22 public function admin_scripts(): void {
23 wp_enqueue_script( 'hostinger_main_scripts', HOSTINGER_ASSETS_URL . '/js/main.js', array( 'jquery', 'wp-i18n' ), HOSTINGER_VERSION, false );
24
25 if ( ! empty( Hostinger_Helper::get_api_token() ) ) {
26 wp_enqueue_script( 'hostinger_requests_scripts', HOSTINGER_ASSETS_URL . '/js/requests.js', array( 'jquery', 'wp-i18n' ), HOSTINGER_VERSION, false );
27 wp_localize_script('hostinger_requests_scripts', 'ajax_var', array(
28 'url' => admin_url('admin-ajax.php'),
29 'nonce' => wp_create_nonce('hts-ajax-nonce')
30 ));
31 }
32 }
33 }
34
35 new Hostinger_Admin_Assets();
36