Completed
Push — master ( 78b9e3...efb4fd )
by Dwain
04:49
created
includes/class-sensei-updates.php 1 patch
Indentation   +276 added lines, -276 removed lines patch added patch discarded remove patch
@@ -12,107 +12,107 @@  discard block
 block discarded – undo
12 12
  */
13 13
 class Sensei_Updates
14 14
 {
15
-    public $token = 'woothemes-sensei';
16
-    public $version;
17
-    public $updates_run;
18
-    public $updates;
19
-    private $parent;
20
-
21
-    /**
22
-     * Constructor.
23
-     *
24
-     * @access  public
25
-     * @since   1.1.0
26
-     * @param   string $parent The main Sensei object by Ref.
27
-     * @return  void
28
-     */
29
-    public function __construct($parent)
30
-    {
15
+	public $token = 'woothemes-sensei';
16
+	public $version;
17
+	public $updates_run;
18
+	public $updates;
19
+	private $parent;
20
+
21
+	/**
22
+	 * Constructor.
23
+	 *
24
+	 * @access  public
25
+	 * @since   1.1.0
26
+	 * @param   string $parent The main Sensei object by Ref.
27
+	 * @return  void
28
+	 */
29
+	public function __construct($parent)
30
+	{
31 31
 
32 32
 		// Setup object data
33 33
 		$this->parent = $parent;
34 34
 		$this->updates_run = get_option( 'woothemes-sensei-upgrades', array() );
35 35
 
36
-        // The list of upgrades to run
37
-        $this->updates = array('1.1.0' => array('auto' => array('assign_role_caps' => array('title' => __('Assign role capabilities', 'woothemes-sensei'), 'desc' => __('Assigns Sensei capabilites to the relevant user roles.', 'woothemes-sensei'), 'product' => 'Sensei')),
38
-            'manual' => array()
39
-        ),
40
-            '1.3.0' => array('auto' => array('set_default_quiz_grade_type' => array('title' => __('Set default quiz grade type', 'woothemes-sensei'), 'desc' => __('Sets all quizzes to the default \'auto\' grade type.', 'woothemes-sensei')),
41
-                'set_default_question_type' => array('title' => __('Set default question type', 'woothemes-sensei'), 'desc' => __('Sets all questions to the default \'multiple choice\' type.', 'woothemes-sensei'))
42
-            ),
43
-                'manual' => array('update_question_answer_data' => array('title' => __('Update question answer data', 'woothemes-sensei'), 'desc' => __('Updates questions to use the new question types structure.', 'woothemes-sensei')))
44
-            ),
45
-            '1.4.0' => array('auto' => array('update_question_grade_points' => array('title' => __('Update question grade points', 'woothemes-sensei'), 'desc' => __('Sets all question grade points to the default value of \'1\'.', 'woothemes-sensei'))),
46
-                'manual' => array()
47
-            ),
48
-            '1.5.0' => array('auto' => array('convert_essay_paste_questions' => array('title' => __('Convert essay paste questions into multi-line questions', 'woothemes-sensei'), 'desc' => __('Converts all essay paste questions into multi-line questions as the essay paste question type was removed in v1.5.0.', 'woothemes-sensei'))),
49
-                'manual' => array('set_random_question_order' => array('title' => __('Set all quizzes to have a random question order', 'woothemes-sensei'), 'desc' => __('Sets the order all of questions in all quizzes to a random order, which can be switched off per quiz.', 'woothemes-sensei')),
50
-                    'set_default_show_question_count' => array('title' => __('Set all quizzes to show all questions', 'woothemes-sensei'), 'desc' => __('Sets all quizzes to show all questions - this can be changed per quiz.', 'woothemes-sensei')),
51
-                    'remove_deleted_user_activity' => array('title' => __('Remove Sensei activity for deleted users', 'woothemes-sensei'), 'desc' => __('Removes all course, lesson & quiz activity for users that have already been deleted from the database. This will fix incorrect learner counts in the Analysis section.', 'woothemes-sensei')))
52
-            ),
53
-            '1.6.0' => array('auto' => array('add_teacher_role' => array('title' => __('Add \'Teacher\' role', 'woothemes-sensei'), 'desc' => __('Adds a \'Teacher\' role to your WordPress site that will allow users to mange the Grading and Analysis pages.', 'woothemes-sensei')),
54
-                'add_sensei_caps' => array('title' => __('Add administrator capabilities', 'woothemes-sensei'), 'desc' => __('Adds the \'manage_sensei\' and \'manage_sensei_grades\' capabilities to the Administrator role.', 'woothemes-sensei')),
55
-                'restructure_question_meta' => array('title' => __('Restructure question meta data', 'woothemes-sensei'), 'desc' => __('Restructures the question meta data as it relates to quizzes - this accounts for changes in the data structure in v1.6+.', 'woothemes-sensei')),
56
-                'update_quiz_settings' => array('title' => __('Add new quiz settings', 'woothemes-sensei'), 'desc' => __('Adds new settings to quizzes that were previously registered as global settings.', 'woothemes-sensei')),
57
-                'reset_lesson_order_meta' => array('title' => __('Set default order of lessons', 'woothemes-sensei'), 'desc' => __('Adds data to lessons to ensure that they show up on the \'Order Lessons\' screen - if this update has been run once before then it will reset all lessons to the default order.', 'woothemes-sensei')),),
58
-                'manual' => array()
59
-            ),
60
-            '1.7.0' => array('auto' => array('add_editor_caps' => array('title' => __('Add Editor capabilities', 'woothemes-sensei'), 'desc' => __('Adds the \'manage_sensei_grades\' capability to the Editor role.', 'woothemes-sensei')),),
61
-                'forced' => array('update_question_gap_fill_separators' => array('title' => __('Update Gap Fill questions', 'woothemes-sensei'), 'desc' => __('Updates the format of gap fill questions to allow auto grading and greater flexibility in matching.', 'woothemes-sensei')),
62
-                    'update_quiz_lesson_relationship' => array('title' => __('Restructure quiz lesson relationship', 'woothemes-sensei'), 'desc' => __('Adds data to quizzes and lessons to ensure that they maintain their 1 to 1 relationship.', 'woothemes-sensei')),
63
-                    'status_changes_fix_lessons' => array('title' => __('Update lesson statuses', 'woothemes-sensei'), 'desc' => __('Update existing lesson statuses.', 'woothemes-sensei')),
64
-                    'status_changes_convert_lessons' => array('title' => __('Convert lesson statuses', 'woothemes-sensei'), 'desc' => __('Convert to new lesson statuses.', 'woothemes-sensei')),
65
-                    'status_changes_convert_courses' => array('title' => __('Convert course statuses', 'woothemes-sensei'), 'desc' => __('Convert to new course statuses.', 'woothemes-sensei')),
66
-                    'status_changes_convert_questions' => array('title' => __('Convert question statuses', 'woothemes-sensei'), 'desc' => __('Convert to new question statuses.', 'woothemes-sensei')),
67
-                    'update_legacy_sensei_comments_status' => array('title' => __('Convert legacy Sensei activity types', 'woothemes-sensei'), 'desc' => __('Convert all legacy Sensei activity types such as \'sensei_lesson_start\' and \'sensei_user_answer\' to new status format.', 'woothemes-sensei')),
68
-                    'update_comment_course_lesson_comment_counts' => array('title' => __('Update comment counts', 'woothemes-sensei'), 'desc' => __('Update comment counts on Courses and Lessons due to status changes.', 'woothemes-sensei')),),
69
-            ),
70
-            '1.7.2' => array('auto' => array('index_comment_status_field' => array('title' => __('Add database index to comment statuses', 'woothemes-sensei'), 'desc' => __('This indexes the comment statuses in the database, which will speed up all Sensei activity queries.', 'woothemes-sensei')),),
71
-                /*'manual' 		=> array( 'remove_legacy_comments' => array( 'title' => __( 'Remove legacy Sensei activity types', 'woothemes-sensei' ), 'desc' => __( 'This removes all legacy (pre-1.7) Sensei activity types - only run this update once the update to v1.7 is complete and everything is stable.', 'woothemes-sensei' ) ) )*/
72
-            ),
73
-            '1.8.0' => array('auto' => array('enhance_teacher_role' => array('title' => 'Enhance the \'Teacher\' role', 'desc' => 'Adds the ability for a \'Teacher\' to create courses, lessons , quizes and manage their learners.'),),
74
-                'manual' => array()
75
-            ),
76
-        );
36
+		// The list of upgrades to run
37
+		$this->updates = array('1.1.0' => array('auto' => array('assign_role_caps' => array('title' => __('Assign role capabilities', 'woothemes-sensei'), 'desc' => __('Assigns Sensei capabilites to the relevant user roles.', 'woothemes-sensei'), 'product' => 'Sensei')),
38
+			'manual' => array()
39
+		),
40
+			'1.3.0' => array('auto' => array('set_default_quiz_grade_type' => array('title' => __('Set default quiz grade type', 'woothemes-sensei'), 'desc' => __('Sets all quizzes to the default \'auto\' grade type.', 'woothemes-sensei')),
41
+				'set_default_question_type' => array('title' => __('Set default question type', 'woothemes-sensei'), 'desc' => __('Sets all questions to the default \'multiple choice\' type.', 'woothemes-sensei'))
42
+			),
43
+				'manual' => array('update_question_answer_data' => array('title' => __('Update question answer data', 'woothemes-sensei'), 'desc' => __('Updates questions to use the new question types structure.', 'woothemes-sensei')))
44
+			),
45
+			'1.4.0' => array('auto' => array('update_question_grade_points' => array('title' => __('Update question grade points', 'woothemes-sensei'), 'desc' => __('Sets all question grade points to the default value of \'1\'.', 'woothemes-sensei'))),
46
+				'manual' => array()
47
+			),
48
+			'1.5.0' => array('auto' => array('convert_essay_paste_questions' => array('title' => __('Convert essay paste questions into multi-line questions', 'woothemes-sensei'), 'desc' => __('Converts all essay paste questions into multi-line questions as the essay paste question type was removed in v1.5.0.', 'woothemes-sensei'))),
49
+				'manual' => array('set_random_question_order' => array('title' => __('Set all quizzes to have a random question order', 'woothemes-sensei'), 'desc' => __('Sets the order all of questions in all quizzes to a random order, which can be switched off per quiz.', 'woothemes-sensei')),
50
+					'set_default_show_question_count' => array('title' => __('Set all quizzes to show all questions', 'woothemes-sensei'), 'desc' => __('Sets all quizzes to show all questions - this can be changed per quiz.', 'woothemes-sensei')),
51
+					'remove_deleted_user_activity' => array('title' => __('Remove Sensei activity for deleted users', 'woothemes-sensei'), 'desc' => __('Removes all course, lesson & quiz activity for users that have already been deleted from the database. This will fix incorrect learner counts in the Analysis section.', 'woothemes-sensei')))
52
+			),
53
+			'1.6.0' => array('auto' => array('add_teacher_role' => array('title' => __('Add \'Teacher\' role', 'woothemes-sensei'), 'desc' => __('Adds a \'Teacher\' role to your WordPress site that will allow users to mange the Grading and Analysis pages.', 'woothemes-sensei')),
54
+				'add_sensei_caps' => array('title' => __('Add administrator capabilities', 'woothemes-sensei'), 'desc' => __('Adds the \'manage_sensei\' and \'manage_sensei_grades\' capabilities to the Administrator role.', 'woothemes-sensei')),
55
+				'restructure_question_meta' => array('title' => __('Restructure question meta data', 'woothemes-sensei'), 'desc' => __('Restructures the question meta data as it relates to quizzes - this accounts for changes in the data structure in v1.6+.', 'woothemes-sensei')),
56
+				'update_quiz_settings' => array('title' => __('Add new quiz settings', 'woothemes-sensei'), 'desc' => __('Adds new settings to quizzes that were previously registered as global settings.', 'woothemes-sensei')),
57
+				'reset_lesson_order_meta' => array('title' => __('Set default order of lessons', 'woothemes-sensei'), 'desc' => __('Adds data to lessons to ensure that they show up on the \'Order Lessons\' screen - if this update has been run once before then it will reset all lessons to the default order.', 'woothemes-sensei')),),
58
+				'manual' => array()
59
+			),
60
+			'1.7.0' => array('auto' => array('add_editor_caps' => array('title' => __('Add Editor capabilities', 'woothemes-sensei'), 'desc' => __('Adds the \'manage_sensei_grades\' capability to the Editor role.', 'woothemes-sensei')),),
61
+				'forced' => array('update_question_gap_fill_separators' => array('title' => __('Update Gap Fill questions', 'woothemes-sensei'), 'desc' => __('Updates the format of gap fill questions to allow auto grading and greater flexibility in matching.', 'woothemes-sensei')),
62
+					'update_quiz_lesson_relationship' => array('title' => __('Restructure quiz lesson relationship', 'woothemes-sensei'), 'desc' => __('Adds data to quizzes and lessons to ensure that they maintain their 1 to 1 relationship.', 'woothemes-sensei')),
63
+					'status_changes_fix_lessons' => array('title' => __('Update lesson statuses', 'woothemes-sensei'), 'desc' => __('Update existing lesson statuses.', 'woothemes-sensei')),
64
+					'status_changes_convert_lessons' => array('title' => __('Convert lesson statuses', 'woothemes-sensei'), 'desc' => __('Convert to new lesson statuses.', 'woothemes-sensei')),
65
+					'status_changes_convert_courses' => array('title' => __('Convert course statuses', 'woothemes-sensei'), 'desc' => __('Convert to new course statuses.', 'woothemes-sensei')),
66
+					'status_changes_convert_questions' => array('title' => __('Convert question statuses', 'woothemes-sensei'), 'desc' => __('Convert to new question statuses.', 'woothemes-sensei')),
67
+					'update_legacy_sensei_comments_status' => array('title' => __('Convert legacy Sensei activity types', 'woothemes-sensei'), 'desc' => __('Convert all legacy Sensei activity types such as \'sensei_lesson_start\' and \'sensei_user_answer\' to new status format.', 'woothemes-sensei')),
68
+					'update_comment_course_lesson_comment_counts' => array('title' => __('Update comment counts', 'woothemes-sensei'), 'desc' => __('Update comment counts on Courses and Lessons due to status changes.', 'woothemes-sensei')),),
69
+			),
70
+			'1.7.2' => array('auto' => array('index_comment_status_field' => array('title' => __('Add database index to comment statuses', 'woothemes-sensei'), 'desc' => __('This indexes the comment statuses in the database, which will speed up all Sensei activity queries.', 'woothemes-sensei')),),
71
+				/*'manual' 		=> array( 'remove_legacy_comments' => array( 'title' => __( 'Remove legacy Sensei activity types', 'woothemes-sensei' ), 'desc' => __( 'This removes all legacy (pre-1.7) Sensei activity types - only run this update once the update to v1.7 is complete and everything is stable.', 'woothemes-sensei' ) ) )*/
72
+			),
73
+			'1.8.0' => array('auto' => array('enhance_teacher_role' => array('title' => 'Enhance the \'Teacher\' role', 'desc' => 'Adds the ability for a \'Teacher\' to create courses, lessons , quizes and manage their learners.'),),
74
+				'manual' => array()
75
+			),
76
+		);
77 77
 
78 78
 		$this->updates = apply_filters( 'sensei_upgrade_functions', $this->updates, $this->updates );
79 79
 		$this->version = get_option( 'woothemes-sensei-version' );
80 80
 
81
-        // Manual Update Screen
82
-        add_action('admin_menu', array($this, 'add_update_admin_screen'), 50);
83
-
84
-    } // End __construct()
85
-
86
-    /**
87
-     * add_update_admin_screen Adds admin screen to run manual udpates
88
-     *
89
-     * @access public
90
-     * @since  1.3.7
91
-     * @return void
92
-     */
93
-    public function add_update_admin_screen()
94
-    {
95
-        if (current_user_can('manage_options')) {
96
-            add_submenu_page('sensei', __('Sensei Updates', 'woothemes-sensei'), __('Data Updates', 'woothemes-sensei'), 'manage_options', 'sensei_updates', array($this, 'sensei_updates_page'));
97
-        }
98
-    } // End add_update_admin_screen()
99
-
100
-    /**
101
-     * sensei_updates_page HTML output for manual update screen
102
-     *
103
-     * @access public
104
-     * @since  1.3.7
105
-     * @return void
106
-     */
107
-    public function sensei_updates_page() {
108
-
109
-        // Only allow admins to load this page and run the update functions
110
-        if ( ! current_user_can('manage_options')) {
111
-
112
-            return;
113
-
114
-        }
115
-        ?>
81
+		// Manual Update Screen
82
+		add_action('admin_menu', array($this, 'add_update_admin_screen'), 50);
83
+
84
+	} // End __construct()
85
+
86
+	/**
87
+	 * add_update_admin_screen Adds admin screen to run manual udpates
88
+	 *
89
+	 * @access public
90
+	 * @since  1.3.7
91
+	 * @return void
92
+	 */
93
+	public function add_update_admin_screen()
94
+	{
95
+		if (current_user_can('manage_options')) {
96
+			add_submenu_page('sensei', __('Sensei Updates', 'woothemes-sensei'), __('Data Updates', 'woothemes-sensei'), 'manage_options', 'sensei_updates', array($this, 'sensei_updates_page'));
97
+		}
98
+	} // End add_update_admin_screen()
99
+
100
+	/**
101
+	 * sensei_updates_page HTML output for manual update screen
102
+	 *
103
+	 * @access public
104
+	 * @since  1.3.7
105
+	 * @return void
106
+	 */
107
+	public function sensei_updates_page() {
108
+
109
+		// Only allow admins to load this page and run the update functions
110
+		if ( ! current_user_can('manage_options')) {
111
+
112
+			return;
113
+
114
+		}
115
+		?>
116 116
 
117 117
         <div class="wrap">
118 118
 
@@ -120,111 +120,111 @@  discard block
 block discarded – undo
120 120
         <h2><?php _e('Sensei Updates', 'woothemes-sensei'); ?></h2>
121 121
 
122 122
         <?php
123
-        $function_name= '';
124
-        if ( isset($_GET['action']) && $_GET['action'] == 'update'
125
-            && isset($_GET['n']) && intval($_GET['n']) >= 0
126
-            && ( (isset($_POST['checked'][0]) && '' != $_POST['checked'][0]) || (isset($_GET['functions']) && '' != $_GET['functions']))) {
123
+		$function_name= '';
124
+		if ( isset($_GET['action']) && $_GET['action'] == 'update'
125
+			&& isset($_GET['n']) && intval($_GET['n']) >= 0
126
+			&& ( (isset($_POST['checked'][0]) && '' != $_POST['checked'][0]) || (isset($_GET['functions']) && '' != $_GET['functions']))) {
127 127
 
128
-            // Setup the data variables
129
-            $n = intval($_GET['n']);
130
-            $functions_list = '';
131
-            $done_processing = false;
128
+			// Setup the data variables
129
+			$n = intval($_GET['n']);
130
+			$functions_list = '';
131
+			$done_processing = false;
132 132
 
133
-            // Check for updates to run
134
-            if (isset($_POST['checked'][0]) && '' != $_POST['checked'][0]) {
133
+			// Check for updates to run
134
+			if (isset($_POST['checked'][0]) && '' != $_POST['checked'][0]) {
135 135
 
136
-                foreach ($_POST['checked'] as $key => $function_name) {
136
+				foreach ($_POST['checked'] as $key => $function_name) {
137 137
 
138
-                    if( ! isset(  $_POST[ $function_name.'_nonce_field' ] ) 
139
-                        || ! wp_verify_nonce( $_POST[ $function_name.'_nonce_field' ] , 'run_'.$function_name ) ){
138
+					if( ! isset(  $_POST[ $function_name.'_nonce_field' ] ) 
139
+						|| ! wp_verify_nonce( $_POST[ $function_name.'_nonce_field' ] , 'run_'.$function_name ) ){
140 140
 
141
-                        wp_die(
142
-                            '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
143
-                            '<p>' . __( 'The nonce supplied in order to run this update function is invalid','woothemes-sensei') . '</p>',
144
-                            403
145
-                        );
141
+						wp_die(
142
+							'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
143
+							'<p>' . __( 'The nonce supplied in order to run this update function is invalid','woothemes-sensei') . '</p>',
144
+							403
145
+						);
146 146
 
147
-                    }
147
+					}
148 148
 
149
-                    // Dynamic function call
150
-                    if (method_exists($this, $function_name)) {
149
+					// Dynamic function call
150
+					if (method_exists($this, $function_name)) {
151 151
 
152
-                        $done_processing = call_user_func_array(array($this, $function_name), array(50, $n));
152
+						$done_processing = call_user_func_array(array($this, $function_name), array(50, $n));
153 153
 
154
-                    } elseif ($this->function_in_whitelist($function_name)) {
154
+					} elseif ($this->function_in_whitelist($function_name)) {
155 155
 
156
-                        $done_processing = call_user_func_array($function_name, array(50, $n));
156
+						$done_processing = call_user_func_array($function_name, array(50, $n));
157 157
 
158
-                    } else {
158
+					} else {
159 159
 
160
-                        _doing_it_wrong( esc_html( $function_name) , 'Is not a valid Sensei updater function', 'Sensei 1.9.0');
161
-                        return;
160
+						_doing_it_wrong( esc_html( $function_name) , 'Is not a valid Sensei updater function', 'Sensei 1.9.0');
161
+						return;
162 162
 
163
-                    }// End If Statement
163
+					}// End If Statement
164 164
 
165
-                // Add to functions list get args
166
-                if ('' == $functions_list) {
167
-                    $functions_list .= $function_name;
168
-                } else {
169
-                    $functions_list .= '+' . $function_name;
170
-                } // End If Statement
165
+				// Add to functions list get args
166
+				if ('' == $functions_list) {
167
+					$functions_list .= $function_name;
168
+				} else {
169
+					$functions_list .= '+' . $function_name;
170
+				} // End If Statement
171 171
 
172
-                // Mark update has having been run
173
-                $this->set_update_run($function_name);
172
+				// Mark update has having been run
173
+				$this->set_update_run($function_name);
174 174
 
175
-            } // End For Loop
175
+			} // End For Loop
176 176
 
177
-        } // End If Statement
177
+		} // End If Statement
178 178
 
179
-        // Check for updates to run
180
-        if (isset($_GET['functions']) && '' != $_GET['functions']) {
179
+		// Check for updates to run
180
+		if (isset($_GET['functions']) && '' != $_GET['functions']) {
181 181
 
182
-            // Existing functions from GET variables instead of POST
183
-            $functions_array = $_GET['functions'];
182
+			// Existing functions from GET variables instead of POST
183
+			$functions_array = $_GET['functions'];
184 184
 
185
-            foreach ($functions_array as $key => $function_name) {
185
+			foreach ($functions_array as $key => $function_name) {
186 186
 
187
-                if( ! isset( $_GET[ $function_name.'_nonce' ] )
188
-                    || ! wp_verify_nonce( $_GET[ $function_name.'_nonce' ] , 'run_'.$function_name ) ){
187
+				if( ! isset( $_GET[ $function_name.'_nonce' ] )
188
+					|| ! wp_verify_nonce( $_GET[ $function_name.'_nonce' ] , 'run_'.$function_name ) ){
189 189
 
190
-                    wp_die(
191
-                        '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
192
-                        '<p>' . __( 'The nonce supplied in order to run this update function is invalid','woothemes-sensei') . '</p>',
193
-                        403
194
-                    );
190
+					wp_die(
191
+						'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
192
+						'<p>' . __( 'The nonce supplied in order to run this update function is invalid','woothemes-sensei') . '</p>',
193
+						403
194
+					);
195 195
 
196
-                }
196
+				}
197 197
 
198
-                // Dynamic function call
199
-                if (method_exists($this, $function_name)) {
198
+				// Dynamic function call
199
+				if (method_exists($this, $function_name)) {
200 200
 
201
-                    $done_processing = call_user_func_array(array($this, $function_name), array(50, $n));
201
+					$done_processing = call_user_func_array(array($this, $function_name), array(50, $n));
202 202
 
203
-                } elseif ($this->function_in_whitelist($function_name)) {
203
+				} elseif ($this->function_in_whitelist($function_name)) {
204 204
 
205
-                    $done_processing = call_user_func_array($function_name, array(50, $n));
205
+					$done_processing = call_user_func_array($function_name, array(50, $n));
206 206
 
207
-                } else {
207
+				} else {
208 208
 
209
-                    _doing_it_wrong( esc_html( $function_name) , 'Is not a valid Sensei updater function', 'Sensei 1.9.0');
210
-                    return;
209
+					_doing_it_wrong( esc_html( $function_name) , 'Is not a valid Sensei updater function', 'Sensei 1.9.0');
210
+					return;
211 211
 
212
-                } // End If Statement
212
+				} // End If Statement
213 213
 
214
-                // Add to functions list get args
215
-                if ('' == $functions_list) {
216
-                    $functions_list .= $function_name;
217
-                } else {
218
-                    $functions_list .= '+' . $function_name;
219
-                } // End If Statement
214
+				// Add to functions list get args
215
+				if ('' == $functions_list) {
216
+					$functions_list .= $function_name;
217
+				} else {
218
+					$functions_list .= '+' . $function_name;
219
+				} // End If Statement
220 220
 
221
-                $this->set_update_run($function_name);
221
+				$this->set_update_run($function_name);
222 222
 
223
-            } // End For Loop
223
+			} // End For Loop
224 224
 
225
-        } // End If Statement
225
+		} // End If Statement
226 226
 
227
-        if (!$done_processing) { ?>
227
+		if (!$done_processing) { ?>
228 228
 
229 229
             <h3><?php _e('Processing Updates...', 'woothemes-sensei'); ?></h3>
230 230
 
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
                 <?php _e( "If your browser doesn't start loading the next page automatically, click this button:", 'woothemes-sensei' ); ?>
234 234
 
235 235
                 <?php
236
-                $next_action_url = add_query_arg( array(
237
-                    'page' => 'sensei_updates',
238
-                    'action' => 'update',
239
-                    'n' => $n + 50,
240
-                    'functions' => array( $functions_list ),
241
-                    $function_name.'_nonce' => wp_create_nonce( 'run_'. $function_name ),
242
-                ), admin_url( 'admin.php' ) );
243
-                ?>
236
+				$next_action_url = add_query_arg( array(
237
+					'page' => 'sensei_updates',
238
+					'action' => 'update',
239
+					'n' => $n + 50,
240
+					'functions' => array( $functions_list ),
241
+					$function_name.'_nonce' => wp_create_nonce( 'run_'. $function_name ),
242
+				), admin_url( 'admin.php' ) );
243
+				?>
244 244
 
245 245
                 <a class="button"  href="<?php echo esc_url( $next_action_url ); ?>">
246 246
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 
270 270
         <?php } // End If Statement
271 271
 
272
-        } else { ?>
272
+		} else { ?>
273 273
 
274 274
             <h3><?php _e('Updates', 'woothemes-sensei'); ?></h3>
275 275
             <p><?php printf(__('These are updates that have been made available as new Sensei versions have been released. Updates of type %1$sAuto%2$s will run as you update Sensei to the relevant version - other updates need to be run manually and you can do that here.', 'woothemes-sensei'), '<code>', '</code>'); ?></p>
@@ -298,19 +298,19 @@  discard block
 block discarded – undo
298 298
 
299 299
                 <tbody class="updates">
300 300
                 <?php
301
-                // Sort updates with the latest at the top
302
-                uksort($this->updates, array($this, 'sort_updates'));
303
-                $this->updates = array_reverse($this->updates, true);
304
-                $class = 'alternate';
305
-                foreach ($this->updates as $version => $version_updates) {
306
-                    foreach ($version_updates as $type => $updates) {
307
-                        foreach ($updates as $update => $data) {
308
-                            $update_run = $this->has_update_run($update);
309
-                            $product = 'Sensei';
310
-                            if (isset($data['product']) && '' != $data['product']) {
311
-                                $product = $data['product'];
312
-                            } // End If Statement
313
-                            ?>
301
+				// Sort updates with the latest at the top
302
+				uksort($this->updates, array($this, 'sort_updates'));
303
+				$this->updates = array_reverse($this->updates, true);
304
+				$class = 'alternate';
305
+				foreach ($this->updates as $version => $version_updates) {
306
+					foreach ($version_updates as $type => $updates) {
307
+						foreach ($updates as $update => $data) {
308
+							$update_run = $this->has_update_run($update);
309
+							$product = 'Sensei';
310
+							if (isset($data['product']) && '' != $data['product']) {
311
+								$product = $data['product'];
312
+							} // End If Statement
313
+							?>
314 314
                             <form method="post" action="admin.php?page=sensei_updates&action=update&n=0"
315 315
                                   name="update-sensei" class="upgrade">
316 316
                                 <tr class="<?php echo $class; ?>">
@@ -323,11 +323,11 @@  discard block
 block discarded – undo
323 323
                                         </p>
324 324
                                     </td>
325 325
                                     <?php
326
-                                    $type_label = __('Auto', 'woothemes-sensei');
327
-                                    if ($type != 'auto') {
328
-                                        $type_label = __('Manual', 'woothemes-sensei');
329
-                                    }
330
-                                    ?>
326
+									$type_label = __('Auto', 'woothemes-sensei');
327
+									if ($type != 'auto') {
328
+										$type_label = __('Manual', 'woothemes-sensei');
329
+									}
330
+									?>
331 331
                                     <td><p><?php echo $type_label; ?></p></td>
332 332
                                     <td>
333 333
                                         <p>
@@ -339,24 +339,24 @@  discard block
 block discarded – undo
339 339
                                                    name="update">
340 340
 
341 341
                                             <?php
342
-                                            $nonce_action = 'run_'.$update;
343
-                                            $nonce_field_name = $update.'_nonce_field';
344
-                                            wp_nonce_field( $nonce_action, $nonce_field_name, false, true );
345
-                                            ?>
342
+											$nonce_action = 'run_'.$update;
343
+											$nonce_field_name = $update.'_nonce_field';
344
+											wp_nonce_field( $nonce_action, $nonce_field_name, false, true );
345
+											?>
346 346
                                         </p>
347 347
                                     </td>
348 348
                                 </tr>
349 349
                             </form>
350 350
                             <?php
351
-                            if ('alternate' == $class) {
352
-                                $class = '';
353
-                            } else {
354
-                                $class = 'alternate';
355
-                            }
356
-                        }
357
-                    }
358
-                }
359
-                ?>
351
+							if ('alternate' == $class) {
352
+								$class = '';
353
+							} else {
354
+								$class = 'alternate';
355
+							}
356
+						}
357
+					}
358
+				}
359
+				?>
360 360
                 </tbody>
361 361
 
362 362
             </table>
@@ -364,31 +364,31 @@  discard block
 block discarded – undo
364 364
             </div>
365 365
 
366 366
             <?php
367
-        } // End If Statement
368
-    } // End sensei_updates_page()
367
+		} // End If Statement
368
+	} // End sensei_updates_page()
369 369
 
370
-    /**
371
-     * Since 1.9.0
372
-     *
373
-     * A list of safe to execute functions withing the
374
-     * updater context.
375
-     *
376
-     * @param string $function_name
377
-     */
378
-    public function function_in_whitelist( $function_name ){
370
+	/**
371
+	 * Since 1.9.0
372
+	 *
373
+	 * A list of safe to execute functions withing the
374
+	 * updater context.
375
+	 *
376
+	 * @param string $function_name
377
+	 */
378
+	public function function_in_whitelist( $function_name ){
379 379
 
380
-        $function_whitelist = array(
381
-            'status_changes_convert_questions',
382
-            'status_changes_fix_lessons',
383
-            'status_changes_convert_courses',
384
-            'status_changes_convert_lessons',
385
-            'status_changes_repair_course_statuses',
380
+		$function_whitelist = array(
381
+			'status_changes_convert_questions',
382
+			'status_changes_fix_lessons',
383
+			'status_changes_convert_courses',
384
+			'status_changes_convert_lessons',
385
+			'status_changes_repair_course_statuses',
386 386
 
387
-        );
387
+		);
388 388
 
389
-        return in_array($function_name, $function_whitelist );
389
+		return in_array($function_name, $function_whitelist );
390 390
 
391
-    }// end function_in_whitelist
391
+	}// end function_in_whitelist
392 392
 
393 393
 	/**
394 394
 	 * Sort updates list by version number
@@ -413,47 +413,47 @@  discard block
 block discarded – undo
413 413
 
414 414
 		// Only allow admins to run update functions
415 415
 		if( ! current_user_can( 'manage_options' ) ) {
416
-            return false;
417
-        }
418
-
419
-        $this->force_updates();
420
-
421
-        // Run through all functions
422
-        foreach ( $this->updates as $version => $value ) {
423
-            foreach ( $this->updates[$version] as $upgrade_type => $function_to_run ) {
424
-                if ( $upgrade_type == $type ) {
425
-                    $updated = false;
426
-                    // Run the update function
427
-                    foreach ( $function_to_run as $function_name => $update_data ) {
428
-                        if ( isset( $function_name ) && '' != $function_name ) {
429
-                            if ( ! in_array( $function_name, $this->updates_run ) ) {
430
-                                $updated = false;
431
-                                if ( method_exists( $this, $function_name ) ) {
432
-
433
-            $this->updates_run = array_unique( $this->updates_run ); // we only need one reference per update
416
+			return false;
417
+		}
418
+
419
+		$this->force_updates();
420
+
421
+		// Run through all functions
422
+		foreach ( $this->updates as $version => $value ) {
423
+			foreach ( $this->updates[$version] as $upgrade_type => $function_to_run ) {
424
+				if ( $upgrade_type == $type ) {
425
+					$updated = false;
426
+					// Run the update function
427
+					foreach ( $function_to_run as $function_name => $update_data ) {
428
+						if ( isset( $function_name ) && '' != $function_name ) {
429
+							if ( ! in_array( $function_name, $this->updates_run ) ) {
430
+								$updated = false;
431
+								if ( method_exists( $this, $function_name ) ) {
432
+
433
+			$this->updates_run = array_unique( $this->updates_run ); // we only need one reference per update
434 434
 			update_option( Sensei()->token . '-upgrades', $this->updates_run );
435 435
 			return true;
436 436
 
437
-                                } elseif( $this->function_in_whitelist( $function_name ) ) {
437
+								} elseif( $this->function_in_whitelist( $function_name ) ) {
438 438
 
439
-                                    $updated = call_user_func( $function_name );
439
+									$updated = call_user_func( $function_name );
440 440
 
441
-                                }  // End If Statement
441
+								}  // End If Statement
442 442
 
443
-                                if ( $updated ) {
444
-                                    array_push( $this->updates_run, $function_name );
445
-                                } // End If Statement
446
-                            }
447
-                        } // End If Statement
448
-                    } // End For Loop
449
-                } // End If Statement
450
-            } // End For Loop
451
-        } // End For Loop
443
+								if ( $updated ) {
444
+									array_push( $this->updates_run, $function_name );
445
+								} // End If Statement
446
+							}
447
+						} // End If Statement
448
+					} // End For Loop
449
+				} // End If Statement
450
+			} // End For Loop
451
+		} // End For Loop
452 452
 
453
-        $this->updates_run = array_unique( $this->updates_run ); // we only need one reference per update
454
-        update_option( $this->token . '-upgrades', $this->updates_run );
453
+		$this->updates_run = array_unique( $this->updates_run ); // we only need one reference per update
454
+		update_option( $this->token . '-upgrades', $this->updates_run );
455 455
 
456
-        return true;
456
+		return true;
457 457
 
458 458
 	} // End update()
459 459
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 	 */
567 567
 	private function set_update_run( $update ) {
568 568
 		array_push( $this->updates_run, $update );
569
-        $this->updates_run = array_unique( $this->updates_run ); // we only need one reference per update
569
+		$this->updates_run = array_unique( $this->updates_run ); // we only need one reference per update
570 570
 		update_option( Sensei()->token . '-upgrades', $this->updates_run );
571 571
 	}
572 572
 
@@ -1030,11 +1030,11 @@  discard block
 block discarded – undo
1030 1030
 				update_post_meta( $lesson->ID, '_order_' . $course_id, 0 );
1031 1031
 			}
1032 1032
 
1033
-            $module = Sensei()->modules->get_lesson_module( $lesson->ID );
1033
+			$module = Sensei()->modules->get_lesson_module( $lesson->ID );
1034 1034
 
1035
-            if( $module ) {
1036
-                update_post_meta( $lesson->ID, '_order_module_' . $module->term_id, 0 );
1037
-            }
1035
+			if( $module ) {
1036
+				update_post_meta( $lesson->ID, '_order_module_' . $module->term_id, 0 );
1037
+			}
1038 1038
 
1039 1039
 		}
1040 1040
 
@@ -1844,22 +1844,22 @@  discard block
 block discarded – undo
1844 1844
 
1845 1845
 	}
1846 1846
 
1847
-     /**
1848
-     * WooThemes_Sensei_Updates::enhance_teacher_role
1849
-     *
1850
-     * This runs the update to create the teacher role
1851
-     * @access public
1852
-     * @since 1.8.0
1853
-     * @return bool;
1854
-     */
1855
-    public  function enhance_teacher_role ( ) {
1856
-
1857
-        require_once('class-sensei-teacher.php');
1858
-        $teacher = new Sensei_Teacher();
1859
-        $teacher->create_role();
1860
-        return true;
1861
-
1862
-    }// end enhance_teacher_role
1847
+	 /**
1848
+	  * WooThemes_Sensei_Updates::enhance_teacher_role
1849
+	  *
1850
+	  * This runs the update to create the teacher role
1851
+	  * @access public
1852
+	  * @since 1.8.0
1853
+	  * @return bool;
1854
+	  */
1855
+	public  function enhance_teacher_role ( ) {
1856
+
1857
+		require_once('class-sensei-teacher.php');
1858
+		$teacher = new Sensei_Teacher();
1859
+		$teacher->create_role();
1860
+		return true;
1861
+
1862
+	}// end enhance_teacher_role
1863 1863
 
1864 1864
 } // End Class
1865 1865
 
Please login to merge, or discard this patch.
includes/shortcodes/class-sensei-legacy-shortcodes.php 1 patch
Indentation   +249 added lines, -249 removed lines patch added patch discarded remove patch
@@ -17,323 +17,323 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class Sensei_Legacy_Shortcodes {
19 19
 
20
-    /**
21
-     * Add the legacy shortcodes to WordPress
22
-     *
23
-     * @since 1.9.0
24
-     */
25
-    public static function init(){
26
-
27
-        add_shortcode( 'allcourses',      array( __CLASS__, 'all_courses' ) );
28
-        add_shortcode( 'newcourses',      array( __CLASS__,'new_courses' ) );
29
-        add_shortcode( 'featuredcourses', array( __CLASS__,'featured_courses') );
30
-        add_shortcode( 'freecourses',     array( __CLASS__,'free_courses') );
31
-        add_shortcode( 'paidcourses',     array( __CLASS__,'paid_courses') );
32
-        add_shortcode( 'usercourses',     array( __CLASS__,'user_courses' ) );
33
-
34
-    }
35
-    /**
36
-     * all_courses shortcode output function.
37
-     *
38
-     * The function should only be called indirectly through do_shortcode()
39
-     *
40
-     * @access public
41
-     * @param mixed $atts
42
-     * @param mixed $content (default: null)
43
-     * @return string
44
-     */
45
-    public static function all_courses( $atts, $content = null ) {
46
-
47
-        return self::generate_shortcode_courses( '', 'allcourses' ); // all courses but no title
48
-
49
-    } // all_courses()
50
-
51
-    /**
52
-     * paid_courses function.
53
-     *
54
-     * @access public
55
-     * @param mixed $atts
56
-     * @param mixed $content (default: null)
57
-     * @return string
58
-     */
59
-    public static function paid_courses( $atts, $content = null ) {
60
-
61
-        return self::generate_shortcode_courses( 'Paid Courses', 'paidcourses' );
62
-
63
-    } // End paid_courses()
64
-
65
-
66
-    /**
67
-     * featured_courses function.
68
-     *
69
-     * @access public
70
-     * @param mixed $atts
71
-     * @param mixed $content (default: null)
72
-     * @return string
73
-     */
74
-    public static function featured_courses( $atts, $content = null ) {
75
-
76
-        return self::generate_shortcode_courses( 'Featured Courses', 'featuredcourses' );
20
+	/**
21
+	 * Add the legacy shortcodes to WordPress
22
+	 *
23
+	 * @since 1.9.0
24
+	 */
25
+	public static function init(){
26
+
27
+		add_shortcode( 'allcourses',      array( __CLASS__, 'all_courses' ) );
28
+		add_shortcode( 'newcourses',      array( __CLASS__,'new_courses' ) );
29
+		add_shortcode( 'featuredcourses', array( __CLASS__,'featured_courses') );
30
+		add_shortcode( 'freecourses',     array( __CLASS__,'free_courses') );
31
+		add_shortcode( 'paidcourses',     array( __CLASS__,'paid_courses') );
32
+		add_shortcode( 'usercourses',     array( __CLASS__,'user_courses' ) );
33
+
34
+	}
35
+	/**
36
+	 * all_courses shortcode output function.
37
+	 *
38
+	 * The function should only be called indirectly through do_shortcode()
39
+	 *
40
+	 * @access public
41
+	 * @param mixed $atts
42
+	 * @param mixed $content (default: null)
43
+	 * @return string
44
+	 */
45
+	public static function all_courses( $atts, $content = null ) {
46
+
47
+		return self::generate_shortcode_courses( '', 'allcourses' ); // all courses but no title
48
+
49
+	} // all_courses()
50
+
51
+	/**
52
+	 * paid_courses function.
53
+	 *
54
+	 * @access public
55
+	 * @param mixed $atts
56
+	 * @param mixed $content (default: null)
57
+	 * @return string
58
+	 */
59
+	public static function paid_courses( $atts, $content = null ) {
60
+
61
+		return self::generate_shortcode_courses( 'Paid Courses', 'paidcourses' );
62
+
63
+	} // End paid_courses()
64
+
65
+
66
+	/**
67
+	 * featured_courses function.
68
+	 *
69
+	 * @access public
70
+	 * @param mixed $atts
71
+	 * @param mixed $content (default: null)
72
+	 * @return string
73
+	 */
74
+	public static function featured_courses( $atts, $content = null ) {
75
+
76
+		return self::generate_shortcode_courses( 'Featured Courses', 'featuredcourses' );
77 77
 
78
-    } // End featured_courses()
78
+	} // End featured_courses()
79 79
 
80
-    /**
81
-     * shortcode_free_courses function.
82
-     *
83
-     * @access public
84
-     * @param mixed $atts
85
-     * @param mixed $content (default: null)
86
-     * @return string
87
-     */
88
-    public static function free_courses( $atts, $content = null ) {
80
+	/**
81
+	 * shortcode_free_courses function.
82
+	 *
83
+	 * @access public
84
+	 * @param mixed $atts
85
+	 * @param mixed $content (default: null)
86
+	 * @return string
87
+	 */
88
+	public static function free_courses( $atts, $content = null ) {
89 89
 
90
-        return self::generate_shortcode_courses( 'Free Courses', 'freecourses' );
90
+		return self::generate_shortcode_courses( 'Free Courses', 'freecourses' );
91 91
 
92
-    } // End free_courses()
92
+	} // End free_courses()
93 93
 
94
-    /**
95
-     * shortcode_new_courses function.
96
-     *
97
-     * @access public
98
-     * @param mixed $atts
99
-     * @param mixed $content (default: null)
100
-     * @return string
101
-     */
102
-    public static function new_courses( $atts, $content = null ) {
94
+	/**
95
+	 * shortcode_new_courses function.
96
+	 *
97
+	 * @access public
98
+	 * @param mixed $atts
99
+	 * @param mixed $content (default: null)
100
+	 * @return string
101
+	 */
102
+	public static function new_courses( $atts, $content = null ) {
103 103
 
104
-        return self::generate_shortcode_courses( 'New Courses', 'newcourses' );
104
+		return self::generate_shortcode_courses( 'New Courses', 'newcourses' );
105 105
 
106
-    } // End new_courses()
106
+	} // End new_courses()
107 107
 
108
-    /**
109
-     * Generate courses adding a title.
110
-     *
111
-     * @since 1.9.0
112
-     *
113
-     * @param $title
114
-     * @param $shortcode_specific_override
115
-     * @return string
116
-     */
117
-    public static function generate_shortcode_courses( $title , $shortcode_specific_override  ){
108
+	/**
109
+	 * Generate courses adding a title.
110
+	 *
111
+	 * @since 1.9.0
112
+	 *
113
+	 * @param $title
114
+	 * @param $shortcode_specific_override
115
+	 * @return string
116
+	 */
117
+	public static function generate_shortcode_courses( $title , $shortcode_specific_override  ){
118 118
 
119
-        global  $shortcode_override, $posts_array;
119
+		global  $shortcode_override, $posts_array;
120 120
 
121
-        $shortcode_override = $shortcode_specific_override;
121
+		$shortcode_override = $shortcode_specific_override;
122 122
 
123
-        // do not show this short code if there is a shortcode int he url and
124
-        // this specific shortcode is not the one requested in the ur.
125
-        $specific_shortcode_requested = isset( $_GET['action'] ) ?  sanitize_text_field(  $_GET['action']  ) : '';
126
-        if( ! empty( $specific_shortcode_requested) &&
127
-            $specific_shortcode_requested != $shortcode_override ){
123
+		// do not show this short code if there is a shortcode int he url and
124
+		// this specific shortcode is not the one requested in the ur.
125
+		$specific_shortcode_requested = isset( $_GET['action'] ) ?  sanitize_text_field(  $_GET['action']  ) : '';
126
+		if( ! empty( $specific_shortcode_requested) &&
127
+			$specific_shortcode_requested != $shortcode_override ){
128 128
 
129
-            return '';
129
+			return '';
130 130
 
131
-        }
131
+		}
132 132
 
133
-        // loop and get all courses html
134
-        ob_start();
135
-        self::initialise_legacy_course_loop();
136
-        $courses = ob_get_clean();
133
+		// loop and get all courses html
134
+		ob_start();
135
+		self::initialise_legacy_course_loop();
136
+		$courses = ob_get_clean();
137 137
 
138
-        $content = '';
139
-        if( count( $posts_array ) > 0 ){
138
+		$content = '';
139
+		if( count( $posts_array ) > 0 ){
140 140
 
141
-            $before = empty($title)? '' : '<header class="archive-header"><h2>'. $title .'</h2></header>';
142
-            $before .= '<section id="main-course" class="course-container">';
141
+			$before = empty($title)? '' : '<header class="archive-header"><h2>'. $title .'</h2></header>';
142
+			$before .= '<section id="main-course" class="course-container">';
143 143
 
144
-            $after = '</section>';
144
+			$after = '</section>';
145 145
 
146
-            //assemble
147
-            $content = $before . $courses . $after;
146
+			//assemble
147
+			$content = $before . $courses . $after;
148 148
 
149
-        }
149
+		}
150 150
 
151
-        return $content;
151
+		return $content;
152 152
 
153
-    }// end generate_shortcode_courses
153
+	}// end generate_shortcode_courses
154 154
 
155 155
 
156
-    /**
157
-     * user_courses function.
158
-     *
159
-     * @access public
160
-     * @param mixed $atts
161
-     * @param mixed $content (default: null)
162
-     * @return string
163
-     */
164
-    public static function user_courses( $atts, $content = null ) {
165
-        global $shortcode_override;
166
-        extract( shortcode_atts( array(	'amount' => 0 ), $atts ) );
156
+	/**
157
+	 * user_courses function.
158
+	 *
159
+	 * @access public
160
+	 * @param mixed $atts
161
+	 * @param mixed $content (default: null)
162
+	 * @return string
163
+	 */
164
+	public static function user_courses( $atts, $content = null ) {
165
+		global $shortcode_override;
166
+		extract( shortcode_atts( array(	'amount' => 0 ), $atts ) );
167 167
 
168
-        $shortcode_override = 'usercourses';
168
+		$shortcode_override = 'usercourses';
169 169
 
170
-        ob_start();
170
+		ob_start();
171 171
 
172
-        if( is_user_logged_in() ){
172
+		if( is_user_logged_in() ){
173 173
 
174
-            Sensei_Templates::get_template( 'user/my-courses.php' );
174
+			Sensei_Templates::get_template( 'user/my-courses.php' );
175 175
 
176
-        }else{
176
+		}else{
177 177
 
178
-            Sensei()->frontend->sensei_login_form();
178
+			Sensei()->frontend->sensei_login_form();
179 179
 
180
-        }
180
+		}
181 181
 
182
-        $content = ob_get_clean();
183
-        return $content;
182
+		$content = ob_get_clean();
183
+		return $content;
184 184
 
185
-    } // End user_courses()
185
+	} // End user_courses()
186 186
 
187
-    /**
188
-     * This function is simply to honor the legacy
189
-     * loop-course.php for the old shortcodes.
190
-     * @since 1.9.0
191
-     */
192
-    public static function initialise_legacy_course_loop(){
187
+	/**
188
+	 * This function is simply to honor the legacy
189
+	 * loop-course.php for the old shortcodes.
190
+	 * @since 1.9.0
191
+	 */
192
+	public static function initialise_legacy_course_loop(){
193 193
 
194
-        global  $post, $wp_query, $shortcode_override, $course_excludes;
194
+		global  $post, $wp_query, $shortcode_override, $course_excludes;
195 195
 
196
-        // Handle Query Type
197
-        $query_type = '';
196
+		// Handle Query Type
197
+		$query_type = '';
198 198
 
199
-        if ( isset( $_GET[ 'action' ] ) && ( '' != esc_html( $_GET[ 'action' ] ) ) ) {
200
-            $query_type = esc_html( $_GET[ 'action' ] );
201
-        } // End If Statement
199
+		if ( isset( $_GET[ 'action' ] ) && ( '' != esc_html( $_GET[ 'action' ] ) ) ) {
200
+			$query_type = esc_html( $_GET[ 'action' ] );
201
+		} // End If Statement
202 202
 
203
-        if ( '' != $shortcode_override ) {
204
-            $query_type = $shortcode_override;
205
-        } // End If Statement
203
+		if ( '' != $shortcode_override ) {
204
+			$query_type = $shortcode_override;
205
+		} // End If Statement
206 206
 
207
-        if ( !is_array( $course_excludes ) ) { $course_excludes = array(); }
207
+		if ( !is_array( $course_excludes ) ) { $course_excludes = array(); }
208 208
 
209
-        // Check that query returns results
210
-        // Handle Pagination
211
-        $paged = $wp_query->get( 'paged' );
212
-        $paged = empty( $paged ) ? 1 : $paged;
209
+		// Check that query returns results
210
+		// Handle Pagination
211
+		$paged = $wp_query->get( 'paged' );
212
+		$paged = empty( $paged ) ? 1 : $paged;
213 213
 
214 214
 
215
-        // Check for pagination settings
216
-        if ( isset( Sensei()->settings->settings[ 'course_archive_amount' ] ) && ( 0 < absint( Sensei()->settings->settings[ 'course_archive_amount' ] ) ) ) {
215
+		// Check for pagination settings
216
+		if ( isset( Sensei()->settings->settings[ 'course_archive_amount' ] ) && ( 0 < absint( Sensei()->settings->settings[ 'course_archive_amount' ] ) ) ) {
217 217
 
218
-            $amount = absint( Sensei()->settings->settings[ 'course_archive_amount' ] );
218
+			$amount = absint( Sensei()->settings->settings[ 'course_archive_amount' ] );
219 219
 
220
-        } else {
220
+		} else {
221 221
 
222
-            $amount = $wp_query->get( 'posts_per_page' );
222
+			$amount = $wp_query->get( 'posts_per_page' );
223 223
 
224
-        } // End If Statement
224
+		} // End If Statement
225 225
 
226
-        // This is not a paginated page (or it's simply the first page of a paginated page/post)
226
+		// This is not a paginated page (or it's simply the first page of a paginated page/post)
227 227
 
228
-        global $posts_array;
229
-        $course_includes   = array();
228
+		global $posts_array;
229
+		$course_includes   = array();
230 230
 
231
-        $query_args = Sensei()->course->get_archive_query_args( $shortcode_override, $amount, $course_includes, $course_excludes );
232
-        $course_query = new WP_Query( $query_args );
233
-        $posts_array = $course_query->get_posts();
231
+		$query_args = Sensei()->course->get_archive_query_args( $shortcode_override, $amount, $course_includes, $course_excludes );
232
+		$course_query = new WP_Query( $query_args );
233
+		$posts_array = $course_query->get_posts();
234 234
 
235
-        // output the courses
236
-        if( ! empty( $posts_array ) ) {
235
+		// output the courses
236
+		if( ! empty( $posts_array ) ) {
237 237
 
238
-            //output all courses for current query
239
-            self::loop_courses( $course_query, $amount );
238
+			//output all courses for current query
239
+			self::loop_courses( $course_query, $amount );
240 240
 
241
-        }
241
+		}
242 242
 
243
-    }
243
+	}
244 244
 
245
-    /**
246
-     * Loop through courses in the query and output the infomration needed
247
-     *
248
-     * @since 1.9.0
249
-     *
250
-     * @param WP_Query $course_query
251
-     */
252
-    public static function loop_courses( $course_query, $amount ){
245
+	/**
246
+	 * Loop through courses in the query and output the infomration needed
247
+	 *
248
+	 * @since 1.9.0
249
+	 *
250
+	 * @param WP_Query $course_query
251
+	 */
252
+	public static function loop_courses( $course_query, $amount ){
253 253
 
254
-        global $shortcode_override, $posts_array, $post, $wp_query, $shortcode_override, $course_excludes, $course_includes;
254
+		global $shortcode_override, $posts_array, $post, $wp_query, $shortcode_override, $course_excludes, $course_includes;
255 255
 
256
-        if ( count( $course_query->get_posts() ) > 0 ) {
256
+		if ( count( $course_query->get_posts() ) > 0 ) {
257 257
 
258
-            do_action( 'sensei_course_archive_header', $shortcode_override );
258
+			do_action( 'sensei_course_archive_header', $shortcode_override );
259 259
 
260
-            foreach ( $course_query->get_posts() as $course){
260
+			foreach ( $course_query->get_posts() as $course){
261 261
 
262
-                // Make sure the other loops dont include the same post twice!
263
-                array_push( $course_excludes, $course->ID );
262
+				// Make sure the other loops dont include the same post twice!
263
+				array_push( $course_excludes, $course->ID );
264 264
 
265
-                // output the course markup
266
-                self::the_course( $course->ID );
265
+				// output the course markup
266
+				self::the_course( $course->ID );
267 267
 
268
-            } // End For Loop
268
+			} // End For Loop
269 269
 
270
-            // More and Prev links
271
-            $posts_array_query = new WP_Query(Sensei()->course->course_query( $shortcode_override, $amount, $course_includes, $course_excludes ) );
272
-            $posts_array       = $posts_array_query->get_posts();
273
-            $max_pages = $course_query->found_posts / $amount;
274
-            if ( '' != $shortcode_override && ( $max_pages > $course_query->get( 'paged' ) ) ) {
270
+			// More and Prev links
271
+			$posts_array_query = new WP_Query(Sensei()->course->course_query( $shortcode_override, $amount, $course_includes, $course_excludes ) );
272
+			$posts_array       = $posts_array_query->get_posts();
273
+			$max_pages = $course_query->found_posts / $amount;
274
+			if ( '' != $shortcode_override && ( $max_pages > $course_query->get( 'paged' ) ) ) {
275 275
 
276
-                switch( $shortcode_override ){
277
-                    case 'paidcourses':
278
-                        $filter = 'paid';
279
-                        break;
280
-                    case 'featuredcourses':
281
-                        $filter = 'featured';
282
-                        break;
283
-                    case 'freecourses':
284
-                        $filter = 'free';
285
-                        break;
286
-                    default:
287
-                        $filter = '';
288
-                        break;
289
-                }
276
+				switch( $shortcode_override ){
277
+					case 'paidcourses':
278
+						$filter = 'paid';
279
+						break;
280
+					case 'featuredcourses':
281
+						$filter = 'featured';
282
+						break;
283
+					case 'freecourses':
284
+						$filter = 'free';
285
+						break;
286
+					default:
287
+						$filter = '';
288
+						break;
289
+				}
290 290
 
291
-                $quer_args = array();
292
-                $quer_args[ 'paged' ] = '2';
293
-                if( !empty( $filter ) ){
294
-                    $quer_args[ 'course_filter' ] = $filter;
295
-                }
291
+				$quer_args = array();
292
+				$quer_args[ 'paged' ] = '2';
293
+				if( !empty( $filter ) ){
294
+					$quer_args[ 'course_filter' ] = $filter;
295
+				}
296 296
 
297
-                $course_pagination_link = get_post_type_archive_link( 'course' );
298
-                $more_link_text = esc_html( Sensei()->settings->settings[ 'course_archive_more_link_text' ] );
299
-                $more_link_url =  esc_url( add_query_arg( $quer_args, $course_pagination_link ) );
297
+				$course_pagination_link = get_post_type_archive_link( 'course' );
298
+				$more_link_text = esc_html( Sensei()->settings->settings[ 'course_archive_more_link_text' ] );
299
+				$more_link_url =  esc_url( add_query_arg( $quer_args, $course_pagination_link ) );
300 300
 
301
-                // next/more
302
-                $html  = '<div class="navigation"><div class="nav-next">';
303
-                $html .= '<a href="' . $more_link_url . '">';
304
-                $html .= $more_link_text;
305
-                $html .= '<span class="meta-nav"></span></a></div>';
301
+				// next/more
302
+				$html  = '<div class="navigation"><div class="nav-next">';
303
+				$html .= '<a href="' . $more_link_url . '">';
304
+				$html .= $more_link_text;
305
+				$html .= '<span class="meta-nav"></span></a></div>';
306 306
 
307
-                echo apply_filters( 'course_archive_next_link', $html );
307
+				echo apply_filters( 'course_archive_next_link', $html );
308 308
 
309
-            } // End If Statement
309
+			} // End If Statement
310 310
 
311
-        } // End If Statement
312
-    }
311
+		} // End If Statement
312
+	}
313 313
 
314
-    /**
315
-     * Print a single course markup
316
-     *
317
-     * @param $course_id
318
-     */
319
-    public static function the_course( $course_id ){
314
+	/**
315
+	 * Print a single course markup
316
+	 *
317
+	 * @param $course_id
318
+	 */
319
+	public static function the_course( $course_id ){
320 320
 
321
-        // Get meta data
322
-        $course =  get_post( $course_id );
323
-        $user_info = get_userdata( absint( $course->post_author ) );
324
-        $author_link = get_author_posts_url( absint( $course->post_author ) );
325
-        $author_display_name = $user_info->display_name;
326
-        $author_id = $course->post_author;
327
-        $category_output = get_the_term_list( $course_id, 'course-category', '', ', ', '' );
328
-        $preview_lesson_count = intval( Sensei()->course->course_lesson_preview_count( $course_id ) );
329
-        $is_user_taking_course = Sensei_Utils::user_started_course( $course_id, get_current_user_id() );
330
-        ?>
321
+		// Get meta data
322
+		$course =  get_post( $course_id );
323
+		$user_info = get_userdata( absint( $course->post_author ) );
324
+		$author_link = get_author_posts_url( absint( $course->post_author ) );
325
+		$author_display_name = $user_info->display_name;
326
+		$author_id = $course->post_author;
327
+		$category_output = get_the_term_list( $course_id, 'course-category', '', ', ', '' );
328
+		$preview_lesson_count = intval( Sensei()->course->course_lesson_preview_count( $course_id ) );
329
+		$is_user_taking_course = Sensei_Utils::user_started_course( $course_id, get_current_user_id() );
330
+		?>
331 331
 
332 332
         <article class="<?php echo esc_attr( join( ' ', get_post_class( array( 'course', 'post' ), $course_id ) ) ); ?>">
333 333
             <?php
334
-            // so that legacy shortcodes work with the party plugins that wants to hook in
335
-            do_action('sensei_course_content_before',$course->ID );
336
-            ?>
334
+			// so that legacy shortcodes work with the party plugins that wants to hook in
335
+			do_action('sensei_course_content_before',$course->ID );
336
+			?>
337 337
             <div class="course-content">
338 338
 
339 339
                 <?php Sensei()->course->course_image($course_id); ?>
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
                     </p>
370 370
 
371 371
                     <?php if ( 0 < $preview_lesson_count && !$is_user_taking_course ) {
372
-                        $preview_lessons = sprintf( __( '(%d preview lessons)', 'woothemes-sensei' ), $preview_lesson_count ); ?>
372
+						$preview_lessons = sprintf( __( '(%d preview lessons)', 'woothemes-sensei' ), $preview_lesson_count ); ?>
373 373
                         <p class="sensei-free-lessons">
374 374
                             <a href="<?php echo get_permalink( $course_id ); ?>"><?php _e( 'Preview this course', 'woothemes-sensei' ) ?>
375 375
                             </a> - <?php echo $preview_lessons; ?>
@@ -380,15 +380,15 @@  discard block
 block discarded – undo
380 380
 
381 381
             </div>
382 382
             <?php
383
-            // so that legacy shortcodes work with thir party plugins that wants to hook in
384
-            do_action('sensei_course_content_after', $course->ID);
385
-            ?>
383
+			// so that legacy shortcodes work with thir party plugins that wants to hook in
384
+			do_action('sensei_course_content_after', $course->ID);
385
+			?>
386 386
 
387 387
         </article>
388 388
 
389 389
         <?php
390 390
 
391 391
 
392
-    } // end the_course
392
+	} // end the_course
393 393
 
394 394
 }// end class legacy shortcodes
395 395
\ No newline at end of file
Please login to merge, or discard this patch.
templates/single-course/lessons.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -1,83 +1,83 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined( 'ABSPATH' ) ) exit;
3 3
 /**
4
- * The Template for displaying all single course meta information.
5
- *
6
- * Override this template by copying it to yourtheme/sensei/single-course/course-lessons.php
7
- *
8
- * @author 		Automattic
9
- * @package 	Sensei
10
- * @category    Templates
11
- * @version     1.9.0
12
- */
4
+	 * The Template for displaying all single course meta information.
5
+	 *
6
+	 * Override this template by copying it to yourtheme/sensei/single-course/course-lessons.php
7
+	 *
8
+	 * @author 		Automattic
9
+	 * @package 	Sensei
10
+	 * @category    Templates
11
+	 * @version     1.9.0
12
+	 */
13 13
 ?>
14 14
 
15 15
 <section class="course-lessons">
16 16
 
17 17
     <?php
18 18
 
19
-        /**
20
-         * Actions just before the sensei single course lessons loop begins
21
-         *
22
-         * @hooked WooThemes_Sensei_Course::load_single_course_lessons_query
23
-         * @since 1.9.0
24
-         */
25
-        do_action( 'sensei_single_course_lessons_before' );
19
+		/**
20
+		 * Actions just before the sensei single course lessons loop begins
21
+		 *
22
+		 * @hooked WooThemes_Sensei_Course::load_single_course_lessons_query
23
+		 * @since 1.9.0
24
+		 */
25
+		do_action( 'sensei_single_course_lessons_before' );
26 26
 
27
-    ?>
27
+	?>
28 28
 
29 29
     <?php
30 30
 
31
-    //lessons loaded into loop in the sensei_single_course_lessons_before hook
32
-    if( have_posts() ):
31
+	//lessons loaded into loop in the sensei_single_course_lessons_before hook
32
+	if( have_posts() ):
33 33
 
34
-        // start course lessons loop
35
-        while ( have_posts() ): the_post();  ?>
34
+		// start course lessons loop
35
+		while ( have_posts() ): the_post();  ?>
36 36
 
37 37
             <article <?php post_class(); ?> >
38 38
 
39 39
                 <?php
40 40
 
41
-                    /**
42
-                     * The hook is inside the course lesson on the single course. It fires
43
-                     * for each lesson. It is just before the lesson excerpt.
44
-                     *
45
-                     * @since 1.9.0
46
-                     *
47
-                     * @param $lessons_id
48
-                     *
49
-                     * @hooked WooThemes_Sensei_Lesson::the_lesson_meta -  5
50
-                     * @hooked WooThemes_Sensei_Lesson::the_lesson_thumbnail - 8
51
-                     *
52
-                     */
53
-                    do_action( 'sensei_single_course_inside_before_lesson', get_the_ID() );
54
-
55
-                ?>
41
+					/**
42
+					 * The hook is inside the course lesson on the single course. It fires
43
+					 * for each lesson. It is just before the lesson excerpt.
44
+					 *
45
+					 * @since 1.9.0
46
+					 *
47
+					 * @param $lessons_id
48
+					 *
49
+					 * @hooked WooThemes_Sensei_Lesson::the_lesson_meta -  5
50
+					 * @hooked WooThemes_Sensei_Lesson::the_lesson_thumbnail - 8
51
+					 *
52
+					 */
53
+					do_action( 'sensei_single_course_inside_before_lesson', get_the_ID() );
54
+
55
+				?>
56 56
 
57 57
                 <section class="entry">
58 58
 
59 59
                     <?php
60
-                    /**
61
-                     * Output all course lessons. If none found for this course
62
-                     * a notice will be displayed. What is displayed
63
-                     * is manipulated via a
64
-                     */
65
-                    the_excerpt();
66
-                    ?>
60
+					/**
61
+					 * Output all course lessons. If none found for this course
62
+					 * a notice will be displayed. What is displayed
63
+					 * is manipulated via a
64
+					 */
65
+					the_excerpt();
66
+					?>
67 67
 
68 68
                 </section>
69 69
 
70 70
                 <?php
71 71
 
72
-                    /**
73
-                     * The hook is inside the course lesson on the single course. It is just before the lesson closing markup.
74
-                     * It fires for each lesson.
75
-                     *
76
-                     * @since 1.9.0
77
-                     */
78
-                    do_action( 'sensei_single_course_inside_after_lesson', get_the_ID() );
72
+					/**
73
+					 * The hook is inside the course lesson on the single course. It is just before the lesson closing markup.
74
+					 * It fires for each lesson.
75
+					 *
76
+					 * @since 1.9.0
77
+					 */
78
+					do_action( 'sensei_single_course_inside_after_lesson', get_the_ID() );
79 79
 
80
-                ?>
80
+				?>
81 81
 
82 82
             </article>
83 83
 
@@ -87,15 +87,15 @@  discard block
 block discarded – undo
87 87
 
88 88
     <?php
89 89
 
90
-        /**
91
-         * Actions just before the sensei single course lessons loop begins
92
-         *
93
-         * @hooked WooThemes_Sensei_Course::reset_single_course_query
94
-         *
95
-         * @since 1.9.0
96
-         */
97
-        do_action( 'sensei_single_course_lessons_after' );
90
+		/**
91
+		 * Actions just before the sensei single course lessons loop begins
92
+		 *
93
+		 * @hooked WooThemes_Sensei_Course::reset_single_course_query
94
+		 *
95
+		 * @since 1.9.0
96
+		 */
97
+		do_action( 'sensei_single_course_lessons_after' );
98 98
 
99
-    ?>
99
+	?>
100 100
 
101 101
 </section>
Please login to merge, or discard this patch.
includes/shortcodes/class-sensei-shortcode-user-courses.php 1 patch
Indentation   +235 added lines, -235 removed lines patch added patch discarded remove patch
@@ -25,167 +25,167 @@  discard block
 block discarded – undo
25 25
  */
26 26
 class Sensei_Shortcode_User_Courses implements Sensei_Shortcode_Interface {
27 27
 
28
-    /**
29
-     * @var WP_Query to help setup the query needed by the render method.
30
-     */
31
-    protected $query;
28
+	/**
29
+	 * @var WP_Query to help setup the query needed by the render method.
30
+	 */
31
+	protected $query;
32 32
 
33
-    /**
34
-     * @var string number of items to show on the current page
35
-     * Default: -1.
36
-     */
37
-    protected $number;
33
+	/**
34
+	 * @var string number of items to show on the current page
35
+	 * Default: -1.
36
+	 */
37
+	protected $number;
38 38
 
39
-    /**
40
-     * @var string ordery by course field
41
-     * Default: date
42
-     */
43
-    protected $orderby;
39
+	/**
40
+	 * @var string ordery by course field
41
+	 * Default: date
42
+	 */
43
+	protected $orderby;
44 44
 
45
-    /**
46
-     * @var string ASC or DESC
47
-     * Default: 'DESC'
48
-     */
49
-    protected  $order;
45
+	/**
46
+	 * @var string ASC or DESC
47
+	 * Default: 'DESC'
48
+	 */
49
+	protected  $order;
50 50
 
51
-    /**
52
-     * @var status can be completed or active. If none is specified all will be shown
53
-     */
54
-    protected $status;
51
+	/**
52
+	 * @var status can be completed or active. If none is specified all will be shown
53
+	 */
54
+	protected $status;
55 55
 
56
-    /**
57
-     * Setup the shortcode object
58
-     *
59
-     * @since 1.9.0
60
-     * @param array $attributes
61
-     * @param string $content
62
-     * @param string $shortcode the shortcode that was called for this instance
63
-     */
64
-    public function __construct( $attributes, $content, $shortcode ){
56
+	/**
57
+	 * Setup the shortcode object
58
+	 *
59
+	 * @since 1.9.0
60
+	 * @param array $attributes
61
+	 * @param string $content
62
+	 * @param string $shortcode the shortcode that was called for this instance
63
+	 */
64
+	public function __construct( $attributes, $content, $shortcode ){
65 65
 
66
-        if(!  is_user_logged_in() ) {
67
-            // show the login form
68
-            Sensei()->frontend->sensei_login_form();
69
-            return;
70
-        }
66
+		if(!  is_user_logged_in() ) {
67
+			// show the login form
68
+			Sensei()->frontend->sensei_login_form();
69
+			return;
70
+		}
71 71
 
72
-        // set up all argument need for constructing the course query
73
-        $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '10';
74
-        $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'title';
75
-        $this->status = isset( $attributes['status'] ) ? $attributes['status'] : 'all';
72
+		// set up all argument need for constructing the course query
73
+		$this->number = isset( $attributes['number'] ) ? $attributes['number'] : '10';
74
+		$this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'title';
75
+		$this->status = isset( $attributes['status'] ) ? $attributes['status'] : 'all';
76 76
 
77
-        // set the default for menu_order to be ASC
78
-        if( 'menu_order' == $this->orderby && !isset( $attributes['order']  ) ){
77
+		// set the default for menu_order to be ASC
78
+		if( 'menu_order' == $this->orderby && !isset( $attributes['order']  ) ){
79 79
 
80
-            $this->order =  'ASC';
80
+			$this->order =  'ASC';
81 81
 
82
-        }else{
82
+		}else{
83 83
 
84
-            // for everything else use the value passed or the default DESC
85
-            $this->order = isset( $attributes['order']  ) ? $attributes['order'] : 'ASC';
84
+			// for everything else use the value passed or the default DESC
85
+			$this->order = isset( $attributes['order']  ) ? $attributes['order'] : 'ASC';
86 86
 
87
-        }
87
+		}
88 88
 
89
-        // setup the course query that will be used when rendering
90
-        $this->setup_course_query();
91
-    }
89
+		// setup the course query that will be used when rendering
90
+		$this->setup_course_query();
91
+	}
92 92
 
93
-    /**
94
-     * Sets up the object course query
95
-     * that will be used in the render method.
96
-     *
97
-     * @since 1.9.0
98
-     */
99
-    protected function setup_course_query(){
93
+	/**
94
+	 * Sets up the object course query
95
+	 * that will be used in the render method.
96
+	 *
97
+	 * @since 1.9.0
98
+	 */
99
+	protected function setup_course_query(){
100 100
 
101
-        $status_query = array( 'user_id' => get_current_user_id(), 'type' => 'sensei_course_status' );
102
-        $user_courses_logs = Sensei_Utils::sensei_check_for_activity( $status_query , true );
103
-        if ( !is_array($user_courses_logs) ) {
101
+		$status_query = array( 'user_id' => get_current_user_id(), 'type' => 'sensei_course_status' );
102
+		$user_courses_logs = Sensei_Utils::sensei_check_for_activity( $status_query , true );
103
+		if ( !is_array($user_courses_logs) ) {
104 104
 
105
-            $user_courses_logs = array( $user_courses_logs );
105
+			$user_courses_logs = array( $user_courses_logs );
106 106
 
107
-        }
107
+		}
108 108
 
109
-        $completed_ids = $active_ids = array();
110
-        foreach( $user_courses_logs as $course_status ) {
109
+		$completed_ids = $active_ids = array();
110
+		foreach( $user_courses_logs as $course_status ) {
111 111
 
112
-            if ( Sensei_Utils::user_completed_course( $course_status, get_current_user_id() ) ) {
112
+			if ( Sensei_Utils::user_completed_course( $course_status, get_current_user_id() ) ) {
113 113
 
114
-                $completed_ids[] = $course_status->comment_post_ID;
114
+				$completed_ids[] = $course_status->comment_post_ID;
115 115
 
116
-            } else {
116
+			} else {
117 117
 
118
-                $active_ids[] = $course_status->comment_post_ID;
118
+				$active_ids[] = $course_status->comment_post_ID;
119 119
 
120
-            }
121
-        }
120
+			}
121
+		}
122 122
 
123
-        if( 'completed' == $this->status ){
123
+		if( 'completed' == $this->status ){
124 124
 
125
-            $included_courses =  $completed_ids;
125
+			$included_courses =  $completed_ids;
126 126
 
127 127
 
128
-        }elseif( 'active'==$this->status ){
128
+		}elseif( 'active'==$this->status ){
129 129
 
130
-            $included_courses =  $active_ids;
130
+			$included_courses =  $active_ids;
131 131
 
132
-        }else{ // all courses
132
+		}else{ // all courses
133 133
 
134
-            if( empty( $completed_ids ) ){
134
+			if( empty( $completed_ids ) ){
135 135
 
136
-                add_action( 'sensei_loop_course_inside_before', array( $this, 'completed_no_course_message_output' ) );
137
-            }
136
+				add_action( 'sensei_loop_course_inside_before', array( $this, 'completed_no_course_message_output' ) );
137
+			}
138 138
 
139
-            if( empty( $active_ids ) ){
139
+			if( empty( $active_ids ) ){
140 140
 
141
-                add_action( 'sensei_loop_course_inside_before', array( $this, 'active_no_course_message_output' ) );
141
+				add_action( 'sensei_loop_course_inside_before', array( $this, 'active_no_course_message_output' ) );
142 142
 
143
-            }
143
+			}
144 144
 
145
-            if( empty( $completed_ids ) &&  empty( $active_ids )  ){
145
+			if( empty( $completed_ids ) &&  empty( $active_ids )  ){
146 146
 
147
-                $included_courses = array('-1000'); // don't show any courses
147
+				$included_courses = array('-1000'); // don't show any courses
148 148
 
149
-            }else{
150
-                $included_courses = Sensei_Utils::array_zip_merge( (array)$active_ids, (array)$completed_ids );
151
-            }
149
+			}else{
150
+				$included_courses = Sensei_Utils::array_zip_merge( (array)$active_ids, (array)$completed_ids );
151
+			}
152
+
153
+
154
+		}
155
+
156
+		// temporary work around to hide pagination on the courses page
157
+		// this is in place until we can load the course for each tab via ajax
158
+		// if the shortcode is not active or in active and the active and completed
159
+		// tabs show up.
160
+		$number_of_posts = $this->number;
161
+		if( 'active' != $this->status && 'complete' != $this->status  ){
162
+			$number_of_posts = 1000;
163
+		}
164
+
165
+		// course query parameters
166
+		$query_var_paged = get_query_var('paged');
167
+		$query_args = array(
168
+			'post_type'        => 'course',
169
+			'post_status'      => 'publish',
170
+			'orderby'          => $this->orderby,
171
+			'order'            => $this->order,
172
+			'paged' => empty( $query_var_paged )? 1 : $query_var_paged,
173
+			'posts_per_page'   => $number_of_posts,
174
+			'post__in'         => $included_courses,
175
+		);
176
+
177
+		$this->query = new WP_Query( $query_args );
152 178
 
179
+	}// end setup _course_query
153 180
 
154
-        }
155
-
156
-        // temporary work around to hide pagination on the courses page
157
-        // this is in place until we can load the course for each tab via ajax
158
-        // if the shortcode is not active or in active and the active and completed
159
-        // tabs show up.
160
-        $number_of_posts = $this->number;
161
-        if( 'active' != $this->status && 'complete' != $this->status  ){
162
-            $number_of_posts = 1000;
163
-        }
164
-
165
-        // course query parameters
166
-        $query_var_paged = get_query_var('paged');
167
-        $query_args = array(
168
-            'post_type'        => 'course',
169
-            'post_status'      => 'publish',
170
-            'orderby'          => $this->orderby,
171
-            'order'            => $this->order,
172
-            'paged' => empty( $query_var_paged )? 1 : $query_var_paged,
173
-            'posts_per_page'   => $number_of_posts,
174
-            'post__in'         => $included_courses,
175
-        );
176
-
177
-        $this->query = new WP_Query( $query_args );
178
-
179
-    }// end setup _course_query
180
-
181
-    /**
182
-     * Output the message that tells the user they have
183
-     * no completed courses.
184
-     *
185
-     * @since 1.9.0
186
-     */
187
-    public function completed_no_course_message_output(){
188
-        ?>
181
+	/**
182
+	 * Output the message that tells the user they have
183
+	 * no completed courses.
184
+	 *
185
+	 * @since 1.9.0
186
+	 */
187
+	public function completed_no_course_message_output(){
188
+		?>
189 189
         <li class="user-completed">
190 190
             <div class="sensei-message info">
191 191
 
@@ -194,16 +194,16 @@  discard block
 block discarded – undo
194 194
             </div>
195 195
         </li>
196 196
         <?php
197
-    }
197
+	}
198 198
 
199
-    /**
200
-     * Output the message that tells the user they have
201
-     * no active courses.
202
-     *
203
-     * @since 1.9.0
204
-     */
205
-    public function active_no_course_message_output(){
206
-        ?>
199
+	/**
200
+	 * Output the message that tells the user they have
201
+	 * no active courses.
202
+	 *
203
+	 * @since 1.9.0
204
+	 */
205
+	public function active_no_course_message_output(){
206
+		?>
207 207
 
208 208
         <li class="user-active">
209 209
             <div class="sensei-message info">
@@ -219,141 +219,141 @@  discard block
 block discarded – undo
219 219
             </div>
220 220
         </li>
221 221
         <?php
222
-    }
222
+	}
223 223
 
224
-    /**
225
-     * Rendering the shortcode this class is responsible for.
226
-     *
227
-     * @return string $content
228
-     */
229
-    public function render(){
224
+	/**
225
+	 * Rendering the shortcode this class is responsible for.
226
+	 *
227
+	 * @return string $content
228
+	 */
229
+	public function render(){
230 230
 
231
-        global $wp_query;
231
+		global $wp_query;
232 232
 
233
-        if(!  is_user_logged_in() ) {
234
-            return '';
235
-        }
233
+		if(!  is_user_logged_in() ) {
234
+			return '';
235
+		}
236 236
 
237
-        // keep a reference to old query
238
-        $current_global_query = $wp_query;
237
+		// keep a reference to old query
238
+		$current_global_query = $wp_query;
239 239
 
240
-        // assign the query setup in $this-> setup_course_query
241
-        $wp_query = $this->query;
240
+		// assign the query setup in $this-> setup_course_query
241
+		$wp_query = $this->query;
242 242
 
243
-        $this->attach_shortcode_hooks();
243
+		$this->attach_shortcode_hooks();
244 244
 
245
-        ob_start();
246
-        echo '<section id="sensei-user-courses">';
247
-        Sensei_Messages::the_my_messages_link();
248
-        Sensei_Templates::get_template('loop-course.php');
249
-        Sensei_Templates::get_template('globals/pagination.php');
250
-        echo '</section>';
245
+		ob_start();
246
+		echo '<section id="sensei-user-courses">';
247
+		Sensei_Messages::the_my_messages_link();
248
+		Sensei_Templates::get_template('loop-course.php');
249
+		Sensei_Templates::get_template('globals/pagination.php');
250
+		echo '</section>';
251 251
 
252
-        $shortcode_output =  ob_get_clean();
252
+		$shortcode_output =  ob_get_clean();
253 253
 
254
-        $this->detach_shortcode_hooks();
254
+		$this->detach_shortcode_hooks();
255 255
 
256
-        //restore old query
257
-        $wp_query = $current_global_query;
256
+		//restore old query
257
+		$wp_query = $current_global_query;
258 258
 
259
-        return $shortcode_output;
259
+		return $shortcode_output;
260 260
 
261
-    }// end render
261
+	}// end render
262 262
 
263
-    /**
264
-     * Add hooks for the shortcode
265
-     *
266
-     * @since 1.9.0
267
-     */
268
-    public function attach_shortcode_hooks(){
263
+	/**
264
+	 * Add hooks for the shortcode
265
+	 *
266
+	 * @since 1.9.0
267
+	 */
268
+	public function attach_shortcode_hooks(){
269 269
 
270
-        // attach the toggle functionality
271
-        // don't show the toggle action if the user specified complete or active for this shortcode
272
-        if( ! in_array( $this->status, array( 'active', 'complete' ) ) ){
270
+		// attach the toggle functionality
271
+		// don't show the toggle action if the user specified complete or active for this shortcode
272
+		if( ! in_array( $this->status, array( 'active', 'complete' ) ) ){
273 273
 
274
-            add_action( 'sensei_loop_course_before', array( $this, 'course_toggle_actions' ) );
275
-            add_action( 'wp_footer', array( $this, 'print_course_toggle_actions_inline_script' ), 90 );
274
+			add_action( 'sensei_loop_course_before', array( $this, 'course_toggle_actions' ) );
275
+			add_action( 'wp_footer', array( $this, 'print_course_toggle_actions_inline_script' ), 90 );
276 276
 
277
-        }
277
+		}
278 278
 
279
-        // add extra classes to distinguish the course based on user completed or active
280
-        add_filter( 'sensei_course_loop_content_class', array( $this, 'course_status_class_tagging' ), 20, 2 );
279
+		// add extra classes to distinguish the course based on user completed or active
280
+		add_filter( 'sensei_course_loop_content_class', array( $this, 'course_status_class_tagging' ), 20, 2 );
281 281
 
282
-        // attach progress meter below course
283
-        add_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_progress' ) );
284
-        add_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_buttons' ) );
282
+		// attach progress meter below course
283
+		add_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_progress' ) );
284
+		add_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_buttons' ) );
285 285
 
286
-    }
286
+	}
287 287
 
288
-    /**
289
-     * Remove hooks for the shortcode
290
-     *
291
-     * @since 1.9.0
292
-     */
293
-    public function detach_shortcode_hooks(){
288
+	/**
289
+	 * Remove hooks for the shortcode
290
+	 *
291
+	 * @since 1.9.0
292
+	 */
293
+	public function detach_shortcode_hooks(){
294 294
 
295
-        //remove all hooks after the output is generated
296
-        remove_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_progress' ) );
297
-        remove_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_buttons' ) );
298
-        remove_filter( 'sensei_course_loop_content_class', array( $this, 'course_status_class_tagging' ), 20, 2 );
299
-        remove_action( 'sensei_loop_course_before', array( $this, 'course_toggle_actions' ) );
300
-    }
295
+		//remove all hooks after the output is generated
296
+		remove_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_progress' ) );
297
+		remove_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_buttons' ) );
298
+		remove_filter( 'sensei_course_loop_content_class', array( $this, 'course_status_class_tagging' ), 20, 2 );
299
+		remove_action( 'sensei_loop_course_before', array( $this, 'course_toggle_actions' ) );
300
+	}
301 301
 
302
-    /**
303
-     * Hooks into sensei_course_content_inside_after
304
-     *
305
-     * @param $course
306
-     */
307
-    public function attach_course_progress( $course_id ){
302
+	/**
303
+	 * Hooks into sensei_course_content_inside_after
304
+	 *
305
+	 * @param $course
306
+	 */
307
+	public function attach_course_progress( $course_id ){
308 308
 
309
-        $percentage = Sensei()->course->get_completion_percentage( $course_id, get_current_user_id() );
310
-        echo Sensei()->course->get_progress_meter( $percentage );
309
+		$percentage = Sensei()->course->get_completion_percentage( $course_id, get_current_user_id() );
310
+		echo Sensei()->course->get_progress_meter( $percentage );
311 311
 
312
-    }// attach_course_progress
312
+	}// attach_course_progress
313 313
 
314 314
 
315
-    /**
316
-     * Hooked into sensei_course_content_inside_after
317
-     *
318
-     * Prints out the course action buttons
319
-     *
320
-     * @param integer $course_id
321
-     */
322
-    public function attach_course_buttons( $course_id ){
315
+	/**
316
+	 * Hooked into sensei_course_content_inside_after
317
+	 *
318
+	 * Prints out the course action buttons
319
+	 *
320
+	 * @param integer $course_id
321
+	 */
322
+	public function attach_course_buttons( $course_id ){
323 323
 
324
-        Sensei()->course->the_course_action_buttons( get_post( $course_id ) );
324
+		Sensei()->course->the_course_action_buttons( get_post( $course_id ) );
325 325
 
326
-    }// attach_course_buttons
326
+	}// attach_course_buttons
327 327
 
328
-    /**
329
-     * Add a the user status class for the given course.
330
-     *
331
-     * @since 1.9
332
-     *
333
-     * @param array $classes
334
-     * @param WP_Post $course
335
-     * @return array $classes
336
-     */
337
-    public function course_status_class_tagging($classes, $course){
328
+	/**
329
+	 * Add a the user status class for the given course.
330
+	 *
331
+	 * @since 1.9
332
+	 *
333
+	 * @param array $classes
334
+	 * @param WP_Post $course
335
+	 * @return array $classes
336
+	 */
337
+	public function course_status_class_tagging($classes, $course){
338 338
 
339
-        if ( Sensei_Utils::user_completed_course( $course, get_current_user_id() ) ) {
339
+		if ( Sensei_Utils::user_completed_course( $course, get_current_user_id() ) ) {
340 340
 
341
-            $classes[] = 'user-completed';
341
+			$classes[] = 'user-completed';
342 342
 
343
-        } else {
343
+		} else {
344 344
 
345
-            $classes[] = 'user-active';
345
+			$classes[] = 'user-active';
346 346
 
347
-        }
347
+		}
348 348
 
349
-        return $classes;
349
+		return $classes;
350 350
 
351
-    }// end course_status_class_tagging
351
+	}// end course_status_class_tagging
352 352
 
353
-    /**
354
-     * Output the course toggle functionality
355
-     */
356
-    public function course_toggle_actions(){ ?>
353
+	/**
354
+	 * Output the course toggle functionality
355
+	 */
356
+	public function course_toggle_actions(){ ?>
357 357
 
358 358
         <section id="user-course-status-toggle">
359 359
             <a id="sensei-user-courses-active-action" href=""><?php _e('Active Courses'); ?></a>
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
 
364 364
     <?php }
365 365
 
366
-    /**
367
-     * Load the javascript for the toggle functionality
368
-     *
369
-     * @since 1.9.0
370
-     */
371
-    function print_course_toggle_actions_inline_script() { ?>
366
+	/**
367
+	 * Load the javascript for the toggle functionality
368
+	 *
369
+	 * @since 1.9.0
370
+	 */
371
+	function print_course_toggle_actions_inline_script() { ?>
372 372
 
373 373
         <script type="text/javascript">
374 374
             var buttonContainer = jQuery('#user-course-status-toggle');
Please login to merge, or discard this patch.
includes/class-sensei-settings.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -19,63 +19,63 @@  discard block
 block discarded – undo
19 19
 	 * @since 1.0.0
20 20
 	 */
21 21
 	public function __construct () {
22
-	    parent::__construct(); // Required in extended classes.
22
+		parent::__construct(); // Required in extended classes.
23 23
 
24
-        $this->token = 'woothemes-sensei-settings';
25
-        add_action('init', array( __CLASS__, 'flush_rewrite_rules' ) );
24
+		$this->token = 'woothemes-sensei-settings';
25
+		add_action('init', array( __CLASS__, 'flush_rewrite_rules' ) );
26 26
 
27
-        // Setup Admin Settings data
28
-        if ( is_admin() ) {
27
+		// Setup Admin Settings data
28
+		if ( is_admin() ) {
29 29
 
30
-            $this->has_tabs 	= true;
31
-            $this->name 		= __( 'Sensei Settings', 'woothemes-sensei' );
32
-            $this->menu_label	= __( 'Settings', 'woothemes-sensei' );
33
-            $this->page_slug	= 'woothemes-sensei-settings';
30
+			$this->has_tabs 	= true;
31
+			$this->name 		= __( 'Sensei Settings', 'woothemes-sensei' );
32
+			$this->menu_label	= __( 'Settings', 'woothemes-sensei' );
33
+			$this->page_slug	= 'woothemes-sensei-settings';
34 34
 
35
-        } // End If Statement
35
+		} // End If Statement
36 36
 
37
-        $this->register_hook_listener();
38
-        $this->get_settings();
37
+		$this->register_hook_listener();
38
+		$this->get_settings();
39 39
 
40 40
 	} // End __construct()
41 41
 
42
-    /**
43
-     * Get settings value
44
-     *
45
-     * @since 1.9.0
46
-     * @param string $setting_name
47
-     * @return mixed
48
-     */
49
-    public function get( $setting_name ){
42
+	/**
43
+	 * Get settings value
44
+	 *
45
+	 * @since 1.9.0
46
+	 * @param string $setting_name
47
+	 * @return mixed
48
+	 */
49
+	public function get( $setting_name ){
50 50
 
51
-        if( isset( $this->settings[ $setting_name ] ) ){
51
+		if( isset( $this->settings[ $setting_name ] ) ){
52 52
 
53
-            return $this->settings[ $setting_name ];
53
+			return $this->settings[ $setting_name ];
54 54
 
55
-        }
55
+		}
56 56
 
57
-        return false;
58
-    }
57
+		return false;
58
+	}
59 59
 
60
-    /**
61
-     * @since 1.9.0
62
-     *
63
-     * @param $setting
64
-     * @param $new_value
65
-     */
66
-    public function set( $setting, $new_value ){
60
+	/**
61
+	 * @since 1.9.0
62
+	 *
63
+	 * @param $setting
64
+	 * @param $new_value
65
+	 */
66
+	public function set( $setting, $new_value ){
67 67
 
68
-        $settings = get_option( $this->token, array() );
68
+		$settings = get_option( $this->token, array() );
69 69
 
70
-        if( isset(  $settings[ $setting ] ) ){
70
+		if( isset(  $settings[ $setting ] ) ){
71 71
 
72
-            $settings[ $setting ] = $new_value;
73
-            return update_option( $this->token,$settings );
72
+			$settings[ $setting ] = $new_value;
73
+			return update_option( $this->token,$settings );
74 74
 
75
-        }
76
-        return false;
75
+		}
76
+		return false;
77 77
 
78
-    }
78
+	}
79 79
 
80 80
 	/**
81 81
 	 * Register the settings screen within the WordPress admin.
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		$complete_settings = array( 'passed' => __( 'Once all the course lessons have been completed', 'woothemes-sensei' ), 'complete' => __( 'At any time (by clicking the \'Complete Course\' button)', 'woothemes-sensei' ) );
164 164
 		$course_display_settings = array( 'excerpt' => __( 'Course Excerpt', 'woothemes-sensei' ), 'full' => __( 'Full Course Content', 'woothemes-sensei' ) );
165 165
 
166
-	    $fields = array();
166
+		$fields = array();
167 167
 
168 168
 		$fields['access_permission'] = array(
169 169
 								'name' => __( 'Access Permissions', 'woothemes-sensei' ),
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 								'section' => 'default-settings'
226 226
 								);
227 227
 
228
-    	// Course Settings
228
+		// Course Settings
229 229
 
230
-    	$fields['course_completion'] = array(
230
+		$fields['course_completion'] = array(
231 231
 								'name' => __( 'Courses are complete:', 'woothemes-sensei' ),
232 232
 								'description' => __( 'This will determine when courses are marked as complete.', 'woothemes-sensei' ),
233 233
 								'type' => 'select',
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 								'options' => $complete_settings
238 238
 								);
239 239
 
240
-    	$fields['course_author'] = array(
240
+		$fields['course_author'] = array(
241 241
 								'name' => __( 'Display Course Author', 'woothemes-sensei' ),
242 242
 								'description' => __( 'Output the Course Author on Course archive and My Courses page.', 'woothemes-sensei' ),
243 243
 								'type' => 'checkbox',
@@ -465,10 +465,10 @@  discard block
 block discarded – undo
465 465
 		);
466 466
 
467 467
 		$teacher_email_options = array(
468
-            'teacher-started-course' => __( 'A learner starts their course', 'woothemes-sensei' ),
469
-            'teacher-completed-course' => __( 'A learner completes their course', 'woothemes-sensei' ),
470
-            'teacher-completed-lesson' => __( 'A learner completes a lesson', 'woothemes-sensei' ),
471
-            'teacher-quiz-submitted' => __( 'A learner submits a quiz for grading', 'woothemes-sensei' ),
468
+			'teacher-started-course' => __( 'A learner starts their course', 'woothemes-sensei' ),
469
+			'teacher-completed-course' => __( 'A learner completes their course', 'woothemes-sensei' ),
470
+			'teacher-completed-lesson' => __( 'A learner completes a lesson', 'woothemes-sensei' ),
471
+			'teacher-quiz-submitted' => __( 'A learner submits a quiz for grading', 'woothemes-sensei' ),
472 472
 			'teacher-new-message' => __( 'A learner sends a private message to a teacher', 'woothemes-sensei' ),
473 473
 		);
474 474
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 
578 578
 		if ( Sensei_WC::is_woocommerce_present() ) {
579 579
 			// WooCommerce Settings
580
-    		$fields['woocommerce_enabled'] = array(
580
+			$fields['woocommerce_enabled'] = array(
581 581
 									'name' => __( 'Enable WooCommerce Courses', 'woothemes-sensei' ),
582 582
 									'description' => __( 'Use WooCommerce to sell Courses by linking a Product to a Course.', 'woothemes-sensei' ),
583 583
 									'type' => 'checkbox',
@@ -665,14 +665,14 @@  discard block
 block discarded – undo
665 665
 		$page_items[] = __( 'Select a Page:', 'woothemes-sensei' );
666 666
 
667 667
 		foreach ( $pages_split as $k => $v ) {
668
-		    $id = '';
669
-		    // Get the ID value.
670
-		    preg_match( '/value="(.*?)"/i', $v, $matches );
671
-
672
-		    if ( isset( $matches[1] ) ) {
673
-		        $id = $matches[1];
674
-		        $page_items[$id] = trim( strip_tags( $v ) );
675
-		    } // End If Statement
668
+			$id = '';
669
+			// Get the ID value.
670
+			preg_match( '/value="(.*?)"/i', $v, $matches );
671
+
672
+			if ( isset( $matches[1] ) ) {
673
+				$id = $matches[1];
674
+				$page_items[$id] = trim( strip_tags( $v ) );
675
+			} // End If Statement
676 676
 		} // End For Loop
677 677
 
678 678
 		$pages_array = $page_items;
@@ -689,22 +689,22 @@  discard block
 block discarded – undo
689 689
 		Sensei_Language_Pack_Manager::messages();
690 690
 	}
691 691
 
692
-    /**
693
-     * Flush the rewrite rules after the settings have been updated.
694
-     * This is to ensure that the
695
-     *
696
-     * @since 1.9.0
697
-     */
698
-    public static function flush_rewrite_rules(){
692
+	/**
693
+	 * Flush the rewrite rules after the settings have been updated.
694
+	 * This is to ensure that the
695
+	 *
696
+	 * @since 1.9.0
697
+	 */
698
+	public static function flush_rewrite_rules(){
699 699
 
700
-        if ( isset( $_POST[ 'option_page' ] ) && 'woothemes-sensei-settings' == $_POST[ 'option_page' ]
701
-            && isset( $_POST[ 'action' ] ) && 'update' == $_POST[ 'action' ] ) {
700
+		if ( isset( $_POST[ 'option_page' ] ) && 'woothemes-sensei-settings' == $_POST[ 'option_page' ]
701
+			&& isset( $_POST[ 'action' ] ) && 'update' == $_POST[ 'action' ] ) {
702 702
 
703
-            Sensei()->initiate_rewrite_rules_flush();
703
+			Sensei()->initiate_rewrite_rules_flush();
704 704
 
705
-        }
705
+		}
706 706
 
707
-    }//end  flush_cache
707
+	}//end  flush_cache
708 708
 } // End Class
709 709
 
710 710
 /**
Please login to merge, or discard this patch.
includes/class-sensei-analysis-overview-list-table.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
 			'order' => $order,
160 160
 		);
161 161
 
162
-        // Handle search
163
-        if ( isset( $_GET['s'] ) && !empty( $_GET['s'] ) ) {
164
-            $args['search'] = esc_html( $_GET['s'] );
165
-        }
162
+		// Handle search
163
+		if ( isset( $_GET['s'] ) && !empty( $_GET['s'] ) ) {
164
+			$args['search'] = esc_html( $_GET['s'] );
165
+		}
166 166
 
167 167
 		switch ( $this->type ) {
168 168
 			case 'courses':
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 		);
220 220
 
221 221
 
222
-        // Handle search
223
-        if ( isset( $_GET['s'] ) && !empty( $_GET['s'] ) ) {
224
-            $args['search'] = esc_html( $_GET['s'] );
225
-        }
222
+		// Handle search
223
+		if ( isset( $_GET['s'] ) && !empty( $_GET['s'] ) ) {
224
+			$args['search'] = esc_html( $_GET['s'] );
225
+		}
226 226
 
227 227
 
228 228
 		// Start the csv with the column headings
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 * Generates the overall array for a single item in the display
261 261
 	 * @since  1.7.0
262 262
 	 * @param object $item The current item
263
-     * @return array $column_data;
263
+	 * @return array $column_data;
264 264
 	 */
265 265
 	protected function get_row_data( $item ) {
266 266
 
@@ -296,10 +296,10 @@  discard block
 block discarded – undo
296 296
 				$percent_count = count( Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_analysis_course_percentage', $grade_args, $item ), true ) );
297 297
 				$percent_total = Sensei_Grading::get_course_users_grades_sum( $item->ID );
298 298
 
299
-                $course_average_percent = 0;
300
-                if( $percent_count > 0 && $percent_total > 0 ){
301
-                    $course_average_percent = abs( round( doubleval( $percent_total / $percent_count ), 2 ) );
302
-                }
299
+				$course_average_percent = 0;
300
+				if( $percent_count > 0 && $percent_total > 0 ){
301
+					$course_average_percent = abs( round( doubleval( $percent_total / $percent_count ), 2 ) );
302
+				}
303 303
 
304 304
 
305 305
 				// Output course data
@@ -355,12 +355,12 @@  discard block
 block discarded – undo
355 355
 					$grade_count = count( Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_analysis_lesson_grades', $grade_args, $item ), true ));
356 356
 					$grade_total = Sensei_Grading::get_lessons_users_grades_sum( $item->ID );
357 357
 
358
-                    $lesson_average_grade = 0;
359
-                    if( $grade_total > 0 && $grade_count > 0 ){
360
-                        $lesson_average_grade = abs( round( doubleval( $grade_total / $grade_count ), 2 ) );
361
-                    }
358
+					$lesson_average_grade = 0;
359
+					if( $grade_total > 0 && $grade_count > 0 ){
360
+						$lesson_average_grade = abs( round( doubleval( $grade_total / $grade_count ), 2 ) );
361
+					}
362 362
 
363
-                }
363
+				}
364 364
 				// Output lesson data
365 365
 				if ( $this->csv_output ) {
366 366
 					$lesson_title = apply_filters( 'the_title', $item->post_title, $item->ID );
@@ -417,15 +417,15 @@  discard block
 block discarded – undo
417 417
 				$grade_count = count( Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_analysis_user_lesson_grades', $grade_args, $item ), true ));
418 418
 				$grade_total = Sensei_Grading::get_user_graded_lessons_sum( $item->ID );
419 419
 
420
-                $user_average_grade = 0;
421
-                if( $grade_total > 0 && $grade_count > 0 ){
422
-                    $user_average_grade = abs( round( doubleval( $grade_total / $grade_count ), 2 ) );
423
-                }
420
+				$user_average_grade = 0;
421
+				if( $grade_total > 0 && $grade_count > 0 ){
422
+					$user_average_grade = abs( round( doubleval( $grade_total / $grade_count ), 2 ) );
423
+				}
424 424
 
425 425
 				// Output the users data
426 426
 				if ( $this->csv_output ) {
427
-                    $user_name = Sensei_Learner::get_full_name( $item->ID );
428
-                }
427
+					$user_name = Sensei_Learner::get_full_name( $item->ID );
428
+				}
429 429
 				else {
430 430
 					$url = add_query_arg( array( 'page' => $this->page_slug, 'user_id' => $item->ID ), admin_url( 'admin.php' ) );
431 431
 					$user_name = '<strong><a class="row-title" href="' . esc_url( $url ) . '">' . $item->display_name . '</a></strong>';
@@ -519,17 +519,17 @@  discard block
 block discarded – undo
519 519
 		// This stops the full meta data of each user being loaded
520 520
 		$args['fields'] = array( 'ID', 'user_login', 'user_email', 'user_registered', 'display_name' );
521 521
 
522
-        /**
523
-         * Filter the WP_User_Query arguments
524
-         * @since 1.6.0
525
-         * @param $args
526
-         */
527
-        $args = apply_filters( 'sensei_analysis_overview_filter_users', $args );
522
+		/**
523
+		 * Filter the WP_User_Query arguments
524
+		 * @since 1.6.0
525
+		 * @param $args
526
+		 */
527
+		$args = apply_filters( 'sensei_analysis_overview_filter_users', $args );
528 528
 		$wp_user_search = new WP_User_Query( $args );
529
-        $learners = $wp_user_search->get_results();
529
+		$learners = $wp_user_search->get_results();
530 530
 		$this->total_items = $wp_user_search->get_total();
531 531
 
532
-        return $learners;
532
+		return $learners;
533 533
 
534 534
 	} // End get_learners()
535 535
 
@@ -546,15 +546,15 @@  discard block
 block discarded – undo
546 546
 		$total_courses = Sensei()->course->course_count( array('publish', 'private') );
547 547
 		$total_lessons = Sensei()->lesson->lesson_count( array('publish', 'private') );
548 548
 
549
-        /**
550
-         * filter the analysis tot grades query args
551
-         */
549
+		/**
550
+		 * filter the analysis tot grades query args
551
+		 */
552 552
 		$grade_args = apply_filters( 'sensei_analysis_total_quiz_grades', array(
553 553
 				'type' => 'sensei_lesson_status',
554 554
 				'status' => 'any',
555 555
 
556
-                'meta_key' => 'grade'
557
-        ));
556
+				'meta_key' => 'grade'
557
+		));
558 558
 
559 559
 		$total_grade_count = Sensei_Grading::get_graded_lessons_count();
560 560
 		$total_grade_total = Sensei_Grading::get_graded_lessons_sum();
Please login to merge, or discard this patch.
templates/course-results.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * The Template for displaying course archives, including the course page template.
4
- *
5
- * Override this template by copying it to yourtheme/sensei/archive-course.php
6
- *
7
- * @author 		Automattic
8
- * @package 	Sensei
9
- * @category    Templates
10
- * @version     1.9.0
11
- */
3
+		 * The Template for displaying course archives, including the course page template.
4
+		 *
5
+		 * Override this template by copying it to yourtheme/sensei/archive-course.php
6
+		 *
7
+		 * @author 		Automattic
8
+		 * @package 	Sensei
9
+		 * @category    Templates
10
+		 * @version     1.9.0
11
+		 */
12 12
 ?>
13 13
 
14 14
 <?php  get_sensei_header();  ?>
15 15
 
16 16
 <?php
17 17
 /**
18
- * This hook fire inside learner-profile.php before the content
19
- *
20
- * @since 1.9.0
21
- *
22
- * @hooked Sensei_Course_Results::deprecate_sensei_course_results_content_hook() - 20
23
- */
18
+		 * This hook fire inside learner-profile.php before the content
19
+		 *
20
+		 * @since 1.9.0
21
+		 *
22
+		 * @hooked Sensei_Course_Results::deprecate_sensei_course_results_content_hook() - 20
23
+		 */
24 24
 do_action( 'sensei_course_results_content_before' );
25 25
 ?>
26 26
 
@@ -34,16 +34,16 @@  discard block
 block discarded – undo
34 34
     <section class="entry fix">
35 35
 
36 36
         <?php
37
-        /**
38
-         * This hook fire inside learner-profile.php inside directly before the content
39
-         *
40
-         * @since 1.9.0
41
-         *
42
-         * @param integer $course_id
43
-         *
44
-         */
45
-        do_action( 'sensei_course_results_content_inside_before', $course->ID );
46
-        ?>
37
+		/**
38
+		 * This hook fire inside learner-profile.php inside directly before the content
39
+		 *
40
+		 * @since 1.9.0
41
+		 *
42
+		 * @param integer $course_id
43
+		 *
44
+		 */
45
+		do_action( 'sensei_course_results_content_inside_before', $course->ID );
46
+		?>
47 47
 
48 48
         <header>
49 49
 
@@ -56,44 +56,44 @@  discard block
 block discarded – undo
56 56
         <?php if ( is_user_logged_in() ):?>
57 57
 
58 58
             <?php
59
-            /**
60
-             * This hook fire inside learner-profile.php inside directly before the content
61
-             *
62
-             * @since 1.9.0
63
-             *
64
-             * @param integer $course_id
65
-             *
66
-             * @hooked Sensei_Course_Results::course_info() - 20
67
-             */
68
-            do_action( 'sensei_course_results_content_inside_before_lessons', $course->ID );
69
-            ?>
59
+			/**
60
+			 * This hook fire inside learner-profile.php inside directly before the content
61
+			 *
62
+			 * @since 1.9.0
63
+			 *
64
+			 * @param integer $course_id
65
+			 *
66
+			 * @hooked Sensei_Course_Results::course_info() - 20
67
+			 */
68
+			do_action( 'sensei_course_results_content_inside_before_lessons', $course->ID );
69
+			?>
70 70
 
71 71
 
72 72
             <section class="course-results-lessons">
73 73
                 <?php
74
-                $started_course = Sensei_Utils::user_started_course( $course->ID, get_current_user_id() );
75
-                if( $started_course ) {
74
+				$started_course = Sensei_Utils::user_started_course( $course->ID, get_current_user_id() );
75
+				if( $started_course ) {
76 76
 
77
-                    sensei_the_course_results_lessons();
77
+					sensei_the_course_results_lessons();
78 78
 
79
-                }
80
-                ?>
79
+				}
80
+				?>
81 81
             </section>
82 82
 
83 83
         <?php endif; ?>
84 84
 
85 85
         <?php
86
-        /**
87
-         * This hook fire inside learner-profile.php inside directly after the content
88
-         *
89
-         * @since 1.9.0
90
-         *
91
-         * @param integer $course_id
92
-         *
93
-         * @hooked Sensei()->course_results->course_info - 20
94
-         */
95
-        do_action( 'sensei_course_results_content_inside_after', $course->ID );
96
-        ?>
86
+		/**
87
+		 * This hook fire inside learner-profile.php inside directly after the content
88
+		 *
89
+		 * @since 1.9.0
90
+		 *
91
+		 * @param integer $course_id
92
+		 *
93
+		 * @hooked Sensei()->course_results->course_info - 20
94
+		 */
95
+		do_action( 'sensei_course_results_content_inside_after', $course->ID );
96
+		?>
97 97
 
98 98
     </section>
99 99
 
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 
102 102
 <?php
103 103
 /**
104
- * This hook fire inside course-results.php before the content
105
- *
106
- * @since 1.9.0
107
- *
108
- */
104
+		 * This hook fire inside course-results.php before the content
105
+		 *
106
+		 * @since 1.9.0
107
+		 *
108
+		 */
109 109
 do_action( 'sensei_course_results_content_after' );
110 110
 ?>
111 111
 
Please login to merge, or discard this patch.
includes/theme-integrations/_s.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,42 +1,42 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Class Sensei__S
4
- *
5
- * Responsible for wrapping for the underscores theme
6
- * with the correct markup
7
- *
8
- *
9
- * @package Views
10
- * @subpackage Theme-Integration
11
- * @author Automattic
12
- *
13
- * @since 1.9.0
3
+	 * Class Sensei__S
4
+	 *
5
+	 * Responsible for wrapping for the underscores theme
6
+	 * with the correct markup
7
+	 *
8
+	 *
9
+	 * @package Views
10
+	 * @subpackage Theme-Integration
11
+	 * @author Automattic
12
+	 *
13
+	 * @since 1.9.0
14 14
 */
15 15
 Class Sensei__S {
16 16
 
17
-    /**
18
-     * Output opening wrappers
19
-     * @since 1.9.0
20
-     */
21
-    public function wrapper_start(){ ?>
17
+	/**
18
+	 * Output opening wrappers
19
+	 * @since 1.9.0
20
+	 */
21
+	public function wrapper_start(){ ?>
22 22
         <div id="primary" class="content-area">
23 23
             <main id="main" class="site-main" role="main">
24 24
 
25 25
     <?php }
26 26
 
27
-    /**
28
-     * Output closing wrappers
29
-     *
30
-     * @since 1.9.0
31
-     */
32
-    public function wrapper_end(){ ?>
27
+	/**
28
+	 * Output closing wrappers
29
+	 *
30
+	 * @since 1.9.0
31
+	 */
32
+	public function wrapper_end(){ ?>
33 33
 
34 34
             </main> <!-- main-site -->
35 35
           </div> <!-- content-area -->
36 36
 
37 37
 	    <?php
38 38
 
39
-        get_sidebar();
39
+		get_sidebar();
40 40
 
41
-    }
41
+	}
42 42
 } // end class
Please login to merge, or discard this patch.
includes/class-sensei-admin.php 1 patch
Indentation   +251 added lines, -251 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
 	 */
17 17
 	public function __construct () {
18 18
 
19
-        //register admin styles
19
+		//register admin styles
20 20
 		add_action( 'admin_enqueue_scripts', array( $this, 'admin_styles_global' ) );
21 21
 
22
-        //register admin scripts
23
-        add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts' ) );
22
+		//register admin scripts
23
+		add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts' ) );
24 24
 
25 25
 		add_action( 'admin_print_styles', array( $this, 'admin_notices_styles' ) );
26 26
 		add_action( 'settings_before_form', array( $this, 'install_pages_output' ) );
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		add_action( 'admin_head', array( $this, 'admin_menu_highlight' ) );
30 30
 		add_action( 'admin_init', array( $this, 'page_redirect' ) );
31 31
 		add_action( 'admin_init', array( $this, 'sensei_add_custom_menu_items' ) );
32
-        add_action( 'admin_init', array( __CLASS__, 'install_pages' ));
32
+		add_action( 'admin_init', array( __CLASS__, 'install_pages' ));
33 33
 
34 34
 		// Duplicate lesson & courses
35 35
 		add_filter( 'post_row_actions', array( $this, 'duplicate_action_link' ), 10, 2 );
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
 		if( $menu_cap ) {
82 82
 			$menu[] = array( '', 'read', 'separator-sensei', '', 'wp-menu-separator sensei' );
83
-            add_menu_page( 'Sensei', 'Sensei', $menu_cap, 'sensei' , array( Sensei()->analysis, 'analysis_page' ) , '', '50' );
83
+			add_menu_page( 'Sensei', 'Sensei', $menu_cap, 'sensei' , array( Sensei()->analysis, 'analysis_page' ) , '', '50' );
84 84
 		}
85 85
 
86 86
 		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' ) );
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 
129 129
 		$screen = get_current_screen();
130 130
 
131
-        if( empty( $screen ) ){
132
-            return;
133
-        }
131
+		if( empty( $screen ) ){
132
+			return;
133
+		}
134 134
 
135 135
 		if ( $screen->base == 'post' && $post_type == 'course' ) {
136 136
 
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
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
-            $submenu_file = 'edit-tags.php?taxonomy=module';
147
-            $parent_file  = 'edit.php?post_type=course';
146
+			$submenu_file = 'edit-tags.php?taxonomy=module';
147
+			$parent_file  = 'edit.php?post_type=course';
148 148
 
149 149
 		} elseif ( in_array( $screen->id, array( 'sensei_message', 'edit-sensei_message' ) ) ) {
150 150
 
151
-            $submenu_file = 'edit.php?post_type=sensei_message';
151
+			$submenu_file = 'edit.php?post_type=sensei_message';
152 152
 			$parent_file  = 'sensei';
153 153
 
154 154
 		}
@@ -176,9 +176,9 @@  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 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>
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
             </div>
187 187
             <?php
188 188
 
189
-        }
189
+		}
190 190
 
191 191
 	} // End install_pages_output()
192 192
 
@@ -205,25 +205,25 @@  discard block
 block discarded – undo
205 205
 	function create_page( $slug, $page_title = '', $page_content = '', $post_parent = 0 ) {
206 206
 		global $wpdb;
207 207
 
208
-        $page_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", $slug ) );
208
+		$page_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", $slug ) );
209 209
 		if ( $page_id ) :
210 210
 			return $page_id;
211 211
 		endif;
212 212
 
213 213
 		$page_data = array(
214
-	        'post_status' 		=> 'publish',
215
-	        'post_type' 		=> 'page',
216
-	        'post_author' 		=> 1,
217
-	        'post_name' 		=> $slug,
218
-	        'post_title' 		=> $page_title,
219
-	        'post_content' 		=> $page_content,
220
-	        'post_parent' 		=> $post_parent,
221
-	        'comment_status' 	=> 'closed'
222
-	    );
214
+			'post_status' 		=> 'publish',
215
+			'post_type' 		=> 'page',
216
+			'post_author' 		=> 1,
217
+			'post_name' 		=> $slug,
218
+			'post_title' 		=> $page_title,
219
+			'post_content' 		=> $page_content,
220
+			'post_parent' 		=> $post_parent,
221
+			'comment_status' 	=> 'closed'
222
+		);
223 223
 
224
-	    $page_id = wp_insert_post( $page_data );
224
+		$page_id = wp_insert_post( $page_data );
225 225
 
226
-	    return $page_id;
226
+		return $page_id;
227 227
 
228 228
 	} // End create_page()
229 229
 
@@ -237,12 +237,12 @@  discard block
 block discarded – undo
237 237
 	function create_pages() {
238 238
 
239 239
 		// Courses page
240
-	    $new_course_page_id = $this->create_page( esc_sql( _x('courses-overview', 'page_slug', 'woothemes-sensei') ),  __('Courses', 'woothemes-sensei'), '' );
241
-        Sensei()->settings->set( 'course_page', $new_course_page_id );
240
+		$new_course_page_id = $this->create_page( esc_sql( _x('courses-overview', 'page_slug', 'woothemes-sensei') ),  __('Courses', 'woothemes-sensei'), '' );
241
+		Sensei()->settings->set( 'course_page', $new_course_page_id );
242 242
 
243
-        // User Dashboard page
244
-	    $new_my_course_page_id = $this->create_page( esc_sql( _x('my-courses', 'page_slug', 'woothemes-sensei') ), __('My Courses', 'woothemes-sensei'), '[sensei_user_courses]' );
245
-        Sensei()->settings->set( 'my_course_page',$new_my_course_page_id  );
243
+		// User Dashboard page
244
+		$new_my_course_page_id = $this->create_page( esc_sql( _x('my-courses', 'page_slug', 'woothemes-sensei') ), __('My Courses', 'woothemes-sensei'), '[sensei_user_courses]' );
245
+		Sensei()->settings->set( 'my_course_page',$new_my_course_page_id  );
246 246
 
247 247
 	} // End create_pages()
248 248
 
@@ -263,8 +263,8 @@  discard block
 block discarded – undo
263 263
 		wp_register_style( 'woothemes-sensei-global', Sensei()->plugin_url . 'assets/css/global.css', '', Sensei()->version, 'screen' );
264 264
 		wp_enqueue_style( 'woothemes-sensei-global' );
265 265
 
266
-        // Select 2 styles
267
-        wp_enqueue_style( 'sensei-core-select2', Sensei()->plugin_url . 'assets/css/select2/select2.css', '', Sensei()->version, 'screen' );
266
+		// Select 2 styles
267
+		wp_enqueue_style( 'sensei-core-select2', Sensei()->plugin_url . 'assets/css/select2/select2.css', '', Sensei()->version, 'screen' );
268 268
 
269 269
 		// Test for Write Panel Pages
270 270
 		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,32 +277,32 @@  discard block
 block discarded – undo
277 277
 	} // End admin_styles_global()
278 278
 
279 279
 
280
-    /**
281
-     * Globally register all scripts needed in admin.
282
-     *
283
-     * The script users should enqueue the script when needed.
284
-     *
285
-     * @since 1.8.2
286
-     * @access public
287
-     */
288
-    public function register_scripts( $hook ){
280
+	/**
281
+	 * Globally register all scripts needed in admin.
282
+	 *
283
+	 * The script users should enqueue the script when needed.
284
+	 *
285
+	 * @since 1.8.2
286
+	 * @access public
287
+	 */
288
+	public function register_scripts( $hook ){
289 289
 
290
-        $screen = get_current_screen();
290
+		$screen = get_current_screen();
291 291
 
292
-        // Allow developers to load non-minified versions of scripts
293
-        $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
292
+		// Allow developers to load non-minified versions of scripts
293
+		$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
294 294
 
295
-        // Select2 script used to enhance all select boxes
296
-        wp_register_script( 'sensei-core-select2', Sensei()->plugin_url . '/assets/js/select2/select2' . $suffix . '.js', array( 'jquery' ), Sensei()->version );
295
+		// Select2 script used to enhance all select boxes
296
+		wp_register_script( 'sensei-core-select2', Sensei()->plugin_url . '/assets/js/select2/select2' . $suffix . '.js', array( 'jquery' ), Sensei()->version );
297 297
 
298
-        // load edit module scripts
299
-        if( 'edit-module' ==  $screen->id ){
298
+		// load edit module scripts
299
+		if( 'edit-module' ==  $screen->id ){
300 300
 
301
-            wp_enqueue_script( 'sensei-chosen-ajax', Sensei()->plugin_url . 'assets/chosen/ajax-chosen.jquery.min.js', array( 'jquery', 'sensei-chosen' ), Sensei()->version, true );
301
+			wp_enqueue_script( 'sensei-chosen-ajax', Sensei()->plugin_url . 'assets/chosen/ajax-chosen.jquery.min.js', array( 'jquery', 'sensei-chosen' ), Sensei()->version, true );
302 302
 
303
-        }
303
+		}
304 304
 
305
-    }
305
+	}
306 306
 
307 307
 
308 308
 	/**
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 	 * @return void
313 313
 	 */
314 314
 	function admin_install_notice() {
315
-	    ?>
315
+		?>
316 316
 	    <div id="message" class="updated sensei-message sensei-connect">
317 317
 
318 318
             <p>
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 	 * @return void
348 348
 	 */
349 349
 	function admin_installed_notice() {
350
-	    ?>
350
+		?>
351 351
 	    <div id="message" class="updated sensei-message sensei-connect">
352 352
 
353 353
 	    	<p>
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
 	    </div>
376 376
 	    <?php
377 377
 
378
-	    // Set installed option
379
-	    update_option('sensei_installed', 0);
378
+		// Set installed option
379
+		update_option('sensei_installed', 0);
380 380
 	} // End admin_installed_notice()
381 381
 
382 382
 
@@ -408,21 +408,21 @@  discard block
 block discarded – undo
408 408
 	function admin_notices_styles() {
409 409
 
410 410
 		// Installed notices
411
-	    if ( 1 == get_option( 'sensei_installed' ) ) {
411
+		if ( 1 == get_option( 'sensei_installed' ) ) {
412 412
 
413
-	    	wp_enqueue_style( 'sensei-activation', plugins_url(  '/assets/css/activation.css', dirname( __FILE__ ) ), '', Sensei()->version );
413
+			wp_enqueue_style( 'sensei-activation', plugins_url(  '/assets/css/activation.css', dirname( __FILE__ ) ), '', Sensei()->version );
414 414
 
415
-	    	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'])) {
416
-	    		add_action( 'admin_notices', array( $this, 'admin_install_notice' ) );
417
-	    	} elseif ( !isset($_GET['page']) || $_GET['page']!='woothemes-sensei-settings' ) {
418
-	    		add_action( 'admin_notices', array( $this, 'admin_installed_notice' ) );
419
-	    	} // End If Statement
415
+			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'])) {
416
+				add_action( 'admin_notices', array( $this, 'admin_install_notice' ) );
417
+			} elseif ( !isset($_GET['page']) || $_GET['page']!='woothemes-sensei-settings' ) {
418
+				add_action( 'admin_notices', array( $this, 'admin_installed_notice' ) );
419
+			} // End If Statement
420 420
 
421
-	    } // End If Statement
421
+		} // End If Statement
422 422
 
423
-	    if ( Sensei_Language_Pack_Manager::has_language_pack_available() ) {
424
-	    	add_action( 'admin_notices', array( $this, 'language_pack_install_notice' ) );
425
-	    }
423
+		if ( Sensei_Language_Pack_Manager::has_language_pack_available() ) {
424
+			add_action( 'admin_notices', array( $this, 'language_pack_install_notice' ) );
425
+		}
426 426
 
427 427
 	} // End admin_notices_styles()
428 428
 
@@ -538,30 +538,30 @@  discard block
 block discarded – undo
538 538
 	 */
539 539
 	private function duplicate_lesson_quizzes( $old_lesson_id, $new_lesson_id ) {
540 540
 
541
-        $old_quiz_id = Sensei()->lesson->lesson_quizzes( $old_lesson_id );
542
-        $old_quiz_questions = Sensei()->lesson->lesson_quiz_questions( $old_quiz_id );
541
+		$old_quiz_id = Sensei()->lesson->lesson_quizzes( $old_lesson_id );
542
+		$old_quiz_questions = Sensei()->lesson->lesson_quiz_questions( $old_quiz_id );
543 543
 
544
-        // duplicate the generic wp post information
544
+		// duplicate the generic wp post information
545 545
 		$new_quiz = $this->duplicate_post( get_post( $old_quiz_id ), '' );
546 546
 
547 547
 		//update the new lesson data
548
-        add_post_meta( $new_lesson_id, '_lesson_quiz', $new_quiz->ID );
548
+		add_post_meta( $new_lesson_id, '_lesson_quiz', $new_quiz->ID );
549 549
 
550 550
 		//update the new quiz data
551
-        add_post_meta( $new_quiz->ID, '_quiz_lesson', $new_lesson_id );
552
-        wp_update_post(
553
-            array(
554
-                'ID' => $new_quiz->ID,
555
-                'post_parent' => $new_lesson_id
556
-            )
557
-        );
551
+		add_post_meta( $new_quiz->ID, '_quiz_lesson', $new_lesson_id );
552
+		wp_update_post(
553
+			array(
554
+				'ID' => $new_quiz->ID,
555
+				'post_parent' => $new_lesson_id
556
+			)
557
+		);
558 558
 
559 559
 		foreach( $old_quiz_questions as $question ) {
560 560
 
561 561
 			// copy the question order over to the new quiz
562 562
 			$old_question_order = get_post_meta( $question->ID, '_quiz_question_order'. $old_quiz_id, true );
563
-            $new_question_order = str_ireplace( $old_quiz_id, $new_quiz->ID , $old_question_order );
564
-            add_post_meta( $question->ID, '_quiz_question_order' . $new_quiz->ID, $new_question_order );
563
+			$new_question_order = str_ireplace( $old_quiz_id, $new_quiz->ID , $old_question_order );
564
+			add_post_meta( $question->ID, '_quiz_question_order' . $new_quiz->ID, $new_question_order );
565 565
 
566 566
 			// Add question to quiz
567 567
 			add_post_meta( $question->ID, '_quiz_id', $new_quiz->ID, false );
@@ -883,21 +883,21 @@  discard block
 block discarded – undo
883 883
 								break;
884 884
 
885 885
 								case 'checkbox':
886
-                                    //backwards compatibility
887
-                                    if( empty( $data ) || 'on' == $data ){
888
-                                        $checked_value = 'on';
889
-                                    }elseif( 'yes' == $data  ) {
886
+									//backwards compatibility
887
+									if( empty( $data ) || 'on' == $data ){
888
+										$checked_value = 'on';
889
+									}elseif( 'yes' == $data  ) {
890 890
 
891
-                                        $checked_value = 'yes';
891
+										$checked_value = 'yes';
892 892
 
893
-                                    }elseif( 'auto' == $data  ) {
893
+									}elseif( 'auto' == $data  ) {
894 894
 
895
-                                        $checked_value = 'auto';
895
+										$checked_value = 'auto';
896 896
 
897
-                                    } else {
898
-                                        $checked_value = 1;
899
-                                        $data = intval( $data );
900
-                                    }
897
+									} else {
898
+										$checked_value = 1;
899
+										$data = intval( $data );
900
+									}
901 901
 									$checked = checked( $checked_value, $data, false );
902 902
 									$html .= '<input id="' . esc_attr( $field['id'] ) . '" type="' . $field['type'] . '" name="' . esc_attr( $field['id'] ) . '" ' . $checked . ' ' . $disabled . '/>' . "\n";
903 903
 								break;
@@ -1001,26 +1001,26 @@  discard block
 block discarded – undo
1001 1001
 
1002 1002
 		if( 0 < count( $courses ) ) {
1003 1003
 
1004
-            // order the courses as set by the users
1005
-            $all_course_ids = array();
1006
-            foreach( $courses as $course ){
1004
+			// order the courses as set by the users
1005
+			$all_course_ids = array();
1006
+			foreach( $courses as $course ){
1007 1007
 
1008
-                $all_course_ids[] = (string)$course->ID;
1008
+				$all_course_ids[] = (string)$course->ID;
1009 1009
 
1010
-            }
1011
-            $order_string = $this->get_course_order();
1010
+			}
1011
+			$order_string = $this->get_course_order();
1012 1012
 
1013
-            if( !empty( $order_string ) ){
1014
-                $ordered_course_ids = explode(',' , $order_string );
1015
-                $all_course_ids = array_unique( array_merge( $ordered_course_ids , $all_course_ids ) );
1016
-            }
1013
+			if( !empty( $order_string ) ){
1014
+				$ordered_course_ids = explode(',' , $order_string );
1015
+				$all_course_ids = array_unique( array_merge( $ordered_course_ids , $all_course_ids ) );
1016
+			}
1017 1017
 
1018 1018
 
1019 1019
 			$html .= '<form id="editgrouping" method="post" action="" class="validate">' . "\n";
1020 1020
 			$html .= '<ul class="sortable-course-list">' . "\n";
1021 1021
 			$count = 0;
1022 1022
 			foreach ( $all_course_ids as $course_id ) {
1023
-                $course = get_post( $course_id );
1023
+				$course = get_post( $course_id );
1024 1024
 				$count++;
1025 1025
 				$class = 'course';
1026 1026
 				if ( $count == 1 ) { $class .= ' first'; }
@@ -1135,73 +1135,73 @@  discard block
 block discarded – undo
1135 1135
 
1136 1136
 				$displayed_lessons = array();
1137 1137
 
1138
-                $modules = Sensei()->modules->get_course_modules( intval( $course_id ) );
1139
-
1140
-                foreach( $modules as $module ) {
1141
-
1142
-                    $args = array(
1143
-                        'post_type' => 'lesson',
1144
-                        'post_status' => 'publish',
1145
-                        'posts_per_page' => -1,
1146
-                        'meta_query' => array(
1147
-                            array(
1148
-                                'key' => '_lesson_course',
1149
-                                'value' => intval( $course_id ),
1150
-                                'compare' => '='
1151
-                            )
1152
-                        ),
1153
-                        'tax_query' => array(
1154
-                            array(
1155
-                                'taxonomy' => Sensei()->modules->taxonomy,
1156
-                                'field' => 'id',
1157
-                                'terms' => intval( $module->term_id )
1158
-                            )
1159
-                        ),
1160
-                        'meta_key' => '_order_module_' . $module->term_id,
1161
-                        'orderby' => 'meta_value_num date',
1162
-                        'order' => 'ASC',
1163
-                        'suppress_filters' => 0
1164
-                    );
1165
-
1166
-                    $lessons = get_posts( $args );
1167
-
1168
-                    if( count( $lessons ) > 0 ) {
1169
-                        $html .= '<h3>' . $module->name . '</h3>' . "\n";
1170
-                        $html .= '<ul class="sortable-lesson-list" data-module_id="' . $module->term_id . '">' . "\n";
1171
-
1172
-                        $count = 0;
1173
-                        foreach( $lessons as $lesson ) {
1174
-                            $count++;
1175
-                            $class = 'lesson';
1176
-                            if ( $count == 1 ) { $class .= ' first'; }
1177
-                            if ( $count == count( $lesson ) ) { $class .= ' last'; }
1178
-                            if ( $count % 2 != 0 ) {
1179
-                                $class .= ' alternate';
1180
-                            }
1181
-
1182
-                            $html .= '<li class="' . esc_attr( $class ) . '"><span rel="' . esc_attr( $lesson->ID ) . '" style="width: 100%;"> ' . $lesson->post_title . '</span></li>' . "\n";
1183
-
1184
-                            $displayed_lessons[] = $lesson->ID;
1185
-                        }
1186
-
1187
-                        $html .= '</ul>' . "\n";
1188
-
1189
-                        $html .= '<input type="hidden" name="lesson-order-module-' . $module->term_id . '" value="" />' . "\n";
1190
-                    }
1191
-                }
1192
-
1193
-
1194
-                $lessons = Sensei()->course->course_lessons( $course_id );
1138
+				$modules = Sensei()->modules->get_course_modules( intval( $course_id ) );
1139
+
1140
+				foreach( $modules as $module ) {
1141
+
1142
+					$args = array(
1143
+						'post_type' => 'lesson',
1144
+						'post_status' => 'publish',
1145
+						'posts_per_page' => -1,
1146
+						'meta_query' => array(
1147
+							array(
1148
+								'key' => '_lesson_course',
1149
+								'value' => intval( $course_id ),
1150
+								'compare' => '='
1151
+							)
1152
+						),
1153
+						'tax_query' => array(
1154
+							array(
1155
+								'taxonomy' => Sensei()->modules->taxonomy,
1156
+								'field' => 'id',
1157
+								'terms' => intval( $module->term_id )
1158
+							)
1159
+						),
1160
+						'meta_key' => '_order_module_' . $module->term_id,
1161
+						'orderby' => 'meta_value_num date',
1162
+						'order' => 'ASC',
1163
+						'suppress_filters' => 0
1164
+					);
1165
+
1166
+					$lessons = get_posts( $args );
1167
+
1168
+					if( count( $lessons ) > 0 ) {
1169
+						$html .= '<h3>' . $module->name . '</h3>' . "\n";
1170
+						$html .= '<ul class="sortable-lesson-list" data-module_id="' . $module->term_id . '">' . "\n";
1171
+
1172
+						$count = 0;
1173
+						foreach( $lessons as $lesson ) {
1174
+							$count++;
1175
+							$class = 'lesson';
1176
+							if ( $count == 1 ) { $class .= ' first'; }
1177
+							if ( $count == count( $lesson ) ) { $class .= ' last'; }
1178
+							if ( $count % 2 != 0 ) {
1179
+								$class .= ' alternate';
1180
+							}
1181
+
1182
+							$html .= '<li class="' . esc_attr( $class ) . '"><span rel="' . esc_attr( $lesson->ID ) . '" style="width: 100%;"> ' . $lesson->post_title . '</span></li>' . "\n";
1183
+
1184
+							$displayed_lessons[] = $lesson->ID;
1185
+						}
1186
+
1187
+						$html .= '</ul>' . "\n";
1188
+
1189
+						$html .= '<input type="hidden" name="lesson-order-module-' . $module->term_id . '" value="" />' . "\n";
1190
+					}
1191
+				}
1192
+
1193
+
1194
+				$lessons = Sensei()->course->course_lessons( $course_id );
1195 1195
 
1196 1196
 				if( 0 < count( $lessons ) ) {
1197 1197
 
1198
-                    //get module term ids, will be used to exclude lessons
1199
-                    $module_items_ids = array();
1200
-                    if( ! empty( $modules ) ) {
1201
-                        foreach ($modules as $module) {
1202
-                            $module_items_ids[] = $module->term_id;
1203
-                        }
1204
-                    }
1198
+					//get module term ids, will be used to exclude lessons
1199
+					$module_items_ids = array();
1200
+					if( ! empty( $modules ) ) {
1201
+						foreach ($modules as $module) {
1202
+							$module_items_ids[] = $module->term_id;
1203
+						}
1204
+					}
1205 1205
 
1206 1206
 					if( 0 < count( $displayed_lessons ) ) {
1207 1207
 						$html .= '<h3>' . __( 'Other Lessons', 'woothemes-sensei' ) . '</h3>' . "\n";
@@ -1211,13 +1211,13 @@  discard block
 block discarded – undo
1211 1211
 					$count = 0;
1212 1212
 					foreach ( $lessons as $lesson ) {
1213 1213
 
1214
-                        // if lesson belongs to one fo the course modules then exclude it here
1215
-                        // as it is listed above
1216
-                        if( has_term( $module_items_ids, 'module', $lesson->ID )  ){
1214
+						// if lesson belongs to one fo the course modules then exclude it here
1215
+						// as it is listed above
1216
+						if( has_term( $module_items_ids, 'module', $lesson->ID )  ){
1217 1217
 
1218
-                            continue;
1218
+							continue;
1219 1219
 
1220
-                        }
1220
+						}
1221 1221
 
1222 1222
 						$count++;
1223 1223
 						$class = 'lesson';
@@ -1261,28 +1261,28 @@  discard block
 block discarded – undo
1261 1261
 
1262 1262
 		if( $course_id ) {
1263 1263
 
1264
-            $modules = Sensei()->modules->get_course_modules( intval( $course_id ) );
1264
+			$modules = Sensei()->modules->get_course_modules( intval( $course_id ) );
1265 1265
 
1266
-            foreach( $modules as $module ) {
1266
+			foreach( $modules as $module ) {
1267 1267
 
1268 1268
 
1269
-                if( isset( $_POST[ 'lesson-order-module-' . $module->term_id ] )
1270
-                    && $_POST[ 'lesson-order-module-' . $module->term_id ] ) {
1269
+				if( isset( $_POST[ 'lesson-order-module-' . $module->term_id ] )
1270
+					&& $_POST[ 'lesson-order-module-' . $module->term_id ] ) {
1271 1271
 
1272
-                    $order = explode( ',', $_POST[ 'lesson-order-module-' . $module->term_id ] );
1273
-                    $i = 1;
1274
-                    foreach( $order as $lesson_id ) {
1272
+					$order = explode( ',', $_POST[ 'lesson-order-module-' . $module->term_id ] );
1273
+					$i = 1;
1274
+					foreach( $order as $lesson_id ) {
1275 1275
 
1276
-                        if( $lesson_id ) {
1277
-                            update_post_meta( $lesson_id, '_order_module_' . $module->term_id, $i );
1278
-                            ++$i;
1279
-                        }
1276
+						if( $lesson_id ) {
1277
+							update_post_meta( $lesson_id, '_order_module_' . $module->term_id, $i );
1278
+							++$i;
1279
+						}
1280 1280
 
1281
-                    }// end for each order
1281
+					}// end for each order
1282 1282
 
1283
-                }// end if
1283
+				}// end if
1284 1284
 
1285
-            } // end for each modules
1285
+			} // end for each modules
1286 1286
 
1287 1287
 
1288 1288
 			if( $order_string ) {
@@ -1365,47 +1365,47 @@  discard block
 block discarded – undo
1365 1365
 
1366 1366
 	/**
1367 1367
 	 * Adding admin notice if the current
1368
-     * installed theme is not compatible
1369
-     *
1368
+	 * installed theme is not compatible
1369
+	 *
1370 1370
 	 * @return void
1371 1371
 	 */
1372 1372
 	public function theme_compatibility_notices() {
1373 1373
 
1374
-        if( isset( $_GET['sensei_hide_notice'] ) ) {
1375
-        	switch( esc_attr( $_GET['sensei_hide_notice'] ) ) {
1374
+		if( isset( $_GET['sensei_hide_notice'] ) ) {
1375
+			switch( esc_attr( $_GET['sensei_hide_notice'] ) ) {
1376 1376
 				case 'menu_settings': add_user_meta( get_current_user_id(), 'sensei_hide_menu_settings_notice', true ); break;
1377 1377
 				case 'theme_check': add_user_meta( get_current_user_id(), 'sensei_hide_theme_check_notice', true ); break;
1378 1378
 			}
1379
-        }
1379
+		}
1380 1380
 
1381
-        // white list templates that are already support by default and do not show notice for them
1382
-        $template = get_option( 'template' );
1381
+		// white list templates that are already support by default and do not show notice for them
1382
+		$template = get_option( 'template' );
1383 1383
 
1384
-        $white_list = array(    'twentyeleven',
1385
-                                'twentytwelve',
1386
-                                'twentyfourteen',
1387
-                                'twentyfifteen',
1388
-                                'twentysixteen',
1389
-                                'storefront',
1390
-                                                );
1384
+		$white_list = array(    'twentyeleven',
1385
+								'twentytwelve',
1386
+								'twentyfourteen',
1387
+								'twentyfifteen',
1388
+								'twentysixteen',
1389
+								'storefront',
1390
+												);
1391 1391
 
1392
-        if ( in_array( $template, $white_list ) ) {
1392
+		if ( in_array( $template, $white_list ) ) {
1393 1393
 
1394
-            return;
1394
+			return;
1395 1395
 
1396
-        }
1396
+		}
1397 1397
 
1398
-        // don't show the notice if the user chose to hide it
1399
-        $hide_theme_check_notice = get_user_meta( get_current_user_id(), 'sensei_hide_theme_check_notice', true );
1400
-        if(  $hide_theme_check_notice ) {
1398
+		// don't show the notice if the user chose to hide it
1399
+		$hide_theme_check_notice = get_user_meta( get_current_user_id(), 'sensei_hide_theme_check_notice', true );
1400
+		if(  $hide_theme_check_notice ) {
1401 1401
 
1402
-            return;
1402
+			return;
1403 1403
 
1404
-        }
1404
+		}
1405 1405
 
1406
-        // show the notice for themes not supporting sensei
1407
-	    if ( ! current_theme_supports( 'sensei' ) ) {
1408
-            ?>
1406
+		// show the notice for themes not supporting sensei
1407
+		if ( ! current_theme_supports( 'sensei' ) ) {
1408
+			?>
1409 1409
 
1410 1410
             <div id="message" class="error sensei-message sensei-connect">
1411 1411
                     <p>
@@ -1441,7 +1441,7 @@  discard block
 block discarded – undo
1441 1441
 	public function reset_theme_check_notices() {
1442 1442
 		global $current_user;
1443 1443
 		wp_get_current_user();
1444
-        $user_id = $current_user->ID;
1444
+		$user_id = $current_user->ID;
1445 1445
 
1446 1446
 		delete_user_meta( $user_id, 'sensei_hide_theme_check_notice' );
1447 1447
 	}
@@ -1461,62 +1461,62 @@  discard block
 block discarded – undo
1461 1461
 		return $prevent_access;
1462 1462
 	}
1463 1463
 
1464
-    /**
1465
-     * Hooked onto admin_init. Listens for install_sensei_pages and skip_install_sensei_pages query args
1466
-     * on the sensei settings page.
1467
-     *
1468
-     * The function
1469
-     *
1470
-     * @since 1.8.7
1471
-     */
1472
-    public  static function install_pages(){
1464
+	/**
1465
+	 * Hooked onto admin_init. Listens for install_sensei_pages and skip_install_sensei_pages query args
1466
+	 * on the sensei settings page.
1467
+	 *
1468
+	 * The function
1469
+	 *
1470
+	 * @since 1.8.7
1471
+	 */
1472
+	public  static function install_pages(){
1473 1473
 
1474
-        // only fire on the settings page
1475
-        if( ! isset( $_GET['page'] )
1476
-            || 'woothemes-sensei-settings' != $_GET['page']
1477
-            || 1 == get_option('skip_install_sensei_pages') ){
1474
+		// only fire on the settings page
1475
+		if( ! isset( $_GET['page'] )
1476
+			|| 'woothemes-sensei-settings' != $_GET['page']
1477
+			|| 1 == get_option('skip_install_sensei_pages') ){
1478 1478
 
1479
-            return;
1479
+			return;
1480 1480
 
1481
-        }
1481
+		}
1482 1482
 
1483
-        // Install/page installer
1484
-        $install_complete = false;
1483
+		// Install/page installer
1484
+		$install_complete = false;
1485 1485
 
1486
-        // Add pages button
1487
-        $settings_url = '';
1488
-        if (isset($_GET['install_sensei_pages']) && $_GET['install_sensei_pages']) {
1486
+		// Add pages button
1487
+		$settings_url = '';
1488
+		if (isset($_GET['install_sensei_pages']) && $_GET['install_sensei_pages']) {
1489 1489
 
1490
-            Sensei()->admin->create_pages();
1490
+			Sensei()->admin->create_pages();
1491 1491
 
1492
-            update_option('skip_install_sensei_pages', 1);
1492
+			update_option('skip_install_sensei_pages', 1);
1493 1493
 
1494
-            $install_complete = true;
1495
-            $settings_url = remove_query_arg('install_sensei_pages');
1494
+			$install_complete = true;
1495
+			$settings_url = remove_query_arg('install_sensei_pages');
1496 1496
 
1497
-            // Skip button
1498
-        } elseif (isset($_GET['skip_install_sensei_pages']) && $_GET['skip_install_sensei_pages']) {
1497
+			// Skip button
1498
+		} elseif (isset($_GET['skip_install_sensei_pages']) && $_GET['skip_install_sensei_pages']) {
1499 1499
 
1500
-            update_option('skip_install_sensei_pages', 1);
1501
-            $install_complete = true;
1502
-            $settings_url = remove_query_arg('skip_install_sensei_pages');
1500
+			update_option('skip_install_sensei_pages', 1);
1501
+			$install_complete = true;
1502
+			$settings_url = remove_query_arg('skip_install_sensei_pages');
1503 1503
 
1504
-        }
1504
+		}
1505 1505
 
1506
-        if ($install_complete) {
1506
+		if ($install_complete) {
1507 1507
 
1508
-            // refresh the rewrite rules on init
1509
-            update_option('sensei_flush_rewrite_rules', '1');
1508
+			// refresh the rewrite rules on init
1509
+			update_option('sensei_flush_rewrite_rules', '1');
1510 1510
 
1511
-            // Set installed option
1512
-            update_option('sensei_installed', 0);
1511
+			// Set installed option
1512
+			update_option('sensei_installed', 0);
1513 1513
 
1514
-            $complete_url = add_query_arg( 'sensei_install_complete', 'true', $settings_url  );
1515
-            wp_redirect( $complete_url );
1514
+			$complete_url = add_query_arg( 'sensei_install_complete', 'true', $settings_url  );
1515
+			wp_redirect( $complete_url );
1516 1516
 
1517
-        }
1517
+		}
1518 1518
 
1519
-    }// end install_pages
1519
+	}// end install_pages
1520 1520
 
1521 1521
 } // End Class
1522 1522
 
Please login to merge, or discard this patch.