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