PluginProbe
WP Bottom Menu / 1.4
WP Bottom Menu v1.4
trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.1 1.1.1 1.1.2 1.2 1.3 1.3.2 1.4 1.4.2 1.4.3 2.0 2.0.1 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.2 2.2.1 2.2.2 All 27 releases
wp-bottom-menu / wp-bottom-menu.php

wp-bottom-menu.php in WP Bottom Menu 1.4, at wp-bottom-menu.php

606 lines 28.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: WP Bottom Menu
4 * Description: WP Bottom Menu allows you to add a woocommerce supported bottom menu to your site.
5 * Version: 1.4
6 * Author: J4
7 * Author URI: https://j4cob.net
8 * License: GPL v2 or later
9 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
10 * Text Domain: wp-bottom-menu
11 * Domain Path: /languages
12 *
13 * WP Bottom Menu is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation, either version 2 of the License, or
16 * any later version.
17 *
18 * WP Bottom Menu is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 */
23
24 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
25
26 define( 'WP_BOTTOM_MENU_VERSION', '1.4' );
27 define( 'WP_BOTTOM_MENU_DIR_URL', plugin_dir_url( __FILE__ ) );
28 define( 'WP_BOTTOM_MENU_DIR_PATH', plugin_dir_path( __FILE__ ) );
29
30
31 if ( class_exists( 'WPBottomMenu' ) ){
32 $wpbottommenu = new WPBottomMenu;
33 }
34
35 class WPBottomMenu{
36
37 public function __construct() {
38 $this->includes();
39 $this->_hooks();
40 }
41
42 function _hooks(){
43 add_action( 'wp_enqueue_scripts', array( $this, 'add_theme_scripts' ) );
44 add_action( 'wp_footer', array($this, 'wp_bottom_menu' ) );
45 add_action( 'customize_register', array($this, 'wp_bottom_menu_customize_register' ) );
46 add_action( 'wp_footer', array($this, 'wpbottommenu_customize_css') );
47 add_filter( 'plugin_action_links', array($this, 'wp_bottom_menu_action_links'), 10, 2 );
48 if (class_exists( 'WooCommerce' )){
49 add_filter( 'woocommerce_add_to_cart_fragments', array($this, 'wp_bottom_menu_add_to_cart_fragment'), 10, 1 );
50 }
51 }
52
53 function includes(){
54 require_once(WP_BOTTOM_MENU_DIR_PATH.'inc/customizer-repeater/functions.php');
55 }
56
57 // enqueue scripts
58 function add_theme_scripts() {
59 wp_enqueue_style( 'wp-bottom-menu-style', WP_BOTTOM_MENU_DIR_URL . 'inc/style.css', array(), WP_BOTTOM_MENU_VERSION, 'all');
60 wp_enqueue_script( 'wp-bottom-menu-js', WP_BOTTOM_MENU_DIR_URL . 'inc/main.js', array(), WP_BOTTOM_MENU_VERSION, true);
61 if(get_option( 'wpbottommenu_iconset', 'fontawesome' ) == 'fontawesome'){
62 wp_enqueue_style( 'font-awesome', WP_BOTTOM_MENU_DIR_URL . 'inc/customizer-repeater/css/font-awesome.min.css', array(), CUSTOMIZER_REPEATER_VERSION );
63 }
64 }
65
66 // wp bottom menu
67 function wp_bottom_menu() {
68
69
70 // Check pages to hide
71 if ( is_array( get_option( 'wpbottommenu_hide_pages' ) ) ){
72 foreach(get_option( 'wpbottommenu_hide_pages' ) as $page){
73 if ($page == get_the_ID())
74 return;
75 }
76 }
77
78 ?>
79 <div class="wp-bottom-menu" id="wp-bottom-menu">
80
81 <?php
82 $customizer_repeater_wpbm = get_option('customizer_repeater_wpbm', json_encode( array(
83 array("choice" => "wpbm-homepage" ,"subtitle" => "fa-home", "title" => "Home", "id" => "customizer_repeater_1" ),
84 array("choice" => "wpbm-woo-account" ,"subtitle" => "fa-user", "title" => "Account", "id" => "customizer_repeater_2" ),
85 array("choice" => "wpbm-woo-cart" ,"subtitle" => "fa-shopping-cart", "title" => "Cart", "id" => "customizer_repeater_3" ),
86 array("choice" => "wpbm-woo-search" ,"subtitle" => "fa-search", "title" => "Search", "id" => "customizer_repeater_4" ),
87 ) ) );
88 /*This returns a json so we have to decode it*/
89
90 $customizer_repeater_wpbm_decoded = json_decode($customizer_repeater_wpbm);
91 $wpbm_woo_search = false;
92 $wpbm_post_search = false;
93 $wpbm_link_target = get_option( 'wpbottommenu_target' ) ? 'target=_blank' : '';
94 foreach($customizer_repeater_wpbm_decoded as $repeater_item){
95
96 if($repeater_item->choice == "wpbm-woo-search" or $repeater_item->choice == "wpbm-post-search"):?>
97 <a href="javascript:void(0);" title="<?php echo $repeater_item->title; ?>" class="wp-bottom-menu-item wp-bottom-menu-search-form-trigger">
98 <?php else: ?>
99 <?php
100 $wpbm_item_url = $wpbm_item_active = '';
101 switch($repeater_item->choice){
102 case "wpbm-homepage":
103 $wpbm_item_url = esc_url( home_url() );
104 if ( is_front_page() ){
105 $wpbm_item_active = 'active';
106 }
107 break;
108 case "wpbm-woo-cart":
109 if ( class_exists( 'WooCommerce' ) ) {
110 $wpbm_item_url = esc_url( wc_get_page_permalink( 'cart' ) );
111 } else {
112 $wpbm_item_url = '#';
113 }
114 break;
115 case "wpbm-woo-account":
116 if ( class_exists( 'WooCommerce' ) ) {
117 $wpbm_item_url = esc_url( wc_get_page_permalink( 'myaccount' ) );
118 } else {
119 $wpbm_item_url = '#';
120 }
121 break;
122
123 default:
124 $wpbm_item_url = esc_url( $repeater_item->link );
125 }
126
127 if ( url_to_postid($wpbm_item_url) === get_the_ID() ){
128 $wpbm_item_active = 'active';
129 }
130
131
132 ?>
133 <a href="<?php echo $wpbm_item_url; ?>" class="wp-bottom-menu-item <?php echo esc_attr($wpbm_item_active); ?>" <?php echo esc_attr($wpbm_link_target); ?>>
134 <?php endif; ?>
135
136 <div class="wp-bottom-menu-icon-wrapper">
137 <?php if(get_option( 'wpbottommenu_show_cart_count', false )): ?>
138 <?php if ( class_exists( 'WooCommerce' ) and $repeater_item->choice == "wpbm-woo-cart") : ?>
139 <div class="wp-bottom-menu-cart-count"><?php echo WC()->cart->get_cart_contents_count(); ?></div>
140 <?php endif; ?>
141 <?php endif; ?>
142
143 <?php if(get_option( 'wpbottommenu_iconset', 'fontawesome' ) == 'fontawesome'): ?>
144 <i class="wp-bottom-menu-item-icons fa <?php echo $repeater_item->subtitle; ?>"></i>
145 <?php else: ?>
146 <?php echo html_entity_decode($repeater_item->subtitle); ?>
147 <?php endif; ?>
148 </div>
149 <?php if(!get_option( 'wpbottommenu_disable_title', false )): ?>
150 <?php if(get_option( 'wpbottommenu_show_cart_total', false ) and $repeater_item->choice == "wpbm-woo-cart" and class_exists( 'WooCommerce' )): ?>
151 <span class="wp-bottom-menu-cart-total"><?php WC()->cart->get_cart_total(); ?></span>
152 <?php else: ?>
153 <span><?php echo $repeater_item->title; ?></span>
154 <?php endif; ?>
155 <?php endif; ?>
156
157 </a>
158 <?php
159
160 if ( $repeater_item->choice == "wpbm-woo-search" and !$wpbm_woo_search )
161 $wpbm_woo_search = true;
162
163 if ( $repeater_item->choice == "wpbm-post-search" and !$wpbm_post_search )
164 $wpbm_post_search = true;
165
166 }
167 ?>
168 </div>
169
170 <?php if ( $wpbm_woo_search || $wpbm_post_search ): ?>
171 <div class="wp-bottom-menu-search-form-wrapper" id="wp-bottom-menu-search-form-wrapper">
172 <form role="search" method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>" class="wp-bottom-menu-search-form">
173 <i class="fa fa-search"></i>
174 <input type="hidden" name="post_type" value="<?php if($wpbm_woo_search and class_exists( 'WooCommerce' )) echo esc_attr("product"); else echo esc_attr("post"); ?>" />
175 <input type="search" class="search-field" placeholder="<?php if(get_option( 'wpbottommenu_placeholder_text', 'Search' )) echo get_option( 'wpbottommenu_placeholder_text', 'Search' ); else echo esc_attr_x( 'Search', 'wp-bottom-menu' ); ?>" value="<?php echo get_search_query(); ?>" name="s" />
176 </form>
177 </div>
178 <?php endif;
179
180 }
181 // customizer api
182 function wp_bottom_menu_customize_register( $wp_customize ) {
183
184 if( !class_exists('Customize_Control_Multiple_Select') ){
185 require_once( WP_BOTTOM_MENU_DIR_PATH . 'inc/page-control/page-control.php');
186 }
187
188 // Add Theme Options Panel.
189 $wp_customize->add_panel( 'wpbottommenu_panel',
190 array(
191 'title' => esc_html__( 'WP Bottom Menu', 'wp-bottom-menu' ),
192 'priority' => 20
193 )
194 );
195
196 //
197 // Section: Settings
198 //
199
200 $wp_customize->add_section( 'wpbottommenu_section_settings', array(
201 'title' => esc_html__( 'Settings', 'wp-bottom-menu' ),
202 'priority' => 120,
203 'panel' => 'wpbottommenu_panel',
204 ));
205
206 $wp_customize->add_setting( 'wpbottommenu_iconset', array(
207 'default' => 'fontawesome',
208 'type' => 'option',
209 ) );
210
211 $wp_customize->add_control( 'wpbottommenu_iconset', array(
212 'type' => 'select',
213 'section' => 'wpbottommenu_section_settings',
214 'label' => __( 'Select Icon Type', 'wp-bottom-menu' ),
215 'description' => __( '<u>Custom SVG:</u> Paste SVG Icon code.<br><u>FontAwesome:</u> Enable FontAwesome Library.', 'wp-bottom-menu' ),
216 'choices' => array(
217 'svg' => __( 'Custom SVG' ),
218 'fontawesome' => __( 'FontAwesome (v4.7)' ),
219 ),
220 ) );
221
222 $wp_customize->add_setting( 'wpbottommenu_display_px' , array(
223 'default' => '1024',
224 'type' => 'option',
225 ));
226
227 $wp_customize->add_control('wpbottommenu_display_px', array(
228 'label' => __( 'Active The Menu (px)', 'wp-bottom-menu' ),
229 'section' => 'wpbottommenu_section_settings',
230 'settings' => 'wpbottommenu_display_px',
231 'type' => 'number',
232 ));
233
234 $wp_customize->add_setting( 'wpbottommenu_display_always' , array(
235 'default' => false,
236 'type' => 'option',
237 ));
238
239 $wp_customize->add_control('wpbottommenu_display_always', array(
240 'label' => __( 'Active for any screen size?', 'wp-bottom-menu' ),
241 'section' => 'wpbottommenu_section_settings',
242 'settings' => 'wpbottommenu_display_always',
243 'type' => 'checkbox',
244 ));
245
246 $wp_customize->add_setting( 'wpbottommenu_target' , array(
247 'default' => false,
248 'type' => 'option',
249 ));
250
251 $wp_customize->add_control('wpbottommenu_target', array(
252 'label' => __( 'Open links in a new tab', 'wp-bottom-menu' ),
253 'section' => 'wpbottommenu_section_settings',
254 'settings' => 'wpbottommenu_target',
255 'type' => 'checkbox',
256 ));
257
258 $wp_customize->add_setting( 'wpbottommenu_zindex' , array(
259 'default' => '9999',
260 'type' => 'option',
261 ));
262
263 $wp_customize->add_control('wpbottommenu_zindex', array(
264 'label' => __( 'Menu Z-Index', 'wp-bottom-menu' ),
265 'description' => esc_html__( 'Recommended value: 9999', 'wp-bottom-menu' ),
266 'section' => 'wpbottommenu_section_settings',
267 'settings' => 'wpbottommenu_zindex',
268 'type' => 'number',
269 ));
270
271 // Hide Pages
272 $wp_customize->add_setting( 'wpbottommenu_hide_pages', array(
273 'type' => 'option',
274 'capability' => 'edit_theme_options',
275 'sanitize_callback' => 'wpbm_pages_sanitize'
276 ) );
277
278 $wp_customize->add_control(
279 new Customize_Control_Multiple_Select(
280 $wp_customize,
281 'multiple_select_setting',
282 array(
283 'settings' => 'wpbottommenu_hide_pages',
284 'label' => __('Hide Menu', 'wp-bottom-menu'),
285 'description' => __('The menu will be hidden on the pages you have selected. You can choose multiple.', 'wp-bottom-menu'),
286 'section' => 'wpbottommenu_section_settings',
287 'type' => 'multiple-select',
288 'choices' => wpbm_pages()
289 )
290 )
291 );
292
293 //
294 // Section: Customize
295 //
296
297 $wp_customize->add_section('wpbottommenu_section_customize', array(
298 'title' => __('Customize', 'wp-bottom-menu'),
299 'priority' => 130,
300 'panel' => 'wpbottommenu_panel'
301 ));
302
303 $wp_customize->add_setting( 'wpbottommenu_placeholder_text' , array(
304 'default' => 'Search',
305 'type' => 'option',
306 ));
307
308 $wp_customize->add_control( 'wpbottommenu_placeholder_text', array(
309 'label' => __( 'Search Input Placeholder Text', 'wp-bottom-menu' ),
310 'section' => 'wpbottommenu_section_customize',
311 'settings' => 'wpbottommenu_placeholder_text',
312 'type' => 'text',
313 ));
314
315 $wp_customize->add_setting( 'wpbottommenu_fontsize' , array(
316 'default' => '12',
317 'type' => 'option',
318 ));
319
320 $wp_customize->add_control( 'wpbottommenu_fontsize', array(
321 'label' => __( 'Menu Font Size (px)', 'wp-bottom-menu' ),
322 'section' => 'wpbottommenu_section_customize',
323 'settings' => 'wpbottommenu_fontsize',
324 'type' => 'number',
325 ));
326
327 $wp_customize->add_setting( 'wpbottommenu_iconsize' , array(
328 'default' => '24',
329 'type' => 'option',
330 ));
331
332 $wp_customize->add_control( 'wpbottommenu_iconsize', array(
333 'label' => __( 'Menu Icon Size (px)', 'wp-bottom-menu' ),
334 'section' => 'wpbottommenu_section_customize',
335 'settings' => 'wpbottommenu_iconsize',
336 'type' => 'number',
337 ));
338
339 $wp_customize->add_setting( 'wpbottommenu_wrapper_padding' , array(
340 'default' => '10',
341 'type' => 'option',
342 ));
343
344 $wp_customize->add_control( 'wpbottommenu_wrapper_padding', array(
345 'label' => __( 'Menu Padding (px)', 'wp-bottom-menu' ),
346 'section' => 'wpbottommenu_section_customize',
347 'settings' => 'wpbottommenu_wrapper_padding',
348 'type' => 'number',
349 ));
350
351 $wp_customize->add_setting( 'wpbottommenu_textcolor', array(
352 'default' => '#555555',
353 'section' => 'wpbottommenu_section_customize',
354 'sanitize_callback' => 'sanitize_hex_color',
355 'type' => 'option'
356 ));
357
358 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'wpbottommenu_textcolor', array(
359 'label' => __( 'Menu Text Color', 'wp-bottom-menu' ),
360 'section' => 'wpbottommenu_section_customize',
361 )));
362
363 $wp_customize->add_setting( 'wpbottommenu_htextcolor', array(
364 'default' => '#000000',
365 'section' => 'wpbottommenu_section_customize',
366 'sanitize_callback' => 'sanitize_hex_color',
367 'type' => 'option'
368 ));
369
370 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'wpbottommenu_htextcolor', array(
371 'label' => __( 'Menu Hover/Active Text Color', 'wp-bottom-menu' ),
372 'section' => 'wpbottommenu_section_customize',
373 )));
374
375 $wp_customize->add_setting( 'wpbottommenu_iconcolor', array(
376 'default' => '#555555',
377 'section' => 'wpbottommenu_section_customize',
378 'sanitize_callback' => 'sanitize_hex_color',
379 'type' => 'option'
380 ));
381
382 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'wpbottommenu_iconcolor', array(
383 'label' => __( 'Menu Icon Color', 'wp-bottom-menu' ),
384 'section' => 'wpbottommenu_section_customize',
385 )));
386
387 $wp_customize->add_setting( 'wpbottommenu_hiconcolor', array(
388 'default' => '#000000',
389 'section' => 'wpbottommenu_section_customize',
390 'sanitize_callback' => 'sanitize_hex_color',
391 'type' => 'option'
392 ));
393
394 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'wpbottommenu_hiconcolor', array(
395 'label' => __( 'Menu Hover/Active Icon Color', 'wp-bottom-menu' ),
396 'section' => 'wpbottommenu_section_customize',
397 )));
398
399 $wp_customize->add_setting( 'wpbottommenu_bgcolor', array(
400 'default' => '#ffffff',
401 'section' => 'wpbottommenu_section_customize',
402 'sanitize_callback' => 'sanitize_hex_color',
403 'type' => 'option'
404 ));
405
406 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'wpbottommenu_bgcolor', array(
407 'label' => __( 'Menu Background Color', 'wp-bottom-menu' ),
408 'section' => 'wpbottommenu_section_customize',
409 )));
410
411 $wp_customize->add_setting( 'wpbottommenu_disable_title' , array(
412 'default' => false,
413 'type' => 'option',
414 ));
415
416 $wp_customize->add_control('wpbottommenu_disable_title', array(
417 'label' => __( 'Disable title?', 'wp-bottom-menu' ),
418 'section' => 'wpbottommenu_section_customize',
419 'settings' => 'wpbottommenu_disable_title',
420 'type' => 'checkbox',
421 ));
422
423 $wp_customize->add_setting( 'wpbottommenu_cart_separator' , array(
424 'type' => 'option',
425 ));
426
427 $wp_customize->add_control('wpbottommenu_cart_separator', array(
428 'label' => __( 'Customize Cart Item', 'wp-bottom-menu' ),
429 'section' => 'wpbottommenu_section_customize',
430 'settings' => 'wpbottommenu_cart_separator',
431 'type' => 'hidden',
432 ));
433
434 $wp_customize->add_setting( 'wpbottommenu_show_cart_count' , array(
435 'default' => false,
436 'type' => 'option',
437 ));
438
439 $wp_customize->add_control('wpbottommenu_show_cart_count', array(
440 'label' => __( 'Show Cart Count', 'wp-bottom-menu' ),
441 'section' => 'wpbottommenu_section_customize',
442 'settings' => 'wpbottommenu_show_cart_count',
443 'type' => 'checkbox',
444 ));
445
446 $wp_customize->add_setting( 'wpbottommenu_cart_count_bgcolor', array(
447 'default' => '#ff0000',
448 'section' => 'wpbottommenu_section_customize',
449 'sanitize_callback' => 'sanitize_hex_color',
450 'type' => 'option'
451 ));
452
453 $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'wpbottommenu_cart_count_bgcolor', array(
454 'description' => __('Cart Count Background Color', 'wp-bottom-menu'),
455 'section' => 'wpbottommenu_section_customize',
456 )));
457
458 $wp_customize->add_setting( 'wpbottommenu_show_cart_total' , array(
459 'default' => false,
460 'type' => 'option',
461 ));
462
463 $wp_customize->add_control('wpbottommenu_show_cart_total', array(
464 'label' => __( 'Show Cart Total', 'wp-bottom-menu' ),
465 'description' => 'This option override cart menu title.',
466 'section' => 'wpbottommenu_section_customize',
467 'settings' => 'wpbottommenu_show_cart_total',
468 'type' => 'checkbox',
469 ));
470
471 //
472 // Section: Menu Items
473 //
474
475 $wp_customize->add_section('wpbottommenu_section_menuitems', array(
476 'title' => __('Menu Items', 'wp-bottom-menu'),
477 'priority' => 140,
478 'panel' => 'wpbottommenu_panel'
479 ));
480
481 $wp_customize->add_setting( 'customizer_repeater_wpbm', array(
482 'sanitize_callback' => 'customizer_repeater_sanitize',
483 'type' => 'option',
484 'default' => json_encode( array(
485 array("choice" => "wpbm-homepage" ,"subtitle" => "fa-home", "title" => "Home", "id" => "customizer_repeater_1" ),
486 array("choice" => "wpbm-woo-account" ,"subtitle" => "fa-user", "title" => "Account", "id" => "customizer_repeater_2" ),
487 array("choice" => "wpbm-woo-cart" ,"subtitle" => "fa-shopping-cart", "title" => "Cart", "id" => "customizer_repeater_3" ),
488 array("choice" => "wpbm-woo-search" ,"subtitle" => "fa-search", "title" => "Search", "id" => "customizer_repeater_4" ),
489 ))
490 ));
491
492 $wp_customize->add_control( new Customizer_Repeater( $wp_customize, 'customizer_repeater_wpbm', array(
493 'label' => esc_html__('Menu Item','customizer-repeater'),
494 'section' => 'wpbottommenu_section_menuitems',
495 'customizer_repeater_title_control' => true,
496 'customizer_repeater_link_control' => true,
497 'customizer_repeater_subtitle_control' => true,
498 )));
499
500 $wp_customize->add_setting( 'wpbottommenu_howuseicon' , array(
501 'type' => 'option',
502 ));
503
504 $wp_customize->add_control( 'wpbottommenu_howuseicon', array(
505 'label' => __( 'How to use Icons?', 'wp-bottom-menu' ),
506 'description' => sprintf(
507 __( '<u>For FontAwesome:</u> Add the names from (%1$s) to the "Icon" field.<br>Example:<code>fa-home</code><hr><u>For SVG Icons:</u> simply paste your SVG code in the "Icon" field. SVG Icon Library: %2$s<br>Enable to use SVG <code>Settings > Select Icon Type > Custom SVG</code> ', 'wp-bottom-menu' ),
508 sprintf( '<a target="_blank" href="https://fontawesome.com/v4.7.0/icons/" rel="nofollow">%s</a>', esc_html__( 'FontAwesome', 'wp-bottom-menu' ) ),
509 sprintf( '<a target="_blank" href="https://remixicon.com" rel="nofollow">%s</a>', esc_html__( 'Remix Icon', 'wp-bottom-menu' ) )
510 ),
511 'section' => 'wpbottommenu_section_menuitems',
512 'settings' => 'wpbottommenu_howuseicon',
513 'type' => 'hidden',
514 ));
515
516
517 }
518
519 // woocommerce cart fragment
520 function wp_bottom_menu_add_to_cart_fragment( $fragments ) {
521 $fragments['div.wp-bottom-menu-cart-count'] = '<div class="wp-bottom-menu-cart-count">' . WC()->cart->get_cart_contents_count() . '</div>';
522 $fragments['span.wp-bottom-menu-cart-total'] = '<span class="wp-bottom-menu-cart-total">' . WC()->cart->get_cart_total() . '</span>';
523 return $fragments;
524 }
525
526 // plugin action links
527 function wp_bottom_menu_action_links( $links_array, $plugin_file_name ){
528 if( strpos( $plugin_file_name, basename(__FILE__) ) ) {
529 array_unshift( $links_array, '<a href="' . admin_url( 'customize.php?autofocus[panel]=wpbottommenu_panel' ) . '">Settings</a>' );
530 }
531 return $links_array;
532 }
533
534 // customize css
535 function wpbottommenu_customize_css(){
536 ?>
537 <style type="text/css">
538 <?php if (!get_option( 'wpbottommenu_display_always', false )): ?>
539 @media (max-width: <?php echo get_option( 'wpbottommenu_display_px', '1024' ); ?>px){
540 .wp-bottom-menu{
541 display:flex;
542 }
543 .wp-bottom-menu-search-form-wrapper{
544 display: block;
545 }
546 }
547 <?php else: ?>
548 .wp-bottom-menu{
549 display:flex;
550 }
551 .wp-bottom-menu-search-form-wrapper{
552 display: block;
553 }
554 <?php endif; ?>
555
556 :root{
557 --wpbottommenu-font-size: <?php echo get_option( 'wpbottommenu_fontsize', '12' );?>px;
558 --wpbottommenu-icon-size: <?php echo get_option( 'wpbottommenu_iconsize', '24' );?>px;
559 --wpbottommenu-text-color: <?php echo get_option( 'wpbottommenu_textcolor', '#555555' );?>;
560 --wpbottommenu-h-text-color: <?php echo get_option( 'wpbottommenu_htextcolor', '#000000' );?>;
561 --wpbottommenu-icon-color: <?php echo get_option( 'wpbottommenu_iconcolor', '#555555' );?>;
562 --wpbottommenu-h-icon-color: <?php echo get_option( 'wpbottommenu_hiconcolor', '#000000' );?>;
563 --wpbottommenu-bgcolor: <?php echo get_option( 'wpbottommenu_bgcolor', '#ffffff' );?>;
564 --wpbottommenu-zindex: <?php echo get_option( 'wpbottommenu_zindex', '9999' ); ?>;
565 --wpbottommenu-cart-count-bgcolor: <?php echo get_option( 'wpbottommenu_cart_count_bgcolor', '#ff0000' );?>;
566 --wpbottommenu-wrapper-padding: <?php echo get_option( 'wpbottommenu_wrapper_padding', '10' );?>px 0;
567 }
568
569 </style>
570 <?php
571 }
572
573 } // class
574
575
576 function wp_bottom_menu_pluginprefix_activate() {
577 flush_rewrite_rules();
578 }
579 register_activation_hook( __FILE__, 'wp_bottom_menu_pluginprefix_activate' );
580
581 function wp_bottom_menu_pluginprefix_deactivate() {
582 /* If you want all settings to be deleted when the plugin is deactive, activate this field.
583
584 delete_option(' customizer_repeater_wpbm' );
585 delete_option( 'wpbottommenu_display_px' );
586 delete_option( 'wpbottommenu_display_always' );
587 delete_option( 'wpbottommenu_fontsize' );
588 delete_option( 'wpbottommenu_iconsize' );
589 delete_option( 'wpbottommenu_textcolor' );
590 delete_option( 'wpbottommenu_htextcolor' );
591 delete_option( 'wpbottommenu_iconcolor' );
592 delete_option( 'wpbottommenu_hiconcolor' );
593 delete_option( 'wpbottommenu_bgcolor' );
594 delete_option( 'wpbottommenu_zindex' );
595 delete_option( 'wpbottommenu_disable_title' );
596 delete_option( 'wpbottommenu_iconset' );
597 delete_option( 'wpbottommenu_placeholder_text' );
598 delete_option( 'wpbottommenu_show_cart_count' );
599 delete_option( 'wpbottommenu_show_cart_total' );
600 delete_option( 'wpbottommenu_cart_count_bgcolor' );
601 delete_option( 'wpbottommenu_hide_pages' );
602 delete_option( 'wpbottommenu_wrapper_padding' );
603 */
604 flush_rewrite_rules();
605 }
606 register_deactivation_hook( __FILE__, 'wp_bottom_menu_pluginprefix_deactivate' );