Completed
Push — master ( 78b9e3...efb4fd )
by Dwain
04:49
created
includes/theme-integrations/twentyeleven.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      * Output opening wrappers
14 14
      * @since 1.9.0
15 15
      */
16
-    public function wrapper_start(){
16
+    public function wrapper_start() {
17 17
     ?>
18 18
 
19 19
         <div id="primary" class="site-content">
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      *
27 27
      * @since 1.9.0
28 28
      */
29
-    public function wrapper_end(){ ?>
29
+    public function wrapper_end() { ?>
30 30
 
31 31
 			</div>
32 32
 		</div>
Please login to merge, or discard this patch.
includes/theme-integrations/twentyfourteen.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      * Output opening wrappers
14 14
      * @since 1.9.0
15 15
      */
16
-    public function wrapper_start(){
16
+    public function wrapper_start() {
17 17
     ?>
18 18
 
19 19
         <div id="primary" class="site-content">
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      *
27 27
      * @since 1.9.0
28 28
      */
29
-    public function wrapper_end(){ ?>
29
+    public function wrapper_end() { ?>
30 30
 
31 31
 			</div>
32 32
 		</div>
Please login to merge, or discard this patch.
includes/theme-integrations/twentytwelve.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      * Output opening wrappers
14 14
      * @since 1.9.0
15 15
      */
16
-    public function wrapper_start(){
16
+    public function wrapper_start() {
17 17
     ?>
18 18
 
19 19
         <div id="primary" class="site-content">
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      *
27 27
      * @since 1.9.0
28 28
      */
29
-    public function wrapper_end(){ ?>
29
+    public function wrapper_end() { ?>
30 30
 
31 31
 			</div>
32 32
 		</div>
Please login to merge, or discard this patch.
includes/sensei-functions.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly
4 4
 
5 5
 /**
6 6
  * Global Sensei functions
@@ -11,21 +11,21 @@  discard block
 block discarded – undo
11 11
 
12 12
 	$is_sensei = false;
13 13
 
14
-	$post_types = array( 'lesson', 'course', 'quiz', 'question' );
15
-	$taxonomies = array( 'course-category', 'quiz-type', 'question-type', 'lesson-tag' );
14
+	$post_types = array('lesson', 'course', 'quiz', 'question');
15
+	$taxonomies = array('course-category', 'quiz-type', 'question-type', 'lesson-tag');
16 16
 
17
-	if( is_post_type_archive( $post_types ) || is_singular( $post_types ) || is_tax( $taxonomies ) ) {
17
+	if (is_post_type_archive($post_types) || is_singular($post_types) || is_tax($taxonomies)) {
18 18
 
19 19
 		$is_sensei = true;
20 20
 
21 21
 	}
22 22
 
23
-	if( is_object( $post ) && ! is_wp_error( $post ) ) {
23
+	if (is_object($post) && ! is_wp_error($post)) {
24 24
 
25
-		$course_page_id = intval( Sensei()->settings->settings[ 'course_page' ] );
26
-		$my_courses_page_id = intval( Sensei()->settings->settings[ 'my_course_page' ] );
25
+		$course_page_id = intval(Sensei()->settings->settings['course_page']);
26
+		$my_courses_page_id = intval(Sensei()->settings->settings['my_course_page']);
27 27
 
28
-		if( in_array( $post->ID, array( $course_page_id, $my_courses_page_id ) ) ) {
28
+		if (in_array($post->ID, array($course_page_id, $my_courses_page_id))) {
29 29
 
30 30
 			$is_sensei = true;
31 31
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 	}
35 35
 
36
-	return apply_filters( 'is_sensei', $is_sensei, $post );
36
+	return apply_filters('is_sensei', $is_sensei, $post);
37 37
 }
38 38
 
39 39
 /**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
  */
46 46
 function sensei_all_access() {
47 47
 
48
-    $access = current_user_can( 'manage_sensei' ) || current_user_can( 'manage_sensei_grades' );
48
+    $access = current_user_can('manage_sensei') || current_user_can('manage_sensei_grades');
49 49
 
50 50
     /**
51 51
      * Filter sensei_all_access function result
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
      * @since 1.4.0
56 56
      * @param bool $access
57 57
      */
58
-	return apply_filters( 'sensei_all_access', $access );
58
+	return apply_filters('sensei_all_access', $access);
59 59
 
60 60
 } // End sensei_all_access()
61 61
 
62
-if ( ! function_exists( 'sensei_light_or_dark' ) ) {
62
+if ( ! function_exists('sensei_light_or_dark')) {
63 63
 
64 64
 	/**
65 65
 	 * Detect if we should use a light or dark colour on a background colour
@@ -70,20 +70,20 @@  discard block
 block discarded – undo
70 70
 	 * @param string $light (default: '#FFFFFF')
71 71
 	 * @return string
72 72
 	 */
73
-	function sensei_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
73
+	function sensei_light_or_dark($color, $dark = '#000000', $light = '#FFFFFF') {
74 74
 
75
-	    $hex = str_replace( '#', '', $color );
75
+	    $hex = str_replace('#', '', $color);
76 76
 
77
-		$c_r = hexdec( substr( $hex, 0, 2 ) );
78
-		$c_g = hexdec( substr( $hex, 2, 2 ) );
79
-		$c_b = hexdec( substr( $hex, 4, 2 ) );
80
-		$brightness = ( ( $c_r * 299 ) + ( $c_g * 587 ) + ( $c_b * 114 ) ) / 1000;
77
+		$c_r = hexdec(substr($hex, 0, 2));
78
+		$c_g = hexdec(substr($hex, 2, 2));
79
+		$c_b = hexdec(substr($hex, 4, 2));
80
+		$brightness = (($c_r * 299) + ($c_g * 587) + ($c_b * 114)) / 1000;
81 81
 
82 82
 		return $brightness > 155 ? $dark : $light;
83 83
 	}
84 84
 }
85 85
 
86
-if ( ! function_exists( 'sensei_rgb_from_hex' ) ) {
86
+if ( ! function_exists('sensei_rgb_from_hex')) {
87 87
 
88 88
 	/**
89 89
 	 * Hex darker/lighter/contrast functions for colours
@@ -92,19 +92,19 @@  discard block
 block discarded – undo
92 92
 	 * @param mixed $color
93 93
 	 * @return string
94 94
 	 */
95
-	function sensei_rgb_from_hex( $color ) {
96
-		$color = str_replace( '#', '', $color );
95
+	function sensei_rgb_from_hex($color) {
96
+		$color = str_replace('#', '', $color);
97 97
 		// Convert shorthand colors to full format, e.g. "FFF" -> "FFFFFF"
98
-		$color = preg_replace( '~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color );
98
+		$color = preg_replace('~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color);
99 99
 
100
-		$rgb['R'] = hexdec( $color{0}.$color{1} );
101
-		$rgb['G'] = hexdec( $color{2}.$color{3} );
102
-		$rgb['B'] = hexdec( $color{4}.$color{5} );
100
+		$rgb['R'] = hexdec($color{0}.$color{1} );
101
+		$rgb['G'] = hexdec($color{2}.$color{3} );
102
+		$rgb['B'] = hexdec($color{4}.$color{5} );
103 103
 		return $rgb;
104 104
 	}
105 105
 }
106 106
 
107
-if ( ! function_exists( 'sensei_hex_darker' ) ) {
107
+if ( ! function_exists('sensei_hex_darker')) {
108 108
 
109 109
 	/**
110 110
 	 * Hex darker/lighter/contrast functions for colours
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	 * @param int $factor (default: 30)
115 115
 	 * @return string
116 116
 	 */
117
-	function sensei_hex_darker( $color, $factor = 30 ) {
118
-		$base = sensei_rgb_from_hex( $color );
117
+	function sensei_hex_darker($color, $factor = 30) {
118
+		$base = sensei_rgb_from_hex($color);
119 119
 		$color = '#';
120 120
 
121 121
 		foreach ($base as $k => $v) :
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	        $new_decimal = $v - $amount;
125 125
 
126 126
 	        $new_hex_component = dechex($new_decimal);
127
-	        if(strlen($new_hex_component) < 2) :
127
+	        if (strlen($new_hex_component) < 2) :
128 128
 	        	$new_hex_component = "0".$new_hex_component;
129 129
 	        endif;
130 130
 	        $color .= $new_hex_component;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	}
135 135
 }
136 136
 
137
-if ( ! function_exists( 'sensei_hex_lighter' ) ) {
137
+if ( ! function_exists('sensei_hex_lighter')) {
138 138
 
139 139
 	/**
140 140
 	 * Hex darker/lighter/contrast functions for colours
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	 * @param int $factor (default: 30)
145 145
 	 * @return string
146 146
 	 */
147
-	function sensei_hex_lighter( $color, $factor = 30 ) {
148
-		$base = sensei_rgb_from_hex( $color );
147
+	function sensei_hex_lighter($color, $factor = 30) {
148
+		$base = sensei_rgb_from_hex($color);
149 149
 		$color = '#';
150 150
 
151 151
 	    foreach ($base as $k => $v) :
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	        $new_decimal = $v + $amount;
156 156
 
157 157
 	        $new_hex_component = dechex($new_decimal);
158
-	        if(strlen($new_hex_component) < 2) :
158
+	        if (strlen($new_hex_component) < 2) :
159 159
 	        	$new_hex_component = "0".$new_hex_component;
160 160
 	        endif;
161 161
 	        $color .= $new_hex_component;
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
  * @since 1.9.0
172 172
  * @deprecated since 1.9.0 use  Sensei_WC::is_woocommerce_active()
173 173
  */
174
-if ( ! function_exists( 'is_woocommerce_active' ) ) {
174
+if ( ! function_exists('is_woocommerce_active')) {
175 175
     function is_woocommerce_active() {
176 176
         // calling is present instead of is active here
177 177
         // as this function can override other is_woocommerce_active
@@ -193,20 +193,20 @@  discard block
 block discarded – undo
193 193
  * @param $alternative
194 194
  * @param array $args
195 195
  */
196
-function sensei_do_deprecated_action( $hook_tag, $version, $alternative="" , $args = array()  ){
196
+function sensei_do_deprecated_action($hook_tag, $version, $alternative = "", $args = array()) {
197 197
 
198
-    if( has_action( $hook_tag ) ){
198
+    if (has_action($hook_tag)) {
199 199
 
200
-        $error_message = sprintf( __( "SENSEI: The hook '%s', has been deprecated since '%s'." , 'woothemes-sensei'), $hook_tag ,$version );
200
+        $error_message = sprintf(__("SENSEI: The hook '%s', has been deprecated since '%s'.", 'woothemes-sensei'), $hook_tag, $version);
201 201
 
202
-        if( !empty( $alternative ) ){
202
+        if ( ! empty($alternative)) {
203 203
 
204
-            $error_message .= sprintf( __("Please use '%s' instead.", 'woothemes-sensei'), $alternative ) ;
204
+            $error_message .= sprintf(__("Please use '%s' instead.", 'woothemes-sensei'), $alternative);
205 205
 
206 206
         }
207 207
 
208
-        trigger_error( $error_message );
209
-        do_action( $hook_tag , $args );
208
+        trigger_error($error_message);
209
+        do_action($hook_tag, $args);
210 210
 
211 211
     }
212 212
 
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
  * @param $post_id
222 222
  * @return bool
223 223
  */
224
-function sensei_is_a_course( $post ){
224
+function sensei_is_a_course($post) {
225 225
 
226
-	return "course" == get_post_type( $post );
226
+	return "course" == get_post_type($post);
227 227
 
228 228
 }
229 229
 
@@ -236,14 +236,14 @@  discard block
 block discarded – undo
236 236
  *
237 237
  * @since 1.9.0
238 238
  */
239
-function sensei_user_login_url(){
239
+function sensei_user_login_url() {
240 240
 
241
-    $my_courses_page_id = intval( Sensei()->settings->get( 'my_course_page' ) );
242
-    $page = get_post( $my_courses_page_id );
241
+    $my_courses_page_id = intval(Sensei()->settings->get('my_course_page'));
242
+    $page = get_post($my_courses_page_id);
243 243
 
244
-    if ( $my_courses_page_id && isset( $page->ID ) && 'page' == get_post_type( $page->ID )  ){
244
+    if ($my_courses_page_id && isset($page->ID) && 'page' == get_post_type($page->ID)) {
245 245
 
246
-        return get_permalink( $page->ID );
246
+        return get_permalink($page->ID);
247 247
 
248 248
     } else {
249 249
 
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
  * @since 1.9.0
261 261
  * @return bool
262 262
  */
263
-function sensei_is_login_required(){
263
+function sensei_is_login_required() {
264 264
 
265
-    $login_required = isset( Sensei()->settings->settings['access_permission'] ) && ( true == Sensei()->settings->settings['access_permission'] );
265
+    $login_required = isset(Sensei()->settings->settings['access_permission']) && (true == Sensei()->settings->settings['access_permission']);
266 266
 
267 267
     return $login_required;
268 268
 
Please login to merge, or discard this patch.
includes/shortcodes/class-sensei-shortcode-loader.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // security check
2
+if ( ! defined('ABSPATH')) exit; // security check
3 3
 /**
4 4
  * Sensei Shortcode Loader Class
5 5
  *
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * @category Shortcodes
14 14
  * @since 1.9.0
15 15
  */
16
-class Sensei_Shortcode_Loader{
16
+class Sensei_Shortcode_Loader {
17 17
 
18 18
     /**
19 19
      * @var array {
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      *
31 31
      * @since 1.9.0
32 32
      */
33
-    public function __construct(){
33
+    public function __construct() {
34 34
 
35 35
         // create a list of shortcodes and the class that handles them
36 36
         $this->setup_shortcode_class_map();
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $this->initialize_shortcodes();
40 40
 
41 41
         // add sensei body class for shortcodes
42
-        add_filter( 'body_class', array( $this, 'possibly_add_body_class' ));
42
+        add_filter('body_class', array($this, 'possibly_add_body_class'));
43 43
 
44 44
         // array( $this, 'add_body_class')
45 45
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * NOTE: When adding a new shortcode here be sure to load your shortcodes class
59 59
      * in class-sensei-autoloader class_file_map function
60 60
      */
61
-    public function setup_shortcode_class_map(){
61
+    public function setup_shortcode_class_map() {
62 62
 
63 63
         $this->shortcode_classes = array(
64 64
             'sensei_featured_courses'    => 'Sensei_Shortcode_Featured_Courses',
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
      * This function adds shortcodes to WP that links to other functionality.
84 84
      * @since 1.9.0
85 85
      */
86
-    public function initialize_shortcodes(){
86
+    public function initialize_shortcodes() {
87 87
 
88 88
         // shortcodes should only respond to front end calls
89
-        if( is_admin() || defined( 'DOING_AJAX' ) ){
89
+        if (is_admin() || defined('DOING_AJAX')) {
90 90
             return;
91 91
         }
92 92
 
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
          *
97 97
          * With this method we only load shortcode classes when we need them.
98 98
          */
99
-        foreach( $this->shortcode_classes as $shortcode => $class ){
99
+        foreach ($this->shortcode_classes as $shortcode => $class) {
100 100
 
101 101
             // all Sensei shortcodes are rendered by this loader class
102 102
             // it acts as an interface between wp and the shortcodes registered
103 103
             // above
104
-            add_shortcode( $shortcode, array( $this,'render_shortcode' ) );
104
+            add_shortcode($shortcode, array($this, 'render_shortcode'));
105 105
 
106 106
         }
107 107
 
@@ -119,23 +119,23 @@  discard block
 block discarded – undo
119 119
      *
120 120
      * @return string
121 121
      */
122
-    public function render_shortcode( $attributes='', $content='', $code ){
122
+    public function render_shortcode($attributes = '', $content = '', $code) {
123 123
 
124 124
         // only respond if the shortcode that we've added shortcode
125 125
         // classes for.
126
-        if( ! isset( $this->shortcode_classes[ $code ] ) ){
126
+        if ( ! isset($this->shortcode_classes[$code])) {
127 127
             return '';
128 128
         }
129 129
 
130 130
         // create an instances of the current requested shortcode
131
-        $shortcode_handling_class = $this->shortcode_classes[ $code ];
132
-        $shortcode = new $shortcode_handling_class( $attributes, $content, $code );
131
+        $shortcode_handling_class = $this->shortcode_classes[$code];
132
+        $shortcode = new $shortcode_handling_class($attributes, $content, $code);
133 133
 
134 134
         // we expect the sensei class instantiated to implement the Sensei_Shortcode interface
135
-        if( ! in_array( 'Sensei_Shortcode_Interface', class_implements( $shortcode) ) ){
135
+        if ( ! in_array('Sensei_Shortcode_Interface', class_implements($shortcode))) {
136 136
 
137 137
             $message = "The rendering class for your shortcode: $code, must implement the Sensei_Shortcode interface";
138
-            _doing_it_wrong('Sensei_Shortcode_Loader::render_shortcode',$message, '1.9.0' );
138
+            _doing_it_wrong('Sensei_Shortcode_Loader::render_shortcode', $message, '1.9.0');
139 139
 
140 140
         }
141 141
 
@@ -154,18 +154,18 @@  discard block
 block discarded – undo
154 154
      * @param array $classes
155 155
      * @return array
156 156
      */
157
-    public function possibly_add_body_class ( $classes ) {
157
+    public function possibly_add_body_class($classes) {
158 158
 
159 159
         global $post;
160 160
 
161 161
         $has_sensei_shortcode = false;
162 162
 
163
-        if ( is_a( $post, 'WP_Post' ) ) {
163
+        if (is_a($post, 'WP_Post')) {
164 164
 
165 165
             // check all registered Sensei shortcodes (not legacy shortcodes)
166
-            foreach ( $this->shortcode_classes as $shortcode => $class ){
166
+            foreach ($this->shortcode_classes as $shortcode => $class) {
167 167
 
168
-                if ( has_shortcode( $post->post_content, $shortcode ) ) {
168
+                if (has_shortcode($post->post_content, $shortcode)) {
169 169
 
170 170
                     $has_sensei_shortcode = true;
171 171
                 }
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
             }
174 174
         }
175 175
 
176
-        if( $has_sensei_shortcode ) {
177
-            $classes[] = 'sensei' ;
176
+        if ($has_sensei_shortcode) {
177
+            $classes[] = 'sensei';
178 178
         }
179 179
 
180 180
 
Please login to merge, or discard this patch.
includes/shortcodes/class-sensei-shortcode-unpurchased-courses.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly
3 3
 /**
4 4
  *
5 5
  * Renders the [sensei_unpurchased_courses] shortcode when a user is logged in. If the user is not logged in
@@ -45,21 +45,21 @@  discard block
 block discarded – undo
45 45
      * @param string $content
46 46
      * @param string $shortcode the shortcode that was called for this instance
47 47
      */
48
-    public function __construct( $attributes, $content, $shortcode ){
48
+    public function __construct($attributes, $content, $shortcode) {
49 49
 
50 50
         // set up all argument need for constructing the course query
51
-        $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '10';
52
-        $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'title';
51
+        $this->number = isset($attributes['number']) ? $attributes['number'] : '10';
52
+        $this->orderby = isset($attributes['orderby']) ? $attributes['orderby'] : 'title';
53 53
 
54 54
         // set the default for menu_order to be ASC
55
-        if( 'menu_order' == $this->orderby && !isset( $attributes['order']  ) ){
55
+        if ('menu_order' == $this->orderby && ! isset($attributes['order'])) {
56 56
 
57
-            $this->order =  'ASC';
57
+            $this->order = 'ASC';
58 58
 
59
-        }else{
59
+        } else {
60 60
 
61 61
             // for everything else use the value passed or the default DESC
62
-            $this->order = isset( $attributes['order']  ) ? $attributes['order'] : 'DESC';
62
+            $this->order = isset($attributes['order']) ? $attributes['order'] : 'DESC';
63 63
 
64 64
         }
65 65
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      *
74 74
      * @since 1.9.0
75 75
      */
76
-    protected function setup_course_query(){
76
+    protected function setup_course_query() {
77 77
 
78 78
 
79 79
         // course query parameters to be used for all courses
@@ -87,18 +87,18 @@  discard block
 block discarded – undo
87 87
         );
88 88
 
89 89
         // get all the courses that has a product attached
90
-        $all_courses_query = new WP_Query( $query_args );
90
+        $all_courses_query = new WP_Query($query_args);
91 91
 
92 92
         $paid_courses_not_taken = array();
93 93
         // look through all course and find the purchasable ones that user has not purchased
94
-        foreach( $all_courses_query->posts as $course ){
94
+        foreach ($all_courses_query->posts as $course) {
95 95
 
96 96
             // only keep the courses with a product including only  courses that the user not taking
97
-            $course_product_id = get_post_meta( $course->ID, '_course_woocommerce_product',true );
98
-            if( is_numeric( $course_product_id )
97
+            $course_product_id = get_post_meta($course->ID, '_course_woocommerce_product', true);
98
+            if (is_numeric($course_product_id)
99 99
                 &&
100
-                ! Sensei_Utils::user_started_course( $course->ID , get_current_user_id()  )
101
-            ){
100
+                ! Sensei_Utils::user_started_course($course->ID, get_current_user_id())
101
+            ) {
102 102
 
103 103
                     $paid_courses_not_taken[] = $course->ID;
104 104
 
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 
109 109
         // setup the course query again and only use the course the user has not purchased.
110 110
         // this query will be loaded into the global WP_Query in the render function.
111
-        $query_args[ 'post__in' ] = $paid_courses_not_taken;
112
-        $query_args[ 'posts_per_page' ] = $this->number;
111
+        $query_args['post__in'] = $paid_courses_not_taken;
112
+        $query_args['posts_per_page'] = $this->number;
113 113
 
114
-        $this->query = new WP_Query( $query_args );
114
+        $this->query = new WP_Query($query_args);
115 115
 
116 116
     }// end setup _course_query
117 117
 
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
      *
121 121
      * @return string $content
122 122
      */
123
-    public function render(){
123
+    public function render() {
124 124
 
125 125
         global $wp_query;
126 126
 
127
-        if ( ! is_user_logged_in() ) {
127
+        if ( ! is_user_logged_in()) {
128 128
 
129
-            $anchor_before = '<a href="' . esc_url( sensei_user_login_url() ) . '" >';
129
+            $anchor_before = '<a href="'.esc_url(sensei_user_login_url()).'" >';
130 130
             $anchor_after = '</a>';
131 131
             $notice = sprintf(
132 132
                 __('You must be logged in to view the non-purchased courses. Click here to %slogin%s.'),
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
                 $anchor_after
135 135
             );
136 136
 
137
-            Sensei()->notices->add_notice( $notice, 'info' );
137
+            Sensei()->notices->add_notice($notice, 'info');
138 138
             Sensei()->notices->print_notices();
139 139
 
140 140
             return '';
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         ob_start();
150 150
         Sensei()->notices->print_notices();
151 151
         Sensei_Templates::get_template('loop-course.php');
152
-        $shortcode_output =  ob_get_clean();
152
+        $shortcode_output = ob_get_clean();
153 153
 
154 154
         //restore old query
155 155
         $wp_query = $current_global_query;
Please login to merge, or discard this patch.
includes/class-sensei-language-pack-manager.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if ( ! defined('ABSPATH')) {
4 4
 	exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 	 * Initialize the language pack manager
29 29
 	 */
30 30
 	public function __construct() {
31
-		add_action( 'update_option_WPLANG', array( $this, 'updated_language_option' ), 10, 2 );
32
-		add_filter( 'admin_init', array( $this, 'language_package_actions' ), 10 );
31
+		add_action('update_option_WPLANG', array($this, 'updated_language_option'), 10, 2);
32
+		add_filter('admin_init', array($this, 'language_package_actions'), 10);
33 33
 	}
34 34
 
35 35
 	/**
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 	 *
40 40
 	 * @return string
41 41
 	 */
42
-	public static function get_package_uri( $locale ) {
43
-		return self::$repo . Sensei()->version . '/packages/' . $locale . '.zip';
42
+	public static function get_package_uri($locale) {
43
+		return self::$repo.Sensei()->version.'/packages/'.$locale.'.zip';
44 44
 	}
45 45
 
46 46
 	/**
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @return string
52 52
 	 */
53
-	protected static function get_settings_uri( $action ) {
54
-		return wp_nonce_url( admin_url( 'admin.php?page=woothemes-sensei-settings&action=' . $action ), 'language_pack', '_sensei_language_nonce' );
53
+	protected static function get_settings_uri($action) {
54
+		return wp_nonce_url(admin_url('admin.php?page=woothemes-sensei-settings&action='.$action), 'language_pack', '_sensei_language_nonce');
55 55
 	}
56 56
 
57 57
 	/**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @return string
61 61
 	 */
62 62
 	public static function get_install_uri() {
63
-		return self::get_settings_uri( 'language_pack_install' );
63
+		return self::get_settings_uri('language_pack_install');
64 64
 	}
65 65
 
66 66
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @return string
70 70
 	 */
71 71
 	public static function get_dismiss_uri() {
72
-		return self::get_settings_uri( 'dismiss_language_pack_notice' );
72
+		return self::get_settings_uri('dismiss_language_pack_notice');
73 73
 	}
74 74
 
75 75
 	/**
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 	 * @param string $old
79 79
 	 * @param string $new
80 80
 	 */
81
-	public function updated_language_option( $old, $new ) {
82
-		self::has_language_pack_available( $new );
81
+	public function updated_language_option($old, $new) {
82
+		self::has_language_pack_available($new);
83 83
 	}
84 84
 
85 85
 	/**
@@ -89,42 +89,42 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @return bool
91 91
 	 */
92
-	public static function has_language_pack_available( $locale = null ) {
92
+	public static function has_language_pack_available($locale = null) {
93 93
 
94
-        if ( is_null( $locale ) ) {
94
+        if (is_null($locale)) {
95 95
 
96 96
 			$locale = get_locale();
97 97
 
98 98
 		}
99 99
 
100
-		if ( 'en_US' === $locale ) {
100
+		if ('en_US' === $locale) {
101 101
 
102 102
 			return false;
103 103
 
104 104
 		}
105 105
 
106
-		if ( 'yes' === get_option( 'sensei_needs_language_pack_install' ) ) {
106
+		if ('yes' === get_option('sensei_needs_language_pack_install')) {
107 107
 
108 108
 			return true;
109 109
 
110 110
 		}
111 111
 
112
-        if( isset( $_GET['translation_updated'] ) && 5 ==  $_GET['translation_updated'] ){
112
+        if (isset($_GET['translation_updated']) && 5 == $_GET['translation_updated']) {
113 113
 
114 114
             return false;
115 115
 
116 116
         }
117 117
 
118
-		$version = get_option( 'woothemes_sensei_language_pack_version', array( '0', $locale ) );
118
+		$version = get_option('woothemes_sensei_language_pack_version', array('0', $locale));
119 119
 
120
-		if ( ! is_array( $version ) || version_compare( $version[0], Sensei()->version, '<' ) || $version[1] !== $locale ) {
121
-			if ( self::check_if_language_pack_exists( $locale ) ) {
122
-				update_option( 'sensei_needs_language_pack_install', 'yes' );
120
+		if ( ! is_array($version) || version_compare($version[0], Sensei()->version, '<') || $version[1] !== $locale) {
121
+			if (self::check_if_language_pack_exists($locale)) {
122
+				update_option('sensei_needs_language_pack_install', 'yes');
123 123
 
124 124
 				return true;
125 125
 			} else {
126 126
 				// Updated the woothemes_sensei_language_pack_version to avoid searching translations for this release again
127
-				self::update_language_pack_version( $locale );
127
+				self::update_language_pack_version($locale);
128 128
 			}
129 129
 		}
130 130
 
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 * @return bool
139 139
 	 */
140
-	public static function check_if_language_pack_exists( $locale ) {
141
-		$response = wp_safe_remote_get( self::get_package_uri( $locale ), array( 'timeout' => 60 ) );
140
+	public static function check_if_language_pack_exists($locale) {
141
+		$response = wp_safe_remote_get(self::get_package_uri($locale), array('timeout' => 60));
142 142
 
143
-		if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
143
+		if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
144 144
 			return true;
145 145
 		} else {
146 146
 			return false;
@@ -152,12 +152,12 @@  discard block
 block discarded – undo
152 152
 	 *
153 153
 	 * @param string $locale
154 154
 	 */
155
-	public static function update_language_pack_version( $locale ) {
155
+	public static function update_language_pack_version($locale) {
156 156
 		// Update the language pack version
157
-		update_option( 'woothemes_sensei_language_pack_version', array( Sensei()->version, $locale ) );
157
+		update_option('woothemes_sensei_language_pack_version', array(Sensei()->version, $locale));
158 158
 
159 159
 		// Remove the translation upgrade notice
160
-		update_option( 'sensei_needs_language_pack_install', 'no' );
160
+		update_option('sensei_needs_language_pack_install', 'no');
161 161
 	}
162 162
 
163 163
 	/**
@@ -166,17 +166,17 @@  discard block
 block discarded – undo
166 166
 	public function language_package_actions() {
167 167
 		if (
168 168
 			is_admin()
169
-			&& current_user_can( 'update_plugins' )
170
-			&& isset( $_GET['page'] )
169
+			&& current_user_can('update_plugins')
170
+			&& isset($_GET['page'])
171 171
 			&& 'woothemes-sensei-settings' === $_GET['page']
172
-			&& isset( $_GET['action'] )
172
+			&& isset($_GET['action'])
173 173
 		) {
174 174
 
175
-			if ( 'language_pack_install' === $_GET['action'] ) {
175
+			if ('language_pack_install' === $_GET['action']) {
176 176
 				$this->language_pack_install();
177 177
 			}
178 178
 
179
-			if ( 'dismiss_language_pack_notice' ) {
179
+			if ('dismiss_language_pack_notice') {
180 180
 				$this->dismiss_language_pack_notice();
181 181
 			}
182 182
 		}
@@ -186,66 +186,66 @@  discard block
 block discarded – undo
186 186
 	 * Install language pack.
187 187
 	 */
188 188
 	protected function language_pack_install() {
189
-		$url          = wp_nonce_url( admin_url( 'admin.php?page=woothemes-sensei-settings&action=language_pack_install' ), 'language_install' );
190
-		$settings_url = admin_url( 'admin.php?page=woothemes-sensei-settings' );
189
+		$url          = wp_nonce_url(admin_url('admin.php?page=woothemes-sensei-settings&action=language_pack_install'), 'language_install');
190
+		$settings_url = admin_url('admin.php?page=woothemes-sensei-settings');
191 191
 		$locale       = get_locale();
192 192
 
193
-		if ( ! isset( $_REQUEST['_sensei_language_nonce'] ) && wp_verify_nonce( $_REQUEST['_sensei_language_nonce'], 'language_pack' ) ) {
194
-			wp_redirect( add_query_arg( array( 'translation_updated' => 2 ), $settings_url ) );
193
+		if ( ! isset($_REQUEST['_sensei_language_nonce']) && wp_verify_nonce($_REQUEST['_sensei_language_nonce'], 'language_pack')) {
194
+			wp_redirect(add_query_arg(array('translation_updated' => 2), $settings_url));
195 195
 			exit;
196 196
 		}
197 197
 
198
-		if ( 'en_US' === $locale || ! self::check_if_language_pack_exists( $locale ) ) {
199
-			wp_redirect( add_query_arg( array( 'translation_updated' => 3 ), $settings_url ) );
198
+		if ('en_US' === $locale || ! self::check_if_language_pack_exists($locale)) {
199
+			wp_redirect(add_query_arg(array('translation_updated' => 3), $settings_url));
200 200
 			exit;
201 201
 		}
202 202
 
203
-		if ( false === ( $creds = request_filesystem_credentials( $url, '', false, false, null ) ) ) {
204
-			wp_redirect( add_query_arg( array( 'translation_updated' => 4 ), $settings_url ) );
203
+		if (false === ($creds = request_filesystem_credentials($url, '', false, false, null))) {
204
+			wp_redirect(add_query_arg(array('translation_updated' => 4), $settings_url));
205 205
 			exit;
206 206
 		}
207 207
 
208
-		if ( ! WP_Filesystem( $creds ) ) {
209
-			request_filesystem_credentials( $url, '', true, false, null );
208
+		if ( ! WP_Filesystem($creds)) {
209
+			request_filesystem_credentials($url, '', true, false, null);
210 210
 
211
-			wp_redirect( add_query_arg( array( 'translation_updated' => 4 ), $settings_url ) );
211
+			wp_redirect(add_query_arg(array('translation_updated' => 4), $settings_url));
212 212
 			exit;
213 213
 		}
214 214
 
215 215
 		// Download the language pack
216
-		$response = wp_safe_remote_get( self::get_package_uri( $locale ), array( 'timeout' => 60 ) );
217
-		if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
216
+		$response = wp_safe_remote_get(self::get_package_uri($locale), array('timeout' => 60));
217
+		if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
218 218
 			global $wp_filesystem;
219 219
 
220 220
 			$upload_dir = wp_upload_dir();
221
-			$file       = trailingslashit( $upload_dir['path'] ) . $locale . '.zip';
221
+			$file       = trailingslashit($upload_dir['path']).$locale.'.zip';
222 222
 
223 223
 			// Save the zip file
224
-			if ( ! $wp_filesystem->put_contents( $file, $response['body'], FS_CHMOD_FILE ) ) {
225
-				wp_redirect( add_query_arg( array( 'translation_updated' => 4 ), $settings_url ) );
224
+			if ( ! $wp_filesystem->put_contents($file, $response['body'], FS_CHMOD_FILE)) {
225
+				wp_redirect(add_query_arg(array('translation_updated' => 4), $settings_url));
226 226
 				exit;
227 227
 			}
228 228
 
229 229
 			// Unzip the file to wp-content/languages/plugins directory
230
-			$dir   = trailingslashit( WP_LANG_DIR ) . 'plugins/';
231
-			$unzip = unzip_file( $file, $dir );
232
-			if ( true !== $unzip ) {
233
-				wp_redirect( add_query_arg( array( 'translation_updated' => 4 ), $settings_url ) );
230
+			$dir   = trailingslashit(WP_LANG_DIR).'plugins/';
231
+			$unzip = unzip_file($file, $dir);
232
+			if (true !== $unzip) {
233
+				wp_redirect(add_query_arg(array('translation_updated' => 4), $settings_url));
234 234
 				exit;
235 235
 			}
236 236
 
237 237
 			// Delete the package file
238
-			$wp_filesystem->delete( $file );
238
+			$wp_filesystem->delete($file);
239 239
 
240 240
 			// Update version and remove notice
241
-			self::update_language_pack_version( $locale );
241
+			self::update_language_pack_version($locale);
242 242
 
243 243
 			// Redirect and show a success message
244
-			wp_redirect( add_query_arg( array( 'translation_updated' => 1 ), $settings_url ) );
244
+			wp_redirect(add_query_arg(array('translation_updated' => 1), $settings_url));
245 245
 			exit;
246 246
 		} else {
247 247
 			// Don't have a valid package for the current language!
248
-			wp_redirect( add_query_arg( array( 'translation_updated' => 5 ), $settings_url ) );
248
+			wp_redirect(add_query_arg(array('translation_updated' => 5), $settings_url));
249 249
 			exit;
250 250
 		}
251 251
 	}
@@ -254,38 +254,38 @@  discard block
 block discarded – undo
254 254
 	 * Hide language pack notice.
255 255
 	 */
256 256
 	protected function dismiss_language_pack_notice() {
257
-		if ( ! isset( $_REQUEST['_sensei_language_nonce'] ) && wp_verify_nonce( $_REQUEST['_sensei_language_nonce'], 'language_pack' ) ) {
258
-			wp_die( __( 'Cheatin&#8217; huh?', 'woothemes-sensei' ) );
257
+		if ( ! isset($_REQUEST['_sensei_language_nonce']) && wp_verify_nonce($_REQUEST['_sensei_language_nonce'], 'language_pack')) {
258
+			wp_die(__('Cheatin&#8217; huh?', 'woothemes-sensei'));
259 259
 		}
260 260
 
261 261
 		// Update version and remove notice
262
-		self::update_language_pack_version( get_locale() );
262
+		self::update_language_pack_version(get_locale());
263 263
 	}
264 264
 
265 265
 	/**
266 266
 	 * Language pack messages
267 267
 	 */
268 268
 	public static function messages() {
269
-		if ( empty( $_GET['translation_updated'] ) ) {
269
+		if (empty($_GET['translation_updated'])) {
270 270
 			return;
271 271
 		}
272 272
 
273
-		switch ( $_GET['translation_updated'] ) {
273
+		switch ($_GET['translation_updated']) {
274 274
 			case 2 :
275
-				echo '<div class="error"><p>' . __( 'Failed to install/update the translation:', 'woothemes-sensei' ) . ' ' . __( 'Seems you don\'t have permission to do this!', 'woothemes-sensei' ) . '</p></div>';
275
+				echo '<div class="error"><p>'.__('Failed to install/update the translation:', 'woothemes-sensei').' '.__('Seems you don\'t have permission to do this!', 'woothemes-sensei').'</p></div>';
276 276
 				break;
277 277
 			case 3 :
278
-				echo '<div class="error"><p>' . __( 'Failed to install/update the translation:', 'woothemes-sensei' ) . ' ' . __( 'There is no translation available for your language!', 'woothemes-sensei' ) . '</p></div>';
278
+				echo '<div class="error"><p>'.__('Failed to install/update the translation:', 'woothemes-sensei').' '.__('There is no translation available for your language!', 'woothemes-sensei').'</p></div>';
279 279
 				break;
280 280
 			case 4 :
281
-				echo '<div class="error"><p>' . __( 'Failed to install/update the translation:', 'woothemes-sensei' ) . ' ' . sprintf( __( 'An authentication error occurred while updating the translation. Please try again or configure your %sUpgrade Constants%s.', 'woothemes-sensei' ), '<a href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants">', '</a>' ) . '</p></div>';
281
+				echo '<div class="error"><p>'.__('Failed to install/update the translation:', 'woothemes-sensei').' '.sprintf(__('An authentication error occurred while updating the translation. Please try again or configure your %sUpgrade Constants%s.', 'woothemes-sensei'), '<a href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants">', '</a>').'</p></div>';
282 282
 				break;
283 283
 			case 5 :
284
-				echo '<div class="error"><p>' . __( 'Failed to install/update the translation:', 'woothemes-sensei' ) . ' ' . __( 'Sorry but there is no translation available for your language =/', 'woothemes-sensei' ) . '</p></div>';
284
+				echo '<div class="error"><p>'.__('Failed to install/update the translation:', 'woothemes-sensei').' '.__('Sorry but there is no translation available for your language =/', 'woothemes-sensei').'</p></div>';
285 285
 				break;
286 286
 
287 287
 			default :
288
-				echo '<div class="updated"><p>' . __( 'Translations installed/updated successfully!', 'woothemes-sensei' ) . '</p></div>';
288
+				echo '<div class="updated"><p>'.__('Translations installed/updated successfully!', 'woothemes-sensei').'</p></div>';
289 289
 				break;
290 290
 		}
291 291
 	}
Please login to merge, or discard this patch.
templates/single-message.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 ?>
13 13
 
14
-<?php  get_sensei_header();  ?>
14
+<?php  get_sensei_header(); ?>
15 15
 
16 16
 <article <?php post_class(); ?> >
17 17
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      * @hooked WooThemes_Sensei_Messages::the_title                 - 20
27 27
      * @hooked WooThemes_Sensei_Messages::the_message_sent_by_title - 40
28 28
      */
29
-    do_action( 'sensei_single_message_content_inside_before', get_the_ID());
29
+    do_action('sensei_single_message_content_inside_before', get_the_ID());
30 30
     ?>
31 31
 
32 32
     <section class="entry">
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      *
44 44
      * @param integer $message_id
45 45
      */
46
-    do_action( 'sensei_single_message_content_inside_after', get_the_ID());
46
+    do_action('sensei_single_message_content_inside_after', get_the_ID());
47 47
 
48 48
     ?>
49 49
 </article><!-- .post -->
Please login to merge, or discard this patch.
templates/content-course.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit;
2
+if ( ! defined('ABSPATH')) exit;
3 3
 /**
4 4
  * Content-course.php template file
5 5
  *
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  */
15 15
 ?>
16 16
 
17
-<li <?php post_class(  WooThemes_Sensei_Course::get_course_loop_content_class() ); ?> >
17
+<li <?php post_class(WooThemes_Sensei_Course::get_course_loop_content_class()); ?> >
18 18
 
19 19
     <?php
20 20
     /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      *
26 26
      * @param integer $course_id
27 27
      */
28
-    do_action( 'sensei_course_content_before', get_the_ID() );
28
+    do_action('sensei_course_content_before', get_the_ID());
29 29
     ?>
30 30
 
31 31
     <section class="course-content">
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
              * @hooked Sensei()->course->course_image       - 10
45 45
              * @hooked  Sensei()->course->the_course_meta   - 20
46 46
              */
47
-            do_action('sensei_course_content_inside_before', get_the_ID() );
47
+            do_action('sensei_course_content_inside_before', get_the_ID());
48 48
             ?>
49 49
 
50 50
             <p class="course-excerpt">
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
              *
64 64
              * @hooked  Sensei()->course->the_course_free_lesson_preview - 20
65 65
              */
66
-            do_action('sensei_course_content_inside_after', get_the_ID() );
66
+            do_action('sensei_course_content_inside_after', get_the_ID());
67 67
             ?>
68 68
 
69 69
         </section> <!-- section .entry -->
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
      *
81 81
      * @hooked  Sensei()->course->the_course_free_lesson_preview - 20
82 82
      */
83
-    do_action('sensei_course_content_after', get_the_ID() );
83
+    do_action('sensei_course_content_after', get_the_ID());
84 84
     ?>
85 85
 
86 86
 
87
-</li> <!-- article .(<?php esc_attr_e( join( ' ', get_post_class( array( 'course', 'post' ) ) ) ); ?>  -->
88 87
\ No newline at end of file
88
+</li> <!-- article .(<?php esc_attr_e(join(' ', get_post_class(array('course', 'post')))); ?>  -->
89 89
\ No newline at end of file
Please login to merge, or discard this patch.