PluginProbe
Catch Web Tools / 3.2
Catch Web Tools v3.2
trunk 0.1 0.2 0.3 0.4 1.0 1.1 1.2 1.3 1.4 1.4.1 1.5 1.5.1 1.5.2 1.6 1.7 1.8 1.8.1 1.9 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 All 58 releases
catch-web-tools / admin / modules / to-top.php

to-top.php in Catch Web Tools 3.2, at admin/modules/to-top.php

326 lines 22.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Exit if accessed directly
4 if (! defined('ABSPATH')) exit;
5
6 /**
7 * Provide a admin area view for the plugin
8 *
9 * This file is used to markup the admin-facing aspects of the plugin.
10 *
11 * @link catchplugins.com
12 * @since 1.0.0
13 *
14 * @package To_Top
15 * @subpackage To_Top/admin/partials
16 */
17 ?>
18
19 <?php include('header.php'); ?>
20 <div id="to_top_main">
21 <div class="content-wrapper">
22 <div class="header">
23 <h3><?php esc_html_e('To Top', 'catch-web-tools'); ?></h3>
24 </div> <!-- .header -->
25 <div class="content">
26 <?php
27 if (is_plugin_active('to-top/to-top.php')) : ?>
28 <div class="module-container">
29 <!-- Status -->
30 <div id="module-disabled" class="catch-modules full-width">
31 <div class="module-header disable">
32 <h3 class="module-title"><?php esc_html_e('Status : Disabled', 'catch-web-tools'); ?>
33 </h3>
34 </div><!-- .module-header -->
35 <div class="module-content">
36 <p class="notice notice-warning">
37 <?php esc_html_e('This module is currently disabled since To Top standalone plugin is already active on your site. If you want to configure the To Top please click on the following link.', 'catch-web-tools'); ?>
38 </p>
39 <?php
40 $settings_link = '<a style="margin-top: 10px; display: inline-block;" href="' . esc_url(admin_url('admin.php?page=to-top')) . '">' . esc_html__('To Top', 'catch-web-tools') . '</a>';
41 echo wp_kses_post($settings_link);
42 ?>
43 </div><!-- .module-content -->
44 </div><!-- .catch-modules -->
45 </div>
46 <?php else: ?>
47 <form method="post" action="options.php">
48 <?php settings_fields('to-top-settings-group'); ?>
49 <?php $settings = catchwebtools_get_options('catchwebtools_to_top_options');
50 ?>
51 <div class="option-container">
52 <h3 class="option-toggle option-active"><a href="#"><?php esc_html_e('Basic Settings', 'catch-web-tools'); ?></a></h3>
53 <div class="option-content inside open">
54 <table class="form-table">
55 <tbody>
56 <tr>
57 <th scope="row"><?php esc_html_e('Enable to Top', 'catch-web-tools'); ?></th>
58
59 <td>
60 <?php
61 echo '<input name="catchwebtools_to_top_options[status]" id="catchwebtools_to_top_options[status]" type="checkbox" value="1" class="catchwebtools_to_top_options[status]" ' . checked(1, $settings['status'], false) . ' />' . esc_html__('Check to Enable', 'catch-web-tools');
62 ?>
63 </td>
64 </tr>
65 <tr>
66 <th scope="row"><?php esc_html_e('Scroll Offset (px)', 'catch-web-tools'); ?></th>
67 <td>
68 <?php
69 echo '<input min="1" type="number" id="catchwebtools_to_top_options[scroll_offset]" name="catchwebtools_to_top_options[scroll_offset]" value="' . absint($settings['scroll_offset']) . '"/>px';
70
71 echo '<p class="description">' . esc_html__('Number of pixels to be scrolled before the button appears', 'catch-web-tools') . '</p>';
72 ?>
73 </td>
74 </tr>
75
76 <tr>
77 <th scope="row"><?php esc_html_e('Icon Opacity (%)', 'catch-web-tools'); ?></th>
78 <td>
79 <?php
80 echo '<input min="1" max="100" type="number" id="catchwebtools_to_top_options[icon_opacity]" name="catchwebtools_to_top_options[icon_opacity]" value="' . absint($settings['icon_opacity']) . '"/>%';
81 ?>
82 </td>
83 </tr>
84
85 <tr>
86 <th scope="row"><?php esc_html_e('Style', 'catch-web-tools'); ?></th>
87
88 <td>
89 <?php
90 echo '<select id="catchwebtools_to_top_options_style" name="catchwebtools_to_top_options[style]">';
91 echo '<option value="icon"' . selected($settings['style'], 'icon', false) . '>' . esc_html__('Icon', 'catch-web-tools') . '</option>';
92 echo '<option value="genericon-icon"' . selected($settings['style'], 'genericon-icon', false) . '>' . esc_html__('Icon Using Genericons', 'catch-web-tools') . '</option>';
93 echo '<option value="font-awesome-icon"' . selected($settings['style'], 'font-awesome-icon', false) . '>' . esc_html__('Icon Using Font Awesome Icons', 'catch-web-tools') . '</option>';
94 echo '<option value="image"' . selected($settings['style'], 'image', false) . '>' . esc_html__('Image', 'catch-web-tools') . '</option>';
95 echo '</select>';
96 ?>
97 </td>
98 </tr>
99 </tbody>
100 </table>
101
102 <?php submit_button(esc_html__('Save Changes', 'catch-web-tools')); ?>
103 </div>
104
105 <h3 class="option-toggle"><a href="#"><?php esc_html_e('Icon Settings', 'catch-web-tools'); ?></a></h3>
106 <div class="option-content inside">
107 <table class="form-table">
108 <tbody>
109 <tr>
110 <th scope="row"><?php esc_html_e('Select Icon Type', 'catch-web-tools'); ?></th>
111
112 <td>
113 <?php
114 echo '<input type="radio" id="catchwebtools_to_top_options_icon_type_1" name="catchwebtools_to_top_options[icon_type]" value="dashicons-arrow-up"' . checked('dashicons-arrow-up', $settings['icon_type'], false) . '/>';
115 echo '<label class="dashicon_label" for="catchwebtools_to_top_options_icon_type_1"><span class="dashicon_to_top_admin dashicons dashicons-arrow-up"></span></label>';
116
117 echo '<input type="radio" id="catchwebtools_to_top_options_icon_type_2" name="catchwebtools_to_top_options[icon_type]" value="dashicons-arrow-up-alt"' . checked('dashicons-arrow-up-alt', $settings['icon_type'], false) . '/>';
118 echo '<label class="dashicon_label" for="catchwebtools_to_top_options_icon_type_2"><span class="dashicon_to_top_admin dashicons dashicons-arrow-up-alt"></span></label>';
119
120 echo '<input type="radio" id="catchwebtools_to_top_options_icon_type_3" name="catchwebtools_to_top_options[icon_type]" value="dashicons-arrow-up-alt2"' . checked('dashicons-arrow-up-alt2', $settings['icon_type'], false) . '/>';
121 echo '<label class="dashicon_label" for="catchwebtools_to_top_options_icon_type_3"><span class="dashicon_to_top_admin dashicons dashicons-arrow-up-alt2"></span></label>';
122 ?>
123 </td>
124 </tr>
125
126 <tr>
127 <th scope="row"><?php esc_html_e('Icon Color', 'catch-web-tools'); ?></th>
128
129 <td>
130 <?php
131 echo '<input type="text" class="catchwebtools_to_top_options_icon_color" name="catchwebtools_to_top_options[icon_color]" value="' . esc_attr(sanitize_text_field($settings['icon_color'])) . '"/>';
132 ?>
133 </td>
134 </tr>
135
136 <tr>
137 <th scope="row"><?php esc_html_e('Icon Background Color', 'catch-web-tools'); ?></th>
138
139 <td>
140 <?php
141 echo '<input type="text" class="catchwebtools_to_top_options_icon_bg_color" name="catchwebtools_to_top_options[icon_bg_color]" value="' . esc_attr(sanitize_text_field($settings['icon_bg_color'])) . '"/>';
142 ?>
143 </td>
144 </tr>
145
146 <tr>
147 <th scope="row"><?php esc_html_e('Icon Size (px)', 'catch-web-tools'); ?></th>
148 <td>
149 <?php
150 echo '<input min="0" type="number" id="catchwebtools_to_top_options_icon_size" name="catchwebtools_to_top_options[icon_size]" value="' . esc_attr(absint($settings['icon_size'])) . '"/>px';
151 ?>
152 </td>
153 </tr>
154
155 <tr>
156 <th scope="row"><?php esc_html_e('Border Radius (%)', 'catch-web-tools'); ?></th>
157 <td>
158 <?php
159 echo '<input min="0" max="50" type="number" id="catchwebtools_to_top_options_border_radius" name="catchwebtools_to_top_options[border_radius]" value="' . esc_attr(absint($settings['border_radius'])) . '"/>%';
160
161 echo '<p class="description">' . esc_html__('0 will make the icon background square, 50 will make it a circle', 'catch-web-tools') . '</p>';
162 ?>
163 </td>
164 </tr>
165 </tbody>
166 </table>
167 <?php submit_button(esc_html__('Save Changes', 'catch-web-tools')); ?>
168 </div>
169
170 <h3 class="option-toggle"><a href="#"><?php esc_html_e('Image Settings', 'catch-web-tools'); ?></a></h3>
171 <div class="option-content inside">
172 <table class="form-table">
173 <tbody>
174 <tr>
175 <th scope="row"><?php esc_html_e('Image', 'catch-web-tools'); ?></th>
176 <td>
177 <input class="upload-url" size="65" type="url" name="catchwebtools_to_top_options[image]" value="<?php echo esc_url($settings['image']); ?>" />
178 <input ref="<?php esc_attr_e('Insert Image', 'catch-web-tools'); ?>" class="st_upload_button button" name="wsl-image-add" type="button" value="<?php esc_attr_e('Change Image', 'catch-web-tools'); ?>" />
179 </td>
180 </tr>
181
182 <tr>
183 <th scope="row"><?php esc_html_e('Image Width (px)', 'catch-web-tools'); ?></th>
184 <td>
185 <?php
186 echo '<input min="0" max="200" type="number" size="65" id="catchwebtools_to_top_options[image_width]" name="catchwebtools_to_top_options[image_width]" value="' . absint($settings['image_width']) . '"/>px';
187 ?>
188 </td>
189 </tr>
190
191 <tr>
192 <th scope="row"><?php esc_html_e('Image Alt', 'catch-web-tools'); ?></th>
193 <td>
194 <?php
195 echo '<input type="text" size="65" id="catchwebtools_to_top_options[image_alt]" name="catchwebtools_to_top_options[image_alt]" value="' . esc_attr(sanitize_text_field($settings['image_alt'])) . '"/>';
196 ?>
197 </td>
198 </tr>
199 </tbody>
200 </table>
201 <?php submit_button(esc_html__('Save Changes', 'catch-web-tools')); ?>
202 </div>
203
204 <h3 class="option-toggle"><a href="#"><?php esc_html_e('Advanced Settings', 'catch-web-tools'); ?></a></h3>
205 <div class="option-content inside">
206 <table class="form-table">
207 <tbody>
208 <tr>
209 <th scope="row"><?php esc_html_e('Location', 'catch-web-tools'); ?></th>
210
211 <td>
212 <?php
213 echo '<select id="catchwebtools_to_top_options[location]" name="catchwebtools_to_top_options[location]">';
214 echo '<option value="bottom-right"' . selected($settings['location'], 'bottom-right', false) . '>' . esc_html__('Bottom Right', 'catch-web-tools') . '</option>';
215 echo '<option value="bottom-left"' . selected($settings['location'], 'bottom-left', false) . '>' . esc_html__('Bottom Left', 'catch-web-tools') . '</option>';
216 echo '<option value="top-right"' . selected($settings['location'], 'top-right', false) . '>' . esc_html__('Top Right', 'catch-web-tools') . '</option>';
217 echo '<option value="top-left"' . selected($settings['location'], 'top-left', false) . '>' . esc_html__('Top Left', 'catch-web-tools') . '</option>';
218 echo '</select>';
219 ?>
220 </td>
221 </tr>
222
223 <tr>
224 <th scope="row"><?php esc_html_e('Margin X (px)', 'catch-web-tools'); ?></th>
225 <td>
226 <?php
227 echo '<input min="1" type="number" id="catchwebtools_to_top_options[margin_x]" name="catchwebtools_to_top_options[margin_x]" value="' . absint($settings['margin_x']) . '"/>px';
228 ?>
229 </td>
230 </tr>
231
232 <tr>
233 <th scope="row"><?php esc_html_e('Margin Y (px)', 'catch-web-tools'); ?></th>
234 <td>
235 <?php
236 echo '<input min="1" type="number" id="catchwebtools_to_top_options[margin_y]" name="catchwebtools_to_top_options[margin_y]" value="' . absint($settings['margin_y']) . '"/>px';
237 ?>
238 </td>
239 </tr>
240
241 <tr>
242 <th scope="row"><?php esc_html_e('Show on WP-ADMIN?', 'catch-web-tools'); ?></th>
243
244 <td>
245 <?php
246 echo '<input name="catchwebtools_to_top_options[show_on_admin]" id="catchwebtools_to_top_options[show_on_admin]" type="checkbox" value="1" class="catchwebtools_to_top_options[show_on_admin]" ' . checked(1, $settings['show_on_admin'], false) . ' />' . esc_html__('Check to Enable', 'catch-web-tools');
247 echo '<p class="description">' . esc_html__('Button will be shown on admin section', 'catch-web-tools') . '</p>';
248 ?>
249 </td>
250 </tr>
251
252 <tr>
253 <th scope="row"><?php esc_html_e('Enable Auto Hide', 'catch-web-tools'); ?></th>
254
255 <td>
256 <?php
257 echo '<input name="catchwebtools_to_top_options[enable_autohide]" id="catchwebtools_to_top_options[enable_autohide]" type="checkbox" value="1" class="catchwebtools_to_top_options[enable_autohide]" ' . checked(1, $settings['enable_autohide'], false) . ' />' . esc_html__('Check to Enable', 'catch-web-tools');
258 ?>
259 </td>
260 </tr>
261
262 <tr>
263 <th scope="row"><?php esc_html_e('Auto Hide Time (secs)', 'catch-web-tools'); ?></th>
264 <td>
265 <?php
266 echo '<input min="1" type="number" id="catchwebtools_to_top_options[autohide_time]" name="catchwebtools_to_top_options[autohide_time]" value="' . absint($settings['autohide_time']) . '"/>sec(s)';
267
268 echo '<p class="description">' . esc_html__('Button will be auto hidden after this duration in seconds, if enabled', 'catch-web-tools') . '</p>';
269 ?>
270 </td>
271 </tr>
272
273 <tr>
274 <th scope="row"><?php esc_html_e('Hide on Small Devices?', 'catch-web-tools'); ?></th>
275
276 <td>
277 <?php
278 echo '<input name="catchwebtools_to_top_options[enable_hide_small_device]" id="catchwebtools_to_top_options[enable_hide_small_device]" type="checkbox" value="1" class="catchwebtools_to_top_options[enable_hide_small_device]" ' . checked(1, $settings['enable_hide_small_device'], false) . ' />' . esc_html__('Check to Enable', 'catch-web-tools');
279 echo '<p class="description">' . esc_html__('Button will be hidden on small devices when the width below matches', 'catch-web-tools') . '</p>';
280 ?>
281 </td>
282 </tr>
283
284 <tr>
285 <th scope="row"><?php esc_html_e('Small Device Max Width (px)', 'catch-web-tools'); ?></th>
286 <td>
287 <?php
288 echo '<input min="1" type="number" id="catchwebtools_to_top_options[small_device_max_width]" name="catchwebtools_to_top_options[small_device_max_width]" value="' . absint($settings['small_device_max_width']) . '"/>px';
289
290 echo '<p class="description">' . esc_html__('Button will be hidden on devices with lesser or equal width', 'catch-web-tools') . '</p>';
291 ?>
292 </td>
293 </tr>
294 </tbody>
295 </table>
296
297 <?php submit_button(esc_html__('Save Changes', 'catch-web-tools')); ?>
298 </div>
299
300 <h3 class="option-toggle"><a href="#"><?php esc_html_e('Reset Settings', 'catch-web-tools'); ?></a></h3>
301 <div class="option-content inside">
302 <table class="form-table">
303 <tbody>
304 <tr>
305 <th scope="row"><?php esc_html_e('Reset All Settings', 'catch-web-tools'); ?></th>
306
307 <td>
308 <?php
309 echo '<input name="catchwebtools_to_top_options[reset]" id="catchwebtools_to_top_options[reset]" type="checkbox" value="1" class="catchwebtools_to_top_options[reset]" />' . esc_html__('Check to Reset All Settings', 'catch-web-tools');
310 echo '<p class="description">' . esc_html__('Caution: All data will be lost', 'catch-web-tools') . '</p>';
311 ?>
312 </td>
313 </tr>
314 </tbody>
315 </table>
316
317 <?php submit_button(esc_html__('Save Changes', 'catch-web-tools')); ?>
318 </div>
319 </div>
320 </form>
321 <?php endif; ?>
322 </div><!-- .content -->
323 </div><!-- .content-wrapper -->
324 </div><!-- #customcss -->
325
326 <?php include('main-footer.php'); ?>