Completed
Branch BUG/semantic-nav-tabs (5d1d44)
by
unknown
44:29 queued 35:40
created
espresso.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -38,103 +38,103 @@
 block discarded – undo
38 38
  * @since           4.0
39 39
  */
40 40
 if (function_exists('espresso_version')) {
41
-    if (! function_exists('espresso_duplicate_plugin_error')) {
42
-        /**
43
-         *    espresso_duplicate_plugin_error
44
-         *    displays if more than one version of EE is activated at the same time
45
-         */
46
-        function espresso_duplicate_plugin_error()
47
-        {
48
-            ?>
41
+	if (! function_exists('espresso_duplicate_plugin_error')) {
42
+		/**
43
+		 *    espresso_duplicate_plugin_error
44
+		 *    displays if more than one version of EE is activated at the same time
45
+		 */
46
+		function espresso_duplicate_plugin_error()
47
+		{
48
+			?>
49 49
             <div class="error">
50 50
                 <p>
51 51
                     <?php
52
-                    echo esc_html__(
53
-                        'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
-                        'event_espresso'
55
-                    ); ?>
52
+					echo esc_html__(
53
+						'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
+						'event_espresso'
55
+					); ?>
56 56
                 </p>
57 57
             </div>
58 58
             <?php
59
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
60
-        }
61
-    }
62
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
59
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
60
+		}
61
+	}
62
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
63 63
 } else {
64
-    define('EE_MIN_PHP_VER_REQUIRED', '5.4.0');
65
-    if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
-        /**
67
-         * espresso_minimum_php_version_error
68
-         *
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
64
+	define('EE_MIN_PHP_VER_REQUIRED', '5.4.0');
65
+	if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
+		/**
67
+		 * espresso_minimum_php_version_error
68
+		 *
69
+		 * @return void
70
+		 */
71
+		function espresso_minimum_php_version_error()
72
+		{
73
+			?>
74 74
             <div class="error">
75 75
                 <p>
76 76
                     <?php
77
-                    printf(
78
-                        esc_html__(
79
-                            'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
-                            'event_espresso'
81
-                        ),
82
-                        EE_MIN_PHP_VER_REQUIRED,
83
-                        PHP_VERSION,
84
-                        '<br/>',
85
-                        '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
-                    );
87
-                    ?>
77
+					printf(
78
+						esc_html__(
79
+							'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
+							'event_espresso'
81
+						),
82
+						EE_MIN_PHP_VER_REQUIRED,
83
+						PHP_VERSION,
84
+						'<br/>',
85
+						'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
+					);
87
+					?>
88 88
                 </p>
89 89
             </div>
90 90
             <?php
91
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
92
-        }
91
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
92
+		}
93 93
 
94
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
-    } else {
96
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
-        /**
98
-         * espresso_version
99
-         * Returns the plugin version
100
-         *
101
-         * @return string
102
-         */
103
-        function espresso_version()
104
-        {
105
-            return apply_filters('FHEE__espresso__espresso_version', '4.9.82.rc.014');
106
-        }
94
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
+	} else {
96
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
+		/**
98
+		 * espresso_version
99
+		 * Returns the plugin version
100
+		 *
101
+		 * @return string
102
+		 */
103
+		function espresso_version()
104
+		{
105
+			return apply_filters('FHEE__espresso__espresso_version', '4.9.82.rc.014');
106
+		}
107 107
 
108
-        /**
109
-         * espresso_plugin_activation
110
-         * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
-         */
112
-        function espresso_plugin_activation()
113
-        {
114
-            update_option('ee_espresso_activation', true);
115
-        }
108
+		/**
109
+		 * espresso_plugin_activation
110
+		 * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
+		 */
112
+		function espresso_plugin_activation()
113
+		{
114
+			update_option('ee_espresso_activation', true);
115
+		}
116 116
 
117
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
117
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
118 118
 
119
-        require_once __DIR__ . '/core/bootstrap_espresso.php';
120
-        bootstrap_espresso();
121
-    }
119
+		require_once __DIR__ . '/core/bootstrap_espresso.php';
120
+		bootstrap_espresso();
121
+	}
122 122
 }
123 123
 if (! function_exists('espresso_deactivate_plugin')) {
124
-    /**
125
-     *    deactivate_plugin
126
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
-     *
128
-     * @access public
129
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
-     * @return    void
131
-     */
132
-    function espresso_deactivate_plugin($plugin_basename = '')
133
-    {
134
-        if (! function_exists('deactivate_plugins')) {
135
-            require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
-        }
137
-        unset($_GET['activate'], $_REQUEST['activate']);
138
-        deactivate_plugins($plugin_basename);
139
-    }
124
+	/**
125
+	 *    deactivate_plugin
126
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
+	 *
128
+	 * @access public
129
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
+	 * @return    void
131
+	 */
132
+	function espresso_deactivate_plugin($plugin_basename = '')
133
+	{
134
+		if (! function_exists('deactivate_plugins')) {
135
+			require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
+		}
137
+		unset($_GET['activate'], $_REQUEST['activate']);
138
+		deactivate_plugins($plugin_basename);
139
+	}
140 140
 }
Please login to merge, or discard this patch.
core/helpers/EEH_Tabbed_Content.helper.php 2 patches
Indentation   +192 added lines, -192 removed lines patch added patch discarded remove patch
@@ -21,202 +21,202 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -36,22 +36,22 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.