@@ -325,7 +325,7 @@ |
||
| 325 | 325 | * |
| 326 | 326 | * @param array $classes |
| 327 | 327 | * @param WP_Post $course |
| 328 | - * @return array $classes |
|
| 328 | + * @return string[] $classes |
|
| 329 | 329 | */ |
| 330 | 330 | public function course_status_class_tagging($classes, $course){ |
| 331 | 331 | |
@@ -1,5 +1,5 @@ discard block |
||
| 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 | * This class is loaded int WP by the shortcode loader class. |
| 5 | 5 | * |
@@ -59,26 +59,26 @@ discard block |
||
| 59 | 59 | * @param string $content |
| 60 | 60 | * @param string $shortcode the shortcode that was called for this instance |
| 61 | 61 | */ |
| 62 | - public function __construct( $attributes, $content, $shortcode ){ |
|
| 62 | + public function __construct($attributes, $content, $shortcode) { |
|
| 63 | 63 | |
| 64 | - if(! is_user_logged_in() ) { |
|
| 64 | + if ( ! is_user_logged_in()) { |
|
| 65 | 65 | return; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // set up all argument need for constructing the course query |
| 69 | - $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '10'; |
|
| 70 | - $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'title'; |
|
| 71 | - $this->status = isset( $attributes['status'] ) ? $attributes['status'] : 'all'; |
|
| 69 | + $this->number = isset($attributes['number']) ? $attributes['number'] : '10'; |
|
| 70 | + $this->orderby = isset($attributes['orderby']) ? $attributes['orderby'] : 'title'; |
|
| 71 | + $this->status = isset($attributes['status']) ? $attributes['status'] : 'all'; |
|
| 72 | 72 | |
| 73 | 73 | // set the default for menu_order to be ASC |
| 74 | - if( 'menu_order' == $this->orderby && !isset( $attributes['order'] ) ){ |
|
| 74 | + if ('menu_order' == $this->orderby && ! isset($attributes['order'])) { |
|
| 75 | 75 | |
| 76 | - $this->order = 'ASC'; |
|
| 76 | + $this->order = 'ASC'; |
|
| 77 | 77 | |
| 78 | - }else{ |
|
| 78 | + } else { |
|
| 79 | 79 | |
| 80 | 80 | // for everything else use the value passed or the default DESC |
| 81 | - $this->order = isset( $attributes['order'] ) ? $attributes['order'] : 'ASC'; |
|
| 81 | + $this->order = isset($attributes['order']) ? $attributes['order'] : 'ASC'; |
|
| 82 | 82 | |
| 83 | 83 | } |
| 84 | 84 | |
@@ -92,20 +92,20 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @since 1.9.0 |
| 94 | 94 | */ |
| 95 | - protected function setup_course_query(){ |
|
| 95 | + protected function setup_course_query() { |
|
| 96 | 96 | |
| 97 | - $status_query = array( 'user_id' => get_current_user_id(), 'type' => 'sensei_course_status' ); |
|
| 98 | - $user_courses_logs = Sensei_Utils::sensei_check_for_activity( $status_query , true ); |
|
| 99 | - if ( !is_array($user_courses_logs) ) { |
|
| 97 | + $status_query = array('user_id' => get_current_user_id(), 'type' => 'sensei_course_status'); |
|
| 98 | + $user_courses_logs = Sensei_Utils::sensei_check_for_activity($status_query, true); |
|
| 99 | + if ( ! is_array($user_courses_logs)) { |
|
| 100 | 100 | |
| 101 | - $user_courses_logs = array( $user_courses_logs ); |
|
| 101 | + $user_courses_logs = array($user_courses_logs); |
|
| 102 | 102 | |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | $completed_ids = $active_ids = array(); |
| 106 | - foreach( $user_courses_logs as $course_status ) { |
|
| 106 | + foreach ($user_courses_logs as $course_status) { |
|
| 107 | 107 | |
| 108 | - if ( Sensei_Utils::user_completed_course( $course_status, get_current_user_id() ) ) { |
|
| 108 | + if (Sensei_Utils::user_completed_course($course_status, get_current_user_id())) { |
|
| 109 | 109 | |
| 110 | 110 | $completed_ids[] = $course_status->comment_post_ID; |
| 111 | 111 | |
@@ -116,34 +116,34 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - if( 'completed' == $this->status ){ |
|
| 119 | + if ('completed' == $this->status) { |
|
| 120 | 120 | |
| 121 | - $included_courses = $completed_ids; |
|
| 121 | + $included_courses = $completed_ids; |
|
| 122 | 122 | |
| 123 | 123 | |
| 124 | - }elseif( 'active'==$this->status ){ |
|
| 124 | + }elseif ('active' == $this->status) { |
|
| 125 | 125 | |
| 126 | - $included_courses = $active_ids; |
|
| 126 | + $included_courses = $active_ids; |
|
| 127 | 127 | |
| 128 | - }else{ // all courses |
|
| 128 | + } else { // all courses |
|
| 129 | 129 | |
| 130 | - if( empty( $completed_ids ) ){ |
|
| 130 | + if (empty($completed_ids)) { |
|
| 131 | 131 | |
| 132 | - add_action( 'sensei_loop_course_inside_before', array( $this, 'completed_no_course_message_output' ) ); |
|
| 132 | + add_action('sensei_loop_course_inside_before', array($this, 'completed_no_course_message_output')); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if( empty( $active_ids ) ){ |
|
| 135 | + if (empty($active_ids)) { |
|
| 136 | 136 | |
| 137 | - add_action( 'sensei_loop_course_inside_before', array( $this, 'active_no_course_message_output' ) ); |
|
| 137 | + add_action('sensei_loop_course_inside_before', array($this, 'active_no_course_message_output')); |
|
| 138 | 138 | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - if( empty( $completed_ids ) && empty( $active_ids ) ){ |
|
| 141 | + if (empty($completed_ids) && empty($active_ids)) { |
|
| 142 | 142 | |
| 143 | 143 | $included_courses = array('-1000'); // don't show any courses |
| 144 | 144 | |
| 145 | - }else{ |
|
| 146 | - $included_courses = Sensei_Utils::array_zip_merge( $active_ids, $completed_ids ); |
|
| 145 | + } else { |
|
| 146 | + $included_courses = Sensei_Utils::array_zip_merge($active_ids, $completed_ids); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | // if the shortcode is not active or in active and the active and completed |
| 155 | 155 | // tabs show up. |
| 156 | 156 | $number_of_posts = $this->number; |
| 157 | - if( 'active' != $this->status && 'complete' != $this->status ){ |
|
| 157 | + if ('active' != $this->status && 'complete' != $this->status) { |
|
| 158 | 158 | $number_of_posts = 1000; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -165,12 +165,12 @@ discard block |
||
| 165 | 165 | 'post_status' => 'publish', |
| 166 | 166 | 'orderby' => $this->orderby, |
| 167 | 167 | 'order' => $this->order, |
| 168 | - 'paged' => empty( $query_var_paged )? 1 : $query_var_paged, |
|
| 168 | + 'paged' => empty($query_var_paged) ? 1 : $query_var_paged, |
|
| 169 | 169 | 'posts_per_page' => $number_of_posts, |
| 170 | 170 | 'post__in' => $included_courses, |
| 171 | 171 | ); |
| 172 | 172 | |
| 173 | - $this->query = new WP_Query( $query_args ); |
|
| 173 | + $this->query = new WP_Query($query_args); |
|
| 174 | 174 | |
| 175 | 175 | }// end setup _course_query |
| 176 | 176 | |
@@ -180,12 +180,12 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @since 1.9.0 |
| 182 | 182 | */ |
| 183 | - public function completed_no_course_message_output(){ |
|
| 183 | + public function completed_no_course_message_output() { |
|
| 184 | 184 | ?> |
| 185 | 185 | <li class="user-completed"> |
| 186 | 186 | <div class="sensei-message info"> |
| 187 | 187 | |
| 188 | - <?php _e( 'You have not completed any courses yet.', 'woothemes-sensei' ); ?> |
|
| 188 | + <?php _e('You have not completed any courses yet.', 'woothemes-sensei'); ?> |
|
| 189 | 189 | |
| 190 | 190 | </div> |
| 191 | 191 | </li> |
@@ -198,17 +198,17 @@ discard block |
||
| 198 | 198 | * |
| 199 | 199 | * @since 1.9.0 |
| 200 | 200 | */ |
| 201 | - public function active_no_course_message_output(){ |
|
| 201 | + public function active_no_course_message_output() { |
|
| 202 | 202 | ?> |
| 203 | 203 | |
| 204 | 204 | <li class="user-active"> |
| 205 | 205 | <div class="sensei-message info"> |
| 206 | 206 | |
| 207 | - <?php _e( 'You have no active courses.', 'woothemes-sensei' ); ?> |
|
| 207 | + <?php _e('You have no active courses.', 'woothemes-sensei'); ?> |
|
| 208 | 208 | |
| 209 | - <a href="<?php esc_attr_e( Sensei_Course::get_courses_page_url() ); ?>"> |
|
| 209 | + <a href="<?php esc_attr_e(Sensei_Course::get_courses_page_url()); ?>"> |
|
| 210 | 210 | |
| 211 | - <?php _e( 'Start a Course!', 'woothemes-sensei' ); ?> |
|
| 211 | + <?php _e('Start a Course!', 'woothemes-sensei'); ?> |
|
| 212 | 212 | |
| 213 | 213 | </a> |
| 214 | 214 | |
@@ -222,11 +222,11 @@ discard block |
||
| 222 | 222 | * |
| 223 | 223 | * @return string $content |
| 224 | 224 | */ |
| 225 | - public function render(){ |
|
| 225 | + public function render() { |
|
| 226 | 226 | |
| 227 | 227 | global $wp_query; |
| 228 | 228 | |
| 229 | - if(! is_user_logged_in() ) { |
|
| 229 | + if ( ! is_user_logged_in()) { |
|
| 230 | 230 | return ''; |
| 231 | 231 | } |
| 232 | 232 | |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | Sensei_Messages::the_my_messages_link(); |
| 243 | 243 | Sensei_Templates::get_template('loop-course.php'); |
| 244 | 244 | Sensei_Templates::get_template('globals/pagination.php'); |
| 245 | - $shortcode_output = ob_get_clean(); |
|
| 245 | + $shortcode_output = ob_get_clean(); |
|
| 246 | 246 | |
| 247 | 247 | $this->detach_shortcode_hooks(); |
| 248 | 248 | |
@@ -258,23 +258,23 @@ discard block |
||
| 258 | 258 | * |
| 259 | 259 | * @since 1.9.0 |
| 260 | 260 | */ |
| 261 | - public function attach_shortcode_hooks(){ |
|
| 261 | + public function attach_shortcode_hooks() { |
|
| 262 | 262 | |
| 263 | 263 | // attach the toggle functionality |
| 264 | 264 | // don't show the toggle action if the user specified complete or active for this shortcode |
| 265 | - if( ! in_array( $this->status, array( 'active', 'complete' ) ) ){ |
|
| 265 | + if ( ! in_array($this->status, array('active', 'complete'))) { |
|
| 266 | 266 | |
| 267 | - add_action( 'sensei_loop_course_before', array( $this, 'course_toggle_actions' ) ); |
|
| 268 | - add_action( 'wp_footer', array( $this, 'print_course_toggle_actions_inline_script' ), 90 ); |
|
| 267 | + add_action('sensei_loop_course_before', array($this, 'course_toggle_actions')); |
|
| 268 | + add_action('wp_footer', array($this, 'print_course_toggle_actions_inline_script'), 90); |
|
| 269 | 269 | |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | // add extra classes to distinguish the course based on user completed or active |
| 273 | - add_filter( 'sensei_course_loop_content_class', array( $this, 'course_status_class_tagging' ), 20, 2 ); |
|
| 273 | + add_filter('sensei_course_loop_content_class', array($this, 'course_status_class_tagging'), 20, 2); |
|
| 274 | 274 | |
| 275 | 275 | // attach progress meter below course |
| 276 | - add_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_progress' ) ); |
|
| 277 | - add_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_buttons' ) ); |
|
| 276 | + add_action('sensei_course_content_inside_after', array($this, 'attach_course_progress')); |
|
| 277 | + add_action('sensei_course_content_inside_after', array($this, 'attach_course_buttons')); |
|
| 278 | 278 | |
| 279 | 279 | } |
| 280 | 280 | |
@@ -283,13 +283,13 @@ discard block |
||
| 283 | 283 | * |
| 284 | 284 | * @since 1.9.0 |
| 285 | 285 | */ |
| 286 | - public function detach_shortcode_hooks(){ |
|
| 286 | + public function detach_shortcode_hooks() { |
|
| 287 | 287 | |
| 288 | 288 | //remove all hooks after the output is generated |
| 289 | - remove_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_progress' ) ); |
|
| 290 | - remove_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_buttons' ) ); |
|
| 291 | - remove_filter( 'sensei_course_loop_content_class', array( $this, 'course_status_class_tagging' ), 20, 2 ); |
|
| 292 | - remove_action( 'sensei_loop_course_before', array( $this, 'course_toggle_actions' ) ); |
|
| 289 | + remove_action('sensei_course_content_inside_after', array($this, 'attach_course_progress')); |
|
| 290 | + remove_action('sensei_course_content_inside_after', array($this, 'attach_course_buttons')); |
|
| 291 | + remove_filter('sensei_course_loop_content_class', array($this, 'course_status_class_tagging'), 20, 2); |
|
| 292 | + remove_action('sensei_loop_course_before', array($this, 'course_toggle_actions')); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | /** |
@@ -297,10 +297,10 @@ discard block |
||
| 297 | 297 | * |
| 298 | 298 | * @param $course |
| 299 | 299 | */ |
| 300 | - public function attach_course_progress( $course ){ |
|
| 300 | + public function attach_course_progress($course) { |
|
| 301 | 301 | |
| 302 | - $percentage = Sensei()->course->get_completion_percentage( $course->ID, get_current_user_id() ); |
|
| 303 | - echo Sensei()->course->get_progress_meter( $percentage ); |
|
| 302 | + $percentage = Sensei()->course->get_completion_percentage($course->ID, get_current_user_id()); |
|
| 303 | + echo Sensei()->course->get_progress_meter($percentage); |
|
| 304 | 304 | |
| 305 | 305 | }// attach_course_progress |
| 306 | 306 | |
@@ -312,9 +312,9 @@ discard block |
||
| 312 | 312 | * |
| 313 | 313 | * @param $course |
| 314 | 314 | */ |
| 315 | - public function attach_course_buttons( $course ){ |
|
| 315 | + public function attach_course_buttons($course) { |
|
| 316 | 316 | |
| 317 | - Sensei()->course->the_course_action_buttons( $course ); |
|
| 317 | + Sensei()->course->the_course_action_buttons($course); |
|
| 318 | 318 | |
| 319 | 319 | }// attach_course_buttons |
| 320 | 320 | |
@@ -327,9 +327,9 @@ discard block |
||
| 327 | 327 | * @param WP_Post $course |
| 328 | 328 | * @return array $classes |
| 329 | 329 | */ |
| 330 | - public function course_status_class_tagging($classes, $course){ |
|
| 330 | + public function course_status_class_tagging($classes, $course) { |
|
| 331 | 331 | |
| 332 | - if ( Sensei_Utils::user_completed_course( $course, get_current_user_id() ) ) { |
|
| 332 | + if (Sensei_Utils::user_completed_course($course, get_current_user_id())) { |
|
| 333 | 333 | |
| 334 | 334 | $classes[] = 'user-completed'; |
| 335 | 335 | |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | /** |
| 347 | 347 | * Output the course toggle functionality |
| 348 | 348 | */ |
| 349 | - public function course_toggle_actions(){ ?> |
|
| 349 | + public function course_toggle_actions() { ?> |
|
| 350 | 350 | |
| 351 | 351 | <section id="user-course-status-toggle"> |
| 352 | 352 | <a id="sensei-user-courses-active-action" href=""><?php _e('Active Courses'); ?></a> |
@@ -1,5 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + exit; |
|
| 4 | +} |
|
| 5 | +// Exit if accessed directly |
|
| 3 | 6 | /** |
| 4 | 7 | * This class is loaded int WP by the shortcode loader class. |
| 5 | 8 | * |
@@ -75,7 +78,7 @@ discard block |
||
| 75 | 78 | |
| 76 | 79 | $this->order = 'ASC'; |
| 77 | 80 | |
| 78 | - }else{ |
|
| 81 | + } else{ |
|
| 79 | 82 | |
| 80 | 83 | // for everything else use the value passed or the default DESC |
| 81 | 84 | $this->order = isset( $attributes['order'] ) ? $attributes['order'] : 'ASC'; |
@@ -121,11 +124,11 @@ discard block |
||
| 121 | 124 | $included_courses = $completed_ids; |
| 122 | 125 | |
| 123 | 126 | |
| 124 | - }elseif( 'active'==$this->status ){ |
|
| 127 | + } elseif( 'active'==$this->status ){ |
|
| 125 | 128 | |
| 126 | 129 | $included_courses = $active_ids; |
| 127 | 130 | |
| 128 | - }else{ // all courses |
|
| 131 | + } else{ // all courses |
|
| 129 | 132 | |
| 130 | 133 | if( empty( $completed_ids ) ){ |
| 131 | 134 | |
@@ -142,7 +145,7 @@ discard block |
||
| 142 | 145 | |
| 143 | 146 | $included_courses = array('-1000'); // don't show any courses |
| 144 | 147 | |
| 145 | - }else{ |
|
| 148 | + } else{ |
|
| 146 | 149 | $included_courses = Sensei_Utils::array_zip_merge( $active_ids, $completed_ids ); |
| 147 | 150 | } |
| 148 | 151 | |
@@ -23,165 +23,165 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | class Sensei_Shortcode_User_Courses implements Sensei_Shortcode_Interface { |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @var WP_Query to help setup the query needed by the render method. |
|
| 28 | - */ |
|
| 29 | - protected $query; |
|
| 26 | + /** |
|
| 27 | + * @var WP_Query to help setup the query needed by the render method. |
|
| 28 | + */ |
|
| 29 | + protected $query; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @var string number of items to show on the current page |
|
| 33 | - * Default: -1. |
|
| 34 | - */ |
|
| 35 | - protected $number; |
|
| 31 | + /** |
|
| 32 | + * @var string number of items to show on the current page |
|
| 33 | + * Default: -1. |
|
| 34 | + */ |
|
| 35 | + protected $number; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @var string ordery by course field |
|
| 39 | - * Default: date |
|
| 40 | - */ |
|
| 41 | - protected $orderby; |
|
| 37 | + /** |
|
| 38 | + * @var string ordery by course field |
|
| 39 | + * Default: date |
|
| 40 | + */ |
|
| 41 | + protected $orderby; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * @var string ASC or DESC |
|
| 45 | - * Default: 'DESC' |
|
| 46 | - */ |
|
| 47 | - protected $order; |
|
| 43 | + /** |
|
| 44 | + * @var string ASC or DESC |
|
| 45 | + * Default: 'DESC' |
|
| 46 | + */ |
|
| 47 | + protected $order; |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @var status can be completed or active. If none is specified all will be shown |
|
| 51 | - */ |
|
| 52 | - protected $status; |
|
| 49 | + /** |
|
| 50 | + * @var status can be completed or active. If none is specified all will be shown |
|
| 51 | + */ |
|
| 52 | + protected $status; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Setup the shortcode object |
|
| 56 | - * |
|
| 57 | - * @since 1.9.0 |
|
| 58 | - * @param array $attributes |
|
| 59 | - * @param string $content |
|
| 60 | - * @param string $shortcode the shortcode that was called for this instance |
|
| 61 | - */ |
|
| 62 | - public function __construct( $attributes, $content, $shortcode ){ |
|
| 54 | + /** |
|
| 55 | + * Setup the shortcode object |
|
| 56 | + * |
|
| 57 | + * @since 1.9.0 |
|
| 58 | + * @param array $attributes |
|
| 59 | + * @param string $content |
|
| 60 | + * @param string $shortcode the shortcode that was called for this instance |
|
| 61 | + */ |
|
| 62 | + public function __construct( $attributes, $content, $shortcode ){ |
|
| 63 | 63 | |
| 64 | - if(! is_user_logged_in() ) { |
|
| 65 | - return; |
|
| 66 | - } |
|
| 64 | + if(! is_user_logged_in() ) { |
|
| 65 | + return; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - // set up all argument need for constructing the course query |
|
| 69 | - $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '10'; |
|
| 70 | - $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'title'; |
|
| 71 | - $this->status = isset( $attributes['status'] ) ? $attributes['status'] : 'all'; |
|
| 68 | + // set up all argument need for constructing the course query |
|
| 69 | + $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '10'; |
|
| 70 | + $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'title'; |
|
| 71 | + $this->status = isset( $attributes['status'] ) ? $attributes['status'] : 'all'; |
|
| 72 | 72 | |
| 73 | - // set the default for menu_order to be ASC |
|
| 74 | - if( 'menu_order' == $this->orderby && !isset( $attributes['order'] ) ){ |
|
| 73 | + // set the default for menu_order to be ASC |
|
| 74 | + if( 'menu_order' == $this->orderby && !isset( $attributes['order'] ) ){ |
|
| 75 | 75 | |
| 76 | - $this->order = 'ASC'; |
|
| 76 | + $this->order = 'ASC'; |
|
| 77 | 77 | |
| 78 | - }else{ |
|
| 78 | + }else{ |
|
| 79 | 79 | |
| 80 | - // for everything else use the value passed or the default DESC |
|
| 81 | - $this->order = isset( $attributes['order'] ) ? $attributes['order'] : 'ASC'; |
|
| 80 | + // for everything else use the value passed or the default DESC |
|
| 81 | + $this->order = isset( $attributes['order'] ) ? $attributes['order'] : 'ASC'; |
|
| 82 | 82 | |
| 83 | - } |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - // setup the course query that will be used when rendering |
|
| 86 | - $this->setup_course_query(); |
|
| 87 | - } |
|
| 85 | + // setup the course query that will be used when rendering |
|
| 86 | + $this->setup_course_query(); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * Sets up the object course query |
|
| 91 | - * that will be used in the render method. |
|
| 92 | - * |
|
| 93 | - * @since 1.9.0 |
|
| 94 | - */ |
|
| 95 | - protected function setup_course_query(){ |
|
| 89 | + /** |
|
| 90 | + * Sets up the object course query |
|
| 91 | + * that will be used in the render method. |
|
| 92 | + * |
|
| 93 | + * @since 1.9.0 |
|
| 94 | + */ |
|
| 95 | + protected function setup_course_query(){ |
|
| 96 | 96 | |
| 97 | - $status_query = array( 'user_id' => get_current_user_id(), 'type' => 'sensei_course_status' ); |
|
| 98 | - $user_courses_logs = Sensei_Utils::sensei_check_for_activity( $status_query , true ); |
|
| 99 | - if ( !is_array($user_courses_logs) ) { |
|
| 97 | + $status_query = array( 'user_id' => get_current_user_id(), 'type' => 'sensei_course_status' ); |
|
| 98 | + $user_courses_logs = Sensei_Utils::sensei_check_for_activity( $status_query , true ); |
|
| 99 | + if ( !is_array($user_courses_logs) ) { |
|
| 100 | 100 | |
| 101 | - $user_courses_logs = array( $user_courses_logs ); |
|
| 101 | + $user_courses_logs = array( $user_courses_logs ); |
|
| 102 | 102 | |
| 103 | - } |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - $completed_ids = $active_ids = array(); |
|
| 106 | - foreach( $user_courses_logs as $course_status ) { |
|
| 105 | + $completed_ids = $active_ids = array(); |
|
| 106 | + foreach( $user_courses_logs as $course_status ) { |
|
| 107 | 107 | |
| 108 | - if ( Sensei_Utils::user_completed_course( $course_status, get_current_user_id() ) ) { |
|
| 108 | + if ( Sensei_Utils::user_completed_course( $course_status, get_current_user_id() ) ) { |
|
| 109 | 109 | |
| 110 | - $completed_ids[] = $course_status->comment_post_ID; |
|
| 110 | + $completed_ids[] = $course_status->comment_post_ID; |
|
| 111 | 111 | |
| 112 | - } else { |
|
| 112 | + } else { |
|
| 113 | 113 | |
| 114 | - $active_ids[] = $course_status->comment_post_ID; |
|
| 114 | + $active_ids[] = $course_status->comment_post_ID; |
|
| 115 | 115 | |
| 116 | - } |
|
| 117 | - } |
|
| 116 | + } |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | - if( 'completed' == $this->status ){ |
|
| 119 | + if( 'completed' == $this->status ){ |
|
| 120 | 120 | |
| 121 | - $included_courses = $completed_ids; |
|
| 121 | + $included_courses = $completed_ids; |
|
| 122 | 122 | |
| 123 | 123 | |
| 124 | - }elseif( 'active'==$this->status ){ |
|
| 124 | + }elseif( 'active'==$this->status ){ |
|
| 125 | 125 | |
| 126 | - $included_courses = $active_ids; |
|
| 126 | + $included_courses = $active_ids; |
|
| 127 | 127 | |
| 128 | - }else{ // all courses |
|
| 128 | + }else{ // all courses |
|
| 129 | 129 | |
| 130 | - if( empty( $completed_ids ) ){ |
|
| 130 | + if( empty( $completed_ids ) ){ |
|
| 131 | 131 | |
| 132 | - add_action( 'sensei_loop_course_inside_before', array( $this, 'completed_no_course_message_output' ) ); |
|
| 133 | - } |
|
| 132 | + add_action( 'sensei_loop_course_inside_before', array( $this, 'completed_no_course_message_output' ) ); |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - if( empty( $active_ids ) ){ |
|
| 135 | + if( empty( $active_ids ) ){ |
|
| 136 | 136 | |
| 137 | - add_action( 'sensei_loop_course_inside_before', array( $this, 'active_no_course_message_output' ) ); |
|
| 137 | + add_action( 'sensei_loop_course_inside_before', array( $this, 'active_no_course_message_output' ) ); |
|
| 138 | 138 | |
| 139 | - } |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | - if( empty( $completed_ids ) && empty( $active_ids ) ){ |
|
| 141 | + if( empty( $completed_ids ) && empty( $active_ids ) ){ |
|
| 142 | 142 | |
| 143 | - $included_courses = array('-1000'); // don't show any courses |
|
| 143 | + $included_courses = array('-1000'); // don't show any courses |
|
| 144 | 144 | |
| 145 | - }else{ |
|
| 146 | - $included_courses = Sensei_Utils::array_zip_merge( $active_ids, $completed_ids ); |
|
| 147 | - } |
|
| 145 | + }else{ |
|
| 146 | + $included_courses = Sensei_Utils::array_zip_merge( $active_ids, $completed_ids ); |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + // temporary work around to hide pagination on the courses page |
|
| 153 | + // this is in place until we can load the course for each tab via ajax |
|
| 154 | + // if the shortcode is not active or in active and the active and completed |
|
| 155 | + // tabs show up. |
|
| 156 | + $number_of_posts = $this->number; |
|
| 157 | + if( 'active' != $this->status && 'complete' != $this->status ){ |
|
| 158 | + $number_of_posts = 1000; |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + // course query parameters |
|
| 162 | + $query_var_paged = get_query_var('paged'); |
|
| 163 | + $query_args = array( |
|
| 164 | + 'post_type' => 'course', |
|
| 165 | + 'post_status' => 'publish', |
|
| 166 | + 'orderby' => $this->orderby, |
|
| 167 | + 'order' => $this->order, |
|
| 168 | + 'paged' => empty( $query_var_paged )? 1 : $query_var_paged, |
|
| 169 | + 'posts_per_page' => $number_of_posts, |
|
| 170 | + 'post__in' => $included_courses, |
|
| 171 | + ); |
|
| 172 | + |
|
| 173 | + $this->query = new WP_Query( $query_args ); |
|
| 148 | 174 | |
| 175 | + }// end setup _course_query |
|
| 149 | 176 | |
| 150 | - } |
|
| 151 | - |
|
| 152 | - // temporary work around to hide pagination on the courses page |
|
| 153 | - // this is in place until we can load the course for each tab via ajax |
|
| 154 | - // if the shortcode is not active or in active and the active and completed |
|
| 155 | - // tabs show up. |
|
| 156 | - $number_of_posts = $this->number; |
|
| 157 | - if( 'active' != $this->status && 'complete' != $this->status ){ |
|
| 158 | - $number_of_posts = 1000; |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - // course query parameters |
|
| 162 | - $query_var_paged = get_query_var('paged'); |
|
| 163 | - $query_args = array( |
|
| 164 | - 'post_type' => 'course', |
|
| 165 | - 'post_status' => 'publish', |
|
| 166 | - 'orderby' => $this->orderby, |
|
| 167 | - 'order' => $this->order, |
|
| 168 | - 'paged' => empty( $query_var_paged )? 1 : $query_var_paged, |
|
| 169 | - 'posts_per_page' => $number_of_posts, |
|
| 170 | - 'post__in' => $included_courses, |
|
| 171 | - ); |
|
| 172 | - |
|
| 173 | - $this->query = new WP_Query( $query_args ); |
|
| 174 | - |
|
| 175 | - }// end setup _course_query |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * Output the message that tells the user they have |
|
| 179 | - * no completed courses. |
|
| 180 | - * |
|
| 181 | - * @since 1.9.0 |
|
| 182 | - */ |
|
| 183 | - public function completed_no_course_message_output(){ |
|
| 184 | - ?> |
|
| 177 | + /** |
|
| 178 | + * Output the message that tells the user they have |
|
| 179 | + * no completed courses. |
|
| 180 | + * |
|
| 181 | + * @since 1.9.0 |
|
| 182 | + */ |
|
| 183 | + public function completed_no_course_message_output(){ |
|
| 184 | + ?> |
|
| 185 | 185 | <li class="user-completed"> |
| 186 | 186 | <div class="sensei-message info"> |
| 187 | 187 | |
@@ -190,16 +190,16 @@ discard block |
||
| 190 | 190 | </div> |
| 191 | 191 | </li> |
| 192 | 192 | <?php |
| 193 | - } |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | - /** |
|
| 196 | - * Output the message that tells the user they have |
|
| 197 | - * no active courses. |
|
| 198 | - * |
|
| 199 | - * @since 1.9.0 |
|
| 200 | - */ |
|
| 201 | - public function active_no_course_message_output(){ |
|
| 202 | - ?> |
|
| 195 | + /** |
|
| 196 | + * Output the message that tells the user they have |
|
| 197 | + * no active courses. |
|
| 198 | + * |
|
| 199 | + * @since 1.9.0 |
|
| 200 | + */ |
|
| 201 | + public function active_no_course_message_output(){ |
|
| 202 | + ?> |
|
| 203 | 203 | |
| 204 | 204 | <li class="user-active"> |
| 205 | 205 | <div class="sensei-message info"> |
@@ -215,141 +215,141 @@ discard block |
||
| 215 | 215 | </div> |
| 216 | 216 | </li> |
| 217 | 217 | <?php |
| 218 | - } |
|
| 218 | + } |
|
| 219 | 219 | |
| 220 | - /** |
|
| 221 | - * Rendering the shortcode this class is responsible for. |
|
| 222 | - * |
|
| 223 | - * @return string $content |
|
| 224 | - */ |
|
| 225 | - public function render(){ |
|
| 220 | + /** |
|
| 221 | + * Rendering the shortcode this class is responsible for. |
|
| 222 | + * |
|
| 223 | + * @return string $content |
|
| 224 | + */ |
|
| 225 | + public function render(){ |
|
| 226 | 226 | |
| 227 | - global $wp_query; |
|
| 227 | + global $wp_query; |
|
| 228 | 228 | |
| 229 | - if(! is_user_logged_in() ) { |
|
| 230 | - return ''; |
|
| 231 | - } |
|
| 229 | + if(! is_user_logged_in() ) { |
|
| 230 | + return ''; |
|
| 231 | + } |
|
| 232 | 232 | |
| 233 | - // keep a reference to old query |
|
| 234 | - $current_global_query = $wp_query; |
|
| 233 | + // keep a reference to old query |
|
| 234 | + $current_global_query = $wp_query; |
|
| 235 | 235 | |
| 236 | - // assign the query setup in $this-> setup_course_query |
|
| 237 | - $wp_query = $this->query; |
|
| 236 | + // assign the query setup in $this-> setup_course_query |
|
| 237 | + $wp_query = $this->query; |
|
| 238 | 238 | |
| 239 | - $this->attach_shortcode_hooks(); |
|
| 239 | + $this->attach_shortcode_hooks(); |
|
| 240 | 240 | |
| 241 | - ob_start(); |
|
| 242 | - echo '<section id="sensei-user-courses">'; |
|
| 243 | - Sensei_Messages::the_my_messages_link(); |
|
| 244 | - Sensei_Templates::get_template('loop-course.php'); |
|
| 245 | - Sensei_Templates::get_template('globals/pagination.php'); |
|
| 246 | - echo '</section>'; |
|
| 241 | + ob_start(); |
|
| 242 | + echo '<section id="sensei-user-courses">'; |
|
| 243 | + Sensei_Messages::the_my_messages_link(); |
|
| 244 | + Sensei_Templates::get_template('loop-course.php'); |
|
| 245 | + Sensei_Templates::get_template('globals/pagination.php'); |
|
| 246 | + echo '</section>'; |
|
| 247 | 247 | |
| 248 | - $shortcode_output = ob_get_clean(); |
|
| 248 | + $shortcode_output = ob_get_clean(); |
|
| 249 | 249 | |
| 250 | - $this->detach_shortcode_hooks(); |
|
| 250 | + $this->detach_shortcode_hooks(); |
|
| 251 | 251 | |
| 252 | - //restore old query |
|
| 253 | - $wp_query = $current_global_query; |
|
| 252 | + //restore old query |
|
| 253 | + $wp_query = $current_global_query; |
|
| 254 | 254 | |
| 255 | - return $shortcode_output; |
|
| 255 | + return $shortcode_output; |
|
| 256 | 256 | |
| 257 | - }// end render |
|
| 257 | + }// end render |
|
| 258 | 258 | |
| 259 | - /** |
|
| 260 | - * Add hooks for the shortcode |
|
| 261 | - * |
|
| 262 | - * @since 1.9.0 |
|
| 263 | - */ |
|
| 264 | - public function attach_shortcode_hooks(){ |
|
| 259 | + /** |
|
| 260 | + * Add hooks for the shortcode |
|
| 261 | + * |
|
| 262 | + * @since 1.9.0 |
|
| 263 | + */ |
|
| 264 | + public function attach_shortcode_hooks(){ |
|
| 265 | 265 | |
| 266 | - // attach the toggle functionality |
|
| 267 | - // don't show the toggle action if the user specified complete or active for this shortcode |
|
| 268 | - if( ! in_array( $this->status, array( 'active', 'complete' ) ) ){ |
|
| 266 | + // attach the toggle functionality |
|
| 267 | + // don't show the toggle action if the user specified complete or active for this shortcode |
|
| 268 | + if( ! in_array( $this->status, array( 'active', 'complete' ) ) ){ |
|
| 269 | 269 | |
| 270 | - add_action( 'sensei_loop_course_before', array( $this, 'course_toggle_actions' ) ); |
|
| 271 | - add_action( 'wp_footer', array( $this, 'print_course_toggle_actions_inline_script' ), 90 ); |
|
| 270 | + add_action( 'sensei_loop_course_before', array( $this, 'course_toggle_actions' ) ); |
|
| 271 | + add_action( 'wp_footer', array( $this, 'print_course_toggle_actions_inline_script' ), 90 ); |
|
| 272 | 272 | |
| 273 | - } |
|
| 273 | + } |
|
| 274 | 274 | |
| 275 | - // add extra classes to distinguish the course based on user completed or active |
|
| 276 | - add_filter( 'sensei_course_loop_content_class', array( $this, 'course_status_class_tagging' ), 20, 2 ); |
|
| 275 | + // add extra classes to distinguish the course based on user completed or active |
|
| 276 | + add_filter( 'sensei_course_loop_content_class', array( $this, 'course_status_class_tagging' ), 20, 2 ); |
|
| 277 | 277 | |
| 278 | - // attach progress meter below course |
|
| 279 | - add_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_progress' ) ); |
|
| 280 | - add_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_buttons' ) ); |
|
| 278 | + // attach progress meter below course |
|
| 279 | + add_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_progress' ) ); |
|
| 280 | + add_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_buttons' ) ); |
|
| 281 | 281 | |
| 282 | - } |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | - /** |
|
| 285 | - * Remove hooks for the shortcode |
|
| 286 | - * |
|
| 287 | - * @since 1.9.0 |
|
| 288 | - */ |
|
| 289 | - public function detach_shortcode_hooks(){ |
|
| 284 | + /** |
|
| 285 | + * Remove hooks for the shortcode |
|
| 286 | + * |
|
| 287 | + * @since 1.9.0 |
|
| 288 | + */ |
|
| 289 | + public function detach_shortcode_hooks(){ |
|
| 290 | 290 | |
| 291 | - //remove all hooks after the output is generated |
|
| 292 | - remove_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_progress' ) ); |
|
| 293 | - remove_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_buttons' ) ); |
|
| 294 | - remove_filter( 'sensei_course_loop_content_class', array( $this, 'course_status_class_tagging' ), 20, 2 ); |
|
| 295 | - remove_action( 'sensei_loop_course_before', array( $this, 'course_toggle_actions' ) ); |
|
| 296 | - } |
|
| 291 | + //remove all hooks after the output is generated |
|
| 292 | + remove_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_progress' ) ); |
|
| 293 | + remove_action( 'sensei_course_content_inside_after', array( $this, 'attach_course_buttons' ) ); |
|
| 294 | + remove_filter( 'sensei_course_loop_content_class', array( $this, 'course_status_class_tagging' ), 20, 2 ); |
|
| 295 | + remove_action( 'sensei_loop_course_before', array( $this, 'course_toggle_actions' ) ); |
|
| 296 | + } |
|
| 297 | 297 | |
| 298 | - /** |
|
| 299 | - * Hooks into sensei_course_content_inside_after |
|
| 300 | - * |
|
| 301 | - * @param $course |
|
| 302 | - */ |
|
| 303 | - public function attach_course_progress( $course ){ |
|
| 298 | + /** |
|
| 299 | + * Hooks into sensei_course_content_inside_after |
|
| 300 | + * |
|
| 301 | + * @param $course |
|
| 302 | + */ |
|
| 303 | + public function attach_course_progress( $course ){ |
|
| 304 | 304 | |
| 305 | - $percentage = Sensei()->course->get_completion_percentage( $course->ID, get_current_user_id() ); |
|
| 306 | - echo Sensei()->course->get_progress_meter( $percentage ); |
|
| 305 | + $percentage = Sensei()->course->get_completion_percentage( $course->ID, get_current_user_id() ); |
|
| 306 | + echo Sensei()->course->get_progress_meter( $percentage ); |
|
| 307 | 307 | |
| 308 | - }// attach_course_progress |
|
| 308 | + }// attach_course_progress |
|
| 309 | 309 | |
| 310 | 310 | |
| 311 | - /** |
|
| 312 | - * Hooked into sensei_course_content_inside_after |
|
| 313 | - * |
|
| 314 | - * Prints out the course action buttons |
|
| 315 | - * |
|
| 316 | - * @param $course |
|
| 317 | - */ |
|
| 318 | - public function attach_course_buttons( $course ){ |
|
| 311 | + /** |
|
| 312 | + * Hooked into sensei_course_content_inside_after |
|
| 313 | + * |
|
| 314 | + * Prints out the course action buttons |
|
| 315 | + * |
|
| 316 | + * @param $course |
|
| 317 | + */ |
|
| 318 | + public function attach_course_buttons( $course ){ |
|
| 319 | 319 | |
| 320 | - Sensei()->course->the_course_action_buttons( $course ); |
|
| 320 | + Sensei()->course->the_course_action_buttons( $course ); |
|
| 321 | 321 | |
| 322 | - }// attach_course_buttons |
|
| 322 | + }// attach_course_buttons |
|
| 323 | 323 | |
| 324 | - /** |
|
| 325 | - * Add a the user status class for the given course. |
|
| 326 | - * |
|
| 327 | - * @since 1.9 |
|
| 328 | - * |
|
| 329 | - * @param array $classes |
|
| 330 | - * @param WP_Post $course |
|
| 331 | - * @return array $classes |
|
| 332 | - */ |
|
| 333 | - public function course_status_class_tagging($classes, $course){ |
|
| 324 | + /** |
|
| 325 | + * Add a the user status class for the given course. |
|
| 326 | + * |
|
| 327 | + * @since 1.9 |
|
| 328 | + * |
|
| 329 | + * @param array $classes |
|
| 330 | + * @param WP_Post $course |
|
| 331 | + * @return array $classes |
|
| 332 | + */ |
|
| 333 | + public function course_status_class_tagging($classes, $course){ |
|
| 334 | 334 | |
| 335 | - if ( Sensei_Utils::user_completed_course( $course, get_current_user_id() ) ) { |
|
| 335 | + if ( Sensei_Utils::user_completed_course( $course, get_current_user_id() ) ) { |
|
| 336 | 336 | |
| 337 | - $classes[] = 'user-completed'; |
|
| 337 | + $classes[] = 'user-completed'; |
|
| 338 | 338 | |
| 339 | - } else { |
|
| 339 | + } else { |
|
| 340 | 340 | |
| 341 | - $classes[] = 'user-active'; |
|
| 341 | + $classes[] = 'user-active'; |
|
| 342 | 342 | |
| 343 | - } |
|
| 343 | + } |
|
| 344 | 344 | |
| 345 | - return $classes; |
|
| 345 | + return $classes; |
|
| 346 | 346 | |
| 347 | - }// end course_status_class_tagging |
|
| 347 | + }// end course_status_class_tagging |
|
| 348 | 348 | |
| 349 | - /** |
|
| 350 | - * Output the course toggle functionality |
|
| 351 | - */ |
|
| 352 | - public function course_toggle_actions(){ ?> |
|
| 349 | + /** |
|
| 350 | + * Output the course toggle functionality |
|
| 351 | + */ |
|
| 352 | + public function course_toggle_actions(){ ?> |
|
| 353 | 353 | |
| 354 | 354 | <section id="user-course-status-toggle"> |
| 355 | 355 | <a id="sensei-user-courses-active-action" href=""><?php _e('Active Courses'); ?></a> |
@@ -359,12 +359,12 @@ discard block |
||
| 359 | 359 | |
| 360 | 360 | <?php } |
| 361 | 361 | |
| 362 | - /** |
|
| 363 | - * Load the javascript for the toggle functionality |
|
| 364 | - * |
|
| 365 | - * @since 1.9.0 |
|
| 366 | - */ |
|
| 367 | - function print_course_toggle_actions_inline_script() { ?> |
|
| 362 | + /** |
|
| 363 | + * Load the javascript for the toggle functionality |
|
| 364 | + * |
|
| 365 | + * @since 1.9.0 |
|
| 366 | + */ |
|
| 367 | + function print_course_toggle_actions_inline_script() { ?> |
|
| 368 | 368 | |
| 369 | 369 | <script type="text/javascript"> |
| 370 | 370 | var buttonContainer = jQuery('#user-course-status-toggle'); |
@@ -167,8 +167,6 @@ |
||
| 167 | 167 | |
| 168 | 168 | /** |
| 169 | 169 | * Load the desired component, if a method is available for it. |
| 170 | - * @param string $component The component to potentially be loaded. |
|
| 171 | - * |
|
| 172 | 170 | * @since 1.0.0 |
| 173 | 171 | * @return void |
| 174 | 172 | */ |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | remove_filter( 'pre_get_posts', 'sensei_course_archive_filter', 10, 1 ); |
| 65 | 65 | |
| 66 | 66 | if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) ) |
| 67 | - && ( 'activecourses' == $instance['component'] || 'completedcourses' == $instance['component'] ) |
|
| 68 | - && !is_user_logged_in() ) {
|
|
| 67 | + && ( 'activecourses' == $instance['component'] || 'completedcourses' == $instance['component'] ) |
|
| 68 | + && !is_user_logged_in() ) {
|
|
| 69 | 69 | |
| 70 | 70 | // No Output |
| 71 | - return; |
|
| 71 | + return; |
|
| 72 | 72 | |
| 73 | 73 | } else {
|
| 74 | 74 | /* Our variables from the widget settings. */ |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * @param array $instance The settings for this instance. |
| 131 | 131 | * @return void |
| 132 | 132 | */ |
| 133 | - public function form( $instance ) {
|
|
| 133 | + public function form( $instance ) {
|
|
| 134 | 134 | |
| 135 | 135 | /* Set up some default widget settings. */ |
| 136 | 136 | /* Make sure all keys are added here, even with empty string values. */ |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | /** |
| 169 | 169 | * Load the desired component, if a method is available for it. |
| 170 | 170 | * @param string $component The component to potentially be loaded. |
| 171 | - * |
|
| 171 | + * |
|
| 172 | 172 | * @since 1.0.0 |
| 173 | 173 | * @return void |
| 174 | 174 | */ |
@@ -207,24 +207,24 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - if ( ! empty( $course_ids ) ) {
|
|
| 210 | + if ( ! empty( $course_ids ) ) {
|
|
| 211 | 211 | |
| 212 | - $posts_array = Sensei()->course->course_query( intval( $instance['limit'] ), esc_attr( $instance['component'] ), $course_ids ); |
|
| 212 | + $posts_array = Sensei()->course->course_query( intval( $instance['limit'] ), esc_attr( $instance['component'] ), $course_ids ); |
|
| 213 | 213 | |
| 214 | 214 | } else {
|
| 215 | 215 | |
| 216 | - if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
|
|
| 216 | + if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
|
|
| 217 | 217 | $posts_array = array(); |
| 218 | 218 | |
| 219 | - } else {
|
|
| 219 | + } else {
|
|
| 220 | 220 | |
| 221 | - $course_args = array( |
|
| 222 | - 'post_type' => 'course', |
|
| 223 | - 'orderby' => 'date', |
|
| 224 | - 'order' => 'DESC', |
|
| 225 | - 'post_status' => 'publish', |
|
| 226 | - 'posts_per_page' => $instance['limit'], |
|
| 227 | - ); |
|
| 221 | + $course_args = array( |
|
| 222 | + 'post_type' => 'course', |
|
| 223 | + 'orderby' => 'date', |
|
| 224 | + 'order' => 'DESC', |
|
| 225 | + 'post_status' => 'publish', |
|
| 226 | + 'posts_per_page' => $instance['limit'], |
|
| 227 | + ); |
|
| 228 | 228 | |
| 229 | 229 | $posts_array = get_posts( $course_args ); |
| 230 | 230 | } |
@@ -234,13 +234,13 @@ discard block |
||
| 234 | 234 | if ( count( $posts_array ) > 0 ) { ?>
|
| 235 | 235 | <ul> |
| 236 | 236 | <?php foreach ($posts_array as $post_item){
|
| 237 | - $post_id = absint( $post_item->ID ); |
|
| 238 | - $post_title = $post_item->post_title; |
|
| 239 | - $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 240 | - $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 241 | - $author_display_name = $user_info->display_name; |
|
| 242 | - $author_id = $post_item->post_author; |
|
| 243 | - ?> |
|
| 237 | + $post_id = absint( $post_item->ID ); |
|
| 238 | + $post_title = $post_item->post_title; |
|
| 239 | + $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 240 | + $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 241 | + $author_display_name = $user_info->display_name; |
|
| 242 | + $author_id = $post_item->post_author; |
|
| 243 | + ?> |
|
| 244 | 244 | <li class="fix"> |
| 245 | 245 | <?php do_action( 'sensei_course_image', $post_id ); ?> |
| 246 | 246 | <a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a> |
@@ -255,9 +255,9 @@ discard block |
||
| 255 | 255 | </li> |
| 256 | 256 | <?php } // End For Loop ?> |
| 257 | 257 | <?php if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
|
| 258 | - $my_account_page_id = intval( Sensei()->settings->settings[ 'my_course_page' ] ); |
|
| 259 | - echo '<li class="my-account fix"><a href="'. esc_url( get_permalink( $my_account_page_id ) ) .'">'.__('My Courses', 'woothemes-sensei').' <span class="meta-nav"></span></a></li>';
|
|
| 260 | - } // End If Statement ?> |
|
| 258 | + $my_account_page_id = intval( Sensei()->settings->settings[ 'my_course_page' ] ); |
|
| 259 | + echo '<li class="my-account fix"><a href="'. esc_url( get_permalink( $my_account_page_id ) ) .'">'.__('My Courses', 'woothemes-sensei').' <span class="meta-nav"></span></a></li>';
|
|
| 260 | + } // End If Statement ?> |
|
| 261 | 261 | </ul> |
| 262 | 262 | <?php } else {
|
| 263 | 263 | // No posts returned. This means the user either has no active or no completed courses. |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 2 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly.
|
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Sensei Course Component Widget |
@@ -26,30 +26,30 @@ discard block |
||
| 26 | 26 | public function __construct() {
|
| 27 | 27 | /* Widget variable settings. */ |
| 28 | 28 | $this->woo_widget_cssclass = 'widget_sensei_course_component'; |
| 29 | - $this->woo_widget_description = __( 'This widget will output a list of Courses - New, Featured, Free, Paid, Active, Completed.', 'woothemes-sensei' ); |
|
| 29 | + $this->woo_widget_description = __('This widget will output a list of Courses - New, Featured, Free, Paid, Active, Completed.', 'woothemes-sensei');
|
|
| 30 | 30 | $this->woo_widget_idbase = 'sensei_course_component'; |
| 31 | - $this->woo_widget_title = __( 'Sensei - Course Component', 'woothemes-sensei' ); |
|
| 31 | + $this->woo_widget_title = __('Sensei - Course Component', 'woothemes-sensei');
|
|
| 32 | 32 | |
| 33 | 33 | $this->woo_widget_componentslist = array( |
| 34 | - 'usercourses' => __( 'New Courses', 'woothemes-sensei' ), |
|
| 35 | - 'featuredcourses' => __( 'Featured Courses', 'woothemes-sensei' ), |
|
| 36 | - 'activecourses' => __( 'My Active Courses', 'woothemes-sensei' ), |
|
| 37 | - 'completedcourses' => __( 'My Completed Courses', 'woothemes-sensei' ), |
|
| 34 | + 'usercourses' => __('New Courses', 'woothemes-sensei'),
|
|
| 35 | + 'featuredcourses' => __('Featured Courses', 'woothemes-sensei'),
|
|
| 36 | + 'activecourses' => __('My Active Courses', 'woothemes-sensei'),
|
|
| 37 | + 'completedcourses' => __('My Completed Courses', 'woothemes-sensei'),
|
|
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | 40 | // Add support for the WooCommerce shelf. |
| 41 | - if ( Sensei_WC::is_woocommerce_active() ) {
|
|
| 42 | - $this->woo_widget_componentslist['freecourses'] = __( 'Free Courses', 'woothemes-sensei' ); |
|
| 43 | - $this->woo_widget_componentslist['paidcourses'] = __( 'Paid Courses', 'woothemes-sensei' ); |
|
| 41 | + if (Sensei_WC::is_woocommerce_active()) {
|
|
| 42 | + $this->woo_widget_componentslist['freecourses'] = __('Free Courses', 'woothemes-sensei');
|
|
| 43 | + $this->woo_widget_componentslist['paidcourses'] = __('Paid Courses', 'woothemes-sensei');
|
|
| 44 | 44 | } |
| 45 | 45 | /* Widget settings. */ |
| 46 | - $widget_ops = array( 'classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description ); |
|
| 46 | + $widget_ops = array('classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description);
|
|
| 47 | 47 | |
| 48 | 48 | /* Widget control settings. */ |
| 49 | - $control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase ); |
|
| 49 | + $control_ops = array('width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase);
|
|
| 50 | 50 | |
| 51 | 51 | /* Create the widget. */ |
| 52 | - parent::__construct( $this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops ); |
|
| 52 | + parent::__construct($this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops); |
|
| 53 | 53 | } // End __construct() |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -59,44 +59,44 @@ discard block |
||
| 59 | 59 | * @param array $instance Widget settings for this instance. |
| 60 | 60 | * @return void |
| 61 | 61 | */ |
| 62 | - public function widget( $args, $instance ) {
|
|
| 62 | + public function widget($args, $instance) {
|
|
| 63 | 63 | |
| 64 | - remove_filter( 'pre_get_posts', 'sensei_course_archive_filter', 10, 1 ); |
|
| 64 | + remove_filter('pre_get_posts', 'sensei_course_archive_filter', 10, 1);
|
|
| 65 | 65 | |
| 66 | - if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) ) |
|
| 67 | - && ( 'activecourses' == $instance['component'] || 'completedcourses' == $instance['component'] ) |
|
| 68 | - && !is_user_logged_in() ) {
|
|
| 66 | + if (in_array($instance['component'], array_keys($this->woo_widget_componentslist)) |
|
| 67 | + && ('activecourses' == $instance['component'] || 'completedcourses' == $instance['component'])
|
|
| 68 | + && ! is_user_logged_in()) {
|
|
| 69 | 69 | |
| 70 | 70 | // No Output |
| 71 | 71 | return; |
| 72 | 72 | |
| 73 | 73 | } else {
|
| 74 | 74 | /* Our variables from the widget settings. */ |
| 75 | - $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
|
|
| 75 | + $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
|
|
| 76 | 76 | |
| 77 | 77 | /* Before widget (defined by themes). */ |
| 78 | 78 | echo $args['before_widget']; |
| 79 | 79 | |
| 80 | 80 | /* Display the widget title if one was input (before and after defined by themes). */ |
| 81 | - if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; }
|
|
| 81 | + if ($title) { echo $args['before_title'].$title.$args['after_title']; }
|
|
| 82 | 82 | |
| 83 | 83 | /* Widget content. */ |
| 84 | 84 | // Add actions for plugins/themes to hook onto. |
| 85 | - do_action( $this->woo_widget_cssclass . '_top' ); |
|
| 85 | + do_action($this->woo_widget_cssclass.'_top'); |
|
| 86 | 86 | |
| 87 | - if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) ) ) {
|
|
| 88 | - $this->load_component( $instance ); |
|
| 87 | + if (in_array($instance['component'], array_keys($this->woo_widget_componentslist))) {
|
|
| 88 | + $this->load_component($instance); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // Add actions for plugins/themes to hook onto. |
| 92 | - do_action( $this->woo_widget_cssclass . '_bottom' ); |
|
| 92 | + do_action($this->woo_widget_cssclass.'_bottom'); |
|
| 93 | 93 | |
| 94 | 94 | /* After widget (defined by themes). */ |
| 95 | 95 | echo $args['after_widget']; |
| 96 | 96 | |
| 97 | 97 | } // End If Statement |
| 98 | 98 | |
| 99 | - add_filter( 'pre_get_posts', 'sensei_course_archive_filter', 10, 1 ); |
|
| 99 | + add_filter('pre_get_posts', 'sensei_course_archive_filter', 10, 1);
|
|
| 100 | 100 | |
| 101 | 101 | } // End widget() |
| 102 | 102 | |
@@ -107,17 +107,17 @@ discard block |
||
| 107 | 107 | * @param array $old_instance Previous settings. |
| 108 | 108 | * @return array Updated settings. |
| 109 | 109 | */ |
| 110 | - public function update ( $new_instance, $old_instance ) {
|
|
| 110 | + public function update($new_instance, $old_instance) {
|
|
| 111 | 111 | $instance = $old_instance; |
| 112 | 112 | |
| 113 | 113 | /* Strip tags for title and name to remove HTML (important for text inputs). */ |
| 114 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
| 114 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 115 | 115 | |
| 116 | 116 | /* The select box is returning a text value, so we escape it. */ |
| 117 | - $instance['component'] = esc_attr( $new_instance['component'] ); |
|
| 117 | + $instance['component'] = esc_attr($new_instance['component']); |
|
| 118 | 118 | |
| 119 | 119 | /* The select box is returning a text value, so we escape it. */ |
| 120 | - $instance['limit'] = esc_attr( $new_instance['limit'] ); |
|
| 120 | + $instance['limit'] = esc_attr($new_instance['limit']); |
|
| 121 | 121 | |
| 122 | 122 | |
| 123 | 123 | return $instance; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * @param array $instance The settings for this instance. |
| 131 | 131 | * @return void |
| 132 | 132 | */ |
| 133 | - public function form( $instance ) {
|
|
| 133 | + public function form($instance) {
|
|
| 134 | 134 | |
| 135 | 135 | /* Set up some default widget settings. */ |
| 136 | 136 | /* Make sure all keys are added here, even with empty string values. */ |
@@ -140,26 +140,26 @@ discard block |
||
| 140 | 140 | 'limit' => 3 |
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
| 143 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
| 144 | 144 | ?> |
| 145 | 145 | <!-- Widget Title: Text Input --> |
| 146 | 146 | <p> |
| 147 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label> |
|
| 148 | - <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" /> |
|
| 147 | + <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title (optional):', 'woothemes-sensei'); ?></label>
|
|
| 148 | + <input type="text" name="<?php echo esc_attr($this->get_field_name('title')); ?>" value="<?php echo esc_attr($instance['title']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" />
|
|
| 149 | 149 | </p> |
| 150 | 150 | <!-- Widget Component: Select Input --> |
| 151 | 151 | <p> |
| 152 | - <label for="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>"><?php _e( 'Component:', 'woothemes-sensei' ); ?></label> |
|
| 153 | - <select name="<?php echo esc_attr( $this->get_field_name( 'component' ) ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>"> |
|
| 154 | - <?php foreach ( $this->woo_widget_componentslist as $k => $v ) { ?>
|
|
| 155 | - <option value="<?php echo esc_attr( $k ); ?>"<?php selected( $instance['component'], $k ); ?>><?php echo $v; ?></option> |
|
| 152 | + <label for="<?php echo esc_attr($this->get_field_id('component')); ?>"><?php _e('Component:', 'woothemes-sensei'); ?></label>
|
|
| 153 | + <select name="<?php echo esc_attr($this->get_field_name('component')); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('component')); ?>">
|
|
| 154 | + <?php foreach ($this->woo_widget_componentslist as $k => $v) { ?>
|
|
| 155 | + <option value="<?php echo esc_attr($k); ?>"<?php selected($instance['component'], $k); ?>><?php echo $v; ?></option> |
|
| 156 | 156 | <?php } ?> |
| 157 | 157 | </select> |
| 158 | 158 | </p> |
| 159 | 159 | <!-- Widget Limit: Text Input --> |
| 160 | 160 | <p> |
| 161 | - <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Courses (optional):', 'woothemes-sensei' ); ?></label> |
|
| 162 | - <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" value="<?php echo esc_attr( $instance['limit'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" /> |
|
| 161 | + <label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php _e('Number of Courses (optional):', 'woothemes-sensei'); ?></label>
|
|
| 162 | + <input type="text" name="<?php echo esc_attr($this->get_field_name('limit')); ?>" value="<?php echo esc_attr($instance['limit']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('limit')); ?>" />
|
|
| 163 | 163 | </p> |
| 164 | 164 | |
| 165 | 165 | <?php |
@@ -172,28 +172,28 @@ discard block |
||
| 172 | 172 | * @since 1.0.0 |
| 173 | 173 | * @return void |
| 174 | 174 | */ |
| 175 | - protected function load_component ( $instance ) {
|
|
| 175 | + protected function load_component($instance) {
|
|
| 176 | 176 | global $current_user; |
| 177 | 177 | |
| 178 | 178 | get_currentuserinfo(); |
| 179 | 179 | |
| 180 | 180 | $course_ids = array(); |
| 181 | - if ( 'activecourses' == esc_attr( $instance['component'] ) ) {
|
|
| 182 | - $courses = WooThemes_Sensei_Utils::sensei_check_for_activity( array( 'user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'in-progress' ), true ); |
|
| 181 | + if ('activecourses' == esc_attr($instance['component'])) {
|
|
| 182 | + $courses = WooThemes_Sensei_Utils::sensei_check_for_activity(array('user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'in-progress'), true);
|
|
| 183 | 183 | // Need to always return an array, even with only 1 item |
| 184 | - if ( !is_array($courses) ) {
|
|
| 185 | - $courses = array( $courses ); |
|
| 184 | + if ( ! is_array($courses)) {
|
|
| 185 | + $courses = array($courses); |
|
| 186 | 186 | } |
| 187 | - foreach( $courses AS $course ) {
|
|
| 187 | + foreach ($courses AS $course) {
|
|
| 188 | 188 | $course_ids[] = $course->comment_post_ID; |
| 189 | 189 | } |
| 190 | - } elseif( 'completedcourses' == esc_attr( $instance['component'] ) ) {
|
|
| 191 | - $courses = WooThemes_Sensei_Utils::sensei_check_for_activity( array( 'user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'complete' ), true ); |
|
| 190 | + } elseif ('completedcourses' == esc_attr($instance['component'])) {
|
|
| 191 | + $courses = WooThemes_Sensei_Utils::sensei_check_for_activity(array('user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'complete'), true);
|
|
| 192 | 192 | // Need to always return an array, even with only 1 item |
| 193 | - if ( !is_array($courses) ) {
|
|
| 194 | - $courses = array( $courses ); |
|
| 193 | + if ( ! is_array($courses)) {
|
|
| 194 | + $courses = array($courses); |
|
| 195 | 195 | } |
| 196 | - foreach( $courses AS $course ) {
|
|
| 196 | + foreach ($courses AS $course) {
|
|
| 197 | 197 | $course_ids[] = $course->comment_post_ID; |
| 198 | 198 | } |
| 199 | 199 | } // End If Statement |
@@ -201,19 +201,19 @@ discard block |
||
| 201 | 201 | $posts_array = array(); |
| 202 | 202 | |
| 203 | 203 | // course_query() is buggy, it doesn't honour the 1st arg if includes are provided, so instead slice the includes |
| 204 | - if ( !empty($instance['limit']) && intval( $instance['limit'] ) >= 1 && intval( $instance['limit'] ) < count($course_ids) ) {
|
|
| 204 | + if ( ! empty($instance['limit']) && intval($instance['limit']) >= 1 && intval($instance['limit']) < count($course_ids)) {
|
|
| 205 | 205 | |
| 206 | - $course_ids = array_slice( $course_ids, 0, intval( $instance['limit'] ) ); // This does mean the order by is effectively ignored |
|
| 206 | + $course_ids = array_slice($course_ids, 0, intval($instance['limit'])); // This does mean the order by is effectively ignored |
|
| 207 | 207 | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - if ( ! empty( $course_ids ) ) {
|
|
| 210 | + if ( ! empty($course_ids)) {
|
|
| 211 | 211 | |
| 212 | - $posts_array = Sensei()->course->course_query( intval( $instance['limit'] ), esc_attr( $instance['component'] ), $course_ids ); |
|
| 212 | + $posts_array = Sensei()->course->course_query(intval($instance['limit']), esc_attr($instance['component']), $course_ids); |
|
| 213 | 213 | |
| 214 | 214 | } else {
|
| 215 | 215 | |
| 216 | - if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
|
|
| 216 | + if ('activecourses' == esc_attr($instance['component']) || 'completedcourses' == esc_attr($instance['component'])) {
|
|
| 217 | 217 | $posts_array = array(); |
| 218 | 218 | |
| 219 | 219 | } else {
|
@@ -226,43 +226,43 @@ discard block |
||
| 226 | 226 | 'posts_per_page' => $instance['limit'], |
| 227 | 227 | ); |
| 228 | 228 | |
| 229 | - $posts_array = get_posts( $course_args ); |
|
| 229 | + $posts_array = get_posts($course_args); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | } // End If Statement |
| 233 | 233 | |
| 234 | - if ( count( $posts_array ) > 0 ) { ?>
|
|
| 234 | + if (count($posts_array) > 0) { ?>
|
|
| 235 | 235 | <ul> |
| 236 | - <?php foreach ($posts_array as $post_item){
|
|
| 237 | - $post_id = absint( $post_item->ID ); |
|
| 236 | + <?php foreach ($posts_array as $post_item) {
|
|
| 237 | + $post_id = absint($post_item->ID); |
|
| 238 | 238 | $post_title = $post_item->post_title; |
| 239 | - $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 240 | - $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 239 | + $user_info = get_userdata(absint($post_item->post_author)); |
|
| 240 | + $author_link = get_author_posts_url(absint($post_item->post_author)); |
|
| 241 | 241 | $author_display_name = $user_info->display_name; |
| 242 | 242 | $author_id = $post_item->post_author; |
| 243 | 243 | ?> |
| 244 | 244 | <li class="fix"> |
| 245 | - <?php do_action( 'sensei_course_image', $post_id ); ?> |
|
| 246 | - <a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a> |
|
| 245 | + <?php do_action('sensei_course_image', $post_id); ?>
|
|
| 246 | + <a href="<?php echo esc_url(get_permalink($post_id)); ?>" title="<?php echo esc_attr($post_title); ?>"><?php echo $post_title; ?></a> |
|
| 247 | 247 | <br /> |
| 248 | - <?php if ( isset( Sensei()->settings->settings[ 'course_author' ] ) && ( Sensei()->settings->settings[ 'course_author' ] ) ) { ?>
|
|
| 249 | - <span class="course-author"><?php _e( 'by ', 'woothemes-sensei' ); ?><a href="<?php echo esc_url( $author_link ); ?>" title="<?php echo esc_attr( $author_display_name ); ?>"><?php echo esc_html( $author_display_name ); ?></a></span> |
|
| 248 | + <?php if (isset(Sensei()->settings->settings['course_author']) && (Sensei()->settings->settings['course_author'])) { ?>
|
|
| 249 | + <span class="course-author"><?php _e('by ', 'woothemes-sensei'); ?><a href="<?php echo esc_url($author_link); ?>" title="<?php echo esc_attr($author_display_name); ?>"><?php echo esc_html($author_display_name); ?></a></span>
|
|
| 250 | 250 | <br /> |
| 251 | 251 | <?php } // End If Statement ?> |
| 252 | - <span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count( $post_id ) . ' ' . __( 'Lessons', 'woothemes-sensei' ); ?></span> |
|
| 252 | + <span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count($post_id).' '.__('Lessons', 'woothemes-sensei'); ?></span>
|
|
| 253 | 253 | <br /> |
| 254 | - <?php sensei_simple_course_price( $post_id ); ?> |
|
| 254 | + <?php sensei_simple_course_price($post_id); ?> |
|
| 255 | 255 | </li> |
| 256 | 256 | <?php } // End For Loop ?> |
| 257 | - <?php if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
|
|
| 258 | - $my_account_page_id = intval( Sensei()->settings->settings[ 'my_course_page' ] ); |
|
| 259 | - echo '<li class="my-account fix"><a href="'. esc_url( get_permalink( $my_account_page_id ) ) .'">'.__('My Courses', 'woothemes-sensei').' <span class="meta-nav"></span></a></li>';
|
|
| 257 | + <?php if ('activecourses' == esc_attr($instance['component']) || 'completedcourses' == esc_attr($instance['component'])) {
|
|
| 258 | + $my_account_page_id = intval(Sensei()->settings->settings['my_course_page']); |
|
| 259 | + echo '<li class="my-account fix"><a href="'.esc_url(get_permalink($my_account_page_id)).'">'.__('My Courses', 'woothemes-sensei').' <span class="meta-nav"></span></a></li>';
|
|
| 260 | 260 | } // End If Statement ?> |
| 261 | 261 | </ul> |
| 262 | 262 | <?php } else {
|
| 263 | 263 | // No posts returned. This means the user either has no active or no completed courses. |
| 264 | - $course_status = substr( esc_attr( $instance['component'] ) , 0, -7); |
|
| 265 | - echo sprintf( __( 'You have no %1s courses.', 'woothemes-sensei' ), $course_status ); |
|
| 264 | + $course_status = substr(esc_attr($instance['component']), 0, -7); |
|
| 265 | + echo sprintf(__('You have no %1s courses.', 'woothemes-sensei'), $course_status);
|
|
| 266 | 266 | } // End If Statement |
| 267 | 267 | } // End load_component() |
| 268 | 268 | } // End Class |
| 269 | 269 | \ No newline at end of file |
@@ -1,5 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + exit; |
|
| 4 | +} |
|
| 5 | +// Exit if accessed directly. |
|
| 3 | 6 | |
| 4 | 7 | /** |
| 5 | 8 | * Sensei Course Component Widget |
@@ -151,7 +151,6 @@ |
||
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | 153 | * Load the desired component, if a method is available for it. |
| 154 | - * @param string $component The component to potentially be loaded. |
|
| 155 | 154 | * @since 5.0.8 |
| 156 | 155 | * @return void |
| 157 | 156 | */ |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @param array $instance The settings for this instance. |
| 115 | 115 | * @return void |
| 116 | 116 | */ |
| 117 | - public function form( $instance ) {
|
|
| 117 | + public function form( $instance ) {
|
|
| 118 | 118 | |
| 119 | 119 | /* Set up some default widget settings. */ |
| 120 | 120 | /* Make sure all keys are added here, even with empty string values. */ |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | $post_args = array( 'post_type' => 'lesson', |
| 169 | 169 | 'posts_per_page' => intval( $instance[ 'limit' ] ), |
| 170 | 170 | 'orderby' => 'menu_order date', |
| 171 | - 'order' => 'DESC', |
|
| 172 | - 'post_status' => 'publish', |
|
| 171 | + 'order' => 'DESC', |
|
| 172 | + 'post_status' => 'publish', |
|
| 173 | 173 | 'suppress_filters' => 0 |
| 174 | 174 | ); |
| 175 | 175 | $posts_array = get_posts( $post_args ); |
@@ -177,14 +177,14 @@ discard block |
||
| 177 | 177 | if ( count( $posts_array ) > 0 ) { ?>
|
| 178 | 178 | <ul> |
| 179 | 179 | <?php foreach ($posts_array as $post_item){
|
| 180 | - $post_id = absint( $post_item->ID ); |
|
| 181 | - $post_title = $post_item->post_title; |
|
| 182 | - $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 183 | - $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 184 | - $author_display_name = $user_info->display_name; |
|
| 185 | - $author_id = $post_item->post_author; |
|
| 186 | - $lesson_course_id = get_post_meta( $post_id, '_lesson_course', true ); |
|
| 187 | - ?> |
|
| 180 | + $post_id = absint( $post_item->ID ); |
|
| 181 | + $post_title = $post_item->post_title; |
|
| 182 | + $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 183 | + $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 184 | + $author_display_name = $user_info->display_name; |
|
| 185 | + $author_id = $post_item->post_author; |
|
| 186 | + $lesson_course_id = get_post_meta( $post_id, '_lesson_course', true ); |
|
| 187 | + ?> |
|
| 188 | 188 | <li class="fix"> |
| 189 | 189 | <?php do_action( 'sensei_lesson_image', $post_id, '100', '100', false, true ); ?> |
| 190 | 190 | <a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a> |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 2 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly.
|
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Sensei Lesson Component Widget |
@@ -26,22 +26,22 @@ discard block |
||
| 26 | 26 | public function __construct() {
|
| 27 | 27 | /* Widget variable settings. */ |
| 28 | 28 | $this->woo_widget_cssclass = 'widget_sensei_lesson_component'; |
| 29 | - $this->woo_widget_description = __( 'This widget will output a list of the latest Lessons.', 'woothemes-sensei' ); |
|
| 29 | + $this->woo_widget_description = __('This widget will output a list of the latest Lessons.', 'woothemes-sensei');
|
|
| 30 | 30 | $this->woo_widget_idbase = 'sensei_lesson_component'; |
| 31 | - $this->woo_widget_title = __( 'Sensei - Lesson Component', 'woothemes-sensei' ); |
|
| 31 | + $this->woo_widget_title = __('Sensei - Lesson Component', 'woothemes-sensei');
|
|
| 32 | 32 | |
| 33 | 33 | $this->woo_widget_componentslist = array( |
| 34 | - 'newlessons' => __( 'New Lessons', 'woothemes-sensei' ), |
|
| 34 | + 'newlessons' => __('New Lessons', 'woothemes-sensei'),
|
|
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | 37 | /* Widget settings. */ |
| 38 | - $widget_ops = array( 'classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description ); |
|
| 38 | + $widget_ops = array('classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description);
|
|
| 39 | 39 | |
| 40 | 40 | /* Widget control settings. */ |
| 41 | - $control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase ); |
|
| 41 | + $control_ops = array('width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase);
|
|
| 42 | 42 | |
| 43 | 43 | /* Create the widget. */ |
| 44 | - parent::__construct( $this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops ); |
|
| 44 | + parent::__construct($this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops); |
|
| 45 | 45 | } // End __construct() |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -51,32 +51,32 @@ discard block |
||
| 51 | 51 | * @param array $instance Widget settings for this instance. |
| 52 | 52 | * @return void |
| 53 | 53 | */ |
| 54 | - public function widget( $args, $instance ) {
|
|
| 55 | - extract( $args, EXTR_SKIP ); |
|
| 54 | + public function widget($args, $instance) {
|
|
| 55 | + extract($args, EXTR_SKIP); |
|
| 56 | 56 | |
| 57 | 57 | |
| 58 | - if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) ) && ( 'activecourses' == $instance['component'] || 'completedcourses' == $instance['component'] ) && !is_user_logged_in() ) {
|
|
| 58 | + if (in_array($instance['component'], array_keys($this->woo_widget_componentslist)) && ('activecourses' == $instance['component'] || 'completedcourses' == $instance['component']) && ! is_user_logged_in()) {
|
|
| 59 | 59 | // No Output |
| 60 | 60 | } else {
|
| 61 | 61 | /* Our variables from the widget settings. */ |
| 62 | - $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
|
|
| 62 | + $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
|
|
| 63 | 63 | |
| 64 | 64 | /* Before widget (defined by themes). */ |
| 65 | 65 | echo $before_widget; |
| 66 | 66 | |
| 67 | 67 | /* Display the widget title if one was input (before and after defined by themes). */ |
| 68 | - if ( $title ) { echo $before_title . $title . $after_title; }
|
|
| 68 | + if ($title) { echo $before_title.$title.$after_title; }
|
|
| 69 | 69 | |
| 70 | 70 | /* Widget content. */ |
| 71 | 71 | // Add actions for plugins/themes to hook onto. |
| 72 | - do_action( $this->woo_widget_cssclass . '_top' ); |
|
| 72 | + do_action($this->woo_widget_cssclass.'_top'); |
|
| 73 | 73 | |
| 74 | - if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) ) ) {
|
|
| 75 | - $this->load_component( $instance ); |
|
| 74 | + if (in_array($instance['component'], array_keys($this->woo_widget_componentslist))) {
|
|
| 75 | + $this->load_component($instance); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // Add actions for plugins/themes to hook onto. |
| 79 | - do_action( $this->woo_widget_cssclass . '_bottom' ); |
|
| 79 | + do_action($this->woo_widget_cssclass.'_bottom'); |
|
| 80 | 80 | |
| 81 | 81 | /* After widget (defined by themes). */ |
| 82 | 82 | echo $after_widget; |
@@ -91,17 +91,17 @@ discard block |
||
| 91 | 91 | * @param array $old_instance Previous settings. |
| 92 | 92 | * @return array Updated settings. |
| 93 | 93 | */ |
| 94 | - public function update ( $new_instance, $old_instance ) {
|
|
| 94 | + public function update($new_instance, $old_instance) {
|
|
| 95 | 95 | $instance = $old_instance; |
| 96 | 96 | |
| 97 | 97 | /* Strip tags for title and name to remove HTML (important for text inputs). */ |
| 98 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
| 98 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 99 | 99 | |
| 100 | 100 | /* The select box is returning a text value, so we escape it. */ |
| 101 | - $instance['component'] = esc_attr( $new_instance['component'] ); |
|
| 101 | + $instance['component'] = esc_attr($new_instance['component']); |
|
| 102 | 102 | |
| 103 | 103 | /* The select box is returning a text value, so we escape it. */ |
| 104 | - $instance['limit'] = esc_attr( $new_instance['limit'] ); |
|
| 104 | + $instance['limit'] = esc_attr($new_instance['limit']); |
|
| 105 | 105 | |
| 106 | 106 | |
| 107 | 107 | return $instance; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @param array $instance The settings for this instance. |
| 115 | 115 | * @return void |
| 116 | 116 | */ |
| 117 | - public function form( $instance ) {
|
|
| 117 | + public function form($instance) {
|
|
| 118 | 118 | |
| 119 | 119 | /* Set up some default widget settings. */ |
| 120 | 120 | /* Make sure all keys are added here, even with empty string values. */ |
@@ -124,26 +124,26 @@ discard block |
||
| 124 | 124 | 'limit' => 3 |
| 125 | 125 | ); |
| 126 | 126 | |
| 127 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
| 127 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
| 128 | 128 | ?> |
| 129 | 129 | <!-- Widget Title: Text Input --> |
| 130 | 130 | <p> |
| 131 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label> |
|
| 132 | - <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" /> |
|
| 131 | + <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title (optional):', 'woothemes-sensei'); ?></label>
|
|
| 132 | + <input type="text" name="<?php echo esc_attr($this->get_field_name('title')); ?>" value="<?php echo esc_attr($instance['title']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" />
|
|
| 133 | 133 | </p> |
| 134 | 134 | <!-- Widget Component: Select Input --> |
| 135 | 135 | <p> |
| 136 | - <label for="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>"><?php _e( 'Component:', 'woothemes-sensei' ); ?></label> |
|
| 137 | - <select name="<?php echo esc_attr( $this->get_field_name( 'component' ) ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>"> |
|
| 138 | - <?php foreach ( $this->woo_widget_componentslist as $k => $v ) { ?>
|
|
| 139 | - <option value="<?php echo esc_attr( $k ); ?>"<?php selected( $instance['component'], $k ); ?>><?php echo $v; ?></option> |
|
| 136 | + <label for="<?php echo esc_attr($this->get_field_id('component')); ?>"><?php _e('Component:', 'woothemes-sensei'); ?></label>
|
|
| 137 | + <select name="<?php echo esc_attr($this->get_field_name('component')); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('component')); ?>">
|
|
| 138 | + <?php foreach ($this->woo_widget_componentslist as $k => $v) { ?>
|
|
| 139 | + <option value="<?php echo esc_attr($k); ?>"<?php selected($instance['component'], $k); ?>><?php echo $v; ?></option> |
|
| 140 | 140 | <?php } ?> |
| 141 | 141 | </select> |
| 142 | 142 | </p> |
| 143 | 143 | <!-- Widget Limit: Text Input --> |
| 144 | 144 | <p> |
| 145 | - <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Lessons (optional):', 'woothemes-sensei' ); ?></label> |
|
| 146 | - <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" value="<?php echo esc_attr( $instance['limit'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" /> |
|
| 145 | + <label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php _e('Number of Lessons (optional):', 'woothemes-sensei'); ?></label>
|
|
| 146 | + <input type="text" name="<?php echo esc_attr($this->get_field_name('limit')); ?>" value="<?php echo esc_attr($instance['limit']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('limit')); ?>" />
|
|
| 147 | 147 | </p> |
| 148 | 148 | |
| 149 | 149 | <?php |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * @since 5.0.8 |
| 156 | 156 | * @return void |
| 157 | 157 | */ |
| 158 | - protected function load_component ( $instance ) {
|
|
| 158 | + protected function load_component($instance) {
|
|
| 159 | 159 | global $current_user; |
| 160 | 160 | // Get User Meta |
| 161 | 161 | get_currentuserinfo(); |
@@ -165,41 +165,41 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | $posts_array = array(); |
| 167 | 167 | |
| 168 | - $post_args = array( 'post_type' => 'lesson', |
|
| 169 | - 'posts_per_page' => intval( $instance[ 'limit' ] ), |
|
| 168 | + $post_args = array('post_type' => 'lesson',
|
|
| 169 | + 'posts_per_page' => intval($instance['limit']), |
|
| 170 | 170 | 'orderby' => 'menu_order date', |
| 171 | 171 | 'order' => 'DESC', |
| 172 | 172 | 'post_status' => 'publish', |
| 173 | 173 | 'suppress_filters' => 0 |
| 174 | 174 | ); |
| 175 | - $posts_array = get_posts( $post_args ); |
|
| 175 | + $posts_array = get_posts($post_args); |
|
| 176 | 176 | |
| 177 | - if ( count( $posts_array ) > 0 ) { ?>
|
|
| 177 | + if (count($posts_array) > 0) { ?>
|
|
| 178 | 178 | <ul> |
| 179 | - <?php foreach ($posts_array as $post_item){
|
|
| 180 | - $post_id = absint( $post_item->ID ); |
|
| 179 | + <?php foreach ($posts_array as $post_item) {
|
|
| 180 | + $post_id = absint($post_item->ID); |
|
| 181 | 181 | $post_title = $post_item->post_title; |
| 182 | - $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 183 | - $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 182 | + $user_info = get_userdata(absint($post_item->post_author)); |
|
| 183 | + $author_link = get_author_posts_url(absint($post_item->post_author)); |
|
| 184 | 184 | $author_display_name = $user_info->display_name; |
| 185 | 185 | $author_id = $post_item->post_author; |
| 186 | - $lesson_course_id = get_post_meta( $post_id, '_lesson_course', true ); |
|
| 186 | + $lesson_course_id = get_post_meta($post_id, '_lesson_course', true); |
|
| 187 | 187 | ?> |
| 188 | 188 | <li class="fix"> |
| 189 | - <?php do_action( 'sensei_lesson_image', $post_id, '100', '100', false, true ); ?> |
|
| 190 | - <a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a> |
|
| 189 | + <?php do_action('sensei_lesson_image', $post_id, '100', '100', false, true); ?>
|
|
| 190 | + <a href="<?php echo esc_url(get_permalink($post_id)); ?>" title="<?php echo esc_attr($post_title); ?>"><?php echo $post_title; ?></a> |
|
| 191 | 191 | <br /> |
| 192 | - <?php if ( isset( Sensei()->settings->settings[ 'lesson_author' ] ) && ( Sensei()->settings->settings[ 'lesson_author' ] ) ) { ?>
|
|
| 193 | - <span class="course-author"><?php _e( 'by ', 'woothemes-sensei' ); ?><a href="<?php echo esc_url( $author_link ); ?>" title="<?php echo esc_attr( $author_display_name ); ?>"><?php echo esc_html( $author_display_name ); ?></a></span> |
|
| 192 | + <?php if (isset(Sensei()->settings->settings['lesson_author']) && (Sensei()->settings->settings['lesson_author'])) { ?>
|
|
| 193 | + <span class="course-author"><?php _e('by ', 'woothemes-sensei'); ?><a href="<?php echo esc_url($author_link); ?>" title="<?php echo esc_attr($author_display_name); ?>"><?php echo esc_html($author_display_name); ?></a></span>
|
|
| 194 | 194 | <br /> |
| 195 | 195 | <?php } // End If Statement ?> |
| 196 | - <?php if ( 0 < $lesson_course_id ) { ?>
|
|
| 197 | - <span class="lesson-course"><?php echo ' ' . sprintf( __( 'Part of: %s', 'woothemes-sensei' ), '<a href="' . esc_url( get_permalink( $lesson_course_id ) ) . '" title="' . esc_attr( __( 'View course', 'woothemes-sensei' ) ) . '"><em>' . get_the_title( $lesson_course_id ) . '</em></a>' ); ?></span> |
|
| 196 | + <?php if (0 < $lesson_course_id) { ?>
|
|
| 197 | + <span class="lesson-course"><?php echo ' '.sprintf(__('Part of: %s', 'woothemes-sensei'), '<a href="'.esc_url(get_permalink($lesson_course_id)).'" title="'.esc_attr(__('View course', 'woothemes-sensei')).'"><em>'.get_the_title($lesson_course_id).'</em></a>'); ?></span>
|
|
| 198 | 198 | <?php } ?> |
| 199 | 199 | <br /> |
| 200 | 200 | </li> |
| 201 | 201 | <?php } // End For Loop ?> |
| 202 | - <?php echo '<li class="my-account fix"><a class="button" href="'. esc_url( get_post_type_archive_link( 'lesson' ) ) .'">'.__('More Lessons', 'woothemes-sensei').'</a></li>'; ?>
|
|
| 202 | + <?php echo '<li class="my-account fix"><a class="button" href="'.esc_url(get_post_type_archive_link('lesson')).'">'.__('More Lessons', 'woothemes-sensei').'</a></li>'; ?>
|
|
| 203 | 203 | </ul> |
| 204 | 204 | <?php } // End If Statement |
| 205 | 205 | } // End load_component() |
@@ -1,5 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + exit; |
|
| 4 | +} |
|
| 5 | +// Exit if accessed directly. |
|
| 3 | 6 | |
| 4 | 7 | /** |
| 5 | 8 | * Sensei Course Component Widget |
@@ -10,8 +10,8 @@ |
||
| 10 | 10 | * @author WooThemes |
| 11 | 11 | * @since 1.0.0 |
| 12 | 12 | */ |
| 13 | -if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit(); |
|
| 13 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) exit(); |
|
| 14 | 14 | |
| 15 | 15 | $token = 'woothemes-sensei'; |
| 16 | -delete_option( 'skip_install_sensei_pages' ); |
|
| 17 | -delete_option( 'sensei_installed' ); |
|
| 18 | 16 | \ No newline at end of file |
| 17 | +delete_option('skip_install_sensei_pages'); |
|
| 18 | +delete_option('sensei_installed'); |
|
| 19 | 19 | \ No newline at end of file |
@@ -10,7 +10,9 @@ |
||
| 10 | 10 | * @author WooThemes |
| 11 | 11 | * @since 1.0.0 |
| 12 | 12 | */ |
| 13 | -if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit(); |
|
| 13 | +if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
| 14 | + exit(); |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | $token = 'woothemes-sensei'; |
| 16 | 18 | delete_option( 'skip_install_sensei_pages' ); |
@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * WooThemes Sensei Uninstall |
|
| 4 | - * |
|
| 5 | - * Uninstalls the plugin and associated data. |
|
| 6 | - * |
|
| 7 | - * @package WordPress |
|
| 8 | - * @subpackage Sensei |
|
| 9 | - * @category Core |
|
| 10 | - * @author WooThemes |
|
| 11 | - * @since 1.0.0 |
|
| 12 | - */ |
|
| 3 | + * WooThemes Sensei Uninstall |
|
| 4 | + * |
|
| 5 | + * Uninstalls the plugin and associated data. |
|
| 6 | + * |
|
| 7 | + * @package WordPress |
|
| 8 | + * @subpackage Sensei |
|
| 9 | + * @category Core |
|
| 10 | + * @author WooThemes |
|
| 11 | + * @since 1.0.0 |
|
| 12 | + */ |
|
| 13 | 13 | if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit(); |
| 14 | 14 | |
| 15 | 15 | $token = 'woothemes-sensei'; |
@@ -103,7 +103,7 @@ |
||
| 103 | 103 | * @param array $instance The settings for this instance. |
| 104 | 104 | * @return void |
| 105 | 105 | */ |
| 106 | - public function form( $instance ) {
|
|
| 106 | + public function form( $instance ) {
|
|
| 107 | 107 | |
| 108 | 108 | /* Set up some default widget settings. */ |
| 109 | 109 | /* Make sure all keys are added here, even with empty string values. */ |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 2 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly.
|
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Sensei Course Categories Widget |
@@ -26,18 +26,18 @@ discard block |
||
| 26 | 26 | public function __construct() {
|
| 27 | 27 | /* Widget variable settings. */ |
| 28 | 28 | $this->woo_widget_cssclass = 'widget_sensei_course_categories'; |
| 29 | - $this->woo_widget_description = __( 'This widget will output a list of Course Categories.', 'woothemes-sensei' ); |
|
| 29 | + $this->woo_widget_description = __('This widget will output a list of Course Categories.', 'woothemes-sensei');
|
|
| 30 | 30 | $this->woo_widget_idbase = 'sensei_course_categories'; |
| 31 | - $this->woo_widget_title = __( 'Sensei - Course Categories', 'woothemes-sensei' ); |
|
| 31 | + $this->woo_widget_title = __('Sensei - Course Categories', 'woothemes-sensei');
|
|
| 32 | 32 | |
| 33 | 33 | /* Widget settings. */ |
| 34 | - $widget_ops = array( 'classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description ); |
|
| 34 | + $widget_ops = array('classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description);
|
|
| 35 | 35 | |
| 36 | 36 | /* Widget control settings. */ |
| 37 | - $control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase ); |
|
| 37 | + $control_ops = array('width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase);
|
|
| 38 | 38 | |
| 39 | 39 | /* Create the widget. */ |
| 40 | - parent::__construct( $this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops ); |
|
| 40 | + parent::__construct($this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops); |
|
| 41 | 41 | } // End __construct() |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -47,26 +47,26 @@ discard block |
||
| 47 | 47 | * @param array $instance Widget settings for this instance. |
| 48 | 48 | * @return void |
| 49 | 49 | */ |
| 50 | - public function widget( $args, $instance ) {
|
|
| 51 | - extract( $args, EXTR_SKIP ); |
|
| 50 | + public function widget($args, $instance) {
|
|
| 51 | + extract($args, EXTR_SKIP); |
|
| 52 | 52 | |
| 53 | 53 | /* Our variables from the widget settings. */ |
| 54 | - $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
|
|
| 54 | + $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
|
|
| 55 | 55 | |
| 56 | 56 | /* Before widget (defined by themes). */ |
| 57 | 57 | echo $before_widget; |
| 58 | 58 | |
| 59 | 59 | /* Display the widget title if one was input (before and after defined by themes). */ |
| 60 | - if ( $title ) { echo $before_title . $title . $after_title; }
|
|
| 60 | + if ($title) { echo $before_title.$title.$after_title; }
|
|
| 61 | 61 | |
| 62 | 62 | /* Widget content. */ |
| 63 | 63 | // Add actions for plugins/themes to hook onto. |
| 64 | - do_action( $this->woo_widget_cssclass . '_top' ); |
|
| 64 | + do_action($this->woo_widget_cssclass.'_top'); |
|
| 65 | 65 | |
| 66 | - $this->load_component( $instance ); |
|
| 66 | + $this->load_component($instance); |
|
| 67 | 67 | |
| 68 | 68 | // Add actions for plugins/themes to hook onto. |
| 69 | - do_action( $this->woo_widget_cssclass . '_bottom' ); |
|
| 69 | + do_action($this->woo_widget_cssclass.'_bottom'); |
|
| 70 | 70 | |
| 71 | 71 | /* After widget (defined by themes). */ |
| 72 | 72 | echo $after_widget; |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | * @param array $old_instance Previous settings. |
| 81 | 81 | * @return array Updated settings. |
| 82 | 82 | */ |
| 83 | - public function update ( $new_instance, $old_instance ) {
|
|
| 83 | + public function update($new_instance, $old_instance) {
|
|
| 84 | 84 | $instance = $old_instance; |
| 85 | 85 | |
| 86 | 86 | /* Strip tags for title and name to remove HTML (important for text inputs). */ |
| 87 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
| 87 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 88 | 88 | |
| 89 | 89 | /* The select box is returning a text value, so we escape it. */ |
| 90 | - $instance['limit'] = esc_attr( $new_instance['limit'] ); |
|
| 90 | + $instance['limit'] = esc_attr($new_instance['limit']); |
|
| 91 | 91 | |
| 92 | 92 | /* The check box is returning a boolean value. */ |
| 93 | 93 | $instance['count'] = $new_instance['count']; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @param array $instance The settings for this instance. |
| 104 | 104 | * @return void |
| 105 | 105 | */ |
| 106 | - public function form( $instance ) {
|
|
| 106 | + public function form($instance) {
|
|
| 107 | 107 | |
| 108 | 108 | /* Set up some default widget settings. */ |
| 109 | 109 | /* Make sure all keys are added here, even with empty string values. */ |
@@ -114,27 +114,27 @@ discard block |
||
| 114 | 114 | 'hierarchical' => false |
| 115 | 115 | ); |
| 116 | 116 | |
| 117 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
| 117 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
| 118 | 118 | ?> |
| 119 | 119 | <!-- Widget Title: Text Input --> |
| 120 | 120 | <p> |
| 121 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label> |
|
| 122 | - <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" /> |
|
| 121 | + <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title (optional):', 'woothemes-sensei'); ?></label>
|
|
| 122 | + <input type="text" name="<?php echo esc_attr($this->get_field_name('title')); ?>" value="<?php echo esc_attr($instance['title']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" />
|
|
| 123 | 123 | </p> |
| 124 | 124 | <!-- Widget Limit: Text Input --> |
| 125 | 125 | <p> |
| 126 | - <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Categories (optional):', 'woothemes-sensei' ); ?></label> |
|
| 127 | - <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" value="<?php echo esc_attr( $instance['limit'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" /> |
|
| 126 | + <label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php _e('Number of Categories (optional):', 'woothemes-sensei'); ?></label>
|
|
| 127 | + <input type="text" name="<?php echo esc_attr($this->get_field_name('limit')); ?>" value="<?php echo esc_attr($instance['limit']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('limit')); ?>" />
|
|
| 128 | 128 | </p> |
| 129 | 129 | <!-- Widget Show Count: Checkbox Input --> |
| 130 | 130 | <p> |
| 131 | - <input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id('count') ); ?>" name="<?php echo esc_attr( $this->get_field_name('count') ); ?>"<?php checked( $instance['count'], 'on' ); ?> />
|
|
| 132 | - <label for="<?php echo esc_attr( $this->get_field_id('count') ); ?>"><?php _e( 'Show post counts', 'woothemes-sensei' ); ?></label><br />
|
|
| 131 | + <input type="checkbox" class="checkbox" id="<?php echo esc_attr($this->get_field_id('count')); ?>" name="<?php echo esc_attr($this->get_field_name('count')); ?>"<?php checked($instance['count'], 'on'); ?> />
|
|
| 132 | + <label for="<?php echo esc_attr($this->get_field_id('count')); ?>"><?php _e('Show post counts', 'woothemes-sensei'); ?></label><br />
|
|
| 133 | 133 | </p> |
| 134 | 134 | <!-- Widget Show Hierarchy: Checkbox Input --> |
| 135 | 135 | <p> |
| 136 | - <input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id('hierarchical') ); ?>" name="<?php echo esc_attr( $this->get_field_name('hierarchical') ); ?>"<?php checked( $instance['hierarchical'], 'on' ); ?> />
|
|
| 137 | - <label for="<?php echo esc_attr( $this->get_field_id('hierarchical') ); ?>"><?php _e( 'Show hierarchy', 'woothemes-sensei' ); ?></label></p>
|
|
| 136 | + <input type="checkbox" class="checkbox" id="<?php echo esc_attr($this->get_field_id('hierarchical')); ?>" name="<?php echo esc_attr($this->get_field_name('hierarchical')); ?>"<?php checked($instance['hierarchical'], 'on'); ?> />
|
|
| 137 | + <label for="<?php echo esc_attr($this->get_field_id('hierarchical')); ?>"><?php _e('Show hierarchy', 'woothemes-sensei'); ?></label></p>
|
|
| 138 | 138 | </p> |
| 139 | 139 | <?php |
| 140 | 140 | } // End form() |
@@ -145,18 +145,18 @@ discard block |
||
| 145 | 145 | * @since 1.1.0 |
| 146 | 146 | * @return void |
| 147 | 147 | */ |
| 148 | - protected function load_component ( $instance ) {
|
|
| 148 | + protected function load_component($instance) {
|
|
| 149 | 149 | |
| 150 | - $limit = intval( $instance['limit'] ); |
|
| 151 | - $count = isset($instance['count']) ? (bool) $instance['count'] :false; |
|
| 152 | - $hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false; |
|
| 150 | + $limit = intval($instance['limit']); |
|
| 151 | + $count = isset($instance['count']) ? (bool) $instance['count'] : false; |
|
| 152 | + $hierarchical = isset($instance['hierarchical']) ? (bool) $instance['hierarchical'] : false; |
|
| 153 | 153 | |
| 154 | - $cat_args = array( 'title_li' => '', 'taxonomy' => 'course-category', 'orderby' => 'name', 'show_count' => $count, 'hierarchical' => $hierarchical); |
|
| 155 | - if ( 0 < $limit ) {
|
|
| 156 | - $cat_args[ 'number' ] = $limit; |
|
| 154 | + $cat_args = array('title_li' => '', 'taxonomy' => 'course-category', 'orderby' => 'name', 'show_count' => $count, 'hierarchical' => $hierarchical);
|
|
| 155 | + if (0 < $limit) {
|
|
| 156 | + $cat_args['number'] = $limit; |
|
| 157 | 157 | } // End If Statement |
| 158 | 158 | echo '<ul>'; |
| 159 | - wp_list_categories( apply_filters('widget_course_categories_args', $cat_args) );
|
|
| 159 | + wp_list_categories(apply_filters('widget_course_categories_args', $cat_args));
|
|
| 160 | 160 | echo '</ul>'; |
| 161 | 161 | } // End load_component() |
| 162 | 162 | } // End Class |
| 163 | 163 | \ No newline at end of file |
@@ -1,5 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + exit; |
|
| 4 | +} |
|
| 5 | +// Exit if accessed directly. |
|
| 3 | 6 | |
| 4 | 7 | /** |
| 5 | 8 | * Sensei Course Component Widget |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * @param array $instance The settings for this instance. |
| 107 | 107 | * @return void |
| 108 | 108 | */ |
| 109 | - public function form( $instance ) {
|
|
| 109 | + public function form( $instance ) {
|
|
| 110 | 110 | |
| 111 | 111 | /* Set up some default widget settings. */ |
| 112 | 112 | /* Make sure all keys are added here, even with empty string values. */ |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | $post_args = array( 'post_type' => 'course', |
| 154 | 154 | 'posts_per_page' => intval( $instance[ 'limit' ] ), |
| 155 | 155 | 'orderby' => 'menu_order date', |
| 156 | - 'order' => 'ASC', |
|
| 157 | - 'post_status' => 'publish', |
|
| 156 | + 'order' => 'ASC', |
|
| 157 | + 'post_status' => 'publish', |
|
| 158 | 158 | 'suppress_filters' => 0, |
| 159 | 159 | ); |
| 160 | 160 | |
@@ -171,13 +171,13 @@ discard block |
||
| 171 | 171 | if ( count( $posts_array ) > 0 ) { ?>
|
| 172 | 172 | <ul> |
| 173 | 173 | <?php foreach ($posts_array as $post_item){
|
| 174 | - $post_id = absint( $post_item->ID ); |
|
| 175 | - $post_title = $post_item->post_title; |
|
| 176 | - $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 177 | - $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 178 | - $author_display_name = $user_info->display_name; |
|
| 179 | - $author_id = $post_item->post_author; |
|
| 180 | - ?> |
|
| 174 | + $post_id = absint( $post_item->ID ); |
|
| 175 | + $post_title = $post_item->post_title; |
|
| 176 | + $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 177 | + $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 178 | + $author_display_name = $user_info->display_name; |
|
| 179 | + $author_id = $post_item->post_author; |
|
| 180 | + ?> |
|
| 181 | 181 | <li class="fix"> |
| 182 | 182 | <?php do_action( 'sensei_course_image', $post_id ); ?> |
| 183 | 183 | <a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a> |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 2 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly.
|
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Sensei Category Courses Widget |
@@ -26,18 +26,18 @@ discard block |
||
| 26 | 26 | public function __construct() {
|
| 27 | 27 | /* Widget variable settings. */ |
| 28 | 28 | $this->woo_widget_cssclass = 'widget_sensei_category_courses'; |
| 29 | - $this->woo_widget_description = __( 'This widget will output a list of Courses for a specific category.', 'woothemes-sensei' ); |
|
| 29 | + $this->woo_widget_description = __('This widget will output a list of Courses for a specific category.', 'woothemes-sensei');
|
|
| 30 | 30 | $this->woo_widget_idbase = 'sensei_category_courses'; |
| 31 | - $this->woo_widget_title = __( 'Sensei - Category Courses', 'woothemes-sensei' ); |
|
| 31 | + $this->woo_widget_title = __('Sensei - Category Courses', 'woothemes-sensei');
|
|
| 32 | 32 | |
| 33 | 33 | /* Widget settings. */ |
| 34 | - $widget_ops = array( 'classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description ); |
|
| 34 | + $widget_ops = array('classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description);
|
|
| 35 | 35 | |
| 36 | 36 | /* Widget control settings. */ |
| 37 | - $control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase ); |
|
| 37 | + $control_ops = array('width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase);
|
|
| 38 | 38 | |
| 39 | 39 | /* Create the widget. */ |
| 40 | - parent::__construct( $this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops ); |
|
| 40 | + parent::__construct($this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops); |
|
| 41 | 41 | |
| 42 | 42 | } // End __construct() |
| 43 | 43 | |
@@ -48,28 +48,28 @@ discard block |
||
| 48 | 48 | * @param array $instance Widget settings for this instance. |
| 49 | 49 | * @return void |
| 50 | 50 | */ |
| 51 | - public function widget( $args, $instance ) {
|
|
| 52 | - extract( $args, EXTR_SKIP ); |
|
| 51 | + public function widget($args, $instance) {
|
|
| 52 | + extract($args, EXTR_SKIP); |
|
| 53 | 53 | |
| 54 | 54 | /* Our variables from the widget settings. */ |
| 55 | - $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
|
|
| 55 | + $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
|
|
| 56 | 56 | |
| 57 | 57 | /* Before widget (defined by themes). */ |
| 58 | 58 | echo $before_widget; |
| 59 | 59 | |
| 60 | 60 | /* Display the widget title if one was input (before and after defined by themes). */ |
| 61 | - if ( $title ) { echo $before_title . $title . $after_title; }
|
|
| 61 | + if ($title) { echo $before_title.$title.$after_title; }
|
|
| 62 | 62 | |
| 63 | 63 | /* Widget content. */ |
| 64 | 64 | // Add actions for plugins/themes to hook onto. |
| 65 | - do_action( $this->woo_widget_cssclass . '_top' ); |
|
| 65 | + do_action($this->woo_widget_cssclass.'_top'); |
|
| 66 | 66 | |
| 67 | - if ( 0 < intval( $instance['course_category'] ) ) {
|
|
| 68 | - $this->load_component( $instance ); |
|
| 67 | + if (0 < intval($instance['course_category'])) {
|
|
| 68 | + $this->load_component($instance); |
|
| 69 | 69 | } // End If Statement |
| 70 | 70 | |
| 71 | 71 | // Add actions for plugins/themes to hook onto. |
| 72 | - do_action( $this->woo_widget_cssclass . '_bottom' ); |
|
| 72 | + do_action($this->woo_widget_cssclass.'_bottom'); |
|
| 73 | 73 | |
| 74 | 74 | /* After widget (defined by themes). */ |
| 75 | 75 | echo $after_widget; |
@@ -83,17 +83,17 @@ discard block |
||
| 83 | 83 | * @param array $old_instance Previous settings. |
| 84 | 84 | * @return array Updated settings. |
| 85 | 85 | */ |
| 86 | - public function update ( $new_instance, $old_instance ) {
|
|
| 86 | + public function update($new_instance, $old_instance) {
|
|
| 87 | 87 | $instance = $old_instance; |
| 88 | 88 | |
| 89 | 89 | /* Strip tags for title and name to remove HTML (important for text inputs). */ |
| 90 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
| 90 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 91 | 91 | |
| 92 | 92 | /* The select box is returning a text value, so we escape it. */ |
| 93 | - $instance['course_category'] = esc_attr( $new_instance['course_category'] ); |
|
| 93 | + $instance['course_category'] = esc_attr($new_instance['course_category']); |
|
| 94 | 94 | |
| 95 | 95 | /* Strip tags for limit to remove HTML (important for text inputs). */ |
| 96 | - $instance['limit'] = strip_tags( $new_instance['limit'] ); |
|
| 96 | + $instance['limit'] = strip_tags($new_instance['limit']); |
|
| 97 | 97 | |
| 98 | 98 | |
| 99 | 99 | return $instance; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * @param array $instance The settings for this instance. |
| 107 | 107 | * @return void |
| 108 | 108 | */ |
| 109 | - public function form( $instance ) {
|
|
| 109 | + public function form($instance) {
|
|
| 110 | 110 | |
| 111 | 111 | /* Set up some default widget settings. */ |
| 112 | 112 | /* Make sure all keys are added here, even with empty string values. */ |
@@ -116,25 +116,25 @@ discard block |
||
| 116 | 116 | 'limit' => 3 |
| 117 | 117 | ); |
| 118 | 118 | |
| 119 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
| 119 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
| 120 | 120 | ?> |
| 121 | 121 | <!-- Widget Title: Text Input --> |
| 122 | 122 | <p> |
| 123 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label> |
|
| 124 | - <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" /> |
|
| 123 | + <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title (optional):', 'woothemes-sensei'); ?></label>
|
|
| 124 | + <input type="text" name="<?php echo esc_attr($this->get_field_name('title')); ?>" value="<?php echo esc_attr($instance['title']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" />
|
|
| 125 | 125 | </p> |
| 126 | 126 | <!-- Widget Course Category: Select Input --> |
| 127 | 127 | <p> |
| 128 | - <label for="<?php echo esc_attr( $this->get_field_id( 'course_category' ) ); ?>"><?php _e( 'Course Category:', 'woothemes-sensei' ); ?></label> |
|
| 128 | + <label for="<?php echo esc_attr($this->get_field_id('course_category')); ?>"><?php _e('Course Category:', 'woothemes-sensei'); ?></label>
|
|
| 129 | 129 | <?php |
| 130 | - $cat_args = array( 'hierarchical' => true, 'show_option_none' => __( 'Select Category:', 'woothemes-sensei' ), 'taxonomy' => 'course-category', 'orderby' => 'name', 'selected' => intval( $instance['course_category'] ), 'id' => $this->get_field_id( 'course_category' ), 'name' => $this->get_field_name( 'course_category' ), 'class' => 'widefat' ); |
|
| 130 | + $cat_args = array('hierarchical' => true, 'show_option_none' => __('Select Category:', 'woothemes-sensei'), 'taxonomy' => 'course-category', 'orderby' => 'name', 'selected' => intval($instance['course_category']), 'id' => $this->get_field_id('course_category'), 'name' => $this->get_field_name('course_category'), 'class' => 'widefat');
|
|
| 131 | 131 | wp_dropdown_categories(apply_filters('widget_course_categories_dropdown_args', $cat_args));
|
| 132 | 132 | ?> |
| 133 | 133 | </p> |
| 134 | 134 | <!-- Widget Limit: Text Input --> |
| 135 | 135 | <p> |
| 136 | - <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Courses (optional):', 'woothemes-sensei' ); ?></label> |
|
| 137 | - <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" value="<?php echo esc_attr( $instance['limit'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" /> |
|
| 136 | + <label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php _e('Number of Courses (optional):', 'woothemes-sensei'); ?></label>
|
|
| 137 | + <input type="text" name="<?php echo esc_attr($this->get_field_name('limit')); ?>" value="<?php echo esc_attr($instance['limit']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('limit')); ?>" />
|
|
| 138 | 138 | </p> |
| 139 | 139 | |
| 140 | 140 | <?php |
@@ -146,49 +146,49 @@ discard block |
||
| 146 | 146 | * @since 1.1.0 |
| 147 | 147 | * @return void |
| 148 | 148 | */ |
| 149 | - protected function load_component ( $instance ) {
|
|
| 149 | + protected function load_component($instance) {
|
|
| 150 | 150 | |
| 151 | 151 | |
| 152 | 152 | $posts_array = array(); |
| 153 | - $post_args = array( 'post_type' => 'course', |
|
| 154 | - 'posts_per_page' => intval( $instance[ 'limit' ] ), |
|
| 153 | + $post_args = array('post_type' => 'course',
|
|
| 154 | + 'posts_per_page' => intval($instance['limit']), |
|
| 155 | 155 | 'orderby' => 'menu_order date', |
| 156 | 156 | 'order' => 'ASC', |
| 157 | 157 | 'post_status' => 'publish', |
| 158 | 158 | 'suppress_filters' => 0, |
| 159 | 159 | ); |
| 160 | 160 | |
| 161 | - $post_args[ 'tax_query' ] = array( |
|
| 161 | + $post_args['tax_query'] = array( |
|
| 162 | 162 | array( |
| 163 | 163 | 'taxonomy' => 'course-category', |
| 164 | 164 | 'field' => 'id', |
| 165 | - 'terms' => intval( $instance['course_category'] ) |
|
| 165 | + 'terms' => intval($instance['course_category']) |
|
| 166 | 166 | ) |
| 167 | 167 | ); |
| 168 | 168 | |
| 169 | - $posts_array = get_posts( $post_args ); |
|
| 169 | + $posts_array = get_posts($post_args); |
|
| 170 | 170 | |
| 171 | - if ( count( $posts_array ) > 0 ) { ?>
|
|
| 171 | + if (count($posts_array) > 0) { ?>
|
|
| 172 | 172 | <ul> |
| 173 | - <?php foreach ($posts_array as $post_item){
|
|
| 174 | - $post_id = absint( $post_item->ID ); |
|
| 173 | + <?php foreach ($posts_array as $post_item) {
|
|
| 174 | + $post_id = absint($post_item->ID); |
|
| 175 | 175 | $post_title = $post_item->post_title; |
| 176 | - $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 177 | - $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 176 | + $user_info = get_userdata(absint($post_item->post_author)); |
|
| 177 | + $author_link = get_author_posts_url(absint($post_item->post_author)); |
|
| 178 | 178 | $author_display_name = $user_info->display_name; |
| 179 | 179 | $author_id = $post_item->post_author; |
| 180 | 180 | ?> |
| 181 | 181 | <li class="fix"> |
| 182 | - <?php do_action( 'sensei_course_image', $post_id ); ?> |
|
| 183 | - <a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a> |
|
| 182 | + <?php do_action('sensei_course_image', $post_id); ?>
|
|
| 183 | + <a href="<?php echo esc_url(get_permalink($post_id)); ?>" title="<?php echo esc_attr($post_title); ?>"><?php echo $post_title; ?></a> |
|
| 184 | 184 | <br /> |
| 185 | - <?php if ( isset( Sensei()->settings->settings[ 'course_author' ] ) && ( Sensei()->settings->settings[ 'course_author' ] ) ) { ?>
|
|
| 186 | - <span class="course-author"><?php _e( 'by ', 'woothemes-sensei' ); ?><a href="<?php echo esc_url( $author_link ); ?>" title="<?php echo esc_attr( $author_display_name ); ?>"><?php echo esc_html( $author_display_name ); ?></a></span> |
|
| 185 | + <?php if (isset(Sensei()->settings->settings['course_author']) && (Sensei()->settings->settings['course_author'])) { ?>
|
|
| 186 | + <span class="course-author"><?php _e('by ', 'woothemes-sensei'); ?><a href="<?php echo esc_url($author_link); ?>" title="<?php echo esc_attr($author_display_name); ?>"><?php echo esc_html($author_display_name); ?></a></span>
|
|
| 187 | 187 | <br /> |
| 188 | 188 | <?php } // End If Statement ?> |
| 189 | - <span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count( $post_id ) . ' ' . __( 'Lessons', 'woothemes-sensei' ); ?></span> |
|
| 189 | + <span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count($post_id).' '.__('Lessons', 'woothemes-sensei'); ?></span>
|
|
| 190 | 190 | <br /> |
| 191 | - <?php sensei_simple_course_price( $post_id ); ?> |
|
| 191 | + <?php sensei_simple_course_price($post_id); ?> |
|
| 192 | 192 | </li> |
| 193 | 193 | <?php } // End For Loop ?> |
| 194 | 194 | </ul> |
@@ -1,5 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + exit; |
|
| 4 | +} |
|
| 5 | +// Exit if accessed directly. |
|
| 3 | 6 | |
| 4 | 7 | /** |
| 5 | 8 | * Sensei Course Component Widget |
@@ -1,17 +1,17 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 3 | 3 | /** |
| 4 | - * Content-lesson.php template file |
|
| 5 | - * |
|
| 6 | - * responsible for content on archive like pages. Only shows the lesson excerpt. |
|
| 7 | - * |
|
| 8 | - * For single lesson content please see single-lesson.php |
|
| 9 | - * |
|
| 10 | - * @author Automattic |
|
| 11 | - * @package Sensei |
|
| 12 | - * @category Templates |
|
| 13 | - * @version 1.9.0 |
|
| 14 | - */ |
|
| 4 | + * Content-lesson.php template file |
|
| 5 | + * |
|
| 6 | + * responsible for content on archive like pages. Only shows the lesson excerpt. |
|
| 7 | + * |
|
| 8 | + * For single lesson content please see single-lesson.php |
|
| 9 | + * |
|
| 10 | + * @author Automattic |
|
| 11 | + * @package Sensei |
|
| 12 | + * @category Templates |
|
| 13 | + * @version 1.9.0 |
|
| 14 | + */ |
|
| 15 | 15 | ?> |
| 16 | 16 | |
| 17 | 17 | <article <?php post_class( get_the_ID() ); ?> > |
@@ -19,32 +19,32 @@ discard block |
||
| 19 | 19 | <section class="lesson-content"> |
| 20 | 20 | |
| 21 | 21 | <?php |
| 22 | - /** |
|
| 23 | - * sensei_content_lesson_before |
|
| 24 | - * action that runs before the sensei {post_type} content. It runs inside the sensei |
|
| 25 | - * content.php template. This applies to the specific post type that you've targeted. |
|
| 26 | - * |
|
| 27 | - * @since 1.9.0 |
|
| 28 | - * @param string $post_id |
|
| 29 | - */ |
|
| 30 | - do_action( 'sensei_content_lesson_before', get_the_ID() ); |
|
| 31 | - ?> |
|
| 22 | + /** |
|
| 23 | + * sensei_content_lesson_before |
|
| 24 | + * action that runs before the sensei {post_type} content. It runs inside the sensei |
|
| 25 | + * content.php template. This applies to the specific post type that you've targeted. |
|
| 26 | + * |
|
| 27 | + * @since 1.9.0 |
|
| 28 | + * @param string $post_id |
|
| 29 | + */ |
|
| 30 | + do_action( 'sensei_content_lesson_before', get_the_ID() ); |
|
| 31 | + ?> |
|
| 32 | 32 | |
| 33 | 33 | <section class="entry"> |
| 34 | 34 | |
| 35 | 35 | <?php |
| 36 | - /** |
|
| 37 | - * Fires just before the post content in the content-lesson.php file. |
|
| 38 | - * |
|
| 39 | - * @since 1.9.0 |
|
| 40 | - * |
|
| 41 | - * @hooked Sensei()->modules->module_archive_description - 11 |
|
| 42 | - * @hooked Sensei_Lesson::the_lesson_meta - 20 |
|
| 43 | - * |
|
| 44 | - * @param string $post_id |
|
| 45 | - */ |
|
| 46 | - do_action('sensei_content_lesson_inside_before', get_the_ID()); |
|
| 47 | - ?> |
|
| 36 | + /** |
|
| 37 | + * Fires just before the post content in the content-lesson.php file. |
|
| 38 | + * |
|
| 39 | + * @since 1.9.0 |
|
| 40 | + * |
|
| 41 | + * @hooked Sensei()->modules->module_archive_description - 11 |
|
| 42 | + * @hooked Sensei_Lesson::the_lesson_meta - 20 |
|
| 43 | + * |
|
| 44 | + * @param string $post_id |
|
| 45 | + */ |
|
| 46 | + do_action('sensei_content_lesson_inside_before', get_the_ID()); |
|
| 47 | + ?> |
|
| 48 | 48 | |
| 49 | 49 | <p class="lesson-excerpt"> |
| 50 | 50 | |
@@ -53,28 +53,28 @@ discard block |
||
| 53 | 53 | </p> |
| 54 | 54 | |
| 55 | 55 | <?php |
| 56 | - /** |
|
| 57 | - * Fires just after the post content in the lesson-content.php file. |
|
| 58 | - * |
|
| 59 | - * @since 1.9.0 |
|
| 60 | - * |
|
| 61 | - * @param string $post_id |
|
| 62 | - */ |
|
| 63 | - do_action('sensei_content_lesson_inside_after', get_the_ID()); |
|
| 64 | - ?> |
|
| 56 | + /** |
|
| 57 | + * Fires just after the post content in the lesson-content.php file. |
|
| 58 | + * |
|
| 59 | + * @since 1.9.0 |
|
| 60 | + * |
|
| 61 | + * @param string $post_id |
|
| 62 | + */ |
|
| 63 | + do_action('sensei_content_lesson_inside_after', get_the_ID()); |
|
| 64 | + ?> |
|
| 65 | 65 | |
| 66 | 66 | </section> <!-- section .entry --> |
| 67 | 67 | |
| 68 | 68 | <?php |
| 69 | - /** |
|
| 70 | - * This action runs after the sensei lesson content. It runs inside the sensei |
|
| 71 | - * lesson-content.php template. |
|
| 72 | - * |
|
| 73 | - * @since 1.9.0 |
|
| 74 | - * @param string $post_id |
|
| 75 | - */ |
|
| 76 | - do_action( 'sensei_content_lesson_after', get_the_ID() ); |
|
| 77 | - ?> |
|
| 69 | + /** |
|
| 70 | + * This action runs after the sensei lesson content. It runs inside the sensei |
|
| 71 | + * lesson-content.php template. |
|
| 72 | + * |
|
| 73 | + * @since 1.9.0 |
|
| 74 | + * @param string $post_id |
|
| 75 | + */ |
|
| 76 | + do_action( 'sensei_content_lesson_after', get_the_ID() ); |
|
| 77 | + ?> |
|
| 78 | 78 | |
| 79 | 79 | </section> <!-- article .lesson-content --> |
| 80 | 80 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 2 | +if ( ! defined('ABSPATH')) exit; |
|
| 3 | 3 | /** |
| 4 | 4 | * Content-lesson.php template file |
| 5 | 5 | * |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | ?> |
| 16 | 16 | |
| 17 | -<article <?php post_class( get_the_ID() ); ?> > |
|
| 17 | +<article <?php post_class(get_the_ID()); ?> > |
|
| 18 | 18 | |
| 19 | 19 | <section class="lesson-content"> |
| 20 | 20 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * @since 1.9.0 |
| 28 | 28 | * @param string $post_id |
| 29 | 29 | */ |
| 30 | - do_action( 'sensei_content_lesson_before', get_the_ID() ); |
|
| 30 | + do_action('sensei_content_lesson_before', get_the_ID()); |
|
| 31 | 31 | ?> |
| 32 | 32 | |
| 33 | 33 | <section class="entry"> |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | * @since 1.9.0 |
| 74 | 74 | * @param string $post_id |
| 75 | 75 | */ |
| 76 | - do_action( 'sensei_content_lesson_after', get_the_ID() ); |
|
| 76 | + do_action('sensei_content_lesson_after', get_the_ID()); |
|
| 77 | 77 | ?> |
| 78 | 78 | |
| 79 | 79 | </section> <!-- article .lesson-content --> |
| 80 | 80 | |
| 81 | -</article> <!-- article .(<?php esc_attr_e( join( ' ', get_post_class( array( 'lesson', 'post' ) ) ) ); ?> --> |
|
| 82 | 81 | \ No newline at end of file |
| 82 | +</article> <!-- article .(<?php esc_attr_e(join(' ', get_post_class(array('lesson', 'post')))); ?> --> |
|
| 83 | 83 | \ No newline at end of file |
@@ -1,5 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + exit; |
|
| 4 | +} |
|
| 3 | 5 | /** |
| 4 | 6 | * The Template for displaying the my course page data. |
| 5 | 7 | * |
@@ -11,7 +11,7 @@ discard block |
||
| 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 | |
@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | * @param $quiz_id |
| 28 | 28 | * |
| 29 | 29 | */ |
| 30 | - do_action( 'sensei_single_quiz_content_inside_before', get_the_ID() ); |
|
| 30 | + do_action('sensei_single_quiz_content_inside_before', get_the_ID()); |
|
| 31 | 31 | |
| 32 | 32 | ?> |
| 33 | 33 | |
| 34 | 34 | <section class="entry quiz-questions"> |
| 35 | 35 | |
| 36 | - <?php if ( sensei_quiz_has_questions() ): ?> |
|
| 36 | + <?php if (sensei_quiz_has_questions()): ?> |
|
| 37 | 37 | |
| 38 | - <form method="POST" action="<?php echo esc_url_raw( get_permalink() ); ?>" enctype="multipart/form-data"> |
|
| 38 | + <form method="POST" action="<?php echo esc_url_raw(get_permalink()); ?>" enctype="multipart/form-data"> |
|
| 39 | 39 | |
| 40 | 40 | <?php |
| 41 | 41 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @param string $the_quiz_id |
| 48 | 48 | */ |
| 49 | - do_action( 'sensei_single_quiz_questions_before', get_the_id() ); |
|
| 49 | + do_action('sensei_single_quiz_questions_before', get_the_id()); |
|
| 50 | 50 | |
| 51 | 51 | ?> |
| 52 | 52 | |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | <ol id="sensei-quiz-list"> |
| 56 | 56 | |
| 57 | - <?php while ( sensei_quiz_has_questions() ): sensei_setup_the_question(); ?> |
|
| 57 | + <?php while (sensei_quiz_has_questions()): sensei_setup_the_question(); ?> |
|
| 58 | 58 | |
| 59 | - <li class="<?php sensei_the_question_class();?>"> |
|
| 59 | + <li class="<?php sensei_the_question_class(); ?>"> |
|
| 60 | 60 | |
| 61 | 61 | <?php |
| 62 | 62 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * @since 1.9.0 |
| 72 | 72 | * @param string $the_question_id |
| 73 | 73 | */ |
| 74 | - do_action( 'sensei_quiz_question_inside_before', sensei_get_the_question_id() ); |
|
| 74 | + do_action('sensei_quiz_question_inside_before', sensei_get_the_question_id()); |
|
| 75 | 75 | |
| 76 | 76 | ?> |
| 77 | 77 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @param string $the_question_id |
| 88 | 88 | */ |
| 89 | - do_action( 'sensei_quiz_question_inside_after', sensei_get_the_question_id() ); |
|
| 89 | + do_action('sensei_quiz_question_inside_after', sensei_get_the_question_id()); |
|
| 90 | 90 | |
| 91 | 91 | ?> |
| 92 | 92 | |
@@ -103,21 +103,21 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @param string $the_quiz_id |
| 105 | 105 | */ |
| 106 | - do_action( 'sensei_single_quiz_questions_after', get_the_id() ); |
|
| 106 | + do_action('sensei_single_quiz_questions_after', get_the_id()); |
|
| 107 | 107 | |
| 108 | 108 | ?> |
| 109 | 109 | |
| 110 | 110 | </form> |
| 111 | 111 | <?php else: ?> |
| 112 | 112 | |
| 113 | - <div class="sensei-message alert"> <?php _e( 'There are no questions for this Quiz yet. Check back soon.', 'woothemes-sensei' ); ?></div> |
|
| 113 | + <div class="sensei-message alert"> <?php _e('There are no questions for this Quiz yet. Check back soon.', 'woothemes-sensei'); ?></div> |
|
| 114 | 114 | |
| 115 | 115 | <?php endif; // End If have questions ?> |
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | <?php |
| 119 | 119 | $quiz_lesson = Sensei()->quiz->data->quiz_lesson; |
| 120 | - do_action( 'sensei_quiz_back_link', $quiz_lesson ); |
|
| 120 | + do_action('sensei_quiz_back_link', $quiz_lesson); |
|
| 121 | 121 | ?> |
| 122 | 122 | |
| 123 | 123 | </section> |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @hooked |
| 133 | 133 | * |
| 134 | 134 | */ |
| 135 | - do_action( 'sensei_single_quiz_content_inside_after' ); |
|
| 135 | + do_action('sensei_single_quiz_content_inside_after'); |
|
| 136 | 136 | |
| 137 | 137 | ?> |
| 138 | 138 | |
@@ -108,9 +108,12 @@ |
||
| 108 | 108 | ?> |
| 109 | 109 | |
| 110 | 110 | </form> |
| 111 | - <?php else: ?> |
|
| 111 | + <?php else { |
|
| 112 | + : ?> |
|
| 112 | 113 | |
| 113 | - <div class="sensei-message alert"> <?php _e( 'There are no questions for this Quiz yet. Check back soon.', 'woothemes-sensei' ); ?></div> |
|
| 114 | + <div class="sensei-message alert"> <?php _e( 'There are no questions for this Quiz yet. Check back soon.', 'woothemes-sensei' ); |
|
| 115 | +} |
|
| 116 | +?></div> |
|
| 114 | 117 | |
| 115 | 118 | <?php endif; // End If have questions ?> |
| 116 | 119 | |
@@ -1,14 +1,14 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * The Template for displaying all Quiz Questions. |
|
| 4 | - * |
|
| 5 | - * Override this template by copying it to yourtheme/sensei/single-quiz.php |
|
| 6 | - * |
|
| 7 | - * @author Automattic |
|
| 8 | - * @package Sensei |
|
| 9 | - * @category Templates |
|
| 10 | - * @version 1.9.0 |
|
| 11 | - */ |
|
| 3 | + * The Template for displaying all Quiz Questions. |
|
| 4 | + * |
|
| 5 | + * Override this template by copying it to yourtheme/sensei/single-quiz.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(); ?> |
@@ -17,19 +17,19 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | <?php |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Hook inside the single quiz post above the content |
|
| 22 | - * |
|
| 23 | - * @since 1.9.0 |
|
| 24 | - * |
|
| 25 | - * @hooked Sensei_Quiz::the_title - 20 |
|
| 26 | - * @hooked Sensei_Quiz::the_user_status_message - 40 |
|
| 27 | - * @param $quiz_id |
|
| 28 | - * |
|
| 29 | - */ |
|
| 30 | - do_action( 'sensei_single_quiz_content_inside_before', get_the_ID() ); |
|
| 20 | + /** |
|
| 21 | + * Hook inside the single quiz post above the content |
|
| 22 | + * |
|
| 23 | + * @since 1.9.0 |
|
| 24 | + * |
|
| 25 | + * @hooked Sensei_Quiz::the_title - 20 |
|
| 26 | + * @hooked Sensei_Quiz::the_user_status_message - 40 |
|
| 27 | + * @param $quiz_id |
|
| 28 | + * |
|
| 29 | + */ |
|
| 30 | + do_action( 'sensei_single_quiz_content_inside_before', get_the_ID() ); |
|
| 31 | 31 | |
| 32 | - ?> |
|
| 32 | + ?> |
|
| 33 | 33 | |
| 34 | 34 | <section class="entry quiz-questions"> |
| 35 | 35 | |
@@ -39,16 +39,16 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | <?php |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Action inside before the question content on single-quiz page |
|
| 44 | - * |
|
| 45 | - * @hooked WooThemes_Sensei_Quiz::the_user_status_message - 10 |
|
| 46 | - * |
|
| 47 | - * @param string $the_quiz_id |
|
| 48 | - */ |
|
| 49 | - do_action( 'sensei_single_quiz_questions_before', get_the_id() ); |
|
| 42 | + /** |
|
| 43 | + * Action inside before the question content on single-quiz page |
|
| 44 | + * |
|
| 45 | + * @hooked WooThemes_Sensei_Quiz::the_user_status_message - 10 |
|
| 46 | + * |
|
| 47 | + * @param string $the_quiz_id |
|
| 48 | + */ |
|
| 49 | + do_action( 'sensei_single_quiz_questions_before', get_the_id() ); |
|
| 50 | 50 | |
| 51 | - ?> |
|
| 51 | + ?> |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | |
@@ -60,35 +60,35 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | <?php |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Action inside before the question content on single-quiz page |
|
| 65 | - * |
|
| 66 | - * @hooked WooThemes_Sensei_Question::the_question_title - 10 |
|
| 67 | - * @hooked WooThemes_Sensei_Question::the_question_description - 20 |
|
| 68 | - * @hooked WooThemes_Sensei_Question::the_question_media - 30 |
|
| 69 | - * @hooked WooThemes_Sensei_Question::the_question_hidden_field - 40 |
|
| 70 | - * |
|
| 71 | - * @since 1.9.0 |
|
| 72 | - * @param string $the_question_id |
|
| 73 | - */ |
|
| 74 | - do_action( 'sensei_quiz_question_inside_before', sensei_get_the_question_id() ); |
|
| 75 | - |
|
| 76 | - ?> |
|
| 63 | + /** |
|
| 64 | + * Action inside before the question content on single-quiz page |
|
| 65 | + * |
|
| 66 | + * @hooked WooThemes_Sensei_Question::the_question_title - 10 |
|
| 67 | + * @hooked WooThemes_Sensei_Question::the_question_description - 20 |
|
| 68 | + * @hooked WooThemes_Sensei_Question::the_question_media - 30 |
|
| 69 | + * @hooked WooThemes_Sensei_Question::the_question_hidden_field - 40 |
|
| 70 | + * |
|
| 71 | + * @since 1.9.0 |
|
| 72 | + * @param string $the_question_id |
|
| 73 | + */ |
|
| 74 | + do_action( 'sensei_quiz_question_inside_before', sensei_get_the_question_id() ); |
|
| 75 | + |
|
| 76 | + ?> |
|
| 77 | 77 | |
| 78 | 78 | <?php sensei_the_question_content(); ?> |
| 79 | 79 | |
| 80 | 80 | <?php |
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Action inside before the question content on single-quiz page |
|
| 84 | - * |
|
| 85 | - * @hooked WooThemes_Sensei_Question::answer_feedback_notes |
|
| 86 | - * |
|
| 87 | - * @param string $the_question_id |
|
| 88 | - */ |
|
| 89 | - do_action( 'sensei_quiz_question_inside_after', sensei_get_the_question_id() ); |
|
| 82 | + /** |
|
| 83 | + * Action inside before the question content on single-quiz page |
|
| 84 | + * |
|
| 85 | + * @hooked WooThemes_Sensei_Question::answer_feedback_notes |
|
| 86 | + * |
|
| 87 | + * @param string $the_question_id |
|
| 88 | + */ |
|
| 89 | + do_action( 'sensei_quiz_question_inside_after', sensei_get_the_question_id() ); |
|
| 90 | 90 | |
| 91 | - ?> |
|
| 91 | + ?> |
|
| 92 | 92 | |
| 93 | 93 | </li> |
| 94 | 94 | |
@@ -98,14 +98,14 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | <?php |
| 100 | 100 | |
| 101 | - /** |
|
| 102 | - * Action inside before the question content on single-quiz page |
|
| 103 | - * |
|
| 104 | - * @param string $the_quiz_id |
|
| 105 | - */ |
|
| 106 | - do_action( 'sensei_single_quiz_questions_after', get_the_id() ); |
|
| 101 | + /** |
|
| 102 | + * Action inside before the question content on single-quiz page |
|
| 103 | + * |
|
| 104 | + * @param string $the_quiz_id |
|
| 105 | + */ |
|
| 106 | + do_action( 'sensei_single_quiz_questions_after', get_the_id() ); |
|
| 107 | 107 | |
| 108 | - ?> |
|
| 108 | + ?> |
|
| 109 | 109 | |
| 110 | 110 | </form> |
| 111 | 111 | <?php else: ?> |
@@ -116,25 +116,25 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | <?php |
| 119 | - $quiz_lesson = Sensei()->quiz->data->quiz_lesson; |
|
| 120 | - do_action( 'sensei_quiz_back_link', $quiz_lesson ); |
|
| 121 | - ?> |
|
| 119 | + $quiz_lesson = Sensei()->quiz->data->quiz_lesson; |
|
| 120 | + do_action( 'sensei_quiz_back_link', $quiz_lesson ); |
|
| 121 | + ?> |
|
| 122 | 122 | |
| 123 | 123 | </section> |
| 124 | 124 | |
| 125 | 125 | <?php |
| 126 | 126 | |
| 127 | - /** |
|
| 128 | - * Hook inside the single quiz post above the content |
|
| 129 | - * |
|
| 130 | - * @since 1.9.0 |
|
| 131 | - * |
|
| 132 | - * @hooked |
|
| 133 | - * |
|
| 134 | - */ |
|
| 135 | - do_action( 'sensei_single_quiz_content_inside_after' ); |
|
| 136 | - |
|
| 137 | - ?> |
|
| 127 | + /** |
|
| 128 | + * Hook inside the single quiz post above the content |
|
| 129 | + * |
|
| 130 | + * @since 1.9.0 |
|
| 131 | + * |
|
| 132 | + * @hooked |
|
| 133 | + * |
|
| 134 | + */ |
|
| 135 | + do_action( 'sensei_single_quiz_content_inside_after' ); |
|
| 136 | + |
|
| 137 | + ?> |
|
| 138 | 138 | |
| 139 | 139 | </article><!-- .quiz --> |
| 140 | 140 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | ?> |
| 13 | 13 | |
| 14 | -<?php get_sensei_header(); ?> |
|
| 14 | +<?php get_sensei_header(); ?> |
|
| 15 | 15 | |
| 16 | 16 | <?php |
| 17 | 17 | /** |
@@ -21,15 +21,15 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @hooked Sensei_Course_Results::deprecate_sensei_course_results_content_hook() - 20 |
| 23 | 23 | */ |
| 24 | -do_action( 'sensei_course_results_content_before' ); |
|
| 24 | +do_action('sensei_course_results_content_before'); |
|
| 25 | 25 | ?> |
| 26 | 26 | |
| 27 | 27 | <?php |
| 28 | 28 | global $course; |
| 29 | -$course = get_page_by_path( $wp_query->query_vars['course_results'], OBJECT, 'course' ); |
|
| 29 | +$course = get_page_by_path($wp_query->query_vars['course_results'], OBJECT, 'course'); |
|
| 30 | 30 | ?> |
| 31 | 31 | |
| 32 | -<article <?php post_class( array( 'course', 'post','course-results' ) ); ?> > |
|
| 32 | +<article <?php post_class(array('course', 'post', 'course-results')); ?> > |
|
| 33 | 33 | |
| 34 | 34 | <section class="entry fix"> |
| 35 | 35 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @hooked Sensei_Course_Results::fire_sensei_message_hook() - 20 |
| 43 | 43 | */ |
| 44 | - do_action( 'sensei_course_results_content_inside_before' ); |
|
| 44 | + do_action('sensei_course_results_content_inside_before'); |
|
| 45 | 45 | ?> |
| 46 | 46 | |
| 47 | 47 | <header> |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | </header> |
| 54 | 54 | |
| 55 | - <?php if ( is_user_logged_in() ):?> |
|
| 55 | + <?php if (is_user_logged_in()):?> |
|
| 56 | 56 | |
| 57 | 57 | <section class="course-results-lessons"> |
| 58 | 58 | <?php |
| 59 | - $started_course = WooThemes_Sensei_Utils::user_started_course( $course->ID, get_current_user_id() ); |
|
| 60 | - if( $started_course ) { |
|
| 59 | + $started_course = WooThemes_Sensei_Utils::user_started_course($course->ID, get_current_user_id()); |
|
| 60 | + if ($started_course) { |
|
| 61 | 61 | |
| 62 | 62 | sensei_the_course_results_lessons(); |
| 63 | 63 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @hooked Sensei()->course_results->course_info - 20 |
| 77 | 77 | */ |
| 78 | - do_action( 'sensei_course_results_content_inside_after' ); |
|
| 78 | + do_action('sensei_course_results_content_inside_after'); |
|
| 79 | 79 | ?> |
| 80 | 80 | |
| 81 | 81 | </section> |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @since 1.9.0 |
| 90 | 90 | * |
| 91 | 91 | */ |
| 92 | -do_action( 'sensei_course_results_content_after' ); |
|
| 92 | +do_action('sensei_course_results_content_after'); |
|
| 93 | 93 | ?> |
| 94 | 94 | |
| 95 | 95 | |
@@ -1,26 +1,26 @@ discard block |
||
| 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,15 +34,15 @@ discard block |
||
| 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 | - * @hooked Sensei_Course_Results::fire_sensei_message_hook() - 20 |
|
| 43 | - */ |
|
| 44 | - do_action( 'sensei_course_results_content_inside_before' ); |
|
| 45 | - ?> |
|
| 37 | + /** |
|
| 38 | + * This hook fire inside learner-profile.php inside directly before the content |
|
| 39 | + * |
|
| 40 | + * @since 1.9.0 |
|
| 41 | + * |
|
| 42 | + * @hooked Sensei_Course_Results::fire_sensei_message_hook() - 20 |
|
| 43 | + */ |
|
| 44 | + do_action( 'sensei_course_results_content_inside_before' ); |
|
| 45 | + ?> |
|
| 46 | 46 | |
| 47 | 47 | <header> |
| 48 | 48 | |
@@ -56,27 +56,27 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | <section class="course-results-lessons"> |
| 58 | 58 | <?php |
| 59 | - $started_course = WooThemes_Sensei_Utils::user_started_course( $course->ID, get_current_user_id() ); |
|
| 60 | - if( $started_course ) { |
|
| 59 | + $started_course = WooThemes_Sensei_Utils::user_started_course( $course->ID, get_current_user_id() ); |
|
| 60 | + if( $started_course ) { |
|
| 61 | 61 | |
| 62 | - sensei_the_course_results_lessons(); |
|
| 62 | + sensei_the_course_results_lessons(); |
|
| 63 | 63 | |
| 64 | - } |
|
| 65 | - ?> |
|
| 64 | + } |
|
| 65 | + ?> |
|
| 66 | 66 | </section> |
| 67 | 67 | |
| 68 | 68 | <?php endif; ?> |
| 69 | 69 | |
| 70 | 70 | <?php |
| 71 | - /** |
|
| 72 | - * This hook fire inside learner-profile.php inside directly after the content |
|
| 73 | - * |
|
| 74 | - * @since 1.9.0 |
|
| 75 | - * |
|
| 76 | - * @hooked Sensei()->course_results->course_info - 20 |
|
| 77 | - */ |
|
| 78 | - do_action( 'sensei_course_results_content_inside_after' ); |
|
| 79 | - ?> |
|
| 71 | + /** |
|
| 72 | + * This hook fire inside learner-profile.php inside directly after the content |
|
| 73 | + * |
|
| 74 | + * @since 1.9.0 |
|
| 75 | + * |
|
| 76 | + * @hooked Sensei()->course_results->course_info - 20 |
|
| 77 | + */ |
|
| 78 | + do_action( 'sensei_course_results_content_inside_after' ); |
|
| 79 | + ?> |
|
| 80 | 80 | |
| 81 | 81 | </section> |
| 82 | 82 | |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | <?php |
| 86 | 86 | /** |
| 87 | - * This hook fire inside course-results.php before the content |
|
| 88 | - * |
|
| 89 | - * @since 1.9.0 |
|
| 90 | - * |
|
| 91 | - */ |
|
| 87 | + * This hook fire inside course-results.php before the content |
|
| 88 | + * |
|
| 89 | + * @since 1.9.0 |
|
| 90 | + * |
|
| 91 | + */ |
|
| 92 | 92 | do_action( 'sensei_course_results_content_after' ); |
| 93 | 93 | ?> |
| 94 | 94 | |