| @@ -1,147 +1,208 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * Settings | |
| 4 | - * | |
| 5 | - * @package Wow_Plugin | |
| 6 | - * @copyright Copyright (c) 2018, Dmytro Lobov | |
| 7 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License | |
| 8 | - * @since 1.0 | |
| 9 | - */ | |
| 10 | 2 | |
| 11 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 12 | - exit; | |
| 13 | -} | |
| 14 | 3 | |
| 15 | -include_once( 'icons.php' ); | |
| 16 | -$icons_new = array(); | |
| 17 | -foreach ( $icons as $key => $value ) { | |
| 18 | - $icons_new[ $value ] = $value; | |
| 19 | -} | |
| 4 | +use FloatMenuLite\WOWP_Plugin; | |
| 20 | 5 | |
| 21 | -$count_i = ( ! empty( $param['menu_1']['item_type'] ) ) ? count( $param['menu_1']['item_type'] ) : '0'; | |
| 22 | -if ( $count_i > 0 ) { | |
| 23 | - for ( $i = 0; $i < $count_i; $i ++ ) { | |
| 6 | +defined( 'ABSPATH' ) || exit; | |
| 24 | 7 | |
| 25 | - // Icon | |
| 26 | - $item_icon_[ $i ] = array( | |
| 27 | - 'name' => 'param[menu_1][item_icon][]', | |
| 28 | - 'class' => 'icons', | |
| 29 | - 'type' => 'select', | |
| 30 | - 'val' => isset( $param['menu_1']['item_icon'][ $i ] ) ? $param['menu_1']['item_icon'][ $i ] | |
| 31 | - : 'fas fa-hand-point-up', | |
| 32 | - 'option' => $icons_new, | |
| 33 | - ); | |
| 8 | +$args = [ | |
| 34 | 9 | |
| 35 | - // Label for item | |
| 36 | - $item_tooltip_[ $i ] = array( | |
| 37 | - 'name' => 'param[menu_1][item_tooltip][]', | |
| 38 | - 'class' => 'item-tooltip', | |
| 39 | - 'type' => 'text', | |
| 40 | - 'val' => isset( $param['menu_1']['item_tooltip'][ $i ] ) ? $param['menu_1']['item_tooltip'][ $i ] : '', | |
| 41 | - ); | |
| 10 | + 'style' => [ | |
| 11 | + [ | |
| 12 | + 'item_tooltip' => [ | |
| 13 | + 'type' => 'text', | |
| 14 | + 'title' => __( 'Text', 'float-menu' ), | |
| 15 | + ], | |
| 16 | + ], | |
| 17 | + [ | |
| 18 | + 'item_tooltip_font' => [ | |
| 19 | + 'type' => 'select', | |
| 20 | + 'title' => __( 'Font Family', 'float-menu' ), | |
| 21 | + 'atts' => [ | |
| 22 | + 'inherit' => __( 'Use Your Themes', 'float-menu' ), | |
| 23 | + 'Tahoma' => __( 'Tahoma', 'float-menu' ), | |
| 24 | + 'Georgia' => __( 'Georgia', 'float-menu' ), | |
| 25 | + 'Comic Sans MS' => __( 'Comic Sans MS', 'float-menu' ), | |
| 26 | + 'Arial' => __( 'Arial', 'float-menu' ), | |
| 27 | + 'Lucida Grande' => __( 'Lucida Grande', 'float-menu' ), | |
| 28 | + 'Times New Roman' => __( 'Times New Roman', 'float-menu' ), | |
| 29 | + ], | |
| 30 | + ], | |
| 42 | 31 | |
| 43 | - // Type of the item | |
| 44 | - $item_type_[ $i ] = array( | |
| 45 | - 'name' => 'param[menu_1][item_type][]', | |
| 46 | - 'type' => 'select', | |
| 47 | - 'class' => 'item-type', | |
| 48 | - 'val' => isset( $param['menu_1']['item_type'][ $i ] ) ? $param['menu_1']['item_type'][ $i ] : 'link', | |
| 49 | - 'option' => array( | |
| 50 | - 'link' => esc_attr__( 'Link', $this->plugin['text'] ), | |
| 51 | - ), | |
| 32 | + 'item_tooltip_style' => [ | |
| 33 | + 'type' => 'select', | |
| 34 | + 'title' => __( 'Font Style', 'float-menu' ), | |
| 35 | + 'atts' => [ | |
| 36 | + 'normal' => __( 'Normal', 'float-menu' ), | |
| 37 | + 'italic' => __( 'Italic', 'float-menu' ), | |
| 38 | + ], | |
| 39 | + ], | |
| 52 | 40 | |
| 53 | - ); | |
| 41 | + 'item_tooltip_weight' => [ | |
| 42 | + 'type' => 'select', | |
| 43 | + 'title' => __( 'Font Weight ', 'float-menu' ), | |
| 44 | + 'atts' => [ | |
| 45 | + 'normal' => __( 'Normal', 'float-menu' ), | |
| 46 | + 'lighter' => __( 'Lighter', 'float-menu' ), | |
| 47 | + 'bold' => __( 'Bold', 'float-menu' ), | |
| 48 | + 'bolder' => __( 'Bolder', 'float-menu' ), | |
| 49 | + ], | |
| 50 | + ], | |
| 51 | + ], | |
| 52 | + [ | |
| 53 | + 'color' => [ | |
| 54 | + 'type' => 'text', | |
| 55 | + 'val' => '#ffffff', | |
| 56 | + 'atts' => [ | |
| 57 | + 'class' => 'wpie-color', | |
| 58 | + 'data-alpha-enabled' => 'true', | |
| 59 | + ], | |
| 60 | + 'title' => __( 'Color', 'float-menu' ), | |
| 61 | + ], | |
| 54 | 62 | |
| 63 | + 'hcolor' => [ | |
| 64 | + 'type' => 'text', | |
| 65 | + 'val' => '#ffffff', | |
| 66 | + 'atts' => [ | |
| 67 | + 'class' => 'wpie-color', | |
| 68 | + 'data-alpha-enabled' => 'true', | |
| 69 | + ], | |
| 70 | + 'title' => __( 'Hover Color', 'float-menu' ), | |
| 71 | + ], | |
| 55 | 72 | |
| 56 | - // Link URL | |
| 57 | - $item_link_[ $i ] = array( | |
| 58 | - 'name' => 'param[menu_1][item_link][]', | |
| 59 | - 'type' => 'text', | |
| 60 | - 'val' => isset( $param['menu_1']['item_link'][ $i ] ) ? $param['menu_1']['item_link'][ $i ] : '', | |
| 61 | - ); | |
| 73 | + 'bcolor' => [ | |
| 74 | + 'type' => 'text', | |
| 75 | + 'val' => '#184c72', | |
| 76 | + 'atts' => [ | |
| 77 | + 'class' => 'wpie-color', | |
| 78 | + 'data-alpha-enabled' => 'true', | |
| 79 | + ], | |
| 80 | + 'title' => __( 'Background', 'float-menu' ), | |
| 81 | + ], | |
| 62 | 82 | |
| 83 | + 'hbcolor' => [ | |
| 84 | + 'type' => 'text', | |
| 85 | + 'val' => '#184c72', | |
| 86 | + 'atts' => [ | |
| 87 | + 'class' => 'wpie-color', | |
| 88 | + 'data-alpha-enabled' => 'true', | |
| 89 | + ], | |
| 90 | + 'title' => __( 'Hover Background', 'float-menu' ), | |
| 91 | + ], | |
| 92 | + ], | |
| 93 | + ], | |
| 63 | 94 | |
| 64 | - // Open link in a new window | |
| 65 | - $new_tab_[ $i ] = array( | |
| 66 | - 'name' => 'param[menu_1][new_tab][]', | |
| 67 | - 'class' => '', | |
| 68 | - 'type' => 'checkbox', | |
| 69 | - 'val' => isset( $param['menu_1']['new_tab'][ $i ] ) ? $param['menu_1']['new_tab'][ $i ] : 0, | |
| 70 | - 'func' => '', | |
| 71 | - 'sep' => '', | |
| 72 | - ); | |
| 95 | + 'type' => [ | |
| 96 | + [ | |
| 97 | + 'item_type' => [ | |
| 98 | + 'type' => 'select', | |
| 99 | + 'title' => __( 'Type', 'float-menu' ), | |
| 100 | + 'atts' => [ | |
| 101 | + 'links_start' => __( 'Links', 'float-menu' ), | |
| 102 | + 'link' => __( 'Link', 'float-menu' ), | |
| 103 | + 'login' => __( 'Login', 'float-menu' ), | |
| 104 | + 'logout' => __( 'Logout', 'float-menu' ), | |
| 105 | + 'lostpassword' => __( 'Lostpassword', 'float-menu' ), | |
| 106 | + 'register' => __( 'Register', 'float-menu' ), | |
| 107 | + 'links_end' => __( 'Links', 'float-menu' ), | |
| 108 | + ], | |
| 109 | + ], | |
| 73 | 110 | |
| 74 | - // Font color | |
| 75 | - $color_[ $i ] = array( | |
| 76 | - 'name' => 'param[menu_1][color][]', | |
| 77 | - 'type' => 'color', | |
| 78 | - 'val' => isset( $param['menu_1']['color'][ $i ] ) ? $param['menu_1']['color'][ $i ] : '#ffffff', | |
| 79 | - ); | |
| 111 | + 'item_link' => [ | |
| 112 | + 'type' => 'text', | |
| 113 | + 'title' => __( 'Link', 'float-menu' ), | |
| 114 | + 'class' => 'is-hidden', | |
| 115 | + ], | |
| 80 | 116 | |
| 81 | - $hcolor_default = isset( $param['menu_1']['color'][ $i ] ) ? $param['menu_1']['color'][ $i ] : '#ffffff'; | |
| 117 | + 'new_tab' => [ | |
| 118 | + 'type' => 'checkbox', | |
| 119 | + 'title' => __( 'Open in new Window', 'float-menu' ), | |
| 120 | + 'label' => __( 'Enable', 'float-menu' ), | |
| 121 | + 'class' => 'is-hidden', | |
| 122 | + ], | |
| 123 | + ], | |
| 124 | + ], | |
| 82 | 125 | |
| 83 | - // Font hover color | |
| 84 | - $hcolor_[ $i ] = array( | |
| 85 | - 'name' => 'param[menu_1][hcolor][]', | |
| 86 | - 'type' => 'color', | |
| 87 | - 'val' => isset( $param['menu_1']['hcolor'][ $i ] ) ? $param['menu_1']['hcolor'][ $i ] : $hcolor_default, | |
| 88 | - ); | |
| 126 | + 'icon' => [ | |
| 127 | + [ | |
| 128 | + 'icon_type' => [ | |
| 129 | + 'type' => 'select', | |
| 130 | + 'title' => __( 'Icon Type', 'float-menu' ), | |
| 131 | + 'value' => 'icon', | |
| 132 | + 'options' => [ | |
| 133 | + 'icon' => __( 'Icon', 'float-menu' ), | |
| 134 | + 'text' => __( 'Text', 'float-menu' ), | |
| 135 | + ] | |
| 136 | + ], | |
| 89 | 137 | |
| 138 | + 'item_custom_text' => [ | |
| 139 | + 'type' => 'text', | |
| 140 | + 'title' => __( 'Enter text', 'float-menu' ), | |
| 141 | + 'atts' => [ | |
| 142 | + 'placeholder' => __( 'Enter text', 'float-menu' ) | |
| 143 | + ], | |
| 144 | + ], | |
| 90 | 145 | |
| 91 | - // Background | |
| 92 | - $bcolor_[ $i ] = array( | |
| 93 | - 'name' => 'param[menu_1][bcolor][]', | |
| 94 | - 'type' => 'color', | |
| 95 | - 'val' => isset( $param['menu_1']['bcolor'][ $i ] ) ? $param['menu_1']['bcolor'][ $i ] : '#128be0', | |
| 96 | - ); | |
| 146 | + 'item_icon' => [ | |
| 147 | + 'type' => 'text', | |
| 148 | + 'title' => __( 'Icon', 'float-menu' ), | |
| 149 | + 'value' => 'fas fa-wand-magic-sparkles', | |
| 150 | + 'options' => [ | |
| 151 | + 'class' => 'wpie-icon-box', | |
| 152 | + ], | |
| 153 | + ], | |
| 154 | + ], | |
| 155 | + ], | |
| 97 | 156 | |
| 98 | - $hbcolor_default = isset( $param['menu_1']['bcolor'][ $i ] ) ? $param['menu_1']['bcolor'][ $i ] : '#128be0'; | |
| 99 | - // Hover Background | |
| 100 | - $hbcolor_[ $i ] = array( | |
| 101 | - 'name' => 'param[menu_1][hbcolor][]', | |
| 102 | - 'type' => 'color', | |
| 103 | - 'val' => isset( $param['menu_1']['hbcolor'][ $i ] ) ? $param['menu_1']['hbcolor'][ $i ] : $hbcolor_default, | |
| 104 | - ); | |
| 105 | 157 | |
| 158 | + 'attributes' => [ | |
| 159 | + [ | |
| 160 | + 'button_id' => [ | |
| 161 | + 'type' => 'text', | |
| 162 | + 'title' => __( 'ID for element', 'float-menu' ), | |
| 163 | + ], | |
| 106 | 164 | |
| 107 | - $button_id_[ $i ] = array( | |
| 108 | - 'name' => 'param[menu_1][button_id][]', | |
| 109 | - 'type' => 'text', | |
| 110 | - 'val' => isset( $param['menu_1']['button_id'][ $i ] ) ? $param['menu_1']['button_id'][ $i ] : '', | |
| 111 | - ); | |
| 165 | + 'button_class' => [ | |
| 166 | + 'type' => 'text', | |
| 167 | + 'title' => __( 'Class for element', 'float-menu' ), | |
| 168 | + ], | |
| 112 | 169 | |
| 113 | - $button_class_[ $i ] = array( | |
| 114 | - 'name' => 'param[menu_1][button_class][]', | |
| 115 | - 'type' => 'text', | |
| 116 | - 'val' => isset( $param['menu_1']['button_class'][ $i ] ) ? $param['menu_1']['button_class'][ $i ] : '', | |
| 117 | - ); | |
| 170 | + 'link_rel' => [ | |
| 171 | + 'type' => 'text', | |
| 172 | + 'title' => __( 'Attribute: rel', 'float-menu' ), | |
| 173 | + ], | |
| 118 | 174 | |
| 119 | - $link_rel_[ $i ] = array( | |
| 120 | - 'name' => 'param[menu_1][link_rel][]', | |
| 121 | - 'type' => 'text', | |
| 122 | - 'val' => isset( $param['menu_1']['link_rel'][ $i ] ) ? $param['menu_1']['link_rel'][ $i ] : '', | |
| 123 | - ); | |
| 175 | + 'aria_label' => [ | |
| 176 | + 'type' => 'text', | |
| 177 | + 'title' => __( 'Aria label', 'float-menu' ), | |
| 178 | + ], | |
| 179 | + ], | |
| 180 | + ], | |
| 181 | +]; | |
| 124 | 182 | |
| 183 | +$args = apply_filters( WOWP_Plugin::PREFIX . '_menu_options', $args ); | |
| 125 | 184 | |
| 126 | - } | |
| 185 | +$prefix = 'menu_1-'; | |
| 186 | +$data = [ | |
| 187 | + 'args' => $args, | |
| 188 | + 'opt' => [], | |
| 189 | + 'tabs' => [], | |
| 190 | +]; | |
| 127 | 191 | |
| 128 | -} | |
| 192 | +foreach ( $args as $i => $group ) { | |
| 193 | + $data['tabs'][] = $i; | |
| 129 | 194 | |
| 130 | -$item_tooltip_help = array( | |
| 131 | - 'text' => esc_attr__( 'Set the text for menu item.', $this->plugin['text'] ), | |
| 132 | -); | |
| 195 | + if ( is_array( $group ) ) { | |
| 133 | 196 | |
| 134 | -$item_type_help = array( | |
| 135 | - 'title' => esc_attr__( 'Types of the button which can be select', $this->plugin['text'] ), | |
| 136 | - 'ul' => array( | |
| 137 | - esc_attr__( 'Link - insert any link', $this->plugin['text'] ), | |
| 138 | - ), | |
| 139 | -); | |
| 197 | + foreach ( $group as $k => $v ) { | |
| 140 | 198 | |
| 141 | -$button_id_help = array( | |
| 142 | - 'text' => esc_attr__( 'Set the attribute ID for the menu item or left empty.', $this->plugin['text'] ), | |
| 143 | -); | |
| 199 | + foreach ( $v as $key => $val ) { | |
| 200 | + $group_key = $prefix . $key; | |
| 201 | + $data['opt'][ $group_key ] = $val; | |
| 202 | + } | |
| 144 | 203 | |
| 145 | -$button_class_help = array( | |
| 146 | - 'text' => esc_attr__( 'Set the attribute CLASS for the menu item or left empty.', $this->plugin['text'] ), | |
| 147 | -); | |
| 204 | + } | |
| 205 | + } | |
| 206 | +} | |
| 207 | + | |
| 208 | +return $data; | |