| 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'] : array( |
| 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 |
?> |
| 75 |
" button-id="<?php |
| 76 |
echo $iButtonId ; |
| 77 |
?> |
| 78 |
"<?php |
| 79 |
if ( $iButtonId == -1 ) { |
| 80 |
echo ' style="display: none"' ; |
| 81 |
} |
| 82 |
?> |
| 83 |
> |
| 84 |
<input type="checkbox" name="buttonizer_buttons[buttonorder][]" value="<?php |
| 85 |
echo $iButtonId ; |
| 86 |
?> |
| 87 |
" checked="checked" style="display: none;" /> |
| 88 |
|
| 89 |
<div class="row-info drag-handle"> |
| 90 |
<div class="mover"></div> |
| 91 |
<span><i class="fa <?php |
| 92 |
echo $this->buttonOutputIcon( $iButtonId ) ; |
| 93 |
?> |
| 94 |
button-icon"></i> <span class="row-title"><?php |
| 95 |
echo ( $iButtonId == -1 ? 'New button' : $sButtonTitle ) ; |
| 96 |
?> |
| 97 |
</span> <i class="fa fa-pencil pencil-edit"></i></span> |
| 98 |
|
| 99 |
<a href="javascript:buttonizer.removeRow(<?php |
| 100 |
echo $iButtonId ; |
| 101 |
?> |
| 102 |
)" class="delete-button">Delete <i class="fa fa-trash-o"></i></a> |
| 103 |
|
| 104 |
<a href="javascript:buttonizer.toggleMobile(<?php |
| 105 |
echo $iButtonId ; |
| 106 |
?> |
| 107 |
)" class="mobiledesktop mobile-button <?php |
| 108 |
echo ( $onMobile == '' ? 'selected' : '' ) ; |
| 109 |
?> |
| 110 |
"><i class="fa fa-mobile"></i></a> |
| 111 |
<a href="javascript:buttonizer.toggleDesktop(<?php |
| 112 |
echo $iButtonId ; |
| 113 |
?> |
| 114 |
)" class="mobiledesktop desktop-button <?php |
| 115 |
echo ( $onDesktop == '' ? 'selected' : '' ) ; |
| 116 |
?> |
| 117 |
"><i class="fa fa-desktop"></i></a> |
| 118 |
|
| 119 |
<a href="javascript:void(0)" class="is-live-button" style="<?php |
| 120 |
echo ( $onMobile != '' || $onDesktop != '' ? '' : 'display: none;' ) ; |
| 121 |
?> |
| 122 |
"><i class="fa fa-circle"></i> Live</a> |
| 123 |
|
| 124 |
<button type="submit" class="must-save-button savebutton " style="display: none;"><i class="fa fa-floppy-o"></i> Save changes</button> |
| 125 |
</div> |
| 126 |
|
| 127 |
<div class="button-data"> |
| 128 |
<table> |
| 129 |
<tr style="display: none;"> |
| 130 |
<td></td> |
| 131 |
<td></td> |
| 132 |
</tr> |
| 133 |
<tr> |
| 134 |
<td width="50%"> |
| 135 |
<label for="button_text" class="label-top"> |
| 136 |
<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> |
| 137 |
Button name: |
| 138 |
</label> |
| 139 |
<input type="text" name="buttonizer_buttons[button_<?php |
| 140 |
echo $iButtonId ; |
| 141 |
?> |
| 142 |
_title]" value="<?php |
| 143 |
echo $sButtonTitle ; |
| 144 |
?> |
| 145 |
" class="button_title" /> |
| 146 |
</td> |
| 147 |
<td class="button-pdr"> |
| 148 |
<label for="button_icon" class="label-top"> |
| 149 |
<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> |
| 150 |
Button icon/image: |
| 151 |
</label> |
| 152 |
<?php |
| 153 |
echo $this->buttonGetIcon( $iButtonId ) ; |
| 154 |
?> |
| 155 |
</td> |
| 156 |
</tr> |
| 157 |
|
| 158 |
<tr> |
| 159 |
<td> </td> |
| 160 |
<td></td> |
| 161 |
</tr> |
| 162 |
|
| 163 |
<tr> |
| 164 |
<td> |
| 165 |
<label for="button_text" class="label-top"> |
| 166 |
<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'</span></span> |
| 167 |
Button label: |
| 168 |
</label> |
| 169 |
<?php |
| 170 |
echo $this->buttonGetText( $iButtonId ) ; |
| 171 |
?> |
| 172 |
</td> |
| 173 |
<td> |
| 174 |
<label for="button_category" class="label-top"> |
| 175 |
<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> |
| 176 |
Button page category: |
| 177 |
</label> |
| 178 |
<?php |
| 179 |
echo $this->buttonGetShowOnPages( $iButtonId ) ; |
| 180 |
?> |
| 181 |
</td> |
| 182 |
</tr> |
| 183 |
|
| 184 |
<tr> |
| 185 |
<td> </td> |
| 186 |
<td></td> |
| 187 |
</tr> |
| 188 |
|
| 189 |
<tr class="settings-row"> |
| 190 |
<td> |
| 191 |
<i class="fa fa-globe setting-icon"></i> URL or phone-number |
| 192 |
<span class="info-class"><i class="fa fa-info-circle"></i> <span>This is the click-action of your button. You can input a full url (http://myawesomewebsite.com), a URI (/contact), an anchor-link (#anchor) or a phone number. Note that if you input a phone number that you select the option ‘Is phone number’. This will be a direct click-to-call action. Please don’t add a full url without the http:// (like: www.myawesomewebsite.com). </span></span> |
| 193 |
</td> |
| 194 |
<td><?php |
| 195 |
echo $this->buttonGetUrl( $iButtonId ) ; |
| 196 |
?> |
| 197 |
</td> |
| 198 |
</tr> |
| 199 |
|
| 200 |
<tr class="settings-row"> |
| 201 |
<td> |
| 202 |
<i class="fa fa-phone setting-icon"></i> Is phone number |
| 203 |
</td> |
| 204 |
<td><?php |
| 205 |
echo $this->buttonGetIsPhoneNumber( $iButtonId ) ; |
| 206 |
?> |
| 207 |
<label for="button_<?php |
| 208 |
echo $iButtonId ; |
| 209 |
?> |
| 210 |
_is_phonenumber"> Yes</label></td> |
| 211 |
</tr> |
| 212 |
|
| 213 |
<tr class="settings-row setting-new-tab"> |
| 214 |
<td> |
| 215 |
<i class="fa fa-external-link setting-icon"></i> Open in new tab |
| 216 |
</td> |
| 217 |
<td><?php |
| 218 |
echo $this->buttonGetNewTab( $iButtonId ) ; |
| 219 |
?> |
| 220 |
<label for="button_<?php |
| 221 |
echo $iButtonId ; |
| 222 |
?> |
| 223 |
_url_newtab"> Yes</label></td> |
| 224 |
</tr> |
| 225 |
|
| 226 |
<tr class="settings-row"> |
| 227 |
<td> |
| 228 |
<i class="fa fa-paint-brush setting-icon"></i> Button colors |
| 229 |
<span class="info-class"><i class="fa fa-info-circle"></i> <span>... </span></span> |
| 230 |
</td> |
| 231 |
<td><?php |
| 232 |
echo $this->buttonColors( $iButtonId ) ; |
| 233 |
?> |
| 234 |
</td> |
| 235 |
</tr> |
| 236 |
|
| 237 |
<tr> |
| 238 |
<td> </td> |
| 239 |
<td></td> |
| 240 |
</tr> |
| 241 |
|
| 242 |
<tr class="settings-row"> |
| 243 |
<td> |
| 244 |
<i class="fa fa-mobile setting-icon"></i> Show on mobile |
| 245 |
</td> |
| 246 |
<td><?php |
| 247 |
echo $this->buttonGetShowPhone( $iButtonId ) ; |
| 248 |
?> |
| 249 |
<label for="button_<?php |
| 250 |
echo $iButtonId ; |
| 251 |
?> |
| 252 |
_show_on_phone"> Yes</label></td> |
| 253 |
</tr> |
| 254 |
|
| 255 |
<tr class="settings-row"> |
| 256 |
<td> |
| 257 |
<i class="fa fa-desktop setting-icon"></i> Show on desktop |
| 258 |
</td> |
| 259 |
<td><?php |
| 260 |
echo $this->buttonGetShowDesktop( $iButtonId ) ; |
| 261 |
?> |
| 262 |
<label for="button_<?php |
| 263 |
echo $iButtonId ; |
| 264 |
?> |
| 265 |
_show_on_desktop"> Yes</label></td> |
| 266 |
</tr> |
| 267 |
|
| 268 |
<tr class="settings-row"> |
| 269 |
<td> |
| 270 |
<i class="fa fa-tag setting-icon"></i> Hide label |
| 271 |
|
| 272 |
<span class="info-class"> |
| 273 |
<i class="fa fa-info-circle"></i> |
| 274 |
<span> |
| 275 |
This is the label what the guest on your website will see. Something like 'Contact me!', or 'Like us on Facebook' |
| 276 |
</span> |
| 277 |
</span> |
| 278 |
</td> |
| 279 |
<td><?php |
| 280 |
echo $this->buttonGetHideLabel( $iButtonId ) ; |
| 281 |
?> |
| 282 |
<label for="button_<?php |
| 283 |
echo $iButtonId ; |
| 284 |
?> |
| 285 |
_hide_label"> Yes</label></td> |
| 286 |
</tr> |
| 287 |
|
| 288 |
<tr> |
| 289 |
<td> </td> |
| 290 |
<td></td> |
| 291 |
</tr> |
| 292 |
|
| 293 |
<?php |
| 294 |
?> |
| 295 |
<tr class="settings-row"> |
| 296 |
<td> |
| 297 |
<i class="fa fa-clock-o setting-icon"></i> Show <b>only</b> on 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> <td></td> |
| 300 |
</tr> |
| 301 |
|
| 302 |
<tr class="settings-row"> |
| 303 |
<td> |
| 304 |
<i class="fa fa-times-circle-o setting-icon"></i> Show <b>only outside</b> opening hours |
| 305 |
</td> |
| 306 |
<td><input type="checkbox" class="buttonizer-click-to-pro" readonly=""> <label> Yes</label> <span class="buttonizer-pro-feature">PRO</span></td> |
| 307 |
</tr> |
| 308 |
<?php |
| 309 |
?> |
| 310 |
</table> |
| 311 |
</div> |
| 312 |
</div> |
| 313 |
</li> |
| 314 |
<?php |
| 315 |
} |
| 316 |
|
| 317 |
/* |
| 318 |
* Form functions |
| 319 |
*/ |
| 320 |
// Get the text of the button |
| 321 |
public function buttonGetText( $iButtonId = 0 ) |
| 322 |
{ |
| 323 |
$fieldName = 'button_' . $iButtonId . '_text'; |
| 324 |
$fieldValue = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : 'New button' ); |
| 325 |
return '<input type="text" name="buttonizer_buttons[' . $fieldName . ']" id="' . $fieldName . '" value="' . $fieldValue . '" class="button_textfield" placeholder="Button text" />'; |
| 326 |
} |
| 327 |
|
| 328 |
// Get button icon |
| 329 |
public function buttonGetIcon( $iButtonId = 0 ) |
| 330 |
{ |
| 331 |
return $this->oIconManager->generator( array( |
| 332 |
'icon' => ( isset( $this->aSavedData['button_' . $iButtonId . '_icon'] ) ? $this->aSavedData['button_' . $iButtonId . '_icon'] : '' ), |
| 333 |
'icon_fieldname' => 'buttonizer_buttons[button_' . $iButtonId . '_icon]', |
| 334 |
'image' => ( isset( $this->aSavedData['button_' . $iButtonId . '_image'] ) ? $this->aSavedData['button_' . $iButtonId . '_image'] : '' ), |
| 335 |
'image_fieldname' => 'buttonizer_buttons[button_' . $iButtonId . '_image]', |
| 336 |
'choose_type' => true, |
| 337 |
) ); |
| 338 |
} |
| 339 |
|
| 340 |
// Get button icon |
| 341 |
public function buttonOutputIcon( $iButtonId = 0 ) |
| 342 |
{ |
| 343 |
$fieldName = 'button_' . $iButtonId . '_icon'; |
| 344 |
return ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : 'fa-info' ); |
| 345 |
} |
| 346 |
|
| 347 |
// Only show this button on phone? |
| 348 |
public function buttonGetShowPhone( $iButtonId = 0 ) |
| 349 |
{ |
| 350 |
$fieldName = 'button_' . $iButtonId . '_show_on_phone'; |
| 351 |
$is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); |
| 352 |
return '<input type="checkbox" name="buttonizer_buttons[' . $fieldName . ']" id="' . $fieldName . '" value="1" class="button_showonphone" ' . (( $is_selected == '1' ? 'checked="checked"' : '' )) . ' />'; |
| 353 |
} |
| 354 |
|
| 355 |
// buttonGetShowOnPages |
| 356 |
public function buttonGetShowOnPages( $iButtonId = 0 ) |
| 357 |
{ |
| 358 |
$fieldName = 'button_' . $iButtonId . '_show_on_pages'; |
| 359 |
$is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); |
| 360 |
$pageOrders = ( isset( $this->aPageCategories['categorieOrder'] ) ? $this->aPageCategories['categorieOrder'] : array() ); |
| 361 |
/* |
| 362 |
* Generate <select> |
| 363 |
*/ |
| 364 |
$html = '<select name="buttonizer_buttons[' . $fieldName . ']" id="button_category"><option value="-5">Show on every page</option><option value="-4">Hide everywhere</option>'; |
| 365 |
foreach ( $pageOrders as $arrayKey => $pageKey ) { |
| 366 |
if ( $pageKey == -1 ) { |
| 367 |
continue; |
| 368 |
} |
| 369 |
$html .= '<option value="' . $pageKey . '"' . (( $pageKey == $is_selected ? 'selected="selected"' : '' )) . '>' . $this->aPageCategories['category_' . $pageKey . '_title'] . '</option>'; |
| 370 |
} |
| 371 |
return $html . '</select>'; |
| 372 |
} |
| 373 |
|
| 374 |
// Only show this button on desktop? |
| 375 |
public function buttonGetShowDesktop( $iButtonId = 0 ) |
| 376 |
{ |
| 377 |
$fieldName = 'button_' . $iButtonId . '_show_on_desktop'; |
| 378 |
$is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); |
| 379 |
return '<input type="checkbox" name="buttonizer_buttons[' . $fieldName . ']" id="' . $fieldName . '" value="1" class="button_showondesktop" ' . (( $is_selected == '1' ? 'checked="checked"' : '' )) . ' />'; |
| 380 |
} |
| 381 |
|
| 382 |
// Only show when company is open? |
| 383 |
public function buttonGetShowWenOpen( $iButtonId = 0 ) |
| 384 |
{ |
| 385 |
$fieldName = 'button_' . $iButtonId . '_show_when_opened'; |
| 386 |
$is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); |
| 387 |
return '<input type="checkbox" name="buttonizer_buttons[' . $fieldName . ']" id="' . $fieldName . '" value="1" class="button_showwhenopened" ' . (( $is_selected == '1' ? 'checked="checked"' : '' )) . ' />'; |
| 388 |
} |
| 389 |
|
| 390 |
// Only show when company is open? |
| 391 |
public function buttonGetShowNotWenOpen( $iButtonId = 0 ) |
| 392 |
{ |
| 393 |
$fieldName = 'button_' . $iButtonId . '_show_not_when_opened'; |
| 394 |
$is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); |
| 395 |
return '<input type="checkbox" name="buttonizer_buttons[' . $fieldName . ']" id="' . $fieldName . '" value="1" class="button_showwhenopened" ' . (( $is_selected == '1' ? 'checked="checked"' : '' )) . ' />'; |
| 396 |
} |
| 397 |
|
| 398 |
public function buttonGetHideLabel( $iButtonId = 0 ) |
| 399 |
{ |
| 400 |
$fieldName = 'button_' . $iButtonId . '_hide_label'; |
| 401 |
$is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); |
| 402 |
return '<input type="checkbox" name="buttonizer_buttons[' . $fieldName . ']" id="' . $fieldName . '" value="1" class="button_hidelabel" ' . (( $is_selected == '1' ? 'checked="checked"' : '' )) . ' />'; |
| 403 |
} |
| 404 |
|
| 405 |
// Is this a phone number? |
| 406 |
public function buttonGetIsPhoneNumber( $iButtonId = 0 ) |
| 407 |
{ |
| 408 |
$fieldName = 'button_' . $iButtonId . '_is_phonenumber'; |
| 409 |
$is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); |
| 410 |
return '<input type="checkbox" name="buttonizer_buttons[' . $fieldName . ']" id="' . $fieldName . '" value="1" class="button_isphonenumber" ' . (( $is_selected == '1' ? 'checked="checked"' : '' )) . ' />'; |
| 411 |
} |
| 412 |
|
| 413 |
public function buttonGetUrl( $iButtonId = 0 ) |
| 414 |
{ |
| 415 |
$fieldName = 'button_' . $iButtonId . '_url'; |
| 416 |
$fieldValue = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); |
| 417 |
return '<input type="text" name="buttonizer_buttons[' . $fieldName . ']" id="' . $fieldName . '" value="' . $fieldValue . '" class="button_isurl" placeholder="URL/Phone number" />'; |
| 418 |
} |
| 419 |
|
| 420 |
// Only show this button on phone? |
| 421 |
public function buttonGetNewTab( $iButtonId = 0 ) |
| 422 |
{ |
| 423 |
$fieldName = 'button_' . $iButtonId . '_url_newtab'; |
| 424 |
$is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); |
| 425 |
return '<input type="checkbox" name="buttonizer_buttons[' . $fieldName . ']" id="' . $fieldName . '" value="1" class="button_isnewtab" ' . (( $is_selected == '1' ? 'checked="checked"' : '' )) . ' />'; |
| 426 |
} |
| 427 |
|
| 428 |
public function buttonColors( $iButtonId = 0 ) |
| 429 |
{ |
| 430 |
// Default button colors |
| 431 |
$sDefaultColor1 = $this->aSystemSettings['button_unpushed']; |
| 432 |
$sDefaultColor2 = $this->aSystemSettings['button_pushed']; |
| 433 |
$sDefaultColor3 = $this->aSystemSettings['icon_color']; |
| 434 |
// Using custom colors? |
| 435 |
$bCustomColors = ( isset( $this->aSavedData['button_' . $iButtonId . '_using_custom_colors'] ) && $this->aSavedData['button_' . $iButtonId . '_using_custom_colors'] == '1' ? true : false ); |
| 436 |
// Get button colors |
| 437 |
$sColor1 = ( $bCustomColors && isset( $this->aSavedData['button_' . $iButtonId . '_colors_button'] ) && !empty($this->aSavedData['button_' . $iButtonId . '_colors_button']) ? $this->aSavedData['button_' . $iButtonId . '_colors_button'] : $sDefaultColor1 ); |
| 438 |
$sColor2 = ( $bCustomColors && isset( $this->aSavedData['button_' . $iButtonId . '_colors_pushed'] ) && !empty($this->aSavedData['button_' . $iButtonId . '_colors_pushed']) ? $this->aSavedData['button_' . $iButtonId . '_colors_pushed'] : $sDefaultColor2 ); |
| 439 |
$sColor3 = ( $bCustomColors && isset( $this->aSavedData['button_' . $iButtonId . '_colors_icon'] ) && !empty($this->aSavedData['button_' . $iButtonId . '_colors_icon']) ? $this->aSavedData['button_' . $iButtonId . '_colors_icon'] : $sDefaultColor3 ); |
| 440 |
$sColorPalet = '<div class="button-color-palet" data-btnid="' . $iButtonId . '">'; |
| 441 |
$sColorPalet .= '<div class="color default" style="background-color: ' . $sColor1 . ';" data-default="' . $sDefaultColor1 . '"></div>'; |
| 442 |
$sColorPalet .= '<div class="color pushed" style="background-color: ' . $sColor2 . ';" data-default="' . $sDefaultColor2 . '"></div>'; |
| 443 |
$sColorPalet .= '<div class="color icon" style="background-color: ' . $sColor3 . ';" data-default="' . $sDefaultColor3 . '"></div>'; |
| 444 |
$sColorPalet .= '<div class="text">' . (( $sColor1 != $sDefaultColor1 || $sColor2 != $sDefaultColor2 || $sColor3 != $sDefaultColor3 ? 'Custom colors' : 'Default colors' )) . '</div>'; |
| 445 |
$sColorPalet .= '<input type="hidden" name="buttonizer_buttons[button_' . $iButtonId . '_using_custom_colors]" class="custom" value="' . (( $bCustomColors ? '1' : '0' )) . '" />'; |
| 446 |
$sColorPalet .= '<input type="hidden" name="buttonizer_buttons[button_' . $iButtonId . '_colors_button]" class="default" value="' . $sColor1 . '" />'; |
| 447 |
$sColorPalet .= '<input type="hidden" name="buttonizer_buttons[button_' . $iButtonId . '_colors_pushed]" class="pushed" value="' . $sColor2 . '" />'; |
| 448 |
$sColorPalet .= '<input type="hidden" name="buttonizer_buttons[button_' . $iButtonId . '_colors_icon]" class="icon" value="' . $sColor3 . '" />'; |
| 449 |
$sColorPalet .= '</div>'; |
| 450 |
$sColorPalet .= '<a href="javascript:void(0)" id="reset_colors_' . $iButtonId . '" style="' . (( !$bCustomColors ? 'display: none' : '' )) . '" class="button color_default_btn">Back to default</a>'; |
| 451 |
return $sColorPalet; |
| 452 |
} |
| 453 |
|
| 454 |
} |