Completed
Push — master ( 80c0ca...82d23b )
by Dwain
04:32
created
includes/class-sensei-analysis-overview-list-table.php 3 patches
Braces   +8 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
5
+// Exit if accessed directly
3 6
 
4 7
 /**
5 8
  * Sensei Analysis Overview List Table Class
@@ -306,8 +309,7 @@  discard block
 block discarded – undo
306 309
 				// Output course data
307 310
 				if ( $this->csv_output ) {
308 311
 					$course_title = apply_filters( 'the_title', $item->post_title, $item->ID );
309
-				}
310
-				else {
312
+				} else {
311 313
 					$url = add_query_arg( array( 'page' => $this->page_slug, 'course_id' => $item->ID ), admin_url( 'admin.php' ) );
312 314
 
313 315
 					$course_title = '<strong><a class="row-title" href="' . esc_url( $url ) . '">' . apply_filters( 'the_title', $item->post_title, $item->ID ) . '</a></strong>';
@@ -363,16 +365,14 @@  discard block
 block discarded – undo
363 365
 				// Output lesson data
364 366
 				if ( $this->csv_output ) {
365 367
 					$lesson_title = apply_filters( 'the_title', $item->post_title, $item->ID );
366
-				}
367
-				else {
368
+				} else {
368 369
 					$url = add_query_arg( array( 'page' => $this->page_slug, 'lesson_id' => $item->ID ), admin_url( 'admin.php' ) );
369 370
 					$lesson_title = '<strong><a class="row-title" href="' . esc_url( $url ) . '">' . apply_filters( 'the_title', $item->post_title, $item->ID ) . '</a></strong>';
370 371
 
371 372
 					if ( $course_id ) {
372 373
 						$url = add_query_arg( array( 'page' => $this->page_slug, 'course_id' => $course_id ), admin_url( 'admin.php' ) );
373 374
 						$course_title = '<a href="' . esc_url( $url ) . '">' . $course_title . '</a>';
374
-					}
375
-					else {
375
+					} else {
376 376
 						$course_title = __('n/a', 'woothemes-sensei');
377 377
 					}
378 378
 					if ( is_numeric( $lesson_average_grade ) ) {
@@ -423,8 +423,7 @@  discard block
 block discarded – undo
423 423
 				// Output the users data
424 424
 				if ( $this->csv_output ) {
425 425
                     $user_name = Sensei()->learners->get_learner_full_name( $item->ID );
426
-                }
427
-				else {
426
+                } else {
428 427
 					$url = add_query_arg( array( 'page' => $this->page_slug, 'user_id' => $item->ID ), admin_url( 'admin.php' ) );
429 428
 					$user_name = '<strong><a class="row-title" href="' . esc_url( $url ) . '">' . $item->display_name . '</a></strong>';
430 429
 					$user_average_grade .= '%';
Please login to merge, or discard this patch.
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 			'order' => $order,
163 163
 		);
164 164
 
165
-        // Handle search
166
-        if ( isset( $_GET['s'] ) && !empty( $_GET['s'] ) ) {
167
-            $args['search'] = esc_html( $_GET['s'] );
168
-        }
165
+		// Handle search
166
+		if ( isset( $_GET['s'] ) && !empty( $_GET['s'] ) ) {
167
+			$args['search'] = esc_html( $_GET['s'] );
168
+		}
169 169
 
170 170
 		switch ( $this->type ) {
171 171
 			case 'courses':
@@ -222,10 +222,10 @@  discard block
 block discarded – undo
222 222
 		);
223 223
 
224 224
 
225
-        // Handle search
226
-        if ( isset( $_GET['s'] ) && !empty( $_GET['s'] ) ) {
227
-            $args['search'] = esc_html( $_GET['s'] );
228
-        }
225
+		// Handle search
226
+		if ( isset( $_GET['s'] ) && !empty( $_GET['s'] ) ) {
227
+			$args['search'] = esc_html( $_GET['s'] );
228
+		}
229 229
 
230 230
 
231 231
 		// Start the csv with the column headings
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 * Generates the overall array for a single item in the display
264 264
 	 * @since  1.7.0
265 265
 	 * @param object $item The current item
266
-     * @return array $column_data;
266
+	 * @return array $column_data;
267 267
 	 */
268 268
 	protected function get_row_data( $item ) {
269 269
 
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
 
423 423
 				// Output the users data
424 424
 				if ( $this->csv_output ) {
425
-                    $user_name = Sensei_Student::get_full_name( $item->ID );
426
-                }
425
+					$user_name = Sensei_Student::get_full_name( $item->ID );
426
+				}
427 427
 				else {
428 428
 					$url = add_query_arg( array( 'page' => $this->page_slug, 'user_id' => $item->ID ), admin_url( 'admin.php' ) );
429 429
 					$user_name = '<strong><a class="row-title" href="' . esc_url( $url ) . '">' . $item->display_name . '</a></strong>';
@@ -517,17 +517,17 @@  discard block
 block discarded – undo
517 517
 		// This stops the full meta data of each user being loaded
518 518
 		$args['fields'] = array( 'ID', 'user_login', 'user_email', 'user_registered', 'display_name' );
519 519
 
520
-        /**
521
-         * Filter the WP_User_Query arguments
522
-         * @since 1.6.0
523
-         * @param $args
524
-         */
525
-        $args = apply_filters( 'sensei_analysis_overview_filter_users', $args );
520
+		/**
521
+		 * Filter the WP_User_Query arguments
522
+		 * @since 1.6.0
523
+		 * @param $args
524
+		 */
525
+		$args = apply_filters( 'sensei_analysis_overview_filter_users', $args );
526 526
 		$wp_user_search = new WP_User_Query( $args );
527
-        $learners = $wp_user_search->get_results();
527
+		$learners = $wp_user_search->get_results();
528 528
 		$this->total_items = $wp_user_search->get_total();
529 529
 
530
-        return $learners;
530
+		return $learners;
531 531
 
532 532
 	} // End get_learners()
533 533
 
Please login to merge, or discard this patch.
Spacing   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly
3 3
 
4 4
 /**
5 5
  * Sensei Analysis Overview List Table Class
@@ -21,17 +21,17 @@  discard block
 block discarded – undo
21 21
 	 * @since  1.2.0
22 22
 	 * @return  void
23 23
 	 */
24
-	public function __construct ( $type = 'users' ) {
25
-		$this->type = in_array( $type, array( 'courses', 'lessons', 'users' ) ) ? $type : 'users';
24
+	public function __construct($type = 'users') {
25
+		$this->type = in_array($type, array('courses', 'lessons', 'users')) ? $type : 'users';
26 26
 
27 27
 		// Load Parent token into constructor
28
-		parent::__construct( 'analysis_overview' );
28
+		parent::__construct('analysis_overview');
29 29
 
30 30
 		// Actions
31
-		add_action( 'sensei_before_list_table', array( $this, 'data_table_header' ) );
32
-		add_action( 'sensei_after_list_table', array( $this, 'data_table_footer' ) );
31
+		add_action('sensei_before_list_table', array($this, 'data_table_header'));
32
+		add_action('sensei_after_list_table', array($this, 'data_table_footer'));
33 33
 
34
-		add_filter( 'sensei_list_table_search_button_text', array( $this, 'search_button' ) );
34
+		add_filter('sensei_list_table_search_button_text', array($this, 'search_button'));
35 35
 	} // End __construct()
36 36
 
37 37
 	/**
@@ -41,41 +41,41 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	function get_columns() {
43 43
 
44
-		switch( $this->type ) {
44
+		switch ($this->type) {
45 45
 			case 'courses':
46 46
 				$columns = array(
47
-					'title' => __( 'Course', 'woothemes-sensei' ),
48
-					'students' => __( 'Learners', 'woothemes-sensei' ),
49
-					'lessons' => __( 'Lessons', 'woothemes-sensei' ),
50
-					'completions' => __( 'Completed', 'woothemes-sensei' ),
51
-					'average_percent' => __( 'Average Percentage', 'woothemes-sensei' ),
47
+					'title' => __('Course', 'woothemes-sensei'),
48
+					'students' => __('Learners', 'woothemes-sensei'),
49
+					'lessons' => __('Lessons', 'woothemes-sensei'),
50
+					'completions' => __('Completed', 'woothemes-sensei'),
51
+					'average_percent' => __('Average Percentage', 'woothemes-sensei'),
52 52
 				);
53 53
 				break;
54 54
 
55 55
 			case 'lessons':
56 56
 				$columns = array(
57
-					'title' => __( 'Lesson', 'woothemes-sensei' ),
58
-					'course' => __( 'Course', 'woothemes-sensei' ),
59
-					'students' => __( 'Learners', 'woothemes-sensei' ),
60
-					'completions' => __( 'Completed', 'woothemes-sensei' ),
61
-					'average_grade' => __( 'Average Grade', 'woothemes-sensei' ),
57
+					'title' => __('Lesson', 'woothemes-sensei'),
58
+					'course' => __('Course', 'woothemes-sensei'),
59
+					'students' => __('Learners', 'woothemes-sensei'),
60
+					'completions' => __('Completed', 'woothemes-sensei'),
61
+					'average_grade' => __('Average Grade', 'woothemes-sensei'),
62 62
 				);
63 63
 				break;
64 64
 
65 65
 			case 'users':
66 66
 			default:
67 67
 				$columns = array(
68
-					'title' => __( 'Learner', 'woothemes-sensei' ),
69
-					'registered' => __( 'Date Registered', 'woothemes-sensei' ),
70
-					'active_courses' => __( 'Active Courses', 'woothemes-sensei' ),
71
-					'completed_courses' => __( 'Completed Courses', 'woothemes-sensei' ),
72
-					'average_grade' => __( 'Average Grade', 'woothemes-sensei' ),
68
+					'title' => __('Learner', 'woothemes-sensei'),
69
+					'registered' => __('Date Registered', 'woothemes-sensei'),
70
+					'active_courses' => __('Active Courses', 'woothemes-sensei'),
71
+					'completed_courses' => __('Completed Courses', 'woothemes-sensei'),
72
+					'average_grade' => __('Average Grade', 'woothemes-sensei'),
73 73
 				);
74 74
 				break;
75 75
 		}
76 76
 		// Backwards compatible filter name, moving forward should have single filter name
77
-		$columns = apply_filters( 'sensei_analysis_overview_' . $this->type . '_columns', $columns, $this );
78
-		$columns = apply_filters( 'sensei_analysis_overview_columns', $columns, $this );
77
+		$columns = apply_filters('sensei_analysis_overview_'.$this->type.'_columns', $columns, $this);
78
+		$columns = apply_filters('sensei_analysis_overview_columns', $columns, $this);
79 79
 		return $columns;
80 80
 	}
81 81
 
@@ -86,41 +86,41 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	function get_sortable_columns() {
88 88
 
89
-		switch( $this->type ) {
89
+		switch ($this->type) {
90 90
 			case 'courses':
91 91
 				$columns = array(
92
-					'title' => array( 'title', false ),
93
-					'students' => array( 'students', false ),
94
-					'lessons' => array( 'lessons', false ),
95
-					'completions' => array( 'completions', false ),
96
-					'average_percent' => array( 'average_percent', false ),
92
+					'title' => array('title', false),
93
+					'students' => array('students', false),
94
+					'lessons' => array('lessons', false),
95
+					'completions' => array('completions', false),
96
+					'average_percent' => array('average_percent', false),
97 97
 				);
98 98
 				break;
99 99
 
100 100
 			case 'lessons':
101 101
 				$columns = array(
102
-					'title' => array( 'title', false ),
103
-					'course' => array( 'course', false ),
104
-					'students' => array( 'students', false ),
105
-					'completions' => array( 'completions', false ),
106
-					'average_grade' => array( 'average_grade', false ),
102
+					'title' => array('title', false),
103
+					'course' => array('course', false),
104
+					'students' => array('students', false),
105
+					'completions' => array('completions', false),
106
+					'average_grade' => array('average_grade', false),
107 107
 				);
108 108
 				break;
109 109
 
110 110
 			case 'users':
111 111
 			default:
112 112
 				$columns = array(
113
-					'title' => array( 'user_login', false ),
114
-					'registered' => array( 'registered', false ),
115
-					'active_courses' => array( 'active_courses', false ),
116
-					'completed_courses' => array( 'completed_courses', false ),
117
-					'average_grade' => array( 'average_grade', false )
113
+					'title' => array('user_login', false),
114
+					'registered' => array('registered', false),
115
+					'active_courses' => array('active_courses', false),
116
+					'completed_courses' => array('completed_courses', false),
117
+					'average_grade' => array('average_grade', false)
118 118
 				);
119 119
 				break;
120 120
 		}
121 121
 		// Backwards compatible filter name, moving forward should have single filter name
122
-		$columns = apply_filters( 'sensei_analysis_overview_' . $this->type . '_columns_sortable', $columns, $this );
123
-		$columns = apply_filters( 'sensei_analysis_overview_columns_sortable', $columns, $this );
122
+		$columns = apply_filters('sensei_analysis_overview_'.$this->type.'_columns_sortable', $columns, $this);
123
+		$columns = apply_filters('sensei_analysis_overview_columns_sortable', $columns, $this);
124 124
 		return $columns;
125 125
 	}
126 126
 
@@ -134,25 +134,25 @@  discard block
 block discarded – undo
134 134
 
135 135
 		// Handle orderby
136 136
 		$orderby = '';
137
-		if ( !empty( $_GET['orderby'] ) ) {
138
-			if ( array_key_exists( esc_html( $_GET['orderby'] ), $this->get_sortable_columns() ) ) {
139
-				$orderby = esc_html( $_GET['orderby'] );
137
+		if ( ! empty($_GET['orderby'])) {
138
+			if (array_key_exists(esc_html($_GET['orderby']), $this->get_sortable_columns())) {
139
+				$orderby = esc_html($_GET['orderby']);
140 140
 			} // End If Statement
141 141
 		}
142 142
 
143 143
 		// Handle order
144 144
 		$order = 'ASC';
145
-		if ( !empty( $_GET['order'] ) ) {
146
-			$order = ( 'ASC' == strtoupper($_GET['order']) ) ? 'ASC' : 'DESC';
145
+		if ( ! empty($_GET['order'])) {
146
+			$order = ('ASC' == strtoupper($_GET['order'])) ? 'ASC' : 'DESC';
147 147
 		}
148 148
 
149
-		$per_page = $this->get_items_per_page( 'sensei_comments_per_page' );
150
-		$per_page = apply_filters( 'sensei_comments_per_page', $per_page, 'sensei_comments' );
149
+		$per_page = $this->get_items_per_page('sensei_comments_per_page');
150
+		$per_page = apply_filters('sensei_comments_per_page', $per_page, 'sensei_comments');
151 151
 
152 152
 		$paged = $this->get_pagenum();
153 153
 		$offset = 0;
154
-		if ( !empty($paged) ) {
155
-			$offset = $per_page * ( $paged - 1 );
154
+		if ( ! empty($paged)) {
155
+			$offset = $per_page * ($paged - 1);
156 156
 		} // End If Statement
157 157
 
158 158
 		$args = array(
@@ -163,32 +163,32 @@  discard block
 block discarded – undo
163 163
 		);
164 164
 
165 165
         // Handle search
166
-        if ( isset( $_GET['s'] ) && !empty( $_GET['s'] ) ) {
167
-            $args['search'] = esc_html( $_GET['s'] );
166
+        if (isset($_GET['s']) && ! empty($_GET['s'])) {
167
+            $args['search'] = esc_html($_GET['s']);
168 168
         }
169 169
 
170
-		switch ( $this->type ) {
170
+		switch ($this->type) {
171 171
 			case 'courses':
172
-				$this->items = $this->get_courses( $args );
172
+				$this->items = $this->get_courses($args);
173 173
 				break;
174 174
 
175 175
 			case 'lessons':
176
-				$this->items = $this->get_lessons( $args );
176
+				$this->items = $this->get_lessons($args);
177 177
 				break;
178 178
 
179 179
 			case 'users':
180 180
 			default :
181
-				$this->items = $this->get_learners( $args );
181
+				$this->items = $this->get_learners($args);
182 182
 				break;
183 183
 		}
184 184
 
185 185
 		$total_items = $this->total_items;
186
-		$total_pages = ceil( $total_items / $per_page );
187
-		$this->set_pagination_args( array(
186
+		$total_pages = ceil($total_items / $per_page);
187
+		$this->set_pagination_args(array(
188 188
 			'total_items' => $total_items,
189 189
 			'total_pages' => $total_pages,
190 190
 			'per_page' => $per_page
191
-		) );
191
+		));
192 192
 	}
193 193
 
194 194
 	/**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 * @since  1.7.0
197 197
 	 * @return data
198 198
 	 */
199
-	public function generate_report( $report ) {
199
+	public function generate_report($report) {
200 200
 
201 201
 		$data = array();
202 202
 
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
 
205 205
 		// Handle orderby
206 206
 		$orderby = '';
207
-		if ( !empty( $_GET['orderby'] ) ) {
208
-			if ( array_key_exists( esc_html( $_GET['orderby'] ), $this->get_sortable_columns() ) ) {
209
-				$orderby = esc_html( $_GET['orderby'] );
207
+		if ( ! empty($_GET['orderby'])) {
208
+			if (array_key_exists(esc_html($_GET['orderby']), $this->get_sortable_columns())) {
209
+				$orderby = esc_html($_GET['orderby']);
210 210
 			} // End If Statement
211 211
 		}
212 212
 
213 213
 		// Handle order
214 214
 		$order = 'ASC';
215
-		if ( !empty( $_GET['order'] ) ) {
216
-			$order = ( 'ASC' == strtoupper($_GET['order']) ) ? 'ASC' : 'DESC';
215
+		if ( ! empty($_GET['order'])) {
216
+			$order = ('ASC' == strtoupper($_GET['order'])) ? 'ASC' : 'DESC';
217 217
 		}
218 218
 
219 219
 		$args = array(
@@ -223,37 +223,37 @@  discard block
 block discarded – undo
223 223
 
224 224
 
225 225
         // Handle search
226
-        if ( isset( $_GET['s'] ) && !empty( $_GET['s'] ) ) {
227
-            $args['search'] = esc_html( $_GET['s'] );
226
+        if (isset($_GET['s']) && ! empty($_GET['s'])) {
227
+            $args['search'] = esc_html($_GET['s']);
228 228
         }
229 229
 
230 230
 
231 231
 		// Start the csv with the column headings
232 232
 		$column_headers = array();
233 233
 		$columns = $this->get_columns();
234
-		foreach( $columns AS $key => $title ) {
234
+		foreach ($columns AS $key => $title) {
235 235
 			$column_headers[] = $title;
236 236
 		}
237 237
 		$data[] = $column_headers;
238 238
 
239
-		switch ( $this->type ) {
239
+		switch ($this->type) {
240 240
 			case 'courses':
241
-				$this->items = $this->get_courses( $args );
241
+				$this->items = $this->get_courses($args);
242 242
 				break;
243 243
 
244 244
 			case 'lessons':
245
-				$this->items = $this->get_lessons( $args );
245
+				$this->items = $this->get_lessons($args);
246 246
 				break;
247 247
 
248 248
 			case 'users':
249 249
 			default :
250
-				$this->items = $this->get_learners( $args );
250
+				$this->items = $this->get_learners($args);
251 251
 				break;
252 252
 		}
253 253
 
254 254
 		// Process each row
255
-		foreach( $this->items AS $item) {
256
-			$data[] = $this->get_row_data( $item );
255
+		foreach ($this->items AS $item) {
256
+			$data[] = $this->get_row_data($item);
257 257
 		}
258 258
 
259 259
 		return $data;
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
 	 * @param object $item The current item
266 266
      * @return array $column_data;
267 267
 	 */
268
-	protected function get_row_data( $item ) {
268
+	protected function get_row_data($item) {
269 269
 
270
-		switch( $this->type ) {
270
+		switch ($this->type) {
271 271
 			case 'courses' :
272 272
 				// Get Learners (i.e. those who have started)
273 273
 				$course_args = array( 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 						'type' => 'sensei_course_status',
276 276
 						'status' => 'any',
277 277
 					);
278
-				$course_students = Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_analysis_course_learners', $course_args, $item ) );
278
+				$course_students = Sensei_Utils::sensei_check_for_activity(apply_filters('sensei_analysis_course_learners', $course_args, $item));
279 279
 
280 280
 				// Get Course Completions
281 281
 				$course_args = array( 
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
 						'type' => 'sensei_course_status',
284 284
 						'status' => 'complete',
285 285
 					);
286
-				$course_completions = Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_analysis_course_completions', $course_args, $item ) );
286
+				$course_completions = Sensei_Utils::sensei_check_for_activity(apply_filters('sensei_analysis_course_completions', $course_args, $item));
287 287
 
288 288
 				// Course Lessons
289
-				$course_lessons = Sensei()->lesson->lesson_count( array('publish', 'private'), $item->ID );
289
+				$course_lessons = Sensei()->lesson->lesson_count(array('publish', 'private'), $item->ID);
290 290
 
291 291
 				// Get Percent Complete
292 292
 				$grade_args = array( 
@@ -295,30 +295,30 @@  discard block
 block discarded – undo
295 295
 						'status' => 'any',
296 296
 						'meta_key' => 'percent',
297 297
 					);
298
-				add_filter( 'comments_clauses', array( 'WooThemes_Sensei_Utils', 'comment_total_sum_meta_value_filter' ) );
299
-				$course_percentage = Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_analysis_course_percentage', $grade_args, $item ), true );
300
-				remove_filter( 'comments_clauses', array( 'WooThemes_Sensei_Utils', 'comment_total_sum_meta_value_filter' ) );
298
+				add_filter('comments_clauses', array('WooThemes_Sensei_Utils', 'comment_total_sum_meta_value_filter'));
299
+				$course_percentage = Sensei_Utils::sensei_check_for_activity(apply_filters('sensei_analysis_course_percentage', $grade_args, $item), true);
300
+				remove_filter('comments_clauses', array('WooThemes_Sensei_Utils', 'comment_total_sum_meta_value_filter'));
301 301
 
302
-				$percent_count = !empty( $course_percentage->total ) ? $course_percentage->total : 1;
303
-				$percent_total = !empty( $course_percentage->meta_sum ) ? doubleval( $course_percentage->meta_sum ) : 0;
304
-				$course_average_percent = abs( round( doubleval( $percent_total / $percent_count ), 2 ) );
302
+				$percent_count = ! empty($course_percentage->total) ? $course_percentage->total : 1;
303
+				$percent_total = ! empty($course_percentage->meta_sum) ? doubleval($course_percentage->meta_sum) : 0;
304
+				$course_average_percent = abs(round(doubleval($percent_total / $percent_count), 2));
305 305
 
306 306
 				// Output course data
307
-				if ( $this->csv_output ) {
308
-					$course_title = apply_filters( 'the_title', $item->post_title, $item->ID );
307
+				if ($this->csv_output) {
308
+					$course_title = apply_filters('the_title', $item->post_title, $item->ID);
309 309
 				}
310 310
 				else {
311
-					$url = add_query_arg( array( 'page' => $this->page_slug, 'course_id' => $item->ID ), admin_url( 'admin.php' ) );
311
+					$url = add_query_arg(array('page' => $this->page_slug, 'course_id' => $item->ID), admin_url('admin.php'));
312 312
 
313
-					$course_title = '<strong><a class="row-title" href="' . esc_url( $url ) . '">' . apply_filters( 'the_title', $item->post_title, $item->ID ) . '</a></strong>';
313
+					$course_title = '<strong><a class="row-title" href="'.esc_url($url).'">'.apply_filters('the_title', $item->post_title, $item->ID).'</a></strong>';
314 314
 					$course_average_percent .= '%';
315 315
 				} // End If Statement
316
-				$column_data = apply_filters( 'sensei_analysis_overview_column_data', array( 'title' => $course_title,
316
+				$column_data = apply_filters('sensei_analysis_overview_column_data', array('title' => $course_title,
317 317
 												'students' => $course_students,
318 318
 												'lessons' => $course_lessons,
319 319
 												'completions' => $course_completions,
320 320
 												'average_percent' => $course_average_percent,
321
-											), $item, $this );
321
+											), $item, $this);
322 322
 				break;
323 323
 
324 324
 			case 'lessons' :
@@ -328,63 +328,63 @@  discard block
 block discarded – undo
328 328
 						'type' => 'sensei_lesson_status',
329 329
 						'status' => 'any',
330 330
 					);
331
-				$lesson_students = Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_analysis_lesson_learners', $lesson_args, $item ) );
331
+				$lesson_students = Sensei_Utils::sensei_check_for_activity(apply_filters('sensei_analysis_lesson_learners', $lesson_args, $item));
332 332
 
333 333
 				// Get Course Completions
334 334
 				$lesson_args = array( 
335 335
 						'post_id' => $item->ID,
336 336
 						'type' => 'sensei_lesson_status',
337
-						'status' => array( 'complete', 'graded', 'passed', 'failed' ),
337
+						'status' => array('complete', 'graded', 'passed', 'failed'),
338 338
 						'count' => true,
339 339
 					);
340
-				$lesson_completions = Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_analysis_lesson_completions', $lesson_args, $item ) );
340
+				$lesson_completions = Sensei_Utils::sensei_check_for_activity(apply_filters('sensei_analysis_lesson_completions', $lesson_args, $item));
341 341
 
342 342
 				// Course 
343
-				$course_id = get_post_meta( $item->ID, '_lesson_course', true );
344
-				$course_title = $course_id ? get_the_title( $course_id ) : '';
343
+				$course_id = get_post_meta($item->ID, '_lesson_course', true);
344
+				$course_title = $course_id ? get_the_title($course_id) : '';
345 345
 
346 346
 				$lesson_average_grade = __('n/a', 'woothemes-sensei');
347
-				if ( false != get_post_meta($item->ID, '_quiz_has_questions', true) ) {
347
+				if (false != get_post_meta($item->ID, '_quiz_has_questions', true)) {
348 348
 					// Get Percent Complete
349 349
 					$grade_args = array( 
350 350
 							'post_id' => $item->ID,
351 351
 							'type' => 'sensei_lesson_status',
352
-							'status' => array( 'graded', 'passed', 'failed' ),
352
+							'status' => array('graded', 'passed', 'failed'),
353 353
 							'meta_key' => 'grade',
354 354
 						);
355
-					add_filter( 'comments_clauses', array( 'WooThemes_Sensei_Utils', 'comment_total_sum_meta_value_filter' ) );
356
-					$lesson_grades = Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_analysis_lesson_grades', $grade_args, $item ), true );
357
-					remove_filter( 'comments_clauses', array( 'WooThemes_Sensei_Utils', 'comment_total_sum_meta_value_filter' ) );
355
+					add_filter('comments_clauses', array('WooThemes_Sensei_Utils', 'comment_total_sum_meta_value_filter'));
356
+					$lesson_grades = Sensei_Utils::sensei_check_for_activity(apply_filters('sensei_analysis_lesson_grades', $grade_args, $item), true);
357
+					remove_filter('comments_clauses', array('WooThemes_Sensei_Utils', 'comment_total_sum_meta_value_filter'));
358 358
 
359
-					$grade_count = !empty( $lesson_grades->total ) ? $lesson_grades->total : 1;
360
-					$grade_total = !empty( $lesson_grades->meta_sum ) ? doubleval( $lesson_grades->meta_sum ) : 0;
361
-					$lesson_average_grade = abs( round( doubleval( $grade_total / $grade_count ), 2 ) );
359
+					$grade_count = ! empty($lesson_grades->total) ? $lesson_grades->total : 1;
360
+					$grade_total = ! empty($lesson_grades->meta_sum) ? doubleval($lesson_grades->meta_sum) : 0;
361
+					$lesson_average_grade = abs(round(doubleval($grade_total / $grade_count), 2));
362 362
 				}
363 363
 				// Output lesson data
364
-				if ( $this->csv_output ) {
365
-					$lesson_title = apply_filters( 'the_title', $item->post_title, $item->ID );
364
+				if ($this->csv_output) {
365
+					$lesson_title = apply_filters('the_title', $item->post_title, $item->ID);
366 366
 				}
367 367
 				else {
368
-					$url = add_query_arg( array( 'page' => $this->page_slug, 'lesson_id' => $item->ID ), admin_url( 'admin.php' ) );
369
-					$lesson_title = '<strong><a class="row-title" href="' . esc_url( $url ) . '">' . apply_filters( 'the_title', $item->post_title, $item->ID ) . '</a></strong>';
368
+					$url = add_query_arg(array('page' => $this->page_slug, 'lesson_id' => $item->ID), admin_url('admin.php'));
369
+					$lesson_title = '<strong><a class="row-title" href="'.esc_url($url).'">'.apply_filters('the_title', $item->post_title, $item->ID).'</a></strong>';
370 370
 
371
-					if ( $course_id ) {
372
-						$url = add_query_arg( array( 'page' => $this->page_slug, 'course_id' => $course_id ), admin_url( 'admin.php' ) );
373
-						$course_title = '<a href="' . esc_url( $url ) . '">' . $course_title . '</a>';
371
+					if ($course_id) {
372
+						$url = add_query_arg(array('page' => $this->page_slug, 'course_id' => $course_id), admin_url('admin.php'));
373
+						$course_title = '<a href="'.esc_url($url).'">'.$course_title.'</a>';
374 374
 					}
375 375
 					else {
376 376
 						$course_title = __('n/a', 'woothemes-sensei');
377 377
 					}
378
-					if ( is_numeric( $lesson_average_grade ) ) {
378
+					if (is_numeric($lesson_average_grade)) {
379 379
 						$lesson_average_grade .= '%';
380 380
 					}
381 381
 				} // End If Statement
382
-				$column_data = apply_filters( 'sensei_analysis_overview_column_data', array( 'title' => $lesson_title,
382
+				$column_data = apply_filters('sensei_analysis_overview_column_data', array('title' => $lesson_title,
383 383
 												'course' => $course_title,
384 384
 												'students' => $lesson_students,
385 385
 												'completions' => $lesson_completions,
386 386
 												'average_grade' => $lesson_average_grade,
387
-											), $item, $this );
387
+											), $item, $this);
388 388
 				break;
389 389
 
390 390
 			case 'users' :
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 						'type' => 'sensei_course_status',
396 396
 						'status' => 'any',
397 397
 					);
398
-				$user_courses_started = Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_analysis_user_courses_started', $course_args, $item ) );
398
+				$user_courses_started = Sensei_Utils::sensei_check_for_activity(apply_filters('sensei_analysis_user_courses_started', $course_args, $item));
399 399
 
400 400
 				// Get Completed Courses
401 401
 				$course_args = array( 
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 						'type' => 'sensei_course_status',
404 404
 						'status' => 'complete',
405 405
 					);
406
-				$user_courses_ended = Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_analysis_user_courses_ended', $course_args, $item ) );
406
+				$user_courses_ended = Sensei_Utils::sensei_check_for_activity(apply_filters('sensei_analysis_user_courses_ended', $course_args, $item));
407 407
 
408 408
 				// Get Quiz Grades
409 409
 				$grade_args = array( 
@@ -412,29 +412,29 @@  discard block
 block discarded – undo
412 412
 						'status' => 'any',
413 413
 						'meta_key' => 'grade',
414 414
 					);
415
-				add_filter( 'comments_clauses', array( 'WooThemes_Sensei_Utils', 'comment_total_sum_meta_value_filter' ) );
416
-				$user_quiz_grades = Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_analysis_user_lesson_grades', $grade_args, $item ), true );
417
-				remove_filter( 'comments_clauses', array( 'WooThemes_Sensei_Utils', 'comment_total_sum_meta_value_filter' ) );
415
+				add_filter('comments_clauses', array('WooThemes_Sensei_Utils', 'comment_total_sum_meta_value_filter'));
416
+				$user_quiz_grades = Sensei_Utils::sensei_check_for_activity(apply_filters('sensei_analysis_user_lesson_grades', $grade_args, $item), true);
417
+				remove_filter('comments_clauses', array('WooThemes_Sensei_Utils', 'comment_total_sum_meta_value_filter'));
418 418
 
419
-				$grade_count = !empty( $user_quiz_grades->total ) ? $user_quiz_grades->total : 1;
420
-				$grade_total = !empty( $user_quiz_grades->meta_sum ) ? doubleval( $user_quiz_grades->meta_sum ) : 0;
421
-				$user_average_grade = abs( round( doubleval( $grade_total / $grade_count ), 2 ) );
419
+				$grade_count = ! empty($user_quiz_grades->total) ? $user_quiz_grades->total : 1;
420
+				$grade_total = ! empty($user_quiz_grades->meta_sum) ? doubleval($user_quiz_grades->meta_sum) : 0;
421
+				$user_average_grade = abs(round(doubleval($grade_total / $grade_count), 2));
422 422
 
423 423
 				// Output the users data
424
-				if ( $this->csv_output ) {
425
-                    $user_name = Sensei_Student::get_full_name( $item->ID );
424
+				if ($this->csv_output) {
425
+                    $user_name = Sensei_Student::get_full_name($item->ID);
426 426
                 }
427 427
 				else {
428
-					$url = add_query_arg( array( 'page' => $this->page_slug, 'user_id' => $item->ID ), admin_url( 'admin.php' ) );
429
-					$user_name = '<strong><a class="row-title" href="' . esc_url( $url ) . '">' . $item->display_name . '</a></strong>';
428
+					$url = add_query_arg(array('page' => $this->page_slug, 'user_id' => $item->ID), admin_url('admin.php'));
429
+					$user_name = '<strong><a class="row-title" href="'.esc_url($url).'">'.$item->display_name.'</a></strong>';
430 430
 					$user_average_grade .= '%';
431 431
 				} // End If Statement
432
-				$column_data = apply_filters( 'sensei_analysis_overview_column_data', array( 'title' => $user_name,
432
+				$column_data = apply_filters('sensei_analysis_overview_column_data', array('title' => $user_name,
433 433
 												'registered' => $item->user_registered,
434
-												'active_courses' => ( $user_courses_started - $user_courses_ended ),
434
+												'active_courses' => ($user_courses_started - $user_courses_ended),
435 435
 												'completed_courses' => $user_courses_ended,
436 436
 												'average_grade' => $user_average_grade,
437
-											), $item, $this );
437
+											), $item, $this);
438 438
 				break;
439 439
 		} // end switch
440 440
 		return $column_data;
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	 * @since  1.7.0
446 446
 	 * @return array courses
447 447
 	 */
448
-	private function get_courses( $args ) {
448
+	private function get_courses($args) {
449 449
 		$course_args = array(
450 450
 			'post_type' => 'course',
451 451
 			'post_status' => array('publish', 'private'),
@@ -456,16 +456,16 @@  discard block
 block discarded – undo
456 456
 			'suppress_filters' => 0,
457 457
 		);
458 458
 
459
-		if ( $this->csv_output ) {
459
+		if ($this->csv_output) {
460 460
 			$course_args['posts_per_page'] = '-1';
461 461
 		}
462 462
 
463
-		if( isset( $args['search'] ) ) {
463
+		if (isset($args['search'])) {
464 464
 			$course_args['s'] = $args['search'];
465 465
 		}
466 466
 
467 467
 		// Using WP_Query as get_posts() doesn't support 'found_posts'
468
-		$courses_query = new WP_Query( apply_filters( 'sensei_analysis_overview_filter_courses', $course_args ) );
468
+		$courses_query = new WP_Query(apply_filters('sensei_analysis_overview_filter_courses', $course_args));
469 469
 		$this->total_items = $courses_query->found_posts;
470 470
 		return $courses_query->posts;
471 471
 
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 	 * @since  1.7.0
477 477
 	 * @return array lessons
478 478
 	 */
479
-	private function get_lessons( $args ) {
479
+	private function get_lessons($args) {
480 480
 		$lessons_args = array(
481 481
 			'post_type' => 'lesson',
482 482
 			'post_status' => array('publish', 'private'),
@@ -487,16 +487,16 @@  discard block
 block discarded – undo
487 487
 			'suppress_filters' => 0,
488 488
 		);
489 489
 
490
-		if ( $this->csv_output ) {
490
+		if ($this->csv_output) {
491 491
 			$lessons_args['posts_per_page'] = '-1';
492 492
 		}
493 493
 
494
-		if( isset( $args['search'] ) ) {
494
+		if (isset($args['search'])) {
495 495
 			$lessons_args['s'] = $args['search'];
496 496
 		}
497 497
 
498 498
 		// Using WP_Query as get_posts() doesn't support 'found_posts'
499
-		$lessons_query = new WP_Query( apply_filters( 'sensei_analysis_overview_filter_lessons', $lessons_args ) );
499
+		$lessons_query = new WP_Query(apply_filters('sensei_analysis_overview_filter_lessons', $lessons_args));
500 500
 		$this->total_items = $lessons_query->found_posts;
501 501
 		return $lessons_query->posts;
502 502
 	} // End get_lessons()
@@ -506,24 +506,24 @@  discard block
 block discarded – undo
506 506
 	 * @since  1.7.0
507 507
 	 * @return array learners
508 508
 	 */
509
-	private function get_learners( $args ) {
509
+	private function get_learners($args) {
510 510
 
511
-		if ( !empty($args['search']) ) {
511
+		if ( ! empty($args['search'])) {
512 512
 			$args = array(
513
-				'search' => '*' . trim( $args['search'], '*' ) . '*',
513
+				'search' => '*'.trim($args['search'], '*').'*',
514 514
 			);
515 515
 		}
516 516
 
517 517
 		// This stops the full meta data of each user being loaded
518
-		$args['fields'] = array( 'ID', 'user_login', 'user_email', 'user_registered', 'display_name' );
518
+		$args['fields'] = array('ID', 'user_login', 'user_email', 'user_registered', 'display_name');
519 519
 
520 520
         /**
521 521
          * Filter the WP_User_Query arguments
522 522
          * @since 1.6.0
523 523
          * @param $args
524 524
          */
525
-        $args = apply_filters( 'sensei_analysis_overview_filter_users', $args );
526
-		$wp_user_search = new WP_User_Query( $args );
525
+        $args = apply_filters('sensei_analysis_overview_filter_users', $args);
526
+		$wp_user_search = new WP_User_Query($args);
527 527
         $learners = $wp_user_search->get_results();
528 528
 		$this->total_items = $wp_user_search->get_total();
529 529
 
@@ -536,13 +536,13 @@  discard block
 block discarded – undo
536 536
 	 * @since  1.2.0
537 537
 	 * @return array $stats_to_render of stats boxes and values
538 538
 	 */
539
-	public function stats_boxes () {
539
+	public function stats_boxes() {
540 540
 
541 541
 		// Get the data required
542 542
 		$user_count = count_users();
543
-		$user_count = apply_filters( 'sensei_analysis_total_users', $user_count['total_users'], $user_count );
544
-		$total_courses = Sensei()->course->course_count( array('publish', 'private') );
545
-		$total_lessons = Sensei()->lesson->lesson_count( array('publish', 'private') );
543
+		$user_count = apply_filters('sensei_analysis_total_users', $user_count['total_users'], $user_count);
544
+		$total_courses = Sensei()->course->course_count(array('publish', 'private'));
545
+		$total_lessons = Sensei()->lesson->lesson_count(array('publish', 'private'));
546 546
 
547 547
 		$grade_args = array( 
548 548
 				'type' => 'sensei_lesson_status',
@@ -550,36 +550,36 @@  discard block
 block discarded – undo
550 550
 				'meta_key' => 'grade',
551 551
 			);
552 552
 
553
-		add_filter( 'comments_clauses', array( 'WooThemes_Sensei_Utils', 'comment_total_sum_meta_value_filter' ) );
554
-		$total_quiz_grades = Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_analysis_total_quiz_grades', $grade_args ), true );
555
-		remove_filter( 'comments_clauses', array( 'WooThemes_Sensei_Utils', 'comment_total_sum_meta_value_filter' ) );
553
+		add_filter('comments_clauses', array('WooThemes_Sensei_Utils', 'comment_total_sum_meta_value_filter'));
554
+		$total_quiz_grades = Sensei_Utils::sensei_check_for_activity(apply_filters('sensei_analysis_total_quiz_grades', $grade_args), true);
555
+		remove_filter('comments_clauses', array('WooThemes_Sensei_Utils', 'comment_total_sum_meta_value_filter'));
556 556
 
557
-		$total_grade_count = !empty( $total_quiz_grades->total ) ? $total_quiz_grades->total : 1;
558
-		$total_grade_total = !empty( $total_quiz_grades->meta_sum ) ? doubleval( $total_quiz_grades->meta_sum ) : 0;
559
-		$total_average_grade = abs( round( doubleval( $total_grade_total / $total_grade_count ), 2 ) );
557
+		$total_grade_count = ! empty($total_quiz_grades->total) ? $total_quiz_grades->total : 1;
558
+		$total_grade_total = ! empty($total_quiz_grades->meta_sum) ? doubleval($total_quiz_grades->meta_sum) : 0;
559
+		$total_average_grade = abs(round(doubleval($total_grade_total / $total_grade_count), 2));
560 560
 
561 561
 		$course_args = array( 
562 562
 				'type' => 'sensei_course_status',
563 563
 				'status' => 'any',
564 564
 			);
565
-		$total_courses_started = Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_analysis_total_courses_started', $course_args ) );
565
+		$total_courses_started = Sensei_Utils::sensei_check_for_activity(apply_filters('sensei_analysis_total_courses_started', $course_args));
566 566
 		$course_args = array( 
567 567
 				'type' => 'sensei_course_status',
568 568
 				'status' => 'complete',
569 569
 			);
570
-		$total_courses_ended = Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_analysis_total_courses_ended', $course_args ) );
571
-		$average_courses_per_learner = abs( round( doubleval( $total_courses_started / $user_count ), 2 ) );
570
+		$total_courses_ended = Sensei_Utils::sensei_check_for_activity(apply_filters('sensei_analysis_total_courses_ended', $course_args));
571
+		$average_courses_per_learner = abs(round(doubleval($total_courses_started / $user_count), 2));
572 572
 
573 573
 		// Setup the boxes to render
574 574
 		$stats_to_render = array( 
575
-								__( 'Total Courses', 'woothemes-sensei' ) => $total_courses,
576
-								__( 'Total Lessons', 'woothemes-sensei' ) => $total_lessons,
577
-								__( 'Total Learners', 'woothemes-sensei' ) => $user_count,
578
-								__( 'Average Courses per Learner', 'woothemes-sensei' ) => $average_courses_per_learner,
579
-								__( 'Average Grade', 'woothemes-sensei' ) => $total_average_grade . '%',
580
-								__( 'Total Completed Courses', 'woothemes-sensei' ) => $total_courses_ended,
575
+								__('Total Courses', 'woothemes-sensei') => $total_courses,
576
+								__('Total Lessons', 'woothemes-sensei') => $total_lessons,
577
+								__('Total Learners', 'woothemes-sensei') => $user_count,
578
+								__('Average Courses per Learner', 'woothemes-sensei') => $average_courses_per_learner,
579
+								__('Average Grade', 'woothemes-sensei') => $total_average_grade.'%',
580
+								__('Total Completed Courses', 'woothemes-sensei') => $total_courses_ended,
581 581
 							);
582
-		return apply_filters( 'sensei_analysis_stats_boxes', $stats_to_render );
582
+		return apply_filters('sensei_analysis_stats_boxes', $stats_to_render);
583 583
 	} // End stats_boxes()
584 584
 
585 585
 	/**
@@ -589,12 +589,12 @@  discard block
 block discarded – undo
589 589
 	 * @return void
590 590
 	 */
591 591
 	public function no_items() {
592
-		if( ! $this->view || 'users' == $this->view ) {
592
+		if ( ! $this->view || 'users' == $this->view) {
593 593
 			$type = 'learners';
594 594
 		} else {
595 595
 			$type = $this->view;
596 596
 		}
597
-		echo  sprintf( __( '%1$sNo %2$s found%3$s', 'woothemes-sensei' ), '<em>', $type, '</em>' );
597
+		echo  sprintf(__('%1$sNo %2$s found%3$s', 'woothemes-sensei'), '<em>', $type, '</em>');
598 598
 	} // End no_items()
599 599
 
600 600
 	/**
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 			'page' => $this->page_slug,
610 610
 		);
611 611
 		$learners_class = $courses_class = $lessons_class = '';
612
-		switch( $this->type ) {
612
+		switch ($this->type) {
613 613
 			case 'courses':
614 614
 				$courses_class = 'current';
615 615
 				break;
@@ -627,18 +627,18 @@  discard block
 block discarded – undo
627 627
 		$lesson_args['view'] = 'lessons';
628 628
 		$courses_args['view'] = 'courses';
629 629
 
630
-		$menu['learners'] = '<a class="' . $learners_class . '" href="' . esc_url( add_query_arg( $learner_args, admin_url( 'admin.php' ) ) ). '">' . __( 'Learners', 'woothemes-sensei' ) . '</a>';
631
-		$menu['courses'] = '<a class="' . $courses_class . '" href="' . esc_url ( add_query_arg( $courses_args, admin_url( 'admin.php' ) ) ) . '">' . __( 'Courses', 'woothemes-sensei' ) . '</a>';
632
-		$menu['lessons'] = '<a class="' . $lessons_class . '" href="' . esc_url( add_query_arg( $lesson_args, admin_url( 'admin.php' ) ) ) . '">' . __( 'Lessons', 'woothemes-sensei' ) . '</a>';
630
+		$menu['learners'] = '<a class="'.$learners_class.'" href="'.esc_url(add_query_arg($learner_args, admin_url('admin.php'))).'">'.__('Learners', 'woothemes-sensei').'</a>';
631
+		$menu['courses'] = '<a class="'.$courses_class.'" href="'.esc_url(add_query_arg($courses_args, admin_url('admin.php'))).'">'.__('Courses', 'woothemes-sensei').'</a>';
632
+		$menu['lessons'] = '<a class="'.$lessons_class.'" href="'.esc_url(add_query_arg($lesson_args, admin_url('admin.php'))).'">'.__('Lessons', 'woothemes-sensei').'</a>';
633 633
 
634
-		$menu = apply_filters( 'sensei_analysis_overview_sub_menu', $menu );
635
-		if ( !empty($menu) ) {
636
-			echo '<ul class="subsubsub">' . "\n";
637
-			foreach ( $menu as $class => $item ) {
638
-				$menu[ $class ] = "\t<li class='$class'>$item";
634
+		$menu = apply_filters('sensei_analysis_overview_sub_menu', $menu);
635
+		if ( ! empty($menu)) {
636
+			echo '<ul class="subsubsub">'."\n";
637
+			foreach ($menu as $class => $item) {
638
+				$menu[$class] = "\t<li class='$class'>$item";
639 639
 			}
640
-			echo implode( " |</li>\n", $menu ) . "</li>\n";
641
-			echo '</ul>' . "\n";
640
+			echo implode(" |</li>\n", $menu)."</li>\n";
641
+			echo '</ul>'."\n";
642 642
 		}
643 643
 	} // End data_table_header()
644 644
 
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 	 * @return void
649 649
 	 */
650 650
 	public function data_table_footer() {
651
-		switch ( $this->type ) {
651
+		switch ($this->type) {
652 652
 			case 'courses':
653 653
 				$report = 'courses-overview';
654 654
 				break;
@@ -662,8 +662,8 @@  discard block
 block discarded – undo
662 662
 				$report = 'user-overview';
663 663
 			break;
664 664
 		} // End Switch Statement
665
-		$url = add_query_arg( array( 'page' => $this->page_slug, 'view' => $this->type, 'sensei_report_download' => $report ), admin_url( 'admin.php' ) );
666
-		echo '<a class="button button-primary" href="' . esc_url( wp_nonce_url( $url, 'sensei_csv_download-' . $report, '_sdl_nonce' ) ) . '">' . __( 'Export all rows (CSV)', 'woothemes-sensei' ) . '</a>';
665
+		$url = add_query_arg(array('page' => $this->page_slug, 'view' => $this->type, 'sensei_report_download' => $report), admin_url('admin.php'));
666
+		echo '<a class="button button-primary" href="'.esc_url(wp_nonce_url($url, 'sensei_csv_download-'.$report, '_sdl_nonce')).'">'.__('Export all rows (CSV)', 'woothemes-sensei').'</a>';
667 667
 	} // End data_table_footer()
668 668
 
669 669
 	/**
@@ -671,19 +671,19 @@  discard block
 block discarded – undo
671 671
 	 * @since  1.7.0
672 672
 	 * @return void
673 673
 	 */
674
-	public function search_button( $text = '' ) {
675
-		switch( $this->type ) {
674
+	public function search_button($text = '') {
675
+		switch ($this->type) {
676 676
 			case 'courses':
677
-				$text = __( 'Search Courses', 'woothemes-sensei' );
677
+				$text = __('Search Courses', 'woothemes-sensei');
678 678
 			break;
679 679
 
680 680
 			case 'lessons':
681
-				$text = __( 'Search Lessons', 'woothemes-sensei' );
681
+				$text = __('Search Lessons', 'woothemes-sensei');
682 682
 			break;
683 683
 
684 684
 			case 'users':
685 685
 			default:
686
-				$text = __( 'Search Learners', 'woothemes-sensei' );
686
+				$text = __('Search Learners', 'woothemes-sensei');
687 687
 			break;
688 688
 		} // End Switch Statement
689 689
 
Please login to merge, or discard this patch.
includes/class-sensei-grading-user-quiz.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 
42 42
 	/**
43 43
 	 * Display output to the admin view
44
-     *
45
-     * This view is shown when grading a quiz for a single user in admin under grading
46
-     *
44
+	 *
45
+	 * This view is shown when grading a quiz for a single user in admin under grading
46
+	 *
47 47
 	 * @since  1.3.0
48 48
 	 * @return html
49 49
 	 */
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 		$user_quiz_grade_total = 0;
58 58
 		$quiz_grade_total = 0;
59 59
 		$quiz_grade = 0;
60
-        $lesson_id = $this->lesson_id;
61
-        $user_id = $this->user_id;
60
+		$lesson_id = $this->lesson_id;
61
+		$user_id = $this->user_id;
62 62
 
63 63
 		?><form name="<?php esc_attr_e( 'quiz_' . $this->quiz_id ); ?>" action="" method="post">
64 64
 			<?php wp_nonce_field( 'sensei_manual_grading', '_wp_sensei_manual_grading_nonce' ); ?>
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 						<p class="user-answer"><?php
207 207
 							foreach ( $user_answer_content as $_user_answer ) {
208 208
 
209
-                                if( 'multi-line' == Sensei()->question->get_question_type( $question->ID ) ){
209
+								if( 'multi-line' == Sensei()->question->get_question_type( $question->ID ) ){
210 210
 
211
-                                    $_user_answer = htmlspecialchars_decode( nl2br( esc_html($_user_answer) ) );
211
+									$_user_answer = htmlspecialchars_decode( nl2br( esc_html($_user_answer) ) );
212 212
 
213
-                                }
213
+								}
214 214
 
215 215
 								echo apply_filters( 'sensei_answer_text', $_user_answer ) . "<br>";
216 216
 							}
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
5
+// Exit if accessed directly
3 6
 
4 7
 /**
5 8
  * Sensei Grading User Quiz Class
@@ -172,8 +175,7 @@  discard block
 block discarded – undo
172 175
 				++$correct_answers;
173 176
 				++$graded_count;
174 177
 				$user_question_grade = 0;
175
-			}
176
-			elseif( intval( $user_question_grade ) > 0 ) {
178
+			} elseif( intval( $user_question_grade ) > 0 ) {
177 179
 				$graded_class = 'user_right';
178 180
 				++$correct_answers;
179 181
 				$user_quiz_grade_total += $user_question_grade;
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly
3 3
 
4 4
 /**
5 5
  * Sensei Grading User Quiz Class
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
 	 * @since  1.3.0
23 23
 	 * @return  void
24 24
 	 */
25
-	public function __construct ( $user_id = 0, $quiz_id = 0 ) {
26
-		$this->user_id = intval( $user_id );
27
-		$this->quiz_id = intval( $quiz_id );
28
-		$this->lesson_id = get_post_meta( $this->quiz_id, '_quiz_lesson', true );
25
+	public function __construct($user_id = 0, $quiz_id = 0) {
26
+		$this->user_id = intval($user_id);
27
+		$this->quiz_id = intval($quiz_id);
28
+		$this->lesson_id = get_post_meta($this->quiz_id, '_quiz_lesson', true);
29 29
 	} // End __construct()
30 30
 
31 31
 	/**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @return array
36 36
 	 */
37 37
 	public function build_data_array() {
38
-		$data_array = Sensei_Utils::sensei_get_quiz_questions( $this->quiz_id );
38
+		$data_array = Sensei_Utils::sensei_get_quiz_questions($this->quiz_id);
39 39
 		return $data_array;
40 40
 	} // End build_data_array()
41 41
 
@@ -60,94 +60,94 @@  discard block
 block discarded – undo
60 60
         $lesson_id = $this->lesson_id;
61 61
         $user_id = $this->user_id;
62 62
 
63
-		?><form name="<?php esc_attr_e( 'quiz_' . $this->quiz_id ); ?>" action="" method="post">
64
-			<?php wp_nonce_field( 'sensei_manual_grading', '_wp_sensei_manual_grading_nonce' ); ?>
65
-			<input type="hidden" name="sensei_manual_grade" value="<?php esc_attr_e( $this->quiz_id ); ?>" />
66
-			<input type="hidden" name="sensei_grade_next_learner" value="<?php esc_attr_e( $this->user_id ); ?>" />
63
+		?><form name="<?php esc_attr_e('quiz_'.$this->quiz_id); ?>" action="" method="post">
64
+			<?php wp_nonce_field('sensei_manual_grading', '_wp_sensei_manual_grading_nonce'); ?>
65
+			<input type="hidden" name="sensei_manual_grade" value="<?php esc_attr_e($this->quiz_id); ?>" />
66
+			<input type="hidden" name="sensei_grade_next_learner" value="<?php esc_attr_e($this->user_id); ?>" />
67 67
 			<div class="total_grade_display">
68
-				<span><?php esc_attr_e( __( 'Grade:', 'woothemes-sensei' ) ); ?></span>
68
+				<span><?php esc_attr_e(__('Grade:', 'woothemes-sensei')); ?></span>
69 69
 				<span class="total_grade_total"><?php echo $user_quiz_grade_total; ?></span> / <span class="quiz_grade_total"><?php echo $quiz_grade_total; ?></span> (<span class="total_grade_percent"><?php echo $quiz_grade; ?></span>%)
70 70
 			</div>
71 71
 			<div class="buttons">
72
-				<input type="submit" value="<?php esc_attr_e( __( 'Save', 'woothemes-sensei' ) ); ?>" class="grade-button button-primary" title="Saves grades as currently marked on this page" />
73
-				<input type="button" value="<?php esc_attr_e( __( 'Auto grade', 'woothemes-sensei' ) ); ?>" class="autograde-button button-secondary" title="Where possible, automatically grades questions that have not yet been graded" />
74
-				<input type="reset" value="<?php esc_attr_e( __( 'Reset', 'woothemes-sensei' ) ); ?>" class="reset-button button-secondary" title="Resets all questions to ungraded and total grade to 0" />
72
+				<input type="submit" value="<?php esc_attr_e(__('Save', 'woothemes-sensei')); ?>" class="grade-button button-primary" title="Saves grades as currently marked on this page" />
73
+				<input type="button" value="<?php esc_attr_e(__('Auto grade', 'woothemes-sensei')); ?>" class="autograde-button button-secondary" title="Where possible, automatically grades questions that have not yet been graded" />
74
+				<input type="reset" value="<?php esc_attr_e(__('Reset', 'woothemes-sensei')); ?>" class="reset-button button-secondary" title="Resets all questions to ungraded and total grade to 0" />
75 75
 			</div>
76 76
 			<div class="clear"></div><br/><?php
77 77
 
78
-		$lesson_status_id = Sensei_Utils::sensei_get_activity_value( array( 'post_id' => $this->lesson_id, 'user_id' => $this->user_id, 'type' => 'sensei_lesson_status', 'field' => 'comment_ID' ) );
79
-		$user_quiz_grade = get_comment_meta( $lesson_status_id, 'grade', true );
78
+		$lesson_status_id = Sensei_Utils::sensei_get_activity_value(array('post_id' => $this->lesson_id, 'user_id' => $this->user_id, 'type' => 'sensei_lesson_status', 'field' => 'comment_ID'));
79
+		$user_quiz_grade = get_comment_meta($lesson_status_id, 'grade', true);
80 80
 		$correct_answers = 0;
81 81
 
82
-		foreach( $questions as $question ) {
82
+		foreach ($questions as $question) {
83 83
 			$question_id = $question->ID;
84 84
 			++$count;
85 85
 
86 86
 			$type = false;
87 87
 			$type_name = '';
88 88
 
89
-			$type = Sensei()->question->get_question_type( $question_id );
89
+			$type = Sensei()->question->get_question_type($question_id);
90 90
 
91
-			$question_answer_notes = Sensei()->quiz->get_user_question_feedback( $lesson_id, $question_id, $user_id );
91
+			$question_answer_notes = Sensei()->quiz->get_user_question_feedback($lesson_id, $question_id, $user_id);
92 92
 
93 93
 
94
-			$question_grade_total = Sensei()->question->get_question_grade( $question_id );
94
+			$question_grade_total = Sensei()->question->get_question_grade($question_id);
95 95
 			$quiz_grade_total += $question_grade_total;
96 96
 
97
-			$right_answer = get_post_meta( $question_id, '_question_right_answer', true );
98
-			$user_answer_content = Sensei()->quiz->get_user_question_answer( $lesson_id, $question_id, $user_id );
99
-			$type_name = __( 'Multiple Choice', 'woothemes-sensei' );
97
+			$right_answer = get_post_meta($question_id, '_question_right_answer', true);
98
+			$user_answer_content = Sensei()->quiz->get_user_question_answer($lesson_id, $question_id, $user_id);
99
+			$type_name = __('Multiple Choice', 'woothemes-sensei');
100 100
 			$grade_type = 'manual-grade';
101 101
 
102
-			switch( $type ) {
102
+			switch ($type) {
103 103
 				case 'boolean':
104
-					$type_name = __( 'True/False', 'woothemes-sensei' );
105
-					$right_answer = ucfirst( $right_answer );
106
-					$user_answer_content = ucfirst( $user_answer_content );
104
+					$type_name = __('True/False', 'woothemes-sensei');
105
+					$right_answer = ucfirst($right_answer);
106
+					$user_answer_content = ucfirst($user_answer_content);
107 107
 					$grade_type = 'auto-grade';
108 108
 				break;
109 109
 				case 'multiple-choice':
110
-					$type_name = __( 'Multiple Choice', 'woothemes-sensei' );
110
+					$type_name = __('Multiple Choice', 'woothemes-sensei');
111 111
 					$grade_type = 'auto-grade';
112 112
 				break;
113 113
 				case 'gap-fill':
114
-					$type_name = __( 'Gap Fill', 'woothemes-sensei' );
114
+					$type_name = __('Gap Fill', 'woothemes-sensei');
115 115
 
116
-					$right_answer_array = explode( '||', $right_answer );
117
-					if ( isset( $right_answer_array[0] ) ) { $gapfill_pre = $right_answer_array[0]; } else { $gapfill_pre = ''; }
118
-					if ( isset( $right_answer_array[1] ) ) { $gapfill_gap = $right_answer_array[1]; } else { $gapfill_gap = ''; }
119
-					if ( isset( $right_answer_array[2] ) ) { $gapfill_post = $right_answer_array[2]; } else { $gapfill_post = ''; }
116
+					$right_answer_array = explode('||', $right_answer);
117
+					if (isset($right_answer_array[0])) { $gapfill_pre = $right_answer_array[0]; } else { $gapfill_pre = ''; }
118
+					if (isset($right_answer_array[1])) { $gapfill_gap = $right_answer_array[1]; } else { $gapfill_gap = ''; }
119
+					if (isset($right_answer_array[2])) { $gapfill_post = $right_answer_array[2]; } else { $gapfill_post = ''; }
120 120
 
121
-					if( ! $user_answer_content ) {
121
+					if ( ! $user_answer_content) {
122 122
 						$user_answer_content = '______';
123 123
 					}
124 124
 
125
-					$right_answer = $gapfill_pre . ' <span class="highlight">' . $gapfill_gap . '</span> ' . $gapfill_post;
126
-					$user_answer_content = $gapfill_pre . ' <span class="highlight">' . $user_answer_content . '</span> ' . $gapfill_post;
125
+					$right_answer = $gapfill_pre.' <span class="highlight">'.$gapfill_gap.'</span> '.$gapfill_post;
126
+					$user_answer_content = $gapfill_pre.' <span class="highlight">'.$user_answer_content.'</span> '.$gapfill_post;
127 127
 					$grade_type = 'auto-grade';
128 128
 
129 129
 				break;
130 130
 				case 'multi-line':
131
-					$type_name = __( 'Multi Line', 'woothemes-sensei' );
131
+					$type_name = __('Multi Line', 'woothemes-sensei');
132 132
 					$grade_type = 'manual-grade';
133 133
 				break;
134 134
 				case 'single-line':
135
-					$type_name = __( 'Single Line', 'woothemes-sensei' );
135
+					$type_name = __('Single Line', 'woothemes-sensei');
136 136
 					$grade_type = 'manual-grade';
137 137
 				break;
138 138
 				case 'file-upload':
139
-					$type_name = __( 'File Upload', 'woothemes-sensei' );
139
+					$type_name = __('File Upload', 'woothemes-sensei');
140 140
 					$grade_type = 'manual-grade';
141 141
 
142 142
 					// Get uploaded file
143
-					if( $user_answer_content ) {
143
+					if ($user_answer_content) {
144 144
 						$attachment_id = $user_answer_content;
145 145
 						$answer_media_url = $answer_media_filename = '';
146
-						if( 0 < intval( $attachment_id ) ) {
147
-							$answer_media_url = wp_get_attachment_url( $attachment_id );
148
-							$answer_media_filename = basename( $answer_media_url );
149
-							if( $answer_media_url && $answer_media_filename ) {
150
-								$user_answer_content = sprintf( __( 'Submitted file: %1$s', 'woothemes-sensei' ), '<a href="' . esc_url( $answer_media_url ) . '" target="_blank">' . esc_html( $answer_media_filename ) . '</a>' );
146
+						if (0 < intval($attachment_id)) {
147
+							$answer_media_url = wp_get_attachment_url($attachment_id);
148
+							$answer_media_filename = basename($answer_media_url);
149
+							if ($answer_media_url && $answer_media_filename) {
150
+								$user_answer_content = sprintf(__('Submitted file: %1$s', 'woothemes-sensei'), '<a href="'.esc_url($answer_media_url).'" target="_blank">'.esc_html($answer_media_filename).'</a>');
151 151
 							}
152 152
 						}
153 153
 					} else {
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
 			}
161 161
 			$user_answer_content = (array) $user_answer_content;
162 162
 			$right_answer = (array) $right_answer;
163
-			$question_title = sprintf( __( 'Question %d: ', 'woothemes-sensei' ), $count ) . $type_name;
163
+			$question_title = sprintf(__('Question %d: ', 'woothemes-sensei'), $count).$type_name;
164 164
 
165 165
 			$graded_class = '';
166
-			$user_question_grade = Sensei()->quiz->get_user_question_grade( $lesson_id, $question_id, $user_id );
166
+			$user_question_grade = Sensei()->quiz->get_user_question_grade($lesson_id, $question_id, $user_id);
167 167
 			$graded_class = 'ungraded';
168
-			if ( 0 == $question_grade_total && 0 == intval( $user_question_grade ) ) {
168
+			if (0 == $question_grade_total && 0 == intval($user_question_grade)) {
169 169
 				// Question skips grading
170 170
 				$grade_type = 'zero-graded';
171 171
 				$graded_class = '';
@@ -173,86 +173,86 @@  discard block
 block discarded – undo
173 173
 				++$graded_count;
174 174
 				$user_question_grade = 0;
175 175
 			}
176
-			elseif( intval( $user_question_grade ) > 0 ) {
176
+			elseif (intval($user_question_grade) > 0) {
177 177
 				$graded_class = 'user_right';
178 178
 				++$correct_answers;
179 179
 				$user_quiz_grade_total += $user_question_grade;
180 180
 				++$graded_count;
181 181
 			} else {
182
-				if( ! is_string( $user_question_grade ) && intval( $user_question_grade ) == 0 ) {
182
+				if ( ! is_string($user_question_grade) && intval($user_question_grade) == 0) {
183 183
 					$graded_class = 'user_wrong';
184 184
 					++$graded_count;
185 185
 				}
186 186
 				$user_question_grade = 0;
187 187
 			}
188 188
 
189
-			?><div class="postbox question_box <?php esc_attr_e( $type ); ?> <?php esc_attr_e( $grade_type ); ?> <?php esc_attr_e( $graded_class ); ?>" id="<?php esc_attr_e( 'question_' . $question_id . '_box' ); ?>">
189
+			?><div class="postbox question_box <?php esc_attr_e($type); ?> <?php esc_attr_e($grade_type); ?> <?php esc_attr_e($graded_class); ?>" id="<?php esc_attr_e('question_'.$question_id.'_box'); ?>">
190 190
 				<div class="handlediv" title="Click to toggle"><br></div>
191 191
 				<h3 class="hndle"><span><?php echo $question_title; ?></span></h3>
192 192
 				<div class="inside">
193 193
 					<div class="sensei-grading-actions">
194 194
 						<div class="actions">
195
-							<input type="hidden" class="question_id" value="<?php esc_attr_e( $question_id ); ?>" />
196
-							<input type="hidden" class="question_total_grade" name="question_total_grade" value="<?php echo esc_attr( $question_grade_total ); ?>" />
197
-							<span class="grading-mark icon_right"><input type="radio" class="<?php esc_attr_e( 'question_' . $question_id . '_right_option' ); ?>" name="<?php esc_attr_e( 'question_' . $question_id ); ?>" value="right" <?php checked( $graded_class, 'user_right', true ); ?> /></span>
198
-							<span class="grading-mark icon_wrong"><input type="radio" class="<?php esc_attr_e( 'question_' . $question_id . '_wrong_option' ); ?>" name="<?php esc_attr_e( 'question_' . $question_id ); ?>" value="wrong" <?php checked( $graded_class, 'user_wrong', true ); ?> /></span>
199
-							<input type="number" class="question-grade" name="<?php esc_attr_e( 'question_' . $question_id . '_grade' ); ?>" id="<?php esc_attr_e( 'question_' . $question_id . '_grade' ); ?>" value="<?php echo esc_attr( $user_question_grade ); ?>" min="0" max="<?php echo esc_attr( $question_grade_total ); ?>" />
195
+							<input type="hidden" class="question_id" value="<?php esc_attr_e($question_id); ?>" />
196
+							<input type="hidden" class="question_total_grade" name="question_total_grade" value="<?php echo esc_attr($question_grade_total); ?>" />
197
+							<span class="grading-mark icon_right"><input type="radio" class="<?php esc_attr_e('question_'.$question_id.'_right_option'); ?>" name="<?php esc_attr_e('question_'.$question_id); ?>" value="right" <?php checked($graded_class, 'user_right', true); ?> /></span>
198
+							<span class="grading-mark icon_wrong"><input type="radio" class="<?php esc_attr_e('question_'.$question_id.'_wrong_option'); ?>" name="<?php esc_attr_e('question_'.$question_id); ?>" value="wrong" <?php checked($graded_class, 'user_wrong', true); ?> /></span>
199
+							<input type="number" class="question-grade" name="<?php esc_attr_e('question_'.$question_id.'_grade'); ?>" id="<?php esc_attr_e('question_'.$question_id.'_grade'); ?>" value="<?php echo esc_attr($user_question_grade); ?>" min="0" max="<?php echo esc_attr($question_grade_total); ?>" />
200 200
 							<span class="question-grade-total"><?php echo $question_grade_total; ?></span>
201 201
 						</div>
202 202
 					</div>
203 203
 					<div class="sensei-grading-answer">
204
-						<h4><?php echo apply_filters( 'sensei_question_title', $question->post_title ); ?></h4>
205
-						<?php echo apply_filters( 'the_content', $question->post_content );?>
204
+						<h4><?php echo apply_filters('sensei_question_title', $question->post_title); ?></h4>
205
+						<?php echo apply_filters('the_content', $question->post_content); ?>
206 206
 						<p class="user-answer"><?php
207
-							foreach ( $user_answer_content as $_user_answer ) {
207
+							foreach ($user_answer_content as $_user_answer) {
208 208
 
209
-                                if( 'multi-line' == Sensei()->question->get_question_type( $question->ID ) ){
209
+                                if ('multi-line' == Sensei()->question->get_question_type($question->ID)) {
210 210
 
211
-                                    $_user_answer = htmlspecialchars_decode( nl2br( esc_html($_user_answer) ) );
211
+                                    $_user_answer = htmlspecialchars_decode(nl2br(esc_html($_user_answer)));
212 212
 
213 213
                                 }
214 214
 
215
-								echo apply_filters( 'sensei_answer_text', $_user_answer ) . "<br>";
215
+								echo apply_filters('sensei_answer_text', $_user_answer)."<br>";
216 216
 							}
217 217
 						?></p>
218 218
 						<div class="right-answer">
219
-							<h5><?php _e( 'Correct answer', 'woothemes-sensei' ) ?></h5>
219
+							<h5><?php _e('Correct answer', 'woothemes-sensei') ?></h5>
220 220
 							<span class="correct-answer"><?php
221
-								foreach ( $right_answer as $_right_answer ) {
221
+								foreach ($right_answer as $_right_answer) {
222 222
 
223
-									echo apply_filters( 'sensei_answer_text', $_right_answer ) . "<br>";
223
+									echo apply_filters('sensei_answer_text', $_right_answer)."<br>";
224 224
 
225 225
 								}
226 226
 							?></span>
227 227
 						</div>
228 228
 						<div class="answer-notes">
229
-							<h5><?php _e( 'Grading Notes', 'woothemes-sensei' ) ?></h5>
230
-							<textarea class="correct-answer" name="questions_feedback[<?php esc_attr_e( $question_id ); ?>]" placeholder="<?php _e( 'Add notes here...', 'woothemes-sensei' ) ?>"><?php echo $question_answer_notes; ?></textarea>
229
+							<h5><?php _e('Grading Notes', 'woothemes-sensei') ?></h5>
230
+							<textarea class="correct-answer" name="questions_feedback[<?php esc_attr_e($question_id); ?>]" placeholder="<?php _e('Add notes here...', 'woothemes-sensei') ?>"><?php echo $question_answer_notes; ?></textarea>
231 231
 						</div>
232 232
 					</div>
233 233
 				</div>
234 234
 			</div><?php
235 235
 		}
236 236
 
237
-		$quiz_grade = intval( $user_quiz_grade );
237
+		$quiz_grade = intval($user_quiz_grade);
238 238
 		$all_graded = 'no';
239
-		if( intval( $count ) == intval( $graded_count ) ) {
239
+		if (intval($count) == intval($graded_count)) {
240 240
 			$all_graded = 'yes';
241 241
 		}
242 242
 
243
-		?>  <input type="hidden" name="total_grade" id="total_grade" value="<?php esc_attr_e( $user_quiz_grade_total ); ?>" />
244
-			<input type="hidden" name="total_questions" id="total_questions" value="<?php esc_attr_e( $count ); ?>" />
245
-			<input type="hidden" name="quiz_grade_total" id="quiz_grade_total" value="<?php esc_attr_e( $quiz_grade_total ); ?>" />
246
-			<input type="hidden" name="total_graded_questions" id="total_graded_questions" value="<?php esc_attr_e( $graded_count ); ?>" />
247
-			<input type="hidden" name="all_questions_graded" id="all_questions_graded" value="<?php esc_attr_e( $all_graded ); ?>" />
243
+		?>  <input type="hidden" name="total_grade" id="total_grade" value="<?php esc_attr_e($user_quiz_grade_total); ?>" />
244
+			<input type="hidden" name="total_questions" id="total_questions" value="<?php esc_attr_e($count); ?>" />
245
+			<input type="hidden" name="quiz_grade_total" id="quiz_grade_total" value="<?php esc_attr_e($quiz_grade_total); ?>" />
246
+			<input type="hidden" name="total_graded_questions" id="total_graded_questions" value="<?php esc_attr_e($graded_count); ?>" />
247
+			<input type="hidden" name="all_questions_graded" id="all_questions_graded" value="<?php esc_attr_e($all_graded); ?>" />
248 248
 			<div class="total_grade_display">
249
-				<span><?php esc_attr_e( __( 'Grade:', 'woothemes-sensei' ) ); ?></span>
249
+				<span><?php esc_attr_e(__('Grade:', 'woothemes-sensei')); ?></span>
250 250
 				<span class="total_grade_total"><?php echo $user_quiz_grade_total; ?></span> / <span class="quiz_grade_total"><?php echo $quiz_grade_total; ?></span> (<span class="total_grade_percent"><?php echo $quiz_grade; ?></span>%)
251 251
 			</div>
252 252
 			<div class="buttons">
253
-				<input type="submit" value="<?php esc_attr_e( 'Save' ); ?>" class="grade-button button-primary" title="Saves grades as currently marked on this page" />
254
-				<input type="button" value="<?php esc_attr_e( __( 'Auto grade', 'woothemes-sensei' ) ); ?>" class="autograde-button button-secondary" title="Where possible, automatically grades questions that have not yet been graded" />
255
-				<input type="reset" value="<?php esc_attr_e( __( 'Reset', 'woothemes-sensei' ) ); ?>" class="reset-button button-secondary" title="Resets all questions to ungraded and total grade to 0" />
253
+				<input type="submit" value="<?php esc_attr_e('Save'); ?>" class="grade-button button-primary" title="Saves grades as currently marked on this page" />
254
+				<input type="button" value="<?php esc_attr_e(__('Auto grade', 'woothemes-sensei')); ?>" class="autograde-button button-secondary" title="Where possible, automatically grades questions that have not yet been graded" />
255
+				<input type="reset" value="<?php esc_attr_e(__('Reset', 'woothemes-sensei')); ?>" class="reset-button button-secondary" title="Resets all questions to ungraded and total grade to 0" />
256 256
 			</div>
257 257
 			<div class="clear"></div>
258 258
 			<script type="text/javascript">
@@ -271,4 +271,4 @@  discard block
 block discarded – undo
271 271
  * for backward compatibility
272 272
  * @since 1.9.0
273 273
  */
274
-class WooThemes_Sensei_Grading_User_Quiz extends Sensei_Grading_User_Quiz{}
274
+class WooThemes_Sensei_Grading_User_Quiz extends Sensei_Grading_User_Quiz {}
Please login to merge, or discard this patch.
includes/class-sensei-grading-main.php 3 patches
Braces   +11 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
5
+// Exit if accessed directly
3 6
 
4 7
 /**
5 8
  * Sensei Grading Overview List Table Class
@@ -155,8 +158,7 @@  discard block
 block discarded – undo
155 158
 
156 159
 		if( $this->lesson_id ) {
157 160
 			$activity_args['post_id'] = $this->lesson_id;
158
-		}
159
-		elseif( $this->course_id ) {
161
+		} elseif( $this->course_id ) {
160 162
 			// Currently not possible to restrict to a single Course, as that requires WP_Comment to support multiple
161 163
 			// post_ids (i.e. every lesson within the Course), WP 4.1 ( https://core.trac.wordpress.org/changeset/29808 )
162 164
 			if ( version_compare($wp_version, '4.1', '>=') ) {
@@ -231,24 +233,19 @@  discard block
 block discarded – undo
231 233
 		if( 'complete' == $item->comment_approved ) {
232 234
 			$status_html = '<span class="graded">' . __( 'Completed', 'woothemes-sensei' ) . '</span>';
233 235
 			$grade =  __( 'No Grade', 'woothemes-sensei' );
234
-		}
235
-		elseif( 'graded' == $item->comment_approved ) {
236
+		} elseif( 'graded' == $item->comment_approved ) {
236 237
 			$status_html = '<span class="graded">' .  __( 'Graded', 'woothemes-sensei' )  . '</span>';
237 238
 			$grade = get_comment_meta( $item->comment_ID, 'grade', true) . '%';
238
-		}
239
-		elseif( 'passed' == $item->comment_approved ) {
239
+		} elseif( 'passed' == $item->comment_approved ) {
240 240
 			$status_html = '<span class="passed">' .  __( 'Passed', 'woothemes-sensei' )  . '</span>';
241 241
 			$grade = get_comment_meta( $item->comment_ID, 'grade', true) . '%';
242
-		}
243
-		elseif( 'failed' == $item->comment_approved ) {
242
+		} elseif( 'failed' == $item->comment_approved ) {
244 243
 			$status_html = '<span class="failed">' .  __( 'Failed', 'woothemes-sensei' )  . '</span>';
245 244
 			$grade = get_comment_meta( $item->comment_ID, 'grade', true) . '%';
246
-		}
247
-		elseif( 'ungraded' == $item->comment_approved ) {
245
+		} elseif( 'ungraded' == $item->comment_approved ) {
248 246
 			$status_html = '<span class="ungraded">' .  __( 'Ungraded', 'woothemes-sensei' )  . '</span>';
249 247
 			$grade = __( 'N/A', 'woothemes-sensei' );
250
-		}
251
-		else {
248
+		} else {
252 249
 			$status_html = '<span class="in-progress">' . __( 'In Progress', 'woothemes-sensei' ) . '</span>';
253 250
 			$grade = __( 'N/A', 'woothemes-sensei' );
254 251
 		}
@@ -276,8 +273,7 @@  discard block
 block discarded – undo
276 273
 		$course_title = '';
277 274
 		if ( !empty($course_id) && version_compare($wp_version, '4.1', '>=') ) {
278 275
 			$course_title = '<a href="' . esc_url( add_query_arg( array( 'page' => $this->page_slug, 'course_id' => $course_id ), admin_url( 'admin.php' ) ) ) . '">' . get_the_title( $course_id ) . '</a>';
279
-		}
280
-		else if ( !empty($course_id) ) {
276
+		} else if ( !empty($course_id) ) {
281 277
 			$course_title = get_the_title( $course_id );
282 278
 		}
283 279
 		$lesson_title = '<a href="' . add_query_arg( array( 'page' => $this->page_slug, 'lesson_id' => $item->comment_post_ID ), admin_url( 'admin.php' ) ) . '">' . get_the_title( $item->comment_post_ID ) . '</a>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 			$grade = __( 'N/A', 'woothemes-sensei' );
254 254
 		}
255 255
 
256
-        $title = Sensei_Student::get_full_name( $item->user_id );
256
+		$title = Sensei_Student::get_full_name( $item->user_id );
257 257
 
258 258
 		// QuizID to be deprecated
259 259
 		$quiz_id = get_post_meta( $item->comment_post_ID, '_lesson_quiz', true );
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	 */
304 304
 	public function no_items() {
305 305
 
306
-        _e( 'No submissions found.', 'woothemes-sensei' );
306
+		_e( 'No submissions found.', 'woothemes-sensei' );
307 307
 
308 308
 	} // End no_items()
309 309
 
Please login to merge, or discard this patch.
Spacing   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly
3 3
 
4 4
 /**
5 5
  * Sensei Grading Overview List Table Class
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @since  1.3.0
26 26
 	 * @return  void
27 27
 	 */
28
-	public function __construct ( $args = null ) {
28
+	public function __construct($args = null) {
29 29
 
30 30
 		$defaults = array(
31 31
 			'course_id' => 0,
@@ -33,24 +33,24 @@  discard block
 block discarded – undo
33 33
 			'user_id' => false,
34 34
 			'view' => 'ungraded',
35 35
 		);
36
-		$args = wp_parse_args( $args, $defaults );
36
+		$args = wp_parse_args($args, $defaults);
37 37
 
38
-		$this->course_id = intval( $args['course_id'] );
39
-		$this->lesson_id = intval( $args['lesson_id'] );
40
-		if ( !empty($args['user_id']) ) {
41
-			$this->user_id = intval( $args['user_id'] );
38
+		$this->course_id = intval($args['course_id']);
39
+		$this->lesson_id = intval($args['lesson_id']);
40
+		if ( ! empty($args['user_id'])) {
41
+			$this->user_id = intval($args['user_id']);
42 42
 		}
43 43
 
44
-		if( !empty( $args['view'] ) && in_array( $args['view'], array( 'in-progress', 'graded', 'ungraded', 'all' ) ) ) {
44
+		if ( ! empty($args['view']) && in_array($args['view'], array('in-progress', 'graded', 'ungraded', 'all'))) {
45 45
 			$this->view = $args['view'];
46 46
 		}
47 47
 
48 48
 		// Load Parent token into constructor
49
-		parent::__construct( 'grading_main' );
49
+		parent::__construct('grading_main');
50 50
 
51 51
 		// Actions
52
-		add_action( 'sensei_before_list_table', array( $this, 'data_table_header' ) );
53
-		add_action( 'sensei_after_list_table', array( $this, 'data_table_footer' ) );
52
+		add_action('sensei_before_list_table', array($this, 'data_table_header'));
53
+		add_action('sensei_after_list_table', array($this, 'data_table_footer'));
54 54
 	} // End __construct()
55 55
 
56 56
 	/**
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	function get_columns() {
62 62
 		$columns = array(
63
-			'title' => __( 'Learner', 'woothemes-sensei' ),
64
-			'course' => __( 'Course', 'woothemes-sensei' ),
65
-			'lesson' => __( 'Lesson', 'woothemes-sensei' ),
66
-			'updated' => __( 'Updated', 'woothemes-sensei' ),
67
-			'user_status' => __( 'Status', 'woothemes-sensei' ),
68
-			'user_grade' => __( 'Grade', 'woothemes-sensei' ),
63
+			'title' => __('Learner', 'woothemes-sensei'),
64
+			'course' => __('Course', 'woothemes-sensei'),
65
+			'lesson' => __('Lesson', 'woothemes-sensei'),
66
+			'updated' => __('Updated', 'woothemes-sensei'),
67
+			'user_status' => __('Status', 'woothemes-sensei'),
68
+			'user_grade' => __('Grade', 'woothemes-sensei'),
69 69
 			'action' => '',
70 70
 		);
71 71
 
72
-		$columns = apply_filters( 'sensei_grading_default_columns', $columns, $this );
72
+		$columns = apply_filters('sensei_grading_default_columns', $columns, $this);
73 73
 		return $columns;
74 74
 	}
75 75
 
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	function get_sortable_columns() {
82 82
 		$columns = array(
83
-			'title' => array( 'title', false ),
84
-			'course' => array( 'course', false ),
85
-			'lesson' => array( 'lesson', false ),
86
-			'updated' => array( 'updated', false ),
87
-			'user_status' => array( 'user_status', false ),
88
-			'user_grade' => array( 'user_grade', false ),
83
+			'title' => array('title', false),
84
+			'course' => array('course', false),
85
+			'lesson' => array('lesson', false),
86
+			'updated' => array('updated', false),
87
+			'user_status' => array('user_status', false),
88
+			'user_grade' => array('user_grade', false),
89 89
 		);
90
-		$columns = apply_filters( 'sensei_grading_default_columns_sortable', $columns, $this );
90
+		$columns = apply_filters('sensei_grading_default_columns_sortable', $columns, $this);
91 91
 		return $columns;
92 92
 	}
93 93
 
@@ -101,47 +101,47 @@  discard block
 block discarded – undo
101 101
 
102 102
 		// Handle orderby
103 103
 		$orderby = '';
104
-		if ( !empty( $_GET['orderby'] ) ) {
105
-			if ( array_key_exists( esc_html( $_GET['orderby'] ), $this->get_sortable_columns() ) ) {
106
-				$orderby = esc_html( $_GET['orderby'] );
104
+		if ( ! empty($_GET['orderby'])) {
105
+			if (array_key_exists(esc_html($_GET['orderby']), $this->get_sortable_columns())) {
106
+				$orderby = esc_html($_GET['orderby']);
107 107
 			} // End If Statement
108 108
 		}
109 109
 
110 110
 		// Handle order
111 111
 		$order = 'DESC';
112
-		if ( !empty( $_GET['order'] ) ) {
113
-			$order = ( 'ASC' == strtoupper($_GET['order']) ) ? 'ASC' : 'DESC';
112
+		if ( ! empty($_GET['order'])) {
113
+			$order = ('ASC' == strtoupper($_GET['order'])) ? 'ASC' : 'DESC';
114 114
 		}
115 115
 
116 116
 		// Handle search
117 117
 		$search = false;
118
-		if ( !empty( $_GET['s'] ) ) {
119
-			$search = esc_html( $_GET['s'] );
118
+		if ( ! empty($_GET['s'])) {
119
+			$search = esc_html($_GET['s']);
120 120
 		} // End If Statement
121 121
 		$this->search = $search;
122 122
 
123 123
 		// Searching users on statuses requires sub-selecting the statuses by user_ids
124
-		if ( $this->search ) {
124
+		if ($this->search) {
125 125
 			$user_args = array(
126
-				'search' => '*' . $this->search . '*',
126
+				'search' => '*'.$this->search.'*',
127 127
 				'fields' => 'ID',
128 128
 			);
129 129
 			// Filter for extending
130
-			$user_args = apply_filters( 'sensei_grading_search_users', $user_args );
131
-			if ( !empty( $user_args ) ) {
132
-				$learners_search = new WP_User_Query( $user_args );
130
+			$user_args = apply_filters('sensei_grading_search_users', $user_args);
131
+			if ( ! empty($user_args)) {
132
+				$learners_search = new WP_User_Query($user_args);
133 133
 				// Store for reuse on counts
134 134
 				$this->user_ids = $learners_search->get_results();
135 135
 			}
136 136
 		} // End If Statement
137 137
 
138
-		$per_page = $this->get_items_per_page( 'sensei_comments_per_page' );
139
-		$per_page = apply_filters( 'sensei_comments_per_page', $per_page, 'sensei_comments' );
138
+		$per_page = $this->get_items_per_page('sensei_comments_per_page');
139
+		$per_page = apply_filters('sensei_comments_per_page', $per_page, 'sensei_comments');
140 140
 
141 141
 		$paged = $this->get_pagenum();
142 142
 		$offset = 0;
143
-		if ( !empty($paged) ) {
144
-			$offset = $per_page * ( $paged - 1 );
143
+		if ( ! empty($paged)) {
144
+			$offset = $per_page * ($paged - 1);
145 145
 		} // End If Statement
146 146
 
147 147
 		$activity_args = array(
@@ -153,27 +153,27 @@  discard block
 block discarded – undo
153 153
 			'status' => 'any',
154 154
 		);
155 155
 
156
-		if( $this->lesson_id ) {
156
+		if ($this->lesson_id) {
157 157
 			$activity_args['post_id'] = $this->lesson_id;
158 158
 		}
159
-		elseif( $this->course_id ) {
159
+		elseif ($this->course_id) {
160 160
 			// Currently not possible to restrict to a single Course, as that requires WP_Comment to support multiple
161 161
 			// post_ids (i.e. every lesson within the Course), WP 4.1 ( https://core.trac.wordpress.org/changeset/29808 )
162
-			if ( version_compare($wp_version, '4.1', '>=') ) {
163
-				$activity_args['post__in'] = Sensei()->course->course_lessons( $this->course_id, 'any', 'ids' );
162
+			if (version_compare($wp_version, '4.1', '>=')) {
163
+				$activity_args['post__in'] = Sensei()->course->course_lessons($this->course_id, 'any', 'ids');
164 164
 			}
165 165
 		}
166 166
 		// Sub select to group of learners
167
-		if ( $this->user_ids ) {
167
+		if ($this->user_ids) {
168 168
 			$activity_args['user_id'] = (array) $this->user_ids;
169 169
 		}
170 170
 		// Restrict to a single Learner
171
-		if( $this->user_id ) {
171
+		if ($this->user_id) {
172 172
 			$activity_args['user_id'] = $this->user_id;
173 173
 		}
174 174
 
175 175
 
176
-		switch( $this->view ) {
176
+		switch ($this->view) {
177 177
 			case 'in-progress' :
178 178
 				$activity_args['status'] = 'in-progress';
179 179
 				break;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 				break;
184 184
 
185 185
 			case 'graded' :
186
-				$activity_args['status'] = array( 'graded', 'passed', 'failed' );
186
+				$activity_args['status'] = array('graded', 'passed', 'failed');
187 187
 				break;
188 188
 
189 189
 			case 'all' :
@@ -192,31 +192,31 @@  discard block
 block discarded – undo
192 192
 				break;
193 193
 		} // End switch
194 194
 
195
-		$activity_args = apply_filters( 'sensei_grading_filter_statuses', $activity_args );
195
+		$activity_args = apply_filters('sensei_grading_filter_statuses', $activity_args);
196 196
 
197 197
 		// WP_Comment_Query doesn't support SQL_CALC_FOUND_ROWS, so instead do this twice
198
-		$total_statuses = Sensei_Utils::sensei_check_for_activity( array_merge( $activity_args, array('count' => true, 'offset' => 0, 'number' => 0) ) );
198
+		$total_statuses = Sensei_Utils::sensei_check_for_activity(array_merge($activity_args, array('count' => true, 'offset' => 0, 'number' => 0)));
199 199
 
200 200
 		// Ensure we change our range to fit (in case a search threw off the pagination) - Should this be added to all views?
201
-		if ( $total_statuses < $activity_args['offset'] ) {
202
-			$new_paged = floor( $total_statuses / $activity_args['number'] );
201
+		if ($total_statuses < $activity_args['offset']) {
202
+			$new_paged = floor($total_statuses / $activity_args['number']);
203 203
 			$activity_args['offset'] = $new_paged * $activity_args['number'];
204 204
 		}
205
-		$statuses = Sensei_Utils::sensei_check_for_activity( $activity_args, true );
205
+		$statuses = Sensei_Utils::sensei_check_for_activity($activity_args, true);
206 206
 		// Need to always return an array, even with only 1 item
207
-		if ( !is_array($statuses) ) {
208
-			$statuses = array( $statuses );
207
+		if ( ! is_array($statuses)) {
208
+			$statuses = array($statuses);
209 209
 		}
210 210
 		$this->total_items = $total_statuses;
211 211
 		$this->items = $statuses;
212 212
 
213 213
 		$total_items = $this->total_items;
214
-		$total_pages = ceil( $total_items / $per_page );
215
-		$this->set_pagination_args( array(
214
+		$total_pages = ceil($total_items / $per_page);
215
+		$this->set_pagination_args(array(
216 216
 			'total_items' => $total_items,
217 217
 			'total_pages' => $total_pages,
218 218
 			'per_page' => $per_page
219
-		) );
219
+		));
220 220
 	}
221 221
 
222 222
 	/**
@@ -224,73 +224,73 @@  discard block
 block discarded – undo
224 224
 	 * @since  1.7.0
225 225
 	 * @param object $item The current item
226 226
 	 */
227
-	protected function get_row_data( $item ) {
227
+	protected function get_row_data($item) {
228 228
 		global $wp_version;
229 229
 
230 230
 		$grade = '';
231
-		if( 'complete' == $item->comment_approved ) {
232
-			$status_html = '<span class="graded">' . __( 'Completed', 'woothemes-sensei' ) . '</span>';
233
-			$grade =  __( 'No Grade', 'woothemes-sensei' );
231
+		if ('complete' == $item->comment_approved) {
232
+			$status_html = '<span class="graded">'.__('Completed', 'woothemes-sensei').'</span>';
233
+			$grade = __('No Grade', 'woothemes-sensei');
234 234
 		}
235
-		elseif( 'graded' == $item->comment_approved ) {
236
-			$status_html = '<span class="graded">' .  __( 'Graded', 'woothemes-sensei' )  . '</span>';
237
-			$grade = get_comment_meta( $item->comment_ID, 'grade', true) . '%';
235
+		elseif ('graded' == $item->comment_approved) {
236
+			$status_html = '<span class="graded">'.__('Graded', 'woothemes-sensei').'</span>';
237
+			$grade = get_comment_meta($item->comment_ID, 'grade', true).'%';
238 238
 		}
239
-		elseif( 'passed' == $item->comment_approved ) {
240
-			$status_html = '<span class="passed">' .  __( 'Passed', 'woothemes-sensei' )  . '</span>';
241
-			$grade = get_comment_meta( $item->comment_ID, 'grade', true) . '%';
239
+		elseif ('passed' == $item->comment_approved) {
240
+			$status_html = '<span class="passed">'.__('Passed', 'woothemes-sensei').'</span>';
241
+			$grade = get_comment_meta($item->comment_ID, 'grade', true).'%';
242 242
 		}
243
-		elseif( 'failed' == $item->comment_approved ) {
244
-			$status_html = '<span class="failed">' .  __( 'Failed', 'woothemes-sensei' )  . '</span>';
245
-			$grade = get_comment_meta( $item->comment_ID, 'grade', true) . '%';
243
+		elseif ('failed' == $item->comment_approved) {
244
+			$status_html = '<span class="failed">'.__('Failed', 'woothemes-sensei').'</span>';
245
+			$grade = get_comment_meta($item->comment_ID, 'grade', true).'%';
246 246
 		}
247
-		elseif( 'ungraded' == $item->comment_approved ) {
248
-			$status_html = '<span class="ungraded">' .  __( 'Ungraded', 'woothemes-sensei' )  . '</span>';
249
-			$grade = __( 'N/A', 'woothemes-sensei' );
247
+		elseif ('ungraded' == $item->comment_approved) {
248
+			$status_html = '<span class="ungraded">'.__('Ungraded', 'woothemes-sensei').'</span>';
249
+			$grade = __('N/A', 'woothemes-sensei');
250 250
 		}
251 251
 		else {
252
-			$status_html = '<span class="in-progress">' . __( 'In Progress', 'woothemes-sensei' ) . '</span>';
253
-			$grade = __( 'N/A', 'woothemes-sensei' );
252
+			$status_html = '<span class="in-progress">'.__('In Progress', 'woothemes-sensei').'</span>';
253
+			$grade = __('N/A', 'woothemes-sensei');
254 254
 		}
255 255
 
256
-        $title = Sensei_Student::get_full_name( $item->user_id );
256
+        $title = Sensei_Student::get_full_name($item->user_id);
257 257
 
258 258
 		// QuizID to be deprecated
259
-		$quiz_id = get_post_meta( $item->comment_post_ID, '_lesson_quiz', true );
260
-		$quiz_link = esc_url( add_query_arg( array( 'page' => $this->page_slug, 'user' => $item->user_id, 'quiz_id' => $quiz_id ), admin_url( 'admin.php' ) ) );
259
+		$quiz_id = get_post_meta($item->comment_post_ID, '_lesson_quiz', true);
260
+		$quiz_link = esc_url(add_query_arg(array('page' => $this->page_slug, 'user' => $item->user_id, 'quiz_id' => $quiz_id), admin_url('admin.php')));
261 261
 
262 262
 		$grade_link = '';
263
-		switch( $item->comment_approved ) {
263
+		switch ($item->comment_approved) {
264 264
 			case 'ungraded':
265
-				$grade_link = '<a class="button-primary button" href="' . $quiz_link . '">' . __('Grade quiz', 'woothemes-sensei' ) . '</a>';
265
+				$grade_link = '<a class="button-primary button" href="'.$quiz_link.'">'.__('Grade quiz', 'woothemes-sensei').'</a>';
266 266
 				break;
267 267
 
268 268
 			case 'graded':
269 269
 			case 'passed':
270 270
 			case 'failed':
271
-				$grade_link = '<a class="button-secondary button" href="' . $quiz_link . '">' . __('Review grade', 'woothemes-sensei' ) . '</a>';
271
+				$grade_link = '<a class="button-secondary button" href="'.$quiz_link.'">'.__('Review grade', 'woothemes-sensei').'</a>';
272 272
 				break;
273 273
 		}
274 274
 
275
-		$course_id = get_post_meta( $item->comment_post_ID, '_lesson_course', true );
275
+		$course_id = get_post_meta($item->comment_post_ID, '_lesson_course', true);
276 276
 		$course_title = '';
277
-		if ( !empty($course_id) && version_compare($wp_version, '4.1', '>=') ) {
278
-			$course_title = '<a href="' . esc_url( add_query_arg( array( 'page' => $this->page_slug, 'course_id' => $course_id ), admin_url( 'admin.php' ) ) ) . '">' . get_the_title( $course_id ) . '</a>';
277
+		if ( ! empty($course_id) && version_compare($wp_version, '4.1', '>=')) {
278
+			$course_title = '<a href="'.esc_url(add_query_arg(array('page' => $this->page_slug, 'course_id' => $course_id), admin_url('admin.php'))).'">'.get_the_title($course_id).'</a>';
279 279
 		}
280
-		else if ( !empty($course_id) ) {
281
-			$course_title = get_the_title( $course_id );
280
+		else if ( ! empty($course_id)) {
281
+			$course_title = get_the_title($course_id);
282 282
 		}
283
-		$lesson_title = '<a href="' . add_query_arg( array( 'page' => $this->page_slug, 'lesson_id' => $item->comment_post_ID ), admin_url( 'admin.php' ) ) . '">' . get_the_title( $item->comment_post_ID ) . '</a>';
283
+		$lesson_title = '<a href="'.add_query_arg(array('page' => $this->page_slug, 'lesson_id' => $item->comment_post_ID), admin_url('admin.php')).'">'.get_the_title($item->comment_post_ID).'</a>';
284 284
 
285
-		$column_data = apply_filters( 'sensei_grading_main_column_data', array(
286
-				'title' => '<strong><a class="row-title" href="' . esc_url( add_query_arg( array( 'page' => $this->page_slug, 'user_id' => $item->user_id ), admin_url( 'admin.php' ) ) ) . '"">' . $title . '</a></strong>',
285
+		$column_data = apply_filters('sensei_grading_main_column_data', array(
286
+				'title' => '<strong><a class="row-title" href="'.esc_url(add_query_arg(array('page' => $this->page_slug, 'user_id' => $item->user_id), admin_url('admin.php'))).'"">'.$title.'</a></strong>',
287 287
 				'course' => $course_title,
288 288
 				'lesson' => $lesson_title,
289 289
 				'updated' => $item->comment_date,
290 290
 				'user_status' => $status_html,
291 291
 				'user_grade' => $grade,
292 292
 				'action' => $grade_link,
293
-			), $item, $course_id );
293
+			), $item, $course_id);
294 294
 
295 295
 		return $column_data;
296 296
 	}
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	 */
304 304
 	public function no_items() {
305 305
 
306
-        _e( 'No submissions found.', 'woothemes-sensei' );
306
+        _e('No submissions found.', 'woothemes-sensei');
307 307
 
308 308
 	} // End no_items()
309 309
 
@@ -316,35 +316,35 @@  discard block
 block discarded – undo
316 316
 		global  $wp_version;
317 317
 
318 318
 		echo '<div class="grading-selects">';
319
-		do_action( 'sensei_grading_before_dropdown_filters' );
319
+		do_action('sensei_grading_before_dropdown_filters');
320 320
 
321
-		echo '<div class="select-box">' . "\n";
321
+		echo '<div class="select-box">'."\n";
322 322
 
323
-			echo '<select id="grading-course-options" name="grading_course" class="chosen_select widefat">' . "\n";
323
+			echo '<select id="grading-course-options" name="grading_course" class="chosen_select widefat">'."\n";
324 324
 
325
-				echo Sensei()->grading->courses_drop_down_html( $this->course_id );
325
+				echo Sensei()->grading->courses_drop_down_html($this->course_id);
326 326
 
327
-			echo '</select>' . "\n";
327
+			echo '</select>'."\n";
328 328
 
329
-		echo '</div>' . "\n";
329
+		echo '</div>'."\n";
330 330
 
331
-		echo '<div class="select-box">' . "\n";
331
+		echo '<div class="select-box">'."\n";
332 332
 
333
-			echo '<select id="grading-lesson-options" data-placeholder="&larr; ' . __( 'Select a course', 'woothemes-sensei' ) . '" name="grading_lesson" class="chosen_select widefat">' . "\n";
333
+			echo '<select id="grading-lesson-options" data-placeholder="&larr; '.__('Select a course', 'woothemes-sensei').'" name="grading_lesson" class="chosen_select widefat">'."\n";
334 334
 
335
-				echo Sensei()->grading->lessons_drop_down_html( $this->course_id, $this->lesson_id );
335
+				echo Sensei()->grading->lessons_drop_down_html($this->course_id, $this->lesson_id);
336 336
 
337
-			echo '</select>' . "\n";
337
+			echo '</select>'."\n";
338 338
 
339
-		echo '</div>' . "\n";
339
+		echo '</div>'."\n";
340 340
 
341
-		if( $this->course_id && $this->lesson_id ) {
341
+		if ($this->course_id && $this->lesson_id) {
342 342
 
343
-			echo '<div class="select-box reset-filter">' . "\n";
343
+			echo '<div class="select-box reset-filter">'."\n";
344 344
 
345
-				echo '<a class="button-secondary" href="' . esc_url( remove_query_arg( array( 'lesson_id', 'course_id' ) ) ) . '">' . __( 'Reset filter', 'woothemes-sensei' ) . '</a>' . "\n";
345
+				echo '<a class="button-secondary" href="'.esc_url(remove_query_arg(array('lesson_id', 'course_id'))).'">'.__('Reset filter', 'woothemes-sensei').'</a>'."\n";
346 346
 
347
-			echo '</div>' . "\n";
347
+			echo '</div>'."\n";
348 348
 
349 349
 		}
350 350
 
@@ -359,26 +359,26 @@  discard block
 block discarded – undo
359 359
 		$query_args = array(
360 360
 			'page' => $this->page_slug,
361 361
 		);
362
-		if( $this->course_id ) {
362
+		if ($this->course_id) {
363 363
 			// Currently not possible to restrict to a single Course, as that requires WP_Comment to support multiple
364 364
 			// post_ids (i.e. every lesson within the Course), WP 4.1 ( https://core.trac.wordpress.org/changeset/29808 )
365 365
 			$query_args['course_id'] = $this->course_id;
366
-			if ( version_compare($wp_version, '4.1', '>=') ) {
367
-				$count_args['post__in'] = Sensei()->course->course_lessons( $this->course_id, 'any', 'ids' );
366
+			if (version_compare($wp_version, '4.1', '>=')) {
367
+				$count_args['post__in'] = Sensei()->course->course_lessons($this->course_id, 'any', 'ids');
368 368
 			}
369 369
 		}
370
-		if( $this->lesson_id ) {
370
+		if ($this->lesson_id) {
371 371
 			$query_args['lesson_id'] = $this->lesson_id;
372 372
 			// Restrict to a single lesson
373 373
 			$count_args['post_id'] = $this->lesson_id;
374 374
 		}
375
-		if( $this->search ) {
375
+		if ($this->search) {
376 376
 			$query_args['s'] = $this->search;
377 377
 		}
378
-		if ( !empty($this->user_ids) ) {
378
+		if ( ! empty($this->user_ids)) {
379 379
 			$count_args['user_id'] = $this->user_ids;
380 380
 		}
381
-		if( !empty($this->user_id) ) {
381
+		if ( ! empty($this->user_id)) {
382 382
 			$query_args['user_id'] = $this->user_id;
383 383
 			$count_args['user_id'] = $this->user_id;
384 384
 		}
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 		$all_lessons_count = $ungraded_lessons_count = $graded_lessons_count = $inprogress_lessons_count = 0;
387 387
 		$all_class = $ungraded_class = $graded_class = $inprogress_class = '';
388 388
 
389
-		switch( $this->view ) :
389
+		switch ($this->view) :
390 390
 			case 'all':
391 391
 				$all_class = 'current';
392 392
 				break;
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 				break;
403 403
 		endswitch;
404 404
 
405
-		$counts = Sensei()->grading->count_statuses( apply_filters( 'sensei_grading_count_statues', $count_args ) );
405
+		$counts = Sensei()->grading->count_statuses(apply_filters('sensei_grading_count_statues', $count_args));
406 406
 
407 407
 		$inprogress_lessons_count = $counts['in-progress'];
408 408
 		$ungraded_lessons_count = $counts['ungraded'];
@@ -418,19 +418,19 @@  discard block
 block discarded – undo
418 418
 		$inprogress_args['view'] = 'in-progress';
419 419
 
420 420
 		$format = '<a class="%s" href="%s">%s <span class="count">(%s)</span></a>';
421
-		$menu['all'] = sprintf( $format, $all_class, esc_url( add_query_arg( $all_args, admin_url( 'admin.php' ) ) ), __( 'All', 'woothemes-sensei' ), number_format( (int) $all_lessons_count ) );
422
-		$menu['ungraded'] = sprintf( $format, $ungraded_class, esc_url( add_query_arg( $ungraded_args, admin_url( 'admin.php' ) ) ), __( 'Ungraded', 'woothemes-sensei' ), number_format( (int) $ungraded_lessons_count ) );
423
-		$menu['graded'] = sprintf( $format, $graded_class, esc_url( add_query_arg( $graded_args, admin_url( 'admin.php' ) ) ), __( 'Graded', 'woothemes-sensei' ), number_format( (int) $graded_lessons_count ) );
424
-		$menu['in-progress'] = sprintf( $format, $inprogress_class, esc_url( add_query_arg( $inprogress_args, admin_url( 'admin.php' ) ) ), __( 'In Progress', 'woothemes-sensei' ), number_format( (int) $inprogress_lessons_count ) );
425
-
426
-		$menu = apply_filters( 'sensei_grading_sub_menu', $menu );
427
-		if ( !empty($menu) ) {
428
-			echo '<ul class="subsubsub">' . "\n";
429
-			foreach ( $menu as $class => $item ) {
430
-				$menu[ $class ] = "\t<li class='$class'>$item";
421
+		$menu['all'] = sprintf($format, $all_class, esc_url(add_query_arg($all_args, admin_url('admin.php'))), __('All', 'woothemes-sensei'), number_format((int) $all_lessons_count));
422
+		$menu['ungraded'] = sprintf($format, $ungraded_class, esc_url(add_query_arg($ungraded_args, admin_url('admin.php'))), __('Ungraded', 'woothemes-sensei'), number_format((int) $ungraded_lessons_count));
423
+		$menu['graded'] = sprintf($format, $graded_class, esc_url(add_query_arg($graded_args, admin_url('admin.php'))), __('Graded', 'woothemes-sensei'), number_format((int) $graded_lessons_count));
424
+		$menu['in-progress'] = sprintf($format, $inprogress_class, esc_url(add_query_arg($inprogress_args, admin_url('admin.php'))), __('In Progress', 'woothemes-sensei'), number_format((int) $inprogress_lessons_count));
425
+
426
+		$menu = apply_filters('sensei_grading_sub_menu', $menu);
427
+		if ( ! empty($menu)) {
428
+			echo '<ul class="subsubsub">'."\n";
429
+			foreach ($menu as $class => $item) {
430
+				$menu[$class] = "\t<li class='$class'>$item";
431 431
 			}
432
-			echo implode( " |</li>\n", $menu ) . "</li>\n";
433
-			echo '</ul>' . "\n";
432
+			echo implode(" |</li>\n", $menu)."</li>\n";
433
+			echo '</ul>'."\n";
434 434
 		}
435 435
 
436 436
 	} // End data_table_header()
@@ -451,4 +451,4 @@  discard block
 block discarded – undo
451 451
  * for backward compatibility
452 452
  * @since 1.9.0
453 453
  */
454
-class WooThemes_Sensei_Grading_Main extends Sensei_Grading_Main{}
454
+class WooThemes_Sensei_Grading_Main extends Sensei_Grading_Main {}
Please login to merge, or discard this patch.
includes/class-sensei-autoloader.php 3 patches
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // security check, don't load file outside WP
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
5
+// security check, don't load file outside WP
3 6
 /**
4 7
  * Sensei Autoloader Class
5 8
  *
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // security check, don't load file outside WP
2
+if ( ! defined('ABSPATH')) exit; // security check, don't load file outside WP
3 3
 /**
4 4
  * Sensei Autoloader Class
5 5
  *
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
      * Constructor
28 28
      * @since 1.9.0
29 29
      */
30
-    public function __construct(){
30
+    public function __construct() {
31 31
 
32 32
         // make sure we do not override an existing autoload function
33
-        if( function_exists('__autoload') ){
34
-           spl_autoload_register( '__autoload' );
33
+        if (function_exists('__autoload')) {
34
+           spl_autoload_register('__autoload');
35 35
         }
36 36
 
37 37
         // setup a relative path for the current autoload instance
38
-        $this->include_path = trailingslashit( untrailingslashit( dirname( __FILE__ ) ) );
38
+        $this->include_path = trailingslashit(untrailingslashit(dirname(__FILE__)));
39 39
 
40 40
         //setup the class file map
41 41
         $this->initialize_class_file_map();
42 42
 
43 43
         // add Sensei custom auto loader
44
-        spl_autoload_register( array( $this, 'autoload' )  );
44
+        spl_autoload_register(array($this, 'autoload'));
45 45
 
46 46
     }
47 47
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      *
52 52
      * @since 1.9.0
53 53
      */
54
-    public function initialize_class_file_map(){
54
+    public function initialize_class_file_map() {
55 55
 
56 56
         $this->class_file_map = array(
57 57
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
             /**
64 64
              * Admin
65 65
              */
66
-            'Sensei_Welcome'            => 'admin/class-sensei-welcome.php' ,
67
-            'Sensei_Learner_Management' => 'admin/class-sensei-learner-management.php' ,
66
+            'Sensei_Welcome'            => 'admin/class-sensei-welcome.php',
67
+            'Sensei_Learner_Management' => 'admin/class-sensei-learner-management.php',
68 68
 
69 69
             /**
70 70
              * Shortcodes
@@ -93,38 +93,38 @@  discard block
 block discarded – undo
93 93
     /**
94 94
      * Autoload all sensei files as the class names are used.
95 95
      */
96
-    public function autoload( $class ){
96
+    public function autoload($class) {
97 97
 
98 98
         // only handle classes with the word `sensei` in it
99
-        if( ! is_numeric( strpos ( strtolower( $class ), 'sensei') ) ){
99
+        if ( ! is_numeric(strpos(strtolower($class), 'sensei'))) {
100 100
 
101 101
             return;
102 102
 
103 103
         }
104 104
 
105 105
         // exit if we didn't provide mapping for this class
106
-        if( isset( $this->class_file_map[ $class ] ) ){
106
+        if (isset($this->class_file_map[$class])) {
107 107
 
108
-            $file_location = $this->include_path . $this->class_file_map[ $class ];
109
-            require_once( $file_location);
108
+            $file_location = $this->include_path.$this->class_file_map[$class];
109
+            require_once($file_location);
110 110
             return;
111 111
 
112 112
         }
113 113
 
114 114
         // check for file in the main includes directory
115
-        $class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $class ) ) . '.php';
116
-        if( file_exists( $class_file_path ) ){
115
+        $class_file_path = $this->include_path.'class-'.str_replace('_', '-', strtolower($class)).'.php';
116
+        if (file_exists($class_file_path)) {
117 117
 
118
-            require_once( $class_file_path );
118
+            require_once($class_file_path);
119 119
             return;
120 120
         }
121 121
 
122 122
         // lastly check legacy types
123
-        $stripped_woothemes_from_class = str_replace( 'woothemes_','', strtolower( $class ) ); // remove woothemes
124
-        $legacy_class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $stripped_woothemes_from_class ) ) . '.php';
125
-        if( file_exists( $legacy_class_file_path ) ){
123
+        $stripped_woothemes_from_class = str_replace('woothemes_', '', strtolower($class)); // remove woothemes
124
+        $legacy_class_file_path = $this->include_path.'class-'.str_replace('_', '-', strtolower($stripped_woothemes_from_class)).'.php';
125
+        if (file_exists($legacy_class_file_path)) {
126 126
 
127
-            require_once( $legacy_class_file_path );
127
+            require_once($legacy_class_file_path);
128 128
             return;
129 129
         }
130 130
 
Please login to merge, or discard this patch.
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -13,137 +13,137 @@
 block discarded – undo
13 13
  */
14 14
 class Sensei_Autoloader {
15 15
 
16
-    /**
17
-     * @var path to the includes directory within Sensei.
18
-     */
19
-    private $include_path = 'includes';
20
-
21
-    /**
22
-     * @var array $class_file_map. List of classes mapped to their files
23
-     */
24
-    private $class_file_map = array();
25
-
26
-    /**
27
-     * Constructor
28
-     * @since 1.9.0
29
-     */
30
-    public function __construct(){
31
-
32
-        // make sure we do not override an existing autoload function
33
-        if( function_exists('__autoload') ){
34
-           spl_autoload_register( '__autoload' );
35
-        }
36
-
37
-        // setup a relative path for the current autoload instance
38
-        $this->include_path = trailingslashit( untrailingslashit( dirname( __FILE__ ) ) );
39
-
40
-        //setup the class file map
41
-        $this->initialize_class_file_map();
42
-
43
-        // add Sensei custom auto loader
44
-        spl_autoload_register( array( $this, 'autoload' )  );
45
-
46
-    }
47
-
48
-    /**
49
-     * Generate a list of Sensei class and map them the their respective
50
-     * files within the includes directory
51
-     *
52
-     * @since 1.9.0
53
-     */
54
-    public function initialize_class_file_map(){
55
-
56
-        $this->class_file_map = array(
57
-
58
-            /**
59
-             * Main Sensei class
60
-             */
61
-            'Sensei_Main' => 'class-sensei.php',
62
-
63
-            /**
64
-             * Admin
65
-             */
66
-            'Sensei_Welcome'            => 'admin/class-sensei-welcome.php' ,
67
-            'Sensei_Learner_Management' => 'admin/class-sensei-learner-management.php' ,
68
-
69
-            /**
70
-             * Shortcodes
71
-             */
72
-            'Sensei_Shortcode_Loader'              => 'shortcodes/class-sensei-shortcode-loader.php',
73
-            'Sensei_Shortcode_Interface'           => 'shortcodes/interface-sensei-shortcode.php',
74
-            'Sensei_Shortcode_Featured_Courses'    => 'shortcodes/class-sensei-shortcode-featured-courses.php',
75
-            'Sensei_Shortcode_User_Courses'        => 'shortcodes/class-sensei-shortcode-user-courses.php',
76
-            'Sensei_Shortcode_Courses'             => 'shortcodes/class-sensei-shortcode-courses.php',
77
-            'Sensei_Shortcode_Teachers'            => 'shortcodes/class-sensei-shortcode-teachers.php',
78
-            'Sensei_Shortcode_User_Messages'       => 'shortcodes/class-sensei-shortcode-user-messages.php',
79
-            'Sensei_Shortcode_Course_Page'         => 'shortcodes/class-sensei-shortcode-course-page.php',
80
-            'Sensei_Shortcode_Lesson_Page'         => 'shortcodes/class-sensei-shortcode-lesson-page.php',
81
-            'Sensei_Shortcode_Course_Categories'   => 'shortcodes/class-sensei-shortcode-course-categories.php',
82
-            'Sensei_Shortcode_Unpurchased_Courses' => 'shortcodes/class-sensei-shortcode-unpurchased-courses.php',
83
-            'Sensei_Legacy_Shortcodes'             => 'shortcodes/class-sensei-legacy-shortcodes.php',
84
-
85
-            /**
86
-             * Built in theme integration support
87
-             */
88
-            'Sensei_Theme_Integration_Loader' => 'theme-integrations/theme-integration-loader.php',
89
-            'Sensei__S'                       => 'theme-integrations/_s.php',
90
-            'Sensei_Twentyeleven'             => 'theme-integrations/twentyeleven.php',
91
-            'Sensei_Twentytwelve'             => 'theme-integrations/twentytwelve.php',
92
-            'Sensei_Twentythirteen'           => 'theme-integrations/Twentythirteen.php',
93
-            'Sensei_Twentyfourteen'           => 'theme-integrations/Twentyfourteen.php',
94
-            'Sensei_Twentyfifteen'            => 'theme-integrations/Twentyfifteen.php',
95
-            'Sensei_Twentysixteen'            => 'theme-integrations/Twentysixteen.php',
96
-            'Sensei_Storefront'               => 'theme-integrations/Storefront.php',
97
-
98
-            /**
99
-             * WooCommerce
100
-             */
101
-            'Sensei_WC' => 'class-sensei-wc.php',
102
-
103
-        );
104
-    }
105
-
106
-    /**
107
-     * Autoload all sensei files as the class names are used.
108
-     */
109
-    public function autoload( $class ){
110
-
111
-        // only handle classes with the word `sensei` in it
112
-        if( ! is_numeric( strpos ( strtolower( $class ), 'sensei') ) ){
113
-
114
-            return;
115
-
116
-        }
117
-
118
-        // exit if we didn't provide mapping for this class
119
-        if( isset( $this->class_file_map[ $class ] ) ){
120
-
121
-            $file_location = $this->include_path . $this->class_file_map[ $class ];
122
-            require_once( $file_location);
123
-            return;
124
-
125
-        }
126
-
127
-        // check for file in the main includes directory
128
-        $class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $class ) ) . '.php';
129
-        if( file_exists( $class_file_path ) ){
130
-
131
-            require_once( $class_file_path );
132
-            return;
133
-        }
134
-
135
-        // lastly check legacy types
136
-        $stripped_woothemes_from_class = str_replace( 'woothemes_','', strtolower( $class ) ); // remove woothemes
137
-        $legacy_class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $stripped_woothemes_from_class ) ) . '.php';
138
-        if( file_exists( $legacy_class_file_path ) ){
139
-
140
-            require_once( $legacy_class_file_path );
141
-            return;
142
-        }
143
-
144
-        return;
145
-
146
-    }// end autoload
16
+	/**
17
+	 * @var path to the includes directory within Sensei.
18
+	 */
19
+	private $include_path = 'includes';
20
+
21
+	/**
22
+	 * @var array $class_file_map. List of classes mapped to their files
23
+	 */
24
+	private $class_file_map = array();
25
+
26
+	/**
27
+	 * Constructor
28
+	 * @since 1.9.0
29
+	 */
30
+	public function __construct(){
31
+
32
+		// make sure we do not override an existing autoload function
33
+		if( function_exists('__autoload') ){
34
+		   spl_autoload_register( '__autoload' );
35
+		}
36
+
37
+		// setup a relative path for the current autoload instance
38
+		$this->include_path = trailingslashit( untrailingslashit( dirname( __FILE__ ) ) );
39
+
40
+		//setup the class file map
41
+		$this->initialize_class_file_map();
42
+
43
+		// add Sensei custom auto loader
44
+		spl_autoload_register( array( $this, 'autoload' )  );
45
+
46
+	}
47
+
48
+	/**
49
+	 * Generate a list of Sensei class and map them the their respective
50
+	 * files within the includes directory
51
+	 *
52
+	 * @since 1.9.0
53
+	 */
54
+	public function initialize_class_file_map(){
55
+
56
+		$this->class_file_map = array(
57
+
58
+			/**
59
+			 * Main Sensei class
60
+			 */
61
+			'Sensei_Main' => 'class-sensei.php',
62
+
63
+			/**
64
+			 * Admin
65
+			 */
66
+			'Sensei_Welcome'            => 'admin/class-sensei-welcome.php' ,
67
+			'Sensei_Learner_Management' => 'admin/class-sensei-learner-management.php' ,
68
+
69
+			/**
70
+			 * Shortcodes
71
+			 */
72
+			'Sensei_Shortcode_Loader'              => 'shortcodes/class-sensei-shortcode-loader.php',
73
+			'Sensei_Shortcode_Interface'           => 'shortcodes/interface-sensei-shortcode.php',
74
+			'Sensei_Shortcode_Featured_Courses'    => 'shortcodes/class-sensei-shortcode-featured-courses.php',
75
+			'Sensei_Shortcode_User_Courses'        => 'shortcodes/class-sensei-shortcode-user-courses.php',
76
+			'Sensei_Shortcode_Courses'             => 'shortcodes/class-sensei-shortcode-courses.php',
77
+			'Sensei_Shortcode_Teachers'            => 'shortcodes/class-sensei-shortcode-teachers.php',
78
+			'Sensei_Shortcode_User_Messages'       => 'shortcodes/class-sensei-shortcode-user-messages.php',
79
+			'Sensei_Shortcode_Course_Page'         => 'shortcodes/class-sensei-shortcode-course-page.php',
80
+			'Sensei_Shortcode_Lesson_Page'         => 'shortcodes/class-sensei-shortcode-lesson-page.php',
81
+			'Sensei_Shortcode_Course_Categories'   => 'shortcodes/class-sensei-shortcode-course-categories.php',
82
+			'Sensei_Shortcode_Unpurchased_Courses' => 'shortcodes/class-sensei-shortcode-unpurchased-courses.php',
83
+			'Sensei_Legacy_Shortcodes'             => 'shortcodes/class-sensei-legacy-shortcodes.php',
84
+
85
+			/**
86
+			 * Built in theme integration support
87
+			 */
88
+			'Sensei_Theme_Integration_Loader' => 'theme-integrations/theme-integration-loader.php',
89
+			'Sensei__S'                       => 'theme-integrations/_s.php',
90
+			'Sensei_Twentyeleven'             => 'theme-integrations/twentyeleven.php',
91
+			'Sensei_Twentytwelve'             => 'theme-integrations/twentytwelve.php',
92
+			'Sensei_Twentythirteen'           => 'theme-integrations/Twentythirteen.php',
93
+			'Sensei_Twentyfourteen'           => 'theme-integrations/Twentyfourteen.php',
94
+			'Sensei_Twentyfifteen'            => 'theme-integrations/Twentyfifteen.php',
95
+			'Sensei_Twentysixteen'            => 'theme-integrations/Twentysixteen.php',
96
+			'Sensei_Storefront'               => 'theme-integrations/Storefront.php',
97
+
98
+			/**
99
+			 * WooCommerce
100
+			 */
101
+			'Sensei_WC' => 'class-sensei-wc.php',
102
+
103
+		);
104
+	}
105
+
106
+	/**
107
+	 * Autoload all sensei files as the class names are used.
108
+	 */
109
+	public function autoload( $class ){
110
+
111
+		// only handle classes with the word `sensei` in it
112
+		if( ! is_numeric( strpos ( strtolower( $class ), 'sensei') ) ){
113
+
114
+			return;
115
+
116
+		}
117
+
118
+		// exit if we didn't provide mapping for this class
119
+		if( isset( $this->class_file_map[ $class ] ) ){
120
+
121
+			$file_location = $this->include_path . $this->class_file_map[ $class ];
122
+			require_once( $file_location);
123
+			return;
124
+
125
+		}
126
+
127
+		// check for file in the main includes directory
128
+		$class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $class ) ) . '.php';
129
+		if( file_exists( $class_file_path ) ){
130
+
131
+			require_once( $class_file_path );
132
+			return;
133
+		}
134
+
135
+		// lastly check legacy types
136
+		$stripped_woothemes_from_class = str_replace( 'woothemes_','', strtolower( $class ) ); // remove woothemes
137
+		$legacy_class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $stripped_woothemes_from_class ) ) . '.php';
138
+		if( file_exists( $legacy_class_file_path ) ){
139
+
140
+			require_once( $legacy_class_file_path );
141
+			return;
142
+		}
143
+
144
+		return;
145
+
146
+	}// end autoload
147 147
 
148 148
 }
149 149
 new Sensei_Autoloader();
Please login to merge, or discard this patch.
includes/class-sensei-posttypes.php 3 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
5
+// Exit if accessed directly
3 6
 
4 7
 /**
5 8
  * Sensei Post Types Class
@@ -146,7 +149,7 @@  discard block
 block discarded – undo
146 149
 
147 150
              return get_page_uri( $settings_course_page->ID );
148 151
 
149
-        }else{
152
+        } else{
150 153
 
151 154
             return 'courses';
152 155
 
Please login to merge, or discard this patch.
Indentation   +245 added lines, -245 removed lines patch added patch discarded remove patch
@@ -17,25 +17,25 @@  discard block
 block discarded – undo
17 17
 	public $slider_labels;
18 18
 	public $role_caps;
19 19
 
20
-    /**
21
-     * @var Sensei_Course
22
-     */
23
-    public $course;
24
-
25
-    /**
26
-     * @var Sensei_Lesson
27
-     */
28
-    public $lesson;
29
-
30
-    /**
31
-     * @var Sensei_Question
32
-     */
33
-    public $question;
34
-
35
-    /**
36
-     * @var Sensei_Quiz
37
-     */
38
-    public $quiz;
20
+	/**
21
+	 * @var Sensei_Course
22
+	 */
23
+	public $course;
24
+
25
+	/**
26
+	 * @var Sensei_Lesson
27
+	 */
28
+	public $lesson;
29
+
30
+	/**
31
+	 * @var Sensei_Question
32
+	 */
33
+	public $question;
34
+
35
+	/**
36
+	 * @var Sensei_Quiz
37
+	 */
38
+	public $quiz;
39 39
 
40 40
 	/**
41 41
 	 * Constructor
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 		// Setup Post Types
47 47
 		$this->labels = array();
48
-        $this->token = 'woothemes-sensei-posttypes';
48
+		$this->token = 'woothemes-sensei-posttypes';
49 49
 
50 50
 		$this->setup_post_type_labels_base();
51 51
 		add_action( 'init', array( $this, 'setup_course_post_type' ), 100 );
@@ -104,94 +104,94 @@  discard block
 block discarded – undo
104 104
 	/**
105 105
 	 * Setup the "course" post type, it's admin menu item and the appropriate labels and permissions.
106 106
 	 * @since  1.0.0
107
-     * @uses  Sensei()
107
+	 * @uses  Sensei()
108 108
 	 * @return void
109 109
 	 */
110 110
 	public function setup_course_post_type () {
111 111
 
112 112
 		$args = array(
113
-		    'labels'              => $this->create_post_type_labels( $this->labels['course']['singular'], $this->labels['course']['plural'], $this->labels['course']['menu'] ),
114
-		    'public'              => true,
115
-		    'publicly_queryable'  => true,
116
-		    'show_ui'             => true,
117
-		    'show_in_menu'        => true,
118
-		    'show_in_admin_bar'   => true,
119
-		    'query_var'           => true,
120
-		    'rewrite'             => array(
121
-                'slug' => esc_attr( apply_filters( 'sensei_course_slug', _x( 'course', 'post type single url base', 'woothemes-sensei' ) ) ) ,
122
-                'with_front' => true,
123
-                'feeds' => true,
124
-                'pages' => true
125
-            ),
126
-		    'map_meta_cap'        => true,
127
-		    'capability_type'     => 'course',
128
-            'has_archive'         => $this->get_course_post_type_archive_slug(),
129
-		    'hierarchical'        => false,
130
-		    'menu_position'       => 51,
131
-		    'supports'            => array( 'title', 'editor', 'excerpt', 'thumbnail' )
113
+			'labels'              => $this->create_post_type_labels( $this->labels['course']['singular'], $this->labels['course']['plural'], $this->labels['course']['menu'] ),
114
+			'public'              => true,
115
+			'publicly_queryable'  => true,
116
+			'show_ui'             => true,
117
+			'show_in_menu'        => true,
118
+			'show_in_admin_bar'   => true,
119
+			'query_var'           => true,
120
+			'rewrite'             => array(
121
+				'slug' => esc_attr( apply_filters( 'sensei_course_slug', _x( 'course', 'post type single url base', 'woothemes-sensei' ) ) ) ,
122
+				'with_front' => true,
123
+				'feeds' => true,
124
+				'pages' => true
125
+			),
126
+			'map_meta_cap'        => true,
127
+			'capability_type'     => 'course',
128
+			'has_archive'         => $this->get_course_post_type_archive_slug(),
129
+			'hierarchical'        => false,
130
+			'menu_position'       => 51,
131
+			'supports'            => array( 'title', 'editor', 'excerpt', 'thumbnail' )
132 132
 		);
133 133
 
134
-        /**
135
-         * Filter the arguments passed in when registering the Sensei Course post type.
136
-         *
137
-         * @since 1.9.0
138
-         * @param array $args
139
-         */
134
+		/**
135
+		 * Filter the arguments passed in when registering the Sensei Course post type.
136
+		 *
137
+		 * @since 1.9.0
138
+		 * @param array $args
139
+		 */
140 140
 		register_post_type( 'course', apply_filters( 'sensei_register_post_type_course', $args ) );
141 141
 
142 142
 	} // End setup_course_post_type()
143 143
 
144
-    /**
145
-     * Figure out of the course post type has an archive and what it should be.
146
-     *
147
-     * This function should return 'courses' or the page_uri for the course page setting.
148
-     *
149
-     * For backward compatibility  sake ( pre 1.9 )If the course page set in settings
150
-     * still has any of the old shortcodes: [newcourses][featuredcourses][freecourses][paidcourses] the
151
-     * page slug will not be returned. For any other pages without it the page URI will be returned.
152
-     *
153
-     *
154
-     * @sine 1.9.0
155
-     *
156
-     *
157
-     * @return false|string
158
-     */
159
-    public function get_course_post_type_archive_slug(){
144
+	/**
145
+	 * Figure out of the course post type has an archive and what it should be.
146
+	 *
147
+	 * This function should return 'courses' or the page_uri for the course page setting.
148
+	 *
149
+	 * For backward compatibility  sake ( pre 1.9 )If the course page set in settings
150
+	 * still has any of the old shortcodes: [newcourses][featuredcourses][freecourses][paidcourses] the
151
+	 * page slug will not be returned. For any other pages without it the page URI will be returned.
152
+	 *
153
+	 *
154
+	 * @sine 1.9.0
155
+	 *
156
+	 *
157
+	 * @return false|string
158
+	 */
159
+	public function get_course_post_type_archive_slug(){
160 160
 
161
-        $settings_course_page = get_post( Sensei()->settings->get( 'course_page' ) );
161
+		$settings_course_page = get_post( Sensei()->settings->get( 'course_page' ) );
162 162
 
163
-        // for a valid post that doesn't have any of the old short codes set the archive the same
164
-        // as the page URI
165
-        if( is_a( $settings_course_page, 'WP_Post') && ! $this->has_old_shortcodes( $settings_course_page->post_content ) ){
163
+		// for a valid post that doesn't have any of the old short codes set the archive the same
164
+		// as the page URI
165
+		if( is_a( $settings_course_page, 'WP_Post') && ! $this->has_old_shortcodes( $settings_course_page->post_content ) ){
166 166
 
167
-             return get_page_uri( $settings_course_page->ID );
167
+			 return get_page_uri( $settings_course_page->ID );
168 168
 
169
-        }else{
169
+		}else{
170 170
 
171
-            return 'courses';
171
+			return 'courses';
172 172
 
173
-        }
173
+		}
174 174
 
175
-    }// end course_post_type_determine_archive
175
+	}// end course_post_type_determine_archive
176 176
 
177
-    /**
178
-     * Check if given content has any of these old shortcodes:
179
-     * [newcourses][featuredcourses][freecourses][paidcourses]
180
-     *
181
-     * @since 1.9.0
182
-     *
183
-     * @param string $content
184
-     *
185
-     * @return bool
186
-     */
187
-    public function has_old_shortcodes( $content ){
177
+	/**
178
+	 * Check if given content has any of these old shortcodes:
179
+	 * [newcourses][featuredcourses][freecourses][paidcourses]
180
+	 *
181
+	 * @since 1.9.0
182
+	 *
183
+	 * @param string $content
184
+	 *
185
+	 * @return bool
186
+	 */
187
+	public function has_old_shortcodes( $content ){
188 188
 
189
-        return  ( has_shortcode( $content, 'newcourses')
190
-        || has_shortcode( $content, 'featuredcourses')
191
-        || has_shortcode( $content, 'freecourses')
192
-        || has_shortcode( $content, 'paidcourses') );
189
+		return  ( has_shortcode( $content, 'newcourses')
190
+		|| has_shortcode( $content, 'featuredcourses')
191
+		|| has_shortcode( $content, 'freecourses')
192
+		|| has_shortcode( $content, 'paidcourses') );
193 193
 
194
-    }// end has old shortcodes
194
+	}// end has old shortcodes
195 195
 
196 196
 
197 197
 	/**
@@ -213,32 +213,32 @@  discard block
 block discarded – undo
213 213
 		} // End If Statement
214 214
 
215 215
 		$args = array(
216
-		    'labels' => $this->create_post_type_labels(  $this->labels['lesson']['singular'], $this->labels['lesson']['plural'], $this->labels['lesson']['menu'] ),
217
-		    'public' => true,
218
-		    'publicly_queryable' => true,
219
-		    'show_ui' => true,
220
-		    'show_in_menu' => true,
221
-		    'query_var' => true,
222
-		    'rewrite' => array(
223
-                'slug' => esc_attr( apply_filters( 'sensei_lesson_slug', _x( 'lesson', 'post type single slug', 'woothemes-sensei' ) ) ) ,
224
-                'with_front' =>  true,
225
-                'feeds' => true,
226
-                'pages' => true
227
-            ),
228
-		    'map_meta_cap' => true,
229
-		    'capability_type' => 'lesson',
230
-		    'has_archive' => true,
231
-		    'hierarchical' => false,
232
-		    'menu_position' => 52,
233
-		    'supports' => $supports_array
216
+			'labels' => $this->create_post_type_labels(  $this->labels['lesson']['singular'], $this->labels['lesson']['plural'], $this->labels['lesson']['menu'] ),
217
+			'public' => true,
218
+			'publicly_queryable' => true,
219
+			'show_ui' => true,
220
+			'show_in_menu' => true,
221
+			'query_var' => true,
222
+			'rewrite' => array(
223
+				'slug' => esc_attr( apply_filters( 'sensei_lesson_slug', _x( 'lesson', 'post type single slug', 'woothemes-sensei' ) ) ) ,
224
+				'with_front' =>  true,
225
+				'feeds' => true,
226
+				'pages' => true
227
+			),
228
+			'map_meta_cap' => true,
229
+			'capability_type' => 'lesson',
230
+			'has_archive' => true,
231
+			'hierarchical' => false,
232
+			'menu_position' => 52,
233
+			'supports' => $supports_array
234 234
 		);
235 235
 
236
-        /**
237
-         * Filter the arguments passed in when registering the Sensei Lesson post type.
238
-         *
239
-         * @since 1.9.0
240
-         * @param array $args
241
-         */
236
+		/**
237
+		 * Filter the arguments passed in when registering the Sensei Lesson post type.
238
+		 *
239
+		 * @since 1.9.0
240
+		 * @param array $args
241
+		 */
242 242
 		register_post_type( 'lesson', apply_filters( 'sensei_register_post_type_lesson', $args ) );
243 243
 
244 244
 	} // End setup_lesson_post_type()
@@ -246,45 +246,45 @@  discard block
 block discarded – undo
246 246
 	/**
247 247
 	 * Setup the "quiz" post type, it's admin menu item and the appropriate labels and permissions.
248 248
 	 * @since  1.0.0
249
-     * @uses  Sensei()
249
+	 * @uses  Sensei()
250 250
 	 * @return void
251 251
 	 */
252 252
 	public function setup_quiz_post_type () {
253 253
 
254 254
 
255 255
 		$args = array(
256
-		    'labels' => $this->create_post_type_labels(
257
-                $this->labels['quiz']['singular'],
258
-                $this->labels['quiz']['plural'],
259
-                $this->labels['quiz']['menu']
260
-            ),
261
-		    'public' => true,
262
-		    'publicly_queryable' => true,
263
-		    'show_ui' => true,
264
-		    'show_in_menu' => false,
265
-		    'show_in_nav_menus' => false,
266
-		    'query_var' => true,
267
-		    'exclude_from_search' => true,
268
-		    'rewrite' => array(
269
-                'slug' => esc_attr( apply_filters( 'sensei_quiz_slug', _x( 'quiz', 'post type single slug', 'woothemes-sensei' ) ) ) ,
270
-                'with_front' =>  true,
271
-                'feeds' => true,
272
-                'pages' => true
273
-            ),
274
-		    'map_meta_cap' => true,
275
-		    'capability_type' => 'quiz',
276
-		    'has_archive' => false,
277
-		    'hierarchical' => false,
278
-		    'menu_position' => 20, // Below "Pages"
279
-		    'supports' => array( '' )
256
+			'labels' => $this->create_post_type_labels(
257
+				$this->labels['quiz']['singular'],
258
+				$this->labels['quiz']['plural'],
259
+				$this->labels['quiz']['menu']
260
+			),
261
+			'public' => true,
262
+			'publicly_queryable' => true,
263
+			'show_ui' => true,
264
+			'show_in_menu' => false,
265
+			'show_in_nav_menus' => false,
266
+			'query_var' => true,
267
+			'exclude_from_search' => true,
268
+			'rewrite' => array(
269
+				'slug' => esc_attr( apply_filters( 'sensei_quiz_slug', _x( 'quiz', 'post type single slug', 'woothemes-sensei' ) ) ) ,
270
+				'with_front' =>  true,
271
+				'feeds' => true,
272
+				'pages' => true
273
+			),
274
+			'map_meta_cap' => true,
275
+			'capability_type' => 'quiz',
276
+			'has_archive' => false,
277
+			'hierarchical' => false,
278
+			'menu_position' => 20, // Below "Pages"
279
+			'supports' => array( '' )
280 280
 		);
281 281
 
282
-        /**
283
-         * Filter the arguments passed in when registering the Sensei Quiz post type.
284
-         *
285
-         * @since 1.9.0
286
-         * @param array $args
287
-         */
282
+		/**
283
+		 * Filter the arguments passed in when registering the Sensei Quiz post type.
284
+		 *
285
+		 * @since 1.9.0
286
+		 * @param array $args
287
+		 */
288 288
 		register_post_type( 'quiz', apply_filters( 'sensei_register_post_type_quiz', $args ) );
289 289
 
290 290
 	} // End setup_quiz_post_type()
@@ -298,34 +298,34 @@  discard block
 block discarded – undo
298 298
 	public function setup_question_post_type () {
299 299
 
300 300
 		$args = array(
301
-		    'labels' => $this->create_post_type_labels( $this->labels['question']['singular'], $this->labels['question']['plural'], $this->labels['question']['menu'] ),
302
-		    'public' => false,
303
-		    'publicly_queryable' => true,
304
-		    'show_ui' => true,
305
-		    'show_in_menu' => true,
306
-		    'show_in_nav_menus' => false,
307
-		    'query_var' => true,
308
-		    'exclude_from_search' => true,
309
-		    'rewrite' => array(
310
-                'slug' => esc_attr( apply_filters( 'sensei_question_slug', _x( 'question', 'post type single slug', 'woothemes-sensei' ) ) ) ,
311
-                'with_front' =>  true,
312
-                'feeds' => true,
313
-                'pages' => true
314
-            ),
315
-		    'map_meta_cap' => true,
316
-		    'capability_type' => 'question',
317
-		    'has_archive' => true,
318
-		    'hierarchical' => false,
319
-		    'menu_position' => 51,
320
-		    'supports' => array( 'title' )
301
+			'labels' => $this->create_post_type_labels( $this->labels['question']['singular'], $this->labels['question']['plural'], $this->labels['question']['menu'] ),
302
+			'public' => false,
303
+			'publicly_queryable' => true,
304
+			'show_ui' => true,
305
+			'show_in_menu' => true,
306
+			'show_in_nav_menus' => false,
307
+			'query_var' => true,
308
+			'exclude_from_search' => true,
309
+			'rewrite' => array(
310
+				'slug' => esc_attr( apply_filters( 'sensei_question_slug', _x( 'question', 'post type single slug', 'woothemes-sensei' ) ) ) ,
311
+				'with_front' =>  true,
312
+				'feeds' => true,
313
+				'pages' => true
314
+			),
315
+			'map_meta_cap' => true,
316
+			'capability_type' => 'question',
317
+			'has_archive' => true,
318
+			'hierarchical' => false,
319
+			'menu_position' => 51,
320
+			'supports' => array( 'title' )
321 321
 		);
322 322
 
323
-        /**
324
-         * Filter the arguments passed in when registering the Sensei Question post type.
325
-         *
326
-         * @since 1.9.0
327
-         * @param array $args
328
-         */
323
+		/**
324
+		 * Filter the arguments passed in when registering the Sensei Question post type.
325
+		 *
326
+		 * @since 1.9.0
327
+		 * @param array $args
328
+		 */
329 329
 		register_post_type( 'question', apply_filters('sensei_register_post_type_question', $args ) );
330 330
 
331 331
 	} // End setup_question_post_type()
@@ -338,26 +338,26 @@  discard block
 block discarded – undo
338 338
 	public function setup_multiple_question_post_type () {
339 339
 
340 340
 		$args = array(
341
-		    'labels' => $this->create_post_type_labels( $this->labels['multiple_question']['singular'], $this->labels['multiple_question']['plural'], $this->labels['multiple_question']['menu'] ),
342
-		    'public' => false,
343
-		    'publicly_queryable' => false,
344
-		    'show_ui' => false,
345
-		    'show_in_menu' => false,
346
-		    'show_in_nav_menus' => false,
347
-		    'query_var' => false,
348
-		    'exclude_from_search' => true,
349
-		    'rewrite' => array(
350
-                'slug' => esc_attr( apply_filters( 'sensei_multiple_question_slug', _x( 'multiple_question', 'post type single slug', 'woothemes-sensei' ) ) ) ,
351
-                'with_front' =>  false,
352
-                'feeds' => false,
353
-                'pages' => false
354
-            ),
355
-		    'map_meta_cap' => true,
356
-		    'capability_type' => 'question',
357
-		    'has_archive' => false,
358
-		    'hierarchical' => false,
359
-		    'menu_position' => 51,
360
-		    'supports' => array( 'title', 'custom-fields' )
341
+			'labels' => $this->create_post_type_labels( $this->labels['multiple_question']['singular'], $this->labels['multiple_question']['plural'], $this->labels['multiple_question']['menu'] ),
342
+			'public' => false,
343
+			'publicly_queryable' => false,
344
+			'show_ui' => false,
345
+			'show_in_menu' => false,
346
+			'show_in_nav_menus' => false,
347
+			'query_var' => false,
348
+			'exclude_from_search' => true,
349
+			'rewrite' => array(
350
+				'slug' => esc_attr( apply_filters( 'sensei_multiple_question_slug', _x( 'multiple_question', 'post type single slug', 'woothemes-sensei' ) ) ) ,
351
+				'with_front' =>  false,
352
+				'feeds' => false,
353
+				'pages' => false
354
+			),
355
+			'map_meta_cap' => true,
356
+			'capability_type' => 'question',
357
+			'has_archive' => false,
358
+			'hierarchical' => false,
359
+			'menu_position' => 51,
360
+			'supports' => array( 'title', 'custom-fields' )
361 361
 		);
362 362
 
363 363
 		register_post_type( 'multiple_question', $args );
@@ -374,34 +374,34 @@  discard block
 block discarded – undo
374 374
 		if( ! isset( Sensei()->settings->settings['messages_disable'] ) || ! Sensei()->settings->settings['messages_disable'] ) {
375 375
 
376 376
 			$args = array(
377
-			    'labels' => $this->create_post_type_labels( $this->labels['sensei_message']['singular'], $this->labels['sensei_message']['plural'], $this->labels['sensei_message']['menu'] ),
378
-			    'public' => true,
379
-			    'publicly_queryable' => true,
380
-			    'show_ui' => true,
381
-			    'show_in_menu' => 'sensei',
382
-			    'show_in_nav_menus' => true,
383
-			    'query_var' => true,
384
-			    'exclude_from_search' => true,
385
-			    'rewrite' => array(
386
-                    'slug' => esc_attr( apply_filters( 'sensei_messages_slug', _x( 'messages', 'post type single slug', 'woothemes-sensei' ) ) ) ,
387
-                    'with_front' =>  false,
388
-                    'feeds' => false,
389
-                    'pages' => true
390
-                ),
391
-			    'map_meta_cap' => true,
392
-			    'capability_type' => 'question',
393
-			    'has_archive' => true,
394
-			    'hierarchical' => false,
395
-			    'menu_position' => 50,
396
-			    'supports' => array( 'title', 'editor', 'comments' ),
377
+				'labels' => $this->create_post_type_labels( $this->labels['sensei_message']['singular'], $this->labels['sensei_message']['plural'], $this->labels['sensei_message']['menu'] ),
378
+				'public' => true,
379
+				'publicly_queryable' => true,
380
+				'show_ui' => true,
381
+				'show_in_menu' => 'sensei',
382
+				'show_in_nav_menus' => true,
383
+				'query_var' => true,
384
+				'exclude_from_search' => true,
385
+				'rewrite' => array(
386
+					'slug' => esc_attr( apply_filters( 'sensei_messages_slug', _x( 'messages', 'post type single slug', 'woothemes-sensei' ) ) ) ,
387
+					'with_front' =>  false,
388
+					'feeds' => false,
389
+					'pages' => true
390
+				),
391
+				'map_meta_cap' => true,
392
+				'capability_type' => 'question',
393
+				'has_archive' => true,
394
+				'hierarchical' => false,
395
+				'menu_position' => 50,
396
+				'supports' => array( 'title', 'editor', 'comments' ),
397 397
 			);
398 398
 
399
-            /**
400
-             * Filter the arguments passed in when registering the Sensei sensei_message post type.
401
-             *
402
-             * @since 1.9.0
403
-             * @param array $args
404
-             */
399
+			/**
400
+			 * Filter the arguments passed in when registering the Sensei sensei_message post type.
401
+			 *
402
+			 * @since 1.9.0
403
+			 * @param array $args
404
+			 */
405 405
 			register_post_type( 'sensei_message', apply_filters('sensei_register_post_type_sensei_message',  $args ) );
406 406
 		}
407 407
 	} // End setup_sensei_message_post_type()
@@ -434,11 +434,11 @@  discard block
 block discarded – undo
434 434
 			'show_ui' => true,
435 435
 			'query_var' => true,
436 436
 			'show_in_nav_menus' => true,
437
-            'capabilities' => array(
438
-                'manage_terms' => 'manage_categories',
439
-                'edit_terms'   => 'edit_courses',
440
-                'delete_terms' => 'manage_categories',
441
-                'assign_terms' => 'edit_courses',),
437
+			'capabilities' => array(
438
+				'manage_terms' => 'manage_categories',
439
+				'edit_terms'   => 'edit_courses',
440
+				'delete_terms' => 'manage_categories',
441
+				'assign_terms' => 'edit_courses',),
442 442
 			'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_course_category_slug', _x( 'course-category', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) )
443 443
 		);
444 444
 
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 			'show_ui' => true, /* TO DO - future releases */
475 475
 			'query_var' => true,
476 476
 			'show_in_nav_menus' => false,
477
-            'public' => false,
477
+			'public' => false,
478 478
 			'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_quiz_type_slug', _x( 'quiz-type', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) )
479 479
 		);
480 480
 
@@ -546,11 +546,11 @@  discard block
 block discarded – undo
546 546
 			'query_var' => false,
547 547
 			'show_in_nav_menus' => false,
548 548
 			'show_admin_column' => true,
549
-            'capabilities' => array(
550
-                'manage_terms' => 'manage_categories',
551
-                'edit_terms'   => 'edit_questions',
552
-                'delete_terms' => 'manage_categories',
553
-                'assign_terms' => 'edit_questions',),
549
+			'capabilities' => array(
550
+				'manage_terms' => 'manage_categories',
551
+				'edit_terms'   => 'edit_questions',
552
+				'delete_terms' => 'manage_categories',
553
+				'assign_terms' => 'edit_questions',),
554 554
 			'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_question_category_slug', _x( 'question-category', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) )
555 555
 		);
556 556
 
@@ -584,11 +584,11 @@  discard block
 block discarded – undo
584 584
 			'show_ui' => true,
585 585
 			'query_var' => true,
586 586
 			'show_in_nav_menus' => true,
587
-            'capabilities' => array(
588
-                'manage_terms' => 'manage_categories',
589
-                'edit_terms'   => 'edit_lessons',
590
-                'delete_terms' => 'manage_categories',
591
-                'assign_terms' => 'edit_lessons',),
587
+			'capabilities' => array(
588
+				'manage_terms' => 'manage_categories',
589
+				'edit_terms'   => 'edit_lessons',
590
+				'delete_terms' => 'manage_categories',
591
+				'assign_terms' => 'edit_lessons',),
592 592
 			'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_lesson_tag_slug', _x( 'lesson-tag', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) )
593 593
 		);
594 594
 
@@ -622,19 +622,19 @@  discard block
 block discarded – undo
622 622
 	 */
623 623
 	private function create_post_type_labels ( $singular, $plural, $menu ) {
624 624
 		$labels = array(
625
-		    'name' => sprintf( _x( '%s', 'post type general name', 'woothemes-sensei' ), $plural ),
626
-		    'singular_name' => sprintf( _x( '%s', 'post type singular name', 'woothemes-sensei' ), $singular ),
627
-		    'add_new' => __( 'Add New', 'woothemes-sensei' ),
628
-		    'add_new_item' => sprintf( __( 'Add New %s', 'woothemes-sensei' ), $singular ),
629
-		    'edit_item' => sprintf( __( 'Edit %s', 'woothemes-sensei' ), $singular ),
630
-		    'new_item' => sprintf( __( 'New %s', 'woothemes-sensei' ), $singular ),
631
-		    'all_items' => sprintf( __( 'All %s', 'woothemes-sensei' ), $plural ),
632
-		    'view_item' => sprintf( __( 'View %s', 'woothemes-sensei' ), $singular ),
633
-		    'search_items' => sprintf( __( 'Search %s', 'woothemes-sensei' ), $plural ),
634
-		    'not_found' =>  sprintf( __( 'No %s found', 'woothemes-sensei' ), mb_strtolower( $plural, 'UTF-8') ),
635
-		    'not_found_in_trash' => sprintf( __( 'No %s found in Trash', 'woothemes-sensei' ), mb_strtolower( $plural, 'UTF-8') ),
636
-		    'parent_item_colon' => '',
637
-		    'menu_name' => sprintf( __( '%s', 'woothemes-sensei' ), $menu )
625
+			'name' => sprintf( _x( '%s', 'post type general name', 'woothemes-sensei' ), $plural ),
626
+			'singular_name' => sprintf( _x( '%s', 'post type singular name', 'woothemes-sensei' ), $singular ),
627
+			'add_new' => __( 'Add New', 'woothemes-sensei' ),
628
+			'add_new_item' => sprintf( __( 'Add New %s', 'woothemes-sensei' ), $singular ),
629
+			'edit_item' => sprintf( __( 'Edit %s', 'woothemes-sensei' ), $singular ),
630
+			'new_item' => sprintf( __( 'New %s', 'woothemes-sensei' ), $singular ),
631
+			'all_items' => sprintf( __( 'All %s', 'woothemes-sensei' ), $plural ),
632
+			'view_item' => sprintf( __( 'View %s', 'woothemes-sensei' ), $singular ),
633
+			'search_items' => sprintf( __( 'Search %s', 'woothemes-sensei' ), $plural ),
634
+			'not_found' =>  sprintf( __( 'No %s found', 'woothemes-sensei' ), mb_strtolower( $plural, 'UTF-8') ),
635
+			'not_found_in_trash' => sprintf( __( 'No %s found in Trash', 'woothemes-sensei' ), mb_strtolower( $plural, 'UTF-8') ),
636
+			'parent_item_colon' => '',
637
+			'menu_name' => sprintf( __( '%s', 'woothemes-sensei' ), $menu )
638 638
 		  );
639 639
 
640 640
 		return $labels;
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 	 * Assigns the defaults for each user role capabilities.
708 708
 	 *
709 709
 	 * @since  1.1.0
710
-     *
710
+	 *
711 711
 	 * @param array $post_types
712 712
 	 * @return void
713 713
 	 */
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 	 * Adds a 'Edit Quiz' link to the admin bar when viewing a Quiz linked to a corresponding Lesson
776 776
 	 * 
777 777
 	 * @since  1.7.0
778
-     * @param WP_Admin_Bar $bar
778
+	 * @param WP_Admin_Bar $bar
779 779
 	 * @return void
780 780
 	 */
781 781
 	public function quiz_admin_bar_menu( $bar ) {
Please login to merge, or discard this patch.
Spacing   +237 added lines, -237 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly
3 3
 
4 4
 /**
5 5
  * Sensei Post Types Class
@@ -41,43 +41,43 @@  discard block
 block discarded – undo
41 41
 	 * Constructor
42 42
 	 * @since  1.0.0
43 43
 	 */
44
-	public function __construct () {
44
+	public function __construct() {
45 45
 
46 46
 		// Setup Post Types
47 47
 		$this->labels = array();
48 48
         $this->token = 'woothemes-sensei-posttypes';
49 49
 
50 50
 		$this->setup_post_type_labels_base();
51
-		add_action( 'init', array( $this, 'setup_course_post_type' ), 100 );
52
-		add_action( 'init', array( $this, 'setup_lesson_post_type' ), 100 );
53
-		add_action( 'init', array( $this, 'setup_quiz_post_type' ), 100 );
54
-		add_action( 'init', array( $this, 'setup_question_post_type' ), 100 );
55
-		add_action( 'init', array( $this, 'setup_multiple_question_post_type' ), 100 );
56
-		add_action( 'init', array( $this, 'setup_sensei_message_post_type' ), 100 );
51
+		add_action('init', array($this, 'setup_course_post_type'), 100);
52
+		add_action('init', array($this, 'setup_lesson_post_type'), 100);
53
+		add_action('init', array($this, 'setup_quiz_post_type'), 100);
54
+		add_action('init', array($this, 'setup_question_post_type'), 100);
55
+		add_action('init', array($this, 'setup_multiple_question_post_type'), 100);
56
+		add_action('init', array($this, 'setup_sensei_message_post_type'), 100);
57 57
 
58 58
 		// Setup Taxonomies
59
-		add_action( 'init', array( $this, 'setup_course_category_taxonomy' ), 100 );
60
-		add_action( 'init', array( $this, 'setup_quiz_type_taxonomy' ), 100 );
61
-		add_action( 'init', array( $this, 'setup_question_type_taxonomy' ), 100 );
62
-		add_action( 'init', array( $this, 'setup_question_category_taxonomy' ), 100 );
63
-		add_action( 'init', array( $this, 'setup_lesson_tag_taxonomy' ), 100 );
59
+		add_action('init', array($this, 'setup_course_category_taxonomy'), 100);
60
+		add_action('init', array($this, 'setup_quiz_type_taxonomy'), 100);
61
+		add_action('init', array($this, 'setup_question_type_taxonomy'), 100);
62
+		add_action('init', array($this, 'setup_question_category_taxonomy'), 100);
63
+		add_action('init', array($this, 'setup_lesson_tag_taxonomy'), 100);
64 64
 
65 65
 		// Load Post Type Objects
66
-		$default_post_types = array( 'course' => 'Course', 'lesson' => 'Lesson', 'quiz' => 'Quiz', 'question' => 'Question', 'messages' => 'Messages' ) ;
67
-		$this->load_posttype_objects( $default_post_types );
66
+		$default_post_types = array('course' => 'Course', 'lesson' => 'Lesson', 'quiz' => 'Quiz', 'question' => 'Question', 'messages' => 'Messages');
67
+		$this->load_posttype_objects($default_post_types);
68 68
 
69 69
 		// Admin functions
70
-		if ( is_admin() ) {
71
-			$this->set_role_cap_defaults( $default_post_types );
70
+		if (is_admin()) {
71
+			$this->set_role_cap_defaults($default_post_types);
72 72
 			global $pagenow;
73
-			if ( ( $pagenow == 'post.php' || $pagenow == 'post-new.php' ) ) {
74
-				add_filter( 'enter_title_here', array( $this, 'enter_title_here' ), 10 );
75
-				add_filter( 'post_updated_messages', array( $this, 'setup_post_type_messages' ) );
73
+			if (($pagenow == 'post.php' || $pagenow == 'post-new.php')) {
74
+				add_filter('enter_title_here', array($this, 'enter_title_here'), 10);
75
+				add_filter('post_updated_messages', array($this, 'setup_post_type_messages'));
76 76
 			} // End If Statement
77 77
 		} // End If Statement
78 78
 
79 79
 		// Add 'Edit Quiz' link to admin bar
80
-		add_action( 'admin_bar_menu', array( $this, 'quiz_admin_bar_menu' ), 81 );
80
+		add_action('admin_bar_menu', array($this, 'quiz_admin_bar_menu'), 81);
81 81
 
82 82
 	} // End __construct()
83 83
 
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
 	 * @param array $posttypes (default: array())
89 89
 	 * @return void
90 90
 	 */
91
-	public function load_posttype_objects( $posttypes = array() ) {
91
+	public function load_posttype_objects($posttypes = array()) {
92 92
 
93
-		foreach ( $posttypes as $posttype_token => $posttype_name ) {
93
+		foreach ($posttypes as $posttype_token => $posttype_name) {
94 94
 
95 95
 			// Load the files
96
-			$class_name = 'WooThemes_Sensei_' . $posttype_name;
96
+			$class_name = 'WooThemes_Sensei_'.$posttype_name;
97 97
 			$this->$posttype_token = new $class_name();
98 98
 			$this->$posttype_token->token = $posttype_token;
99 99
 
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
      * @uses  Sensei()
108 108
 	 * @return void
109 109
 	 */
110
-	public function setup_course_post_type () {
110
+	public function setup_course_post_type() {
111 111
 
112 112
 		$args = array(
113
-		    'labels'              => $this->create_post_type_labels( $this->labels['course']['singular'], $this->labels['course']['plural'], $this->labels['course']['menu'] ),
113
+		    'labels'              => $this->create_post_type_labels($this->labels['course']['singular'], $this->labels['course']['plural'], $this->labels['course']['menu']),
114 114
 		    'public'              => true,
115 115
 		    'publicly_queryable'  => true,
116 116
 		    'show_ui'             => true,
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		    'show_in_admin_bar'   => true,
119 119
 		    'query_var'           => true,
120 120
 		    'rewrite'             => array(
121
-                'slug' => esc_attr( apply_filters( 'sensei_course_slug', _x( 'course', 'post type single url base', 'woothemes-sensei' ) ) ) ,
121
+                'slug' => esc_attr(apply_filters('sensei_course_slug', _x('course', 'post type single url base', 'woothemes-sensei'))),
122 122
                 'with_front' => true,
123 123
                 'feeds' => true,
124 124
                 'pages' => true
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             'has_archive'         => $this->get_course_post_type_archive_slug(),
129 129
 		    'hierarchical'        => false,
130 130
 		    'menu_position'       => 51,
131
-		    'supports'            => array( 'title', 'editor', 'excerpt', 'thumbnail' )
131
+		    'supports'            => array('title', 'editor', 'excerpt', 'thumbnail')
132 132
 		);
133 133
 
134 134
         /**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
          * @since 1.9.0
138 138
          * @param array $args
139 139
          */
140
-		register_post_type( 'course', apply_filters( 'sensei_register_post_type_course', $args ) );
140
+		register_post_type('course', apply_filters('sensei_register_post_type_course', $args));
141 141
 
142 142
 	} // End setup_course_post_type()
143 143
 
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
      *
157 157
      * @return false|string
158 158
      */
159
-    public function get_course_post_type_archive_slug(){
159
+    public function get_course_post_type_archive_slug() {
160 160
 
161
-        $settings_course_page = get_post( Sensei()->settings->get( 'course_page' ) );
161
+        $settings_course_page = get_post(Sensei()->settings->get('course_page'));
162 162
 
163 163
         // for a valid post that doesn't have any of the old short codes set the archive the same
164 164
         // as the page URI
165
-        if( is_a( $settings_course_page, 'WP_Post') && ! $this->has_old_shortcodes( $settings_course_page->post_content ) ){
165
+        if (is_a($settings_course_page, 'WP_Post') && ! $this->has_old_shortcodes($settings_course_page->post_content)) {
166 166
 
167
-             return get_page_uri( $settings_course_page->ID );
167
+             return get_page_uri($settings_course_page->ID);
168 168
 
169
-        }else{
169
+        } else {
170 170
 
171 171
             return 'courses';
172 172
 
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
      *
185 185
      * @return bool
186 186
      */
187
-    public function has_old_shortcodes( $content ){
187
+    public function has_old_shortcodes($content) {
188 188
 
189
-        return  ( has_shortcode( $content, 'newcourses')
190
-        || has_shortcode( $content, 'featuredcourses')
191
-        || has_shortcode( $content, 'freecourses')
192
-        || has_shortcode( $content, 'paidcourses') );
189
+        return  (has_shortcode($content, 'newcourses')
190
+        || has_shortcode($content, 'featuredcourses')
191
+        || has_shortcode($content, 'freecourses')
192
+        || has_shortcode($content, 'paidcourses'));
193 193
 
194 194
     }// end has old shortcodes
195 195
 
@@ -200,27 +200,27 @@  discard block
 block discarded – undo
200 200
 	 * @uses  Sensei()
201 201
 	 * @return void
202 202
 	 */
203
-	public function setup_lesson_post_type () {
203
+	public function setup_lesson_post_type() {
204 204
 
205 205
 
206
-		$supports_array = array( 'title', 'editor', 'excerpt', 'thumbnail', 'page-attributes' );
206
+		$supports_array = array('title', 'editor', 'excerpt', 'thumbnail', 'page-attributes');
207 207
 		$allow_comments = false;
208
-		if ( isset( Sensei()->settings->settings[ 'lesson_comments' ] ) ) {
209
-			$allow_comments = Sensei()->settings->settings[ 'lesson_comments' ];
208
+		if (isset(Sensei()->settings->settings['lesson_comments'])) {
209
+			$allow_comments = Sensei()->settings->settings['lesson_comments'];
210 210
 		} // End If Statement
211
-		if ( $allow_comments ) {
212
-			array_push( $supports_array, 'comments' );
211
+		if ($allow_comments) {
212
+			array_push($supports_array, 'comments');
213 213
 		} // End If Statement
214 214
 
215 215
 		$args = array(
216
-		    'labels' => $this->create_post_type_labels(  $this->labels['lesson']['singular'], $this->labels['lesson']['plural'], $this->labels['lesson']['menu'] ),
216
+		    'labels' => $this->create_post_type_labels($this->labels['lesson']['singular'], $this->labels['lesson']['plural'], $this->labels['lesson']['menu']),
217 217
 		    'public' => true,
218 218
 		    'publicly_queryable' => true,
219 219
 		    'show_ui' => true,
220 220
 		    'show_in_menu' => true,
221 221
 		    'query_var' => true,
222 222
 		    'rewrite' => array(
223
-                'slug' => esc_attr( apply_filters( 'sensei_lesson_slug', _x( 'lesson', 'post type single slug', 'woothemes-sensei' ) ) ) ,
223
+                'slug' => esc_attr(apply_filters('sensei_lesson_slug', _x('lesson', 'post type single slug', 'woothemes-sensei'))),
224 224
                 'with_front' =>  true,
225 225
                 'feeds' => true,
226 226
                 'pages' => true
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
          * @since 1.9.0
240 240
          * @param array $args
241 241
          */
242
-		register_post_type( 'lesson', apply_filters( 'sensei_register_post_type_lesson', $args ) );
242
+		register_post_type('lesson', apply_filters('sensei_register_post_type_lesson', $args));
243 243
 
244 244
 	} // End setup_lesson_post_type()
245 245
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      * @uses  Sensei()
250 250
 	 * @return void
251 251
 	 */
252
-	public function setup_quiz_post_type () {
252
+	public function setup_quiz_post_type() {
253 253
 
254 254
 
255 255
 		$args = array(
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 		    'query_var' => true,
267 267
 		    'exclude_from_search' => true,
268 268
 		    'rewrite' => array(
269
-                'slug' => esc_attr( apply_filters( 'sensei_quiz_slug', _x( 'quiz', 'post type single slug', 'woothemes-sensei' ) ) ) ,
269
+                'slug' => esc_attr(apply_filters('sensei_quiz_slug', _x('quiz', 'post type single slug', 'woothemes-sensei'))),
270 270
                 'with_front' =>  true,
271 271
                 'feeds' => true,
272 272
                 'pages' => true
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 		    'has_archive' => false,
277 277
 		    'hierarchical' => false,
278 278
 		    'menu_position' => 20, // Below "Pages"
279
-		    'supports' => array( '' )
279
+		    'supports' => array('')
280 280
 		);
281 281
 
282 282
         /**
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
          * @since 1.9.0
286 286
          * @param array $args
287 287
          */
288
-		register_post_type( 'quiz', apply_filters( 'sensei_register_post_type_quiz', $args ) );
288
+		register_post_type('quiz', apply_filters('sensei_register_post_type_quiz', $args));
289 289
 
290 290
 	} // End setup_quiz_post_type()
291 291
 
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
 	 * @since  1.0.0
296 296
 	 * @return void
297 297
 	 */
298
-	public function setup_question_post_type () {
298
+	public function setup_question_post_type() {
299 299
 
300 300
 		$args = array(
301
-		    'labels' => $this->create_post_type_labels( $this->labels['question']['singular'], $this->labels['question']['plural'], $this->labels['question']['menu'] ),
301
+		    'labels' => $this->create_post_type_labels($this->labels['question']['singular'], $this->labels['question']['plural'], $this->labels['question']['menu']),
302 302
 		    'public' => false,
303 303
 		    'publicly_queryable' => true,
304 304
 		    'show_ui' => true,
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 		    'query_var' => true,
308 308
 		    'exclude_from_search' => true,
309 309
 		    'rewrite' => array(
310
-                'slug' => esc_attr( apply_filters( 'sensei_question_slug', _x( 'question', 'post type single slug', 'woothemes-sensei' ) ) ) ,
310
+                'slug' => esc_attr(apply_filters('sensei_question_slug', _x('question', 'post type single slug', 'woothemes-sensei'))),
311 311
                 'with_front' =>  true,
312 312
                 'feeds' => true,
313 313
                 'pages' => true
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 		    'has_archive' => true,
318 318
 		    'hierarchical' => false,
319 319
 		    'menu_position' => 51,
320
-		    'supports' => array( 'title' )
320
+		    'supports' => array('title')
321 321
 		);
322 322
 
323 323
         /**
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
          * @since 1.9.0
327 327
          * @param array $args
328 328
          */
329
-		register_post_type( 'question', apply_filters('sensei_register_post_type_question', $args ) );
329
+		register_post_type('question', apply_filters('sensei_register_post_type_question', $args));
330 330
 
331 331
 	} // End setup_question_post_type()
332 332
 
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 	 * @since  1.6.0
336 336
 	 * @return void
337 337
 	 */
338
-	public function setup_multiple_question_post_type () {
338
+	public function setup_multiple_question_post_type() {
339 339
 
340 340
 		$args = array(
341
-		    'labels' => $this->create_post_type_labels( $this->labels['multiple_question']['singular'], $this->labels['multiple_question']['plural'], $this->labels['multiple_question']['menu'] ),
341
+		    'labels' => $this->create_post_type_labels($this->labels['multiple_question']['singular'], $this->labels['multiple_question']['plural'], $this->labels['multiple_question']['menu']),
342 342
 		    'public' => false,
343 343
 		    'publicly_queryable' => false,
344 344
 		    'show_ui' => false,
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 		    'query_var' => false,
348 348
 		    'exclude_from_search' => true,
349 349
 		    'rewrite' => array(
350
-                'slug' => esc_attr( apply_filters( 'sensei_multiple_question_slug', _x( 'multiple_question', 'post type single slug', 'woothemes-sensei' ) ) ) ,
350
+                'slug' => esc_attr(apply_filters('sensei_multiple_question_slug', _x('multiple_question', 'post type single slug', 'woothemes-sensei'))),
351 351
                 'with_front' =>  false,
352 352
                 'feeds' => false,
353 353
                 'pages' => false
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
 		    'has_archive' => false,
358 358
 		    'hierarchical' => false,
359 359
 		    'menu_position' => 51,
360
-		    'supports' => array( 'title', 'custom-fields' )
360
+		    'supports' => array('title', 'custom-fields')
361 361
 		);
362 362
 
363
-		register_post_type( 'multiple_question', $args );
363
+		register_post_type('multiple_question', $args);
364 364
 	} // End setup_multiple_question_post_type()
365 365
 
366 366
 	/**
@@ -368,13 +368,13 @@  discard block
 block discarded – undo
368 368
 	 * @since  1.6.0
369 369
 	 * @return void
370 370
 	 */
371
-	public function setup_sensei_message_post_type () {
371
+	public function setup_sensei_message_post_type() {
372 372
 
373 373
 
374
-		if( ! isset( Sensei()->settings->settings['messages_disable'] ) || ! Sensei()->settings->settings['messages_disable'] ) {
374
+		if ( ! isset(Sensei()->settings->settings['messages_disable']) || ! Sensei()->settings->settings['messages_disable']) {
375 375
 
376 376
 			$args = array(
377
-			    'labels' => $this->create_post_type_labels( $this->labels['sensei_message']['singular'], $this->labels['sensei_message']['plural'], $this->labels['sensei_message']['menu'] ),
377
+			    'labels' => $this->create_post_type_labels($this->labels['sensei_message']['singular'], $this->labels['sensei_message']['plural'], $this->labels['sensei_message']['menu']),
378 378
 			    'public' => true,
379 379
 			    'publicly_queryable' => true,
380 380
 			    'show_ui' => true,
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 			    'query_var' => true,
384 384
 			    'exclude_from_search' => true,
385 385
 			    'rewrite' => array(
386
-                    'slug' => esc_attr( apply_filters( 'sensei_messages_slug', _x( 'messages', 'post type single slug', 'woothemes-sensei' ) ) ) ,
386
+                    'slug' => esc_attr(apply_filters('sensei_messages_slug', _x('messages', 'post type single slug', 'woothemes-sensei'))),
387 387
                     'with_front' =>  false,
388 388
                     'feeds' => false,
389 389
                     'pages' => true
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 			    'has_archive' => true,
394 394
 			    'hierarchical' => false,
395 395
 			    'menu_position' => 50,
396
-			    'supports' => array( 'title', 'editor', 'comments' ),
396
+			    'supports' => array('title', 'editor', 'comments'),
397 397
 			);
398 398
 
399 399
             /**
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
              * @since 1.9.0
403 403
              * @param array $args
404 404
              */
405
-			register_post_type( 'sensei_message', apply_filters('sensei_register_post_type_sensei_message',  $args ) );
405
+			register_post_type('sensei_message', apply_filters('sensei_register_post_type_sensei_message', $args));
406 406
 		}
407 407
 	} // End setup_sensei_message_post_type()
408 408
 
@@ -411,20 +411,20 @@  discard block
 block discarded – undo
411 411
 	 * @since  1.1.0
412 412
 	 * @return void
413 413
 	 */
414
-	public function setup_course_category_taxonomy () {
414
+	public function setup_course_category_taxonomy() {
415 415
 		// "Course Categories" Custom Taxonomy
416 416
 		$labels = array(
417
-			'name' => _x( 'Course Categories', 'taxonomy general name', 'woothemes-sensei' ),
418
-			'singular_name' => _x( 'Course Category', 'taxonomy singular name', 'woothemes-sensei' ),
419
-			'search_items' =>  __( 'Search Course Categories', 'woothemes-sensei' ),
420
-			'all_items' => __( 'All Course Categories', 'woothemes-sensei' ),
421
-			'parent_item' => __( 'Parent Course Category', 'woothemes-sensei' ),
422
-			'parent_item_colon' => __( 'Parent Course Category:', 'woothemes-sensei' ),
423
-			'edit_item' => __( 'Edit Course Category', 'woothemes-sensei' ),
424
-			'update_item' => __( 'Update Course Category', 'woothemes-sensei' ),
425
-			'add_new_item' => __( 'Add New Course Category', 'woothemes-sensei' ),
426
-			'new_item_name' => __( 'New Course Category Name', 'woothemes-sensei' ),
427
-			'menu_name' => __( 'Course Categories', 'woothemes-sensei' ),
417
+			'name' => _x('Course Categories', 'taxonomy general name', 'woothemes-sensei'),
418
+			'singular_name' => _x('Course Category', 'taxonomy singular name', 'woothemes-sensei'),
419
+			'search_items' =>  __('Search Course Categories', 'woothemes-sensei'),
420
+			'all_items' => __('All Course Categories', 'woothemes-sensei'),
421
+			'parent_item' => __('Parent Course Category', 'woothemes-sensei'),
422
+			'parent_item_colon' => __('Parent Course Category:', 'woothemes-sensei'),
423
+			'edit_item' => __('Edit Course Category', 'woothemes-sensei'),
424
+			'update_item' => __('Update Course Category', 'woothemes-sensei'),
425
+			'add_new_item' => __('Add New Course Category', 'woothemes-sensei'),
426
+			'new_item_name' => __('New Course Category Name', 'woothemes-sensei'),
427
+			'menu_name' => __('Course Categories', 'woothemes-sensei'),
428 428
 			'popular_items' => null // Hides the "Popular" section above the "add" form in the admin.
429 429
 		);
430 430
 
@@ -439,10 +439,10 @@  discard block
 block discarded – undo
439 439
                 'edit_terms'   => 'edit_courses',
440 440
                 'delete_terms' => 'manage_categories',
441 441
                 'assign_terms' => 'edit_courses',),
442
-			'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_course_category_slug', _x( 'course-category', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) )
442
+			'rewrite' => array('slug' => esc_attr(apply_filters('sensei_course_category_slug', _x('course-category', 'taxonomy archive slug', 'woothemes-sensei'))))
443 443
 		);
444 444
 
445
-		register_taxonomy( 'course-category', array( 'course' ), $args );
445
+		register_taxonomy('course-category', array('course'), $args);
446 446
 
447 447
 	} // End setup_course_category_taxonomy()
448 448
 
@@ -451,20 +451,20 @@  discard block
 block discarded – undo
451 451
 	 * @since  1.0.0
452 452
 	 * @return void
453 453
 	 */
454
-	public function setup_quiz_type_taxonomy () {
454
+	public function setup_quiz_type_taxonomy() {
455 455
 		// "Quiz Types" Custom Taxonomy
456 456
 		$labels = array(
457
-			'name' => _x( 'Quiz Types', 'taxonomy general name', 'woothemes-sensei' ),
458
-			'singular_name' => _x( 'Quiz Type', 'taxonomy singular name', 'woothemes-sensei' ),
459
-			'search_items' =>  __( 'Search Quiz Types', 'woothemes-sensei' ),
460
-			'all_items' => __( 'All Quiz Types', 'woothemes-sensei' ),
461
-			'parent_item' => __( 'Parent Quiz Type', 'woothemes-sensei' ),
462
-			'parent_item_colon' => __( 'Parent Quiz Type:', 'woothemes-sensei' ),
463
-			'edit_item' => __( 'Edit Quiz Type', 'woothemes-sensei' ),
464
-			'update_item' => __( 'Update Quiz Type', 'woothemes-sensei' ),
465
-			'add_new_item' => __( 'Add New Quiz Type', 'woothemes-sensei' ),
466
-			'new_item_name' => __( 'New Quiz Type Name', 'woothemes-sensei' ),
467
-			'menu_name' => __( 'Quiz Types', 'woothemes-sensei' ),
457
+			'name' => _x('Quiz Types', 'taxonomy general name', 'woothemes-sensei'),
458
+			'singular_name' => _x('Quiz Type', 'taxonomy singular name', 'woothemes-sensei'),
459
+			'search_items' =>  __('Search Quiz Types', 'woothemes-sensei'),
460
+			'all_items' => __('All Quiz Types', 'woothemes-sensei'),
461
+			'parent_item' => __('Parent Quiz Type', 'woothemes-sensei'),
462
+			'parent_item_colon' => __('Parent Quiz Type:', 'woothemes-sensei'),
463
+			'edit_item' => __('Edit Quiz Type', 'woothemes-sensei'),
464
+			'update_item' => __('Update Quiz Type', 'woothemes-sensei'),
465
+			'add_new_item' => __('Add New Quiz Type', 'woothemes-sensei'),
466
+			'new_item_name' => __('New Quiz Type Name', 'woothemes-sensei'),
467
+			'menu_name' => __('Quiz Types', 'woothemes-sensei'),
468 468
 			'popular_items' => null // Hides the "Popular" section above the "add" form in the admin.
469 469
 		);
470 470
 
@@ -475,10 +475,10 @@  discard block
 block discarded – undo
475 475
 			'query_var' => true,
476 476
 			'show_in_nav_menus' => false,
477 477
             'public' => false,
478
-			'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_quiz_type_slug', _x( 'quiz-type', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) )
478
+			'rewrite' => array('slug' => esc_attr(apply_filters('sensei_quiz_type_slug', _x('quiz-type', 'taxonomy archive slug', 'woothemes-sensei'))))
479 479
 		);
480 480
 
481
-		register_taxonomy( 'quiz-type', array( 'quiz' ), $args );
481
+		register_taxonomy('quiz-type', array('quiz'), $args);
482 482
 	} // End setup_quiz_type_taxonomy()
483 483
 
484 484
 	/**
@@ -486,20 +486,20 @@  discard block
 block discarded – undo
486 486
 	 * @since  1.3.0
487 487
 	 * @return void
488 488
 	 */
489
-	public function setup_question_type_taxonomy () {
489
+	public function setup_question_type_taxonomy() {
490 490
 		// "Question Types" Custom Taxonomy
491 491
 		$labels = array(
492
-			'name' => _x( 'Question Types', 'taxonomy general name', 'woothemes-sensei' ),
493
-			'singular_name' => _x( 'Question Type', 'taxonomy singular name', 'woothemes-sensei' ),
494
-			'search_items' =>  __( 'Search Question Types', 'woothemes-sensei' ),
495
-			'all_items' => __( 'All Question Types', 'woothemes-sensei' ),
496
-			'parent_item' => __( 'Parent Question Type', 'woothemes-sensei' ),
497
-			'parent_item_colon' => __( 'Parent Question Type:', 'woothemes-sensei' ),
498
-			'edit_item' => __( 'Edit Question Type', 'woothemes-sensei' ),
499
-			'update_item' => __( 'Update Question Type', 'woothemes-sensei' ),
500
-			'add_new_item' => __( 'Add New Question Type', 'woothemes-sensei' ),
501
-			'new_item_name' => __( 'New Question Type Name', 'woothemes-sensei' ),
502
-			'menu_name' => __( 'Question Types', 'woothemes-sensei' ),
492
+			'name' => _x('Question Types', 'taxonomy general name', 'woothemes-sensei'),
493
+			'singular_name' => _x('Question Type', 'taxonomy singular name', 'woothemes-sensei'),
494
+			'search_items' =>  __('Search Question Types', 'woothemes-sensei'),
495
+			'all_items' => __('All Question Types', 'woothemes-sensei'),
496
+			'parent_item' => __('Parent Question Type', 'woothemes-sensei'),
497
+			'parent_item_colon' => __('Parent Question Type:', 'woothemes-sensei'),
498
+			'edit_item' => __('Edit Question Type', 'woothemes-sensei'),
499
+			'update_item' => __('Update Question Type', 'woothemes-sensei'),
500
+			'add_new_item' => __('Add New Question Type', 'woothemes-sensei'),
501
+			'new_item_name' => __('New Question Type Name', 'woothemes-sensei'),
502
+			'menu_name' => __('Question Types', 'woothemes-sensei'),
503 503
 			'popular_items' => null // Hides the "Popular" section above the "add" form in the admin.
504 504
 		);
505 505
 
@@ -511,10 +511,10 @@  discard block
 block discarded – undo
511 511
 			'query_var' => false,
512 512
 			'show_in_nav_menus' => false,
513 513
 			'show_admin_column' => true,
514
-			'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_question_type_slug', _x( 'question-type', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) )
514
+			'rewrite' => array('slug' => esc_attr(apply_filters('sensei_question_type_slug', _x('question-type', 'taxonomy archive slug', 'woothemes-sensei'))))
515 515
 		);
516 516
 
517
-		register_taxonomy( 'question-type', array( 'question' ), $args );
517
+		register_taxonomy('question-type', array('question'), $args);
518 518
 	} // End setup_question_type_taxonomy()
519 519
 
520 520
 	/**
@@ -522,20 +522,20 @@  discard block
 block discarded – undo
522 522
 	 * @since  1.3.0
523 523
 	 * @return void
524 524
 	 */
525
-	public function setup_question_category_taxonomy () {
525
+	public function setup_question_category_taxonomy() {
526 526
 		// "Question Categories" Custom Taxonomy
527 527
 		$labels = array(
528
-			'name' => _x( 'Question Categories', 'taxonomy general name', 'woothemes-sensei' ),
529
-			'singular_name' => _x( 'Question Category', 'taxonomy singular name', 'woothemes-sensei' ),
530
-			'search_items' =>  __( 'Search Question Categories', 'woothemes-sensei' ),
531
-			'all_items' => __( 'All Question Categories', 'woothemes-sensei' ),
532
-			'parent_item' => __( 'Parent Question Category', 'woothemes-sensei' ),
533
-			'parent_item_colon' => __( 'Parent Question Category:', 'woothemes-sensei' ),
534
-			'edit_item' => __( 'Edit Question Category', 'woothemes-sensei' ),
535
-			'update_item' => __( 'Update Question Category', 'woothemes-sensei' ),
536
-			'add_new_item' => __( 'Add New Question Category', 'woothemes-sensei' ),
537
-			'new_item_name' => __( 'New Question Category Name', 'woothemes-sensei' ),
538
-			'menu_name' => __( 'Categories', 'woothemes-sensei' ),
528
+			'name' => _x('Question Categories', 'taxonomy general name', 'woothemes-sensei'),
529
+			'singular_name' => _x('Question Category', 'taxonomy singular name', 'woothemes-sensei'),
530
+			'search_items' =>  __('Search Question Categories', 'woothemes-sensei'),
531
+			'all_items' => __('All Question Categories', 'woothemes-sensei'),
532
+			'parent_item' => __('Parent Question Category', 'woothemes-sensei'),
533
+			'parent_item_colon' => __('Parent Question Category:', 'woothemes-sensei'),
534
+			'edit_item' => __('Edit Question Category', 'woothemes-sensei'),
535
+			'update_item' => __('Update Question Category', 'woothemes-sensei'),
536
+			'add_new_item' => __('Add New Question Category', 'woothemes-sensei'),
537
+			'new_item_name' => __('New Question Category Name', 'woothemes-sensei'),
538
+			'menu_name' => __('Categories', 'woothemes-sensei'),
539 539
 		);
540 540
 
541 541
 		$args = array(
@@ -551,10 +551,10 @@  discard block
 block discarded – undo
551 551
                 'edit_terms'   => 'edit_questions',
552 552
                 'delete_terms' => 'manage_categories',
553 553
                 'assign_terms' => 'edit_questions',),
554
-			'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_question_category_slug', _x( 'question-category', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) )
554
+			'rewrite' => array('slug' => esc_attr(apply_filters('sensei_question_category_slug', _x('question-category', 'taxonomy archive slug', 'woothemes-sensei'))))
555 555
 		);
556 556
 
557
-		register_taxonomy( 'question-category', array( 'question' ), $args );
557
+		register_taxonomy('question-category', array('question'), $args);
558 558
 	} // End setup_question_type_taxonomy()
559 559
 
560 560
 	/**
@@ -562,20 +562,20 @@  discard block
 block discarded – undo
562 562
 	 * @since  1.5.0
563 563
 	 * @return void
564 564
 	 */
565
-	public function setup_lesson_tag_taxonomy () {
565
+	public function setup_lesson_tag_taxonomy() {
566 566
 		// "Lesson Tags" Custom Taxonomy
567 567
 		$labels = array(
568
-			'name' => _x( 'Lesson Tags', 'taxonomy general name', 'woothemes-sensei' ),
569
-			'singular_name' => _x( 'Lesson Tag', 'taxonomy singular name', 'woothemes-sensei' ),
570
-			'search_items' =>  __( 'Search Lesson Tags', 'woothemes-sensei' ),
571
-			'all_items' => __( 'All Lesson Tags', 'woothemes-sensei' ),
572
-			'parent_item' => __( 'Parent Tag', 'woothemes-sensei' ),
573
-			'parent_item_colon' => __( 'Parent Tag:', 'woothemes-sensei' ),
574
-			'edit_item' => __( 'Edit Lesson Tag', 'woothemes-sensei' ),
575
-			'update_item' => __( 'Update Lesson Tag', 'woothemes-sensei' ),
576
-			'add_new_item' => __( 'Add New Lesson Tag', 'woothemes-sensei' ),
577
-			'new_item_name' => __( 'New Tag Name', 'woothemes-sensei' ),
578
-			'menu_name' => __( 'Lesson Tags', 'woothemes-sensei' )
568
+			'name' => _x('Lesson Tags', 'taxonomy general name', 'woothemes-sensei'),
569
+			'singular_name' => _x('Lesson Tag', 'taxonomy singular name', 'woothemes-sensei'),
570
+			'search_items' =>  __('Search Lesson Tags', 'woothemes-sensei'),
571
+			'all_items' => __('All Lesson Tags', 'woothemes-sensei'),
572
+			'parent_item' => __('Parent Tag', 'woothemes-sensei'),
573
+			'parent_item_colon' => __('Parent Tag:', 'woothemes-sensei'),
574
+			'edit_item' => __('Edit Lesson Tag', 'woothemes-sensei'),
575
+			'update_item' => __('Update Lesson Tag', 'woothemes-sensei'),
576
+			'add_new_item' => __('Add New Lesson Tag', 'woothemes-sensei'),
577
+			'new_item_name' => __('New Tag Name', 'woothemes-sensei'),
578
+			'menu_name' => __('Lesson Tags', 'woothemes-sensei')
579 579
 		);
580 580
 
581 581
 		$args = array(
@@ -589,10 +589,10 @@  discard block
 block discarded – undo
589 589
                 'edit_terms'   => 'edit_lessons',
590 590
                 'delete_terms' => 'manage_categories',
591 591
                 'assign_terms' => 'edit_lessons',),
592
-			'rewrite' => array( 'slug' => esc_attr( apply_filters( 'sensei_lesson_tag_slug', _x( 'lesson-tag', 'taxonomy archive slug', 'woothemes-sensei' ) ) ) )
592
+			'rewrite' => array('slug' => esc_attr(apply_filters('sensei_lesson_tag_slug', _x('lesson-tag', 'taxonomy archive slug', 'woothemes-sensei'))))
593 593
 		);
594 594
 
595
-		register_taxonomy( 'lesson-tag', array( 'lesson' ), $args );
595
+		register_taxonomy('lesson-tag', array('lesson'), $args);
596 596
 	} // End setup_lesson_tag_taxonomy()
597 597
 
598 598
 	/**
@@ -600,15 +600,15 @@  discard block
 block discarded – undo
600 600
 	 * @since  1.0.0
601 601
 	 * @return void
602 602
 	 */
603
-	private function setup_post_type_labels_base () {
604
-		$this->labels = array( 'course' => array(), 'lesson' => array(), 'quiz' => array(), 'question' => array() );
603
+	private function setup_post_type_labels_base() {
604
+		$this->labels = array('course' => array(), 'lesson' => array(), 'quiz' => array(), 'question' => array());
605 605
 
606
-		$this->labels['course'] = array( 'singular' => __( 'Course', 'woothemes-sensei' ), 'plural' => __( 'Courses', 'woothemes-sensei' ), 'menu' => __( 'Courses', 'woothemes-sensei' ) );
607
-		$this->labels['lesson'] = array( 'singular' => __( 'Lesson', 'woothemes-sensei' ), 'plural' => __( 'Lessons', 'woothemes-sensei' ), 'menu' => __( 'Lessons', 'woothemes-sensei' ) );
608
-		$this->labels['quiz'] = array( 'singular' => __( 'Quiz', 'woothemes-sensei' ), 'plural' => __( 'Quizzes', 'woothemes-sensei' ), 'menu' => __( 'Quizzes', 'woothemes-sensei' ) );
609
-		$this->labels['question'] = array( 'singular' => __( 'Question', 'woothemes-sensei' ), 'plural' => __( 'Questions', 'woothemes-sensei' ), 'menu' => __( 'Questions', 'woothemes-sensei' ) );
610
-		$this->labels['multiple_question'] = array( 'singular' => __( 'Multiple Question', 'woothemes-sensei' ), 'plural' => __( 'Multiple Questions', 'woothemes-sensei' ), 'menu' => __( 'Multiple Questions', 'woothemes-sensei' ) );
611
-		$this->labels['sensei_message'] = array( 'singular' => __( 'Message', 'woothemes-sensei' ), 'plural' => __( 'Messages', 'woothemes-sensei' ), 'menu' => __( 'Messages', 'woothemes-sensei' ) );
606
+		$this->labels['course'] = array('singular' => __('Course', 'woothemes-sensei'), 'plural' => __('Courses', 'woothemes-sensei'), 'menu' => __('Courses', 'woothemes-sensei'));
607
+		$this->labels['lesson'] = array('singular' => __('Lesson', 'woothemes-sensei'), 'plural' => __('Lessons', 'woothemes-sensei'), 'menu' => __('Lessons', 'woothemes-sensei'));
608
+		$this->labels['quiz'] = array('singular' => __('Quiz', 'woothemes-sensei'), 'plural' => __('Quizzes', 'woothemes-sensei'), 'menu' => __('Quizzes', 'woothemes-sensei'));
609
+		$this->labels['question'] = array('singular' => __('Question', 'woothemes-sensei'), 'plural' => __('Questions', 'woothemes-sensei'), 'menu' => __('Questions', 'woothemes-sensei'));
610
+		$this->labels['multiple_question'] = array('singular' => __('Multiple Question', 'woothemes-sensei'), 'plural' => __('Multiple Questions', 'woothemes-sensei'), 'menu' => __('Multiple Questions', 'woothemes-sensei'));
611
+		$this->labels['sensei_message'] = array('singular' => __('Message', 'woothemes-sensei'), 'plural' => __('Messages', 'woothemes-sensei'), 'menu' => __('Messages', 'woothemes-sensei'));
612 612
 
613 613
 	} // End setup_post_type_labels_base()
614 614
 
@@ -620,21 +620,21 @@  discard block
 block discarded – undo
620 620
 	 * @param  string $menu     The menu item label
621 621
 	 * @return array            An array of the labels to be used
622 622
 	 */
623
-	private function create_post_type_labels ( $singular, $plural, $menu ) {
623
+	private function create_post_type_labels($singular, $plural, $menu) {
624 624
 		$labels = array(
625
-		    'name' => sprintf( _x( '%s', 'post type general name', 'woothemes-sensei' ), $plural ),
626
-		    'singular_name' => sprintf( _x( '%s', 'post type singular name', 'woothemes-sensei' ), $singular ),
627
-		    'add_new' => __( 'Add New', 'woothemes-sensei' ),
628
-		    'add_new_item' => sprintf( __( 'Add New %s', 'woothemes-sensei' ), $singular ),
629
-		    'edit_item' => sprintf( __( 'Edit %s', 'woothemes-sensei' ), $singular ),
630
-		    'new_item' => sprintf( __( 'New %s', 'woothemes-sensei' ), $singular ),
631
-		    'all_items' => sprintf( __( 'All %s', 'woothemes-sensei' ), $plural ),
632
-		    'view_item' => sprintf( __( 'View %s', 'woothemes-sensei' ), $singular ),
633
-		    'search_items' => sprintf( __( 'Search %s', 'woothemes-sensei' ), $plural ),
634
-		    'not_found' =>  sprintf( __( 'No %s found', 'woothemes-sensei' ), mb_strtolower( $plural, 'UTF-8') ),
635
-		    'not_found_in_trash' => sprintf( __( 'No %s found in Trash', 'woothemes-sensei' ), mb_strtolower( $plural, 'UTF-8') ),
625
+		    'name' => sprintf(_x('%s', 'post type general name', 'woothemes-sensei'), $plural),
626
+		    'singular_name' => sprintf(_x('%s', 'post type singular name', 'woothemes-sensei'), $singular),
627
+		    'add_new' => __('Add New', 'woothemes-sensei'),
628
+		    'add_new_item' => sprintf(__('Add New %s', 'woothemes-sensei'), $singular),
629
+		    'edit_item' => sprintf(__('Edit %s', 'woothemes-sensei'), $singular),
630
+		    'new_item' => sprintf(__('New %s', 'woothemes-sensei'), $singular),
631
+		    'all_items' => sprintf(__('All %s', 'woothemes-sensei'), $plural),
632
+		    'view_item' => sprintf(__('View %s', 'woothemes-sensei'), $singular),
633
+		    'search_items' => sprintf(__('Search %s', 'woothemes-sensei'), $plural),
634
+		    'not_found' =>  sprintf(__('No %s found', 'woothemes-sensei'), mb_strtolower($plural, 'UTF-8')),
635
+		    'not_found_in_trash' => sprintf(__('No %s found in Trash', 'woothemes-sensei'), mb_strtolower($plural, 'UTF-8')),
636 636
 		    'parent_item_colon' => '',
637
-		    'menu_name' => sprintf( __( '%s', 'woothemes-sensei' ), $menu )
637
+		    'menu_name' => sprintf(__('%s', 'woothemes-sensei'), $menu)
638 638
 		  );
639 639
 
640 640
 		return $labels;
@@ -646,14 +646,14 @@  discard block
 block discarded – undo
646 646
 	 * @param  array $messages The existing array of messages for post types.
647 647
 	 * @return array           The modified array of messages for post types.
648 648
 	 */
649
-	public function setup_post_type_messages ( $messages ) {
649
+	public function setup_post_type_messages($messages) {
650 650
 		global $post, $post_ID;
651 651
 
652
-		$messages['course'] = $this->create_post_type_messages( 'course' );
653
-		$messages['lesson'] = $this->create_post_type_messages( 'lesson' );
654
-		$messages['quiz'] = $this->create_post_type_messages( 'quiz' );
655
-		$messages['question'] = $this->create_post_type_messages( 'question' );
656
-		$messages['multiple_question'] = $this->create_post_type_messages( 'multiple_question' );
652
+		$messages['course'] = $this->create_post_type_messages('course');
653
+		$messages['lesson'] = $this->create_post_type_messages('lesson');
654
+		$messages['quiz'] = $this->create_post_type_messages('quiz');
655
+		$messages['question'] = $this->create_post_type_messages('question');
656
+		$messages['multiple_question'] = $this->create_post_type_messages('multiple_question');
657 657
 
658 658
 		return $messages;
659 659
 	} // End setup_post_type_messages()
@@ -664,23 +664,23 @@  discard block
 block discarded – undo
664 664
 	 * @param  string $post_type The post type for which to create messages.
665 665
 	 * @return array            An array of messages (empty array if the post type isn't one we're looking to work with).
666 666
 	 */
667
-	private function create_post_type_messages ( $post_type ) {
667
+	private function create_post_type_messages($post_type) {
668 668
 		global $post, $post_ID;
669 669
 
670
-		if ( ! isset( $this->labels[$post_type] ) ) { return array(); }
670
+		if ( ! isset($this->labels[$post_type])) { return array(); }
671 671
 
672 672
 		$messages = array(
673 673
 			0 => '',
674
-			1 => sprintf( __( '%1$s updated. %2$sView %1$s%3$s.' , 'woothemes-sensei' ), $this->labels[$post_type]['singular'], '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ),
675
-			2 => __( 'Custom field updated.' , 'woothemes-sensei' ),
676
-			3 => __( 'Custom field deleted.' , 'woothemes-sensei' ),
677
-			4 => sprintf( __( '%1$s updated.' , 'woothemes-sensei' ), $this->labels[$post_type]['singular'] ),
678
-			5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s.' , 'woothemes-sensei' ), $this->labels[$post_type]['singular'], wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
679
-			6 => sprintf( __( '%1$s published. %2$sView %1$s%3$s.' , 'woothemes-sensei' ), $this->labels[$post_type]['singular'], '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ),
680
-			7 => sprintf( __( '%1$s saved.' , 'woothemes-sensei' ), $this->labels[$post_type]['singular'] ),
681
-			8 => sprintf( __( '%1$s submitted. %2$sPreview %1$s%3$s.' , 'woothemes-sensei' ), $this->labels[$post_type]['singular'], '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) . '">', '</a>' ),
682
-			9 => sprintf( __( '%1$s scheduled for: %2$s. %3$sPreview %4$s%5$s.' , 'woothemes-sensei' ), $this->labels[$post_type]['singular'], '<strong>' . date_i18n( __( 'M j, Y @ G:i' , 'woothemes-sensei' ), strtotime( $post->post_date ) ) . '</strong>', '<a target="_blank" href="' . esc_url( get_permalink( $post_ID ) ) . '">', $this->labels[$post_type]['singular'], '</a>' ),
683
-			10 => sprintf( __( '%1$s draft updated. %2$sPreview %3$s%4$s.' , 'woothemes-sensei' ), $this->labels[$post_type]['singular'], '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) . '">', $this->labels[$post_type]['singular'], '</a>' ),
674
+			1 => sprintf(__('%1$s updated. %2$sView %1$s%3$s.', 'woothemes-sensei'), $this->labels[$post_type]['singular'], '<a href="'.esc_url(get_permalink($post_ID)).'">', '</a>'),
675
+			2 => __('Custom field updated.', 'woothemes-sensei'),
676
+			3 => __('Custom field deleted.', 'woothemes-sensei'),
677
+			4 => sprintf(__('%1$s updated.', 'woothemes-sensei'), $this->labels[$post_type]['singular']),
678
+			5 => isset($_GET['revision']) ? sprintf(__('%1$s restored to revision from %2$s.', 'woothemes-sensei'), $this->labels[$post_type]['singular'], wp_post_revision_title((int) $_GET['revision'], false)) : false,
679
+			6 => sprintf(__('%1$s published. %2$sView %1$s%3$s.', 'woothemes-sensei'), $this->labels[$post_type]['singular'], '<a href="'.esc_url(get_permalink($post_ID)).'">', '</a>'),
680
+			7 => sprintf(__('%1$s saved.', 'woothemes-sensei'), $this->labels[$post_type]['singular']),
681
+			8 => sprintf(__('%1$s submitted. %2$sPreview %1$s%3$s.', 'woothemes-sensei'), $this->labels[$post_type]['singular'], '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))).'">', '</a>'),
682
+			9 => sprintf(__('%1$s scheduled for: %2$s. %3$sPreview %4$s%5$s.', 'woothemes-sensei'), $this->labels[$post_type]['singular'], '<strong>'.date_i18n(__('M j, Y @ G:i', 'woothemes-sensei'), strtotime($post->post_date)).'</strong>', '<a target="_blank" href="'.esc_url(get_permalink($post_ID)).'">', $this->labels[$post_type]['singular'], '</a>'),
683
+			10 => sprintf(__('%1$s draft updated. %2$sPreview %3$s%4$s.', 'woothemes-sensei'), $this->labels[$post_type]['singular'], '<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))).'">', $this->labels[$post_type]['singular'], '</a>'),
684 684
 		);
685 685
 
686 686
 		return $messages;
@@ -693,11 +693,11 @@  discard block
 block discarded – undo
693 693
 	 * @param  string $title
694 694
 	 * @return string $title
695 695
 	 */
696
-	public function enter_title_here ( $title ) {
697
-		if ( get_post_type() == 'course' ) {
698
-			$title = __( 'Enter a title for this course here', 'woothemes-sensei' );
699
-		} elseif ( get_post_type() == 'lesson' ) {
700
-			$title = __( 'Enter a title for this lesson here', 'woothemes-sensei' );
696
+	public function enter_title_here($title) {
697
+		if (get_post_type() == 'course') {
698
+			$title = __('Enter a title for this course here', 'woothemes-sensei');
699
+		} elseif (get_post_type() == 'lesson') {
700
+			$title = __('Enter a title for this lesson here', 'woothemes-sensei');
701 701
 		}
702 702
 
703 703
 		return $title;
@@ -711,60 +711,60 @@  discard block
 block discarded – undo
711 711
 	 * @param array $post_types
712 712
 	 * @return void
713 713
 	 */
714
-	public function set_role_cap_defaults( $post_types = array() ) {
714
+	public function set_role_cap_defaults($post_types = array()) {
715 715
 
716
-		foreach ( $post_types as $post_type_item => $post_type_name ) {
716
+		foreach ($post_types as $post_type_item => $post_type_name) {
717 717
 			// Super Admin
718
-			$this->role_caps[] =  array(	'administrator' 	=> array( 	'edit_' . $post_type_item,
719
-																			'read_' . $post_type_item,
720
-																			'delete_' . $post_type_item,
721
-																			'create_' . $post_type_item . 's',
722
-																			'edit_' . $post_type_item . 's',
723
-																			'edit_others_' . $post_type_item . 's',
724
-																			'publish_' . $post_type_item . 's',
725
-																			'read_private_' . $post_type_item . 's',
718
+			$this->role_caps[] = array('administrator' 	=> array('edit_'.$post_type_item,
719
+																			'read_'.$post_type_item,
720
+																			'delete_'.$post_type_item,
721
+																			'create_'.$post_type_item.'s',
722
+																			'edit_'.$post_type_item.'s',
723
+																			'edit_others_'.$post_type_item.'s',
724
+																			'publish_'.$post_type_item.'s',
725
+																			'read_private_'.$post_type_item.'s',
726 726
 																			'read',
727
-																			'delete_' . $post_type_item . 's',
728
-																			'delete_private_' . $post_type_item . 's',
729
-																			'delete_published_' . $post_type_item . 's',
730
-																			'delete_others_' . $post_type_item . 's',
731
-																			'edit_private_' . $post_type_item . 's',
732
-																			'edit_published_' . $post_type_item . 's',
727
+																			'delete_'.$post_type_item.'s',
728
+																			'delete_private_'.$post_type_item.'s',
729
+																			'delete_published_'.$post_type_item.'s',
730
+																			'delete_others_'.$post_type_item.'s',
731
+																			'edit_private_'.$post_type_item.'s',
732
+																			'edit_published_'.$post_type_item.'s',
733 733
 																			'manage_sensei',
734
-																			'manage_sensei_grades' ),
735
-											'editor' 			=> array(	'edit_' . $post_type_item,
736
-																			'read_' . $post_type_item,
737
-																			'delete_' . $post_type_item,
738
-																			'create_' . $post_type_item . 's',
739
-																		 	'edit_' . $post_type_item . 's',
740
-																			'edit_others_' . $post_type_item . 's',
741
-																			'publish_' . $post_type_item . 's',
742
-																			'read_private_' . $post_type_item . 's',
734
+																			'manage_sensei_grades'),
735
+											'editor' 			=> array('edit_'.$post_type_item,
736
+																			'read_'.$post_type_item,
737
+																			'delete_'.$post_type_item,
738
+																			'create_'.$post_type_item.'s',
739
+																		 	'edit_'.$post_type_item.'s',
740
+																			'edit_others_'.$post_type_item.'s',
741
+																			'publish_'.$post_type_item.'s',
742
+																			'read_private_'.$post_type_item.'s',
743 743
 																			'read',
744
-																			'delete_' . $post_type_item . 's',
745
-																			'delete_private_' . $post_type_item . 's',
746
-																			'delete_published_' . $post_type_item . 's',
747
-																			'delete_others_' . $post_type_item . 's',
748
-																			'edit_private_' . $post_type_item . 's',
749
-																			'edit_published_' . $post_type_item . 's' ),
750
-											'author' 			=> array( 	'edit_' . $post_type_item,
751
-																			'read_' . $post_type_item,
752
-																			'delete_' . $post_type_item,
753
-																			'create_' . $post_type_item . 's',
754
-																			'edit_' . $post_type_item . 's',
755
-																			'publish_' . $post_type_item . 's',
744
+																			'delete_'.$post_type_item.'s',
745
+																			'delete_private_'.$post_type_item.'s',
746
+																			'delete_published_'.$post_type_item.'s',
747
+																			'delete_others_'.$post_type_item.'s',
748
+																			'edit_private_'.$post_type_item.'s',
749
+																			'edit_published_'.$post_type_item.'s'),
750
+											'author' 			=> array('edit_'.$post_type_item,
751
+																			'read_'.$post_type_item,
752
+																			'delete_'.$post_type_item,
753
+																			'create_'.$post_type_item.'s',
754
+																			'edit_'.$post_type_item.'s',
755
+																			'publish_'.$post_type_item.'s',
756 756
 																			'read',
757
-																			'delete_' . $post_type_item . 's',
758
-																			'delete_published_' . $post_type_item . 's',
759
-																			'edit_published_' . $post_type_item . 's' ),
760
-											'contributor' 		=> array( 	'edit_' . $post_type_item,
761
-																			'read_' . $post_type_item,
762
-																			'delete_' . $post_type_item,
763
-																			'create_' . $post_type_item . 's',
764
-																			'edit_' . $post_type_item . 's',
757
+																			'delete_'.$post_type_item.'s',
758
+																			'delete_published_'.$post_type_item.'s',
759
+																			'edit_published_'.$post_type_item.'s'),
760
+											'contributor' 		=> array('edit_'.$post_type_item,
761
+																			'read_'.$post_type_item,
762
+																			'delete_'.$post_type_item,
763
+																			'create_'.$post_type_item.'s',
764
+																			'edit_'.$post_type_item.'s',
765 765
 																			'read',
766
-																			'delete_' . $post_type_item . 's' ),
767
-											'subscriber' 		=> array( 	'read' )
766
+																			'delete_'.$post_type_item.'s'),
767
+											'subscriber' 		=> array('read')
768 768
 
769 769
 										);
770 770
 		} // End For Loop
@@ -778,16 +778,16 @@  discard block
 block discarded – undo
778 778
      * @param WP_Admin_Bar $bar
779 779
 	 * @return void
780 780
 	 */
781
-	public function quiz_admin_bar_menu( $bar ) {
782
-		if ( is_single() && 'quiz' == get_queried_object()->post_type ) {
783
-			$lesson_id = get_post_meta( get_queried_object()->ID, '_quiz_lesson', true );
784
-			if ( $lesson_id ) {
781
+	public function quiz_admin_bar_menu($bar) {
782
+		if (is_single() && 'quiz' == get_queried_object()->post_type) {
783
+			$lesson_id = get_post_meta(get_queried_object()->ID, '_quiz_lesson', true);
784
+			if ($lesson_id) {
785 785
 				$object_type = get_post_type_object('quiz');
786
-				$bar->add_menu( array(
786
+				$bar->add_menu(array(
787 787
 					'id' => 'edit',
788 788
 					'title' => $object_type->labels->edit_item,
789
-					'href' => get_edit_post_link( $lesson_id ),
790
-				) );
789
+					'href' => get_edit_post_link($lesson_id),
790
+				));
791 791
 			}
792 792
 		}
793 793
 	}
@@ -799,4 +799,4 @@  discard block
 block discarded – undo
799 799
  * for backward compatibility
800 800
  * @since 1.9.0
801 801
  */
802
-class WooThemes_Sensei_PostTypes extends Sensei_PostTypes{}
802
+class WooThemes_Sensei_PostTypes extends Sensei_PostTypes {}
Please login to merge, or discard this patch.
includes/emails/class-woothemes-sensei-teacher-new-course-assignment.php 3 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
7 7
 
8 8
 if (  class_exists( 'Teacher_New_Course_Assignment' ) ){
9
-    return;
9
+	return;
10 10
 }
11 11
 
12 12
 /**
@@ -40,40 +40,40 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	function __construct() {
42 42
 
43
-        $this->template = 'teacher-new-course-assignment';
43
+		$this->template = 'teacher-new-course-assignment';
44 44
 		$this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] You have been assigned to a course', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template );
45 45
 		$this->heading = apply_filters( 'sensei_email_heading', __( 'Course assigned to you', 'woothemes-sensei' ), $this->template );
46
-        return;
46
+		return;
47 47
 	}
48 48
 
49 49
 	/**
50 50
 	 * trigger function.
51 51
 	 *
52 52
 	 * @access public
53
-     * @param $teacher_id
54
-     * @param $course_id
53
+	 * @param $teacher_id
54
+	 * @param $course_id
55 55
 	 * @return void
56 56
 	 */
57 57
 	function trigger( $teacher_id = 0, $course_id = 0 ) {
58 58
 		global $sensei_email_data;
59 59
 
60 60
 		$this->teacher = new WP_User( $teacher_id );
61
-        $this->recipient = stripslashes( $this->teacher->user_email );
62
-        $this->subject = __( 'New course assigned to you', 'woothemes-sensei' );
61
+		$this->recipient = stripslashes( $this->teacher->user_email );
62
+		$this->subject = __( 'New course assigned to you', 'woothemes-sensei' );
63 63
 
64
-        //course edit link
65
-        $course_edit_link = admin_url('post.php?post=' . $course_id . '&action=edit' );
64
+		//course edit link
65
+		$course_edit_link = admin_url('post.php?post=' . $course_id . '&action=edit' );
66 66
 
67
-        // Course name
68
-        $course = get_post( $course_id);
67
+		// Course name
68
+		$course = get_post( $course_id);
69 69
 		// Construct data array
70 70
 		$sensei_email_data = apply_filters( 'sensei_email_data', array(
71 71
 			'template'			=> $this->template,
72 72
 			'heading'			=> $this->heading,
73 73
 			'teacher_id'		=> $teacher_id,
74 74
 			'course_id'			=> $course_id,
75
-            'course_name'			=> $course->post_title,
76
-            'course_edit_link' => $course_edit_link,
75
+			'course_name'			=> $course->post_title,
76
+			'course_edit_link' => $course_edit_link,
77 77
 		), $this->template );
78 78
 
79 79
 		// Send mail
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@  discard block
 block discarded – undo
3 3
  * This email will be sent to a teacher when a course is assigned to them.
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
6
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly
7 7
 
8
-if (  class_exists( 'Teacher_New_Course_Assignment' ) ){
8
+if (class_exists('Teacher_New_Course_Assignment')) {
9 9
     return;
10 10
 }
11 11
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	function __construct() {
42 42
 
43 43
         $this->template = 'teacher-new-course-assignment';
44
-		$this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] You have been assigned to a course', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template );
45
-		$this->heading = apply_filters( 'sensei_email_heading', __( 'Course assigned to you', 'woothemes-sensei' ), $this->template );
44
+		$this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] You have been assigned to a course', 'woothemes-sensei'), get_bloginfo('name')), $this->template);
45
+		$this->heading = apply_filters('sensei_email_heading', __('Course assigned to you', 'woothemes-sensei'), $this->template);
46 46
         return;
47 47
 	}
48 48
 
@@ -54,29 +54,29 @@  discard block
 block discarded – undo
54 54
      * @param $course_id
55 55
 	 * @return void
56 56
 	 */
57
-	function trigger( $teacher_id = 0, $course_id = 0 ) {
57
+	function trigger($teacher_id = 0, $course_id = 0) {
58 58
 		global $sensei_email_data;
59 59
 
60
-		$this->teacher = new WP_User( $teacher_id );
61
-        $this->recipient = stripslashes( $this->teacher->user_email );
62
-        $this->subject = __( 'New course assigned to you', 'woothemes-sensei' );
60
+		$this->teacher = new WP_User($teacher_id);
61
+        $this->recipient = stripslashes($this->teacher->user_email);
62
+        $this->subject = __('New course assigned to you', 'woothemes-sensei');
63 63
 
64 64
         //course edit link
65
-        $course_edit_link = admin_url('post.php?post=' . $course_id . '&action=edit' );
65
+        $course_edit_link = admin_url('post.php?post='.$course_id.'&action=edit');
66 66
 
67 67
         // Course name
68
-        $course = get_post( $course_id);
68
+        $course = get_post($course_id);
69 69
 		// Construct data array
70
-		$sensei_email_data = apply_filters( 'sensei_email_data', array(
70
+		$sensei_email_data = apply_filters('sensei_email_data', array(
71 71
 			'template'			=> $this->template,
72 72
 			'heading'			=> $this->heading,
73 73
 			'teacher_id'		=> $teacher_id,
74 74
 			'course_id'			=> $course_id,
75 75
             'course_name'			=> $course->post_title,
76 76
             'course_edit_link' => $course_edit_link,
77
-		), $this->template );
77
+		), $this->template);
78 78
 
79 79
 		// Send mail
80
-		Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) );
80
+		Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template));
81 81
 	}
82 82
 }
83 83
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
5
+// Exit if accessed directly
3 6
 
4 7
 /**
5 8
  * Sensei Analysis User Profile List Table Class
Please login to merge, or discard this patch.
includes/emails/class-woothemes-sensei-email-teacher-completed-lesson.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		$teacher_id = get_post_field( 'post_author', $lesson_id, 'raw' );
52 52
 		$this->teacher = new WP_User( $teacher_id );
53 53
 
54
-        // Construct data array
54
+		// Construct data array
55 55
 		$sensei_email_data = apply_filters( 'sensei_email_data', array(
56 56
 			'template'			=> $this->template,
57 57
 			'heading'			=> $this->heading,
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		$this->recipient = stripslashes( $this->teacher->user_email );
66 66
 
67 67
 		// Send mail
68
-        Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) );
68
+		Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) );
69 69
 	}
70 70
 }
71 71
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly
4 4
 
5
-if ( ! class_exists( 'WooThemes_Sensei_Email_Teacher_Completed_Lesson' ) ) :
5
+if ( ! class_exists('WooThemes_Sensei_Email_Teacher_Completed_Lesson')) :
6 6
 
7 7
 /**
8 8
  * Teacher Completed Lesson
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	function __construct() {
33 33
 		$this->template = 'teacher-completed-lesson';
34
-		$this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] Your student has completed a lesson', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template );
35
-		$this->heading = apply_filters( 'sensei_email_heading', __( 'Your student has completed a lesson', 'woothemes-sensei' ), $this->template );
34
+		$this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] Your student has completed a lesson', 'woothemes-sensei'), get_bloginfo('name')), $this->template);
35
+		$this->heading = apply_filters('sensei_email_heading', __('Your student has completed a lesson', 'woothemes-sensei'), $this->template);
36 36
 	}
37 37
 
38 38
 	/**
@@ -41,31 +41,31 @@  discard block
 block discarded – undo
41 41
 	 * @access public
42 42
 	 * @return void
43 43
 	 */
44
-	function trigger( $learner_id = 0, $lesson_id = 0 ) {
44
+	function trigger($learner_id = 0, $lesson_id = 0) {
45 45
 		global $sensei_email_data;
46 46
 
47 47
 		// Get learner user object
48
-		$this->learner = new WP_User( $learner_id );
48
+		$this->learner = new WP_User($learner_id);
49 49
 
50 50
 		// Get teacher ID and user object
51
-		$teacher_id = get_post_field( 'post_author', $lesson_id, 'raw' );
52
-		$this->teacher = new WP_User( $teacher_id );
51
+		$teacher_id = get_post_field('post_author', $lesson_id, 'raw');
52
+		$this->teacher = new WP_User($teacher_id);
53 53
 
54 54
         // Construct data array
55
-		$sensei_email_data = apply_filters( 'sensei_email_data', array(
55
+		$sensei_email_data = apply_filters('sensei_email_data', array(
56 56
 			'template'			=> $this->template,
57 57
 			'heading'			=> $this->heading,
58 58
 			'teacher_id'		=> $teacher_id,
59 59
 			'learner_id'		=> $learner_id,
60 60
 			'learner_name'		=> $this->learner->display_name,
61 61
 			'lesson_id'			=> $lesson_id,
62
-		), $this->template );
62
+		), $this->template);
63 63
 
64 64
 		// Set recipient (teacher)
65
-		$this->recipient = stripslashes( $this->teacher->user_email );
65
+		$this->recipient = stripslashes($this->teacher->user_email);
66 66
 
67 67
 		// Send mail
68
-        Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) );
68
+        Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template));
69 69
 	}
70 70
 }
71 71
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
5
+// Exit if accessed directly
3 6
 
4 7
 /**
5 8
  * Sensei Analysis User Profile List Table Class
Please login to merge, or discard this patch.
includes/emails/class-woothemes-sensei-email-learner-graded-quiz.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly
4 4
 
5
-if ( ! class_exists( 'WooThemes_Sensei_Email_Learner_Graded_Quiz' ) ) :
5
+if ( ! class_exists('WooThemes_Sensei_Email_Learner_Graded_Quiz')) :
6 6
 
7 7
 /**
8 8
  * Learner Graded Quiz
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	function __construct() {
32 32
 		$this->template = 'learner-graded-quiz';
33
-		$this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] Your quiz has been graded', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template );
34
-		$this->heading = apply_filters( 'sensei_email_heading', __( 'Your quiz has been graded', 'woothemes-sensei' ), $this->template );
33
+		$this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] Your quiz has been graded', 'woothemes-sensei'), get_bloginfo('name')), $this->template);
34
+		$this->heading = apply_filters('sensei_email_heading', __('Your quiz has been graded', 'woothemes-sensei'), $this->template);
35 35
 	}
36 36
 
37 37
 	/**
@@ -40,47 +40,47 @@  discard block
 block discarded – undo
40 40
 	 * @access public
41 41
 	 * @return void
42 42
 	 */
43
-	function trigger( $user_id = 0, $quiz_id = 0, $grade = 0, $passmark = 0 ) {
43
+	function trigger($user_id = 0, $quiz_id = 0, $grade = 0, $passmark = 0) {
44 44
 		global  $sensei_email_data;
45 45
 
46 46
 		// Get learner user object
47
-		$this->user = new WP_User( $user_id );
47
+		$this->user = new WP_User($user_id);
48 48
 
49 49
 		// Get passed flag
50
-		$passed = __( 'failed', 'woothemes-sensei' );
51
-		if( $grade >= $passmark ) {
52
-			$passed = __( 'passed', 'woothemes-sensei' );
50
+		$passed = __('failed', 'woothemes-sensei');
51
+		if ($grade >= $passmark) {
52
+			$passed = __('passed', 'woothemes-sensei');
53 53
 		}
54 54
 
55 55
 		// Get grade tye (auto/manual)
56
-		$grade_type = get_post_meta( $quiz_id, '_quiz_grade_type', true );
56
+		$grade_type = get_post_meta($quiz_id, '_quiz_grade_type', true);
57 57
 
58
-		if( 'auto' == $grade_type ) {
59
-			$this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] You have completed a quiz', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template );
60
-			$this->heading = apply_filters( 'sensei_email_heading', __( 'You have completed a quiz', 'woothemes-sensei' ), $this->template );
58
+		if ('auto' == $grade_type) {
59
+			$this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] You have completed a quiz', 'woothemes-sensei'), get_bloginfo('name')), $this->template);
60
+			$this->heading = apply_filters('sensei_email_heading', __('You have completed a quiz', 'woothemes-sensei'), $this->template);
61 61
 		}
62 62
 
63
-		$lesson_id = get_post_meta( $quiz_id, '_quiz_lesson', true );
63
+		$lesson_id = get_post_meta($quiz_id, '_quiz_lesson', true);
64 64
 
65 65
 		// Construct data array
66
-		$sensei_email_data = apply_filters( 'sensei_email_data', array(
66
+		$sensei_email_data = apply_filters('sensei_email_data', array(
67 67
 			'template'			=> $this->template,
68 68
 			'heading'			=> $this->heading,
69 69
 			'user_id'			=> $user_id,
70
-			'user_name'         => stripslashes( $this->user->display_name ),
70
+			'user_name'         => stripslashes($this->user->display_name),
71 71
 			'lesson_id'			=> $lesson_id,
72 72
 			'quiz_id'			=> $quiz_id,
73 73
 			'grade'				=> $grade,
74 74
 			'passmark'			=> $passmark,
75 75
 			'passed'			=> $passed,
76 76
 			'grade_type'		=> $grade_type,
77
-		), $this->template );
77
+		), $this->template);
78 78
 
79 79
 		// Set recipient (learner)
80
-		$this->recipient = stripslashes( $this->user->user_email );
80
+		$this->recipient = stripslashes($this->user->user_email);
81 81
 
82 82
 		// Send mail
83
-		Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) );
83
+		Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template));
84 84
 	}
85 85
 }
86 86
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
5
+// Exit if accessed directly
3 6
 
4 7
 /**
5 8
  * Sensei Analysis User Profile List Table Class
Please login to merge, or discard this patch.
includes/emails/class-woothemes-sensei-email-teacher-quiz-submitted.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@
 block discarded – undo
48 48
 		$this->learner = new WP_User( $learner_id );
49 49
 
50 50
 		// Get teacher ID and user object
51
-        $lesson_id = get_post_meta( $quiz_id, '_quiz_lesson', true );
52
-        $course_id = get_post_meta( $lesson_id, '_lesson_course', true );
51
+		$lesson_id = get_post_meta( $quiz_id, '_quiz_lesson', true );
52
+		$course_id = get_post_meta( $lesson_id, '_lesson_course', true );
53 53
 		$teacher_id = get_post_field( 'post_author', $course_id, 'raw' );
54 54
 		$this->teacher = new WP_User( $teacher_id );
55 55
 
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly
4 4
 
5
-if ( ! class_exists( 'WooThemes_Sensei_Email_Teacher_Quiz_Submitted' ) ) :
5
+if ( ! class_exists('WooThemes_Sensei_Email_Teacher_Quiz_Submitted')) :
6 6
 
7 7
 /**
8 8
  * Teacher Quiz Submitted
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	function __construct() {
33 33
 		$this->template = 'teacher-quiz-submitted';
34
-		$this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] Your student has submitted a quiz for grading', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template );
35
-		$this->heading = apply_filters( 'sensei_email_heading', __( 'Your student has submitted a quiz for grading', 'woothemes-sensei' ), $this->template );
34
+		$this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] Your student has submitted a quiz for grading', 'woothemes-sensei'), get_bloginfo('name')), $this->template);
35
+		$this->heading = apply_filters('sensei_email_heading', __('Your student has submitted a quiz for grading', 'woothemes-sensei'), $this->template);
36 36
 	}
37 37
 
38 38
 	/**
@@ -41,20 +41,20 @@  discard block
 block discarded – undo
41 41
 	 * @access public
42 42
 	 * @return void
43 43
 	 */
44
-	function trigger( $learner_id = 0, $quiz_id = 0 ) {
44
+	function trigger($learner_id = 0, $quiz_id = 0) {
45 45
 		global  $sensei_email_data;
46 46
 
47 47
 		// Get learner user object
48
-		$this->learner = new WP_User( $learner_id );
48
+		$this->learner = new WP_User($learner_id);
49 49
 
50 50
 		// Get teacher ID and user object
51
-        $lesson_id = get_post_meta( $quiz_id, '_quiz_lesson', true );
52
-        $course_id = get_post_meta( $lesson_id, '_lesson_course', true );
53
-		$teacher_id = get_post_field( 'post_author', $course_id, 'raw' );
54
-		$this->teacher = new WP_User( $teacher_id );
51
+        $lesson_id = get_post_meta($quiz_id, '_quiz_lesson', true);
52
+        $course_id = get_post_meta($lesson_id, '_lesson_course', true);
53
+		$teacher_id = get_post_field('post_author', $course_id, 'raw');
54
+		$this->teacher = new WP_User($teacher_id);
55 55
 
56 56
 		// Construct data array
57
-		$sensei_email_data = apply_filters( 'sensei_email_data', array(
57
+		$sensei_email_data = apply_filters('sensei_email_data', array(
58 58
 			'template'			=> $this->template,
59 59
 			'heading'			=> $this->heading,
60 60
 			'teacher_id'		=> $teacher_id,
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 			'learner_name'		=> $this->learner->display_name,
63 63
 			'quiz_id'			=> $quiz_id,
64 64
 			'lesson_id'			=> $lesson_id,
65
-		), $this->template );
65
+		), $this->template);
66 66
 
67 67
 		// Set recipient (teacher)
68
-		$this->recipient = stripslashes( $this->teacher->user_email );
68
+		$this->recipient = stripslashes($this->teacher->user_email);
69 69
 
70 70
 		// Send mail
71
-		Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) );
71
+		Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template));
72 72
 	}
73 73
 }
74 74
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
5
+// Exit if accessed directly
3 6
 
4 7
 /**
5 8
  * Sensei Analysis User Profile List Table Class
Please login to merge, or discard this patch.