Passed
Push — master ( 2916ae...16e4f3 )
by
unknown
02:17
created
classes/admin/class-settings.php 2 patches
Indentation   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -9,184 +9,184 @@
 block discarded – undo
9 9
 
10 10
 class Settings {
11 11
 
12
-	/**
13
-	 * Holds class instance
14
-	 *
15
-	 * @since 1.0.0
16
-	 *
17
-	 * @var      object \lsx_team\classes\admin\Settings()
18
-	 */
19
-	protected static $instance = null;
20
-
21
-	/**
22
-	 * Option key, and option page slug
23
-	 *
24
-	 * @var string
25
-	 */
26
-	protected $screen_id = 'lsx_team_settings';
27
-
28
-	/**
29
-	 * Contructor
30
-	 */
31
-	public function __construct() {
32
-		add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) );
33
-		add_action( 'lsx_team_settings_page', array( $this, 'general_settings' ), 1, 1 );
34
-		add_action( 'lsx_team_settings_page', array( $this, 'global_defaults' ), 3, 1 );
35
-	}
36
-
37
-	/**
38
-	 * Return an instance of this class.
39
-	 *
40
-	 * @since 1.0.0
41
-	 *
42
-	 * @return    object Settings()    A single instance of this class.
43
-	 */
44
-	public static function get_instance() {
45
-		// If the single instance hasn't been set, set it now.
46
-		if ( null === self::$instance ) {
47
-			self::$instance = new self();
48
-		}
49
-		return self::$instance;
50
-	}
51
-
52
-	/**
53
-	 * Hook in and register a submenu options page for the Page post-type menu.
54
-	 */
55
-	public function register_settings_page() {
56
-		$cmb = new_cmb2_box(
57
-			array(
58
-				'id'           => $this->screen_id,
59
-				'title'        => esc_html__( 'Settings', 'lsx-team' ),
60
-				'object_types' => array( 'options-page' ),
61
-				'option_key'   => 'lsx_team_options', // The option key and admin menu page slug.
62
-				'parent_slug'  => 'edit.php?post_type=team', // Make options page a submenu item of the themes menu.
63
-				'capability'   => 'manage_options', // Cap required to view options-page.
64
-			)
65
-		);
66
-		do_action( 'lsx_team_settings_page', $cmb );
67
-	}
68
-
69
-	/**
70
-	 * Registers the general settings.
71
-	 *
72
-	 * @param object $cmb new_cmb2_box().
73
-	 * @return void
74
-	 */
75
-	public function general_settings( $cmb ) {
76
-		$cmb->add_field(
77
-			array(
78
-				'id'      => 'settings_general_title',
79
-				'type'    => 'title',
80
-				'name'    => __( 'General', 'lsx-team' ),
81
-				'default' => __( 'General', 'lsx-team' ),
82
-			)
83
-		);
84
-		$cmb->add_field(
85
-			array(
86
-				'name'        => __( 'Disable Single Posts', 'lsx-team' ),
87
-				'id'          => 'team_disable_single',
88
-				'type'        => 'checkbox',
89
-				'value'       => 1,
90
-				'default'     => 0,
91
-				'description' => __( 'Disable Single Posts.', 'lsx-health-plan' ),
92
-			)
93
-		);
94
-
95
-		$cmb->add_field(
96
-			array(
97
-				'name'        => __( 'Group By Role', 'lsx-team' ),
98
-				'id'          => 'group_by_role',
99
-				'type'        => 'checkbox',
100
-				'value'       => 1,
101
-				'default'     => 0,
102
-				'description' => __( 'This setting creates Role sub-headings on the Team Member archive.', 'lsx-health-plan' ),
103
-			)
104
-		);
105
-		$cmb->add_field( array(
106
-			'name'    => 'Placeholder',
107
-			'desc'    => __( 'This image displays on the archive, search results and team members single if not featured image is set.', 'lsx-health-plan' ),
108
-			'id'      => 'team_placeholder',
109
-			'type'    => 'file',
110
-			'options' => array(
111
-				'url' => false, // Hide the text input for the url.
112
-			),
113
-			'text'    => array(
114
-				'add_upload_file_text' => 'Choose Image',
115
-			),
116
-		) );
117
-		$cmb->add_field(
118
-			array(
119
-				'id'   => 'settings_general_closing',
120
-				'type' => 'tab_closing',
121
-			)
122
-		);
123
-	}
124
-
125
-	/**
126
-	 * Registers the global default settings.
127
-	 *
128
-	 * @param object $cmb new_cmb2_box().
129
-	 * @return void
130
-	 */
131
-	public function global_defaults( $cmb ) {
132
-		$cmb->add_field(
133
-			array(
134
-				'id'      => 'global_defaults_title',
135
-				'type'    => 'title',
136
-				'name'    => __( 'Careers CTA', 'lsx-team' ),
137
-				'default' => __( 'Careers CTA', 'lsx-team' ),
138
-			)
139
-		);
140
-
141
-		$cmb->add_field(
142
-			array(
143
-				'name'        => __( 'Enable careers CTA', 'lsx-team' ),
144
-				'id'          => 'team_careers_cta_enable',
145
-				'type'        => 'checkbox',
146
-				'value'       => 1,
147
-				'default'     => 0,
148
-				'description' => __( 'Displays careers CTA mystery man on team archive.', 'lsx-health-plan' ),
149
-			)
150
-		);
151
-
152
-		$cmb->add_field(
153
-			array(
154
-				'name' => __( 'Title', 'lsx-team' ),
155
-				'id'   => 'team_careers_cta_title',
156
-				'type' => 'text',
157
-			)
158
-		);
159
-
160
-		$cmb->add_field(
161
-			array(
162
-				'name' => __( 'Tagline', 'lsx-team' ),
163
-				'id'   => 'team_careers_cta_tagline',
164
-				'type' => 'text',
165
-			)
166
-		);
167
-
168
-		$cmb->add_field(
169
-			array(
170
-				'name' => __( 'Link Text', 'lsx-team' ),
171
-				'id'   => 'team_careers_cta_link_text',
172
-				'type' => 'text',
173
-			)
174
-		);
175
-
176
-		$cmb->add_field(
177
-			array(
178
-				'name' => __( 'Careers page link', 'lsx-team' ),
179
-				'id'   => 'team_careers_cta_link',
180
-				'type' => 'text',
181
-			)
182
-		);
183
-
184
-		$cmb->add_field(
185
-			array(
186
-				'id'   => 'settings_global_defaults_closing',
187
-				'type' => 'tab_closing',
188
-			)
189
-		);
190
-	}
12
+     /**
13
+      * Holds class instance
14
+      *
15
+      * @since 1.0.0
16
+      *
17
+      * @var      object \lsx_team\classes\admin\Settings()
18
+      */
19
+     protected static $instance = null;
20
+
21
+     /**
22
+      * Option key, and option page slug
23
+      *
24
+      * @var string
25
+      */
26
+     protected $screen_id = 'lsx_team_settings';
27
+
28
+     /**
29
+      * Contructor
30
+      */
31
+     public function __construct() {
32
+          add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) );
33
+          add_action( 'lsx_team_settings_page', array( $this, 'general_settings' ), 1, 1 );
34
+          add_action( 'lsx_team_settings_page', array( $this, 'global_defaults' ), 3, 1 );
35
+     }
36
+
37
+     /**
38
+      * Return an instance of this class.
39
+      *
40
+      * @since 1.0.0
41
+      *
42
+      * @return    object Settings()    A single instance of this class.
43
+      */
44
+     public static function get_instance() {
45
+          // If the single instance hasn't been set, set it now.
46
+          if ( null === self::$instance ) {
47
+               self::$instance = new self();
48
+          }
49
+          return self::$instance;
50
+     }
51
+
52
+     /**
53
+      * Hook in and register a submenu options page for the Page post-type menu.
54
+      */
55
+     public function register_settings_page() {
56
+          $cmb = new_cmb2_box(
57
+               array(
58
+                    'id'           => $this->screen_id,
59
+                    'title'        => esc_html__( 'Settings', 'lsx-team' ),
60
+                    'object_types' => array( 'options-page' ),
61
+                    'option_key'   => 'lsx_team_options', // The option key and admin menu page slug.
62
+                    'parent_slug'  => 'edit.php?post_type=team', // Make options page a submenu item of the themes menu.
63
+                    'capability'   => 'manage_options', // Cap required to view options-page.
64
+               )
65
+          );
66
+          do_action( 'lsx_team_settings_page', $cmb );
67
+     }
68
+
69
+     /**
70
+      * Registers the general settings.
71
+      *
72
+      * @param object $cmb new_cmb2_box().
73
+      * @return void
74
+      */
75
+     public function general_settings( $cmb ) {
76
+          $cmb->add_field(
77
+               array(
78
+                    'id'      => 'settings_general_title',
79
+                    'type'    => 'title',
80
+                    'name'    => __( 'General', 'lsx-team' ),
81
+                    'default' => __( 'General', 'lsx-team' ),
82
+               )
83
+          );
84
+          $cmb->add_field(
85
+               array(
86
+                    'name'        => __( 'Disable Single Posts', 'lsx-team' ),
87
+                    'id'          => 'team_disable_single',
88
+                    'type'        => 'checkbox',
89
+                    'value'       => 1,
90
+                    'default'     => 0,
91
+                    'description' => __( 'Disable Single Posts.', 'lsx-health-plan' ),
92
+               )
93
+          );
94
+
95
+          $cmb->add_field(
96
+               array(
97
+                    'name'        => __( 'Group By Role', 'lsx-team' ),
98
+                    'id'          => 'group_by_role',
99
+                    'type'        => 'checkbox',
100
+                    'value'       => 1,
101
+                    'default'     => 0,
102
+                    'description' => __( 'This setting creates Role sub-headings on the Team Member archive.', 'lsx-health-plan' ),
103
+               )
104
+          );
105
+          $cmb->add_field( array(
106
+               'name'    => 'Placeholder',
107
+               'desc'    => __( 'This image displays on the archive, search results and team members single if not featured image is set.', 'lsx-health-plan' ),
108
+               'id'      => 'team_placeholder',
109
+               'type'    => 'file',
110
+               'options' => array(
111
+                    'url' => false, // Hide the text input for the url.
112
+               ),
113
+               'text'    => array(
114
+                    'add_upload_file_text' => 'Choose Image',
115
+               ),
116
+          ) );
117
+          $cmb->add_field(
118
+               array(
119
+                    'id'   => 'settings_general_closing',
120
+                    'type' => 'tab_closing',
121
+               )
122
+          );
123
+     }
124
+
125
+     /**
126
+      * Registers the global default settings.
127
+      *
128
+      * @param object $cmb new_cmb2_box().
129
+      * @return void
130
+      */
131
+     public function global_defaults( $cmb ) {
132
+          $cmb->add_field(
133
+               array(
134
+                    'id'      => 'global_defaults_title',
135
+                    'type'    => 'title',
136
+                    'name'    => __( 'Careers CTA', 'lsx-team' ),
137
+                    'default' => __( 'Careers CTA', 'lsx-team' ),
138
+               )
139
+          );
140
+
141
+          $cmb->add_field(
142
+               array(
143
+                    'name'        => __( 'Enable careers CTA', 'lsx-team' ),
144
+                    'id'          => 'team_careers_cta_enable',
145
+                    'type'        => 'checkbox',
146
+                    'value'       => 1,
147
+                    'default'     => 0,
148
+                    'description' => __( 'Displays careers CTA mystery man on team archive.', 'lsx-health-plan' ),
149
+               )
150
+          );
151
+
152
+          $cmb->add_field(
153
+               array(
154
+                    'name' => __( 'Title', 'lsx-team' ),
155
+                    'id'   => 'team_careers_cta_title',
156
+                    'type' => 'text',
157
+               )
158
+          );
159
+
160
+          $cmb->add_field(
161
+               array(
162
+                    'name' => __( 'Tagline', 'lsx-team' ),
163
+                    'id'   => 'team_careers_cta_tagline',
164
+                    'type' => 'text',
165
+               )
166
+          );
167
+
168
+          $cmb->add_field(
169
+               array(
170
+                    'name' => __( 'Link Text', 'lsx-team' ),
171
+                    'id'   => 'team_careers_cta_link_text',
172
+                    'type' => 'text',
173
+               )
174
+          );
175
+
176
+          $cmb->add_field(
177
+               array(
178
+                    'name' => __( 'Careers page link', 'lsx-team' ),
179
+                    'id'   => 'team_careers_cta_link',
180
+                    'type' => 'text',
181
+               )
182
+          );
183
+
184
+          $cmb->add_field(
185
+               array(
186
+                    'id'   => 'settings_global_defaults_closing',
187
+                    'type' => 'tab_closing',
188
+               )
189
+          );
190
+     }
191 191
 
192 192
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	 * Contructor
30 30
 	 */
31 31
 	public function __construct() {
32
-		add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) );
33
-		add_action( 'lsx_team_settings_page', array( $this, 'general_settings' ), 1, 1 );
34
-		add_action( 'lsx_team_settings_page', array( $this, 'global_defaults' ), 3, 1 );
32
+		add_action('cmb2_admin_init', array($this, 'register_settings_page'));
33
+		add_action('lsx_team_settings_page', array($this, 'general_settings'), 1, 1);
34
+		add_action('lsx_team_settings_page', array($this, 'global_defaults'), 3, 1);
35 35
 	}
36 36
 
37 37
 	/**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public static function get_instance() {
45 45
 		// If the single instance hasn't been set, set it now.
46
-		if ( null === self::$instance ) {
46
+		if (null === self::$instance) {
47 47
 			self::$instance = new self();
48 48
 		}
49 49
 		return self::$instance;
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
 		$cmb = new_cmb2_box(
57 57
 			array(
58 58
 				'id'           => $this->screen_id,
59
-				'title'        => esc_html__( 'Settings', 'lsx-team' ),
60
-				'object_types' => array( 'options-page' ),
59
+				'title'        => esc_html__('Settings', 'lsx-team'),
60
+				'object_types' => array('options-page'),
61 61
 				'option_key'   => 'lsx_team_options', // The option key and admin menu page slug.
62 62
 				'parent_slug'  => 'edit.php?post_type=team', // Make options page a submenu item of the themes menu.
63 63
 				'capability'   => 'manage_options', // Cap required to view options-page.
64 64
 			)
65 65
 		);
66
-		do_action( 'lsx_team_settings_page', $cmb );
66
+		do_action('lsx_team_settings_page', $cmb);
67 67
 	}
68 68
 
69 69
 	/**
@@ -72,39 +72,39 @@  discard block
 block discarded – undo
72 72
 	 * @param object $cmb new_cmb2_box().
73 73
 	 * @return void
74 74
 	 */
75
-	public function general_settings( $cmb ) {
75
+	public function general_settings($cmb) {
76 76
 		$cmb->add_field(
77 77
 			array(
78 78
 				'id'      => 'settings_general_title',
79 79
 				'type'    => 'title',
80
-				'name'    => __( 'General', 'lsx-team' ),
81
-				'default' => __( 'General', 'lsx-team' ),
80
+				'name'    => __('General', 'lsx-team'),
81
+				'default' => __('General', 'lsx-team'),
82 82
 			)
83 83
 		);
84 84
 		$cmb->add_field(
85 85
 			array(
86
-				'name'        => __( 'Disable Single Posts', 'lsx-team' ),
86
+				'name'        => __('Disable Single Posts', 'lsx-team'),
87 87
 				'id'          => 'team_disable_single',
88 88
 				'type'        => 'checkbox',
89 89
 				'value'       => 1,
90 90
 				'default'     => 0,
91
-				'description' => __( 'Disable Single Posts.', 'lsx-health-plan' ),
91
+				'description' => __('Disable Single Posts.', 'lsx-health-plan'),
92 92
 			)
93 93
 		);
94 94
 
95 95
 		$cmb->add_field(
96 96
 			array(
97
-				'name'        => __( 'Group By Role', 'lsx-team' ),
97
+				'name'        => __('Group By Role', 'lsx-team'),
98 98
 				'id'          => 'group_by_role',
99 99
 				'type'        => 'checkbox',
100 100
 				'value'       => 1,
101 101
 				'default'     => 0,
102
-				'description' => __( 'This setting creates Role sub-headings on the Team Member archive.', 'lsx-health-plan' ),
102
+				'description' => __('This setting creates Role sub-headings on the Team Member archive.', 'lsx-health-plan'),
103 103
 			)
104 104
 		);
105
-		$cmb->add_field( array(
105
+		$cmb->add_field(array(
106 106
 			'name'    => 'Placeholder',
107
-			'desc'    => __( 'This image displays on the archive, search results and team members single if not featured image is set.', 'lsx-health-plan' ),
107
+			'desc'    => __('This image displays on the archive, search results and team members single if not featured image is set.', 'lsx-health-plan'),
108 108
 			'id'      => 'team_placeholder',
109 109
 			'type'    => 'file',
110 110
 			'options' => array(
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 			'text'    => array(
114 114
 				'add_upload_file_text' => 'Choose Image',
115 115
 			),
116
-		) );
116
+		));
117 117
 		$cmb->add_field(
118 118
 			array(
119 119
 				'id'   => 'settings_general_closing',
@@ -128,30 +128,30 @@  discard block
 block discarded – undo
128 128
 	 * @param object $cmb new_cmb2_box().
129 129
 	 * @return void
130 130
 	 */
131
-	public function global_defaults( $cmb ) {
131
+	public function global_defaults($cmb) {
132 132
 		$cmb->add_field(
133 133
 			array(
134 134
 				'id'      => 'global_defaults_title',
135 135
 				'type'    => 'title',
136
-				'name'    => __( 'Careers CTA', 'lsx-team' ),
137
-				'default' => __( 'Careers CTA', 'lsx-team' ),
136
+				'name'    => __('Careers CTA', 'lsx-team'),
137
+				'default' => __('Careers CTA', 'lsx-team'),
138 138
 			)
139 139
 		);
140 140
 
141 141
 		$cmb->add_field(
142 142
 			array(
143
-				'name'        => __( 'Enable careers CTA', 'lsx-team' ),
143
+				'name'        => __('Enable careers CTA', 'lsx-team'),
144 144
 				'id'          => 'team_careers_cta_enable',
145 145
 				'type'        => 'checkbox',
146 146
 				'value'       => 1,
147 147
 				'default'     => 0,
148
-				'description' => __( 'Displays careers CTA mystery man on team archive.', 'lsx-health-plan' ),
148
+				'description' => __('Displays careers CTA mystery man on team archive.', 'lsx-health-plan'),
149 149
 			)
150 150
 		);
151 151
 
152 152
 		$cmb->add_field(
153 153
 			array(
154
-				'name' => __( 'Title', 'lsx-team' ),
154
+				'name' => __('Title', 'lsx-team'),
155 155
 				'id'   => 'team_careers_cta_title',
156 156
 				'type' => 'text',
157 157
 			)
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
 		$cmb->add_field(
161 161
 			array(
162
-				'name' => __( 'Tagline', 'lsx-team' ),
162
+				'name' => __('Tagline', 'lsx-team'),
163 163
 				'id'   => 'team_careers_cta_tagline',
164 164
 				'type' => 'text',
165 165
 			)
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 
168 168
 		$cmb->add_field(
169 169
 			array(
170
-				'name' => __( 'Link Text', 'lsx-team' ),
170
+				'name' => __('Link Text', 'lsx-team'),
171 171
 				'id'   => 'team_careers_cta_link_text',
172 172
 				'type' => 'text',
173 173
 			)
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
 		$cmb->add_field(
177 177
 			array(
178
-				'name' => __( 'Careers page link', 'lsx-team' ),
178
+				'name' => __('Careers page link', 'lsx-team'),
179 179
 				'id'   => 'team_careers_cta_link',
180 180
 				'type' => 'text',
181 181
 			)
Please login to merge, or discard this patch.