aFontAwesome = $aFontAwesome; $this->oIconManager = $oIconManager; $this->loadData(); $this->loadButtons(); } private function loadData() { $this->aSavedData = (array) get_option( 'buttonizer_buttons' ); $this->aPageCategories = (array) get_option( 'buttonizer_page_categories' ); $this->aSystemSettings = (array) get_option( 'buttonizer_general_settings' ); } private function loadButtons() { // Get buttons $aButtons = ( isset( $this->aSavedData['buttonorder'] ) && is_array( $this->aSavedData['buttonorder'] ) ? $this->aSavedData['buttonorder'] : array( 0 => -1, ) ); if ( $aButtons[0] != '-1' ) { $aButtons[-1] = '-1'; } echo '' ; echo '' ; } private function loadIndividialButtonRow( $sButtonKey, $iButtonId, $bDisabled ) { $sButtonTitle = ( isset( $this->aSavedData['button_' . $iButtonId . '_title'] ) ? $this->aSavedData['button_' . $iButtonId . '_title'] : 'Button ' . ($iButtonId + 1) ); $onMobile = ( isset( $this->aSavedData['button_' . $iButtonId . '_show_on_phone'] ) ? $this->aSavedData['button_' . $iButtonId . '_show_on_phone'] : '' ); $onDesktop = ( isset( $this->aSavedData['button_' . $iButtonId . '_show_on_desktop'] ) ? $this->aSavedData['button_' . $iButtonId . '_show_on_desktop'] : '' ); ?>
  • aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : 'New button' ); return ''; } // Get button icon public function buttonGetIcon( $iButtonId = 0 ) { return $this->oIconManager->generator( array( 'icon' => ( isset( $this->aSavedData['button_' . $iButtonId . '_icon'] ) ? $this->aSavedData['button_' . $iButtonId . '_icon'] : '' ), 'icon_fieldname' => 'buttonizer_buttons[button_' . $iButtonId . '_icon]', 'image' => ( isset( $this->aSavedData['button_' . $iButtonId . '_image'] ) ? $this->aSavedData['button_' . $iButtonId . '_image'] : '' ), 'image_fieldname' => 'buttonizer_buttons[button_' . $iButtonId . '_image]', 'choose_type' => true, ) ); } // Get button icon public function buttonOutputIcon( $iButtonId = 0 ) { $fieldName = 'button_' . $iButtonId . '_icon'; return ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : 'fa-info' ); } // Only show this button on phone? public function buttonGetShowPhone( $iButtonId = 0 ) { $fieldName = 'button_' . $iButtonId . '_show_on_phone'; $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); return ''; } // buttonGetShowOnPages public function buttonGetShowOnPages( $iButtonId = 0 ) { $fieldName = 'button_' . $iButtonId . '_show_on_pages'; $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); $pageOrders = ( isset( $this->aPageCategories['categorieOrder'] ) ? $this->aPageCategories['categorieOrder'] : array() ); /* * Generate '; foreach ( $pageOrders as $arrayKey => $pageKey ) { if ( $pageKey == -1 ) { continue; } $html .= ''; } return $html . ''; } // Only show this button on desktop? public function buttonGetShowDesktop( $iButtonId = 0 ) { $fieldName = 'button_' . $iButtonId . '_show_on_desktop'; $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); return ''; } // Only show when company is open? public function buttonGetShowWenOpen( $iButtonId = 0 ) { $fieldName = 'button_' . $iButtonId . '_show_when_opened'; $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); return ''; } // Only show when company is open? public function buttonGetShowNotWenOpen( $iButtonId = 0 ) { $fieldName = 'button_' . $iButtonId . '_show_not_when_opened'; $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); return ''; } public function buttonGetHideLabel( $iButtonId = 0 ) { $fieldName = 'button_' . $iButtonId . '_hide_label'; $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); return ''; } // Is this a phone number? public function buttonGetIsPhoneNumber( $iButtonId = 0 ) { $fieldName = 'button_' . $iButtonId . '_is_phonenumber'; $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); return ''; } public function buttonGetUrl( $iButtonId = 0 ) { $fieldName = 'button_' . $iButtonId . '_url'; $fieldValue = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); return ''; } // Only show this button on phone? public function buttonGetNewTab( $iButtonId = 0 ) { $fieldName = 'button_' . $iButtonId . '_url_newtab'; $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); return ''; } public function buttonColors( $iButtonId = 0 ) { // Default button colors $sDefaultColor1 = $this->aSystemSettings['button_unpushed']; $sDefaultColor2 = $this->aSystemSettings['button_pushed']; $sDefaultColor3 = $this->aSystemSettings['icon_color']; // Using custom colors? $bCustomColors = ( isset( $this->aSavedData['button_' . $iButtonId . '_using_custom_colors'] ) && $this->aSavedData['button_' . $iButtonId . '_using_custom_colors'] == '1' ? true : false ); // Get button colors $sColor1 = ( $bCustomColors && isset( $this->aSavedData['button_' . $iButtonId . '_colors_button'] ) && !empty($this->aSavedData['button_' . $iButtonId . '_colors_button']) ? $this->aSavedData['button_' . $iButtonId . '_colors_button'] : $sDefaultColor1 ); $sColor2 = ( $bCustomColors && isset( $this->aSavedData['button_' . $iButtonId . '_colors_pushed'] ) && !empty($this->aSavedData['button_' . $iButtonId . '_colors_pushed']) ? $this->aSavedData['button_' . $iButtonId . '_colors_pushed'] : $sDefaultColor2 ); $sColor3 = ( $bCustomColors && isset( $this->aSavedData['button_' . $iButtonId . '_colors_icon'] ) && !empty($this->aSavedData['button_' . $iButtonId . '_colors_icon']) ? $this->aSavedData['button_' . $iButtonId . '_colors_icon'] : $sDefaultColor3 ); $sColorPalet = '
    '; $sColorPalet .= '
    '; $sColorPalet .= '
    '; $sColorPalet .= '
    '; $sColorPalet .= '
    ' . (( $sColor1 != $sDefaultColor1 || $sColor2 != $sDefaultColor2 || $sColor3 != $sDefaultColor3 ? 'Custom colors' : 'Default colors' )) . '
    '; $sColorPalet .= ''; $sColorPalet .= ''; $sColorPalet .= ''; $sColorPalet .= ''; $sColorPalet .= '
    '; $sColorPalet .= 'Back to default'; return $sColorPalet; } }