PluginProbe
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder / 1.4.4
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder v1.4.4
3.6.0 3.5.0 trunk 1.0.10 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.6.1 1.0.7 1.0.8 1.0.9 1.1 1.1.1 1.2 1.3 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5 1.5.1 All 110 releases
buttonizer-multifunctional-button / classes / Button.php

Button.php in Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder 1.4.4, at classes/Button.php

598 lines 26.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 Copyright 2017 Buttonizer
19 */
20 namespace Buttonizer;
21
22 # No script kiddies
23 defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
24 class Button
25 {
26 // Saved settings
27 private $aButtons ;
28 private $pageCategories ;
29 private $aSettings ;
30 private $aOpeningData ;
31 private $aVideo ;
32 // Default settings
33 private $bIsMobile = false ;
34 private $bIsOpened = true ;
35 // Current page
36 private $currentPageId = 0 ;
37 private $currentCategoryId = 0 ;
38 private $currentBlogId = 0 ;
39 private $sCurrentPageUrl = '' ;
40 private $currentPageTitle = '' ;
41 private $sCurrentPageDescription = '' ;
42 private $aAnimationSettings = array( 'default', 'circle', 'fade-left-to-right' ) ;
43 private $aAttentionAnimationSettings = array( 'none', 'hello', 'bounce' ) ;
44 // Output string
45 private $iAmountOfButtons = 0 ;
46 private $iAmountOfShareButtons = 0 ;
47 private $sOutput = '' ;
48 // Custom button color
49 // Label settings
50 private $labelStyle = '' ;
51 private $sButtonCss = '' ;
52 public function __construct( $bIsMobile )
53 {
54 // Set some data
55 $this->bIsMobile = (bool) $bIsMobile;
56 add_action( 'wp_footer', function () {
57 // Setup
58 $this->setup();
59 // Share buttons
60 $this->share_btns();
61 // Generate
62 $this->generate();
63 // Output
64 $this->output();
65 } );
66 add_action( 'wp_print_styles', array( &$this, 'siteLoadStyles' ) );
67 }
68
69 /**
70 * Buttonizer setup
71 */
72 private function setup()
73 {
74 // Timezone
75 // date_default_timezone_set(get_option('timezone_string') != '' ? get_option('timezone_string') : "Europe/Amsterdam");
76 // Get options
77 $this->aButtons = (array) get_option( 'buttonizer_buttons' );
78 $this->pageCategories = (array) get_option( 'buttonizer_page_categories' );
79 $this->aOpeningData = (array) get_option( 'buttonizer_opening_settings' );
80 $this->aSettings = (array) get_option( 'buttonizer_general_settings' );
81 $this->aVideo = (array) get_option( 'buttonizer_videos' );
82 // Current page data
83 $this->currentPageId = get_the_ID();
84 $this->currentCategoryId = get_the_category();
85 $this->currentBlogId = get_current_blog_id();
86 $this->currentPageTitle = strtolower( get_the_title() );
87 $this->sCurrentPageUrl = urlencode( get_permalink() );
88 $this->sCurrentPageDescription = str_replace( " ", "+", get_the_content( 'Read more' ) );
89 // Is store opened
90 $this->bIsOpened = $this->isOpened();
91 }
92
93 public function siteLoadStyles()
94 {
95 wp_enqueue_style( 'buttonizer', plugins_url( '/css/buttonizer.css?v=' . md5( BUTTONIZER_VERSION ), BUTTONIZER_PLUGIN_DIR ) );
96 wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css' );
97 }
98
99 // Generate
100 private function generate()
101 {
102 $aButtons = ( isset( $this->aButtons['buttonorder'] ) && is_array( $this->aButtons['buttonorder'] ) ? $this->aButtons['buttonorder'] : [] );
103 foreach ( $aButtons as $sKey => $iId ) {
104 if ( '-1' == $iId ) {
105 continue;
106 }
107 $sButton = $this->generateB( $iId );
108
109 if ( 'continue' == $sButton ) {
110 continue;
111 } else {
112 $this->sOutput = $sButton . $this->sOutput;
113 }
114
115 $this->iAmountOfButtons++;
116 }
117 }
118
119 /**
120 * Button generator
121 *
122 * @param $bNmbr
123 * @return string
124 */
125 private function generateB( $bNmbr )
126 {
127 // Check if this one must be showed when the company is open:
128 if ( isset( $this->aButtons['button_' . $bNmbr . '_show_when_opened'] ) && !$this->bIsOpened ) {
129 return 'continue';
130 }
131 // Check if this one must be showed when the company is open:
132 if ( isset( $this->aButtons['button_' . $bNmbr . '_show_not_when_opened'] ) && $this->bIsOpened ) {
133 return 'continue';
134 }
135 // Do we need to show the button?
136
137 if ( !isset( $this->aButtons['button_' . $bNmbr . '_show_on_phone'] ) && !isset( $this->aButtons['button_' . $bNmbr . '_show_on_desktop'] ) ) {
138 // Skipping because not showing on desktop AND phone
139 return 'continue';
140 } else {
141 // Is the button visble on mobile phones?:
142 if ( $this->bIsMobile && !isset( $this->aButtons['button_' . $bNmbr . '_show_on_phone'] ) ) {
143 // Skipping because this is a mobile
144 return 'continue';
145 }
146 // Is the button visible on desktop?:
147 if ( !$this->bIsMobile && !isset( $this->aButtons['button_' . $bNmbr . '_show_on_desktop'] ) ) {
148 // Skipping because this is desktop and it musn't get shown here
149 return 'continue';
150 }
151 }
152
153 /*
154 * Page categories selected or not
155 * Check on what pages the button must be shown
156 */
157 $buttonShowOnPages = ( isset( $this->aButtons['button_' . $bNmbr . '_show_on_pages'] ) ? $this->aButtons['button_' . $bNmbr . '_show_on_pages'] : 'all' );
158 if ( $this->checkPageCategories( $buttonShowOnPages ) ) {
159 return 'continue';
160 }
161 /*
162 * All button info
163 */
164 $buttonText = ( isset( $this->aButtons['button_' . $bNmbr . '_text'] ) ? $this->aButtons['button_' . $bNmbr . '_text'] : 'Button ' . $bNmbr );
165 $buttonTitle = ( isset( $this->aButtons['button_' . $bNmbr . '_title'] ) ? $this->aButtons['button_' . $bNmbr . '_title'] : 'Button ' . $bNmbr );
166 $buttonIsPhone = ( isset( $this->aButtons['button_' . $bNmbr . '_is_phonenumber'] ) ? $this->aButtons['button_' . $bNmbr . '_is_phonenumber'] : '' );
167 $linkNewTab = ( isset( $this->aButtons['button_' . $bNmbr . '_url_newtab'] ) ? 'target="_blank"' : '' );
168 $hideLabel = ( isset( $this->aButtons['button_' . $bNmbr . '_hide_label'] ) ? $this->aButtons['button_' . $bNmbr . '_hide_label'] : '' );
169 $sButtonAction = ( isset( $this->aButtons['button_' . $bNmbr . '_action'] ) ? $this->aButtons['button_' . $bNmbr . '_action'] : '' );
170 $sButtonActionLink = addslashes( ( isset( $this->aButtons['button_' . $bNmbr . '_url'] ) ? $this->aButtons['button_' . $bNmbr . '_url'] : '' ) );
171
172 if ( 'phone' == $sButtonAction || $buttonIsPhone ) {
173 $sButtonActionLink = 'tel:' . str_replace( [
174 ' ',
175 '+',
176 '?',
177 '#'
178 ], '', $sButtonActionLink );
179 } else {
180
181 if ( 'mail' == $sButtonAction ) {
182 $sButtonActionLink = 'mailto:' . $sButtonActionLink;
183 } else {
184
185 if ( 'backtotop' == $sButtonAction ) {
186 $sButtonActionLink = "javascript: window.scroll({top: 0, left: 0, behavior: 'smooth' });";
187 } else {
188 if ( 'gobackpage' == $sButtonAction ) {
189 $sButtonActionLink = "javascript: window.history.back(); ";
190 }
191 }
192
193 }
194
195 }
196
197 // Has image
198
199 if ( !isset( $this->aButtons['button_' . $bNmbr . '_image'] ) || empty($this->aButtons['button_' . $bNmbr . '_image']) ) {
200 $sButtonIcon = '<i class="fa ' . (( isset( $this->aButtons['button_' . $bNmbr . '_icon'] ) ? $this->aButtons['button_' . $bNmbr . '_icon'] : 'plus' )) . '"></i>';
201 } else {
202 $sButtonIcon = '<img src="' . $this->aButtons['button_' . $bNmbr . '_image'] . '" style="width: ' . (( count( $this->aButtons ) > 1 ? '25px' : '32px' )) . '; vertical-align: middle;" />';
203 }
204
205 $sButtonClasses = 'is_extra bt_' . $this->iAmountOfButtons;
206 // Show label on hover (per button)
207 $showOnHover = ( isset( $this->aButtons['button_' . $bNmbr . '_show_label_on_hover'] ) ? $this->aButtons['button_' . $bNmbr . '_show_label_on_hover'] : '' );
208
209 if ( $showOnHover == 'showOnHover' ) {
210 $sButtonClasses .= ' show_on_hover';
211 } else {
212
213 if ( $showOnHover == 'showOnHoverDesktop' ) {
214 if ( $this->bIsMobile == false ) {
215 $sButtonClasses .= ' show_on_hover';
216 }
217 } else {
218 if ( $showOnHover == 'showOnHoverMobile' ) {
219 if ( $this->bIsMobile == true ) {
220 $sButtonClasses .= ' show_on_hover';
221 }
222 }
223 }
224
225 }
226
227 // Custom classes
228 $sButtonClasses .= ' ' . $this->getCustomClass( $bNmbr );
229 // Custom colors?
230 if ( isset( $this->aButtons['button_' . $bNmbr . '_using_custom_colors'] ) && $this->aButtons['button_' . $bNmbr . '_using_custom_colors'] == '1' ) {
231 $this->sButtonCss .= '
232 .buttonizer-button .buttonizer_' . $bNmbr . ' {
233 background-color: ' . $this->aButtons['button_' . $bNmbr . '_colors_button'] . ';
234 }
235
236 .buttonizer-button .buttonizer_' . $bNmbr . ':hover,.buttonizer_' . $bNmbr . ':active {
237 background-color: ' . $this->aButtons['button_' . $bNmbr . '_colors_pushed'] . ';
238 }
239
240 .buttonizer-button .buttonizer_' . $bNmbr . ' i {
241 color: ' . $this->aButtons['button_' . $bNmbr . '_colors_icon'] . ';
242 } ';
243 }
244 return '<a href="' . $sButtonActionLink . '" class="' . $sButtonClasses . ' is_btzn_btn buttonizer_' . $bNmbr . '" ' . $linkNewTab . ' onclick="onButtonizerClickEvent(\'' . $buttonTitle . '\')">' . (( $buttonText != "" ? '<div class="text"' . (( $hideLabel == '1' ? 'style="display: none;"' : '' )) . '><div>' . $buttonText . '</div></div>' : '' )) . $sButtonIcon . '</a>';
245 // Thanks, end
246 }
247
248 /**
249 * Show on timeout
250 *
251 * @return float|int|string
252 */
253 private function showOnTimeout()
254 {
255 return '0';
256 }
257
258 /**
259 * Show on scroll
260 *
261 * @return string|int
262 */
263 private function showOnScroll()
264 {
265 return '0';
266 }
267
268 /**
269 * Exit intent
270 *
271 * @return string
272 */
273 private function enableExitIntent()
274 {
275 return '0';
276 }
277
278 /**
279 * @param $categoryId
280 * @return bool
281 */
282 private function checkPageCategories( $categoryId )
283 {
284 return false;
285 }
286
287 /**
288 * Exit intent
289 *
290 * @return mixed|string
291 */
292 private function enableExitIntentText()
293 {
294 return '';
295 }
296
297 /**
298 * Custom class
299 *
300 * @param $iButtonId
301 * @return string
302 */
303 private function getCustomClass( $iButtonId )
304 {
305 return '';
306 }
307
308 /**
309 * Is the store opened right now?
310 *
311 * @return bool
312 */
313 private function isOpened()
314 {
315 $sDayOfWeek = $this->getDay( date( 'N' ) );
316 // Result
317 $bTodayOpened = ( isset( $this->aOpeningData['buttonizer_' . $sDayOfWeek . '_opened'] ) ? $this->aOpeningData['buttonizer_' . $sDayOfWeek . '_opened'] : '' );
318 // If result == 1 => Opened
319
320 if ( $bTodayOpened != "1" ) {
321 $bIsOpened = false;
322 } else {
323 // Get the time right now
324 $sCurentHour = date( "G" );
325 $sCurrentMinute = date( "i" );
326 // Get the opening and closing time from today.
327 $hourOpening = explode( ':', ( isset( $this->aOpeningData['buttonizer_' . $sDayOfWeek . '_opened_from'] ) ? $this->aOpeningData['buttonizer_' . $sDayOfWeek . '_opened_from'] : '10:00' ) );
328 $hourClosing = explode( ':', ( isset( $this->aOpeningData['buttonizer_' . $sDayOfWeek . '_closing_on'] ) ? $this->aOpeningData['buttonizer_' . $sDayOfWeek . '_closing_on'] : '17:00' ) );
329 // Check if the company is opened/closed
330
331 if ( $sCurentHour < $hourOpening[0] || $sCurentHour == $hourOpening[0] && $sCurrentMinute < $hourOpening[1] || $sCurentHour > $hourClosing[0] || $sCurentHour == $hourClosing[0] && $sCurrentMinute > $hourClosing[1] - 1 ) {
332 $bIsOpened = false;
333 } else {
334 $bIsOpened = true;
335 }
336
337 }
338
339 return $bIsOpened;
340 }
341
342 /**
343 * Day-number to text
344 *
345 * @param $sDay
346 * @return string
347 */
348 private function getDay( $sDay )
349 {
350 switch ( $sDay ) {
351 case '1':
352 return 'monday';
353 break;
354 case '2':
355 return 'tuesday';
356 break;
357 case '3':
358 return 'wednesday';
359 break;
360 case '4':
361 return 'thursday';
362 break;
363 case '5':
364 return 'friday';
365 break;
366 case '6':
367 return 'saturday';
368 break;
369 case '7':
370 return 'sunday';
371 break;
372 default:
373 return 'sunday';
374 break;
375 }
376 }
377
378 /**
379 * Share buttons
380 */
381 private function share_btns()
382 {
383
384 if ( isset( $this->aSettings["share_facebook"] ) && '1' == $this->aSettings["share_facebook"] ) {
385 $buttonText = ( isset( $this->aSettings['share_facebook_text'] ) && $this->aSettings['share_facebook_text'] != '' ? $this->aSettings['share_facebook_text'] : 'Share this on Facebook' );
386 $this->sOutput = '<a href="javascript:void(0)" onclick="onButtonizerClickEvent(\'Facebook share click\'); onButtonizerButtonFacebook();" class="is_extra share share_' . ($this->iAmountOfShareButtons + 1) . '">' . (( $buttonText != "" ? '<div class="text"><div>' . $buttonText . '</div></div>' : '' )) . '<i class="fa fa-facebook"></i></a>' . $this->sOutput;
387 $this->iAmountOfShareButtons++;
388 }
389
390
391 if ( isset( $this->aSettings["share_twitter"] ) && '1' == $this->aSettings["share_twitter"] ) {
392 $buttonText = ( isset( $this->aSettings['share_twitter_text'] ) && $this->aSettings['share_twitter_text'] != '' ? $this->aSettings['share_twitter_text'] : 'Share this on Twitter' );
393 $this->sOutput = '<a href="javascript:void(0)" onclick="onButtonizerClickEvent(\'Twitter share click\'); onButtonizerButtonTwitter();" class="is_extra share share_' . ($this->iAmountOfShareButtons + 1) . '">' . (( $buttonText != "" ? '<div class="text"><div>' . $buttonText . '</div></div>' : '' )) . '<i class="fa fa-twitter"></i></a>' . $this->sOutput;
394 $this->iAmountOfShareButtons++;
395 }
396
397
398 if ( isset( $this->aSettings["share_linkedin"] ) && '1' == $this->aSettings["share_linkedin"] ) {
399 $buttonText = ( isset( $this->aSettings['share_linkedin_text'] ) && $this->aSettings['share_linkedin_text'] != '' ? $this->aSettings['share_linkedin_text'] : 'Share this on LinkedIn' );
400 $this->sOutput = '<a href="javascript:void(0)" onclick="onButtonizerClickEvent(\'Linkedin share click\'); onButtonizerButtonLinkedin();" class="is_extra share share_' . ($this->iAmountOfShareButtons + 1) . '">' . (( $buttonText != "" ? '<div class="text"><div>' . $buttonText . '</div></div>' : '' )) . '<i class="fa fa-linkedin"></i></a>' . $this->sOutput;
401 $this->iAmountOfShareButtons++;
402 }
403
404
405 if ( isset( $this->aSettings["share_email"] ) && '1' == $this->aSettings["share_email"] ) {
406 $buttonText = ( isset( $this->aSettings['share_email_text'] ) && $this->aSettings['share_email_text'] != '' ? $this->aSettings['share_email_text'] : 'Share this on Email' );
407 $this->sOutput = '<a href="javascript:void(0)" onclick="onButtonizerClickEvent(\'Email share click\'); onButtonizerButtonEmail();" class="is_extra share share_' . ($this->iAmountOfShareButtons + 1) . '">' . (( $buttonText != "" ? '<div class="text"><div>' . $buttonText . '</div></div>' : '' )) . '<i class="fa fa-envelope"></i></a>' . $this->sOutput;
408 $this->iAmountOfShareButtons++;
409 }
410
411 // Coming next update: :)
412 if ( wp_is_mobile() == true ) {
413
414 if ( isset( $this->aSettings["share_whatsapp"] ) && '1' == $this->aSettings["share_whatsapp"] ) {
415 $buttonText = ( isset( $this->aSettings['share_whatsapp_text'] ) && $this->aSettings['share_whatsapp_text'] != '' ? $this->aSettings['share_whatsapp_text'] : 'Share this on Whatsapp' );
416 $this->sOutput = '<a href="javascript:void(0)" onclick="onButtonizerClickEvent(\'Whatsapp share click\'); onButtonizerButtonWhatsapp();" class="is_extra share share_' . ($this->iAmountOfShareButtons + 1) . '">' . (( $buttonText != "" ? '<div class="text"><div>' . $buttonText . '</div></div>' : '' )) . '<i class="fa fa-whatsapp"></i></a>' . $this->sOutput;
417 $this->iAmountOfShareButtons++;
418 }
419
420 }
421 //
422 // if(isset($this->aSettings["share_pinterest"]) && '1' == $this->aSettings["share_pinterest"]) {
423 // $buttonText = (isset($this->aSettings['share_pinterest_text']) && $this->aSettings['share_pinterest_text'] != '' ? ($this->aSettings['share_pinterest_text']) : 'Share this on Pinterest');
424 //
425 // $this->sOutput = '<a href="javascript:void(0)" onclick="onButtonizerClickEvent(\'Pinterest share click\'); onButtonizerButtonPinterest();" class="is_extra share share_' . ($this->iAmountOfShareButtons + 1) . '">' . ($buttonText != "" ? '<div class="text"><div>' . $buttonText . '</div></div>' : '') . '<i class="fa fa-pinterest"></i></a>' . $this->sOutput;
426 //
427 // $this->iAmountOfShareButtons++;
428 // }
429 }
430
431 /**
432 * Get the positioning of the buttons
433 * @param string $sPositioning
434 * @return string
435 */
436 public function buttonPositioning( $sPositioning = '' )
437 {
438 $sPositioning .= (( isset( $this->aSettings['buttons_placing'] ) && $this->aSettings['buttons_placing'] == 'left' ? 'left' : 'right' )) . ': ' . (( isset( $this->aSettings['position_horizontal'] ) ? $this->aSettings['position_horizontal'] : (( isset( $this->aSettings['position_right'] ) ? $this->aSettings['position_right'] : '5' )) )) . '%;';
439 $sPositioning .= 'bottom: ' . (( isset( $this->aSettings['position_bottom'] ) ? $this->aSettings['position_bottom'] : '5' )) . '%;';
440 return $sPositioning;
441 }
442
443 /**
444 * Output of the button
445 */
446 public function output()
447 {
448 $showAfterTimeout = $this->showOnTimeout();
449 $showOnScroll = $this->showOnScroll();
450 // Main button image or icon
451 $sImage = ( isset( $this->aSettings['custom_icon'] ) ? $this->aSettings['custom_icon'] : '' );
452
453 if ( $sImage != '' ) {
454 $sIcon = '<img src="' . $sImage . '" style="width: 32px; vertical-align: middle;" />';
455 } else {
456 $sIcon = ( !empty($this->aSettings['icon_icon']) && $this->aSettings['icon_icon'] != '+' ? '<i class="isicon-fa fa ' . $this->aSettings['icon_icon'] . '"></i>' : '<i>+</i>' );
457 }
458
459
460 if ( $this->iAmountOfButtons == 1 && $this->iAmountOfShareButtons == 0 ) {
461 $output = str_replace( "is_extra bt_0", "buttonizer_head onlyone", $this->sOutput );
462 } else {
463
464 if ( $this->iAmountOfButtons > 1 || $this->iAmountOfShareButtons > 0 ) {
465 $output = '<a href="javascript:void(0)" class="buttonizer_head" onclick="onButtonizerClickEvent(\'Open/Close Buttonizer button\')">' . (( !empty($this->aSettings['icon_label']) ? '<div class="text noremove"><div>' . $this->aSettings['icon_label'] . '</div></div>' : '' )) . $sIcon . '</a>' . $this->sOutput;
466 } else {
467 $output = '';
468 }
469
470 }
471
472 // Google analytics toevoegen
473 if ( isset( $this->aSettings['google_analytics'] ) && $this->aSettings['google_analytics'] != "" ) {
474 $output .= "<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');ga('create', '" . $this->aSettings['google_analytics'] . "', 'auto');</script>";
475 }
476
477 if ( isset( $this->aSettings['buttons_animation'] ) && in_array( $this->aSettings['buttons_animation'], $this->aAnimationSettings ) ) {
478 $sButtonAnimation = $this->aSettings['buttons_animation'];
479 } else {
480 $sButtonAnimation = 'default';
481 }
482
483
484 if ( isset( $this->aSettings['attention_animation'] ) && in_array( $this->aSettings['attention_animation'], $this->aAttentionAnimationSettings ) ) {
485 $sAttentionAnimation = $this->aSettings['attention_animation'];
486 } else {
487 $sAttentionAnimation = 'default';
488 }
489
490 // Label hovering
491
492 if ( !isset( $this->aSettings['buttons_label_show_on_hover'] ) || $this->aSettings['buttons_label_show_on_hover'] == 'default' ) {
493 $labelStyle = 'buttonizer_label_default';
494 } else {
495
496 if ( $this->aSettings['buttons_label_show_on_hover'] == 'showOnHover' ) {
497 $labelStyle = 'buttonizer_label_hover';
498 } else {
499
500 if ( $this->aSettings['buttons_label_show_on_hover'] == 'showOnHoverDesktop' ) {
501
502 if ( $this->bIsMobile == false ) {
503 $labelStyle = 'buttonizer_label_hover';
504 } else {
505 $labelStyle = 'buttonizer_label_default';
506 }
507
508 } else {
509 if ( $this->aSettings['buttons_label_show_on_hover'] == 'showOnHoverMobile' ) {
510
511 if ( $this->bIsMobile == true ) {
512 $labelStyle = 'buttonizer_label_hover';
513 } else {
514 $labelStyle = 'buttonizer_label_default';
515 }
516
517 }
518 }
519
520 }
521
522 }
523
524 list( $sShadowColorRed, $sShadowColorGreen, $sShadowColorBlue ) = sscanf( $this->aSettings['button_unpushed'], "#%02x%02x%02x" );
525 // Mobile button size vs Desktop button size
526
527 if ( $this->bIsMobile ) {
528 $iconSize = ( isset( $this->aSettings['mobile_icon_size'] ) ? $this->aSettings['mobile_icon_size'] : 56 );
529 } else {
530 $iconSize = ( isset( $this->aSettings['icon_size'] ) ? $this->aSettings['icon_size'] : 56 );
531 }
532
533 echo '
534 <style>
535 .buttonizer-button a:hover,
536 .buttonizer-button a:focus{ background:' . $this->aSettings['button_pushed'] . '; }
537 .buttonizer-button a { background:' . $this->aSettings['button_unpushed'] . '; }
538 .buttonizer-button a i { color: ' . $this->aSettings['icon_color'] . '; }
539
540 .buttonizer-button a.buttonizer_head, .buttonizer-button a.buttonizer_head i {
541 height: ' . $iconSize . 'px !important;
542 width: ' . $iconSize . 'px !important;
543 line-height: ' . $iconSize . 'px !important;
544 }
545
546 .buttonizer-button a.buttonizer_head, .buttonizer-button a.buttonizer_head {
547 margin-left: -' . ($iconSize - 56) / 2 . 'px;
548 margin-top: -' . ($iconSize - 56) / 2 . 'px;
549 }
550
551 .buttonizer-button a.buttonizer_head, .buttonizer-button a.is_extra {
552 margin-top: -' . ($iconSize - 56) . 'px;
553 }
554 .buttonizer-button a.buttonizer_head .text{
555 right: ' . ($iconSize + 20) . 'px !important;
556 top: ' . $iconSize / 3 . 'px !important;
557 }
558
559
560 .buttonizer-button[label-style="mirrored"] a.is_extra.share {
561 margin-top: -' . ($iconSize - 56) / 2 . 'px;
562 margin-left: ' . ($iconSize - 56) . 'px;
563 }
564
565 .buttonizer-button[label-style="default"] a.is_extra.share {
566 margin-top: -' . ($iconSize - 56) / 2 . 'px;
567 margin-left: -' . ($iconSize - 56) . 'px !important;
568 }
569
570
571
572 ' . $this->sButtonCss . '
573 </style>
574 <div class="buttonizer-button ' . (( $showOnScroll > 0 || $showAfterTimeout > 0 ? 'hide' : '' )) . ' ' . $labelStyle . '"
575 button-animation="' . $sButtonAnimation . '"
576 attention-animation="' . $sAttentionAnimation . '"
577
578
579 label-style="' . (( isset( $this->aSettings['buttons_label_placing'] ) ? $this->aSettings['buttons_label_placing'] : 'default' )) . '"
580
581
582 style="' . $this->buttonPositioning() . '"
583 id="buttonizer-button"><div class="buttonizer_inner" id="buttonizer-sys">' . $output . '</div></div>' ;
584 echo '
585 <script defer type="text/javascript" src="' . plugins_url( '/js/buttonizer.js?v=' . md5( BUTTONIZER_VERSION ), BUTTONIZER_PLUGIN_DIR ) . '"></script>
586 <script type="text/javascript">
587 document.addEventListener(\'DOMContentLoaded\', function(){
588 buttonizer.init({
589 scrollBarTop: ' . $showOnScroll . ',
590 showAfter: ' . $showAfterTimeout . ',
591 ' . (( ButtonizerLicense()->is__premium_only() ? 'exitIntent: ' . $this->enableExitIntent() . ',' : '' )) . '
592 ' . (( ButtonizerLicense()->is__premium_only() ? 'exitIntentText: "' . $this->enableExitIntentText() . '",' : '' )) . '
593 });
594 });
595 </script>' ;
596 }
597
598 }