| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Simple Floating Menu |
| 4 |
* Plugin URI: https://github.com/pzstar/simple-floating-menu |
| 5 |
* Description: Simple Floating Menu adds a stylish designed menu in your website. |
| 6 |
* Version: 1.3.4 |
| 7 |
* Author: HashThemes |
| 8 |
* Author URI: https://hashthemes.com |
| 9 |
* Text Domain: simple-floating-menu |
| 10 |
* License: GPL-2.0+ |
| 11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 12 |
* Domain Path: /languages |
| 13 |
* |
| 14 |
*/ |
| 15 |
if (!defined('ABSPATH')) |
| 16 |
exit; |
| 17 |
|
| 18 |
define('SFM_VERSION', '1.3.4'); |
| 19 |
define('SFM_FILE', __FILE__); |
| 20 |
define('SFM_PLUGIN_BASENAME', plugin_basename(SFM_FILE)); |
| 21 |
define('SFM_PATH', plugin_dir_path(SFM_FILE)); |
| 22 |
define('SFM_URL', plugins_url('/', SFM_FILE)); |
| 23 |
|
| 24 |
if (!class_exists('Simple_Floating_Menu')) { |
| 25 |
|
| 26 |
class Simple_Floating_Menu { |
| 27 |
|
| 28 |
/** |
| 29 |
* Instance of this class. |
| 30 |
* |
| 31 |
* @var object |
| 32 |
*/ |
| 33 |
protected static $instance = null; |
| 34 |
|
| 35 |
/* Saved Settings */ |
| 36 |
public $settings; |
| 37 |
|
| 38 |
/** |
| 39 |
* Return an instance of this class. |
| 40 |
* |
| 41 |
* @return object A single instance of this class. |
| 42 |
*/ |
| 43 |
public static function get_instance() { |
| 44 |
if (null == self::$instance) { |
| 45 |
self::$instance = new self; |
| 46 |
} |
| 47 |
|
| 48 |
return self::$instance; |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* Initialize the plugin. |
| 53 |
*/ |
| 54 |
private function __construct() { |
| 55 |
|
| 56 |
// Add necesary backend JS |
| 57 |
add_action('admin_enqueue_scripts', array($this, 'load_backends')); |
| 58 |
|
| 59 |
// Include classes. |
| 60 |
$this->includes(); |
| 61 |
|
| 62 |
// WP-Admin Menu |
| 63 |
add_action('admin_menu', array($this, 'load_menu')); |
| 64 |
|
| 65 |
add_action('admin_footer', array($this, 'sfm_dymanic_styles')); |
| 66 |
|
| 67 |
// Process a settings export that generates a .json file of the simple floating menu settings |
| 68 |
add_action('admin_init', array($this, 'sfm_imex_process_settings_export')); |
| 69 |
|
| 70 |
// Process a settings import from a json file |
| 71 |
add_action('admin_init', array($this, 'sfm_imex_process_settings_import')); |
| 72 |
|
| 73 |
add_action('admin_init', array($this, 'welcome_init')); |
| 74 |
add_action('admin_notices', array($this, 'admin_notice_content')); |
| 75 |
|
| 76 |
register_deactivation_hook(__FILE__, array($this, 'erase_hide_notice')); |
| 77 |
} |
| 78 |
|
| 79 |
|
| 80 |
/* |
| 81 |
* WP-ADMIN Menu for importer |
| 82 |
*/ |
| 83 |
|
| 84 |
public function load_menu() { |
| 85 |
// Add the menu item and page |
| 86 |
$page_title = esc_html__('Simple Floating Menu', 'simple-floating-menu'); |
| 87 |
$menu_title = esc_html__('Simple Floating Menu', 'simple-floating-menu'); |
| 88 |
$capability = 'manage_options'; |
| 89 |
$slug = 'simple-floating-menu'; |
| 90 |
$callback = array($this, 'settings_page_content'); |
| 91 |
$icon = 'dashicons-admin-generic'; |
| 92 |
$position = 100; |
| 93 |
|
| 94 |
add_menu_page($page_title, $menu_title, $capability, $slug, $callback, $icon, $position); |
| 95 |
} |
| 96 |
|
| 97 |
/** |
| 98 |
* Include plugin functions. |
| 99 |
*/ |
| 100 |
protected function includes() { |
| 101 |
include_once SFM_PATH . 'inc/style.php'; |
| 102 |
include_once SFM_PATH . 'inc/font-icons.php'; |
| 103 |
include_once SFM_PATH . 'inc/google-fonts-list.php'; |
| 104 |
include_once SFM_PATH . 'frontend.php'; |
| 105 |
include_once SFM_PATH . 'live-preview.php'; |
| 106 |
} |
| 107 |
|
| 108 |
/* |
| 109 |
Register necessary backend js |
| 110 |
*/ |
| 111 |
|
| 112 |
public function load_backends($hook) { |
| 113 |
if ('toplevel_page_simple-floating-menu' == $hook) { |
| 114 |
wp_enqueue_script('chosen', SFM_URL . 'assets/js/chosen.jquery.js', array('jquery'), SFM_VERSION, true); |
| 115 |
wp_enqueue_script('webfont', SFM_URL . 'assets/js/webfont.js', array(), SFM_VERSION, true); |
| 116 |
wp_enqueue_script('wp-color-picker-alpha', SFM_URL . 'assets/js/wp-color-picker-alpha.js', array('jquery', 'wp-color-picker'), SFM_VERSION, true); |
| 117 |
wp_enqueue_script('sfm-admin-script', SFM_URL . 'assets/js/admin-scripts.js', array('jquery', 'jquery-ui-slider', 'jquery-ui-sortable'), SFM_VERSION, true); |
| 118 |
wp_localize_script('sfm-admin-script', 'sfm_obj', array( |
| 119 |
'nonce' => wp_create_nonce('sfm_nonce_update'), |
| 120 |
'ajax_url' => admin_url('admin-ajax.php') |
| 121 |
)); |
| 122 |
|
| 123 |
wp_enqueue_style('wp-color-picker'); |
| 124 |
wp_enqueue_style('fontawesome-6.3.0', SFM_URL . 'assets/css/fontawesome-6.3.0.css', array(), SFM_VERSION); |
| 125 |
wp_enqueue_style('eleganticons', SFM_URL . 'assets/css/eleganticons.css', array(), SFM_VERSION); |
| 126 |
wp_enqueue_style('iconfont', SFM_URL . 'assets/css/icofont.css', array(), SFM_VERSION); |
| 127 |
wp_enqueue_style('materialdesignicons', SFM_URL . 'assets/css/materialdesignicons.css', array(), SFM_VERSION); |
| 128 |
wp_enqueue_style('chosen', SFM_URL . 'assets/css/chosen.css', array(), SFM_VERSION); |
| 129 |
wp_enqueue_style('sfm-fonts', Simple_Floating_Menu_Frontend::sfm_fonts_url(), array(), SFM_VERSION); |
| 130 |
wp_enqueue_style('sfm-style', SFM_URL . 'assets/css/style.css', array(), SFM_VERSION); |
| 131 |
} |
| 132 |
wp_enqueue_style('essentialicon', SFM_URL . 'assets/css/essentialicon.css', array(), SFM_VERSION); |
| 133 |
if (is_rtl()) { |
| 134 |
wp_enqueue_style('sfm-admin-style', SFM_URL . 'assets/css/admin-style.rtl.css', array(), SFM_VERSION); |
| 135 |
} else { |
| 136 |
wp_enqueue_style('sfm-admin-style', SFM_URL . 'assets/css/admin-style.css', array(), SFM_VERSION); |
| 137 |
} |
| 138 |
} |
| 139 |
|
| 140 |
public static function default_settings() { |
| 141 |
$defaults = array( |
| 142 |
'enable_sfm' => 'yes', |
| 143 |
'enable_sfm_setting' => 'yes', |
| 144 |
'sfm_load_google_font_locally' => 'no', |
| 145 |
'buttons' => array(array( |
| 146 |
'id' => uniqid('sfm-'), |
| 147 |
'icon' => 'icofont-dart', |
| 148 |
'url' => 'http://', |
| 149 |
'tool_tip_text' => '', |
| 150 |
'open_new_tab' => true, |
| 151 |
'button_bg_color' => '#000000', |
| 152 |
'button_icon_color' => '#FFFFFF', |
| 153 |
'button_bg_color_hover' => '#000000', |
| 154 |
'button_icon_color_hover' => '#FFFFFF', |
| 155 |
'tooltip_bg_color' => '#000000', |
| 156 |
'tooltip_text_color' => '#FFFFFF', |
| 157 |
) |
| 158 |
), |
| 159 |
'tooltip_font' => array( |
| 160 |
'family' => 'Open Sans', |
| 161 |
'style' => '400', |
| 162 |
'transform' => 'none', |
| 163 |
'decoration' => 'none', |
| 164 |
'size' => '16', |
| 165 |
'line_height' => '1', |
| 166 |
'letter_spacing' => '0', |
| 167 |
), |
| 168 |
'position' => 'middle-right', |
| 169 |
'orientation' => 'vertical', |
| 170 |
'style' => 'sfm-rect', |
| 171 |
'button_height' => 50, |
| 172 |
'button_width' => 50, |
| 173 |
'icon_size' => 16, |
| 174 |
'icon_position' => 0, |
| 175 |
'top_offset' => 0, |
| 176 |
'bottom_offset' => 0, |
| 177 |
'left_offset' => 0, |
| 178 |
'right_offset' => 0, |
| 179 |
'button_spacing' => 5, |
| 180 |
'zindex' => 999, |
| 181 |
'button_shadow' => array( |
| 182 |
'x' => 0, |
| 183 |
'y' => 0, |
| 184 |
'blur' => 0, |
| 185 |
'color' => '' |
| 186 |
) |
| 187 |
); |
| 188 |
return $defaults; |
| 189 |
} |
| 190 |
|
| 191 |
public static function get_settings() { |
| 192 |
$defaults = self::default_settings(); |
| 193 |
$sfm_settings = get_option('sfm_settings'); |
| 194 |
$sfm_settings = wp_parse_args($sfm_settings, $defaults); |
| 195 |
return $sfm_settings; |
| 196 |
} |
| 197 |
|
| 198 |
public function settings_page_content() { |
| 199 |
$settings_array = apply_filters('sfm_settings_page_content_array', array( |
| 200 |
'sfm-buttons-nav' => array( |
| 201 |
'href' => '#tab-sfm-buttons', |
| 202 |
'icon' => 'mdi mdi-animation', |
| 203 |
'title' => esc_html__('Buttons', 'simple-floating-menu') |
| 204 |
), |
| 205 |
'sfm-setting-nav' => array( |
| 206 |
'href' => '#tab-sfm-settings', |
| 207 |
'icon' => 'mdi mdi-application-edit-outline', |
| 208 |
'title' => esc_html__('Settings', 'simple-floating-menu') |
| 209 |
), |
| 210 |
'sfm-imex-nav' => array( |
| 211 |
'href' => '#tab-sfm-imex', |
| 212 |
'icon' => 'mdi mdi-database-export', |
| 213 |
'title' => esc_html__('Import/Export', 'simple-floating-menu') |
| 214 |
), |
| 215 |
'sfm-upgrade-nav' => array( |
| 216 |
'href' => '#tab-upgrade-pro', |
| 217 |
'icon' => 'mdi mdi-arrow-up-bold', |
| 218 |
'title' => esc_html__('Premium Features', 'simple-floating-menu'), |
| 219 |
'image' => SFM_URL . 'assets/img/upgrade-pro.png' |
| 220 |
), |
| 221 |
)); |
| 222 |
?> |
| 223 |
<div class="sfm-wrap"> |
| 224 |
<div class="sfm-title-bar"> |
| 225 |
<h2> |
| 226 |
<i class="essentialicon-menu"></i> |
| 227 |
<?php esc_html_e('Simple Floating Menu Settings', 'simple-floating-menu'); ?> |
| 228 |
<span>- v <?php echo SFM_VERSION; ?></span> |
| 229 |
</h2> |
| 230 |
</div> |
| 231 |
|
| 232 |
<div class="wrap"> |
| 233 |
<h1></h1> |
| 234 |
</div> |
| 235 |
|
| 236 |
<div id="sfm-header"> |
| 237 |
<div id="sfm-tab-wrapper" class="sfm-tab-wrapper"> |
| 238 |
<?php |
| 239 |
$count = 1; |
| 240 |
foreach ($settings_array as $id => $settings) { |
| 241 |
?> |
| 242 |
<a id="<?php echo esc_attr($id) ?>" class="sfm-tab <?php echo $count == 1 ? 'sfm-tab-active' : '' ?>" href="<?php echo esc_attr($settings['href']) ?>"> |
| 243 |
<i class="<?php echo esc_attr($settings['icon']) ?>"></i> |
| 244 |
<?php echo esc_html($settings['title']) ?> |
| 245 |
<?php if (isset($settings['image'])): ?> |
| 246 |
<img src="<?php echo esc_url($settings['image']) ?>"> |
| 247 |
<?php endif; ?> |
| 248 |
</a> |
| 249 |
<?php |
| 250 |
$count++; |
| 251 |
} |
| 252 |
?> |
| 253 |
</div> |
| 254 |
</div> |
| 255 |
|
| 256 |
<div id="sfm-form-wrap"> |
| 257 |
<div class="sfm-form-start"> |
| 258 |
<?php |
| 259 |
if (isset($_POST['updated']) && $_POST['updated'] === 'true') { |
| 260 |
$this->handle_form(); |
| 261 |
} |
| 262 |
|
| 263 |
$sfm_settings = self::get_settings(); |
| 264 |
?> |
| 265 |
<form method="POST"> |
| 266 |
<input type="hidden" name="updated" value="true" /> |
| 267 |
<?php wp_nonce_field('sfm_nonce_update', 'sfm_nonce'); ?> |
| 268 |
|
| 269 |
<div class="form-row sfm-form-row"> |
| 270 |
<label class="form-label"><?php esc_html_e('Enable Floating Menu', 'simple-floating-menu'); ?></label> |
| 271 |
<div class="form-field"> |
| 272 |
<div class="onoff-switch"> |
| 273 |
<?php |
| 274 |
$enable_sfm = isset($sfm_settings['enable_sfm']) ? $sfm_settings['enable_sfm'] : 'yes'; |
| 275 |
?> |
| 276 |
<input type="checkbox" id="enable_sfm" name="sfm_settings[enable_sfm]" class="onoff-switch-checkbox" value="1" <?php checked($enable_sfm, 'yes'); ?>> |
| 277 |
<label class="onoff-switch-label" for="enable_sfm"></label> |
| 278 |
</div> |
| 279 |
</div> |
| 280 |
</div> |
| 281 |
|
| 282 |
<div class="form-row sfm-form-row"> |
| 283 |
<label class="form-label"><?php esc_html_e('Display Setting Button on Menu', 'simple-floating-menu'); ?><br /> |
| 284 |
<span><?php esc_html_e('Displays only for the Administrator on the Frontend so that you can quickly access the setting page for edit.', 'simple-floating-menu'); ?></span></label> |
| 285 |
<div class="form-field"> |
| 286 |
<div class="onoff-switch"> |
| 287 |
<?php |
| 288 |
$enable_sfm_setting = isset($sfm_settings['enable_sfm_setting']) ? $sfm_settings['enable_sfm_setting'] : 'yes'; |
| 289 |
?> |
| 290 |
<input type="checkbox" id="enable_sfm_setting" name="sfm_settings[enable_sfm_setting]" class="onoff-switch-checkbox" value="1" <?php checked($enable_sfm_setting, 'yes'); ?>> |
| 291 |
<label class="onoff-switch-label" for="enable_sfm_setting"></label> |
| 292 |
</div> |
| 293 |
</div> |
| 294 |
</div> |
| 295 |
|
| 296 |
<div id="tab-sfm-buttons" class="sfm-form-page sfm-active"> |
| 297 |
<div id="sfm-buttons-settings"> |
| 298 |
<?php |
| 299 |
$buttons = $sfm_settings['buttons']; |
| 300 |
$count = count($buttons); |
| 301 |
?> |
| 302 |
<div class="sfm-button-repeater" data-count="<?php echo esc_attr($count); ?>"> |
| 303 |
<?php |
| 304 |
$count = 0; |
| 305 |
foreach ($buttons as $button) { |
| 306 |
?> |
| 307 |
<div class="sfm-button-fields"> |
| 308 |
<div class="sfm-button-fields-header"> |
| 309 |
<div class="sfm-drag"><i class="icofont-drag"></i></div> |
| 310 |
<?php esc_html_e('Button', 'simple-floating-menu'); ?> |
| 311 |
<div class="sfm-remove"><i class="mdi-trash-can-outline"></i></div> |
| 312 |
</div> |
| 313 |
<div class="form-row"> |
| 314 |
<label class="form-label"><?php esc_html_e('Choose Icon', 'simple-floating-menu'); ?></label> |
| 315 |
<div class="form-field"> |
| 316 |
<?php |
| 317 |
echo '<div class="sfm-customizer-icon-box">'; |
| 318 |
echo '<div class="sfm-selected-icon">'; |
| 319 |
echo '<i class="' . esc_attr($button['icon']) . '"></i>'; |
| 320 |
echo '<span><i class="icofont-simple-down"></i></span>'; |
| 321 |
echo '</div>'; |
| 322 |
echo '<div class="sfm-icon-box">'; |
| 323 |
echo '<div class="sfm-icon-search">'; |
| 324 |
echo '<select>'; |
| 325 |
|
| 326 |
if (apply_filters('sfm_show_ico_font', true)) { |
| 327 |
echo '<option value="sfm-icofont-list">' . esc_html__('Ico Font', 'simple-floating-menu') . '</option>'; |
| 328 |
} |
| 329 |
|
| 330 |
if (apply_filters('sfm_show_font_awesome', true)) { |
| 331 |
echo '<option value="sfm-fontawesome-list">' . esc_html__('Font Awesome', 'simple-floating-menu') . '</option>'; |
| 332 |
} |
| 333 |
|
| 334 |
if (apply_filters('sfm_show_essential_icon', true)) { |
| 335 |
echo '<option value="sfm-essential-icon-list">' . esc_html__('Essential Icon', 'simple-floating-menu') . '</option>'; |
| 336 |
} |
| 337 |
|
| 338 |
if (apply_filters('sfm_show_material_icon', true)) { |
| 339 |
echo '<option value="sfm-material-icon-list">' . esc_html__('Material Icon', 'simple-floating-menu') . '</option>'; |
| 340 |
} |
| 341 |
|
| 342 |
if (apply_filters('sfm_show_elegant_icon', true)) { |
| 343 |
echo '<option value="sfm-elegant-icon-list">' . esc_html__('Elegant Icon', 'simple-floating-menu') . '</option>'; |
| 344 |
} |
| 345 |
|
| 346 |
echo '</select>'; |
| 347 |
echo '<input type="text" class="sfm-icon-search-input" placeholder="' . esc_html__('Type to filter', 'simple-floating-menu') . '" />'; |
| 348 |
echo '</div>'; |
| 349 |
|
| 350 |
if (apply_filters('sfm_show_ico_font', true)) { |
| 351 |
echo '<ul class="sfm-icon-list sfm-icofont-list clearfix active">'; |
| 352 |
$sfm_icofont_icon_array = sfm_icofont_icon_array(); |
| 353 |
foreach ($sfm_icofont_icon_array as $sfm_icofont_icon) { |
| 354 |
$icon_class = $button['icon'] == $sfm_icofont_icon ? 'icon-active' : ''; |
| 355 |
echo '<li class=' . esc_attr($icon_class) . '><i class="' . esc_attr($sfm_icofont_icon) . '"></i></li>'; |
| 356 |
} |
| 357 |
echo '</ul>'; |
| 358 |
} |
| 359 |
|
| 360 |
if (apply_filters('sfm_show_font_awesome', true)) { |
| 361 |
echo '<ul class="sfm-icon-list sfm-fontawesome-list clearfix">'; |
| 362 |
$sfm_font_awesome_icon_array = sfm_font_awesome_icon_array(); |
| 363 |
foreach ($sfm_font_awesome_icon_array as $sfm_font_awesome_icon) { |
| 364 |
$icon_class = $button['icon'] == $sfm_font_awesome_icon ? 'icon-active' : ''; |
| 365 |
echo '<li class=' . esc_attr($icon_class) . '><i class="' . esc_attr($sfm_font_awesome_icon) . '"></i></li>'; |
| 366 |
} |
| 367 |
echo '</ul>'; |
| 368 |
} |
| 369 |
|
| 370 |
if (apply_filters('sfm_show_essential_icon', true)) { |
| 371 |
echo '<ul class="sfm-icon-list sfm-essential-icon-list clearfix">'; |
| 372 |
$sfm_essential_icon_array = sfm_essential_icon_array(); |
| 373 |
foreach ($sfm_essential_icon_array as $sfm_essential_icon) { |
| 374 |
$icon_class = $button['icon'] == $sfm_essential_icon ? 'icon-active' : ''; |
| 375 |
echo '<li class=' . esc_attr($icon_class) . '><i class="' . esc_attr($sfm_essential_icon) . '"></i></li>'; |
| 376 |
} |
| 377 |
echo '</ul>'; |
| 378 |
} |
| 379 |
|
| 380 |
if (apply_filters('sfm_show_material_icon', true)) { |
| 381 |
echo '<ul class="sfm-icon-list sfm-material-icon-list clearfix">'; |
| 382 |
$sfm_materialdesignicons_icon_array = sfm_materialdesignicons_array(); |
| 383 |
foreach ($sfm_materialdesignicons_icon_array as $sfm_materialdesignicons_icon) { |
| 384 |
$icon_class = $button['icon'] == $sfm_materialdesignicons_icon ? 'icon-active' : ''; |
| 385 |
echo '<li class=' . esc_attr($icon_class) . '><i class="' . esc_attr($sfm_materialdesignicons_icon) . '"></i></li>'; |
| 386 |
} |
| 387 |
echo '</ul>'; |
| 388 |
} |
| 389 |
|
| 390 |
if (apply_filters('sfm_show_elegant_icon', true)) { |
| 391 |
echo '<ul class="sfm-icon-list sfm-elegant-icon-list clearfix">'; |
| 392 |
$sfm_eleganticons_icon_array = sfm_eleganticons_array(); |
| 393 |
foreach ($sfm_eleganticons_icon_array as $sfm_eleganticons_icon) { |
| 394 |
$icon_class = $button['icon'] == $sfm_eleganticons_icon ? 'icon-active' : ''; |
| 395 |
echo '<li class=' . esc_attr($icon_class) . '><i class="' . esc_attr($sfm_eleganticons_icon) . '"></i></li>'; |
| 396 |
} |
| 397 |
echo '</ul>'; |
| 398 |
} |
| 399 |
|
| 400 |
echo '</div>'; |
| 401 |
echo '<input class="sfm-icon" type="hidden" value="' . esc_attr($button['icon']) . '" name="sfm_settings[buttons][' . esc_attr($count) . '][icon]" data-default="icofont-dart"/>'; |
| 402 |
echo '</div>'; |
| 403 |
?> |
| 404 |
</div> |
| 405 |
</div> |
| 406 |
|
| 407 |
<div class="form-row"> |
| 408 |
<label class="form-label"><?php esc_html_e('Button Url', 'simple-floating-menu'); ?></label> |
| 409 |
<div class="form-field"> |
| 410 |
<input name="sfm_settings[buttons][<?php echo esc_attr($count); ?>][url]" type="text" value="<?php echo esc_attr($button['url']); ?>" class="regular-text sfm-ltr" data-default="http://" /> |
| 411 |
<p class="form-description"><?php esc_html_e('Leaving empty will not display the button', 'simple-floating-menu'); ?></p> |
| 412 |
</div> |
| 413 |
</div> |
| 414 |
<div class="form-row"> |
| 415 |
<label class="form-label"><?php esc_html_e('Tool Tip Text', 'simple-floating-menu'); ?></label> |
| 416 |
<div class="form-field"> |
| 417 |
<input name="sfm_settings[buttons][<?php echo esc_attr($count); ?>][tool_tip_text]" type="text" value="<?php echo esc_html($button['tool_tip_text']); ?>" class="regular-text" /> |
| 418 |
<p class="form-description"><?php esc_html_e('This text will display on hovering the button', 'simple-floating-menu'); ?></p> |
| 419 |
</div> |
| 420 |
</div> |
| 421 |
<div class="form-row"> |
| 422 |
<label class="form-label"><?php esc_html_e('Open in New Tab', 'simple-floating-menu'); ?></label> |
| 423 |
<div class="form-field"> |
| 424 |
<label class="form-label"> |
| 425 |
<?php |
| 426 |
$checkbox_val = isset($button['open_new_tab']) ? true : false; |
| 427 |
?> |
| 428 |
<input name="sfm_settings[buttons][<?php echo esc_attr($count); ?>][open_new_tab]" type="checkbox" value="1" <?php checked($checkbox_val, 1); ?>> |
| 429 |
<?php esc_html_e('Open in New Tab', 'simple-floating-menu'); ?> |
| 430 |
</label> |
| 431 |
</div> |
| 432 |
</div> |
| 433 |
<div class="form-row"> |
| 434 |
<div class="form-flex form-col-2"> |
| 435 |
<div class="form-col"> |
| 436 |
<label class="form-label"><?php esc_html_e('Button Background Color', 'simple-floating-menu'); ?></label> |
| 437 |
<div class="form-field"> |
| 438 |
<input class="sfm-color-picker sfm-button-bg-color" name="sfm_settings[buttons][<?php echo esc_attr($count); ?>][button_bg_color]" type="text" value="<?php echo sanitize_hex_color($button['button_bg_color']); ?>" data-default="#000000" /> |
| 439 |
</div> |
| 440 |
</div> |
| 441 |
|
| 442 |
<div class="form-col"> |
| 443 |
<label class="form-label"><?php esc_html_e('Button Icon Color', 'simple-floating-menu'); ?></label> |
| 444 |
<div class="form-field"><input class="sfm-color-picker sfm-icon-color" name="sfm_settings[buttons][<?php echo esc_attr($count); ?>][button_icon_color]" type="text" value="<?php echo sanitize_hex_color($button['button_icon_color']); ?>" data-default="#FFFFFF" /></div> |
| 445 |
</div> |
| 446 |
<div class="form-col"> |
| 447 |
<label class="form-label"><?php esc_html_e('Button Background Color Hover', 'simple-floating-menu'); ?></label> |
| 448 |
<div class="form-field"><input class="sfm-color-picker sfm-button-bg-color-hover" name="sfm_settings[buttons][<?php echo esc_attr($count); ?>][button_bg_color_hover]" type="text" value="<?php echo sanitize_hex_color($button['button_bg_color_hover']); ?>" data-default="#000000" /></div> |
| 449 |
</div> |
| 450 |
<div class="form-col"> |
| 451 |
<label class="form-label"><?php esc_html_e('Button Icon Color Hover', 'simple-floating-menu'); ?></label> |
| 452 |
<div class="form-field"><input class="sfm-color-picker sfm-icon-color-hover" name="sfm_settings[buttons][<?php echo esc_attr($count); ?>][button_icon_color_hover]" type="text" value="<?php echo sanitize_hex_color($button['button_icon_color_hover']); ?>" data-default="#FFFFFF" /></div> |
| 453 |
</div> |
| 454 |
</div> |
| 455 |
</div> |
| 456 |
<div class="form-row"> |
| 457 |
<div class="form-flex form-col-2"> |
| 458 |
<div class="form-col"> |
| 459 |
<label class="form-label"><?php esc_html_e('Tool Tip Background Color', 'simple-floating-menu'); ?></label> |
| 460 |
<div class="form-field"><input class="sfm-color-picker sfm-tool-tip-bg-color" name="sfm_settings[buttons][<?php echo esc_attr($count); ?>][tooltip_bg_color]" type="text" value="<?php echo sanitize_hex_color($button['tooltip_bg_color']); ?>" data-default="#000000" /></div> |
| 461 |
</div> |
| 462 |
<div class="form-col"> |
| 463 |
<label class="form-label"><?php esc_html_e('Tool Tip Text Color', 'simple-floating-menu'); ?></label> |
| 464 |
<div class="form-field"><input class="sfm-color-picker sfm-tool-tip-text-color" name="sfm_settings[buttons][<?php echo esc_attr($count); ?>][tooltip_text_color]" type="text" value="<?php echo sanitize_hex_color($button['tooltip_text_color']); ?>" data-default="#FFFFFF" /></div> |
| 465 |
</div> |
| 466 |
</div> |
| 467 |
</div> |
| 468 |
<input name="sfm_settings[buttons][<?php echo esc_attr($count); ?>][id]" type="hidden" class="sfm-unique-id" value="<?php echo esc_attr($button['id']); ?>"> |
| 469 |
</div> |
| 470 |
<?php |
| 471 |
$count++; |
| 472 |
} |
| 473 |
?> |
| 474 |
</div> |
| 475 |
<div class="sfm-add-new-button-fields"><a class="button" href="#"><i class="mdi mdi-plus"></i> <?php esc_html_e('Add New', 'simple-floating-menu'); ?></a></div> |
| 476 |
</div> |
| 477 |
<p class="submit"> |
| 478 |
<button type="submit" name="submit" class="button button-primary"><i class="mdi mdi-content-save"></i> <?php esc_html_e('Save Settings', 'simple-floating-menu'); ?></button> |
| 479 |
</p> |
| 480 |
</div> |
| 481 |
|
| 482 |
<div id="tab-sfm-settings" class="sfm-form-page"> |
| 483 |
<div class="form-row sfm-form-row"> |
| 484 |
<label class="form-label"><?php esc_html_e('Load Google Fonts Locally', 'simple-floating-menu'); ?><br /><span><?php esc_html_e('It is required to load the Google Fonts locally in order to comply with GDPR. However, if your website is not required to comply with GDPR then you can check this field off.', 'simple-floating-menu'); ?></span></label> |
| 485 |
<div class="form-field"> |
| 486 |
<div class="onoff-switch"> |
| 487 |
<?php |
| 488 |
$sfm_load_google_font_locally = isset($sfm_settings['sfm_load_google_font_locally']) ? $sfm_settings['sfm_load_google_font_locally'] : 'no'; |
| 489 |
?> |
| 490 |
<input type="checkbox" id="sfm_load_google_font_locally" name="sfm_settings[sfm_load_google_font_locally]" class="onoff-switch-checkbox" value="1" <?php checked($sfm_load_google_font_locally, 'yes'); ?>> |
| 491 |
<label class="onoff-switch-label" for="sfm_load_google_font_locally"></label> |
| 492 |
</div> |
| 493 |
</div> |
| 494 |
</div> |
| 495 |
<table class="form-table"> |
| 496 |
<tbody> |
| 497 |
<tr> |
| 498 |
<th><label><?php esc_html_e('Button Position', 'simple-floating-menu'); ?></label></th> |
| 499 |
<td> |
| 500 |
<select class="sfm-button-position" name="sfm_settings[position]"> |
| 501 |
<option value="top-left" <?php selected($sfm_settings['position'], 'top-left'); ?>><?php esc_html_e('Top Left', 'simple-floating-menu'); ?></option> |
| 502 |
<option value="top-middle" <?php selected($sfm_settings['position'], 'top-middle'); ?>><?php esc_html_e('Top Middle', 'simple-floating-menu'); ?></option> |
| 503 |
<option value="top-right" <?php selected($sfm_settings['position'], 'top-right'); ?>><?php esc_html_e('Top Right', 'simple-floating-menu'); ?></option> |
| 504 |
<option value="bottom-left" <?php selected($sfm_settings['position'], 'bottom-left'); ?>><?php esc_html_e('Bottom Left', 'simple-floating-menu'); ?></option> |
| 505 |
<option value="bottom-middle" <?php selected($sfm_settings['position'], 'bottom-middle'); ?>><?php esc_html_e('Bottom Middle', 'simple-floating-menu'); ?></option> |
| 506 |
<option value="bottom-right" <?php selected($sfm_settings['position'], 'bottom-right'); ?>><?php esc_html_e('Bottom Right', 'simple-floating-menu'); ?></option> |
| 507 |
<option value="middle-left" <?php selected($sfm_settings['position'], 'middle-left'); ?>><?php esc_html_e('Middle Left', 'simple-floating-menu'); ?></option> |
| 508 |
<option value="middle-right" <?php selected($sfm_settings['position'], 'middle-right'); ?>><?php esc_html_e('Middle Right', 'simple-floating-menu'); ?></option> |
| 509 |
</select> |
| 510 |
</td> |
| 511 |
</tr> |
| 512 |
<tr> |
| 513 |
<th><label><?php esc_html_e('Orientation', 'simple-floating-menu'); ?></label></th> |
| 514 |
<td> |
| 515 |
<select class="sfm-button-orientation" name="sfm_settings[orientation]"> |
| 516 |
<option value="horizontal" <?php selected($sfm_settings['orientation'], 'horizontal'); ?>><?php esc_html_e('Horizontal', 'simple-floating-menu'); ?></option> |
| 517 |
<option value="vertical" <?php selected($sfm_settings['orientation'], 'vertical'); ?>><?php esc_html_e('Vertical', 'simple-floating-menu'); ?></option> |
| 518 |
</select> |
| 519 |
</td> |
| 520 |
</tr> |
| 521 |
|
| 522 |
<tr> |
| 523 |
<th><label><?php esc_html_e('Button Style', 'simple-floating-menu'); ?></label></th> |
| 524 |
<td> |
| 525 |
<select class="sfm-button-style" name="sfm_settings[style]"> |
| 526 |
<option value="sfm-rect" <?php selected($sfm_settings['style'], 'sfm-rect'); ?>><?php esc_html_e('Rectangle', 'simple-floating-menu'); ?></option> |
| 527 |
<option value="sfm-round" <?php selected($sfm_settings['style'], 'sfm-round'); ?>><?php esc_html_e('Round', 'simple-floating-menu'); ?></option> |
| 528 |
<option value="sfm-triangle" <?php selected($sfm_settings['style'], 'sfm-triangle'); ?>><?php esc_html_e('Triangle', 'simple-floating-menu'); ?></option> |
| 529 |
<option value="sfm-rhombus" <?php selected($sfm_settings['style'], 'sfm-rhombus'); ?>><?php esc_html_e('Rhombus', 'simple-floating-menu'); ?></option> |
| 530 |
<option value="sfm-pentagon" <?php selected($sfm_settings['style'], 'sfm-pentagon'); ?>><?php esc_html_e('Pentagon', 'simple-floating-menu'); ?></option> |
| 531 |
<option value="sfm-hexagon" <?php selected($sfm_settings['style'], 'sfm-hexagon'); ?>><?php esc_html_e('Hexagon', 'simple-floating-menu'); ?></option> |
| 532 |
<option value="sfm-star" <?php selected($sfm_settings['style'], 'sfm-star'); ?>><?php esc_html_e('Star', 'simple-floating-menu'); ?></option> |
| 533 |
<option value="sfm-rabbet" <?php selected($sfm_settings['style'], 'sfm-rabbet'); ?>><?php esc_html_e('Rabbet', 'simple-floating-menu'); ?></option> |
| 534 |
<option value="sfm-oval" <?php selected($sfm_settings['style'], 'sfm-oval'); ?>><?php esc_html_e('Oval', 'simple-floating-menu'); ?></option> |
| 535 |
</select> |
| 536 |
</td> |
| 537 |
</tr> |
| 538 |
<tr> |
| 539 |
<td colspan="2" class="sfm-seperator"> |
| 540 |
<hr> |
| 541 |
</td> |
| 542 |
</tr> |
| 543 |
<tr> |
| 544 |
<th><label><?php esc_html_e('Button Height', 'simple-floating-menu'); ?></label></th> |
| 545 |
<td> |
| 546 |
<?php |
| 547 |
echo '<div class="sfm-range-slider">'; |
| 548 |
echo '<div class="range-input" value="' . absint($sfm_settings['button_height']) . '" data-min="40" data-max="200" data-step="1"></div>'; |
| 549 |
echo '<input class="range-input-selector sfm-button-height" type="hidden" value="' . absint($sfm_settings['button_height']) . '" name="sfm_settings[button_height]"/>'; |
| 550 |
echo '</div>'; |
| 551 |
?> |
| 552 |
</td> |
| 553 |
</tr> |
| 554 |
<tr> |
| 555 |
<th><label><?php esc_html_e('Button Width', 'simple-floating-menu'); ?></label></th> |
| 556 |
<td> |
| 557 |
<?php |
| 558 |
echo '<div class="sfm-range-slider">'; |
| 559 |
echo '<div class="range-input" value="' . absint($sfm_settings['button_width']) . '" data-min="40" data-max="200" data-step="1"></div>'; |
| 560 |
echo '<input class="range-input-selector sfm-button-width" type="hidden" value="' . absint($sfm_settings['button_width']) . '" name="sfm_settings[button_width]"/>'; |
| 561 |
echo '</div>'; |
| 562 |
?> |
| 563 |
</td> |
| 564 |
</tr> |
| 565 |
<tr> |
| 566 |
<th><label><?php esc_html_e('Button Shadow', 'simple-floating-menu'); ?></label></th> |
| 567 |
<td> |
| 568 |
<ul class="sfm-shadow-fields"> |
| 569 |
<li class="sfm-shadow-settings-field"> |
| 570 |
<input type="number" name="sfm_settings[button_shadow][x]" value="<?php echo absint($sfm_settings['button_shadow']['x']) ?>"> |
| 571 |
<label><?php esc_html_e('X', 'simple-floating-menu'); ?></label> |
| 572 |
</li> |
| 573 |
<li class="sfm-shadow-settings-field"> |
| 574 |
<input type="number" name="sfm_settings[button_shadow][y]" value="<?php echo absint($sfm_settings['button_shadow']['y']) ?>"> |
| 575 |
<label><?php esc_html_e('Y', 'simple-floating-menu'); ?></label> |
| 576 |
</li> |
| 577 |
<li class="sfm-shadow-settings-field"> |
| 578 |
<input type="number" name="sfm_settings[button_shadow][blur]" value="<?php echo absint($sfm_settings['button_shadow']['blur']) ?>"> |
| 579 |
<label><?php esc_html_e('Blur', 'simple-floating-menu'); ?></label> |
| 580 |
</li> |
| 581 |
<li class="sfm-shadow-settings-field"> |
| 582 |
<div class="uwcc-color-input-field"> |
| 583 |
<input type="text" class="sfm-color-picker" data-alpha-enabled="true" data-alpha-custom-width="30px" data-alpha-color-type="hex" name="sfm_settings[button_shadow][color]" value="<?php echo esc_attr($sfm_settings['button_shadow']['color']) ?>" data-default="#000000"> |
| 584 |
</div> |
| 585 |
</li> |
| 586 |
</ul> |
| 587 |
</td> |
| 588 |
</tr> |
| 589 |
<tr> |
| 590 |
<td colspan="2" class="sfm-seperator"> |
| 591 |
<hr> |
| 592 |
</td> |
| 593 |
</tr> |
| 594 |
<tr> |
| 595 |
<th><label><?php esc_html_e('Icon Size', 'simple-floating-menu'); ?></label></th> |
| 596 |
<td> |
| 597 |
<?php |
| 598 |
echo '<div class="sfm-range-slider">'; |
| 599 |
echo '<div class="range-input" value="' . absint($sfm_settings['icon_size']) . '" data-min="10" data-max="60" data-step="1"></div>'; |
| 600 |
echo '<input class="range-input-selector sfm-icon-size" type="hidden" value="' . absint($sfm_settings['icon_size']) . '" name="sfm_settings[icon_size]"/>'; |
| 601 |
echo '</div>'; |
| 602 |
?> |
| 603 |
</td> |
| 604 |
</tr> |
| 605 |
<tr> |
| 606 |
<th><label><?php esc_html_e('Icon Vertical Position', 'simple-floating-menu'); ?></label></th> |
| 607 |
<td> |
| 608 |
<?php |
| 609 |
echo '<div class="sfm-range-slider">'; |
| 610 |
echo '<div class="range-input" value="' . absint($sfm_settings['icon_position']) . '" data-min="-40" data-max="40" data-step="1"></div>'; |
| 611 |
echo '<input class="range-input-selector sfm-icon-position" type="hidden" value="' . absint($sfm_settings['icon_position']) . '" name="sfm_settings[icon_position]"/>'; |
| 612 |
echo '</div>'; |
| 613 |
?> |
| 614 |
</td> |
| 615 |
</tr> |
| 616 |
<tr> |
| 617 |
<td colspan="2" class="sfm-seperator"> |
| 618 |
<hr> |
| 619 |
</td> |
| 620 |
</tr> |
| 621 |
<tr> |
| 622 |
<th><label><?php esc_html_e('Tool Tip Typography', 'simple-floating-menu'); ?></label></th> |
| 623 |
<td> |
| 624 |
<ul class="sfm-typography-fields"> |
| 625 |
<li class="sfm-typography-font-family"> |
| 626 |
<div class="form-row"> |
| 627 |
<label class="form-label"><?php esc_html_e('Font Family', 'simple-floating-menu'); ?></label> |
| 628 |
|
| 629 |
<div class="form-field"> |
| 630 |
<select name="sfm_settings[tooltip_font][family]" class="typography_face"> |
| 631 |
|
| 632 |
<?php |
| 633 |
$standard_fonts = sfm_get_standard_font_families(); |
| 634 |
if ($standard_fonts) { |
| 635 |
?> |
| 636 |
<optgroup label="Standard Fonts"> |
| 637 |
<?php foreach ($standard_fonts as $standard_font) { ?> |
| 638 |
<option value="<?php echo esc_attr($standard_font); ?>" <?php selected($sfm_settings['tooltip_font']['family'], $standard_font); ?>><?php echo esc_html($standard_font); ?></option> |
| 639 |
<?php } ?> |
| 640 |
</optgroup> |
| 641 |
<?php } ?> |
| 642 |
|
| 643 |
<?php |
| 644 |
$google_fonts = sfm_get_google_font_families(); |
| 645 |
if ($google_fonts) { |
| 646 |
?> |
| 647 |
<optgroup label="Google Fonts"> |
| 648 |
<?php foreach ($google_fonts as $google_font) { ?> |
| 649 |
<option value="<?php echo esc_attr($google_font); ?>" <?php selected($sfm_settings['tooltip_font']['family'], $google_font); ?>><?php echo esc_html($google_font); ?></option> |
| 650 |
<?php } ?> |
| 651 |
</optgroup> |
| 652 |
<?php } ?> |
| 653 |
|
| 654 |
</select> |
| 655 |
</div> |
| 656 |
</div> |
| 657 |
</li> |
| 658 |
|
| 659 |
<li class="sfm-typography-font-style"> |
| 660 |
<div class="form-row"> |
| 661 |
<label class="form-label"><?php esc_html_e('Font Style', 'simple-floating-menu'); ?></label> |
| 662 |
|
| 663 |
<div class="form-field"> |
| 664 |
<?php |
| 665 |
$family = $sfm_settings['tooltip_font']['family']; |
| 666 |
$font_weights = sfm_get_font_weight_choices($family); |
| 667 |
if ($font_weights) { |
| 668 |
?> |
| 669 |
<select name="sfm_settings[tooltip_font][style]" class="typography_font_style"> |
| 670 |
<?php foreach ($font_weights as $font_weight => $font_weight_label) { ?> |
| 671 |
<option value="<?php echo esc_attr($font_weight); ?>" <?php selected($sfm_settings['tooltip_font']['style'], $font_weight); ?>><?php echo esc_html($font_weight_label); ?></option> |
| 672 |
<?php } ?> |
| 673 |
</select> |
| 674 |
<?php } ?> |
| 675 |
</div> |
| 676 |
</div> |
| 677 |
</li> |
| 678 |
|
| 679 |
<li class="sfm-typography-text-transform"> |
| 680 |
<div class="form-row"> |
| 681 |
<label class="form-label"><?php esc_html_e('Text Transform', 'simple-floating-menu'); ?></label> |
| 682 |
|
| 683 |
<div class="form-field"> |
| 684 |
<?php |
| 685 |
$text_transforms = sfm_get_text_transform_choices(); |
| 686 |
if ($text_transforms) { |
| 687 |
?> |
| 688 |
<select name="sfm_settings[tooltip_font][transform]" class="typography_text_transform"> |
| 689 |
<?php foreach ($text_transforms as $key => $value) { ?> |
| 690 |
<option value="<?php echo esc_attr($key) ?>" <?php selected($sfm_settings['tooltip_font']['transform'], $key); ?>><?php echo esc_html($value); ?></option> |
| 691 |
<?php } ?> |
| 692 |
</select> |
| 693 |
<?php } ?> |
| 694 |
</div> |
| 695 |
</div> |
| 696 |
</li> |
| 697 |
|
| 698 |
<li class="sfm-typography-text-decoration"> |
| 699 |
<div class="form-row"> |
| 700 |
<label class="form-label"><?php esc_html_e('Text Decoration', 'simple-floating-menu'); ?></label> |
| 701 |
|
| 702 |
<div class="form-field"> |
| 703 |
<?php |
| 704 |
$text_decorations = sfm_get_text_decoration_choices(); |
| 705 |
if ($text_decorations) { |
| 706 |
?> |
| 707 |
<select name="sfm_settings[tooltip_font][decoration]" class="typography_text_decoration"> |
| 708 |
<?php foreach ($text_decorations as $key => $value) { ?> |
| 709 |
<option value="<?php echo esc_attr($key) ?>" <?php selected($sfm_settings['tooltip_font']['decoration'], $key); ?>><?php echo esc_html($value); ?></option> |
| 710 |
<?php } ?> |
| 711 |
</select> |
| 712 |
<?php } ?> |
| 713 |
</div> |
| 714 |
</div> |
| 715 |
</li> |
| 716 |
|
| 717 |
<li class="sfm-typography-font-size"> |
| 718 |
<div class="form-row"> |
| 719 |
<label class="form-label"><?php esc_html_e('Font Size', 'simple-floating-menu'); ?></label> |
| 720 |
|
| 721 |
<div class="form-field"> |
| 722 |
<div class="sfm-range-slider"> |
| 723 |
<div class="range-input" value="<?php echo absint($sfm_settings['tooltip_font']['size']); ?>" data-min="10" data-max="60" data-step="1"></div> |
| 724 |
<input class="range-input-selector" type="hidden" value="<?php echo absint($sfm_settings['tooltip_font']['size']); ?>" name="sfm_settings[tooltip_font][size]" /> |
| 725 |
</div> |
| 726 |
</div> |
| 727 |
</div> |
| 728 |
</li> |
| 729 |
|
| 730 |
|
| 731 |
<li class="sfm-typography-line-height"> |
| 732 |
<div class="form-row"> |
| 733 |
<label class="form-label"><?php esc_html_e('Line Height', 'simple-floating-menu'); ?></label> |
| 734 |
|
| 735 |
<div class="form-field"> |
| 736 |
<div class="sfm-range-slider"> |
| 737 |
<div class="range-input" value="<?php echo esc_attr($sfm_settings['tooltip_font']['line_height']); ?>" data-min="0.5" data-max="5" data-step="0.1"></div> |
| 738 |
<input class="range-input-selector" type="hidden" value="<?php echo esc_attr($sfm_settings['tooltip_font']['line_height']); ?>" name="sfm_settings[tooltip_font][line_height]" /> |
| 739 |
</div> |
| 740 |
</div> |
| 741 |
</div> |
| 742 |
</li> |
| 743 |
|
| 744 |
|
| 745 |
<li class="sfm-typography-letter-spacing"> |
| 746 |
<div class="form-row"> |
| 747 |
<label class="form-label"><?php esc_html_e('Letter Spacing', 'simple-floating-menu'); ?></label> |
| 748 |
|
| 749 |
<div class="form-field"> |
| 750 |
<div class="sfm-range-slider"> |
| 751 |
<div class="range-input" value="<?php echo esc_attr($sfm_settings['tooltip_font']['letter_spacing']); ?>" data-min="-5" data-max="5" data-step="0.1"></div> |
| 752 |
<input class="range-input-selector" type="hidden" value="<?php echo esc_attr($sfm_settings['tooltip_font']['letter_spacing']); ?>" name="sfm_settings[tooltip_font][letter_spacing]" /> |
| 753 |
</div> |
| 754 |
</div> |
| 755 |
</div> |
| 756 |
</li> |
| 757 |
</ul> |
| 758 |
</td> |
| 759 |
</tr> |
| 760 |
<tr> |
| 761 |
<td colspan="2" class="sfm-seperator"> |
| 762 |
<hr> |
| 763 |
</td> |
| 764 |
</tr> |
| 765 |
<tr class="sfm-top-offset-wrap"> |
| 766 |
<th><label><?php esc_html_e('Floating Menu Top Offset', 'simple-floating-menu'); ?></label></th> |
| 767 |
<td> |
| 768 |
<?php |
| 769 |
echo '<div class="sfm-range-slider">'; |
| 770 |
echo '<div class="range-input" value="' . absint($sfm_settings['top_offset']) . '" data-min="0" data-max="200" data-step="1"></div>'; |
| 771 |
echo '<input class="range-input-selector sfm-top-offset" type="hidden" value="' . absint($sfm_settings['top_offset']) . '" name="sfm_settings[top_offset]"/>'; |
| 772 |
echo '</div>'; |
| 773 |
?> |
| 774 |
</td> |
| 775 |
</tr> |
| 776 |
|
| 777 |
<tr class="sfm-bottom-offset-wrap"> |
| 778 |
<th><label><?php esc_html_e('Floating Menu Bottom Offset', 'simple-floating-menu'); ?></label></th> |
| 779 |
<td> |
| 780 |
<?php |
| 781 |
echo '<div class="sfm-range-slider">'; |
| 782 |
echo '<div class="range-input" value="' . absint($sfm_settings['bottom_offset']) . '" data-min="0" data-max="200" data-step="1"></div>'; |
| 783 |
echo '<input class="range-input-selector sfm-bottom-offset" type="hidden" value="' . absint($sfm_settings['bottom_offset']) . '" name="sfm_settings[bottom_offset]"/>'; |
| 784 |
echo '</div>'; |
| 785 |
?> |
| 786 |
</td> |
| 787 |
</tr> |
| 788 |
|
| 789 |
<tr class="sfm-left-offset-wrap"> |
| 790 |
<th><label><?php esc_html_e('Floating Menu Left Offset', 'simple-floating-menu'); ?></label></th> |
| 791 |
<td> |
| 792 |
<?php |
| 793 |
echo '<div class="sfm-range-slider">'; |
| 794 |
echo '<div class="range-input" value="' . absint($sfm_settings['left_offset']) . '" data-min="0" data-max="200" data-step="1"></div>'; |
| 795 |
echo '<input class="range-input-selector sfm-left-offset" type="hidden" value="' . absint($sfm_settings['left_offset']) . '" name="sfm_settings[left_offset]"/>'; |
| 796 |
echo '</div>'; |
| 797 |
?> |
| 798 |
</td> |
| 799 |
</tr> |
| 800 |
|
| 801 |
<tr class="sfm-right-offset-wrap"> |
| 802 |
<th><label><?php esc_html_e('Floating Menu Right Offset', 'simple-floating-menu'); ?></label></th> |
| 803 |
<td> |
| 804 |
<?php |
| 805 |
echo '<div class="sfm-range-slider">'; |
| 806 |
echo '<div class="range-input" value="' . esc_attr($sfm_settings['right_offset']) . '" data-min="0" data-max="200" data-step="1"></div>'; |
| 807 |
echo '<input class="range-input-selector sfm-right-offset" type="hidden" value="' . esc_attr($sfm_settings['right_offset']) . '" name="sfm_settings[right_offset]"/>'; |
| 808 |
echo '</div>'; |
| 809 |
?> |
| 810 |
</td> |
| 811 |
</tr> |
| 812 |
<tr> |
| 813 |
<td colspan="2" class="sfm-seperator"> |
| 814 |
<hr> |
| 815 |
</td> |
| 816 |
</tr> |
| 817 |
<tr> |
| 818 |
<th><label><?php esc_html_e('Spacing Between Buttons', 'simple-floating-menu'); ?></label></th> |
| 819 |
<td> |
| 820 |
<?php |
| 821 |
echo '<div class="sfm-range-slider">'; |
| 822 |
echo '<div class="range-input" value="' . absint($sfm_settings['button_spacing']) . '" data-min="0" data-max="50" data-step="1"></div>'; |
| 823 |
echo '<input class="range-input-selector sfm-button-spacing" type="hidden" value="' . absint($sfm_settings['button_spacing']) . '" name="sfm_settings[button_spacing]"/>'; |
| 824 |
echo '</div>'; |
| 825 |
?> |
| 826 |
</td> |
| 827 |
</tr> |
| 828 |
<tr> |
| 829 |
<th><label><?php esc_html_e('Z Index', 'simple-floating-menu'); ?></label></th> |
| 830 |
<td> |
| 831 |
<?php |
| 832 |
echo '<input class="sfm-z-index" type="text" value="' . absint($sfm_settings['zindex']) . '" name="sfm_settings[zindex]"/>'; |
| 833 |
?> |
| 834 |
</td> |
| 835 |
</tr> |
| 836 |
</tbody> |
| 837 |
</table> |
| 838 |
<p class="submit"> |
| 839 |
<button type="submit" name="submit" class="button button-primary"><i class="mdi mdi-content-save"></i> <?php esc_html_e('Save Settings', 'simple-floating-menu'); ?></button> |
| 840 |
</p> |
| 841 |
</div> |
| 842 |
|
| 843 |
<?php do_action('sfm_before_settings_form_end') ?> |
| 844 |
</form> |
| 845 |
|
| 846 |
<div id="tab-sfm-imex" class="sfm-form-page"> |
| 847 |
<table class="form-table"> |
| 848 |
<tbody> |
| 849 |
<tr> |
| 850 |
<th><label><?php esc_html_e('Export Settings', 'simple-floating-menu'); ?></label></th> |
| 851 |
<td> |
| 852 |
<div class="sfm-settings-fields"> |
| 853 |
<form method="post"> |
| 854 |
<input type="hidden" name="sfm_imex_action" value="export_settings" /> |
| 855 |
<?php wp_nonce_field("sfm_imex_export_nonce", "sfm_imex_export_nonce"); ?> |
| 856 |
<button class="button button-primary" id="sfm_export" name="sfm_export"><i class='icofont-download'></i> <?php esc_html_e("Download Settings", "simple-floating-menu") ?></button> |
| 857 |
</form> |
| 858 |
</div> |
| 859 |
</td> |
| 860 |
</tr> |
| 861 |
|
| 862 |
<tr> |
| 863 |
<th><label><?php esc_html_e('Import Settings', 'simple-floating-menu'); ?></label></th> |
| 864 |
<td> |
| 865 |
<div class="sfm-settings-fields"> |
| 866 |
<form method="post" enctype="multipart/form-data"> |
| 867 |
<div class="sfm-preview-zone hidden"> |
| 868 |
<div class="box box-solid"> |
| 869 |
<div class="box-body"></div> |
| 870 |
<button type="button" class="button sfm-remove-preview"> |
| 871 |
<i class="icofont-close-circled"></i> |
| 872 |
</button> |
| 873 |
</div> |
| 874 |
</div> |
| 875 |
<div class="sfm-dropzone-wrapper"> |
| 876 |
<div class="sfm-dropzone-desc"> |
| 877 |
<i class="icofont-download"></i> |
| 878 |
<p><?php esc_html_e("Choose an json file or drag it here", "simple-floating-menu"); ?></p> |
| 879 |
</div> |
| 880 |
<input type="file" name="sfm_import_file" class="sfm-dropzone"> |
| 881 |
</div> |
| 882 |
<button class="button button-primary" id="sfm_import" type="submit" name="sfm_import"><i class='icofont-download'></i> <?php esc_html_e("Import", "simple-floating-menu") ?></button> |
| 883 |
<input type="hidden" name="sfm_imex_action" value="import_settings" /> |
| 884 |
<?php wp_nonce_field("sfm_imex_import_nonce", "sfm_imex_import_nonce"); ?> |
| 885 |
|
| 886 |
</form> |
| 887 |
</div> |
| 888 |
</td> |
| 889 |
</tr> |
| 890 |
</tbody> |
| 891 |
</table> |
| 892 |
</div> |
| 893 |
|
| 894 |
<div id="tab-upgrade-pro" class="sfm-form-page"> |
| 895 |
<p><?php esc_html_e('Simple Floating Menu gives you one floating bar. Super Floating & Flying Menu gives you as many menus as you like, in seven different shapes, with over 100 ready made designs to start from and full control over when and where each one appears.', 'simple-floating-menu'); ?></p> |
| 896 |
|
| 897 |
<h3>Demo and Purchase Links</h3> |
| 898 |
<div class="sfm-inline-buttons"> |
| 899 |
<div class="sfm-buy-link sfm-link-button"> |
| 900 |
<a href="https://demo.hashthemes.com/super-floating-and-flying-menu/" target="_blank"><?php esc_html_e('Premium Demos', 'simple-floating-menu'); ?></a> |
| 901 |
</div> |
| 902 |
|
| 903 |
<div class="sfm-demo-link sfm-link-button"> |
| 904 |
<a href="https://1.envato.market/LPXYao" target="_blank"><?php esc_html_e('Buy Premium Version', 'simple-floating-menu'); ?></a> |
| 905 |
</div> |
| 906 |
</div> |
| 907 |
|
| 908 |
<div class="sfm-premium-features"> |
| 909 |
<h4>Premium Features - Ready Made Menus</h4> |
| 910 |
<img src="<?php echo esc_url(SFM_URL . '/assets/img/banner-image.png'); ?>" /> |
| 911 |
<ul class="sfm-feature-box"> |
| 912 |
<li>Over 100 Ready Made Menus, Imported With One Click</li> |
| 913 |
<li>Browse Them By Category, Or Search By Name</li> |
| 914 |
<li>Start A New Menu From A Template, Or Apply One To A Menu You Already Have</li> |
| 915 |
<li>Every Template Is Yours To Edit Once It Lands</li> |
| 916 |
<li>Build Menus Without Using Appearance > Menus At All</li> |
| 917 |
<li>A Builder Screen With The Item List And Each Item's Settings Side By Side</li> |
| 918 |
<li>Unlimited Menus On One Site, Each With Its Own Design And Display Rules</li> |
| 919 |
<li>Import, Export And Duplicate Any Menu, Including As The Other Menu Type</li> |
| 920 |
</ul> |
| 921 |
<ul class="sfm-grid-col-3 sfm-grid-col"> |
| 922 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/" target="_blank"><?php esc_html_e('See All Demos', 'simple-floating-menu'); ?></a></li> |
| 923 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/floating-menu-template-1/" target="_blank"><?php esc_html_e('Floating Menus', 'simple-floating-menu'); ?></a></li> |
| 924 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/side-panel-menu-slide-up-down-submenu/" target="_blank"><?php esc_html_e('Panel Menus', 'simple-floating-menu'); ?></a></li> |
| 925 |
</ul> |
| 926 |
</div> |
| 927 |
|
| 928 |
<div class="sfm-premium-features"> |
| 929 |
<h4>Premium Features - Floating Buttons</h4> |
| 930 |
<img src="<?php echo esc_url(SFM_URL . '/assets/img/floating-buttons.png'); ?>" /> |
| 931 |
<ul class="sfm-feature-box"> |
| 932 |
<li>Create Unlimited Floating Menu</li> |
| 933 |
<li>10 Differently Designed Styles</li> |
| 934 |
<li>11 Different Button Shapes</li> |
| 935 |
<li>7 Font Icon Packs With 13,000+ Icons</li> |
| 936 |
<li>Upload Custom Image Icons</li> |
| 937 |
<li>Display Buttons At Any Position On The Screen With Custom Offset Values</li> |
| 938 |
<li>Configure Button/Icon Size & Colors</li> |
| 939 |
<li>Display Buttons Selectively On Specific Posts/Pages Only</li> |
| 940 |
<li>Set Custom Typography With 1,400+ Google Fonts And Font Parameters</li> |
| 941 |
<li>Import/Export Settings Easily With Just One Click</li> |
| 942 |
<li>Set Every Button's Colors In One Place Instead Of One At A Time, Plus Hover Colors For The Tooltips</li> |
| 943 |
<li>12 Show/Hide Animation</li> |
| 944 |
<li>RTL (Right to Left Text) Ready</li> |
| 945 |
<li>Multilingual Ready (Compatible With Polylang & WPML Plugin)</li> |
| 946 |
</ul> |
| 947 |
<ul class="sfm-grid-col-4 sfm-grid-col"> |
| 948 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/floating-menu-template-1/" target="_blank"><?php esc_html_e('Template 1', 'simple-floating-menu'); ?></a></li> |
| 949 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/floating-menu-template-2/" target="_blank"><?php esc_html_e('Template 2', 'simple-floating-menu'); ?></a></li> |
| 950 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/floating-menu-template-3/" target="_blank"><?php esc_html_e('Template 3', 'simple-floating-menu'); ?></a></li> |
| 951 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/floating-menu-template-4/" target="_blank"><?php esc_html_e('Template 4', 'simple-floating-menu'); ?></a></li> |
| 952 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/floating-menu-template-5/" target="_blank"><?php esc_html_e('Template 5', 'simple-floating-menu'); ?></a></li> |
| 953 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/floating-menu-template-6/" target="_blank"><?php esc_html_e('Template 6', 'simple-floating-menu'); ?></a></li> |
| 954 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/floating-menu-template-7/" target="_blank"><?php esc_html_e('Template 7', 'simple-floating-menu'); ?></a></li> |
| 955 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/floating-menu-template-8/" target="_blank"><?php esc_html_e('Template 8', 'simple-floating-menu'); ?></a></li> |
| 956 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/floating-menu-template-9/" target="_blank"><?php esc_html_e('Template 9', 'simple-floating-menu'); ?></a></li> |
| 957 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/floating-menu-template-10/" target="_blank"><?php esc_html_e('Template 10', 'simple-floating-menu'); ?></a></li> |
| 958 |
</ul> |
| 959 |
</div> |
| 960 |
|
| 961 |
<div class="sfm-premium-features"> |
| 962 |
<h4>Premium Features - Circular Floating Buttons</h4> |
| 963 |
<img src="<?php echo esc_url(SFM_URL . '/assets/img/floating-circular-buttons.png'); ?>" /> |
| 964 |
<ul class="sfm-feature-box"> |
| 965 |
<li>11 Different Button Shapes</li> |
| 966 |
<li>7 Font Icon Packs With 13,000+ Icons</li> |
| 967 |
<li>Upload Custom Image Icons</li> |
| 968 |
<li>Display Buttons At Any Position On The Screen With Custom Offset Values</li> |
| 969 |
<li>Configure Button/Icon Size & Colors</li> |
| 970 |
<li>Display Buttons Selectively On Specific Posts/Pages Only</li> |
| 971 |
<li>Set Custom Typography With 1,400+ Google Fonts And Font Parameters</li> |
| 972 |
<li>Import/Export Settings Easily With Just One Click</li> |
| 973 |
<li>Set Every Button's Colors In One Place Instead Of One At A Time, Plus Hover Colors For The Tooltips</li> |
| 974 |
<li>12 Show/Hide Animation</li> |
| 975 |
<li>29 Hover Animation</li> |
| 976 |
<li>12 Idle Animation To Grab User Attention</li> |
| 977 |
<li>Open Sub Menu Items On Hover Or Click</li> |
| 978 |
<li>RTL (Right to Left Text) Ready</li> |
| 979 |
<li>Multilingual Ready (Compatible With Polylang & WPML Plugin)</li> |
| 980 |
</ul> |
| 981 |
<ul class="sfm-grid-col-3 sfm-grid-col"> |
| 982 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/floating-menu-quater-circular/" target="_blank"><?php esc_html_e('Quater Circular', 'simple-floating-menu'); ?></a></li> |
| 983 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/floating-menu-half-circular/" target="_blank"><?php esc_html_e('Half Circular', 'simple-floating-menu'); ?></a></li> |
| 984 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/floating-menu-full-circular/" target="_blank"><?php esc_html_e('Full Circular', 'simple-floating-menu'); ?></a></li> |
| 985 |
</ul> |
| 986 |
</div> |
| 987 |
|
| 988 |
<div class="sfm-premium-features"> |
| 989 |
<h4>Premium Features - Navigation Indicator(One Page) Menu</h4> |
| 990 |
<img src="<?php echo esc_url(SFM_URL . '/assets/img/nav-menu.png'); ?>" /> |
| 991 |
<ul class="sfm-feature-box"> |
| 992 |
<li>One Page Sticky Menu</li> |
| 993 |
<li>13 Different Styles</li> |
| 994 |
<li>Display Left Or Right</li> |
| 995 |
<li>Custom Navigation Item Size, Color & Spacing</li> |
| 996 |
<li>Custom Top Offset Value For Sticky Header</li> |
| 997 |
<li>Custom Typography For Tool Tips</li> |
| 998 |
<li>RTL (Right to Left Text) Ready</li> |
| 999 |
<li>Multilingual Ready (Compatible With Polylang & WPML Plugin)</li> |
| 1000 |
</ul> |
| 1001 |
<ul class="sfm-grid-col-4 sfm-grid-col"> |
| 1002 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/nav-indicator-animation-1/" target="_blank"><?php esc_html_e('Template 1', 'simple-floating-menu'); ?></a></li> |
| 1003 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/nav-indicator-animation-2/" target="_blank"><?php esc_html_e('Template 2', 'simple-floating-menu'); ?></a></li> |
| 1004 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/nav-indicator-animation-3/" target="_blank"><?php esc_html_e('Template 3', 'simple-floating-menu'); ?></a></li> |
| 1005 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/nav-indicator-animation-4/" target="_blank"><?php esc_html_e('Template 4', 'simple-floating-menu'); ?></a></li> |
| 1006 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/nav-indicator-animation-5/" target="_blank"><?php esc_html_e('Template 5', 'simple-floating-menu'); ?></a></li> |
| 1007 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/nav-indicator-animation-6/" target="_blank"><?php esc_html_e('Template 6', 'simple-floating-menu'); ?></a></li> |
| 1008 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/nav-indicator-animation-7/" target="_blank"><?php esc_html_e('Template 7', 'simple-floating-menu'); ?></a></li> |
| 1009 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/nav-indicator-animation-8/" target="_blank"><?php esc_html_e('Template 8', 'simple-floating-menu'); ?></a></li> |
| 1010 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/nav-indicator-animation-9/" target="_blank"><?php esc_html_e('Template 9', 'simple-floating-menu'); ?></a></li> |
| 1011 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/nav-indicator-animation-10/" target="_blank"><?php esc_html_e('Template 10', 'simple-floating-menu'); ?></a></li> |
| 1012 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/nav-indicator-animation-11/" target="_blank"><?php esc_html_e('Template 11', 'simple-floating-menu'); ?></a></li> |
| 1013 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/nav-indicator-animation-12/" target="_blank"><?php esc_html_e('Template 12', 'simple-floating-menu'); ?></a></li> |
| 1014 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/nav-indicator-animation-13/" target="_blank"><?php esc_html_e('Template 13', 'simple-floating-menu'); ?></a></li> |
| 1015 |
</ul> |
| 1016 |
</div> |
| 1017 |
|
| 1018 |
<div class="sfm-premium-features"> |
| 1019 |
<h4>Premium Features - Side Panel & Full Screen Menu</h4> |
| 1020 |
<img src="<?php echo esc_url(SFM_URL . '/assets/img/side-full-menu.png'); ?>" /> |
| 1021 |
<ul class="sfm-feature-box"> |
| 1022 |
<li>7 Sub Menu Open/Close Animations Styles.</li> |
| 1023 |
<li>Align the menu items to left, center, or right with 3 different Menu hover animations.</li> |
| 1024 |
<li>Apply color background, Image background or video background to the panel.</li> |
| 1025 |
<li>Align the content to left, center or right with custom spacing, typography, colors for each elements.</li> |
| 1026 |
<li>There are 37 entrance and 37 exit animations to choose from for the menu panel.</li> |
| 1027 |
<li>Choose from 13,000+ font icons or 16 animated Hamburger Icons, or add your own custom jpg, png or gif images.</li> |
| 1028 |
<li>Eye catching Button Hover and Idle Animation to grab the attention of the users.</li> |
| 1029 |
<li>Adjust the button and icon size, colors and shadow.</li> |
| 1030 |
<li>Place the button at any position on the screen. There are 8 predefined positions to choose from along with offset values to move it.</li> |
| 1031 |
<li>Display the Menu selectively only on the pages that you want.</li> |
| 1032 |
<li>Insert the trigger button at the start or at the end of the menu items on any menu. </li> |
| 1033 |
<li>Download the menu setting easily with just one click. And import it to any other menus on the same website or different website easily.</li> |
| 1034 |
<li>If you are a fan of pagebuider then you can create the content of the side panel with the Elementor Page builder.</li> |
| 1035 |
<li>RTL (Right to Left Text) Ready</li> |
| 1036 |
<li>Multilingual Ready (Compatible With Polylang & WPML Plugin)</li> |
| 1037 |
</ul> |
| 1038 |
<ul class="sfm-grid-col-3 sfm-grid-col"> |
| 1039 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/side-panel-menu-slide-up-down-submenu/" target="_blank"><?php esc_html_e('Side Panel Menu', 'simple-floating-menu'); ?></a></li> |
| 1040 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/skew-side-panel-menu/" target="_blank"><?php esc_html_e('Skew Side Panel Menu', 'simple-floating-menu'); ?></a></li> |
| 1041 |
<li><a href="https://demo.hashthemes.com/super-floating-and-flying-menu/full-screen-menu-wave-animation-1/" target="_blank"><?php esc_html_e('Full Screen Menu', 'simple-floating-menu'); ?></a></li> |
| 1042 |
</ul> |
| 1043 |
</div> |
| 1044 |
|
| 1045 |
<div class="sfm-premium-features"> |
| 1046 |
<h4>Premium Features - When And Where A Menu Shows</h4> |
| 1047 |
<ul class="sfm-feature-box"> |
| 1048 |
<li>Show A Menu Only After The Visitor Has Scrolled Down, By Pixels Or By A Share Of The Page</li> |
| 1049 |
<li>Hide It Again While They Scroll Down, And Bring It Back When They Scroll Up</li> |
| 1050 |
<li>Schedule A Menu Between Two Dates, So An Offer Starts And Ends On Its Own</li> |
| 1051 |
<li>Run A Menu Only On Chosen Days Of The Week</li> |
| 1052 |
<li>Show Or Hide By Page, Post Type, Archive, Search Or 404</li> |
| 1053 |
<li>Show Only To Logged In Or Logged Out Visitors</li> |
| 1054 |
<li>Show Only To Chosen User Roles</li> |
| 1055 |
<li>Hide On Desktop, Tablet Or Mobile</li> |
| 1056 |
<li>Show A Different Menu Per Language With Polylang Or WPML</li> |
| 1057 |
</ul> |
| 1058 |
</div> |
| 1059 |
|
| 1060 |
<h3>Pre Sales Questions?</h3> |
| 1061 |
<p>If you have any pre sales questions, then feel free to email us at support@hashthemes.com</p> |
| 1062 |
</div> |
| 1063 |
|
| 1064 |
</div> |
| 1065 |
|
| 1066 |
<div class="sfm-live-demo"> |
| 1067 |
<?php |
| 1068 |
$obj = new Simple_Floating_Menu_Frontend(); |
| 1069 |
$obj->floating_menu_html(); |
| 1070 |
?> |
| 1071 |
</div> |
| 1072 |
</div> |
| 1073 |
</div> <?php |
| 1074 |
} |
| 1075 |
|
| 1076 |
public function sanitize_form($sfm_settings) { |
| 1077 |
$defaults = self::default_settings(); |
| 1078 |
|
| 1079 |
$valid_positions = array('top-left', 'top-right', 'top-middle', 'bottom-middle', 'bottom-left', 'bottom-right', 'middle-left', 'middle-right'); |
| 1080 |
$valid_styles = array('sfm-rect', 'sfm-round', 'sfm-triangle', 'sfm-rhombus', 'sfm-pentagon', 'sfm-hexagon', 'sfm-star', 'sfm-rabbet', 'sfm-oval'); |
| 1081 |
$valid_orientation = array('vertical', 'horizontal'); |
| 1082 |
$valid_icons = array_merge(sfm_font_awesome_icon_array(), sfm_materialdesignicons_array(), sfm_essential_icon_array(), sfm_icofont_icon_array(), sfm_eleganticons_array()); |
| 1083 |
$button_height = (int) $sfm_settings['button_height']; |
| 1084 |
$button_width = (int) $sfm_settings['button_width']; |
| 1085 |
$icon_size = (int) $sfm_settings['icon_size']; |
| 1086 |
$icon_position = (int) $sfm_settings['icon_position']; |
| 1087 |
$top_offset = (int) $sfm_settings['top_offset']; |
| 1088 |
$bottom_offset = (int) $sfm_settings['bottom_offset']; |
| 1089 |
$left_offset = (int) $sfm_settings['left_offset']; |
| 1090 |
$right_offset = (int) $sfm_settings['right_offset']; |
| 1091 |
$button_spacing = (int) $sfm_settings['button_spacing']; |
| 1092 |
|
| 1093 |
$sanitize_settings['enable_sfm'] = isset($sfm_settings['enable_sfm']) ? 'yes' : 'no'; |
| 1094 |
$sanitize_settings['enable_sfm_setting'] = isset($sfm_settings['enable_sfm_setting']) ? 'yes' : 'no'; |
| 1095 |
$sanitize_settings['sfm_load_google_font_locally'] = isset($sfm_settings['sfm_load_google_font_locally']) ? 'yes' : 'no'; |
| 1096 |
$sanitize_settings['position'] = in_array($sfm_settings['position'], $valid_positions) ? $sfm_settings['position'] : $defaults['position']; |
| 1097 |
$sanitize_settings['orientation'] = in_array($sfm_settings['orientation'], $valid_orientation) ? $sfm_settings['orientation'] : $defaults['orientation']; |
| 1098 |
$sanitize_settings['style'] = in_array($sfm_settings['style'], $valid_styles) ? $sfm_settings['style'] : $defaults['style']; |
| 1099 |
$sanitize_settings['button_height'] = (40 <= $button_height && $button_height <= 200 && is_int($button_height)) ? $button_height : $defaults['button_height']; |
| 1100 |
$sanitize_settings['button_width'] = (40 <= $button_width && $button_width <= 200 && is_int($button_width)) ? $button_width : $defaults['button_width']; |
| 1101 |
$sanitize_settings['icon_size'] = (10 <= $icon_size && $icon_size <= 60 && is_int($icon_size)) ? $icon_size : $defaults['icon_size']; |
| 1102 |
$sanitize_settings['icon_position'] = (-40 <= $icon_position && $icon_position <= 40 && is_int($icon_position)) ? $icon_position : $defaults['icon_position']; |
| 1103 |
$sanitize_settings['top_offset'] = (0 <= $top_offset && $top_offset <= 200 && is_int($top_offset)) ? $top_offset : $defaults['top_offset']; |
| 1104 |
$sanitize_settings['bottom_offset'] = (0 <= $bottom_offset && $bottom_offset <= 200 && is_int($bottom_offset)) ? $bottom_offset : $defaults['bottom_offset']; |
| 1105 |
$sanitize_settings['left_offset'] = (0 <= $left_offset && $left_offset <= 200 && is_int($left_offset)) ? $left_offset : $defaults['left_offset']; |
| 1106 |
$sanitize_settings['right_offset'] = (0 <= $right_offset && $right_offset <= 200 && is_int($right_offset)) ? $right_offset : $defaults['right_offset']; |
| 1107 |
$sanitize_settings['button_spacing'] = (0 <= $button_spacing && $button_spacing <= 200 && is_int($button_spacing)) ? $button_spacing : $defaults['button_spacing']; |
| 1108 |
$sanitize_settings['zindex'] = (int) $sfm_settings['zindex']; |
| 1109 |
|
| 1110 |
$buttons_settings = $sfm_settings['buttons']; |
| 1111 |
|
| 1112 |
foreach ($buttons_settings as $index => $settings) { |
| 1113 |
foreach ($settings as $key => $value) { |
| 1114 |
if ($key == 'url') { |
| 1115 |
$sanitize_settings['buttons'][$index][$key] = esc_url_raw($value); |
| 1116 |
} elseif ($key == 'tool_tip_text') { |
| 1117 |
$sanitize_settings['buttons'][$index][$key] = sanitize_text_field($value); |
| 1118 |
} elseif ($key == 'open_new_tab') { |
| 1119 |
$sanitize_settings['buttons'][$index][$key] = isset($value) ? true : false; |
| 1120 |
} elseif ($key == 'icon') { |
| 1121 |
$sanitize_settings['buttons'][$index][$key] = in_array($value, $valid_icons) ? $value : ''; |
| 1122 |
} elseif ($key == 'button_bg_color' || $key == 'button_icon_color' || $key == 'button_bg_color_hover' || $key == 'button_icon_color_hover' || $key == 'tooltip_bg_color' || $key == 'tooltip_text_color') { |
| 1123 |
$sanitize_settings['buttons'][$index][$key] = sanitize_hex_color($value); |
| 1124 |
} else { |
| 1125 |
$sanitize_settings['buttons'][$index][$key] = sanitize_text_field($value); |
| 1126 |
} |
| 1127 |
} |
| 1128 |
} |
| 1129 |
|
| 1130 |
$sfm_standard_font = sfm_get_standard_font_families(); |
| 1131 |
$sfm_google_font = sfm_get_google_font_families(); |
| 1132 |
$font_size = (int) $sfm_settings['tooltip_font']['size']; |
| 1133 |
$line_height = (float) $sfm_settings['tooltip_font']['line_height']; |
| 1134 |
$letter_spacing = (float) $sfm_settings['tooltip_font']['letter_spacing']; |
| 1135 |
|
| 1136 |
$sfm_font = array_merge($sfm_standard_font, $sfm_google_font); |
| 1137 |
|
| 1138 |
$sanitize_settings['tooltip_font']['family'] = array_key_exists($sfm_settings['tooltip_font']['family'], $sfm_font) ? $sfm_settings['tooltip_font']['family'] : $defaults['tooltip_font']['family']; |
| 1139 |
$sanitize_settings['tooltip_font']['style'] = array_key_exists($sfm_settings['tooltip_font']['style'], sfm_get_font_weight_choices($sfm_settings['tooltip_font']['family'])) ? $sfm_settings['tooltip_font']['style'] : $defaults['tooltip_font']['style']; |
| 1140 |
$sanitize_settings['tooltip_font']['transform'] = array_key_exists($sfm_settings['tooltip_font']['transform'], sfm_get_text_transform_choices()) ? $sfm_settings['tooltip_font']['transform'] : $defaults['tooltip_font']['transform']; |
| 1141 |
$sanitize_settings['tooltip_font']['decoration'] = array_key_exists($sfm_settings['tooltip_font']['decoration'], sfm_get_text_decoration_choices()) ? $sfm_settings['tooltip_font']['decoration'] : $defaults['tooltip_font']['decoration']; |
| 1142 |
$sanitize_settings['tooltip_font']['size'] = (10 <= $font_size && $font_size <= 60 && is_int($font_size)) ? $font_size : (int) $defaults['tooltip_font']['size']; |
| 1143 |
$sanitize_settings['tooltip_font']['line_height'] = (0.5 <= $line_height && $line_height <= 5 && is_float($line_height)) ? $line_height : (float) $defaults['tooltip_font']['line_height']; |
| 1144 |
$sanitize_settings['tooltip_font']['letter_spacing'] = (-5 <= $letter_spacing && $letter_spacing <= 5 && is_float($letter_spacing)) ? $letter_spacing : (float) $defaults['tooltip_font']['letter_spacing']; |
| 1145 |
$sanitize_settings['floatmenu_hide_show_pages'] = isset($sfm_settings['floatmenu_hide_show_pages']) && $sfm_settings['floatmenu_hide_show_pages'] == 'show_in_pages' ? 'show_in_pages' : 'hide_in_pages'; |
| 1146 |
$sanitize_settings['floatmenu_front_pages'] = isset($sfm_settings['floatmenu_front_pages']) ? 'yes' : 'no'; |
| 1147 |
$sanitize_settings['floatmenu_blog_pages'] = isset($sfm_settings['floatmenu_blog_pages']) ? 'yes' : 'no'; |
| 1148 |
$sanitize_settings['floatmenu_archive_pages'] = isset($sfm_settings['floatmenu_archive_pages']) ? 'yes' : 'no'; |
| 1149 |
$sanitize_settings['floatmenu_error_pages'] = isset($sfm_settings['floatmenu_error_pages']) ? 'yes' : 'no'; |
| 1150 |
$sanitize_settings['floatmenu_search_pages'] = isset($sfm_settings['floatmenu_search_pages']) ? 'yes' : 'no'; |
| 1151 |
$sanitize_settings['floatmenu_single_pages'] = isset($sfm_settings['floatmenu_single_pages']) ? 'yes' : 'no'; |
| 1152 |
$sanitize_settings['floatmenu_specific_pages'] = isset($sfm_settings['floatmenu_specific_pages']) ? $sfm_settings['floatmenu_specific_pages'] : []; |
| 1153 |
|
| 1154 |
$button_shadow_settings = $sfm_settings['button_shadow']; |
| 1155 |
foreach ($button_shadow_settings as $key => $value) { |
| 1156 |
if ($key == 'color') { |
| 1157 |
$sanitize_settings['button_shadow'][$key] = self::sfm_sanitize_color($value); |
| 1158 |
} else { |
| 1159 |
$sanitize_settings['button_shadow'][$key] = sanitize_text_field($value); |
| 1160 |
} |
| 1161 |
} |
| 1162 |
return $sanitize_settings; |
| 1163 |
} |
| 1164 |
|
| 1165 |
public function handle_form() { |
| 1166 |
$nonce = isset($_POST['sfm_nonce']) ? sanitize_text_field(wp_unslash($_POST['sfm_nonce'])) : ''; |
| 1167 |
if (!wp_verify_nonce($nonce, 'sfm_nonce_update')) { |
| 1168 |
?> |
| 1169 |
<div class="sfm-error-notice sfm-notice"> |
| 1170 |
<p><?php esc_html_e('Sorry, your nonce was not correct. Please try again.', 'simple-floating-menu'); ?></p> |
| 1171 |
</div> <?php |
| 1172 |
exit; |
| 1173 |
} else { |
| 1174 |
$sfm_settings = isset($_POST['sfm_settings']) ? wp_unslash($_POST['sfm_settings']) : ''; |
| 1175 |
$sanitize_settings = $this->sanitize_form($sfm_settings); |
| 1176 |
update_option('sfm_settings', $sanitize_settings); |
| 1177 |
?> |
| 1178 |
<div class="sfm-success-notice sfm-notice"> |
| 1179 |
<p><?php esc_html_e('Settings saved!', 'simple-floating-menu'); ?></p> |
| 1180 |
</div> |
| 1181 |
<?php |
| 1182 |
} |
| 1183 |
} |
| 1184 |
|
| 1185 |
public function sfm_dymanic_styles() { |
| 1186 |
$currentScreen = get_current_screen(); |
| 1187 |
if ('toplevel_page_simple-floating-menu' == $currentScreen->id) { |
| 1188 |
echo '<style id="sfm-dynamic-styles">'; |
| 1189 |
echo sfm_dymanic_styles(); |
| 1190 |
echo '</style>'; |
| 1191 |
} |
| 1192 |
} |
| 1193 |
|
| 1194 |
public function sfm_imex_process_settings_export() { |
| 1195 |
|
| 1196 |
if (empty($_POST['sfm_imex_action']) || 'export_settings' != $_POST['sfm_imex_action']) |
| 1197 |
return; |
| 1198 |
|
| 1199 |
$nonce = isset($_POST['sfm_imex_export_nonce']) ? sanitize_text_field(wp_unslash($_POST['sfm_imex_export_nonce'])) : ''; |
| 1200 |
if (!wp_verify_nonce($nonce, 'sfm_imex_export_nonce')) |
| 1201 |
return; |
| 1202 |
|
| 1203 |
if (!current_user_can('manage_options')) |
| 1204 |
return; |
| 1205 |
|
| 1206 |
$sfm_settings = self::get_settings(); |
| 1207 |
|
| 1208 |
ignore_user_abort(true); |
| 1209 |
|
| 1210 |
nocache_headers(); |
| 1211 |
header('Content-Type: application/json; charset=utf-8'); |
| 1212 |
header('Content-Disposition: attachment; filename=sfm-' . gmdate('m-d-Y') . '.json'); |
| 1213 |
header("Expires: 0"); |
| 1214 |
|
| 1215 |
echo json_encode($sfm_settings); |
| 1216 |
exit; |
| 1217 |
} |
| 1218 |
|
| 1219 |
public function sfm_imex_process_settings_import() { |
| 1220 |
|
| 1221 |
if (empty($_POST['sfm_imex_action']) || 'import_settings' != $_POST['sfm_imex_action']) |
| 1222 |
return; |
| 1223 |
|
| 1224 |
$nonce = isset($_POST['sfm_imex_import_nonce']) ? sanitize_text_field(wp_unslash($_POST['sfm_imex_import_nonce'])) : ''; |
| 1225 |
if (!wp_verify_nonce($nonce, 'sfm_imex_import_nonce')) |
| 1226 |
return; |
| 1227 |
|
| 1228 |
if (!current_user_can('manage_options')) |
| 1229 |
return; |
| 1230 |
|
| 1231 |
$filename = isset($_FILES['sfm_import_file']['name']) ? sanitize_text_field($_FILES['sfm_import_file']['name']) : ''; |
| 1232 |
$extension = explode('.', $filename); |
| 1233 |
$extension = end($extension); |
| 1234 |
|
| 1235 |
if ($extension != 'json') { |
| 1236 |
wp_die(esc_html__('Please upload a valid .json file', 'simple-floating-menu')); |
| 1237 |
} |
| 1238 |
|
| 1239 |
$sfm_import_file = isset($_FILES['sfm_import_file']['tmp_name']) ? sanitize_text_field($_FILES['sfm_import_file']['tmp_name']) : ''; |
| 1240 |
|
| 1241 |
if (empty($sfm_import_file)) { |
| 1242 |
wp_die(esc_html__('Please upload a file to import', 'simple-floating-menu')); |
| 1243 |
} |
| 1244 |
|
| 1245 |
// Retrieve the settings from the file and convert the json object to an array. |
| 1246 |
$sfm_settings = json_decode(file_get_contents($sfm_import_file), true); |
| 1247 |
$sanitize_settings = $this->sanitize_form($sfm_settings); |
| 1248 |
update_option('sfm_settings', $sanitize_settings); |
| 1249 |
} |
| 1250 |
|
| 1251 |
/** |
| 1252 |
* Handle a click on the dismiss button |
| 1253 |
* |
| 1254 |
* @return void |
| 1255 |
*/ |
| 1256 |
public function welcome_init() { |
| 1257 |
if (!get_option('sfm_first_activation')) { |
| 1258 |
update_option('sfm_first_activation', time()); |
| 1259 |
} |
| 1260 |
; |
| 1261 |
|
| 1262 |
if (isset($_GET['sfm-hide-notice'], $_GET['sfm_notice_nonce'])) { |
| 1263 |
$notice = sanitize_key($_GET['sfm-hide-notice']); |
| 1264 |
if (check_admin_referer($notice, 'sfm_notice_nonce')) { |
| 1265 |
self::dismiss($notice); |
| 1266 |
wp_safe_redirect(remove_query_arg(array('sfm-hide-notice', 'sfm_notice_nonce'), wp_get_referer())); |
| 1267 |
exit; |
| 1268 |
} |
| 1269 |
} |
| 1270 |
} |
| 1271 |
|
| 1272 |
/** |
| 1273 |
* Displays a notice asking for a review |
| 1274 |
* |
| 1275 |
* @return void |
| 1276 |
*/ |
| 1277 |
private function review_notice() { |
| 1278 |
?> |
| 1279 |
<div class="sfm-notice notice notice-info"> |
| 1280 |
<?php $this->dismiss_button('review'); ?> |
| 1281 |
<i class="essentialicon-menu-1"></i> |
| 1282 |
<div class="sfm-notice-info"> |
| 1283 |
<p> |
| 1284 |
|
| 1285 |
<?php |
| 1286 |
printf( |
| 1287 |
/* translators: %1$s is link start tag, %2$s is link end tag. */ |
| 1288 |
esc_html__('We have noticed that you have been using Simple Floating Menu for some time. We hope you love it, and we would really appreciate it if you would %1$sgive us a 5 stars rating%2$s and spread your words to the world.', 'simple-floating-menu'), '<a target="_blank" href="https://wordpress.org/support/plugin/simple-floating-menu/reviews/?rate=5#new-post">', '</a>' |
| 1289 |
); |
| 1290 |
?> |
| 1291 |
</p> |
| 1292 |
<a target="_blank" class="button button-primary action" href="https://wordpress.org/support/plugin/simple-floating-menu/reviews/?rate=5#new-post"><span class="dashicons dashicons-thumbs-up"></span><?php echo esc_html__('Yes, of course', 'simple-floating-menu') ?></a> |
| 1293 |
<a class="button action" href="<?php echo esc_url(wp_nonce_url(add_query_arg('sfm-hide-notice', 'review'), 'review', 'sfm_notice_nonce')); ?>"><span class="dashicons dashicons-yes"></span><?php echo esc_html__('I have already rated', 'simple-floating-menu') ?></a> |
| 1294 |
</div> |
| 1295 |
</div> |
| 1296 |
<?php |
| 1297 |
} |
| 1298 |
|
| 1299 |
/** |
| 1300 |
* Has a notice been dismissed? |
| 1301 |
* |
| 1302 |
* @param string $notice Notice name |
| 1303 |
* @return bool |
| 1304 |
*/ |
| 1305 |
public static function is_dismissed($notice) { |
| 1306 |
$dismissed = get_option('sfm_dismissed_notices', array()); |
| 1307 |
|
| 1308 |
// Handle legacy user meta |
| 1309 |
$dismissed_meta = get_user_meta(get_current_user_id(), 'sfm_dismissed_notices', true); |
| 1310 |
if (is_array($dismissed_meta)) { |
| 1311 |
if (array_diff($dismissed_meta, $dismissed)) { |
| 1312 |
$dismissed = array_merge($dismissed, $dismissed_meta); |
| 1313 |
update_option('sfm_dismissed_notices', $dismissed); |
| 1314 |
} |
| 1315 |
if (!is_multisite()) { |
| 1316 |
// Don't delete on multisite to avoid the notices to appear in other sites. |
| 1317 |
delete_user_meta(get_current_user_id(), 'sfm_dismissed_notices'); |
| 1318 |
} |
| 1319 |
} |
| 1320 |
|
| 1321 |
return in_array($notice, $dismissed); |
| 1322 |
} |
| 1323 |
|
| 1324 |
/** |
| 1325 |
* Displays a dismiss button |
| 1326 |
* |
| 1327 |
* @param string $name Notice name |
| 1328 |
* @return void |
| 1329 |
*/ |
| 1330 |
public function dismiss_button($name) { |
| 1331 |
printf('<a class="notice-dismiss" href="%s"><span class="screen-reader-text">%s</span></a>', esc_url(wp_nonce_url(add_query_arg('sfm-hide-notice', $name), $name, 'sfm_notice_nonce')), esc_html__('Dismiss this notice.', 'simple-floating-menu') |
| 1332 |
); |
| 1333 |
} |
| 1334 |
|
| 1335 |
/** |
| 1336 |
* Stores a dismissed notice in database |
| 1337 |
* |
| 1338 |
* @param string $notice |
| 1339 |
* @return void |
| 1340 |
*/ |
| 1341 |
public static function dismiss($notice) { |
| 1342 |
$dismissed = get_option('sfm_dismissed_notices', array()); |
| 1343 |
|
| 1344 |
if (!in_array($notice, $dismissed)) { |
| 1345 |
$dismissed[] = $notice; |
| 1346 |
update_option('sfm_dismissed_notices', array_unique($dismissed)); |
| 1347 |
} |
| 1348 |
} |
| 1349 |
|
| 1350 |
/** Welcome Message Notification */ |
| 1351 |
public function admin_notice_content() { |
| 1352 |
if (!$this->is_dismissed('review') && !empty(get_option('sfm_first_activation')) && time() > get_option('sfm_first_activation') + 15 * DAY_IN_SECONDS) { |
| 1353 |
$this->review_notice(); |
| 1354 |
} |
| 1355 |
} |
| 1356 |
|
| 1357 |
/** |
| 1358 |
* Deactivation hook. |
| 1359 |
*/ |
| 1360 |
public function erase_hide_notice() { |
| 1361 |
delete_option('sfm_dismissed_notices'); |
| 1362 |
delete_option('sfm_first_activation'); |
| 1363 |
} |
| 1364 |
|
| 1365 |
private static function sfm_sanitize_color($color) { |
| 1366 |
// Is this an rgba color or a hex? |
| 1367 |
$mode = (false === strpos($color, 'rgba')) ? 'hex' : 'rgba'; |
| 1368 |
if ('rgba' === $mode) { |
| 1369 |
$color = str_replace(' ', '', $color); |
| 1370 |
sscanf($color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha); |
| 1371 |
return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')'; |
| 1372 |
} else { |
| 1373 |
return sanitize_hex_color($color); |
| 1374 |
} |
| 1375 |
} |
| 1376 |
|
| 1377 |
} |
| 1378 |
|
| 1379 |
} |
| 1380 |
|
| 1381 |
function simple_floating_menu() { |
| 1382 |
Simple_Floating_Menu::get_instance(); |
| 1383 |
} |
| 1384 |
|
| 1385 |
/** |
| 1386 |
* Init the plugin. |
| 1387 |
*/ |
| 1388 |
simple_floating_menu(); |
| 1389 |
|