@@ -21,202 +21,202 @@ |
||
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * assembles and returns the html structure for tabs |
|
| 26 | - * |
|
| 27 | - * @static |
|
| 28 | - * @param array $tabs_contents an array of the content for each tab [required] |
|
| 29 | - * @param array $tabs_names an unassociative array of names for each tab [optional] - if this isn't included then we use the indexes for $tabs_content as the tab names) |
|
| 30 | - * @param bool $small_tabs |
|
| 31 | - * @param bool $tabs_content |
|
| 32 | - * @return string the assembled html string containing the tabbed content for display. |
|
| 33 | - * @throws \EE_Error |
|
| 34 | - */ |
|
| 35 | - public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = true) |
|
| 36 | - { |
|
| 37 | - |
|
| 38 | - // first check if $tabs_names is not empty then the count must match the count of $tabs_content otherwise we've got a problem houston |
|
| 39 | - if (!empty($tabs_names) && ( count((array) $tabs_names) != count((array) $tabs_content) )) { |
|
| 40 | - throw new EE_Error(esc_html__('The count for $tabs_names and $tabs_content does not match.', 'event_espresso')); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - // make sure we've got incoming data setup properly |
|
| 44 | - $tabs = !empty($tabs_names) ? (array) $tabs_names : array_keys((array) $tabs_contents); |
|
| 45 | - $tabs_content = !empty($tabs_names) ? array_combine((array) $tabs_names, (array) $tabs_content) : $tabs_contents; |
|
| 46 | - |
|
| 47 | - $all_tabs = '<h2 class="nav-tab-wrapper">' . "\n"; |
|
| 48 | - $all_tabs_content = ''; |
|
| 49 | - |
|
| 50 | - $index = 0; |
|
| 51 | - foreach ($tabs as $tab) { |
|
| 52 | - $active = $index === 0 ? true : false; |
|
| 53 | - $all_tabs .= self::tab($tab, $active); |
|
| 54 | - $all_tabs_content .= self::tab_content($tab, $tabs_content[ $tab ], $active); |
|
| 55 | - $index++; |
|
| 56 | - } |
|
| 57 | - /* |
|
| 24 | + /** |
|
| 25 | + * assembles and returns the html structure for tabs |
|
| 26 | + * |
|
| 27 | + * @static |
|
| 28 | + * @param array $tabs_contents an array of the content for each tab [required] |
|
| 29 | + * @param array $tabs_names an unassociative array of names for each tab [optional] - if this isn't included then we use the indexes for $tabs_content as the tab names) |
|
| 30 | + * @param bool $small_tabs |
|
| 31 | + * @param bool $tabs_content |
|
| 32 | + * @return string the assembled html string containing the tabbed content for display. |
|
| 33 | + * @throws \EE_Error |
|
| 34 | + */ |
|
| 35 | + public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = true) |
|
| 36 | + { |
|
| 37 | + |
|
| 38 | + // first check if $tabs_names is not empty then the count must match the count of $tabs_content otherwise we've got a problem houston |
|
| 39 | + if (!empty($tabs_names) && ( count((array) $tabs_names) != count((array) $tabs_content) )) { |
|
| 40 | + throw new EE_Error(esc_html__('The count for $tabs_names and $tabs_content does not match.', 'event_espresso')); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + // make sure we've got incoming data setup properly |
|
| 44 | + $tabs = !empty($tabs_names) ? (array) $tabs_names : array_keys((array) $tabs_contents); |
|
| 45 | + $tabs_content = !empty($tabs_names) ? array_combine((array) $tabs_names, (array) $tabs_content) : $tabs_contents; |
|
| 46 | + |
|
| 47 | + $all_tabs = '<h2 class="nav-tab-wrapper">' . "\n"; |
|
| 48 | + $all_tabs_content = ''; |
|
| 49 | + |
|
| 50 | + $index = 0; |
|
| 51 | + foreach ($tabs as $tab) { |
|
| 52 | + $active = $index === 0 ? true : false; |
|
| 53 | + $all_tabs .= self::tab($tab, $active); |
|
| 54 | + $all_tabs_content .= self::tab_content($tab, $tabs_content[ $tab ], $active); |
|
| 55 | + $index++; |
|
| 56 | + } |
|
| 57 | + /* |
|
| 58 | 58 | sample content for testing |
| 59 | 59 | |
| 60 | 60 | $all_tabs .= '<a class="nav-tab" rel="ee-tab-anothertab" href="#anothertab">Another Tab</a>'; |
| 61 | 61 | $all_tabs_content .= '<div class="nav-tab-content hidden" id="ee-tab-anothertab">This is just some sample content to show another tab<div style="clear:both"></div></div>'; |
| 62 | 62 | //end sample content /**/ |
| 63 | 63 | |
| 64 | - $all_tabs .= '</h2>'; |
|
| 65 | - |
|
| 66 | - $tab_container_class = $small_tabs ? 'ee-nav-tabs ee-nav-tabs-small' : 'ee-nav-tabs'; |
|
| 67 | - |
|
| 68 | - return '<div class="'. $tab_container_class . '">' . "\n\t" . $all_tabs . $all_tabs_content . "\n" . '</div>'; |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * display_admin_nav_tabs |
|
| 75 | - * this returns the properly formatted tab html for EE_Admin_Pages. |
|
| 76 | - * We are expecting an array of tabs in the following format |
|
| 77 | - * array( |
|
| 78 | - * 'nav_tab_name' => array( |
|
| 79 | - * 'url' => 'url for tab', |
|
| 80 | - * 'link_text' => 'tab text', |
|
| 81 | - * 'css_class' => 'tab class' //including the nav-tab-active class if its active |
|
| 82 | - * ) |
|
| 83 | - * ) |
|
| 84 | - * |
|
| 85 | - * @access public |
|
| 86 | - * @static |
|
| 87 | - * @param array $nav_tabs tab array for nav tabs |
|
| 88 | - * @return string |
|
| 89 | - * @throws \EE_Error |
|
| 90 | - */ |
|
| 91 | - public static function display_admin_nav_tabs($nav_tabs = array()) |
|
| 92 | - { |
|
| 93 | - if (empty($nav_tabs)) { |
|
| 94 | - throw new EE_Error(esc_html__('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso')); |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - $all_tabs = '<nav class="nav-tab-wrapper wp-clearfix" aria-label="' . esc_attr__('Secondary menu', 'event_espresso') . '">' . "\n"; |
|
| 98 | - foreach ($nav_tabs as $slug => $tab) { |
|
| 99 | - $all_tabs .= self::tab($slug, false, $tab['link_text'], $tab['url'], $tab['css_class']); |
|
| 100 | - } |
|
| 101 | - $all_tabs .= '</nav>'; |
|
| 102 | - return $all_tabs; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * this simply returns a single tab given a tab name & content |
|
| 107 | - * @param string $name name of tab |
|
| 108 | - * @param bool $active true=tab active, false=tab not active |
|
| 109 | - * @param bool|string $nice_name if string given then this value will be used for the tab link text. |
|
| 110 | - * @param bool|string $url If url given then tabs will be generated linking to the url. |
|
| 111 | - * @param bool|string $css If string given then the generated tab will include that as the class. |
|
| 112 | - * @return string html for tab |
|
| 113 | - */ |
|
| 114 | - private static function tab($name, $active = false, $nice_name = false, $url = false, $css = false) |
|
| 115 | - { |
|
| 116 | - $name = str_replace(' ', '-', $name); |
|
| 117 | - $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
|
| 118 | - $class = $css ? $class . ' ' . $css : $class; |
|
| 119 | - $nice_name = $nice_name ? $nice_name : ucwords(preg_replace('/(-|_)/', ' ', $name)); |
|
| 120 | - $url = $url ? $url : '#' . $name; |
|
| 121 | - $tab = '<a class="' . $class . '" rel="ee-tab-' . $name . '" href="' . $url . '">' . $nice_name . '</a>' . "\n\t"; |
|
| 122 | - return $tab; |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * this just returns the properly formatted tab content for our tab box. |
|
| 129 | - * |
|
| 130 | - * @param string $name name of tab (used for selector) |
|
| 131 | - * @param string $tab_content content of tab |
|
| 132 | - * @param bool $active |
|
| 133 | - * @return string html for content area |
|
| 134 | - */ |
|
| 135 | - private static function tab_content($name, $tab_content, $active = false) |
|
| 136 | - { |
|
| 137 | - $class = $active ? 'nav-tab-content' : 'nav-tab-content hidden'; |
|
| 138 | - $name = str_replace(' ', '-', $name); |
|
| 139 | - $content = "\t" . '<div class="'. $class . '" id="ee-tab-' . $name . '">' . "\n"; |
|
| 140 | - $content .= "\t" . $tab_content . "\n"; |
|
| 141 | - $content .= '<div style="clear:both"></div></div>'; |
|
| 142 | - return $content; |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - |
|
| 146 | - |
|
| 147 | - /** HORIZONTAL TEXT LINKS **/ |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * This will take in an array of link items and spit out a formatted list of links that can be used to navigate to items. |
|
| 151 | - * There is a corresponding js file that can be loaded to dynamically display containers with the same id as the href -ref. |
|
| 152 | - * |
|
| 153 | - * @param array $item_array formatted array of items. Format: |
|
| 154 | - * array( |
|
| 155 | - * 'label' => __('localized label displayed'), |
|
| 156 | - * 'class' => 'class_for_item', |
|
| 157 | - * 'href' => '#some_item_id', //url/bookmark for item. If you include a bookmark the js will used this to show the container div. |
|
| 158 | - * 'title' => __('localized text for the title attribute of the link'), |
|
| 159 | - * 'slug' => 'slug_used_for_reference' |
|
| 160 | - * ) |
|
| 161 | - * @param string $container_class class used for main container |
|
| 162 | - * @param string $sep you can add in what is used as a separator between each link (or leave blank for none) |
|
| 163 | - * @param string $default You can include a string for the item that will receive the "item_display" class for the js. |
|
| 164 | - * @return string a html snippet of of all the formatted link elements. |
|
| 165 | - */ |
|
| 166 | - public static function tab_text_links($item_array, $container_class = '', $sep = '|', $default = '') |
|
| 167 | - { |
|
| 168 | - $item_array = apply_filters('FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class); |
|
| 169 | - if (!is_array($item_array) || empty($item_array)) { |
|
| 170 | - return false; // get out we don't have even the basic thing we need! |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - |
|
| 174 | - $defaults = array( |
|
| 175 | - 'label' => esc_html__('Item', 'event_espresso'), |
|
| 176 | - 'class' => '', |
|
| 177 | - 'href' => '', |
|
| 178 | - 'title' => esc_attr__('Link for Item', 'event_espresso'), |
|
| 179 | - 'slug' => 'item_slug' |
|
| 180 | - ); |
|
| 181 | - $container_class = !empty($container_class) ? 'ee-text-links ' . $container_class : 'ee-text-links'; |
|
| 182 | - $list = '<ul class="' . $container_class . '">'; |
|
| 183 | - |
|
| 184 | - $ci = 1; |
|
| 185 | - foreach ($item_array as $item) { |
|
| 186 | - $item = wp_parse_args($item, $defaults); |
|
| 187 | - $item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class']; |
|
| 188 | - $list .= self::_text_link_item($item); |
|
| 189 | - if (!empty($sep) && $ci != count($item_array)) { |
|
| 190 | - $list .= self::_text_link_item($sep); |
|
| 191 | - } |
|
| 192 | - $ci++; |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - $list .= '</ul>'; |
|
| 196 | - return $list; |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - |
|
| 200 | - |
|
| 201 | - private static function _text_link_item($item) |
|
| 202 | - { |
|
| 203 | - // if this isn't an array then we're doing a separator |
|
| 204 | - if (!is_array($item)) { |
|
| 205 | - $label = $item; |
|
| 206 | - $class = 'ee-text-link-sep'; |
|
| 207 | - $href = ''; |
|
| 208 | - $title = ''; |
|
| 209 | - } else { |
|
| 210 | - extract($item); |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - $class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li ' . $class . '"' : 'class="ee-text-link-sep"'; |
|
| 214 | - |
|
| 215 | - $content = '<li ' . $class . '>'; |
|
| 216 | - $content .= !empty($href) ? '<a class="ee-text-link" href="#' . $href . '" title="' . $title . '">' : ''; |
|
| 217 | - $content .= $label; |
|
| 218 | - $content .= !empty($href) ? '</a>' : ''; |
|
| 219 | - $content .= '</li>'; |
|
| 220 | - return $content; |
|
| 221 | - } |
|
| 64 | + $all_tabs .= '</h2>'; |
|
| 65 | + |
|
| 66 | + $tab_container_class = $small_tabs ? 'ee-nav-tabs ee-nav-tabs-small' : 'ee-nav-tabs'; |
|
| 67 | + |
|
| 68 | + return '<div class="'. $tab_container_class . '">' . "\n\t" . $all_tabs . $all_tabs_content . "\n" . '</div>'; |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * display_admin_nav_tabs |
|
| 75 | + * this returns the properly formatted tab html for EE_Admin_Pages. |
|
| 76 | + * We are expecting an array of tabs in the following format |
|
| 77 | + * array( |
|
| 78 | + * 'nav_tab_name' => array( |
|
| 79 | + * 'url' => 'url for tab', |
|
| 80 | + * 'link_text' => 'tab text', |
|
| 81 | + * 'css_class' => 'tab class' //including the nav-tab-active class if its active |
|
| 82 | + * ) |
|
| 83 | + * ) |
|
| 84 | + * |
|
| 85 | + * @access public |
|
| 86 | + * @static |
|
| 87 | + * @param array $nav_tabs tab array for nav tabs |
|
| 88 | + * @return string |
|
| 89 | + * @throws \EE_Error |
|
| 90 | + */ |
|
| 91 | + public static function display_admin_nav_tabs($nav_tabs = array()) |
|
| 92 | + { |
|
| 93 | + if (empty($nav_tabs)) { |
|
| 94 | + throw new EE_Error(esc_html__('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso')); |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + $all_tabs = '<nav class="nav-tab-wrapper wp-clearfix" aria-label="' . esc_attr__('Secondary menu', 'event_espresso') . '">' . "\n"; |
|
| 98 | + foreach ($nav_tabs as $slug => $tab) { |
|
| 99 | + $all_tabs .= self::tab($slug, false, $tab['link_text'], $tab['url'], $tab['css_class']); |
|
| 100 | + } |
|
| 101 | + $all_tabs .= '</nav>'; |
|
| 102 | + return $all_tabs; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * this simply returns a single tab given a tab name & content |
|
| 107 | + * @param string $name name of tab |
|
| 108 | + * @param bool $active true=tab active, false=tab not active |
|
| 109 | + * @param bool|string $nice_name if string given then this value will be used for the tab link text. |
|
| 110 | + * @param bool|string $url If url given then tabs will be generated linking to the url. |
|
| 111 | + * @param bool|string $css If string given then the generated tab will include that as the class. |
|
| 112 | + * @return string html for tab |
|
| 113 | + */ |
|
| 114 | + private static function tab($name, $active = false, $nice_name = false, $url = false, $css = false) |
|
| 115 | + { |
|
| 116 | + $name = str_replace(' ', '-', $name); |
|
| 117 | + $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
|
| 118 | + $class = $css ? $class . ' ' . $css : $class; |
|
| 119 | + $nice_name = $nice_name ? $nice_name : ucwords(preg_replace('/(-|_)/', ' ', $name)); |
|
| 120 | + $url = $url ? $url : '#' . $name; |
|
| 121 | + $tab = '<a class="' . $class . '" rel="ee-tab-' . $name . '" href="' . $url . '">' . $nice_name . '</a>' . "\n\t"; |
|
| 122 | + return $tab; |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * this just returns the properly formatted tab content for our tab box. |
|
| 129 | + * |
|
| 130 | + * @param string $name name of tab (used for selector) |
|
| 131 | + * @param string $tab_content content of tab |
|
| 132 | + * @param bool $active |
|
| 133 | + * @return string html for content area |
|
| 134 | + */ |
|
| 135 | + private static function tab_content($name, $tab_content, $active = false) |
|
| 136 | + { |
|
| 137 | + $class = $active ? 'nav-tab-content' : 'nav-tab-content hidden'; |
|
| 138 | + $name = str_replace(' ', '-', $name); |
|
| 139 | + $content = "\t" . '<div class="'. $class . '" id="ee-tab-' . $name . '">' . "\n"; |
|
| 140 | + $content .= "\t" . $tab_content . "\n"; |
|
| 141 | + $content .= '<div style="clear:both"></div></div>'; |
|
| 142 | + return $content; |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + |
|
| 146 | + |
|
| 147 | + /** HORIZONTAL TEXT LINKS **/ |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * This will take in an array of link items and spit out a formatted list of links that can be used to navigate to items. |
|
| 151 | + * There is a corresponding js file that can be loaded to dynamically display containers with the same id as the href -ref. |
|
| 152 | + * |
|
| 153 | + * @param array $item_array formatted array of items. Format: |
|
| 154 | + * array( |
|
| 155 | + * 'label' => __('localized label displayed'), |
|
| 156 | + * 'class' => 'class_for_item', |
|
| 157 | + * 'href' => '#some_item_id', //url/bookmark for item. If you include a bookmark the js will used this to show the container div. |
|
| 158 | + * 'title' => __('localized text for the title attribute of the link'), |
|
| 159 | + * 'slug' => 'slug_used_for_reference' |
|
| 160 | + * ) |
|
| 161 | + * @param string $container_class class used for main container |
|
| 162 | + * @param string $sep you can add in what is used as a separator between each link (or leave blank for none) |
|
| 163 | + * @param string $default You can include a string for the item that will receive the "item_display" class for the js. |
|
| 164 | + * @return string a html snippet of of all the formatted link elements. |
|
| 165 | + */ |
|
| 166 | + public static function tab_text_links($item_array, $container_class = '', $sep = '|', $default = '') |
|
| 167 | + { |
|
| 168 | + $item_array = apply_filters('FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class); |
|
| 169 | + if (!is_array($item_array) || empty($item_array)) { |
|
| 170 | + return false; // get out we don't have even the basic thing we need! |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + |
|
| 174 | + $defaults = array( |
|
| 175 | + 'label' => esc_html__('Item', 'event_espresso'), |
|
| 176 | + 'class' => '', |
|
| 177 | + 'href' => '', |
|
| 178 | + 'title' => esc_attr__('Link for Item', 'event_espresso'), |
|
| 179 | + 'slug' => 'item_slug' |
|
| 180 | + ); |
|
| 181 | + $container_class = !empty($container_class) ? 'ee-text-links ' . $container_class : 'ee-text-links'; |
|
| 182 | + $list = '<ul class="' . $container_class . '">'; |
|
| 183 | + |
|
| 184 | + $ci = 1; |
|
| 185 | + foreach ($item_array as $item) { |
|
| 186 | + $item = wp_parse_args($item, $defaults); |
|
| 187 | + $item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class']; |
|
| 188 | + $list .= self::_text_link_item($item); |
|
| 189 | + if (!empty($sep) && $ci != count($item_array)) { |
|
| 190 | + $list .= self::_text_link_item($sep); |
|
| 191 | + } |
|
| 192 | + $ci++; |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + $list .= '</ul>'; |
|
| 196 | + return $list; |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + |
|
| 200 | + |
|
| 201 | + private static function _text_link_item($item) |
|
| 202 | + { |
|
| 203 | + // if this isn't an array then we're doing a separator |
|
| 204 | + if (!is_array($item)) { |
|
| 205 | + $label = $item; |
|
| 206 | + $class = 'ee-text-link-sep'; |
|
| 207 | + $href = ''; |
|
| 208 | + $title = ''; |
|
| 209 | + } else { |
|
| 210 | + extract($item); |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + $class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li ' . $class . '"' : 'class="ee-text-link-sep"'; |
|
| 214 | + |
|
| 215 | + $content = '<li ' . $class . '>'; |
|
| 216 | + $content .= !empty($href) ? '<a class="ee-text-link" href="#' . $href . '" title="' . $title . '">' : ''; |
|
| 217 | + $content .= $label; |
|
| 218 | + $content .= !empty($href) ? '</a>' : ''; |
|
| 219 | + $content .= '</li>'; |
|
| 220 | + return $content; |
|
| 221 | + } |
|
| 222 | 222 | } |
@@ -36,22 +36,22 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | |
| 38 | 38 | // first check if $tabs_names is not empty then the count must match the count of $tabs_content otherwise we've got a problem houston |
| 39 | - if (!empty($tabs_names) && ( count((array) $tabs_names) != count((array) $tabs_content) )) { |
|
| 39 | + if ( ! empty($tabs_names) && (count((array) $tabs_names) != count((array) $tabs_content))) { |
|
| 40 | 40 | throw new EE_Error(esc_html__('The count for $tabs_names and $tabs_content does not match.', 'event_espresso')); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // make sure we've got incoming data setup properly |
| 44 | - $tabs = !empty($tabs_names) ? (array) $tabs_names : array_keys((array) $tabs_contents); |
|
| 45 | - $tabs_content = !empty($tabs_names) ? array_combine((array) $tabs_names, (array) $tabs_content) : $tabs_contents; |
|
| 44 | + $tabs = ! empty($tabs_names) ? (array) $tabs_names : array_keys((array) $tabs_contents); |
|
| 45 | + $tabs_content = ! empty($tabs_names) ? array_combine((array) $tabs_names, (array) $tabs_content) : $tabs_contents; |
|
| 46 | 46 | |
| 47 | - $all_tabs = '<h2 class="nav-tab-wrapper">' . "\n"; |
|
| 47 | + $all_tabs = '<h2 class="nav-tab-wrapper">'."\n"; |
|
| 48 | 48 | $all_tabs_content = ''; |
| 49 | 49 | |
| 50 | 50 | $index = 0; |
| 51 | 51 | foreach ($tabs as $tab) { |
| 52 | 52 | $active = $index === 0 ? true : false; |
| 53 | 53 | $all_tabs .= self::tab($tab, $active); |
| 54 | - $all_tabs_content .= self::tab_content($tab, $tabs_content[ $tab ], $active); |
|
| 54 | + $all_tabs_content .= self::tab_content($tab, $tabs_content[$tab], $active); |
|
| 55 | 55 | $index++; |
| 56 | 56 | } |
| 57 | 57 | /* |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | $tab_container_class = $small_tabs ? 'ee-nav-tabs ee-nav-tabs-small' : 'ee-nav-tabs'; |
| 67 | 67 | |
| 68 | - return '<div class="'. $tab_container_class . '">' . "\n\t" . $all_tabs . $all_tabs_content . "\n" . '</div>'; |
|
| 68 | + return '<div class="'.$tab_container_class.'">'."\n\t".$all_tabs.$all_tabs_content."\n".'</div>'; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | throw new EE_Error(esc_html__('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso')); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - $all_tabs = '<nav class="nav-tab-wrapper wp-clearfix" aria-label="' . esc_attr__('Secondary menu', 'event_espresso') . '">' . "\n"; |
|
| 97 | + $all_tabs = '<nav class="nav-tab-wrapper wp-clearfix" aria-label="'.esc_attr__('Secondary menu', 'event_espresso').'">'."\n"; |
|
| 98 | 98 | foreach ($nav_tabs as $slug => $tab) { |
| 99 | 99 | $all_tabs .= self::tab($slug, false, $tab['link_text'], $tab['url'], $tab['css_class']); |
| 100 | 100 | } |
@@ -115,10 +115,10 @@ discard block |
||
| 115 | 115 | { |
| 116 | 116 | $name = str_replace(' ', '-', $name); |
| 117 | 117 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
| 118 | - $class = $css ? $class . ' ' . $css : $class; |
|
| 118 | + $class = $css ? $class.' '.$css : $class; |
|
| 119 | 119 | $nice_name = $nice_name ? $nice_name : ucwords(preg_replace('/(-|_)/', ' ', $name)); |
| 120 | - $url = $url ? $url : '#' . $name; |
|
| 121 | - $tab = '<a class="' . $class . '" rel="ee-tab-' . $name . '" href="' . $url . '">' . $nice_name . '</a>' . "\n\t"; |
|
| 120 | + $url = $url ? $url : '#'.$name; |
|
| 121 | + $tab = '<a class="'.$class.'" rel="ee-tab-'.$name.'" href="'.$url.'">'.$nice_name.'</a>'."\n\t"; |
|
| 122 | 122 | return $tab; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | { |
| 137 | 137 | $class = $active ? 'nav-tab-content' : 'nav-tab-content hidden'; |
| 138 | 138 | $name = str_replace(' ', '-', $name); |
| 139 | - $content = "\t" . '<div class="'. $class . '" id="ee-tab-' . $name . '">' . "\n"; |
|
| 140 | - $content .= "\t" . $tab_content . "\n"; |
|
| 139 | + $content = "\t".'<div class="'.$class.'" id="ee-tab-'.$name.'">'."\n"; |
|
| 140 | + $content .= "\t".$tab_content."\n"; |
|
| 141 | 141 | $content .= '<div style="clear:both"></div></div>'; |
| 142 | 142 | return $content; |
| 143 | 143 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | public static function tab_text_links($item_array, $container_class = '', $sep = '|', $default = '') |
| 167 | 167 | { |
| 168 | 168 | $item_array = apply_filters('FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class); |
| 169 | - if (!is_array($item_array) || empty($item_array)) { |
|
| 169 | + if ( ! is_array($item_array) || empty($item_array)) { |
|
| 170 | 170 | return false; // get out we don't have even the basic thing we need! |
| 171 | 171 | } |
| 172 | 172 | |
@@ -178,15 +178,15 @@ discard block |
||
| 178 | 178 | 'title' => esc_attr__('Link for Item', 'event_espresso'), |
| 179 | 179 | 'slug' => 'item_slug' |
| 180 | 180 | ); |
| 181 | - $container_class = !empty($container_class) ? 'ee-text-links ' . $container_class : 'ee-text-links'; |
|
| 182 | - $list = '<ul class="' . $container_class . '">'; |
|
| 181 | + $container_class = ! empty($container_class) ? 'ee-text-links '.$container_class : 'ee-text-links'; |
|
| 182 | + $list = '<ul class="'.$container_class.'">'; |
|
| 183 | 183 | |
| 184 | 184 | $ci = 1; |
| 185 | 185 | foreach ($item_array as $item) { |
| 186 | 186 | $item = wp_parse_args($item, $defaults); |
| 187 | - $item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class']; |
|
| 187 | + $item['class'] = ! empty($default) && $default == $item['slug'] ? 'item_display '.$item['class'] : $item['class']; |
|
| 188 | 188 | $list .= self::_text_link_item($item); |
| 189 | - if (!empty($sep) && $ci != count($item_array)) { |
|
| 189 | + if ( ! empty($sep) && $ci != count($item_array)) { |
|
| 190 | 190 | $list .= self::_text_link_item($sep); |
| 191 | 191 | } |
| 192 | 192 | $ci++; |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | private static function _text_link_item($item) |
| 202 | 202 | { |
| 203 | 203 | // if this isn't an array then we're doing a separator |
| 204 | - if (!is_array($item)) { |
|
| 204 | + if ( ! is_array($item)) { |
|
| 205 | 205 | $label = $item; |
| 206 | 206 | $class = 'ee-text-link-sep'; |
| 207 | 207 | $href = ''; |
@@ -210,12 +210,12 @@ discard block |
||
| 210 | 210 | extract($item); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - $class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li ' . $class . '"' : 'class="ee-text-link-sep"'; |
|
| 213 | + $class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li '.$class.'"' : 'class="ee-text-link-sep"'; |
|
| 214 | 214 | |
| 215 | - $content = '<li ' . $class . '>'; |
|
| 216 | - $content .= !empty($href) ? '<a class="ee-text-link" href="#' . $href . '" title="' . $title . '">' : ''; |
|
| 215 | + $content = '<li '.$class.'>'; |
|
| 216 | + $content .= ! empty($href) ? '<a class="ee-text-link" href="#'.$href.'" title="'.$title.'">' : ''; |
|
| 217 | 217 | $content .= $label; |
| 218 | - $content .= !empty($href) ? '</a>' : ''; |
|
| 218 | + $content .= ! empty($href) ? '</a>' : ''; |
|
| 219 | 219 | $content .= '</li>'; |
| 220 | 220 | return $content; |
| 221 | 221 | } |