| 1 |
<?php |
| 2 |
/** |
| 3 |
* Fixed Bottom Menu |
| 4 |
* |
| 5 |
* @package Fixed Bottom Menu |
| 6 |
* @subpackage FixedBottomMenuAdmin Management screen |
| 7 |
Copyright (c) 2019- Katsushi Kawamori (email : dodesyoswift312@gmail.com) |
| 8 |
This program is free software; you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation; version 2 of the License. |
| 11 |
|
| 12 |
This program is distributed in the hope that it will be useful, |
| 13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
GNU General Public License for more details. |
| 16 |
|
| 17 |
You should have received a copy of the GNU General Public License |
| 18 |
along with this program; if not, write to the Free Software |
| 19 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 |
*/ |
| 21 |
|
| 22 |
$fixedbottommenuadmin = new FixedBottomMenuAdmin(); |
| 23 |
|
| 24 |
/** ================================================== |
| 25 |
* Management screen |
| 26 |
*/ |
| 27 |
class FixedBottomMenuAdmin { |
| 28 |
|
| 29 |
/** ================================================== |
| 30 |
* Construct |
| 31 |
* |
| 32 |
* @since 1.00 |
| 33 |
*/ |
| 34 |
public function __construct() { |
| 35 |
|
| 36 |
add_action( 'init', array( $this, 'register_settings' ) ); |
| 37 |
add_action( 'admin_menu', array( $this, 'plugin_menu' ) ); |
| 38 |
add_action( 'admin_enqueue_scripts', array( $this, 'load_custom_wp_admin_style' ) ); |
| 39 |
add_filter( 'plugin_action_links', array( $this, 'settings_link' ), 10, 2 ); |
| 40 |
|
| 41 |
} |
| 42 |
|
| 43 |
/** ================================================== |
| 44 |
* Add a "Settings" link to the plugins page |
| 45 |
* |
| 46 |
* @param array $links links array. |
| 47 |
* @param string $file file. |
| 48 |
* @return array $links links array. |
| 49 |
* @since 1.00 |
| 50 |
*/ |
| 51 |
public function settings_link( $links, $file ) { |
| 52 |
static $this_plugin; |
| 53 |
if ( empty( $this_plugin ) ) { |
| 54 |
$this_plugin = 'fixed-bottom-menu/fixedbottommenu.php'; |
| 55 |
} |
| 56 |
if ( $file === $this_plugin ) { |
| 57 |
$links[] = '<a href="' . admin_url( 'options-general.php?page=fixedbottommenu' ) . '">' . __( 'Settings' ) . '</a>'; |
| 58 |
} |
| 59 |
return $links; |
| 60 |
} |
| 61 |
|
| 62 |
/** ================================================== |
| 63 |
* Settings page |
| 64 |
* |
| 65 |
* @since 1.00 |
| 66 |
*/ |
| 67 |
public function plugin_menu() { |
| 68 |
add_options_page( 'Fixed Bottom Menu Options', 'Fixed Bottom Menu', 'manage_options', 'fixedbottommenu', array( $this, 'plugin_options' ) ); |
| 69 |
} |
| 70 |
|
| 71 |
/** ================================================== |
| 72 |
* Add Css and Script |
| 73 |
* |
| 74 |
* @since 1.00 |
| 75 |
*/ |
| 76 |
public function load_custom_wp_admin_style() { |
| 77 |
if ( $this->is_my_plugin_screen() ) { |
| 78 |
wp_enqueue_style( 'jquery-responsiveTabs', plugin_dir_url( __DIR__ ) . 'css/responsive-tabs.css', array(), '1.4.0' ); |
| 79 |
wp_enqueue_style( 'jquery-responsiveTabs-style', plugin_dir_url( __DIR__ ) . 'css/style.css', array(), '1.4.0' ); |
| 80 |
wp_enqueue_script( 'jquery' ); |
| 81 |
wp_enqueue_script( 'jquery-responsiveTabs', plugin_dir_url( __DIR__ ) . 'js/jquery.responsiveTabs.min.js', array(), '1.4.0', false ); |
| 82 |
wp_enqueue_script( 'jquery-jscolor', plugin_dir_url( __DIR__ ) . 'js/jscolor.min.js', array(), '2.0.5', false ); |
| 83 |
wp_enqueue_script( 'fixedbottommenu-admin-js', plugin_dir_url( __DIR__ ) . 'js/jquery.fixedbottommenu.admin.js', array( 'jquery' ), '1.0.0', false ); |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
/** ================================================== |
| 88 |
* For only admin style |
| 89 |
* |
| 90 |
* @since 1.00 |
| 91 |
*/ |
| 92 |
private function is_my_plugin_screen() { |
| 93 |
$screen = get_current_screen(); |
| 94 |
if ( is_object( $screen ) && 'settings_page_fixedbottommenu' === $screen->id ) { |
| 95 |
return true; |
| 96 |
} else { |
| 97 |
return false; |
| 98 |
} |
| 99 |
} |
| 100 |
|
| 101 |
/** ================================================== |
| 102 |
* Settings page |
| 103 |
* |
| 104 |
* @since 1.00 |
| 105 |
*/ |
| 106 |
public function plugin_options() { |
| 107 |
|
| 108 |
if ( ! current_user_can( 'manage_options' ) ) { |
| 109 |
wp_die( esc_html__( 'You do not have sufficient permissions to access this page.' ) ); |
| 110 |
} |
| 111 |
|
| 112 |
$this->options_updated(); |
| 113 |
do_action( 'fbm_icon_update' ); |
| 114 |
|
| 115 |
$icon_type = 'dash'; |
| 116 |
$addonicon = array(); |
| 117 |
if ( function_exists( 'fixed_bottom_menu_add_on_icon_load_textdomain' ) ) { |
| 118 |
$addonicon = get_option( 'fixedbottommenu_add_on_icon_settings' ); |
| 119 |
$icon_type = $addonicon['type']; |
| 120 |
} |
| 121 |
|
| 122 |
$scriptname = admin_url( 'options-general.php?page=fixedbottommenu' ); |
| 123 |
|
| 124 |
$fixedbottommenu_settings = get_option( 'fixedbottommenu_settings' ); |
| 125 |
|
| 126 |
?> |
| 127 |
|
| 128 |
<div class="wrap"> |
| 129 |
<h2>Fixed Bottom Menu</h2> |
| 130 |
|
| 131 |
<div id="fixedbottommenu-admin-tabs"> |
| 132 |
<ul> |
| 133 |
<li><a href="#fixedbottommenu-admin-tabs-1"><?php esc_html_e( 'Settings' ); ?></a></li> |
| 134 |
<li><a href="#fixedbottommenu-admin-tabs-2"><?php esc_html_e( 'Donate to this plugin »' ); ?></a></li> |
| 135 |
</ul> |
| 136 |
|
| 137 |
<div id="fixedbottommenu-admin-tabs-1"> |
| 138 |
<div class="wrap"> |
| 139 |
<h2><?php esc_html_e( 'Settings' ); ?></h2> |
| 140 |
|
| 141 |
<div style="margin: 5px; padding: 5px;"> |
| 142 |
<p class="description"> |
| 143 |
<div><?php esc_html_e( 'If the footer is overlaid on the menu and it is difficult to see, go to Appearance->Customize->Additional CSS and add a CSS like the following to make it move. The class (.site-info in the following cases) depends on the theme you are using, so please change it accordingly.', 'fixed-bottom-menu' ); ?></div> |
| 144 |
|
| 145 |
<div><?php esc_html_e( 'Example', 'fixed-bottom-menu' ); ?> : <code>.site-info{margin-bottom:2rem;}</code> |
| 146 |
<?php |
| 147 |
/* translators: menu height */ |
| 148 |
echo esc_html( sprintf( __( '* The menu is anchored to the %s.', 'fixed-bottom-menu' ), '2rem' ) ); |
| 149 |
?> |
| 150 |
</div> |
| 151 |
</p> |
| 152 |
<?php |
| 153 |
if ( empty( $addonicon ) ) { |
| 154 |
?> |
| 155 |
<details style="margin-bottom: 5px;"> |
| 156 |
<summary style="cursor: pointer; padding: 10px; border: 1px solid #ddd; background: #f4f4f4; color: #000;"><?php esc_html_e( 'Add on', 'fixed-bottom-menu' ); ?></summary> |
| 157 |
<h3>Fixed Bottom Menu Add On Icon</h3> |
| 158 |
<p class="description"> |
| 159 |
<?php |
| 160 |
esc_html_e( 'Sell add-ons that add the following icons.', 'fixed-bottom-menu' ); |
| 161 |
?> |
| 162 |
<div style="padding: 5px;"> |
| 163 |
<a href="https://fontawesome.com/" target="_blank" rel="noopener noreferrer" class="page-title-action">Font Awesome</a> |
| 164 |
<a href="https://material.io/resources/icons/" target="_blank" rel="noopener noreferrer" class="page-title-action">Google Material Icons</a> |
| 165 |
</div> |
| 166 |
</p> |
| 167 |
<div style="margin: 0 100px 10px; "> |
| 168 |
<a href="<?php echo esc_url( __( 'https://shop.riverforest-wp.info/fixed-bottom-menu-add-on-icon/', 'fixed-bottom-menu' ) ); ?>" target="_blank" rel="noopener noreferrer"><?php submit_button( __( 'BUY', 'fixed-bottom-menu' ), 'primary', 'buylink', false ); ?></a> |
| 169 |
</div> |
| 170 |
</details> |
| 171 |
<?php |
| 172 |
} else { |
| 173 |
do_action( 'fbm_icon_type' ); |
| 174 |
} |
| 175 |
?> |
| 176 |
<form method="post" action="<?php echo esc_url( $scriptname ); ?>"> |
| 177 |
<?php wp_nonce_field( 'fbm_set', 'fixedbottommenu_set' ); ?> |
| 178 |
<?php |
| 179 |
for ( $i = 1; $i <= 5; $i++ ) { |
| 180 |
?> |
| 181 |
<details style="margin-bottom: 5px;"> |
| 182 |
<summary style="cursor: pointer; padding: 10px; border: 1px solid #ddd; background: #f4f4f4; color: #000;"><?php echo esc_html( $i ); ?></summary> |
| 183 |
<?php |
| 184 |
if ( 'dash' === $icon_type ) { |
| 185 |
?> |
| 186 |
<div style="padding: 5px;"> |
| 187 |
<a style="text-decoration: none;" href="https://developer.wordpress.org/resource/dashicons/" target="_blank" rel="noopener noreferrer"><strong><?php esc_html_e( 'Dashicon' ); ?></strong></a> : |
| 188 |
<input type="text" name="dash<?php echo esc_attr( $i ); ?>" value="<?php echo esc_attr( $fixedbottommenu_settings[ 'dash' . $i ] ); ?>"> |
| 189 |
</div> |
| 190 |
<?php |
| 191 |
} else { |
| 192 |
do_action( 'fbm_icon_name', $i ); |
| 193 |
} |
| 194 |
?> |
| 195 |
<div style="padding: 5px;"> |
| 196 |
<strong><?php esc_html_e( 'URL' ); ?></strong> : |
| 197 |
<input type="text" name="url<?php echo esc_attr( $i ); ?>" style="width: 80%;" value="<?php echo esc_url( $fixedbottommenu_settings[ 'url' . $i ] ); ?>"> |
| 198 |
</div> |
| 199 |
<div style="padding: 5px;"> |
| 200 |
<strong><?php esc_html_e( 'Text' ); ?></strong> : |
| 201 |
<input type="text" name="text<?php echo esc_attr( $i ); ?>" value="<?php echo esc_attr( $fixedbottommenu_settings[ 'text' . $i ] ); ?>"> |
| 202 |
</div> |
| 203 |
</details> |
| 204 |
<?php |
| 205 |
} |
| 206 |
?> |
| 207 |
<details style="margin-bottom: 5px;"> |
| 208 |
<summary style="cursor: pointer; padding: 10px; border: 1px solid #ddd; background: #f4f4f4; color: #000;"><?php echo esc_html( __( 'Font Sizes' ) . ' & ' . __( 'Color' ) . ' & ' . __( 'Max Width' ) ); ?></summary> |
| 209 |
<div style="display: block;padding:5px 15px"> |
| 210 |
<strong><?php esc_html_e( 'Font Sizes' ); ?> : </strong> |
| 211 |
<input type="range" id="font_size_bar" style="vertical-align:middle;" step="1" min="8" max="12" name="font_size" value="<?php echo esc_attr( $fixedbottommenu_settings['font_size'] ); ?>" /><span id="font_size_range"></span> |
| 212 |
</div> |
| 213 |
<div style="display: block;padding:5px 15px"> |
| 214 |
<strong><?php esc_html_e( 'Background color' ); ?> : </strong> |
| 215 |
<input type="text" class="jscolor" name="back_color" value="<?php echo esc_attr( $fixedbottommenu_settings['back_color'] ); ?>" size="10" /> |
| 216 |
</div> |
| 217 |
<div style="display: block;padding:5px 15px"> |
| 218 |
<strong><?php esc_html_e( 'Text color' ); ?> : </strong> |
| 219 |
<input type="text" class="jscolor" name="color" value="<?php echo esc_attr( $fixedbottommenu_settings['color'] ); ?>" size="10" /> |
| 220 |
</div> |
| 221 |
<div style="display: block;padding:5px 15px"> |
| 222 |
<strong><?php esc_html_e( 'Overlay Color', 'fixed-bottom-menu' ); ?> : </strong> |
| 223 |
<input type="text" class="jscolor" name="over_color" value="<?php echo esc_attr( $fixedbottommenu_settings['over_color'] ); ?>" size="10" /> |
| 224 |
</div> |
| 225 |
<div style="display: block;padding:5px 15px"> |
| 226 |
<strong><?php esc_html_e( 'Max Width' ); ?> : </strong> |
| 227 |
<input type="number" step="1" min="768" name="min_width" value="<?php echo esc_attr( $fixedbottommenu_settings['min_width'] ); ?>" /> |
| 228 |
</div> |
| 229 |
</details> |
| 230 |
<details style="margin-bottom: 5px;"> |
| 231 |
<summary style="cursor: pointer; padding: 10px; border: 1px solid #ddd; background: #f4f4f4; color: #000;"><?php esc_html_e( 'Old settings', 'fixed-bottom-menu' ); ?></summary> |
| 232 |
<div style="padding: 5px;"> |
| 233 |
<p class="description"> |
| 234 |
<?php esc_html_e( 'This is the setting up to version 1.01. You can use this setting by checking the box if you are having problems. Some of the latest themes, such as Twenty Twenty, may have glitches. If you experience any problems with the latest settings, please contact the support forum. In this case, please specify the browser and device you are using. CSS hacks would be much appreciated.', 'fixed-bottom-menu' ); ?> |
| 235 |
</p> |
| 236 |
<div style="display: block;padding:5px 15px"> |
| 237 |
<a href="https://wordpress.org/support/plugin/fixed-bottom-menu" target="_blank" rel="noopener noreferrer" class="page-title-action"><?php esc_html_e( 'Support Forums', 'fixed-bottom-menu' ); ?></a> |
| 238 |
</div> |
| 239 |
<div style="display: block;padding:5px 15px"> |
| 240 |
<?php esc_html_e( 'Example of footer settings', 'fixed-bottom-menu' ); ?> : <code>.site-info{margin-bottom:45px;}</code> |
| 241 |
<?php |
| 242 |
/* translators: menu height */ |
| 243 |
echo esc_html( sprintf( __( '* The menu is anchored to the %s.', 'fixed-bottom-menu' ), '45px' ) ); |
| 244 |
?> |
| 245 |
</div> |
| 246 |
<div style="display: block;padding:5px 15px"> |
| 247 |
<input type="checkbox" name="old_set" value="1" <?php checked( get_option( 'fixedbottommenu_settings_old' ), true ); ?>/><?php esc_html_e( 'Apply old settings', 'fixed-bottom-menu' ); ?> |
| 248 |
</div> |
| 249 |
</div> |
| 250 |
</details> |
| 251 |
<div class="submit"> |
| 252 |
<?php submit_button( __( 'Save Changes' ), 'large', 'Manageset', false ); ?> |
| 253 |
<?php submit_button( __( 'Default' ), 'large', 'Defaultset', false ); ?> |
| 254 |
</div> |
| 255 |
|
| 256 |
</form> |
| 257 |
|
| 258 |
</div> |
| 259 |
</div> |
| 260 |
</div> |
| 261 |
|
| 262 |
<div id="fixedbottommenu-admin-tabs-2"> |
| 263 |
<div class="wrap"> |
| 264 |
<?php $this->credit(); ?> |
| 265 |
</div> |
| 266 |
</div> |
| 267 |
|
| 268 |
</div> |
| 269 |
|
| 270 |
</div> |
| 271 |
<?php |
| 272 |
} |
| 273 |
|
| 274 |
/** ================================================== |
| 275 |
* Credit |
| 276 |
* |
| 277 |
* @since 1.00 |
| 278 |
*/ |
| 279 |
private function credit() { |
| 280 |
|
| 281 |
$plugin_name = null; |
| 282 |
$plugin_ver_num = null; |
| 283 |
$plugin_path = plugin_dir_path( __DIR__ ); |
| 284 |
$plugin_dir = untrailingslashit( $plugin_path ); |
| 285 |
$slugs = explode( '/', $plugin_dir ); |
| 286 |
$slug = end( $slugs ); |
| 287 |
$files = scandir( $plugin_dir ); |
| 288 |
foreach ( $files as $file ) { |
| 289 |
if ( '.' === $file || '..' === $file || is_dir( $plugin_path . $file ) ) { |
| 290 |
continue; |
| 291 |
} else { |
| 292 |
$exts = explode( '.', $file ); |
| 293 |
$ext = strtolower( end( $exts ) ); |
| 294 |
if ( 'php' === $ext ) { |
| 295 |
$plugin_datas = get_file_data( |
| 296 |
$plugin_path . $file, |
| 297 |
array( |
| 298 |
'name' => 'Plugin Name', |
| 299 |
'version' => 'Version', |
| 300 |
) |
| 301 |
); |
| 302 |
if ( array_key_exists( 'name', $plugin_datas ) && ! empty( $plugin_datas['name'] ) && array_key_exists( 'version', $plugin_datas ) && ! empty( $plugin_datas['version'] ) ) { |
| 303 |
$plugin_name = $plugin_datas['name']; |
| 304 |
$plugin_ver_num = $plugin_datas['version']; |
| 305 |
break; |
| 306 |
} |
| 307 |
} |
| 308 |
} |
| 309 |
} |
| 310 |
$plugin_version = __( 'Version:' ) . ' ' . $plugin_ver_num; |
| 311 |
/* translators: FAQ Link & Slug */ |
| 312 |
$faq = sprintf( esc_html__( 'https://wordpress.org/plugins/%s/faq', '%s' ), $slug ); |
| 313 |
$support = 'https://wordpress.org/support/plugin/' . $slug; |
| 314 |
$review = 'https://wordpress.org/support/view/plugin-reviews/' . $slug; |
| 315 |
$translate = 'https://translate.wordpress.org/projects/wp-plugins/' . $slug; |
| 316 |
$facebook = 'https://www.facebook.com/katsushikawamori/'; |
| 317 |
$twitter = 'https://twitter.com/dodesyo312'; |
| 318 |
$youtube = 'https://www.youtube.com/channel/UC5zTLeyROkvZm86OgNRcb_w'; |
| 319 |
$donate = sprintf( esc_html__( 'https://shop.riverforest-wp.info/donate/', '%s' ), $slug ); |
| 320 |
|
| 321 |
?> |
| 322 |
<span style="font-weight: bold;"> |
| 323 |
<div> |
| 324 |
<?php echo esc_html( $plugin_version ); ?> | |
| 325 |
<a style="text-decoration: none;" href="<?php echo esc_url( $faq ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'FAQ' ); ?></a> | <a style="text-decoration: none;" href="<?php echo esc_url( $support ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Support Forums' ); ?></a> | <a style="text-decoration: none;" href="<?php echo esc_url( $review ); ?>" target="_blank" rel="noopener noreferrer"><?php sprintf( esc_html_e( 'Reviews', '%s' ), $slug ); ?></a> |
| 326 |
</div> |
| 327 |
<div> |
| 328 |
<a style="text-decoration: none;" href="<?php echo esc_url( $translate ); ?>" target="_blank" rel="noopener noreferrer"> |
| 329 |
<?php |
| 330 |
/* translators: Plugin translation link */ |
| 331 |
echo sprintf( esc_html__( 'Translations for %s' ), esc_html( $plugin_name ) ); |
| 332 |
?> |
| 333 |
</a> | <a style="text-decoration: none;" href="<?php echo esc_url( $facebook ); ?>" target="_blank" rel="noopener noreferrer"><span class="dashicons dashicons-facebook"></span></a> | <a style="text-decoration: none;" href="<?php echo esc_url( $twitter ); ?>" target="_blank" rel="noopener noreferrer"><span class="dashicons dashicons-twitter"></span></a> | <a style="text-decoration: none;" href="<?php echo esc_url( $youtube ); ?>" target="_blank" rel="noopener noreferrer"><span class="dashicons dashicons-video-alt3"></span></a> |
| 334 |
</div> |
| 335 |
</span> |
| 336 |
|
| 337 |
<div style="width: 250px; height: 180px; margin: 5px; padding: 5px; border: #CCC 2px solid;"> |
| 338 |
<h3><?php sprintf( esc_html_e( 'Please make a donation if you like my work or would like to further the development of this plugin.', '%s' ), $slug ); ?></h3> |
| 339 |
<div style="text-align: right; margin: 5px; padding: 5px;"><span style="padding: 3px; color: #ffffff; background-color: #008000">Plugin Author</span> <span style="font-weight: bold;">Katsushi Kawamori</span></div> |
| 340 |
<button type="button" style="margin: 5px; padding: 5px;" onclick="window.open('<?php echo esc_url( $donate ); ?>')"><?php esc_html_e( 'Donate to this plugin »' ); ?></button> |
| 341 |
</div> |
| 342 |
|
| 343 |
<?php |
| 344 |
|
| 345 |
} |
| 346 |
|
| 347 |
/** ================================================== |
| 348 |
* Update wp_options table. |
| 349 |
* |
| 350 |
* @since 1.00 |
| 351 |
*/ |
| 352 |
private function options_updated() { |
| 353 |
|
| 354 |
if ( isset( $_POST['Manageset'] ) && ! empty( $_POST['Manageset'] ) ) { |
| 355 |
if ( check_admin_referer( 'fbm_set', 'fixedbottommenu_set' ) ) { |
| 356 |
$icon_type = 'dash'; |
| 357 |
$addonicon = array(); |
| 358 |
if ( function_exists( 'fixed_bottom_menu_add_on_icon_load_textdomain' ) ) { |
| 359 |
$addonicon = get_option( 'fixedbottommenu_add_on_icon_settings' ); |
| 360 |
$icon_type = $addonicon['type']; |
| 361 |
} |
| 362 |
$fixedbottommenu_settings = get_option( 'fixedbottommenu_settings' ); |
| 363 |
if ( 'dash' === $icon_type ) { |
| 364 |
if ( ! empty( $_POST['dash1'] ) ) { |
| 365 |
$fixedbottommenu_settings['dash1'] = sanitize_text_field( wp_unslash( $_POST['dash1'] ) ); |
| 366 |
} else { |
| 367 |
$fixedbottommenu_settings['dash1'] = null; |
| 368 |
} |
| 369 |
if ( ! empty( $_POST['dash2'] ) ) { |
| 370 |
$fixedbottommenu_settings['dash2'] = sanitize_text_field( wp_unslash( $_POST['dash2'] ) ); |
| 371 |
} else { |
| 372 |
$fixedbottommenu_settings['dash2'] = null; |
| 373 |
} |
| 374 |
if ( ! empty( $_POST['dash3'] ) ) { |
| 375 |
$fixedbottommenu_settings['dash3'] = sanitize_text_field( wp_unslash( $_POST['dash3'] ) ); |
| 376 |
} else { |
| 377 |
$fixedbottommenu_settings['dash3'] = null; |
| 378 |
} |
| 379 |
if ( ! empty( $_POST['dash4'] ) ) { |
| 380 |
$fixedbottommenu_settings['dash4'] = sanitize_text_field( wp_unslash( $_POST['dash4'] ) ); |
| 381 |
} else { |
| 382 |
$fixedbottommenu_settings['dash4'] = null; |
| 383 |
} |
| 384 |
if ( ! empty( $_POST['dash5'] ) ) { |
| 385 |
$fixedbottommenu_settings['dash5'] = sanitize_text_field( wp_unslash( $_POST['dash5'] ) ); |
| 386 |
} else { |
| 387 |
$fixedbottommenu_settings['dash5'] = null; |
| 388 |
} |
| 389 |
} |
| 390 |
if ( ! empty( $_POST['url1'] ) ) { |
| 391 |
$fixedbottommenu_settings['url1'] = esc_url_raw( wp_unslash( $_POST['url1'] ) ); |
| 392 |
} else { |
| 393 |
$fixedbottommenu_settings['url1'] = null; |
| 394 |
} |
| 395 |
if ( ! empty( $_POST['text1'] ) ) { |
| 396 |
$fixedbottommenu_settings['text1'] = sanitize_text_field( wp_unslash( $_POST['text1'] ) ); |
| 397 |
} else { |
| 398 |
$fixedbottommenu_settings['text1'] = null; |
| 399 |
} |
| 400 |
if ( ! empty( $_POST['url2'] ) ) { |
| 401 |
$fixedbottommenu_settings['url2'] = esc_url_raw( wp_unslash( $_POST['url2'] ) ); |
| 402 |
} else { |
| 403 |
$fixedbottommenu_settings['url2'] = null; |
| 404 |
} |
| 405 |
if ( ! empty( $_POST['text2'] ) ) { |
| 406 |
$fixedbottommenu_settings['text2'] = sanitize_text_field( wp_unslash( $_POST['text2'] ) ); |
| 407 |
} else { |
| 408 |
$fixedbottommenu_settings['text2'] = null; |
| 409 |
} |
| 410 |
if ( ! empty( $_POST['url3'] ) ) { |
| 411 |
$fixedbottommenu_settings['url3'] = esc_url_raw( wp_unslash( $_POST['url3'] ) ); |
| 412 |
} else { |
| 413 |
$fixedbottommenu_settings['url3'] = null; |
| 414 |
} |
| 415 |
if ( ! empty( $_POST['text3'] ) ) { |
| 416 |
$fixedbottommenu_settings['text3'] = sanitize_text_field( wp_unslash( $_POST['text3'] ) ); |
| 417 |
} else { |
| 418 |
$fixedbottommenu_settings['text3'] = null; |
| 419 |
} |
| 420 |
if ( ! empty( $_POST['url4'] ) ) { |
| 421 |
$fixedbottommenu_settings['url4'] = esc_url_raw( wp_unslash( $_POST['url4'] ) ); |
| 422 |
} else { |
| 423 |
$fixedbottommenu_settings['url4'] = null; |
| 424 |
} |
| 425 |
if ( ! empty( $_POST['text4'] ) ) { |
| 426 |
$fixedbottommenu_settings['text4'] = sanitize_text_field( wp_unslash( $_POST['text4'] ) ); |
| 427 |
} else { |
| 428 |
$fixedbottommenu_settings['text4'] = null; |
| 429 |
} |
| 430 |
if ( ! empty( $_POST['url5'] ) ) { |
| 431 |
$fixedbottommenu_settings['url5'] = esc_url_raw( wp_unslash( $_POST['url5'] ) ); |
| 432 |
} else { |
| 433 |
$fixedbottommenu_settings['url5'] = null; |
| 434 |
} |
| 435 |
if ( ! empty( $_POST['text5'] ) ) { |
| 436 |
$fixedbottommenu_settings['text5'] = sanitize_text_field( wp_unslash( $_POST['text5'] ) ); |
| 437 |
} else { |
| 438 |
$fixedbottommenu_settings['text5'] = null; |
| 439 |
} |
| 440 |
if ( isset( $_POST['font_size'] ) && ! empty( $_POST['font_size'] ) ) { |
| 441 |
$fixedbottommenu_settings['font_size'] = intval( $_POST['font_size'] ); |
| 442 |
} |
| 443 |
if ( isset( $_POST['back_color'] ) && ! empty( $_POST['back_color'] ) ) { |
| 444 |
$fixedbottommenu_settings['back_color'] = '#' . sanitize_text_field( wp_unslash( $_POST['back_color'] ) ); |
| 445 |
} |
| 446 |
if ( isset( $_POST['color'] ) && ! empty( $_POST['color'] ) ) { |
| 447 |
$fixedbottommenu_settings['color'] = '#' . sanitize_text_field( wp_unslash( $_POST['color'] ) ); |
| 448 |
} |
| 449 |
if ( isset( $_POST['over_color'] ) && ! empty( $_POST['over_color'] ) ) { |
| 450 |
$fixedbottommenu_settings['over_color'] = '#' . sanitize_text_field( wp_unslash( $_POST['over_color'] ) ); |
| 451 |
} |
| 452 |
if ( isset( $_POST['min_width'] ) && ! empty( $_POST['min_width'] ) ) { |
| 453 |
$fixedbottommenu_settings['min_width'] = intval( $_POST['min_width'] ); |
| 454 |
} |
| 455 |
if ( ! empty( $_POST['old_set'] ) ) { |
| 456 |
update_option( 'fixedbottommenu_settings_old', true ); |
| 457 |
} else { |
| 458 |
delete_option( 'fixedbottommenu_settings_old' ); |
| 459 |
} |
| 460 |
update_option( 'fixedbottommenu_settings', $fixedbottommenu_settings ); |
| 461 |
echo '<div class="notice notice-success is-dismissible"><ul><li>' . esc_html__( 'Settings' ) . ' --> ' . esc_html__( 'Settings saved.' ) . '</li></ul></div>'; |
| 462 |
} |
| 463 |
} |
| 464 |
|
| 465 |
if ( isset( $_POST['Defaultset'] ) && ! empty( $_POST['Defaultset'] ) ) { |
| 466 |
if ( check_admin_referer( 'fbm_set', 'fixedbottommenu_set' ) ) { |
| 467 |
$fixedbottommenu_tbl = array( |
| 468 |
'dash1' => 'admin-home', |
| 469 |
'dash2' => 'calendar', |
| 470 |
'dash3' => 'edit', |
| 471 |
'dash4' => 'playlist-video', |
| 472 |
'dash5' => 'location', |
| 473 |
'url1' => home_url(), |
| 474 |
'text1' => 'Home', |
| 475 |
'url2' => null, |
| 476 |
'text2' => 'Calendar', |
| 477 |
'url3' => null, |
| 478 |
'text3' => 'Blog', |
| 479 |
'url4' => null, |
| 480 |
'text4' => 'Gallery', |
| 481 |
'url5' => null, |
| 482 |
'text5' => 'Address', |
| 483 |
'font_size' => 10, |
| 484 |
'back_color' => '#7db4e6', |
| 485 |
'color' => '#ffffff', |
| 486 |
'over_color' => '#0000ff', |
| 487 |
'min_width' => '1300', |
| 488 |
); |
| 489 |
update_option( 'fixedbottommenu_settings', $fixedbottommenu_tbl ); |
| 490 |
echo '<div class="notice notice-success is-dismissible"><ul><li>' . esc_html__( 'Settings' ) . ' --> ' . esc_html__( 'Default' ) . '</li></ul></div>'; |
| 491 |
delete_option( 'fixedbottommenu_settings_old' ); |
| 492 |
} |
| 493 |
} |
| 494 |
|
| 495 |
} |
| 496 |
|
| 497 |
/** ================================================== |
| 498 |
* Settings register |
| 499 |
* |
| 500 |
* @since 1.00 |
| 501 |
*/ |
| 502 |
public function register_settings() { |
| 503 |
|
| 504 |
if ( ! get_option( 'fixedbottommenu_settings' ) ) { |
| 505 |
$fixedbottommenu_tbl = array( |
| 506 |
'dash1' => 'admin-home', |
| 507 |
'dash2' => 'calendar', |
| 508 |
'dash3' => 'edit', |
| 509 |
'dash4' => 'playlist-video', |
| 510 |
'dash5' => 'location', |
| 511 |
'url1' => home_url(), |
| 512 |
'text1' => 'Home', |
| 513 |
'url2' => null, |
| 514 |
'text2' => 'Calendar', |
| 515 |
'url3' => null, |
| 516 |
'text3' => 'Blog', |
| 517 |
'url4' => null, |
| 518 |
'text4' => 'Gallery', |
| 519 |
'url5' => null, |
| 520 |
'text5' => 'Address', |
| 521 |
'font_size' => 10, |
| 522 |
'back_color' => '#7db4e6', |
| 523 |
'color' => '#ffffff', |
| 524 |
'over_color' => '#0000ff', |
| 525 |
'min_width' => '1300', |
| 526 |
); |
| 527 |
update_option( 'fixedbottommenu_settings', $fixedbottommenu_tbl ); |
| 528 |
} |
| 529 |
|
| 530 |
} |
| 531 |
|
| 532 |
} |
| 533 |
|
| 534 |
|
| 535 |
|