PluginProbe
Responsive Menu – Mobile Menu & Hamburger Menu Builder / 4.7.4
Responsive Menu – Mobile Menu & Hamburger Menu Builder v4.7.4
4.7.4 4.7.3 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.10 4.1.11 4.1.12 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 All 91 releases
responsive-menu / v4.0.0 / inc / classes / class-assets.php

class-assets.php in Responsive Menu – Mobile Menu & Hamburger Menu Builder 4.7.4, at v4.0.0/inc/classes/class-assets.php

210 lines 4.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Assets class.
4 *
5 * This class is responsible to load the resources as per page call.
6 *
7 * @since 4.0.0
8 * @author Expresstech System
9 * @package responsive_menu_pro
10 */
11
12 namespace RMP\Features\Inc;
13
14 use RMP\Features\Inc\Traits\Singleton;
15
16 // Disable the direct access to this class.
17 if ( ! defined( 'ABSPATH' ) ) {
18 exit;
19 }
20
21 /**
22 * Class Assets
23 */
24 class Assets {
25
26 use Singleton;
27
28 /**
29 * Construct method.
30 */
31 protected function __construct() {
32 $this->setup_hooks();
33 }
34
35 /**
36 * To setup action/filter.
37 *
38 * @return void
39 */
40 protected function setup_hooks() {
41 add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
42 add_action( 'admin_enqueue_scripts', array( $this, 'admin_custom_style_inline' ) );
43 add_action( 'admin_enqueue_scripts', array( $this, 'rmp_menu_editor_style_inline' ) );
44 }
45
46 /**
47 * Add custom css to manage headerbar extra padding.
48 *
49 * @since 4.0.1
50 */
51 public function rmp_menu_editor_style_inline() {
52 $editor = filter_input( INPUT_GET, 'editor', FILTER_SANITIZE_URL );
53 if ( ! empty( $editor ) && 'rmp_menu' === get_post_type() && current_user_can( 'administrator' ) ) {
54 $css_data = 'html.wp-toolbar {
55 margin: 0;
56 padding: 0 !important;
57 }';
58 wp_add_inline_style( 'rmp_admin_main_styles', $css_data );
59 }
60 }
61
62 /**
63 * Add custom css to manage size of admin menu logo.
64 *
65 * @since 4.0.0
66 */
67 public function admin_custom_style_inline() {
68 wp_register_style( 'rmp_admin_inline', false, array(), RMP_PLUGIN_VERSION );
69 wp_enqueue_style( 'rmp_admin_inline' );
70
71 $css_data = '
72 #adminmenu .menu-icon-rmp_menu .wp-menu-image img{
73 height: 18px;
74 }
75
76 .responsive-menu-license-upgrade-link {
77 color: #f80668;
78 font-weight: 600;
79 }
80 ';
81 wp_add_inline_style( 'rmp_admin_inline', $css_data );
82 }
83
84 /**
85 * To enqueue scripts and styles in admin.
86 *
87 * @param string $hook_suffix Admin page name.
88 *
89 * @return void
90 */
91 public function admin_enqueue_scripts() {
92 $post_type = get_post_type();
93
94 if ( empty( $post_type ) && ! empty( $_GET['post_type'] ) ) {
95 $post_type = sanitize_text_field( wp_unslash( $_GET['post_type'] ) );
96 }
97
98 if ( 'rmp_menu' !== $post_type || ! current_user_can( 'administrator' ) ) {
99 return;
100 }
101
102 if ( wp_is_mobile() ) {
103 wp_enqueue_script( 'jquery-touch-punch' );
104 }
105
106 /**
107 * Fires before enqueue the scripts.
108 */
109 do_action( 'before_rmp_enqueue_scripts' );
110
111 wp_enqueue_script( 'jquery-ui-tabs' );
112 wp_enqueue_script( 'jquery-ui-accordion' );
113 wp_enqueue_script( 'jquery-ui-draggable' );
114 wp_enqueue_script( 'jquery-ui-sortable' );
115 wp_enqueue_style( 'wp-color-picker' );
116
117 if ( ! did_action( 'wp_enqueue_media' ) ) {
118 wp_enqueue_media();
119 }
120
121 wp_enqueue_script(
122 'rmp_admin_selectize_scripts',
123 RMP_PLUGIN_URL_V4 . '/assets/admin/js/selectize.js',
124 null,
125 RMP_PLUGIN_VERSION,
126 true
127 );
128
129 wp_enqueue_style(
130 'rmp_admin_selectize_styles',
131 RMP_PLUGIN_URL_V4 . '/assets/admin/scss/selectize.css',
132 null,
133 RMP_PLUGIN_VERSION
134 );
135
136 wp_enqueue_style(
137 'rmp_admin_main_styles',
138 RMP_PLUGIN_URL_V4 . '/assets/admin/build/css/rmpMain.css',
139 null,
140 RMP_PLUGIN_VERSION
141 );
142
143 wp_enqueue_script(
144 'rmp_admin_dropzone_scripts',
145 RMP_PLUGIN_URL_V4 . '/assets/admin/js/dropzone.min.js',
146 array( 'jquery' ),
147 RMP_PLUGIN_VERSION,
148 true
149 );
150
151 wp_enqueue_style(
152 'rmp_admin_styles',
153 RMP_PLUGIN_URL_V4 . '/assets/admin/scss/admin.css',
154 null,
155 RMP_PLUGIN_VERSION
156 );
157
158 wp_register_script(
159 'rmp_admin_scripts',
160 RMP_PLUGIN_URL_V4 . '/assets/admin/build/js/rmpMain.js',
161 array( 'wp-color-picker', 'jquery' ),
162 RMP_PLUGIN_VERSION,
163 true
164 );
165
166 wp_localize_script(
167 'rmp_admin_scripts',
168 'rmpObject',
169 array(
170 'ajaxURL' => admin_url( 'admin-ajax.php' ),
171 'ajax_nonce' => wp_create_nonce( 'rmp_nonce' ),
172 'THEMES_FOLDER_URL' => wp_upload_dir()['baseurl'] . '/rmp-themes/',
173 )
174 );
175
176 wp_enqueue_script( 'rmp_admin_scripts' );
177
178 wp_enqueue_script(
179 'rmp_admin_social_icons',
180 RMP_PLUGIN_URL_V4 . '/assets/admin/js/rmp-social-icons.js',
181 array( 'jquery', 'wp-color-picker', 'jquery-ui-sortable', 'rmp_admin_scripts' ),
182 RMP_PLUGIN_VERSION,
183 true
184 );
185
186 /** Enqueue the icons resources */
187
188 wp_enqueue_style( 'dashicons' );
189
190 wp_enqueue_style(
191 'rmp-admin-fontawesome-icons',
192 'https://use.fontawesome.com/releases/v5.13.0/css/all.css',
193 null,
194 RMP_PLUGIN_VERSION
195 );
196
197 wp_enqueue_style(
198 'rmp-admin-glyph-icons',
199 RMP_PLUGIN_URL_V4 . '/assets/admin/scss/glyphicons.css',
200 null,
201 RMP_PLUGIN_VERSION
202 );
203
204 /**
205 * Fires after enqueue the admin scripts.
206 */
207 do_action( 'after_rmp_enqueue_admin_scripts' );
208 }
209 }
210