Completed
Push — master ( b09b8b...45e17f )
by Dwain
07:46
created
includes/shortcodes/class-sensei-shortcode-teachers.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
  * Renders the [sensei_teachers] shortcode. Will show a list of teachers
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
      * @param string $content
41 41
      * @param string $shortcode the shortcode that was called for this instance
42 42
      */
43
-    public function __construct( $attributes, $content, $shortcode ){
43
+    public function __construct($attributes, $content, $shortcode) {
44 44
 
45
-        $include = isset( $attributes['include'] ) ? explode( ',', $attributes['include'] ) : '';
46
-        $exclude = isset( $attributes['exclude'] ) ? explode( ',', $attributes['exclude'] ) : '';
45
+        $include = isset($attributes['include']) ? explode(',', $attributes['include']) : '';
46
+        $exclude = isset($attributes['exclude']) ? explode(',', $attributes['exclude']) : '';
47 47
 
48 48
         // convert teacher usernames given to the id
49
-        $this->include = $this->convert_usernames_to_ids( $include );
50
-        $this->exclude = $this->convert_usernames_to_ids( $exclude );
49
+        $this->include = $this->convert_usernames_to_ids($include);
50
+        $this->exclude = $this->convert_usernames_to_ids($exclude);
51 51
 
52 52
         $this->setup_teacher_query();
53 53
 
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
      *
60 60
      * @since 1.9.0
61 61
      */
62
-    protected function setup_teacher_query(){
62
+    protected function setup_teacher_query() {
63 63
 
64 64
         $user_query_args = array(
65 65
             'role' => 'teacher',
66 66
         );
67 67
 
68
-        $this->user_query = new WP_User_Query( $user_query_args );
68
+        $this->user_query = new WP_User_Query($user_query_args);
69 69
 
70 70
     }// end setup _course_query
71 71
 
@@ -74,41 +74,41 @@  discard block
 block discarded – undo
74 74
      *
75 75
      * @return string $content
76 76
      */
77
-    public function render(){
77
+    public function render() {
78 78
 
79 79
         $all_users = $this->user_query->get_results();
80 80
         // if the user has specified more users add them as well.
81
-        if( ! empty( $this->include ) ){
81
+        if ( ! empty($this->include)) {
82 82
 
83
-            $included_users_query = new WP_User_Query( array( 'include' => $this->include ) );
83
+            $included_users_query = new WP_User_Query(array('include' => $this->include));
84 84
             $included_users = $included_users_query->get_results();
85
-            if( ! empty( $included_users ) ){
85
+            if ( ! empty($included_users)) {
86 86
 
87
-                $merged_users = array_merge( $all_users, $included_users );
88
-                $all_users = $this->users_unique( $merged_users );
89
-                $all_users = $this->users_sort( $all_users );
87
+                $merged_users = array_merge($all_users, $included_users);
88
+                $all_users = $this->users_unique($merged_users);
89
+                $all_users = $this->users_sort($all_users);
90 90
 
91 91
             }
92 92
 
93 93
         }
94 94
 
95 95
         // exclude the users not wanted
96
-        if( ! empty( $this->exclude ) ){
96
+        if ( ! empty($this->exclude)) {
97 97
 
98
-            $all_users = $this->exclude_users( $all_users, $this->exclude );
98
+            $all_users = $this->exclude_users($all_users, $this->exclude);
99 99
 
100 100
         }
101 101
 
102
-        if( ! count( $all_users )> 0  ){
102
+        if ( ! count($all_users) > 0) {
103 103
             return '';
104 104
         }
105 105
 
106 106
 
107 107
         $users_output = '';
108 108
 
109
-        foreach ( $all_users as $user ) {
109
+        foreach ($all_users as $user) {
110 110
 
111
-            $user_display_name = $this->get_user_public_name( $user );
111
+            $user_display_name = $this->get_user_public_name($user);
112 112
 
113 113
             /**
114 114
              * Sensei teachers shortcode list item filter
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
              * @param string $teacher_li the html for the teacher li
119 119
              * @param WP_User $user
120 120
              */
121
-            $users_output .= apply_filters( 'sensei_teachers_shortcode_list_item', '<li class="teacher"><a href="'. get_author_posts_url( $user->ID ) . '">'. $user_display_name .  '<a/></li>', $user );
121
+            $users_output .= apply_filters('sensei_teachers_shortcode_list_item', '<li class="teacher"><a href="'.get_author_posts_url($user->ID).'">'.$user_display_name.'<a/></li>', $user);
122 122
 
123 123
         }
124 124
 
125
-        return '<ul class="sensei-teachers">' . $users_output . '</ul>';
125
+        return '<ul class="sensei-teachers">'.$users_output.'</ul>';
126 126
 
127 127
     }// end render
128 128
 
@@ -139,17 +139,17 @@  discard block
 block discarded – undo
139 139
      *   @type WP_User
140 140
      * }
141 141
      */
142
-    public  function users_unique( $users ){
142
+    public  function users_unique($users) {
143 143
 
144 144
         $array_unique_users_ids = array();
145
-        foreach( $users as $index => $user ){
145
+        foreach ($users as $index => $user) {
146 146
 
147
-            if(  in_array( $user->ID,  $array_unique_users_ids)  ){
147
+            if (in_array($user->ID, $array_unique_users_ids)) {
148 148
 
149 149
                 // exclude this user as it is already in the list
150
-                unset( $users[ $index ] );
150
+                unset($users[$index]);
151 151
 
152
-            }else{
152
+            } else {
153 153
 
154 154
                 // add teh user to the list of users
155 155
                 $array_unique_users_ids[] = $user->ID;
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
      * @param array $exclude_ids
172 172
      * @return array
173 173
      */
174
-    public function exclude_users( $users, $exclude_ids ){
174
+    public function exclude_users($users, $exclude_ids) {
175 175
 
176
-        foreach( $users as $index => $user ){
176
+        foreach ($users as $index => $user) {
177 177
 
178
-            if( in_array( $user->ID, $exclude_ids )  ){
178
+            if (in_array($user->ID, $exclude_ids)) {
179 179
 
180 180
                 // remove the user from the list
181
-                unset( $users[ $index ] );
181
+                unset($users[$index]);
182 182
 
183 183
             }
184 184
 
@@ -194,16 +194,16 @@  discard block
 block discarded – undo
194 194
      * @param array $users
195 195
      * @return array $users_ids
196 196
      */
197
-    public function convert_usernames_to_ids( $users ){
197
+    public function convert_usernames_to_ids($users) {
198 198
 
199 199
         // backup
200 200
         $users_ids = array();
201 201
 
202
-        if ( is_array($users) ) {
202
+        if (is_array($users)) {
203 203
 
204 204
             foreach ($users as $user_id_or_username) {
205 205
 
206
-                if (!is_numeric($user_id_or_username)) {
206
+                if ( ! is_numeric($user_id_or_username)) {
207 207
 
208 208
                     $user_name = $user_id_or_username;
209 209
                     $user = get_user_by('login', $user_name);
@@ -233,11 +233,11 @@  discard block
 block discarded – undo
233 233
      * @param $user
234 234
      * @return string $user_public_name
235 235
      */
236
-    public function get_user_public_name( $user ){
236
+    public function get_user_public_name($user) {
237 237
 
238
-        if (!empty($user->first_name) && !empty($user->last_name)) {
238
+        if ( ! empty($user->first_name) && ! empty($user->last_name)) {
239 239
 
240
-            $user_public_name = $user->first_name . ' ' . $user->last_name;
240
+            $user_public_name = $user->first_name.' '.$user->last_name;
241 241
 
242 242
         }
243 243
 
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
      * @param $users
260 260
      * @return  array $sorted_users
261 261
      */
262
-    public function users_sort( $users ){
262
+    public function users_sort($users) {
263 263
 
264 264
         $sorted_users = $users;
265 265
 
266
-        uasort( $sorted_users, array( $this, 'custom_user_sort' ) );
266
+        uasort($sorted_users, array($this, 'custom_user_sort'));
267 267
 
268 268
         return $sorted_users;
269 269
     }
@@ -277,9 +277,9 @@  discard block
 block discarded – undo
277 277
      * @param $user_2
278 278
      * @return int
279 279
      */
280
-    public function custom_user_sort($user_1, $user_2){
280
+    public function custom_user_sort($user_1, $user_2) {
281 281
 
282
-        return strcasecmp( $this->get_user_public_name( $user_1 ), $this->get_user_public_name( $user_2 )  );
282
+        return strcasecmp($this->get_user_public_name($user_1), $this->get_user_public_name($user_2));
283 283
 
284 284
     }// end custom_user_sort
285 285
 
Please login to merge, or discard this patch.
includes/shortcodes/class-sensei-shortcode-course-categories.php 1 patch
Spacing   +23 added lines, -23 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
  * Renders the [sensei_course_categories] shortcode. Show the list or course categories as links to their archive
@@ -37,22 +37,22 @@  discard block
 block discarded – undo
37 37
      * @param string $content
38 38
      * @param string $shortcode the shortcode that was called for this instance
39 39
      */
40
-    public function __construct( $attributes, $content, $shortcode ){
40
+    public function __construct($attributes, $content, $shortcode) {
41 41
 
42
-        $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'name';
43
-        $this->order = isset( $attributes['order'] ) ? $attributes['order'] : 'ASC';
44
-        $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '100';
45
-        $this->parent = isset( $attributes['parent'] ) ? $attributes['parent'] : '';
42
+        $this->orderby = isset($attributes['orderby']) ? $attributes['orderby'] : 'name';
43
+        $this->order = isset($attributes['order']) ? $attributes['order'] : 'ASC';
44
+        $this->number = isset($attributes['number']) ? $attributes['number'] : '100';
45
+        $this->parent = isset($attributes['parent']) ? $attributes['parent'] : '';
46 46
 
47
-        $include = isset( $attributes['include'] ) ? explode( ',' , $attributes['include'] ) : '';
48
-        $this->include = $this->generate_term_ids( $include );
47
+        $include = isset($attributes['include']) ? explode(',', $attributes['include']) : '';
48
+        $this->include = $this->generate_term_ids($include);
49 49
 
50
-        $exclude = isset( $attributes['exclude'] ) ? explode( ',' , $attributes['exclude'] ) : '';
51
-        $this->exclude = $this->generate_term_ids( $exclude );
50
+        $exclude = isset($attributes['exclude']) ? explode(',', $attributes['exclude']) : '';
51
+        $this->exclude = $this->generate_term_ids($exclude);
52 52
 
53 53
         // make sure we handle string true/false values correctly with respective defaults
54
-        $hide_empty = isset( $attributes['hide_empty'] ) ? $attributes['hide_empty'] : 'false';
55
-        $this->hide_empty = 'true' == $hide_empty ? true: false;
54
+        $hide_empty = isset($attributes['hide_empty']) ? $attributes['hide_empty'] : 'false';
55
+        $this->hide_empty = 'true' == $hide_empty ? true : false;
56 56
 
57 57
         $this->setup_course_categories();
58 58
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      *
64 64
      * @return mixed
65 65
      */
66
-    public function setup_course_categories(){
66
+    public function setup_course_categories() {
67 67
 
68 68
         $args = array(
69 69
             'orderby'       => $this->orderby,
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
      *
86 86
      * @return string $content
87 87
      */
88
-    public function render(){
88
+    public function render() {
89 89
 
90
-        if( empty(  $this->sensei_course_taxonomy_terms  ) ){
90
+        if (empty($this->sensei_course_taxonomy_terms)) {
91 91
 
92
-            return __( 'No course categories found.', 'woothemes-sensei' );
92
+            return __('No course categories found.', 'woothemes-sensei');
93 93
 
94 94
         }
95 95
 
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
 
98 98
         //set the wp_query to the current messages query
99 99
         $terms_html .= '<ul class="sensei course-categories">';
100
-        foreach( $this->sensei_course_taxonomy_terms as $category ){
100
+        foreach ($this->sensei_course_taxonomy_terms as $category) {
101 101
 
102
-            $category_link = '<a href="'. get_term_link( $category ) . '">' . $category->name  . '</a>';
103
-            $terms_html .=  '<li class="sensei course-category" >' . $category_link . '</li>';
102
+            $category_link = '<a href="'.get_term_link($category).'">'.$category->name.'</a>';
103
+            $terms_html .= '<li class="sensei course-category" >'.$category_link.'</li>';
104 104
 
105 105
         }
106 106
         $terms_html .= '<ul>';
@@ -117,20 +117,20 @@  discard block
 block discarded – undo
117 117
      * @param array $category_ids
118 118
      * @return array
119 119
      */
120
-    public function generate_term_ids( $categories = array() ){
120
+    public function generate_term_ids($categories = array()) {
121 121
 
122 122
         $cat_ids = array();
123 123
 
124
-        if ( is_array($categories) ) {
124
+        if (is_array($categories)) {
125 125
             foreach ($categories as $cat) {
126 126
 
127
-                if (!is_numeric($cat)) {
127
+                if ( ! is_numeric($cat)) {
128 128
 
129 129
                     // try the slug
130 130
                     $term = get_term_by('slug', $cat, 'course-category');
131 131
 
132 132
                     // if the slug didn't work try the name
133
-                    if (!$term) {
133
+                    if ( ! $term) {
134 134
 
135 135
                         $term = get_term_by('name', $cat, 'course-category');
136 136
 
Please login to merge, or discard this patch.
includes/class-sensei-emails.php 1 patch
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -42,22 +42,22 @@  discard block
 block discarded – undo
42 42
 	 * @access public
43 43
 	 * @return void
44 44
 	 */
45
-	function __construct( $file ) {
45
+	function __construct($file) {
46 46
 
47 47
 		$this->init();
48 48
 
49 49
 		// Hooks for sending emails during Sensei events
50
-		add_action( 'sensei_user_quiz_grade', array( $this, 'learner_graded_quiz' ), 10, 4 );
51
-		add_action( 'sensei_course_status_updated', array( $this, 'learner_completed_course' ), 10, 4 );
52
-		add_action( 'sensei_course_status_updated', array( $this, 'teacher_completed_course' ), 10, 4 );
53
-		add_action( 'sensei_user_course_start', array( $this, 'teacher_started_course' ), 10, 2 );
54
-        add_action( 'sensei_user_lesson_end', array( $this, 'teacher_completed_lesson' ), 10, 2 );
55
-		add_action( 'sensei_user_quiz_submitted', array( $this, 'teacher_quiz_submitted' ), 10, 5 );
56
-		add_action( 'sensei_new_private_message', array( $this, 'teacher_new_message' ), 10, 1 );
57
-		add_action( 'sensei_private_message_reply', array( $this, 'new_message_reply' ), 10, 2 );
50
+		add_action('sensei_user_quiz_grade', array($this, 'learner_graded_quiz'), 10, 4);
51
+		add_action('sensei_course_status_updated', array($this, 'learner_completed_course'), 10, 4);
52
+		add_action('sensei_course_status_updated', array($this, 'teacher_completed_course'), 10, 4);
53
+		add_action('sensei_user_course_start', array($this, 'teacher_started_course'), 10, 2);
54
+        add_action('sensei_user_lesson_end', array($this, 'teacher_completed_lesson'), 10, 2);
55
+		add_action('sensei_user_quiz_submitted', array($this, 'teacher_quiz_submitted'), 10, 5);
56
+		add_action('sensei_new_private_message', array($this, 'teacher_new_message'), 10, 1);
57
+		add_action('sensei_private_message_reply', array($this, 'new_message_reply'), 10, 2);
58 58
 
59 59
 		// Let 3rd parties unhook the above via this hook
60
-		do_action( 'sensei_emails', $this );
60
+		do_action('sensei_emails', $this);
61 61
 	}
62 62
 
63 63
 	/**
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	function init() {
67 67
 
68
-		$this->emails['learner-graded-quiz'] = include( 'emails/class-woothemes-sensei-email-learner-graded-quiz.php' );
69
-		$this->emails['learner-completed-course'] = include( 'emails/class-woothemes-sensei-email-learner-completed-course.php' );
70
-		$this->emails['teacher-completed-course'] = include( 'emails/class-woothemes-sensei-email-teacher-completed-course.php' );
71
-        $this->emails['teacher-started-course'] = include( 'emails/class-woothemes-sensei-email-teacher-started-course.php' );
72
-        $this->emails['teacher-completed-lesson'] = include( 'emails/class-woothemes-sensei-email-teacher-completed-lesson.php' );
73
-        $this->emails['teacher-quiz-submitted'] = include( 'emails/class-woothemes-sensei-email-teacher-quiz-submitted.php' );
74
-		$this->emails['teacher-new-message'] = include( 'emails/class-woothemes-sensei-email-teacher-new-message.php' );
75
-		$this->emails['new-message-reply'] = include( 'emails/class-woothemes-sensei-email-new-message-reply.php' );
76
-		$this->emails = apply_filters( 'sensei_email_classes', $this->emails );
68
+		$this->emails['learner-graded-quiz'] = include('emails/class-woothemes-sensei-email-learner-graded-quiz.php');
69
+		$this->emails['learner-completed-course'] = include('emails/class-woothemes-sensei-email-learner-completed-course.php');
70
+		$this->emails['teacher-completed-course'] = include('emails/class-woothemes-sensei-email-teacher-completed-course.php');
71
+        $this->emails['teacher-started-course'] = include('emails/class-woothemes-sensei-email-teacher-started-course.php');
72
+        $this->emails['teacher-completed-lesson'] = include('emails/class-woothemes-sensei-email-teacher-completed-lesson.php');
73
+        $this->emails['teacher-quiz-submitted'] = include('emails/class-woothemes-sensei-email-teacher-quiz-submitted.php');
74
+		$this->emails['teacher-new-message'] = include('emails/class-woothemes-sensei-email-teacher-new-message.php');
75
+		$this->emails['new-message-reply'] = include('emails/class-woothemes-sensei-email-new-message-reply.php');
76
+		$this->emails = apply_filters('sensei_email_classes', $this->emails);
77 77
 	}
78 78
 
79 79
 	/**
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
 	function get_from_name() {
96 96
 
97 97
 
98
-		if ( ! $this->_from_name ) {
99
-			if( isset( Sensei()->settings->settings['email_from_name'] ) && '' != Sensei()->settings->settings['email_from_name'] ) {
98
+		if ( ! $this->_from_name) {
99
+			if (isset(Sensei()->settings->settings['email_from_name']) && '' != Sensei()->settings->settings['email_from_name']) {
100 100
 				$this->_from_name = Sensei()->settings->settings['email_from_name'];
101 101
 			} else {
102
-				$this->_from_name = get_bloginfo( 'name' );
102
+				$this->_from_name = get_bloginfo('name');
103 103
 			}
104 104
 		}
105 105
 
106
-		return wp_specialchars_decode( $this->_from_name );
106
+		return wp_specialchars_decode($this->_from_name);
107 107
 	}
108 108
 
109 109
 	/**
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
 	function get_from_address() {
116 116
 
117 117
 
118
-		if ( ! $this->_from_address ) {
119
-			if( isset( Sensei()->settings->settings['email_from_address'] ) && '' != Sensei()->settings->settings['email_from_address'] ) {
118
+		if ( ! $this->_from_address) {
119
+			if (isset(Sensei()->settings->settings['email_from_address']) && '' != Sensei()->settings->settings['email_from_address']) {
120 120
 				$this->_from_address = Sensei()->settings->settings['email_from_address'];
121 121
 			} else {
122
-				$this->_from_address = get_bloginfo( 'admin_email' );
122
+				$this->_from_address = get_bloginfo('admin_email');
123 123
 			}
124 124
 		}
125 125
 
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
 	 * @param mixed $content
144 144
 	 * @return string
145 145
 	 */
146
-	function wrap_message( $content ) {
146
+	function wrap_message($content) {
147 147
 
148 148
 		$html = '';
149 149
 
150
-		$html .= $this->load_template( 'header' );
151
-		$html .= wpautop( wptexturize( $content ) );
152
-		$html .= $this->load_template( 'footer' );
150
+		$html .= $this->load_template('header');
151
+		$html .= wpautop(wptexturize($content));
152
+		$html .= $this->load_template('footer');
153 153
 
154 154
 		return $html;
155 155
 	}
@@ -166,16 +166,16 @@  discard block
 block discarded – undo
166 166
 	 * @param string $content_type (default: "text/html")
167 167
 	 * @return void
168 168
 	 */
169
-	function send( $to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = "", $content_type = 'text/html' ) {
169
+	function send($to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = "", $content_type = 'text/html') {
170 170
 		global $email_template;
171 171
 
172 172
 		// Set content type
173 173
 		$this->_content_type = $content_type;
174 174
 
175 175
 		// Filters for the email
176
-		add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
177
-		add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
178
-		add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
176
+		add_filter('wp_mail_from', array($this, 'get_from_address'));
177
+		add_filter('wp_mail_from_name', array($this, 'get_from_name'));
178
+		add_filter('wp_mail_content_type', array($this, 'get_content_type'));
179 179
 
180 180
         // Send
181 181
         $send_email = true;
@@ -186,40 +186,40 @@  discard block
 block discarded – undo
186 186
          * @since 1.8.0
187 187
          * @param bool $send_email default true
188 188
          */
189
-        if( apply_filters('sensei_send_emails', $send_email,$to, $subject, $message )  ){
189
+        if (apply_filters('sensei_send_emails', $send_email, $to, $subject, $message)) {
190 190
 
191
-            wp_mail( $to, $subject, $message, $headers, $attachments );
191
+            wp_mail($to, $subject, $message, $headers, $attachments);
192 192
 
193 193
         }
194 194
 
195 195
 		// Unhook filters
196
-		remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
197
-		remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
198
-		remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
196
+		remove_filter('wp_mail_from', array($this, 'get_from_address'));
197
+		remove_filter('wp_mail_from_name', array($this, 'get_from_name'));
198
+		remove_filter('wp_mail_content_type', array($this, 'get_content_type'));
199 199
 	}
200 200
 
201
-	function get_content( $email_template ) {
201
+	function get_content($email_template) {
202 202
 
203
-		$message = $this->load_template( $email_template );
203
+		$message = $this->load_template($email_template);
204 204
 
205
-		$html = $this->wrap_message( $message );
205
+		$html = $this->wrap_message($message);
206 206
 
207
-		return apply_filters( 'sensei_email', $html, $email_template );
207
+		return apply_filters('sensei_email', $html, $email_template);
208 208
 	}
209 209
 
210
-	function load_template( $template = '' ) {
210
+	function load_template($template = '') {
211 211
 		global  $email_template;
212 212
 
213
-		if( ! $template ) return;
213
+		if ( ! $template) return;
214 214
 
215
-		$email_template = $template . '.php';
216
-		$template = Sensei_Templates::template_loader( '' );
215
+		$email_template = $template.'.php';
216
+		$template = Sensei_Templates::template_loader('');
217 217
 
218 218
 		ob_start();
219 219
 
220
-		do_action( 'sensei_before_email_template', $email_template );
221
-		include( $template );
222
-		do_action( 'sensei_after_email_template', $email_template );
220
+		do_action('sensei_before_email_template', $email_template);
221
+		include($template);
222
+		do_action('sensei_after_email_template', $email_template);
223 223
 
224 224
 		return ob_get_clean();
225 225
 	}
@@ -230,22 +230,22 @@  discard block
 block discarded – undo
230 230
 	 * @access public
231 231
 	 * @return void
232 232
 	 */
233
-	function learner_graded_quiz( $user_id, $quiz_id, $grade, $passmark ) {
233
+	function learner_graded_quiz($user_id, $quiz_id, $grade, $passmark) {
234 234
 
235 235
 
236 236
 		$send = false;
237 237
 
238
-		if( isset( Sensei()->settings->settings['email_learners'] ) ) {
239
-			if( in_array( 'learner-graded-quiz', (array) Sensei()->settings->settings['email_learners'] ) ) {
238
+		if (isset(Sensei()->settings->settings['email_learners'])) {
239
+			if (in_array('learner-graded-quiz', (array) Sensei()->settings->settings['email_learners'])) {
240 240
 				$send = true;
241 241
 			}
242 242
 		} else {
243 243
 			$send = true;
244 244
 		}
245 245
 
246
-		if( $send ) {
246
+		if ($send) {
247 247
 			$email = $this->emails['learner-graded-quiz'];
248
-			$email->trigger( $user_id, $quiz_id, $grade, $passmark );
248
+			$email->trigger($user_id, $quiz_id, $grade, $passmark);
249 249
 		}
250 250
 	}
251 251
 
@@ -255,26 +255,26 @@  discard block
 block discarded – undo
255 255
 	 * @access public
256 256
 	 * @return void
257 257
 	 */
258
-	function learner_completed_course( $status = 'in-progress', $user_id = 0, $course_id = 0, $comment_id = 0 ) {
258
+	function learner_completed_course($status = 'in-progress', $user_id = 0, $course_id = 0, $comment_id = 0) {
259 259
 
260 260
 
261
-		if( 'complete' != $status ) {
261
+		if ('complete' != $status) {
262 262
 			return;
263 263
 		}
264 264
 
265 265
 		$send = false;
266 266
 
267
-		if( isset( Sensei()->settings->settings['email_learners'] ) ) {
268
-			if( in_array( 'learner-completed-course', (array) Sensei()->settings->settings['email_learners'] ) ) {
267
+		if (isset(Sensei()->settings->settings['email_learners'])) {
268
+			if (in_array('learner-completed-course', (array) Sensei()->settings->settings['email_learners'])) {
269 269
 				$send = true;
270 270
 			}
271 271
 		} else {
272 272
 			$send = true;
273 273
 		}
274 274
 
275
-		if( $send ) {
275
+		if ($send) {
276 276
 			$email = $this->emails['learner-completed-course'];
277
-			$email->trigger( $user_id, $course_id );
277
+			$email->trigger($user_id, $course_id);
278 278
 		}
279 279
 	}
280 280
 
@@ -284,26 +284,26 @@  discard block
 block discarded – undo
284 284
 	 * @access public
285 285
 	 * @return void
286 286
 	 */
287
-	function teacher_completed_course( $status = 'in-progress', $learner_id = 0, $course_id = 0, $comment_id = 0 ) {
287
+	function teacher_completed_course($status = 'in-progress', $learner_id = 0, $course_id = 0, $comment_id = 0) {
288 288
 
289 289
 
290
-		if( 'complete' != $status ) {
290
+		if ('complete' != $status) {
291 291
 			return;
292 292
 		}
293 293
 
294 294
 		$send = false;
295 295
 
296
-		if( isset( Sensei()->settings->settings['email_teachers'] ) ) {
297
-			if( in_array( 'teacher-completed-course', (array) Sensei()->settings->settings['email_teachers'] ) ) {
296
+		if (isset(Sensei()->settings->settings['email_teachers'])) {
297
+			if (in_array('teacher-completed-course', (array) Sensei()->settings->settings['email_teachers'])) {
298 298
 				$send = true;
299 299
 			}
300 300
 		} else {
301 301
 			$send = true;
302 302
 		}
303 303
 
304
-		if( $send ) {
304
+		if ($send) {
305 305
 			$email = $this->emails['teacher-completed-course'];
306
-			$email->trigger( $learner_id, $course_id );
306
+			$email->trigger($learner_id, $course_id);
307 307
 		}
308 308
 	}
309 309
 
@@ -313,22 +313,22 @@  discard block
 block discarded – undo
313 313
 	 * @access public
314 314
 	 * @return void
315 315
 	 */
316
-	function teacher_started_course( $learner_id = 0, $course_id = 0 ) {
316
+	function teacher_started_course($learner_id = 0, $course_id = 0) {
317 317
 
318 318
 
319 319
 		$send = false;
320 320
 
321
-		if( isset( Sensei()->settings->settings['email_teachers'] ) ) {
322
-			if( in_array( 'teacher-started-course', (array) Sensei()->settings->settings['email_teachers'] ) ) {
321
+		if (isset(Sensei()->settings->settings['email_teachers'])) {
322
+			if (in_array('teacher-started-course', (array) Sensei()->settings->settings['email_teachers'])) {
323 323
 				$send = true;
324 324
 			}
325 325
 		} else {
326 326
 			$send = true;
327 327
 		}
328 328
 
329
-		if( $send ) {
329
+		if ($send) {
330 330
 			$email = $this->emails['teacher-started-course'];
331
-			$email->trigger( $learner_id, $course_id );
331
+			$email->trigger($learner_id, $course_id);
332 332
 		}
333 333
 	}
334 334
 
@@ -341,22 +341,22 @@  discard block
 block discarded – undo
341 341
      * @return void
342 342
      * @since 1.9.0
343 343
      */
344
-    function teacher_completed_lesson( $learner_id = 0, $lesson_id = 0 ) {
344
+    function teacher_completed_lesson($learner_id = 0, $lesson_id = 0) {
345 345
 
346 346
 
347 347
         $send = false;
348 348
 
349
-        if( isset( Sensei()->settings->settings[ 'email_teachers' ] ) ) {
350
-            if( in_array( 'teacher-completed-lesson', (array) Sensei()->settings->settings[ 'email_teachers' ]) ) {
349
+        if (isset(Sensei()->settings->settings['email_teachers'])) {
350
+            if (in_array('teacher-completed-lesson', (array) Sensei()->settings->settings['email_teachers'])) {
351 351
                 $send = true;
352 352
             }
353 353
         } else {
354 354
             $send = true;
355 355
         }
356 356
 
357
-        if( $send ) {
357
+        if ($send) {
358 358
             $email = $this->emails['teacher-completed-lesson'];
359
-            $email->trigger( $learner_id, $lesson_id );
359
+            $email->trigger($learner_id, $lesson_id);
360 360
         }
361 361
     }
362 362
 
@@ -366,25 +366,25 @@  discard block
 block discarded – undo
366 366
 	 * @access public
367 367
 	 * @return void
368 368
 	 */
369
-	function teacher_quiz_submitted( $learner_id = 0, $quiz_id = 0, $grade = 0, $passmark = 0, $quiz_grade_type = 'manual' ) {
369
+	function teacher_quiz_submitted($learner_id = 0, $quiz_id = 0, $grade = 0, $passmark = 0, $quiz_grade_type = 'manual') {
370 370
 
371 371
 
372 372
 
373 373
 		$send = false;
374 374
 
375 375
 		// Only trigger if the quiz was marked as manual grading, or auto grading didn't complete
376
-		if( 'manual' == $quiz_grade_type || is_wp_error( $grade ) ) {
377
-			if( isset( Sensei()->settings->settings['email_teachers'] ) ) {
378
-				if( in_array( 'teacher-quiz-submitted', (array) Sensei()->settings->settings['email_teachers'] ) ) {
376
+		if ('manual' == $quiz_grade_type || is_wp_error($grade)) {
377
+			if (isset(Sensei()->settings->settings['email_teachers'])) {
378
+				if (in_array('teacher-quiz-submitted', (array) Sensei()->settings->settings['email_teachers'])) {
379 379
 					$send = true;
380 380
 				}
381 381
 			} else {
382 382
 				$send = true;
383 383
 			}
384 384
 
385
-			if( $send ) {
385
+			if ($send) {
386 386
 				$email = $this->emails['teacher-quiz-submitted'];
387
-				$email->trigger( $learner_id, $quiz_id );
387
+				$email->trigger($learner_id, $quiz_id);
388 388
 			}
389 389
 
390 390
 		}
@@ -396,22 +396,22 @@  discard block
 block discarded – undo
396 396
 	 * @access public
397 397
 	 * @return void
398 398
 	 */
399
-	function teacher_new_message( $message_id = 0 ) {
399
+	function teacher_new_message($message_id = 0) {
400 400
 
401 401
 
402 402
 		$send = false;
403 403
 
404
-		if( isset( Sensei()->settings->settings['email_teachers'] ) ) {
405
-			if( in_array( 'teacher-new-message', (array) Sensei()->settings->settings['email_teachers'] ) ) {
404
+		if (isset(Sensei()->settings->settings['email_teachers'])) {
405
+			if (in_array('teacher-new-message', (array) Sensei()->settings->settings['email_teachers'])) {
406 406
 				$send = true;
407 407
 			}
408 408
 		} else {
409 409
 			$send = true;
410 410
 		}
411 411
 
412
-		if( $send ) {
412
+		if ($send) {
413 413
 			$email = $this->emails['teacher-new-message'];
414
-			$email->trigger( $message_id );
414
+			$email->trigger($message_id);
415 415
 		}
416 416
 	}
417 417
 
@@ -421,22 +421,22 @@  discard block
 block discarded – undo
421 421
 	 * @access public
422 422
 	 * @return void
423 423
 	 */
424
-	function new_message_reply( $comment, $message ) {
424
+	function new_message_reply($comment, $message) {
425 425
 
426 426
 
427 427
 		$send = false;
428 428
 
429
-		if( isset( Sensei()->settings->settings['email_global'] ) ) {
430
-			if( in_array( 'new-message-reply', (array) Sensei()->settings->settings['email_global'] ) ) {
429
+		if (isset(Sensei()->settings->settings['email_global'])) {
430
+			if (in_array('new-message-reply', (array) Sensei()->settings->settings['email_global'])) {
431 431
 				$send = true;
432 432
 			}
433 433
 		} else {
434 434
 			$send = true;
435 435
 		}
436 436
 
437
-		if( $send ) {
437
+		if ($send) {
438 438
 			$email = $this->emails['new-message-reply'];
439
-			$email->trigger( $comment, $message );
439
+			$email->trigger($comment, $message);
440 440
 		}
441 441
 	}
442 442
 
@@ -447,4 +447,4 @@  discard block
 block discarded – undo
447 447
  * for backward compatibility
448 448
  * @since 1.9.0
449 449
  */
450
-class WooThemes_Sensei_Emails extends Sensei_Emails{}
450
+class WooThemes_Sensei_Emails extends Sensei_Emails {}
Please login to merge, or discard this patch.
includes/class-sensei-notices.php 1 patch
Spacing   +11 added lines, -11 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 Notices Class
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * @since 1.6.3
14 14
  */
15 15
 
16
-class Sensei_Notices{
16
+class Sensei_Notices {
17 17
 
18 18
 	/**
19 19
 	*  @var $notices
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	/**
24 24
 	*  constructor 
25 25
  	*/
26
-	public function __construct(){
26
+	public function __construct() {
27 27
 		//initialize the notices variable
28 28
 		$this->notices = array();
29 29
 	}
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	* @return void
40 40
 	*/
41 41
 
42
-	public function add_notice( $content ,  $type = 'alert'   ){
42
+	public function add_notice($content, $type = 'alert') {
43 43
 		// append the new notice
44
-		$this->notices[] = array('content' => $content , 'type'=> $type );
44
+		$this->notices[] = array('content' => $content, 'type'=> $type);
45 45
 	} // end add_notice()
46 46
 
47 47
 	/**
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 	* @return void
54 54
 	*/
55 55
 
56
-	public function print_notices(){
57
-		if(  count( $this->notices ) > 0  ){
56
+	public function print_notices() {
57
+		if (count($this->notices) > 0) {
58 58
 			foreach ($this->notices  as  $notice) {
59 59
 
60
-				$classes = 'sensei-message '. $notice['type'];
61
-				$html = '<div class="'. $classes . '">'. $notice['content'] . '</div>';
60
+				$classes = 'sensei-message '.$notice['type'];
61
+				$html = '<div class="'.$classes.'">'.$notice['content'].'</div>';
62 62
 
63 63
 				echo $html; 
64 64
 			}
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	* @return void
74 74
 	*/
75 75
 
76
-	public function clear_notices(){
76
+	public function clear_notices() {
77 77
 		// assign an empty array to clear all existing notices
78 78
 		$this->notices = array();
79 79
 	} // end clear_notices()
@@ -85,4 +85,4 @@  discard block
 block discarded – undo
85 85
  * for backward compatibility
86 86
  * @since 1.9.0
87 87
  */
88
-class Woothemes_Sensei_Notices extends Sensei_Notices{}
88
+class Woothemes_Sensei_Notices extends Sensei_Notices {}
Please login to merge, or discard this patch.
includes/emails/class-woothemes-sensei-email-teacher-completed-lesson.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly
4 4
 
5
-if ( ! class_exists( 'WooThemes_Sensei_Email_Teacher_Completed_Lesson' ) ) :
5
+if ( ! class_exists('WooThemes_Sensei_Email_Teacher_Completed_Lesson')) :
6 6
 
7 7
 /**
8 8
  * Teacher Completed Lesson
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	function __construct() {
33 33
 		$this->template = 'teacher-completed-lesson';
34
-		$this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] Your student has completed a lesson', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template );
35
-		$this->heading = apply_filters( 'sensei_email_heading', __( 'Your student has completed a lesson', 'woothemes-sensei' ), $this->template );
34
+		$this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] Your student has completed a lesson', 'woothemes-sensei'), get_bloginfo('name')), $this->template);
35
+		$this->heading = apply_filters('sensei_email_heading', __('Your student has completed a lesson', 'woothemes-sensei'), $this->template);
36 36
 	}
37 37
 
38 38
 	/**
@@ -41,31 +41,31 @@  discard block
 block discarded – undo
41 41
 	 * @access public
42 42
 	 * @return void
43 43
 	 */
44
-	function trigger( $learner_id = 0, $lesson_id = 0 ) {
44
+	function trigger($learner_id = 0, $lesson_id = 0) {
45 45
 		global $sensei_email_data;
46 46
 
47 47
 		// Get learner user object
48
-		$this->learner = new WP_User( $learner_id );
48
+		$this->learner = new WP_User($learner_id);
49 49
 
50 50
 		// Get teacher ID and user object
51
-		$teacher_id = get_post_field( 'post_author', $lesson_id, 'raw' );
52
-		$this->teacher = new WP_User( $teacher_id );
51
+		$teacher_id = get_post_field('post_author', $lesson_id, 'raw');
52
+		$this->teacher = new WP_User($teacher_id);
53 53
 
54 54
         // Construct data array
55
-		$sensei_email_data = apply_filters( 'sensei_email_data', array(
55
+		$sensei_email_data = apply_filters('sensei_email_data', array(
56 56
 			'template'			=> $this->template,
57 57
 			'heading'			=> $this->heading,
58 58
 			'teacher_id'		=> $teacher_id,
59 59
 			'learner_id'		=> $learner_id,
60 60
 			'learner_name'		=> $this->learner->display_name,
61 61
 			'lesson_id'			=> $lesson_id,
62
-		), $this->template );
62
+		), $this->template);
63 63
 
64 64
 		// Set recipient (teacher)
65
-		$this->recipient = stripslashes( $this->teacher->user_email );
65
+		$this->recipient = stripslashes($this->teacher->user_email);
66 66
 
67 67
 		// Send mail
68
-        Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) );
68
+        Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template));
69 69
 	}
70 70
 }
71 71
 
Please login to merge, or discard this patch.
includes/emails/class-woothemes-sensei-email-teacher-quiz-submitted.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly
4 4
 
5
-if ( ! class_exists( 'WooThemes_Sensei_Email_Teacher_Quiz_Submitted' ) ) :
5
+if ( ! class_exists('WooThemes_Sensei_Email_Teacher_Quiz_Submitted')) :
6 6
 
7 7
 /**
8 8
  * Teacher Quiz Submitted
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	function __construct() {
33 33
 		$this->template = 'teacher-quiz-submitted';
34
-		$this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] Your student has submitted a quiz for grading', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template );
35
-		$this->heading = apply_filters( 'sensei_email_heading', __( 'Your student has submitted a quiz for grading', 'woothemes-sensei' ), $this->template );
34
+		$this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] Your student has submitted a quiz for grading', 'woothemes-sensei'), get_bloginfo('name')), $this->template);
35
+		$this->heading = apply_filters('sensei_email_heading', __('Your student has submitted a quiz for grading', 'woothemes-sensei'), $this->template);
36 36
 	}
37 37
 
38 38
 	/**
@@ -41,20 +41,20 @@  discard block
 block discarded – undo
41 41
 	 * @access public
42 42
 	 * @return void
43 43
 	 */
44
-	function trigger( $learner_id = 0, $quiz_id = 0 ) {
44
+	function trigger($learner_id = 0, $quiz_id = 0) {
45 45
 		global  $sensei_email_data;
46 46
 
47 47
 		// Get learner user object
48
-		$this->learner = new WP_User( $learner_id );
48
+		$this->learner = new WP_User($learner_id);
49 49
 
50 50
 		// Get teacher ID and user object
51
-        $lesson_id = get_post_meta( $quiz_id, '_quiz_lesson', true );
52
-        $course_id = get_post_meta( $lesson_id, '_lesson_course', true );
53
-		$teacher_id = get_post_field( 'post_author', $course_id, 'raw' );
54
-		$this->teacher = new WP_User( $teacher_id );
51
+        $lesson_id = get_post_meta($quiz_id, '_quiz_lesson', true);
52
+        $course_id = get_post_meta($lesson_id, '_lesson_course', true);
53
+		$teacher_id = get_post_field('post_author', $course_id, 'raw');
54
+		$this->teacher = new WP_User($teacher_id);
55 55
 
56 56
 		// Construct data array
57
-		$sensei_email_data = apply_filters( 'sensei_email_data', array(
57
+		$sensei_email_data = apply_filters('sensei_email_data', array(
58 58
 			'template'			=> $this->template,
59 59
 			'heading'			=> $this->heading,
60 60
 			'teacher_id'		=> $teacher_id,
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 			'learner_name'		=> $this->learner->display_name,
63 63
 			'quiz_id'			=> $quiz_id,
64 64
 			'lesson_id'			=> $lesson_id,
65
-		), $this->template );
65
+		), $this->template);
66 66
 
67 67
 		// Set recipient (teacher)
68
-		$this->recipient = stripslashes( $this->teacher->user_email );
68
+		$this->recipient = stripslashes($this->teacher->user_email);
69 69
 
70 70
 		// Send mail
71
-		Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) );
71
+		Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template));
72 72
 	}
73 73
 }
74 74
 
Please login to merge, or discard this patch.
includes/emails/class-woothemes-sensei-email-teacher-new-message.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly
4 4
 
5
-if ( ! class_exists( 'WooThemes_Sensei_Email_Teacher_New_Message' ) ) :
5
+if ( ! class_exists('WooThemes_Sensei_Email_Teacher_New_Message')) :
6 6
 
7 7
 /**
8 8
  * Teacher New Message
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	function __construct() {
34 34
 		$this->template = 'teacher-new-message';
35
-		$this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] You have received a new private message', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template );
36
-		$this->heading = apply_filters( 'sensei_email_heading', __( 'Your student has sent you a private message', 'woothemes-sensei' ), $this->template );
35
+		$this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] You have received a new private message', 'woothemes-sensei'), get_bloginfo('name')), $this->template);
36
+		$this->heading = apply_filters('sensei_email_heading', __('Your student has sent you a private message', 'woothemes-sensei'), $this->template);
37 37
 	}
38 38
 
39 39
 	/**
@@ -42,29 +42,29 @@  discard block
 block discarded – undo
42 42
 	 * @access public
43 43
 	 * @return void
44 44
 	 */
45
-	function trigger( $message_id = 0 ) {
45
+	function trigger($message_id = 0) {
46 46
 		global  $sensei_email_data;
47 47
 
48
-		$this->message = get_post( $message_id );
48
+		$this->message = get_post($message_id);
49 49
 
50
-		$learner_username = get_post_meta( $message_id, '_sender', true );
51
-		$this->learner = get_user_by( 'login', $learner_username );
50
+		$learner_username = get_post_meta($message_id, '_sender', true);
51
+		$this->learner = get_user_by('login', $learner_username);
52 52
 
53
-		$teacher_username = get_post_meta( $message_id, '_receiver', true );
54
-		$this->teacher = get_user_by( 'login', $teacher_username );
53
+		$teacher_username = get_post_meta($message_id, '_receiver', true);
54
+		$this->teacher = get_user_by('login', $teacher_username);
55 55
 
56
-		$content_type = get_post_meta( $message_id, '_posttype', true );
57
-		$content_id = get_post_meta( $message_id, '_post', true );
58
-		$content_title = get_the_title( $content_id );
56
+		$content_type = get_post_meta($message_id, '_posttype', true);
57
+		$content_id = get_post_meta($message_id, '_post', true);
58
+		$content_title = get_the_title($content_id);
59 59
 
60 60
         // setup the post type parameter
61
-        $content_type = get_post_type( $content_id );
62
-        if( !$content_type ){
63
-            $content_type ='';
61
+        $content_type = get_post_type($content_id);
62
+        if ( ! $content_type) {
63
+            $content_type = '';
64 64
         }
65 65
 
66 66
 		// Construct data array
67
-		$sensei_email_data = apply_filters( 'sensei_email_data', array(
67
+		$sensei_email_data = apply_filters('sensei_email_data', array(
68 68
 			'template'			=> $this->template,
69 69
             $content_type.'_id' => $content_id,
70 70
 			'heading'			=> $this->heading,
@@ -75,15 +75,15 @@  discard block
 block discarded – undo
75 75
 			'message'			=> $this->message->post_content,
76 76
 			'content_title'		=> $content_title,
77 77
 			'content_type'		=> $content_type,
78
-		), $this->template );
78
+		), $this->template);
79 79
 
80 80
 		// Set recipient (teacher)
81
-		$this->recipient = stripslashes( $this->teacher->user_email );
81
+		$this->recipient = stripslashes($this->teacher->user_email);
82 82
 
83 83
 		// Send mail
84
-		Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) );
84
+		Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template));
85 85
 
86
-		wp_safe_redirect( esc_url_raw( add_query_arg( array( 'send' => 'complete' ) ) ) );
86
+		wp_safe_redirect(esc_url_raw(add_query_arg(array('send' => 'complete'))));
87 87
 		exit;
88 88
 	}
89 89
 }
Please login to merge, or discard this patch.
includes/emails/class-woothemes-sensei-email-teacher-started-course.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly
4 4
 
5
-if ( ! class_exists( 'WooThemes_Sensei_Email_Teacher_Started_Course' ) ) :
5
+if ( ! class_exists('WooThemes_Sensei_Email_Teacher_Started_Course')) :
6 6
 
7 7
 /**
8 8
  * Teacher Started Course
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	function __construct() {
33 33
 		$this->template = 'teacher-started-course';
34
-		$this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] Your student has started a course', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template );
35
-		$this->heading = apply_filters( 'sensei_email_heading', __( 'Your student has started a course', 'woothemes-sensei' ), $this->template );
34
+		$this->subject = apply_filters('sensei_email_subject', sprintf(__('[%1$s] Your student has started a course', 'woothemes-sensei'), get_bloginfo('name')), $this->template);
35
+		$this->heading = apply_filters('sensei_email_heading', __('Your student has started a course', 'woothemes-sensei'), $this->template);
36 36
 	}
37 37
 
38 38
 	/**
@@ -41,31 +41,31 @@  discard block
 block discarded – undo
41 41
 	 * @access public
42 42
 	 * @return void
43 43
 	 */
44
-	function trigger( $learner_id = 0, $course_id = 0 ) {
44
+	function trigger($learner_id = 0, $course_id = 0) {
45 45
 		global  $sensei_email_data;
46 46
 
47 47
 		// Get learner user object
48
-		$this->learner = new WP_User( $learner_id );
48
+		$this->learner = new WP_User($learner_id);
49 49
 
50 50
 		// Get teacher ID and user object
51
-		$teacher_id = get_post_field( 'post_author', $course_id, 'raw' );
52
-		$this->teacher = new WP_User( $teacher_id );
51
+		$teacher_id = get_post_field('post_author', $course_id, 'raw');
52
+		$this->teacher = new WP_User($teacher_id);
53 53
 
54 54
 		// Construct data array
55
-		$sensei_email_data = apply_filters( 'sensei_email_data', array(
55
+		$sensei_email_data = apply_filters('sensei_email_data', array(
56 56
 			'template'			=> $this->template,
57 57
 			'heading'			=> $this->heading,
58 58
 			'teacher_id'		=> $teacher_id,
59 59
 			'learner_id'		=> $learner_id,
60 60
 			'learner_name'		=> $this->learner->display_name,
61 61
 			'course_id'			=> $course_id,
62
-		), $this->template );
62
+		), $this->template);
63 63
 
64 64
 		// Set recipient (learner)
65
-		$this->recipient = stripslashes( $this->teacher->user_email );
65
+		$this->recipient = stripslashes($this->teacher->user_email);
66 66
 
67 67
 		// Send mail
68
-		Sensei()->emails->send( $this->recipient, $this->subject, Sensei()->emails->get_content( $this->template ) );
68
+		Sensei()->emails->send($this->recipient, $this->subject, Sensei()->emails->get_content($this->template));
69 69
 	}
70 70
 }
71 71
 
Please login to merge, or discard this patch.
includes/admin/class-sensei-welcome.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @version     1.8.0
13 13
 */
14 14
 
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit; // Exit if accessed directly
17 17
 }
18 18
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function __construct() {
31 31
 
32
-        add_action( 'admin_menu', array( $this, 'admin_menus') );
33
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
32
+        add_action('admin_menu', array($this, 'admin_menus'));
33
+		add_action('admin_head', array($this, 'admin_head'));
34 34
 
35 35
 	}
36 36
 
@@ -40,23 +40,23 @@  discard block
 block discarded – undo
40 40
      * Hooked into activated_plugin
41 41
      * @since 1.8.0
42 42
      */
43
-    public static function redirect( $plugin ) {
43
+    public static function redirect($plugin) {
44 44
 
45 45
         // Bail if activating from network, or bulk, or within an iFrame
46
-        if ( is_network_admin() || isset( $_GET['activate-multi'] ) || defined( 'IFRAME_REQUEST' ) ) {
46
+        if (is_network_admin() || isset($_GET['activate-multi']) || defined('IFRAME_REQUEST')) {
47 47
 
48 48
             return;
49 49
 
50 50
         }
51 51
         // don't run for upgrades and for pages already on the welcome screen
52
-        if ( ( isset( $_GET['action'] ) && 'upgrade-plugin' == $_GET['action'] )
53
-            || ( ! empty( $_GET['page'] ) && $_GET['page'] === 'sensei-welcome' ) ) {
52
+        if ((isset($_GET['action']) && 'upgrade-plugin' == $_GET['action'])
53
+            || ( ! empty($_GET['page']) && $_GET['page'] === 'sensei-welcome')) {
54 54
 
55 55
             return;
56 56
 
57 57
         }
58 58
 
59
-        wp_redirect( admin_url( 'index.php?page=sensei-welcome' ) );
59
+        wp_redirect(admin_url('index.php?page=sensei-welcome'));
60 60
         exit;
61 61
     }
62 62
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function admin_menus() {
69 69
 
70
-		if ( ! isset( $_GET['page'] ) || 'sensei-welcome' != $_GET[ 'page' ] ) {
70
+		if ( ! isset($_GET['page']) || 'sensei-welcome' != $_GET['page']) {
71 71
 			return;
72 72
 		}
73 73
 
74
-		$welcome_page_name  = __( 'Sensei Activation', 'woothemes-sensei' );
75
-		$welcome_page_title = __( 'Welcome to Sensei', 'woothemes-sensei' );
76
-        add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'sensei-welcome', array( $this, 'welcome_screen' ) );
74
+		$welcome_page_name  = __('Sensei Activation', 'woothemes-sensei');
75
+		$welcome_page_title = __('Welcome to Sensei', 'woothemes-sensei');
76
+        add_dashboard_page($welcome_page_title, $welcome_page_name, 'manage_options', 'sensei-welcome', array($this, 'welcome_screen'));
77 77
 
78 78
 	}
79 79
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             <hr />
133 133
 
134 134
             <div class="return-to-dashboard">
135
-                <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'woothemes-sensei-settings' ), 'admin.php' ) ) ); ?>"><?php _e( 'Go to Sensei Settings', 'woothemes-sensei' ); ?></a>
135
+                <a href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'woothemes-sensei-settings'), 'admin.php'))); ?>"><?php _e('Go to Sensei Settings', 'woothemes-sensei'); ?></a>
136 136
             </div>
137 137
         </div>
138 138
     <?php
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	public function admin_head() {
145 145
         // remove the menu page so it is not visible in the admin side bar
146
-		remove_submenu_page( 'index.php', 'sensei-welcome' );
146
+		remove_submenu_page('index.php', 'sensei-welcome');
147 147
 		?>
148 148
 		<style type="text/css">
149 149
 			/*<![CDATA[*/
@@ -262,47 +262,47 @@  discard block
 block discarded – undo
262 262
 	private function intro() {
263 263
 
264 264
 		// Drop minor version if 0
265
-		$major_version = substr( Sensei()->version, 0, 3 );
265
+		$major_version = substr(Sensei()->version, 0, 3);
266 266
 
267 267
 		// Random tweet - must be kept to 102 chars to "fit"
268 268
 		$tweets        = array(
269 269
             'I\'ve just installed Sensei - A premium Learning Management plugin for #WordPress.'
270 270
 		);
271
-		shuffle( $tweets );
271
+		shuffle($tweets);
272 272
 		?>
273
-		<h1><?php printf( __( 'Welcome to Sensei %s', 'woothemes-sensei' ), $major_version ); ?></h1>
273
+		<h1><?php printf(__('Welcome to Sensei %s', 'woothemes-sensei'), $major_version); ?></h1>
274 274
 
275 275
 		<div class="about-text sensei-about-text">
276 276
 			<?php
277
-				if ( ! empty( $_GET['sensei-installed'] ) ) {
278
-					$message = __( 'Thanks, all done!', 'woothemes-sensei' );
279
-				} elseif ( ! empty( $_GET['sensei-updated'] ) ) {
280
-					$message = __( 'Thank you for updating to the latest version!', 'woothemes-sensei' );
277
+				if ( ! empty($_GET['sensei-installed'])) {
278
+					$message = __('Thanks, all done!', 'woothemes-sensei');
279
+				} elseif ( ! empty($_GET['sensei-updated'])) {
280
+					$message = __('Thank you for updating to the latest version!', 'woothemes-sensei');
281 281
 				} else {
282
-					$message = __( 'Thanks for installing!', 'woothemes-sensei' );
282
+					$message = __('Thanks for installing!', 'woothemes-sensei');
283 283
 				}
284 284
 
285
-				printf( __( '%s We hope you enjoy using Sensei %s.', 'woothemes-sensei' ), $message, $major_version );
285
+				printf(__('%s We hope you enjoy using Sensei %s.', 'woothemes-sensei'), $message, $major_version);
286 286
 			?>
287 287
 		</div>
288 288
 
289 289
 		<div class="sensei-badge">
290 290
             <?php
291
-                _e('Sensei by WooThemes','woothemes-sensei');
291
+                _e('Sensei by WooThemes', 'woothemes-sensei');
292 292
                 echo '<br />';
293 293
 
294
-                printf( __( 'Version %s', 'woothemes-sensei' ), Sensei()->version );
294
+                printf(__('Version %s', 'woothemes-sensei'), Sensei()->version);
295 295
             ?>
296 296
         </div>
297 297
 
298 298
 		<p class="sensei-actions">
299
-			<a href="<?php echo admin_url('admin.php?page=woothemes-sensei-settings'); ?>" class="button button-primary"><?php _e( 'Settings', 'woothemes-sensei' ); ?></a>
300
-			<a href="<?php echo esc_url( apply_filters( 'sensei_docs_url', 'http://docs.woothemes.com/documentation/plugins/sensei/', 'woothemes-sensei' ) ); ?>" class="docs button button-primary"><?php _e( 'Docs', 'woothemes-sensei' ); ?></a>
301
-			<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.woothemes.com/products/sensei" data-text="<?php echo esc_attr( $tweets[0] ); ?>" data-via="WooThemes" data-size="large">Tweet</a>
299
+			<a href="<?php echo admin_url('admin.php?page=woothemes-sensei-settings'); ?>" class="button button-primary"><?php _e('Settings', 'woothemes-sensei'); ?></a>
300
+			<a href="<?php echo esc_url(apply_filters('sensei_docs_url', 'http://docs.woothemes.com/documentation/plugins/sensei/', 'woothemes-sensei')); ?>" class="docs button button-primary"><?php _e('Docs', 'woothemes-sensei'); ?></a>
301
+			<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.woothemes.com/products/sensei" data-text="<?php echo esc_attr($tweets[0]); ?>" data-via="WooThemes" data-size="large">Tweet</a>
302 302
 			<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
303 303
 		</p>
304 304
 
305
-		<h2 > <?php _e( "What's New", 'woothemes-sensei' ); ?> </h2>
305
+		<h2 > <?php _e("What's New", 'woothemes-sensei'); ?> </h2>
306 306
 
307 307
 		<?php
308 308
 	}
Please login to merge, or discard this patch.