PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 2.2.8
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v2.2.8
2.3.2 2.3.1 2.3.0 2.2.8 2.2.7 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.11.1 1.11.2 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 1.9.10 1.9.11 All 60 releases
merchant / admin / pages / page-module.php

page-module.php in Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant 2.2.8, at admin/pages/page-module.php

364 lines 22.6 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; // Exit if accessed directly
5 }
6
7 $merchant_module = ( ! empty( $_GET['module'] ) ) ? sanitize_text_field( wp_unslash( $_GET['module'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
8 $merchant_module_info = Merchant_Admin_Modules::get_module_info( $merchant_module );
9
10 Merchant_Admin_Preview::set_preview( $merchant_module );
11
12 ?>
13
14 <?php if ( ! empty( $merchant_module_info ) ) : ?>
15
16 <div class="merchant-module-page">
17
18 <div class="merchant-module-page-content">
19
20 <form method="post" action="" class="merchant-module-page-ajax-form" autocomplete="off">
21
22 <input type="hidden" name="merchant_nonce" value="<?php echo esc_attr( wp_create_nonce( 'merchant_nonce' ) ); ?>"/>
23
24 <div class="merchant-module-page-ajax-header">
25 <div class="merchant-module-page-ajax-notice"><?php esc_html_e( 'Your settings have been modified. Save?', 'merchant' ); ?></div>
26 <div class="merchant-module-page-ajax-buttons">
27 <a href="<?php echo esc_url( add_query_arg( array( 'page' => 'merchant', 'module' => $merchant_module ), 'admin.php' ) ); ?>"
28 class="merchant-module-discard-button"><?php esc_html_e( 'Discard', 'merchant' ); ?></a>
29 <button type="submit" name="merchant_save" value="save" class="merchant-module-save-button"><span class="merchant-module-save-button-label"><?php esc_html_e( 'Save',
30 'merchant' ); ?></span><i class="dashicons dashicons-update-alt"></i></button>
31 </div>
32 </div>
33
34 <div class="merchant-module-page-header">
35
36 <div class="merchant-module-page-header-content">
37
38 <div class="merchant-module-page-back">
39 <a href="<?php echo esc_url( add_query_arg( array( 'page' => 'merchant' ), 'admin.php' ) ); ?>">
40 <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
41 <rect width="16" height="16" rx="2" fill="white"/>
42 <path d="M13.3329 7.20013H4.46628L7.19961 4.20013L6.46628 3.4668L2.59961 7.6668L6.46628 11.5335L7.19961 10.8001L4.53294 8.20013H13.3329V7.20013Z" fill="#1D2327"/>
43 </svg>
44 <span><?php echo esc_html__( 'Go Back', 'merchant' ); ?></span>
45 </a>
46 </div>
47
48 <div class="merchant-module-page-heading">
49 <div class="merchant-module-page-info">
50 <div class="merchant-module-page-title">
51 <?php echo esc_html( $merchant_module_info['title'] ); ?>
52 </div>
53 <div class="merchant-module-page-desc"><?php echo esc_html( $merchant_module_info['desc'] ); ?></div>
54 </div>
55 </div>
56
57 <div class="merchant-module-page-actions">
58
59 <div class="merchant-module-page-actions-inner">
60
61 <?php
62 $merchant_module_is_upsell = ! defined( 'MERCHANT_PRO_VERSION' ) && isset( $merchant_module_info['pro'] ) && true === $merchant_module_info['pro'];
63 $merchant_module_enabled = ( Merchant_Modules::is_module_active( $merchant_module ) && ! $merchant_module_is_upsell ) ? ' merchant-enabled' : '';
64 ?>
65
66 <div class="merchant-module-action<?php echo esc_attr( $merchant_module_enabled ); ?>">
67
68
69 <?php if ( $merchant_module_is_upsell ) :
70 $installed_plugins = Merchant_Admin_Menu::get_installed_plugins();
71 $is_pro_installed = isset( $installed_plugins['merchant-pro/merchant-pro.php'] );
72
73 if ( $is_pro_installed && ! is_plugin_active( 'merchant-pro/merchant-pro.php' ) ) :
74 $url = add_query_arg( array(
75 'page' => 'merchant',
76 'module' => $merchant_module,
77 'action' => 'merchant_activate_pro',
78 'nonce' => wp_create_nonce( 'merchant_activate_pro' ),
79 ), admin_url( 'admin.php' ) );
80 ?>
81 <div class="merchant-module-buy">
82
83 <a href="<?php echo esc_url( $url ); ?>"
84 class="merchant-module-page-button merchant-module-activate">
85 <?php esc_html_e( 'Activate Merchant Pro', 'merchant' ); ?>
86 </a>
87
88 </div>
89 <?php
90 else :
91 $url = merchant_admin_upgrade_link(
92 'https://athemes.com/merchant-upgrade',
93 array(
94 'utm_source' => 'module_inner_settings',
95 'utm_content' => $merchant_module,
96 'utm_medium' => 'merchant_dashboard',
97 'utm_campaign' => 'Merchant',
98 ),
99 'module-inner-settings-upgrade-link'
100 );
101 ?>
102 <div class="merchant-module-buy">
103
104 <a href="<?php echo esc_url( $url ); ?>" target="_blank"
105 class="merchant-module-page-button ">
106 <?php esc_html_e( 'Buy Pro', 'merchant' ); ?>
107 </a>
108
109 </div>
110 <?php endif; ?>
111 <?php else :
112 /**
113 * Hook 'merchant_admin_module_{module_id}_activate_button_class'
114 * Filters the class name for the activate button.
115 *
116 * @param string $button_activate_class The class name for the activate button.
117 * @since 1.0
118 */
119 $button_activate_class = apply_filters( "merchant_admin_module_{$merchant_module}_activate_button_class", 'merchant-module-page-button merchant-module-activate merchant-module-page-button-action-activate' );
120 ?>
121
122 <div data-module="<?php echo esc_attr( $merchant_module ); ?>"
123 class="<?php echo esc_attr( $button_activate_class ); ?>">
124 <?php esc_html_e( 'Enable', 'merchant' ); ?>
125 </div>
126 <div class="merchant-module-deactivate">
127
128 <div class="merchant-module-page-button merchant-module-page-button-deactivate">
129 <?php esc_html_e( 'Enabled', 'merchant' ); ?>
130 <svg width="8" height="5" viewBox="0 0 8 5" fill="none" xmlns="http://www.w3.org/2000/svg">
131 <path d="M7.09832 3.98009e-07L0.901685 -1.43717e-07C0.15069 -2.09371e-07 -0.269991 0.75351 0.193991 1.2676L3.29231 4.70055C3.65265 5.09982 4.34735 5.09982 4.70769 4.70055L7.80601 1.2676C8.26999 0.753511 7.84931 4.63664e-07 7.09832 3.98009e-07Z"
132 fill="#3858E9"/>
133 </svg>
134 </div>
135
136 <div class="merchant-module-deactivate-dropdown">
137 <div data-module="<?php echo esc_attr( $merchant_module ); ?>" class="merchant-module-page-button-action-deactivate">
138 <?php echo esc_html__( 'Disable', 'merchant' ) . ' ' . esc_html( $merchant_module_info['title'] ); ?>
139 </div>
140 </div>
141
142 </div>
143 <?php endif ?>
144
145
146 <div class="merchant-module-dropdown merchant-module-question-list-dropdown">
147 <div class="merchant-module-question-title">
148 <?php esc_html_e( 'Did something go wrong?', 'merchant' ); ?><i class="dashicons dashicons-no-alt merchant-module-dropdown-close"></i>
149 </div>
150 <ul>
151 <li data-answer-target="bug">
152 <span><?php esc_html_e( 'Submit a bug: the module doesn’t work as expected', 'merchant' ); ?></span>
153 </li>
154 <li data-answer-target="missing">
155 <span><?php esc_html_e( 'Some options are missing', 'merchant' ); ?></span>
156 </li>
157 <li data-answer-target="conflict">
158 <span><?php esc_html_e( 'It conflicts with another feature', 'merchant' ); ?></span>
159 </li>
160 <li data-answer-target="thank-you">
161 <span><?php esc_html_e( 'I don’t need it anymore.', 'merchant' ); ?></span>
162 </li>
163 <li data-answer-target="other">
164 <span><?php esc_html_e( 'Other', 'merchant' ); ?></span>
165 </li>
166 </ul>
167 </div>
168
169 <div class="merchant-module-dropdown merchant-module-question-answer-dropdown">
170
171 <div class="merchant-module-question-answer">
172
173 <div class="merchant-module-question-answer-title" data-answer-title="bug">
174 <?php esc_html_e( 'Please tell us why, and we’ll look into it.', 'merchant' ); ?><i
175 class="dashicons dashicons-no-alt merchant-module-dropdown-close"></i>
176 </div>
177
178 <div class="merchant-module-question-answer-title" data-answer-title="missing">
179 <?php esc_html_e( 'What feature are you looking for?', 'merchant' ); ?><i class="dashicons dashicons-no-alt merchant-module-dropdown-close"></i>
180 </div>
181
182 <div class="merchant-module-question-answer-title" data-answer-title="conflict">
183 <?php esc_html_e( 'Please tell us what plugin/theme it conflicts with.', 'merchant' ); ?><i
184 class="dashicons dashicons-no-alt merchant-module-dropdown-close"></i>
185 </div>
186
187 <div class="merchant-module-question-answer-title" data-answer-title="other">
188 <?php esc_html_e( 'Would you mind telling us why?', 'merchant' ); ?><i class="dashicons dashicons-no-alt merchant-module-dropdown-close"></i>
189 </div>
190
191 </div>
192
193 <div class="merchant-module-question-answer-form">
194 <textarea class="merchant-module-question-answer-textarea" data-subject=""></textarea>
195 <button class="merchant-module-page-button merchant-module-question-answer-button" disabled><?php esc_html_e( 'Submit', 'merchant' ); ?></button>
196 </div>
197
198 </div>
199
200 <div class="merchant-module-dropdown merchant-module-question-thank-you-dropdown">
201
202 <div class="merchant-module-question-answer-title">
203 <?php esc_html_e( 'Thank you', 'merchant' ); ?><i class="dashicons dashicons-no-alt merchant-module-dropdown-close"></i>
204 </div>
205
206 <div class="merchant-module-question-answer-thank-you-text">
207 <?php esc_html_e( 'Your feedback helps us improve Merchant.', 'merchant' ); ?>
208 </div>
209
210 </div>
211
212 </div>
213
214 <div class="merchant-module-page-actions-links">
215
216 <?php if ( ! empty( $merchant_module_info['tutorial_url'] ) ) : ?>
217 <a href="<?php echo esc_url( $merchant_module_info['tutorial_url'] ); ?>" class="merchant-module-page-link merchant-module-page-link-tutorial" target="_blank">
218 <span><?php echo esc_html__( 'Tutorial', 'merchant' ); ?></span>
219 <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
220 <path d="M11.4375 0H8.25C7.94531 0 7.66406 0.1875 7.54688 0.492188C7.42969 0.773438 7.5 1.10156 7.71094 1.3125L8.67188 2.27344L4.14844 6.79688C3.84375 7.07812 3.84375 7.57031 4.14844 7.85156C4.28906 7.99219 4.47656 8.0625 4.6875 8.0625C4.875 8.0625 5.0625 7.99219 5.20312 7.85156L9.72656 3.32812L10.6875 4.28906C10.8281 4.42969 11.0156 4.5 11.2266 4.5C11.3203 4.5 11.4141 4.5 11.5078 4.45312C11.8125 4.33594 12 4.05469 12 3.75V0.5625C12 0.257812 11.7422 0 11.4375 0ZM9.1875 7.5C8.85938 7.5 8.625 7.75781 8.625 8.0625V10.6875C8.625 10.8047 8.53125 10.875 8.4375 10.875H1.3125C1.19531 10.875 1.125 10.8047 1.125 10.6875V3.5625C1.125 3.46875 1.19531 3.375 1.3125 3.375H3.9375C4.24219 3.375 4.5 3.14062 4.5 2.8125C4.5 2.50781 4.24219 2.25 3.9375 2.25H1.3125C0.585938 2.25 0 2.85938 0 3.5625V10.6875C0 11.4141 0.585938 12 1.3125 12H8.4375C9.14062 12 9.75 11.4141 9.75 10.6875V8.0625C9.75 7.75781 9.49219 7.5 9.1875 7.5Z"
221 fill="#3858E9"/>
222 </svg>
223 </a>
224 <?php endif; ?>
225
226 </div>
227
228 </div>
229
230 </div>
231
232 </div>
233
234 </div>
235
236 <?php
237 /**
238 * Hook 'merchant_admin_after_module_page_page_header'
239 *
240 * @since 1.0
241 * @updated 2.0 added $merchant_module as parameter
242 */
243 do_action( 'merchant_admin_after_module_page_page_header', $merchant_module );
244
245 ?>
246
247 <div class="merchant-module-page-body <?php echo Merchant_Admin_Preview::has_preview() ? 'has-preview' : ''; ?>">
248
249 <div class="merchant-module-page-content">
250
251 <?php
252
253 /**
254 * Hook: merchant_module_file_path
255 *
256 * @since 1.0
257 */
258 $merchant_module_file = apply_filters( 'merchant_module_file_path',
259 MERCHANT_DIR . 'admin/modules/' . $merchant_module . '/admin-page-' . $merchant_module . '.php',
260 $merchant_module );
261
262 if ( file_exists( $merchant_module_file ) ) {
263 require $merchant_module_file;
264 }
265
266 ?>
267 <div class="merchant-module-page-settings backup-restore-section">
268 <div class="merchant-module-page-setting-box">
269 <div class="merchant-module-page-setting-title">
270 <?php esc_html_e( 'Backup & Restore', 'merchant' ); ?>
271 </div>
272 <div class="merchant-module-page-setting-fields">
273 <section class="backup-section">
274 <h3><?php esc_html_e( 'Backup Module Settings', 'merchant' ); ?></h3>
275 <p><?php esc_html_e( 'Download a backup of your currently saved module settings as a JSON file. To capture the most up-to-date configuration, remember to save your settings before downloading the backup. You can then use this file to restore your settings later.', 'merchant' ); ?></p>
276 <div class="form-field">
277 <button type="button" data-module-id="<?php echo esc_attr($merchant_module)?>" id="download-backup-button"><?php esc_html_e( 'Download', 'merchant' ); ?></button>
278 <span class="merchant-backup-status"></span>
279 <span class="merchant-loading-spinner"></span>
280 </div>
281 </section>
282 <section class="restore-section">
283 <h3><?php esc_html_e( 'Restore Module Settings', 'merchant' ); ?></h3>
284 <p><?php esc_html_e( 'Restore the module settings by uploading a previously saved backup file. Please be aware that restoring settings will overwrite your current module configurations.', 'merchant' ); ?></p>
285 <div class="form-field">
286 <div class="merchant-dropzone" id="merchant-restore-dropzone" data-module-id="<?php echo esc_attr( $merchant_module )?>">
287 <div class="merchant-dropzone__content">
288 <span class="dashicons dashicons-upload"></span>
289 <p><?php esc_html_e( 'Drag & drop a JSON backup file here, or', 'merchant' ); ?></p>
290 <button type="button" class="merchant-dropzone__browse"><?php esc_html_e( 'Browse', 'merchant' ); ?></button>
291 </div>
292 <input type="file" id="merchant-backup-file" class="merchant-backup-file" name="backup-file" accept=".json">
293 <div class="merchant-dropzone__loading">
294 <span class="merchant-loading-spinner"></span>
295 <p><?php esc_html_e( 'Restoring...', 'merchant' ); ?></p>
296 </div>
297 <div class="merchant-dropzone__success">
298 <span class="dashicons dashicons-yes-alt"></span>
299 <p><?php esc_html_e( 'Settings restored successfully!', 'merchant' ); ?></p>
300 </div>
301 <div class="merchant-dropzone__error">
302 <span class="dashicons dashicons-warning"></span>
303 <p></p>
304 </div>
305 </div>
306 </div>
307 </section>
308 </div>
309 </div>
310 </div>
311 </div>
312
313 <?php if ( Merchant_Admin_Preview::has_preview() ) : ?>
314
315 <div class="merchant-module-page-preview">
316 <div class="merchant-module-page-preview-box">
317 <div class="merchant-module-page-preview-title">
318 <?php esc_html_e( 'Preview', 'merchant' ); ?>
319 </div>
320 <div class="merchant-module-page-preview-browser">
321 <div class="merchant-module-page-preview-browser-top">
322 <span class="merchant-module-page-preview-browser-top-circle"></span>
323 <span class="merchant-module-page-preview-browser-top-circle"></span>
324 <span class="merchant-module-page-preview-browser-top-circle"></span>
325 </div>
326 <div class="merchant-module-page-preview-browser-inner">
327 <?php echo wp_kses( Merchant_Admin_Preview::get_html(), merchant_kses_allowed_tags( array( 'all' ) ) ); ?>
328 </div>
329 </div>
330 </div>
331 </div>
332
333 <?php endif; ?>
334
335 </div>
336
337 </form>
338
339 </div>
340
341 </div>
342
343 <div class="merchant-module-alert">
344 <div class="merchant-module-alert-overlay"></div>
345 <div class="merchant-module-alert-wrapper">
346 <div class="merchant-module-alert-header"><strong><?php esc_html_e( 'Important info!', 'merchant' ); ?></strong><a href="#" class="merchant-module-alert-close"><i
347 class="dashicons dashicons-no-alt"></i></a></div>
348 <div class="merchant-module-alert-content">
349 <figure><img src="<?php echo esc_url( MERCHANT_URI . 'assets/images/enable-module.png' ); ?>"/></figure>
350 <p><?php esc_html_e( 'This module is currently disabled. Please enable the module to see it in your store.', 'merchant' ); ?></p>
351 </div>
352 </div>
353 </div>
354
355 <div class="merchant-module-footer-text">
356 <?php esc_html_e( 'Copyright © aThemes ' . gmdate( 'Y' ) . '. All Rights Reserved.', 'merchant' ); ?>
357 </div>
358
359 <?php else : ?>
360
361 <?php wp_safe_redirect( add_query_arg( array( 'page' => 'merchant' ), admin_url( 'admin.php' ) ) ); ?>
362
363 <?php endif; ?>
364