Completed
Push — master ( ec0479...7d92ba )
by Dwain
11:56
created
includes/shortcodes/class-sensei-legacy-shortcodes.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -103,8 +103,8 @@
 block discarded – undo
103 103
      *
104 104
      * @since 1.9.0
105 105
      *
106
-     * @param $title
107
-     * @param $shortcode_specific_override
106
+     * @param string $title
107
+     * @param string $shortcode_specific_override
108 108
      * @return string
109 109
      */
110 110
     public static function generate_shortcode_courses( $title , $shortcode_specific_override  ){
Please login to merge, or discard this patch.
Indentation   +249 added lines, -249 removed lines patch added patch discarded remove patch
@@ -10,323 +10,323 @@  discard block
 block discarded – undo
10 10
  */
11 11
 class Sensei_Legacy_Shortcodes {
12 12
 
13
-    /**
14
-     * Add the legacy shortcodes to WordPress
15
-     *
16
-     * @since 1.9.0
17
-     */
18
-    public static function init(){
19
-
20
-        add_shortcode( 'allcourses',      array( __CLASS__, 'all_courses' ) );
21
-        add_shortcode( 'newcourses',      array( __CLASS__,'new_courses' ) );
22
-        add_shortcode( 'featuredcourses', array( __CLASS__,'featured_courses') );
23
-        add_shortcode( 'freecourses',     array( __CLASS__,'free_courses') );
24
-        add_shortcode( 'paidcourses',     array( __CLASS__,'paid_courses') );
25
-        add_shortcode( 'usercourses',     array( __CLASS__,'user_courses' ) );
26
-
27
-    }
28
-    /**
29
-     * all_courses shortcode output function.
30
-     *
31
-     * The function should only be called indirectly through do_shortcode()
32
-     *
33
-     * @access public
34
-     * @param mixed $atts
35
-     * @param mixed $content (default: null)
36
-     * @return string
37
-     */
38
-    public static function all_courses( $atts, $content = null ) {
39
-
40
-        return self::generate_shortcode_courses( '', 'allcourses' ); // all courses but no title
41
-
42
-    } // all_courses()
43
-
44
-    /**
45
-     * paid_courses function.
46
-     *
47
-     * @access public
48
-     * @param mixed $atts
49
-     * @param mixed $content (default: null)
50
-     * @return string
51
-     */
52
-    public static function paid_courses( $atts, $content = null ) {
53
-
54
-        return self::generate_shortcode_courses( 'Paid Courses', 'paidcourses' );
55
-
56
-    } // End paid_courses()
57
-
58
-
59
-    /**
60
-     * featured_courses function.
61
-     *
62
-     * @access public
63
-     * @param mixed $atts
64
-     * @param mixed $content (default: null)
65
-     * @return string
66
-     */
67
-    public static function featured_courses( $atts, $content = null ) {
68
-
69
-        return self::generate_shortcode_courses( 'Featured Courses', 'featuredcourses' );
13
+	/**
14
+	 * Add the legacy shortcodes to WordPress
15
+	 *
16
+	 * @since 1.9.0
17
+	 */
18
+	public static function init(){
19
+
20
+		add_shortcode( 'allcourses',      array( __CLASS__, 'all_courses' ) );
21
+		add_shortcode( 'newcourses',      array( __CLASS__,'new_courses' ) );
22
+		add_shortcode( 'featuredcourses', array( __CLASS__,'featured_courses') );
23
+		add_shortcode( 'freecourses',     array( __CLASS__,'free_courses') );
24
+		add_shortcode( 'paidcourses',     array( __CLASS__,'paid_courses') );
25
+		add_shortcode( 'usercourses',     array( __CLASS__,'user_courses' ) );
26
+
27
+	}
28
+	/**
29
+	 * all_courses shortcode output function.
30
+	 *
31
+	 * The function should only be called indirectly through do_shortcode()
32
+	 *
33
+	 * @access public
34
+	 * @param mixed $atts
35
+	 * @param mixed $content (default: null)
36
+	 * @return string
37
+	 */
38
+	public static function all_courses( $atts, $content = null ) {
39
+
40
+		return self::generate_shortcode_courses( '', 'allcourses' ); // all courses but no title
41
+
42
+	} // all_courses()
43
+
44
+	/**
45
+	 * paid_courses function.
46
+	 *
47
+	 * @access public
48
+	 * @param mixed $atts
49
+	 * @param mixed $content (default: null)
50
+	 * @return string
51
+	 */
52
+	public static function paid_courses( $atts, $content = null ) {
53
+
54
+		return self::generate_shortcode_courses( 'Paid Courses', 'paidcourses' );
55
+
56
+	} // End paid_courses()
57
+
58
+
59
+	/**
60
+	 * featured_courses function.
61
+	 *
62
+	 * @access public
63
+	 * @param mixed $atts
64
+	 * @param mixed $content (default: null)
65
+	 * @return string
66
+	 */
67
+	public static function featured_courses( $atts, $content = null ) {
68
+
69
+		return self::generate_shortcode_courses( 'Featured Courses', 'featuredcourses' );
70 70
 
71
-    } // End featured_courses()
71
+	} // End featured_courses()
72 72
 
73
-    /**
74
-     * shortcode_free_courses function.
75
-     *
76
-     * @access public
77
-     * @param mixed $atts
78
-     * @param mixed $content (default: null)
79
-     * @return string
80
-     */
81
-    public static function free_courses( $atts, $content = null ) {
73
+	/**
74
+	 * shortcode_free_courses function.
75
+	 *
76
+	 * @access public
77
+	 * @param mixed $atts
78
+	 * @param mixed $content (default: null)
79
+	 * @return string
80
+	 */
81
+	public static function free_courses( $atts, $content = null ) {
82 82
 
83
-        return self::generate_shortcode_courses( 'Free Courses', 'freecourses' );
83
+		return self::generate_shortcode_courses( 'Free Courses', 'freecourses' );
84 84
 
85
-    } // End free_courses()
85
+	} // End free_courses()
86 86
 
87
-    /**
88
-     * shortcode_new_courses function.
89
-     *
90
-     * @access public
91
-     * @param mixed $atts
92
-     * @param mixed $content (default: null)
93
-     * @return string
94
-     */
95
-    public static function new_courses( $atts, $content = null ) {
87
+	/**
88
+	 * shortcode_new_courses function.
89
+	 *
90
+	 * @access public
91
+	 * @param mixed $atts
92
+	 * @param mixed $content (default: null)
93
+	 * @return string
94
+	 */
95
+	public static function new_courses( $atts, $content = null ) {
96 96
 
97
-        return self::generate_shortcode_courses( 'New Courses', 'newcourses' );
97
+		return self::generate_shortcode_courses( 'New Courses', 'newcourses' );
98 98
 
99
-    } // End new_courses()
99
+	} // End new_courses()
100 100
 
101
-    /**
102
-     * Generate courses adding a title.
103
-     *
104
-     * @since 1.9.0
105
-     *
106
-     * @param $title
107
-     * @param $shortcode_specific_override
108
-     * @return string
109
-     */
110
-    public static function generate_shortcode_courses( $title , $shortcode_specific_override  ){
101
+	/**
102
+	 * Generate courses adding a title.
103
+	 *
104
+	 * @since 1.9.0
105
+	 *
106
+	 * @param $title
107
+	 * @param $shortcode_specific_override
108
+	 * @return string
109
+	 */
110
+	public static function generate_shortcode_courses( $title , $shortcode_specific_override  ){
111 111
 
112
-        global  $shortcode_override, $posts_array;
112
+		global  $shortcode_override, $posts_array;
113 113
 
114
-        $shortcode_override = $shortcode_specific_override;
114
+		$shortcode_override = $shortcode_specific_override;
115 115
 
116
-        // do not show this short code if there is a shortcode int he url and
117
-        // this specific shortcode is not the one requested in the ur.
118
-        $specific_shortcode_requested = isset( $_GET['action'] ) ?  sanitize_text_field(  $_GET['action']  ) : '';
119
-        if( ! empty( $specific_shortcode_requested) &&
120
-            $specific_shortcode_requested != $shortcode_override ){
116
+		// do not show this short code if there is a shortcode int he url and
117
+		// this specific shortcode is not the one requested in the ur.
118
+		$specific_shortcode_requested = isset( $_GET['action'] ) ?  sanitize_text_field(  $_GET['action']  ) : '';
119
+		if( ! empty( $specific_shortcode_requested) &&
120
+			$specific_shortcode_requested != $shortcode_override ){
121 121
 
122
-            return '';
122
+			return '';
123 123
 
124
-        }
124
+		}
125 125
 
126
-        // loop and get all courses html
127
-        ob_start();
128
-        self::initialise_legacy_course_loop();
129
-        $courses = ob_get_clean();
126
+		// loop and get all courses html
127
+		ob_start();
128
+		self::initialise_legacy_course_loop();
129
+		$courses = ob_get_clean();
130 130
 
131
-        $content = '';
132
-        if( count( $posts_array ) > 0 ){
131
+		$content = '';
132
+		if( count( $posts_array ) > 0 ){
133 133
 
134
-            $before = empty($title)? '' : '<header class="archive-header"><h2>'. $title .'</h2></header>';
135
-            $before .= '<section id="main-course" class="course-container">';
134
+			$before = empty($title)? '' : '<header class="archive-header"><h2>'. $title .'</h2></header>';
135
+			$before .= '<section id="main-course" class="course-container">';
136 136
 
137
-            $after = '</section>';
137
+			$after = '</section>';
138 138
 
139
-            //assemble
140
-            $content = $before . $courses . $after;
139
+			//assemble
140
+			$content = $before . $courses . $after;
141 141
 
142
-        }
142
+		}
143 143
 
144
-        return $content;
144
+		return $content;
145 145
 
146
-    }// end generate_shortcode_courses
146
+	}// end generate_shortcode_courses
147 147
 
148 148
 
149
-    /**
150
-     * user_courses function.
151
-     *
152
-     * @access public
153
-     * @param mixed $atts
154
-     * @param mixed $content (default: null)
155
-     * @return string
156
-     */
157
-    public static function user_courses( $atts, $content = null ) {
158
-        global $shortcode_override;
159
-        extract( shortcode_atts( array(	'amount' => 0 ), $atts ) );
149
+	/**
150
+	 * user_courses function.
151
+	 *
152
+	 * @access public
153
+	 * @param mixed $atts
154
+	 * @param mixed $content (default: null)
155
+	 * @return string
156
+	 */
157
+	public static function user_courses( $atts, $content = null ) {
158
+		global $shortcode_override;
159
+		extract( shortcode_atts( array(	'amount' => 0 ), $atts ) );
160 160
 
161
-        $shortcode_override = 'usercourses';
161
+		$shortcode_override = 'usercourses';
162 162
 
163
-        ob_start();
163
+		ob_start();
164 164
 
165
-        if( is_user_logged_in() ){
165
+		if( is_user_logged_in() ){
166 166
 
167
-            Sensei_Templates::get_template( 'user/my-courses.php' );
167
+			Sensei_Templates::get_template( 'user/my-courses.php' );
168 168
 
169
-        }else{
169
+		}else{
170 170
 
171
-            Sensei()->frontend->sensei_login_form();
171
+			Sensei()->frontend->sensei_login_form();
172 172
 
173
-        }
173
+		}
174 174
 
175
-        $content = ob_get_clean();
176
-        return $content;
175
+		$content = ob_get_clean();
176
+		return $content;
177 177
 
178
-    } // End user_courses()
178
+	} // End user_courses()
179 179
 
180
-    /**
181
-     * This function is simply to honor the legacy
182
-     * loop-course.php for the old shortcodes.
183
-     * @since 1.9.0
184
-     */
185
-    public static function initialise_legacy_course_loop(){
180
+	/**
181
+	 * This function is simply to honor the legacy
182
+	 * loop-course.php for the old shortcodes.
183
+	 * @since 1.9.0
184
+	 */
185
+	public static function initialise_legacy_course_loop(){
186 186
 
187
-        global  $post, $wp_query, $shortcode_override, $course_excludes;
187
+		global  $post, $wp_query, $shortcode_override, $course_excludes;
188 188
 
189
-        // Handle Query Type
190
-        $query_type = '';
189
+		// Handle Query Type
190
+		$query_type = '';
191 191
 
192
-        if ( isset( $_GET[ 'action' ] ) && ( '' != esc_html( $_GET[ 'action' ] ) ) ) {
193
-            $query_type = esc_html( $_GET[ 'action' ] );
194
-        } // End If Statement
192
+		if ( isset( $_GET[ 'action' ] ) && ( '' != esc_html( $_GET[ 'action' ] ) ) ) {
193
+			$query_type = esc_html( $_GET[ 'action' ] );
194
+		} // End If Statement
195 195
 
196
-        if ( '' != $shortcode_override ) {
197
-            $query_type = $shortcode_override;
198
-        } // End If Statement
196
+		if ( '' != $shortcode_override ) {
197
+			$query_type = $shortcode_override;
198
+		} // End If Statement
199 199
 
200
-        if ( !is_array( $course_excludes ) ) { $course_excludes = array(); }
200
+		if ( !is_array( $course_excludes ) ) { $course_excludes = array(); }
201 201
 
202
-        // Check that query returns results
203
-        // Handle Pagination
204
-        $paged = $wp_query->get( 'paged' );
205
-        $paged = empty( $paged ) ? 1 : $paged;
202
+		// Check that query returns results
203
+		// Handle Pagination
204
+		$paged = $wp_query->get( 'paged' );
205
+		$paged = empty( $paged ) ? 1 : $paged;
206 206
 
207 207
 
208
-        // Check for pagination settings
209
-        if ( isset( Sensei()->settings->settings[ 'course_archive_amount' ] ) && ( 0 < absint( Sensei()->settings->settings[ 'course_archive_amount' ] ) ) ) {
208
+		// Check for pagination settings
209
+		if ( isset( Sensei()->settings->settings[ 'course_archive_amount' ] ) && ( 0 < absint( Sensei()->settings->settings[ 'course_archive_amount' ] ) ) ) {
210 210
 
211
-            $amount = absint( Sensei()->settings->settings[ 'course_archive_amount' ] );
211
+			$amount = absint( Sensei()->settings->settings[ 'course_archive_amount' ] );
212 212
 
213
-        } else {
213
+		} else {
214 214
 
215
-            $amount = $wp_query->get( 'posts_per_page' );
215
+			$amount = $wp_query->get( 'posts_per_page' );
216 216
 
217
-        } // End If Statement
217
+		} // End If Statement
218 218
 
219
-        // This is not a paginated page (or it's simply the first page of a paginated page/post)
219
+		// This is not a paginated page (or it's simply the first page of a paginated page/post)
220 220
 
221
-        global $posts_array;
222
-        $course_includes   = array();
221
+		global $posts_array;
222
+		$course_includes   = array();
223 223
 
224
-        $query_args = Sensei()->course->get_archive_query_args( $shortcode_override, $amount, $course_includes, $course_excludes );
225
-        $course_query = new WP_Query( $query_args );
226
-        $posts_array = $course_query->get_posts();
224
+		$query_args = Sensei()->course->get_archive_query_args( $shortcode_override, $amount, $course_includes, $course_excludes );
225
+		$course_query = new WP_Query( $query_args );
226
+		$posts_array = $course_query->get_posts();
227 227
 
228
-        // output the courses
229
-        if( ! empty( $posts_array ) ) {
228
+		// output the courses
229
+		if( ! empty( $posts_array ) ) {
230 230
 
231
-            //output all courses for current query
232
-            self::loop_courses( $course_query, $amount );
231
+			//output all courses for current query
232
+			self::loop_courses( $course_query, $amount );
233 233
 
234
-        }
234
+		}
235 235
 
236
-    }
236
+	}
237 237
 
238
-    /**
239
-     * Loop through courses in the query and output the infomration needed
240
-     *
241
-     * @since 1.9.0
242
-     *
243
-     * @param WP_Query $course_query
244
-     */
245
-    public static function loop_courses( $course_query, $amount ){
238
+	/**
239
+	 * Loop through courses in the query and output the infomration needed
240
+	 *
241
+	 * @since 1.9.0
242
+	 *
243
+	 * @param WP_Query $course_query
244
+	 */
245
+	public static function loop_courses( $course_query, $amount ){
246 246
 
247
-        global $shortcode_override, $posts_array, $post, $wp_query, $shortcode_override, $course_excludes, $course_includes;
247
+		global $shortcode_override, $posts_array, $post, $wp_query, $shortcode_override, $course_excludes, $course_includes;
248 248
 
249
-        if ( count( $course_query->get_posts() ) > 0 ) {
249
+		if ( count( $course_query->get_posts() ) > 0 ) {
250 250
 
251
-            do_action( 'sensei_course_archive_header', $shortcode_override );
251
+			do_action( 'sensei_course_archive_header', $shortcode_override );
252 252
 
253
-            foreach ( $course_query->get_posts() as $course){
253
+			foreach ( $course_query->get_posts() as $course){
254 254
 
255
-                // Make sure the other loops dont include the same post twice!
256
-                array_push( $course_excludes, $course->ID );
255
+				// Make sure the other loops dont include the same post twice!
256
+				array_push( $course_excludes, $course->ID );
257 257
 
258
-                // output the course markup
259
-                self::the_course( $course->ID );
258
+				// output the course markup
259
+				self::the_course( $course->ID );
260 260
 
261
-            } // End For Loop
261
+			} // End For Loop
262 262
 
263
-            // More and Prev links
264
-            $posts_array_query = new WP_Query(Sensei()->course->course_query( $shortcode_override, $amount, $course_includes, $course_excludes ) );
265
-            $posts_array       = $posts_array_query->get_posts();
266
-            $max_pages = $course_query->found_posts / $amount;
267
-            if ( '' != $shortcode_override && ( $max_pages > $course_query->get( 'paged' ) ) ) {
263
+			// More and Prev links
264
+			$posts_array_query = new WP_Query(Sensei()->course->course_query( $shortcode_override, $amount, $course_includes, $course_excludes ) );
265
+			$posts_array       = $posts_array_query->get_posts();
266
+			$max_pages = $course_query->found_posts / $amount;
267
+			if ( '' != $shortcode_override && ( $max_pages > $course_query->get( 'paged' ) ) ) {
268 268
 
269
-                switch( $shortcode_override ){
270
-                    case 'paidcourses':
271
-                        $filter = 'paid';
272
-                        break;
273
-                    case 'featuredcourses':
274
-                        $filter = 'featured';
275
-                        break;
276
-                    case 'freecourses':
277
-                        $filter = 'free';
278
-                        break;
279
-                    default:
280
-                        $filter = '';
281
-                        break;
282
-                }
269
+				switch( $shortcode_override ){
270
+					case 'paidcourses':
271
+						$filter = 'paid';
272
+						break;
273
+					case 'featuredcourses':
274
+						$filter = 'featured';
275
+						break;
276
+					case 'freecourses':
277
+						$filter = 'free';
278
+						break;
279
+					default:
280
+						$filter = '';
281
+						break;
282
+				}
283 283
 
284
-                $quer_args = array();
285
-                $quer_args[ 'paged' ] = '2';
286
-                if( !empty( $filter ) ){
287
-                    $quer_args[ 'course_filter' ] = $filter;
288
-                }
284
+				$quer_args = array();
285
+				$quer_args[ 'paged' ] = '2';
286
+				if( !empty( $filter ) ){
287
+					$quer_args[ 'course_filter' ] = $filter;
288
+				}
289 289
 
290
-                $course_pagination_link = get_post_type_archive_link( 'course' );
291
-                $more_link_text = esc_html( Sensei()->settings->settings[ 'course_archive_more_link_text' ] );
292
-                $more_link_url =  esc_url( add_query_arg( $quer_args, $course_pagination_link ) );
290
+				$course_pagination_link = get_post_type_archive_link( 'course' );
291
+				$more_link_text = esc_html( Sensei()->settings->settings[ 'course_archive_more_link_text' ] );
292
+				$more_link_url =  esc_url( add_query_arg( $quer_args, $course_pagination_link ) );
293 293
 
294
-                // next/more
295
-                $html  = '<div class="navigation"><div class="nav-next">';
296
-                $html .= '<a href="' . $more_link_url . '">';
297
-                $html .= $more_link_text;
298
-                $html .= '<span class="meta-nav"></span></a></div>';
294
+				// next/more
295
+				$html  = '<div class="navigation"><div class="nav-next">';
296
+				$html .= '<a href="' . $more_link_url . '">';
297
+				$html .= $more_link_text;
298
+				$html .= '<span class="meta-nav"></span></a></div>';
299 299
 
300
-                echo apply_filters( 'course_archive_next_link', $html );
300
+				echo apply_filters( 'course_archive_next_link', $html );
301 301
 
302
-            } // End If Statement
302
+			} // End If Statement
303 303
 
304
-        } // End If Statement
305
-    }
304
+		} // End If Statement
305
+	}
306 306
 
307
-    /**
308
-     * Print a single course markup
309
-     *
310
-     * @param $course_id
311
-     */
312
-    public static function the_course( $course_id ){
307
+	/**
308
+	 * Print a single course markup
309
+	 *
310
+	 * @param $course_id
311
+	 */
312
+	public static function the_course( $course_id ){
313 313
 
314
-        // Get meta data
315
-        $course =  get_post( $course_id );
316
-        $user_info = get_userdata( absint( $course->post_author ) );
317
-        $author_link = get_author_posts_url( absint( $course->post_author ) );
318
-        $author_display_name = $user_info->display_name;
319
-        $author_id = $course->post_author;
320
-        $category_output = get_the_term_list( $course_id, 'course-category', '', ', ', '' );
321
-        $preview_lesson_count = intval( Sensei()->course->course_lesson_preview_count( $course_id ) );
322
-        $is_user_taking_course = WooThemes_Sensei_Utils::user_started_course( $course_id, get_current_user_id() );
323
-        ?>
314
+		// Get meta data
315
+		$course =  get_post( $course_id );
316
+		$user_info = get_userdata( absint( $course->post_author ) );
317
+		$author_link = get_author_posts_url( absint( $course->post_author ) );
318
+		$author_display_name = $user_info->display_name;
319
+		$author_id = $course->post_author;
320
+		$category_output = get_the_term_list( $course_id, 'course-category', '', ', ', '' );
321
+		$preview_lesson_count = intval( Sensei()->course->course_lesson_preview_count( $course_id ) );
322
+		$is_user_taking_course = WooThemes_Sensei_Utils::user_started_course( $course_id, get_current_user_id() );
323
+		?>
324 324
 
325 325
         <article class="<?php echo esc_attr( join( ' ', get_post_class( array( 'course', 'post' ), $course_id ) ) ); ?>">
326 326
             <?php
327
-            // so that legacy shortcodes work with thir party plugins that wants to hook in
328
-            do_action('sensei_course_content_before',$course );
329
-            ?>
327
+			// so that legacy shortcodes work with thir party plugins that wants to hook in
328
+			do_action('sensei_course_content_before',$course );
329
+			?>
330 330
             <div class="course-content">
331 331
 
332 332
                 <?php Sensei()->course->course_image($course_id); ?>
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
                     </p>
363 363
 
364 364
                     <?php if ( 0 < $preview_lesson_count && !$is_user_taking_course ) {
365
-                        $preview_lessons = sprintf( __( '(%d preview lessons)', 'woothemes-sensei' ), $preview_lesson_count ); ?>
365
+						$preview_lessons = sprintf( __( '(%d preview lessons)', 'woothemes-sensei' ), $preview_lesson_count ); ?>
366 366
                         <p class="sensei-free-lessons">
367 367
                             <a href="<?php echo get_permalink( $course_id ); ?>"><?php _e( 'Preview this course', 'woothemes-sensei' ) ?>
368 368
                             </a> - <?php echo $preview_lessons; ?>
@@ -373,15 +373,15 @@  discard block
 block discarded – undo
373 373
 
374 374
             </div>
375 375
             <?php
376
-            // so that legacy shortcodes work with thir party plugins that wants to hook in
377
-            do_action('sensei_course_content_after', $course);
378
-            ?>
376
+			// so that legacy shortcodes work with thir party plugins that wants to hook in
377
+			do_action('sensei_course_content_after', $course);
378
+			?>
379 379
 
380 380
         </article>
381 381
 
382 382
         <?php
383 383
 
384 384
 
385
-    } // end the_course
385
+	} // end the_course
386 386
 
387 387
 }// end class legacy shortcodes
388 388
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
15 15
      *
16 16
      * @since 1.9.0
17 17
      */
18
-    public static function init(){
18
+    public static function init() {
19 19
 
20
-        add_shortcode( 'allcourses',      array( __CLASS__, 'all_courses' ) );
21
-        add_shortcode( 'newcourses',      array( __CLASS__,'new_courses' ) );
22
-        add_shortcode( 'featuredcourses', array( __CLASS__,'featured_courses') );
23
-        add_shortcode( 'freecourses',     array( __CLASS__,'free_courses') );
24
-        add_shortcode( 'paidcourses',     array( __CLASS__,'paid_courses') );
25
-        add_shortcode( 'usercourses',     array( __CLASS__,'user_courses' ) );
20
+        add_shortcode('allcourses', array(__CLASS__, 'all_courses'));
21
+        add_shortcode('newcourses', array(__CLASS__, 'new_courses'));
22
+        add_shortcode('featuredcourses', array(__CLASS__, 'featured_courses'));
23
+        add_shortcode('freecourses', array(__CLASS__, 'free_courses'));
24
+        add_shortcode('paidcourses', array(__CLASS__, 'paid_courses'));
25
+        add_shortcode('usercourses', array(__CLASS__, 'user_courses'));
26 26
 
27 27
     }
28 28
     /**
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
      * @param mixed $content (default: null)
36 36
      * @return string
37 37
      */
38
-    public static function all_courses( $atts, $content = null ) {
38
+    public static function all_courses($atts, $content = null) {
39 39
 
40
-        return self::generate_shortcode_courses( '', 'allcourses' ); // all courses but no title
40
+        return self::generate_shortcode_courses('', 'allcourses'); // all courses but no title
41 41
 
42 42
     } // all_courses()
43 43
 
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
      * @param mixed $content (default: null)
50 50
      * @return string
51 51
      */
52
-    public static function paid_courses( $atts, $content = null ) {
52
+    public static function paid_courses($atts, $content = null) {
53 53
 
54
-        return self::generate_shortcode_courses( 'Paid Courses', 'paidcourses' );
54
+        return self::generate_shortcode_courses('Paid Courses', 'paidcourses');
55 55
 
56 56
     } // End paid_courses()
57 57
 
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
      * @param mixed $content (default: null)
65 65
      * @return string
66 66
      */
67
-    public static function featured_courses( $atts, $content = null ) {
67
+    public static function featured_courses($atts, $content = null) {
68 68
 
69
-        return self::generate_shortcode_courses( 'Featured Courses', 'featuredcourses' );
69
+        return self::generate_shortcode_courses('Featured Courses', 'featuredcourses');
70 70
 
71 71
     } // End featured_courses()
72 72
 
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
      * @param mixed $content (default: null)
79 79
      * @return string
80 80
      */
81
-    public static function free_courses( $atts, $content = null ) {
81
+    public static function free_courses($atts, $content = null) {
82 82
 
83
-        return self::generate_shortcode_courses( 'Free Courses', 'freecourses' );
83
+        return self::generate_shortcode_courses('Free Courses', 'freecourses');
84 84
 
85 85
     } // End free_courses()
86 86
 
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
      * @param mixed $content (default: null)
93 93
      * @return string
94 94
      */
95
-    public static function new_courses( $atts, $content = null ) {
95
+    public static function new_courses($atts, $content = null) {
96 96
 
97
-        return self::generate_shortcode_courses( 'New Courses', 'newcourses' );
97
+        return self::generate_shortcode_courses('New Courses', 'newcourses');
98 98
 
99 99
     } // End new_courses()
100 100
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      * @param $shortcode_specific_override
108 108
      * @return string
109 109
      */
110
-    public static function generate_shortcode_courses( $title , $shortcode_specific_override  ){
110
+    public static function generate_shortcode_courses($title, $shortcode_specific_override) {
111 111
 
112 112
         global  $shortcode_override, $posts_array;
113 113
 
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 
116 116
         // do not show this short code if there is a shortcode int he url and
117 117
         // this specific shortcode is not the one requested in the ur.
118
-        $specific_shortcode_requested = isset( $_GET['action'] ) ?  sanitize_text_field(  $_GET['action']  ) : '';
119
-        if( ! empty( $specific_shortcode_requested) &&
120
-            $specific_shortcode_requested != $shortcode_override ){
118
+        $specific_shortcode_requested = isset($_GET['action']) ? sanitize_text_field($_GET['action']) : '';
119
+        if ( ! empty($specific_shortcode_requested) &&
120
+            $specific_shortcode_requested != $shortcode_override) {
121 121
 
122 122
             return '';
123 123
 
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
         $courses = ob_get_clean();
130 130
 
131 131
         $content = '';
132
-        if( count( $posts_array ) > 0 ){
132
+        if (count($posts_array) > 0) {
133 133
 
134
-            $before = empty($title)? '' : '<header class="archive-header"><h2>'. $title .'</h2></header>';
134
+            $before = empty($title) ? '' : '<header class="archive-header"><h2>'.$title.'</h2></header>';
135 135
             $before .= '<section id="main-course" class="course-container">';
136 136
 
137 137
             $after = '</section>';
138 138
 
139 139
             //assemble
140
-            $content = $before . $courses . $after;
140
+            $content = $before.$courses.$after;
141 141
 
142 142
         }
143 143
 
@@ -154,19 +154,19 @@  discard block
 block discarded – undo
154 154
      * @param mixed $content (default: null)
155 155
      * @return string
156 156
      */
157
-    public static function user_courses( $atts, $content = null ) {
157
+    public static function user_courses($atts, $content = null) {
158 158
         global $shortcode_override;
159
-        extract( shortcode_atts( array(	'amount' => 0 ), $atts ) );
159
+        extract(shortcode_atts(array('amount' => 0), $atts));
160 160
 
161 161
         $shortcode_override = 'usercourses';
162 162
 
163 163
         ob_start();
164 164
 
165
-        if( is_user_logged_in() ){
165
+        if (is_user_logged_in()) {
166 166
 
167
-            Sensei_Templates::get_template( 'user/my-courses.php' );
167
+            Sensei_Templates::get_template('user/my-courses.php');
168 168
 
169
-        }else{
169
+        } else {
170 170
 
171 171
             Sensei()->frontend->sensei_login_form();
172 172
 
@@ -182,54 +182,54 @@  discard block
 block discarded – undo
182 182
      * loop-course.php for the old shortcodes.
183 183
      * @since 1.9.0
184 184
      */
185
-    public static function initialise_legacy_course_loop(){
185
+    public static function initialise_legacy_course_loop() {
186 186
 
187 187
         global  $post, $wp_query, $shortcode_override, $course_excludes;
188 188
 
189 189
         // Handle Query Type
190 190
         $query_type = '';
191 191
 
192
-        if ( isset( $_GET[ 'action' ] ) && ( '' != esc_html( $_GET[ 'action' ] ) ) ) {
193
-            $query_type = esc_html( $_GET[ 'action' ] );
192
+        if (isset($_GET['action']) && ('' != esc_html($_GET['action']))) {
193
+            $query_type = esc_html($_GET['action']);
194 194
         } // End If Statement
195 195
 
196
-        if ( '' != $shortcode_override ) {
196
+        if ('' != $shortcode_override) {
197 197
             $query_type = $shortcode_override;
198 198
         } // End If Statement
199 199
 
200
-        if ( !is_array( $course_excludes ) ) { $course_excludes = array(); }
200
+        if ( ! is_array($course_excludes)) { $course_excludes = array(); }
201 201
 
202 202
         // Check that query returns results
203 203
         // Handle Pagination
204
-        $paged = $wp_query->get( 'paged' );
205
-        $paged = empty( $paged ) ? 1 : $paged;
204
+        $paged = $wp_query->get('paged');
205
+        $paged = empty($paged) ? 1 : $paged;
206 206
 
207 207
 
208 208
         // Check for pagination settings
209
-        if ( isset( Sensei()->settings->settings[ 'course_archive_amount' ] ) && ( 0 < absint( Sensei()->settings->settings[ 'course_archive_amount' ] ) ) ) {
209
+        if (isset(Sensei()->settings->settings['course_archive_amount']) && (0 < absint(Sensei()->settings->settings['course_archive_amount']))) {
210 210
 
211
-            $amount = absint( Sensei()->settings->settings[ 'course_archive_amount' ] );
211
+            $amount = absint(Sensei()->settings->settings['course_archive_amount']);
212 212
 
213 213
         } else {
214 214
 
215
-            $amount = $wp_query->get( 'posts_per_page' );
215
+            $amount = $wp_query->get('posts_per_page');
216 216
 
217 217
         } // End If Statement
218 218
 
219 219
         // This is not a paginated page (or it's simply the first page of a paginated page/post)
220 220
 
221 221
         global $posts_array;
222
-        $course_includes   = array();
222
+        $course_includes = array();
223 223
 
224
-        $query_args = Sensei()->course->get_archive_query_args( $shortcode_override, $amount, $course_includes, $course_excludes );
225
-        $course_query = new WP_Query( $query_args );
224
+        $query_args = Sensei()->course->get_archive_query_args($shortcode_override, $amount, $course_includes, $course_excludes);
225
+        $course_query = new WP_Query($query_args);
226 226
         $posts_array = $course_query->get_posts();
227 227
 
228 228
         // output the courses
229
-        if( ! empty( $posts_array ) ) {
229
+        if ( ! empty($posts_array)) {
230 230
 
231 231
             //output all courses for current query
232
-            self::loop_courses( $course_query, $amount );
232
+            self::loop_courses($course_query, $amount);
233 233
 
234 234
         }
235 235
 
@@ -242,31 +242,31 @@  discard block
 block discarded – undo
242 242
      *
243 243
      * @param WP_Query $course_query
244 244
      */
245
-    public static function loop_courses( $course_query, $amount ){
245
+    public static function loop_courses($course_query, $amount) {
246 246
 
247 247
         global $shortcode_override, $posts_array, $post, $wp_query, $shortcode_override, $course_excludes, $course_includes;
248 248
 
249
-        if ( count( $course_query->get_posts() ) > 0 ) {
249
+        if (count($course_query->get_posts()) > 0) {
250 250
 
251
-            do_action( 'sensei_course_archive_header', $shortcode_override );
251
+            do_action('sensei_course_archive_header', $shortcode_override);
252 252
 
253
-            foreach ( $course_query->get_posts() as $course){
253
+            foreach ($course_query->get_posts() as $course) {
254 254
 
255 255
                 // Make sure the other loops dont include the same post twice!
256
-                array_push( $course_excludes, $course->ID );
256
+                array_push($course_excludes, $course->ID);
257 257
 
258 258
                 // output the course markup
259
-                self::the_course( $course->ID );
259
+                self::the_course($course->ID);
260 260
 
261 261
             } // End For Loop
262 262
 
263 263
             // More and Prev links
264
-            $posts_array_query = new WP_Query(Sensei()->course->course_query( $shortcode_override, $amount, $course_includes, $course_excludes ) );
264
+            $posts_array_query = new WP_Query(Sensei()->course->course_query($shortcode_override, $amount, $course_includes, $course_excludes));
265 265
             $posts_array       = $posts_array_query->get_posts();
266 266
             $max_pages = $course_query->found_posts / $amount;
267
-            if ( '' != $shortcode_override && ( $max_pages > $course_query->get( 'paged' ) ) ) {
267
+            if ('' != $shortcode_override && ($max_pages > $course_query->get('paged'))) {
268 268
 
269
-                switch( $shortcode_override ){
269
+                switch ($shortcode_override) {
270 270
                     case 'paidcourses':
271 271
                         $filter = 'paid';
272 272
                         break;
@@ -282,22 +282,22 @@  discard block
 block discarded – undo
282 282
                 }
283 283
 
284 284
                 $quer_args = array();
285
-                $quer_args[ 'paged' ] = '2';
286
-                if( !empty( $filter ) ){
287
-                    $quer_args[ 'course_filter' ] = $filter;
285
+                $quer_args['paged'] = '2';
286
+                if ( ! empty($filter)) {
287
+                    $quer_args['course_filter'] = $filter;
288 288
                 }
289 289
 
290
-                $course_pagination_link = get_post_type_archive_link( 'course' );
291
-                $more_link_text = esc_html( Sensei()->settings->settings[ 'course_archive_more_link_text' ] );
292
-                $more_link_url =  esc_url( add_query_arg( $quer_args, $course_pagination_link ) );
290
+                $course_pagination_link = get_post_type_archive_link('course');
291
+                $more_link_text = esc_html(Sensei()->settings->settings['course_archive_more_link_text']);
292
+                $more_link_url = esc_url(add_query_arg($quer_args, $course_pagination_link));
293 293
 
294 294
                 // next/more
295 295
                 $html  = '<div class="navigation"><div class="nav-next">';
296
-                $html .= '<a href="' . $more_link_url . '">';
296
+                $html .= '<a href="'.$more_link_url.'">';
297 297
                 $html .= $more_link_text;
298 298
                 $html .= '<span class="meta-nav"></span></a></div>';
299 299
 
300
-                echo apply_filters( 'course_archive_next_link', $html );
300
+                echo apply_filters('course_archive_next_link', $html);
301 301
 
302 302
             } // End If Statement
303 303
 
@@ -309,23 +309,23 @@  discard block
 block discarded – undo
309 309
      *
310 310
      * @param $course_id
311 311
      */
312
-    public static function the_course( $course_id ){
312
+    public static function the_course($course_id) {
313 313
 
314 314
         // Get meta data
315
-        $course =  get_post( $course_id );
316
-        $user_info = get_userdata( absint( $course->post_author ) );
317
-        $author_link = get_author_posts_url( absint( $course->post_author ) );
315
+        $course = get_post($course_id);
316
+        $user_info = get_userdata(absint($course->post_author));
317
+        $author_link = get_author_posts_url(absint($course->post_author));
318 318
         $author_display_name = $user_info->display_name;
319 319
         $author_id = $course->post_author;
320
-        $category_output = get_the_term_list( $course_id, 'course-category', '', ', ', '' );
321
-        $preview_lesson_count = intval( Sensei()->course->course_lesson_preview_count( $course_id ) );
322
-        $is_user_taking_course = WooThemes_Sensei_Utils::user_started_course( $course_id, get_current_user_id() );
320
+        $category_output = get_the_term_list($course_id, 'course-category', '', ', ', '');
321
+        $preview_lesson_count = intval(Sensei()->course->course_lesson_preview_count($course_id));
322
+        $is_user_taking_course = WooThemes_Sensei_Utils::user_started_course($course_id, get_current_user_id());
323 323
         ?>
324 324
 
325
-        <article class="<?php echo esc_attr( join( ' ', get_post_class( array( 'course', 'post' ), $course_id ) ) ); ?>">
325
+        <article class="<?php echo esc_attr(join(' ', get_post_class(array('course', 'post'), $course_id))); ?>">
326 326
             <?php
327 327
             // so that legacy shortcodes work with thir party plugins that wants to hook in
328
-            do_action('sensei_course_content_before',$course );
328
+            do_action('sensei_course_content_before', $course);
329 329
             ?>
330 330
             <div class="course-content">
331 331
 
@@ -341,19 +341,19 @@  discard block
 block discarded – undo
341 341
 
342 342
                     <p class="sensei-course-meta">
343 343
 
344
-                        <?php if ( isset( Sensei()->settings->settings[ 'course_author' ] ) && ( Sensei()->settings->settings[ 'course_author' ] ) ) { ?>
345
-                            <span class="course-author"><?php _e( 'by ', 'woothemes-sensei' ); ?><a href="<?php echo $author_link; ?>" title="<?php echo esc_attr( $author_display_name ); ?>"><?php echo esc_html( $author_display_name   ); ?></a></span>
344
+                        <?php if (isset(Sensei()->settings->settings['course_author']) && (Sensei()->settings->settings['course_author'])) { ?>
345
+                            <span class="course-author"><?php _e('by ', 'woothemes-sensei'); ?><a href="<?php echo $author_link; ?>" title="<?php echo esc_attr($author_display_name); ?>"><?php echo esc_html($author_display_name); ?></a></span>
346 346
                         <?php } // End If Statement ?>
347 347
 
348 348
                         <span class="course-lesson-count">
349
-                                    <?php echo Sensei()->course->course_lesson_count( $course_id ) . '&nbsp;' .  __( 'Lessons', 'woothemes-sensei' ); ?>
349
+                                    <?php echo Sensei()->course->course_lesson_count($course_id).'&nbsp;'.__('Lessons', 'woothemes-sensei'); ?>
350 350
                                 </span>
351 351
 
352
-                        <?php if ( '' != $category_output ) { ?>
353
-                            <span class="course-category"><?php echo sprintf( __( 'in %s', 'woothemes-sensei' ), $category_output ); ?></span>
352
+                        <?php if ('' != $category_output) { ?>
353
+                            <span class="course-category"><?php echo sprintf(__('in %s', 'woothemes-sensei'), $category_output); ?></span>
354 354
                         <?php } // End If Statement ?>
355 355
 
356
-                        <?php sensei_simple_course_price( $course_id ); ?>
356
+                        <?php sensei_simple_course_price($course_id); ?>
357 357
 
358 358
                     </p>
359 359
 
@@ -361,10 +361,10 @@  discard block
 block discarded – undo
361 361
 
362 362
                     </p>
363 363
 
364
-                    <?php if ( 0 < $preview_lesson_count && !$is_user_taking_course ) {
365
-                        $preview_lessons = sprintf( __( '(%d preview lessons)', 'woothemes-sensei' ), $preview_lesson_count ); ?>
364
+                    <?php if (0 < $preview_lesson_count && ! $is_user_taking_course) {
365
+                        $preview_lessons = sprintf(__('(%d preview lessons)', 'woothemes-sensei'), $preview_lesson_count); ?>
366 366
                         <p class="sensei-free-lessons">
367
-                            <a href="<?php echo get_permalink( $course_id ); ?>"><?php _e( 'Preview this course', 'woothemes-sensei' ) ?>
367
+                            <a href="<?php echo get_permalink($course_id); ?>"><?php _e('Preview this course', 'woothemes-sensei') ?>
368 368
                             </a> - <?php echo $preview_lessons; ?>
369 369
                         </p>
370 370
                     <?php } ?>
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@
 block discarded – undo
166 166
 
167 167
             Sensei_Templates::get_template( 'user/my-courses.php' );
168 168
 
169
-        }else{
169
+        } else{
170 170
 
171 171
             Sensei()->frontend->sensei_login_form();
172 172
 
Please login to merge, or discard this patch.
includes/shortcodes/class-sensei-shortcode-course-categories.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@
 block discarded – undo
114 114
      *
115 115
      * @since 1.9.0
116 116
      *
117
-     * @param array $category_ids
117
+     * @param array $categories
118 118
      * @return array
119 119
      */
120 120
     public function generate_term_ids( $categories = array() ){
Please login to merge, or discard this patch.
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -24,135 +24,135 @@
 block discarded – undo
24 24
  */
25 25
 class Sensei_Shortcode_Course_Categories implements Sensei_Shortcode_Interface {
26 26
 
27
-    /**
28
-     * @var array list of taxonomy terms.
29
-     */
30
-    protected $sensei_course_taxonomy_terms;
27
+	/**
28
+	 * @var array list of taxonomy terms.
29
+	 */
30
+	protected $sensei_course_taxonomy_terms;
31 31
 
32
-    /**
33
-     * Setup the shortcode object
34
-     *
35
-     * @since 1.9.0
36
-     * @param array $attributes
37
-     * @param string $content
38
-     * @param string $shortcode the shortcode that was called for this instance
39
-     */
40
-    public function __construct( $attributes, $content, $shortcode ){
32
+	/**
33
+	 * Setup the shortcode object
34
+	 *
35
+	 * @since 1.9.0
36
+	 * @param array $attributes
37
+	 * @param string $content
38
+	 * @param string $shortcode the shortcode that was called for this instance
39
+	 */
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
-        // 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;
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;
56 56
 
57
-        $this->setup_course_categories();
57
+		$this->setup_course_categories();
58 58
 
59
-    }
59
+	}
60 60
 
61
-    /**
62
-     * create the messages query .
63
-     *
64
-     * @return mixed
65
-     */
66
-    public function setup_course_categories(){
61
+	/**
62
+	 * create the messages query .
63
+	 *
64
+	 * @return mixed
65
+	 */
66
+	public function setup_course_categories(){
67 67
 
68
-        $args = array(
69
-            'orderby'       => $this->orderby,
70
-            'order'         => $this->order,
71
-            'exclude'       => $this->exclude,
72
-            'include'       => $this->include,
73
-            'number'        => $this->number,
74
-            'parent'        => $this->parent,
75
-            'hide_empty'    => $this->hide_empty,
76
-            'fields'        => 'all',
77
-        );
68
+		$args = array(
69
+			'orderby'       => $this->orderby,
70
+			'order'         => $this->order,
71
+			'exclude'       => $this->exclude,
72
+			'include'       => $this->include,
73
+			'number'        => $this->number,
74
+			'parent'        => $this->parent,
75
+			'hide_empty'    => $this->hide_empty,
76
+			'fields'        => 'all',
77
+		);
78 78
 
79
-        $this->sensei_course_taxonomy_terms = get_terms('course-category', $args);
79
+		$this->sensei_course_taxonomy_terms = get_terms('course-category', $args);
80 80
 
81
-    }
81
+	}
82 82
 
83
-    /**
84
-     * Rendering the shortcode this class is responsible for.
85
-     *
86
-     * @return string $content
87
-     */
88
-    public function render(){
83
+	/**
84
+	 * Rendering the shortcode this class is responsible for.
85
+	 *
86
+	 * @return string $content
87
+	 */
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
 
96
-        $terms_html = '';
96
+		$terms_html = '';
97 97
 
98
-        //set the wp_query to the current messages query
99
-        $terms_html .= '<ul class="sensei course-categories">';
100
-        foreach( $this->sensei_course_taxonomy_terms as $category ){
98
+		//set the wp_query to the current messages query
99
+		$terms_html .= '<ul class="sensei course-categories">';
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
-        }
106
-        $terms_html .= '<ul>';
105
+		}
106
+		$terms_html .= '<ul>';
107 107
 
108
-        return $terms_html;
108
+		return $terms_html;
109 109
 
110
-    }// end render
110
+	}// end render
111 111
 
112
-    /**
113
-     * Convert an array of mixed ids, slugs or names to only the id's of those terms
114
-     *
115
-     * @since 1.9.0
116
-     *
117
-     * @param array $category_ids
118
-     * @return array
119
-     */
120
-    public function generate_term_ids( $categories = array() ){
112
+	/**
113
+	 * Convert an array of mixed ids, slugs or names to only the id's of those terms
114
+	 *
115
+	 * @since 1.9.0
116
+	 *
117
+	 * @param array $category_ids
118
+	 * @return array
119
+	 */
120
+	public function generate_term_ids( $categories = array() ){
121 121
 
122
-        $cat_ids = array();
122
+		$cat_ids = array();
123 123
 
124
-        if ( is_array($categories) ) {
125
-            foreach ($categories as $cat) {
124
+		if ( is_array($categories) ) {
125
+			foreach ($categories as $cat) {
126 126
 
127
-                if (!is_numeric($cat)) {
127
+				if (!is_numeric($cat)) {
128 128
 
129
-                    // try the slug
130
-                    $term = get_term_by('slug', $cat, 'course-category');
129
+					// try the slug
130
+					$term = get_term_by('slug', $cat, 'course-category');
131 131
 
132
-                    // if the slug didn't work try the name
133
-                    if (!$term) {
132
+					// if the slug didn't work try the name
133
+					if (!$term) {
134 134
 
135
-                        $term = get_term_by('name', $cat, 'course-category');
135
+						$term = get_term_by('name', $cat, 'course-category');
136 136
 
137
-                    }
137
+					}
138 138
 
139
-                    if ($term) {
140
-                        $cat_ids[] = $term->term_id;
141
-                    }
139
+					if ($term) {
140
+						$cat_ids[] = $term->term_id;
141
+					}
142 142
 
143
-                } else {
143
+				} else {
144 144
 
145
-                    $cat_ids[] = $cat;
145
+					$cat_ids[] = $cat;
146 146
 
147
-                }
147
+				}
148 148
 
149
-            }
149
+			}
150 150
 
151
-        }
151
+		}
152 152
 
153
-        return $cat_ids;
153
+		return $cat_ids;
154 154
 
155
-    }// end generate_term_ids
155
+	}// end generate_term_ids
156 156
 
157 157
 }// end class
158 158
 
Please login to merge, or discard this 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.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
5
+// Exit if accessed directly
3 6
 
4 7
 /**
5 8
  * Sensei Analysis User Profile List Table Class
Please login to merge, or discard this patch.
includes/shortcodes/class-sensei-shortcode-user-courses.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -325,7 +325,7 @@
 block discarded – undo
325 325
      *
326 326
      * @param array $classes
327 327
      * @param WP_Post $course
328
-     * @return array $classes
328
+     * @return string[] $classes
329 329
      */
330 330
     public function course_status_class_tagging($classes, $course){
331 331
 
Please login to merge, or discard this patch.
Indentation   +231 added lines, -231 removed lines patch added patch discarded remove patch
@@ -23,165 +23,165 @@  discard block
 block discarded – undo
23 23
  */
24 24
 class Sensei_Shortcode_User_Courses implements Sensei_Shortcode_Interface {
25 25
 
26
-    /**
27
-     * @var WP_Query to help setup the query needed by the render method.
28
-     */
29
-    protected $query;
26
+	/**
27
+	 * @var WP_Query to help setup the query needed by the render method.
28
+	 */
29
+	protected $query;
30 30
 
31
-    /**
32
-     * @var string number of items to show on the current page
33
-     * Default: -1.
34
-     */
35
-    protected $number;
31
+	/**
32
+	 * @var string number of items to show on the current page
33
+	 * Default: -1.
34
+	 */
35
+	protected $number;
36 36
 
37
-    /**
38
-     * @var string ordery by course field
39
-     * Default: date
40
-     */
41
-    protected $orderby;
37
+	/**
38
+	 * @var string ordery by course field
39
+	 * Default: date
40
+	 */
41
+	protected $orderby;
42 42
 
43
-    /**
44
-     * @var string ASC or DESC
45
-     * Default: 'DESC'
46
-     */
47
-    protected  $order;
43
+	/**
44
+	 * @var string ASC or DESC
45
+	 * Default: 'DESC'
46
+	 */
47
+	protected  $order;
48 48
 
49
-    /**
50
-     * @var status can be completed or active. If none is specified all will be shown
51
-     */
52
-    protected $status;
49
+	/**
50
+	 * @var status can be completed or active. If none is specified all will be shown
51
+	 */
52
+	protected $status;
53 53
 
54
-    /**
55
-     * Setup the shortcode object
56
-     *
57
-     * @since 1.9.0
58
-     * @param array $attributes
59
-     * @param string $content
60
-     * @param string $shortcode the shortcode that was called for this instance
61
-     */
62
-    public function __construct( $attributes, $content, $shortcode ){
54
+	/**
55
+	 * Setup the shortcode object
56
+	 *
57
+	 * @since 1.9.0
58
+	 * @param array $attributes
59
+	 * @param string $content
60
+	 * @param string $shortcode the shortcode that was called for this instance
61
+	 */
62
+	public function __construct( $attributes, $content, $shortcode ){
63 63
 
64
-        if(!  is_user_logged_in() ) {
65
-            return;
66
-        }
64
+		if(!  is_user_logged_in() ) {
65
+			return;
66
+		}
67 67
 
68
-        // set up all argument need for constructing the course query
69
-        $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '10';
70
-        $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'title';
71
-        $this->status = isset( $attributes['status'] ) ? $attributes['status'] : 'all';
68
+		// set up all argument need for constructing the course query
69
+		$this->number = isset( $attributes['number'] ) ? $attributes['number'] : '10';
70
+		$this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'title';
71
+		$this->status = isset( $attributes['status'] ) ? $attributes['status'] : 'all';
72 72
 
73
-        // set the default for menu_order to be ASC
74
-        if( 'menu_order' == $this->orderby && !isset( $attributes['order']  ) ){
73
+		// set the default for menu_order to be ASC
74
+		if( 'menu_order' == $this->orderby && !isset( $attributes['order']  ) ){
75 75
 
76
-            $this->order =  'ASC';
76
+			$this->order =  'ASC';
77 77
 
78
-        }else{
78
+		}else{
79 79
 
80
-            // for everything else use the value passed or the default DESC
81
-            $this->order = isset( $attributes['order']  ) ? $attributes['order'] : 'ASC';
80
+			// for everything else use the value passed or the default DESC
81
+			$this->order = isset( $attributes['order']  ) ? $attributes['order'] : 'ASC';
82 82
 
83
-        }
83
+		}
84 84
 
85
-        // setup the course query that will be used when rendering
86
-        $this->setup_course_query();
87
-    }
85
+		// setup the course query that will be used when rendering
86
+		$this->setup_course_query();
87
+	}
88 88
 
89
-    /**
90
-     * Sets up the object course query
91
-     * that will be used in the render method.
92
-     *
93
-     * @since 1.9.0
94
-     */
95
-    protected function setup_course_query(){
89
+	/**
90
+	 * Sets up the object course query
91
+	 * that will be used in the render method.
92
+	 *
93
+	 * @since 1.9.0
94
+	 */
95
+	protected function setup_course_query(){
96 96
 
97
-        $status_query = array( 'user_id' => get_current_user_id(), 'type' => 'sensei_course_status' );
98
-        $user_courses_logs = Sensei_Utils::sensei_check_for_activity( $status_query , true );
99
-        if ( !is_array($user_courses_logs) ) {
97
+		$status_query = array( 'user_id' => get_current_user_id(), 'type' => 'sensei_course_status' );
98
+		$user_courses_logs = Sensei_Utils::sensei_check_for_activity( $status_query , true );
99
+		if ( !is_array($user_courses_logs) ) {
100 100
 
101
-            $user_courses_logs = array( $user_courses_logs );
101
+			$user_courses_logs = array( $user_courses_logs );
102 102
 
103
-        }
103
+		}
104 104
 
105
-        $completed_ids = $active_ids = array();
106
-        foreach( $user_courses_logs as $course_status ) {
105
+		$completed_ids = $active_ids = array();
106
+		foreach( $user_courses_logs as $course_status ) {
107 107
 
108
-            if ( Sensei_Utils::user_completed_course( $course_status, get_current_user_id() ) ) {
108
+			if ( Sensei_Utils::user_completed_course( $course_status, get_current_user_id() ) ) {
109 109
 
110
-                $completed_ids[] = $course_status->comment_post_ID;
110
+				$completed_ids[] = $course_status->comment_post_ID;
111 111
 
112
-            } else {
112
+			} else {
113 113
 
114
-                $active_ids[] = $course_status->comment_post_ID;
114
+				$active_ids[] = $course_status->comment_post_ID;
115 115
 
116
-            }
117
-        }
116
+			}
117
+		}
118 118
 
119
-        if( 'completed' == $this->status ){
119
+		if( 'completed' == $this->status ){
120 120
 
121
-            $included_courses =  $completed_ids;
121
+			$included_courses =  $completed_ids;
122 122
 
123 123
 
124
-        }elseif( 'active'==$this->status ){
124
+		}elseif( 'active'==$this->status ){
125 125
 
126
-            $included_courses =  $active_ids;
126
+			$included_courses =  $active_ids;
127 127
 
128
-        }else{ // all courses
128
+		}else{ // all courses
129 129
 
130
-            if( empty( $completed_ids ) ){
130
+			if( empty( $completed_ids ) ){
131 131
 
132
-                add_action( 'sensei_loop_course_inside_before', array( $this, 'completed_no_course_message_output' ) );
133
-            }
132
+				add_action( 'sensei_loop_course_inside_before', array( $this, 'completed_no_course_message_output' ) );
133
+			}
134 134
 
135
-            if( empty( $active_ids ) ){
135
+			if( empty( $active_ids ) ){
136 136
 
137
-                add_action( 'sensei_loop_course_inside_before', array( $this, 'active_no_course_message_output' ) );
137
+				add_action( 'sensei_loop_course_inside_before', array( $this, 'active_no_course_message_output' ) );
138 138
 
139
-            }
139
+			}
140 140
 
141
-            if( empty( $completed_ids ) &&  empty( $active_ids )  ){
141
+			if( empty( $completed_ids ) &&  empty( $active_ids )  ){
142 142
 
143
-                $included_courses = array('-1000'); // don't show any courses
143
+				$included_courses = array('-1000'); // don't show any courses
144 144
 
145
-            }else{
146
-                $included_courses = Sensei_Utils::array_zip_merge( $active_ids, $completed_ids );
147
-            }
145
+			}else{
146
+				$included_courses = Sensei_Utils::array_zip_merge( $active_ids, $completed_ids );
147
+			}
148
+
149
+
150
+		}
151
+
152
+		// temporary work around to hide pagination on the courses page
153
+		// this is in place until we can load the course for each tab via ajax
154
+		// if the shortcode is not active or in active and the active and completed
155
+		// tabs show up.
156
+		$number_of_posts = $this->number;
157
+		if( 'active' != $this->status && 'complete' != $this->status  ){
158
+			$number_of_posts = 1000;
159
+		}
160
+
161
+		// course query parameters
162
+		$query_var_paged = get_query_var('paged');
163
+		$query_args = array(
164
+			'post_type'        => 'course',
165
+			'post_status'      => 'publish',
166
+			'orderby'          => $this->orderby,
167
+			'order'            => $this->order,
168
+			'paged' => empty( $query_var_paged )? 1 : $query_var_paged,
169
+			'posts_per_page'   => $number_of_posts,
170
+			'post__in'         => $included_courses,
171
+		);
172
+
173
+		$this->query = new WP_Query( $query_args );
148 174
 
175
+	}// end setup _course_query
149 176
 
150
-        }
151
-
152
-        // temporary work around to hide pagination on the courses page
153
-        // this is in place until we can load the course for each tab via ajax
154
-        // if the shortcode is not active or in active and the active and completed
155
-        // tabs show up.
156
-        $number_of_posts = $this->number;
157
-        if( 'active' != $this->status && 'complete' != $this->status  ){
158
-            $number_of_posts = 1000;
159
-        }
160
-
161
-        // course query parameters
162
-        $query_var_paged = get_query_var('paged');
163
-        $query_args = array(
164
-            'post_type'        => 'course',
165
-            'post_status'      => 'publish',
166
-            'orderby'          => $this->orderby,
167
-            'order'            => $this->order,
168
-            'paged' => empty( $query_var_paged )? 1 : $query_var_paged,
169
-            'posts_per_page'   => $number_of_posts,
170
-            'post__in'         => $included_courses,
171
-        );
172
-
173
-        $this->query = new WP_Query( $query_args );
174
-
175
-    }// end setup _course_query
176
-
177
-    /**
178
-     * Output the message that tells the user they have
179
-     * no completed courses.
180
-     *
181
-     * @since 1.9.0
182
-     */
183
-    public function completed_no_course_message_output(){
184
-        ?>
177
+	/**
178
+	 * Output the message that tells the user they have
179
+	 * no completed courses.
180
+	 *
181
+	 * @since 1.9.0
182
+	 */
183
+	public function completed_no_course_message_output(){
184
+		?>
185 185
         <li class="user-completed">
186 186
             <div class="sensei-message info">
187 187
 
@@ -190,16 +190,16 @@  discard block
 block discarded – undo
190 190
             </div>
191 191
         </li>
192 192
         <?php
193
-    }
193
+	}
194 194
 
195
-    /**
196
-     * Output the message that tells the user they have
197
-     * no active courses.
198
-     *
199
-     * @since 1.9.0
200
-     */
201
-    public function active_no_course_message_output(){
202
-        ?>
195
+	/**
196
+	 * Output the message that tells the user they have
197
+	 * no active courses.
198
+	 *
199
+	 * @since 1.9.0
200
+	 */
201
+	public function active_no_course_message_output(){
202
+		?>
203 203
 
204 204
         <li class="user-active">
205 205
             <div class="sensei-message info">
@@ -215,138 +215,138 @@  discard block
 block discarded – undo
215 215
             </div>
216 216
         </li>
217 217
         <?php
218
-    }
218
+	}
219 219
 
220
-    /**
221
-     * Rendering the shortcode this class is responsible for.
222
-     *
223
-     * @return string $content
224
-     */
225
-    public function render(){
220
+	/**
221
+	 * Rendering the shortcode this class is responsible for.
222
+	 *
223
+	 * @return string $content
224
+	 */
225
+	public function render(){
226 226
 
227
-        global $wp_query;
227
+		global $wp_query;
228 228
 
229
-        if(!  is_user_logged_in() ) {
230
-            return '';
231
-        }
229
+		if(!  is_user_logged_in() ) {
230
+			return '';
231
+		}
232 232
 
233
-        // keep a reference to old query
234
-        $current_global_query = $wp_query;
233
+		// keep a reference to old query
234
+		$current_global_query = $wp_query;
235 235
 
236
-        // assign the query setup in $this-> setup_course_query
237
-        $wp_query = $this->query;
236
+		// assign the query setup in $this-> setup_course_query
237
+		$wp_query = $this->query;
238 238
 
239
-        $this->attach_shortcode_hooks();
239
+		$this->attach_shortcode_hooks();
240 240
 
241
-        ob_start();
242
-        Sensei_Messages::the_my_messages_link();
243
-        Sensei_Templates::get_template('loop-course.php');
244
-        Sensei_Templates::get_template('globals/pagination.php');
245
-        $shortcode_output =  ob_get_clean();
241
+		ob_start();
242
+		Sensei_Messages::the_my_messages_link();
243
+		Sensei_Templates::get_template('loop-course.php');
244
+		Sensei_Templates::get_template('globals/pagination.php');
245
+		$shortcode_output =  ob_get_clean();
246 246
 
247
-        $this->detach_shortcode_hooks();
247
+		$this->detach_shortcode_hooks();
248 248
 
249
-        //restore old query
250
-        $wp_query = $current_global_query;
249
+		//restore old query
250
+		$wp_query = $current_global_query;
251 251
 
252
-        return $shortcode_output;
252
+		return $shortcode_output;
253 253
 
254
-    }// end render
254
+	}// end render
255 255
 
256
-    /**
257
-     * Add hooks for the shortcode
258
-     *
259
-     * @since 1.9.0
260
-     */
261
-    public function attach_shortcode_hooks(){
256
+	/**
257
+	 * Add hooks for the shortcode
258
+	 *
259
+	 * @since 1.9.0
260
+	 */
261
+	public function attach_shortcode_hooks(){
262 262
 
263
-        // attach the toggle functionality
264
-        // don't show the toggle action if the user specified complete or active for this shortcode
265
-        if( ! in_array( $this->status, array( 'active', 'complete' ) ) ){
263
+		// attach the toggle functionality
264
+		// don't show the toggle action if the user specified complete or active for this shortcode
265
+		if( ! in_array( $this->status, array( 'active', 'complete' ) ) ){
266 266
 
267
-            add_action( 'sensei_loop_course_before', array( $this, 'course_toggle_actions' ) );
268
-            add_action( 'wp_footer', array( $this, 'print_course_toggle_actions_inline_script' ), 90 );
267
+			add_action( 'sensei_loop_course_before', array( $this, 'course_toggle_actions' ) );
268
+			add_action( 'wp_footer', array( $this, 'print_course_toggle_actions_inline_script' ), 90 );
269 269
 
270
-        }
270
+		}
271 271
 
272
-        // add extra classes to distinguish the course based on user completed or active
273
-        add_filter( 'sensei_course_loop_content_class', array( $this, 'course_status_class_tagging' ), 20, 2 );
272
+		// add extra classes to distinguish the course based on user completed or active
273
+		add_filter( 'sensei_course_loop_content_class', array( $this, 'course_status_class_tagging' ), 20, 2 );
274 274
 
275
-        // attach progress meter below course
276
-        add_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_progress' ) );
277
-        add_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_buttons' ) );
275
+		// attach progress meter below course
276
+		add_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_progress' ) );
277
+		add_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_buttons' ) );
278 278
 
279
-    }
279
+	}
280 280
 
281
-    /**
282
-     * Remove hooks for the shortcode
283
-     *
284
-     * @since 1.9.0
285
-     */
286
-    public function detach_shortcode_hooks(){
281
+	/**
282
+	 * Remove hooks for the shortcode
283
+	 *
284
+	 * @since 1.9.0
285
+	 */
286
+	public function detach_shortcode_hooks(){
287 287
 
288
-        //remove all hooks after the output is generated
289
-        remove_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_progress' ) );
290
-        remove_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_buttons' ) );
291
-        remove_filter( 'sensei_course_loop_content_class', array( $this, 'course_status_class_tagging' ), 20, 2 );
292
-        remove_action( 'sensei_loop_course_before', array( $this, 'course_toggle_actions' ) );
293
-    }
288
+		//remove all hooks after the output is generated
289
+		remove_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_progress' ) );
290
+		remove_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_buttons' ) );
291
+		remove_filter( 'sensei_course_loop_content_class', array( $this, 'course_status_class_tagging' ), 20, 2 );
292
+		remove_action( 'sensei_loop_course_before', array( $this, 'course_toggle_actions' ) );
293
+	}
294 294
 
295
-    /**
296
-     * Hooks into sensei_course_content_inside_after
297
-     *
298
-     * @param $course
299
-     */
300
-    public function attach_course_progress( $course ){
295
+	/**
296
+	 * Hooks into sensei_course_content_inside_after
297
+	 *
298
+	 * @param $course
299
+	 */
300
+	public function attach_course_progress( $course ){
301 301
 
302
-        $percentage = Sensei()->course->get_completion_percentage( $course->ID, get_current_user_id() );
303
-        echo Sensei()->course->get_progress_meter( $percentage );
302
+		$percentage = Sensei()->course->get_completion_percentage( $course->ID, get_current_user_id() );
303
+		echo Sensei()->course->get_progress_meter( $percentage );
304 304
 
305
-    }// attach_course_progress
305
+	}// attach_course_progress
306 306
 
307 307
 
308
-    /**
309
-     * Hooked into sensei_course_content_inside_after
310
-     *
311
-     * Prints out the course action buttons
312
-     *
313
-     * @param $course
314
-     */
315
-    public function attach_course_buttons( $course ){
308
+	/**
309
+	 * Hooked into sensei_course_content_inside_after
310
+	 *
311
+	 * Prints out the course action buttons
312
+	 *
313
+	 * @param $course
314
+	 */
315
+	public function attach_course_buttons( $course ){
316 316
 
317
-        Sensei()->course->the_course_action_buttons( $course );
317
+		Sensei()->course->the_course_action_buttons( $course );
318 318
 
319
-    }// attach_course_buttons
319
+	}// attach_course_buttons
320 320
 
321
-    /**
322
-     * Add a the user status class for the given course.
323
-     *
324
-     * @since 1.9
325
-     *
326
-     * @param array $classes
327
-     * @param WP_Post $course
328
-     * @return array $classes
329
-     */
330
-    public function course_status_class_tagging($classes, $course){
321
+	/**
322
+	 * Add a the user status class for the given course.
323
+	 *
324
+	 * @since 1.9
325
+	 *
326
+	 * @param array $classes
327
+	 * @param WP_Post $course
328
+	 * @return array $classes
329
+	 */
330
+	public function course_status_class_tagging($classes, $course){
331 331
 
332
-        if ( Sensei_Utils::user_completed_course( $course, get_current_user_id() ) ) {
332
+		if ( Sensei_Utils::user_completed_course( $course, get_current_user_id() ) ) {
333 333
 
334
-            $classes[] = 'user-completed';
334
+			$classes[] = 'user-completed';
335 335
 
336
-        } else {
336
+		} else {
337 337
 
338
-            $classes[] = 'user-active';
338
+			$classes[] = 'user-active';
339 339
 
340
-        }
340
+		}
341 341
 
342
-        return $classes;
342
+		return $classes;
343 343
 
344
-    }// end course_status_class_tagging
344
+	}// end course_status_class_tagging
345 345
 
346
-    /**
347
-     * Output the course toggle functionality
348
-     */
349
-    public function course_toggle_actions(){ ?>
346
+	/**
347
+	 * Output the course toggle functionality
348
+	 */
349
+	public function course_toggle_actions(){ ?>
350 350
 
351 351
         <section id="user-course-status-toggle">
352 352
             <a id="sensei-user-courses-active-action" href=""><?php _e('Active Courses'); ?></a>
@@ -356,12 +356,12 @@  discard block
 block discarded – undo
356 356
 
357 357
     <?php }
358 358
 
359
-    /**
360
-     * Load the javascript for the toggle functionality
361
-     *
362
-     * @since 1.9.0
363
-     */
364
-    function print_course_toggle_actions_inline_script() { ?>
359
+	/**
360
+	 * Load the javascript for the toggle functionality
361
+	 *
362
+	 * @since 1.9.0
363
+	 */
364
+	function print_course_toggle_actions_inline_script() { ?>
365 365
 
366 366
         <script type="text/javascript">
367 367
             var buttonContainer = jQuery('#user-course-status-toggle');
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 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
  * This class is loaded int WP by the shortcode loader class.
5 5
  *
@@ -59,26 +59,26 @@  discard block
 block discarded – undo
59 59
      * @param string $content
60 60
      * @param string $shortcode the shortcode that was called for this instance
61 61
      */
62
-    public function __construct( $attributes, $content, $shortcode ){
62
+    public function __construct($attributes, $content, $shortcode) {
63 63
 
64
-        if(!  is_user_logged_in() ) {
64
+        if ( ! is_user_logged_in()) {
65 65
             return;
66 66
         }
67 67
 
68 68
         // set up all argument need for constructing the course query
69
-        $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '10';
70
-        $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'title';
71
-        $this->status = isset( $attributes['status'] ) ? $attributes['status'] : 'all';
69
+        $this->number = isset($attributes['number']) ? $attributes['number'] : '10';
70
+        $this->orderby = isset($attributes['orderby']) ? $attributes['orderby'] : 'title';
71
+        $this->status = isset($attributes['status']) ? $attributes['status'] : 'all';
72 72
 
73 73
         // set the default for menu_order to be ASC
74
-        if( 'menu_order' == $this->orderby && !isset( $attributes['order']  ) ){
74
+        if ('menu_order' == $this->orderby && ! isset($attributes['order'])) {
75 75
 
76
-            $this->order =  'ASC';
76
+            $this->order = 'ASC';
77 77
 
78
-        }else{
78
+        } else {
79 79
 
80 80
             // for everything else use the value passed or the default DESC
81
-            $this->order = isset( $attributes['order']  ) ? $attributes['order'] : 'ASC';
81
+            $this->order = isset($attributes['order']) ? $attributes['order'] : 'ASC';
82 82
 
83 83
         }
84 84
 
@@ -92,20 +92,20 @@  discard block
 block discarded – undo
92 92
      *
93 93
      * @since 1.9.0
94 94
      */
95
-    protected function setup_course_query(){
95
+    protected function setup_course_query() {
96 96
 
97
-        $status_query = array( 'user_id' => get_current_user_id(), 'type' => 'sensei_course_status' );
98
-        $user_courses_logs = Sensei_Utils::sensei_check_for_activity( $status_query , true );
99
-        if ( !is_array($user_courses_logs) ) {
97
+        $status_query = array('user_id' => get_current_user_id(), 'type' => 'sensei_course_status');
98
+        $user_courses_logs = Sensei_Utils::sensei_check_for_activity($status_query, true);
99
+        if ( ! is_array($user_courses_logs)) {
100 100
 
101
-            $user_courses_logs = array( $user_courses_logs );
101
+            $user_courses_logs = array($user_courses_logs);
102 102
 
103 103
         }
104 104
 
105 105
         $completed_ids = $active_ids = array();
106
-        foreach( $user_courses_logs as $course_status ) {
106
+        foreach ($user_courses_logs as $course_status) {
107 107
 
108
-            if ( Sensei_Utils::user_completed_course( $course_status, get_current_user_id() ) ) {
108
+            if (Sensei_Utils::user_completed_course($course_status, get_current_user_id())) {
109 109
 
110 110
                 $completed_ids[] = $course_status->comment_post_ID;
111 111
 
@@ -116,34 +116,34 @@  discard block
 block discarded – undo
116 116
             }
117 117
         }
118 118
 
119
-        if( 'completed' == $this->status ){
119
+        if ('completed' == $this->status) {
120 120
 
121
-            $included_courses =  $completed_ids;
121
+            $included_courses = $completed_ids;
122 122
 
123 123
 
124
-        }elseif( 'active'==$this->status ){
124
+        }elseif ('active' == $this->status) {
125 125
 
126
-            $included_courses =  $active_ids;
126
+            $included_courses = $active_ids;
127 127
 
128
-        }else{ // all courses
128
+        } else { // all courses
129 129
 
130
-            if( empty( $completed_ids ) ){
130
+            if (empty($completed_ids)) {
131 131
 
132
-                add_action( 'sensei_loop_course_inside_before', array( $this, 'completed_no_course_message_output' ) );
132
+                add_action('sensei_loop_course_inside_before', array($this, 'completed_no_course_message_output'));
133 133
             }
134 134
 
135
-            if( empty( $active_ids ) ){
135
+            if (empty($active_ids)) {
136 136
 
137
-                add_action( 'sensei_loop_course_inside_before', array( $this, 'active_no_course_message_output' ) );
137
+                add_action('sensei_loop_course_inside_before', array($this, 'active_no_course_message_output'));
138 138
 
139 139
             }
140 140
 
141
-            if( empty( $completed_ids ) &&  empty( $active_ids )  ){
141
+            if (empty($completed_ids) && empty($active_ids)) {
142 142
 
143 143
                 $included_courses = array('-1000'); // don't show any courses
144 144
 
145
-            }else{
146
-                $included_courses = Sensei_Utils::array_zip_merge( $active_ids, $completed_ids );
145
+            } else {
146
+                $included_courses = Sensei_Utils::array_zip_merge($active_ids, $completed_ids);
147 147
             }
148 148
 
149 149
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         // if the shortcode is not active or in active and the active and completed
155 155
         // tabs show up.
156 156
         $number_of_posts = $this->number;
157
-        if( 'active' != $this->status && 'complete' != $this->status  ){
157
+        if ('active' != $this->status && 'complete' != $this->status) {
158 158
             $number_of_posts = 1000;
159 159
         }
160 160
 
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
             'post_status'      => 'publish',
166 166
             'orderby'          => $this->orderby,
167 167
             'order'            => $this->order,
168
-            'paged' => empty( $query_var_paged )? 1 : $query_var_paged,
168
+            'paged' => empty($query_var_paged) ? 1 : $query_var_paged,
169 169
             'posts_per_page'   => $number_of_posts,
170 170
             'post__in'         => $included_courses,
171 171
         );
172 172
 
173
-        $this->query = new WP_Query( $query_args );
173
+        $this->query = new WP_Query($query_args);
174 174
 
175 175
     }// end setup _course_query
176 176
 
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
      *
181 181
      * @since 1.9.0
182 182
      */
183
-    public function completed_no_course_message_output(){
183
+    public function completed_no_course_message_output() {
184 184
         ?>
185 185
         <li class="user-completed">
186 186
             <div class="sensei-message info">
187 187
 
188
-                <?php _e( 'You have not completed any courses yet.', 'woothemes-sensei' ); ?>
188
+                <?php _e('You have not completed any courses yet.', 'woothemes-sensei'); ?>
189 189
 
190 190
             </div>
191 191
         </li>
@@ -198,17 +198,17 @@  discard block
 block discarded – undo
198 198
      *
199 199
      * @since 1.9.0
200 200
      */
201
-    public function active_no_course_message_output(){
201
+    public function active_no_course_message_output() {
202 202
         ?>
203 203
 
204 204
         <li class="user-active">
205 205
             <div class="sensei-message info">
206 206
 
207
-                <?php _e( 'You have no active courses.', 'woothemes-sensei' ); ?>
207
+                <?php _e('You have no active courses.', 'woothemes-sensei'); ?>
208 208
 
209
-                <a href="<?php esc_attr_e( Sensei_Course::get_courses_page_url() ); ?>">
209
+                <a href="<?php esc_attr_e(Sensei_Course::get_courses_page_url()); ?>">
210 210
 
211
-                    <?php  _e( 'Start a Course!', 'woothemes-sensei' ); ?>
211
+                    <?php  _e('Start a Course!', 'woothemes-sensei'); ?>
212 212
 
213 213
                 </a>
214 214
 
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
      *
223 223
      * @return string $content
224 224
      */
225
-    public function render(){
225
+    public function render() {
226 226
 
227 227
         global $wp_query;
228 228
 
229
-        if(!  is_user_logged_in() ) {
229
+        if ( ! is_user_logged_in()) {
230 230
             return '';
231 231
         }
232 232
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
         Sensei_Messages::the_my_messages_link();
243 243
         Sensei_Templates::get_template('loop-course.php');
244 244
         Sensei_Templates::get_template('globals/pagination.php');
245
-        $shortcode_output =  ob_get_clean();
245
+        $shortcode_output = ob_get_clean();
246 246
 
247 247
         $this->detach_shortcode_hooks();
248 248
 
@@ -258,23 +258,23 @@  discard block
 block discarded – undo
258 258
      *
259 259
      * @since 1.9.0
260 260
      */
261
-    public function attach_shortcode_hooks(){
261
+    public function attach_shortcode_hooks() {
262 262
 
263 263
         // attach the toggle functionality
264 264
         // don't show the toggle action if the user specified complete or active for this shortcode
265
-        if( ! in_array( $this->status, array( 'active', 'complete' ) ) ){
265
+        if ( ! in_array($this->status, array('active', 'complete'))) {
266 266
 
267
-            add_action( 'sensei_loop_course_before', array( $this, 'course_toggle_actions' ) );
268
-            add_action( 'wp_footer', array( $this, 'print_course_toggle_actions_inline_script' ), 90 );
267
+            add_action('sensei_loop_course_before', array($this, 'course_toggle_actions'));
268
+            add_action('wp_footer', array($this, 'print_course_toggle_actions_inline_script'), 90);
269 269
 
270 270
         }
271 271
 
272 272
         // add extra classes to distinguish the course based on user completed or active
273
-        add_filter( 'sensei_course_loop_content_class', array( $this, 'course_status_class_tagging' ), 20, 2 );
273
+        add_filter('sensei_course_loop_content_class', array($this, 'course_status_class_tagging'), 20, 2);
274 274
 
275 275
         // attach progress meter below course
276
-        add_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_progress' ) );
277
-        add_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_buttons' ) );
276
+        add_action('sensei_course_content_inside_after', array($this, 'attach_course_progress'));
277
+        add_action('sensei_course_content_inside_after', array($this, 'attach_course_buttons'));
278 278
 
279 279
     }
280 280
 
@@ -283,13 +283,13 @@  discard block
 block discarded – undo
283 283
      *
284 284
      * @since 1.9.0
285 285
      */
286
-    public function detach_shortcode_hooks(){
286
+    public function detach_shortcode_hooks() {
287 287
 
288 288
         //remove all hooks after the output is generated
289
-        remove_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_progress' ) );
290
-        remove_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_buttons' ) );
291
-        remove_filter( 'sensei_course_loop_content_class', array( $this, 'course_status_class_tagging' ), 20, 2 );
292
-        remove_action( 'sensei_loop_course_before', array( $this, 'course_toggle_actions' ) );
289
+        remove_action('sensei_course_content_inside_after', array($this, 'attach_course_progress'));
290
+        remove_action('sensei_course_content_inside_after', array($this, 'attach_course_buttons'));
291
+        remove_filter('sensei_course_loop_content_class', array($this, 'course_status_class_tagging'), 20, 2);
292
+        remove_action('sensei_loop_course_before', array($this, 'course_toggle_actions'));
293 293
     }
294 294
 
295 295
     /**
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
      *
298 298
      * @param $course
299 299
      */
300
-    public function attach_course_progress( $course ){
300
+    public function attach_course_progress($course) {
301 301
 
302
-        $percentage = Sensei()->course->get_completion_percentage( $course->ID, get_current_user_id() );
303
-        echo Sensei()->course->get_progress_meter( $percentage );
302
+        $percentage = Sensei()->course->get_completion_percentage($course->ID, get_current_user_id());
303
+        echo Sensei()->course->get_progress_meter($percentage);
304 304
 
305 305
     }// attach_course_progress
306 306
 
@@ -312,9 +312,9 @@  discard block
 block discarded – undo
312 312
      *
313 313
      * @param $course
314 314
      */
315
-    public function attach_course_buttons( $course ){
315
+    public function attach_course_buttons($course) {
316 316
 
317
-        Sensei()->course->the_course_action_buttons( $course );
317
+        Sensei()->course->the_course_action_buttons($course);
318 318
 
319 319
     }// attach_course_buttons
320 320
 
@@ -327,9 +327,9 @@  discard block
 block discarded – undo
327 327
      * @param WP_Post $course
328 328
      * @return array $classes
329 329
      */
330
-    public function course_status_class_tagging($classes, $course){
330
+    public function course_status_class_tagging($classes, $course) {
331 331
 
332
-        if ( Sensei_Utils::user_completed_course( $course, get_current_user_id() ) ) {
332
+        if (Sensei_Utils::user_completed_course($course, get_current_user_id())) {
333 333
 
334 334
             $classes[] = 'user-completed';
335 335
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
     /**
347 347
      * Output the course toggle functionality
348 348
      */
349
-    public function course_toggle_actions(){ ?>
349
+    public function course_toggle_actions() { ?>
350 350
 
351 351
         <section id="user-course-status-toggle">
352 352
             <a id="sensei-user-courses-active-action" href=""><?php _e('Active Courses'); ?></a>
Please login to merge, or discard this patch.
Braces   +8 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
5
+// Exit if accessed directly
3 6
 /**
4 7
  * This class is loaded int WP by the shortcode loader class.
5 8
  *
@@ -75,7 +78,7 @@  discard block
 block discarded – undo
75 78
 
76 79
             $this->order =  'ASC';
77 80
 
78
-        }else{
81
+        } else{
79 82
 
80 83
             // for everything else use the value passed or the default DESC
81 84
             $this->order = isset( $attributes['order']  ) ? $attributes['order'] : 'ASC';
@@ -121,11 +124,11 @@  discard block
 block discarded – undo
121 124
             $included_courses =  $completed_ids;
122 125
 
123 126
 
124
-        }elseif( 'active'==$this->status ){
127
+        } elseif( 'active'==$this->status ){
125 128
 
126 129
             $included_courses =  $active_ids;
127 130
 
128
-        }else{ // all courses
131
+        } else{ // all courses
129 132
 
130 133
             if( empty( $completed_ids ) ){
131 134
 
@@ -142,7 +145,7 @@  discard block
 block discarded – undo
142 145
 
143 146
                 $included_courses = array('-1000'); // don't show any courses
144 147
 
145
-            }else{
148
+            } else{
146 149
                 $included_courses = Sensei_Utils::array_zip_merge( $active_ids, $completed_ids );
147 150
             }
148 151
 
Please login to merge, or discard this patch.
includes/template-functions.php 4 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 *
93 93
 	 * @access public
94 94
 	 * @param mixed $course_id
95
-	 * @return void
95
+	 * @return boolean
96 96
 	 */
97 97
 	function sensei_check_prerequisite_course( $course_id ) {
98 98
 		global $current_user;
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
 	 * sensei_check_if_product_is_in_cart function.
235 235
 	 *
236 236
 	 * @deprecated since 1.9.0
237
-	 * @param int $wc_post_id (default: 0)
238
-	 * @return void
237
+	 * @param int $wc_product_id (default: 0)
238
+	 * @return boolean
239 239
 	 */
240 240
 	function sensei_check_if_product_is_in_cart( $wc_product_id = 0 ) {
241 241
         return Sensei_WC::is_product_in_cart( $wc_product_id );
Please login to merge, or discard this patch.
Indentation   +295 added lines, -296 removed lines patch added patch discarded remove patch
@@ -5,18 +5,18 @@  discard block
 block discarded – undo
5 5
 	 * 	Output tags.
6 6
 	 ***************************************************************************************************/
7 7
 
8
-    /**
9
-     * sensei_course_archive_next_link function.
10
-     *
11
-     * @access public
12
-     * @param string $type (default: 'newcourses')
13
-     * @return void
14
-     */
15
-    function sensei_course_archive_next_link( $type = 'newcourses' ) {
8
+	/**
9
+	 * sensei_course_archive_next_link function.
10
+	 *
11
+	 * @access public
12
+	 * @param string $type (default: 'newcourses')
13
+	 * @return void
14
+	 */
15
+	function sensei_course_archive_next_link( $type = 'newcourses' ) {
16 16
 
17
-        _deprecated_function('sensei_course_archive_next_link', '1.9.0','This is no longer used or required in Sensei.');
17
+		_deprecated_function('sensei_course_archive_next_link', '1.9.0','This is no longer used or required in Sensei.');
18 18
 
19
-    } // End sensei_course_archive_next_link()
19
+	} // End sensei_course_archive_next_link()
20 20
 
21 21
 	 /**
22 22
 	  * course_single_lessons function.
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
 	  */
27 27
 	 function course_single_lessons() {
28 28
 
29
-         // load backwards compatible template name if it exists in the users theme
30
-         $located_template= locate_template( Sensei()->template_url . 'single-course/course-lessons.php' );
31
-         if( $located_template ){
29
+		 // load backwards compatible template name if it exists in the users theme
30
+		 $located_template= locate_template( Sensei()->template_url . 'single-course/course-lessons.php' );
31
+		 if( $located_template ){
32 32
 
33
-             Sensei_Templates::get_template( 'single-course/course-lessons.php' );
34
-             return;
33
+			 Sensei_Templates::get_template( 'single-course/course-lessons.php' );
34
+			 return;
35 35
 
36
-        }
36
+		}
37 37
 
38 38
 		Sensei_Templates::get_template( 'single-course/lessons.php' );
39 39
 
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	  */
49 49
 	 function lesson_single_meta() {
50 50
 
51
-         _deprecated_function('lesson_single_meta','1.9;0', 'WooThemes_Sensei_Lesson::the_lesson_meta' );
52
-         sensei_the_single_lesson_meta();
51
+		 _deprecated_function('lesson_single_meta','1.9;0', 'WooThemes_Sensei_Lesson::the_lesson_meta' );
52
+		 sensei_the_single_lesson_meta();
53 53
 
54 54
 	 } // End lesson_single_meta()
55 55
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	  * @access public
61 61
 	  * @param bool $return (default: false)
62 62
 	  * @return void
63
-      * @deprecated since 1.9.0
63
+	  * @deprecated since 1.9.0
64 64
 	  */
65 65
 	 function quiz_questions( $return = false ) {
66 66
 
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 	  * @access public
75 75
 	  * @since  1.3.0
76 76
 	  * @return void
77
-      * @deprecated
77
+	  * @deprecated
78 78
 	  */
79 79
 	 function quiz_question_type( $question_type = 'multiple-choice' ) {
80 80
 
81
-         Sensei_Templates::get_template( 'single-quiz/question_type-' . $question_type . '.php' );
81
+		 Sensei_Templates::get_template( 'single-quiz/question_type-' . $question_type . '.php' );
82 82
 
83 83
 	 } // End lesson_single_meta()
84 84
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     			<span><input name="course_start" type="submit" class="course-start" value="<?php _e( 'Start taking this Course', 'woothemes-sensei' ); ?>"/></span>
131 131
 
132 132
     		</form><?php
133
-    	} // End If Statement
133
+		} // End If Statement
134 134
 	} // End sensei_start_course_form()
135 135
 
136 136
 
@@ -165,20 +165,20 @@  discard block
 block discarded – undo
165 165
 
166 166
 			<?php } else {
167 167
 
168
-			    // based on simple.php in WC templates/single-product/add-to-cart/
169
-			    if ( 0 < $wc_post_id ) {
170
-
171
-			        // Get the product
172
-			        $product = Sensei()->sensei_get_woocommerce_product_object( $wc_post_id );
173
-			        if ( ! isset ( $product ) || ! is_object( $product ) ) return;
174
-			        if ( $product->is_purchasable() ) {
175
-			            // Check Product Availability
176
-			            $availability = $product->get_availability();
177
-			            if ($availability['availability']) {
178
-			                echo apply_filters( 'woocommerce_stock_html', '<p class="stock '.$availability['class'].'">'.$availability['availability'].'</p>', $availability['availability'] );
179
-			            } // End If Statement
180
-			            // Check for stock
181
-			            if ( $product->is_in_stock() ) { ?>
168
+				// based on simple.php in WC templates/single-product/add-to-cart/
169
+				if ( 0 < $wc_post_id ) {
170
+
171
+					// Get the product
172
+					$product = Sensei()->sensei_get_woocommerce_product_object( $wc_post_id );
173
+					if ( ! isset ( $product ) || ! is_object( $product ) ) return;
174
+					if ( $product->is_purchasable() ) {
175
+						// Check Product Availability
176
+						$availability = $product->get_availability();
177
+						if ($availability['availability']) {
178
+							echo apply_filters( 'woocommerce_stock_html', '<p class="stock '.$availability['class'].'">'.$availability['availability'].'</p>', $availability['availability'] );
179
+						} // End If Statement
180
+						// Check for stock
181
+						if ( $product->is_in_stock() ) { ?>
182 182
 
183 183
 			                <?php if (! sensei_check_if_product_is_in_cart( $wc_post_id ) ) { ?>
184 184
 
@@ -209,16 +209,16 @@  discard block
 block discarded – undo
209 209
 
210 210
 			             <?php } // End If Statement
211 211
 
212
-			        } // End If Statement
212
+					} // End If Statement
213 213
 
214
-			    } // End If Statement
214
+				} // End If Statement
215 215
 
216 216
 			} // End If Statement
217 217
 
218 218
 			if ( !is_user_logged_in() ) {
219 219
 
220
-			    $my_courses_page_id = intval( Sensei()->settings->settings[ 'my_course_page' ] );
221
-			    $login_link =  '<a href="' . esc_url( get_permalink( $my_courses_page_id ) ) . '">' . __( 'log in', 'woothemes-sensei' ) . '</a>'; ?>
220
+				$my_courses_page_id = intval( Sensei()->settings->settings[ 'my_course_page' ] );
221
+				$login_link =  '<a href="' . esc_url( get_permalink( $my_courses_page_id ) ) . '">' . __( 'log in', 'woothemes-sensei' ) . '</a>'; ?>
222 222
 			    <p class="add-to-cart-login">
223 223
 			        <?php echo sprintf( __( 'Or %1$s to access your purchased courses', 'woothemes-sensei' ), $login_link ); ?>
224 224
 			    </p>
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 * @return void
239 239
 	 */
240 240
 	function sensei_check_if_product_is_in_cart( $wc_product_id = 0 ) {
241
-        return Sensei_WC::is_product_in_cart( $wc_product_id );
241
+		return Sensei_WC::is_product_in_cart( $wc_product_id );
242 242
 	} // End sensei_check_if_product_is_in_cart()
243 243
 
244 244
 	/**
@@ -251,17 +251,17 @@  discard block
 block discarded – undo
251 251
 	function sensei_simple_course_price( $post_id ) {
252 252
 
253 253
 		//WooCommerce Pricing
254
-    	if ( WooThemes_Sensei_Utils::sensei_is_woocommerce_activated() ) {
255
-    	    $wc_post_id = get_post_meta( $post_id, '_course_woocommerce_product', true );
256
-    	    if ( 0 < $wc_post_id ) {
257
-    	    	// Get the product
258
-    	    	$product = Sensei()->sensei_get_woocommerce_product_object( $wc_post_id );
254
+		if ( WooThemes_Sensei_Utils::sensei_is_woocommerce_activated() ) {
255
+			$wc_post_id = get_post_meta( $post_id, '_course_woocommerce_product', true );
256
+			if ( 0 < $wc_post_id ) {
257
+				// Get the product
258
+				$product = Sensei()->sensei_get_woocommerce_product_object( $wc_post_id );
259 259
 
260
-    	    	if ( isset( $product ) && !empty( $product )  &&  $product->is_purchasable() && $product->is_in_stock() && !sensei_check_if_product_is_in_cart( $wc_post_id ) ) { ?>
260
+				if ( isset( $product ) && !empty( $product )  &&  $product->is_purchasable() && $product->is_in_stock() && !sensei_check_if_product_is_in_cart( $wc_post_id ) ) { ?>
261 261
     	    		<span class="course-price"><?php echo $product->get_price_html(); ?></span>
262 262
     	    	<?php } // End If Statement
263
-    	    } // End If Statement
264
-    	} // End If Statement
263
+			} // End If Statement
264
+		} // End If Statement
265 265
 	} // End sensei_simple_course_price()
266 266
 
267 267
 	/**
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
 
290 290
 		if ( ! $query->is_main_query() )
291
-        	return;
291
+			return;
292 292
 
293 293
 		// Apply Filter only if on frontend and when course archive is running
294 294
 		$course_page_id = intval( Sensei()->settings->settings[ 'course_page' ] );
@@ -296,11 +296,11 @@  discard block
 block discarded – undo
296 296
 		if ( ! is_admin() && 0 < $course_page_id && 0 < intval( $query->get( 'page_id' ) ) && $query->get( 'page_id' ) == $course_page_id ) {
297 297
 			// Check for pagination settings
298 298
    			if ( isset( Sensei()->settings->settings[ 'course_archive_amount' ] ) && ( 0 < absint( Sensei()->settings->settings[ 'course_archive_amount' ] ) ) ) {
299
-    			$amount = absint( Sensei()->settings->settings[ 'course_archive_amount' ] );
300
-    		} else {
301
-    			$amount = $query->get( 'posts_per_page' );
302
-    		} // End If Statement
303
-    		$query->set( 'posts_per_page', $amount );
299
+				$amount = absint( Sensei()->settings->settings[ 'course_archive_amount' ] );
300
+			} else {
301
+				$amount = $query->get( 'posts_per_page' );
302
+			} // End If Statement
303
+			$query->set( 'posts_per_page', $amount );
304 304
 		} // End If Statement
305 305
 	} // End sensei_course_archive_filter()
306 306
 	add_filter( 'pre_get_posts', 'sensei_course_archive_filter', 10, 1 );
@@ -339,66 +339,66 @@  discard block
 block discarded – undo
339 339
 			$lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true );
340 340
 			$all_lessons = array();
341 341
 
342
-            $modules = Sensei()->modules->get_course_modules( intval( $lesson_course_id ) );
343
-
344
-            foreach( (array) $modules as $module ) {
345
-
346
-                $args = array(
347
-                    'post_type' => 'lesson',
348
-                    'post_status' => 'publish',
349
-                    'posts_per_page' => -1,
350
-                    'meta_query' => array(
351
-                        array(
352
-                            'key' => '_lesson_course',
353
-                            'value' => intval( $lesson_course_id ),
354
-                            'compare' => '='
355
-                        )
356
-                    ),
357
-                    'tax_query' => array(
358
-                        array(
359
-                            'taxonomy' => Sensei()->modules->taxonomy,
360
-                            'field' => 'id',
361
-                            'terms' => intval( $module->term_id )
362
-                        )
363
-                    ),
364
-                    'meta_key' => '_order_module_' . $module->term_id,
365
-                    'orderby' => 'meta_value_num date',
366
-                    'order' => 'ASC',
367
-                    'suppress_filters' => 0
368
-                );
369
-
370
-                $lessons = get_posts( $args );
371
-                if ( 0 < count( $lessons ) ) {
372
-                    foreach ($lessons as $lesson_item){
373
-                        $all_lessons[] = $lesson_item->ID;
374
-                    } // End For Loop
375
-                } // End If Statement
376
-            }
377
-
378
-            $args = array(
379
-                'post_type' => 'lesson',
380
-                'posts_per_page' => -1,
381
-                'suppress_filters' => 0,
382
-                'meta_key' => '_order_' . $lesson_course_id,
383
-                'orderby' => 'meta_value_num date',
384
-                'order' => 'ASC',
385
-                'meta_query' => array(
386
-                    array(
387
-                        'key' => '_lesson_course',
388
-                        'value' => intval( $lesson_course_id ),
389
-                    ),
390
-                ),
391
-                'post__not_in' => $all_lessons,
392
-            );
393
-
394
-            $other_lessons = get_posts( $args );
395
-            if ( 0 < count( $other_lessons ) ) {
342
+			$modules = Sensei()->modules->get_course_modules( intval( $lesson_course_id ) );
343
+
344
+			foreach( (array) $modules as $module ) {
345
+
346
+				$args = array(
347
+					'post_type' => 'lesson',
348
+					'post_status' => 'publish',
349
+					'posts_per_page' => -1,
350
+					'meta_query' => array(
351
+						array(
352
+							'key' => '_lesson_course',
353
+							'value' => intval( $lesson_course_id ),
354
+							'compare' => '='
355
+						)
356
+					),
357
+					'tax_query' => array(
358
+						array(
359
+							'taxonomy' => Sensei()->modules->taxonomy,
360
+							'field' => 'id',
361
+							'terms' => intval( $module->term_id )
362
+						)
363
+					),
364
+					'meta_key' => '_order_module_' . $module->term_id,
365
+					'orderby' => 'meta_value_num date',
366
+					'order' => 'ASC',
367
+					'suppress_filters' => 0
368
+				);
369
+
370
+				$lessons = get_posts( $args );
371
+				if ( 0 < count( $lessons ) ) {
372
+					foreach ($lessons as $lesson_item){
373
+						$all_lessons[] = $lesson_item->ID;
374
+					} // End For Loop
375
+				} // End If Statement
376
+			}
377
+
378
+			$args = array(
379
+				'post_type' => 'lesson',
380
+				'posts_per_page' => -1,
381
+				'suppress_filters' => 0,
382
+				'meta_key' => '_order_' . $lesson_course_id,
383
+				'orderby' => 'meta_value_num date',
384
+				'order' => 'ASC',
385
+				'meta_query' => array(
386
+					array(
387
+						'key' => '_lesson_course',
388
+						'value' => intval( $lesson_course_id ),
389
+					),
390
+				),
391
+				'post__not_in' => $all_lessons,
392
+			);
393
+
394
+			$other_lessons = get_posts( $args );
395
+			if ( 0 < count( $other_lessons ) ) {
396 396
 				foreach ($other_lessons as $lesson_item){
397 397
 					$all_lessons[] = $lesson_item->ID;
398 398
 				} // End For Loop
399 399
 			} // End If Statement
400 400
 
401
-            if ( 0 < count( $all_lessons ) ) {
401
+			if ( 0 < count( $all_lessons ) ) {
402 402
 				$found_index = false;
403 403
 				foreach ( $all_lessons as $lesson ){
404 404
 					if ( $found_index && $return_values['next_lesson'] == 0 ) {
@@ -429,9 +429,9 @@  discard block
 block discarded – undo
429 429
    */
430 430
   function sensei_get_excerpt( $post_id = '' ) {
431 431
 
432
-      global $post;
433
-      _deprecated_function('sensei_get_excerpt', 'use the wordpress excerpt functionality.');
434
-      return get_the_excerpt();
432
+	  global $post;
433
+	  _deprecated_function('sensei_get_excerpt', 'use the wordpress excerpt functionality.');
434
+	  return get_the_excerpt();
435 435
 
436 436
   }
437 437
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 */
457 457
 function sensei_has_user_completed_prerequisite_lesson( $current_lesson_id, $user_id ) {
458 458
 
459
-    return WooThemes_Sensei_Lesson::is_pre_requisite_complete( $current_lesson_id, $user_id );
459
+	return WooThemes_Sensei_Lesson::is_pre_requisite_complete( $current_lesson_id, $user_id );
460 460
 
461 461
 } // End sensei_has_user_completed_prerequisite_lesson()
462 462
 
@@ -571,27 +571,27 @@  discard block
 block discarded – undo
571 571
 
572 572
 	}else{
573 573
 
574
-        // if the loop has not been initiated check the first module has lessons
575
-        if( -1 == $sensei_modules_loop[ 'current' ]  ){
574
+		// if the loop has not been initiated check the first module has lessons
575
+		if( -1 == $sensei_modules_loop[ 'current' ]  ){
576 576
 
577
-            $index = 0;
577
+			$index = 0;
578 578
 
579
-            if( isset( $sensei_modules_loop['modules'][ $index ] ) ) {
580
-                // setup the query for the module lessons
581
-                $course_id = $sensei_modules_loop['course_id'];
579
+			if( isset( $sensei_modules_loop['modules'][ $index ] ) ) {
580
+				// setup the query for the module lessons
581
+				$course_id = $sensei_modules_loop['course_id'];
582 582
 
583
-                $module_term_id = $sensei_modules_loop['modules'][ $index ] ->term_id;
584
-                $modules_query = Sensei()->modules->get_lessons_query( $course_id , $module_term_id );
583
+				$module_term_id = $sensei_modules_loop['modules'][ $index ] ->term_id;
584
+				$modules_query = Sensei()->modules->get_lessons_query( $course_id , $module_term_id );
585 585
 
586
-                // setup the global wp-query only if the lessons
587
-                if( $modules_query->have_posts() ){
586
+				// setup the global wp-query only if the lessons
587
+				if( $modules_query->have_posts() ){
588 588
 
589
-                    return true;
589
+					return true;
590 590
 
591
-                }
592
-            }
593
-        }
594
-        // default to false if the first module doesn't have posts
591
+				}
592
+			}
593
+		}
594
+		// default to false if the first module doesn't have posts
595 595
 		return false;
596 596
 
597 597
 	}
@@ -703,21 +703,21 @@  discard block
 block discarded – undo
703 703
  */
704 704
 function sensei_quiz_has_questions(){
705 705
 
706
-    global $sensei_question_loop;
706
+	global $sensei_question_loop;
707 707
 
708
-    if( !isset( $sensei_question_loop['total'] ) ){
709
-        return false;
710
-    }
708
+	if( !isset( $sensei_question_loop['total'] ) ){
709
+		return false;
710
+	}
711 711
 
712
-    if( $sensei_question_loop['current'] + 1 < $sensei_question_loop['total']  ){
712
+	if( $sensei_question_loop['current'] + 1 < $sensei_question_loop['total']  ){
713 713
 
714
-        return true;
714
+		return true;
715 715
 
716
-    }else{
716
+	}else{
717 717
 
718
-        return false;
718
+		return false;
719 719
 
720
-    }
720
+	}
721 721
 
722 722
 }// end sensei_quiz_has_questions
723 723
 
@@ -728,15 +728,14 @@  discard block
 block discarded – undo
728 728
  * execution.
729 729
  *
730 730
  * @since 1.9.0
731
-
732 731
  */
733 732
 function sensei_setup_the_question(){
734 733
 
735
-    global $sensei_question_loop;
734
+	global $sensei_question_loop;
736 735
 
737
-    $sensei_question_loop['current']++;
738
-    $index = $sensei_question_loop['current'];
739
-    $sensei_question_loop['current_question'] =  $sensei_question_loop['questions'][ $index ] ;
736
+	$sensei_question_loop['current']++;
737
+	$index = $sensei_question_loop['current'];
738
+	$sensei_question_loop['current_question'] =  $sensei_question_loop['questions'][ $index ] ;
740 739
 
741 740
 
742 741
 }// end sensei_setup_the_question
@@ -749,12 +748,12 @@  discard block
 block discarded – undo
749 748
  */
750 749
 function sensei_the_question_content(){
751 750
 
752
-    global $sensei_question_loop;
751
+	global $sensei_question_loop;
753 752
 
754
-    $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID );
753
+	$question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID );
755 754
 
756
-    // load the template that displays the question information.
757
-    WooThemes_Sensei_Question::load_question_template( $question_type );
755
+	// load the template that displays the question information.
756
+	WooThemes_Sensei_Question::load_question_template( $question_type );
758 757
 
759 758
 }// end sensei_the_question_content
760 759
 
@@ -765,26 +764,26 @@  discard block
 block discarded – undo
765 764
  */
766 765
 function sensei_the_question_class(){
767 766
 
768
-    global $sensei_question_loop;
767
+	global $sensei_question_loop;
769 768
 
770
-    $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID );
769
+	$question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID );
771 770
 
772
-    /**
773
-     * filter the sensei question class within
774
-     * the quiz question loop.
775
-     *
776
-     * @since 1.9.0
777
-     */
778
-     $classes = apply_filters( 'sensei_question_classes', array( $question_type ) );
771
+	/**
772
+	 * filter the sensei question class within
773
+	 * the quiz question loop.
774
+	 *
775
+	 * @since 1.9.0
776
+	 */
777
+	 $classes = apply_filters( 'sensei_question_classes', array( $question_type ) );
779 778
 
780
-    $html_classes = '';
781
-    foreach( $classes as $class ){
779
+	$html_classes = '';
780
+	foreach( $classes as $class ){
782 781
 
783
-        $html_classes .= $class . ' ';
782
+		$html_classes .= $class . ' ';
784 783
 
785
-    }// end foreach
784
+	}// end foreach
786 785
 
787
-    esc_attr_e( trim( $html_classes ) );
786
+	esc_attr_e( trim( $html_classes ) );
788 787
 
789 788
 }
790 789
 
@@ -795,12 +794,12 @@  discard block
 block discarded – undo
795 794
  */
796 795
 function sensei_get_the_question_id( ){
797 796
 
798
-    global $sensei_question_loop;
799
-    if( isset( $sensei_question_loop['current_question']->ID ) ){
797
+	global $sensei_question_loop;
798
+	if( isset( $sensei_question_loop['current_question']->ID ) ){
800 799
 
801
-        return $sensei_question_loop['current_question']->ID;
800
+		return $sensei_question_loop['current_question']->ID;
802 801
 
803
-    }
802
+	}
804 803
 
805 804
 }// end sensei_the_question_id
806 805
 
@@ -827,63 +826,63 @@  discard block
 block discarded – undo
827 826
  */
828 827
 function sensei_can_user_view_lesson( $lesson_id = '', $user_id = ''  ){
829 828
 
830
-    if( empty( $lesson_id ) ){
829
+	if( empty( $lesson_id ) ){
831 830
 
832
-        $lesson_id = get_the_ID();
831
+		$lesson_id = get_the_ID();
833 832
 
834
-    }
833
+	}
835 834
 
836
-    if( empty( $user_id ) ){
835
+	if( empty( $user_id ) ){
837 836
 
838
-        $user_id = get_current_user_id();
837
+		$user_id = get_current_user_id();
839 838
 
840
-    }
839
+	}
841 840
 
842
-    // Check for prerequisite lesson completions
843
-    $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete( $lesson_id, $user_id );
844
-    $lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true );
845
-    $user_taking_course = WooThemes_Sensei_Utils::user_started_course( $lesson_course_id, $user_id );
841
+	// Check for prerequisite lesson completions
842
+	$pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete( $lesson_id, $user_id );
843
+	$lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true );
844
+	$user_taking_course = WooThemes_Sensei_Utils::user_started_course( $lesson_course_id, $user_id );
846 845
 
847
-    $is_preview = false;
848
-    if( WooThemes_Sensei_Utils::is_preview_lesson( $lesson_id ) ) {
846
+	$is_preview = false;
847
+	if( WooThemes_Sensei_Utils::is_preview_lesson( $lesson_id ) ) {
849 848
 
850
-        $is_preview = true;
851
-        $pre_requisite_complete = true;
849
+		$is_preview = true;
850
+		$pre_requisite_complete = true;
852 851
 
853
-    };
852
+	};
854 853
 
855 854
 
856
-    $user_can_access_lesson =  false;
855
+	$user_can_access_lesson =  false;
857 856
 
858
-    if( is_user_logged_in() && $user_taking_course ){
857
+	if( is_user_logged_in() && $user_taking_course ){
859 858
 
860
-        $user_can_access_lesson =  true;
859
+		$user_can_access_lesson =  true;
861 860
 
862
-    }
861
+	}
863 862
 
864 863
 
865
-    $access_permission = false;
864
+	$access_permission = false;
866 865
 
867
-    if ( ! Sensei()->settings->get('access_permission')  || sensei_all_access() ) {
866
+	if ( ! Sensei()->settings->get('access_permission')  || sensei_all_access() ) {
868 867
 
869
-        $access_permission = true;
868
+		$access_permission = true;
870 869
 
871
-    }
870
+	}
872 871
 
873
-    $can_user_view_lesson = $access_permission || ( $user_can_access_lesson && $pre_requisite_complete ) || $is_preview;
872
+	$can_user_view_lesson = $access_permission || ( $user_can_access_lesson && $pre_requisite_complete ) || $is_preview;
874 873
 
875
-    /**
876
-     * Filter the can user view lesson function
877
-     *
878
-     * @since 1.9.0
879
-     *
880
-     * @hooked Sensei_WC::alter_can_user_view_lesson
881
-     *
882
-     * @param bool $can_user_view_lesson
883
-     * @param string $lesson_id
884
-     * @param string $user_id
885
-     */
886
-    return apply_filters( 'sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id );
874
+	/**
875
+	 * Filter the can user view lesson function
876
+	 *
877
+	 * @since 1.9.0
878
+	 *
879
+	 * @hooked Sensei_WC::alter_can_user_view_lesson
880
+	 *
881
+	 * @param bool $can_user_view_lesson
882
+	 * @param string $lesson_id
883
+	 * @param string $user_id
884
+	 */
885
+	return apply_filters( 'sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id );
887 886
 
888 887
 } // end sensei_can_current_user_view_lesson
889 888
 
@@ -895,52 +894,52 @@  discard block
 block discarded – undo
895 894
  */
896 895
 function sensei_the_single_lesson_meta(){
897 896
 
898
-    // if the lesson meta is included within theme load that instead of the function content
899
-    $template = Sensei_Templates::locate_template( 'single-lesson/lesson-meta.php' );
900
-    if( ! empty( $template ) ){
897
+	// if the lesson meta is included within theme load that instead of the function content
898
+	$template = Sensei_Templates::locate_template( 'single-lesson/lesson-meta.php' );
899
+	if( ! empty( $template ) ){
901 900
 
902
-        Sensei_Templates::get_template( 'single-lesson/lesson-meta.php' );
903
-        return;
901
+		Sensei_Templates::get_template( 'single-lesson/lesson-meta.php' );
902
+		return;
904 903
 
905
-    }
904
+	}
906 905
 
907
-    // Get the meta info
908
-    $lesson_course_id = absint( get_post_meta( get_the_ID(), '_lesson_course', true ) );
909
-    $is_preview = WooThemes_Sensei_Utils::is_preview_lesson( get_the_ID() );
906
+	// Get the meta info
907
+	$lesson_course_id = absint( get_post_meta( get_the_ID(), '_lesson_course', true ) );
908
+	$is_preview = WooThemes_Sensei_Utils::is_preview_lesson( get_the_ID() );
910 909
 
911
-    // Get User Meta
912
-    get_currentuserinfo();
910
+	// Get User Meta
911
+	get_currentuserinfo();
913 912
 
914
-    // Complete Lesson Logic
915
-    do_action( 'sensei_complete_lesson' );
916
-    // Check that the course has been started
917
-    if ( Sensei()->access_settings()
918
-        || WooThemes_Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id())
919
-        || $is_preview ) {
920
-        ?>
913
+	// Complete Lesson Logic
914
+	do_action( 'sensei_complete_lesson' );
915
+	// Check that the course has been started
916
+	if ( Sensei()->access_settings()
917
+		|| WooThemes_Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id())
918
+		|| $is_preview ) {
919
+		?>
921 920
         <section class="lesson-meta">
922 921
             <?php
923
-            if( apply_filters( 'sensei_video_position', 'top', get_the_ID() ) == 'bottom' ) {
922
+			if( apply_filters( 'sensei_video_position', 'top', get_the_ID() ) == 'bottom' ) {
924 923
 
925
-                do_action( 'sensei_lesson_video', get_the_ID() );
924
+				do_action( 'sensei_lesson_video', get_the_ID() );
926 925
 
927
-            }
928
-            ?>
926
+			}
927
+			?>
929 928
             <?php do_action( 'sensei_frontend_messages' ); ?>
930 929
 
931 930
             <?php if ( ! $is_preview
932
-                || WooThemes_Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) ) {
931
+				|| WooThemes_Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) ) {
933 932
 
934
-                sensei_do_deprecated_action( 'sensei_lesson_quiz_meta','1.9.0', 'sensei_single_lesson_content_inside_before' ,array( get_the_ID(), get_current_user_id() )  );
933
+				sensei_do_deprecated_action( 'sensei_lesson_quiz_meta','1.9.0', 'sensei_single_lesson_content_inside_before' ,array( get_the_ID(), get_current_user_id() )  );
935 934
 
936
-            } ?>
935
+			} ?>
937 936
         </section>
938 937
 
939 938
         <?php do_action( 'sensei_lesson_back_link', $lesson_course_id ); ?>
940 939
 
941 940
     <?php }
942 941
 
943
-    do_action( 'sensei_lesson_meta_extra', get_the_ID() );
942
+	do_action( 'sensei_lesson_meta_extra', get_the_ID() );
944 943
 
945 944
 } // end the_single_lesson_meta
946 945
 
@@ -956,16 +955,16 @@  discard block
 block discarded – undo
956 955
  */
957 956
 function get_sensei_header(){
958 957
 
959
-    if ( ! defined( 'ABSPATH' ) ) exit;
958
+	if ( ! defined( 'ABSPATH' ) ) exit;
960 959
 
961
-    get_header();
960
+	get_header();
962 961
 
963
-    /**
964
-     * sensei_before_main_content hook
965
-     *
966
-     * @hooked sensei_output_content_wrapper - 10 (outputs opening divs for the content)
967
-     */
968
-    do_action( 'sensei_before_main_content' );
962
+	/**
963
+	 * sensei_before_main_content hook
964
+	 *
965
+	 * @hooked sensei_output_content_wrapper - 10 (outputs opening divs for the content)
966
+	 */
967
+	do_action( 'sensei_before_main_content' );
969 968
 
970 969
 }// end get_sensei_header
971 970
 
@@ -981,28 +980,28 @@  discard block
 block discarded – undo
981 980
  */
982 981
 function get_sensei_footer(){
983 982
 
984
-    /**
985
-     * sensei_pagination hook
986
-     *
987
-     * @hooked sensei_pagination - 10 (outputs pagination)
988
-     */
989
-    do_action( 'sensei_pagination' );
990
-
991
-    /**
992
-     * sensei_after_main_content hook
993
-     *
994
-     * @hooked sensei_output_content_wrapper_end - 10 (outputs closing divs for the content)
995
-     */
996
-    do_action( 'sensei_after_main_content' );
997
-
998
-    /**
999
-     * sensei_sidebar hook
1000
-     *
1001
-     * @hooked sensei_get_sidebar - 10
1002
-     */
1003
-    do_action( 'sensei_sidebar' );
1004
-
1005
-    get_footer();
983
+	/**
984
+	 * sensei_pagination hook
985
+	 *
986
+	 * @hooked sensei_pagination - 10 (outputs pagination)
987
+	 */
988
+	do_action( 'sensei_pagination' );
989
+
990
+	/**
991
+	 * sensei_after_main_content hook
992
+	 *
993
+	 * @hooked sensei_output_content_wrapper_end - 10 (outputs closing divs for the content)
994
+	 */
995
+	do_action( 'sensei_after_main_content' );
996
+
997
+	/**
998
+	 * sensei_sidebar hook
999
+	 *
1000
+	 * @hooked sensei_get_sidebar - 10
1001
+	 */
1002
+	do_action( 'sensei_sidebar' );
1003
+
1004
+	get_footer();
1006 1005
 
1007 1006
 }// end get_sensei_header
1008 1007
 
@@ -1014,14 +1013,14 @@  discard block
 block discarded – undo
1014 1013
  */
1015 1014
 function the_no_permissions_title(){
1016 1015
 
1017
-    /**
1018
-     * Filter the no permissions title just before it is echo'd on the
1019
-     * no-permissions.php file.
1020
-     *
1021
-     * @since 1.9.0
1022
-     * @param $no_permissions_title
1023
-     */
1024
-    echo apply_filters( 'sensei_the_no_permissions_title', Sensei()->permissions_message['title'] );
1016
+	/**
1017
+	 * Filter the no permissions title just before it is echo'd on the
1018
+	 * no-permissions.php file.
1019
+	 *
1020
+	 * @since 1.9.0
1021
+	 * @param $no_permissions_title
1022
+	 */
1023
+	echo apply_filters( 'sensei_the_no_permissions_title', Sensei()->permissions_message['title'] );
1025 1024
 
1026 1025
 }
1027 1026
 
@@ -1032,14 +1031,14 @@  discard block
 block discarded – undo
1032 1031
  */
1033 1032
 function the_no_permissions_message(){
1034 1033
 
1035
-    /**
1036
-     * Filter the no permissions message just before it is echo'd on the
1037
-     * no-permissions.php file.
1038
-     *
1039
-     * @since 1.9.0
1040
-     * @param $no_permissions_message
1041
-     */
1042
-    echo apply_filters( 'sensei_the_no_permissions_message', Sensei()->permissions_message['message'] );
1034
+	/**
1035
+	 * Filter the no permissions message just before it is echo'd on the
1036
+	 * no-permissions.php file.
1037
+	 *
1038
+	 * @since 1.9.0
1039
+	 * @param $no_permissions_message
1040
+	 */
1041
+	echo apply_filters( 'sensei_the_no_permissions_message', Sensei()->permissions_message['message'] );
1043 1042
 
1044 1043
 }
1045 1044
 
@@ -1050,8 +1049,8 @@  discard block
 block discarded – undo
1050 1049
  */
1051 1050
 function sensei_the_excerpt(){
1052 1051
 
1053
-    global $post;
1054
-    the_excerpt( $post );
1052
+	global $post;
1053
+	the_excerpt( $post );
1055 1054
 
1056 1055
 }
1057 1056
 
@@ -1065,9 +1064,9 @@  discard block
 block discarded – undo
1065 1064
  */
1066 1065
  function sensei_get_current_page_url(){
1067 1066
 
1068
-     global $wp;
1069
-     $current_page_url =  home_url( $wp->request );
1070
-     return $current_page_url;
1067
+	 global $wp;
1068
+	 $current_page_url =  home_url( $wp->request );
1069
+	 return $current_page_url;
1071 1070
 
1072 1071
  }
1073 1072
 
@@ -1079,7 +1078,7 @@  discard block
 block discarded – undo
1079 1078
  */
1080 1079
 function sensei_the_my_courses_content(){
1081 1080
 
1082
-    echo Sensei()->course->load_user_courses_content( wp_get_current_user() );
1081
+	echo Sensei()->course->load_user_courses_content( wp_get_current_user() );
1083 1082
 
1084 1083
 } // sensei_the_my_courses_content
1085 1084
 
@@ -1094,7 +1093,7 @@  discard block
 block discarded – undo
1094 1093
  */
1095 1094
 function sensei_load_template( $template_name ){
1096 1095
 
1097
-    Sensei_Templates::get_template( $template_name );
1096
+	Sensei_Templates::get_template( $template_name );
1098 1097
 
1099 1098
 }
1100 1099
 
@@ -1108,7 +1107,7 @@  discard block
 block discarded – undo
1108 1107
  */
1109 1108
 function sensei_load_template_part( $slug, $name ){
1110 1109
 
1111
-    Sensei_Templates::get_part( $slug, $name );
1110
+	Sensei_Templates::get_part( $slug, $name );
1112 1111
 
1113 1112
 }
1114 1113
 
@@ -1127,17 +1126,17 @@  discard block
 block discarded – undo
1127 1126
  */
1128 1127
 function sensei_the_lesson_excerpt( $lesson_id = '' ) {
1129 1128
 
1130
-    if( empty( $lesson_id )){
1129
+	if( empty( $lesson_id )){
1131 1130
 
1132
-        $lesson_id = get_the_ID();
1131
+		$lesson_id = get_the_ID();
1133 1132
 
1134
-    }
1133
+	}
1135 1134
 
1136
-    if( 'lesson' != get_post_type( $lesson_id ) ){
1137
-        return;
1138
-    }
1135
+	if( 'lesson' != get_post_type( $lesson_id ) ){
1136
+		return;
1137
+	}
1139 1138
 
1140
-    echo Sensei_Lesson::lesson_excerpt( get_post( $lesson_id ), false );
1139
+	echo Sensei_Lesson::lesson_excerpt( get_post( $lesson_id ), false );
1141 1140
 
1142 1141
 }// End lesson_excerpt()
1143 1142
 
@@ -1147,16 +1146,16 @@  discard block
 block discarded – undo
1147 1146
  * @since 1.9.0
1148 1147
  */
1149 1148
 function sensei_the_course_results_lessons(){
1150
-    // load backwards compatible template name if it exists in the users theme
1151
-    $located_template= locate_template( Sensei()->template_url . 'course-results/course-lessons.php' );
1152
-    if( $located_template ){
1149
+	// load backwards compatible template name if it exists in the users theme
1150
+	$located_template= locate_template( Sensei()->template_url . 'course-results/course-lessons.php' );
1151
+	if( $located_template ){
1153 1152
 
1154
-        Sensei_Templates::get_template( 'course-results/course-lessons.php' );
1155
-        return;
1153
+		Sensei_Templates::get_template( 'course-results/course-lessons.php' );
1154
+		return;
1156 1155
 
1157
-    }
1156
+	}
1158 1157
 
1159
-    Sensei_Templates::get_template( 'course-results/lessons.php' );
1158
+	Sensei_Templates::get_template( 'course-results/lessons.php' );
1160 1159
 }
1161 1160
 
1162 1161
 /**
@@ -1168,6 +1167,6 @@  discard block
 block discarded – undo
1168 1167
  */
1169 1168
 function sensei_courses_per_row(){
1170 1169
 
1171
-    echo Sensei_Course::get_loop_number_of_columns();
1170
+	echo Sensei_Course::get_loop_number_of_columns();
1172 1171
 
1173 1172
 }
Please login to merge, or discard this patch.
Spacing   +203 added lines, -203 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
 	 * 	Output tags.
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
      * @param string $type (default: 'newcourses')
13 13
      * @return void
14 14
      */
15
-    function sensei_course_archive_next_link( $type = 'newcourses' ) {
15
+    function sensei_course_archive_next_link($type = 'newcourses') {
16 16
 
17
-        _deprecated_function('sensei_course_archive_next_link', '1.9.0','This is no longer used or required in Sensei.');
17
+        _deprecated_function('sensei_course_archive_next_link', '1.9.0', 'This is no longer used or required in Sensei.');
18 18
 
19 19
     } // End sensei_course_archive_next_link()
20 20
 
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 	 function course_single_lessons() {
28 28
 
29 29
          // load backwards compatible template name if it exists in the users theme
30
-         $located_template= locate_template( Sensei()->template_url . 'single-course/course-lessons.php' );
31
-         if( $located_template ){
30
+         $located_template = locate_template(Sensei()->template_url.'single-course/course-lessons.php');
31
+         if ($located_template) {
32 32
 
33
-             Sensei_Templates::get_template( 'single-course/course-lessons.php' );
33
+             Sensei_Templates::get_template('single-course/course-lessons.php');
34 34
              return;
35 35
 
36 36
         }
37 37
 
38
-		Sensei_Templates::get_template( 'single-course/lessons.php' );
38
+		Sensei_Templates::get_template('single-course/lessons.php');
39 39
 
40 40
 	 } // End course_single_lessons()
41 41
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	  */
49 49
 	 function lesson_single_meta() {
50 50
 
51
-         _deprecated_function('lesson_single_meta','1.9;0', 'WooThemes_Sensei_Lesson::the_lesson_meta' );
51
+         _deprecated_function('lesson_single_meta', '1.9;0', 'WooThemes_Sensei_Lesson::the_lesson_meta');
52 52
          sensei_the_single_lesson_meta();
53 53
 
54 54
 	 } // End lesson_single_meta()
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 	  * @return void
63 63
       * @deprecated since 1.9.0
64 64
 	  */
65
-	 function quiz_questions( $return = false ) {
65
+	 function quiz_questions($return = false) {
66 66
 
67
-	 	Sensei_Templates::get_template( 'single-quiz/quiz-questions.php' );
67
+	 	Sensei_Templates::get_template('single-quiz/quiz-questions.php');
68 68
 
69 69
 	 } // End quiz_questions()
70 70
 
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 	  * @return void
77 77
       * @deprecated
78 78
 	  */
79
-	 function quiz_question_type( $question_type = 'multiple-choice' ) {
79
+	 function quiz_question_type($question_type = 'multiple-choice') {
80 80
 
81
-         Sensei_Templates::get_template( 'single-quiz/question_type-' . $question_type . '.php' );
81
+         Sensei_Templates::get_template('single-quiz/question_type-'.$question_type.'.php');
82 82
 
83 83
 	 } // End lesson_single_meta()
84 84
 
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 	 * @param mixed $course_id
95 95
 	 * @return void
96 96
 	 */
97
-	function sensei_check_prerequisite_course( $course_id ) {
97
+	function sensei_check_prerequisite_course($course_id) {
98 98
 		global $current_user;
99 99
 		// Get User Meta
100 100
 		get_currentuserinfo();
101
-		$course_prerequisite_id = (int) get_post_meta( $course_id, '_course_prerequisite', true);
101
+		$course_prerequisite_id = (int) get_post_meta($course_id, '_course_prerequisite', true);
102 102
 		$prequisite_complete = false;
103
-		if ( 0 < absint( $course_prerequisite_id ) ) {
104
-			$prequisite_complete = WooThemes_Sensei_Utils::user_completed_course( $course_prerequisite_id, $current_user->ID );
103
+		if (0 < absint($course_prerequisite_id)) {
104
+			$prequisite_complete = WooThemes_Sensei_Utils::user_completed_course($course_prerequisite_id, $current_user->ID);
105 105
 		} else {
106 106
 			$prequisite_complete = true;
107 107
 		} // End If Statement
@@ -118,16 +118,16 @@  discard block
 block discarded – undo
118 118
 	 * @param mixed $course_id
119 119
 	 * @return void
120 120
 	 */
121
-	function sensei_start_course_form( $course_id ) {
121
+	function sensei_start_course_form($course_id) {
122 122
 
123
-		$prerequisite_complete = sensei_check_prerequisite_course( $course_id );
123
+		$prerequisite_complete = sensei_check_prerequisite_course($course_id);
124 124
 
125
-		if ( $prerequisite_complete ) {
126
-		?><form method="POST" action="<?php echo esc_url( get_permalink() ); ?>">
125
+		if ($prerequisite_complete) {
126
+		?><form method="POST" action="<?php echo esc_url(get_permalink()); ?>">
127 127
 
128
-    			<input type="hidden" name="<?php echo esc_attr( 'woothemes_sensei_start_course_noonce' ); ?>" id="<?php echo esc_attr( 'woothemes_sensei_start_course_noonce' ); ?>" value="<?php echo esc_attr( wp_create_nonce( 'woothemes_sensei_start_course_noonce' ) ); ?>" />
128
+    			<input type="hidden" name="<?php echo esc_attr('woothemes_sensei_start_course_noonce'); ?>" id="<?php echo esc_attr('woothemes_sensei_start_course_noonce'); ?>" value="<?php echo esc_attr(wp_create_nonce('woothemes_sensei_start_course_noonce')); ?>" />
129 129
 
130
-    			<span><input name="course_start" type="submit" class="course-start" value="<?php _e( 'Start taking this Course', 'woothemes-sensei' ); ?>"/></span>
130
+    			<span><input name="course_start" type="submit" class="course-start" value="<?php _e('Start taking this Course', 'woothemes-sensei'); ?>"/></span>
131 131
 
132 132
     		</form><?php
133 133
     	} // End If Statement
@@ -141,58 +141,58 @@  discard block
 block discarded – undo
141 141
 	 * @param mixed $course_id
142 142
 	 * @return void
143 143
 	 */
144
-	function sensei_wc_add_to_cart( $course_id ) {
144
+	function sensei_wc_add_to_cart($course_id) {
145 145
 
146
-		$prerequisite_complete = sensei_check_prerequisite_course( $course_id );
146
+		$prerequisite_complete = sensei_check_prerequisite_course($course_id);
147 147
 
148
-		if ( $prerequisite_complete ) {
148
+		if ($prerequisite_complete) {
149 149
 
150 150
 			global $post, $current_user, $woocommerce;
151 151
 
152
-			$wc_post_id = get_post_meta( $post->ID, '_course_woocommerce_product', true );
152
+			$wc_post_id = get_post_meta($post->ID, '_course_woocommerce_product', true);
153 153
 
154 154
 			// Get User Meta
155 155
 			get_currentuserinfo();
156 156
 
157 157
 			// Check if customer purchased the product
158
-			if ( WooThemes_Sensei_Utils::sensei_customer_bought_product( $current_user->user_email, $current_user->ID, $wc_post_id ) ) { ?>
158
+			if (WooThemes_Sensei_Utils::sensei_customer_bought_product($current_user->user_email, $current_user->ID, $wc_post_id)) { ?>
159 159
 
160 160
 			    <div class="sensei-message tick">
161 161
 
162
-			    	<?php _e( 'You are currently taking this course.', 'woothemes-sensei' ); ?>
162
+			    	<?php _e('You are currently taking this course.', 'woothemes-sensei'); ?>
163 163
 
164 164
 			    </div>
165 165
 
166 166
 			<?php } else {
167 167
 
168 168
 			    // based on simple.php in WC templates/single-product/add-to-cart/
169
-			    if ( 0 < $wc_post_id ) {
169
+			    if (0 < $wc_post_id) {
170 170
 
171 171
 			        // Get the product
172
-			        $product = Sensei()->sensei_get_woocommerce_product_object( $wc_post_id );
173
-			        if ( ! isset ( $product ) || ! is_object( $product ) ) return;
174
-			        if ( $product->is_purchasable() ) {
172
+			        $product = Sensei()->sensei_get_woocommerce_product_object($wc_post_id);
173
+			        if ( ! isset ($product) || ! is_object($product)) return;
174
+			        if ($product->is_purchasable()) {
175 175
 			            // Check Product Availability
176 176
 			            $availability = $product->get_availability();
177 177
 			            if ($availability['availability']) {
178
-			                echo apply_filters( 'woocommerce_stock_html', '<p class="stock '.$availability['class'].'">'.$availability['availability'].'</p>', $availability['availability'] );
178
+			                echo apply_filters('woocommerce_stock_html', '<p class="stock '.$availability['class'].'">'.$availability['availability'].'</p>', $availability['availability']);
179 179
 			            } // End If Statement
180 180
 			            // Check for stock
181
-			            if ( $product->is_in_stock() ) { ?>
181
+			            if ($product->is_in_stock()) { ?>
182 182
 
183
-			                <?php if (! sensei_check_if_product_is_in_cart( $wc_post_id ) ) { ?>
183
+			                <?php if ( ! sensei_check_if_product_is_in_cart($wc_post_id)) { ?>
184 184
 
185
-			                    <form action="<?php echo esc_url( $product->add_to_cart_url() ); ?>" class="cart" method="post" enctype="multipart/form-data">
186
-			                        <input type="hidden" name="product_id" value="<?php echo esc_attr( $product->id ); ?>" />
185
+			                    <form action="<?php echo esc_url($product->add_to_cart_url()); ?>" class="cart" method="post" enctype="multipart/form-data">
186
+			                        <input type="hidden" name="product_id" value="<?php echo esc_attr($product->id); ?>" />
187 187
 			                        <input type="hidden" name="quantity" value="1" />
188
-			                        <?php if ( isset( $product->variation_id ) && 0 < intval( $product->variation_id ) ) { ?>
188
+			                        <?php if (isset($product->variation_id) && 0 < intval($product->variation_id)) { ?>
189 189
 
190 190
 			                            <input type="hidden" name="variation_id" value="<?php echo $product->variation_id; ?>" />
191
-			                            <?php if( isset( $product->variation_data ) && is_array( $product->variation_data ) && count( $product->variation_data ) > 0 ) { ?>
191
+			                            <?php if (isset($product->variation_data) && is_array($product->variation_data) && count($product->variation_data) > 0) { ?>
192 192
 
193
-			                                <?php foreach( $product->variation_data as $att => $val ) { ?>
193
+			                                <?php foreach ($product->variation_data as $att => $val) { ?>
194 194
 
195
-			                                    <input type="hidden" name="<?php echo esc_attr( $att ); ?>" id="<?php echo esc_attr( str_replace( 'attribute_', '', $att ) ); ?>" value="<?php echo esc_attr( $val ); ?>" />
195
+			                                    <input type="hidden" name="<?php echo esc_attr($att); ?>" id="<?php echo esc_attr(str_replace('attribute_', '', $att)); ?>" value="<?php echo esc_attr($val); ?>" />
196 196
 
197 197
 			                                <?php } ?>
198 198
 
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 
216 216
 			} // End If Statement
217 217
 
218
-			if ( !is_user_logged_in() ) {
218
+			if ( ! is_user_logged_in()) {
219 219
 
220
-			    $my_courses_page_id = intval( Sensei()->settings->settings[ 'my_course_page' ] );
221
-			    $login_link =  '<a href="' . esc_url( get_permalink( $my_courses_page_id ) ) . '">' . __( 'log in', 'woothemes-sensei' ) . '</a>'; ?>
220
+			    $my_courses_page_id = intval(Sensei()->settings->settings['my_course_page']);
221
+			    $login_link = '<a href="'.esc_url(get_permalink($my_courses_page_id)).'">'.__('log in', 'woothemes-sensei').'</a>'; ?>
222 222
 			    <p class="add-to-cart-login">
223
-			        <?php echo sprintf( __( 'Or %1$s to access your purchased courses', 'woothemes-sensei' ), $login_link ); ?>
223
+			        <?php echo sprintf(__('Or %1$s to access your purchased courses', 'woothemes-sensei'), $login_link); ?>
224 224
 			    </p>
225 225
 
226 226
 			<?php }
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 	 * @param int $wc_post_id (default: 0)
238 238
 	 * @return void
239 239
 	 */
240
-	function sensei_check_if_product_is_in_cart( $wc_product_id = 0 ) {
241
-        return Sensei_WC::is_product_in_cart( $wc_product_id );
240
+	function sensei_check_if_product_is_in_cart($wc_product_id = 0) {
241
+        return Sensei_WC::is_product_in_cart($wc_product_id);
242 242
 	} // End sensei_check_if_product_is_in_cart()
243 243
 
244 244
 	/**
@@ -248,16 +248,16 @@  discard block
 block discarded – undo
248 248
 	 * @param mixed $post_id
249 249
 	 * @return void
250 250
 	 */
251
-	function sensei_simple_course_price( $post_id ) {
251
+	function sensei_simple_course_price($post_id) {
252 252
 
253 253
 		//WooCommerce Pricing
254
-    	if ( WooThemes_Sensei_Utils::sensei_is_woocommerce_activated() ) {
255
-    	    $wc_post_id = get_post_meta( $post_id, '_course_woocommerce_product', true );
256
-    	    if ( 0 < $wc_post_id ) {
254
+    	if (WooThemes_Sensei_Utils::sensei_is_woocommerce_activated()) {
255
+    	    $wc_post_id = get_post_meta($post_id, '_course_woocommerce_product', true);
256
+    	    if (0 < $wc_post_id) {
257 257
     	    	// Get the product
258
-    	    	$product = Sensei()->sensei_get_woocommerce_product_object( $wc_post_id );
258
+    	    	$product = Sensei()->sensei_get_woocommerce_product_object($wc_post_id);
259 259
 
260
-    	    	if ( isset( $product ) && !empty( $product )  &&  $product->is_purchasable() && $product->is_in_stock() && !sensei_check_if_product_is_in_cart( $wc_post_id ) ) { ?>
260
+    	    	if (isset($product) && ! empty($product) && $product->is_purchasable() && $product->is_in_stock() && ! sensei_check_if_product_is_in_cart($wc_post_id)) { ?>
261 261
     	    		<span class="course-price"><?php echo $product->get_price_html(); ?></span>
262 262
     	    	<?php } // End If Statement
263 263
     	    } // End If Statement
@@ -271,11 +271,11 @@  discard block
 block discarded – undo
271 271
 	 * @param array $widget_args (default: array())
272 272
 	 * @return void
273 273
 	 */
274
-	function sensei_recent_comments_widget_filter( $widget_args = array() ) {
275
-		if ( ! isset( $widget_args['post_type'] ) ) $widget_args['post_type'] = array( 'post', 'page' );
274
+	function sensei_recent_comments_widget_filter($widget_args = array()) {
275
+		if ( ! isset($widget_args['post_type'])) $widget_args['post_type'] = array('post', 'page');
276 276
 		return $widget_args;
277 277
 	} // End sensei_recent_comments_widget_filter()
278
-	add_filter( 'widget_comments_args', 'sensei_recent_comments_widget_filter', 10, 1 );
278
+	add_filter('widget_comments_args', 'sensei_recent_comments_widget_filter', 10, 1);
279 279
 
280 280
 	/**
281 281
 	 * sensei_course_archive_filter function.
@@ -284,26 +284,26 @@  discard block
 block discarded – undo
284 284
 	 * @param array $query ( default: array ( ) )
285 285
 	 * @return void
286 286
 	 */
287
-	function sensei_course_archive_filter( $query ) {
287
+	function sensei_course_archive_filter($query) {
288 288
 
289 289
 
290
-		if ( ! $query->is_main_query() )
290
+		if ( ! $query->is_main_query())
291 291
         	return;
292 292
 
293 293
 		// Apply Filter only if on frontend and when course archive is running
294
-		$course_page_id = intval( Sensei()->settings->settings[ 'course_page' ] );
294
+		$course_page_id = intval(Sensei()->settings->settings['course_page']);
295 295
 
296
-		if ( ! is_admin() && 0 < $course_page_id && 0 < intval( $query->get( 'page_id' ) ) && $query->get( 'page_id' ) == $course_page_id ) {
296
+		if ( ! is_admin() && 0 < $course_page_id && 0 < intval($query->get('page_id')) && $query->get('page_id') == $course_page_id) {
297 297
 			// Check for pagination settings
298
-   			if ( isset( Sensei()->settings->settings[ 'course_archive_amount' ] ) && ( 0 < absint( Sensei()->settings->settings[ 'course_archive_amount' ] ) ) ) {
299
-    			$amount = absint( Sensei()->settings->settings[ 'course_archive_amount' ] );
298
+   			if (isset(Sensei()->settings->settings['course_archive_amount']) && (0 < absint(Sensei()->settings->settings['course_archive_amount']))) {
299
+    			$amount = absint(Sensei()->settings->settings['course_archive_amount']);
300 300
     		} else {
301
-    			$amount = $query->get( 'posts_per_page' );
301
+    			$amount = $query->get('posts_per_page');
302 302
     		} // End If Statement
303
-    		$query->set( 'posts_per_page', $amount );
303
+    		$query->set('posts_per_page', $amount);
304 304
 		} // End If Statement
305 305
 	} // End sensei_course_archive_filter()
306
-	add_filter( 'pre_get_posts', 'sensei_course_archive_filter', 10, 1 );
306
+	add_filter('pre_get_posts', 'sensei_course_archive_filter', 10, 1);
307 307
 
308 308
 	/**
309 309
 	 * sensei_complete_lesson_button description
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 	 * @return html
312 312
 	 */
313 313
 	function sensei_complete_lesson_button() {
314
-		do_action( 'sensei_complete_lesson_button' );
314
+		do_action('sensei_complete_lesson_button');
315 315
 	} // End sensei_complete_lesson_button()
316 316
 
317 317
 	/**
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 * @return html
321 321
 	 */
322 322
 	function sensei_reset_lesson_button() {
323
-		do_action( 'sensei_reset_lesson_button' );
323
+		do_action('sensei_reset_lesson_button');
324 324
 	} // End sensei_reset_lesson_button()
325 325
 
326 326
 	/**
@@ -329,19 +329,19 @@  discard block
 block discarded – undo
329 329
 	 * @param  integer $lesson_id
330 330
 	 * @return array $return_values
331 331
 	 */
332
-	function sensei_get_prev_next_lessons( $lesson_id = 0 ) {
332
+	function sensei_get_prev_next_lessons($lesson_id = 0) {
333 333
 
334 334
 		$return_values = array();
335 335
 		$return_values['prev_lesson'] = 0;
336 336
 		$return_values['next_lesson'] = 0;
337
-		if ( 0 < $lesson_id ) {
337
+		if (0 < $lesson_id) {
338 338
 			// Get the List of Lessons in the Course
339
-			$lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true );
339
+			$lesson_course_id = get_post_meta($lesson_id, '_lesson_course', true);
340 340
 			$all_lessons = array();
341 341
 
342
-            $modules = Sensei()->modules->get_course_modules( intval( $lesson_course_id ) );
342
+            $modules = Sensei()->modules->get_course_modules(intval($lesson_course_id));
343 343
 
344
-            foreach( (array) $modules as $module ) {
344
+            foreach ((array) $modules as $module) {
345 345
 
346 346
                 $args = array(
347 347
                     'post_type' => 'lesson',
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
                     'meta_query' => array(
351 351
                         array(
352 352
                             'key' => '_lesson_course',
353
-                            'value' => intval( $lesson_course_id ),
353
+                            'value' => intval($lesson_course_id),
354 354
                             'compare' => '='
355 355
                         )
356 356
                     ),
@@ -358,18 +358,18 @@  discard block
 block discarded – undo
358 358
                         array(
359 359
                             'taxonomy' => Sensei()->modules->taxonomy,
360 360
                             'field' => 'id',
361
-                            'terms' => intval( $module->term_id )
361
+                            'terms' => intval($module->term_id)
362 362
                         )
363 363
                     ),
364
-                    'meta_key' => '_order_module_' . $module->term_id,
364
+                    'meta_key' => '_order_module_'.$module->term_id,
365 365
                     'orderby' => 'meta_value_num date',
366 366
                     'order' => 'ASC',
367 367
                     'suppress_filters' => 0
368 368
                 );
369 369
 
370
-                $lessons = get_posts( $args );
371
-                if ( 0 < count( $lessons ) ) {
372
-                    foreach ($lessons as $lesson_item){
370
+                $lessons = get_posts($args);
371
+                if (0 < count($lessons)) {
372
+                    foreach ($lessons as $lesson_item) {
373 373
                         $all_lessons[] = $lesson_item->ID;
374 374
                     } // End For Loop
375 375
                 } // End If Statement
@@ -379,36 +379,36 @@  discard block
 block discarded – undo
379 379
                 'post_type' => 'lesson',
380 380
                 'posts_per_page' => -1,
381 381
                 'suppress_filters' => 0,
382
-                'meta_key' => '_order_' . $lesson_course_id,
382
+                'meta_key' => '_order_'.$lesson_course_id,
383 383
                 'orderby' => 'meta_value_num date',
384 384
                 'order' => 'ASC',
385 385
                 'meta_query' => array(
386 386
                     array(
387 387
                         'key' => '_lesson_course',
388
-                        'value' => intval( $lesson_course_id ),
388
+                        'value' => intval($lesson_course_id),
389 389
                     ),
390 390
                 ),
391 391
                 'post__not_in' => $all_lessons,
392 392
             );
393 393
 
394
-            $other_lessons = get_posts( $args );
395
-            if ( 0 < count( $other_lessons ) ) {
396
-				foreach ($other_lessons as $lesson_item){
394
+            $other_lessons = get_posts($args);
395
+            if (0 < count($other_lessons)) {
396
+				foreach ($other_lessons as $lesson_item) {
397 397
 					$all_lessons[] = $lesson_item->ID;
398 398
 				} // End For Loop
399 399
 			} // End If Statement
400 400
 
401
-            if ( 0 < count( $all_lessons ) ) {
401
+            if (0 < count($all_lessons)) {
402 402
 				$found_index = false;
403
-				foreach ( $all_lessons as $lesson ){
404
-					if ( $found_index && $return_values['next_lesson'] == 0 ) {
403
+				foreach ($all_lessons as $lesson) {
404
+					if ($found_index && $return_values['next_lesson'] == 0) {
405 405
 						$return_values['next_lesson'] = $lesson;
406 406
 					} // End If Statement
407
-					if ( $lesson == $lesson_id ) {
407
+					if ($lesson == $lesson_id) {
408 408
 						// Is the current post
409 409
 						$found_index = true;
410 410
 					} // End If Statement
411
-					if ( !$found_index ) {
411
+					if ( ! $found_index) {
412 412
 						$return_values['prev_lesson'] = $lesson;
413 413
 					} // End If Statement
414 414
 				} // End For Loop
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
    * @param  int|WP_Post $post_id Optional. Defaults to current post
428 428
    * @return string $excerpt
429 429
    */
430
-  function sensei_get_excerpt( $post_id = '' ) {
430
+  function sensei_get_excerpt($post_id = '') {
431 431
 
432 432
       global $post;
433 433
       _deprecated_function('sensei_get_excerpt', 'use the wordpress excerpt functionality.');
@@ -435,14 +435,14 @@  discard block
 block discarded – undo
435 435
 
436 436
   }
437 437
 
438
-	function sensei_has_user_started_course( $post_id = 0, $user_id = 0 ) {
439
-		_deprecated_function( __FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_started_course()" );
440
-		return WooThemes_Sensei_Utils::user_started_course( $post_id, $user_id );
438
+	function sensei_has_user_started_course($post_id = 0, $user_id = 0) {
439
+		_deprecated_function(__FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_started_course()");
440
+		return WooThemes_Sensei_Utils::user_started_course($post_id, $user_id);
441 441
 	} // End sensei_has_user_started_course()
442 442
 
443
-	function sensei_has_user_completed_lesson( $post_id = 0, $user_id = 0 ) {
444
-		_deprecated_function( __FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_completed_lesson()" );
445
-		return WooThemes_Sensei_Utils::user_completed_lesson( $post_id, $user_id );
443
+	function sensei_has_user_completed_lesson($post_id = 0, $user_id = 0) {
444
+		_deprecated_function(__FUNCTION__, '1.7', "WooThemes_Sensei_Utils::user_completed_lesson()");
445
+		return WooThemes_Sensei_Utils::user_completed_lesson($post_id, $user_id);
446 446
 	} // End sensei_has_user_completed_lesson()
447 447
 
448 448
 /**
@@ -454,9 +454,9 @@  discard block
 block discarded – undo
454 454
  * @param int $user_id
455 455
  * @return bool
456 456
 */
457
-function sensei_has_user_completed_prerequisite_lesson( $current_lesson_id, $user_id ) {
457
+function sensei_has_user_completed_prerequisite_lesson($current_lesson_id, $user_id) {
458 458
 
459
-    return WooThemes_Sensei_Lesson::is_pre_requisite_complete( $current_lesson_id, $user_id );
459
+    return WooThemes_Sensei_Lesson::is_pre_requisite_complete($current_lesson_id, $user_id);
460 460
 
461 461
 } // End sensei_has_user_completed_prerequisite_lesson()
462 462
 
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
  * @return bool
480 480
  *
481 481
  */
482
-function sensei_have_modules( $course_post_id = '' ){
482
+function sensei_have_modules($course_post_id = '') {
483 483
 
484 484
 	global $post, $wp_query, $sensei_modules_loop;
485 485
 
@@ -487,23 +487,23 @@  discard block
 block discarded – undo
487 487
 	wp_reset_query();
488 488
 	$post = $wp_query->post;
489 489
 
490
-	if( empty( $course_post_id ) ){
490
+	if (empty($course_post_id)) {
491 491
 
492 492
 		$course_id = $post->ID;
493 493
 
494 494
 	}
495 495
 
496 496
 	// doesn't apply to none course post types
497
-	if( ! sensei_is_a_course( $course_id )  ){
497
+	if ( ! sensei_is_a_course($course_id)) {
498 498
 		return false;
499 499
 	}
500 500
 
501 501
 	// check the current item compared to the total number of modules
502
-	if( $sensei_modules_loop[ 'current' ] + 1 > $sensei_modules_loop[ 'total' ]  ){
502
+	if ($sensei_modules_loop['current'] + 1 > $sensei_modules_loop['total']) {
503 503
 
504 504
 		return false;
505 505
 
506
-	}else{
506
+	} else {
507 507
 
508 508
 		return true;
509 509
 
@@ -517,27 +517,27 @@  discard block
 block discarded – undo
517 517
  *
518 518
  * @since 1.9.0
519 519
  */
520
-function sensei_setup_module(){
520
+function sensei_setup_module() {
521 521
 
522 522
 	global  $sensei_modules_loop, $wp_query;
523 523
 
524 524
 	// increment the index
525
-	$sensei_modules_loop[ 'current' ]++;
526
-	$index = $sensei_modules_loop[ 'current' ];
527
-	if( isset( $sensei_modules_loop['modules'][ $index ] ) ) {
525
+	$sensei_modules_loop['current']++;
526
+	$index = $sensei_modules_loop['current'];
527
+	if (isset($sensei_modules_loop['modules'][$index])) {
528 528
 
529 529
 		$sensei_modules_loop['current_module'] = $sensei_modules_loop['modules'][$index];
530 530
 		// setup the query for the module lessons
531 531
 		$course_id = $sensei_modules_loop['course_id'];
532 532
 		$module_term_id = $sensei_modules_loop['current_module']->term_id;
533
-		$modules_query = Sensei()->modules->get_lessons_query( $course_id , $module_term_id );
533
+		$modules_query = Sensei()->modules->get_lessons_query($course_id, $module_term_id);
534 534
 
535 535
 		// setup the global wp-query only if the lessons
536
-		if( $modules_query->have_posts() ){
536
+		if ($modules_query->have_posts()) {
537 537
 
538 538
 			$wp_query = $modules_query;
539 539
 
540
-		}else{
540
+		} else {
541 541
 
542 542
 			wp_reset_query();
543 543
 
@@ -561,30 +561,30 @@  discard block
 block discarded – undo
561 561
  *
562 562
  * @return bool
563 563
  */
564
-function sensei_module_has_lessons(){
564
+function sensei_module_has_lessons() {
565 565
 
566 566
 	global $wp_query, $sensei_modules_loop;
567 567
 
568
-	if( 'lesson' == $wp_query->get('post_type') ){
568
+	if ('lesson' == $wp_query->get('post_type')) {
569 569
 
570 570
 		return have_posts();
571 571
 
572
-	}else{
572
+	} else {
573 573
 
574 574
         // if the loop has not been initiated check the first module has lessons
575
-        if( -1 == $sensei_modules_loop[ 'current' ]  ){
575
+        if ( -1 == $sensei_modules_loop['current']  ) {
576 576
 
577 577
             $index = 0;
578 578
 
579
-            if( isset( $sensei_modules_loop['modules'][ $index ] ) ) {
579
+            if (isset($sensei_modules_loop['modules'][$index])) {
580 580
                 // setup the query for the module lessons
581 581
                 $course_id = $sensei_modules_loop['course_id'];
582 582
 
583
-                $module_term_id = $sensei_modules_loop['modules'][ $index ] ->term_id;
584
-                $modules_query = Sensei()->modules->get_lessons_query( $course_id , $module_term_id );
583
+                $module_term_id = $sensei_modules_loop['modules'][$index] ->term_id;
584
+                $modules_query = Sensei()->modules->get_lessons_query($course_id, $module_term_id);
585 585
 
586 586
                 // setup the global wp-query only if the lessons
587
-                if( $modules_query->have_posts() ){
587
+                if ($modules_query->have_posts()) {
588 588
 
589 589
                     return true;
590 590
 
@@ -608,9 +608,9 @@  discard block
 block discarded – undo
608 608
  * @uses sensei_the_module_title
609 609
  * @return string
610 610
  */
611
-function sensei_the_module_title_attribute(){
611
+function sensei_the_module_title_attribute() {
612 612
 
613
-	esc_attr_e( sensei_get_the_module_title() );
613
+	esc_attr_e(sensei_get_the_module_title());
614 614
 
615 615
 }
616 616
 
@@ -621,11 +621,11 @@  discard block
 block discarded – undo
621 621
  *
622 622
  * @return string
623 623
  */
624
-function sensei_the_module_permalink(){
624
+function sensei_the_module_permalink() {
625 625
 
626 626
 	global $sensei_modules_loop;
627 627
 	$course_id = $sensei_modules_loop['course_id'];
628
-	$module_url = add_query_arg('course_id', $course_id, get_term_link( $sensei_modules_loop['current_module'], 'module' ) );
628
+	$module_url = add_query_arg('course_id', $course_id, get_term_link($sensei_modules_loop['current_module'], 'module'));
629 629
 	$module_term_id = $sensei_modules_loop['current_module']->term_id;
630 630
 
631 631
 	/**
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 	 * @param int $module_term_id
638 638
 	 * @param string $course_id
639 639
 	 */
640
-	 echo esc_url_raw( apply_filters( 'sensei_the_module_permalink', $module_url, $module_term_id  ,$course_id ) );
640
+	 echo esc_url_raw(apply_filters('sensei_the_module_permalink', $module_url, $module_term_id, $course_id));
641 641
 
642 642
 }// end sensei_the_module_permalink
643 643
 
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
  *
650 650
  * @return string
651 651
  */
652
-function sensei_get_the_module_title(){
652
+function sensei_get_the_module_title() {
653 653
 
654 654
 	global $sensei_modules_loop;
655 655
 
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 	 * @param $module_term_id
669 669
 	 * @param $course_id
670 670
 	 */
671
-	return apply_filters( 'sensei_the_module_title',  $module_title , $module_term_id, $course_id );
671
+	return apply_filters('sensei_the_module_title', $module_title, $module_term_id, $course_id);
672 672
 
673 673
 }
674 674
 
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
  * @uses sensei_get_the_module_title
681 681
  * @return string
682 682
  */
683
-function sensei_the_module_title(){
683
+function sensei_the_module_title() {
684 684
 
685 685
 	echo sensei_get_the_module_title();
686 686
 
@@ -701,19 +701,19 @@  discard block
 block discarded – undo
701 701
  *
702 702
  * @return bool
703 703
  */
704
-function sensei_quiz_has_questions(){
704
+function sensei_quiz_has_questions() {
705 705
 
706 706
     global $sensei_question_loop;
707 707
 
708
-    if( !isset( $sensei_question_loop['total'] ) ){
708
+    if ( ! isset($sensei_question_loop['total'])) {
709 709
         return false;
710 710
     }
711 711
 
712
-    if( $sensei_question_loop['current'] + 1 < $sensei_question_loop['total']  ){
712
+    if ($sensei_question_loop['current'] + 1 < $sensei_question_loop['total']) {
713 713
 
714 714
         return true;
715 715
 
716
-    }else{
716
+    } else {
717 717
 
718 718
         return false;
719 719
 
@@ -730,13 +730,13 @@  discard block
 block discarded – undo
730 730
  * @since 1.9.0
731 731
 
732 732
  */
733
-function sensei_setup_the_question(){
733
+function sensei_setup_the_question() {
734 734
 
735 735
     global $sensei_question_loop;
736 736
 
737 737
     $sensei_question_loop['current']++;
738 738
     $index = $sensei_question_loop['current'];
739
-    $sensei_question_loop['current_question'] =  $sensei_question_loop['questions'][ $index ] ;
739
+    $sensei_question_loop['current_question'] = $sensei_question_loop['questions'][$index];
740 740
 
741 741
 
742 742
 }// end sensei_setup_the_question
@@ -747,14 +747,14 @@  discard block
 block discarded – undo
747 747
  * This function gets the type and loads the template that will handle it.
748 748
  *
749 749
  */
750
-function sensei_the_question_content(){
750
+function sensei_the_question_content() {
751 751
 
752 752
     global $sensei_question_loop;
753 753
 
754
-    $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID );
754
+    $question_type = Sensei()->question->get_question_type($sensei_question_loop['current_question']->ID);
755 755
 
756 756
     // load the template that displays the question information.
757
-    WooThemes_Sensei_Question::load_question_template( $question_type );
757
+    WooThemes_Sensei_Question::load_question_template($question_type);
758 758
 
759 759
 }// end sensei_the_question_content
760 760
 
@@ -763,11 +763,11 @@  discard block
 block discarded – undo
763 763
  *
764 764
  * @since 1.9.0
765 765
  */
766
-function sensei_the_question_class(){
766
+function sensei_the_question_class() {
767 767
 
768 768
     global $sensei_question_loop;
769 769
 
770
-    $question_type = Sensei()->question->get_question_type( $sensei_question_loop['current_question']->ID );
770
+    $question_type = Sensei()->question->get_question_type($sensei_question_loop['current_question']->ID);
771 771
 
772 772
     /**
773 773
      * filter the sensei question class within
@@ -775,16 +775,16 @@  discard block
 block discarded – undo
775 775
      *
776 776
      * @since 1.9.0
777 777
      */
778
-     $classes = apply_filters( 'sensei_question_classes', array( $question_type ) );
778
+     $classes = apply_filters('sensei_question_classes', array($question_type));
779 779
 
780 780
     $html_classes = '';
781
-    foreach( $classes as $class ){
781
+    foreach ($classes as $class) {
782 782
 
783
-        $html_classes .= $class . ' ';
783
+        $html_classes .= $class.' ';
784 784
 
785 785
     }// end foreach
786 786
 
787
-    esc_attr_e( trim( $html_classes ) );
787
+    esc_attr_e(trim($html_classes));
788 788
 
789 789
 }
790 790
 
@@ -793,10 +793,10 @@  discard block
 block discarded – undo
793 793
  *
794 794
  * @since 1.9.0
795 795
  */
796
-function sensei_get_the_question_id( ){
796
+function sensei_get_the_question_id( ) {
797 797
 
798 798
     global $sensei_question_loop;
799
-    if( isset( $sensei_question_loop['current_question']->ID ) ){
799
+    if (isset($sensei_question_loop['current_question']->ID)) {
800 800
 
801 801
         return $sensei_question_loop['current_question']->ID;
802 802
 
@@ -825,27 +825,27 @@  discard block
 block discarded – undo
825 825
  * @param string $lesson_id
826 826
  * @return bool
827 827
  */
828
-function sensei_can_user_view_lesson( $lesson_id = '', $user_id = ''  ){
828
+function sensei_can_user_view_lesson($lesson_id = '', $user_id = '') {
829 829
 
830
-    if( empty( $lesson_id ) ){
830
+    if (empty($lesson_id)) {
831 831
 
832 832
         $lesson_id = get_the_ID();
833 833
 
834 834
     }
835 835
 
836
-    if( empty( $user_id ) ){
836
+    if (empty($user_id)) {
837 837
 
838 838
         $user_id = get_current_user_id();
839 839
 
840 840
     }
841 841
 
842 842
     // Check for prerequisite lesson completions
843
-    $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete( $lesson_id, $user_id );
844
-    $lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true );
845
-    $user_taking_course = WooThemes_Sensei_Utils::user_started_course( $lesson_course_id, $user_id );
843
+    $pre_requisite_complete = WooThemes_Sensei_Lesson::is_prerequisite_complete($lesson_id, $user_id);
844
+    $lesson_course_id = get_post_meta($lesson_id, '_lesson_course', true);
845
+    $user_taking_course = WooThemes_Sensei_Utils::user_started_course($lesson_course_id, $user_id);
846 846
 
847 847
     $is_preview = false;
848
-    if( WooThemes_Sensei_Utils::is_preview_lesson( $lesson_id ) ) {
848
+    if (WooThemes_Sensei_Utils::is_preview_lesson($lesson_id)) {
849 849
 
850 850
         $is_preview = true;
851 851
         $pre_requisite_complete = true;
@@ -853,24 +853,24 @@  discard block
 block discarded – undo
853 853
     };
854 854
 
855 855
 
856
-    $user_can_access_lesson =  false;
856
+    $user_can_access_lesson = false;
857 857
 
858
-    if( is_user_logged_in() && $user_taking_course ){
858
+    if (is_user_logged_in() && $user_taking_course) {
859 859
 
860
-        $user_can_access_lesson =  true;
860
+        $user_can_access_lesson = true;
861 861
 
862 862
     }
863 863
 
864 864
 
865 865
     $access_permission = false;
866 866
 
867
-    if ( ! Sensei()->settings->get('access_permission')  || sensei_all_access() ) {
867
+    if ( ! Sensei()->settings->get('access_permission') || sensei_all_access()) {
868 868
 
869 869
         $access_permission = true;
870 870
 
871 871
     }
872 872
 
873
-    $can_user_view_lesson = $access_permission || ( $user_can_access_lesson && $pre_requisite_complete ) || $is_preview;
873
+    $can_user_view_lesson = $access_permission || ($user_can_access_lesson && $pre_requisite_complete) || $is_preview;
874 874
 
875 875
     /**
876 876
      * Filter the can user view lesson function
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
      * @param string $lesson_id
884 884
      * @param string $user_id
885 885
      */
886
-    return apply_filters( 'sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id );
886
+    return apply_filters('sensei_can_user_view_lesson', $can_user_view_lesson, $lesson_id, $user_id);
887 887
 
888 888
 } // end sensei_can_current_user_view_lesson
889 889
 
@@ -893,54 +893,54 @@  discard block
 block discarded – undo
893 893
  * The function should only be called on the single lesson
894 894
  *
895 895
  */
896
-function sensei_the_single_lesson_meta(){
896
+function sensei_the_single_lesson_meta() {
897 897
 
898 898
     // if the lesson meta is included within theme load that instead of the function content
899
-    $template = Sensei_Templates::locate_template( 'single-lesson/lesson-meta.php' );
900
-    if( ! empty( $template ) ){
899
+    $template = Sensei_Templates::locate_template('single-lesson/lesson-meta.php');
900
+    if ( ! empty($template)) {
901 901
 
902
-        Sensei_Templates::get_template( 'single-lesson/lesson-meta.php' );
902
+        Sensei_Templates::get_template('single-lesson/lesson-meta.php');
903 903
         return;
904 904
 
905 905
     }
906 906
 
907 907
     // Get the meta info
908
-    $lesson_course_id = absint( get_post_meta( get_the_ID(), '_lesson_course', true ) );
909
-    $is_preview = WooThemes_Sensei_Utils::is_preview_lesson( get_the_ID() );
908
+    $lesson_course_id = absint(get_post_meta(get_the_ID(), '_lesson_course', true));
909
+    $is_preview = WooThemes_Sensei_Utils::is_preview_lesson(get_the_ID());
910 910
 
911 911
     // Get User Meta
912 912
     get_currentuserinfo();
913 913
 
914 914
     // Complete Lesson Logic
915
-    do_action( 'sensei_complete_lesson' );
915
+    do_action('sensei_complete_lesson');
916 916
     // Check that the course has been started
917
-    if ( Sensei()->access_settings()
918
-        || WooThemes_Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id())
919
-        || $is_preview ) {
917
+    if (Sensei()->access_settings()
918
+        || WooThemes_Sensei_Utils::user_started_course($lesson_course_id, get_current_user_id())
919
+        || $is_preview) {
920 920
         ?>
921 921
         <section class="lesson-meta">
922 922
             <?php
923
-            if( apply_filters( 'sensei_video_position', 'top', get_the_ID() ) == 'bottom' ) {
923
+            if (apply_filters('sensei_video_position', 'top', get_the_ID()) == 'bottom') {
924 924
 
925
-                do_action( 'sensei_lesson_video', get_the_ID() );
925
+                do_action('sensei_lesson_video', get_the_ID());
926 926
 
927 927
             }
928 928
             ?>
929
-            <?php do_action( 'sensei_frontend_messages' ); ?>
929
+            <?php do_action('sensei_frontend_messages'); ?>
930 930
 
931 931
             <?php if ( ! $is_preview
932
-                || WooThemes_Sensei_Utils::user_started_course( $lesson_course_id, get_current_user_id()) ) {
932
+                || WooThemes_Sensei_Utils::user_started_course($lesson_course_id, get_current_user_id())) {
933 933
 
934
-                sensei_do_deprecated_action( 'sensei_lesson_quiz_meta','1.9.0', 'sensei_single_lesson_content_inside_before' ,array( get_the_ID(), get_current_user_id() )  );
934
+                sensei_do_deprecated_action('sensei_lesson_quiz_meta', '1.9.0', 'sensei_single_lesson_content_inside_before', array(get_the_ID(), get_current_user_id()));
935 935
 
936 936
             } ?>
937 937
         </section>
938 938
 
939
-        <?php do_action( 'sensei_lesson_back_link', $lesson_course_id ); ?>
939
+        <?php do_action('sensei_lesson_back_link', $lesson_course_id); ?>
940 940
 
941 941
     <?php }
942 942
 
943
-    do_action( 'sensei_lesson_meta_extra', get_the_ID() );
943
+    do_action('sensei_lesson_meta_extra', get_the_ID());
944 944
 
945 945
 } // end the_single_lesson_meta
946 946
 
@@ -954,9 +954,9 @@  discard block
 block discarded – undo
954 954
  *
955 955
  * @since 1.9.0
956 956
  */
957
-function get_sensei_header(){
957
+function get_sensei_header() {
958 958
 
959
-    if ( ! defined( 'ABSPATH' ) ) exit;
959
+    if ( ! defined('ABSPATH')) exit;
960 960
 
961 961
     get_header();
962 962
 
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
      *
966 966
      * @hooked sensei_output_content_wrapper - 10 (outputs opening divs for the content)
967 967
      */
968
-    do_action( 'sensei_before_main_content' );
968
+    do_action('sensei_before_main_content');
969 969
 
970 970
 }// end get_sensei_header
971 971
 
@@ -979,28 +979,28 @@  discard block
 block discarded – undo
979 979
  *
980 980
  * @since 1.9.0
981 981
  */
982
-function get_sensei_footer(){
982
+function get_sensei_footer() {
983 983
 
984 984
     /**
985 985
      * sensei_pagination hook
986 986
      *
987 987
      * @hooked sensei_pagination - 10 (outputs pagination)
988 988
      */
989
-    do_action( 'sensei_pagination' );
989
+    do_action('sensei_pagination');
990 990
 
991 991
     /**
992 992
      * sensei_after_main_content hook
993 993
      *
994 994
      * @hooked sensei_output_content_wrapper_end - 10 (outputs closing divs for the content)
995 995
      */
996
-    do_action( 'sensei_after_main_content' );
996
+    do_action('sensei_after_main_content');
997 997
 
998 998
     /**
999 999
      * sensei_sidebar hook
1000 1000
      *
1001 1001
      * @hooked sensei_get_sidebar - 10
1002 1002
      */
1003
-    do_action( 'sensei_sidebar' );
1003
+    do_action('sensei_sidebar');
1004 1004
 
1005 1005
     get_footer();
1006 1006
 
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
  *
1013 1013
  * @since 1.9.0
1014 1014
  */
1015
-function the_no_permissions_title(){
1015
+function the_no_permissions_title() {
1016 1016
 
1017 1017
     /**
1018 1018
      * Filter the no permissions title just before it is echo'd on the
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
      * @since 1.9.0
1022 1022
      * @param $no_permissions_title
1023 1023
      */
1024
-    echo apply_filters( 'sensei_the_no_permissions_title', Sensei()->permissions_message['title'] );
1024
+    echo apply_filters('sensei_the_no_permissions_title', Sensei()->permissions_message['title']);
1025 1025
 
1026 1026
 }
1027 1027
 
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
  *
1031 1031
  * @since 1.9.0
1032 1032
  */
1033
-function the_no_permissions_message(){
1033
+function the_no_permissions_message() {
1034 1034
 
1035 1035
     /**
1036 1036
      * Filter the no permissions message just before it is echo'd on the
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
      * @since 1.9.0
1040 1040
      * @param $no_permissions_message
1041 1041
      */
1042
-    echo apply_filters( 'sensei_the_no_permissions_message', Sensei()->permissions_message['message'] );
1042
+    echo apply_filters('sensei_the_no_permissions_message', Sensei()->permissions_message['message']);
1043 1043
 
1044 1044
 }
1045 1045
 
@@ -1048,10 +1048,10 @@  discard block
 block discarded – undo
1048 1048
  *
1049 1049
  * @since 1.9.0
1050 1050
  */
1051
-function sensei_the_excerpt(){
1051
+function sensei_the_excerpt() {
1052 1052
 
1053 1053
     global $post;
1054
-    the_excerpt( $post );
1054
+    the_excerpt($post);
1055 1055
 
1056 1056
 }
1057 1057
 
@@ -1063,10 +1063,10 @@  discard block
 block discarded – undo
1063 1063
  * @global WP $wp
1064 1064
  * @return string $current_page_url
1065 1065
  */
1066
- function sensei_get_current_page_url(){
1066
+ function sensei_get_current_page_url() {
1067 1067
 
1068 1068
      global $wp;
1069
-     $current_page_url =  home_url( $wp->request );
1069
+     $current_page_url = home_url($wp->request);
1070 1070
      return $current_page_url;
1071 1071
 
1072 1072
  }
@@ -1077,9 +1077,9 @@  discard block
 block discarded – undo
1077 1077
  *
1078 1078
  * @since 1.9.0
1079 1079
  */
1080
-function sensei_the_my_courses_content(){
1080
+function sensei_the_my_courses_content() {
1081 1081
 
1082
-    echo Sensei()->course->load_user_courses_content( wp_get_current_user() );
1082
+    echo Sensei()->course->load_user_courses_content(wp_get_current_user());
1083 1083
 
1084 1084
 } // sensei_the_my_courses_content
1085 1085
 
@@ -1092,9 +1092,9 @@  discard block
 block discarded – undo
1092 1092
  *
1093 1093
  * @since 1.9.0
1094 1094
  */
1095
-function sensei_load_template( $template_name ){
1095
+function sensei_load_template($template_name) {
1096 1096
 
1097
-    Sensei_Templates::get_template( $template_name );
1097
+    Sensei_Templates::get_template($template_name);
1098 1098
 
1099 1099
 }
1100 1100
 
@@ -1106,9 +1106,9 @@  discard block
 block discarded – undo
1106 1106
  * @param string $name the name of the template.
1107 1107
  * @since 1.9.0
1108 1108
  */
1109
-function sensei_load_template_part( $slug, $name ){
1109
+function sensei_load_template_part($slug, $name) {
1110 1110
 
1111
-    Sensei_Templates::get_part( $slug, $name );
1111
+    Sensei_Templates::get_part($slug, $name);
1112 1112
 
1113 1113
 }
1114 1114
 
@@ -1125,19 +1125,19 @@  discard block
 block discarded – undo
1125 1125
  * @access public
1126 1126
  * @param string $lesson_id
1127 1127
  */
1128
-function sensei_the_lesson_excerpt( $lesson_id = '' ) {
1128
+function sensei_the_lesson_excerpt($lesson_id = '') {
1129 1129
 
1130
-    if( empty( $lesson_id )){
1130
+    if (empty($lesson_id)) {
1131 1131
 
1132 1132
         $lesson_id = get_the_ID();
1133 1133
 
1134 1134
     }
1135 1135
 
1136
-    if( 'lesson' != get_post_type( $lesson_id ) ){
1136
+    if ('lesson' != get_post_type($lesson_id)) {
1137 1137
         return;
1138 1138
     }
1139 1139
 
1140
-    echo Sensei_Lesson::lesson_excerpt( get_post( $lesson_id ), false );
1140
+    echo Sensei_Lesson::lesson_excerpt(get_post($lesson_id), false);
1141 1141
 
1142 1142
 }// End lesson_excerpt()
1143 1143
 
@@ -1146,17 +1146,17 @@  discard block
 block discarded – undo
1146 1146
  *
1147 1147
  * @since 1.9.0
1148 1148
  */
1149
-function sensei_the_course_results_lessons(){
1149
+function sensei_the_course_results_lessons() {
1150 1150
     // load backwards compatible template name if it exists in the users theme
1151
-    $located_template= locate_template( Sensei()->template_url . 'course-results/course-lessons.php' );
1152
-    if( $located_template ){
1151
+    $located_template = locate_template(Sensei()->template_url.'course-results/course-lessons.php');
1152
+    if ($located_template) {
1153 1153
 
1154
-        Sensei_Templates::get_template( 'course-results/course-lessons.php' );
1154
+        Sensei_Templates::get_template('course-results/course-lessons.php');
1155 1155
         return;
1156 1156
 
1157 1157
     }
1158 1158
 
1159
-    Sensei_Templates::get_template( 'course-results/lessons.php' );
1159
+    Sensei_Templates::get_template('course-results/lessons.php');
1160 1160
 }
1161 1161
 
1162 1162
 /**
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
  * @uses Sensei_Course::get_loop_number_of_columns
1167 1167
  * @since 1.9.0
1168 1168
  */
1169
-function sensei_courses_per_row(){
1169
+function sensei_courses_per_row() {
1170 1170
 
1171 1171
     echo Sensei_Course::get_loop_number_of_columns();
1172 1172
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -9 removed lines patch added patch discarded remove patch
@@ -170,7 +170,9 @@  discard block
 block discarded – undo
170 170
 
171 171
 			        // Get the product
172 172
 			        $product = Sensei()->sensei_get_woocommerce_product_object( $wc_post_id );
173
-			        if ( ! isset ( $product ) || ! is_object( $product ) ) return;
173
+			        if ( ! isset ( $product ) || ! is_object( $product ) ) {
174
+			        	return;
175
+			        }
174 176
 			        if ( $product->is_purchasable() ) {
175 177
 			            // Check Product Availability
176 178
 			            $availability = $product->get_availability();
@@ -272,7 +274,9 @@  discard block
 block discarded – undo
272 274
 	 * @return void
273 275
 	 */
274 276
 	function sensei_recent_comments_widget_filter( $widget_args = array() ) {
275
-		if ( ! isset( $widget_args['post_type'] ) ) $widget_args['post_type'] = array( 'post', 'page' );
277
+		if ( ! isset( $widget_args['post_type'] ) ) {
278
+			$widget_args['post_type'] = array( 'post', 'page' );
279
+		}
276 280
 		return $widget_args;
277 281
 	} // End sensei_recent_comments_widget_filter()
278 282
 	add_filter( 'widget_comments_args', 'sensei_recent_comments_widget_filter', 10, 1 );
@@ -287,8 +291,9 @@  discard block
 block discarded – undo
287 291
 	function sensei_course_archive_filter( $query ) {
288 292
 
289 293
 
290
-		if ( ! $query->is_main_query() )
291
-        	return;
294
+		if ( ! $query->is_main_query() ) {
295
+		        	return;
296
+		}
292 297
 
293 298
 		// Apply Filter only if on frontend and when course archive is running
294 299
 		$course_page_id = intval( Sensei()->settings->settings[ 'course_page' ] );
@@ -503,7 +508,7 @@  discard block
 block discarded – undo
503 508
 
504 509
 		return false;
505 510
 
506
-	}else{
511
+	} else{
507 512
 
508 513
 		return true;
509 514
 
@@ -537,7 +542,7 @@  discard block
 block discarded – undo
537 542
 
538 543
 			$wp_query = $modules_query;
539 544
 
540
-		}else{
545
+		} else{
541 546
 
542 547
 			wp_reset_query();
543 548
 
@@ -569,7 +574,7 @@  discard block
 block discarded – undo
569 574
 
570 575
 		return have_posts();
571 576
 
572
-	}else{
577
+	} else{
573 578
 
574 579
         // if the loop has not been initiated check the first module has lessons
575 580
         if( -1 == $sensei_modules_loop[ 'current' ]  ){
@@ -713,7 +718,7 @@  discard block
 block discarded – undo
713 718
 
714 719
         return true;
715 720
 
716
-    }else{
721
+    } else{
717 722
 
718 723
         return false;
719 724
 
@@ -956,7 +961,9 @@  discard block
 block discarded – undo
956 961
  */
957 962
 function get_sensei_header(){
958 963
 
959
-    if ( ! defined( 'ABSPATH' ) ) exit;
964
+    if ( ! defined( 'ABSPATH' ) ) {
965
+    	exit;
966
+    }
960 967
 
961 968
     get_header();
962 969
 
Please login to merge, or discard this patch.
widgets/widget-woothemes-sensei-course-component.php 4 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -167,8 +167,6 @@
 block discarded – undo
167 167
 
168 168
 	/**
169 169
 	 * Load the desired component, if a method is available for it.
170
-	 * @param  string $component The component to potentially be loaded.
171
-     *
172 170
 	 * @since  1.0.0
173 171
 	 * @return void
174 172
 	 */
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		remove_filter( 'pre_get_posts', 'sensei_course_archive_filter', 10, 1 );
65 65
 
66 66
 		if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) )
67
-            && ( 'activecourses' == $instance['component'] || 'completedcourses' == $instance['component'] )
68
-            && !is_user_logged_in() ) {
67
+			&& ( 'activecourses' == $instance['component'] || 'completedcourses' == $instance['component'] )
68
+			&& !is_user_logged_in() ) {
69 69
 
70 70
 			// No Output
71
-            return;
71
+			return;
72 72
 
73 73
 		} else {
74 74
 			/* Our variables from the widget settings. */
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @param  array $instance The settings for this instance.
131 131
 	 * @return void
132 132
 	 */
133
-    public function form( $instance ) {
133
+	public function form( $instance ) {
134 134
 
135 135
 		/* Set up some default widget settings. */
136 136
 		/* Make sure all keys are added here, even with empty string values. */
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	/**
169 169
 	 * Load the desired component, if a method is available for it.
170 170
 	 * @param  string $component The component to potentially be loaded.
171
-     *
171
+	 *
172 172
 	 * @since  1.0.0
173 173
 	 * @return void
174 174
 	 */
@@ -207,24 +207,24 @@  discard block
 block discarded – undo
207 207
 
208 208
 		}
209 209
 
210
-        if ( ! empty( $course_ids ) ) {
210
+		if ( ! empty( $course_ids ) ) {
211 211
 
212
-            $posts_array = Sensei()->course->course_query( intval( $instance['limit'] ), esc_attr( $instance['component'] ), $course_ids );
212
+			$posts_array = Sensei()->course->course_query( intval( $instance['limit'] ), esc_attr( $instance['component'] ), $course_ids );
213 213
 
214 214
 		} else {
215 215
 
216
-            if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
216
+			if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
217 217
 				$posts_array = array();
218 218
 
219
-            } else {
219
+			} else {
220 220
 
221
-                $course_args = array(
222
-                    'post_type' => 'course',
223
-                    'orderby'         	=> 'date',
224
-                    'order'           	=> 'DESC',
225
-                    'post_status'      	=> 'publish',
226
-                    'posts_per_page' => $instance['limit'],
227
-                );
221
+				$course_args = array(
222
+					'post_type' => 'course',
223
+					'orderby'         	=> 'date',
224
+					'order'           	=> 'DESC',
225
+					'post_status'      	=> 'publish',
226
+					'posts_per_page' => $instance['limit'],
227
+				);
228 228
 
229 229
 				$posts_array = get_posts( $course_args );
230 230
 			}
@@ -234,13 +234,13 @@  discard block
 block discarded – undo
234 234
 		if ( count( $posts_array ) > 0 ) { ?>
235 235
 			<ul>
236 236
 			<?php foreach ($posts_array as $post_item){
237
-		    	$post_id = absint( $post_item->ID );
238
-		    	$post_title = $post_item->post_title;
239
-		    	$user_info = get_userdata( absint( $post_item->post_author ) );
240
-		    	$author_link = get_author_posts_url( absint( $post_item->post_author ) );
241
-		    	$author_display_name = $user_info->display_name;
242
-		    	$author_id = $post_item->post_author;
243
-		    ?>
237
+				$post_id = absint( $post_item->ID );
238
+				$post_title = $post_item->post_title;
239
+				$user_info = get_userdata( absint( $post_item->post_author ) );
240
+				$author_link = get_author_posts_url( absint( $post_item->post_author ) );
241
+				$author_display_name = $user_info->display_name;
242
+				$author_id = $post_item->post_author;
243
+			?>
244 244
 		    	<li class="fix">
245 245
 		    		<?php do_action( 'sensei_course_image', $post_id ); ?>
246 246
 		    		<a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a>
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
 		    	</li>
256 256
 		    <?php } // End For Loop ?>
257 257
 		    <?php if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
258
-		    	$my_account_page_id = intval( Sensei()->settings->settings[ 'my_course_page' ] );
259
-		    	echo '<li class="my-account fix"><a href="'. esc_url( get_permalink( $my_account_page_id ) ) .'">'.__('My Courses', 'woothemes-sensei').' <span class="meta-nav"></span></a></li>';
260
-		    } // End If Statement ?>
258
+				$my_account_page_id = intval( Sensei()->settings->settings[ 'my_course_page' ] );
259
+				echo '<li class="my-account fix"><a href="'. esc_url( get_permalink( $my_account_page_id ) ) .'">'.__('My Courses', 'woothemes-sensei').' <span class="meta-nav"></span></a></li>';
260
+			} // End If Statement ?>
261 261
 		</ul>
262 262
 		<?php } else {
263 263
 			// No posts returned. This means the user either has no active or no completed courses.
Please login to merge, or discard this patch.
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
2
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly.
3 3
 
4 4
 /**
5 5
  * Sensei Course Component Widget
@@ -26,30 +26,30 @@  discard block
 block discarded – undo
26 26
 	public function __construct() {
27 27
 		/* Widget variable settings. */
28 28
 		$this->woo_widget_cssclass = 'widget_sensei_course_component';
29
-		$this->woo_widget_description = __( 'This widget will output a list of Courses - New, Featured, Free, Paid, Active, Completed.', 'woothemes-sensei' );
29
+		$this->woo_widget_description = __('This widget will output a list of Courses - New, Featured, Free, Paid, Active, Completed.', 'woothemes-sensei');
30 30
 		$this->woo_widget_idbase = 'sensei_course_component';
31
-		$this->woo_widget_title = __( 'Sensei - Course Component', 'woothemes-sensei' );
31
+		$this->woo_widget_title = __('Sensei - Course Component', 'woothemes-sensei');
32 32
 
33 33
 		$this->woo_widget_componentslist = array(
34
-												'usercourses' => __( 'New Courses', 'woothemes-sensei' ),
35
-												'featuredcourses' => __( 'Featured Courses', 'woothemes-sensei' ),
36
-												'activecourses' => __( 'My Active Courses', 'woothemes-sensei' ),
37
-												'completedcourses' => __( 'My Completed Courses', 'woothemes-sensei' ),
34
+												'usercourses' => __('New Courses', 'woothemes-sensei'),
35
+												'featuredcourses' => __('Featured Courses', 'woothemes-sensei'),
36
+												'activecourses' => __('My Active Courses', 'woothemes-sensei'),
37
+												'completedcourses' => __('My Completed Courses', 'woothemes-sensei'),
38 38
 												);
39 39
 
40 40
 		// Add support for the WooCommerce shelf.
41
-		if ( Sensei_WC::is_woocommerce_active() ) {
42
-			$this->woo_widget_componentslist['freecourses'] = __( 'Free Courses', 'woothemes-sensei' );
43
-			$this->woo_widget_componentslist['paidcourses'] = __( 'Paid Courses', 'woothemes-sensei' );
41
+		if (Sensei_WC::is_woocommerce_active()) {
42
+			$this->woo_widget_componentslist['freecourses'] = __('Free Courses', 'woothemes-sensei');
43
+			$this->woo_widget_componentslist['paidcourses'] = __('Paid Courses', 'woothemes-sensei');
44 44
 		}
45 45
 		/* Widget settings. */
46
-		$widget_ops = array( 'classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description );
46
+		$widget_ops = array('classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description);
47 47
 
48 48
 		/* Widget control settings. */
49
-		$control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase );
49
+		$control_ops = array('width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase);
50 50
 
51 51
 		/* Create the widget. */
52
-		parent::__construct( $this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops );
52
+		parent::__construct($this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops);
53 53
 	} // End __construct()
54 54
 
55 55
 	/**
@@ -59,44 +59,44 @@  discard block
 block discarded – undo
59 59
 	 * @param  array $instance Widget settings for this instance.
60 60
 	 * @return void
61 61
 	 */
62
-	public function widget( $args, $instance ) {
62
+	public function widget($args, $instance) {
63 63
 
64
-		remove_filter( 'pre_get_posts', 'sensei_course_archive_filter', 10, 1 );
64
+		remove_filter('pre_get_posts', 'sensei_course_archive_filter', 10, 1);
65 65
 
66
-		if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) )
67
-            && ( 'activecourses' == $instance['component'] || 'completedcourses' == $instance['component'] )
68
-            && !is_user_logged_in() ) {
66
+		if (in_array($instance['component'], array_keys($this->woo_widget_componentslist))
67
+            && ('activecourses' == $instance['component'] || 'completedcourses' == $instance['component'])
68
+            && ! is_user_logged_in()) {
69 69
 
70 70
 			// No Output
71 71
             return;
72 72
 
73 73
 		} else {
74 74
 			/* Our variables from the widget settings. */
75
-			$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
75
+			$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
76 76
 
77 77
 			/* Before widget (defined by themes). */
78 78
 			echo $args['before_widget'];
79 79
 
80 80
 			/* Display the widget title if one was input (before and after defined by themes). */
81
-			if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; }
81
+			if ($title) { echo $args['before_title'].$title.$args['after_title']; }
82 82
 
83 83
 			/* Widget content. */
84 84
 			// Add actions for plugins/themes to hook onto.
85
-			do_action( $this->woo_widget_cssclass . '_top' );
85
+			do_action($this->woo_widget_cssclass.'_top');
86 86
 
87
-			if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) ) ) {
88
-				$this->load_component( $instance );
87
+			if (in_array($instance['component'], array_keys($this->woo_widget_componentslist))) {
88
+				$this->load_component($instance);
89 89
 			}
90 90
 
91 91
 			// Add actions for plugins/themes to hook onto.
92
-			do_action( $this->woo_widget_cssclass . '_bottom' );
92
+			do_action($this->woo_widget_cssclass.'_bottom');
93 93
 
94 94
 			/* After widget (defined by themes). */
95 95
 			echo $args['after_widget'];
96 96
 
97 97
 		} // End If Statement
98 98
 
99
-		add_filter( 'pre_get_posts', 'sensei_course_archive_filter', 10, 1 );
99
+		add_filter('pre_get_posts', 'sensei_course_archive_filter', 10, 1);
100 100
 
101 101
 	} // End widget()
102 102
 
@@ -107,17 +107,17 @@  discard block
 block discarded – undo
107 107
 	 * @param  array $old_instance Previous settings.
108 108
 	 * @return array               Updated settings.
109 109
 	 */
110
-	public function update ( $new_instance, $old_instance ) {
110
+	public function update($new_instance, $old_instance) {
111 111
 		$instance = $old_instance;
112 112
 
113 113
 		/* Strip tags for title and name to remove HTML (important for text inputs). */
114
-		$instance['title'] = strip_tags( $new_instance['title'] );
114
+		$instance['title'] = strip_tags($new_instance['title']);
115 115
 
116 116
 		/* The select box is returning a text value, so we escape it. */
117
-		$instance['component'] = esc_attr( $new_instance['component'] );
117
+		$instance['component'] = esc_attr($new_instance['component']);
118 118
 
119 119
 		/* The select box is returning a text value, so we escape it. */
120
-		$instance['limit'] = esc_attr( $new_instance['limit'] );
120
+		$instance['limit'] = esc_attr($new_instance['limit']);
121 121
 
122 122
 
123 123
 		return $instance;
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @param  array $instance The settings for this instance.
131 131
 	 * @return void
132 132
 	 */
133
-    public function form( $instance ) {
133
+    public function form($instance) {
134 134
 
135 135
 		/* Set up some default widget settings. */
136 136
 		/* Make sure all keys are added here, even with empty string values. */
@@ -140,26 +140,26 @@  discard block
 block discarded – undo
140 140
 						'limit' => 3
141 141
 					);
142 142
 
143
-		$instance = wp_parse_args( (array) $instance, $defaults );
143
+		$instance = wp_parse_args((array) $instance, $defaults);
144 144
 ?>
145 145
 		<!-- Widget Title: Text Input -->
146 146
 		<p>
147
-			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label>
148
-			<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"  value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" />
147
+			<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title (optional):', 'woothemes-sensei'); ?></label>
148
+			<input type="text" name="<?php echo esc_attr($this->get_field_name('title')); ?>"  value="<?php echo esc_attr($instance['title']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" />
149 149
 		</p>
150 150
 		<!-- Widget Component: Select Input -->
151 151
 		<p>
152
-			<label for="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>"><?php _e( 'Component:', 'woothemes-sensei' ); ?></label>
153
-			<select name="<?php echo esc_attr( $this->get_field_name( 'component' ) ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>">
154
-			<?php foreach ( $this->woo_widget_componentslist as $k => $v ) { ?>
155
-				<option value="<?php echo esc_attr( $k ); ?>"<?php selected( $instance['component'], $k ); ?>><?php echo $v; ?></option>
152
+			<label for="<?php echo esc_attr($this->get_field_id('component')); ?>"><?php _e('Component:', 'woothemes-sensei'); ?></label>
153
+			<select name="<?php echo esc_attr($this->get_field_name('component')); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('component')); ?>">
154
+			<?php foreach ($this->woo_widget_componentslist as $k => $v) { ?>
155
+				<option value="<?php echo esc_attr($k); ?>"<?php selected($instance['component'], $k); ?>><?php echo $v; ?></option>
156 156
 			<?php } ?>
157 157
 			</select>
158 158
 		</p>
159 159
 		<!-- Widget Limit: Text Input -->
160 160
 		<p>
161
-			<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Courses (optional):', 'woothemes-sensei' ); ?></label>
162
-			<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>"  value="<?php echo esc_attr( $instance['limit'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" />
161
+			<label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php _e('Number of Courses (optional):', 'woothemes-sensei'); ?></label>
162
+			<input type="text" name="<?php echo esc_attr($this->get_field_name('limit')); ?>"  value="<?php echo esc_attr($instance['limit']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('limit')); ?>" />
163 163
 		</p>
164 164
 
165 165
 <?php
@@ -172,28 +172,28 @@  discard block
 block discarded – undo
172 172
 	 * @since  1.0.0
173 173
 	 * @return void
174 174
 	 */
175
-	protected function load_component ( $instance ) {
175
+	protected function load_component($instance) {
176 176
 		global  $current_user;
177 177
 
178 178
 		get_currentuserinfo();
179 179
 
180 180
 		$course_ids = array();
181
-		if ( 'activecourses' == esc_attr( $instance['component'] ) ) {
182
-			$courses = WooThemes_Sensei_Utils::sensei_check_for_activity( array( 'user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'in-progress' ), true );
181
+		if ('activecourses' == esc_attr($instance['component'])) {
182
+			$courses = WooThemes_Sensei_Utils::sensei_check_for_activity(array('user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'in-progress'), true);
183 183
 			// Need to always return an array, even with only 1 item
184
-			if ( !is_array($courses) ) {
185
-				$courses = array( $courses );
184
+			if ( ! is_array($courses)) {
185
+				$courses = array($courses);
186 186
 			}
187
-			foreach( $courses AS $course ) {
187
+			foreach ($courses AS $course) {
188 188
 				$course_ids[] = $course->comment_post_ID;
189 189
 			}
190
-		} elseif( 'completedcourses' == esc_attr( $instance['component'] ) ) {
191
-			$courses = WooThemes_Sensei_Utils::sensei_check_for_activity( array( 'user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'complete' ), true );
190
+		} elseif ('completedcourses' == esc_attr($instance['component'])) {
191
+			$courses = WooThemes_Sensei_Utils::sensei_check_for_activity(array('user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'complete'), true);
192 192
 			// Need to always return an array, even with only 1 item
193
-			if ( !is_array($courses) ) {
194
-				$courses = array( $courses );
193
+			if ( ! is_array($courses)) {
194
+				$courses = array($courses);
195 195
 			}
196
-			foreach( $courses AS $course ) {
196
+			foreach ($courses AS $course) {
197 197
 				$course_ids[] = $course->comment_post_ID;
198 198
 			}
199 199
 		} // End If Statement
@@ -201,19 +201,19 @@  discard block
 block discarded – undo
201 201
 		$posts_array = array();
202 202
 
203 203
 		// course_query() is buggy, it doesn't honour the 1st arg if includes are provided, so instead slice the includes
204
-		if ( !empty($instance['limit']) && intval( $instance['limit'] ) >= 1 && intval( $instance['limit'] ) < count($course_ids) ) {
204
+		if ( ! empty($instance['limit']) && intval($instance['limit']) >= 1 && intval($instance['limit']) < count($course_ids)) {
205 205
 
206
-			$course_ids = array_slice( $course_ids, 0, intval( $instance['limit'] ) ); // This does mean the order by is effectively ignored
206
+			$course_ids = array_slice($course_ids, 0, intval($instance['limit'])); // This does mean the order by is effectively ignored
207 207
 
208 208
 		}
209 209
 
210
-        if ( ! empty( $course_ids ) ) {
210
+        if ( ! empty($course_ids)) {
211 211
 
212
-            $posts_array = Sensei()->course->course_query( intval( $instance['limit'] ), esc_attr( $instance['component'] ), $course_ids );
212
+            $posts_array = Sensei()->course->course_query(intval($instance['limit']), esc_attr($instance['component']), $course_ids);
213 213
 
214 214
 		} else {
215 215
 
216
-            if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
216
+            if ('activecourses' == esc_attr($instance['component']) || 'completedcourses' == esc_attr($instance['component'])) {
217 217
 				$posts_array = array();
218 218
 
219 219
             } else {
@@ -226,43 +226,43 @@  discard block
 block discarded – undo
226 226
                     'posts_per_page' => $instance['limit'],
227 227
                 );
228 228
 
229
-				$posts_array = get_posts( $course_args );
229
+				$posts_array = get_posts($course_args);
230 230
 			}
231 231
 
232 232
 		} // End If Statement
233 233
 
234
-		if ( count( $posts_array ) > 0 ) { ?>
234
+		if (count($posts_array) > 0) { ?>
235 235
 			<ul>
236
-			<?php foreach ($posts_array as $post_item){
237
-		    	$post_id = absint( $post_item->ID );
236
+			<?php foreach ($posts_array as $post_item) {
237
+		    	$post_id = absint($post_item->ID);
238 238
 		    	$post_title = $post_item->post_title;
239
-		    	$user_info = get_userdata( absint( $post_item->post_author ) );
240
-		    	$author_link = get_author_posts_url( absint( $post_item->post_author ) );
239
+		    	$user_info = get_userdata(absint($post_item->post_author));
240
+		    	$author_link = get_author_posts_url(absint($post_item->post_author));
241 241
 		    	$author_display_name = $user_info->display_name;
242 242
 		    	$author_id = $post_item->post_author;
243 243
 		    ?>
244 244
 		    	<li class="fix">
245
-		    		<?php do_action( 'sensei_course_image', $post_id ); ?>
246
-		    		<a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a>
245
+		    		<?php do_action('sensei_course_image', $post_id); ?>
246
+		    		<a href="<?php echo esc_url(get_permalink($post_id)); ?>" title="<?php echo esc_attr($post_title); ?>"><?php echo $post_title; ?></a>
247 247
 		    		<br />
248
-		    		<?php if ( isset( Sensei()->settings->settings[ 'course_author' ] ) && ( Sensei()->settings->settings[ 'course_author' ] ) ) { ?>
249
-    					<span class="course-author"><?php _e( 'by ', 'woothemes-sensei' ); ?><a href="<?php echo esc_url( $author_link ); ?>" title="<?php echo esc_attr( $author_display_name ); ?>"><?php echo esc_html( $author_display_name ); ?></a></span>
248
+		    		<?php if (isset(Sensei()->settings->settings['course_author']) && (Sensei()->settings->settings['course_author'])) { ?>
249
+    					<span class="course-author"><?php _e('by ', 'woothemes-sensei'); ?><a href="<?php echo esc_url($author_link); ?>" title="<?php echo esc_attr($author_display_name); ?>"><?php echo esc_html($author_display_name); ?></a></span>
250 250
     					<br />
251 251
     				<?php } // End If Statement ?>
252
-    				<span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count( $post_id ) . '&nbsp;' . __( 'Lessons', 'woothemes-sensei' ); ?></span>
252
+    				<span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count($post_id).'&nbsp;'.__('Lessons', 'woothemes-sensei'); ?></span>
253 253
     				<br />
254
-    				<?php sensei_simple_course_price( $post_id ); ?>
254
+    				<?php sensei_simple_course_price($post_id); ?>
255 255
 		    	</li>
256 256
 		    <?php } // End For Loop ?>
257
-		    <?php if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
258
-		    	$my_account_page_id = intval( Sensei()->settings->settings[ 'my_course_page' ] );
259
-		    	echo '<li class="my-account fix"><a href="'. esc_url( get_permalink( $my_account_page_id ) ) .'">'.__('My Courses', 'woothemes-sensei').' <span class="meta-nav"></span></a></li>';
257
+		    <?php if ('activecourses' == esc_attr($instance['component']) || 'completedcourses' == esc_attr($instance['component'])) {
258
+		    	$my_account_page_id = intval(Sensei()->settings->settings['my_course_page']);
259
+		    	echo '<li class="my-account fix"><a href="'.esc_url(get_permalink($my_account_page_id)).'">'.__('My Courses', 'woothemes-sensei').' <span class="meta-nav"></span></a></li>';
260 260
 		    } // End If Statement ?>
261 261
 		</ul>
262 262
 		<?php } else {
263 263
 			// No posts returned. This means the user either has no active or no completed courses.
264
-			$course_status = substr( esc_attr( $instance['component'] ) , 0, -7);
265
-			echo sprintf( __( 'You have no %1s courses.', 'woothemes-sensei' ), $course_status );
264
+			$course_status = substr(esc_attr($instance['component']), 0, -7);
265
+			echo sprintf(__('You have no %1s courses.', 'woothemes-sensei'), $course_status);
266 266
 		} // End If Statement
267 267
 	} // End load_component()
268 268
 } // End Class
269 269
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
5
+// Exit if accessed directly.
3 6
 
4 7
 /**
5 8
  * Sensei Course Component Widget
Please login to merge, or discard this patch.
widgets/widget-woothemes-sensei-lesson-component.php 4 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -151,7 +151,6 @@
 block discarded – undo
151 151
 
152 152
 	/**
153 153
 	 * Load the desired component, if a method is available for it.
154
-	 * @param  string $component The component to potentially be loaded.
155 154
 	 * @since  5.0.8
156 155
 	 * @return void
157 156
 	 */
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 * @param  array $instance The settings for this instance.
115 115
 	 * @return void
116 116
 	 */
117
-    public function form( $instance ) {
117
+	public function form( $instance ) {
118 118
 
119 119
 		/* Set up some default widget settings. */
120 120
 		/* Make sure all keys are added here, even with empty string values. */
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 		$post_args = array(	'post_type' 		=> 'lesson',
169 169
 							'posts_per_page' 		=> intval( $instance[ 'limit' ] ),
170 170
 							'orderby'         	=> 'menu_order date',
171
-    						'order'           	=> 'DESC',
172
-    						'post_status'       => 'publish',
171
+							'order'           	=> 'DESC',
172
+							'post_status'       => 'publish',
173 173
 							'suppress_filters' 	=> 0
174 174
 							);
175 175
 		$posts_array = get_posts( $post_args );
@@ -177,14 +177,14 @@  discard block
 block discarded – undo
177 177
 		if ( count( $posts_array ) > 0 ) { ?>
178 178
 			<ul>
179 179
 			<?php foreach ($posts_array as $post_item){
180
-		    	$post_id = absint( $post_item->ID );
181
-		    	$post_title = $post_item->post_title;
182
-		    	$user_info = get_userdata( absint( $post_item->post_author ) );
183
-		    	$author_link = get_author_posts_url( absint( $post_item->post_author ) );
184
-		    	$author_display_name = $user_info->display_name;
185
-		    	$author_id = $post_item->post_author;
186
-		    	$lesson_course_id = get_post_meta( $post_id, '_lesson_course', true );
187
-		    ?>
180
+				$post_id = absint( $post_item->ID );
181
+				$post_title = $post_item->post_title;
182
+				$user_info = get_userdata( absint( $post_item->post_author ) );
183
+				$author_link = get_author_posts_url( absint( $post_item->post_author ) );
184
+				$author_display_name = $user_info->display_name;
185
+				$author_id = $post_item->post_author;
186
+				$lesson_course_id = get_post_meta( $post_id, '_lesson_course', true );
187
+			?>
188 188
 		    	<li class="fix">
189 189
 		    		<?php do_action( 'sensei_lesson_image', $post_id, '100', '100', false, true ); ?>
190 190
 		    		<a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a>
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
2
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly.
3 3
 
4 4
 /**
5 5
  * Sensei Lesson Component Widget
@@ -26,22 +26,22 @@  discard block
 block discarded – undo
26 26
 	public function __construct() {
27 27
 		/* Widget variable settings. */
28 28
 		$this->woo_widget_cssclass = 'widget_sensei_lesson_component';
29
-		$this->woo_widget_description = __( 'This widget will output a list of the latest Lessons.', 'woothemes-sensei' );
29
+		$this->woo_widget_description = __('This widget will output a list of the latest Lessons.', 'woothemes-sensei');
30 30
 		$this->woo_widget_idbase = 'sensei_lesson_component';
31
-		$this->woo_widget_title = __( 'Sensei - Lesson Component', 'woothemes-sensei' );
31
+		$this->woo_widget_title = __('Sensei - Lesson Component', 'woothemes-sensei');
32 32
 
33 33
 		$this->woo_widget_componentslist = array(
34
-												'newlessons' => __( 'New Lessons', 'woothemes-sensei' ),
34
+												'newlessons' => __('New Lessons', 'woothemes-sensei'),
35 35
 												);
36 36
 
37 37
 		/* Widget settings. */
38
-		$widget_ops = array( 'classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description );
38
+		$widget_ops = array('classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description);
39 39
 
40 40
 		/* Widget control settings. */
41
-		$control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase );
41
+		$control_ops = array('width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase);
42 42
 
43 43
 		/* Create the widget. */
44
-		parent::__construct( $this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops );
44
+		parent::__construct($this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops);
45 45
 	} // End __construct()
46 46
 
47 47
 	/**
@@ -51,32 +51,32 @@  discard block
 block discarded – undo
51 51
 	 * @param  array $instance Widget settings for this instance.
52 52
 	 * @return void
53 53
 	 */
54
-	public function widget( $args, $instance ) {
55
-		extract( $args, EXTR_SKIP );
54
+	public function widget($args, $instance) {
55
+		extract($args, EXTR_SKIP);
56 56
 
57 57
 
58
-		if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) ) && ( 'activecourses' == $instance['component'] || 'completedcourses' == $instance['component'] ) && !is_user_logged_in() ) {
58
+		if (in_array($instance['component'], array_keys($this->woo_widget_componentslist)) && ('activecourses' == $instance['component'] || 'completedcourses' == $instance['component']) && ! is_user_logged_in()) {
59 59
 			// No Output
60 60
 		} else {
61 61
 			/* Our variables from the widget settings. */
62
-			$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
62
+			$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
63 63
 
64 64
 			/* Before widget (defined by themes). */
65 65
 			echo $before_widget;
66 66
 
67 67
 			/* Display the widget title if one was input (before and after defined by themes). */
68
-			if ( $title ) { echo $before_title . $title . $after_title; }
68
+			if ($title) { echo $before_title.$title.$after_title; }
69 69
 
70 70
 			/* Widget content. */
71 71
 			// Add actions for plugins/themes to hook onto.
72
-			do_action( $this->woo_widget_cssclass . '_top' );
72
+			do_action($this->woo_widget_cssclass.'_top');
73 73
 
74
-			if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) ) ) {
75
-				$this->load_component( $instance );
74
+			if (in_array($instance['component'], array_keys($this->woo_widget_componentslist))) {
75
+				$this->load_component($instance);
76 76
 			}
77 77
 
78 78
 			// Add actions for plugins/themes to hook onto.
79
-			do_action( $this->woo_widget_cssclass . '_bottom' );
79
+			do_action($this->woo_widget_cssclass.'_bottom');
80 80
 
81 81
 			/* After widget (defined by themes). */
82 82
 			echo $after_widget;
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 91
 	 * @param  array $old_instance Previous settings.
92 92
 	 * @return array               Updated settings.
93 93
 	 */
94
-	public function update ( $new_instance, $old_instance ) {
94
+	public function update($new_instance, $old_instance) {
95 95
 		$instance = $old_instance;
96 96
 
97 97
 		/* Strip tags for title and name to remove HTML (important for text inputs). */
98
-		$instance['title'] = strip_tags( $new_instance['title'] );
98
+		$instance['title'] = strip_tags($new_instance['title']);
99 99
 
100 100
 		/* The select box is returning a text value, so we escape it. */
101
-		$instance['component'] = esc_attr( $new_instance['component'] );
101
+		$instance['component'] = esc_attr($new_instance['component']);
102 102
 
103 103
 		/* The select box is returning a text value, so we escape it. */
104
-		$instance['limit'] = esc_attr( $new_instance['limit'] );
104
+		$instance['limit'] = esc_attr($new_instance['limit']);
105 105
 
106 106
 
107 107
 		return $instance;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 * @param  array $instance The settings for this instance.
115 115
 	 * @return void
116 116
 	 */
117
-    public function form( $instance ) {
117
+    public function form($instance) {
118 118
 
119 119
 		/* Set up some default widget settings. */
120 120
 		/* Make sure all keys are added here, even with empty string values. */
@@ -124,26 +124,26 @@  discard block
 block discarded – undo
124 124
 						'limit' => 3
125 125
 					);
126 126
 
127
-		$instance = wp_parse_args( (array) $instance, $defaults );
127
+		$instance = wp_parse_args((array) $instance, $defaults);
128 128
 ?>
129 129
 		<!-- Widget Title: Text Input -->
130 130
 		<p>
131
-			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label>
132
-			<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"  value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" />
131
+			<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title (optional):', 'woothemes-sensei'); ?></label>
132
+			<input type="text" name="<?php echo esc_attr($this->get_field_name('title')); ?>"  value="<?php echo esc_attr($instance['title']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" />
133 133
 		</p>
134 134
 		<!-- Widget Component: Select Input -->
135 135
 		<p>
136
-			<label for="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>"><?php _e( 'Component:', 'woothemes-sensei' ); ?></label>
137
-			<select name="<?php echo esc_attr( $this->get_field_name( 'component' ) ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>">
138
-			<?php foreach ( $this->woo_widget_componentslist as $k => $v ) { ?>
139
-				<option value="<?php echo esc_attr( $k ); ?>"<?php selected( $instance['component'], $k ); ?>><?php echo $v; ?></option>
136
+			<label for="<?php echo esc_attr($this->get_field_id('component')); ?>"><?php _e('Component:', 'woothemes-sensei'); ?></label>
137
+			<select name="<?php echo esc_attr($this->get_field_name('component')); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('component')); ?>">
138
+			<?php foreach ($this->woo_widget_componentslist as $k => $v) { ?>
139
+				<option value="<?php echo esc_attr($k); ?>"<?php selected($instance['component'], $k); ?>><?php echo $v; ?></option>
140 140
 			<?php } ?>
141 141
 			</select>
142 142
 		</p>
143 143
 		<!-- Widget Limit: Text Input -->
144 144
 		<p>
145
-			<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Lessons (optional):', 'woothemes-sensei' ); ?></label>
146
-			<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>"  value="<?php echo esc_attr( $instance['limit'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" />
145
+			<label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php _e('Number of Lessons (optional):', 'woothemes-sensei'); ?></label>
146
+			<input type="text" name="<?php echo esc_attr($this->get_field_name('limit')); ?>"  value="<?php echo esc_attr($instance['limit']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('limit')); ?>" />
147 147
 		</p>
148 148
 
149 149
 <?php
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @since  5.0.8
156 156
 	 * @return void
157 157
 	 */
158
-	protected function load_component ( $instance ) {
158
+	protected function load_component($instance) {
159 159
 		global  $current_user;
160 160
 		// Get User Meta
161 161
 		get_currentuserinfo();
@@ -165,41 +165,41 @@  discard block
 block discarded – undo
165 165
 
166 166
 		$posts_array = array();
167 167
 
168
-		$post_args = array(	'post_type' 		=> 'lesson',
169
-							'posts_per_page' 		=> intval( $instance[ 'limit' ] ),
168
+		$post_args = array('post_type' 		=> 'lesson',
169
+							'posts_per_page' 		=> intval($instance['limit']),
170 170
 							'orderby'         	=> 'menu_order date',
171 171
     						'order'           	=> 'DESC',
172 172
     						'post_status'       => 'publish',
173 173
 							'suppress_filters' 	=> 0
174 174
 							);
175
-		$posts_array = get_posts( $post_args );
175
+		$posts_array = get_posts($post_args);
176 176
 
177
-		if ( count( $posts_array ) > 0 ) { ?>
177
+		if (count($posts_array) > 0) { ?>
178 178
 			<ul>
179
-			<?php foreach ($posts_array as $post_item){
180
-		    	$post_id = absint( $post_item->ID );
179
+			<?php foreach ($posts_array as $post_item) {
180
+		    	$post_id = absint($post_item->ID);
181 181
 		    	$post_title = $post_item->post_title;
182
-		    	$user_info = get_userdata( absint( $post_item->post_author ) );
183
-		    	$author_link = get_author_posts_url( absint( $post_item->post_author ) );
182
+		    	$user_info = get_userdata(absint($post_item->post_author));
183
+		    	$author_link = get_author_posts_url(absint($post_item->post_author));
184 184
 		    	$author_display_name = $user_info->display_name;
185 185
 		    	$author_id = $post_item->post_author;
186
-		    	$lesson_course_id = get_post_meta( $post_id, '_lesson_course', true );
186
+		    	$lesson_course_id = get_post_meta($post_id, '_lesson_course', true);
187 187
 		    ?>
188 188
 		    	<li class="fix">
189
-		    		<?php do_action( 'sensei_lesson_image', $post_id, '100', '100', false, true ); ?>
190
-		    		<a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a>
189
+		    		<?php do_action('sensei_lesson_image', $post_id, '100', '100', false, true); ?>
190
+		    		<a href="<?php echo esc_url(get_permalink($post_id)); ?>" title="<?php echo esc_attr($post_title); ?>"><?php echo $post_title; ?></a>
191 191
 		    		<br />
192
-		    		<?php if ( isset( Sensei()->settings->settings[ 'lesson_author' ] ) && ( Sensei()->settings->settings[ 'lesson_author' ] ) ) { ?>
193
-    					<span class="course-author"><?php _e( 'by ', 'woothemes-sensei' ); ?><a href="<?php echo esc_url( $author_link ); ?>" title="<?php echo esc_attr( $author_display_name ); ?>"><?php echo esc_html( $author_display_name ); ?></a></span>
192
+		    		<?php if (isset(Sensei()->settings->settings['lesson_author']) && (Sensei()->settings->settings['lesson_author'])) { ?>
193
+    					<span class="course-author"><?php _e('by ', 'woothemes-sensei'); ?><a href="<?php echo esc_url($author_link); ?>" title="<?php echo esc_attr($author_display_name); ?>"><?php echo esc_html($author_display_name); ?></a></span>
194 194
     					<br />
195 195
     				<?php } // End If Statement ?>
196
-    				<?php if ( 0 < $lesson_course_id ) { ?>
197
-                        <span class="lesson-course"><?php echo ' ' . sprintf( __( 'Part of: %s', 'woothemes-sensei' ), '<a href="' . esc_url( get_permalink( $lesson_course_id ) ) . '" title="' . esc_attr( __( 'View course', 'woothemes-sensei' ) ) . '"><em>' . get_the_title( $lesson_course_id ) . '</em></a>' ); ?></span>
196
+    				<?php if (0 < $lesson_course_id) { ?>
197
+                        <span class="lesson-course"><?php echo ' '.sprintf(__('Part of: %s', 'woothemes-sensei'), '<a href="'.esc_url(get_permalink($lesson_course_id)).'" title="'.esc_attr(__('View course', 'woothemes-sensei')).'"><em>'.get_the_title($lesson_course_id).'</em></a>'); ?></span>
198 198
                     <?php } ?>
199 199
     				<br />
200 200
 		    	</li>
201 201
 		    <?php } // End For Loop ?>
202
-		    <?php echo '<li class="my-account fix"><a class="button" href="'. esc_url( get_post_type_archive_link( 'lesson' ) ) .'">'.__('More Lessons', 'woothemes-sensei').'</a></li>'; ?>
202
+		    <?php echo '<li class="my-account fix"><a class="button" href="'.esc_url(get_post_type_archive_link('lesson')).'">'.__('More Lessons', 'woothemes-sensei').'</a></li>'; ?>
203 203
 		</ul>
204 204
 		<?php } // End If Statement
205 205
 	} // End load_component()
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
5
+// Exit if accessed directly.
3 6
 
4 7
 /**
5 8
  * Sensei Course Component Widget
Please login to merge, or discard this patch.
uninstall.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@
 block discarded – undo
10 10
  * @author WooThemes
11 11
  * @since 1.0.0
12 12
  */
13
-if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit();
13
+if ( ! defined('WP_UNINSTALL_PLUGIN')) exit();
14 14
 
15 15
 $token = 'woothemes-sensei';
16
-delete_option( 'skip_install_sensei_pages' );
17
-delete_option( 'sensei_installed' );
18 16
\ No newline at end of file
17
+delete_option('skip_install_sensei_pages');
18
+delete_option('sensei_installed');
19 19
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  * @author WooThemes
11 11
  * @since 1.0.0
12 12
  */
13
-if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit();
13
+if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
14
+	exit();
15
+}
14 16
 
15 17
 $token = 'woothemes-sensei';
16 18
 delete_option( 'skip_install_sensei_pages' );
Please login to merge, or discard this patch.
widgets/widget-woothemes-sensei-course-categories.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@
 block discarded – undo
103 103
 	 * @param  array $instance The settings for this instance.
104 104
 	 * @return void
105 105
 	 */
106
-    public function form( $instance ) {
106
+	public function form( $instance ) {
107 107
 
108 108
 		/* Set up some default widget settings. */
109 109
 		/* Make sure all keys are added here, even with empty string values. */
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
2
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly.
3 3
 
4 4
 /**
5 5
  * Sensei Course Categories Widget
@@ -26,18 +26,18 @@  discard block
 block discarded – undo
26 26
 	public function __construct() {
27 27
 		/* Widget variable settings. */
28 28
 		$this->woo_widget_cssclass = 'widget_sensei_course_categories';
29
-		$this->woo_widget_description = __( 'This widget will output a list of Course Categories.', 'woothemes-sensei' );
29
+		$this->woo_widget_description = __('This widget will output a list of Course Categories.', 'woothemes-sensei');
30 30
 		$this->woo_widget_idbase = 'sensei_course_categories';
31
-		$this->woo_widget_title = __( 'Sensei - Course Categories', 'woothemes-sensei' );
31
+		$this->woo_widget_title = __('Sensei - Course Categories', 'woothemes-sensei');
32 32
 
33 33
 		/* Widget settings. */
34
-		$widget_ops = array( 'classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description );
34
+		$widget_ops = array('classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description);
35 35
 
36 36
 		/* Widget control settings. */
37
-		$control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase );
37
+		$control_ops = array('width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase);
38 38
 
39 39
 		/* Create the widget. */
40
-		parent::__construct( $this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops );
40
+		parent::__construct($this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops);
41 41
 	} // End __construct()
42 42
 
43 43
 	/**
@@ -47,26 +47,26 @@  discard block
 block discarded – undo
47 47
 	 * @param  array $instance Widget settings for this instance.
48 48
 	 * @return void
49 49
 	 */
50
-	public function widget( $args, $instance ) {
51
-		extract( $args, EXTR_SKIP );
50
+	public function widget($args, $instance) {
51
+		extract($args, EXTR_SKIP);
52 52
 
53 53
 			/* Our variables from the widget settings. */
54
-			$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
54
+			$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
55 55
 
56 56
 			/* Before widget (defined by themes). */
57 57
 			echo $before_widget;
58 58
 
59 59
 			/* Display the widget title if one was input (before and after defined by themes). */
60
-			if ( $title ) { echo $before_title . $title . $after_title; }
60
+			if ($title) { echo $before_title.$title.$after_title; }
61 61
 
62 62
 			/* Widget content. */
63 63
 			// Add actions for plugins/themes to hook onto.
64
-			do_action( $this->woo_widget_cssclass . '_top' );
64
+			do_action($this->woo_widget_cssclass.'_top');
65 65
 
66
-			$this->load_component( $instance );
66
+			$this->load_component($instance);
67 67
 
68 68
 			// Add actions for plugins/themes to hook onto.
69
-			do_action( $this->woo_widget_cssclass . '_bottom' );
69
+			do_action($this->woo_widget_cssclass.'_bottom');
70 70
 
71 71
 			/* After widget (defined by themes). */
72 72
 			echo $after_widget;
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	 * @param  array $old_instance Previous settings.
81 81
 	 * @return array               Updated settings.
82 82
 	 */
83
-	public function update ( $new_instance, $old_instance ) {
83
+	public function update($new_instance, $old_instance) {
84 84
 		$instance = $old_instance;
85 85
 
86 86
 		/* Strip tags for title and name to remove HTML (important for text inputs). */
87
-		$instance['title'] = strip_tags( $new_instance['title'] );
87
+		$instance['title'] = strip_tags($new_instance['title']);
88 88
 
89 89
 		/* The select box is returning a text value, so we escape it. */
90
-		$instance['limit'] = esc_attr( $new_instance['limit'] );
90
+		$instance['limit'] = esc_attr($new_instance['limit']);
91 91
 
92 92
 		/* The check box is returning a boolean value. */
93 93
 		$instance['count'] = $new_instance['count'];
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 * @param  array $instance The settings for this instance.
104 104
 	 * @return void
105 105
 	 */
106
-    public function form( $instance ) {
106
+    public function form($instance) {
107 107
 
108 108
 		/* Set up some default widget settings. */
109 109
 		/* Make sure all keys are added here, even with empty string values. */
@@ -114,27 +114,27 @@  discard block
 block discarded – undo
114 114
 						'hierarchical' => false
115 115
 					);
116 116
 
117
-		$instance = wp_parse_args( (array) $instance, $defaults );
117
+		$instance = wp_parse_args((array) $instance, $defaults);
118 118
 ?>
119 119
 		<!-- Widget Title: Text Input -->
120 120
 		<p>
121
-			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label>
122
-			<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"  value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" />
121
+			<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title (optional):', 'woothemes-sensei'); ?></label>
122
+			<input type="text" name="<?php echo esc_attr($this->get_field_name('title')); ?>"  value="<?php echo esc_attr($instance['title']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" />
123 123
 		</p>
124 124
 		<!-- Widget Limit: Text Input -->
125 125
 		<p>
126
-			<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Categories (optional):', 'woothemes-sensei' ); ?></label>
127
-			<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>"  value="<?php echo esc_attr( $instance['limit'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" />
126
+			<label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php _e('Number of Categories (optional):', 'woothemes-sensei'); ?></label>
127
+			<input type="text" name="<?php echo esc_attr($this->get_field_name('limit')); ?>"  value="<?php echo esc_attr($instance['limit']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('limit')); ?>" />
128 128
 		</p>
129 129
 		<!-- Widget Show Count: Checkbox Input -->
130 130
 		<p>
131
-			<input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id('count') ); ?>" name="<?php echo esc_attr( $this->get_field_name('count') ); ?>"<?php checked( $instance['count'], 'on' ); ?> />
132
-			<label for="<?php echo esc_attr( $this->get_field_id('count') ); ?>"><?php _e( 'Show post counts', 'woothemes-sensei' ); ?></label><br />
131
+			<input type="checkbox" class="checkbox" id="<?php echo esc_attr($this->get_field_id('count')); ?>" name="<?php echo esc_attr($this->get_field_name('count')); ?>"<?php checked($instance['count'], 'on'); ?> />
132
+			<label for="<?php echo esc_attr($this->get_field_id('count')); ?>"><?php _e('Show post counts', 'woothemes-sensei'); ?></label><br />
133 133
 		</p>
134 134
 		<!-- Widget Show Hierarchy: Checkbox Input -->
135 135
 		<p>
136
-			<input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id('hierarchical') ); ?>" name="<?php echo esc_attr( $this->get_field_name('hierarchical') ); ?>"<?php checked( $instance['hierarchical'], 'on' ); ?> />
137
-			<label for="<?php echo esc_attr( $this->get_field_id('hierarchical') ); ?>"><?php _e( 'Show hierarchy', 'woothemes-sensei' ); ?></label></p>
136
+			<input type="checkbox" class="checkbox" id="<?php echo esc_attr($this->get_field_id('hierarchical')); ?>" name="<?php echo esc_attr($this->get_field_name('hierarchical')); ?>"<?php checked($instance['hierarchical'], 'on'); ?> />
137
+			<label for="<?php echo esc_attr($this->get_field_id('hierarchical')); ?>"><?php _e('Show hierarchy', 'woothemes-sensei'); ?></label></p>
138 138
 		</p>
139 139
 <?php
140 140
 	} // End form()
@@ -145,18 +145,18 @@  discard block
 block discarded – undo
145 145
 	 * @since  1.1.0
146 146
 	 * @return void
147 147
 	 */
148
-	protected function load_component ( $instance ) {
148
+	protected function load_component($instance) {
149 149
 
150
-		$limit = intval( $instance['limit'] );
151
-		$count = isset($instance['count']) ? (bool) $instance['count'] :false;
152
-		$hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false;
150
+		$limit = intval($instance['limit']);
151
+		$count = isset($instance['count']) ? (bool) $instance['count'] : false;
152
+		$hierarchical = isset($instance['hierarchical']) ? (bool) $instance['hierarchical'] : false;
153 153
 
154
-		$cat_args = array( 'title_li' => '', 'taxonomy' => 'course-category', 'orderby' => 'name', 'show_count' => $count, 'hierarchical' => $hierarchical);
155
-		if ( 0 < $limit ) {
156
-			$cat_args[ 'number' ] = $limit;
154
+		$cat_args = array('title_li' => '', 'taxonomy' => 'course-category', 'orderby' => 'name', 'show_count' => $count, 'hierarchical' => $hierarchical);
155
+		if (0 < $limit) {
156
+			$cat_args['number'] = $limit;
157 157
 		} // End If Statement
158 158
 		echo '<ul>';
159
-			wp_list_categories( apply_filters('widget_course_categories_args', $cat_args) );
159
+			wp_list_categories(apply_filters('widget_course_categories_args', $cat_args));
160 160
 		echo '</ul>';
161 161
 	} // End load_component()
162 162
 } // End Class
163 163
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
5
+// Exit if accessed directly.
3 6
 
4 7
 /**
5 8
  * Sensei Course Component Widget
Please login to merge, or discard this patch.
widgets/widget-woothemes-sensei-category-courses.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 * @param  array $instance The settings for this instance.
107 107
 	 * @return void
108 108
 	 */
109
-    public function form( $instance ) {
109
+	public function form( $instance ) {
110 110
 
111 111
 		/* Set up some default widget settings. */
112 112
 		/* Make sure all keys are added here, even with empty string values. */
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 		$post_args = array(	'post_type' 		=> 'course',
154 154
 							'posts_per_page' 		=> intval( $instance[ 'limit' ] ),
155 155
 							'orderby'         	=> 'menu_order date',
156
-    						'order'           	=> 'ASC',
157
-    						'post_status'       => 'publish',
156
+							'order'           	=> 'ASC',
157
+							'post_status'       => 'publish',
158 158
 							'suppress_filters' 	=> 0,
159 159
 							);
160 160
 
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
 		if ( count( $posts_array ) > 0 ) { ?>
172 172
 			<ul>
173 173
 			<?php foreach ($posts_array as $post_item){
174
-		    	$post_id = absint( $post_item->ID );
175
-		    	$post_title = $post_item->post_title;
176
-		    	$user_info = get_userdata( absint( $post_item->post_author ) );
177
-		    	$author_link = get_author_posts_url( absint( $post_item->post_author ) );
178
-		    	$author_display_name = $user_info->display_name;
179
-		    	$author_id = $post_item->post_author;
180
-		    ?>
174
+				$post_id = absint( $post_item->ID );
175
+				$post_title = $post_item->post_title;
176
+				$user_info = get_userdata( absint( $post_item->post_author ) );
177
+				$author_link = get_author_posts_url( absint( $post_item->post_author ) );
178
+				$author_display_name = $user_info->display_name;
179
+				$author_id = $post_item->post_author;
180
+			?>
181 181
 		    	<li class="fix">
182 182
 		    		<?php do_action( 'sensei_course_image', $post_id ); ?>
183 183
 		    		<a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a>
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
2
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly.
3 3
 
4 4
 /**
5 5
  * Sensei Category Courses Widget
@@ -26,18 +26,18 @@  discard block
 block discarded – undo
26 26
 	public function __construct() {
27 27
 		/* Widget variable settings. */
28 28
 		$this->woo_widget_cssclass = 'widget_sensei_category_courses';
29
-		$this->woo_widget_description = __( 'This widget will output a list of Courses for a specific category.', 'woothemes-sensei' );
29
+		$this->woo_widget_description = __('This widget will output a list of Courses for a specific category.', 'woothemes-sensei');
30 30
 		$this->woo_widget_idbase = 'sensei_category_courses';
31
-		$this->woo_widget_title = __( 'Sensei - Category Courses', 'woothemes-sensei' );
31
+		$this->woo_widget_title = __('Sensei - Category Courses', 'woothemes-sensei');
32 32
 
33 33
 		/* Widget settings. */
34
-		$widget_ops = array( 'classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description );
34
+		$widget_ops = array('classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description);
35 35
 
36 36
 		/* Widget control settings. */
37
-		$control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase );
37
+		$control_ops = array('width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase);
38 38
 
39 39
 		/* Create the widget. */
40
-		parent::__construct( $this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops );
40
+		parent::__construct($this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops);
41 41
 
42 42
 	} // End __construct()
43 43
 
@@ -48,28 +48,28 @@  discard block
 block discarded – undo
48 48
 	 * @param  array $instance Widget settings for this instance.
49 49
 	 * @return void
50 50
 	 */
51
-	public function widget( $args, $instance ) {
52
-		extract( $args, EXTR_SKIP );
51
+	public function widget($args, $instance) {
52
+		extract($args, EXTR_SKIP);
53 53
 
54 54
 		/* Our variables from the widget settings. */
55
-		$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
55
+		$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
56 56
 
57 57
 		/* Before widget (defined by themes). */
58 58
 		echo $before_widget;
59 59
 
60 60
 		/* Display the widget title if one was input (before and after defined by themes). */
61
-		if ( $title ) { echo $before_title . $title . $after_title; }
61
+		if ($title) { echo $before_title.$title.$after_title; }
62 62
 
63 63
 		/* Widget content. */
64 64
 		// Add actions for plugins/themes to hook onto.
65
-		do_action( $this->woo_widget_cssclass . '_top' );
65
+		do_action($this->woo_widget_cssclass.'_top');
66 66
 
67
-		if ( 0 < intval( $instance['course_category'] ) ) {
68
-			$this->load_component( $instance );
67
+		if (0 < intval($instance['course_category'])) {
68
+			$this->load_component($instance);
69 69
 		} // End If Statement
70 70
 
71 71
 		// Add actions for plugins/themes to hook onto.
72
-		do_action( $this->woo_widget_cssclass . '_bottom' );
72
+		do_action($this->woo_widget_cssclass.'_bottom');
73 73
 
74 74
 		/* After widget (defined by themes). */
75 75
 		echo $after_widget;
@@ -83,17 +83,17 @@  discard block
 block discarded – undo
83 83
 	 * @param  array $old_instance Previous settings.
84 84
 	 * @return array               Updated settings.
85 85
 	 */
86
-	public function update ( $new_instance, $old_instance ) {
86
+	public function update($new_instance, $old_instance) {
87 87
 		$instance = $old_instance;
88 88
 
89 89
 		/* Strip tags for title and name to remove HTML (important for text inputs). */
90
-		$instance['title'] = strip_tags( $new_instance['title'] );
90
+		$instance['title'] = strip_tags($new_instance['title']);
91 91
 
92 92
 		/* The select box is returning a text value, so we escape it. */
93
-		$instance['course_category'] = esc_attr( $new_instance['course_category'] );
93
+		$instance['course_category'] = esc_attr($new_instance['course_category']);
94 94
 
95 95
 		/* Strip tags for limit to remove HTML (important for text inputs). */
96
-		$instance['limit'] = strip_tags( $new_instance['limit'] );
96
+		$instance['limit'] = strip_tags($new_instance['limit']);
97 97
 
98 98
 
99 99
 		return $instance;
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 * @param  array $instance The settings for this instance.
107 107
 	 * @return void
108 108
 	 */
109
-    public function form( $instance ) {
109
+    public function form($instance) {
110 110
 
111 111
 		/* Set up some default widget settings. */
112 112
 		/* Make sure all keys are added here, even with empty string values. */
@@ -116,25 +116,25 @@  discard block
 block discarded – undo
116 116
 						'limit' => 3
117 117
 					);
118 118
 
119
-		$instance = wp_parse_args( (array) $instance, $defaults );
119
+		$instance = wp_parse_args((array) $instance, $defaults);
120 120
 ?>
121 121
 		<!-- Widget Title: Text Input -->
122 122
 		<p>
123
-			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label>
124
-			<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"  value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" />
123
+			<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title (optional):', 'woothemes-sensei'); ?></label>
124
+			<input type="text" name="<?php echo esc_attr($this->get_field_name('title')); ?>"  value="<?php echo esc_attr($instance['title']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" />
125 125
 		</p>
126 126
 		<!-- Widget Course Category: Select Input -->
127 127
 		<p>
128
-			<label for="<?php echo esc_attr( $this->get_field_id( 'course_category' ) ); ?>"><?php _e( 'Course Category:', 'woothemes-sensei' ); ?></label>
128
+			<label for="<?php echo esc_attr($this->get_field_id('course_category')); ?>"><?php _e('Course Category:', 'woothemes-sensei'); ?></label>
129 129
 			<?php
130
-			$cat_args = array( 'hierarchical' => true, 'show_option_none' => __( 'Select Category:', 'woothemes-sensei' ), 'taxonomy' => 'course-category', 'orderby' => 'name', 'selected' => intval( $instance['course_category'] ), 'id' => $this->get_field_id( 'course_category' ), 'name' => $this->get_field_name( 'course_category' ), 'class' => 'widefat' );
130
+			$cat_args = array('hierarchical' => true, 'show_option_none' => __('Select Category:', 'woothemes-sensei'), 'taxonomy' => 'course-category', 'orderby' => 'name', 'selected' => intval($instance['course_category']), 'id' => $this->get_field_id('course_category'), 'name' => $this->get_field_name('course_category'), 'class' => 'widefat');
131 131
 			wp_dropdown_categories(apply_filters('widget_course_categories_dropdown_args', $cat_args));
132 132
 			?>
133 133
 		</p>
134 134
 		<!-- Widget Limit: Text Input -->
135 135
 		<p>
136
-			<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Courses (optional):', 'woothemes-sensei' ); ?></label>
137
-			<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>"  value="<?php echo esc_attr( $instance['limit'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" />
136
+			<label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php _e('Number of Courses (optional):', 'woothemes-sensei'); ?></label>
137
+			<input type="text" name="<?php echo esc_attr($this->get_field_name('limit')); ?>"  value="<?php echo esc_attr($instance['limit']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('limit')); ?>" />
138 138
 		</p>
139 139
 
140 140
 <?php
@@ -146,49 +146,49 @@  discard block
 block discarded – undo
146 146
 	 * @since  1.1.0
147 147
 	 * @return void
148 148
 	 */
149
-	protected function load_component ( $instance ) {
149
+	protected function load_component($instance) {
150 150
 
151 151
 
152 152
 		$posts_array = array();
153
-		$post_args = array(	'post_type' 		=> 'course',
154
-							'posts_per_page' 		=> intval( $instance[ 'limit' ] ),
153
+		$post_args = array('post_type' 		=> 'course',
154
+							'posts_per_page' 		=> intval($instance['limit']),
155 155
 							'orderby'         	=> 'menu_order date',
156 156
     						'order'           	=> 'ASC',
157 157
     						'post_status'       => 'publish',
158 158
 							'suppress_filters' 	=> 0,
159 159
 							);
160 160
 
161
-		$post_args[ 'tax_query' ] = array(
161
+		$post_args['tax_query'] = array(
162 162
 											array(
163 163
 												'taxonomy' => 'course-category',
164 164
 												'field' => 'id',
165
-												'terms' => intval( $instance['course_category'] )
165
+												'terms' => intval($instance['course_category'])
166 166
 											)
167 167
 										);
168 168
 
169
-		$posts_array = get_posts( $post_args );
169
+		$posts_array = get_posts($post_args);
170 170
 
171
-		if ( count( $posts_array ) > 0 ) { ?>
171
+		if (count($posts_array) > 0) { ?>
172 172
 			<ul>
173
-			<?php foreach ($posts_array as $post_item){
174
-		    	$post_id = absint( $post_item->ID );
173
+			<?php foreach ($posts_array as $post_item) {
174
+		    	$post_id = absint($post_item->ID);
175 175
 		    	$post_title = $post_item->post_title;
176
-		    	$user_info = get_userdata( absint( $post_item->post_author ) );
177
-		    	$author_link = get_author_posts_url( absint( $post_item->post_author ) );
176
+		    	$user_info = get_userdata(absint($post_item->post_author));
177
+		    	$author_link = get_author_posts_url(absint($post_item->post_author));
178 178
 		    	$author_display_name = $user_info->display_name;
179 179
 		    	$author_id = $post_item->post_author;
180 180
 		    ?>
181 181
 		    	<li class="fix">
182
-		    		<?php do_action( 'sensei_course_image', $post_id ); ?>
183
-		    		<a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a>
182
+		    		<?php do_action('sensei_course_image', $post_id); ?>
183
+		    		<a href="<?php echo esc_url(get_permalink($post_id)); ?>" title="<?php echo esc_attr($post_title); ?>"><?php echo $post_title; ?></a>
184 184
 		    		<br />
185
-		    		<?php if ( isset( Sensei()->settings->settings[ 'course_author' ] ) && ( Sensei()->settings->settings[ 'course_author' ] ) ) { ?>
186
-    					<span class="course-author"><?php _e( 'by ', 'woothemes-sensei' ); ?><a href="<?php echo esc_url( $author_link ); ?>" title="<?php echo esc_attr( $author_display_name ); ?>"><?php echo esc_html( $author_display_name ); ?></a></span>
185
+		    		<?php if (isset(Sensei()->settings->settings['course_author']) && (Sensei()->settings->settings['course_author'])) { ?>
186
+    					<span class="course-author"><?php _e('by ', 'woothemes-sensei'); ?><a href="<?php echo esc_url($author_link); ?>" title="<?php echo esc_attr($author_display_name); ?>"><?php echo esc_html($author_display_name); ?></a></span>
187 187
     					<br />
188 188
     				<?php } // End If Statement ?>
189
-    				<span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count( $post_id ) . '&nbsp;' .  __( 'Lessons', 'woothemes-sensei' ); ?></span>
189
+    				<span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count($post_id).'&nbsp;'.__('Lessons', 'woothemes-sensei'); ?></span>
190 190
     				<br />
191
-    				<?php sensei_simple_course_price( $post_id ); ?>
191
+    				<?php sensei_simple_course_price($post_id); ?>
192 192
 		    	</li>
193 193
 		    <?php } // End For Loop ?>
194 194
 			</ul>
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	exit;
4
+}
5
+// Exit if accessed directly.
3 6
 
4 7
 /**
5 8
  * Sensei Course Component Widget
Please login to merge, or discard this patch.