Completed
Push — master ( b89b53...97debb )
by Dwain
04:52
created
includes/class-sensei-settings.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -19,57 +19,57 @@  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
 		$settings[ $setting ] = $new_value;
70 70
 		return update_option( $this->token,$settings );
71 71
 
72
-    }
72
+	}
73 73
 
74 74
 	/**
75 75
 	 * Register the settings screen within the WordPress admin.
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		$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' ) );
158 158
 		$course_display_settings = array( 'excerpt' => __( 'Course Excerpt', 'woothemes-sensei' ), 'full' => __( 'Full Course Content', 'woothemes-sensei' ) );
159 159
 
160
-	    $fields = array();
160
+		$fields = array();
161 161
 
162 162
 		$fields['access_permission'] = array(
163 163
 								'name' => __( 'Access Permissions', 'woothemes-sensei' ),
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
 								'section' => 'default-settings'
220 220
 								);
221 221
 
222
-    	// Course Settings
222
+		// Course Settings
223 223
 
224
-    	$fields['course_completion'] = array(
224
+		$fields['course_completion'] = array(
225 225
 								'name' => __( 'Courses are complete:', 'woothemes-sensei' ),
226 226
 								'description' => __( 'This will determine when courses are marked as complete.', 'woothemes-sensei' ),
227 227
 								'type' => 'select',
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 								'options' => $complete_settings
232 232
 								);
233 233
 
234
-    	$fields['course_author'] = array(
234
+		$fields['course_author'] = array(
235 235
 								'name' => __( 'Display Course Author', 'woothemes-sensei' ),
236 236
 								'description' => __( 'Output the Course Author on Course archive and My Courses page.', 'woothemes-sensei' ),
237 237
 								'type' => 'checkbox',
@@ -459,10 +459,10 @@  discard block
 block discarded – undo
459 459
 		);
460 460
 
461 461
 		$teacher_email_options = array(
462
-            'teacher-started-course' => __( 'A learner starts their course', 'woothemes-sensei' ),
463
-            'teacher-completed-course' => __( 'A learner completes their course', 'woothemes-sensei' ),
464
-            'teacher-completed-lesson' => __( 'A learner completes a lesson', 'woothemes-sensei' ),
465
-            'teacher-quiz-submitted' => __( 'A learner submits a quiz for grading', 'woothemes-sensei' ),
462
+			'teacher-started-course' => __( 'A learner starts their course', 'woothemes-sensei' ),
463
+			'teacher-completed-course' => __( 'A learner completes their course', 'woothemes-sensei' ),
464
+			'teacher-completed-lesson' => __( 'A learner completes a lesson', 'woothemes-sensei' ),
465
+			'teacher-quiz-submitted' => __( 'A learner submits a quiz for grading', 'woothemes-sensei' ),
466 466
 			'teacher-new-message' => __( 'A learner sends a private message to a teacher', 'woothemes-sensei' ),
467 467
 		);
468 468
 
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 
572 572
 		if ( Sensei_WC::is_woocommerce_present() ) {
573 573
 			// WooCommerce Settings
574
-    		$fields['woocommerce_enabled'] = array(
574
+			$fields['woocommerce_enabled'] = array(
575 575
 									'name' => __( 'Enable WooCommerce Courses', 'woothemes-sensei' ),
576 576
 									'description' => __( 'Use WooCommerce to sell Courses by linking a Product to a Course.', 'woothemes-sensei' ),
577 577
 									'type' => 'checkbox',
@@ -659,14 +659,14 @@  discard block
 block discarded – undo
659 659
 		$page_items[] = __( 'Select a Page:', 'woothemes-sensei' );
660 660
 
661 661
 		foreach ( $pages_split as $k => $v ) {
662
-		    $id = '';
663
-		    // Get the ID value.
664
-		    preg_match( '/value="(.*?)"/i', $v, $matches );
665
-
666
-		    if ( isset( $matches[1] ) ) {
667
-		        $id = $matches[1];
668
-		        $page_items[$id] = trim( strip_tags( $v ) );
669
-		    } // End If Statement
662
+			$id = '';
663
+			// Get the ID value.
664
+			preg_match( '/value="(.*?)"/i', $v, $matches );
665
+
666
+			if ( isset( $matches[1] ) ) {
667
+				$id = $matches[1];
668
+				$page_items[$id] = trim( strip_tags( $v ) );
669
+			} // End If Statement
670 670
 		} // End For Loop
671 671
 
672 672
 		$pages_array = $page_items;
@@ -683,22 +683,22 @@  discard block
 block discarded – undo
683 683
 		Sensei_Language_Pack_Manager::messages();
684 684
 	}
685 685
 
686
-    /**
687
-     * Flush the rewrite rules after the settings have been updated.
688
-     * This is to ensure that the
689
-     *
690
-     * @since 1.9.0
691
-     */
692
-    public static function flush_rewrite_rules(){
686
+	/**
687
+	 * Flush the rewrite rules after the settings have been updated.
688
+	 * This is to ensure that the
689
+	 *
690
+	 * @since 1.9.0
691
+	 */
692
+	public static function flush_rewrite_rules(){
693 693
 
694
-        if ( isset( $_POST[ 'option_page' ] ) && 'woothemes-sensei-settings' == $_POST[ 'option_page' ]
695
-            && isset( $_POST[ 'action' ] ) && 'update' == $_POST[ 'action' ] ) {
694
+		if ( isset( $_POST[ 'option_page' ] ) && 'woothemes-sensei-settings' == $_POST[ 'option_page' ]
695
+			&& isset( $_POST[ 'action' ] ) && 'update' == $_POST[ 'action' ] ) {
696 696
 
697
-            Sensei()->initiate_rewrite_rules_flush();
697
+			Sensei()->initiate_rewrite_rules_flush();
698 698
 
699
-        }
699
+		}
700 700
 
701
-    }//end  flush_cache
701
+	}//end  flush_cache
702 702
 } // End Class
703 703
 
704 704
 /**
Please login to merge, or discard this patch.