PluginProbe
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder / 1.5.1
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder v1.5.1
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 / Admin / Buttons.php

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

574 lines 29.2 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\Admin;
21
22 # No script kiddies
23 defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
24 class Buttons
25 {
26 private $aSavedData = array() ;
27 private $aPageCategories = array() ;
28 private $aFontAwesome = array() ;
29 private $oIconManager = array() ;
30 private $aSystemSettings = array() ;
31 public function __construct( $aFontAwesome, $oIconManager )
32 {
33 $this->aFontAwesome = $aFontAwesome;
34 $this->oIconManager = $oIconManager;
35 $this->loadData();
36 $this->loadButtons();
37 }
38
39 private function loadData()
40 {
41 $this->aSavedData = (array) get_option( 'buttonizer_buttons' );
42 $this->aPageCategories = (array) get_option( 'buttonizer_page_categories' );
43 $this->aSystemSettings = (array) get_option( 'buttonizer_general_settings' );
44 }
45
46 private function loadButtons()
47 {
48 // Get buttons
49 $aButtons = ( isset( $this->aSavedData['buttonorder'] ) && is_array( $this->aSavedData['buttonorder'] ) ? $this->aSavedData['buttonorder'] : [
50 0 => -1,
51 ] );
52 if ( $aButtons[0] != '-1' ) {
53 $aButtons[-1] = '-1';
54 }
55 echo '<ul id="button-rows">' ;
56 $iButtonCount = 0;
57 foreach ( $aButtons as $sButtonKey => $iButtonId ) {
58 $this->loadIndividialButtonRow( $sButtonKey, $iButtonId, ( isset( $bDisabled ) ? true : false ) );
59 $iButtonCount++;
60 }
61 echo '</ul>' ;
62 echo '<img src="' . plugins_url( '/assets/no-buttons.jpg', BUTTONIZER_PLUGIN_DIR ) . '" style="' . (( 0 == $iButtonCount - 1 ? 'display: block;' : 'display: none;' )) . '" class="buttonizer-no-buttons" />' ;
63 }
64
65 private function loadIndividialButtonRow( $sButtonKey, $iButtonId, $bDisabled )
66 {
67 $sButtonTitle = ( isset( $this->aSavedData['button_' . $iButtonId . '_title'] ) ? $this->aSavedData['button_' . $iButtonId . '_title'] : 'Button ' . ($iButtonId + 1) );
68 $onMobile = ( isset( $this->aSavedData['button_' . $iButtonId . '_show_on_phone'] ) ? $this->aSavedData['button_' . $iButtonId . '_show_on_phone'] : '' );
69 $onDesktop = ( isset( $this->aSavedData['button_' . $iButtonId . '_show_on_desktop'] ) ? $this->aSavedData['button_' . $iButtonId . '_show_on_desktop'] : '' );
70 ?>
71 <li>
72 <div class="button-row" id="btn_row_<?php
73 echo $iButtonId ;
74 ?>" button-id="<?php
75 echo $iButtonId ;
76 ?>" data-button-action="<?php
77 echo ( isset( $this->aSavedData['button_' . $iButtonId . '_type'] ) ? $this->aSavedData['button_' . $iButtonId . '_type'] : 'url' ) ;
78 ?>" <?php
79 if ( $iButtonId == -1 ) {
80 echo ' style="display: none"' ;
81 }
82 ?>>
83 <input type="checkbox" name="buttonizer_buttons[buttonorder][]" value="<?php
84 echo $iButtonId ;
85 ?>" checked="checked" style="display: none;" />
86
87 <div class="row-info drag-handle">
88 <div class="mover"></div>
89 <span><i class="fa <?php
90 echo $this->buttonOutputIcon( $iButtonId ) ;
91 ?> button-icon"></i> <span class="row-title"><?php
92 echo ( $iButtonId == -1 ? 'New button' : $sButtonTitle ) ;
93 ?></span> <i class="fa fa-pencil pencil-edit" ></i></span>
94
95 <a href="javascript:buttonizer.removeRow(<?php
96 echo $iButtonId ;
97 ?>)" class="delete-button"><i class="fa fa-trash-o"></i></a>
98 <a href="javascript:buttonizer.copyRow(<?php
99 echo $iButtonId ;
100 ?>)" class="mobiledesktop selected copy-button"><i class="fa fa-copy"></i></a>
101
102 <a href="javascript:buttonizer.toggleMobile(<?php
103 echo $iButtonId ;
104 ?>)" class="mobiledesktop mobile-button <?php
105 echo ( $onMobile == "" ? 'selected' : '' ) ;
106 ?>"><i class="fa fa-mobile"></i></a>
107 <a href="javascript:buttonizer.toggleDesktop(<?php
108 echo $iButtonId ;
109 ?>)" class="mobiledesktop desktop-button <?php
110 echo ( $onDesktop == "" ? 'selected' : '' ) ;
111 ?>"><i class="fa fa-desktop"></i></a>
112
113 <a href="javascript:void(0)" class="is-live-button" style="<?php
114 echo ( $onMobile != "" || $onDesktop != "" ? '' : 'display: none;' ) ;
115 ?>"><i class="fa fa-circle"></i> Live</a>
116
117 <button type="submit" class="must-save-button savebutton " style="display: none;"><i class="fa fa-floppy-o"></i> Save changes</button>
118 </div>
119
120 <div class="button-data">
121 <table>
122 <tr style="display: none;">
123 <td></td>
124 <td></td>
125 </tr>
126 <tr style="vertical-align: top;">
127 <td width="50%">
128 <label for="button_text" class="label-top">
129 <span class="info-class"><i class="fa fa-info-circle"></i> <span>This is for internal use only.<br /><br />When using Google Analytics, this will be the title of the event when clicking this button.</span></span>
130 Button name:
131 </label>
132 <input type="text" name="buttonizer_buttons[button_<?php
133 echo $iButtonId ;
134 ?>_title]" value="<?php
135 echo $sButtonTitle ;
136 ?>" class="button_title" />
137 </td>
138 <td class="button-pdr">
139 <label for="button_icon" class="label-top">
140 <span class="info-class"><i class="fa fa-info-circle"></i> <span>This will be the icon of the button. You can choose from the build-in Font Awesome icons.<br /><br />When you want to use your own icon or image, you can click the 'or upload an image' link to use your own icon.</span></span>
141 Button icon/image:
142 </label>
143 <?php
144 echo $this->buttonGetIcon( $iButtonId ) ;
145 ?>
146 </td>
147 </tr>
148
149 <tr>
150 <td>&nbsp;</td>
151 <td></td>
152 </tr>
153
154 <tr>
155 <td>
156 <label for="button_text" class="label-top">
157 <span class="info-class"><i class="fa fa-info-circle"></i> <span>This is the label what the guest on your website will see. Something like 'Contact me!', or 'Like us on Facebook' <br/><span style="color: red;">Don't make it too long!!</span></span></span>
158 Button label:
159 </label>
160 <?php
161 echo $this->buttonGetText( $iButtonId ) ;
162 ?>
163 </td>
164 <td>
165 <label for="button_category" class="label-top">
166 <span class="info-class"><i class="fa fa-info-circle"></i> <span>Select a page category. You can add more page rules at the 'Page categories' tab.</span></span>
167 Button page category:
168 </label>
169 <?php
170 echo $this->buttonGetShowOnPages( $iButtonId ) ;
171 ?>
172 </td>
173 </tr>
174
175 <tr>
176 <td>&nbsp;</td>
177 <td></td>
178 </tr>
179
180 <tr class="settings-row button-action">
181 <td colspan="2">
182 <i class="fa fa-globe setting-icon"></i> Button action
183 <span class="info-class"><i class="fa fa-info-circle"></i> <span>This is the click-action of your button. When you choose for a phone number, it will be a direct click-to-call action.</span></span>
184
185 <table width="100%" class="settings-row-type">
186 <tr>
187 <!-- Button action set -->
188 <td width="200"><?php
189 echo $this->buttonGetType( $iButtonId ) ;
190 ?></td>
191 <td>
192 <!-- Button input set -->
193
194 <?php
195 echo $this->buttonGetUrl( $iButtonId ) ;
196 ?>
197 <?php
198 echo $this->buttonGetSocial( $iButtonId ) ;
199 ?>
200
201 <div class="input_error" style="display: none;"></div>
202
203 <div class="extra_info" data-button-type="phone">
204
205 </div>
206 </td>
207 </tr>
208 </table>
209 </td>
210 </tr>
211
212 <tr class="settings-row setting-new-tab">
213 <td>
214 <i class="fa fa-external-link setting-icon"></i> Open in new tab
215 </td>
216 <td><?php
217 echo $this->buttonGetNewTab( $iButtonId ) ;
218 ?><label for="button_<?php
219 echo $iButtonId ;
220 ?>_url_newtab"> Yes</label></td>
221 </tr>
222
223 <tr class="settings-row">
224 <td>
225 <i class="fa fa-paint-brush setting-icon"></i> Button colors
226 <span class="info-class"><i class="fa fa-info-circle"></i> <span>You can change the colors of this button, like the default background, the background on hover or the icon color. You can undo them too. Click the palet for changing the colors.</span></span>
227 </td>
228 <td><?php
229 echo $this->buttonColors( $iButtonId ) ;
230 ?></td>
231 </tr>
232
233 <tr>
234 <td>&nbsp;</td>
235 <td></td>
236 </tr>
237
238 <tr class="settings-row show-mobile-btn">
239 <td>
240 <i class="fa fa-mobile setting-icon"></i> Show on mobile
241 </td>
242 <td><?php
243 echo $this->buttonGetShowPhone( $iButtonId ) ;
244 ?><label for="button_<?php
245 echo $iButtonId ;
246 ?>_show_on_phone"> Yes</label></td>
247 </tr>
248
249 <tr class="settings-row show-desktop-btn">
250 <td>
251 <i class="fa fa-desktop setting-icon"></i> Show on desktop
252 </td>
253 <td><?php
254 echo $this->buttonGetShowDesktop( $iButtonId ) ;
255 ?><label for="button_<?php
256 echo $iButtonId ;
257 ?>_show_on_desktop"> Yes</label></td>
258 </tr>
259
260 <tr class="settings-row">
261 <td>
262 <i class="fa fa-tag setting-icon"></i> Show label on hover
263
264 <span class="info-class">
265 <i class="fa fa-info-circle"></i>
266 <span>
267 When you hover over the button, the label will be hided until the user hovers the icon.
268 </span>
269 </span>
270 </td>
271 <!-- drop down here -->
272 <td><?php
273 echo $this->buttonShowOnHover( $iButtonId ) ;
274 ?></td>
275 <!-- <td>-->
276 <!-- -->
277 <!-- </td>-->
278 </tr>
279
280 <tr>
281 <td>&nbsp;</td>
282
283 <td></td>
284 </tr>
285
286 <?php
287 ?>
288 <tr class="settings-row">
289 <td>
290 <i class="fa fa-clock-o setting-icon"></i> Show <b>only</b> on opening hours
291 </td>
292 <td><input type="checkbox" class="buttonizer-click-to-pro" readonly=""> <label> Yes</label> <span class="buttonizer-pro-feature">PRO</span></td> <td></td>
293 </tr>
294
295 <tr class="settings-row">
296 <td>
297 <i class="fa fa-times-circle-o setting-icon"></i> Show <b>only outside</b> opening hours
298 </td>
299 <td><input type="checkbox" class="buttonizer-click-to-pro" readonly=""> <label> Yes</label> <span class="buttonizer-pro-feature">PRO</span></td>
300 </tr>
301 <?php
302 ?>
303
304 <tr>
305 <td>&nbsp;</td>
306 <td></td>
307 </tr>
308
309 <tr class="settings-row">
310 <td>
311 <i class="fa fa-css3 setting-icon"></i> Custom CSS class <?php
312 echo $this->showPro() ;
313 ?>
314 </td>
315 <td><?php
316 echo $this->buttonCustomClass( $iButtonId ) ;
317 ?></td>
318 </tr>
319 </table>
320 </div>
321 </div>
322 </li>
323 <?php
324 }
325
326 /*
327 * Form functions
328 */
329 // Get the text of the button
330 function buttonGetText( $iButtonId = 0 )
331 {
332 $fieldName = 'button_' . $iButtonId . '_text';
333 $fieldValue = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : 'New button' );
334 return '<input type="text" name="buttonizer_buttons[' . $fieldName . ']" id="' . $fieldName . '" value="' . $fieldValue . '" class="button_textfield" placeholder="Button text" />';
335 }
336
337 // Get button icon
338 function buttonGetIcon( $iButtonId = 0 )
339 {
340 return $this->oIconManager->generator( [
341 'icon' => ( isset( $this->aSavedData['button_' . $iButtonId . '_icon'] ) ? $this->aSavedData['button_' . $iButtonId . '_icon'] : '' ),
342 'icon_fieldname' => 'buttonizer_buttons[button_' . $iButtonId . '_icon]',
343 'image' => ( isset( $this->aSavedData['button_' . $iButtonId . '_image'] ) ? $this->aSavedData['button_' . $iButtonId . '_image'] : '' ),
344 'image_fieldname' => 'buttonizer_buttons[button_' . $iButtonId . '_image]',
345 'choose_type' => true,
346 'show_is_background' => ( isset( $this->aSavedData['button_' . $iButtonId . '_image_background'] ) ? $this->aSavedData['button_' . $iButtonId . '_image_background'] : '' ),
347 'show_is_background_fieldname' => 'buttonizer_buttons[button_' . $iButtonId . '_image_background]',
348 ] );
349 }
350
351 // Get button icon
352 function buttonOutputIcon( $iButtonId = 0 )
353 {
354 $fieldName = 'button_' . $iButtonId . '_icon';
355 return ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : 'fa-info' );
356 }
357
358 // Only show this button on phone?
359 function buttonGetShowPhone( $iButtonId = 0 )
360 {
361 $fieldName = 'button_' . $iButtonId . '_show_on_phone';
362 $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' );
363 return '<input type="checkbox" name="buttonizer_buttons[' . $fieldName . ']" id="' . $fieldName . '" value="1" class="button_showonphone" ' . (( $is_selected == '1' ? 'checked="checked"' : '' )) . ' />';
364 }
365
366 // buttonGetShowOnPages
367 function buttonGetShowOnPages( $iButtonId = 0 )
368 {
369 $fieldName = 'button_' . $iButtonId . '_show_on_pages';
370 $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' );
371 $pageOrders = ( isset( $this->aPageCategories ) ? $this->aPageCategories : [] );
372 /*
373 * Generate <select>
374 */
375 $html = '<select name="buttonizer_buttons[' . $fieldName . ']" id="button_category"><option value="-5">Show on every page</option><option value="-4">Hide everywhere</option>';
376 foreach ( $pageOrders as $id => $data ) {
377 if ( !isset( $data['title'] ) ) {
378 continue;
379 }
380 $html .= '<option value="' . $id . '"' . (( $id == $is_selected ? 'selected="selected"' : '' )) . '>' . $data['title'] . '</option>';
381 }
382 return $html . '</select>';
383 }
384
385 // Only show this button on desktop?
386 function buttonGetShowDesktop( $iButtonId = 0 )
387 {
388 $fieldName = 'button_' . $iButtonId . '_show_on_desktop';
389 $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' );
390 return '<input type="checkbox" name="buttonizer_buttons[' . $fieldName . ']" id="' . $fieldName . '" value="1" class="button_showondesktop" ' . (( $is_selected == '1' ? 'checked="checked"' : '' )) . ' />';
391 }
392
393 // Only show when company is open?
394 function buttonGetShowWenOpen( $iButtonId = 0 )
395 {
396 $fieldName = 'button_' . $iButtonId . '_show_when_opened';
397 $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' );
398 return '<input type="checkbox" name="buttonizer_buttons[' . $fieldName . ']" id="' . $fieldName . '" value="1" class="button_showwhenopened" ' . (( $is_selected == '1' ? 'checked="checked"' : '' )) . ' />';
399 }
400
401 // Only show when company is open?
402 function buttonGetShowNotWenOpen( $iButtonId = 0 )
403 {
404 $fieldName = 'button_' . $iButtonId . '_show_not_when_opened';
405 $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' );
406 return '<input type="checkbox" name="buttonizer_buttons[' . $fieldName . ']" id="' . $fieldName . '" value="1" class="button_showwhenopened" ' . (( $is_selected == '1' ? 'checked="checked"' : '' )) . ' />';
407 }
408
409 function buttonShowOnHover( $iButtonId = 0 )
410 {
411 $fieldName = 'button_' . $iButtonId . '_show_label_on_hover';
412 $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' );
413 // return '<input type="checkbox" name="buttonizer_buttons['. $fieldName .']" id="'. $fieldName .'" value="1" class="button_showlabelonhover" '. ($is_selected == '1' ? 'checked="checked"' : '') .' />';
414 return '
415 <select name="buttonizer_buttons[' . $fieldName . ']" style="width: 100%; padding: 0 10px; height: 40px;">
416 <option value="default" ' . (( $is_selected == 'default' ? 'selected' : '' )) . '>Always show label</option>
417 <option value="showOnHover" ' . (( $is_selected == 'showOnHover' ? 'selected' : '' )) . '>Show on hover</option>
418 <option value="showOnHoverDesktop" ' . (( $is_selected == 'showOnHoverDesktop' ? 'selected' : '' )) . '>Show on hover (Desktop only)</option>
419 <option value="showOnHoverMobile" ' . (( $is_selected == 'showOnHoverMobile' ? 'selected' : '' )) . '>Show on hover (Mobile only)</option>
420 </select>
421 ';
422 }
423
424 function buttonGetType( $iButtonId = 0 )
425 {
426 $aTypes = [
427 'url' => 'Website URL',
428 'phone' => 'Phone number',
429 'mail' => 'E-mail',
430 'backtotop' => 'Back to top',
431 'gobackpage' => 'Go back one page',
432 'socialsharing' => 'Social Sharing',
433 ];
434 $aTypes = array_merge( $aTypes, [
435 'disabled_whatsapp' => 'Open whatsapp (phone number) - PRO ONLY',
436 'disabled_javascript' => 'Javascript function - PRO ONLY',
437 ] );
438 $fieldName = 'button_' . $iButtonId . '_action';
439 $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : 'url' );
440 $html = '<select name="buttonizer_buttons[' . $fieldName . ']" id="button_type" class="button_action">';
441 foreach ( $aTypes as $sType => $sTitle ) {
442 $html .= '<option value="' . str_replace( 'disabled_', '', $sType ) . '"' . (( $sType == $is_selected ? 'selected="selected"' : '' )) . ' ' . (( strpos( $sType, 'disabled_' ) !== false > 0 ? 'disabled' : '' )) . '>' . $sTitle . '</option>';
443 }
444 return $html . '</select>';
445 }
446
447 //Getting the button input
448 function buttonGetUrl( $iButtonId = 0 )
449 {
450 $fieldName = 'button_' . $iButtonId . '_url';
451 $fieldValue = str_replace( '"', '\'', ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ) );
452 return '<input type="text" name="buttonizer_buttons[' . $fieldName . ']" id="' . $fieldName . '" value="' . $fieldValue . '" class="button_input" placeholder="" />';
453 }
454
455 function buttonGetSocial( $iButtonId = 0 )
456 {
457 $fieldName = 'button_' . $iButtonId . '_social';
458 $aSocials = [
459 'facebook' => "Share on Facebook",
460 'twitter' => "Share on Twitter",
461 'whatsapp' => "Share on Whatsapp",
462 'linkedin' => "Share on Linkedin",
463 'mail' => "Share on email",
464 ];
465 $fieldValue = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' );
466 $html = '<select name="buttonizer_buttons[' . $fieldName . ']" id="" class="social_input" style="display:none;">';
467 foreach ( $aSocials as $sSocial => $sTitle ) {
468 $html .= '<option value="' . str_replace( 'disabled_', '', $sSocial ) . '"' . (( $sSocial == $fieldValue ? 'selected="selected"' : '' )) . ' ' . (( strpos( $sSocial, 'disabled_' ) !== false > 0 ? 'disabled' : '' )) . '>' . $sTitle . '</option>';
469 }
470 return $html . '</select>';
471 }
472
473 /**
474 * New tab
475 *
476 * @param int $iButtonId
477 * @return string
478 */
479 function buttonGetNewTab( $iButtonId = 0 )
480 {
481 $fieldName = 'button_' . $iButtonId . '_url_newtab';
482 $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' );
483 return '<input type="checkbox" name="buttonizer_buttons[' . $fieldName . ']" id="' . $fieldName . '" value="1" class="button_isnewtab" ' . (( $is_selected == '1' ? 'checked="checked"' : '' )) . ' />';
484 }
485
486 /**
487 * Button colors
488 *
489 * @param int $iButtonId
490 * @return string
491 */
492 function buttonColors( $iButtonId = 0 )
493 {
494 // Default button colors
495 $sDefaultColor1 = ( isset( $this->aSystemSettings['button_unpushed'] ) ? $this->aSystemSettings['button_unpushed'] : '#48A4DC' );
496 $sDefaultColor2 = ( isset( $this->aSystemSettings['button_pushed'] ) ? $this->aSystemSettings['button_pushed'] : '#1D9BDB' );
497 $sDefaultColor3 = ( isset( $this->aSystemSettings['icon_color'] ) ? $this->aSystemSettings['icon_color'] : '#fffff' );
498 // Using custom colors?
499 $bCustomColors = ( isset( $this->aSavedData['button_' . $iButtonId . '_using_custom_colors'] ) && $this->aSavedData['button_' . $iButtonId . '_using_custom_colors'] == '1' ? true : false );
500 // Get button colors
501 $sColor1 = ( $bCustomColors && isset( $this->aSavedData['button_' . $iButtonId . '_colors_button'] ) && !empty($this->aSavedData['button_' . $iButtonId . '_colors_button']) ? $this->aSavedData['button_' . $iButtonId . '_colors_button'] : $sDefaultColor1 );
502 $sColor2 = ( $bCustomColors && isset( $this->aSavedData['button_' . $iButtonId . '_colors_pushed'] ) && !empty($this->aSavedData['button_' . $iButtonId . '_colors_pushed']) ? $this->aSavedData['button_' . $iButtonId . '_colors_pushed'] : $sDefaultColor2 );
503 $sColor3 = ( $bCustomColors && isset( $this->aSavedData['button_' . $iButtonId . '_colors_icon'] ) && !empty($this->aSavedData['button_' . $iButtonId . '_colors_icon']) ? $this->aSavedData['button_' . $iButtonId . '_colors_icon'] : $sDefaultColor3 );
504 $sColorPalet = '<div class="button-color-palet" data-btnid="' . $iButtonId . '">';
505 $sColorPalet .= '<div class="color default" style="background-color: ' . $sColor1 . ';" data-default="' . $sDefaultColor1 . '"></div>';
506 $sColorPalet .= '<div class="color pushed" style="background-color: ' . $sColor2 . ';" data-default="' . $sDefaultColor2 . '"></div>';
507 $sColorPalet .= '<div class="color icon" style="background-color: ' . $sColor3 . ';" data-default="' . $sDefaultColor3 . '"></div>';
508 $sColorPalet .= '<div class="text">' . (( $sColor1 != $sDefaultColor1 || $sColor2 != $sDefaultColor2 || $sColor3 != $sDefaultColor3 ? 'Custom colors' : 'Default colors' )) . '</div>';
509 $sColorPalet .= '<input type="hidden" name="buttonizer_buttons[button_' . $iButtonId . '_using_custom_colors]" class="custom" value="' . (( $bCustomColors ? '1' : '0' )) . '" />';
510 $sColorPalet .= '<input type="hidden" name="buttonizer_buttons[button_' . $iButtonId . '_colors_button]" class="default" value="' . $sColor1 . '" />';
511 $sColorPalet .= '<input type="hidden" name="buttonizer_buttons[button_' . $iButtonId . '_colors_pushed]" class="pushed" value="' . $sColor2 . '" />';
512 $sColorPalet .= '<input type="hidden" name="buttonizer_buttons[button_' . $iButtonId . '_colors_icon]" class="icon" value="' . $sColor3 . '" />';
513 $sColorPalet .= '</div>';
514 $sColorPalet .= '<a href="javascript:void(0)" id="reset_colors_' . $iButtonId . '" style="' . (( !$bCustomColors ? 'display: none' : '' )) . '" class="button color_default_btn">Back to default</a>';
515 return $sColorPalet;
516 }
517
518 /**
519 * Button custom class
520 *
521 * @param $iButtonId
522 * @return string
523 */
524 public function buttonCustomClass( $iButtonId )
525 {
526 return '<input type="text" class="buttonizer-click-to-pro" value="Use PRO for custom classes" readonly>';
527 }
528
529 /**
530 * Show the pro message
531 * @return string
532 */
533 public function showPro()
534 {
535 return '<span class="buttonizer-pro-feature buttonizer-click-to-pro">PRO</span>';
536 }
537
538 }
539 // Share page
540 function field_share_facebook()
541 {
542 $share_facebook = ( isset( $this->aSavedData['share_facebook'] ) ? $this->aSavedData['share_facebook'] : '' );
543 $share_facebook_text = ( isset( $this->aSavedData['share_facebook_text'] ) ? $this->aSavedData['share_facebook_text'] : 'Share this on Facebook' );
544 return '<span class="before-input"><option name="buttonizer_general_settings[share_facebook]" value="1" ' . (( $share_facebook == '1' ? 'checked="checked"' : '' )) . ' class="socialSharingCheckbox" onchange="checkSelection()"/></span> <input type="text" name="buttonizer_general_settings[share_facebook_text]" value="' . $share_facebook_text . '" class="before-input-padding" placeholder="Share this on Facebook" />';
545 }
546
547 function field_share_linkedin()
548 {
549 $share_linkedin = ( isset( $this->aSavedData['share_linkedin'] ) ? $this->aSavedData['share_linkedin'] : '' );
550 $share_linkedin_text = ( isset( $this->aSavedData['share_linkedin_text'] ) ? $this->aSavedData['share_linkedin_text'] : 'Share this on LinkedIn' );
551 return '<span class="before-input"><option name="buttonizer_general_settings[share_linkedin]" value="1" ' . (( $share_linkedin == '1' ? 'checked="checked"' : '' )) . ' class="socialSharingCheckbox" onchange="checkSelection()"/></span> <input type="text" name="buttonizer_general_settings[share_linkedin_text]" value="' . $share_linkedin_text . '" class="before-input-padding" placeholder="Share this on LinkedIn" />';
552 }
553
554 function field_share_twitter()
555 {
556 $share_twitter = ( isset( $this->aSavedData['share_twitter'] ) ? $this->aSavedData['share_twitter'] : '' );
557 $share_twitter_text = ( isset( $this->aSavedData['share_twitter_text'] ) ? $this->aSavedData['share_twitter_text'] : 'Share this on Twitter' );
558 return '<span class="before-input"><option name="buttonizer_general_settings[share_twitter]" value="1" ' . (( $share_twitter == '1' ? 'checked="checked"' : '' )) . ' class="socialSharingCheckbox" onchange="checkSelection()"/></span> <input type="text" name="buttonizer_general_settings[share_twitter_text]" value="' . $share_twitter_text . '" class="before-input-padding" placeholder="Share this on Twitter" />';
559 }
560
561 function field_share_email()
562 {
563 $share_email = ( isset( $this->aSavedData['share_email'] ) ? $this->aSavedData['share_email'] : '' );
564 $share_email_text = ( isset( $this->aSavedData['share_email_text'] ) ? $this->aSavedData['share_email_text'] : 'Share this on Email' );
565 return '<span class="before-input"><option name="buttonizer_general_settings[share_email]" value="1" ' . (( $share_email == '1' ? 'checked="checked"' : '' )) . ' class="socialSharingCheckbox" onchange="checkSelection()"/></span> <input type="text" name="buttonizer_general_settings[share_email_text]" value="' . $share_email_text . '" class="before-input-padding" placeholder="Share this on Email" />';
566 }
567
568 function field_share_whatsapp()
569 {
570 $share_whatsapp = ( isset( $this->aSavedData['share_whatsapp'] ) ? $this->aSavedData['share_whatsapp'] : '' );
571 $share_whatsapp_text = ( isset( $this->aSavedData['share_whatsapp_text'] ) ? $this->aSavedData['share_whatsapp_text'] : 'Share this on Whatsapp' );
572 return '<span class="before-input"><option name="buttonizer_general_settings[share_whatsapp]" value="1" ' . (( $share_whatsapp == '1' ? 'checked="checked"' : '' )) . ' class="socialSharingCheckbox" onchange="checkSelection()"/></span> <input type="text" name="buttonizer_general_settings[share_whatsapp_text]" value="' . $share_whatsapp_text . '" class="before-input-padding" placeholder="Share this on Whatsapp" />';
573 }
574