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