Completed
Push — master ( 6f9e7a...de5671 )
by Dwain
09:23
created
templates/content-course.php 1 patch
Spacing   +7 added lines, -7 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;
2
+if ( ! defined('ABSPATH')) exit;
3 3
 /**
4 4
  * Content-course.php template file
5 5
  *
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  */
15 15
 ?>
16 16
 
17
-<li <?php post_class(  WooThemes_Sensei_Course::get_course_loop_content_class() ); ?> >
17
+<li <?php post_class(WooThemes_Sensei_Course::get_course_loop_content_class()); ?> >
18 18
 
19 19
     <?php
20 20
     /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      *
26 26
      * @param integer $course_id
27 27
      */
28
-    do_action( 'sensei_course_content_before', get_the_ID() );
28
+    do_action('sensei_course_content_before', get_the_ID());
29 29
     ?>
30 30
 
31 31
     <section class="course-content">
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
              * @hooked Sensei()->course->course_image       - 10
45 45
              * @hooked  Sensei()->course->the_course_meta   - 20
46 46
              */
47
-            do_action('sensei_course_content_inside_before', get_the_ID() );
47
+            do_action('sensei_course_content_inside_before', get_the_ID());
48 48
             ?>
49 49
 
50 50
             <p class="course-excerpt">
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
              *
64 64
              * @hooked  Sensei()->course->the_course_free_lesson_preview - 20
65 65
              */
66
-            do_action('sensei_course_content_inside_after', get_the_ID() );
66
+            do_action('sensei_course_content_inside_after', get_the_ID());
67 67
             ?>
68 68
 
69 69
         </section> <!-- section .entry -->
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
      *
81 81
      * @hooked  Sensei()->course->the_course_free_lesson_preview - 20
82 82
      */
83
-    do_action('sensei_course_content_after', get_the_ID() );
83
+    do_action('sensei_course_content_after', get_the_ID());
84 84
     ?>
85 85
 
86 86
 
87
-</li> <!-- article .(<?php esc_attr_e( join( ' ', get_post_class( array( 'course', 'post' ) ) ) ); ?>  -->
88 87
\ No newline at end of file
88
+</li> <!-- article .(<?php esc_attr_e(join(' ', get_post_class(array('course', 'post')))); ?>  -->
89 89
\ No newline at end of file
Please login to merge, or discard this patch.
templates/single-lesson.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  */
12 12
 ?>
13 13
 
14
-<?php  get_sensei_header();  ?>
14
+<?php  get_sensei_header(); ?>
15 15
 
16 16
 <?php the_post(); ?>
17 17
 
18
-<article <?php post_class( array( 'lesson', 'post' ) ); ?>>
18
+<article <?php post_class(array('lesson', 'post')); ?>>
19 19
 
20 20
     <?php
21 21
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
          * @hooked Sensei_Lesson::lesson_image() -  17
32 32
          * @hooked deprecate_lesson_single_main_content_hook - 20
33 33
          */
34
-        do_action( 'sensei_single_lesson_content_inside_before', get_the_ID() );
34
+        do_action('sensei_single_lesson_content_inside_before', get_the_ID());
35 35
 
36 36
     ?>
37 37
 
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 
40 40
         <?php
41 41
 
42
-        if ( sensei_can_user_view_lesson() ) {
42
+        if (sensei_can_user_view_lesson()) {
43 43
 
44
-            if( apply_filters( 'sensei_video_position', 'top', $post->ID ) == 'top' ) {
44
+            if (apply_filters('sensei_video_position', 'top', $post->ID) == 'top') {
45 45
 
46
-                do_action( 'sensei_lesson_video', $post->ID );
46
+                do_action('sensei_lesson_video', $post->ID);
47 47
 
48 48
             }
49 49
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
          *
73 73
          * @hooked Sensei()->frontend->sensei_breadcrumb   - 30
74 74
          */
75
-        do_action( 'sensei_single_lesson_content_inside_after', get_the_ID() );
75
+        do_action('sensei_single_lesson_content_inside_after', get_the_ID());
76 76
 
77 77
     ?>
78 78
 
Please login to merge, or discard this patch.
templates/single-course.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
  */
12 12
 ?>
13 13
 
14
-<?php  get_sensei_header();  ?>
14
+<?php  get_sensei_header(); ?>
15 15
 
16
-<article <?php post_class( array( 'course', 'post' ) ); ?>>
16
+<article <?php post_class(array('course', 'post')); ?>>
17 17
 
18 18
     <?php
19 19
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      * @hooked Sensei()->message->send_message_link        -  35
33 33
      * @hooked Sensei_Course::the_course_video             -  40
34 34
      */
35
-    do_action( 'sensei_single_course_content_inside_before', get_the_ID() );
35
+    do_action('sensei_single_course_content_inside_before', get_the_ID());
36 36
 
37 37
     ?>
38 38
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * @param integer $course_id
53 53
      *
54 54
      */
55
-    do_action( 'sensei_single_course_content_inside_after', get_the_ID() );
55
+    do_action('sensei_single_course_content_inside_after', get_the_ID());
56 56
 
57 57
     ?>
58 58
 </article><!-- .post .single-course -->
Please login to merge, or discard this patch.
widgets/widget-woothemes-sensei-lesson-component.php 1 patch
Spacing   +50 added lines, -50 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 Lesson Component Widget
@@ -26,22 +26,22 @@  discard block
 block discarded – undo
26 26
 	public function __construct() {
27 27
 		/* Widget variable settings. */
28 28
 		$this->woo_widget_cssclass = 'widget_sensei_lesson_component';
29
-		$this->woo_widget_description = __( 'This widget will output a list of the latest Lessons.', 'woothemes-sensei' );
29
+		$this->woo_widget_description = __('This widget will output a list of the latest Lessons.', 'woothemes-sensei');
30 30
 		$this->woo_widget_idbase = 'sensei_lesson_component';
31
-		$this->woo_widget_title = __( 'Sensei - Lesson Component', 'woothemes-sensei' );
31
+		$this->woo_widget_title = __('Sensei - Lesson Component', 'woothemes-sensei');
32 32
 
33 33
 		$this->woo_widget_componentslist = array(
34
-												'newlessons' => __( 'New Lessons', 'woothemes-sensei' ),
34
+												'newlessons' => __('New Lessons', 'woothemes-sensei'),
35 35
 												);
36 36
 
37 37
 		/* Widget settings. */
38
-		$widget_ops = array( 'classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description );
38
+		$widget_ops = array('classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description);
39 39
 
40 40
 		/* Widget control settings. */
41
-		$control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase );
41
+		$control_ops = array('width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase);
42 42
 
43 43
 		/* Create the widget. */
44
-		parent::__construct( $this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops );
44
+		parent::__construct($this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops);
45 45
 	} // End __construct()
46 46
 
47 47
 	/**
@@ -51,35 +51,35 @@  discard block
 block discarded – undo
51 51
 	 * @param  array $instance Widget settings for this instance.
52 52
 	 * @return void
53 53
 	 */
54
-	public function widget( $args, $instance ) {
54
+	public function widget($args, $instance) {
55 55
 
56
-        $before_widget = $args[ 'before_widget' ];
57
-        $before_title  = $args[ 'before_title' ];
58
-        $after_title   = $args[ 'after_title' ];
59
-        $after_widget  = $args[ 'after_widget' ];
56
+        $before_widget = $args['before_widget'];
57
+        $before_title  = $args['before_title'];
58
+        $after_title   = $args['after_title'];
59
+        $after_widget  = $args['after_widget'];
60 60
 
61
-		if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) ) && ( 'activecourses' == $instance['component'] || 'completedcourses' == $instance['component'] ) && !is_user_logged_in() ) {
61
+		if (in_array($instance['component'], array_keys($this->woo_widget_componentslist)) && ('activecourses' == $instance['component'] || 'completedcourses' == $instance['component']) && ! is_user_logged_in()) {
62 62
 			// No Output
63 63
 		} else {
64 64
 			/* Our variables from the widget settings. */
65
-			$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
65
+			$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
66 66
 
67 67
 			/* Before widget (defined by themes). */
68 68
 			echo $before_widget;
69 69
 
70 70
 			/* Display the widget title if one was input (before and after defined by themes). */
71
-			if ( $title ) { echo $before_title . $title . $after_title; }
71
+			if ($title) { echo $before_title.$title.$after_title; }
72 72
 
73 73
 			/* Widget content. */
74 74
 			// Add actions for plugins/themes to hook onto.
75
-			do_action( $this->woo_widget_cssclass . '_top' );
75
+			do_action($this->woo_widget_cssclass.'_top');
76 76
 
77
-			if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) ) ) {
78
-				$this->load_component( $instance );
77
+			if (in_array($instance['component'], array_keys($this->woo_widget_componentslist))) {
78
+				$this->load_component($instance);
79 79
 			}
80 80
 
81 81
 			// Add actions for plugins/themes to hook onto.
82
-			do_action( $this->woo_widget_cssclass . '_bottom' );
82
+			do_action($this->woo_widget_cssclass.'_bottom');
83 83
 
84 84
 			/* After widget (defined by themes). */
85 85
 			echo $after_widget;
@@ -94,17 +94,17 @@  discard block
 block discarded – undo
94 94
 	 * @param  array $old_instance Previous settings.
95 95
 	 * @return array               Updated settings.
96 96
 	 */
97
-	public function update ( $new_instance, $old_instance ) {
97
+	public function update($new_instance, $old_instance) {
98 98
 		$instance = $old_instance;
99 99
 
100 100
 		/* Strip tags for title and name to remove HTML (important for text inputs). */
101
-		$instance['title'] = strip_tags( $new_instance['title'] );
101
+		$instance['title'] = strip_tags($new_instance['title']);
102 102
 
103 103
 		/* The select box is returning a text value, so we escape it. */
104
-		$instance['component'] = esc_attr( $new_instance['component'] );
104
+		$instance['component'] = esc_attr($new_instance['component']);
105 105
 
106 106
 		/* The select box is returning a text value, so we escape it. */
107
-		$instance['limit'] = esc_attr( $new_instance['limit'] );
107
+		$instance['limit'] = esc_attr($new_instance['limit']);
108 108
 
109 109
 
110 110
 		return $instance;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * @param  array $instance The settings for this instance.
118 118
 	 * @return void
119 119
 	 */
120
-    public function form( $instance ) {
120
+    public function form($instance) {
121 121
 
122 122
 		/* Set up some default widget settings. */
123 123
 		/* Make sure all keys are added here, even with empty string values. */
@@ -127,26 +127,26 @@  discard block
 block discarded – undo
127 127
 						'limit' => 3
128 128
 					);
129 129
 
130
-		$instance = wp_parse_args( (array) $instance, $defaults );
130
+		$instance = wp_parse_args((array) $instance, $defaults);
131 131
 ?>
132 132
 		<!-- Widget Title: Text Input -->
133 133
 		<p>
134
-			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label>
135
-			<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"  value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" />
134
+			<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title (optional):', 'woothemes-sensei'); ?></label>
135
+			<input type="text" name="<?php echo esc_attr($this->get_field_name('title')); ?>"  value="<?php echo esc_attr($instance['title']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" />
136 136
 		</p>
137 137
 		<!-- Widget Component: Select Input -->
138 138
 		<p>
139
-			<label for="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>"><?php _e( 'Component:', 'woothemes-sensei' ); ?></label>
140
-			<select name="<?php echo esc_attr( $this->get_field_name( 'component' ) ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>">
141
-			<?php foreach ( $this->woo_widget_componentslist as $k => $v ) { ?>
142
-				<option value="<?php echo esc_attr( $k ); ?>"<?php selected( $instance['component'], $k ); ?>><?php echo $v; ?></option>
139
+			<label for="<?php echo esc_attr($this->get_field_id('component')); ?>"><?php _e('Component:', 'woothemes-sensei'); ?></label>
140
+			<select name="<?php echo esc_attr($this->get_field_name('component')); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('component')); ?>">
141
+			<?php foreach ($this->woo_widget_componentslist as $k => $v) { ?>
142
+				<option value="<?php echo esc_attr($k); ?>"<?php selected($instance['component'], $k); ?>><?php echo $v; ?></option>
143 143
 			<?php } ?>
144 144
 			</select>
145 145
 		</p>
146 146
 		<!-- Widget Limit: Text Input -->
147 147
 		<p>
148
-			<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Lessons (optional):', 'woothemes-sensei' ); ?></label>
149
-			<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>"  value="<?php echo esc_attr( $instance['limit'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" />
148
+			<label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php _e('Number of Lessons (optional):', 'woothemes-sensei'); ?></label>
149
+			<input type="text" name="<?php echo esc_attr($this->get_field_name('limit')); ?>"  value="<?php echo esc_attr($instance['limit']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('limit')); ?>" />
150 150
 		</p>
151 151
 
152 152
 <?php
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * @since  5.0.8
159 159
 	 * @return void
160 160
 	 */
161
-	protected function load_component ( $instance ) {
161
+	protected function load_component($instance) {
162 162
 
163 163
 		global  $current_user;
164 164
 		// Get User Meta
@@ -169,41 +169,41 @@  discard block
 block discarded – undo
169 169
 
170 170
 		$posts_array = array();
171 171
 
172
-		$post_args = array(	'post_type' 		=> 'lesson',
173
-							'posts_per_page' 		=> intval( $instance[ 'limit' ] ),
172
+		$post_args = array('post_type' 		=> 'lesson',
173
+							'posts_per_page' 		=> intval($instance['limit']),
174 174
 							'orderby'         	=> 'menu_order date',
175 175
     						'order'           	=> 'DESC',
176 176
     						'post_status'       => 'publish',
177 177
 							'suppress_filters' 	=> 0
178 178
 							);
179
-		$posts_array = get_posts( $post_args );
179
+		$posts_array = get_posts($post_args);
180 180
 
181
-		if ( count( $posts_array ) > 0 ) { ?>
181
+		if (count($posts_array) > 0) { ?>
182 182
 			<ul>
183
-			<?php foreach ($posts_array as $post_item){
184
-		    	$post_id = absint( $post_item->ID );
183
+			<?php foreach ($posts_array as $post_item) {
184
+		    	$post_id = absint($post_item->ID);
185 185
 		    	$post_title = $post_item->post_title;
186
-		    	$user_info = get_userdata( absint( $post_item->post_author ) );
187
-		    	$author_link = get_author_posts_url( absint( $post_item->post_author ) );
186
+		    	$user_info = get_userdata(absint($post_item->post_author));
187
+		    	$author_link = get_author_posts_url(absint($post_item->post_author));
188 188
 		    	$author_display_name = $user_info->display_name;
189 189
 		    	$author_id = $post_item->post_author;
190
-		    	$lesson_course_id = get_post_meta( $post_id, '_lesson_course', true );
190
+		    	$lesson_course_id = get_post_meta($post_id, '_lesson_course', true);
191 191
 		    ?>
192 192
 		    	<li class="fix">
193
-		    		<?php do_action( 'sensei_lesson_image', $post_id, '100', '100', false, true ); ?>
194
-		    		<a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a>
193
+		    		<?php do_action('sensei_lesson_image', $post_id, '100', '100', false, true); ?>
194
+		    		<a href="<?php echo esc_url(get_permalink($post_id)); ?>" title="<?php echo esc_attr($post_title); ?>"><?php echo $post_title; ?></a>
195 195
 		    		<br />
196
-		    		<?php if ( isset( Sensei()->settings->settings[ 'lesson_author' ] ) && ( Sensei()->settings->settings[ 'lesson_author' ] ) ) { ?>
197
-    					<span class="course-author"><?php _e( 'by ', 'woothemes-sensei' ); ?><a href="<?php echo esc_url( $author_link ); ?>" title="<?php echo esc_attr( $author_display_name ); ?>"><?php echo esc_html( $author_display_name ); ?></a></span>
196
+		    		<?php if (isset(Sensei()->settings->settings['lesson_author']) && (Sensei()->settings->settings['lesson_author'])) { ?>
197
+    					<span class="course-author"><?php _e('by ', 'woothemes-sensei'); ?><a href="<?php echo esc_url($author_link); ?>" title="<?php echo esc_attr($author_display_name); ?>"><?php echo esc_html($author_display_name); ?></a></span>
198 198
     					<br />
199 199
     				<?php } // End If Statement ?>
200
-    				<?php if ( 0 < $lesson_course_id ) { ?>
201
-                        <span class="lesson-course"><?php echo ' ' . sprintf( __( 'Part of: %s', 'woothemes-sensei' ), '<a href="' . esc_url( get_permalink( $lesson_course_id ) ) . '" title="' . esc_attr( __( 'View course', 'woothemes-sensei' ) ) . '"><em>' . get_the_title( $lesson_course_id ) . '</em></a>' ); ?></span>
200
+    				<?php if (0 < $lesson_course_id) { ?>
201
+                        <span class="lesson-course"><?php echo ' '.sprintf(__('Part of: %s', 'woothemes-sensei'), '<a href="'.esc_url(get_permalink($lesson_course_id)).'" title="'.esc_attr(__('View course', 'woothemes-sensei')).'"><em>'.get_the_title($lesson_course_id).'</em></a>'); ?></span>
202 202
                     <?php } ?>
203 203
     				<br />
204 204
 		    	</li>
205 205
 		    <?php } // End For Loop ?>
206
-		    <?php echo '<li class="my-account fix"><a class="button" href="'. esc_url( get_post_type_archive_link( 'lesson' ) ) .'">'.__('More Lessons', 'woothemes-sensei').'</a></li>'; ?>
206
+		    <?php echo '<li class="my-account fix"><a class="button" href="'.esc_url(get_post_type_archive_link('lesson')).'">'.__('More Lessons', 'woothemes-sensei').'</a></li>'; ?>
207 207
 		</ul>
208 208
 		<?php } // End If Statement
209 209
 	} // End load_component()
Please login to merge, or discard this patch.
widgets/widget-woothemes-sensei-category-courses.php 1 patch
Spacing   +46 added lines, -46 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 Category Courses Widget
@@ -26,18 +26,18 @@  discard block
 block discarded – undo
26 26
 	public function __construct() {
27 27
 		/* Widget variable settings. */
28 28
 		$this->woo_widget_cssclass = 'widget_sensei_category_courses';
29
-		$this->woo_widget_description = __( 'This widget will output a list of Courses for a specific category.', 'woothemes-sensei' );
29
+		$this->woo_widget_description = __('This widget will output a list of Courses for a specific category.', 'woothemes-sensei');
30 30
 		$this->woo_widget_idbase = 'sensei_category_courses';
31
-		$this->woo_widget_title = __( 'Sensei - Category Courses', 'woothemes-sensei' );
31
+		$this->woo_widget_title = __('Sensei - Category Courses', 'woothemes-sensei');
32 32
 
33 33
 		/* Widget settings. */
34
-		$widget_ops = array( 'classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description );
34
+		$widget_ops = array('classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description);
35 35
 
36 36
 		/* Widget control settings. */
37
-		$control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase );
37
+		$control_ops = array('width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase);
38 38
 
39 39
 		/* Create the widget. */
40
-		parent::__construct( $this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops );
40
+		parent::__construct($this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops);
41 41
 
42 42
 	} // End __construct()
43 43
 
@@ -48,32 +48,32 @@  discard block
 block discarded – undo
48 48
 	 * @param  array $instance Widget settings for this instance.
49 49
 	 * @return void
50 50
 	 */
51
-	public function widget( $args, $instance ) {
51
+	public function widget($args, $instance) {
52 52
 
53
-        $before_widget = $args[ 'before_widget' ];
54
-        $before_title  = $args[ 'before_title' ];
55
-        $after_title   = $args[ 'after_title' ];
56
-        $after_widget  = $args[ 'after_widget' ];
53
+        $before_widget = $args['before_widget'];
54
+        $before_title  = $args['before_title'];
55
+        $after_title   = $args['after_title'];
56
+        $after_widget  = $args['after_widget'];
57 57
 
58 58
 		/* Our variables from the widget settings. */
59
-		$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
59
+		$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
60 60
 
61 61
 		/* Before widget (defined by themes). */
62 62
 		echo $before_widget;
63 63
 
64 64
 		/* Display the widget title if one was input (before and after defined by themes). */
65
-		if ( $title ) { echo $before_title . $title . $after_title; }
65
+		if ($title) { echo $before_title.$title.$after_title; }
66 66
 
67 67
 		/* Widget content. */
68 68
 		// Add actions for plugins/themes to hook onto.
69
-		do_action( $this->woo_widget_cssclass . '_top' );
69
+		do_action($this->woo_widget_cssclass.'_top');
70 70
 
71
-		if ( 0 < intval( $instance['course_category'] ) ) {
72
-			$this->load_component( $instance );
71
+		if (0 < intval($instance['course_category'])) {
72
+			$this->load_component($instance);
73 73
 		} // End If Statement
74 74
 
75 75
 		// Add actions for plugins/themes to hook onto.
76
-		do_action( $this->woo_widget_cssclass . '_bottom' );
76
+		do_action($this->woo_widget_cssclass.'_bottom');
77 77
 
78 78
 		/* After widget (defined by themes). */
79 79
 		echo $after_widget;
@@ -87,17 +87,17 @@  discard block
 block discarded – undo
87 87
 	 * @param  array $old_instance Previous settings.
88 88
 	 * @return array               Updated settings.
89 89
 	 */
90
-	public function update ( $new_instance, $old_instance ) {
90
+	public function update($new_instance, $old_instance) {
91 91
 		$instance = $old_instance;
92 92
 
93 93
 		/* Strip tags for title and name to remove HTML (important for text inputs). */
94
-		$instance['title'] = strip_tags( $new_instance['title'] );
94
+		$instance['title'] = strip_tags($new_instance['title']);
95 95
 
96 96
 		/* The select box is returning a text value, so we escape it. */
97
-		$instance['course_category'] = esc_attr( $new_instance['course_category'] );
97
+		$instance['course_category'] = esc_attr($new_instance['course_category']);
98 98
 
99 99
 		/* Strip tags for limit to remove HTML (important for text inputs). */
100
-		$instance['limit'] = strip_tags( $new_instance['limit'] );
100
+		$instance['limit'] = strip_tags($new_instance['limit']);
101 101
 
102 102
 
103 103
 		return $instance;
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @param  array $instance The settings for this instance.
111 111
 	 * @return void
112 112
 	 */
113
-    public function form( $instance ) {
113
+    public function form($instance) {
114 114
 
115 115
 		/* Set up some default widget settings. */
116 116
 		/* Make sure all keys are added here, even with empty string values. */
@@ -120,25 +120,25 @@  discard block
 block discarded – undo
120 120
 						'limit' => 3
121 121
 					);
122 122
 
123
-		$instance = wp_parse_args( (array) $instance, $defaults );
123
+		$instance = wp_parse_args((array) $instance, $defaults);
124 124
 ?>
125 125
 		<!-- Widget Title: Text Input -->
126 126
 		<p>
127
-			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label>
128
-			<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"  value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" />
127
+			<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title (optional):', 'woothemes-sensei'); ?></label>
128
+			<input type="text" name="<?php echo esc_attr($this->get_field_name('title')); ?>"  value="<?php echo esc_attr($instance['title']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" />
129 129
 		</p>
130 130
 		<!-- Widget Course Category: Select Input -->
131 131
 		<p>
132
-			<label for="<?php echo esc_attr( $this->get_field_id( 'course_category' ) ); ?>"><?php _e( 'Course Category:', 'woothemes-sensei' ); ?></label>
132
+			<label for="<?php echo esc_attr($this->get_field_id('course_category')); ?>"><?php _e('Course Category:', 'woothemes-sensei'); ?></label>
133 133
 			<?php
134
-			$cat_args = array( 'hierarchical' => true, 'show_option_none' => __( 'Select Category:', 'woothemes-sensei' ), 'taxonomy' => 'course-category', 'orderby' => 'name', 'selected' => intval( $instance['course_category'] ), 'id' => $this->get_field_id( 'course_category' ), 'name' => $this->get_field_name( 'course_category' ), 'class' => 'widefat' );
134
+			$cat_args = array('hierarchical' => true, 'show_option_none' => __('Select Category:', 'woothemes-sensei'), 'taxonomy' => 'course-category', 'orderby' => 'name', 'selected' => intval($instance['course_category']), 'id' => $this->get_field_id('course_category'), 'name' => $this->get_field_name('course_category'), 'class' => 'widefat');
135 135
 			wp_dropdown_categories(apply_filters('widget_course_categories_dropdown_args', $cat_args));
136 136
 			?>
137 137
 		</p>
138 138
 		<!-- Widget Limit: Text Input -->
139 139
 		<p>
140
-			<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Courses (optional):', 'woothemes-sensei' ); ?></label>
141
-			<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>"  value="<?php echo esc_attr( $instance['limit'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" />
140
+			<label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php _e('Number of Courses (optional):', 'woothemes-sensei'); ?></label>
141
+			<input type="text" name="<?php echo esc_attr($this->get_field_name('limit')); ?>"  value="<?php echo esc_attr($instance['limit']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('limit')); ?>" />
142 142
 		</p>
143 143
 
144 144
 <?php
@@ -150,49 +150,49 @@  discard block
 block discarded – undo
150 150
 	 * @since  1.1.0
151 151
 	 * @return void
152 152
 	 */
153
-	protected function load_component ( $instance ) {
153
+	protected function load_component($instance) {
154 154
 
155 155
 
156 156
 		$posts_array = array();
157
-		$post_args = array(	'post_type' 		=> 'course',
158
-							'posts_per_page' 		=> intval( $instance[ 'limit' ] ),
157
+		$post_args = array('post_type' 		=> 'course',
158
+							'posts_per_page' 		=> intval($instance['limit']),
159 159
 							'orderby'         	=> 'menu_order date',
160 160
     						'order'           	=> 'ASC',
161 161
     						'post_status'       => 'publish',
162 162
 							'suppress_filters' 	=> 0,
163 163
 							);
164 164
 
165
-		$post_args[ 'tax_query' ] = array(
165
+		$post_args['tax_query'] = array(
166 166
 											array(
167 167
 												'taxonomy' => 'course-category',
168 168
 												'field' => 'id',
169
-												'terms' => intval( $instance['course_category'] )
169
+												'terms' => intval($instance['course_category'])
170 170
 											)
171 171
 										);
172 172
 
173
-		$posts_array = get_posts( $post_args );
173
+		$posts_array = get_posts($post_args);
174 174
 
175
-		if ( count( $posts_array ) > 0 ) { ?>
175
+		if (count($posts_array) > 0) { ?>
176 176
 			<ul>
177
-			<?php foreach ($posts_array as $post_item){
178
-		    	$post_id = absint( $post_item->ID );
177
+			<?php foreach ($posts_array as $post_item) {
178
+		    	$post_id = absint($post_item->ID);
179 179
 		    	$post_title = $post_item->post_title;
180
-		    	$user_info = get_userdata( absint( $post_item->post_author ) );
181
-		    	$author_link = get_author_posts_url( absint( $post_item->post_author ) );
180
+		    	$user_info = get_userdata(absint($post_item->post_author));
181
+		    	$author_link = get_author_posts_url(absint($post_item->post_author));
182 182
 		    	$author_display_name = $user_info->display_name;
183 183
 		    	$author_id = $post_item->post_author;
184 184
 		    ?>
185 185
 		    	<li class="fix">
186
-		    		<?php do_action( 'sensei_course_image', $post_id ); ?>
187
-		    		<a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a>
186
+		    		<?php do_action('sensei_course_image', $post_id); ?>
187
+		    		<a href="<?php echo esc_url(get_permalink($post_id)); ?>" title="<?php echo esc_attr($post_title); ?>"><?php echo $post_title; ?></a>
188 188
 		    		<br />
189
-		    		<?php if ( isset( Sensei()->settings->settings[ 'course_author' ] ) && ( Sensei()->settings->settings[ 'course_author' ] ) ) { ?>
190
-    					<span class="course-author"><?php _e( 'by ', 'woothemes-sensei' ); ?><a href="<?php echo esc_url( $author_link ); ?>" title="<?php echo esc_attr( $author_display_name ); ?>"><?php echo esc_html( $author_display_name ); ?></a></span>
189
+		    		<?php if (isset(Sensei()->settings->settings['course_author']) && (Sensei()->settings->settings['course_author'])) { ?>
190
+    					<span class="course-author"><?php _e('by ', 'woothemes-sensei'); ?><a href="<?php echo esc_url($author_link); ?>" title="<?php echo esc_attr($author_display_name); ?>"><?php echo esc_html($author_display_name); ?></a></span>
191 191
     					<br />
192 192
     				<?php } // End If Statement ?>
193
-    				<span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count( $post_id ) . '&nbsp;' .  __( 'Lessons', 'woothemes-sensei' ); ?></span>
193
+    				<span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count($post_id).'&nbsp;'.__('Lessons', 'woothemes-sensei'); ?></span>
194 194
     				<br />
195
-    				<?php sensei_simple_course_price( $post_id ); ?>
195
+    				<?php sensei_simple_course_price($post_id); ?>
196 196
 		    	</li>
197 197
 		    <?php } // End For Loop ?>
198 198
 			</ul>
Please login to merge, or discard this patch.
widgets/widget-woothemes-sensei-course-categories.php 1 patch
Spacing   +37 added lines, -37 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 Course Categories Widget
@@ -26,18 +26,18 @@  discard block
 block discarded – undo
26 26
 	public function __construct() {
27 27
 		/* Widget variable settings. */
28 28
 		$this->woo_widget_cssclass = 'widget_sensei_course_categories';
29
-		$this->woo_widget_description = __( 'This widget will output a list of Course Categories.', 'woothemes-sensei' );
29
+		$this->woo_widget_description = __('This widget will output a list of Course Categories.', 'woothemes-sensei');
30 30
 		$this->woo_widget_idbase = 'sensei_course_categories';
31
-		$this->woo_widget_title = __( 'Sensei - Course Categories', 'woothemes-sensei' );
31
+		$this->woo_widget_title = __('Sensei - Course Categories', 'woothemes-sensei');
32 32
 
33 33
 		/* Widget settings. */
34
-		$widget_ops = array( 'classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description );
34
+		$widget_ops = array('classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description);
35 35
 
36 36
 		/* Widget control settings. */
37
-		$control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase );
37
+		$control_ops = array('width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase);
38 38
 
39 39
 		/* Create the widget. */
40
-		parent::__construct( $this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops );
40
+		parent::__construct($this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops);
41 41
 	} // End __construct()
42 42
 
43 43
 	/**
@@ -47,30 +47,30 @@  discard block
 block discarded – undo
47 47
 	 * @param  array $instance Widget settings for this instance.
48 48
 	 * @return void
49 49
 	 */
50
-	public function widget( $args, $instance ) {
50
+	public function widget($args, $instance) {
51 51
 
52
-        $before_widget = $args[ 'before_widget' ];
53
-        $before_title  = $args[ 'before_title' ];
54
-        $after_title   = $args[ 'after_title' ];
55
-        $after_widget  = $args[ 'after_widget' ];
52
+        $before_widget = $args['before_widget'];
53
+        $before_title  = $args['before_title'];
54
+        $after_title   = $args['after_title'];
55
+        $after_widget  = $args['after_widget'];
56 56
 
57 57
         /* Our variables from the widget settings. */
58
-        $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
58
+        $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
59 59
 
60 60
         /* Before widget (defined by themes). */
61 61
         echo $before_widget;
62 62
 
63 63
         /* Display the widget title if one was input (before and after defined by themes). */
64
-        if ( $title ) { echo $before_title . $title . $after_title; }
64
+        if ($title) { echo $before_title.$title.$after_title; }
65 65
 
66 66
         /* Widget content. */
67 67
         // Add actions for plugins/themes to hook onto.
68
-        do_action( $this->woo_widget_cssclass . '_top' );
68
+        do_action($this->woo_widget_cssclass.'_top');
69 69
 
70
-        $this->load_component( $instance );
70
+        $this->load_component($instance);
71 71
 
72 72
         // Add actions for plugins/themes to hook onto.
73
-        do_action( $this->woo_widget_cssclass . '_bottom' );
73
+        do_action($this->woo_widget_cssclass.'_bottom');
74 74
 
75 75
         /* After widget (defined by themes). */
76 76
         echo $after_widget;
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 	 * @param  array $old_instance Previous settings.
85 85
 	 * @return array               Updated settings.
86 86
 	 */
87
-	public function update ( $new_instance, $old_instance ) {
87
+	public function update($new_instance, $old_instance) {
88 88
 		$instance = $old_instance;
89 89
 
90 90
 		/* Strip tags for title and name to remove HTML (important for text inputs). */
91
-		$instance['title'] = strip_tags( $new_instance['title'] );
91
+		$instance['title'] = strip_tags($new_instance['title']);
92 92
 
93 93
 		/* The select box is returning a text value, so we escape it. */
94
-		$instance['limit'] = esc_attr( $new_instance['limit'] );
94
+		$instance['limit'] = esc_attr($new_instance['limit']);
95 95
 
96 96
 		/* The check box is returning a boolean value. */
97 97
 		$instance['count'] = $new_instance['count'];
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 * @param  array $instance The settings for this instance.
108 108
 	 * @return void
109 109
 	 */
110
-    public function form( $instance ) {
110
+    public function form($instance) {
111 111
 
112 112
 		/* Set up some default widget settings. */
113 113
 		/* Make sure all keys are added here, even with empty string values. */
@@ -118,27 +118,27 @@  discard block
 block discarded – undo
118 118
 						'hierarchical' => false
119 119
 					);
120 120
 
121
-		$instance = wp_parse_args( (array) $instance, $defaults );
121
+		$instance = wp_parse_args((array) $instance, $defaults);
122 122
 ?>
123 123
 		<!-- Widget Title: Text Input -->
124 124
 		<p>
125
-			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label>
126
-			<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"  value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" />
125
+			<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title (optional):', 'woothemes-sensei'); ?></label>
126
+			<input type="text" name="<?php echo esc_attr($this->get_field_name('title')); ?>"  value="<?php echo esc_attr($instance['title']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" />
127 127
 		</p>
128 128
 		<!-- Widget Limit: Text Input -->
129 129
 		<p>
130
-			<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Categories (optional):', 'woothemes-sensei' ); ?></label>
131
-			<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>"  value="<?php echo esc_attr( $instance['limit'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" />
130
+			<label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php _e('Number of Categories (optional):', 'woothemes-sensei'); ?></label>
131
+			<input type="text" name="<?php echo esc_attr($this->get_field_name('limit')); ?>"  value="<?php echo esc_attr($instance['limit']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('limit')); ?>" />
132 132
 		</p>
133 133
 		<!-- Widget Show Count: Checkbox Input -->
134 134
 		<p>
135
-			<input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id('count') ); ?>" name="<?php echo esc_attr( $this->get_field_name('count') ); ?>"<?php checked( $instance['count'], 'on' ); ?> />
136
-			<label for="<?php echo esc_attr( $this->get_field_id('count') ); ?>"><?php _e( 'Show post counts', 'woothemes-sensei' ); ?></label><br />
135
+			<input type="checkbox" class="checkbox" id="<?php echo esc_attr($this->get_field_id('count')); ?>" name="<?php echo esc_attr($this->get_field_name('count')); ?>"<?php checked($instance['count'], 'on'); ?> />
136
+			<label for="<?php echo esc_attr($this->get_field_id('count')); ?>"><?php _e('Show post counts', 'woothemes-sensei'); ?></label><br />
137 137
 		</p>
138 138
 		<!-- Widget Show Hierarchy: Checkbox Input -->
139 139
 		<p>
140
-			<input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id('hierarchical') ); ?>" name="<?php echo esc_attr( $this->get_field_name('hierarchical') ); ?>"<?php checked( $instance['hierarchical'], 'on' ); ?> />
141
-			<label for="<?php echo esc_attr( $this->get_field_id('hierarchical') ); ?>"><?php _e( 'Show hierarchy', 'woothemes-sensei' ); ?></label></p>
140
+			<input type="checkbox" class="checkbox" id="<?php echo esc_attr($this->get_field_id('hierarchical')); ?>" name="<?php echo esc_attr($this->get_field_name('hierarchical')); ?>"<?php checked($instance['hierarchical'], 'on'); ?> />
141
+			<label for="<?php echo esc_attr($this->get_field_id('hierarchical')); ?>"><?php _e('Show hierarchy', 'woothemes-sensei'); ?></label></p>
142 142
 		</p>
143 143
 <?php
144 144
 	} // End form()
@@ -149,18 +149,18 @@  discard block
 block discarded – undo
149 149
 	 * @since  1.1.0
150 150
 	 * @return void
151 151
 	 */
152
-	protected function load_component ( $instance ) {
152
+	protected function load_component($instance) {
153 153
 
154
-		$limit = intval( $instance['limit'] );
155
-		$count = isset($instance['count']) ? (bool) $instance['count'] :false;
156
-		$hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false;
154
+		$limit = intval($instance['limit']);
155
+		$count = isset($instance['count']) ? (bool) $instance['count'] : false;
156
+		$hierarchical = isset($instance['hierarchical']) ? (bool) $instance['hierarchical'] : false;
157 157
 
158
-		$cat_args = array( 'title_li' => '', 'taxonomy' => 'course-category', 'orderby' => 'name', 'show_count' => $count, 'hierarchical' => $hierarchical);
159
-		if ( 0 < $limit ) {
160
-			$cat_args[ 'number' ] = $limit;
158
+		$cat_args = array('title_li' => '', 'taxonomy' => 'course-category', 'orderby' => 'name', 'show_count' => $count, 'hierarchical' => $hierarchical);
159
+		if (0 < $limit) {
160
+			$cat_args['number'] = $limit;
161 161
 		} // End If Statement
162 162
 		echo '<ul>';
163
-			wp_list_categories( apply_filters('widget_course_categories_args', $cat_args) );
163
+			wp_list_categories(apply_filters('widget_course_categories_args', $cat_args));
164 164
 		echo '</ul>';
165 165
 	} // End load_component()
166 166
 } // End Class
167 167
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-sensei-learner-profiles.php 1 patch
Spacing   +41 added lines, -41 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
  * All functionality pertaining to the learner profiles in Sensei.
@@ -19,20 +19,20 @@  discard block
 block discarded – undo
19 19
 	 * Constructor.
20 20
 	 * @since  1.4.0
21 21
 	 */
22
-	public function __construct () {
22
+	public function __construct() {
23 23
 
24 24
 		// Setup learner profile URL base
25
-		$this->profile_url_base = apply_filters( 'sensei_learner_profiles_url_base', __( 'learner', 'woothemes-sensei') );
25
+		$this->profile_url_base = apply_filters('sensei_learner_profiles_url_base', __('learner', 'woothemes-sensei'));
26 26
 
27 27
 		// Setup permalink structure for learner profiles
28
-		add_action( 'init', array( $this, 'setup_permastruct' ) );
29
-		add_filter( 'wp_title', array( $this, 'page_title' ), 10, 2 );
28
+		add_action('init', array($this, 'setup_permastruct'));
29
+		add_filter('wp_title', array($this, 'page_title'), 10, 2);
30 30
 
31 31
 		// Set heading for courses section of learner profiles
32
-		add_action( 'sensei_learner_profile_info', array( $this, 'learner_profile_courses_heading' ), 30, 1 );
32
+		add_action('sensei_learner_profile_info', array($this, 'learner_profile_courses_heading'), 30, 1);
33 33
 
34 34
 		// Add class to body tag
35
-		add_filter( 'body_class', array( $this, 'learner_profile_body_class' ), 10, 1 );
35
+		add_filter('body_class', array($this, 'learner_profile_body_class'), 10, 1);
36 36
 	} // End __construct()
37 37
 
38 38
 	/**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function setup_permastruct() {
44 44
 
45
-        if( isset( Sensei()->settings->settings[ 'learner_profile_enable' ] )
46
-            && Sensei()->settings->settings[ 'learner_profile_enable' ] ) {
45
+        if (isset(Sensei()->settings->settings['learner_profile_enable'])
46
+            && Sensei()->settings->settings['learner_profile_enable']) {
47 47
 
48
-			add_rewrite_rule( '^' . $this->profile_url_base . '/([^/]*)/?', 'index.php?learner_profile=$matches[1]', 'top' );
49
-			add_rewrite_tag( '%learner_profile%', '([^&]+)' );
48
+			add_rewrite_rule('^'.$this->profile_url_base.'/([^/]*)/?', 'index.php?learner_profile=$matches[1]', 'top');
49
+			add_rewrite_tag('%learner_profile%', '([^&]+)');
50 50
 
51 51
 		}
52 52
 	}
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 	 * @param  string $sep   Seeparator string
58 58
 	 * @return string        Modified title
59 59
 	 */
60
-	public function page_title( $title, $sep = null ) {
60
+	public function page_title($title, $sep = null) {
61 61
 		global $wp_query;
62
-		if( isset( $wp_query->query_vars['learner_profile'] ) ) {
63
-			$learner_user = get_user_by( 'login', $wp_query->query_vars['learner_profile'] );
62
+		if (isset($wp_query->query_vars['learner_profile'])) {
63
+			$learner_user = get_user_by('login', $wp_query->query_vars['learner_profile']);
64 64
 
65
-            $name = Sensei_Learner::get_full_name( $learner_user->ID );
65
+            $name = Sensei_Learner::get_full_name($learner_user->ID);
66 66
 
67
-			$title = apply_filters( 'sensei_learner_profile_courses_heading', sprintf( __( 'Courses %s is taking', 'woothemes-sensei' ), $name ) ) . ' ' . $sep . ' ';
67
+			$title = apply_filters('sensei_learner_profile_courses_heading', sprintf(__('Courses %s is taking', 'woothemes-sensei'), $name)).' '.$sep.' ';
68 68
 		}
69 69
 		return $title;
70 70
 	}
@@ -75,23 +75,23 @@  discard block
 block discarded – undo
75 75
 	 * @param  integer $user_id ID of user
76 76
 	 * @return string           The learner profile permalink
77 77
 	 */
78
-	public function get_permalink( $user_id = 0 ) {
78
+	public function get_permalink($user_id = 0) {
79 79
 		$user = false;
80
-		if( $user_id == 0 ) {
80
+		if ($user_id == 0) {
81 81
 			global $current_user;
82 82
 			wp_get_current_user();
83 83
 			$user = $current_user;
84 84
 		} else {
85
-			$user = get_userdata( $user_id );
85
+			$user = get_userdata($user_id);
86 86
 		}
87 87
 
88 88
 		$permalink = '';
89 89
 
90
-		if( $user ) {
91
-			if ( get_option('permalink_structure') ) {
92
-				$permalink = trailingslashit( get_site_url() ) . $this->profile_url_base . '/' . $user->user_nicename;
90
+		if ($user) {
91
+			if (get_option('permalink_structure')) {
92
+				$permalink = trailingslashit(get_site_url()).$this->profile_url_base.'/'.$user->user_nicename;
93 93
 			} else {
94
-				$permalink = trailingslashit( get_site_url() ) . '?learner_profile=' . $user->user_nicename;
94
+				$permalink = trailingslashit(get_site_url()).'?learner_profile='.$user->user_nicename;
95 95
 			}
96 96
 		}
97 97
 
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
 	 * @return void
105 105
 	 */
106 106
 	public function content() {
107
-		global $wp_query,  $learner_user, $current_user;
107
+		global $wp_query, $learner_user, $current_user;
108 108
 
109
-		if( isset( Sensei()->settings->settings[ 'learner_profile_enable' ] ) && Sensei()->settings->settings[ 'learner_profile_enable' ] ) {
109
+		if (isset(Sensei()->settings->settings['learner_profile_enable']) && Sensei()->settings->settings['learner_profile_enable']) {
110 110
 
111
-			if( isset( $wp_query->query_vars['learner_profile'] ) ) {
111
+			if (isset($wp_query->query_vars['learner_profile'])) {
112 112
 
113
-                Sensei_Templates::get_template( 'learner-profile/learner-info.php' );
113
+                Sensei_Templates::get_template('learner-profile/learner-info.php');
114 114
 
115 115
 			}
116 116
 		}
@@ -122,14 +122,14 @@  discard block
 block discarded – undo
122 122
 	 * @param  object $user Queried user object
123 123
 	 * @return void
124 124
 	 */
125
-	public function learner_profile_courses_heading( $user ) {
126
-		if( strlen( $user->first_name ) > 0 ) {
125
+	public function learner_profile_courses_heading($user) {
126
+		if (strlen($user->first_name) > 0) {
127 127
 			$name = $user->first_name;
128 128
 		} else {
129 129
 			$name = $user->display_name;
130 130
 		}
131
-		$name = apply_filters( 'sensei_learner_profile_courses_heading_name', $name );
132
-		echo '<h2>' . apply_filters( 'sensei_learner_profile_courses_heading', sprintf( __( 'Courses %s is taking', 'woothemes-sensei' ), $name ) ) . '</h2>';
131
+		$name = apply_filters('sensei_learner_profile_courses_heading_name', $name);
132
+		echo '<h2>'.apply_filters('sensei_learner_profile_courses_heading', sprintf(__('Courses %s is taking', 'woothemes-sensei'), $name)).'</h2>';
133 133
 	}
134 134
 
135 135
 	/**
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
 	 * @param  object $user Queried user object
139 139
 	 * @return void
140 140
 	 */
141
-	public static function user_info( $user ) {
141
+	public static function user_info($user) {
142 142
 
143 143
         /**
144 144
          * This hooke fires inside the Sensei_Learner_Profiles::user_info function.
145 145
          * just before the htmls is generated.
146 146
          * @since 1.0.0
147 147
          */
148
-        do_action( 'sensei_learner_profile_info', $user );
148
+        do_action('sensei_learner_profile_info', $user);
149 149
 
150 150
         /**
151 151
          * This filter runs inside the Sensei_Learner_Profiles::user_info function.
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
          *
156 156
          * @param false|string `<img>` $user_avatar
157 157
          */
158
-		$learner_avatar = apply_filters( 'sensei_learner_profile_info_avatar', get_avatar( $user->ID, 120 ), $user->ID );
158
+		$learner_avatar = apply_filters('sensei_learner_profile_info_avatar', get_avatar($user->ID, 120), $user->ID);
159 159
 
160 160
         /**
161 161
          * This filter runs inside the Sensei_Learner_Profiles::user_info function.
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
          * @param string $user_display_name
166 166
          * @param string $user_id
167 167
          */
168
-		$learner_name = apply_filters( 'sensei_learner_profile_info_name', $user->display_name, $user->ID );
168
+		$learner_name = apply_filters('sensei_learner_profile_info_name', $user->display_name, $user->ID);
169 169
 
170 170
         /**
171 171
          * This filter runs inside the Sensei_Learner_Profiles::user_info function.
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
          * @param string $user_description
178 178
          * @param string $user_id
179 179
          */
180
-		$learner_bio = apply_filters( 'sensei_learner_profile_info_bio', $user->description, $user->ID );
180
+		$learner_bio = apply_filters('sensei_learner_profile_info_bio', $user->description, $user->ID);
181 181
 		?>
182 182
 
183 183
 		<div id="learner-info">
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 
189 189
 				<h2><?php echo $learner_name; ?></h2>
190 190
 
191
-				<div class="description"><?php echo wpautop( $learner_bio ); ?></div>
191
+				<div class="description"><?php echo wpautop($learner_bio); ?></div>
192 192
 
193 193
 			</div>
194 194
 
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
 	 * @param  array $classes Existing classes
203 203
 	 * @return array          Modified classes
204 204
 	 */
205
-	public function learner_profile_body_class( $classes ) {
205
+	public function learner_profile_body_class($classes) {
206 206
 		global $wp_query;
207
-		if( isset( $wp_query->query_vars['learner_profile'] ) ) {
207
+		if (isset($wp_query->query_vars['learner_profile'])) {
208 208
 			$classes[] = 'learner-profile';
209 209
 		}
210 210
 		return $classes;
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
      *
216 216
      * @since 1.9.0
217 217
      */
218
-    public static function deprecate_sensei_learner_profile_content_hook(){
218
+    public static function deprecate_sensei_learner_profile_content_hook() {
219 219
 
220
-        sensei_do_deprecated_action( 'sensei_learner_profile_content', '1.9.0', 'sensei_learner_profile_content_before' );
220
+        sensei_do_deprecated_action('sensei_learner_profile_content', '1.9.0', 'sensei_learner_profile_content_before');
221 221
 
222 222
     }
223 223
 
Please login to merge, or discard this patch.
includes/class-sensei-grading-main.php 1 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
  * Admin Grading Overview Data Table in Sensei.
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 * Constructor
22 22
 	 * @since  1.3.0
23 23
 	 */
24
-	public function __construct ( $args = null ) {
24
+	public function __construct($args = null) {
25 25
 
26 26
 		$defaults = array(
27 27
 			'course_id' => 0,
@@ -29,24 +29,24 @@  discard block
 block discarded – undo
29 29
 			'user_id' => false,
30 30
 			'view' => 'ungraded',
31 31
 		);
32
-		$args = wp_parse_args( $args, $defaults );
32
+		$args = wp_parse_args($args, $defaults);
33 33
 
34
-		$this->course_id = intval( $args['course_id'] );
35
-		$this->lesson_id = intval( $args['lesson_id'] );
36
-		if ( !empty($args['user_id']) ) {
37
-			$this->user_id = intval( $args['user_id'] );
34
+		$this->course_id = intval($args['course_id']);
35
+		$this->lesson_id = intval($args['lesson_id']);
36
+		if ( ! empty($args['user_id'])) {
37
+			$this->user_id = intval($args['user_id']);
38 38
 		}
39 39
 
40
-		if( !empty( $args['view'] ) && in_array( $args['view'], array( 'in-progress', 'graded', 'ungraded', 'all' ) ) ) {
40
+		if ( ! empty($args['view']) && in_array($args['view'], array('in-progress', 'graded', 'ungraded', 'all'))) {
41 41
 			$this->view = $args['view'];
42 42
 		}
43 43
 
44 44
 		// Load Parent token into constructor
45
-		parent::__construct( 'grading_main' );
45
+		parent::__construct('grading_main');
46 46
 
47 47
 		// Actions
48
-		add_action( 'sensei_before_list_table', array( $this, 'data_table_header' ) );
49
-		add_action( 'sensei_after_list_table', array( $this, 'data_table_footer' ) );
48
+		add_action('sensei_before_list_table', array($this, 'data_table_header'));
49
+		add_action('sensei_after_list_table', array($this, 'data_table_footer'));
50 50
 	} // End __construct()
51 51
 
52 52
 	/**
@@ -56,16 +56,16 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	function get_columns() {
58 58
 		$columns = array(
59
-			'title' => __( 'Learner', 'woothemes-sensei' ),
60
-			'course' => __( 'Course', 'woothemes-sensei' ),
61
-			'lesson' => __( 'Lesson', 'woothemes-sensei' ),
62
-			'updated' => __( 'Updated', 'woothemes-sensei' ),
63
-			'user_status' => __( 'Status', 'woothemes-sensei' ),
64
-			'user_grade' => __( 'Grade', 'woothemes-sensei' ),
59
+			'title' => __('Learner', 'woothemes-sensei'),
60
+			'course' => __('Course', 'woothemes-sensei'),
61
+			'lesson' => __('Lesson', 'woothemes-sensei'),
62
+			'updated' => __('Updated', 'woothemes-sensei'),
63
+			'user_status' => __('Status', 'woothemes-sensei'),
64
+			'user_grade' => __('Grade', 'woothemes-sensei'),
65 65
 			'action' => '',
66 66
 		);
67 67
 
68
-		$columns = apply_filters( 'sensei_grading_default_columns', $columns, $this );
68
+		$columns = apply_filters('sensei_grading_default_columns', $columns, $this);
69 69
 		return $columns;
70 70
 	}
71 71
 
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	function get_sortable_columns() {
78 78
 		$columns = array(
79
-			'title' => array( 'title', false ),
80
-			'course' => array( 'course', false ),
81
-			'lesson' => array( 'lesson', false ),
82
-			'updated' => array( 'updated', false ),
83
-			'user_status' => array( 'user_status', false ),
84
-			'user_grade' => array( 'user_grade', false ),
79
+			'title' => array('title', false),
80
+			'course' => array('course', false),
81
+			'lesson' => array('lesson', false),
82
+			'updated' => array('updated', false),
83
+			'user_status' => array('user_status', false),
84
+			'user_grade' => array('user_grade', false),
85 85
 		);
86
-		$columns = apply_filters( 'sensei_grading_default_columns_sortable', $columns, $this );
86
+		$columns = apply_filters('sensei_grading_default_columns_sortable', $columns, $this);
87 87
 		return $columns;
88 88
 	}
89 89
 
@@ -97,47 +97,47 @@  discard block
 block discarded – undo
97 97
 
98 98
 		// Handle orderby
99 99
 		$orderby = '';
100
-		if ( !empty( $_GET['orderby'] ) ) {
101
-			if ( array_key_exists( esc_html( $_GET['orderby'] ), $this->get_sortable_columns() ) ) {
102
-				$orderby = esc_html( $_GET['orderby'] );
100
+		if ( ! empty($_GET['orderby'])) {
101
+			if (array_key_exists(esc_html($_GET['orderby']), $this->get_sortable_columns())) {
102
+				$orderby = esc_html($_GET['orderby']);
103 103
 			} // End If Statement
104 104
 		}
105 105
 
106 106
 		// Handle order
107 107
 		$order = 'DESC';
108
-		if ( !empty( $_GET['order'] ) ) {
109
-			$order = ( 'ASC' == strtoupper($_GET['order']) ) ? 'ASC' : 'DESC';
108
+		if ( ! empty($_GET['order'])) {
109
+			$order = ('ASC' == strtoupper($_GET['order'])) ? 'ASC' : 'DESC';
110 110
 		}
111 111
 
112 112
 		// Handle search
113 113
 		$search = false;
114
-		if ( !empty( $_GET['s'] ) ) {
115
-			$search = esc_html( $_GET['s'] );
114
+		if ( ! empty($_GET['s'])) {
115
+			$search = esc_html($_GET['s']);
116 116
 		} // End If Statement
117 117
 		$this->search = $search;
118 118
 
119 119
 		// Searching users on statuses requires sub-selecting the statuses by user_ids
120
-		if ( $this->search ) {
120
+		if ($this->search) {
121 121
 			$user_args = array(
122
-				'search' => '*' . $this->search . '*',
122
+				'search' => '*'.$this->search.'*',
123 123
 				'fields' => 'ID',
124 124
 			);
125 125
 			// Filter for extending
126
-			$user_args = apply_filters( 'sensei_grading_search_users', $user_args );
127
-			if ( !empty( $user_args ) ) {
128
-				$learners_search = new WP_User_Query( $user_args );
126
+			$user_args = apply_filters('sensei_grading_search_users', $user_args);
127
+			if ( ! empty($user_args)) {
128
+				$learners_search = new WP_User_Query($user_args);
129 129
 				// Store for reuse on counts
130 130
 				$this->user_ids = $learners_search->get_results();
131 131
 			}
132 132
 		} // End If Statement
133 133
 
134
-		$per_page = $this->get_items_per_page( 'sensei_comments_per_page' );
135
-		$per_page = apply_filters( 'sensei_comments_per_page', $per_page, 'sensei_comments' );
134
+		$per_page = $this->get_items_per_page('sensei_comments_per_page');
135
+		$per_page = apply_filters('sensei_comments_per_page', $per_page, 'sensei_comments');
136 136
 
137 137
 		$paged = $this->get_pagenum();
138 138
 		$offset = 0;
139
-		if ( !empty($paged) ) {
140
-			$offset = $per_page * ( $paged - 1 );
139
+		if ( ! empty($paged)) {
140
+			$offset = $per_page * ($paged - 1);
141 141
 		} // End If Statement
142 142
 
143 143
 		$activity_args = array(
@@ -149,27 +149,27 @@  discard block
 block discarded – undo
149 149
 			'status' => 'any',
150 150
 		);
151 151
 
152
-		if( $this->lesson_id ) {
152
+		if ($this->lesson_id) {
153 153
 			$activity_args['post_id'] = $this->lesson_id;
154 154
 		}
155
-		elseif( $this->course_id ) {
155
+		elseif ($this->course_id) {
156 156
 			// Currently not possible to restrict to a single Course, as that requires WP_Comment to support multiple
157 157
 			// post_ids (i.e. every lesson within the Course), WP 4.1 ( https://core.trac.wordpress.org/changeset/29808 )
158
-			if ( version_compare($wp_version, '4.1', '>=') ) {
159
-				$activity_args['post__in'] = Sensei()->course->course_lessons( $this->course_id, 'any', 'ids' );
158
+			if (version_compare($wp_version, '4.1', '>=')) {
159
+				$activity_args['post__in'] = Sensei()->course->course_lessons($this->course_id, 'any', 'ids');
160 160
 			}
161 161
 		}
162 162
 		// Sub select to group of learners
163
-		if ( $this->user_ids ) {
163
+		if ($this->user_ids) {
164 164
 			$activity_args['user_id'] = (array) $this->user_ids;
165 165
 		}
166 166
 		// Restrict to a single Learner
167
-		if( $this->user_id ) {
167
+		if ($this->user_id) {
168 168
 			$activity_args['user_id'] = $this->user_id;
169 169
 		}
170 170
 
171 171
 
172
-		switch( $this->view ) {
172
+		switch ($this->view) {
173 173
 			case 'in-progress' :
174 174
 				$activity_args['status'] = 'in-progress';
175 175
 				break;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 				break;
180 180
 
181 181
 			case 'graded' :
182
-				$activity_args['status'] = array( 'graded', 'passed', 'failed' );
182
+				$activity_args['status'] = array('graded', 'passed', 'failed');
183 183
 				break;
184 184
 
185 185
 			case 'all' :
@@ -188,31 +188,31 @@  discard block
 block discarded – undo
188 188
 				break;
189 189
 		} // End switch
190 190
 
191
-		$activity_args = apply_filters( 'sensei_grading_filter_statuses', $activity_args );
191
+		$activity_args = apply_filters('sensei_grading_filter_statuses', $activity_args);
192 192
 
193 193
 		// WP_Comment_Query doesn't support SQL_CALC_FOUND_ROWS, so instead do this twice
194
-		$total_statuses = Sensei_Utils::sensei_check_for_activity( array_merge( $activity_args, array('count' => true, 'offset' => 0, 'number' => 0) ) );
194
+		$total_statuses = Sensei_Utils::sensei_check_for_activity(array_merge($activity_args, array('count' => true, 'offset' => 0, 'number' => 0)));
195 195
 
196 196
 		// Ensure we change our range to fit (in case a search threw off the pagination) - Should this be added to all views?
197
-		if ( $total_statuses < $activity_args['offset'] ) {
198
-			$new_paged = floor( $total_statuses / $activity_args['number'] );
197
+		if ($total_statuses < $activity_args['offset']) {
198
+			$new_paged = floor($total_statuses / $activity_args['number']);
199 199
 			$activity_args['offset'] = $new_paged * $activity_args['number'];
200 200
 		}
201
-		$statuses = Sensei_Utils::sensei_check_for_activity( $activity_args, true );
201
+		$statuses = Sensei_Utils::sensei_check_for_activity($activity_args, true);
202 202
 		// Need to always return an array, even with only 1 item
203
-		if ( !is_array($statuses) ) {
204
-			$statuses = array( $statuses );
203
+		if ( ! is_array($statuses)) {
204
+			$statuses = array($statuses);
205 205
 		}
206 206
 		$this->total_items = $total_statuses;
207 207
 		$this->items = $statuses;
208 208
 
209 209
 		$total_items = $this->total_items;
210
-		$total_pages = ceil( $total_items / $per_page );
211
-		$this->set_pagination_args( array(
210
+		$total_pages = ceil($total_items / $per_page);
211
+		$this->set_pagination_args(array(
212 212
 			'total_items' => $total_items,
213 213
 			'total_pages' => $total_pages,
214 214
 			'per_page' => $per_page
215
-		) );
215
+		));
216 216
 	}
217 217
 
218 218
 	/**
@@ -220,73 +220,73 @@  discard block
 block discarded – undo
220 220
 	 * @since  1.7.0
221 221
 	 * @param object $item The current item
222 222
 	 */
223
-	protected function get_row_data( $item ) {
223
+	protected function get_row_data($item) {
224 224
 		global $wp_version;
225 225
 
226 226
 		$grade = '';
227
-		if( 'complete' == $item->comment_approved ) {
228
-			$status_html = '<span class="graded">' . __( 'Completed', 'woothemes-sensei' ) . '</span>';
229
-			$grade =  __( 'No Grade', 'woothemes-sensei' );
227
+		if ('complete' == $item->comment_approved) {
228
+			$status_html = '<span class="graded">'.__('Completed', 'woothemes-sensei').'</span>';
229
+			$grade = __('No Grade', 'woothemes-sensei');
230 230
 		}
231
-		elseif( 'graded' == $item->comment_approved ) {
232
-			$status_html = '<span class="graded">' .  __( 'Graded', 'woothemes-sensei' )  . '</span>';
233
-			$grade = get_comment_meta( $item->comment_ID, 'grade', true) . '%';
231
+		elseif ('graded' == $item->comment_approved) {
232
+			$status_html = '<span class="graded">'.__('Graded', 'woothemes-sensei').'</span>';
233
+			$grade = get_comment_meta($item->comment_ID, 'grade', true).'%';
234 234
 		}
235
-		elseif( 'passed' == $item->comment_approved ) {
236
-			$status_html = '<span class="passed">' .  __( 'Passed', 'woothemes-sensei' )  . '</span>';
237
-			$grade = get_comment_meta( $item->comment_ID, 'grade', true) . '%';
235
+		elseif ('passed' == $item->comment_approved) {
236
+			$status_html = '<span class="passed">'.__('Passed', 'woothemes-sensei').'</span>';
237
+			$grade = get_comment_meta($item->comment_ID, 'grade', true).'%';
238 238
 		}
239
-		elseif( 'failed' == $item->comment_approved ) {
240
-			$status_html = '<span class="failed">' .  __( 'Failed', 'woothemes-sensei' )  . '</span>';
241
-			$grade = get_comment_meta( $item->comment_ID, 'grade', true) . '%';
239
+		elseif ('failed' == $item->comment_approved) {
240
+			$status_html = '<span class="failed">'.__('Failed', 'woothemes-sensei').'</span>';
241
+			$grade = get_comment_meta($item->comment_ID, 'grade', true).'%';
242 242
 		}
243
-		elseif( 'ungraded' == $item->comment_approved ) {
244
-			$status_html = '<span class="ungraded">' .  __( 'Ungraded', 'woothemes-sensei' )  . '</span>';
245
-			$grade = __( 'N/A', 'woothemes-sensei' );
243
+		elseif ('ungraded' == $item->comment_approved) {
244
+			$status_html = '<span class="ungraded">'.__('Ungraded', 'woothemes-sensei').'</span>';
245
+			$grade = __('N/A', 'woothemes-sensei');
246 246
 		}
247 247
 		else {
248
-			$status_html = '<span class="in-progress">' . __( 'In Progress', 'woothemes-sensei' ) . '</span>';
249
-			$grade = __( 'N/A', 'woothemes-sensei' );
248
+			$status_html = '<span class="in-progress">'.__('In Progress', 'woothemes-sensei').'</span>';
249
+			$grade = __('N/A', 'woothemes-sensei');
250 250
 		}
251 251
 
252
-        $title = Sensei_Learner::get_full_name( $item->user_id );
252
+        $title = Sensei_Learner::get_full_name($item->user_id);
253 253
 
254 254
 		// QuizID to be deprecated
255
-		$quiz_id = get_post_meta( $item->comment_post_ID, '_lesson_quiz', true );
256
-		$quiz_link = esc_url( add_query_arg( array( 'page' => $this->page_slug, 'user' => $item->user_id, 'quiz_id' => $quiz_id ), admin_url( 'admin.php' ) ) );
255
+		$quiz_id = get_post_meta($item->comment_post_ID, '_lesson_quiz', true);
256
+		$quiz_link = esc_url(add_query_arg(array('page' => $this->page_slug, 'user' => $item->user_id, 'quiz_id' => $quiz_id), admin_url('admin.php')));
257 257
 
258 258
 		$grade_link = '';
259
-		switch( $item->comment_approved ) {
259
+		switch ($item->comment_approved) {
260 260
 			case 'ungraded':
261
-				$grade_link = '<a class="button-primary button" href="' . $quiz_link . '">' . __('Grade quiz', 'woothemes-sensei' ) . '</a>';
261
+				$grade_link = '<a class="button-primary button" href="'.$quiz_link.'">'.__('Grade quiz', 'woothemes-sensei').'</a>';
262 262
 				break;
263 263
 
264 264
 			case 'graded':
265 265
 			case 'passed':
266 266
 			case 'failed':
267
-				$grade_link = '<a class="button-secondary button" href="' . $quiz_link . '">' . __('Review grade', 'woothemes-sensei' ) . '</a>';
267
+				$grade_link = '<a class="button-secondary button" href="'.$quiz_link.'">'.__('Review grade', 'woothemes-sensei').'</a>';
268 268
 				break;
269 269
 		}
270 270
 
271
-		$course_id = get_post_meta( $item->comment_post_ID, '_lesson_course', true );
271
+		$course_id = get_post_meta($item->comment_post_ID, '_lesson_course', true);
272 272
 		$course_title = '';
273
-		if ( !empty($course_id) && version_compare($wp_version, '4.1', '>=') ) {
274
-			$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>';
273
+		if ( ! empty($course_id) && version_compare($wp_version, '4.1', '>=')) {
274
+			$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>';
275 275
 		}
276
-		else if ( !empty($course_id) ) {
277
-			$course_title = get_the_title( $course_id );
276
+		else if ( ! empty($course_id)) {
277
+			$course_title = get_the_title($course_id);
278 278
 		}
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>';
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>';
280 280
 
281
-		$column_data = apply_filters( 'sensei_grading_main_column_data', array(
282
-				'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>',
281
+		$column_data = apply_filters('sensei_grading_main_column_data', array(
282
+				'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>',
283 283
 				'course' => $course_title,
284 284
 				'lesson' => $lesson_title,
285 285
 				'updated' => $item->comment_date,
286 286
 				'user_status' => $status_html,
287 287
 				'user_grade' => $grade,
288 288
 				'action' => $grade_link,
289
-			), $item, $course_id );
289
+			), $item, $course_id);
290 290
 
291 291
 		return $column_data;
292 292
 	}
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 */
300 300
 	public function no_items() {
301 301
 
302
-        _e( 'No submissions found.', 'woothemes-sensei' );
302
+        _e('No submissions found.', 'woothemes-sensei');
303 303
 
304 304
 	} // End no_items()
305 305
 
@@ -312,35 +312,35 @@  discard block
 block discarded – undo
312 312
 		global  $wp_version;
313 313
 
314 314
 		echo '<div class="grading-selects">';
315
-		do_action( 'sensei_grading_before_dropdown_filters' );
315
+		do_action('sensei_grading_before_dropdown_filters');
316 316
 
317
-		echo '<div class="select-box">' . "\n";
317
+		echo '<div class="select-box">'."\n";
318 318
 
319
-			echo '<select id="grading-course-options" name="grading_course" class="chosen_select widefat">' . "\n";
319
+			echo '<select id="grading-course-options" name="grading_course" class="chosen_select widefat">'."\n";
320 320
 
321
-				echo Sensei()->grading->courses_drop_down_html( $this->course_id );
321
+				echo Sensei()->grading->courses_drop_down_html($this->course_id);
322 322
 
323
-			echo '</select>' . "\n";
323
+			echo '</select>'."\n";
324 324
 
325
-		echo '</div>' . "\n";
325
+		echo '</div>'."\n";
326 326
 
327
-		echo '<div class="select-box">' . "\n";
327
+		echo '<div class="select-box">'."\n";
328 328
 
329
-			echo '<select id="grading-lesson-options" data-placeholder="&larr; ' . __( 'Select a course', 'woothemes-sensei' ) . '" name="grading_lesson" class="chosen_select widefat">' . "\n";
329
+			echo '<select id="grading-lesson-options" data-placeholder="&larr; '.__('Select a course', 'woothemes-sensei').'" name="grading_lesson" class="chosen_select widefat">'."\n";
330 330
 
331
-				echo Sensei()->grading->lessons_drop_down_html( $this->course_id, $this->lesson_id );
331
+				echo Sensei()->grading->lessons_drop_down_html($this->course_id, $this->lesson_id);
332 332
 
333
-			echo '</select>' . "\n";
333
+			echo '</select>'."\n";
334 334
 
335
-		echo '</div>' . "\n";
335
+		echo '</div>'."\n";
336 336
 
337
-		if( $this->course_id && $this->lesson_id ) {
337
+		if ($this->course_id && $this->lesson_id) {
338 338
 
339
-			echo '<div class="select-box reset-filter">' . "\n";
339
+			echo '<div class="select-box reset-filter">'."\n";
340 340
 
341
-				echo '<a class="button-secondary" href="' . esc_url( remove_query_arg( array( 'lesson_id', 'course_id' ) ) ) . '">' . __( 'Reset filter', 'woothemes-sensei' ) . '</a>' . "\n";
341
+				echo '<a class="button-secondary" href="'.esc_url(remove_query_arg(array('lesson_id', 'course_id'))).'">'.__('Reset filter', 'woothemes-sensei').'</a>'."\n";
342 342
 
343
-			echo '</div>' . "\n";
343
+			echo '</div>'."\n";
344 344
 
345 345
 		}
346 346
 
@@ -355,26 +355,26 @@  discard block
 block discarded – undo
355 355
 		$query_args = array(
356 356
 			'page' => $this->page_slug,
357 357
 		);
358
-		if( $this->course_id ) {
358
+		if ($this->course_id) {
359 359
 			// Currently not possible to restrict to a single Course, as that requires WP_Comment to support multiple
360 360
 			// post_ids (i.e. every lesson within the Course), WP 4.1 ( https://core.trac.wordpress.org/changeset/29808 )
361 361
 			$query_args['course_id'] = $this->course_id;
362
-			if ( version_compare($wp_version, '4.1', '>=') ) {
363
-				$count_args['post__in'] = Sensei()->course->course_lessons( $this->course_id, 'any', 'ids' );
362
+			if (version_compare($wp_version, '4.1', '>=')) {
363
+				$count_args['post__in'] = Sensei()->course->course_lessons($this->course_id, 'any', 'ids');
364 364
 			}
365 365
 		}
366
-		if( $this->lesson_id ) {
366
+		if ($this->lesson_id) {
367 367
 			$query_args['lesson_id'] = $this->lesson_id;
368 368
 			// Restrict to a single lesson
369 369
 			$count_args['post_id'] = $this->lesson_id;
370 370
 		}
371
-		if( $this->search ) {
371
+		if ($this->search) {
372 372
 			$query_args['s'] = $this->search;
373 373
 		}
374
-		if ( !empty($this->user_ids) ) {
374
+		if ( ! empty($this->user_ids)) {
375 375
 			$count_args['user_id'] = $this->user_ids;
376 376
 		}
377
-		if( !empty($this->user_id) ) {
377
+		if ( ! empty($this->user_id)) {
378 378
 			$query_args['user_id'] = $this->user_id;
379 379
 			$count_args['user_id'] = $this->user_id;
380 380
 		}
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 		$all_lessons_count = $ungraded_lessons_count = $graded_lessons_count = $inprogress_lessons_count = 0;
383 383
 		$all_class = $ungraded_class = $graded_class = $inprogress_class = '';
384 384
 
385
-		switch( $this->view ) :
385
+		switch ($this->view) :
386 386
 			case 'all':
387 387
 				$all_class = 'current';
388 388
 				break;
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 				break;
399 399
 		endswitch;
400 400
 
401
-		$counts = Sensei()->grading->count_statuses( apply_filters( 'sensei_grading_count_statues', $count_args ) );
401
+		$counts = Sensei()->grading->count_statuses(apply_filters('sensei_grading_count_statues', $count_args));
402 402
 
403 403
 		$inprogress_lessons_count = $counts['in-progress'];
404 404
 		$ungraded_lessons_count = $counts['ungraded'];
@@ -414,19 +414,19 @@  discard block
 block discarded – undo
414 414
 		$inprogress_args['view'] = 'in-progress';
415 415
 
416 416
 		$format = '<a class="%s" href="%s">%s <span class="count">(%s)</span></a>';
417
-		$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 ) );
418
-		$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 ) );
419
-		$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 ) );
420
-		$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 ) );
421
-
422
-		$menu = apply_filters( 'sensei_grading_sub_menu', $menu );
423
-		if ( !empty($menu) ) {
424
-			echo '<ul class="subsubsub">' . "\n";
425
-			foreach ( $menu as $class => $item ) {
426
-				$menu[ $class ] = "\t<li class='$class'>$item";
417
+		$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));
418
+		$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));
419
+		$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));
420
+		$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));
421
+
422
+		$menu = apply_filters('sensei_grading_sub_menu', $menu);
423
+		if ( ! empty($menu)) {
424
+			echo '<ul class="subsubsub">'."\n";
425
+			foreach ($menu as $class => $item) {
426
+				$menu[$class] = "\t<li class='$class'>$item";
427 427
 			}
428
-			echo implode( " |</li>\n", $menu ) . "</li>\n";
429
-			echo '</ul>' . "\n";
428
+			echo implode(" |</li>\n", $menu)."</li>\n";
429
+			echo '</ul>'."\n";
430 430
 		}
431 431
 
432 432
 	} // End data_table_header()
@@ -447,4 +447,4 @@  discard block
 block discarded – undo
447 447
  * @ignore only for backward compatibility
448 448
  * @since 1.9.0
449 449
  */
450
-class WooThemes_Sensei_Grading_Main extends Sensei_Grading_Main{}
450
+class WooThemes_Sensei_Grading_Main extends Sensei_Grading_Main {}
Please login to merge, or discard this patch.
includes/class-sensei-analysis-lesson-list-table.php 1 patch
Spacing   +95 added lines, -95 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
  * Admin Analysis Lesson Data Table in Sensei.
@@ -18,18 +18,18 @@  discard block
 block discarded – undo
18 18
 	 * Constructor
19 19
 	 * @since  1.2.0
20 20
 	 */
21
-	public function __construct ( $lesson_id = 0 ) {
22
-		$this->lesson_id = intval( $lesson_id );
23
-		$this->course_id = intval( get_post_meta( $this->lesson_id, '_lesson_course', true ) );
21
+	public function __construct($lesson_id = 0) {
22
+		$this->lesson_id = intval($lesson_id);
23
+		$this->course_id = intval(get_post_meta($this->lesson_id, '_lesson_course', true));
24 24
 
25 25
 		// Load Parent token into constructor
26
-		parent::__construct( 'analysis_lesson' );
26
+		parent::__construct('analysis_lesson');
27 27
 
28 28
 		// Actions
29
-		add_action( 'sensei_before_list_table', array( $this, 'data_table_header' ) );
30
-		add_action( 'sensei_after_list_table', array( $this, 'data_table_footer' ) );
29
+		add_action('sensei_before_list_table', array($this, 'data_table_header'));
30
+		add_action('sensei_after_list_table', array($this, 'data_table_footer'));
31 31
 
32
-		add_filter( 'sensei_list_table_search_button_text', array( $this, 'search_button' ) );
32
+		add_filter('sensei_list_table_search_button_text', array($this, 'search_button'));
33 33
 	} // End __construct()
34 34
 
35 35
 	/**
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	function get_columns() {
41 41
 		$columns = array(
42
-			'title' => __( 'Learner', 'woothemes-sensei' ),
43
-			'started' => __( 'Date Started', 'woothemes-sensei' ),
44
-			'completed' => __( 'Date Completed', 'woothemes-sensei' ),
45
-			'status' => __( 'Status', 'woothemes-sensei' ),
46
-			'grade' => __( 'Grade', 'woothemes-sensei' ),
42
+			'title' => __('Learner', 'woothemes-sensei'),
43
+			'started' => __('Date Started', 'woothemes-sensei'),
44
+			'completed' => __('Date Completed', 'woothemes-sensei'),
45
+			'status' => __('Status', 'woothemes-sensei'),
46
+			'grade' => __('Grade', 'woothemes-sensei'),
47 47
 		);
48
-		$columns = apply_filters( 'sensei_analysis_lesson_columns', $columns, $this );
48
+		$columns = apply_filters('sensei_analysis_lesson_columns', $columns, $this);
49 49
 		return $columns;
50 50
 	}
51 51
 
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	function get_sortable_columns() {
58 58
 		$columns = array(
59
-			'title' => array( 'title', false ),
60
-			'started' => array( 'started', false ),
61
-			'completed' => array( 'completed', false ),
62
-			'status' => array( 'status', false ),
63
-			'grade' => array( 'grade', false ),
59
+			'title' => array('title', false),
60
+			'started' => array('started', false),
61
+			'completed' => array('completed', false),
62
+			'status' => array('status', false),
63
+			'grade' => array('grade', false),
64 64
 		);
65
-		$columns = apply_filters( 'sensei_analysis_lesson_columns_sortable', $columns, $this );
65
+		$columns = apply_filters('sensei_analysis_lesson_columns_sortable', $columns, $this);
66 66
 		return $columns;
67 67
 	}
68 68
 
@@ -76,32 +76,32 @@  discard block
 block discarded – undo
76 76
 
77 77
 		// Handle orderby (needs work)
78 78
 		$orderby = '';
79
-		if ( !empty( $_GET['orderby'] ) ) {
80
-			if ( array_key_exists( esc_html( $_GET['orderby'] ), $this->get_sortable_columns() ) ) {
81
-				$orderby = esc_html( $_GET['orderby'] );
79
+		if ( ! empty($_GET['orderby'])) {
80
+			if (array_key_exists(esc_html($_GET['orderby']), $this->get_sortable_columns())) {
81
+				$orderby = esc_html($_GET['orderby']);
82 82
 			} // End If Statement
83 83
 		}
84 84
 
85 85
 		// Handle order
86 86
 		$order = 'ASC';
87
-		if ( !empty( $_GET['order'] ) ) {
88
-			$order = ( 'ASC' == strtoupper($_GET['order']) ) ? 'ASC' : 'DESC';
87
+		if ( ! empty($_GET['order'])) {
88
+			$order = ('ASC' == strtoupper($_GET['order'])) ? 'ASC' : 'DESC';
89 89
 		}
90 90
 
91 91
 		// Handle search, need 4.1 version of WP to be able to restrict statuses to known post_ids
92 92
 		$search = false;
93
-		if ( !empty( $_GET['s'] ) ) {
94
-			$search = esc_html( $_GET['s'] );
93
+		if ( ! empty($_GET['s'])) {
94
+			$search = esc_html($_GET['s']);
95 95
 		} // End If Statement
96 96
 		$this->search = $search;
97 97
 
98
-		$per_page = $this->get_items_per_page( 'sensei_comments_per_page' );
99
-		$per_page = apply_filters( 'sensei_comments_per_page', $per_page, 'sensei_comments' );
98
+		$per_page = $this->get_items_per_page('sensei_comments_per_page');
99
+		$per_page = apply_filters('sensei_comments_per_page', $per_page, 'sensei_comments');
100 100
 
101 101
 		$paged = $this->get_pagenum();
102 102
 		$offset = 0;
103
-		if ( !empty($paged) ) {
104
-			$offset = $per_page * ( $paged - 1 );
103
+		if ( ! empty($paged)) {
104
+			$offset = $per_page * ($paged - 1);
105 105
 		} // End If Statement
106 106
 
107 107
 		$args = array(
@@ -110,19 +110,19 @@  discard block
 block discarded – undo
110 110
 			'orderby' => $orderby,
111 111
 			'order' => $order,
112 112
 		);
113
-		if ( $this->search ) {
113
+		if ($this->search) {
114 114
 			$args['search'] = $this->search;
115 115
 		} // End If Statement
116 116
 
117
-		$this->items = $this->get_lesson_statuses( $args );
117
+		$this->items = $this->get_lesson_statuses($args);
118 118
 
119 119
 		$total_items = $this->total_items;
120
-		$total_pages = ceil( $total_items / $per_page );
121
-		$this->set_pagination_args( array(
120
+		$total_pages = ceil($total_items / $per_page);
121
+		$this->set_pagination_args(array(
122 122
 			'total_items' => $total_items,
123 123
 			'total_pages' => $total_pages,
124 124
 			'per_page' => $per_page
125
-		) );
125
+		));
126 126
 	}
127 127
 
128 128
 	/**
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @since  1.7.0
131 131
 	 * @return data
132 132
 	 */
133
-	public function generate_report( $report ) {
133
+	public function generate_report($report) {
134 134
 
135 135
 		$data = array();
136 136
 
@@ -138,22 +138,22 @@  discard block
 block discarded – undo
138 138
 
139 139
 		// Handle orderby
140 140
 		$orderby = '';
141
-		if ( !empty( $_GET['orderby'] ) ) {
142
-			if ( array_key_exists( esc_html( $_GET['orderby'] ), $this->get_sortable_columns() ) ) {
143
-				$orderby = esc_html( $_GET['orderby'] );
141
+		if ( ! empty($_GET['orderby'])) {
142
+			if (array_key_exists(esc_html($_GET['orderby']), $this->get_sortable_columns())) {
143
+				$orderby = esc_html($_GET['orderby']);
144 144
 			} // End If Statement
145 145
 		}
146 146
 
147 147
 		// Handle order
148 148
 		$order = 'ASC';
149
-		if ( !empty( $_GET['order'] ) ) {
150
-			$order = ( 'ASC' == strtoupper($_GET['order']) ) ? 'ASC' : 'DESC';
149
+		if ( ! empty($_GET['order'])) {
150
+			$order = ('ASC' == strtoupper($_GET['order'])) ? 'ASC' : 'DESC';
151 151
 		}
152 152
 
153 153
 		// Handle search
154 154
 		$search = false;
155
-		if ( !empty( $_GET['s'] ) ) {
156
-			$search = esc_html( $_GET['s'] );
155
+		if ( ! empty($_GET['s'])) {
156
+			$search = esc_html($_GET['s']);
157 157
 		} // End If Statement
158 158
 		$this->search = $search;
159 159
 
@@ -161,23 +161,23 @@  discard block
 block discarded – undo
161 161
 			'orderby' => $orderby,
162 162
 			'order' => $order,
163 163
 		);
164
-		if ( $this->search ) {
164
+		if ($this->search) {
165 165
 			$args['search'] = $this->search;
166 166
 		} // End If Statement
167 167
 
168 168
 		// Start the csv with the column headings
169 169
 		$column_headers = array();
170 170
 		$columns = $this->get_columns();
171
-		foreach( $columns AS $key => $title ) {
171
+		foreach ($columns AS $key => $title) {
172 172
 			$column_headers[] = $title;
173 173
 		}
174 174
 		$data[] = $column_headers;
175 175
 
176
-		$this->items = $this->get_lesson_statuses( $args );
176
+		$this->items = $this->get_lesson_statuses($args);
177 177
 
178 178
 		// Process each row
179
-		foreach( $this->items AS $item) {
180
-			$data[] = $this->get_row_data( $item );
179
+		foreach ($this->items AS $item) {
180
+			$data[] = $this->get_row_data($item);
181 181
 		}
182 182
 
183 183
 		return $data;
@@ -189,64 +189,64 @@  discard block
 block discarded – undo
189 189
 	 * @since  1.7.0
190 190
 	 * @param object $item The current item
191 191
 	 */
192
-	protected function get_row_data( $item ) {
192
+	protected function get_row_data($item) {
193 193
 
194
-		$user_start_date = get_comment_meta( $item->comment_ID, 'start', true );
194
+		$user_start_date = get_comment_meta($item->comment_ID, 'start', true);
195 195
 		$user_end_date = $item->comment_date;
196 196
 		$status_class = $grade = '';
197 197
 
198
-		if( 'complete' == $item->comment_approved ) {
199
-			$status =  __( 'Completed', 'woothemes-sensei' );
198
+		if ('complete' == $item->comment_approved) {
199
+			$status = __('Completed', 'woothemes-sensei');
200 200
 			$status_class = 'graded';
201 201
 
202
-			$grade =  __( 'No Grade', 'woothemes-sensei' );
202
+			$grade = __('No Grade', 'woothemes-sensei');
203 203
 		}
204
-		elseif( 'graded' == $item->comment_approved ) {
205
-			$status = __( 'Graded', 'woothemes-sensei' ) ;
204
+		elseif ('graded' == $item->comment_approved) {
205
+			$status = __('Graded', 'woothemes-sensei');
206 206
 			$status_class = 'graded';
207 207
 
208
-			$grade = get_comment_meta( $item->comment_ID, 'grade', true);
208
+			$grade = get_comment_meta($item->comment_ID, 'grade', true);
209 209
 		}
210
-		elseif( 'passed' == $item->comment_approved ) {
211
-			$status =  __( 'Passed', 'woothemes-sensei' );
210
+		elseif ('passed' == $item->comment_approved) {
211
+			$status = __('Passed', 'woothemes-sensei');
212 212
 			$status_class = 'graded';
213 213
 
214
-			$grade = get_comment_meta( $item->comment_ID, 'grade', true);
214
+			$grade = get_comment_meta($item->comment_ID, 'grade', true);
215 215
 		}
216
-		elseif( 'failed' == $item->comment_approved ) {
217
-			$status = __( 'Failed', 'woothemes-sensei' );
216
+		elseif ('failed' == $item->comment_approved) {
217
+			$status = __('Failed', 'woothemes-sensei');
218 218
 			$status_class = 'failed';
219 219
 
220
-			$grade = get_comment_meta( $item->comment_ID, 'grade', true);
220
+			$grade = get_comment_meta($item->comment_ID, 'grade', true);
221 221
 		}
222
-		elseif( 'ungraded' == $item->comment_approved ) {
223
-			$status =  __( 'Ungraded', 'woothemes-sensei' );
222
+		elseif ('ungraded' == $item->comment_approved) {
223
+			$status = __('Ungraded', 'woothemes-sensei');
224 224
 			$status_class = 'ungraded';
225 225
 
226 226
 		}
227 227
 		else {
228
-			$status =  __( 'In Progress', 'woothemes-sensei' );
228
+			$status = __('In Progress', 'woothemes-sensei');
229 229
 			$user_end_date = '';
230 230
 		}
231 231
 
232 232
 		// Output users data
233
-        $user_name = Sensei_Learner::get_full_name( $item->user_id );
233
+        $user_name = Sensei_Learner::get_full_name($item->user_id);
234 234
 
235
-        if ( !$this->csv_output ) {
236
-			$url = add_query_arg( array( 'page' => $this->page_slug, 'user_id' => $item->user_id, 'course_id' => $this->course_id ), admin_url( 'admin.php' ) );
235
+        if ( ! $this->csv_output) {
236
+			$url = add_query_arg(array('page' => $this->page_slug, 'user_id' => $item->user_id, 'course_id' => $this->course_id), admin_url('admin.php'));
237 237
 
238
-			$user_name = '<strong><a class="row-title" href="' . esc_url( $url ) . '">' . $user_name . '</a></strong>';
239
-			$status = sprintf( '<span class="%s">%s</span>', $item->comment_approved, $status );
240
-			if ( is_numeric($grade) ) {
238
+			$user_name = '<strong><a class="row-title" href="'.esc_url($url).'">'.$user_name.'</a></strong>';
239
+			$status = sprintf('<span class="%s">%s</span>', $item->comment_approved, $status);
240
+			if (is_numeric($grade)) {
241 241
 				$grade .= '%';
242 242
 			}
243 243
 		} // End If Statement
244
-		$column_data = apply_filters( 'sensei_analysis_lesson_column_data', array( 'title' => $user_name,
244
+		$column_data = apply_filters('sensei_analysis_lesson_column_data', array('title' => $user_name,
245 245
 										'started' => $user_start_date,
246 246
 										'completed' => $user_end_date,
247 247
 										'status' => $status,
248 248
 										'grade' => $grade,
249
-									), $item, $this );
249
+									), $item, $this);
250 250
 
251 251
 		return $column_data;
252 252
 	}
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 * @since  1.7.0
257 257
 	 * @return array statuses
258 258
 	 */
259
-	private function get_lesson_statuses( $args ) {
259
+	private function get_lesson_statuses($args) {
260 260
 
261 261
 		$activity_args = array( 
262 262
 				'post_id' => $this->lesson_id,
@@ -269,34 +269,34 @@  discard block
 block discarded – undo
269 269
 			);
270 270
 
271 271
 		// Searching users on statuses requires sub-selecting the statuses by user_ids
272
-		if ( $this->search ) {
272
+		if ($this->search) {
273 273
 			$user_args = array(
274
-				'search' => '*' . $this->search . '*',
274
+				'search' => '*'.$this->search.'*',
275 275
 				'fields' => 'ID',
276 276
 			);
277 277
 			// Filter for extending
278
-			$user_args = apply_filters( 'sensei_analysis_lesson_search_users', $user_args );
279
-			if ( !empty( $user_args ) ) {
280
-				$learners_search = new WP_User_Query( $user_args );
278
+			$user_args = apply_filters('sensei_analysis_lesson_search_users', $user_args);
279
+			if ( ! empty($user_args)) {
280
+				$learners_search = new WP_User_Query($user_args);
281 281
 				// Store for reuse on counts
282 282
 				$activity_args['user_id'] = (array) $learners_search->get_results();
283 283
 			}
284 284
 		} // End If Statement
285 285
 
286
-		$activity_args = apply_filters( 'sensei_analysis_lesson_filter_statuses', $activity_args );
286
+		$activity_args = apply_filters('sensei_analysis_lesson_filter_statuses', $activity_args);
287 287
 
288 288
 		// WP_Comment_Query doesn't support SQL_CALC_FOUND_ROWS, so instead do this twice
289
-		$this->total_items = Sensei_Utils::sensei_check_for_activity( array_merge( $activity_args, array('count' => true, 'offset' => 0, 'number' => 0) ) );
289
+		$this->total_items = Sensei_Utils::sensei_check_for_activity(array_merge($activity_args, array('count' => true, 'offset' => 0, 'number' => 0)));
290 290
 
291 291
 		// Ensure we change our range to fit (in case a search threw off the pagination) - Should this be added to all views?
292
-		if ( $this->total_items < $activity_args['offset'] ) {
293
-			$new_paged = floor( $total_statuses / $activity_args['number'] );
292
+		if ($this->total_items < $activity_args['offset']) {
293
+			$new_paged = floor($total_statuses / $activity_args['number']);
294 294
 			$activity_args['offset'] = $new_paged * $activity_args['number'];
295 295
 		}
296
-		$statuses = Sensei_Utils::sensei_check_for_activity( $activity_args, true );
296
+		$statuses = Sensei_Utils::sensei_check_for_activity($activity_args, true);
297 297
 		// Need to always return an array, even with only 1 item
298
-		if ( !is_array($statuses) ) {
299
-			$statuses = array( $statuses );
298
+		if ( ! is_array($statuses)) {
299
+			$statuses = array($statuses);
300 300
 		}
301 301
 		return $statuses;
302 302
 	} // End get_lesson_statuses()
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	 * @return void
309 309
 	 */
310 310
 	public function no_items() {
311
-		 _e( 'No learners found.', 'woothemes-sensei' );
311
+		 _e('No learners found.', 'woothemes-sensei');
312 312
 	} // End no_items()
313 313
 
314 314
 	/**
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 * @return void
318 318
 	 */
319 319
 	public function data_table_header() {
320
-		echo '<strong>' . __( 'Learners taking this Lesson', 'woothemes-sensei' ) . '</strong>';
320
+		echo '<strong>'.__('Learners taking this Lesson', 'woothemes-sensei').'</strong>';
321 321
 	} // End data_table_header()
322 322
 
323 323
 	/**
@@ -326,10 +326,10 @@  discard block
 block discarded – undo
326 326
 	 * @return void
327 327
 	 */
328 328
 	public function data_table_footer() {
329
-		$lesson = get_post( $this->lesson_id );
330
-		$report = sanitize_title( $lesson->post_title ) . '-learners-overview';
331
-		$url = add_query_arg( array( 'page' => $this->page_slug, 'lesson_id' => $this->lesson_id, 'sensei_report_download' => $report ), admin_url( 'admin.php' ) );
332
-		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>';
329
+		$lesson = get_post($this->lesson_id);
330
+		$report = sanitize_title($lesson->post_title).'-learners-overview';
331
+		$url = add_query_arg(array('page' => $this->page_slug, 'lesson_id' => $this->lesson_id, 'sensei_report_download' => $report), admin_url('admin.php'));
332
+		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>';
333 333
 	} // End data_table_footer()
334 334
 
335 335
 	/**
@@ -337,9 +337,9 @@  discard block
 block discarded – undo
337 337
 	 * @since  1.7.0
338 338
 	 * @return string $text
339 339
 	 */
340
-	public function search_button( $text = '' ) {
340
+	public function search_button($text = '') {
341 341
 
342
-        $text =  __( 'Search Learners', 'woothemes-sensei' );
342
+        $text = __('Search Learners', 'woothemes-sensei');
343 343
 
344 344
         return $text;
345 345
 
Please login to merge, or discard this patch.