Completed
Push — master ( c7b50c...c46eb5 )
by Dwain
05:23
created
includes/class-sensei-learner-profiles.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
  * @since 1.4.0
11 11
  */
12 12
 class Sensei_Learner_Profiles {
13
-    /**
14
-     * @var string
15
-     */
16
-    private $profile_url_base;
13
+	/**
14
+	 * @var string
15
+	 */
16
+	private $profile_url_base;
17 17
 
18 18
 	/**
19 19
 	 * Constructor.
@@ -42,8 +42,8 @@  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 48
 			add_rewrite_rule( '^' . $this->profile_url_base . '/([^/]*)/?', 'index.php?learner_profile=$matches[1]', 'top' );
49 49
 			add_rewrite_tag( '%learner_profile%', '([^&]+)' );
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 		if( isset( $wp_query->query_vars['learner_profile'] ) ) {
63 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 67
 			$title = apply_filters( 'sensei_learner_profile_courses_heading', sprintf( __( 'Courses %s is taking', 'woothemes-sensei' ), $name ) ) . ' ' . $sep . ' ';
68 68
 		}
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 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
 		}
@@ -140,43 +140,43 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	public static function user_info( $user ) {
142 142
 
143
-        /**
144
-         * This hooke fires inside the Sensei_Learner_Profiles::user_info function.
145
-         * just before the htmls is generated.
146
-         * @since 1.0.0
147
-         */
148
-        do_action( 'sensei_learner_profile_info', $user );
149
-
150
-        /**
151
-         * This filter runs inside the Sensei_Learner_Profiles::user_info function.
152
-         * Here you can change the user avatar.
153
-         *
154
-         * @since 1.0.0
155
-         *
156
-         * @param false|string `<img>` $user_avatar
157
-         */
143
+		/**
144
+		 * This hooke fires inside the Sensei_Learner_Profiles::user_info function.
145
+		 * just before the htmls is generated.
146
+		 * @since 1.0.0
147
+		 */
148
+		do_action( 'sensei_learner_profile_info', $user );
149
+
150
+		/**
151
+		 * This filter runs inside the Sensei_Learner_Profiles::user_info function.
152
+		 * Here you can change the user avatar.
153
+		 *
154
+		 * @since 1.0.0
155
+		 *
156
+		 * @param false|string `<img>` $user_avatar
157
+		 */
158 158
 		$learner_avatar = apply_filters( 'sensei_learner_profile_info_avatar', get_avatar( $user->ID, 120 ), $user->ID );
159 159
 
160
-        /**
161
-         * This filter runs inside the Sensei_Learner_Profiles::user_info function.
162
-         * Here you can change the learner profile user display name.
163
-         * @since 1.0.0
164
-         *
165
-         * @param string $user_display_name
166
-         * @param string $user_id
167
-         */
160
+		/**
161
+		 * This filter runs inside the Sensei_Learner_Profiles::user_info function.
162
+		 * Here you can change the learner profile user display name.
163
+		 * @since 1.0.0
164
+		 *
165
+		 * @param string $user_display_name
166
+		 * @param string $user_id
167
+		 */
168 168
 		$learner_name = apply_filters( 'sensei_learner_profile_info_name', $user->display_name, $user->ID );
169 169
 
170
-        /**
171
-         * This filter runs inside the Sensei_Learner_Profiles::user_info function.
172
-         * With this filter can change the users description on the learner user info
173
-         * output.
174
-         *
175
-         * @since 1.0.0
176
-         *
177
-         * @param string $user_description
178
-         * @param string $user_id
179
-         */
170
+		/**
171
+		 * This filter runs inside the Sensei_Learner_Profiles::user_info function.
172
+		 * With this filter can change the users description on the learner user info
173
+		 * output.
174
+		 *
175
+		 * @since 1.0.0
176
+		 *
177
+		 * @param string $user_description
178
+		 * @param string $user_id
179
+		 */
180 180
 		$learner_bio = apply_filters( 'sensei_learner_profile_info_bio', $user->description, $user->ID );
181 181
 		?>
182 182
 
@@ -210,16 +210,16 @@  discard block
 block discarded – undo
210 210
 		return $classes;
211 211
 	}
212 212
 
213
-    /**
214
-     * Deprecate the deprecate_sensei_learner_profile_content hook
215
-     *
216
-     * @since 1.9.0
217
-     */
218
-    public static function deprecate_sensei_learner_profile_content_hook(){
213
+	/**
214
+	 * Deprecate the deprecate_sensei_learner_profile_content hook
215
+	 *
216
+	 * @since 1.9.0
217
+	 */
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
 
224 224
 
225 225
 } // End Class
Please login to merge, or discard this patch.
includes/class-sensei-grading-main.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 class Sensei_Grading_Main extends WooThemes_Sensei_List_Table {
12 12
 
13
-    public $user_id;
13
+	public $user_id;
14 14
 	public $course_id;
15 15
 	public $lesson_id;
16 16
 	public $view;
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 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 255
 		$quiz_id = get_post_meta( $item->comment_post_ID, '_lesson_quiz', true );
@@ -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
 
Please login to merge, or discard this patch.
includes/class-sensei-analysis-lesson-list-table.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
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 ) {
235
+		if ( !$this->csv_output ) {
236 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 238
 			$user_name = '<strong><a class="row-title" href="' . esc_url( $url ) . '">' . $user_name . '</a></strong>';
@@ -339,9 +339,9 @@  discard block
 block discarded – undo
339 339
 	 */
340 340
 	public function search_button( $text = '' ) {
341 341
 
342
-        $text =  __( 'Search Learners', 'woothemes-sensei' );
342
+		$text =  __( 'Search Learners', 'woothemes-sensei' );
343 343
 
344
-        return $text;
344
+		return $text;
345 345
 
346 346
 	}
347 347
 } // End Class
Please login to merge, or discard this patch.
includes/class-sensei-learner.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -13,46 +13,46 @@
 block discarded – undo
13 13
  */
14 14
 class Sensei_Student{
15 15
 
16
-    /**
17
-     * Get the students full name
18
-     *
19
-     * This function replaces Sensei_Learner_Managment->get_learner_full_name
20
-     * @since 1.9.0
21
-     *
22
-     * @param $user_id
23
-     * @return bool|mixed|void
24
-     */
25
-    public static function get_full_name( $user_id ){
16
+	/**
17
+	 * Get the students full name
18
+	 *
19
+	 * This function replaces Sensei_Learner_Managment->get_learner_full_name
20
+	 * @since 1.9.0
21
+	 *
22
+	 * @param $user_id
23
+	 * @return bool|mixed|void
24
+	 */
25
+	public static function get_full_name( $user_id ){
26 26
 
27
-        $full_name = '';
27
+		$full_name = '';
28 28
 
29
-        if( empty( $user_id ) || ! ( 0 < intval( $user_id ) )
30
-            || !( get_userdata( $user_id ) ) ){
31
-            return false;
32
-        }
29
+		if( empty( $user_id ) || ! ( 0 < intval( $user_id ) )
30
+			|| !( get_userdata( $user_id ) ) ){
31
+			return false;
32
+		}
33 33
 
34
-        // get the user details
35
-        $user = get_user_by( 'id', $user_id );
34
+		// get the user details
35
+		$user = get_user_by( 'id', $user_id );
36 36
 
37
-        if( ! empty( $user->first_name  ) && ! empty( $user->last_name  )  ){
37
+		if( ! empty( $user->first_name  ) && ! empty( $user->last_name  )  ){
38 38
 
39
-            $full_name = trim( $user->first_name   ) . ' ' . trim( $user->last_name  );
39
+			$full_name = trim( $user->first_name   ) . ' ' . trim( $user->last_name  );
40 40
 
41
-        }else{
41
+		}else{
42 42
 
43
-            $full_name =  $user->display_name;
43
+			$full_name =  $user->display_name;
44 44
 
45
-        }
45
+		}
46 46
 
47
-        /**
48
-         * Filter the user full name from the get_learner_full_name function.
49
-         *
50
-         * @since 1.8.0
51
-         * @param $full_name
52
-         * @param $user_id
53
-         */
54
-        return apply_filters( 'sensei_learner_full_name' , $full_name , $user_id );
47
+		/**
48
+		 * Filter the user full name from the get_learner_full_name function.
49
+		 *
50
+		 * @since 1.8.0
51
+		 * @param $full_name
52
+		 * @param $user_id
53
+		 */
54
+		return apply_filters( 'sensei_learner_full_name' , $full_name , $user_id );
55 55
 
56
-    }// end get_full_name
56
+	}// end get_full_name
57 57
 
58 58
 }
59 59
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-sensei-analysis-course-list-table.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -627,7 +627,7 @@
 block discarded – undo
627 627
 		$course = get_post( $this->course_id );
628 628
 		$report = sanitize_title( $course->post_title ) . '-' . $this->view . 's-overview';
629 629
 		if ( $this->user_id ) {
630
-            $user_name = Sensei_Learner::get_full_name( $this->user_id );
630
+			$user_name = Sensei_Learner::get_full_name( $this->user_id );
631 631
 			$report = sanitize_title( $user_name  ) . '-' . $report;
632 632
 		}
633 633
 
Please login to merge, or discard this patch.
includes/admin/class-sensei-welcome.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined( 'ABSPATH' ) ) {
3
-    exit; // Exit if accessed directly
3
+	exit; // Exit if accessed directly
4 4
 }
5 5
 
6 6
 /**
@@ -17,45 +17,45 @@  discard block
 block discarded – undo
17 17
 
18 18
 	/**
19 19
 	 * Hook in tabs.
20
-     * @since 1.8.0
20
+	 * @since 1.8.0
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-        add_action( 'admin_menu', array( $this, 'admin_menus') );
24
+		add_action( 'admin_menu', array( $this, 'admin_menus') );
25 25
 		add_action( 'admin_head', array( $this, 'admin_head' ) );
26 26
 
27 27
 	}
28 28
 
29
-    /**
30
-     * Sends user to the welcome page on first activation.
31
-     *
32
-     * Hooked into activated_plugin
33
-     * @since 1.8.0
34
-     */
35
-    public static function redirect( $plugin ) {
29
+	/**
30
+	 * Sends user to the welcome page on first activation.
31
+	 *
32
+	 * Hooked into activated_plugin
33
+	 * @since 1.8.0
34
+	 */
35
+	public static function redirect( $plugin ) {
36 36
 
37
-        // Bail if activating from network, or bulk, or within an iFrame
38
-        if ( is_network_admin() || isset( $_GET['activate-multi'] ) || defined( 'IFRAME_REQUEST' ) ) {
37
+		// Bail if activating from network, or bulk, or within an iFrame
38
+		if ( is_network_admin() || isset( $_GET['activate-multi'] ) || defined( 'IFRAME_REQUEST' ) ) {
39 39
 
40
-            return;
40
+			return;
41 41
 
42
-        }
43
-        // don't run for upgrades and for pages already on the welcome screen
44
-        if ( ( isset( $_GET['action'] ) && 'upgrade-plugin' == $_GET['action'] )
45
-            || ( ! empty( $_GET['page'] ) && $_GET['page'] === 'sensei-welcome' ) ) {
42
+		}
43
+		// don't run for upgrades and for pages already on the welcome screen
44
+		if ( ( isset( $_GET['action'] ) && 'upgrade-plugin' == $_GET['action'] )
45
+			|| ( ! empty( $_GET['page'] ) && $_GET['page'] === 'sensei-welcome' ) ) {
46 46
 
47
-            return;
47
+			return;
48 48
 
49
-        }
49
+		}
50 50
 
51
-        wp_redirect( admin_url( 'index.php?page=sensei-welcome' ) );
52
-        exit;
53
-    }
51
+		wp_redirect( admin_url( 'index.php?page=sensei-welcome' ) );
52
+		exit;
53
+	}
54 54
 
55 55
 	/**
56 56
 	 * Add admin menus/screens.
57
-     *
58
-     * @since 1.8.0
57
+	 *
58
+	 * @since 1.8.0
59 59
 	 */
60 60
 	public function admin_menus() {
61 61
 
@@ -65,17 +65,17 @@  discard block
 block discarded – undo
65 65
 
66 66
 		$welcome_page_name  = __( 'Sensei Activation', 'woothemes-sensei' );
67 67
 		$welcome_page_title = __( 'Welcome to Sensei', 'woothemes-sensei' );
68
-        add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'sensei-welcome', array( $this, 'welcome_screen' ) );
68
+		add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'sensei-welcome', array( $this, 'welcome_screen' ) );
69 69
 
70 70
 	}
71 71
 
72
-    /**
73
-     * Output the Welcome  screen.
74
-     *
75
-     * @since 1.8.0
76
-     */
77
-    public function welcome_screen() {
78
-        ?>
72
+	/**
73
+	 * Output the Welcome  screen.
74
+	 *
75
+	 * @since 1.8.0
76
+	 */
77
+	public function welcome_screen() {
78
+		?>
79 79
         <div class="wrap about-wrap">
80 80
 
81 81
             <?php  $this->intro(); ?>
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
             </div>
129 129
         </div>
130 130
     <?php
131
-    }
131
+	}
132 132
 
133 133
 	/**
134 134
 	 * Add styles just for this page, and remove dashboard page links.
135 135
 	 */
136 136
 	public function admin_head() {
137
-        // remove the menu page so it is not visible in the admin side bar
137
+		// remove the menu page so it is not visible in the admin side bar
138 138
 		remove_submenu_page( 'index.php', 'sensei-welcome' );
139 139
 		?>
140 140
 		<style type="text/css">
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
 		// Random tweet - must be kept to 102 chars to "fit"
260 260
 		$tweets        = array(
261
-            'I\'ve just installed Sensei - A premium Learning Management plugin for #WordPress.'
261
+			'I\'ve just installed Sensei - A premium Learning Management plugin for #WordPress.'
262 262
 		);
263 263
 		shuffle( $tweets );
264 264
 		?>
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
 
281 281
 		<div class="sensei-badge">
282 282
             <?php
283
-                _e('Sensei by WooThemes','woothemes-sensei');
284
-                echo '<br />';
283
+				_e('Sensei by WooThemes','woothemes-sensei');
284
+				echo '<br />';
285 285
 
286
-                printf( __( 'Version %s', 'woothemes-sensei' ), Sensei()->version );
287
-            ?>
286
+				printf( __( 'Version %s', 'woothemes-sensei' ), Sensei()->version );
287
+			?>
288 288
         </div>
289 289
 
290 290
 		<p class="sensei-actions">
Please login to merge, or discard this patch.
includes/class-sensei-learners-main.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -205,13 +205,13 @@  discard block
 block discarded – undo
205 205
 
206 206
 	/**
207 207
 	 * Generates content for a single row of the table in the user management
208
-     * screen.
209
-     *
208
+	 * screen.
209
+	 *
210 210
 	 * @since  1.7.0
211
-     *
211
+	 *
212 212
 	 * @param object $item The current item
213
-     *
214
-     * @return void
213
+	 *
214
+	 * @return void
215 215
 	 */
216 216
 	protected function get_row_data( $item ) {
217 217
 		global $wp_version;
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 		switch ( $this->view ) {
220 220
 			case 'learners' :
221 221
 
222
-                // in this case the item passed in is actually the users activity on course of lesson
223
-                $user_activity = $item;
222
+				// in this case the item passed in is actually the users activity on course of lesson
223
+				$user_activity = $item;
224 224
 				$post_id = false;
225 225
 
226 226
 				if( $this->lesson_id ) {
@@ -239,30 +239,30 @@  discard block
 block discarded – undo
239 239
 
240 240
 				if( 'complete' == $user_activity->comment_approved || 'graded' == $user_activity->comment_approved || 'passed' == $user_activity->comment_approved ) {
241 241
 
242
-                    $status_html = '<span class="graded">' .__( 'Completed', 'woothemes-sensei' ) . '</span>';
242
+					$status_html = '<span class="graded">' .__( 'Completed', 'woothemes-sensei' ) . '</span>';
243 243
 
244 244
 				} else {
245 245
 
246
-                    $status_html = '<span class="in-progress">' . __( 'In Progress', 'woothemes-sensei' ) . '</span>';
246
+					$status_html = '<span class="in-progress">' . __( 'In Progress', 'woothemes-sensei' ) . '</span>';
247 247
 
248 248
 				}
249 249
 
250
-                $title = Sensei_Learner::get_full_name( $user_activity->user_id );
250
+				$title = Sensei_Learner::get_full_name( $user_activity->user_id );
251 251
 				$a_title = sprintf( __( 'Edit &#8220;%s&#8221;' ), $title );
252 252
 
253
-                /**
254
-                 * sensei_learners_main_column_data filter
255
-                 *
256
-                 * This filter runs on the learner management screen for a specific course.
257
-                 * It provides the learner row column details.
258
-                 *
259
-                 * @param array $columns{
260
-                 *   type string $title
261
-                 *   type string $date_started
262
-                 *   type string $course_status (completed, started etc)
263
-                 *   type html $action_buttons
264
-                 * }
265
-                 */
253
+				/**
254
+				 * sensei_learners_main_column_data filter
255
+				 *
256
+				 * This filter runs on the learner management screen for a specific course.
257
+				 * It provides the learner row column details.
258
+				 *
259
+				 * @param array $columns{
260
+				 *   type string $title
261
+				 *   type string $date_started
262
+				 *   type string $course_status (completed, started etc)
263
+				 *   type html $action_buttons
264
+				 * }
265
+				 */
266 266
 				$column_data = apply_filters( 'sensei_learners_main_column_data', array(
267 267
 						'title' => '<strong><a class="row-title" href="' . admin_url( 'user-edit.php?user_id=' . $user_activity->user_id ) . '" title="' . esc_attr( $a_title ) . '">' . $title . '</a></strong>',
268 268
 						'date_started' => get_comment_meta( $user_activity->comment_ID, 'start', true),
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 
293 293
 			case 'courses' :
294 294
 			default:
295
-                $course_learners = Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_learners_course_learners', array( 'post_id' => $item->ID, 'type' => 'sensei_course_status', 'status' => 'any' ) ) );
295
+				$course_learners = Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_learners_course_learners', array( 'post_id' => $item->ID, 'type' => 'sensei_course_status', 'status' => 'any' ) ) );
296 296
 				$title = get_the_title( $item );
297 297
 				$a_title = sprintf( __( 'Edit &#8220;%s&#8221;' ), $title );
298 298
 
Please login to merge, or discard this patch.
includes/class-sensei-messages.php 1 patch
Indentation   +222 added lines, -222 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 * @since  1.6.0
22 22
 	 */
23 23
 	public function __construct () {
24
-        $this->token = 'messages';
24
+		$this->token = 'messages';
25 25
 		$this->post_type = 'sensei_message';
26 26
 		$this->meta_fields = array( 'sender', 'receiver' );
27 27
 
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 		// Monitor when new reply is posted
37 37
 		add_action( 'comment_post', array( $this, 'message_reply_received' ), 10, 1 );
38 38
 
39
-        // Block WordPress from sending comment update emails for the messages post type
40
-        add_filter('comment_notification_recipients', array( $this, 'stop_wp_comment_emails' ),  20, 2  );
39
+		// Block WordPress from sending comment update emails for the messages post type
40
+		add_filter('comment_notification_recipients', array( $this, 'stop_wp_comment_emails' ),  20, 2  );
41 41
 
42
-        // Block WordPress from sending comment moderator emails on the sensei messages post types
43
-        add_filter('comment_moderation_recipients', array( $this, 'stop_wp_comment_emails' ),  20, 2  );
42
+		// Block WordPress from sending comment moderator emails on the sensei messages post types
43
+		add_filter('comment_moderation_recipients', array( $this, 'stop_wp_comment_emails' ),  20, 2  );
44 44
 
45 45
 		// Process saving of message posts
46 46
 		add_action( 'save_post', array( $this, 'save_message' ) );
@@ -48,20 +48,20 @@  discard block
 block discarded – undo
48 48
 		// Add message links to courses & lessons
49 49
 		add_action( 'sensei_single_course_content_inside_before', array( $this, 'send_message_link' ), 35 );
50 50
 
51
-        // add message link to lesson
52
-        add_action( 'sensei_single_lesson_content_inside_before', array( $this, 'send_message_link' ), 30, 2 );
51
+		// add message link to lesson
52
+		add_action( 'sensei_single_lesson_content_inside_before', array( $this, 'send_message_link' ), 30, 2 );
53 53
 
54
-        // add message link to lesson
55
-        add_action( 'sensei_single_quiz_questions_before', array( $this, 'send_message_link' ), 10, 2 );
54
+		// add message link to lesson
55
+		add_action( 'sensei_single_quiz_questions_before', array( $this, 'send_message_link' ), 10, 2 );
56 56
 
57 57
 		// Hide messages and replies from users who do not have access
58
-        add_action( 'template_redirect', array( $this, 'message_login' ), 10, 1 );
59
-        add_action( 'pre_get_posts', array( $this, 'message_list' ), 10, 1 );
60
-        add_filter( 'the_title', array( $this, 'message_title' ), 10, 2 );
61
-        add_filter( 'the_content', array( $this, 'message_content' ), 10, 1 );
62
-        add_filter( 'comments_array', array( $this, 'message_replies' ), 100, 1 );
63
-        add_filter( 'get_comments_number', array( $this, 'message_reply_count' ), 100, 2 );
64
-        add_filter( 'comments_open', array( $this, 'message_replies_open' ), 100, 2 );
58
+		add_action( 'template_redirect', array( $this, 'message_login' ), 10, 1 );
59
+		add_action( 'pre_get_posts', array( $this, 'message_list' ), 10, 1 );
60
+		add_filter( 'the_title', array( $this, 'message_title' ), 10, 2 );
61
+		add_filter( 'the_content', array( $this, 'message_content' ), 10, 1 );
62
+		add_filter( 'comments_array', array( $this, 'message_replies' ), 100, 1 );
63
+		add_filter( 'get_comments_number', array( $this, 'message_reply_count' ), 100, 2 );
64
+		add_filter( 'comments_open', array( $this, 'message_replies_open' ), 100, 2 );
65 65
 	} // End __construct()
66 66
 
67 67
 	public function add_menu_item() {
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 	public function send_message_link( $post_id = 0, $user_id = 0 ) {
163 163
 		global  $post;
164 164
 
165
-        // only show the link for the allowed post types:
166
-        $allowed_post_types = array('lesson', 'course', 'quiz');
165
+		// only show the link for the allowed post types:
166
+		$allowed_post_types = array('lesson', 'course', 'quiz');
167 167
 		if ( ! in_array( get_post_type() , $allowed_post_types ) ) {
168 168
 
169 169
 			return;
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 				} elseif( 'course' == $post->post_type ) {
187 187
 					$contact_button_text = __( 'Contact Course Teacher', 'woothemes-sensei' );
188 188
 				}else{
189
-                    $contact_button_text = __( 'Contact Teacher', 'woothemes-sensei' );
190
-                }
189
+					$contact_button_text = __( 'Contact Teacher', 'woothemes-sensei' );
190
+				}
191 191
 
192 192
 				$html .= '<p><a class="button send-message-button" href="' . esc_url($href) . '#private_message">' . $contact_button_text . '</a></p>';
193 193
 			}
@@ -212,19 +212,19 @@  discard block
 block discarded – undo
212 212
 
213 213
 		if( ! isset( $post->ID ) ) return $html;
214 214
 
215
-        //confirm private message
216
-        $confirmation = '';
217
-        if( isset( $_GET[ 'send' ] ) && 'complete' == $_GET[ 'send' ] ) {
215
+		//confirm private message
216
+		$confirmation = '';
217
+		if( isset( $_GET[ 'send' ] ) && 'complete' == $_GET[ 'send' ] ) {
218 218
 
219
-            $confirmation_message = __('Your private message has been sent.', 'woothemes-sensei');
220
-            $confirmation = '<div class="sensei-message tick">' . $confirmation_message . '</div>';
219
+			$confirmation_message = __('Your private message has been sent.', 'woothemes-sensei');
220
+			$confirmation = '<div class="sensei-message tick">' . $confirmation_message . '</div>';
221 221
 
222
-        }
222
+		}
223 223
 
224 224
 		$html .= '<h3 id="private_message">' . __( 'Send Private Message', 'woothemes-sensei' ) . '</h3>';
225
-        $html .= '<p>';
226
-        $html .=  $confirmation;
227
-        $html .= '</p>';
225
+		$html .= '<p>';
226
+		$html .=  $confirmation;
227
+		$html .= '</p>';
228 228
 		$html .= '<form name="contact-teacher" action="" method="post" class="contact-teacher">';
229 229
 			$html .= '<p class="form-row form-row-wide">';
230 230
 				$html .= '<textarea name="contact_message" placeholder="' . __( 'Enter your private message.', 'woothemes-sensei' ) . '"></textarea>';
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	public function message_reply_received( $comment_id = 0 ) {
256 256
 
257 257
 		// Get comment object
258
-    	$comment = get_comment( $comment_id );
258
+		$comment = get_comment( $comment_id );
259 259
 
260 260
 		if( is_null( $comment ) ) return;
261 261
 
@@ -270,87 +270,87 @@  discard block
 block discarded – undo
270 270
 		do_action( 'sensei_private_message_reply', $comment, $message );
271 271
 	}
272 272
 
273
-    /**
274
-     * This function stops WordPress from sending the default comment update emails.
275
-     *
276
-     * This function is hooked into comment_notification_recipients. It will simply return
277
-     * an empty array if the current passed in comment is on a message post type.
278
-     *
279
-     * @param array $emails
280
-     * @param int $comment_id
281
-     * @return array;
282
-     */
283
-    public function stop_wp_comment_emails( $emails , $comment_id ){
273
+	/**
274
+	 * This function stops WordPress from sending the default comment update emails.
275
+	 *
276
+	 * This function is hooked into comment_notification_recipients. It will simply return
277
+	 * an empty array if the current passed in comment is on a message post type.
278
+	 *
279
+	 * @param array $emails
280
+	 * @param int $comment_id
281
+	 * @return array;
282
+	 */
283
+	public function stop_wp_comment_emails( $emails , $comment_id ){
284 284
 
285
-        $comment = get_comment( $comment_id );
286
-        if( isset( $comment->comment_post_ID ) &&
287
-            'sensei_message' == get_post_type( $comment->comment_post_ID )  ){
285
+		$comment = get_comment( $comment_id );
286
+		if( isset( $comment->comment_post_ID ) &&
287
+			'sensei_message' == get_post_type( $comment->comment_post_ID )  ){
288 288
 
289
-            // empty the emails array to ensure no emails are sent for this comment
290
-            $emails = array();
289
+			// empty the emails array to ensure no emails are sent for this comment
290
+			$emails = array();
291 291
 
292
-        }
293
-        return $emails;
292
+		}
293
+		return $emails;
294 294
 
295
-    }// end stop_wp_comment_emails
295
+	}// end stop_wp_comment_emails
296 296
 
297 297
 	/**
298
-     * Save new message post
299
-     * @param  integer $sender_id   ID of sender
300
-     * @param  integer $receiver_id ID of receiver
301
-     * @param  string  $message     Message content
302
-     * @param  string  $post_id     ID of post related to message
303
-     * @return mixed                Message ID on success, boolean false on failure
304
-     */
305
-    private function save_new_message_post( $sender_id = 0, $receiver_id = 0, $message = '', $post_id = 0 ) {
298
+	 * Save new message post
299
+	 * @param  integer $sender_id   ID of sender
300
+	 * @param  integer $receiver_id ID of receiver
301
+	 * @param  string  $message     Message content
302
+	 * @param  string  $post_id     ID of post related to message
303
+	 * @return mixed                Message ID on success, boolean false on failure
304
+	 */
305
+	private function save_new_message_post( $sender_id = 0, $receiver_id = 0, $message = '', $post_id = 0 ) {
306 306
 
307
-    	$message_id = false;
307
+		$message_id = false;
308 308
 
309
-    	if( $sender_id && $receiver_id && $message && $post_id ) {
309
+		if( $sender_id && $receiver_id && $message && $post_id ) {
310 310
 
311
-    		$title = wp_trim_words( $message, 8, '...' );
311
+			$title = wp_trim_words( $message, 8, '...' );
312 312
 
313
-    		// Set up post data for message
314
-	    	$message_data = array(
315
-	            'post_type'      => $this->post_type,
316
-	            'post_title'     => esc_html( $title ),
317
-	            'post_content'   => esc_html( $message ),
318
-	            'post_status'    => 'publish',
319
-	            'ping_status'    => 'closed',
320
-	            'comment_status' => 'open',
321
-	            'post_excerpt'   => '',
322
-	            'post_author'	 => intval( $sender_id )
323
-	        );
313
+			// Set up post data for message
314
+			$message_data = array(
315
+				'post_type'      => $this->post_type,
316
+				'post_title'     => esc_html( $title ),
317
+				'post_content'   => esc_html( $message ),
318
+				'post_status'    => 'publish',
319
+				'ping_status'    => 'closed',
320
+				'comment_status' => 'open',
321
+				'post_excerpt'   => '',
322
+				'post_author'	 => intval( $sender_id )
323
+			);
324 324
 
325
-	    	// Insert post
326
-	        $message_id = wp_insert_post( $message_data );
325
+			// Insert post
326
+			$message_id = wp_insert_post( $message_data );
327 327
 
328
-	        if( ! is_wp_error( $message_id ) ) {
328
+			if( ! is_wp_error( $message_id ) ) {
329 329
 
330
-	        	// Add sender to message meta
331
-	        	$sender = get_userdata( $sender_id );
332
-	        	add_post_meta( $message_id, '_sender', $sender->user_login );
330
+				// Add sender to message meta
331
+				$sender = get_userdata( $sender_id );
332
+				add_post_meta( $message_id, '_sender', $sender->user_login );
333 333
 
334
-	        	// Add receiver to message meta
335
-	        	$receiver = get_userdata( $receiver_id );
336
-		        add_post_meta( $message_id, '_receiver', $receiver->user_login );
334
+				// Add receiver to message meta
335
+				$receiver = get_userdata( $receiver_id );
336
+				add_post_meta( $message_id, '_receiver', $receiver->user_login );
337 337
 
338
-		        // Add lesson/course ID to message meta
339
-		        $post = get_post( $post_id );
340
-		        add_post_meta( $message_id, '_posttype', $post->post_type );
341
-		        add_post_meta( $message_id, '_post', $post->ID );
338
+				// Add lesson/course ID to message meta
339
+				$post = get_post( $post_id );
340
+				add_post_meta( $message_id, '_posttype', $post->post_type );
341
+				add_post_meta( $message_id, '_post', $post->ID );
342 342
 
343
-		        do_action( 'sensei_new_private_message', $message_id );
343
+				do_action( 'sensei_new_private_message', $message_id );
344 344
 
345
-		    } else {
345
+			} else {
346 346
 
347
-		    	$message_id = false;
347
+				$message_id = false;
348 348
 
349
-		    }
350
-	    }
349
+			}
350
+		}
351 351
 
352
-	    return $message_id;
353
-    }
352
+		return $message_id;
353
+	}
354 354
 
355 355
 	/**
356 356
 	 * Check if user has access to view this message
@@ -389,56 +389,56 @@  discard block
 block discarded – undo
389 389
 		remove_meta_box('commentstatusdiv', $this->post_type, 'normal');
390 390
 	}
391 391
 
392
-    /**
393
-     * Function message_login()
394
-     *
395
-     * Only show /messages/* to logged in users, and
396
-     * redirect logged out users to wp-login.php
397
-     *
398
-     * @since 1.9.0
399
-     * @param  none
400
-     * @return void
401
-     */
392
+	/**
393
+	 * Function message_login()
394
+	 *
395
+	 * Only show /messages/* to logged in users, and
396
+	 * redirect logged out users to wp-login.php
397
+	 *
398
+	 * @since 1.9.0
399
+	 * @param  none
400
+	 * @return void
401
+	 */
402 402
 
403
-    public function message_login () {
403
+	public function message_login () {
404 404
 
405
-        if ( is_user_logged_in() ) {
405
+		if ( is_user_logged_in() ) {
406 406
 
407
-            return;
408
-        }
407
+			return;
408
+		}
409 409
 
410
-        $settings = Sensei()->settings->get_settings();
411
-        if( isset( $settings[ 'my_course_page' ] )
412
-            && 0 < intval( $settings[ 'my_course_page' ] ) ){
410
+		$settings = Sensei()->settings->get_settings();
411
+		if( isset( $settings[ 'my_course_page' ] )
412
+			&& 0 < intval( $settings[ 'my_course_page' ] ) ){
413 413
 
414
-            $my_courses_page_id = $settings[ 'my_course_page' ];
414
+			$my_courses_page_id = $settings[ 'my_course_page' ];
415 415
 
416
-            $my_courses_url = get_permalink($my_courses_page_id);
416
+			$my_courses_url = get_permalink($my_courses_page_id);
417 417
 
418
-        }
418
+		}
419 419
 
420
-        if ( is_single() && is_singular( $this->post_type )
421
-            || is_post_type_archive( $this->post_type ) ) {
420
+		if ( is_single() && is_singular( $this->post_type )
421
+			|| is_post_type_archive( $this->post_type ) ) {
422 422
 
423
-            if ( isset($my_courses_url) ) {
423
+			if ( isset($my_courses_url) ) {
424 424
 
425
-                wp_redirect($my_courses_url, 303);
426
-                exit;
427
-            }
425
+				wp_redirect($my_courses_url, 303);
426
+				exit;
427
+			}
428 428
 
429
-            else {
429
+			else {
430 430
 
431
-                wp_redirect(home_url('/wp-login.php'), 303);
432
-                exit;
433
-            }
431
+				wp_redirect(home_url('/wp-login.php'), 303);
432
+				exit;
433
+			}
434 434
 
435
-        }
436
-    }
435
+		}
436
+	}
437 437
 	/**
438
-     * Only show allowed messages in messages archive
439
-     * @param  WP_Query $query Original query
440
-     * @return void
441
-     */
438
+	 * Only show allowed messages in messages archive
439
+	 * @param  WP_Query $query Original query
440
+	 * @return void
441
+	 */
442 442
 	public function message_list( $query ) {
443 443
 		global $current_user;
444 444
 
@@ -555,17 +555,17 @@  discard block
 block discarded – undo
555 555
 		return $open;
556 556
 	}
557 557
 
558
-    /**
559
-     * Print outthe message was sent by $sender_username on the
560
-     *
561
-     * @since 1.9.0
562
-     */
563
-    public static function the_message_sent_by_title(){
558
+	/**
559
+	 * Print outthe message was sent by $sender_username on the
560
+	 *
561
+	 * @since 1.9.0
562
+	 */
563
+	public static function the_message_sent_by_title(){
564 564
 
565
-        $sender_username = get_post_meta( get_the_ID() , '_sender', true );
566
-        if( $sender_username ) {
565
+		$sender_username = get_post_meta( get_the_ID() , '_sender', true );
566
+		if( $sender_username ) {
567 567
 
568
-            $sender = get_user_by( 'login', $sender_username ); ?>
568
+			$sender = get_user_by( 'login', $sender_username ); ?>
569 569
 
570 570
             <p class="message-meta">
571 571
                 <small>
@@ -577,41 +577,41 @@  discard block
 block discarded – undo
577 577
 
578 578
         <?php }
579 579
 
580
-    }
580
+	}
581 581
 
582
-    /**
583
-     * sensei_single_title output for single page title
584
-     * @since  1.1.0
585
-     * @return void
586
-     * @deprecate
587
-     */
588
-    public static function the_title() {
582
+	/**
583
+	 * sensei_single_title output for single page title
584
+	 * @since  1.1.0
585
+	 * @return void
586
+	 * @deprecate
587
+	 */
588
+	public static function the_title() {
589 589
 
590
-        global $post;
590
+		global $post;
591 591
 
592
-        $content_post_id = get_post_meta( $post->ID, '_post', true );
593
-        if( $content_post_id ) {
594
-            $title = sprintf( __( 'Re: %1$s', 'woothemes-sensei' ), '<a href="' . get_permalink( $content_post_id ) . '">' . get_the_title( $content_post_id ) . '</a>' );
595
-        } else {
596
-            $title = get_the_title( $post->ID );
597
-        }
592
+		$content_post_id = get_post_meta( $post->ID, '_post', true );
593
+		if( $content_post_id ) {
594
+			$title = sprintf( __( 'Re: %1$s', 'woothemes-sensei' ), '<a href="' . get_permalink( $content_post_id ) . '">' . get_the_title( $content_post_id ) . '</a>' );
595
+		} else {
596
+			$title = get_the_title( $post->ID );
597
+		}
598 598
 
599
-        ?>
599
+		?>
600 600
         <header>
601 601
 
602 602
             <h1>
603 603
 
604 604
                 <?php
605
-                /**
606
-                 * Filter Sensei single title
607
-                 *
608
-                 * @since 1.8.0
609
-                 * @param string $title
610
-                 * @param string $template
611
-                 * @param string $post_type
612
-                 */
613
-                echo apply_filters( 'sensei_single_title', $title, $post->post_type );
614
-                ?>
605
+				/**
606
+				 * Filter Sensei single title
607
+				 *
608
+				 * @since 1.8.0
609
+				 * @param string $title
610
+				 * @param string $template
611
+				 * @param string $post_type
612
+				 */
613
+				echo apply_filters( 'sensei_single_title', $title, $post->post_type );
614
+				?>
615 615
 
616 616
             </h1>
617 617
 
@@ -619,52 +619,52 @@  discard block
 block discarded – undo
619 619
 
620 620
         <?php
621 621
 
622
-    } // End sensei_single_title()
622
+	} // End sensei_single_title()
623 623
 
624
-    /**
625
-     * Generates the my messages
626
-     * archive header.
627
-     *
628
-     * @since 1.9.0
629
-     *
630
-     * @return string
631
-     */
632
-    public static function the_archive_header( ){
624
+	/**
625
+	 * Generates the my messages
626
+	 * archive header.
627
+	 *
628
+	 * @since 1.9.0
629
+	 *
630
+	 * @return string
631
+	 */
632
+	public static function the_archive_header( ){
633 633
 
634
-        $html = '';
635
-        $html .= '<header class="archive-header"><h1>';
636
-        $html .= __( 'My Messages', 'woothemes-sensei' );
637
-        $html .= '</h1></header>';
634
+		$html = '';
635
+		$html .= '<header class="archive-header"><h1>';
636
+		$html .= __( 'My Messages', 'woothemes-sensei' );
637
+		$html .= '</h1></header>';
638 638
 
639
-        /**
640
-         * Filter the sensei messages archive title.
641
-         * @since 1.0.0
642
-         */
643
-        echo apply_filters( 'sensei_message_archive_title', $html );
639
+		/**
640
+		 * Filter the sensei messages archive title.
641
+		 * @since 1.0.0
642
+		 */
643
+		echo apply_filters( 'sensei_message_archive_title', $html );
644 644
 
645
-    } // get_archive_header()
645
+	} // get_archive_header()
646 646
 
647
-    /**
648
-     * Output the title for a message given the post_id.
649
-     *
650
-     * @since 1.9.0
651
-     * @param $post_id
652
-     */
653
-    public static function the_message_title( $message_post_id ){
647
+	/**
648
+	 * Output the title for a message given the post_id.
649
+	 *
650
+	 * @since 1.9.0
651
+	 * @param $post_id
652
+	 */
653
+	public static function the_message_title( $message_post_id ){
654 654
 
655
-        $content_post_id = get_post_meta( $message_post_id, '_post', true );
655
+		$content_post_id = get_post_meta( $message_post_id, '_post', true );
656 656
 
657
-        if( $content_post_id ) {
657
+		if( $content_post_id ) {
658 658
 
659
-            $title = sprintf( __( 'Re: %1$s', 'woothemes-sensei' ), get_the_title( $content_post_id ) );
659
+			$title = sprintf( __( 'Re: %1$s', 'woothemes-sensei' ), get_the_title( $content_post_id ) );
660 660
 
661
-        } else {
661
+		} else {
662 662
 
663
-            $title = get_the_title( $message_post_id );
663
+			$title = get_the_title( $message_post_id );
664 664
 
665
-        }
665
+		}
666 666
 
667
-        ?>
667
+		?>
668 668
         <h2>
669 669
             <a href="<?php esc_url( get_permalink( $message_post_id ) );?>">
670 670
                 <?php echo  $title; ?>
@@ -673,21 +673,21 @@  discard block
 block discarded – undo
673 673
         </h2>
674 674
 
675 675
         <?php
676
-    } //end the_message_header
676
+	} //end the_message_header
677 677
 
678
-    /**
679
-     * Output the message sender given the post id.
680
-     *
681
-     * @param $message_post_id
682
-     */
683
-    public  static function the_message_sender( $message_post_id ){
678
+	/**
679
+	 * Output the message sender given the post id.
680
+	 *
681
+	 * @param $message_post_id
682
+	 */
683
+	public  static function the_message_sender( $message_post_id ){
684 684
 
685
-        $sender_username = get_post_meta( $message_post_id, '_sender', true );
686
-        $sender = get_user_by( 'login', $sender_username );
685
+		$sender_username = get_post_meta( $message_post_id, '_sender', true );
686
+		$sender = get_user_by( 'login', $sender_username );
687 687
 
688
-        if( $sender_username && $sender instanceof WP_User ) {
689
-            $sender_display_name = sprintf( __( 'Sent by %1$s on %2$s.', 'woothemes-sensei' ), $sender->display_name, get_the_date() );
690
-            ?>
688
+		if( $sender_username && $sender instanceof WP_User ) {
689
+			$sender_display_name = sprintf( __( 'Sent by %1$s on %2$s.', 'woothemes-sensei' ), $sender->display_name, get_the_date() );
690
+			?>
691 691
             <p class="message-meta">
692 692
                 <small>
693 693
                     <em> <?php echo $sender_display_name; ?> </em>
@@ -695,18 +695,18 @@  discard block
 block discarded – undo
695 695
             </p>
696 696
 
697 697
             <?php
698
-        } // end if
699
-
700
-    } // end the_message_archive_sender
701
-
702
-    /**
703
-     * Link to the users my messages page
704
-     *
705
-     * @since 1.9.0
706
-     */
707
-    public static function the_my_messages_link(){
708
-        if( ! Sensei()->settings->get('messages_disable')  ) {
709
-            ?>
698
+		} // end if
699
+
700
+	} // end the_message_archive_sender
701
+
702
+	/**
703
+	 * Link to the users my messages page
704
+	 *
705
+	 * @since 1.9.0
706
+	 */
707
+	public static function the_my_messages_link(){
708
+		if( ! Sensei()->settings->get('messages_disable')  ) {
709
+			?>
710 710
             <p class="my-messages-link-container">
711 711
                 <a class="my-messages-link" href="<?php echo get_post_type_archive_link( 'sensei_message' ); ?>"
712 712
                    title="<?php _e( 'View & reply to private messages sent to your course & lesson teachers.', 'woothemes-sensei' ); ?>">
@@ -714,8 +714,8 @@  discard block
 block discarded – undo
714 714
                 </a>
715 715
             </p>
716 716
             <?php
717
-        }
718
-    }
717
+		}
718
+	}
719 719
 
720 720
 } // End Class
721 721
 
Please login to merge, or discard this patch.
includes/class-sensei-emails.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 		add_action( 'sensei_course_status_updated', array( $this, 'learner_completed_course' ), 10, 4 );
46 46
 		add_action( 'sensei_course_status_updated', array( $this, 'teacher_completed_course' ), 10, 4 );
47 47
 		add_action( 'sensei_user_course_start', array( $this, 'teacher_started_course' ), 10, 2 );
48
-        add_action( 'sensei_user_lesson_end', array( $this, 'teacher_completed_lesson' ), 10, 2 );
48
+		add_action( 'sensei_user_lesson_end', array( $this, 'teacher_completed_lesson' ), 10, 2 );
49 49
 		add_action( 'sensei_user_quiz_submitted', array( $this, 'teacher_quiz_submitted' ), 10, 5 );
50 50
 		add_action( 'sensei_new_private_message', array( $this, 'teacher_new_message' ), 10, 1 );
51 51
 		add_action( 'sensei_private_message_reply', array( $this, 'new_message_reply' ), 10, 2 );
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 		$this->emails['learner-graded-quiz'] = include( 'emails/class-woothemes-sensei-email-learner-graded-quiz.php' );
63 63
 		$this->emails['learner-completed-course'] = include( 'emails/class-woothemes-sensei-email-learner-completed-course.php' );
64 64
 		$this->emails['teacher-completed-course'] = include( 'emails/class-woothemes-sensei-email-teacher-completed-course.php' );
65
-        $this->emails['teacher-started-course'] = include( 'emails/class-woothemes-sensei-email-teacher-started-course.php' );
66
-        $this->emails['teacher-completed-lesson'] = include( 'emails/class-woothemes-sensei-email-teacher-completed-lesson.php' );
67
-        $this->emails['teacher-quiz-submitted'] = include( 'emails/class-woothemes-sensei-email-teacher-quiz-submitted.php' );
65
+		$this->emails['teacher-started-course'] = include( 'emails/class-woothemes-sensei-email-teacher-started-course.php' );
66
+		$this->emails['teacher-completed-lesson'] = include( 'emails/class-woothemes-sensei-email-teacher-completed-lesson.php' );
67
+		$this->emails['teacher-quiz-submitted'] = include( 'emails/class-woothemes-sensei-email-teacher-quiz-submitted.php' );
68 68
 		$this->emails['teacher-new-message'] = include( 'emails/class-woothemes-sensei-email-teacher-new-message.php' );
69 69
 		$this->emails['new-message-reply'] = include( 'emails/class-woothemes-sensei-email-new-message-reply.php' );
70 70
 		$this->emails = apply_filters( 'sensei_email_classes', $this->emails );
@@ -171,20 +171,20 @@  discard block
 block discarded – undo
171 171
 		add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
172 172
 		add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
173 173
 
174
-        // Send
175
-        $send_email = true;
174
+		// Send
175
+		$send_email = true;
176 176
 
177
-        /**
178
-         * Filter Sensei's ability to send out emails.
179
-         *
180
-         * @since 1.8.0
181
-         * @param bool $send_email default true
182
-         */
183
-        if( apply_filters('sensei_send_emails', $send_email,$to, $subject, $message )  ){
177
+		/**
178
+		 * Filter Sensei's ability to send out emails.
179
+		 *
180
+		 * @since 1.8.0
181
+		 * @param bool $send_email default true
182
+		 */
183
+		if( apply_filters('sensei_send_emails', $send_email,$to, $subject, $message )  ){
184 184
 
185
-            wp_mail( $to, $subject, $message, $headers, $attachments );
185
+			wp_mail( $to, $subject, $message, $headers, $attachments );
186 186
 
187
-        }
187
+		}
188 188
 
189 189
 		// Unhook filters
190 190
 		remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
@@ -326,44 +326,44 @@  discard block
 block discarded – undo
326 326
 		}
327 327
 	}
328 328
 
329
-    /**
330
-     * teacher_completed_lesson()
331
-     *
332
-     * Send email to teacher on student completing lesson
333
-     *
334
-     * @access public
335
-     * @return void
336
-     * @since 1.9.0
337
-     */
338
-    function teacher_completed_lesson( $learner_id = 0, $lesson_id = 0 ) {
339
-
340
-
341
-        $send = false;
342
-
343
-        if( isset( Sensei()->settings->settings[ 'email_teachers' ] ) ) {
344
-            if( in_array( 'teacher-completed-lesson', (array) Sensei()->settings->settings[ 'email_teachers' ]) ) {
345
-                $send = true;
346
-            }
347
-        } else {
348
-            $send = true;
349
-        }
350
-
351
-        if( $send ) {
352
-            $email = $this->emails['teacher-completed-lesson'];
353
-            $email->trigger( $learner_id, $lesson_id );
354
-        }
355
-    }
329
+	/**
330
+	 * teacher_completed_lesson()
331
+	 *
332
+	 * Send email to teacher on student completing lesson
333
+	 *
334
+	 * @access public
335
+	 * @return void
336
+	 * @since 1.9.0
337
+	 */
338
+	function teacher_completed_lesson( $learner_id = 0, $lesson_id = 0 ) {
339
+
340
+
341
+		$send = false;
342
+
343
+		if( isset( Sensei()->settings->settings[ 'email_teachers' ] ) ) {
344
+			if( in_array( 'teacher-completed-lesson', (array) Sensei()->settings->settings[ 'email_teachers' ]) ) {
345
+				$send = true;
346
+			}
347
+		} else {
348
+			$send = true;
349
+		}
350
+
351
+		if( $send ) {
352
+			$email = $this->emails['teacher-completed-lesson'];
353
+			$email->trigger( $learner_id, $lesson_id );
354
+		}
355
+	}
356 356
 
357 357
 	/**
358 358
 	 * Send email to teacher on quiz submission
359 359
 	 *
360 360
 	 *
361
-     * @param int $learner_id
362
-     * @param int $quiz_id
363
-     * @param int $grade
364
-     * @param int $passmark
365
-     * @param string $quiz_grade_type
366
-     */
361
+	 * @param int $learner_id
362
+	 * @param int $quiz_id
363
+	 * @param int $grade
364
+	 * @param int $passmark
365
+	 * @param string $quiz_grade_type
366
+	 */
367 367
 	function teacher_quiz_submitted( $learner_id = 0, $quiz_id = 0, $grade = 0, $passmark = 0, $quiz_grade_type = 'manual' ) {
368 368
 
369 369
 		$send = false;
Please login to merge, or discard this patch.