PluginProbe
Pixelavo – Server Side Tracking & Pixel + AI Ads Tools / 1.0.8
Pixelavo – Server Side Tracking & Pixel + AI Ads Tools v1.0.8
1.5.5 1.5.4 trunk 1.0.0 1.0.1 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 All 47 releases
pixelavo / admin / settings-panel / includes / classes / Admin / Menu.php

Menu.php in Pixelavo – Server Side Tracking & Pixel + AI Ads Tools 1.0.8, at admin/settings-panel/includes/classes/Admin/Menu.php

168 lines 6.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace PixelavoOpt\Admin;
3
4 class Menu {
5
6 /**
7 * [init]
8 */
9 public function init() {
10 add_action( 'admin_menu', [ $this, 'admin_menu' ], 220 );
11 }
12
13 /**
14 * Register Menu
15 *
16 * @return void
17 */
18 public function admin_menu(){
19 global $submenu;
20
21 $slug = 'pixelavo';
22 $capability = 'manage_options';
23
24 $hook = add_menu_page(
25 esc_html__( 'Pixelavo', 'pixelavo' ),
26 esc_html__( 'Pixelavo', 'pixelavo' ),
27 $capability,
28 $slug,
29 [ $this, 'plugin_page' ],
30 'dashicons-controls-repeat',
31 59
32 );
33
34 if ( current_user_can( $capability ) ) {
35 $submenu[ $slug ][] = array( esc_html__( 'Pixels', 'pixelavo' ), $capability, 'admin.php?page=' . $slug . '#/pixels' );
36 $submenu[ $slug ][] = array( esc_html__( 'Events', 'pixelavo' ), $capability, 'admin.php?page=' . $slug . '#/events' );
37 $submenu[ $slug ][] = array( esc_html__( 'Custom Events', 'pixelavo' ), $capability, 'admin.php?page=' . $slug . '#/custom_events' );
38 $submenu[ $slug ][] = array( esc_html__( 'Settings', 'pixelavo' ), $capability, 'admin.php?page=' . $slug . '#/settings' );
39 }
40
41 add_action( 'load-' . $hook, [ $this, 'init_hooks'] );
42
43 }
44
45 /**
46 * Initialize our hooks for the admin page
47 *
48 * @return void
49 */
50 public function init_hooks() {
51 add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
52 }
53
54 /**
55 * Load scripts and styles for the app
56 *
57 * @return void
58 */
59 public function enqueue_scripts() {
60 wp_enqueue_style('pixelavoopt-sweetalert2');
61 wp_enqueue_style( 'pixelavoopt-admin' );
62 wp_enqueue_style( 'pixelavoopt-style' );
63 wp_enqueue_script( 'pixelavoopt-admin' );
64 wp_enqueue_script( 'pixelavoopt-main' );
65
66 $option_localize_script = [
67 'adminUrl' => admin_url( '/' ),
68 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
69 'rootApiUrl' => esc_url_raw( rest_url() ),
70 'restNonce' => wp_create_nonce( 'wp_rest' ),
71 'verifynonce' => wp_create_nonce( 'pixelavoopt_verifynonce' ),
72 'tabs' => Options_Field::instance()->get_settings_tabs(),
73 'sections' => Options_Field::instance()->get_settings_subtabs(),
74 'settings' => Options_Field::instance()->get_registered_settings(),
75 'options' => pixelavo_get_options( Options_Field::instance()->get_registered_settings() ),
76 'labels' => [
77 'pro' => __( 'Pro', 'pixelavo' ),
78 'modal' => [
79 'title' => __( 'BUY PRO', 'pixelavo' ),
80 'buynow' => __( 'Buy Now', 'pixelavo' ),
81 'desc' => __( 'Our free version is great, but it doesn\'t have all our advanced features. The best way to unlock all of the features in our plugin is by purchasing the pro version.', 'pixelavo' )
82 ],
83 'saveButton' => [
84 'text' => __( 'Save Settings', 'pixelavo' ),
85 'saving' => __( 'Saving...', 'pixelavo' ),
86 'saved' => __( 'Data Saved', 'pixelavo' ),
87 ],
88 'enableAllButton' => [
89 'enable' => __( 'Enable All', 'pixelavo' ),
90 'disable' => __( 'Disable All', 'pixelavo' ),
91 ],
92 'resetButton' => [
93 'text' => __( 'Reset All Settings', 'pixelavo' ),
94 'reseting' => __( 'Resetting...', 'pixelavo' ),
95 'reseted' => __( 'All Data Restored', 'pixelavo' ),
96 'alert' => [
97 'one'=>[
98 'title' => __( 'Are you sure?', 'pixelavo' ),
99 'text' => __( 'It will reset all the settings to default, and all the changes you made will be deleted.', 'pixelavo' ),
100 'confirm' => __( 'Yes', 'pixelavo' ),
101 'cancel' => __( 'No', 'pixelavo' ),
102 ],
103 'two'=>[
104 'title' => __( 'Reset!', 'pixelavo' ),
105 'text' => __( 'All settings has been reset successfully.', 'pixelavo' ),
106 'confirm' => __( 'OK', 'pixelavo' ),
107 ]
108 ],
109 ],
110 'pixelDelete' => [
111 'alert' => [
112 'title' => __( 'Are you sure?', 'pixelavo' ),
113 'desc' => __( 'You won\'t be able to revert this pixel!', 'pixelavo' ),
114 'label' => [
115 'confirm' => __('Yes, delete it!', 'pixelavo')
116 ]
117 ],
118 'success' => [
119 'title' => __( 'Deleted!', 'pixelavo' ),
120 'desc' => __( 'Your pixel has been deleted.', 'pixelavo' ),
121 ]
122 ],
123 'pixelBtn' => [
124 'default' => [
125 'save' => __( 'Save', 'pixelavo' ),
126 'update' => __( 'Update', 'pixelavo' )
127 ],
128 'saving' => [
129 'save' => __( 'Saving...', 'pixelavo' ),
130 'update' => __( 'Updating...', 'pixelavo' )
131 ],
132 'saved' => [
133 'save' => __( 'Saved', 'pixelavo' ),
134 'update' => __( 'Updated', 'pixelavo' ),
135 ],
136 ],
137 'eventBtn' => [
138 'default' => [
139 'save' => __( 'Save', 'pixelavo' ),
140 'update' => __( 'Update', 'pixelavo' )
141 ],
142 'saving' => [
143 'save' => __( 'Saving...', 'pixelavo' ),
144 'update' => __( 'Updating...', 'pixelavo' )
145 ],
146 'saved' => [
147 'save' => __( 'Saved', 'pixelavo' ),
148 'update' => __( 'Updated', 'pixelavo' ),
149 ],
150 ]
151 ]
152 ];
153 wp_localize_script( 'pixelavoopt-admin', 'pixelavoOptions', $option_localize_script );
154 }
155
156 /**
157 * Render our admin page
158 *
159 * @return void
160 */
161 public function plugin_page() {
162 ob_start();
163 include_once PIXELAVO_INCLUDES .'/templates/settings-page.php';
164 echo ob_get_clean();
165 }
166
167 }
168