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'] : [ 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 function buttonGetIcon( $iButtonId = 0 ) { return $this->oIconManager->generator( [ '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 function buttonOutputIcon( $iButtonId = 0 ) { $fieldName = 'button_' . $iButtonId . '_icon'; return ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : 'fa-info' ); } // Only show this button on phone? function buttonGetShowPhone( $iButtonId = 0 ) { $fieldName = 'button_' . $iButtonId . '_show_on_phone'; $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); return ''; } // buttonGetShowOnPages function buttonGetShowOnPages( $iButtonId = 0 ) { $fieldName = 'button_' . $iButtonId . '_show_on_pages'; $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); $pageOrders = ( isset( $this->aPageCategories ) ? $this->aPageCategories : [] ); /* * Generate '; foreach ( $pageOrders as $id => $data ) { if ( $pageKey == -1 ) { continue; } $html .= ''; } return $html . ''; } // Only show this button on desktop? 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? 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? function buttonGetShowNotWenOpen( $iButtonId = 0 ) { $fieldName = 'button_' . $iButtonId . '_show_not_when_opened'; $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); return ''; } function buttonShowOnHover( $iButtonId = 0 ) { $fieldName = 'button_' . $iButtonId . '_show_label_on_hover'; $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); // return ''; return ' '; } function buttonGetType( $iButtonId = 0 ) { $aTypes = [ 'url' => 'Website URL', 'phone' => 'Phone number', 'mail' => 'E-mail', 'backtotop' => 'Back to top', ]; $aTypes = array_merge( $aTypes, [ 'disabled_whatsapp' => 'Open whatsapp (phone number) - PRO ONLY', 'disabled_javascript' => 'Javascript function - PRO ONLY', ] ); $fieldName = 'button_' . $iButtonId . '_action'; $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : 'url' ); $html = ''; } function buttonGetUrl( $iButtonId = 0 ) { $fieldName = 'button_' . $iButtonId . '_url'; $fieldValue = str_replace( '"', '\'', ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ) ); return ''; } /** * New tab * * @param int $iButtonId * @return string */ function buttonGetNewTab( $iButtonId = 0 ) { $fieldName = 'button_' . $iButtonId . '_url_newtab'; $is_selected = ( isset( $this->aSavedData[$fieldName] ) ? $this->aSavedData[$fieldName] : '' ); return ''; } /** * Button colors * * @param int $iButtonId * @return string */ function buttonColors( $iButtonId = 0 ) { // Default button colors $sDefaultColor1 = ( isset( $this->aSystemSettings['button_unpushed'] ) ? $this->aSystemSettings['button_unpushed'] : '#48A4DC' ); $sDefaultColor2 = ( isset( $this->aSystemSettings['button_pushed'] ) ? $this->aSystemSettings['button_pushed'] : '#1D9BDB' ); $sDefaultColor3 = ( isset( $this->aSystemSettings['icon_color'] ) ? $this->aSystemSettings['icon_color'] : '#fffff' ); // 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; } /** * Button custom class * * @param $iButtonId * @return string */ public function buttonCustomClass( $iButtonId ) { return ''; } /** * Show the pro message * @return string */ public function showPro() { return 'PRO'; } }