Completed
Push — master ( d51ce1...80c0ca )
by Dwain
05:52
created
includes/class-sensei-admin.php 1 patch
Spacing   +419 added lines, -419 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 Administration Class
@@ -18,51 +18,51 @@  discard block
 block discarded – undo
18 18
 	 * Constructor.
19 19
 	 * @since  1.0.0
20 20
 	 */
21
-	public function __construct () {
21
+	public function __construct() {
22 22
 
23 23
         //register admin styles
24
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_styles_global' ) );
24
+		add_action('admin_enqueue_scripts', array($this, 'admin_styles_global'));
25 25
 
26 26
         //register admin scripts
27
-        add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts' ) );
27
+        add_action('admin_enqueue_scripts', array($this, 'register_scripts'));
28 28
 
29
-		add_action( 'admin_print_styles', array( $this, 'admin_notices_styles' ) );
30
-		add_action( 'settings_before_form', array( $this, 'install_pages_output' ) );
31
-		add_action( 'admin_menu', array( $this, 'admin_menu' ), 10 );
32
-		add_action( 'menu_order', array( $this, 'admin_menu_order' ) );
33
-		add_action( 'admin_head', array( $this, 'admin_menu_highlight' ) );
34
-		add_action( 'admin_init', array( $this, 'page_redirect' ) );
35
-		add_action( 'admin_init', array( $this, 'sensei_add_custom_menu_items' ) );
36
-        add_action( 'admin_init', array( __CLASS__, 'install_pages' ));
29
+		add_action('admin_print_styles', array($this, 'admin_notices_styles'));
30
+		add_action('settings_before_form', array($this, 'install_pages_output'));
31
+		add_action('admin_menu', array($this, 'admin_menu'), 10);
32
+		add_action('menu_order', array($this, 'admin_menu_order'));
33
+		add_action('admin_head', array($this, 'admin_menu_highlight'));
34
+		add_action('admin_init', array($this, 'page_redirect'));
35
+		add_action('admin_init', array($this, 'sensei_add_custom_menu_items'));
36
+        add_action('admin_init', array(__CLASS__, 'install_pages'));
37 37
 
38 38
 		// Duplicate lesson & courses
39
-		add_filter( 'post_row_actions', array( $this, 'duplicate_action_link' ), 10, 2 );
40
-		add_action( 'admin_action_duplicate_lesson', array( $this, 'duplicate_lesson_action' ) );
41
-		add_action( 'admin_action_duplicate_course', array( $this, 'duplicate_course_action' ) );
42
-		add_action( 'admin_action_duplicate_course_with_lessons', array( $this, 'duplicate_course_with_lessons_action' ) );
39
+		add_filter('post_row_actions', array($this, 'duplicate_action_link'), 10, 2);
40
+		add_action('admin_action_duplicate_lesson', array($this, 'duplicate_lesson_action'));
41
+		add_action('admin_action_duplicate_course', array($this, 'duplicate_course_action'));
42
+		add_action('admin_action_duplicate_course_with_lessons', array($this, 'duplicate_course_with_lessons_action'));
43 43
 
44 44
 		// Handle lessons list table filtering
45
-		add_action( 'restrict_manage_posts', array( $this, 'lesson_filter_options' ) );
46
-		add_filter( 'request', array( $this, 'lesson_filter_actions' ) );
45
+		add_action('restrict_manage_posts', array($this, 'lesson_filter_options'));
46
+		add_filter('request', array($this, 'lesson_filter_actions'));
47 47
 
48 48
 		// Add Sensei items to 'at a glance' widget
49
-		add_filter( 'dashboard_glance_items', array( $this, 'glance_items' ), 10, 1 );
49
+		add_filter('dashboard_glance_items', array($this, 'glance_items'), 10, 1);
50 50
 
51 51
 		// Handle course and lesson deletions
52
-		add_action( 'trash_course', array( $this, 'delete_content' ), 10, 2 );
53
-		add_action( 'trash_lesson', array( $this, 'delete_content' ), 10, 2 );
52
+		add_action('trash_course', array($this, 'delete_content'), 10, 2);
53
+		add_action('trash_lesson', array($this, 'delete_content'), 10, 2);
54 54
 
55 55
 		// Delete user activity when user is deleted
56
-		add_action( 'deleted_user', array( $this, 'delete_user_activity' ), 10, 1 );
56
+		add_action('deleted_user', array($this, 'delete_user_activity'), 10, 1);
57 57
 
58 58
 		// Add notices to WP dashboard
59
-		add_action( 'admin_notices', array( $this, 'theme_compatibility_notices' ) );
59
+		add_action('admin_notices', array($this, 'theme_compatibility_notices'));
60 60
 
61 61
 		// Reset theme notices when switching themes
62
-		add_action( 'switch_theme', array( $this, 'reset_theme_check_notices' ) );
62
+		add_action('switch_theme', array($this, 'reset_theme_check_notices'));
63 63
 
64 64
 		// Allow Teacher access the admin area
65
-		add_filter( 'woocommerce_prevent_admin_access', array( $this, 'admin_access' ) );
65
+		add_filter('woocommerce_prevent_admin_access', array($this, 'admin_access'));
66 66
 
67 67
 	} // End __construct()
68 68
 
@@ -74,21 +74,21 @@  discard block
 block discarded – undo
74 74
 	public function admin_menu() {
75 75
 		global $menu;
76 76
 		$menu_cap = '';
77
-		if( current_user_can( 'manage_sensei' ) ) {
77
+		if (current_user_can('manage_sensei')) {
78 78
 			$menu_cap = 'manage_sensei';
79 79
 		} else {
80
-			if( current_user_can( 'manage_sensei_grades' ) ) {
80
+			if (current_user_can('manage_sensei_grades')) {
81 81
 				$menu_cap = 'manage_sensei_grades';
82 82
 			}
83 83
 		}
84 84
 
85
-		if( $menu_cap ) {
86
-			$menu[] = array( '', 'read', 'separator-sensei', '', 'wp-menu-separator sensei' );
87
-            add_menu_page( 'Sensei', 'Sensei', $menu_cap, 'sensei' , array( Sensei()->analysis, 'analysis_page' ) , '', '50' );
85
+		if ($menu_cap) {
86
+			$menu[] = array('', 'read', 'separator-sensei', '', 'wp-menu-separator sensei');
87
+            add_menu_page('Sensei', 'Sensei', $menu_cap, 'sensei', array(Sensei()->analysis, 'analysis_page'), '', '50');
88 88
 		}
89 89
 
90
-		add_submenu_page( 'edit.php?post_type=course', __( 'Order Courses', 'woothemes-sensei' ), __( 'Order Courses', 'woothemes-sensei' ), 'manage_sensei', 'course-order', array( $this, 'course_order_screen' ) );
91
-		add_submenu_page( 'edit.php?post_type=lesson', __( 'Order Lessons', 'woothemes-sensei' ), __( 'Order Lessons', 'woothemes-sensei' ), 'edit_lessons', 'lesson-order', array( $this, 'lesson_order_screen' ) );
90
+		add_submenu_page('edit.php?post_type=course', __('Order Courses', 'woothemes-sensei'), __('Order Courses', 'woothemes-sensei'), 'manage_sensei', 'course-order', array($this, 'course_order_screen'));
91
+		add_submenu_page('edit.php?post_type=lesson', __('Order Lessons', 'woothemes-sensei'), __('Order Lessons', 'woothemes-sensei'), 'edit_lessons', 'lesson-order', array($this, 'lesson_order_screen'));
92 92
 	}
93 93
 
94 94
 	/**
@@ -97,22 +97,22 @@  discard block
 block discarded – undo
97 97
 	 * @param  array $menu_order Existing menu order
98 98
 	 * @return array 			 Modified menu order for Sensei
99 99
 	 */
100
-	public function admin_menu_order( $menu_order ) {
100
+	public function admin_menu_order($menu_order) {
101 101
 
102 102
 		// Initialize our custom order array
103 103
 		$sensei_menu_order = array();
104 104
 
105 105
 		// Get the index of our custom separator
106
-		$sensei_separator = array_search( 'separator-sensei', $menu_order );
106
+		$sensei_separator = array_search('separator-sensei', $menu_order);
107 107
 
108 108
 		// Loop through menu order and do some rearranging
109
-		foreach ( $menu_order as $index => $item ) :
109
+		foreach ($menu_order as $index => $item) :
110 110
 
111
-			if ( ( ( 'sensei' ) == $item ) ) :
111
+			if ((('sensei') == $item)) :
112 112
 				$sensei_menu_order[] = 'separator-sensei';
113 113
 				$sensei_menu_order[] = $item;
114
-				unset( $menu_order[$sensei_separator] );
115
-			elseif ( !in_array( $item, array( 'separator-sensei' ) ) ) :
114
+				unset($menu_order[$sensei_separator]);
115
+			elseif ( ! in_array($item, array('separator-sensei'))) :
116 116
 				$sensei_menu_order[] = $item;
117 117
 			endif;
118 118
 
@@ -132,24 +132,24 @@  discard block
 block discarded – undo
132 132
 
133 133
 		$screen = get_current_screen();
134 134
 
135
-		if ( $screen->base == 'post' && $post_type == 'course' ) {
135
+		if ($screen->base == 'post' && $post_type == 'course') {
136 136
 
137
-			$parent_file  = 'edit.php?post_type=course';
137
+			$parent_file = 'edit.php?post_type=course';
138 138
 
139
-		} elseif ( $screen->base == 'edit-tags' && $taxonomy == 'course-category' ) {
139
+		} elseif ($screen->base == 'edit-tags' && $taxonomy == 'course-category') {
140 140
 
141 141
 			$submenu_file = 'edit-tags.php?taxonomy=course-category&amp;post_type=course';
142 142
 			$parent_file  = 'edit.php?post_type=course';
143 143
 
144
-        } elseif ( $screen->base == 'edit-tags' && $taxonomy == 'module' ) {
144
+        } elseif ($screen->base == 'edit-tags' && $taxonomy == 'module') {
145 145
 
146 146
             $submenu_file = 'edit-tags.php?taxonomy=module';
147 147
             $parent_file  = 'edit.php?post_type=course';
148 148
 
149
-		} elseif ( in_array( $screen->id, array( 'sensei_message', 'edit-sensei_message' ) ) ) {
149
+		} elseif (in_array($screen->id, array('sensei_message', 'edit-sensei_message'))) {
150 150
 
151 151
             $submenu_file = 'edit.php?post_type=sensei_message';
152
-			$parent_file  = 'sensei';
152
+			$parent_file = 'sensei';
153 153
 
154 154
 		}
155 155
 	}
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 * @return void
161 161
 	 */
162 162
 	public function page_redirect() {
163
-		if( isset( $_GET['page'] ) && $_GET['page'] == 'sensei' ) {
164
-			wp_safe_redirect( 'admin.php?page=sensei_analysis' );
163
+		if (isset($_GET['page']) && $_GET['page'] == 'sensei') {
164
+			wp_safe_redirect('admin.php?page=sensei_analysis');
165 165
 			exit;
166 166
 		}
167 167
 	}
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	function install_pages_output() {
178 178
 
179
-        if( isset($_GET['sensei_install_complete']) && 'true' == $_GET['sensei_install_complete']) {
179
+        if (isset($_GET['sensei_install_complete']) && 'true' == $_GET['sensei_install_complete']) {
180 180
 
181 181
             ?>
182 182
             <div id="message" class="updated sensei-message sensei-connect">
183
-                <p><?php _e( '<strong>Congratulations!</strong> &#8211; Sensei has been installed and set up.', 'woothemes-sensei' ); ?></p>
183
+                <p><?php _e('<strong>Congratulations!</strong> &#8211; Sensei has been installed and set up.', 'woothemes-sensei'); ?></p>
184 184
                 <p><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.woothemes.com/sensei/" data-text="A premium Learning Management plugin for #WordPress that helps you create courses. Beautifully." data-via="WooThemes" data-size="large" data-hashtags="Sensei">Tweet</a>
185 185
                 <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></p>
186 186
             </div>
@@ -202,18 +202,18 @@  discard block
 block discarded – undo
202 202
 	 * @param int $post_parent (default: 0)
203 203
 	 * @return void
204 204
 	 */
205
-	function create_page( $slug, $option, $page_title = '', $page_content = '', $post_parent = 0 ) {
205
+	function create_page($slug, $option, $page_title = '', $page_content = '', $post_parent = 0) {
206 206
 		global $wpdb;
207 207
 
208
-		$option_value = get_option( $option );
208
+		$option_value = get_option($option);
209 209
 
210
-		if ( $option_value > 0 && get_post( $option_value ) )
210
+		if ($option_value > 0 && get_post($option_value))
211 211
 			return;
212 212
 
213
-		$page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", $slug ) );
214
-		if ( $page_found ) :
215
-			if ( ! $option_value )
216
-				update_option( $option, $page_found );
213
+		$page_found = $wpdb->get_var($wpdb->prepare("SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;", $slug));
214
+		if ($page_found) :
215
+			if ( ! $option_value)
216
+				update_option($option, $page_found);
217 217
 			return;
218 218
 		endif;
219 219
 
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 	        'post_parent' 		=> $post_parent,
228 228
 	        'comment_status' 	=> 'closed'
229 229
 	    );
230
-	    $page_id = wp_insert_post( $page_data );
230
+	    $page_id = wp_insert_post($page_data);
231 231
 
232
-	    update_option( $option, $page_id );
232
+	    update_option($option, $page_id);
233 233
 	} // End create_page()
234 234
 
235 235
 
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 	function create_pages() {
243 243
 
244 244
 		// Courses page
245
-	    $this->create_page( esc_sql( _x('courses-overview', 'page_slug', 'woothemes-sensei') ), 'woothemes-sensei_courses_page_id', __('Courses', 'woothemes-sensei'), '[newcourses][featuredcourses][freecourses][paidcourses]' );
245
+	    $this->create_page(esc_sql(_x('courses-overview', 'page_slug', 'woothemes-sensei')), 'woothemes-sensei_courses_page_id', __('Courses', 'woothemes-sensei'), '[newcourses][featuredcourses][freecourses][paidcourses]');
246 246
 
247 247
 		// User Dashboard page
248
-	    $this->create_page( esc_sql( _x('my-courses', 'page_slug', 'woothemes-sensei') ), 'woothemes-sensei_user_dashboard_page_id', __('My Courses', 'woothemes-sensei'), '[usercourses]' );
248
+	    $this->create_page(esc_sql(_x('my-courses', 'page_slug', 'woothemes-sensei')), 'woothemes-sensei_user_dashboard_page_id', __('My Courses', 'woothemes-sensei'), '[usercourses]');
249 249
 
250 250
 	} // End create_pages()
251 251
 
@@ -255,25 +255,25 @@  discard block
 block discarded – undo
255 255
 	 * @since 1.0.0
256 256
 	 * @return void
257 257
 	 */
258
-	public function admin_styles_global ( $hook ) {
258
+	public function admin_styles_global($hook) {
259 259
 		global $post_type;
260 260
 
261
-		$allowed_post_types = apply_filters( 'sensei_scripts_allowed_post_types', array( 'lesson', 'course', 'question' ) );
262
-		$allowed_post_type_pages = apply_filters( 'sensei_scripts_allowed_post_type_pages', array( 'edit.php', 'post-new.php', 'post.php', 'edit-tags.php' ) );
263
-		$allowed_pages = apply_filters( 'sensei_scripts_allowed_pages', array( 'sensei_grading', 'sensei_analysis', 'sensei_learners', 'sensei_updates', 'woothemes-sensei-settings', 'lesson-order', 'course-order' ) );
261
+		$allowed_post_types = apply_filters('sensei_scripts_allowed_post_types', array('lesson', 'course', 'question'));
262
+		$allowed_post_type_pages = apply_filters('sensei_scripts_allowed_post_type_pages', array('edit.php', 'post-new.php', 'post.php', 'edit-tags.php'));
263
+		$allowed_pages = apply_filters('sensei_scripts_allowed_pages', array('sensei_grading', 'sensei_analysis', 'sensei_learners', 'sensei_updates', 'woothemes-sensei-settings', 'lesson-order', 'course-order'));
264 264
 
265 265
 		// Global Styles for icons and menu items
266
-		wp_register_style( 'woothemes-sensei-global', Sensei()->plugin_url . 'assets/css/global.css', '', Sensei()->version, 'screen' );
267
-		wp_enqueue_style( 'woothemes-sensei-global' );
266
+		wp_register_style('woothemes-sensei-global', Sensei()->plugin_url.'assets/css/global.css', '', Sensei()->version, 'screen');
267
+		wp_enqueue_style('woothemes-sensei-global');
268 268
 
269 269
         // Select 2 styles
270
-        wp_enqueue_style( 'select2', Sensei()->plugin_url . 'assets/css/select2/select2.css', '', Sensei()->version, 'screen' );
270
+        wp_enqueue_style('select2', Sensei()->plugin_url.'assets/css/select2/select2.css', '', Sensei()->version, 'screen');
271 271
 
272 272
 		// Test for Write Panel Pages
273
-		if ( ( ( isset( $post_type ) && in_array( $post_type, $allowed_post_types ) ) && ( isset( $hook ) && in_array( $hook, $allowed_post_type_pages ) ) ) || ( isset( $_GET['page'] ) && in_array( $_GET['page'], $allowed_pages ) ) ) {
273
+		if (((isset($post_type) && in_array($post_type, $allowed_post_types)) && (isset($hook) && in_array($hook, $allowed_post_type_pages))) || (isset($_GET['page']) && in_array($_GET['page'], $allowed_pages))) {
274 274
 
275
-			wp_register_style( 'woothemes-sensei-admin-custom', Sensei()->plugin_url . 'assets/css/admin-custom.css', '', Sensei()->version, 'screen' );
276
-			wp_enqueue_style( 'woothemes-sensei-admin-custom' );
275
+			wp_register_style('woothemes-sensei-admin-custom', Sensei()->plugin_url.'assets/css/admin-custom.css', '', Sensei()->version, 'screen');
276
+			wp_enqueue_style('woothemes-sensei-admin-custom');
277 277
 
278 278
 		}
279 279
 
@@ -288,20 +288,20 @@  discard block
 block discarded – undo
288 288
      * @since 1.8.2
289 289
      * @access public
290 290
      */
291
-    public function register_scripts( $hook ){
291
+    public function register_scripts($hook) {
292 292
 
293 293
         $screen = get_current_screen();
294 294
 
295 295
         // Allow developers to load non-minified versions of scripts
296
-        $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
296
+        $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
297 297
 
298 298
         // Select2 script used to enhance all select boxes
299
-        wp_register_script( 'select2', Sensei()->plugin_url . '/assets/js/select2/select2' . $suffix . '.js', array( 'jquery' ), Sensei()->version );
299
+        wp_register_script('select2', Sensei()->plugin_url.'/assets/js/select2/select2'.$suffix.'.js', array('jquery'), Sensei()->version);
300 300
 
301 301
         // load edit module scripts
302
-        if( 'edit-module' ==  $screen->id ){
302
+        if ('edit-module' == $screen->id) {
303 303
 
304
-            wp_enqueue_script( 'sensei-chosen-ajax', Sensei()->plugin_url . 'assets/chosen/ajax-chosen.jquery.min.js', array( 'jquery', 'sensei-chosen' ), Sensei()->version, true );
304
+            wp_enqueue_script('sensei-chosen-ajax', Sensei()->plugin_url.'assets/chosen/ajax-chosen.jquery.min.js', array('jquery', 'sensei-chosen'), Sensei()->version, true);
305 305
 
306 306
         }
307 307
 
@@ -319,19 +319,19 @@  discard block
 block discarded – undo
319 319
 	    <div id="message" class="updated sensei-message sensei-connect">
320 320
 
321 321
             <p>
322
-                <?php _e( '<strong>Welcome to Sensei</strong> &#8211; You\'re almost ready to create some courses!', 'woothemes-sensei' ); ?>
322
+                <?php _e('<strong>Welcome to Sensei</strong> &#8211; You\'re almost ready to create some courses!', 'woothemes-sensei'); ?>
323 323
             </p>
324 324
 
325 325
             <p class="submit">
326 326
 
327
-                <a href="<?php echo esc_url( add_query_arg('install_sensei_pages', 'true', admin_url('admin.php?page=woothemes-sensei-settings') ) ); ?>"
327
+                <a href="<?php echo esc_url(add_query_arg('install_sensei_pages', 'true', admin_url('admin.php?page=woothemes-sensei-settings'))); ?>"
328 328
                    class="button-primary">
329 329
 
330
-                    <?php _e( 'Install Sensei Pages', 'woothemes-sensei' ); ?>
330
+                    <?php _e('Install Sensei Pages', 'woothemes-sensei'); ?>
331 331
 
332 332
                 </a>
333 333
 
334
-                <a class="skip button" href="<?php echo esc_url( add_query_arg( 'skip_install_sensei_pages', 'true', admin_url('admin.php?page=woothemes-sensei-settings' ) ) ); ?>">
334
+                <a class="skip button" href="<?php echo esc_url(add_query_arg('skip_install_sensei_pages', 'true', admin_url('admin.php?page=woothemes-sensei-settings'))); ?>">
335 335
 
336 336
                     <?php _e('Skip setup', 'woothemes-sensei'); ?>
337 337
 
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
 	    <div id="message" class="updated sensei-message sensei-connect">
355 355
 
356 356
 	    	<p>
357
-                <?php _e( '<strong>Sensei has been installed</strong> &#8211; You\'re ready to start creating courses!', 'woothemes-sensei' ); ?>
357
+                <?php _e('<strong>Sensei has been installed</strong> &#8211; You\'re ready to start creating courses!', 'woothemes-sensei'); ?>
358 358
             </p>
359 359
 
360 360
 			<p class="submit">
361
-                <a href="<?php echo admin_url('admin.php?page=woothemes-sensei-settings'); ?>" class="button-primary"><?php _e( 'Settings', 'woothemes-sensei' ); ?></a> <a class="docs button" href="http://www.woothemes.com/sensei-docs/">
361
+                <a href="<?php echo admin_url('admin.php?page=woothemes-sensei-settings'); ?>" class="button-primary"><?php _e('Settings', 'woothemes-sensei'); ?></a> <a class="docs button" href="http://www.woothemes.com/sensei-docs/">
362 362
                     <?php _e('Documentation', 'woothemes-sensei'); ?>
363 363
                 </a>
364 364
             </p>
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
 	public function language_pack_install_notice() {
392 392
 		?>
393 393
 		<div id="message" class="updated sensei-message sensei-connect">
394
-				<p><?php _e( '<strong>Sensei in your language</strong> &#8211; There is a translation available for your language.', 'woothemes-sensei' ); ?><p>
394
+				<p><?php _e('<strong>Sensei in your language</strong> &#8211; There is a translation available for your language.', 'woothemes-sensei'); ?><p>
395 395
 
396 396
 				<p class="submit">
397
-					<a href="<?php echo esc_url( Sensei_Language_Pack_Manager::get_install_uri() ); ?>" class="button-primary"><?php _e( 'Install', 'woothemes-sensei' ); ?></a>
398
-					<a href="<?php echo esc_url( Sensei_Language_Pack_Manager::get_dismiss_uri() ) ?>" class="docs button"><?php _e( 'Hide this notice', 'woothemes-sensei' ); ?></a>
397
+					<a href="<?php echo esc_url(Sensei_Language_Pack_Manager::get_install_uri()); ?>" class="button-primary"><?php _e('Install', 'woothemes-sensei'); ?></a>
398
+					<a href="<?php echo esc_url(Sensei_Language_Pack_Manager::get_dismiss_uri()) ?>" class="docs button"><?php _e('Hide this notice', 'woothemes-sensei'); ?></a>
399 399
 				</p>
400 400
 		</div>
401 401
 		<?php
@@ -411,20 +411,20 @@  discard block
 block discarded – undo
411 411
 	function admin_notices_styles() {
412 412
 
413 413
 		// Installed notices
414
-	    if ( 1 == get_option( 'sensei_installed' ) ) {
414
+	    if (1 == get_option('sensei_installed')) {
415 415
 
416
-	    	wp_enqueue_style( 'sensei-activation', plugins_url(  '/assets/css/activation.css', dirname( __FILE__ ) ), '', Sensei()->version );
416
+	    	wp_enqueue_style('sensei-activation', plugins_url('/assets/css/activation.css', dirname(__FILE__)), '', Sensei()->version);
417 417
 
418
-	    	if (get_option('skip_install_sensei_pages')!=1 && Sensei()->get_page_id('course')<1 && !isset($_GET['install_sensei_pages']) && !isset($_GET['skip_install_sensei_pages'])) {
419
-	    		add_action( 'admin_notices', array( $this, 'admin_install_notice' ) );
420
-	    	} elseif ( !isset($_GET['page']) || $_GET['page']!='woothemes-sensei-settings' ) {
421
-	    		add_action( 'admin_notices', array( $this, 'admin_installed_notice' ) );
418
+	    	if (get_option('skip_install_sensei_pages') != 1 && Sensei()->get_page_id('course') < 1 && ! isset($_GET['install_sensei_pages']) && ! isset($_GET['skip_install_sensei_pages'])) {
419
+	    		add_action('admin_notices', array($this, 'admin_install_notice'));
420
+	    	} elseif ( ! isset($_GET['page']) || $_GET['page'] != 'woothemes-sensei-settings') {
421
+	    		add_action('admin_notices', array($this, 'admin_installed_notice'));
422 422
 	    	} // End If Statement
423 423
 
424 424
 	    } // End If Statement
425 425
 
426
-	    if ( Sensei_Language_Pack_Manager::has_language_pack_available() ) {
427
-	    	add_action( 'admin_notices', array( $this, 'language_pack_install_notice' ) );
426
+	    if (Sensei_Language_Pack_Manager::has_language_pack_available()) {
427
+	    	add_action('admin_notices', array($this, 'language_pack_install_notice'));
428 428
 	    }
429 429
 
430 430
 	} // End admin_notices_styles()
@@ -435,17 +435,17 @@  discard block
 block discarded – undo
435 435
 	 * @param  object $post    Current post
436 436
 	 * @return array           Modified actions
437 437
 	 */
438
-	public function duplicate_action_link( $actions, $post ) {
439
-		switch( $post->post_type ) {
438
+	public function duplicate_action_link($actions, $post) {
439
+		switch ($post->post_type) {
440 440
 			case 'lesson':
441
-				$confirm = __( 'This will duplicate the lesson quiz and all of its questions. Are you sure you want to do this?', 'woothemes-sensei' );
442
-				$actions['duplicate'] = "<a onclick='return confirm(\"" . $confirm . "\");' href='" . $this->get_duplicate_link( $post->ID ) . "' title='" . esc_attr(__( 'Duplicate this lesson', 'woothemes-sensei' ) ) . "'>" .  __('Duplicate', 'woothemes-sensei' ) . "</a>";
441
+				$confirm = __('This will duplicate the lesson quiz and all of its questions. Are you sure you want to do this?', 'woothemes-sensei');
442
+				$actions['duplicate'] = "<a onclick='return confirm(\"".$confirm."\");' href='".$this->get_duplicate_link($post->ID)."' title='".esc_attr(__('Duplicate this lesson', 'woothemes-sensei'))."'>".__('Duplicate', 'woothemes-sensei')."</a>";
443 443
 			break;
444 444
 
445 445
 			case 'course':
446
-				$confirm = __( 'This will duplicate the course lessons along with all of their quizzes and questions. Are you sure you want to do this?', 'woothemes-sensei' );
447
-				$actions['duplicate'] = '<a href="' . $this->get_duplicate_link( $post->ID ) . '" title="' . esc_attr(__( 'Duplicate this course', 'woothemes-sensei' ) ) . '">' .  __('Duplicate', 'woothemes-sensei' ) . '</a>';
448
-				$actions['duplicate_with_lessons'] = '<a onclick="return confirm(\'' . $confirm . '\');" href="' . $this->get_duplicate_link( $post->ID, true ) . '" title="' . esc_attr(__( 'Duplicate this course with its lessons', 'woothemes-sensei' ) ) . '">' .  __('Duplicate (with lessons)', 'woothemes-sensei' ) . '</a>';
446
+				$confirm = __('This will duplicate the course lessons along with all of their quizzes and questions. Are you sure you want to do this?', 'woothemes-sensei');
447
+				$actions['duplicate'] = '<a href="'.$this->get_duplicate_link($post->ID).'" title="'.esc_attr(__('Duplicate this course', 'woothemes-sensei')).'">'.__('Duplicate', 'woothemes-sensei').'</a>';
448
+				$actions['duplicate_with_lessons'] = '<a onclick="return confirm(\''.$confirm.'\');" href="'.$this->get_duplicate_link($post->ID, true).'" title="'.esc_attr(__('Duplicate this course with its lessons', 'woothemes-sensei')).'">'.__('Duplicate (with lessons)', 'woothemes-sensei').'</a>';
449 449
 			break;
450 450
 		}
451 451
 
@@ -458,17 +458,17 @@  discard block
 block discarded – undo
458 458
 	 * @param  boolean $with_lessons Include lessons or not
459 459
 	 * @return string                Duplication link
460 460
 	 */
461
-	private function get_duplicate_link( $post_id = 0, $with_lessons = false ) {
461
+	private function get_duplicate_link($post_id = 0, $with_lessons = false) {
462 462
 
463
-		$post = get_post( $post_id );
463
+		$post = get_post($post_id);
464 464
 
465
-		$action = 'duplicate_' . $post->post_type;
465
+		$action = 'duplicate_'.$post->post_type;
466 466
 
467
-		if( 'course' == $post->post_type && $with_lessons ) {
467
+		if ('course' == $post->post_type && $with_lessons) {
468 468
 			$action .= '_with_lessons';
469 469
 		}
470 470
 
471
-		return apply_filters( $action . '_link', admin_url( 'admin.php?action=' . $action . '&post=' . $post_id ), $post_id );
471
+		return apply_filters($action.'_link', admin_url('admin.php?action='.$action.'&post='.$post_id), $post_id);
472 472
 	}
473 473
 
474 474
 	/**
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 	 * @return void
477 477
 	 */
478 478
 	public function duplicate_lesson_action() {
479
-		$this->duplicate_content( 'lesson' );
479
+		$this->duplicate_content('lesson');
480 480
 	}
481 481
 
482 482
 	/**
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 	 * @return void
485 485
 	 */
486 486
 	public function duplicate_course_action() {
487
-		$this->duplicate_content( 'course' );
487
+		$this->duplicate_content('course');
488 488
 	}
489 489
 
490 490
 	/**
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 	 * @return void
493 493
 	 */
494 494
 	public function duplicate_course_with_lessons_action() {
495
-		$this->duplicate_content( 'course', true );
495
+		$this->duplicate_content('course', true);
496 496
 	}
497 497
 
498 498
 	/**
@@ -501,34 +501,34 @@  discard block
 block discarded – undo
501 501
 	 * @param  boolean $with_lessons Include lessons or not
502 502
 	 * @return void
503 503
 	 */
504
-	private function duplicate_content( $post_type = 'lesson', $with_lessons = false ) {
505
-		if ( ! isset( $_GET['post'] ) ) {
506
-			wp_die( sprintf( __( 'Please supply a %1$s ID.', 'woothemes-sensei' ) ), $post_type );
504
+	private function duplicate_content($post_type = 'lesson', $with_lessons = false) {
505
+		if ( ! isset($_GET['post'])) {
506
+			wp_die(sprintf(__('Please supply a %1$s ID.', 'woothemes-sensei')), $post_type);
507 507
 		}
508 508
 
509 509
 		$post_id = $_GET['post'];
510
-		$post = get_post( $post_id );
510
+		$post = get_post($post_id);
511 511
 
512
-		if( ! is_wp_error( $post ) ) {
512
+		if ( ! is_wp_error($post)) {
513 513
 
514
-			$new_post = $this->duplicate_post( $post );
514
+			$new_post = $this->duplicate_post($post);
515 515
 
516
-			if( $new_post && ! is_wp_error( $new_post ) ) {
516
+			if ($new_post && ! is_wp_error($new_post)) {
517 517
 
518
-				if( 'lesson' == $new_post->post_type ) {
519
-					$this->duplicate_lesson_quizzes( $post_id, $new_post->ID );
518
+				if ('lesson' == $new_post->post_type) {
519
+					$this->duplicate_lesson_quizzes($post_id, $new_post->ID);
520 520
 				}
521 521
 
522
-				if( 'course' == $new_post->post_type && $with_lessons ) {
523
-					$this->duplicate_course_lessons( $post_id, $new_post->ID );
522
+				if ('course' == $new_post->post_type && $with_lessons) {
523
+					$this->duplicate_course_lessons($post_id, $new_post->ID);
524 524
 				}
525 525
 
526
-				$redirect_url = admin_url( 'post.php?post=' . $new_post->ID . '&action=edit' );
526
+				$redirect_url = admin_url('post.php?post='.$new_post->ID.'&action=edit');
527 527
 			} else {
528
-				$redirect_url = admin_url( 'edit.php?post_type=' . $post->post_type . '&message=duplicate_failed' );
528
+				$redirect_url = admin_url('edit.php?post_type='.$post->post_type.'&message=duplicate_failed');
529 529
 			}
530 530
 
531
-			wp_safe_redirect( esc_url_raw( $redirect_url ) );
531
+			wp_safe_redirect(esc_url_raw($redirect_url));
532 532
 			exit;
533 533
 		}
534 534
 	}
@@ -539,19 +539,19 @@  discard block
 block discarded – undo
539 539
 	 * @param  integer $new_lesson_id ID of duplicate lesson
540 540
 	 * @return void
541 541
 	 */
542
-	private function duplicate_lesson_quizzes( $old_lesson_id, $new_lesson_id ) {
542
+	private function duplicate_lesson_quizzes($old_lesson_id, $new_lesson_id) {
543 543
 
544
-        $old_quiz_id = Sensei()->lesson->lesson_quizzes( $old_lesson_id );
545
-        $old_quiz_questions = Sensei()->lesson->lesson_quiz_questions( $old_quiz_id );
544
+        $old_quiz_id = Sensei()->lesson->lesson_quizzes($old_lesson_id);
545
+        $old_quiz_questions = Sensei()->lesson->lesson_quiz_questions($old_quiz_id);
546 546
 
547 547
         // duplicate the generic wp post information
548
-		$new_quiz = $this->duplicate_post( get_post( $old_quiz_id ), '' );
548
+		$new_quiz = $this->duplicate_post(get_post($old_quiz_id), '');
549 549
 
550 550
 		//update the new lesson data
551
-        add_post_meta( $new_lesson_id, '_lesson_quiz', $new_quiz->ID );
551
+        add_post_meta($new_lesson_id, '_lesson_quiz', $new_quiz->ID);
552 552
 
553 553
 		//update the new quiz data
554
-        add_post_meta( $new_quiz->ID, '_quiz_lesson', $new_lesson_id );
554
+        add_post_meta($new_quiz->ID, '_quiz_lesson', $new_lesson_id);
555 555
         wp_update_post(
556 556
             array(
557 557
                 'ID' => $new_quiz->ID,
@@ -559,15 +559,15 @@  discard block
 block discarded – undo
559 559
             )
560 560
         );
561 561
 
562
-		foreach( $old_quiz_questions as $question ) {
562
+		foreach ($old_quiz_questions as $question) {
563 563
 
564 564
 			// copy the question order over to the new quiz
565
-			$old_question_order = get_post_meta( $question->ID, '_quiz_question_order'. $old_quiz_id, true );
566
-            $new_question_order = str_ireplace( $old_quiz_id, $new_quiz->ID , $old_question_order );
567
-            add_post_meta( $question->ID, '_quiz_question_order' . $new_quiz->ID, $new_question_order );
565
+			$old_question_order = get_post_meta($question->ID, '_quiz_question_order'.$old_quiz_id, true);
566
+            $new_question_order = str_ireplace($old_quiz_id, $new_quiz->ID, $old_question_order);
567
+            add_post_meta($question->ID, '_quiz_question_order'.$new_quiz->ID, $new_question_order);
568 568
 
569 569
 			// Add question to quiz
570
-			add_post_meta( $question->ID, '_quiz_id', $new_quiz->ID, false );
570
+			add_post_meta($question->ID, '_quiz_id', $new_quiz->ID, false);
571 571
 
572 572
 		}
573 573
 	}
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 	 * @param  integer $new_course_id ID of duplicated course
579 579
 	 * @return void
580 580
 	 */
581
-	private function duplicate_course_lessons( $old_course_id, $new_course_id ) {
581
+	private function duplicate_course_lessons($old_course_id, $new_course_id) {
582 582
 		$lesson_args = array(
583 583
 			'post_type' => 'lesson',
584 584
 			'posts_per_page' => -1,
@@ -586,13 +586,13 @@  discard block
 block discarded – undo
586 586
 			'meta_value' => $old_course_id,
587 587
 			'suppress_filters' 	=> 0
588 588
 		);
589
-		$lessons = get_posts( $lesson_args );
589
+		$lessons = get_posts($lesson_args);
590 590
 
591
-		foreach( $lessons as $lesson ) {
592
-			$new_lesson = $this->duplicate_post( $lesson, '', true );
593
-			add_post_meta( $new_lesson->ID, '_lesson_course', $new_course_id );
591
+		foreach ($lessons as $lesson) {
592
+			$new_lesson = $this->duplicate_post($lesson, '', true);
593
+			add_post_meta($new_lesson->ID, '_lesson_course', $new_course_id);
594 594
 
595
-			$this->duplicate_lesson_quizzes( $lesson->ID, $new_lesson->ID );
595
+			$this->duplicate_lesson_quizzes($lesson->ID, $new_lesson->ID);
596 596
 		}
597 597
 	}
598 598
 
@@ -603,24 +603,24 @@  discard block
 block discarded – undo
603 603
 	 * @param  boolean $ignore_course Ignore lesson course when dulicating
604 604
 	 * @return object                 Duplicate post object
605 605
 	 */
606
-	private function duplicate_post( $post, $suffix = ' (Duplicate)', $ignore_course = false ) {
606
+	private function duplicate_post($post, $suffix = ' (Duplicate)', $ignore_course = false) {
607 607
 
608 608
 		$new_post = array();
609 609
 
610
-		foreach( $post as $k => $v ) {
611
-			if( ! in_array( $k, array( 'ID', 'post_status', 'post_date', 'post_date_gmt', 'post_name', 'post_modified', 'post_modified_gmt', 'guid', 'comment_count' ) ) ) {
612
-				$new_post[ $k ] = $v;
610
+		foreach ($post as $k => $v) {
611
+			if ( ! in_array($k, array('ID', 'post_status', 'post_date', 'post_date_gmt', 'post_name', 'post_modified', 'post_modified_gmt', 'guid', 'comment_count'))) {
612
+				$new_post[$k] = $v;
613 613
 			}
614 614
 		}
615 615
 
616
-		$new_post['post_title'] .= __( $suffix, 'woothemes-sensei' );
616
+		$new_post['post_title'] .= __($suffix, 'woothemes-sensei');
617 617
 
618
-		$new_post['post_date'] = current_time( 'mysql' );
619
-		$new_post['post_date_gmt'] = get_gmt_from_date( $new_post['post_date'] );
618
+		$new_post['post_date'] = current_time('mysql');
619
+		$new_post['post_date_gmt'] = get_gmt_from_date($new_post['post_date']);
620 620
 		$new_post['post_modified'] = $new_post['post_date'];
621 621
 		$new_post['post_modified_gmt'] = $new_post['post_date_gmt'];
622 622
 
623
-		switch( $post->post_type ) {
623
+		switch ($post->post_type) {
624 624
 			case 'course': $new_post['post_status'] = 'draft'; break;
625 625
 			case 'lesson': $new_post['post_status'] = 'draft'; break;
626 626
 			case 'quiz': $new_post['post_status'] = 'publish'; break;
@@ -628,45 +628,45 @@  discard block
 block discarded – undo
628 628
 		}
629 629
 
630 630
 		// As per wp_update_post() we need to escape the data from the db.
631
-		$new_post = wp_slash( $new_post );
631
+		$new_post = wp_slash($new_post);
632 632
 
633
-		$new_post_id = wp_insert_post( $new_post );
633
+		$new_post_id = wp_insert_post($new_post);
634 634
 
635
-		if( ! is_wp_error( $new_post_id ) ) {
635
+		if ( ! is_wp_error($new_post_id)) {
636 636
 
637
-			$post_meta = get_post_custom( $post->ID );
638
-			if( $post_meta && count( $post_meta ) > 0 ) {
637
+			$post_meta = get_post_custom($post->ID);
638
+			if ($post_meta && count($post_meta) > 0) {
639 639
 
640
-				$ignore_meta = array( '_quiz_lesson', '_quiz_id', '_lesson_quiz' );
640
+				$ignore_meta = array('_quiz_lesson', '_quiz_id', '_lesson_quiz');
641 641
 
642
-				if( $ignore_course ) {
642
+				if ($ignore_course) {
643 643
 					$ignore_meta[] = '_lesson_course';
644 644
 				}
645 645
 
646
-				foreach( $post_meta as $key => $meta ) {
647
-					foreach( $meta as $value ) {
648
-						$value = maybe_unserialize( $value );
649
-						if( ! in_array( $key, $ignore_meta ) ) {
650
-							add_post_meta( $new_post_id, $key, $value );
646
+				foreach ($post_meta as $key => $meta) {
647
+					foreach ($meta as $value) {
648
+						$value = maybe_unserialize($value);
649
+						if ( ! in_array($key, $ignore_meta)) {
650
+							add_post_meta($new_post_id, $key, $value);
651 651
 						}
652 652
 					}
653 653
 				}
654 654
 			}
655 655
 
656
-			add_post_meta( $new_post_id, '_duplicate', $post->ID );
656
+			add_post_meta($new_post_id, '_duplicate', $post->ID);
657 657
 
658
-			$taxonomies = get_object_taxonomies( $post->post_type, 'objects' );
658
+			$taxonomies = get_object_taxonomies($post->post_type, 'objects');
659 659
 
660
-			foreach ( $taxonomies as $slug => $tax ) {
661
-				$terms = get_the_terms( $post->ID, $slug );
662
-				if( isset( $terms ) && is_array( $terms ) && 0 < count( $terms ) ) {
663
-					foreach( $terms as $term ) {
664
-						wp_set_object_terms( $new_post_id, $term->term_id, $slug, true );
660
+			foreach ($taxonomies as $slug => $tax) {
661
+				$terms = get_the_terms($post->ID, $slug);
662
+				if (isset($terms) && is_array($terms) && 0 < count($terms)) {
663
+					foreach ($terms as $term) {
664
+						wp_set_object_terms($new_post_id, $term->term_id, $slug, true);
665 665
 					}
666 666
 				}
667 667
 			}
668 668
 
669
-			$new_post = get_post( $new_post_id );
669
+			$new_post = get_post($new_post_id);
670 670
 
671 671
 			return $new_post;
672 672
 		}
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 	public function lesson_filter_options() {
682 682
 		global $typenow;
683 683
 
684
-		if( is_admin() && 'lesson' == $typenow ) {
684
+		if (is_admin() && 'lesson' == $typenow) {
685 685
 
686 686
 			$args = array(
687 687
 				'post_type' => 'course',
@@ -691,16 +691,16 @@  discard block
 block discarded – undo
691 691
 				'orderby' => 'menu_order date',
692 692
 				'order' => 'ASC',
693 693
 			);
694
-			$courses = get_posts( $args );
694
+			$courses = get_posts($args);
695 695
 
696
-			$selected = isset( $_GET['lesson_course'] ) ? $_GET['lesson_course'] : '';
696
+			$selected = isset($_GET['lesson_course']) ? $_GET['lesson_course'] : '';
697 697
 			$course_options = '';
698
-			foreach( $courses as $course ) {
699
-				$course_options .= '<option value="' . esc_attr( $course->ID ) . '" ' . selected( $selected, $course->ID, false ) . '>' . get_the_title( $course->ID ) . '</option>';
698
+			foreach ($courses as $course) {
699
+				$course_options .= '<option value="'.esc_attr($course->ID).'" '.selected($selected, $course->ID, false).'>'.get_the_title($course->ID).'</option>';
700 700
 			}
701 701
 
702 702
 			$output = '<select name="lesson_course" id="dropdown_lesson_course">';
703
-			$output .= '<option value="">'.__( 'Show all courses', 'woothemes-sensei' ).'</option>';
703
+			$output .= '<option value="">'.__('Show all courses', 'woothemes-sensei').'</option>';
704 704
 			$output .= $course_options;
705 705
 			$output .= '</select>';
706 706
 
@@ -713,13 +713,13 @@  discard block
 block discarded – undo
713 713
 	 * @param  array $request Current request
714 714
 	 * @return array          Modified request
715 715
 	 */
716
-	public function lesson_filter_actions( $request ) {
716
+	public function lesson_filter_actions($request) {
717 717
 		global $typenow;
718 718
 
719
-		if( is_admin() && 'lesson' == $typenow ) {
720
-			$lesson_course = isset( $_GET['lesson_course'] ) ? $_GET['lesson_course'] : '';
719
+		if (is_admin() && 'lesson' == $typenow) {
720
+			$lesson_course = isset($_GET['lesson_course']) ? $_GET['lesson_course'] : '';
721 721
 
722
-			if( $lesson_course ) {
722
+			if ($lesson_course) {
723 723
 				$request['meta_key'] = '_lesson_course';
724 724
 				$request['meta_value'] = $lesson_course;
725 725
 				$request['meta_compare'] = '=';
@@ -734,27 +734,27 @@  discard block
 block discarded – undo
734 734
 	 * @param  array $items Existing items
735 735
 	 * @return array        Updated items
736 736
 	 */
737
-	public function glance_items( $items = array() ) {
737
+	public function glance_items($items = array()) {
738 738
 
739
-		$types = array( 'course', 'lesson', 'question' );
739
+		$types = array('course', 'lesson', 'question');
740 740
 
741
-		foreach( $types as $type ) {
742
-			if( ! post_type_exists( $type ) ) continue;
741
+		foreach ($types as $type) {
742
+			if ( ! post_type_exists($type)) continue;
743 743
 
744
-			$num_posts = wp_count_posts( $type );
744
+			$num_posts = wp_count_posts($type);
745 745
 
746
-			if( $num_posts ) {
746
+			if ($num_posts) {
747 747
 
748
-				$published = intval( $num_posts->publish );
749
-				$post_type = get_post_type_object( $type );
748
+				$published = intval($num_posts->publish);
749
+				$post_type = get_post_type_object($type);
750 750
 
751
-				$text = _n( '%s ' . $post_type->labels->singular_name, '%s ' . $post_type->labels->name, $published, 'woothemes-sensei' );
752
-				$text = sprintf( $text, number_format_i18n( $published ) );
751
+				$text = _n('%s '.$post_type->labels->singular_name, '%s '.$post_type->labels->name, $published, 'woothemes-sensei');
752
+				$text = sprintf($text, number_format_i18n($published));
753 753
 
754
-				if ( current_user_can( $post_type->cap->edit_posts ) ) {
755
-					$items[] = sprintf( '<a class="%1$s-count" href="edit.php?post_type=%1$s">%2$s</a>', $type, $text ) . "\n";
754
+				if (current_user_can($post_type->cap->edit_posts)) {
755
+					$items[] = sprintf('<a class="%1$s-count" href="edit.php?post_type=%1$s">%2$s</a>', $type, $text)."\n";
756 756
 				} else {
757
-					$items[] = sprintf( '<span class="%1$s-count">%2$s</span>', $type, $text ) . "\n";
757
+					$items[] = sprintf('<span class="%1$s-count">%2$s</span>', $type, $text)."\n";
758 758
 				}
759 759
 			}
760 760
 		}
@@ -768,13 +768,13 @@  discard block
 block discarded – undo
768 768
 	 * @param  object  $post    Post object
769 769
 	 * @return void
770 770
 	 */
771
-	public function delete_content( $post_id, $post ) {
771
+	public function delete_content($post_id, $post) {
772 772
 
773 773
 		$type = $post->post_type;
774 774
 
775
-		if( in_array( $type, array( 'lesson', 'course' ) ) ) {
775
+		if (in_array($type, array('lesson', 'course'))) {
776 776
 
777
-			$meta_key = '_' . $type . '_prerequisite';
777
+			$meta_key = '_'.$type.'_prerequisite';
778 778
 
779 779
 			$args = array(
780 780
 				'post_type' => $type,
@@ -784,10 +784,10 @@  discard block
 block discarded – undo
784 784
 				'meta_value' => $post_id
785 785
 			);
786 786
 
787
-			$posts = get_posts( $args );
787
+			$posts = get_posts($args);
788 788
 
789
-			foreach( $posts as $post ) {
790
-				delete_post_meta( $post->ID, $meta_key );
789
+			foreach ($posts as $post) {
790
+				delete_post_meta($post->ID, $meta_key);
791 791
 			}
792 792
 		}
793 793
 	}
@@ -797,181 +797,181 @@  discard block
 block discarded – undo
797 797
 	 * @param  integer $user_id User ID
798 798
 	 * @return void
799 799
 	 */
800
-	public function delete_user_activity( $user_id = 0 ) {
801
-		if( $user_id ) {
802
-			Sensei_Utils::delete_all_user_activity( $user_id );
800
+	public function delete_user_activity($user_id = 0) {
801
+		if ($user_id) {
802
+			Sensei_Utils::delete_all_user_activity($user_id);
803 803
 		}
804 804
 	}
805 805
 
806
-	public function render_settings( $settings = array(), $post_id = 0, $group_id = '' ) {
806
+	public function render_settings($settings = array(), $post_id = 0, $group_id = '') {
807 807
 
808 808
 		$html = '';
809 809
 
810
-		if( 0 == count( $settings ) ) return $html;
810
+		if (0 == count($settings)) return $html;
811 811
 
812
-		$html .= '<div class="sensei-options-panel">' . "\n";
812
+		$html .= '<div class="sensei-options-panel">'."\n";
813 813
 
814
-			$html .= '<div class="options_group" id="' . esc_attr( $group_id ) . '">' . "\n";
814
+			$html .= '<div class="options_group" id="'.esc_attr($group_id).'">'."\n";
815 815
 
816
-				foreach( $settings as $field ) {
816
+				foreach ($settings as $field) {
817 817
 
818 818
 					$data = '';
819 819
 
820
-					if( $post_id ) {
821
-						$data = get_post_meta( $post_id, '_' . $field['id'], true );
822
-						if( ! $data && isset( $field['default'] ) ) {
820
+					if ($post_id) {
821
+						$data = get_post_meta($post_id, '_'.$field['id'], true);
822
+						if ( ! $data && isset($field['default'])) {
823 823
 							$data = $field['default'];
824 824
 						}
825 825
 					} else {
826
-						$option = get_option( $field['id'] );
827
-						if( isset( $field['default'] ) ) {
826
+						$option = get_option($field['id']);
827
+						if (isset($field['default'])) {
828 828
 							$data = $field['default'];
829
-							if( $option ) {
829
+							if ($option) {
830 830
 								$data = $option;
831 831
 							}
832 832
 						}
833 833
 					}
834 834
 
835 835
 					$disabled = '';
836
-					if( isset( $field['disabled'] ) && $field['disabled'] ) {
837
-						$disabled = disabled( $field['disabled'], true, false );
836
+					if (isset($field['disabled']) && $field['disabled']) {
837
+						$disabled = disabled($field['disabled'], true, false);
838 838
 					}
839 839
 
840
-					if( 'hidden' != $field['type'] ) {
840
+					if ('hidden' != $field['type']) {
841 841
 
842 842
 						$class_tail = '';
843 843
 
844
-						if( isset( $field['class'] ) ) {
844
+						if (isset($field['class'])) {
845 845
 							$class_tail .= $field['class'];
846 846
 						}
847 847
 
848
-						if( isset( $field['disabled'] ) && $field['disabled'] ) {
848
+						if (isset($field['disabled']) && $field['disabled']) {
849 849
 							$class_tail .= ' disabled';
850 850
 						}
851 851
 
852
-						$html .= '<p class="form-field ' . esc_attr( $field['id'] ) . ' ' . esc_attr( $class_tail ) . '">' . "\n";
852
+						$html .= '<p class="form-field '.esc_attr($field['id']).' '.esc_attr($class_tail).'">'."\n";
853 853
 					}
854 854
 
855
-						if( ! in_array( $field['type'], array( 'hidden', 'checkbox_multi', 'radio' ) ) ) {
856
-							$html .= '<label for="' . esc_attr( $field['id'] ) . '">' . "\n";
855
+						if ( ! in_array($field['type'], array('hidden', 'checkbox_multi', 'radio'))) {
856
+							$html .= '<label for="'.esc_attr($field['id']).'">'."\n";
857 857
 						}
858 858
 
859
-							if( $field['label'] ) {
860
-								$html .= '<span class="label">' . esc_html( $field['label'] ) . '</span>';
859
+							if ($field['label']) {
860
+								$html .= '<span class="label">'.esc_html($field['label']).'</span>';
861 861
 							}
862 862
 
863
-							switch( $field['type'] ) {
863
+							switch ($field['type']) {
864 864
 								case 'text':
865 865
 								case 'password':
866
-									$html .= '<input id="' . esc_attr( $field['id'] ) . '" type="' . $field['type'] . '" name="' . esc_attr( $field['id'] ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '" value="' . $data . '" ' . $disabled . ' />' . "\n";
866
+									$html .= '<input id="'.esc_attr($field['id']).'" type="'.$field['type'].'" name="'.esc_attr($field['id']).'" placeholder="'.esc_attr($field['placeholder']).'" value="'.$data.'" '.$disabled.' />'."\n";
867 867
 								break;
868 868
 
869 869
 								case 'number':
870 870
 
871 871
 									$min = '';
872
-									if( isset( $field['min'] ) ) {
873
-										$min = 'min="' . esc_attr( $field['min'] ) . '"';
872
+									if (isset($field['min'])) {
873
+										$min = 'min="'.esc_attr($field['min']).'"';
874 874
 									}
875 875
 
876 876
 									$max = '';
877
-									if( isset( $field['max'] ) ) {
878
-										$max = 'max="' . esc_attr( $field['max'] ) . '"';
877
+									if (isset($field['max'])) {
878
+										$max = 'max="'.esc_attr($field['max']).'"';
879 879
 									}
880 880
 
881
-									$html .= '<input id="' . esc_attr( $field['id'] ) . '" type="' . $field['type'] . '" name="' . esc_attr( $field['id'] ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '" value="' . $data . '" ' . $min . '  ' . $max . ' class="small-text" ' . $disabled . ' />' . "\n";
881
+									$html .= '<input id="'.esc_attr($field['id']).'" type="'.$field['type'].'" name="'.esc_attr($field['id']).'" placeholder="'.esc_attr($field['placeholder']).'" value="'.$data.'" '.$min.'  '.$max.' class="small-text" '.$disabled.' />'."\n";
882 882
 								break;
883 883
 
884 884
 								case 'textarea':
885
-									$html .= '<textarea id="' . esc_attr( $field['id'] ) . '" rows="5" cols="50" name="' . esc_attr( $field['id'] ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '" ' . $disabled . '>' . $data . '</textarea><br/>'. "\n";
885
+									$html .= '<textarea id="'.esc_attr($field['id']).'" rows="5" cols="50" name="'.esc_attr($field['id']).'" placeholder="'.esc_attr($field['placeholder']).'" '.$disabled.'>'.$data.'</textarea><br/>'."\n";
886 886
 								break;
887 887
 
888 888
 								case 'checkbox':
889 889
                                     //backwards compatibility
890
-                                    if( empty( $data ) || 'on' == $data ){
890
+                                    if (empty($data) || 'on' == $data) {
891 891
                                         $checked_value = 'on';
892
-                                    }elseif( 'yes' == $data  ) {
892
+                                    }elseif ('yes' == $data) {
893 893
 
894 894
                                         $checked_value = 'yes';
895 895
 
896
-                                    }elseif( 'auto' == $data  ) {
896
+                                    }elseif ('auto' == $data) {
897 897
 
898 898
                                         $checked_value = 'auto';
899 899
 
900 900
                                     } else {
901 901
                                         $checked_value = 1;
902
-                                        $data = intval( $data );
902
+                                        $data = intval($data);
903 903
                                     }
904
-									$checked = checked( $checked_value, $data, false );
905
-									$html .= '<input id="' . esc_attr( $field['id'] ) . '" type="' . $field['type'] . '" name="' . esc_attr( $field['id'] ) . '" ' . $checked . ' ' . $disabled . '/>' . "\n";
904
+									$checked = checked($checked_value, $data, false);
905
+									$html .= '<input id="'.esc_attr($field['id']).'" type="'.$field['type'].'" name="'.esc_attr($field['id']).'" '.$checked.' '.$disabled.'/>'."\n";
906 906
 								break;
907 907
 
908 908
 								case 'checkbox_multi':
909
-									foreach( $field['options'] as $k => $v ) {
909
+									foreach ($field['options'] as $k => $v) {
910 910
 										$checked = false;
911
-										if( in_array( $k, $data ) ) {
911
+										if (in_array($k, $data)) {
912 912
 											$checked = true;
913 913
 										}
914
-										$html .= '<label for="' . esc_attr( $field['id'] . '_' . $k ) . '"><input type="checkbox" ' . checked( $checked, true, false ) . ' name="' . esc_attr( $field['id'] ) . '[]" value="' . esc_attr( $k ) . '" id="' . esc_attr( $field['id'] . '_' . $k ) . '" ' . $disabled . ' /> ' . $v . '</label> ' . "\n";
914
+										$html .= '<label for="'.esc_attr($field['id'].'_'.$k).'"><input type="checkbox" '.checked($checked, true, false).' name="'.esc_attr($field['id']).'[]" value="'.esc_attr($k).'" id="'.esc_attr($field['id'].'_'.$k).'" '.$disabled.' /> '.$v.'</label> '."\n";
915 915
 									}
916 916
 								break;
917 917
 
918 918
 								case 'radio':
919
-									foreach( $field['options'] as $k => $v ) {
919
+									foreach ($field['options'] as $k => $v) {
920 920
 										$checked = false;
921
-										if( $k == $data ) {
921
+										if ($k == $data) {
922 922
 											$checked = true;
923 923
 										}
924
-										$html .= '<label for="' . esc_attr( $field['id'] . '_' . $k ) . '"><input type="radio" ' . checked( $checked, true, false ) . ' name="' . esc_attr( $field['id'] ) . '" value="' . esc_attr( $k ) . '" id="' . esc_attr( $field['id'] . '_' . $k ) . '" ' . $disabled . ' /> ' . $v . '</label> ' . "\n";
924
+										$html .= '<label for="'.esc_attr($field['id'].'_'.$k).'"><input type="radio" '.checked($checked, true, false).' name="'.esc_attr($field['id']).'" value="'.esc_attr($k).'" id="'.esc_attr($field['id'].'_'.$k).'" '.$disabled.' /> '.$v.'</label> '."\n";
925 925
 									}
926 926
 								break;
927 927
 
928 928
 								case 'select':
929
-									$html .= '<select name="' . esc_attr( $field['id'] ) . '" id="' . esc_attr( $field['id'] ) . '" ' . $disabled . '>' . "\n";
930
-									foreach( $field['options'] as $k => $v ) {
929
+									$html .= '<select name="'.esc_attr($field['id']).'" id="'.esc_attr($field['id']).'" '.$disabled.'>'."\n";
930
+									foreach ($field['options'] as $k => $v) {
931 931
 										$selected = false;
932
-										if( $k == $data ) {
932
+										if ($k == $data) {
933 933
 											$selected = true;
934 934
 										}
935
-										$html .= '<option ' . selected( $selected, true, false ) . ' value="' . esc_attr( $k ) . '">' . $v . '</option>' . "\n";
935
+										$html .= '<option '.selected($selected, true, false).' value="'.esc_attr($k).'">'.$v.'</option>'."\n";
936 936
 									}
937
-									$html .= '</select><br/>' . "\n";
937
+									$html .= '</select><br/>'."\n";
938 938
 								break;
939 939
 
940 940
 								case 'select_multi':
941
-									$html .= '<select name="' . esc_attr( $field['id'] ) . '[]" id="' . esc_attr( $field['id'] ) . '" multiple="multiple" ' . $disabled . '>' . "\n";
942
-									foreach( $field['options'] as $k => $v ) {
941
+									$html .= '<select name="'.esc_attr($field['id']).'[]" id="'.esc_attr($field['id']).'" multiple="multiple" '.$disabled.'>'."\n";
942
+									foreach ($field['options'] as $k => $v) {
943 943
 										$selected = false;
944
-										if( in_array( $k, $data ) ) {
944
+										if (in_array($k, $data)) {
945 945
 											$selected = true;
946 946
 										}
947
-										$html .= '<option ' . selected( $selected, true, false ) . ' value="' . esc_attr( $k ) . '" />' . $v . '</option>' . "\n";
947
+										$html .= '<option '.selected($selected, true, false).' value="'.esc_attr($k).'" />'.$v.'</option>'."\n";
948 948
 									}
949 949
 									$html .= '</select> . "\n"';
950 950
 								break;
951 951
 
952 952
 								case 'hidden':
953
-									$html .= '<input id="' . esc_attr( $field['id'] ) . '" type="' . $field['type'] . '" name="' . esc_attr( $field['id'] ) . '" value="' . $data . '" ' . $disabled . '/>' . "\n";
953
+									$html .= '<input id="'.esc_attr($field['id']).'" type="'.$field['type'].'" name="'.esc_attr($field['id']).'" value="'.$data.'" '.$disabled.'/>'."\n";
954 954
 								break;
955 955
 
956 956
 							}
957 957
 
958
-							if( $field['description'] ) {
959
-								$html .= ' <span class="description">' . esc_html( $field['description'] ) . '</span>' . "\n";
958
+							if ($field['description']) {
959
+								$html .= ' <span class="description">'.esc_html($field['description']).'</span>'."\n";
960 960
 							}
961 961
 
962
-						if( ! in_array( $field['type'], array( 'hidden', 'checkbox_multi', 'radio' ) ) ) {
963
-							$html .= '</label>' . "\n";
962
+						if ( ! in_array($field['type'], array('hidden', 'checkbox_multi', 'radio'))) {
963
+							$html .= '</label>'."\n";
964 964
 						}
965 965
 
966
-					if( 'hidden' != $field['type'] ) {
967
-						$html .= '</p>' . "\n";
966
+					if ('hidden' != $field['type']) {
967
+						$html .= '</p>'."\n";
968 968
 					}
969 969
 
970 970
 				}
971 971
 
972
-			$html .= '</div>' . "\n";
972
+			$html .= '</div>'."\n";
973 973
 
974
-		$html .= '</div>' . "\n";
974
+		$html .= '</div>'."\n";
975 975
 
976 976
 		return $html;
977 977
 	}
@@ -982,61 +982,61 @@  discard block
 block discarded – undo
982 982
 	 */
983 983
 	public function course_order_screen() {
984 984
 
985
-		$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
986
-		wp_enqueue_script( 'woothemes-sensei-settings', esc_url( Sensei()->plugin_url . 'assets/js/settings' . $suffix . '.js' ), array( 'jquery', 'jquery-ui-sortable' ), Sensei()->version );
985
+		$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
986
+		wp_enqueue_script('woothemes-sensei-settings', esc_url(Sensei()->plugin_url.'assets/js/settings'.$suffix.'.js'), array('jquery', 'jquery-ui-sortable'), Sensei()->version);
987 987
 
988 988
 		?><div id="course-order" class="wrap course-order">
989
-		<h2><?php _e( 'Order Courses', 'woothemes-sensei' ); ?></h2><?php
989
+		<h2><?php _e('Order Courses', 'woothemes-sensei'); ?></h2><?php
990 990
 
991 991
 		$html = '';
992 992
 
993
-		if( isset( $_POST['course-order'] ) && 0 < strlen( $_POST['course-order'] ) ) {
994
-			$ordered = $this->save_course_order( esc_attr( $_POST['course-order'] ) );
993
+		if (isset($_POST['course-order']) && 0 < strlen($_POST['course-order'])) {
994
+			$ordered = $this->save_course_order(esc_attr($_POST['course-order']));
995 995
 
996
-			if( $ordered ) {
997
-				$html .= '<div class="updated fade">' . "\n";
998
-				$html .= '<p>' . __( 'The course order has been saved.', 'woothemes-sensei' ) . '</p>' . "\n";
999
-				$html .= '</div>' . "\n";
996
+			if ($ordered) {
997
+				$html .= '<div class="updated fade">'."\n";
998
+				$html .= '<p>'.__('The course order has been saved.', 'woothemes-sensei').'</p>'."\n";
999
+				$html .= '</div>'."\n";
1000 1000
 			}
1001 1001
 		}
1002 1002
 
1003 1003
 		$courses = Sensei()->course->get_all_courses();
1004 1004
 
1005
-		if( 0 < count( $courses ) ) {
1005
+		if (0 < count($courses)) {
1006 1006
 
1007 1007
             // order the courses as set by the users
1008 1008
             $all_course_ids = array();
1009
-            foreach( $courses as $course ){
1009
+            foreach ($courses as $course) {
1010 1010
 
1011
-                $all_course_ids[] = (string)$course->ID;
1011
+                $all_course_ids[] = (string) $course->ID;
1012 1012
 
1013 1013
             }
1014 1014
             $order_string = $this->get_course_order();
1015 1015
 
1016
-            if( !empty( $order_string ) ){
1017
-                $ordered_course_ids = explode(',' , $order_string );
1018
-                $all_course_ids = array_unique( array_merge( $ordered_course_ids , $all_course_ids ) );
1016
+            if ( ! empty($order_string)) {
1017
+                $ordered_course_ids = explode(',', $order_string);
1018
+                $all_course_ids = array_unique(array_merge($ordered_course_ids, $all_course_ids));
1019 1019
             }
1020 1020
 
1021 1021
 
1022
-			$html .= '<form id="editgrouping" method="post" action="" class="validate">' . "\n";
1023
-			$html .= '<ul class="sortable-course-list">' . "\n";
1022
+			$html .= '<form id="editgrouping" method="post" action="" class="validate">'."\n";
1023
+			$html .= '<ul class="sortable-course-list">'."\n";
1024 1024
 			$count = 0;
1025
-			foreach ( $all_course_ids as $course_id ) {
1026
-                $course = get_post( $course_id );
1025
+			foreach ($all_course_ids as $course_id) {
1026
+                $course = get_post($course_id);
1027 1027
 				$count++;
1028 1028
 				$class = 'course';
1029
-				if ( $count == 1 ) { $class .= ' first'; }
1030
-				if ( $count == count( $course ) ) { $class .= ' last'; }
1031
-				if ( $count % 2 != 0 ) {
1029
+				if ($count == 1) { $class .= ' first'; }
1030
+				if ($count == count($course)) { $class .= ' last'; }
1031
+				if ($count % 2 != 0) {
1032 1032
 					$class .= ' alternate';
1033 1033
 				}
1034
-				$html .= '<li class="' . esc_attr( $class ) . '"><span rel="' . esc_attr( $course->ID ) . '" style="width: 100%;"> ' . $course->post_title . '</span></li>' . "\n";
1034
+				$html .= '<li class="'.esc_attr($class).'"><span rel="'.esc_attr($course->ID).'" style="width: 100%;"> '.$course->post_title.'</span></li>'."\n";
1035 1035
 			}
1036
-			$html .= '</ul>' . "\n";
1036
+			$html .= '</ul>'."\n";
1037 1037
 
1038
-			$html .= '<input type="hidden" name="course-order" value="' . esc_attr( $order_string ) . '" />' . "\n";
1039
-			$html .= '<input type="submit" class="button-primary" value="' . __( 'Save course order', 'woothemes-sensei' ) . '" />' . "\n";
1038
+			$html .= '<input type="hidden" name="course-order" value="'.esc_attr($order_string).'" />'."\n";
1039
+			$html .= '<input type="submit" class="button-primary" value="'.__('Save course order', 'woothemes-sensei').'" />'."\n";
1040 1040
 		}
1041 1041
 
1042 1042
 		echo $html;
@@ -1045,25 +1045,25 @@  discard block
 block discarded – undo
1045 1045
 	}
1046 1046
 
1047 1047
 	public function get_course_order() {
1048
-		return get_option( 'sensei_course_order', '' );
1048
+		return get_option('sensei_course_order', '');
1049 1049
 	}
1050 1050
 
1051
-	public function save_course_order( $order_string = '' ) {
1052
-		$order = explode( ',', $order_string );
1051
+	public function save_course_order($order_string = '') {
1052
+		$order = explode(',', $order_string);
1053 1053
 
1054
-		update_option( 'sensei_course_order', $order_string );
1054
+		update_option('sensei_course_order', $order_string);
1055 1055
 
1056 1056
 		$i = 1;
1057
-		foreach( $order as $course_id ) {
1057
+		foreach ($order as $course_id) {
1058 1058
 
1059
-			if( $course_id ) {
1059
+			if ($course_id) {
1060 1060
 
1061 1061
 				$update_args = array(
1062 1062
 					'ID' => $course_id,
1063 1063
 					'menu_order' => $i,
1064 1064
 				);
1065 1065
 
1066
-				wp_update_post( $update_args );
1066
+				wp_update_post($update_args);
1067 1067
 
1068 1068
 				++$i;
1069 1069
 			}
@@ -1078,22 +1078,22 @@  discard block
 block discarded – undo
1078 1078
 	 */
1079 1079
 	public function lesson_order_screen() {
1080 1080
 
1081
-		$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
1082
-		wp_enqueue_script( 'woothemes-sensei-settings', esc_url( Sensei()->plugin_url . 'assets/js/settings' . $suffix . '.js' ), array( 'jquery', 'jquery-ui-sortable' ), Sensei()->version );
1081
+		$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
1082
+		wp_enqueue_script('woothemes-sensei-settings', esc_url(Sensei()->plugin_url.'assets/js/settings'.$suffix.'.js'), array('jquery', 'jquery-ui-sortable'), Sensei()->version);
1083 1083
 
1084 1084
 		?><div id="lesson-order" class="wrap lesson-order">
1085
-		<h2><?php _e( 'Order Lessons', 'woothemes-sensei' ); ?></h2><?php
1085
+		<h2><?php _e('Order Lessons', 'woothemes-sensei'); ?></h2><?php
1086 1086
 
1087 1087
 		$html = '';
1088 1088
 
1089
-		if( isset( $_POST['lesson-order'] ) ) {
1089
+		if (isset($_POST['lesson-order'])) {
1090 1090
 
1091
-			$ordered = $this->save_lesson_order( esc_attr( $_POST['lesson-order'] ), esc_attr( $_POST['course_id'] ) );
1091
+			$ordered = $this->save_lesson_order(esc_attr($_POST['lesson-order']), esc_attr($_POST['course_id']));
1092 1092
 
1093
-			if( $ordered ) {
1094
-				$html .= '<div class="updated fade">' . "\n";
1095
-				$html .= '<p>' . __( 'The lesson order has been saved.', 'woothemes-sensei' ) . '</p>' . "\n";
1096
-				$html .= '</div>' . "\n";
1093
+			if ($ordered) {
1094
+				$html .= '<div class="updated fade">'."\n";
1095
+				$html .= '<p>'.__('The lesson order has been saved.', 'woothemes-sensei').'</p>'."\n";
1096
+				$html .= '</div>'."\n";
1097 1097
 			}
1098 1098
 		}
1099 1099
 
@@ -1104,43 +1104,43 @@  discard block
 block discarded – undo
1104 1104
 			'orderby' => 'name',
1105 1105
 			'order' => 'ASC',
1106 1106
 		);
1107
-		$courses = get_posts( $args );
1107
+		$courses = get_posts($args);
1108 1108
 
1109
-		$html .= '<form action="' . admin_url( 'edit.php' ) . '" method="get">' . "\n";
1110
-		$html .= '<input type="hidden" name="post_type" value="lesson" />' . "\n";
1111
-		$html .= '<input type="hidden" name="page" value="lesson-order" />' . "\n";
1112
-		$html .= '<select id="lesson-order-course" name="course_id">' . "\n";
1113
-		$html .= '<option value="">' . __( 'Select a course', 'woothemes-sensei' ) . '</option>' . "\n";
1109
+		$html .= '<form action="'.admin_url('edit.php').'" method="get">'."\n";
1110
+		$html .= '<input type="hidden" name="post_type" value="lesson" />'."\n";
1111
+		$html .= '<input type="hidden" name="page" value="lesson-order" />'."\n";
1112
+		$html .= '<select id="lesson-order-course" name="course_id">'."\n";
1113
+		$html .= '<option value="">'.__('Select a course', 'woothemes-sensei').'</option>'."\n";
1114 1114
 
1115
-		foreach( $courses as $course ) {
1115
+		foreach ($courses as $course) {
1116 1116
 			$course_id = '';
1117
-			if( isset( $_GET['course_id'] ) ) {
1118
-				$course_id = intval( $_GET['course_id'] );
1117
+			if (isset($_GET['course_id'])) {
1118
+				$course_id = intval($_GET['course_id']);
1119 1119
 			}
1120
-			$html .= '<option value="' . esc_attr( intval( $course->ID ) ) . '" ' . selected( $course->ID, $course_id, false ) .'>' . get_the_title( $course->ID ) . '</option>' . "\n";
1120
+			$html .= '<option value="'.esc_attr(intval($course->ID)).'" '.selected($course->ID, $course_id, false).'>'.get_the_title($course->ID).'</option>'."\n";
1121 1121
 		}
1122 1122
 
1123
-		$html .= '</select>' . "\n";
1124
-		$html .= '<input type="submit" class="button-primary lesson-order-select-course-submit" value="' . __( 'Select', 'woothemes-sensei' ) . '" />' . "\n";
1125
-		$html .= '</form>' . "\n";
1123
+		$html .= '</select>'."\n";
1124
+		$html .= '<input type="submit" class="button-primary lesson-order-select-course-submit" value="'.__('Select', 'woothemes-sensei').'" />'."\n";
1125
+		$html .= '</form>'."\n";
1126 1126
 
1127
-		$html .= '<script type="text/javascript">' . "\n";
1128
-		$html .= 'jQuery( \'#lesson-order-course\' ).select2({width:"resolve"});' . "\n";
1129
-		$html .= '</script>' . "\n";
1127
+		$html .= '<script type="text/javascript">'."\n";
1128
+		$html .= 'jQuery( \'#lesson-order-course\' ).select2({width:"resolve"});'."\n";
1129
+		$html .= '</script>'."\n";
1130 1130
 
1131
-		if( isset( $_GET['course_id'] ) ) {
1132
-			$course_id = intval( $_GET['course_id'] );
1133
-			if( $course_id > 0 ) {
1131
+		if (isset($_GET['course_id'])) {
1132
+			$course_id = intval($_GET['course_id']);
1133
+			if ($course_id > 0) {
1134 1134
 
1135
-				$order_string = $this->get_lesson_order( $course_id );
1135
+				$order_string = $this->get_lesson_order($course_id);
1136 1136
 
1137
-				$html .= '<form id="editgrouping" method="post" action="" class="validate">' . "\n";
1137
+				$html .= '<form id="editgrouping" method="post" action="" class="validate">'."\n";
1138 1138
 
1139 1139
 				$displayed_lessons = array();
1140 1140
 
1141
-                $modules = Sensei()->modules->get_course_modules( intval( $course_id ) );
1141
+                $modules = Sensei()->modules->get_course_modules(intval($course_id));
1142 1142
 
1143
-                foreach( $modules as $module ) {
1143
+                foreach ($modules as $module) {
1144 1144
 
1145 1145
                     $args = array(
1146 1146
                         'post_type' => 'lesson',
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
                         'meta_query' => array(
1150 1150
                             array(
1151 1151
                                 'key' => '_lesson_course',
1152
-                                'value' => intval( $course_id ),
1152
+                                'value' => intval($course_id),
1153 1153
                                 'compare' => '='
1154 1154
                             )
1155 1155
                         ),
@@ -1157,66 +1157,66 @@  discard block
 block discarded – undo
1157 1157
                             array(
1158 1158
                                 'taxonomy' => Sensei()->modules->taxonomy,
1159 1159
                                 'field' => 'id',
1160
-                                'terms' => intval( $module->term_id )
1160
+                                'terms' => intval($module->term_id)
1161 1161
                             )
1162 1162
                         ),
1163
-                        'meta_key' => '_order_module_' . $module->term_id,
1163
+                        'meta_key' => '_order_module_'.$module->term_id,
1164 1164
                         'orderby' => 'meta_value_num date',
1165 1165
                         'order' => 'ASC',
1166 1166
                         'suppress_filters' => 0
1167 1167
                     );
1168 1168
 
1169
-                    $lessons = get_posts( $args );
1169
+                    $lessons = get_posts($args);
1170 1170
 
1171
-                    if( count( $lessons ) > 0 ) {
1172
-                        $html .= '<h3>' . $module->name . '</h3>' . "\n";
1173
-                        $html .= '<ul class="sortable-lesson-list" data-module_id="' . $module->term_id . '">' . "\n";
1171
+                    if (count($lessons) > 0) {
1172
+                        $html .= '<h3>'.$module->name.'</h3>'."\n";
1173
+                        $html .= '<ul class="sortable-lesson-list" data-module_id="'.$module->term_id.'">'."\n";
1174 1174
 
1175 1175
                         $count = 0;
1176
-                        foreach( $lessons as $lesson ) {
1176
+                        foreach ($lessons as $lesson) {
1177 1177
                             $count++;
1178 1178
                             $class = 'lesson';
1179
-                            if ( $count == 1 ) { $class .= ' first'; }
1180
-                            if ( $count == count( $lesson ) ) { $class .= ' last'; }
1181
-                            if ( $count % 2 != 0 ) {
1179
+                            if ($count == 1) { $class .= ' first'; }
1180
+                            if ($count == count($lesson)) { $class .= ' last'; }
1181
+                            if ($count % 2 != 0) {
1182 1182
                                 $class .= ' alternate';
1183 1183
                             }
1184 1184
 
1185
-                            $html .= '<li class="' . esc_attr( $class ) . '"><span rel="' . esc_attr( $lesson->ID ) . '" style="width: 100%;"> ' . $lesson->post_title . '</span></li>' . "\n";
1185
+                            $html .= '<li class="'.esc_attr($class).'"><span rel="'.esc_attr($lesson->ID).'" style="width: 100%;"> '.$lesson->post_title.'</span></li>'."\n";
1186 1186
 
1187 1187
                             $displayed_lessons[] = $lesson->ID;
1188 1188
                         }
1189 1189
 
1190
-                        $html .= '</ul>' . "\n";
1190
+                        $html .= '</ul>'."\n";
1191 1191
 
1192
-                        $html .= '<input type="hidden" name="lesson-order-module-' . $module->term_id . '" value="" />' . "\n";
1192
+                        $html .= '<input type="hidden" name="lesson-order-module-'.$module->term_id.'" value="" />'."\n";
1193 1193
                     }
1194 1194
                 }
1195 1195
 
1196 1196
 
1197
-                $lessons = Sensei()->course->course_lessons( $course_id );
1197
+                $lessons = Sensei()->course->course_lessons($course_id);
1198 1198
 
1199
-				if( 0 < count( $lessons ) ) {
1199
+				if (0 < count($lessons)) {
1200 1200
 
1201 1201
                     //get module term ids, will be used to exclude lessons
1202 1202
                     $module_items_ids = array();
1203
-                    if( ! empty( $modules ) ) {
1203
+                    if ( ! empty($modules)) {
1204 1204
                         foreach ($modules as $module) {
1205 1205
                             $module_items_ids[] = $module->term_id;
1206 1206
                         }
1207 1207
                     }
1208 1208
 
1209
-					if( 0 < count( $displayed_lessons ) ) {
1210
-						$html .= '<h3>' . __( 'Other Lessons', 'woothemes-sensei' ) . '</h3>' . "\n";
1209
+					if (0 < count($displayed_lessons)) {
1210
+						$html .= '<h3>'.__('Other Lessons', 'woothemes-sensei').'</h3>'."\n";
1211 1211
 					}
1212 1212
 
1213
-					$html .= '<ul class="sortable-lesson-list" data-module_id="0">' . "\n";
1213
+					$html .= '<ul class="sortable-lesson-list" data-module_id="0">'."\n";
1214 1214
 					$count = 0;
1215
-					foreach ( $lessons as $lesson ) {
1215
+					foreach ($lessons as $lesson) {
1216 1216
 
1217 1217
                         // if lesson belongs to one fo the course modules then exclude it here
1218 1218
                         // as it is listed above
1219
-                        if( has_term( $module_items_ids, 'module', $lesson->ID )  ){
1219
+                        if (has_term($module_items_ids, 'module', $lesson->ID)) {
1220 1220
 
1221 1221
                             continue;
1222 1222
 
@@ -1224,28 +1224,28 @@  discard block
 block discarded – undo
1224 1224
 
1225 1225
 						$count++;
1226 1226
 						$class = 'lesson';
1227
-						if ( $count == 1 ) { $class .= ' first'; }
1228
-						if ( $count == count( $lesson ) ) { $class .= ' last'; }
1229
-						if ( $count % 2 != 0 ) {
1227
+						if ($count == 1) { $class .= ' first'; }
1228
+						if ($count == count($lesson)) { $class .= ' last'; }
1229
+						if ($count % 2 != 0) {
1230 1230
 
1231 1231
 							$class .= ' alternate';
1232 1232
 
1233 1233
 						}
1234
-						$html .= '<li class="' . esc_attr( $class ) . '"><span rel="' . esc_attr( $lesson->ID ) . '" style="width: 100%;"> ' . $lesson->post_title . '</span></li>' . "\n";
1234
+						$html .= '<li class="'.esc_attr($class).'"><span rel="'.esc_attr($lesson->ID).'" style="width: 100%;"> '.$lesson->post_title.'</span></li>'."\n";
1235 1235
 
1236 1236
 						$displayed_lessons[] = $lesson->ID;
1237 1237
 					}
1238
-					$html .= '</ul>' . "\n";
1238
+					$html .= '</ul>'."\n";
1239 1239
 				} else {
1240
-					if( 0 == count( $displayed_lessons ) ) {
1241
-						$html .= '<p><em>' . __( 'There are no lessons in this course.', 'woothemes-sensei' ) . '</em></p>';
1240
+					if (0 == count($displayed_lessons)) {
1241
+						$html .= '<p><em>'.__('There are no lessons in this course.', 'woothemes-sensei').'</em></p>';
1242 1242
 					}
1243 1243
 				}
1244 1244
 
1245
-				if( 0 < count( $displayed_lessons ) ) {
1246
-					$html .= '<input type="hidden" name="lesson-order" value="' . esc_attr( $order_string ) . '" />' . "\n";
1247
-					$html .= '<input type="hidden" name="course_id" value="' . $course_id . '" />' . "\n";
1248
-					$html .= '<input type="submit" class="button-primary" value="' . __( 'Save lesson order', 'woothemes-sensei' ) . '" />' . "\n";
1245
+				if (0 < count($displayed_lessons)) {
1246
+					$html .= '<input type="hidden" name="lesson-order" value="'.esc_attr($order_string).'" />'."\n";
1247
+					$html .= '<input type="hidden" name="course_id" value="'.$course_id.'" />'."\n";
1248
+					$html .= '<input type="submit" class="button-primary" value="'.__('Save lesson order', 'woothemes-sensei').'" />'."\n";
1249 1249
 				}
1250 1250
 			}
1251 1251
 		}
@@ -1255,27 +1255,27 @@  discard block
 block discarded – undo
1255 1255
 		?></div><?php
1256 1256
 	}
1257 1257
 
1258
-	public function get_lesson_order( $course_id = 0 ) {
1259
-		$order_string = get_post_meta( $course_id, '_lesson_order', true );
1258
+	public function get_lesson_order($course_id = 0) {
1259
+		$order_string = get_post_meta($course_id, '_lesson_order', true);
1260 1260
 		return $order_string;
1261 1261
 	}
1262 1262
 
1263
-	public function save_lesson_order( $order_string = '', $course_id = 0 ) {
1263
+	public function save_lesson_order($order_string = '', $course_id = 0) {
1264 1264
 
1265
-		if( $course_id ) {
1265
+		if ($course_id) {
1266 1266
 
1267
-            $modules = Sensei()->modules->get_course_modules( intval( $course_id ) );
1267
+            $modules = Sensei()->modules->get_course_modules(intval($course_id));
1268 1268
 
1269
-            foreach( $modules as $module ) {
1269
+            foreach ($modules as $module) {
1270 1270
 
1271
-                $module_order_string = $_POST[ 'lesson-order-module-' . $module->term_id ];
1271
+                $module_order_string = $_POST['lesson-order-module-'.$module->term_id];
1272 1272
 
1273
-                if( $module_order_string ) {
1274
-                    $order = explode( ',', $module_order_string );
1273
+                if ($module_order_string) {
1274
+                    $order = explode(',', $module_order_string);
1275 1275
                     $i = 1;
1276
-                    foreach( $order as $lesson_id ) {
1277
-                        if( $lesson_id ) {
1278
-                            update_post_meta( $lesson_id, '_order_module_' . $module->term_id, $i );
1276
+                    foreach ($order as $lesson_id) {
1277
+                        if ($lesson_id) {
1278
+                            update_post_meta($lesson_id, '_order_module_'.$module->term_id, $i);
1279 1279
                             ++$i;
1280 1280
                         }
1281 1281
                     }
@@ -1283,15 +1283,15 @@  discard block
 block discarded – undo
1283 1283
             }
1284 1284
 
1285 1285
 
1286
-			if( $order_string ) {
1287
-				update_post_meta( $course_id, '_lesson_order', $order_string );
1286
+			if ($order_string) {
1287
+				update_post_meta($course_id, '_lesson_order', $order_string);
1288 1288
 
1289
-				$order = explode( ',', $order_string );
1289
+				$order = explode(',', $order_string);
1290 1290
 
1291 1291
 				$i = 1;
1292
-				foreach( $order as $lesson_id ) {
1293
-					if( $lesson_id ) {
1294
-						update_post_meta( $lesson_id, '_order_' . $course_id, $i );
1292
+				foreach ($order as $lesson_id) {
1293
+					if ($lesson_id) {
1294
+						update_post_meta($lesson_id, '_order_'.$course_id, $i);
1295 1295
 						++$i;
1296 1296
 					}
1297 1297
 				}
@@ -1306,54 +1306,54 @@  discard block
 block discarded – undo
1306 1306
 	function sensei_add_custom_menu_items() {
1307 1307
 		global $pagenow;
1308 1308
 
1309
-		if( 'nav-menus.php' == $pagenow ) {
1310
-			add_meta_box( 'add-sensei-links', 'Sensei', array( $this, 'wp_nav_menu_item_sensei_links_meta_box' ), 'nav-menus', 'side', 'low' );
1309
+		if ('nav-menus.php' == $pagenow) {
1310
+			add_meta_box('add-sensei-links', 'Sensei', array($this, 'wp_nav_menu_item_sensei_links_meta_box'), 'nav-menus', 'side', 'low');
1311 1311
 		}
1312 1312
 	}
1313 1313
 
1314
-	function wp_nav_menu_item_sensei_links_meta_box( $object ) {
1314
+	function wp_nav_menu_item_sensei_links_meta_box($object) {
1315 1315
 		global $nav_menu_selected_id;
1316 1316
 
1317 1317
 		$menu_items = array(
1318
-			'#senseicourses' => __( 'Courses', 'woothemes-sensei' ),
1319
-			'#senseilessons' => __( 'Lessons', 'woothemes-sensei' ),
1320
-			'#senseimycourses' => __( 'My Courses', 'woothemes-sensei' ),
1321
-			'#senseilearnerprofile' => __( 'My Profile', 'woothemes-sensei' ),
1322
-			'#senseimymessages' => __( 'My Messages', 'woothemes-sensei' ),
1323
-			'#senseiloginlogout' => __( 'Login', 'woothemes-sensei' ) . '|' . __( 'Logout', 'woothemes-sensei' )
1318
+			'#senseicourses' => __('Courses', 'woothemes-sensei'),
1319
+			'#senseilessons' => __('Lessons', 'woothemes-sensei'),
1320
+			'#senseimycourses' => __('My Courses', 'woothemes-sensei'),
1321
+			'#senseilearnerprofile' => __('My Profile', 'woothemes-sensei'),
1322
+			'#senseimymessages' => __('My Messages', 'woothemes-sensei'),
1323
+			'#senseiloginlogout' => __('Login', 'woothemes-sensei').'|'.__('Logout', 'woothemes-sensei')
1324 1324
 		);
1325 1325
 
1326 1326
 		$menu_items_obj = array();
1327
-		foreach ( $menu_items as $value => $title ) {
1327
+		foreach ($menu_items as $value => $title) {
1328 1328
 			$menu_items_obj[$title] = new stdClass;
1329
-			$menu_items_obj[$title]->object_id			= esc_attr( $value );
1330
-			$menu_items_obj[$title]->title				= esc_attr( $title );
1331
-			$menu_items_obj[$title]->url				= esc_attr( $value );
1332
-			$menu_items_obj[$title]->description 		= 'description';
1329
+			$menu_items_obj[$title]->object_id = esc_attr($value);
1330
+			$menu_items_obj[$title]->title = esc_attr($title);
1331
+			$menu_items_obj[$title]->url = esc_attr($value);
1332
+			$menu_items_obj[$title]->description = 'description';
1333 1333
 			$menu_items_obj[$title]->db_id 				= 0;
1334 1334
 			$menu_items_obj[$title]->object 			= 'sensei';
1335
-			$menu_items_obj[$title]->menu_item_parent 	= 0;
1336
-			$menu_items_obj[$title]->type 				= 'custom';
1335
+			$menu_items_obj[$title]->menu_item_parent = 0;
1336
+			$menu_items_obj[$title]->type = 'custom';
1337 1337
 			$menu_items_obj[$title]->target 			= '';
1338
-			$menu_items_obj[$title]->attr_title 		= '';
1339
-			$menu_items_obj[$title]->classes 			= array();
1340
-			$menu_items_obj[$title]->xfn 				= '';
1338
+			$menu_items_obj[$title]->attr_title = '';
1339
+			$menu_items_obj[$title]->classes = array();
1340
+			$menu_items_obj[$title]->xfn = '';
1341 1341
 		}
1342 1342
 
1343
-		$walker = new Walker_Nav_Menu_Checklist( array() );
1343
+		$walker = new Walker_Nav_Menu_Checklist(array());
1344 1344
 		?>
1345 1345
 
1346 1346
 		<div id="sensei-links" class="senseidiv taxonomydiv">
1347 1347
 			<div id="tabs-panel-sensei-links-all" class="tabs-panel tabs-panel-view-all tabs-panel-active">
1348 1348
 
1349 1349
 				<ul id="sensei-linkschecklist" class="list:sensei-links categorychecklist form-no-clear">
1350
-					<?php echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $menu_items_obj ), 0, (object)array( 'walker' => $walker ) ); ?>
1350
+					<?php echo walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', $menu_items_obj), 0, (object) array('walker' => $walker)); ?>
1351 1351
 				</ul>
1352 1352
 
1353 1353
 			</div>
1354 1354
 			<p class="button-controls">
1355 1355
 				<span class="add-to-menu">
1356
-					<input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( 'Add to Menu', 'woothemes-sensei' ); ?>" name="add-sensei-links-menu-item" id="submit-sensei-links" />
1356
+					<input type="submit"<?php disabled($nav_menu_selected_id, 0); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu', 'woothemes-sensei'); ?>" name="add-sensei-links-menu-item" id="submit-sensei-links" />
1357 1357
 					<span class="spinner"></span>
1358 1358
 				</span>
1359 1359
 			</p>
@@ -1369,17 +1369,17 @@  discard block
 block discarded – undo
1369 1369
 	 */
1370 1370
 	public function theme_compatibility_notices() {
1371 1371
 
1372
-        if( isset( $_GET['sensei_hide_notice'] ) ) {
1373
-        	switch( esc_attr( $_GET['sensei_hide_notice'] ) ) {
1374
-				case 'menu_settings': add_user_meta( get_current_user_id(), 'sensei_hide_menu_settings_notice', true ); break;
1375
-				case 'theme_check': add_user_meta( get_current_user_id(), 'sensei_hide_theme_check_notice', true ); break;
1372
+        if (isset($_GET['sensei_hide_notice'])) {
1373
+        	switch (esc_attr($_GET['sensei_hide_notice'])) {
1374
+				case 'menu_settings': add_user_meta(get_current_user_id(), 'sensei_hide_menu_settings_notice', true); break;
1375
+				case 'theme_check': add_user_meta(get_current_user_id(), 'sensei_hide_theme_check_notice', true); break;
1376 1376
 			}
1377 1377
         }
1378 1378
 
1379 1379
         // white list templates that are already support by default and do not show notice for them
1380
-        $template = get_option( 'template' );
1380
+        $template = get_option('template');
1381 1381
 
1382
-        $white_list = array(    'twentyeleven',
1382
+        $white_list = array('twentyeleven',
1383 1383
                                 'twentytwelve',
1384 1384
                                 'twentyfourteen',
1385 1385
                                 'twentyfifteen',
@@ -1387,43 +1387,43 @@  discard block
 block discarded – undo
1387 1387
                                 'storefront',
1388 1388
                                                 );
1389 1389
 
1390
-        if ( in_array( $template, $white_list ) ) {
1390
+        if (in_array($template, $white_list)) {
1391 1391
 
1392 1392
             return;
1393 1393
 
1394 1394
         }
1395 1395
 
1396 1396
         // don't show the notice if the user chose to hide it
1397
-        $hide_theme_check_notice = get_user_meta( get_current_user_id(), 'sensei_hide_theme_check_notice', true );
1398
-        if(  $hide_theme_check_notice ) {
1397
+        $hide_theme_check_notice = get_user_meta(get_current_user_id(), 'sensei_hide_theme_check_notice', true);
1398
+        if ($hide_theme_check_notice) {
1399 1399
 
1400 1400
             return;
1401 1401
 
1402 1402
         }
1403 1403
 
1404 1404
         // show the notice for themes not supporting sensei
1405
-	    if ( ! current_theme_supports( 'sensei' ) ) {
1405
+	    if ( ! current_theme_supports('sensei')) {
1406 1406
             ?>
1407 1407
 
1408 1408
             <div id="message" class="error sensei-message sensei-connect">
1409 1409
                     <p>
1410 1410
                         <strong>
1411 1411
 
1412
-                            <?php _e('Your theme does not declare Sensei support', 'woothemes-sensei' ); ?>
1412
+                            <?php _e('Your theme does not declare Sensei support', 'woothemes-sensei'); ?>
1413 1413
 
1414 1414
                         </strong> &#8211;
1415 1415
 
1416
-                        <?php _e( 'if you encounter layout issues please read our integration guide or choose a ', 'woothemes-sensei' ); ?>
1416
+                        <?php _e('if you encounter layout issues please read our integration guide or choose a ', 'woothemes-sensei'); ?>
1417 1417
 
1418
-                        <a href="http://www.woothemes.com/product-category/themes/sensei-themes/"> <?php  _e( 'Sensei theme', 'woothemes-sensei' ) ?> </a>
1418
+                        <a href="http://www.woothemes.com/product-category/themes/sensei-themes/"> <?php  _e('Sensei theme', 'woothemes-sensei') ?> </a>
1419 1419
 
1420 1420
                         :)
1421 1421
 
1422 1422
                     </p>
1423 1423
                     <p class="submit">
1424
-                        <a href="<?php echo esc_url( apply_filters( 'sensei_docs_url', 'http://docs.woothemes.com/document/sensei-and-theme-compatibility/', 'theme-compatibility' ) ); ?>" class="button-primary">
1424
+                        <a href="<?php echo esc_url(apply_filters('sensei_docs_url', 'http://docs.woothemes.com/document/sensei-and-theme-compatibility/', 'theme-compatibility')); ?>" class="button-primary">
1425 1425
 
1426
-                            <?php _e( 'Theme Integration Guide', 'woothemes-sensei' ); ?></a> <a class="skip button" href="<?php echo esc_url( add_query_arg( 'sensei_hide_notice', 'theme_check' ) ); ?>"><?php _e( 'Hide this notice', 'woothemes-sensei' ); ?>
1426
+                            <?php _e('Theme Integration Guide', 'woothemes-sensei'); ?></a> <a class="skip button" href="<?php echo esc_url(add_query_arg('sensei_hide_notice', 'theme_check')); ?>"><?php _e('Hide this notice', 'woothemes-sensei'); ?>
1427 1427
 
1428 1428
                         </a>
1429 1429
                     </p>
@@ -1441,7 +1441,7 @@  discard block
 block discarded – undo
1441 1441
 		wp_get_current_user();
1442 1442
         $user_id = $current_user->ID;
1443 1443
 
1444
-		delete_user_meta( $user_id, 'sensei_hide_theme_check_notice' );
1444
+		delete_user_meta($user_id, 'sensei_hide_theme_check_notice');
1445 1445
 	}
1446 1446
 
1447 1447
 	/**
@@ -1451,8 +1451,8 @@  discard block
 block discarded – undo
1451 1451
 	 * @param  bool $prevent_access
1452 1452
 	 * @return bool
1453 1453
 	 */
1454
-	public function admin_access( $prevent_access ) {
1455
-		if ( current_user_can( 'manage_sensei_grades' ) ) {
1454
+	public function admin_access($prevent_access) {
1455
+		if (current_user_can('manage_sensei_grades')) {
1456 1456
 			return false;
1457 1457
 		}
1458 1458
 
@@ -1467,12 +1467,12 @@  discard block
 block discarded – undo
1467 1467
      *
1468 1468
      * @since 1.8.7
1469 1469
      */
1470
-    public  static function install_pages(){
1470
+    public  static function install_pages() {
1471 1471
 
1472 1472
         // only fire on the settings page
1473
-        if( ! isset( $_GET['page'] )
1473
+        if ( ! isset($_GET['page'])
1474 1474
             || 'woothemes-sensei-settings' != $_GET['page']
1475
-            || 1 == get_option('skip_install_sensei_pages') ){
1475
+            || 1 == get_option('skip_install_sensei_pages')) {
1476 1476
 
1477 1477
             return;
1478 1478
 
@@ -1502,13 +1502,13 @@  discard block
 block discarded – undo
1502 1502
         if ($install_complete) {
1503 1503
 
1504 1504
             // Flush rules after install
1505
-            flush_rewrite_rules( true );
1505
+            flush_rewrite_rules(true);
1506 1506
 
1507 1507
             // Set installed option
1508 1508
             update_option('sensei_installed', 0);
1509 1509
 
1510
-            $complete_url = add_query_arg( 'sensei_install_complete', 'true', $settings_url  );
1511
-            wp_redirect( $complete_url );
1510
+            $complete_url = add_query_arg('sensei_install_complete', 'true', $settings_url);
1511
+            wp_redirect($complete_url);
1512 1512
 
1513 1513
         }
1514 1514
 
@@ -1521,4 +1521,4 @@  discard block
 block discarded – undo
1521 1521
  * for backward compatibility
1522 1522
  * @since 1.9.0
1523 1523
  */
1524
-class WooThemes_Sensei_Admin extends Sensei_Admin{ }
1524
+class WooThemes_Sensei_Admin extends Sensei_Admin { }
Please login to merge, or discard this patch.