PluginProbe
Bubble Menu – Floating Button Menu with Sticky Navigation / 4.0
Bubble Menu – Floating Button Menu with Sticky Navigation v4.0
trunk 1.3 2.0 2.2 2.2.1 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1 3.1.1 4.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.1 4.1.1
bubble-menu / admin / class-wowp-admin.php

class-wowp-admin.php in Bubble Menu – Floating Button Menu with Sticky Navigation 4.0, at admin/class-wowp-admin.php

130 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Class WOWP_Admin
5 *
6 * The main admin class responsible for initializing the admin functionality of the plugin.
7 *
8 * @package BubbleMenu
9 * @subpackage Admin
10 * @author Dmytro Lobov <hey@wow-company.com>, Wow-Company
11 * @copyright 2024 Dmytro Lobov
12 * @license GPL-2.0+
13 */
14
15 namespace BubbleMenu;
16
17 use BubbleMenu\Admin\AdminActions;
18 use BubbleMenu\Admin\Dashboard;
19
20 defined( 'ABSPATH' ) || exit;
21
22 class WOWP_Admin {
23 public function __construct() {
24 Dashboard::init();
25 AdminActions::init();
26 $this->includes();
27
28 add_action( WOWP_Plugin::PREFIX . '_admin_header_links', [ $this, 'plugin_links' ] );
29 add_filter( WOWP_Plugin::PREFIX . '_save_settings', [ $this, 'save_settings' ] );
30 add_action( WOWP_Plugin::PREFIX . '_admin_load_assets', [ $this, 'load_assets' ] );
31
32 }
33
34 public function includes(): void {
35 require_once plugin_dir_path( __FILE__ ) . 'class-settings-helper.php';
36 }
37
38 public function plugin_links(): void {
39 ?>
40 <div class="wpie-links">
41 <a href="<?php echo esc_url( WOWP_Plugin::info( 'pro' ) ); ?>" target="_blank">PRO Plugin</a>
42 <a href="<?php echo esc_url( WOWP_Plugin::info( 'rating' ) ); ?>" target="_blank" class="wpie-color-orange">Rating</a>
43 </div>
44 <?php
45 }
46
47 public function save_settings() {
48
49 $param = ! empty( $_POST['param'] ) ? map_deep( $_POST['param'], 'sanitize_text_field' ) : [];
50
51 $param['label'] = $this->sanitize_tooltip( $_POST['param']['label'] );
52 $param['emoji'] = $this->sanitize_tooltip( $_POST['param']['emoji'] );
53
54 if ( isset( $_POST['param']['item']['label'] ) ) {
55 $param['item']['label'] = map_deep( $_POST['param']['item']['label'], array(
56 $this,
57 'sanitize_tooltip'
58 ) );
59 }
60
61 if ( isset( $_POST['param']['item']['emoji'] ) ) {
62 $param['item']['emoji'] = map_deep( $_POST['param']['item']['emoji'], [
63 $this,
64 'sanitize_text'
65 ] );
66 }
67
68 if ( isset( $_POST['param']['item']['popup'] ) ) {
69 $param['item']['popup'] = map_deep( $_POST['param']['item']['popup'], [
70 $this,
71 'sanitize_tooltip'
72 ] );
73 }
74
75 return $param;
76
77 }
78
79 public function sanitize_text( $text ): string {
80 return wp_kses_post( wp_encode_emoji( wp_unslash( $text ) ) );
81 }
82
83 public function sanitize_tooltip( $text ): string {
84 return sanitize_text_field( wp_encode_emoji(wp_unslash( $text ) ));
85 }
86
87
88 public function load_assets(): void {
89 wp_enqueue_style( 'wp-color-picker' );
90 wp_enqueue_script( 'wp-color-picker' );
91 wp_enqueue_script( 'wp-tinymce' );
92 wp_enqueue_editor();
93 wp_enqueue_media();
94 wp_enqueue_script( 'thickbox' );
95 wp_enqueue_style( 'thickbox' );
96
97 wp_enqueue_script( 'jquery-ui-sortable' );
98
99 wp_enqueue_script( 'code-editor' );
100 wp_enqueue_style( 'code-editor' );
101 wp_enqueue_script( 'htmlhint' );
102 wp_enqueue_script( 'csslint' );
103
104 wp_enqueue_style( 'notification-fontawesome', WOWP_Plugin::url() . 'vendors/fontawesome/css/all.min.css', [], '6.6' );
105
106 // include fonticonpicker styles & scripts
107 $url_assets = WOWP_Plugin::url() . 'vendors/';
108 $slug = WOWP_Plugin::SLUG;
109 $version = WOWP_Plugin::info( 'version' );
110
111 wp_enqueue_style( $slug. '-fontawesome', $url_assets . '/fontawesome/css/all.min.css', [], '6.6' );
112
113 $fonticonpicker_js = $url_assets . 'fonticonpicker/js/jquery.fonticonpicker.js';
114 wp_enqueue_script( $slug . '-fonticonpicker', $fonticonpicker_js, array( 'jquery' ), $version );
115
116 $fonticonpicker_css = $url_assets . 'fonticonpicker/css/base/jquery.fonticonpicker.css';
117 wp_enqueue_style( $slug . '-fonticonpicker', $fonticonpicker_css, null, $version );
118
119 $fonticonpicker_dark_css = $url_assets . 'fonticonpicker/css/themes/dark-grey-theme/jquery.fonticonpicker.darkgrey.css';
120 wp_enqueue_style( $slug . '-fonticonpicker-darkgrey', $fonticonpicker_dark_css, null, $version );
121
122 $arg = [
123 'plugin_url' => WOWP_Plugin::url(),
124 ];
125
126 wp_localize_script( 'wp-tinymce', 'notification_obj', $arg );
127 }
128
129
130 }