Passed
Push — master ( cc0eaf...f066ab )
by Warwick
04:07 queued 10s
created
classes/admin/class-settings-theme.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
 	 * Contructor
37 37
 	 */
38 38
 	public function __construct() {
39
-		add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 );
40
-		add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 );
41
-		add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 );
42
-		add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 );
43
-		add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 );
44
-		add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 );
45
-		add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 );
46
-		add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 );
39
+		add_filter('cmb2_enqueue_css', array($this, 'disable_cmb2_styles'), 1, 1);
40
+		add_action('cmb2_before_form', array($this, 'generate_navigation'), 10, 4);
41
+		add_action('cmb2_before_title_field_row', array($this, 'output_tab_open_div'), 10, 1);
42
+		add_action('cmb2_after_tab_closing_field_row', array($this, 'output_tab_closing_div'), 10, 1);
43
+		add_action('cmb2_render_tab_closing', array($this, 'cmb2_render_callback_for_tab_closing'), 10, 5);
44
+		add_filter('cmb2_sanitize_tab_closing', array($this, 'cmb2_sanitize_tab_closing_callback'), 10, 2);
45
+		add_action('cmb2_after_form', array($this, 'navigation_js'), 10, 4);
46
+		add_filter('cmb2_options_page_redirect_url', array($this, 'add_tab_argument'), 10, 1);
47 47
 	}
48 48
 
49 49
 	/**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public static function get_instance() {
57 57
 		// If the single instance hasn't been set, set it now.
58
-		if ( null == self::$instance ) {
58
+		if (null == self::$instance) {
59 59
 			self::$instance = new self();
60 60
 		}
61 61
 		return self::$instance;
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @return bool $enabled Whether to enable (enqueue) styles.
68 68
 	 */
69
-	public function disable_cmb2_styles( $enabled ) {
70
-		if ( is_admin() ) {
69
+	public function disable_cmb2_styles($enabled) {
70
+		if (is_admin()) {
71 71
 			$current_screen = get_current_screen();
72
-			if ( is_object( $current_screen ) && 'team_page_lsx_team_options' === $current_screen->id ) {
72
+			if (is_object($current_screen) && 'team_page_lsx_team_options' === $current_screen->id) {
73 73
 				$enabled = false;
74 74
 			}
75 75
 		}
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
 	 * @param object $cmb2_obj
86 86
 	 * @return void
87 87
 	 */
88
-	public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) {
89
-		if ( 'lsx_team_settings' === $cmb_id && 'lsx_team_options' === $object_id && 'options-page' === $object_type ) {
88
+	public function generate_navigation($cmb_id, $object_id, $object_type, $cmb2_obj) {
89
+		if ('lsx_team_settings' === $cmb_id && 'lsx_team_options' === $object_id && 'options-page' === $object_type) {
90 90
 			$this->navigation      = array();
91 91
 			$this->is_options_page = true;
92
-			if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) {
93
-				foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) {
94
-					if ( 'title' === $field['type'] ) {
95
-						$this->navigation[ $field_index ] = $field['name'];
92
+			if (isset($cmb2_obj->meta_box['fields']) && !empty($cmb2_obj->meta_box['fields'])) {
93
+				foreach ($cmb2_obj->meta_box['fields'] as $field_index => $field) {
94
+					if ('title' === $field['type']) {
95
+						$this->navigation[$field_index] = $field['name'];
96 96
 					}
97 97
 				}
98 98
 			}
@@ -106,32 +106,32 @@  discard block
 block discarded – undo
106 106
 	 * @return void
107 107
 	 */
108 108
 	public function output_navigation() {
109
-		if ( ! empty( $this->navigation ) ) {
109
+		if (!empty($this->navigation)) {
110 110
 			?>
111 111
 			<div class="wp-filter hide-if-no-js">
112 112
 				<ul class="filter-links">
113 113
 					<?php
114 114
 					$first_tab    = true;
115
-					$total        = count( $this->navigation );
115
+					$total        = count($this->navigation);
116 116
 					$count        = 0;
117 117
 					$separator    = ' |';
118 118
 					$selected_tab = '';
119
-					if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) {
120
-						$selected_tab  = sanitize_text_field( wp_unslash( $_GET['cmb_tab'] ) );
121
-						$selected_tab  = 'settings_' . $selected_tab;
119
+					if (isset($_GET['cmb_tab']) && '' !== $_GET['cmb_tab']) {
120
+						$selected_tab  = sanitize_text_field(wp_unslash($_GET['cmb_tab']));
121
+						$selected_tab  = 'settings_'.$selected_tab;
122 122
 					}
123
-					foreach ( $this->navigation as $key => $label ) {
123
+					foreach ($this->navigation as $key => $label) {
124 124
 						$count++;
125 125
 						$current_css = '';
126
-						if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) {
126
+						if ((true === $first_tab && '' === $selected_tab) || $key === $selected_tab) {
127 127
 							$first_tab   = false;
128 128
 							$current_css = 'current';
129 129
 						}
130
-						if ( $count === $total ) {
130
+						if ($count === $total) {
131 131
 							$separator = '';
132 132
 						}
133 133
 						?>
134
-							<li><a href="#" class="<?php echo esc_attr( $current_css ); ?>" data-sort="<?php echo esc_attr( $key ); ?>_tab"><?php echo esc_attr( $label ); ?></a><?php echo esc_attr( $separator ); ?></li>
134
+							<li><a href="#" class="<?php echo esc_attr($current_css); ?>" data-sort="<?php echo esc_attr($key); ?>_tab"><?php echo esc_attr($label); ?></a><?php echo esc_attr($separator); ?></li>
135 135
 						<?php
136 136
 					}
137 137
 					?>
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 	 * @param object $field CMB2_Field();
148 148
 	 * @return void
149 149
 	 */
150
-	public function output_tab_open_div( $field ) {
151
-		if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) {
150
+	public function output_tab_open_div($field) {
151
+		if (true === $this->is_options_page && isset($field->args['type']) && 'title' === $field->args['type']) {
152 152
 			?>
153
-			<div id="<?php echo esc_attr( $field->args['id'] ); ?>_tab" class="tab tab-nav hidden">
153
+			<div id="<?php echo esc_attr($field->args['id']); ?>_tab" class="tab tab-nav hidden">
154 154
 			<?php
155 155
 		}
156 156
 	}
@@ -161,19 +161,19 @@  discard block
 block discarded – undo
161 161
 	 * @param object $field CMB2_Field();
162 162
 	 * @return void
163 163
 	 */
164
-	public function output_tab_closing_div( $field ) {
165
-		if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) {
164
+	public function output_tab_closing_div($field) {
165
+		if (true === $this->is_options_page && isset($field->args['type']) && 'tab_closing' === $field->args['type']) {
166 166
 			?>
167 167
 			</div>
168 168
 			<?php
169 169
 		}
170 170
 	}
171 171
 
172
-	public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) {
172
+	public function cmb2_render_callback_for_tab_closing($field, $escaped_value, $object_id, $object_type, $field_type_object) {
173 173
 		return;
174 174
 	}
175 175
 
176
-	public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) {
176
+	public function cmb2_sanitize_tab_closing_callback($override_value, $value) {
177 177
 		return '';
178 178
 	}
179 179
 
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 	 * @param object $cmb2_obj
187 187
 	 * @return void
188 188
 	 */
189
-	public function navigation_js( $cmb_id, $object_id, $object_type, $cmb2_obj ) {
190
-		if ( 'lsx_team_settings' === $cmb_id && 'lsx_team_options' === $object_id && 'options-page' === $object_type ) {
189
+	public function navigation_js($cmb_id, $object_id, $object_type, $cmb2_obj) {
190
+		if ('lsx_team_settings' === $cmb_id && 'lsx_team_options' === $object_id && 'options-page' === $object_type) {
191 191
 			?>
192 192
 			<script>
193 193
 				var LSX_TEAM_CMB2 = Object.create( null );
@@ -270,14 +270,14 @@  discard block
 block discarded – undo
270 270
 	 * @param string $url
271 271
 	 * @return void
272 272
 	 */
273
-	public function add_tab_argument( $url ) {
274
-		if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine
275
-			$tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine
276
-			$tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine
277
-			if ( 'single' !== $tab_selection ) {
278
-				$url = add_query_arg( 'cmb_tab', $tab_selection, $url );
273
+	public function add_tab_argument($url) {
274
+		if (isset($_POST['cmb_tab']) && '' !== $_POST['cmb_tab']) { // @codingStandardsIgnoreLine
275
+			$tab_selection = sanitize_text_field($_POST['cmb_tab']); // @codingStandardsIgnoreLine
276
+			$tab_selection = str_replace(array('settings_', '_tab'), '', $tab_selection); // @codingStandardsIgnoreLine
277
+			if ('single' !== $tab_selection) {
278
+				$url = add_query_arg('cmb_tab', $tab_selection, $url);
279 279
 			} else {
280
-				$url = remove_query_arg( 'cmb_tab', $url );
280
+				$url = remove_query_arg('cmb_tab', $url);
281 281
 			}
282 282
 		}
283 283
 		return $url;
Please login to merge, or discard this patch.