@@ -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 | * |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 2 | +if ( ! defined('ABSPATH')) exit; |
|
| 3 | 3 | /** |
| 4 | 4 | * The Template for displaying all course lessons on the course results page. |
| 5 | 5 | * |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | global $course; |
| 15 | 15 | ?> |
| 16 | 16 | |
| 17 | -<?php if ( is_user_logged_in() ): ?> |
|
| 17 | +<?php if (is_user_logged_in()): ?> |
|
| 18 | 18 | |
| 19 | 19 | <?php |
| 20 | 20 | /** |
@@ -22,53 +22,53 @@ discard block |
||
| 22 | 22 | * is uer logged check, just above the lessons header. |
| 23 | 23 | * @since 1.4.0 |
| 24 | 24 | */ |
| 25 | - do_action( 'sensei_course_results_before_lessons', $course->ID ); |
|
| 25 | + do_action('sensei_course_results_before_lessons', $course->ID); |
|
| 26 | 26 | ?> |
| 27 | 27 | |
| 28 | 28 | <header> |
| 29 | 29 | |
| 30 | - <h2> <?php _e( 'Lessons', 'woothemes-sensei' ); ?> </h2> |
|
| 30 | + <h2> <?php _e('Lessons', 'woothemes-sensei'); ?> </h2> |
|
| 31 | 31 | |
| 32 | 32 | </header> |
| 33 | 33 | |
| 34 | - <article class="<?php esc_attr_e( join( ' ', get_post_class( array( 'course', 'post' ), $course->ID ) ) ); ?> "> |
|
| 34 | + <article class="<?php esc_attr_e(join(' ', get_post_class(array('course', 'post'), $course->ID))); ?> "> |
|
| 35 | 35 | |
| 36 | 36 | <?php |
| 37 | 37 | |
| 38 | 38 | $displayed_lessons = array(); |
| 39 | - $modules = Sensei()->modules->get_course_modules( intval( $course->ID ) ); |
|
| 39 | + $modules = Sensei()->modules->get_course_modules(intval($course->ID)); |
|
| 40 | 40 | |
| 41 | 41 | // List modules with lessons |
| 42 | - foreach( $modules as $module ) { |
|
| 42 | + foreach ($modules as $module) { |
|
| 43 | 43 | |
| 44 | - $lessons_query = Sensei()->modules->get_lessons_query( $course->ID, $module->term_id ); |
|
| 44 | + $lessons_query = Sensei()->modules->get_lessons_query($course->ID, $module->term_id); |
|
| 45 | 45 | $lessons = $lessons_query->get_posts(); |
| 46 | 46 | |
| 47 | - if( count( $lessons ) > 0 ) { ?> |
|
| 47 | + if (count($lessons) > 0) { ?> |
|
| 48 | 48 | |
| 49 | 49 | <h3> <?php echo $module->name; ?></h3> |
| 50 | 50 | |
| 51 | 51 | <?php |
| 52 | 52 | $count = 0; |
| 53 | - foreach( $lessons as $lesson ) { |
|
| 53 | + foreach ($lessons as $lesson) { |
|
| 54 | 54 | |
| 55 | 55 | $lesson_grade = 'n/a'; |
| 56 | - $has_questions = get_post_meta( $lesson->ID, '_quiz_has_questions', true ); |
|
| 57 | - if ( $has_questions ) { |
|
| 58 | - $lesson_status = Sensei_Utils::user_lesson_status( $lesson->ID, get_current_user_id() ); |
|
| 56 | + $has_questions = get_post_meta($lesson->ID, '_quiz_has_questions', true); |
|
| 57 | + if ($has_questions) { |
|
| 58 | + $lesson_status = Sensei_Utils::user_lesson_status($lesson->ID, get_current_user_id()); |
|
| 59 | 59 | // Get user quiz grade |
| 60 | - $lesson_grade = get_comment_meta( $lesson_status->comment_ID, 'grade', true ); |
|
| 61 | - if ( $lesson_grade ) { |
|
| 60 | + $lesson_grade = get_comment_meta($lesson_status->comment_ID, 'grade', true); |
|
| 61 | + if ($lesson_grade) { |
|
| 62 | 62 | $lesson_grade .= '%'; |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | ?> |
| 66 | 66 | <h2> |
| 67 | 67 | |
| 68 | - <a href="<?php esc_url_raw( get_permalink( $lesson->ID ) ); ?>" |
|
| 69 | - title="<?php esc_attr_e( sprintf( __( 'Start %s', 'woothemes-sensei' ), $lesson->post_title ) ); ?>"> |
|
| 68 | + <a href="<?php esc_url_raw(get_permalink($lesson->ID)); ?>" |
|
| 69 | + title="<?php esc_attr_e(sprintf(__('Start %s', 'woothemes-sensei'), $lesson->post_title)); ?>"> |
|
| 70 | 70 | |
| 71 | - <?php esc_html_e( $lesson->post_title ); ?> |
|
| 71 | + <?php esc_html_e($lesson->post_title); ?> |
|
| 72 | 72 | |
| 73 | 73 | </a> |
| 74 | 74 | |
@@ -89,25 +89,25 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | <?php |
| 91 | 91 | |
| 92 | - $lessons = Sensei()->modules->get_none_module_lessons( $course->ID ); |
|
| 93 | - if( 0 < count( $lessons ) ): ?> |
|
| 92 | + $lessons = Sensei()->modules->get_none_module_lessons($course->ID); |
|
| 93 | + if (0 < count($lessons)): ?> |
|
| 94 | 94 | |
| 95 | 95 | <h3> |
| 96 | 96 | |
| 97 | - <?php _e( 'Other Lessons', 'woothemes-sensei' ); ?> |
|
| 97 | + <?php _e('Other Lessons', 'woothemes-sensei'); ?> |
|
| 98 | 98 | |
| 99 | 99 | </h3> |
| 100 | 100 | |
| 101 | - <?php foreach ( $lessons as $lesson ): ?> |
|
| 101 | + <?php foreach ($lessons as $lesson): ?> |
|
| 102 | 102 | |
| 103 | 103 | <?php |
| 104 | 104 | $lesson_grade = 'n/a'; |
| 105 | - $has_questions = get_post_meta( $lesson->ID, '_quiz_has_questions', true ); |
|
| 106 | - if ( $has_questions ) { |
|
| 107 | - $lesson_status = Sensei_Utils::user_lesson_status( $lesson->ID, get_current_user_id()); |
|
| 105 | + $has_questions = get_post_meta($lesson->ID, '_quiz_has_questions', true); |
|
| 106 | + if ($has_questions) { |
|
| 107 | + $lesson_status = Sensei_Utils::user_lesson_status($lesson->ID, get_current_user_id()); |
|
| 108 | 108 | // Get user quiz grade |
| 109 | - $lesson_grade = get_comment_meta( $lesson_status->comment_ID, 'grade', true ); |
|
| 110 | - if ( $lesson_grade ) { |
|
| 109 | + $lesson_grade = get_comment_meta($lesson_status->comment_ID, 'grade', true); |
|
| 110 | + if ($lesson_grade) { |
|
| 111 | 111 | $lesson_grade .= '%'; |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | <h2> |
| 117 | 117 | |
| 118 | - <a href="<?php esc_url_raw( get_permalink( $lesson->ID ) ) ?>" title="<?php esc_attr_e( sprintf( __( 'Start %s', 'woothemes-sensei' ), $lesson->post_title ) ) ?>" > |
|
| 118 | + <a href="<?php esc_url_raw(get_permalink($lesson->ID)) ?>" title="<?php esc_attr_e(sprintf(__('Start %s', 'woothemes-sensei'), $lesson->post_title)) ?>" > |
|
| 119 | 119 | |
| 120 | - <?php esc_html_e( sprintf( __( '%s', 'woothemes-sensei' ), $lesson->post_title ) ); ?> |
|
| 120 | + <?php esc_html_e(sprintf(__('%s', 'woothemes-sensei'), $lesson->post_title)); ?> |
|
| 121 | 121 | |
| 122 | 122 | </a> |
| 123 | 123 | |
@@ -132,13 +132,13 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | <h2 class="total-grade"> |
| 134 | 134 | |
| 135 | - <?php _e( 'Total Grade', 'woothemes-sensei' ); ?> |
|
| 135 | + <?php _e('Total Grade', 'woothemes-sensei'); ?> |
|
| 136 | 136 | <span class="lesson-grade"> |
| 137 | 137 | |
| 138 | 138 | <?php |
| 139 | 139 | |
| 140 | - $course_user_grade = Sensei_Utils::sensei_course_user_grade( $course->ID, get_current_user_id() ); |
|
| 141 | - echo $course_user_grade . '%'; |
|
| 140 | + $course_user_grade = Sensei_Utils::sensei_course_user_grade($course->ID, get_current_user_id()); |
|
| 141 | + echo $course_user_grade.'%'; |
|
| 142 | 142 | |
| 143 | 143 | ?> |
| 144 | 144 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @since 1.4.0 |
| 157 | 157 | */ |
| 158 | - do_action( 'sensei_course_results_after_lessons', $course->ID ); |
|
| 158 | + do_action('sensei_course_results_after_lessons', $course->ID); |
|
| 159 | 159 | ?> |
| 160 | 160 | |
| 161 | 161 | <?php endif; //user logged in ?> |
| 162 | 162 | \ No newline at end of file |
@@ -1,15 +1,15 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 3 | 3 | /** |
| 4 | - * The Template for displaying all course lessons on the course results page. |
|
| 5 | - * |
|
| 6 | - * Override this template by copying it to yourtheme/sensei/course-results/course-lessons.php |
|
| 7 | - * |
|
| 8 | - * @author Automattic |
|
| 9 | - * @package Sensei |
|
| 10 | - * @category Templates |
|
| 11 | - * @version 1.9.0 |
|
| 12 | - */ |
|
| 4 | + * The Template for displaying all course lessons on the course results page. |
|
| 5 | + * |
|
| 6 | + * Override this template by copying it to yourtheme/sensei/course-results/course-lessons.php |
|
| 7 | + * |
|
| 8 | + * @author Automattic |
|
| 9 | + * @package Sensei |
|
| 10 | + * @category Templates |
|
| 11 | + * @version 1.9.0 |
|
| 12 | + */ |
|
| 13 | 13 | |
| 14 | 14 | global $course; |
| 15 | 15 | ?> |
@@ -17,13 +17,13 @@ discard block |
||
| 17 | 17 | <?php if ( is_user_logged_in() ): ?> |
| 18 | 18 | |
| 19 | 19 | <?php |
| 20 | - /** |
|
| 21 | - * Fires inside course-results/lessons.php after the |
|
| 22 | - * is uer logged check, just above the lessons header. |
|
| 23 | - * @since 1.4.0 |
|
| 24 | - */ |
|
| 25 | - do_action( 'sensei_course_results_before_lessons', $course->ID ); |
|
| 26 | - ?> |
|
| 20 | + /** |
|
| 21 | + * Fires inside course-results/lessons.php after the |
|
| 22 | + * is uer logged check, just above the lessons header. |
|
| 23 | + * @since 1.4.0 |
|
| 24 | + */ |
|
| 25 | + do_action( 'sensei_course_results_before_lessons', $course->ID ); |
|
| 26 | + ?> |
|
| 27 | 27 | |
| 28 | 28 | <header> |
| 29 | 29 | |
@@ -36,33 +36,33 @@ discard block |
||
| 36 | 36 | <?php |
| 37 | 37 | |
| 38 | 38 | $displayed_lessons = array(); |
| 39 | - $modules = Sensei()->modules->get_course_modules( intval( $course->ID ) ); |
|
| 39 | + $modules = Sensei()->modules->get_course_modules( intval( $course->ID ) ); |
|
| 40 | 40 | |
| 41 | - // List modules with lessons |
|
| 42 | - foreach( $modules as $module ) { |
|
| 41 | + // List modules with lessons |
|
| 42 | + foreach( $modules as $module ) { |
|
| 43 | 43 | |
| 44 | - $lessons_query = Sensei()->modules->get_lessons_query( $course->ID, $module->term_id ); |
|
| 45 | - $lessons = $lessons_query->get_posts(); |
|
| 44 | + $lessons_query = Sensei()->modules->get_lessons_query( $course->ID, $module->term_id ); |
|
| 45 | + $lessons = $lessons_query->get_posts(); |
|
| 46 | 46 | |
| 47 | - if( count( $lessons ) > 0 ) { ?> |
|
| 47 | + if( count( $lessons ) > 0 ) { ?> |
|
| 48 | 48 | |
| 49 | 49 | <h3> <?php echo $module->name; ?></h3> |
| 50 | 50 | |
| 51 | 51 | <?php |
| 52 | - $count = 0; |
|
| 53 | - foreach( $lessons as $lesson ) { |
|
| 54 | - |
|
| 55 | - $lesson_grade = 'n/a'; |
|
| 56 | - $has_questions = get_post_meta( $lesson->ID, '_quiz_has_questions', true ); |
|
| 57 | - if ( $has_questions ) { |
|
| 58 | - $lesson_status = Sensei_Utils::user_lesson_status( $lesson->ID, get_current_user_id() ); |
|
| 59 | - // Get user quiz grade |
|
| 60 | - $lesson_grade = get_comment_meta( $lesson_status->comment_ID, 'grade', true ); |
|
| 61 | - if ( $lesson_grade ) { |
|
| 62 | - $lesson_grade .= '%'; |
|
| 63 | - } |
|
| 64 | - } |
|
| 65 | - ?> |
|
| 52 | + $count = 0; |
|
| 53 | + foreach( $lessons as $lesson ) { |
|
| 54 | + |
|
| 55 | + $lesson_grade = 'n/a'; |
|
| 56 | + $has_questions = get_post_meta( $lesson->ID, '_quiz_has_questions', true ); |
|
| 57 | + if ( $has_questions ) { |
|
| 58 | + $lesson_status = Sensei_Utils::user_lesson_status( $lesson->ID, get_current_user_id() ); |
|
| 59 | + // Get user quiz grade |
|
| 60 | + $lesson_grade = get_comment_meta( $lesson_status->comment_ID, 'grade', true ); |
|
| 61 | + if ( $lesson_grade ) { |
|
| 62 | + $lesson_grade .= '%'; |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | + ?> |
|
| 66 | 66 | <h2> |
| 67 | 67 | |
| 68 | 68 | <a href="<?php esc_url_raw( get_permalink( $lesson->ID ) ); ?>" |
@@ -80,17 +80,17 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | <?php |
| 82 | 82 | |
| 83 | - }// end for each |
|
| 83 | + }// end for each |
|
| 84 | 84 | |
| 85 | - }// end if count lesson |
|
| 85 | + }// end if count lesson |
|
| 86 | 86 | |
| 87 | - } // end for each module |
|
| 88 | - ?> |
|
| 87 | + } // end for each module |
|
| 88 | + ?> |
|
| 89 | 89 | |
| 90 | 90 | <?php |
| 91 | 91 | |
| 92 | - $lessons = Sensei()->modules->get_none_module_lessons( $course->ID ); |
|
| 93 | - if( 0 < count( $lessons ) ): ?> |
|
| 92 | + $lessons = Sensei()->modules->get_none_module_lessons( $course->ID ); |
|
| 93 | + if( 0 < count( $lessons ) ): ?> |
|
| 94 | 94 | |
| 95 | 95 | <h3> |
| 96 | 96 | |
@@ -101,17 +101,17 @@ discard block |
||
| 101 | 101 | <?php foreach ( $lessons as $lesson ): ?> |
| 102 | 102 | |
| 103 | 103 | <?php |
| 104 | - $lesson_grade = 'n/a'; |
|
| 105 | - $has_questions = get_post_meta( $lesson->ID, '_quiz_has_questions', true ); |
|
| 106 | - if ( $has_questions ) { |
|
| 107 | - $lesson_status = Sensei_Utils::user_lesson_status( $lesson->ID, get_current_user_id()); |
|
| 108 | - // Get user quiz grade |
|
| 109 | - $lesson_grade = get_comment_meta( $lesson_status->comment_ID, 'grade', true ); |
|
| 110 | - if ( $lesson_grade ) { |
|
| 111 | - $lesson_grade .= '%'; |
|
| 112 | - } |
|
| 113 | - } |
|
| 114 | - ?> |
|
| 104 | + $lesson_grade = 'n/a'; |
|
| 105 | + $has_questions = get_post_meta( $lesson->ID, '_quiz_has_questions', true ); |
|
| 106 | + if ( $has_questions ) { |
|
| 107 | + $lesson_status = Sensei_Utils::user_lesson_status( $lesson->ID, get_current_user_id()); |
|
| 108 | + // Get user quiz grade |
|
| 109 | + $lesson_grade = get_comment_meta( $lesson_status->comment_ID, 'grade', true ); |
|
| 110 | + if ( $lesson_grade ) { |
|
| 111 | + $lesson_grade .= '%'; |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | + ?> |
|
| 115 | 115 | |
| 116 | 116 | <h2> |
| 117 | 117 | |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | <?php |
| 139 | 139 | |
| 140 | - $course_user_grade = Sensei_Utils::sensei_course_user_grade( $course->ID, get_current_user_id() ); |
|
| 141 | - echo $course_user_grade . '%'; |
|
| 140 | + $course_user_grade = Sensei_Utils::sensei_course_user_grade( $course->ID, get_current_user_id() ); |
|
| 141 | + echo $course_user_grade . '%'; |
|
| 142 | 142 | |
| 143 | - ?> |
|
| 143 | + ?> |
|
| 144 | 144 | |
| 145 | 145 | </span> |
| 146 | 146 | |
@@ -149,13 +149,13 @@ discard block |
||
| 149 | 149 | </article> |
| 150 | 150 | |
| 151 | 151 | <?php |
| 152 | - /** |
|
| 153 | - * Fires inside course-results/lessons.php after the |
|
| 154 | - * is uer logged check, at the bottom of all lessons. |
|
| 155 | - * |
|
| 156 | - * @since 1.4.0 |
|
| 157 | - */ |
|
| 152 | + /** |
|
| 153 | + * Fires inside course-results/lessons.php after the |
|
| 154 | + * is uer logged check, at the bottom of all lessons. |
|
| 155 | + * |
|
| 156 | + * @since 1.4.0 |
|
| 157 | + */ |
|
| 158 | 158 | do_action( 'sensei_course_results_after_lessons', $course->ID ); |
| 159 | - ?> |
|
| 159 | + ?> |
|
| 160 | 160 | |
| 161 | 161 | <?php endif; //user logged in ?> |
| 162 | 162 | \ 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 |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function widget( $args, $instance ) {
|
| 55 | 55 | |
| 56 | - $before_widget = $args[ 'before_widget' ]; |
|
| 57 | - $before_title = $args[ 'before_title' ]; |
|
| 58 | - $after_title = $args[ 'after_title' ]; |
|
| 59 | - $after_widget = $args[ 'after_widget' ]; |
|
| 56 | + $before_widget = $args[ 'before_widget' ]; |
|
| 57 | + $before_title = $args[ 'before_title' ]; |
|
| 58 | + $after_title = $args[ 'after_title' ]; |
|
| 59 | + $after_widget = $args[ 'after_widget' ]; |
|
| 60 | 60 | |
| 61 | 61 | if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) ) && ( 'activecourses' == $instance['component'] || 'completedcourses' == $instance['component'] ) && !is_user_logged_in() ) {
|
| 62 | 62 | // No Output |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @param array $instance The settings for this instance. |
| 118 | 118 | * @return void |
| 119 | 119 | */ |
| 120 | - public function form( $instance ) {
|
|
| 120 | + public function form( $instance ) {
|
|
| 121 | 121 | |
| 122 | 122 | /* Set up some default widget settings. */ |
| 123 | 123 | /* Make sure all keys are added here, even with empty string values. */ |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | $post_args = array( 'post_type' => 'lesson', |
| 173 | 173 | 'posts_per_page' => intval( $instance[ 'limit' ] ), |
| 174 | 174 | 'orderby' => 'menu_order date', |
| 175 | - 'order' => 'DESC', |
|
| 176 | - 'post_status' => 'publish', |
|
| 175 | + 'order' => 'DESC', |
|
| 176 | + 'post_status' => 'publish', |
|
| 177 | 177 | 'suppress_filters' => 0 |
| 178 | 178 | ); |
| 179 | 179 | $posts_array = get_posts( $post_args ); |
@@ -181,14 +181,14 @@ discard block |
||
| 181 | 181 | if ( count( $posts_array ) > 0 ) { ?>
|
| 182 | 182 | <ul> |
| 183 | 183 | <?php foreach ($posts_array as $post_item){
|
| 184 | - $post_id = absint( $post_item->ID ); |
|
| 185 | - $post_title = $post_item->post_title; |
|
| 186 | - $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 187 | - $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 188 | - $author_display_name = $user_info->display_name; |
|
| 189 | - $author_id = $post_item->post_author; |
|
| 190 | - $lesson_course_id = get_post_meta( $post_id, '_lesson_course', true ); |
|
| 191 | - ?> |
|
| 184 | + $post_id = absint( $post_item->ID ); |
|
| 185 | + $post_title = $post_item->post_title; |
|
| 186 | + $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 187 | + $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 188 | + $author_display_name = $user_info->display_name; |
|
| 189 | + $author_id = $post_item->post_author; |
|
| 190 | + $lesson_course_id = get_post_meta( $post_id, '_lesson_course', true ); |
|
| 191 | + ?> |
|
| 192 | 192 | <li class="fix"> |
| 193 | 193 | <?php do_action( 'sensei_lesson_image', $post_id, '100', '100', false, true ); ?> |
| 194 | 194 | <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,35 +51,35 @@ discard block |
||
| 51 | 51 | * @param array $instance Widget settings for this instance. |
| 52 | 52 | * @return void |
| 53 | 53 | */ |
| 54 | - public function widget( $args, $instance ) {
|
|
| 54 | + public function widget($args, $instance) {
|
|
| 55 | 55 | |
| 56 | - $before_widget = $args[ 'before_widget' ]; |
|
| 57 | - $before_title = $args[ 'before_title' ]; |
|
| 58 | - $after_title = $args[ 'after_title' ]; |
|
| 59 | - $after_widget = $args[ 'after_widget' ]; |
|
| 56 | + $before_widget = $args['before_widget']; |
|
| 57 | + $before_title = $args['before_title']; |
|
| 58 | + $after_title = $args['after_title']; |
|
| 59 | + $after_widget = $args['after_widget']; |
|
| 60 | 60 | |
| 61 | - if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) ) && ( 'activecourses' == $instance['component'] || 'completedcourses' == $instance['component'] ) && !is_user_logged_in() ) {
|
|
| 61 | + if (in_array($instance['component'], array_keys($this->woo_widget_componentslist)) && ('activecourses' == $instance['component'] || 'completedcourses' == $instance['component']) && ! is_user_logged_in()) {
|
|
| 62 | 62 | // No Output |
| 63 | 63 | } else {
|
| 64 | 64 | /* Our variables from the widget settings. */ |
| 65 | - $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
|
|
| 65 | + $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
|
|
| 66 | 66 | |
| 67 | 67 | /* Before widget (defined by themes). */ |
| 68 | 68 | echo $before_widget; |
| 69 | 69 | |
| 70 | 70 | /* Display the widget title if one was input (before and after defined by themes). */ |
| 71 | - if ( $title ) { echo $before_title . $title . $after_title; }
|
|
| 71 | + if ($title) { echo $before_title.$title.$after_title; }
|
|
| 72 | 72 | |
| 73 | 73 | /* Widget content. */ |
| 74 | 74 | // Add actions for plugins/themes to hook onto. |
| 75 | - do_action( $this->woo_widget_cssclass . '_top' ); |
|
| 75 | + do_action($this->woo_widget_cssclass.'_top'); |
|
| 76 | 76 | |
| 77 | - if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) ) ) {
|
|
| 78 | - $this->load_component( $instance ); |
|
| 77 | + if (in_array($instance['component'], array_keys($this->woo_widget_componentslist))) {
|
|
| 78 | + $this->load_component($instance); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // Add actions for plugins/themes to hook onto. |
| 82 | - do_action( $this->woo_widget_cssclass . '_bottom' ); |
|
| 82 | + do_action($this->woo_widget_cssclass.'_bottom'); |
|
| 83 | 83 | |
| 84 | 84 | /* After widget (defined by themes). */ |
| 85 | 85 | echo $after_widget; |
@@ -94,17 +94,17 @@ discard block |
||
| 94 | 94 | * @param array $old_instance Previous settings. |
| 95 | 95 | * @return array Updated settings. |
| 96 | 96 | */ |
| 97 | - public function update ( $new_instance, $old_instance ) {
|
|
| 97 | + public function update($new_instance, $old_instance) {
|
|
| 98 | 98 | $instance = $old_instance; |
| 99 | 99 | |
| 100 | 100 | /* Strip tags for title and name to remove HTML (important for text inputs). */ |
| 101 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
| 101 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 102 | 102 | |
| 103 | 103 | /* The select box is returning a text value, so we escape it. */ |
| 104 | - $instance['component'] = esc_attr( $new_instance['component'] ); |
|
| 104 | + $instance['component'] = esc_attr($new_instance['component']); |
|
| 105 | 105 | |
| 106 | 106 | /* The select box is returning a text value, so we escape it. */ |
| 107 | - $instance['limit'] = esc_attr( $new_instance['limit'] ); |
|
| 107 | + $instance['limit'] = esc_attr($new_instance['limit']); |
|
| 108 | 108 | |
| 109 | 109 | |
| 110 | 110 | return $instance; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @param array $instance The settings for this instance. |
| 118 | 118 | * @return void |
| 119 | 119 | */ |
| 120 | - public function form( $instance ) {
|
|
| 120 | + public function form($instance) {
|
|
| 121 | 121 | |
| 122 | 122 | /* Set up some default widget settings. */ |
| 123 | 123 | /* Make sure all keys are added here, even with empty string values. */ |
@@ -127,26 +127,26 @@ discard block |
||
| 127 | 127 | 'limit' => 3 |
| 128 | 128 | ); |
| 129 | 129 | |
| 130 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
| 130 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
| 131 | 131 | ?> |
| 132 | 132 | <!-- Widget Title: Text Input --> |
| 133 | 133 | <p> |
| 134 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label> |
|
| 135 | - <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' ) ); ?>" /> |
|
| 134 | + <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title (optional):', 'woothemes-sensei'); ?></label>
|
|
| 135 | + <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')); ?>" />
|
|
| 136 | 136 | </p> |
| 137 | 137 | <!-- Widget Component: Select Input --> |
| 138 | 138 | <p> |
| 139 | - <label for="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>"><?php _e( 'Component:', 'woothemes-sensei' ); ?></label> |
|
| 140 | - <select name="<?php echo esc_attr( $this->get_field_name( 'component' ) ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>"> |
|
| 141 | - <?php foreach ( $this->woo_widget_componentslist as $k => $v ) { ?>
|
|
| 142 | - <option value="<?php echo esc_attr( $k ); ?>"<?php selected( $instance['component'], $k ); ?>><?php echo $v; ?></option> |
|
| 139 | + <label for="<?php echo esc_attr($this->get_field_id('component')); ?>"><?php _e('Component:', 'woothemes-sensei'); ?></label>
|
|
| 140 | + <select name="<?php echo esc_attr($this->get_field_name('component')); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('component')); ?>">
|
|
| 141 | + <?php foreach ($this->woo_widget_componentslist as $k => $v) { ?>
|
|
| 142 | + <option value="<?php echo esc_attr($k); ?>"<?php selected($instance['component'], $k); ?>><?php echo $v; ?></option> |
|
| 143 | 143 | <?php } ?> |
| 144 | 144 | </select> |
| 145 | 145 | </p> |
| 146 | 146 | <!-- Widget Limit: Text Input --> |
| 147 | 147 | <p> |
| 148 | - <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Lessons (optional):', 'woothemes-sensei' ); ?></label> |
|
| 149 | - <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' ) ); ?>" /> |
|
| 148 | + <label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php _e('Number of Lessons (optional):', 'woothemes-sensei'); ?></label>
|
|
| 149 | + <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')); ?>" />
|
|
| 150 | 150 | </p> |
| 151 | 151 | |
| 152 | 152 | <?php |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @since 5.0.8 |
| 159 | 159 | * @return void |
| 160 | 160 | */ |
| 161 | - protected function load_component ( $instance ) {
|
|
| 161 | + protected function load_component($instance) {
|
|
| 162 | 162 | |
| 163 | 163 | global $current_user; |
| 164 | 164 | // Get User Meta |
@@ -169,41 +169,41 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | $posts_array = array(); |
| 171 | 171 | |
| 172 | - $post_args = array( 'post_type' => 'lesson', |
|
| 173 | - 'posts_per_page' => intval( $instance[ 'limit' ] ), |
|
| 172 | + $post_args = array('post_type' => 'lesson',
|
|
| 173 | + 'posts_per_page' => intval($instance['limit']), |
|
| 174 | 174 | 'orderby' => 'menu_order date', |
| 175 | 175 | 'order' => 'DESC', |
| 176 | 176 | 'post_status' => 'publish', |
| 177 | 177 | 'suppress_filters' => 0 |
| 178 | 178 | ); |
| 179 | - $posts_array = get_posts( $post_args ); |
|
| 179 | + $posts_array = get_posts($post_args); |
|
| 180 | 180 | |
| 181 | - if ( count( $posts_array ) > 0 ) { ?>
|
|
| 181 | + if (count($posts_array) > 0) { ?>
|
|
| 182 | 182 | <ul> |
| 183 | - <?php foreach ($posts_array as $post_item){
|
|
| 184 | - $post_id = absint( $post_item->ID ); |
|
| 183 | + <?php foreach ($posts_array as $post_item) {
|
|
| 184 | + $post_id = absint($post_item->ID); |
|
| 185 | 185 | $post_title = $post_item->post_title; |
| 186 | - $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 187 | - $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 186 | + $user_info = get_userdata(absint($post_item->post_author)); |
|
| 187 | + $author_link = get_author_posts_url(absint($post_item->post_author)); |
|
| 188 | 188 | $author_display_name = $user_info->display_name; |
| 189 | 189 | $author_id = $post_item->post_author; |
| 190 | - $lesson_course_id = get_post_meta( $post_id, '_lesson_course', true ); |
|
| 190 | + $lesson_course_id = get_post_meta($post_id, '_lesson_course', true); |
|
| 191 | 191 | ?> |
| 192 | 192 | <li class="fix"> |
| 193 | - <?php do_action( 'sensei_lesson_image', $post_id, '100', '100', false, true ); ?> |
|
| 194 | - <a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a> |
|
| 193 | + <?php do_action('sensei_lesson_image', $post_id, '100', '100', false, true); ?>
|
|
| 194 | + <a href="<?php echo esc_url(get_permalink($post_id)); ?>" title="<?php echo esc_attr($post_title); ?>"><?php echo $post_title; ?></a> |
|
| 195 | 195 | <br /> |
| 196 | - <?php if ( isset( Sensei()->settings->settings[ 'lesson_author' ] ) && ( Sensei()->settings->settings[ 'lesson_author' ] ) ) { ?>
|
|
| 197 | - <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> |
|
| 196 | + <?php if (isset(Sensei()->settings->settings['lesson_author']) && (Sensei()->settings->settings['lesson_author'])) { ?>
|
|
| 197 | + <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>
|
|
| 198 | 198 | <br /> |
| 199 | 199 | <?php } // End If Statement ?> |
| 200 | - <?php if ( 0 < $lesson_course_id ) { ?>
|
|
| 201 | - <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> |
|
| 200 | + <?php if (0 < $lesson_course_id) { ?>
|
|
| 201 | + <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>
|
|
| 202 | 202 | <?php } ?> |
| 203 | 203 | <br /> |
| 204 | 204 | </li> |
| 205 | 205 | <?php } // End For Loop ?> |
| 206 | - <?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>'; ?>
|
|
| 206 | + <?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>'; ?>
|
|
| 207 | 207 | </ul> |
| 208 | 208 | <?php } // End If Statement |
| 209 | 209 | } // 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 |
@@ -49,31 +49,31 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function widget( $args, $instance ) {
|
| 51 | 51 | |
| 52 | - $before_widget = $args[ 'before_widget' ]; |
|
| 53 | - $before_title = $args[ 'before_title' ]; |
|
| 54 | - $after_title = $args[ 'after_title' ]; |
|
| 55 | - $after_widget = $args[ 'after_widget' ]; |
|
| 52 | + $before_widget = $args[ 'before_widget' ]; |
|
| 53 | + $before_title = $args[ 'before_title' ]; |
|
| 54 | + $after_title = $args[ 'after_title' ]; |
|
| 55 | + $after_widget = $args[ 'after_widget' ]; |
|
| 56 | 56 | |
| 57 | - /* Our variables from the widget settings. */ |
|
| 58 | - $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
|
|
| 57 | + /* Our variables from the widget settings. */ |
|
| 58 | + $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
|
|
| 59 | 59 | |
| 60 | - /* Before widget (defined by themes). */ |
|
| 61 | - echo $before_widget; |
|
| 60 | + /* Before widget (defined by themes). */ |
|
| 61 | + echo $before_widget; |
|
| 62 | 62 | |
| 63 | - /* Display the widget title if one was input (before and after defined by themes). */ |
|
| 64 | - if ( $title ) { echo $before_title . $title . $after_title; }
|
|
| 63 | + /* Display the widget title if one was input (before and after defined by themes). */ |
|
| 64 | + if ( $title ) { echo $before_title . $title . $after_title; }
|
|
| 65 | 65 | |
| 66 | - /* Widget content. */ |
|
| 67 | - // Add actions for plugins/themes to hook onto. |
|
| 68 | - do_action( $this->woo_widget_cssclass . '_top' ); |
|
| 66 | + /* Widget content. */ |
|
| 67 | + // Add actions for plugins/themes to hook onto. |
|
| 68 | + do_action( $this->woo_widget_cssclass . '_top' ); |
|
| 69 | 69 | |
| 70 | - $this->load_component( $instance ); |
|
| 70 | + $this->load_component( $instance ); |
|
| 71 | 71 | |
| 72 | - // Add actions for plugins/themes to hook onto. |
|
| 73 | - do_action( $this->woo_widget_cssclass . '_bottom' ); |
|
| 72 | + // Add actions for plugins/themes to hook onto. |
|
| 73 | + do_action( $this->woo_widget_cssclass . '_bottom' ); |
|
| 74 | 74 | |
| 75 | - /* After widget (defined by themes). */ |
|
| 76 | - echo $after_widget; |
|
| 75 | + /* After widget (defined by themes). */ |
|
| 76 | + echo $after_widget; |
|
| 77 | 77 | |
| 78 | 78 | } // End widget() |
| 79 | 79 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @param array $instance The settings for this instance. |
| 108 | 108 | * @return void |
| 109 | 109 | */ |
| 110 | - public function form( $instance ) {
|
|
| 110 | + public function form( $instance ) {
|
|
| 111 | 111 | |
| 112 | 112 | /* Set up some default widget settings. */ |
| 113 | 113 | /* 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,30 +47,30 @@ discard block |
||
| 47 | 47 | * @param array $instance Widget settings for this instance. |
| 48 | 48 | * @return void |
| 49 | 49 | */ |
| 50 | - public function widget( $args, $instance ) {
|
|
| 50 | + public function widget($args, $instance) {
|
|
| 51 | 51 | |
| 52 | - $before_widget = $args[ 'before_widget' ]; |
|
| 53 | - $before_title = $args[ 'before_title' ]; |
|
| 54 | - $after_title = $args[ 'after_title' ]; |
|
| 55 | - $after_widget = $args[ 'after_widget' ]; |
|
| 52 | + $before_widget = $args['before_widget']; |
|
| 53 | + $before_title = $args['before_title']; |
|
| 54 | + $after_title = $args['after_title']; |
|
| 55 | + $after_widget = $args['after_widget']; |
|
| 56 | 56 | |
| 57 | 57 | /* Our variables from the widget settings. */ |
| 58 | - $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
|
|
| 58 | + $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
|
|
| 59 | 59 | |
| 60 | 60 | /* Before widget (defined by themes). */ |
| 61 | 61 | echo $before_widget; |
| 62 | 62 | |
| 63 | 63 | /* Display the widget title if one was input (before and after defined by themes). */ |
| 64 | - if ( $title ) { echo $before_title . $title . $after_title; }
|
|
| 64 | + if ($title) { echo $before_title.$title.$after_title; }
|
|
| 65 | 65 | |
| 66 | 66 | /* Widget content. */ |
| 67 | 67 | // Add actions for plugins/themes to hook onto. |
| 68 | - do_action( $this->woo_widget_cssclass . '_top' ); |
|
| 68 | + do_action($this->woo_widget_cssclass.'_top'); |
|
| 69 | 69 | |
| 70 | - $this->load_component( $instance ); |
|
| 70 | + $this->load_component($instance); |
|
| 71 | 71 | |
| 72 | 72 | // Add actions for plugins/themes to hook onto. |
| 73 | - do_action( $this->woo_widget_cssclass . '_bottom' ); |
|
| 73 | + do_action($this->woo_widget_cssclass.'_bottom'); |
|
| 74 | 74 | |
| 75 | 75 | /* After widget (defined by themes). */ |
| 76 | 76 | echo $after_widget; |
@@ -84,14 +84,14 @@ discard block |
||
| 84 | 84 | * @param array $old_instance Previous settings. |
| 85 | 85 | * @return array Updated settings. |
| 86 | 86 | */ |
| 87 | - public function update ( $new_instance, $old_instance ) {
|
|
| 87 | + public function update($new_instance, $old_instance) {
|
|
| 88 | 88 | $instance = $old_instance; |
| 89 | 89 | |
| 90 | 90 | /* Strip tags for title and name to remove HTML (important for text inputs). */ |
| 91 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
| 91 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 92 | 92 | |
| 93 | 93 | /* The select box is returning a text value, so we escape it. */ |
| 94 | - $instance['limit'] = esc_attr( $new_instance['limit'] ); |
|
| 94 | + $instance['limit'] = esc_attr($new_instance['limit']); |
|
| 95 | 95 | |
| 96 | 96 | /* The check box is returning a boolean value. */ |
| 97 | 97 | $instance['count'] = $new_instance['count']; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @param array $instance The settings for this instance. |
| 108 | 108 | * @return void |
| 109 | 109 | */ |
| 110 | - public function form( $instance ) {
|
|
| 110 | + public function form($instance) {
|
|
| 111 | 111 | |
| 112 | 112 | /* Set up some default widget settings. */ |
| 113 | 113 | /* Make sure all keys are added here, even with empty string values. */ |
@@ -118,27 +118,27 @@ discard block |
||
| 118 | 118 | 'hierarchical' => false |
| 119 | 119 | ); |
| 120 | 120 | |
| 121 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
| 121 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
| 122 | 122 | ?> |
| 123 | 123 | <!-- Widget Title: Text Input --> |
| 124 | 124 | <p> |
| 125 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label> |
|
| 126 | - <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 | + <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title (optional):', 'woothemes-sensei'); ?></label>
|
|
| 126 | + <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')); ?>" />
|
|
| 127 | 127 | </p> |
| 128 | 128 | <!-- Widget Limit: Text Input --> |
| 129 | 129 | <p> |
| 130 | - <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Categories (optional):', 'woothemes-sensei' ); ?></label> |
|
| 131 | - <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' ) ); ?>" /> |
|
| 130 | + <label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php _e('Number of Categories (optional):', 'woothemes-sensei'); ?></label>
|
|
| 131 | + <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')); ?>" />
|
|
| 132 | 132 | </p> |
| 133 | 133 | <!-- Widget Show Count: Checkbox Input --> |
| 134 | 134 | <p> |
| 135 | - <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' ); ?> />
|
|
| 136 | - <label for="<?php echo esc_attr( $this->get_field_id('count') ); ?>"><?php _e( 'Show post counts', 'woothemes-sensei' ); ?></label><br />
|
|
| 135 | + <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'); ?> />
|
|
| 136 | + <label for="<?php echo esc_attr($this->get_field_id('count')); ?>"><?php _e('Show post counts', 'woothemes-sensei'); ?></label><br />
|
|
| 137 | 137 | </p> |
| 138 | 138 | <!-- Widget Show Hierarchy: Checkbox Input --> |
| 139 | 139 | <p> |
| 140 | - <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' ); ?> />
|
|
| 141 | - <label for="<?php echo esc_attr( $this->get_field_id('hierarchical') ); ?>"><?php _e( 'Show hierarchy', 'woothemes-sensei' ); ?></label></p>
|
|
| 140 | + <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'); ?> />
|
|
| 141 | + <label for="<?php echo esc_attr($this->get_field_id('hierarchical')); ?>"><?php _e('Show hierarchy', 'woothemes-sensei'); ?></label></p>
|
|
| 142 | 142 | </p> |
| 143 | 143 | <?php |
| 144 | 144 | } // End form() |
@@ -149,18 +149,18 @@ discard block |
||
| 149 | 149 | * @since 1.1.0 |
| 150 | 150 | * @return void |
| 151 | 151 | */ |
| 152 | - protected function load_component ( $instance ) {
|
|
| 152 | + protected function load_component($instance) {
|
|
| 153 | 153 | |
| 154 | - $limit = intval( $instance['limit'] ); |
|
| 155 | - $count = isset($instance['count']) ? (bool) $instance['count'] :false; |
|
| 156 | - $hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false; |
|
| 154 | + $limit = intval($instance['limit']); |
|
| 155 | + $count = isset($instance['count']) ? (bool) $instance['count'] : false; |
|
| 156 | + $hierarchical = isset($instance['hierarchical']) ? (bool) $instance['hierarchical'] : false; |
|
| 157 | 157 | |
| 158 | - $cat_args = array( 'title_li' => '', 'taxonomy' => 'course-category', 'orderby' => 'name', 'show_count' => $count, 'hierarchical' => $hierarchical); |
|
| 159 | - if ( 0 < $limit ) {
|
|
| 160 | - $cat_args[ 'number' ] = $limit; |
|
| 158 | + $cat_args = array('title_li' => '', 'taxonomy' => 'course-category', 'orderby' => 'name', 'show_count' => $count, 'hierarchical' => $hierarchical);
|
|
| 159 | + if (0 < $limit) {
|
|
| 160 | + $cat_args['number'] = $limit; |
|
| 161 | 161 | } // End If Statement |
| 162 | 162 | echo '<ul>'; |
| 163 | - wp_list_categories( apply_filters('widget_course_categories_args', $cat_args) );
|
|
| 163 | + wp_list_categories(apply_filters('widget_course_categories_args', $cat_args));
|
|
| 164 | 164 | echo '</ul>'; |
| 165 | 165 | } // End load_component() |
| 166 | 166 | } // End Class |
| 167 | 167 | \ 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 |
@@ -50,10 +50,10 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function widget( $args, $instance ) {
|
| 52 | 52 | |
| 53 | - $before_widget = $args[ 'before_widget' ]; |
|
| 54 | - $before_title = $args[ 'before_title' ]; |
|
| 55 | - $after_title = $args[ 'after_title' ]; |
|
| 56 | - $after_widget = $args[ 'after_widget' ]; |
|
| 53 | + $before_widget = $args[ 'before_widget' ]; |
|
| 54 | + $before_title = $args[ 'before_title' ]; |
|
| 55 | + $after_title = $args[ 'after_title' ]; |
|
| 56 | + $after_widget = $args[ 'after_widget' ]; |
|
| 57 | 57 | |
| 58 | 58 | /* Our variables from the widget settings. */ |
| 59 | 59 | $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
|
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @param array $instance The settings for this instance. |
| 111 | 111 | * @return void |
| 112 | 112 | */ |
| 113 | - public function form( $instance ) {
|
|
| 113 | + public function form( $instance ) {
|
|
| 114 | 114 | |
| 115 | 115 | /* Set up some default widget settings. */ |
| 116 | 116 | /* Make sure all keys are added here, even with empty string values. */ |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | $post_args = array( 'post_type' => 'course', |
| 158 | 158 | 'posts_per_page' => intval( $instance[ 'limit' ] ), |
| 159 | 159 | 'orderby' => 'menu_order date', |
| 160 | - 'order' => 'ASC', |
|
| 161 | - 'post_status' => 'publish', |
|
| 160 | + 'order' => 'ASC', |
|
| 161 | + 'post_status' => 'publish', |
|
| 162 | 162 | 'suppress_filters' => 0, |
| 163 | 163 | ); |
| 164 | 164 | |
@@ -175,13 +175,13 @@ discard block |
||
| 175 | 175 | if ( count( $posts_array ) > 0 ) { ?>
|
| 176 | 176 | <ul> |
| 177 | 177 | <?php foreach ($posts_array as $post_item){
|
| 178 | - $post_id = absint( $post_item->ID ); |
|
| 179 | - $post_title = $post_item->post_title; |
|
| 180 | - $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 181 | - $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 182 | - $author_display_name = $user_info->display_name; |
|
| 183 | - $author_id = $post_item->post_author; |
|
| 184 | - ?> |
|
| 178 | + $post_id = absint( $post_item->ID ); |
|
| 179 | + $post_title = $post_item->post_title; |
|
| 180 | + $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 181 | + $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 182 | + $author_display_name = $user_info->display_name; |
|
| 183 | + $author_id = $post_item->post_author; |
|
| 184 | + ?> |
|
| 185 | 185 | <li class="fix"> |
| 186 | 186 | <?php do_action( 'sensei_course_image', $post_id ); ?> |
| 187 | 187 | <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,32 +48,32 @@ discard block |
||
| 48 | 48 | * @param array $instance Widget settings for this instance. |
| 49 | 49 | * @return void |
| 50 | 50 | */ |
| 51 | - public function widget( $args, $instance ) {
|
|
| 51 | + public function widget($args, $instance) {
|
|
| 52 | 52 | |
| 53 | - $before_widget = $args[ 'before_widget' ]; |
|
| 54 | - $before_title = $args[ 'before_title' ]; |
|
| 55 | - $after_title = $args[ 'after_title' ]; |
|
| 56 | - $after_widget = $args[ 'after_widget' ]; |
|
| 53 | + $before_widget = $args['before_widget']; |
|
| 54 | + $before_title = $args['before_title']; |
|
| 55 | + $after_title = $args['after_title']; |
|
| 56 | + $after_widget = $args['after_widget']; |
|
| 57 | 57 | |
| 58 | 58 | /* Our variables from the widget settings. */ |
| 59 | - $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
|
|
| 59 | + $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
|
|
| 60 | 60 | |
| 61 | 61 | /* Before widget (defined by themes). */ |
| 62 | 62 | echo $before_widget; |
| 63 | 63 | |
| 64 | 64 | /* Display the widget title if one was input (before and after defined by themes). */ |
| 65 | - if ( $title ) { echo $before_title . $title . $after_title; }
|
|
| 65 | + if ($title) { echo $before_title.$title.$after_title; }
|
|
| 66 | 66 | |
| 67 | 67 | /* Widget content. */ |
| 68 | 68 | // Add actions for plugins/themes to hook onto. |
| 69 | - do_action( $this->woo_widget_cssclass . '_top' ); |
|
| 69 | + do_action($this->woo_widget_cssclass.'_top'); |
|
| 70 | 70 | |
| 71 | - if ( 0 < intval( $instance['course_category'] ) ) {
|
|
| 72 | - $this->load_component( $instance ); |
|
| 71 | + if (0 < intval($instance['course_category'])) {
|
|
| 72 | + $this->load_component($instance); |
|
| 73 | 73 | } // End If Statement |
| 74 | 74 | |
| 75 | 75 | // Add actions for plugins/themes to hook onto. |
| 76 | - do_action( $this->woo_widget_cssclass . '_bottom' ); |
|
| 76 | + do_action($this->woo_widget_cssclass.'_bottom'); |
|
| 77 | 77 | |
| 78 | 78 | /* After widget (defined by themes). */ |
| 79 | 79 | echo $after_widget; |
@@ -87,17 +87,17 @@ discard block |
||
| 87 | 87 | * @param array $old_instance Previous settings. |
| 88 | 88 | * @return array Updated settings. |
| 89 | 89 | */ |
| 90 | - public function update ( $new_instance, $old_instance ) {
|
|
| 90 | + public function update($new_instance, $old_instance) {
|
|
| 91 | 91 | $instance = $old_instance; |
| 92 | 92 | |
| 93 | 93 | /* Strip tags for title and name to remove HTML (important for text inputs). */ |
| 94 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
| 94 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 95 | 95 | |
| 96 | 96 | /* The select box is returning a text value, so we escape it. */ |
| 97 | - $instance['course_category'] = esc_attr( $new_instance['course_category'] ); |
|
| 97 | + $instance['course_category'] = esc_attr($new_instance['course_category']); |
|
| 98 | 98 | |
| 99 | 99 | /* Strip tags for limit to remove HTML (important for text inputs). */ |
| 100 | - $instance['limit'] = strip_tags( $new_instance['limit'] ); |
|
| 100 | + $instance['limit'] = strip_tags($new_instance['limit']); |
|
| 101 | 101 | |
| 102 | 102 | |
| 103 | 103 | return $instance; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @param array $instance The settings for this instance. |
| 111 | 111 | * @return void |
| 112 | 112 | */ |
| 113 | - public function form( $instance ) {
|
|
| 113 | + public function form($instance) {
|
|
| 114 | 114 | |
| 115 | 115 | /* Set up some default widget settings. */ |
| 116 | 116 | /* Make sure all keys are added here, even with empty string values. */ |
@@ -120,25 +120,25 @@ discard block |
||
| 120 | 120 | 'limit' => 3 |
| 121 | 121 | ); |
| 122 | 122 | |
| 123 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
| 123 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
| 124 | 124 | ?> |
| 125 | 125 | <!-- Widget Title: Text Input --> |
| 126 | 126 | <p> |
| 127 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label> |
|
| 128 | - <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' ) ); ?>" /> |
|
| 127 | + <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title (optional):', 'woothemes-sensei'); ?></label>
|
|
| 128 | + <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')); ?>" />
|
|
| 129 | 129 | </p> |
| 130 | 130 | <!-- Widget Course Category: Select Input --> |
| 131 | 131 | <p> |
| 132 | - <label for="<?php echo esc_attr( $this->get_field_id( 'course_category' ) ); ?>"><?php _e( 'Course Category:', 'woothemes-sensei' ); ?></label> |
|
| 132 | + <label for="<?php echo esc_attr($this->get_field_id('course_category')); ?>"><?php _e('Course Category:', 'woothemes-sensei'); ?></label>
|
|
| 133 | 133 | <?php |
| 134 | - $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' ); |
|
| 134 | + $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');
|
|
| 135 | 135 | wp_dropdown_categories(apply_filters('widget_course_categories_dropdown_args', $cat_args));
|
| 136 | 136 | ?> |
| 137 | 137 | </p> |
| 138 | 138 | <!-- Widget Limit: Text Input --> |
| 139 | 139 | <p> |
| 140 | - <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Courses (optional):', 'woothemes-sensei' ); ?></label> |
|
| 141 | - <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' ) ); ?>" /> |
|
| 140 | + <label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php _e('Number of Courses (optional):', 'woothemes-sensei'); ?></label>
|
|
| 141 | + <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')); ?>" />
|
|
| 142 | 142 | </p> |
| 143 | 143 | |
| 144 | 144 | <?php |
@@ -150,49 +150,49 @@ discard block |
||
| 150 | 150 | * @since 1.1.0 |
| 151 | 151 | * @return void |
| 152 | 152 | */ |
| 153 | - protected function load_component ( $instance ) {
|
|
| 153 | + protected function load_component($instance) {
|
|
| 154 | 154 | |
| 155 | 155 | |
| 156 | 156 | $posts_array = array(); |
| 157 | - $post_args = array( 'post_type' => 'course', |
|
| 158 | - 'posts_per_page' => intval( $instance[ 'limit' ] ), |
|
| 157 | + $post_args = array('post_type' => 'course',
|
|
| 158 | + 'posts_per_page' => intval($instance['limit']), |
|
| 159 | 159 | 'orderby' => 'menu_order date', |
| 160 | 160 | 'order' => 'ASC', |
| 161 | 161 | 'post_status' => 'publish', |
| 162 | 162 | 'suppress_filters' => 0, |
| 163 | 163 | ); |
| 164 | 164 | |
| 165 | - $post_args[ 'tax_query' ] = array( |
|
| 165 | + $post_args['tax_query'] = array( |
|
| 166 | 166 | array( |
| 167 | 167 | 'taxonomy' => 'course-category', |
| 168 | 168 | 'field' => 'id', |
| 169 | - 'terms' => intval( $instance['course_category'] ) |
|
| 169 | + 'terms' => intval($instance['course_category']) |
|
| 170 | 170 | ) |
| 171 | 171 | ); |
| 172 | 172 | |
| 173 | - $posts_array = get_posts( $post_args ); |
|
| 173 | + $posts_array = get_posts($post_args); |
|
| 174 | 174 | |
| 175 | - if ( count( $posts_array ) > 0 ) { ?>
|
|
| 175 | + if (count($posts_array) > 0) { ?>
|
|
| 176 | 176 | <ul> |
| 177 | - <?php foreach ($posts_array as $post_item){
|
|
| 178 | - $post_id = absint( $post_item->ID ); |
|
| 177 | + <?php foreach ($posts_array as $post_item) {
|
|
| 178 | + $post_id = absint($post_item->ID); |
|
| 179 | 179 | $post_title = $post_item->post_title; |
| 180 | - $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 181 | - $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 180 | + $user_info = get_userdata(absint($post_item->post_author)); |
|
| 181 | + $author_link = get_author_posts_url(absint($post_item->post_author)); |
|
| 182 | 182 | $author_display_name = $user_info->display_name; |
| 183 | 183 | $author_id = $post_item->post_author; |
| 184 | 184 | ?> |
| 185 | 185 | <li class="fix"> |
| 186 | - <?php do_action( 'sensei_course_image', $post_id ); ?> |
|
| 187 | - <a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a> |
|
| 186 | + <?php do_action('sensei_course_image', $post_id); ?>
|
|
| 187 | + <a href="<?php echo esc_url(get_permalink($post_id)); ?>" title="<?php echo esc_attr($post_title); ?>"><?php echo $post_title; ?></a> |
|
| 188 | 188 | <br /> |
| 189 | - <?php if ( isset( Sensei()->settings->settings[ 'course_author' ] ) && ( Sensei()->settings->settings[ 'course_author' ] ) ) { ?>
|
|
| 190 | - <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> |
|
| 189 | + <?php if (isset(Sensei()->settings->settings['course_author']) && (Sensei()->settings->settings['course_author'])) { ?>
|
|
| 190 | + <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>
|
|
| 191 | 191 | <br /> |
| 192 | 192 | <?php } // End If Statement ?> |
| 193 | - <span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count( $post_id ) . ' ' . __( 'Lessons', 'woothemes-sensei' ); ?></span> |
|
| 193 | + <span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count($post_id).' '.__('Lessons', 'woothemes-sensei'); ?></span>
|
|
| 194 | 194 | <br /> |
| 195 | - <?php sensei_simple_course_price( $post_id ); ?> |
|
| 195 | + <?php sensei_simple_course_price($post_id); ?> |
|
| 196 | 196 | </li> |
| 197 | 197 | <?php } // End For Loop ?> |
| 198 | 198 | </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 Analysis User Profile List Table Class |
@@ -14,10 +14,10 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | class Sensei_Course_Results { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * @var string |
|
| 19 | - */ |
|
| 20 | - public $courses_url_base; |
|
| 17 | + /** |
|
| 18 | + * @var string |
|
| 19 | + */ |
|
| 20 | + public $courses_url_base; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Constructor. |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | global $wp_query, $current_user; |
| 99 | 99 | |
| 100 | 100 | if( isset( $wp_query->query_vars['course_results'] ) ) { |
| 101 | - Sensei_Templates::get_template( 'course-results/course-info.php' ); |
|
| 101 | + Sensei_Templates::get_template( 'course-results/course-info.php' ); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | } |
@@ -117,20 +117,20 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | sensei_do_deprecated_action( 'sensei_course_results_lessons','1.9.','sensei_course_results_content_inside_after', $course ); |
| 119 | 119 | |
| 120 | - sensei_do_deprecated_action( 'sensei_course_results_bottom','1.9.','sensei_course_results_content_inside_after', $course->ID ); |
|
| 120 | + sensei_do_deprecated_action( 'sensei_course_results_bottom','1.9.','sensei_course_results_content_inside_after', $course->ID ); |
|
| 121 | 121 | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | 125 | * Load template for displaying course lessons |
| 126 | - * |
|
| 126 | + * |
|
| 127 | 127 | * @since 1.4.0 |
| 128 | 128 | * @return void |
| 129 | 129 | */ |
| 130 | 130 | public function course_lessons() { |
| 131 | 131 | |
| 132 | 132 | global $course; |
| 133 | - _deprecated_function( 'Sensei_modules course_lessons ', '1.9.0' ); |
|
| 133 | + _deprecated_function( 'Sensei_modules course_lessons ', '1.9.0' ); |
|
| 134 | 134 | |
| 135 | 135 | } |
| 136 | 136 | |
@@ -147,62 +147,62 @@ discard block |
||
| 147 | 147 | return $classes; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - /** |
|
| 151 | - * Deprecate the sensei_course_results_content hook |
|
| 152 | - * |
|
| 153 | - * @deprecated since 1.9.0 |
|
| 154 | - */ |
|
| 155 | - public static function deprecate_sensei_course_results_content_hook(){ |
|
| 150 | + /** |
|
| 151 | + * Deprecate the sensei_course_results_content hook |
|
| 152 | + * |
|
| 153 | + * @deprecated since 1.9.0 |
|
| 154 | + */ |
|
| 155 | + public static function deprecate_sensei_course_results_content_hook(){ |
|
| 156 | 156 | |
| 157 | - sensei_do_deprecated_action('sensei_course_results_content', '1.9.0','sensei_course_results_content_before'); |
|
| 157 | + sensei_do_deprecated_action('sensei_course_results_content', '1.9.0','sensei_course_results_content_before'); |
|
| 158 | 158 | |
| 159 | - } |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | - /** |
|
| 162 | - * Fire the sensei frontend message hook |
|
| 163 | - * |
|
| 164 | - * @since 1.9.0 |
|
| 165 | - */ |
|
| 166 | - public static function fire_sensei_message_hook(){ |
|
| 161 | + /** |
|
| 162 | + * Fire the sensei frontend message hook |
|
| 163 | + * |
|
| 164 | + * @since 1.9.0 |
|
| 165 | + */ |
|
| 166 | + public static function fire_sensei_message_hook(){ |
|
| 167 | 167 | |
| 168 | - do_action( 'sensei_frontend_messages' ); |
|
| 168 | + do_action( 'sensei_frontend_messages' ); |
|
| 169 | 169 | |
| 170 | - } |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | - /** |
|
| 173 | - * Deprecate the course_results info hook |
|
| 174 | - * |
|
| 175 | - * @since 1.9.0 |
|
| 176 | - */ |
|
| 177 | - public static function deprecate_course_result_info_hook(){ |
|
| 172 | + /** |
|
| 173 | + * Deprecate the course_results info hook |
|
| 174 | + * |
|
| 175 | + * @since 1.9.0 |
|
| 176 | + */ |
|
| 177 | + public static function deprecate_course_result_info_hook(){ |
|
| 178 | 178 | |
| 179 | - sensei_do_deprecated_action( 'sensei_course_results_info', '1.9.0', 'sensei_course_results_content_inside_before' ); |
|
| 179 | + sensei_do_deprecated_action( 'sensei_course_results_info', '1.9.0', 'sensei_course_results_content_inside_before' ); |
|
| 180 | 180 | |
| 181 | - } |
|
| 181 | + } |
|
| 182 | 182 | |
| 183 | - /** |
|
| 184 | - * Deprecate the sensei_course_results_top hook |
|
| 185 | - * |
|
| 186 | - * @deprecate since 1.9.0 |
|
| 187 | - */ |
|
| 188 | - public static function deprecate_course_results_top_hook(){ |
|
| 183 | + /** |
|
| 184 | + * Deprecate the sensei_course_results_top hook |
|
| 185 | + * |
|
| 186 | + * @deprecate since 1.9.0 |
|
| 187 | + */ |
|
| 188 | + public static function deprecate_course_results_top_hook(){ |
|
| 189 | 189 | |
| 190 | - global $course; |
|
| 191 | - sensei_do_deprecated_action( 'sensei_course_results_top', '1.9.0' ,'sensei_course_results_content_inside_before',$course->ID ); |
|
| 190 | + global $course; |
|
| 191 | + sensei_do_deprecated_action( 'sensei_course_results_top', '1.9.0' ,'sensei_course_results_content_inside_before',$course->ID ); |
|
| 192 | 192 | |
| 193 | - } |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | - /** |
|
| 196 | - * Fire the course image hook |
|
| 197 | - * |
|
| 198 | - * @since 1.8.0 |
|
| 199 | - */ |
|
| 200 | - public static function fire_course_image_hook(){ |
|
| 195 | + /** |
|
| 196 | + * Fire the course image hook |
|
| 197 | + * |
|
| 198 | + * @since 1.8.0 |
|
| 199 | + */ |
|
| 200 | + public static function fire_course_image_hook(){ |
|
| 201 | 201 | |
| 202 | - global $course; |
|
| 203 | - sensei_do_deprecated_action('sensei_course_image','1.9.0', 'sensei_single_course_content_inside_before', array( get_the_ID()) ); |
|
| 202 | + global $course; |
|
| 203 | + sensei_do_deprecated_action('sensei_course_image','1.9.0', 'sensei_single_course_content_inside_before', array( get_the_ID()) ); |
|
| 204 | 204 | |
| 205 | - } |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | 207 | } // End Class |
| 208 | 208 | |
@@ -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 Results Class |
@@ -23,20 +23,20 @@ discard block |
||
| 23 | 23 | * Constructor. |
| 24 | 24 | * @since 1.4.0 |
| 25 | 25 | */ |
| 26 | - public function __construct () { |
|
| 26 | + public function __construct() { |
|
| 27 | 27 | |
| 28 | 28 | // Setup learner profile URL base |
| 29 | - $this->courses_url_base = apply_filters( 'sensei_course_slug', _x( 'course', 'post type single url slug', 'woothemes-sensei' ) ); |
|
| 29 | + $this->courses_url_base = apply_filters('sensei_course_slug', _x('course', 'post type single url slug', 'woothemes-sensei')); |
|
| 30 | 30 | |
| 31 | 31 | // Setup permalink structure for course results |
| 32 | - add_action( 'init', array( $this, 'setup_permastruct' ) ); |
|
| 33 | - add_filter( 'wp_title', array( $this, 'page_title' ), 10, 2 ); |
|
| 32 | + add_action('init', array($this, 'setup_permastruct')); |
|
| 33 | + add_filter('wp_title', array($this, 'page_title'), 10, 2); |
|
| 34 | 34 | |
| 35 | 35 | // Load course results |
| 36 | - add_action( 'sensei_course_results_content_inside_before', array( $this, 'deprecate_course_result_info_hook' ), 10 ); |
|
| 36 | + add_action('sensei_course_results_content_inside_before', array($this, 'deprecate_course_result_info_hook'), 10); |
|
| 37 | 37 | |
| 38 | 38 | // Add class to body tag |
| 39 | - add_filter( 'body_class', array( $this, 'body_class' ), 10, 1 ); |
|
| 39 | + add_filter('body_class', array($this, 'body_class'), 10, 1); |
|
| 40 | 40 | |
| 41 | 41 | } // End __construct() |
| 42 | 42 | |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | * @return void |
| 47 | 47 | */ |
| 48 | 48 | public function setup_permastruct() { |
| 49 | - add_rewrite_rule( '^' . $this->courses_url_base . '/([^/]*)/results/?', 'index.php?course_results=$matches[1]', 'top' ); |
|
| 50 | - add_rewrite_tag( '%course_results%', '([^&]+)' ); |
|
| 49 | + add_rewrite_rule('^'.$this->courses_url_base.'/([^/]*)/results/?', 'index.php?course_results=$matches[1]', 'top'); |
|
| 50 | + add_rewrite_tag('%course_results%', '([^&]+)'); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | * @param string $sep Seeparator string |
| 57 | 57 | * @return string Modified title |
| 58 | 58 | */ |
| 59 | - public function page_title( $title, $sep = null ) { |
|
| 59 | + public function page_title($title, $sep = null) { |
|
| 60 | 60 | global $wp_query; |
| 61 | - if( isset( $wp_query->query_vars['course_results'] ) ) { |
|
| 62 | - $course = get_page_by_path( $wp_query->query_vars['course_results'], OBJECT, 'course' ); |
|
| 63 | - $title = __( 'Course Results: ', 'woothemes-sensei' ) . $course->post_title . ' ' . $sep . ' '; |
|
| 61 | + if (isset($wp_query->query_vars['course_results'])) { |
|
| 62 | + $course = get_page_by_path($wp_query->query_vars['course_results'], OBJECT, 'course'); |
|
| 63 | + $title = __('Course Results: ', 'woothemes-sensei').$course->post_title.' '.$sep.' '; |
|
| 64 | 64 | } |
| 65 | 65 | return $title; |
| 66 | 66 | } |
@@ -71,18 +71,18 @@ discard block |
||
| 71 | 71 | * @param integer $course_id ID of course |
| 72 | 72 | * @return string The course results page permalink |
| 73 | 73 | */ |
| 74 | - public function get_permalink( $course_id = 0 ) { |
|
| 74 | + public function get_permalink($course_id = 0) { |
|
| 75 | 75 | |
| 76 | 76 | $permalink = ''; |
| 77 | 77 | |
| 78 | - if( $course_id > 0 ) { |
|
| 78 | + if ($course_id > 0) { |
|
| 79 | 79 | |
| 80 | - $course = get_post( $course_id ); |
|
| 80 | + $course = get_post($course_id); |
|
| 81 | 81 | |
| 82 | - if ( get_option('permalink_structure') ) { |
|
| 83 | - $permalink = trailingslashit( get_home_url() ) . $this->courses_url_base . '/' . $course->post_name . '/results/'; |
|
| 82 | + if (get_option('permalink_structure')) { |
|
| 83 | + $permalink = trailingslashit(get_home_url()).$this->courses_url_base.'/'.$course->post_name.'/results/'; |
|
| 84 | 84 | } else { |
| 85 | - $permalink = trailingslashit( get_home_url() ) . '?course_results=' . $course->post_name; |
|
| 85 | + $permalink = trailingslashit(get_home_url()).'?course_results='.$course->post_name; |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
@@ -95,10 +95,10 @@ discard block |
||
| 95 | 95 | * @return void |
| 96 | 96 | */ |
| 97 | 97 | public function content() { |
| 98 | - global $wp_query, $current_user; |
|
| 98 | + global $wp_query, $current_user; |
|
| 99 | 99 | |
| 100 | - if( isset( $wp_query->query_vars['course_results'] ) ) { |
|
| 101 | - Sensei_Templates::get_template( 'course-results/course-info.php' ); |
|
| 100 | + if (isset($wp_query->query_vars['course_results'])) { |
|
| 101 | + Sensei_Templates::get_template('course-results/course-info.php'); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | } |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | global $course; |
| 114 | 114 | |
| 115 | - $course_status = Sensei_Utils::sensei_user_course_status_message( $course->ID, get_current_user_id()); |
|
| 116 | - echo '<div class="sensei-message ' . $course_status['box_class'] . '">' . $course_status['message'] . '</div>'; |
|
| 115 | + $course_status = Sensei_Utils::sensei_user_course_status_message($course->ID, get_current_user_id()); |
|
| 116 | + echo '<div class="sensei-message '.$course_status['box_class'].'">'.$course_status['message'].'</div>'; |
|
| 117 | 117 | |
| 118 | - sensei_do_deprecated_action( 'sensei_course_results_lessons','1.9.','sensei_course_results_content_inside_after', $course ); |
|
| 118 | + sensei_do_deprecated_action('sensei_course_results_lessons', '1.9.', 'sensei_course_results_content_inside_after', $course); |
|
| 119 | 119 | |
| 120 | - sensei_do_deprecated_action( 'sensei_course_results_bottom','1.9.','sensei_course_results_content_inside_after', $course->ID ); |
|
| 120 | + sensei_do_deprecated_action('sensei_course_results_bottom', '1.9.', 'sensei_course_results_content_inside_after', $course->ID); |
|
| 121 | 121 | |
| 122 | 122 | } |
| 123 | 123 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | public function course_lessons() { |
| 131 | 131 | |
| 132 | 132 | global $course; |
| 133 | - _deprecated_function( 'Sensei_modules course_lessons ', '1.9.0' ); |
|
| 133 | + _deprecated_function('Sensei_modules course_lessons ', '1.9.0'); |
|
| 134 | 134 | |
| 135 | 135 | } |
| 136 | 136 | |
@@ -139,9 +139,9 @@ discard block |
||
| 139 | 139 | * @param array $classes Existing classes |
| 140 | 140 | * @return array Modified classes |
| 141 | 141 | */ |
| 142 | - public function body_class( $classes ) { |
|
| 142 | + public function body_class($classes) { |
|
| 143 | 143 | global $wp_query; |
| 144 | - if( isset( $wp_query->query_vars['course_results'] ) ) { |
|
| 144 | + if (isset($wp_query->query_vars['course_results'])) { |
|
| 145 | 145 | $classes[] = 'course-results'; |
| 146 | 146 | } |
| 147 | 147 | return $classes; |
@@ -152,9 +152,9 @@ discard block |
||
| 152 | 152 | * |
| 153 | 153 | * @deprecated since 1.9.0 |
| 154 | 154 | */ |
| 155 | - public static function deprecate_sensei_course_results_content_hook(){ |
|
| 155 | + public static function deprecate_sensei_course_results_content_hook() { |
|
| 156 | 156 | |
| 157 | - sensei_do_deprecated_action('sensei_course_results_content', '1.9.0','sensei_course_results_content_before'); |
|
| 157 | + sensei_do_deprecated_action('sensei_course_results_content', '1.9.0', 'sensei_course_results_content_before'); |
|
| 158 | 158 | |
| 159 | 159 | } |
| 160 | 160 | |
@@ -163,9 +163,9 @@ discard block |
||
| 163 | 163 | * |
| 164 | 164 | * @since 1.9.0 |
| 165 | 165 | */ |
| 166 | - public static function fire_sensei_message_hook(){ |
|
| 166 | + public static function fire_sensei_message_hook() { |
|
| 167 | 167 | |
| 168 | - do_action( 'sensei_frontend_messages' ); |
|
| 168 | + do_action('sensei_frontend_messages'); |
|
| 169 | 169 | |
| 170 | 170 | } |
| 171 | 171 | |
@@ -174,9 +174,9 @@ discard block |
||
| 174 | 174 | * |
| 175 | 175 | * @since 1.9.0 |
| 176 | 176 | */ |
| 177 | - public static function deprecate_course_result_info_hook(){ |
|
| 177 | + public static function deprecate_course_result_info_hook() { |
|
| 178 | 178 | |
| 179 | - sensei_do_deprecated_action( 'sensei_course_results_info', '1.9.0', 'sensei_course_results_content_inside_before' ); |
|
| 179 | + sensei_do_deprecated_action('sensei_course_results_info', '1.9.0', 'sensei_course_results_content_inside_before'); |
|
| 180 | 180 | |
| 181 | 181 | } |
| 182 | 182 | |
@@ -185,10 +185,10 @@ discard block |
||
| 185 | 185 | * |
| 186 | 186 | * @deprecate since 1.9.0 |
| 187 | 187 | */ |
| 188 | - public static function deprecate_course_results_top_hook(){ |
|
| 188 | + public static function deprecate_course_results_top_hook() { |
|
| 189 | 189 | |
| 190 | 190 | global $course; |
| 191 | - sensei_do_deprecated_action( 'sensei_course_results_top', '1.9.0' ,'sensei_course_results_content_inside_before',$course->ID ); |
|
| 191 | + sensei_do_deprecated_action('sensei_course_results_top', '1.9.0', 'sensei_course_results_content_inside_before', $course->ID); |
|
| 192 | 192 | |
| 193 | 193 | } |
| 194 | 194 | |
@@ -197,10 +197,10 @@ discard block |
||
| 197 | 197 | * |
| 198 | 198 | * @since 1.8.0 |
| 199 | 199 | */ |
| 200 | - public static function fire_course_image_hook(){ |
|
| 200 | + public static function fire_course_image_hook() { |
|
| 201 | 201 | |
| 202 | 202 | global $course; |
| 203 | - sensei_do_deprecated_action('sensei_course_image','1.9.0', 'sensei_single_course_content_inside_before', array( get_the_ID()) ); |
|
| 203 | + sensei_do_deprecated_action('sensei_course_image', '1.9.0', 'sensei_single_course_content_inside_before', array(get_the_ID())); |
|
| 204 | 204 | |
| 205 | 205 | } |
| 206 | 206 | |
@@ -211,4 +211,4 @@ discard block |
||
| 211 | 211 | * for backward compatibility |
| 212 | 212 | * @since 1.9.0 |
| 213 | 213 | */ |
| 214 | -class WooThemes_Sensei_Course_Results extends Sensei_Course_Results{} |
|
| 214 | +class WooThemes_Sensei_Course_Results extends Sensei_Course_Results {} |
|
@@ -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 Analysis User Profile List Table Class |
@@ -60,8 +60,8 @@ |
||
| 60 | 60 | /** |
| 61 | 61 | * @since 1.9.0 |
| 62 | 62 | * |
| 63 | - * @param $setting |
|
| 64 | - * @param $new_value |
|
| 63 | + * @param string $setting |
|
| 64 | + * @param integer $new_value |
|
| 65 | 65 | */ |
| 66 | 66 | public function set( $setting, $new_value ){ |
| 67 | 67 | |
@@ -19,63 +19,63 @@ discard block |
||
| 19 | 19 | * @since 1.0.0 |
| 20 | 20 | */ |
| 21 | 21 | public function __construct () { |
| 22 | - parent::__construct(); // Required in extended classes. |
|
| 22 | + parent::__construct(); // Required in extended classes. |
|
| 23 | 23 | |
| 24 | - $this->token = 'woothemes-sensei-settings'; |
|
| 25 | - add_action('init', array( __CLASS__, 'flush_rewrite_rules' ) ); |
|
| 24 | + $this->token = 'woothemes-sensei-settings'; |
|
| 25 | + add_action('init', array( __CLASS__, 'flush_rewrite_rules' ) ); |
|
| 26 | 26 | |
| 27 | - // Setup Admin Settings data |
|
| 28 | - if ( is_admin() ) { |
|
| 27 | + // Setup Admin Settings data |
|
| 28 | + if ( is_admin() ) { |
|
| 29 | 29 | |
| 30 | - $this->has_tabs = true; |
|
| 31 | - $this->name = __( 'Sensei Settings', 'woothemes-sensei' ); |
|
| 32 | - $this->menu_label = __( 'Settings', 'woothemes-sensei' ); |
|
| 33 | - $this->page_slug = 'woothemes-sensei-settings'; |
|
| 30 | + $this->has_tabs = true; |
|
| 31 | + $this->name = __( 'Sensei Settings', 'woothemes-sensei' ); |
|
| 32 | + $this->menu_label = __( 'Settings', 'woothemes-sensei' ); |
|
| 33 | + $this->page_slug = 'woothemes-sensei-settings'; |
|
| 34 | 34 | |
| 35 | - } // End If Statement |
|
| 35 | + } // End If Statement |
|
| 36 | 36 | |
| 37 | - $this->register_hook_listener(); |
|
| 38 | - $this->get_settings(); |
|
| 37 | + $this->register_hook_listener(); |
|
| 38 | + $this->get_settings(); |
|
| 39 | 39 | |
| 40 | 40 | } // End __construct() |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Get settings value |
|
| 44 | - * |
|
| 45 | - * @since 1.9.0 |
|
| 46 | - * @param string $setting_name |
|
| 47 | - * @return mixed |
|
| 48 | - */ |
|
| 49 | - public function get( $setting_name ){ |
|
| 42 | + /** |
|
| 43 | + * Get settings value |
|
| 44 | + * |
|
| 45 | + * @since 1.9.0 |
|
| 46 | + * @param string $setting_name |
|
| 47 | + * @return mixed |
|
| 48 | + */ |
|
| 49 | + public function get( $setting_name ){ |
|
| 50 | 50 | |
| 51 | - if( isset( $this->settings[ $setting_name ] ) ){ |
|
| 51 | + if( isset( $this->settings[ $setting_name ] ) ){ |
|
| 52 | 52 | |
| 53 | - return $this->settings[ $setting_name ]; |
|
| 53 | + return $this->settings[ $setting_name ]; |
|
| 54 | 54 | |
| 55 | - } |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - return false; |
|
| 58 | - } |
|
| 57 | + return false; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @since 1.9.0 |
|
| 62 | - * |
|
| 63 | - * @param $setting |
|
| 64 | - * @param $new_value |
|
| 65 | - */ |
|
| 66 | - public function set( $setting, $new_value ){ |
|
| 60 | + /** |
|
| 61 | + * @since 1.9.0 |
|
| 62 | + * |
|
| 63 | + * @param $setting |
|
| 64 | + * @param $new_value |
|
| 65 | + */ |
|
| 66 | + public function set( $setting, $new_value ){ |
|
| 67 | 67 | |
| 68 | - $settings = get_option( $this->token, array() ); |
|
| 68 | + $settings = get_option( $this->token, array() ); |
|
| 69 | 69 | |
| 70 | - if( isset( $settings[ $setting ] ) ){ |
|
| 70 | + if( isset( $settings[ $setting ] ) ){ |
|
| 71 | 71 | |
| 72 | - $settings[ $setting ] = $new_value; |
|
| 73 | - return update_option( $this->token,$settings ); |
|
| 72 | + $settings[ $setting ] = $new_value; |
|
| 73 | + return update_option( $this->token,$settings ); |
|
| 74 | 74 | |
| 75 | - } |
|
| 76 | - return false; |
|
| 75 | + } |
|
| 76 | + return false; |
|
| 77 | 77 | |
| 78 | - } |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * Register the settings screen within the WordPress admin. |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $complete_settings = array( 'passed' => __( 'Once all the course lessons have been completed', 'woothemes-sensei' ), 'complete' => __( 'At any time (by clicking the \'Complete Course\' button)', 'woothemes-sensei' ) ); |
| 164 | 164 | $course_display_settings = array( 'excerpt' => __( 'Course Excerpt', 'woothemes-sensei' ), 'full' => __( 'Full Course Content', 'woothemes-sensei' ) ); |
| 165 | 165 | |
| 166 | - $fields = array(); |
|
| 166 | + $fields = array(); |
|
| 167 | 167 | |
| 168 | 168 | $fields['access_permission'] = array( |
| 169 | 169 | 'name' => __( 'Access Permissions', 'woothemes-sensei' ), |
@@ -225,9 +225,9 @@ discard block |
||
| 225 | 225 | 'section' => 'default-settings' |
| 226 | 226 | ); |
| 227 | 227 | |
| 228 | - // Course Settings |
|
| 228 | + // Course Settings |
|
| 229 | 229 | |
| 230 | - $fields['course_completion'] = array( |
|
| 230 | + $fields['course_completion'] = array( |
|
| 231 | 231 | 'name' => __( 'Courses are complete:', 'woothemes-sensei' ), |
| 232 | 232 | 'description' => __( 'This will determine when courses are marked as complete.', 'woothemes-sensei' ), |
| 233 | 233 | 'type' => 'select', |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | 'options' => $complete_settings |
| 238 | 238 | ); |
| 239 | 239 | |
| 240 | - $fields['course_author'] = array( |
|
| 240 | + $fields['course_author'] = array( |
|
| 241 | 241 | 'name' => __( 'Display Course Author', 'woothemes-sensei' ), |
| 242 | 242 | 'description' => __( 'Output the Course Author on Course archive and My Courses page.', 'woothemes-sensei' ), |
| 243 | 243 | 'type' => 'checkbox', |
@@ -465,10 +465,10 @@ discard block |
||
| 465 | 465 | ); |
| 466 | 466 | |
| 467 | 467 | $teacher_email_options = array( |
| 468 | - 'teacher-started-course' => __( 'A learner starts their course', 'woothemes-sensei' ), |
|
| 469 | - 'teacher-completed-course' => __( 'A learner completes their course', 'woothemes-sensei' ), |
|
| 470 | - 'teacher-completed-lesson' => __( 'A learner completes a lesson', 'woothemes-sensei' ), |
|
| 471 | - 'teacher-quiz-submitted' => __( 'A learner submits a quiz for grading', 'woothemes-sensei' ), |
|
| 468 | + 'teacher-started-course' => __( 'A learner starts their course', 'woothemes-sensei' ), |
|
| 469 | + 'teacher-completed-course' => __( 'A learner completes their course', 'woothemes-sensei' ), |
|
| 470 | + 'teacher-completed-lesson' => __( 'A learner completes a lesson', 'woothemes-sensei' ), |
|
| 471 | + 'teacher-quiz-submitted' => __( 'A learner submits a quiz for grading', 'woothemes-sensei' ), |
|
| 472 | 472 | 'teacher-new-message' => __( 'A learner sends a private message to a teacher', 'woothemes-sensei' ), |
| 473 | 473 | ); |
| 474 | 474 | |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | |
| 578 | 578 | if ( Sensei_WC::is_woocommerce_present() ) { |
| 579 | 579 | // WooCommerce Settings |
| 580 | - $fields['woocommerce_enabled'] = array( |
|
| 580 | + $fields['woocommerce_enabled'] = array( |
|
| 581 | 581 | 'name' => __( 'Enable WooCommerce Courses', 'woothemes-sensei' ), |
| 582 | 582 | 'description' => __( 'Use WooCommerce to sell Courses by linking a Product to a Course.', 'woothemes-sensei' ), |
| 583 | 583 | 'type' => 'checkbox', |
@@ -665,14 +665,14 @@ discard block |
||
| 665 | 665 | $page_items[] = __( 'Select a Page:', 'woothemes-sensei' ); |
| 666 | 666 | |
| 667 | 667 | foreach ( $pages_split as $k => $v ) { |
| 668 | - $id = ''; |
|
| 669 | - // Get the ID value. |
|
| 670 | - preg_match( '/value="(.*?)"/i', $v, $matches ); |
|
| 671 | - |
|
| 672 | - if ( isset( $matches[1] ) ) { |
|
| 673 | - $id = $matches[1]; |
|
| 674 | - $page_items[$id] = trim( strip_tags( $v ) ); |
|
| 675 | - } // End If Statement |
|
| 668 | + $id = ''; |
|
| 669 | + // Get the ID value. |
|
| 670 | + preg_match( '/value="(.*?)"/i', $v, $matches ); |
|
| 671 | + |
|
| 672 | + if ( isset( $matches[1] ) ) { |
|
| 673 | + $id = $matches[1]; |
|
| 674 | + $page_items[$id] = trim( strip_tags( $v ) ); |
|
| 675 | + } // End If Statement |
|
| 676 | 676 | } // End For Loop |
| 677 | 677 | |
| 678 | 678 | $pages_array = $page_items; |
@@ -689,22 +689,22 @@ discard block |
||
| 689 | 689 | Sensei_Language_Pack_Manager::messages(); |
| 690 | 690 | } |
| 691 | 691 | |
| 692 | - /** |
|
| 693 | - * Flush the rewrite rules after the settings have been updated. |
|
| 694 | - * This is to ensure that the |
|
| 695 | - * |
|
| 696 | - * @since 1.9.0 |
|
| 697 | - */ |
|
| 698 | - public static function flush_rewrite_rules(){ |
|
| 692 | + /** |
|
| 693 | + * Flush the rewrite rules after the settings have been updated. |
|
| 694 | + * This is to ensure that the |
|
| 695 | + * |
|
| 696 | + * @since 1.9.0 |
|
| 697 | + */ |
|
| 698 | + public static function flush_rewrite_rules(){ |
|
| 699 | 699 | |
| 700 | - if ( isset( $_POST[ 'option_page' ] ) && 'woothemes-sensei-settings' == $_POST[ 'option_page' ] |
|
| 701 | - && isset( $_POST[ 'action' ] ) && 'update' == $_POST[ 'action' ] ) { |
|
| 700 | + if ( isset( $_POST[ 'option_page' ] ) && 'woothemes-sensei-settings' == $_POST[ 'option_page' ] |
|
| 701 | + && isset( $_POST[ 'action' ] ) && 'update' == $_POST[ 'action' ] ) { |
|
| 702 | 702 | |
| 703 | - Sensei()->initiate_rewrite_rules_flush(); |
|
| 703 | + Sensei()->initiate_rewrite_rules_flush(); |
|
| 704 | 704 | |
| 705 | - } |
|
| 705 | + } |
|
| 706 | 706 | |
| 707 | - }//end flush_cache |
|
| 707 | + }//end flush_cache |
|
| 708 | 708 | } // End Class |
| 709 | 709 | |
| 710 | 710 | /** |
@@ -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 Settings Class |
@@ -18,18 +18,18 @@ discard block |
||
| 18 | 18 | * @access public |
| 19 | 19 | * @since 1.0.0 |
| 20 | 20 | */ |
| 21 | - public function __construct () { |
|
| 21 | + public function __construct() { |
|
| 22 | 22 | parent::__construct(); // Required in extended classes. |
| 23 | 23 | |
| 24 | 24 | $this->token = 'woothemes-sensei-settings'; |
| 25 | - add_action('init', array( __CLASS__, 'flush_rewrite_rules' ) ); |
|
| 25 | + add_action('init', array(__CLASS__, 'flush_rewrite_rules')); |
|
| 26 | 26 | |
| 27 | 27 | // Setup Admin Settings data |
| 28 | - if ( is_admin() ) { |
|
| 28 | + if (is_admin()) { |
|
| 29 | 29 | |
| 30 | 30 | $this->has_tabs = true; |
| 31 | - $this->name = __( 'Sensei Settings', 'woothemes-sensei' ); |
|
| 32 | - $this->menu_label = __( 'Settings', 'woothemes-sensei' ); |
|
| 31 | + $this->name = __('Sensei Settings', 'woothemes-sensei'); |
|
| 32 | + $this->menu_label = __('Settings', 'woothemes-sensei'); |
|
| 33 | 33 | $this->page_slug = 'woothemes-sensei-settings'; |
| 34 | 34 | |
| 35 | 35 | } // End If Statement |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | * @param string $setting_name |
| 47 | 47 | * @return mixed |
| 48 | 48 | */ |
| 49 | - public function get( $setting_name ){ |
|
| 49 | + public function get($setting_name) { |
|
| 50 | 50 | |
| 51 | - if( isset( $this->settings[ $setting_name ] ) ){ |
|
| 51 | + if (isset($this->settings[$setting_name])) { |
|
| 52 | 52 | |
| 53 | - return $this->settings[ $setting_name ]; |
|
| 53 | + return $this->settings[$setting_name]; |
|
| 54 | 54 | |
| 55 | 55 | } |
| 56 | 56 | |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | * @param $setting |
| 64 | 64 | * @param $new_value |
| 65 | 65 | */ |
| 66 | - public function set( $setting, $new_value ){ |
|
| 66 | + public function set($setting, $new_value) { |
|
| 67 | 67 | |
| 68 | - $settings = get_option( $this->token, array() ); |
|
| 68 | + $settings = get_option($this->token, array()); |
|
| 69 | 69 | |
| 70 | - if( isset( $settings[ $setting ] ) ){ |
|
| 70 | + if (isset($settings[$setting])) { |
|
| 71 | 71 | |
| 72 | - $settings[ $setting ] = $new_value; |
|
| 73 | - return update_option( $this->token,$settings ); |
|
| 72 | + $settings[$setting] = $new_value; |
|
| 73 | + return update_option($this->token, $settings); |
|
| 74 | 74 | |
| 75 | 75 | } |
| 76 | 76 | return false; |
@@ -83,17 +83,17 @@ discard block |
||
| 83 | 83 | * @since 1.0.0 |
| 84 | 84 | * @return void |
| 85 | 85 | */ |
| 86 | - public function register_settings_screen () { |
|
| 86 | + public function register_settings_screen() { |
|
| 87 | 87 | |
| 88 | 88 | $this->settings_version = Sensei()->version; // Use the global plugin version on this settings screen. |
| 89 | - $hook = add_submenu_page( 'sensei', $this->name, $this->menu_label, 'manage_sensei', $this->page_slug, array( $this, 'settings_screen' ) ); |
|
| 89 | + $hook = add_submenu_page('sensei', $this->name, $this->menu_label, 'manage_sensei', $this->page_slug, array($this, 'settings_screen')); |
|
| 90 | 90 | $this->hook = $hook; |
| 91 | 91 | |
| 92 | - if ( isset( $_GET['page'] ) && ( $_GET['page'] == $this->page_slug ) ) { |
|
| 93 | - add_action( 'admin_notices', array( $this, 'settings_errors' ) ); |
|
| 94 | - add_action( 'admin_notices', array( $this, 'language_pack_notices' ) ); |
|
| 95 | - add_action( 'admin_print_scripts', array( $this, 'enqueue_scripts' ) ); |
|
| 96 | - add_action( 'admin_print_styles', array( $this, 'enqueue_styles' ) ); |
|
| 92 | + if (isset($_GET['page']) && ($_GET['page'] == $this->page_slug)) { |
|
| 93 | + add_action('admin_notices', array($this, 'settings_errors')); |
|
| 94 | + add_action('admin_notices', array($this, 'language_pack_notices')); |
|
| 95 | + add_action('admin_print_scripts', array($this, 'enqueue_scripts')); |
|
| 96 | + add_action('admin_print_styles', array($this, 'enqueue_styles')); |
|
| 97 | 97 | } |
| 98 | 98 | } // End register_settings_screen() |
| 99 | 99 | |
@@ -103,49 +103,49 @@ discard block |
||
| 103 | 103 | * @since 1.0.0 |
| 104 | 104 | * @return void |
| 105 | 105 | */ |
| 106 | - public function init_sections () { |
|
| 106 | + public function init_sections() { |
|
| 107 | 107 | $sections = array(); |
| 108 | 108 | |
| 109 | 109 | $sections['default-settings'] = array( |
| 110 | - 'name' => __( 'General', 'woothemes-sensei' ), |
|
| 111 | - 'description' => __( 'Settings that apply to the entire plugin.', 'woothemes-sensei' ) |
|
| 110 | + 'name' => __('General', 'woothemes-sensei'), |
|
| 111 | + 'description' => __('Settings that apply to the entire plugin.', 'woothemes-sensei') |
|
| 112 | 112 | ); |
| 113 | 113 | |
| 114 | 114 | $sections['course-settings'] = array( |
| 115 | - 'name' => __( 'Courses', 'woothemes-sensei' ), |
|
| 116 | - 'description' => __( 'Settings that apply to all Courses.', 'woothemes-sensei' ) |
|
| 115 | + 'name' => __('Courses', 'woothemes-sensei'), |
|
| 116 | + 'description' => __('Settings that apply to all Courses.', 'woothemes-sensei') |
|
| 117 | 117 | ); |
| 118 | 118 | |
| 119 | 119 | $sections['lesson-settings'] = array( |
| 120 | - 'name' => __( 'Lessons', 'woothemes-sensei' ), |
|
| 121 | - 'description' => __( 'Settings that apply to all Lessons.', 'woothemes-sensei' ) |
|
| 120 | + 'name' => __('Lessons', 'woothemes-sensei'), |
|
| 121 | + 'description' => __('Settings that apply to all Lessons.', 'woothemes-sensei') |
|
| 122 | 122 | ); |
| 123 | 123 | |
| 124 | 124 | $sections['email-notification-settings'] = array( |
| 125 | - 'name' => __( 'Email Notifications', 'woothemes-sensei' ), |
|
| 126 | - 'description' => __( 'Settings for email notifications sent from your site.', 'woothemes-sensei' ) |
|
| 125 | + 'name' => __('Email Notifications', 'woothemes-sensei'), |
|
| 126 | + 'description' => __('Settings for email notifications sent from your site.', 'woothemes-sensei') |
|
| 127 | 127 | ); |
| 128 | 128 | |
| 129 | 129 | $sections['learner-profile-settings'] = array( |
| 130 | - 'name' => __( 'Learner Profiles', 'woothemes-sensei' ), |
|
| 131 | - 'description' => __( 'Settings for public Learner Profiles.', 'woothemes-sensei' ) |
|
| 130 | + 'name' => __('Learner Profiles', 'woothemes-sensei'), |
|
| 131 | + 'description' => __('Settings for public Learner Profiles.', 'woothemes-sensei') |
|
| 132 | 132 | ); |
| 133 | 133 | |
| 134 | - if ( Sensei_WC::is_woocommerce_present() ) { |
|
| 134 | + if (Sensei_WC::is_woocommerce_present()) { |
|
| 135 | 135 | $sections['woocommerce-settings'] = array( |
| 136 | - 'name' => __( 'WooCommerce', 'woothemes-sensei' ), |
|
| 137 | - 'description' => __( 'Optional settings for WooCommerce functions.', 'woothemes-sensei' ) |
|
| 136 | + 'name' => __('WooCommerce', 'woothemes-sensei'), |
|
| 137 | + 'description' => __('Optional settings for WooCommerce functions.', 'woothemes-sensei') |
|
| 138 | 138 | ); |
| 139 | 139 | } // End If Statement |
| 140 | 140 | |
| 141 | - if ( 'en_US' !== get_locale() ) { |
|
| 141 | + if ('en_US' !== get_locale()) { |
|
| 142 | 142 | $sections['language-settings'] = array( |
| 143 | - 'name' => __( 'Language', 'woothemes-sensei' ), |
|
| 144 | - 'description' => __( 'Language options.', 'woothemes-sensei' ) |
|
| 143 | + 'name' => __('Language', 'woothemes-sensei'), |
|
| 144 | + 'description' => __('Language options.', 'woothemes-sensei') |
|
| 145 | 145 | ); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $this->sections = apply_filters( 'sensei_settings_tabs', $sections ); |
|
| 148 | + $this->sections = apply_filters('sensei_settings_tabs', $sections); |
|
| 149 | 149 | } // End init_sections() |
| 150 | 150 | |
| 151 | 151 | /** |
@@ -155,71 +155,71 @@ discard block |
||
| 155 | 155 | * @uses Sensei_Utils::get_slider_types() |
| 156 | 156 | * @return void |
| 157 | 157 | */ |
| 158 | - public function init_fields () { |
|
| 158 | + public function init_fields() { |
|
| 159 | 159 | global $pagenow; |
| 160 | 160 | |
| 161 | 161 | $pages_array = $this->pages_array(); |
| 162 | - $posts_per_page_array = array( '0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20' ); |
|
| 163 | - $complete_settings = array( 'passed' => __( 'Once all the course lessons have been completed', 'woothemes-sensei' ), 'complete' => __( 'At any time (by clicking the \'Complete Course\' button)', 'woothemes-sensei' ) ); |
|
| 164 | - $course_display_settings = array( 'excerpt' => __( 'Course Excerpt', 'woothemes-sensei' ), 'full' => __( 'Full Course Content', 'woothemes-sensei' ) ); |
|
| 162 | + $posts_per_page_array = array('0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20'); |
|
| 163 | + $complete_settings = array('passed' => __('Once all the course lessons have been completed', 'woothemes-sensei'), 'complete' => __('At any time (by clicking the \'Complete Course\' button)', 'woothemes-sensei')); |
|
| 164 | + $course_display_settings = array('excerpt' => __('Course Excerpt', 'woothemes-sensei'), 'full' => __('Full Course Content', 'woothemes-sensei')); |
|
| 165 | 165 | |
| 166 | 166 | $fields = array(); |
| 167 | 167 | |
| 168 | 168 | $fields['access_permission'] = array( |
| 169 | - 'name' => __( 'Access Permissions', 'woothemes-sensei' ), |
|
| 170 | - 'description' => __( 'Users must be logged in to view Course and Lesson content.', 'woothemes-sensei', 'woothemes-sensei' ), |
|
| 169 | + 'name' => __('Access Permissions', 'woothemes-sensei'), |
|
| 170 | + 'description' => __('Users must be logged in to view Course and Lesson content.', 'woothemes-sensei', 'woothemes-sensei'), |
|
| 171 | 171 | 'type' => 'checkbox', |
| 172 | 172 | 'default' => true, |
| 173 | 173 | 'section' => 'default-settings' |
| 174 | 174 | ); |
| 175 | 175 | |
| 176 | 176 | $fields['messages_disable'] = array( |
| 177 | - 'name' => __( 'Disable Private Messages', 'woothemes-sensei' ), |
|
| 178 | - 'description' => __( 'Disable the private message functions between learners and teachers.', 'woothemes-sensei' ), |
|
| 177 | + 'name' => __('Disable Private Messages', 'woothemes-sensei'), |
|
| 178 | + 'description' => __('Disable the private message functions between learners and teachers.', 'woothemes-sensei'), |
|
| 179 | 179 | 'type' => 'checkbox', |
| 180 | 180 | 'default' => false, |
| 181 | 181 | 'section' => 'default-settings' |
| 182 | 182 | ); |
| 183 | 183 | |
| 184 | 184 | $fields['course_page'] = array( |
| 185 | - 'name' => __( 'Course Archive Page', 'woothemes-sensei' ), |
|
| 186 | - 'description' => __( 'The page to use to display courses. If you leave this blank the default custom post type archive will apply.', 'woothemes-sensei' ), |
|
| 185 | + 'name' => __('Course Archive Page', 'woothemes-sensei'), |
|
| 186 | + 'description' => __('The page to use to display courses. If you leave this blank the default custom post type archive will apply.', 'woothemes-sensei'), |
|
| 187 | 187 | 'type' => 'select', |
| 188 | - 'default' => get_option( 'woothemes-sensei_courses_page_id', 0 ), |
|
| 188 | + 'default' => get_option('woothemes-sensei_courses_page_id', 0), |
|
| 189 | 189 | 'section' => 'default-settings', |
| 190 | 190 | 'required' => 0, |
| 191 | 191 | 'options' => $pages_array |
| 192 | 192 | ); |
| 193 | 193 | |
| 194 | 194 | $fields['my_course_page'] = array( |
| 195 | - 'name' => __( 'My Courses Page', 'woothemes-sensei' ), |
|
| 196 | - 'description' => __( 'The page to use to display the courses that a user is currently taking as well as the courses a user has complete.', 'woothemes-sensei' ), |
|
| 195 | + 'name' => __('My Courses Page', 'woothemes-sensei'), |
|
| 196 | + 'description' => __('The page to use to display the courses that a user is currently taking as well as the courses a user has complete.', 'woothemes-sensei'), |
|
| 197 | 197 | 'type' => 'select', |
| 198 | - 'default' => get_option( 'woothemes-sensei_user_dashboard_page_id', 0 ), |
|
| 198 | + 'default' => get_option('woothemes-sensei_user_dashboard_page_id', 0), |
|
| 199 | 199 | 'section' => 'default-settings', |
| 200 | 200 | 'required' => 0, |
| 201 | 201 | 'options' => $pages_array |
| 202 | 202 | ); |
| 203 | 203 | |
| 204 | 204 | $fields['placeholder_images_enable'] = array( |
| 205 | - 'name' => __( 'Use placeholder images', 'woothemes-sensei' ), |
|
| 206 | - 'description' => __( 'Output a placeholder image when no featured image has been specified for Courses and Lessons.', 'woothemes-sensei' ), |
|
| 205 | + 'name' => __('Use placeholder images', 'woothemes-sensei'), |
|
| 206 | + 'description' => __('Output a placeholder image when no featured image has been specified for Courses and Lessons.', 'woothemes-sensei'), |
|
| 207 | 207 | 'type' => 'checkbox', |
| 208 | 208 | 'default' => false, |
| 209 | 209 | 'section' => 'default-settings' |
| 210 | 210 | ); |
| 211 | 211 | |
| 212 | 212 | $fields['styles_disable'] = array( |
| 213 | - 'name' => __( 'Disable Sensei Styles', 'woothemes-sensei' ), |
|
| 214 | - 'description' => __( 'Prevent the frontend stylesheets from loading. This will remove the default styles for all Sensei elements.', 'woothemes-sensei' ), |
|
| 213 | + 'name' => __('Disable Sensei Styles', 'woothemes-sensei'), |
|
| 214 | + 'description' => __('Prevent the frontend stylesheets from loading. This will remove the default styles for all Sensei elements.', 'woothemes-sensei'), |
|
| 215 | 215 | 'type' => 'checkbox', |
| 216 | 216 | 'default' => false, |
| 217 | 217 | 'section' => 'default-settings' |
| 218 | 218 | ); |
| 219 | 219 | |
| 220 | 220 | $fields['js_disable'] = array( |
| 221 | - 'name' => __( 'Disable Sensei Javascript', 'woothemes-sensei' ), |
|
| 222 | - 'description' => __( 'Prevent the frontend javascript from loading. This affects the progress bars and the My Courses tabs.', 'woothemes-sensei' ), |
|
| 221 | + 'name' => __('Disable Sensei Javascript', 'woothemes-sensei'), |
|
| 222 | + 'description' => __('Prevent the frontend javascript from loading. This affects the progress bars and the My Courses tabs.', 'woothemes-sensei'), |
|
| 223 | 223 | 'type' => 'checkbox', |
| 224 | 224 | 'default' => false, |
| 225 | 225 | 'section' => 'default-settings' |
@@ -228,8 +228,8 @@ discard block |
||
| 228 | 228 | // Course Settings |
| 229 | 229 | |
| 230 | 230 | $fields['course_completion'] = array( |
| 231 | - 'name' => __( 'Courses are complete:', 'woothemes-sensei' ), |
|
| 232 | - 'description' => __( 'This will determine when courses are marked as complete.', 'woothemes-sensei' ), |
|
| 231 | + 'name' => __('Courses are complete:', 'woothemes-sensei'), |
|
| 232 | + 'description' => __('This will determine when courses are marked as complete.', 'woothemes-sensei'), |
|
| 233 | 233 | 'type' => 'select', |
| 234 | 234 | 'default' => 'passed', |
| 235 | 235 | 'section' => 'course-settings', |
@@ -238,16 +238,16 @@ discard block |
||
| 238 | 238 | ); |
| 239 | 239 | |
| 240 | 240 | $fields['course_author'] = array( |
| 241 | - 'name' => __( 'Display Course Author', 'woothemes-sensei' ), |
|
| 242 | - 'description' => __( 'Output the Course Author on Course archive and My Courses page.', 'woothemes-sensei' ), |
|
| 241 | + 'name' => __('Display Course Author', 'woothemes-sensei'), |
|
| 242 | + 'description' => __('Output the Course Author on Course archive and My Courses page.', 'woothemes-sensei'), |
|
| 243 | 243 | 'type' => 'checkbox', |
| 244 | 244 | 'default' => true, |
| 245 | 245 | 'section' => 'course-settings' |
| 246 | 246 | ); |
| 247 | 247 | |
| 248 | 248 | $fields['my_course_amount'] = array( |
| 249 | - 'name' => __( 'My Courses Pagination', 'woothemes-sensei' ), |
|
| 250 | - 'description' => __( 'The number of courses to output for the my courses page.', 'woothemes-sensei' ), |
|
| 249 | + 'name' => __('My Courses Pagination', 'woothemes-sensei'), |
|
| 250 | + 'description' => __('The number of courses to output for the my courses page.', 'woothemes-sensei'), |
|
| 251 | 251 | 'type' => 'range', |
| 252 | 252 | 'default' => '0', |
| 253 | 253 | 'section' => 'course-settings', |
@@ -256,16 +256,16 @@ discard block |
||
| 256 | 256 | ); |
| 257 | 257 | |
| 258 | 258 | $fields['course_archive_image_enable'] = array( |
| 259 | - 'name' => __( 'Course Archive Image', 'woothemes-sensei' ), |
|
| 260 | - 'description' => __( 'Output the Course Image on the Course Archive Page.', 'woothemes-sensei' ), |
|
| 259 | + 'name' => __('Course Archive Image', 'woothemes-sensei'), |
|
| 260 | + 'description' => __('Output the Course Image on the Course Archive Page.', 'woothemes-sensei'), |
|
| 261 | 261 | 'type' => 'checkbox', |
| 262 | 262 | 'default' => true, |
| 263 | 263 | 'section' => 'course-settings' |
| 264 | 264 | ); |
| 265 | 265 | |
| 266 | 266 | $fields['course_archive_image_width'] = array( |
| 267 | - 'name' => __( 'Image Width - Archive', 'woothemes-sensei' ), |
|
| 268 | - 'description' => __( 'The width in pixels of the featured image for the Course Archive page.', 'woothemes-sensei' ), |
|
| 267 | + 'name' => __('Image Width - Archive', 'woothemes-sensei'), |
|
| 268 | + 'description' => __('The width in pixels of the featured image for the Course Archive page.', 'woothemes-sensei'), |
|
| 269 | 269 | 'type' => 'text', |
| 270 | 270 | 'default' => '100', |
| 271 | 271 | 'section' => 'course-settings', |
@@ -273,8 +273,8 @@ discard block |
||
| 273 | 273 | ); |
| 274 | 274 | |
| 275 | 275 | $fields['course_archive_image_height'] = array( |
| 276 | - 'name' => __( 'Image Height - Archive', 'woothemes-sensei' ), |
|
| 277 | - 'description' => __( 'The height in pixels of the featured image for the Course Archive page.', 'woothemes-sensei' ), |
|
| 276 | + 'name' => __('Image Height - Archive', 'woothemes-sensei'), |
|
| 277 | + 'description' => __('The height in pixels of the featured image for the Course Archive page.', 'woothemes-sensei'), |
|
| 278 | 278 | 'type' => 'text', |
| 279 | 279 | 'default' => '100', |
| 280 | 280 | 'section' => 'course-settings', |
@@ -282,24 +282,24 @@ discard block |
||
| 282 | 282 | ); |
| 283 | 283 | |
| 284 | 284 | $fields['course_archive_image_hard_crop'] = array( |
| 285 | - 'name' => __( 'Image Hard Crop - Archive', 'woothemes-sensei' ), |
|
| 286 | - 'description' => sprintf( __( 'After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei' ), '<a href="' . esc_url( 'http://wordpress.org/extend/plugins/regenerate-thumbnails/' ) . '">', '</a>' ), |
|
| 285 | + 'name' => __('Image Hard Crop - Archive', 'woothemes-sensei'), |
|
| 286 | + 'description' => sprintf(__('After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei'), '<a href="'.esc_url('http://wordpress.org/extend/plugins/regenerate-thumbnails/').'">', '</a>'), |
|
| 287 | 287 | 'type' => 'checkbox', |
| 288 | 288 | 'default' => false, |
| 289 | 289 | 'section' => 'course-settings' |
| 290 | 290 | ); |
| 291 | 291 | |
| 292 | 292 | $fields['course_single_image_enable'] = array( |
| 293 | - 'name' => __( 'Single Course Image', 'woothemes-sensei' ), |
|
| 294 | - 'description' => __( 'Output the Course Image on the Single Course Page.', 'woothemes-sensei' ), |
|
| 293 | + 'name' => __('Single Course Image', 'woothemes-sensei'), |
|
| 294 | + 'description' => __('Output the Course Image on the Single Course Page.', 'woothemes-sensei'), |
|
| 295 | 295 | 'type' => 'checkbox', |
| 296 | 296 | 'default' => false, |
| 297 | 297 | 'section' => 'course-settings' |
| 298 | 298 | ); |
| 299 | 299 | |
| 300 | 300 | $fields['course_single_image_width'] = array( |
| 301 | - 'name' => __( 'Image Width - Single', 'woothemes-sensei' ), |
|
| 302 | - 'description' => __( 'The width in pixels of the featured image for the Course single post page.', 'woothemes-sensei' ), |
|
| 301 | + 'name' => __('Image Width - Single', 'woothemes-sensei'), |
|
| 302 | + 'description' => __('The width in pixels of the featured image for the Course single post page.', 'woothemes-sensei'), |
|
| 303 | 303 | 'type' => 'text', |
| 304 | 304 | 'default' => '100', |
| 305 | 305 | 'section' => 'course-settings', |
@@ -307,8 +307,8 @@ discard block |
||
| 307 | 307 | ); |
| 308 | 308 | |
| 309 | 309 | $fields['course_single_image_height'] = array( |
| 310 | - 'name' => __( 'Image Height - Single', 'woothemes-sensei' ), |
|
| 311 | - 'description' => __( 'The height in pixels of the featured image for the Course single post page.', 'woothemes-sensei' ), |
|
| 310 | + 'name' => __('Image Height - Single', 'woothemes-sensei'), |
|
| 311 | + 'description' => __('The height in pixels of the featured image for the Course single post page.', 'woothemes-sensei'), |
|
| 312 | 312 | 'type' => 'text', |
| 313 | 313 | 'default' => '100', |
| 314 | 314 | 'section' => 'course-settings', |
@@ -316,16 +316,16 @@ discard block |
||
| 316 | 316 | ); |
| 317 | 317 | |
| 318 | 318 | $fields['course_single_image_hard_crop'] = array( |
| 319 | - 'name' => __( 'Image Hard Crop - Single', 'woothemes-sensei' ), |
|
| 320 | - 'description' => sprintf( __( 'After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei' ), '<a href="' . esc_url( 'http://wordpress.org/extend/plugins/regenerate-thumbnails/' ) . '">', '</a>' ), |
|
| 319 | + 'name' => __('Image Hard Crop - Single', 'woothemes-sensei'), |
|
| 320 | + 'description' => sprintf(__('After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei'), '<a href="'.esc_url('http://wordpress.org/extend/plugins/regenerate-thumbnails/').'">', '</a>'), |
|
| 321 | 321 | 'type' => 'checkbox', |
| 322 | 322 | 'default' => false, |
| 323 | 323 | 'section' => 'course-settings' |
| 324 | 324 | ); |
| 325 | 325 | |
| 326 | 326 | $fields['course_single_content_display'] = array( |
| 327 | - 'name' => __( 'Single Course page displays:', 'woothemes-sensei' ), |
|
| 328 | - 'description' => __( 'Determines what content to display on the single course page.', 'woothemes-sensei' ), |
|
| 327 | + 'name' => __('Single Course page displays:', 'woothemes-sensei'), |
|
| 328 | + 'description' => __('Determines what content to display on the single course page.', 'woothemes-sensei'), |
|
| 329 | 329 | 'type' => 'select', |
| 330 | 330 | 'default' => 'excerpt', |
| 331 | 331 | 'section' => 'course-settings', |
@@ -334,18 +334,18 @@ discard block |
||
| 334 | 334 | ); |
| 335 | 335 | |
| 336 | 336 | $fields['course_archive_featured_enable'] = array( |
| 337 | - 'name' => __( 'Featured Courses Panel', 'woothemes-sensei' ), |
|
| 338 | - 'description' => __( 'Output the Featured Courses Panel on the Course Archive Page.', 'woothemes-sensei' ), |
|
| 337 | + 'name' => __('Featured Courses Panel', 'woothemes-sensei'), |
|
| 338 | + 'description' => __('Output the Featured Courses Panel on the Course Archive Page.', 'woothemes-sensei'), |
|
| 339 | 339 | 'type' => 'checkbox', |
| 340 | 340 | 'default' => true, |
| 341 | 341 | 'section' => 'course-settings' |
| 342 | 342 | ); |
| 343 | 343 | |
| 344 | 344 | $fields['course_archive_more_link_text'] = array( |
| 345 | - 'name' => __( 'More link text', 'woothemes-sensei' ), |
|
| 346 | - 'description' => __( 'The text that will be displayed on the Course Archive for the more courses link.', 'woothemes-sensei' ), |
|
| 345 | + 'name' => __('More link text', 'woothemes-sensei'), |
|
| 346 | + 'description' => __('The text that will be displayed on the Course Archive for the more courses link.', 'woothemes-sensei'), |
|
| 347 | 347 | 'type' => 'text', |
| 348 | - 'default' => __ ( 'More', 'woothemes-sensei' ), |
|
| 348 | + 'default' => __('More', 'woothemes-sensei'), |
|
| 349 | 349 | 'section' => 'course-settings', |
| 350 | 350 | 'required' => 0 |
| 351 | 351 | ); |
@@ -353,32 +353,32 @@ discard block |
||
| 353 | 353 | // Lesson Settings |
| 354 | 354 | |
| 355 | 355 | $fields['lesson_comments'] = array( |
| 356 | - 'name' => __( 'Allow Comments for Lessons', 'woothemes-sensei' ), |
|
| 357 | - 'description' => __( 'This will allow learners to post comments on the single Lesson page, only learner who have access to the Lesson will be allowed to comment.', 'woothemes-sensei' ), |
|
| 356 | + 'name' => __('Allow Comments for Lessons', 'woothemes-sensei'), |
|
| 357 | + 'description' => __('This will allow learners to post comments on the single Lesson page, only learner who have access to the Lesson will be allowed to comment.', 'woothemes-sensei'), |
|
| 358 | 358 | 'type' => 'checkbox', |
| 359 | 359 | 'default' => true, |
| 360 | 360 | 'section' => 'lesson-settings' |
| 361 | 361 | ); |
| 362 | 362 | |
| 363 | 363 | $fields['lesson_author'] = array( |
| 364 | - 'name' => __( 'Display Lesson Author', 'woothemes-sensei' ), |
|
| 365 | - 'description' => __( 'Output the Lesson Author on Course single page & Lesson archive page.', 'woothemes-sensei' ), |
|
| 364 | + 'name' => __('Display Lesson Author', 'woothemes-sensei'), |
|
| 365 | + 'description' => __('Output the Lesson Author on Course single page & Lesson archive page.', 'woothemes-sensei'), |
|
| 366 | 366 | 'type' => 'checkbox', |
| 367 | 367 | 'default' => true, |
| 368 | 368 | 'section' => 'lesson-settings' |
| 369 | 369 | ); |
| 370 | 370 | |
| 371 | 371 | $fields['course_lesson_image_enable'] = array( |
| 372 | - 'name' => __( 'Course Lesson Images', 'woothemes-sensei' ), |
|
| 373 | - 'description' => __( 'Output the Lesson Image on the Single Course Page.', 'woothemes-sensei' ), |
|
| 372 | + 'name' => __('Course Lesson Images', 'woothemes-sensei'), |
|
| 373 | + 'description' => __('Output the Lesson Image on the Single Course Page.', 'woothemes-sensei'), |
|
| 374 | 374 | 'type' => 'checkbox', |
| 375 | 375 | 'default' => false, |
| 376 | 376 | 'section' => 'lesson-settings' |
| 377 | 377 | ); |
| 378 | 378 | |
| 379 | 379 | $fields['lesson_archive_image_width'] = array( |
| 380 | - 'name' => __( 'Image Width - Course Lessons', 'woothemes-sensei' ), |
|
| 381 | - 'description' => __( 'The width in pixels of the featured image for the Lessons on the Course Single page.', 'woothemes-sensei' ), |
|
| 380 | + 'name' => __('Image Width - Course Lessons', 'woothemes-sensei'), |
|
| 381 | + 'description' => __('The width in pixels of the featured image for the Lessons on the Course Single page.', 'woothemes-sensei'), |
|
| 382 | 382 | 'type' => 'text', |
| 383 | 383 | 'default' => '100', |
| 384 | 384 | 'section' => 'lesson-settings', |
@@ -386,8 +386,8 @@ discard block |
||
| 386 | 386 | ); |
| 387 | 387 | |
| 388 | 388 | $fields['lesson_archive_image_height'] = array( |
| 389 | - 'name' => __( 'Image Height - Course Lessons', 'woothemes-sensei' ), |
|
| 390 | - 'description' => __( 'The height in pixels of the featured image for the Lessons on the Course Single page.', 'woothemes-sensei' ), |
|
| 389 | + 'name' => __('Image Height - Course Lessons', 'woothemes-sensei'), |
|
| 390 | + 'description' => __('The height in pixels of the featured image for the Lessons on the Course Single page.', 'woothemes-sensei'), |
|
| 391 | 391 | 'type' => 'text', |
| 392 | 392 | 'default' => '100', |
| 393 | 393 | 'section' => 'lesson-settings', |
@@ -395,24 +395,24 @@ discard block |
||
| 395 | 395 | ); |
| 396 | 396 | |
| 397 | 397 | $fields['lesson_archive_image_hard_crop'] = array( |
| 398 | - 'name' => __( 'Image Hard Crop - Course Lessons', 'woothemes-sensei' ), |
|
| 399 | - 'description' => sprintf( __( 'After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei' ), '<a href="' . esc_url( 'http://wordpress.org/extend/plugins/regenerate-thumbnails/' ) . '">', '</a>' ), |
|
| 398 | + 'name' => __('Image Hard Crop - Course Lessons', 'woothemes-sensei'), |
|
| 399 | + 'description' => sprintf(__('After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei'), '<a href="'.esc_url('http://wordpress.org/extend/plugins/regenerate-thumbnails/').'">', '</a>'), |
|
| 400 | 400 | 'type' => 'checkbox', |
| 401 | 401 | 'default' => false, |
| 402 | 402 | 'section' => 'lesson-settings' |
| 403 | 403 | ); |
| 404 | 404 | |
| 405 | 405 | $fields['lesson_single_image_enable'] = array( |
| 406 | - 'name' => __( 'Single Lesson Images', 'woothemes-sensei' ), |
|
| 407 | - 'description' => __( 'Output the Lesson Image on the Single Lesson Page.', 'woothemes-sensei' ), |
|
| 406 | + 'name' => __('Single Lesson Images', 'woothemes-sensei'), |
|
| 407 | + 'description' => __('Output the Lesson Image on the Single Lesson Page.', 'woothemes-sensei'), |
|
| 408 | 408 | 'type' => 'checkbox', |
| 409 | 409 | 'default' => false, |
| 410 | 410 | 'section' => 'lesson-settings' |
| 411 | 411 | ); |
| 412 | 412 | |
| 413 | 413 | $fields['lesson_single_image_width'] = array( |
| 414 | - 'name' => __( 'Image Width - Single', 'woothemes-sensei' ), |
|
| 415 | - 'description' => __( 'The width in pixels of the featured image for the Lessons single post page.', 'woothemes-sensei' ), |
|
| 414 | + 'name' => __('Image Width - Single', 'woothemes-sensei'), |
|
| 415 | + 'description' => __('The width in pixels of the featured image for the Lessons single post page.', 'woothemes-sensei'), |
|
| 416 | 416 | 'type' => 'text', |
| 417 | 417 | 'default' => '100', |
| 418 | 418 | 'section' => 'lesson-settings', |
@@ -420,8 +420,8 @@ discard block |
||
| 420 | 420 | ); |
| 421 | 421 | |
| 422 | 422 | $fields['lesson_single_image_height'] = array( |
| 423 | - 'name' => __( 'Image Height - Single', 'woothemes-sensei' ), |
|
| 424 | - 'description' => __( 'The height in pixels of the featured image for the Lessons single post page.', 'woothemes-sensei' ), |
|
| 423 | + 'name' => __('Image Height - Single', 'woothemes-sensei'), |
|
| 424 | + 'description' => __('The height in pixels of the featured image for the Lessons single post page.', 'woothemes-sensei'), |
|
| 425 | 425 | 'type' => 'text', |
| 426 | 426 | 'default' => '100', |
| 427 | 427 | 'section' => 'lesson-settings', |
@@ -429,8 +429,8 @@ discard block |
||
| 429 | 429 | ); |
| 430 | 430 | |
| 431 | 431 | $fields['lesson_single_image_hard_crop'] = array( |
| 432 | - 'name' => __( 'Image Hard Crop - Single', 'woothemes-sensei' ), |
|
| 433 | - 'description' => sprintf( __( 'After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei' ), '<a href="' . esc_url( 'http://wordpress.org/extend/plugins/regenerate-thumbnails/' ) . '">', '</a>' ), |
|
| 432 | + 'name' => __('Image Hard Crop - Single', 'woothemes-sensei'), |
|
| 433 | + 'description' => sprintf(__('After changing this setting, you may need to %1$sregenerate your thumbnails%2$s.', 'woothemes-sensei'), '<a href="'.esc_url('http://wordpress.org/extend/plugins/regenerate-thumbnails/').'">', '</a>'), |
|
| 434 | 434 | 'type' => 'checkbox', |
| 435 | 435 | 'default' => false, |
| 436 | 436 | 'section' => 'lesson-settings' |
@@ -438,20 +438,20 @@ discard block |
||
| 438 | 438 | |
| 439 | 439 | // Learner Profile settings |
| 440 | 440 | |
| 441 | - $profile_url_base = apply_filters( 'sensei_learner_profiles_url_base', __( 'learner', 'woothemes-sensei') ); |
|
| 442 | - $profile_url_example = trailingslashit( get_site_url() ) . $profile_url_base . '/%username%'; |
|
| 441 | + $profile_url_base = apply_filters('sensei_learner_profiles_url_base', __('learner', 'woothemes-sensei')); |
|
| 442 | + $profile_url_example = trailingslashit(get_site_url()).$profile_url_base.'/%username%'; |
|
| 443 | 443 | |
| 444 | 444 | $fields['learner_profile_enable'] = array( |
| 445 | - 'name' => __( 'Public learner profiles', 'woothemes-sensei' ), |
|
| 446 | - 'description' => sprintf( __( 'Enable public learner profiles that will be accessible to everyone. Profile URL format: %s', 'woothemes-sensei' ), $profile_url_example ), |
|
| 445 | + 'name' => __('Public learner profiles', 'woothemes-sensei'), |
|
| 446 | + 'description' => sprintf(__('Enable public learner profiles that will be accessible to everyone. Profile URL format: %s', 'woothemes-sensei'), $profile_url_example), |
|
| 447 | 447 | 'type' => 'checkbox', |
| 448 | 448 | 'default' => true, |
| 449 | 449 | 'section' => 'learner-profile-settings' |
| 450 | 450 | ); |
| 451 | 451 | |
| 452 | 452 | $fields['learner_profile_show_courses'] = array( |
| 453 | - 'name' => __( 'Show learner\'s courses', 'woothemes-sensei' ), |
|
| 454 | - 'description' => __( 'Display the learner\'s active and completed courses on their profile.', 'woothemes-sensei' ), |
|
| 453 | + 'name' => __('Show learner\'s courses', 'woothemes-sensei'), |
|
| 454 | + 'description' => __('Display the learner\'s active and completed courses on their profile.', 'woothemes-sensei'), |
|
| 455 | 455 | 'type' => 'checkbox', |
| 456 | 456 | 'default' => true, |
| 457 | 457 | 'section' => 'learner-profile-settings' |
@@ -460,70 +460,70 @@ discard block |
||
| 460 | 460 | // Email notifications |
| 461 | 461 | |
| 462 | 462 | $learner_email_options = array( |
| 463 | - 'learner-graded-quiz' => __( 'Their quiz is graded (auto and manual grading)', 'woothemes-sensei' ), |
|
| 464 | - 'learner-completed-course' => __( 'They complete a course', 'woothemes-sensei' ), |
|
| 463 | + 'learner-graded-quiz' => __('Their quiz is graded (auto and manual grading)', 'woothemes-sensei'), |
|
| 464 | + 'learner-completed-course' => __('They complete a course', 'woothemes-sensei'), |
|
| 465 | 465 | ); |
| 466 | 466 | |
| 467 | 467 | $teacher_email_options = array( |
| 468 | - 'teacher-started-course' => __( 'A learner starts their course', 'woothemes-sensei' ), |
|
| 469 | - 'teacher-completed-course' => __( 'A learner completes their course', 'woothemes-sensei' ), |
|
| 470 | - 'teacher-completed-lesson' => __( 'A learner completes a lesson', 'woothemes-sensei' ), |
|
| 471 | - 'teacher-quiz-submitted' => __( 'A learner submits a quiz for grading', 'woothemes-sensei' ), |
|
| 472 | - 'teacher-new-message' => __( 'A learner sends a private message to a teacher', 'woothemes-sensei' ), |
|
| 468 | + 'teacher-started-course' => __('A learner starts their course', 'woothemes-sensei'), |
|
| 469 | + 'teacher-completed-course' => __('A learner completes their course', 'woothemes-sensei'), |
|
| 470 | + 'teacher-completed-lesson' => __('A learner completes a lesson', 'woothemes-sensei'), |
|
| 471 | + 'teacher-quiz-submitted' => __('A learner submits a quiz for grading', 'woothemes-sensei'), |
|
| 472 | + 'teacher-new-message' => __('A learner sends a private message to a teacher', 'woothemes-sensei'), |
|
| 473 | 473 | ); |
| 474 | 474 | |
| 475 | 475 | $global_email_options = array( |
| 476 | - 'new-message-reply' => __( 'They receive a reply to their private message', 'woothemes-sensei' ), |
|
| 476 | + 'new-message-reply' => __('They receive a reply to their private message', 'woothemes-sensei'), |
|
| 477 | 477 | ); |
| 478 | 478 | |
| 479 | 479 | $fields['email_learners'] = array( |
| 480 | - 'name' => __( 'Emails Sent to Learners', 'woothemes-sensei' ), |
|
| 481 | - 'description' => __( 'Select the notifications that will be sent to learners.', 'woothemes-sensei' ), |
|
| 480 | + 'name' => __('Emails Sent to Learners', 'woothemes-sensei'), |
|
| 481 | + 'description' => __('Select the notifications that will be sent to learners.', 'woothemes-sensei'), |
|
| 482 | 482 | 'type' => 'multicheck', |
| 483 | 483 | 'options' => $learner_email_options, |
| 484 | - 'defaults' => array( 'learner-graded-quiz', 'learner-completed-course' ), |
|
| 484 | + 'defaults' => array('learner-graded-quiz', 'learner-completed-course'), |
|
| 485 | 485 | 'section' => 'email-notification-settings' |
| 486 | 486 | ); |
| 487 | 487 | |
| 488 | 488 | $fields['email_teachers'] = array( |
| 489 | - 'name' => __( 'Emails Sent to Teachers', 'woothemes-sensei' ), |
|
| 490 | - 'description' => __( 'Select the notifications that will be sent to teachers.', 'woothemes-sensei' ), |
|
| 489 | + 'name' => __('Emails Sent to Teachers', 'woothemes-sensei'), |
|
| 490 | + 'description' => __('Select the notifications that will be sent to teachers.', 'woothemes-sensei'), |
|
| 491 | 491 | 'type' => 'multicheck', |
| 492 | 492 | 'options' => $teacher_email_options, |
| 493 | - 'defaults' => array( 'teacher-completed-course', 'teacher-started-course', 'teacher-quiz-submitted', 'teacher-new-message' ), |
|
| 493 | + 'defaults' => array('teacher-completed-course', 'teacher-started-course', 'teacher-quiz-submitted', 'teacher-new-message'), |
|
| 494 | 494 | 'section' => 'email-notification-settings' |
| 495 | 495 | ); |
| 496 | 496 | |
| 497 | 497 | $fields['email_global'] = array( |
| 498 | - 'name' => __( 'Emails Sent to All Users', 'woothemes-sensei' ), |
|
| 499 | - 'description' => __( 'Select the notifications that will be sent to all users.', 'woothemes-sensei' ), |
|
| 498 | + 'name' => __('Emails Sent to All Users', 'woothemes-sensei'), |
|
| 499 | + 'description' => __('Select the notifications that will be sent to all users.', 'woothemes-sensei'), |
|
| 500 | 500 | 'type' => 'multicheck', |
| 501 | 501 | 'options' => $global_email_options, |
| 502 | - 'defaults' => array( 'new-message-reply' ), |
|
| 502 | + 'defaults' => array('new-message-reply'), |
|
| 503 | 503 | 'section' => 'email-notification-settings' |
| 504 | 504 | ); |
| 505 | 505 | |
| 506 | 506 | $fields['email_from_name'] = array( |
| 507 | - 'name' => __( '"From" Name', 'woothemes-sensei' ), |
|
| 508 | - 'description' => __( 'The name from which all emails will be sent.', 'woothemes-sensei' ), |
|
| 507 | + 'name' => __('"From" Name', 'woothemes-sensei'), |
|
| 508 | + 'description' => __('The name from which all emails will be sent.', 'woothemes-sensei'), |
|
| 509 | 509 | 'type' => 'text', |
| 510 | - 'default' => get_bloginfo( 'name' ), |
|
| 510 | + 'default' => get_bloginfo('name'), |
|
| 511 | 511 | 'section' => 'email-notification-settings', |
| 512 | 512 | 'required' => 1 |
| 513 | 513 | ); |
| 514 | 514 | |
| 515 | 515 | $fields['email_from_address'] = array( |
| 516 | - 'name' => __( '"From" Address', 'woothemes-sensei' ), |
|
| 517 | - 'description' => __( 'The address from which all emails will be sent.', 'woothemes-sensei' ), |
|
| 516 | + 'name' => __('"From" Address', 'woothemes-sensei'), |
|
| 517 | + 'description' => __('The address from which all emails will be sent.', 'woothemes-sensei'), |
|
| 518 | 518 | 'type' => 'text', |
| 519 | - 'default' => get_bloginfo( 'admin_email' ), |
|
| 519 | + 'default' => get_bloginfo('admin_email'), |
|
| 520 | 520 | 'section' => 'email-notification-settings', |
| 521 | 521 | 'required' => 1 |
| 522 | 522 | ); |
| 523 | 523 | |
| 524 | 524 | $fields['email_header_image'] = array( |
| 525 | - 'name' => __( 'Header Image', 'woothemes-sensei' ), |
|
| 526 | - 'description' => sprintf( __( 'Enter a URL to an image you want to show in the email\'s header. Upload your image using the %1$smedia uploader%2$s.', 'woothemes-sensei' ), '<a href="' . admin_url( 'media-new.php' ) . '">', '</a>' ), |
|
| 525 | + 'name' => __('Header Image', 'woothemes-sensei'), |
|
| 526 | + 'description' => sprintf(__('Enter a URL to an image you want to show in the email\'s header. Upload your image using the %1$smedia uploader%2$s.', 'woothemes-sensei'), '<a href="'.admin_url('media-new.php').'">', '</a>'), |
|
| 527 | 527 | 'type' => 'text', |
| 528 | 528 | 'default' => '', |
| 529 | 529 | 'section' => 'email-notification-settings', |
@@ -531,17 +531,17 @@ discard block |
||
| 531 | 531 | ); |
| 532 | 532 | |
| 533 | 533 | $fields['email_footer_text'] = array( |
| 534 | - 'name' => __( 'Email Footer Text', 'woothemes-sensei' ), |
|
| 535 | - 'description' => __( 'The text to appear in the footer of Sensei emails.', 'woothemes-sensei' ), |
|
| 534 | + 'name' => __('Email Footer Text', 'woothemes-sensei'), |
|
| 535 | + 'description' => __('The text to appear in the footer of Sensei emails.', 'woothemes-sensei'), |
|
| 536 | 536 | 'type' => 'textarea', |
| 537 | - 'default' => sprintf( __( '%1$s - Powered by Sensei', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), |
|
| 537 | + 'default' => sprintf(__('%1$s - Powered by Sensei', 'woothemes-sensei'), get_bloginfo('name')), |
|
| 538 | 538 | 'section' => 'email-notification-settings', |
| 539 | 539 | 'required' => 0 |
| 540 | 540 | ); |
| 541 | 541 | |
| 542 | 542 | $fields['email_base_color'] = array( |
| 543 | - 'name' => __( 'Base Colour', 'woothemes-sensei' ), |
|
| 544 | - 'description' => sprintf( __( 'The base colour for Sensei email templates. Default %1$s#557da1%2$s.', 'woothemes-sensei' ), '<code>', '</code>' ), |
|
| 543 | + 'name' => __('Base Colour', 'woothemes-sensei'), |
|
| 544 | + 'description' => sprintf(__('The base colour for Sensei email templates. Default %1$s#557da1%2$s.', 'woothemes-sensei'), '<code>', '</code>'), |
|
| 545 | 545 | 'type' => 'color', |
| 546 | 546 | 'default' => '#557da1', |
| 547 | 547 | 'section' => 'email-notification-settings', |
@@ -549,8 +549,8 @@ discard block |
||
| 549 | 549 | ); |
| 550 | 550 | |
| 551 | 551 | $fields['email_background_color'] = array( |
| 552 | - 'name' => __( 'Background Colour', 'woothemes-sensei' ), |
|
| 553 | - 'description' => sprintf( __( 'The background colour for Sensei email templates. Default %1$s#f5f5f5%2$s.', 'woothemes-sensei' ), '<code>', '</code>' ), |
|
| 552 | + 'name' => __('Background Colour', 'woothemes-sensei'), |
|
| 553 | + 'description' => sprintf(__('The background colour for Sensei email templates. Default %1$s#f5f5f5%2$s.', 'woothemes-sensei'), '<code>', '</code>'), |
|
| 554 | 554 | 'type' => 'color', |
| 555 | 555 | 'default' => '#f5f5f5', |
| 556 | 556 | 'section' => 'email-notification-settings', |
@@ -558,8 +558,8 @@ discard block |
||
| 558 | 558 | ); |
| 559 | 559 | |
| 560 | 560 | $fields['email_body_background_color'] = array( |
| 561 | - 'name' => __( 'Body Background Colour', 'woothemes-sensei' ), |
|
| 562 | - 'description' => sprintf( __( 'The main body background colour for Sensei email templates. Default %1$s#fdfdfd%2$s.', 'woothemes-sensei' ), '<code>', '</code>' ), |
|
| 561 | + 'name' => __('Body Background Colour', 'woothemes-sensei'), |
|
| 562 | + 'description' => sprintf(__('The main body background colour for Sensei email templates. Default %1$s#fdfdfd%2$s.', 'woothemes-sensei'), '<code>', '</code>'), |
|
| 563 | 563 | 'type' => 'color', |
| 564 | 564 | 'default' => '#fdfdfd', |
| 565 | 565 | 'section' => 'email-notification-settings', |
@@ -567,35 +567,35 @@ discard block |
||
| 567 | 567 | ); |
| 568 | 568 | |
| 569 | 569 | $fields['email_text_color'] = array( |
| 570 | - 'name' => __( 'Body Text Colour', 'woothemes-sensei' ), |
|
| 571 | - 'description' => sprintf( __( 'The main body text colour for Sensei email templates. Default %1$s#505050%2$s.', 'woothemes-sensei' ), '<code>', '</code>' ), |
|
| 570 | + 'name' => __('Body Text Colour', 'woothemes-sensei'), |
|
| 571 | + 'description' => sprintf(__('The main body text colour for Sensei email templates. Default %1$s#505050%2$s.', 'woothemes-sensei'), '<code>', '</code>'), |
|
| 572 | 572 | 'type' => 'color', |
| 573 | 573 | 'default' => '#505050', |
| 574 | 574 | 'section' => 'email-notification-settings', |
| 575 | 575 | 'required' => 1 |
| 576 | 576 | ); |
| 577 | 577 | |
| 578 | - if ( Sensei_WC::is_woocommerce_present() ) { |
|
| 578 | + if (Sensei_WC::is_woocommerce_present()) { |
|
| 579 | 579 | // WooCommerce Settings |
| 580 | 580 | $fields['woocommerce_enabled'] = array( |
| 581 | - 'name' => __( 'Enable WooCommerce Courses', 'woothemes-sensei' ), |
|
| 582 | - 'description' => __( 'Use WooCommerce to sell Courses by linking a Product to a Course.', 'woothemes-sensei' ), |
|
| 581 | + 'name' => __('Enable WooCommerce Courses', 'woothemes-sensei'), |
|
| 582 | + 'description' => __('Use WooCommerce to sell Courses by linking a Product to a Course.', 'woothemes-sensei'), |
|
| 583 | 583 | 'type' => 'checkbox', |
| 584 | 584 | 'default' => true, |
| 585 | 585 | 'section' => 'woocommerce-settings' |
| 586 | 586 | ); |
| 587 | 587 | |
| 588 | 588 | $fields['course_archive_free_enable'] = array( |
| 589 | - 'name' => __( 'Free Courses Panel', 'woothemes-sensei' ), |
|
| 590 | - 'description' => __( 'Output the Free Courses Panel on the Course Archive Page.', 'woothemes-sensei' ), |
|
| 589 | + 'name' => __('Free Courses Panel', 'woothemes-sensei'), |
|
| 590 | + 'description' => __('Output the Free Courses Panel on the Course Archive Page.', 'woothemes-sensei'), |
|
| 591 | 591 | 'type' => 'checkbox', |
| 592 | 592 | 'default' => true, |
| 593 | 593 | 'section' => 'woocommerce-settings' |
| 594 | 594 | ); |
| 595 | 595 | |
| 596 | 596 | $fields['course_archive_paid_enable'] = array( |
| 597 | - 'name' => __( 'Paid Courses Panel', 'woothemes-sensei' ), |
|
| 598 | - 'description' => __( 'Output the Paid Courses Panel on the Course Archive Page.', 'woothemes-sensei' ), |
|
| 597 | + 'name' => __('Paid Courses Panel', 'woothemes-sensei'), |
|
| 598 | + 'description' => __('Output the Paid Courses Panel on the Course Archive Page.', 'woothemes-sensei'), |
|
| 599 | 599 | 'type' => 'checkbox', |
| 600 | 600 | 'default' => true, |
| 601 | 601 | 'section' => 'woocommerce-settings' |
@@ -603,18 +603,18 @@ discard block |
||
| 603 | 603 | |
| 604 | 604 | } // End If Statement |
| 605 | 605 | |
| 606 | - if ( 'en_US' !== get_locale() ) { |
|
| 606 | + if ('en_US' !== get_locale()) { |
|
| 607 | 607 | $fields['install_language_pack'] = array( |
| 608 | - 'name' => __( 'Install Language Pack', 'woothemes-sensei' ), |
|
| 609 | - 'description' => __( 'Use this action to install or re-install translation for your language if available.', 'woothemes-sensei' ), |
|
| 608 | + 'name' => __('Install Language Pack', 'woothemes-sensei'), |
|
| 609 | + 'description' => __('Use this action to install or re-install translation for your language if available.', 'woothemes-sensei'), |
|
| 610 | 610 | 'type' => 'button', |
| 611 | 611 | 'section' => 'language-settings', |
| 612 | 612 | 'target' => Sensei_Language_Pack_Manager::get_install_uri(), |
| 613 | - 'label' => __( 'Install', 'woothemes-sensei' ) |
|
| 613 | + 'label' => __('Install', 'woothemes-sensei') |
|
| 614 | 614 | ); |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | - $this->fields = apply_filters( 'sensei_settings_fields', $fields ); |
|
| 617 | + $this->fields = apply_filters('sensei_settings_fields', $fields); |
|
| 618 | 618 | |
| 619 | 619 | } // End init_fields() |
| 620 | 620 | |
@@ -624,20 +624,20 @@ discard block |
||
| 624 | 624 | * @param $include_milliseconds (default: true) Whether or not to include milliseconds between 0 and 1. |
| 625 | 625 | * @return array Options between 0.1 and 10 seconds. |
| 626 | 626 | */ |
| 627 | - private function get_duration_options ( $include_milliseconds = true ) { |
|
| 628 | - $numbers = array( '1.0', '1.5', '2.0', '2.5', '3.0', '3.5', '4.0', '4.5', '5.0', '5.5', '6.0', '6.5', '7.0', '7.5', '8.0', '8.5', '9.0', '9.5', '10.0' ); |
|
| 627 | + private function get_duration_options($include_milliseconds = true) { |
|
| 628 | + $numbers = array('1.0', '1.5', '2.0', '2.5', '3.0', '3.5', '4.0', '4.5', '5.0', '5.5', '6.0', '6.5', '7.0', '7.5', '8.0', '8.5', '9.0', '9.5', '10.0'); |
|
| 629 | 629 | $options = array(); |
| 630 | 630 | |
| 631 | - if ( true == (bool)$include_milliseconds ) { |
|
| 632 | - $milliseconds = array( '0.1', '0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9' ); |
|
| 633 | - foreach ( $milliseconds as $k => $v ) { |
|
| 631 | + if (true == (bool) $include_milliseconds) { |
|
| 632 | + $milliseconds = array('0.1', '0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9'); |
|
| 633 | + foreach ($milliseconds as $k => $v) { |
|
| 634 | 634 | $options[$v] = $v; |
| 635 | 635 | } |
| 636 | 636 | } else { |
| 637 | 637 | $options['0.5'] = '0.5'; |
| 638 | 638 | } |
| 639 | 639 | |
| 640 | - foreach ( $numbers as $k => $v ) { |
|
| 640 | + foreach ($numbers as $k => $v) { |
|
| 641 | 641 | $options[$v] = $v; |
| 642 | 642 | } |
| 643 | 643 | |
@@ -653,25 +653,25 @@ discard block |
||
| 653 | 653 | private function pages_array() { |
| 654 | 654 | // REFACTOR - Transform this into a field type instead. |
| 655 | 655 | // Setup an array of portfolio gallery terms for a dropdown. |
| 656 | - $args = array( 'echo' => 0, 'hierarchical' => 1, 'sort_column' => 'post_title', 'sort_order' => 'ASC' ); |
|
| 657 | - $pages_dropdown = wp_dropdown_pages( $args ); |
|
| 656 | + $args = array('echo' => 0, 'hierarchical' => 1, 'sort_column' => 'post_title', 'sort_order' => 'ASC'); |
|
| 657 | + $pages_dropdown = wp_dropdown_pages($args); |
|
| 658 | 658 | $page_items = array(); |
| 659 | 659 | |
| 660 | 660 | // Quick string hack to make sure we get the pages with the indents. |
| 661 | - $pages_dropdown = str_replace( "<select class='' name='page_id' id='page_id'>", '', $pages_dropdown ); |
|
| 662 | - $pages_dropdown = str_replace( '</select>', '', $pages_dropdown ); |
|
| 663 | - $pages_split = explode( '</option>', $pages_dropdown ); |
|
| 661 | + $pages_dropdown = str_replace("<select class='' name='page_id' id='page_id'>", '', $pages_dropdown); |
|
| 662 | + $pages_dropdown = str_replace('</select>', '', $pages_dropdown); |
|
| 663 | + $pages_split = explode('</option>', $pages_dropdown); |
|
| 664 | 664 | |
| 665 | - $page_items[] = __( 'Select a Page:', 'woothemes-sensei' ); |
|
| 665 | + $page_items[] = __('Select a Page:', 'woothemes-sensei'); |
|
| 666 | 666 | |
| 667 | - foreach ( $pages_split as $k => $v ) { |
|
| 667 | + foreach ($pages_split as $k => $v) { |
|
| 668 | 668 | $id = ''; |
| 669 | 669 | // Get the ID value. |
| 670 | - preg_match( '/value="(.*?)"/i', $v, $matches ); |
|
| 670 | + preg_match('/value="(.*?)"/i', $v, $matches); |
|
| 671 | 671 | |
| 672 | - if ( isset( $matches[1] ) ) { |
|
| 672 | + if (isset($matches[1])) { |
|
| 673 | 673 | $id = $matches[1]; |
| 674 | - $page_items[$id] = trim( strip_tags( $v ) ); |
|
| 674 | + $page_items[$id] = trim(strip_tags($v)); |
|
| 675 | 675 | } // End If Statement |
| 676 | 676 | } // End For Loop |
| 677 | 677 | |
@@ -695,10 +695,10 @@ discard block |
||
| 695 | 695 | * |
| 696 | 696 | * @since 1.9.0 |
| 697 | 697 | */ |
| 698 | - public static function flush_rewrite_rules(){ |
|
| 698 | + public static function flush_rewrite_rules() { |
|
| 699 | 699 | |
| 700 | - if ( isset( $_POST[ 'option_page' ] ) && 'woothemes-sensei-settings' == $_POST[ 'option_page' ] |
|
| 701 | - && isset( $_POST[ 'action' ] ) && 'update' == $_POST[ 'action' ] ) { |
|
| 700 | + if (isset($_POST['option_page']) && 'woothemes-sensei-settings' == $_POST['option_page'] |
|
| 701 | + && isset($_POST['action']) && 'update' == $_POST['action']) { |
|
| 702 | 702 | |
| 703 | 703 | Sensei()->initiate_rewrite_rules_flush(); |
| 704 | 704 | |
@@ -712,4 +712,4 @@ discard block |
||
| 712 | 712 | * @ignore only for backward compatibility |
| 713 | 713 | * @since 1.9.0 |
| 714 | 714 | */ |
| 715 | -class WooThemes_Sensei_Settings extends Sensei_Settings{} |
|
| 715 | +class WooThemes_Sensei_Settings extends Sensei_Settings {} |
|
@@ -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 Analysis User Profile List Table Class |
@@ -15,91 +15,91 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Sensei_Shortcode_User_Messages implements Sensei_Shortcode_Interface { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @var WP_Query |
|
| 20 | - * messages for the current user |
|
| 21 | - */ |
|
| 22 | - protected $messages_query; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * Setup the shortcode object |
|
| 26 | - * |
|
| 27 | - * @since 1.9.0 |
|
| 28 | - * @param array $attributes |
|
| 29 | - * @param string $content |
|
| 30 | - * @param string $shortcode the shortcode that was called for this instance |
|
| 31 | - */ |
|
| 32 | - public function __construct( $attributes, $content, $shortcode ){ |
|
| 33 | - |
|
| 34 | - $this->setup_messages_query(); |
|
| 35 | - |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * create the messages query . |
|
| 40 | - * |
|
| 41 | - * @return mixed |
|
| 42 | - */ |
|
| 43 | - public function setup_messages_query(){ |
|
| 44 | - |
|
| 45 | - $user = wp_get_current_user(); |
|
| 46 | - |
|
| 47 | - $args = array( |
|
| 48 | - 'post_type' => 'sensei_message', |
|
| 49 | - 'posts_per_page' => 500, |
|
| 50 | - 'orderby' => 'date', |
|
| 51 | - 'order' => 'DESC', |
|
| 52 | - 'post_status' => 'publish', |
|
| 53 | - 'meta_query' => array( |
|
| 54 | - array( |
|
| 55 | - 'key' => '_sender', |
|
| 56 | - 'value' => $user->user_login, |
|
| 57 | - 'compare' => '=', |
|
| 58 | - ), |
|
| 59 | - ), |
|
| 60 | - ); |
|
| 61 | - |
|
| 62 | - $this->messages_query = new WP_Query( $args ); |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * Rendering the shortcode this class is responsible for. |
|
| 67 | - * |
|
| 68 | - * @return string $content |
|
| 69 | - */ |
|
| 70 | - public function render(){ |
|
| 71 | - |
|
| 72 | - if( !is_user_logged_in() ){ |
|
| 73 | - |
|
| 74 | - Sensei()->notices->add_notice( __('Please login to view your messages.','woothemes-sensei') , 'alert' ); |
|
| 75 | - |
|
| 76 | - } elseif( 0 == $this->messages_query->post_count ){ |
|
| 77 | - |
|
| 78 | - Sensei()->notices->add_notice( __( 'You do not have any messages.', 'woothemes-sensei') , 'alert' ); |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - $messages_disabled_in_settings = ! ( ! isset( Sensei()->settings->settings['messages_disable'] ) |
|
| 82 | - || ! Sensei()->settings->settings['messages_disable'] ) ; |
|
| 83 | - |
|
| 84 | - // don't show anything if messages are disable |
|
| 85 | - if( $messages_disabled_in_settings ){ |
|
| 86 | - return ''; |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - //set the wp_query to the current messages query |
|
| 90 | - global $wp_query; |
|
| 91 | - $wp_query = $this->messages_query; |
|
| 92 | - |
|
| 93 | - ob_start(); |
|
| 94 | - Sensei()->notices->print_notices(); |
|
| 95 | - Sensei_Templates::get_part('loop', 'message'); |
|
| 96 | - $messages_html = ob_get_clean(); |
|
| 97 | - |
|
| 98 | - // set back the global query |
|
| 99 | - wp_reset_query(); |
|
| 100 | - |
|
| 101 | - return $messages_html; |
|
| 102 | - |
|
| 103 | - }// end render |
|
| 18 | + /** |
|
| 19 | + * @var WP_Query |
|
| 20 | + * messages for the current user |
|
| 21 | + */ |
|
| 22 | + protected $messages_query; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * Setup the shortcode object |
|
| 26 | + * |
|
| 27 | + * @since 1.9.0 |
|
| 28 | + * @param array $attributes |
|
| 29 | + * @param string $content |
|
| 30 | + * @param string $shortcode the shortcode that was called for this instance |
|
| 31 | + */ |
|
| 32 | + public function __construct( $attributes, $content, $shortcode ){ |
|
| 33 | + |
|
| 34 | + $this->setup_messages_query(); |
|
| 35 | + |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * create the messages query . |
|
| 40 | + * |
|
| 41 | + * @return mixed |
|
| 42 | + */ |
|
| 43 | + public function setup_messages_query(){ |
|
| 44 | + |
|
| 45 | + $user = wp_get_current_user(); |
|
| 46 | + |
|
| 47 | + $args = array( |
|
| 48 | + 'post_type' => 'sensei_message', |
|
| 49 | + 'posts_per_page' => 500, |
|
| 50 | + 'orderby' => 'date', |
|
| 51 | + 'order' => 'DESC', |
|
| 52 | + 'post_status' => 'publish', |
|
| 53 | + 'meta_query' => array( |
|
| 54 | + array( |
|
| 55 | + 'key' => '_sender', |
|
| 56 | + 'value' => $user->user_login, |
|
| 57 | + 'compare' => '=', |
|
| 58 | + ), |
|
| 59 | + ), |
|
| 60 | + ); |
|
| 61 | + |
|
| 62 | + $this->messages_query = new WP_Query( $args ); |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * Rendering the shortcode this class is responsible for. |
|
| 67 | + * |
|
| 68 | + * @return string $content |
|
| 69 | + */ |
|
| 70 | + public function render(){ |
|
| 71 | + |
|
| 72 | + if( !is_user_logged_in() ){ |
|
| 73 | + |
|
| 74 | + Sensei()->notices->add_notice( __('Please login to view your messages.','woothemes-sensei') , 'alert' ); |
|
| 75 | + |
|
| 76 | + } elseif( 0 == $this->messages_query->post_count ){ |
|
| 77 | + |
|
| 78 | + Sensei()->notices->add_notice( __( 'You do not have any messages.', 'woothemes-sensei') , 'alert' ); |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + $messages_disabled_in_settings = ! ( ! isset( Sensei()->settings->settings['messages_disable'] ) |
|
| 82 | + || ! Sensei()->settings->settings['messages_disable'] ) ; |
|
| 83 | + |
|
| 84 | + // don't show anything if messages are disable |
|
| 85 | + if( $messages_disabled_in_settings ){ |
|
| 86 | + return ''; |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + //set the wp_query to the current messages query |
|
| 90 | + global $wp_query; |
|
| 91 | + $wp_query = $this->messages_query; |
|
| 92 | + |
|
| 93 | + ob_start(); |
|
| 94 | + Sensei()->notices->print_notices(); |
|
| 95 | + Sensei_Templates::get_part('loop', 'message'); |
|
| 96 | + $messages_html = ob_get_clean(); |
|
| 97 | + |
|
| 98 | + // set back the global query |
|
| 99 | + wp_reset_query(); |
|
| 100 | + |
|
| 101 | + return $messages_html; |
|
| 102 | + |
|
| 103 | + }// end render |
|
| 104 | 104 | |
| 105 | 105 | }// end class |
| 106 | 106 | \ No newline at end of file |
@@ -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 | * Renders the [sensei_user_messages] shortcode. The current users messages. |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param string $content |
| 30 | 30 | * @param string $shortcode the shortcode that was called for this instance |
| 31 | 31 | */ |
| 32 | - public function __construct( $attributes, $content, $shortcode ){ |
|
| 32 | + public function __construct($attributes, $content, $shortcode) { |
|
| 33 | 33 | |
| 34 | 34 | $this->setup_messages_query(); |
| 35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @return mixed |
| 42 | 42 | */ |
| 43 | - public function setup_messages_query(){ |
|
| 43 | + public function setup_messages_query() { |
|
| 44 | 44 | |
| 45 | 45 | $user = wp_get_current_user(); |
| 46 | 46 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | ), |
| 60 | 60 | ); |
| 61 | 61 | |
| 62 | - $this->messages_query = new WP_Query( $args ); |
|
| 62 | + $this->messages_query = new WP_Query($args); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -67,22 +67,22 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @return string $content |
| 69 | 69 | */ |
| 70 | - public function render(){ |
|
| 70 | + public function render() { |
|
| 71 | 71 | |
| 72 | - if( !is_user_logged_in() ){ |
|
| 72 | + if ( ! is_user_logged_in()) { |
|
| 73 | 73 | |
| 74 | - Sensei()->notices->add_notice( __('Please login to view your messages.','woothemes-sensei') , 'alert' ); |
|
| 74 | + Sensei()->notices->add_notice(__('Please login to view your messages.', 'woothemes-sensei'), 'alert'); |
|
| 75 | 75 | |
| 76 | - } elseif( 0 == $this->messages_query->post_count ){ |
|
| 76 | + } elseif (0 == $this->messages_query->post_count) { |
|
| 77 | 77 | |
| 78 | - Sensei()->notices->add_notice( __( 'You do not have any messages.', 'woothemes-sensei') , 'alert' ); |
|
| 78 | + Sensei()->notices->add_notice(__('You do not have any messages.', 'woothemes-sensei'), 'alert'); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $messages_disabled_in_settings = ! ( ! isset( Sensei()->settings->settings['messages_disable'] ) |
|
| 82 | - || ! Sensei()->settings->settings['messages_disable'] ) ; |
|
| 81 | + $messages_disabled_in_settings = ! ( ! isset(Sensei()->settings->settings['messages_disable']) |
|
| 82 | + || ! Sensei()->settings->settings['messages_disable']); |
|
| 83 | 83 | |
| 84 | 84 | // don't show anything if messages are disable |
| 85 | - if( $messages_disabled_in_settings ){ |
|
| 85 | + if ($messages_disabled_in_settings) { |
|
| 86 | 86 | return ''; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -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 | /** |
| 5 | 8 | * Sensei Post Types Class |
@@ -146,7 +149,7 @@ discard block |
||
| 146 | 149 | |
| 147 | 150 | return get_page_uri( $settings_course_page->ID ); |
| 148 | 151 | |
| 149 | - }else{ |
|
| 152 | + } else{ |
|
| 150 | 153 | |
| 151 | 154 | return 'courses'; |
| 152 | 155 | |
@@ -14,148 +14,148 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class Sensei_Shortcode_Unpurchased_Courses implements Sensei_Shortcode_Interface { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * @var WP_Query to help setup the query needed by the render method. |
|
| 19 | - */ |
|
| 20 | - protected $query; |
|
| 21 | - |
|
| 22 | - /** |
|
| 23 | - * @var string number of items to show on the current page |
|
| 24 | - * Default: all. |
|
| 25 | - */ |
|
| 26 | - protected $number; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * @var string ordery by course field |
|
| 30 | - * Default: date |
|
| 31 | - */ |
|
| 32 | - protected $orderby; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * @var string ASC or DESC |
|
| 36 | - * Default: 'DESC' |
|
| 37 | - */ |
|
| 38 | - protected $order; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * Setup the shortcode object |
|
| 42 | - * |
|
| 43 | - * @since 1.9.0 |
|
| 44 | - * @param array $attributes |
|
| 45 | - * @param string $content |
|
| 46 | - * @param string $shortcode the shortcode that was called for this instance |
|
| 47 | - */ |
|
| 48 | - public function __construct( $attributes, $content, $shortcode ){ |
|
| 49 | - |
|
| 50 | - // set up all argument need for constructing the course query |
|
| 51 | - $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '10'; |
|
| 52 | - $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'title'; |
|
| 53 | - |
|
| 54 | - // set the default for menu_order to be ASC |
|
| 55 | - if( 'menu_order' == $this->orderby && !isset( $attributes['order'] ) ){ |
|
| 56 | - |
|
| 57 | - $this->order = 'ASC'; |
|
| 17 | + /** |
|
| 18 | + * @var WP_Query to help setup the query needed by the render method. |
|
| 19 | + */ |
|
| 20 | + protected $query; |
|
| 21 | + |
|
| 22 | + /** |
|
| 23 | + * @var string number of items to show on the current page |
|
| 24 | + * Default: all. |
|
| 25 | + */ |
|
| 26 | + protected $number; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * @var string ordery by course field |
|
| 30 | + * Default: date |
|
| 31 | + */ |
|
| 32 | + protected $orderby; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * @var string ASC or DESC |
|
| 36 | + * Default: 'DESC' |
|
| 37 | + */ |
|
| 38 | + protected $order; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * Setup the shortcode object |
|
| 42 | + * |
|
| 43 | + * @since 1.9.0 |
|
| 44 | + * @param array $attributes |
|
| 45 | + * @param string $content |
|
| 46 | + * @param string $shortcode the shortcode that was called for this instance |
|
| 47 | + */ |
|
| 48 | + public function __construct( $attributes, $content, $shortcode ){ |
|
| 49 | + |
|
| 50 | + // set up all argument need for constructing the course query |
|
| 51 | + $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '10'; |
|
| 52 | + $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'title'; |
|
| 53 | + |
|
| 54 | + // set the default for menu_order to be ASC |
|
| 55 | + if( 'menu_order' == $this->orderby && !isset( $attributes['order'] ) ){ |
|
| 56 | + |
|
| 57 | + $this->order = 'ASC'; |
|
| 58 | 58 | |
| 59 | - }else{ |
|
| 59 | + }else{ |
|
| 60 | 60 | |
| 61 | - // for everything else use the value passed or the default DESC |
|
| 62 | - $this->order = isset( $attributes['order'] ) ? $attributes['order'] : 'DESC'; |
|
| 61 | + // for everything else use the value passed or the default DESC |
|
| 62 | + $this->order = isset( $attributes['order'] ) ? $attributes['order'] : 'DESC'; |
|
| 63 | 63 | |
| 64 | - } |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - // setup the course query that will be used when rendering |
|
| 67 | - $this->setup_course_query(); |
|
| 68 | - } |
|
| 66 | + // setup the course query that will be used when rendering |
|
| 67 | + $this->setup_course_query(); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * Sets up the object course query |
|
| 72 | - * that will be used int he render method. |
|
| 73 | - * |
|
| 74 | - * @since 1.9.0 |
|
| 75 | - */ |
|
| 76 | - protected function setup_course_query(){ |
|
| 70 | + /** |
|
| 71 | + * Sets up the object course query |
|
| 72 | + * that will be used int he render method. |
|
| 73 | + * |
|
| 74 | + * @since 1.9.0 |
|
| 75 | + */ |
|
| 76 | + protected function setup_course_query(){ |
|
| 77 | 77 | |
| 78 | 78 | |
| 79 | - // course query parameters to be used for all courses |
|
| 80 | - $query_args = array( |
|
| 81 | - 'post_type' => 'course', |
|
| 82 | - 'post_status' => 'publish', |
|
| 83 | - // the number specified by the user will be used later in this function |
|
| 84 | - 'posts_per_page' => 1000, |
|
| 85 | - 'orderby' => $this->orderby, |
|
| 86 | - 'order' => $this->order |
|
| 87 | - ); |
|
| 79 | + // course query parameters to be used for all courses |
|
| 80 | + $query_args = array( |
|
| 81 | + 'post_type' => 'course', |
|
| 82 | + 'post_status' => 'publish', |
|
| 83 | + // the number specified by the user will be used later in this function |
|
| 84 | + 'posts_per_page' => 1000, |
|
| 85 | + 'orderby' => $this->orderby, |
|
| 86 | + 'order' => $this->order |
|
| 87 | + ); |
|
| 88 | 88 | |
| 89 | - // get all the courses that has a product attached |
|
| 90 | - $all_courses_query = new WP_Query( $query_args ); |
|
| 89 | + // get all the courses that has a product attached |
|
| 90 | + $all_courses_query = new WP_Query( $query_args ); |
|
| 91 | 91 | |
| 92 | - $paid_courses_not_taken = array(); |
|
| 93 | - // look through all course and find the purchasable ones that user has not purchased |
|
| 94 | - foreach( $all_courses_query->posts as $course ){ |
|
| 92 | + $paid_courses_not_taken = array(); |
|
| 93 | + // look through all course and find the purchasable ones that user has not purchased |
|
| 94 | + foreach( $all_courses_query->posts as $course ){ |
|
| 95 | 95 | |
| 96 | - // only keep the courses with a product including only courses that the user not taking |
|
| 97 | - $course_product_id = get_post_meta( $course->ID, '_course_woocommerce_product',true ); |
|
| 98 | - if( is_numeric( $course_product_id ) |
|
| 99 | - && |
|
| 100 | - ! Sensei_Utils::user_started_course( $course->ID , get_current_user_id() ) |
|
| 101 | - ){ |
|
| 96 | + // only keep the courses with a product including only courses that the user not taking |
|
| 97 | + $course_product_id = get_post_meta( $course->ID, '_course_woocommerce_product',true ); |
|
| 98 | + if( is_numeric( $course_product_id ) |
|
| 99 | + && |
|
| 100 | + ! Sensei_Utils::user_started_course( $course->ID , get_current_user_id() ) |
|
| 101 | + ){ |
|
| 102 | 102 | |
| 103 | - $paid_courses_not_taken[] = $course->ID; |
|
| 103 | + $paid_courses_not_taken[] = $course->ID; |
|
| 104 | 104 | |
| 105 | - } |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - } // end foreach |
|
| 107 | + } // end foreach |
|
| 108 | 108 | |
| 109 | - // setup the course query again and only use the course the user has not purchased. |
|
| 110 | - // this query will be loaded into the global WP_Query in the render function. |
|
| 111 | - $query_args[ 'post__in' ] = $paid_courses_not_taken; |
|
| 112 | - $query_args[ 'posts_per_page' ] = $this->number; |
|
| 109 | + // setup the course query again and only use the course the user has not purchased. |
|
| 110 | + // this query will be loaded into the global WP_Query in the render function. |
|
| 111 | + $query_args[ 'post__in' ] = $paid_courses_not_taken; |
|
| 112 | + $query_args[ 'posts_per_page' ] = $this->number; |
|
| 113 | 113 | |
| 114 | - $this->query = new WP_Query( $query_args ); |
|
| 114 | + $this->query = new WP_Query( $query_args ); |
|
| 115 | 115 | |
| 116 | - }// end setup _course_query |
|
| 116 | + }// end setup _course_query |
|
| 117 | 117 | |
| 118 | - /** |
|
| 119 | - * Rendering the shortcode this class is responsible for. |
|
| 120 | - * |
|
| 121 | - * @return string $content |
|
| 122 | - */ |
|
| 123 | - public function render(){ |
|
| 118 | + /** |
|
| 119 | + * Rendering the shortcode this class is responsible for. |
|
| 120 | + * |
|
| 121 | + * @return string $content |
|
| 122 | + */ |
|
| 123 | + public function render(){ |
|
| 124 | 124 | |
| 125 | - global $wp_query; |
|
| 125 | + global $wp_query; |
|
| 126 | 126 | |
| 127 | - if ( ! is_user_logged_in() ) { |
|
| 127 | + if ( ! is_user_logged_in() ) { |
|
| 128 | 128 | |
| 129 | - $anchor_before = '<a href="' . esc_url( sensei_user_login_url() ) . '" >'; |
|
| 130 | - $anchor_after = '</a>'; |
|
| 131 | - $notice = sprintf( |
|
| 132 | - __('You must be logged in to view the non-purchased courses. Click here to %slogin%s.'), |
|
| 133 | - $anchor_before, |
|
| 134 | - $anchor_after |
|
| 135 | - ); |
|
| 129 | + $anchor_before = '<a href="' . esc_url( sensei_user_login_url() ) . '" >'; |
|
| 130 | + $anchor_after = '</a>'; |
|
| 131 | + $notice = sprintf( |
|
| 132 | + __('You must be logged in to view the non-purchased courses. Click here to %slogin%s.'), |
|
| 133 | + $anchor_before, |
|
| 134 | + $anchor_after |
|
| 135 | + ); |
|
| 136 | 136 | |
| 137 | - Sensei()->notices->add_notice( $notice, 'info' ); |
|
| 138 | - Sensei()->notices->print_notices(); |
|
| 137 | + Sensei()->notices->add_notice( $notice, 'info' ); |
|
| 138 | + Sensei()->notices->print_notices(); |
|
| 139 | 139 | |
| 140 | - return ''; |
|
| 140 | + return ''; |
|
| 141 | 141 | |
| 142 | - } |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - // keep a reference to old query |
|
| 145 | - $current_global_query = $wp_query; |
|
| 146 | - // assign the query setup in $this-> setup_course_query |
|
| 147 | - $wp_query = $this->query; |
|
| 144 | + // keep a reference to old query |
|
| 145 | + $current_global_query = $wp_query; |
|
| 146 | + // assign the query setup in $this-> setup_course_query |
|
| 147 | + $wp_query = $this->query; |
|
| 148 | 148 | |
| 149 | - ob_start(); |
|
| 150 | - Sensei()->notices->print_notices(); |
|
| 151 | - Sensei_Templates::get_template('loop-course.php'); |
|
| 152 | - $shortcode_output = ob_get_clean(); |
|
| 149 | + ob_start(); |
|
| 150 | + Sensei()->notices->print_notices(); |
|
| 151 | + Sensei_Templates::get_template('loop-course.php'); |
|
| 152 | + $shortcode_output = ob_get_clean(); |
|
| 153 | 153 | |
| 154 | - //restore old query |
|
| 155 | - $wp_query = $current_global_query; |
|
| 154 | + //restore old query |
|
| 155 | + $wp_query = $current_global_query; |
|
| 156 | 156 | |
| 157 | - return $shortcode_output; |
|
| 157 | + return $shortcode_output; |
|
| 158 | 158 | |
| 159 | - }// end render |
|
| 159 | + }// end render |
|
| 160 | 160 | |
| 161 | 161 | } |
| 162 | 162 | \ No newline at end of file |
@@ -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 | * Renders the [sensei_unpurchased_courses] shortcode when a user is logged in. If the user is not logged in |
@@ -45,21 +45,21 @@ discard block |
||
| 45 | 45 | * @param string $content |
| 46 | 46 | * @param string $shortcode the shortcode that was called for this instance |
| 47 | 47 | */ |
| 48 | - public function __construct( $attributes, $content, $shortcode ){ |
|
| 48 | + public function __construct($attributes, $content, $shortcode) { |
|
| 49 | 49 | |
| 50 | 50 | // set up all argument need for constructing the course query |
| 51 | - $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '10'; |
|
| 52 | - $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'title'; |
|
| 51 | + $this->number = isset($attributes['number']) ? $attributes['number'] : '10'; |
|
| 52 | + $this->orderby = isset($attributes['orderby']) ? $attributes['orderby'] : 'title'; |
|
| 53 | 53 | |
| 54 | 54 | // set the default for menu_order to be ASC |
| 55 | - if( 'menu_order' == $this->orderby && !isset( $attributes['order'] ) ){ |
|
| 55 | + if ('menu_order' == $this->orderby && ! isset($attributes['order'])) { |
|
| 56 | 56 | |
| 57 | - $this->order = 'ASC'; |
|
| 57 | + $this->order = 'ASC'; |
|
| 58 | 58 | |
| 59 | - }else{ |
|
| 59 | + } else { |
|
| 60 | 60 | |
| 61 | 61 | // for everything else use the value passed or the default DESC |
| 62 | - $this->order = isset( $attributes['order'] ) ? $attributes['order'] : 'DESC'; |
|
| 62 | + $this->order = isset($attributes['order']) ? $attributes['order'] : 'DESC'; |
|
| 63 | 63 | |
| 64 | 64 | } |
| 65 | 65 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @since 1.9.0 |
| 75 | 75 | */ |
| 76 | - protected function setup_course_query(){ |
|
| 76 | + protected function setup_course_query() { |
|
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | // course query parameters to be used for all courses |
@@ -87,18 +87,18 @@ discard block |
||
| 87 | 87 | ); |
| 88 | 88 | |
| 89 | 89 | // get all the courses that has a product attached |
| 90 | - $all_courses_query = new WP_Query( $query_args ); |
|
| 90 | + $all_courses_query = new WP_Query($query_args); |
|
| 91 | 91 | |
| 92 | 92 | $paid_courses_not_taken = array(); |
| 93 | 93 | // look through all course and find the purchasable ones that user has not purchased |
| 94 | - foreach( $all_courses_query->posts as $course ){ |
|
| 94 | + foreach ($all_courses_query->posts as $course) { |
|
| 95 | 95 | |
| 96 | 96 | // only keep the courses with a product including only courses that the user not taking |
| 97 | - $course_product_id = get_post_meta( $course->ID, '_course_woocommerce_product',true ); |
|
| 98 | - if( is_numeric( $course_product_id ) |
|
| 97 | + $course_product_id = get_post_meta($course->ID, '_course_woocommerce_product', true); |
|
| 98 | + if (is_numeric($course_product_id) |
|
| 99 | 99 | && |
| 100 | - ! Sensei_Utils::user_started_course( $course->ID , get_current_user_id() ) |
|
| 101 | - ){ |
|
| 100 | + ! Sensei_Utils::user_started_course($course->ID, get_current_user_id()) |
|
| 101 | + ) { |
|
| 102 | 102 | |
| 103 | 103 | $paid_courses_not_taken[] = $course->ID; |
| 104 | 104 | |
@@ -108,10 +108,10 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | // setup the course query again and only use the course the user has not purchased. |
| 110 | 110 | // this query will be loaded into the global WP_Query in the render function. |
| 111 | - $query_args[ 'post__in' ] = $paid_courses_not_taken; |
|
| 112 | - $query_args[ 'posts_per_page' ] = $this->number; |
|
| 111 | + $query_args['post__in'] = $paid_courses_not_taken; |
|
| 112 | + $query_args['posts_per_page'] = $this->number; |
|
| 113 | 113 | |
| 114 | - $this->query = new WP_Query( $query_args ); |
|
| 114 | + $this->query = new WP_Query($query_args); |
|
| 115 | 115 | |
| 116 | 116 | }// end setup _course_query |
| 117 | 117 | |
@@ -120,13 +120,13 @@ discard block |
||
| 120 | 120 | * |
| 121 | 121 | * @return string $content |
| 122 | 122 | */ |
| 123 | - public function render(){ |
|
| 123 | + public function render() { |
|
| 124 | 124 | |
| 125 | 125 | global $wp_query; |
| 126 | 126 | |
| 127 | - if ( ! is_user_logged_in() ) { |
|
| 127 | + if ( ! is_user_logged_in()) { |
|
| 128 | 128 | |
| 129 | - $anchor_before = '<a href="' . esc_url( sensei_user_login_url() ) . '" >'; |
|
| 129 | + $anchor_before = '<a href="'.esc_url(sensei_user_login_url()).'" >'; |
|
| 130 | 130 | $anchor_after = '</a>'; |
| 131 | 131 | $notice = sprintf( |
| 132 | 132 | __('You must be logged in to view the non-purchased courses. Click here to %slogin%s.'), |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $anchor_after |
| 135 | 135 | ); |
| 136 | 136 | |
| 137 | - Sensei()->notices->add_notice( $notice, 'info' ); |
|
| 137 | + Sensei()->notices->add_notice($notice, 'info'); |
|
| 138 | 138 | Sensei()->notices->print_notices(); |
| 139 | 139 | |
| 140 | 140 | return ''; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | ob_start(); |
| 150 | 150 | Sensei()->notices->print_notices(); |
| 151 | 151 | Sensei_Templates::get_template('loop-course.php'); |
| 152 | - $shortcode_output = ob_get_clean(); |
|
| 152 | + $shortcode_output = ob_get_clean(); |
|
| 153 | 153 | |
| 154 | 154 | //restore old query |
| 155 | 155 | $wp_query = $current_global_query; |
@@ -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 Analysis User Profile List Table Class |
@@ -10,10 +10,10 @@ discard block |
||
| 10 | 10 | * @since 1.4.0 |
| 11 | 11 | */ |
| 12 | 12 | class Sensei_Learner_Profiles { |
| 13 | - /** |
|
| 14 | - * @var string |
|
| 15 | - */ |
|
| 16 | - private $profile_url_base; |
|
| 13 | + /** |
|
| 14 | + * @var string |
|
| 15 | + */ |
|
| 16 | + private $profile_url_base; |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Constructor. |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function setup_permastruct() { |
| 44 | 44 | |
| 45 | - if( isset( Sensei()->settings->settings[ 'learner_profile_enable' ] ) |
|
| 46 | - && Sensei()->settings->settings[ 'learner_profile_enable' ] ) { |
|
| 45 | + if( isset( Sensei()->settings->settings[ 'learner_profile_enable' ] ) |
|
| 46 | + && Sensei()->settings->settings[ 'learner_profile_enable' ] ) { |
|
| 47 | 47 | |
| 48 | 48 | add_rewrite_rule( '^' . $this->profile_url_base . '/([^/]*)/?', 'index.php?learner_profile=$matches[1]', 'top' ); |
| 49 | 49 | add_rewrite_tag( '%learner_profile%', '([^&]+)' ); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | if( isset( $wp_query->query_vars['learner_profile'] ) ) { |
| 63 | 63 | $learner_user = get_user_by( 'login', $wp_query->query_vars['learner_profile'] ); |
| 64 | 64 | |
| 65 | - $name = Sensei_Learner::get_full_name( $learner_user->ID ); |
|
| 65 | + $name = Sensei_Learner::get_full_name( $learner_user->ID ); |
|
| 66 | 66 | |
| 67 | 67 | $title = apply_filters( 'sensei_learner_profile_courses_heading', sprintf( __( 'Courses %s is taking', 'woothemes-sensei' ), $name ) ) . ' ' . $sep . ' '; |
| 68 | 68 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | if( isset( $wp_query->query_vars['learner_profile'] ) ) { |
| 112 | 112 | |
| 113 | - Sensei_Templates::get_template( 'learner-profile/learner-info.php' ); |
|
| 113 | + Sensei_Templates::get_template( 'learner-profile/learner-info.php' ); |
|
| 114 | 114 | |
| 115 | 115 | } |
| 116 | 116 | } |
@@ -140,43 +140,43 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public static function user_info( $user ) { |
| 142 | 142 | |
| 143 | - /** |
|
| 144 | - * This hooke fires inside the Sensei_Learner_Profiles::user_info function. |
|
| 145 | - * just before the htmls is generated. |
|
| 146 | - * @since 1.0.0 |
|
| 147 | - */ |
|
| 148 | - do_action( 'sensei_learner_profile_info', $user ); |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
|
| 152 | - * Here you can change the user avatar. |
|
| 153 | - * |
|
| 154 | - * @since 1.0.0 |
|
| 155 | - * |
|
| 156 | - * @param false|string `<img>` $user_avatar |
|
| 157 | - */ |
|
| 143 | + /** |
|
| 144 | + * This hooke fires inside the Sensei_Learner_Profiles::user_info function. |
|
| 145 | + * just before the htmls is generated. |
|
| 146 | + * @since 1.0.0 |
|
| 147 | + */ |
|
| 148 | + do_action( 'sensei_learner_profile_info', $user ); |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
|
| 152 | + * Here you can change the user avatar. |
|
| 153 | + * |
|
| 154 | + * @since 1.0.0 |
|
| 155 | + * |
|
| 156 | + * @param false|string `<img>` $user_avatar |
|
| 157 | + */ |
|
| 158 | 158 | $learner_avatar = apply_filters( 'sensei_learner_profile_info_avatar', get_avatar( $user->ID, 120 ), $user->ID ); |
| 159 | 159 | |
| 160 | - /** |
|
| 161 | - * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
|
| 162 | - * Here you can change the learner profile user display name. |
|
| 163 | - * @since 1.0.0 |
|
| 164 | - * |
|
| 165 | - * @param string $user_display_name |
|
| 166 | - * @param string $user_id |
|
| 167 | - */ |
|
| 160 | + /** |
|
| 161 | + * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
|
| 162 | + * Here you can change the learner profile user display name. |
|
| 163 | + * @since 1.0.0 |
|
| 164 | + * |
|
| 165 | + * @param string $user_display_name |
|
| 166 | + * @param string $user_id |
|
| 167 | + */ |
|
| 168 | 168 | $learner_name = apply_filters( 'sensei_learner_profile_info_name', $user->display_name, $user->ID ); |
| 169 | 169 | |
| 170 | - /** |
|
| 171 | - * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
|
| 172 | - * With this filter can change the users description on the learner user info |
|
| 173 | - * output. |
|
| 174 | - * |
|
| 175 | - * @since 1.0.0 |
|
| 176 | - * |
|
| 177 | - * @param string $user_description |
|
| 178 | - * @param string $user_id |
|
| 179 | - */ |
|
| 170 | + /** |
|
| 171 | + * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
|
| 172 | + * With this filter can change the users description on the learner user info |
|
| 173 | + * output. |
|
| 174 | + * |
|
| 175 | + * @since 1.0.0 |
|
| 176 | + * |
|
| 177 | + * @param string $user_description |
|
| 178 | + * @param string $user_id |
|
| 179 | + */ |
|
| 180 | 180 | $learner_bio = apply_filters( 'sensei_learner_profile_info_bio', $user->description, $user->ID ); |
| 181 | 181 | ?> |
| 182 | 182 | |
@@ -210,16 +210,16 @@ discard block |
||
| 210 | 210 | return $classes; |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - /** |
|
| 214 | - * Deprecate the deprecate_sensei_learner_profile_content hook |
|
| 215 | - * |
|
| 216 | - * @since 1.9.0 |
|
| 217 | - */ |
|
| 218 | - public static function deprecate_sensei_learner_profile_content_hook(){ |
|
| 213 | + /** |
|
| 214 | + * Deprecate the deprecate_sensei_learner_profile_content hook |
|
| 215 | + * |
|
| 216 | + * @since 1.9.0 |
|
| 217 | + */ |
|
| 218 | + public static function deprecate_sensei_learner_profile_content_hook(){ |
|
| 219 | 219 | |
| 220 | - sensei_do_deprecated_action( 'sensei_learner_profile_content', '1.9.0', 'sensei_learner_profile_content_before' ); |
|
| 220 | + sensei_do_deprecated_action( 'sensei_learner_profile_content', '1.9.0', 'sensei_learner_profile_content_before' ); |
|
| 221 | 221 | |
| 222 | - } |
|
| 222 | + } |
|
| 223 | 223 | |
| 224 | 224 | |
| 225 | 225 | } // End Class |
@@ -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 | * All functionality pertaining to the learner profiles in Sensei. |
@@ -19,20 +19,20 @@ discard block |
||
| 19 | 19 | * Constructor. |
| 20 | 20 | * @since 1.4.0 |
| 21 | 21 | */ |
| 22 | - public function __construct () { |
|
| 22 | + public function __construct() { |
|
| 23 | 23 | |
| 24 | 24 | // Setup learner profile URL base |
| 25 | - $this->profile_url_base = apply_filters( 'sensei_learner_profiles_url_base', __( 'learner', 'woothemes-sensei') ); |
|
| 25 | + $this->profile_url_base = apply_filters('sensei_learner_profiles_url_base', __('learner', 'woothemes-sensei')); |
|
| 26 | 26 | |
| 27 | 27 | // Setup permalink structure for learner profiles |
| 28 | - add_action( 'init', array( $this, 'setup_permastruct' ) ); |
|
| 29 | - add_filter( 'wp_title', array( $this, 'page_title' ), 10, 2 ); |
|
| 28 | + add_action('init', array($this, 'setup_permastruct')); |
|
| 29 | + add_filter('wp_title', array($this, 'page_title'), 10, 2); |
|
| 30 | 30 | |
| 31 | 31 | // Set heading for courses section of learner profiles |
| 32 | - add_action( 'sensei_learner_profile_info', array( $this, 'learner_profile_courses_heading' ), 30, 1 ); |
|
| 32 | + add_action('sensei_learner_profile_info', array($this, 'learner_profile_courses_heading'), 30, 1); |
|
| 33 | 33 | |
| 34 | 34 | // Add class to body tag |
| 35 | - add_filter( 'body_class', array( $this, 'learner_profile_body_class' ), 10, 1 ); |
|
| 35 | + add_filter('body_class', array($this, 'learner_profile_body_class'), 10, 1); |
|
| 36 | 36 | } // End __construct() |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function setup_permastruct() { |
| 44 | 44 | |
| 45 | - if( isset( Sensei()->settings->settings[ 'learner_profile_enable' ] ) |
|
| 46 | - && Sensei()->settings->settings[ 'learner_profile_enable' ] ) { |
|
| 45 | + if (isset(Sensei()->settings->settings['learner_profile_enable']) |
|
| 46 | + && Sensei()->settings->settings['learner_profile_enable']) { |
|
| 47 | 47 | |
| 48 | - add_rewrite_rule( '^' . $this->profile_url_base . '/([^/]*)/?', 'index.php?learner_profile=$matches[1]', 'top' ); |
|
| 49 | - add_rewrite_tag( '%learner_profile%', '([^&]+)' ); |
|
| 48 | + add_rewrite_rule('^'.$this->profile_url_base.'/([^/]*)/?', 'index.php?learner_profile=$matches[1]', 'top'); |
|
| 49 | + add_rewrite_tag('%learner_profile%', '([^&]+)'); |
|
| 50 | 50 | |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | * @param string $sep Seeparator string |
| 58 | 58 | * @return string Modified title |
| 59 | 59 | */ |
| 60 | - public function page_title( $title, $sep = null ) { |
|
| 60 | + public function page_title($title, $sep = null) { |
|
| 61 | 61 | global $wp_query; |
| 62 | - if( isset( $wp_query->query_vars['learner_profile'] ) ) { |
|
| 63 | - $learner_user = get_user_by( 'login', $wp_query->query_vars['learner_profile'] ); |
|
| 62 | + if (isset($wp_query->query_vars['learner_profile'])) { |
|
| 63 | + $learner_user = get_user_by('login', $wp_query->query_vars['learner_profile']); |
|
| 64 | 64 | |
| 65 | - $name = Sensei_Learner::get_full_name( $learner_user->ID ); |
|
| 65 | + $name = Sensei_Learner::get_full_name($learner_user->ID); |
|
| 66 | 66 | |
| 67 | - $title = apply_filters( 'sensei_learner_profile_courses_heading', sprintf( __( 'Courses %s is taking', 'woothemes-sensei' ), $name ) ) . ' ' . $sep . ' '; |
|
| 67 | + $title = apply_filters('sensei_learner_profile_courses_heading', sprintf(__('Courses %s is taking', 'woothemes-sensei'), $name)).' '.$sep.' '; |
|
| 68 | 68 | } |
| 69 | 69 | return $title; |
| 70 | 70 | } |
@@ -75,23 +75,23 @@ discard block |
||
| 75 | 75 | * @param integer $user_id ID of user |
| 76 | 76 | * @return string The learner profile permalink |
| 77 | 77 | */ |
| 78 | - public function get_permalink( $user_id = 0 ) { |
|
| 78 | + public function get_permalink($user_id = 0) { |
|
| 79 | 79 | $user = false; |
| 80 | - if( $user_id == 0 ) { |
|
| 80 | + if ($user_id == 0) { |
|
| 81 | 81 | global $current_user; |
| 82 | 82 | wp_get_current_user(); |
| 83 | 83 | $user = $current_user; |
| 84 | 84 | } else { |
| 85 | - $user = get_userdata( $user_id ); |
|
| 85 | + $user = get_userdata($user_id); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $permalink = ''; |
| 89 | 89 | |
| 90 | - if( $user ) { |
|
| 91 | - if ( get_option('permalink_structure') ) { |
|
| 92 | - $permalink = trailingslashit( get_site_url() ) . $this->profile_url_base . '/' . $user->user_nicename; |
|
| 90 | + if ($user) { |
|
| 91 | + if (get_option('permalink_structure')) { |
|
| 92 | + $permalink = trailingslashit(get_site_url()).$this->profile_url_base.'/'.$user->user_nicename; |
|
| 93 | 93 | } else { |
| 94 | - $permalink = trailingslashit( get_site_url() ) . '?learner_profile=' . $user->user_nicename; |
|
| 94 | + $permalink = trailingslashit(get_site_url()).'?learner_profile='.$user->user_nicename; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
@@ -104,13 +104,13 @@ discard block |
||
| 104 | 104 | * @return void |
| 105 | 105 | */ |
| 106 | 106 | public function content() { |
| 107 | - global $wp_query, $learner_user, $current_user; |
|
| 107 | + global $wp_query, $learner_user, $current_user; |
|
| 108 | 108 | |
| 109 | - if( isset( Sensei()->settings->settings[ 'learner_profile_enable' ] ) && Sensei()->settings->settings[ 'learner_profile_enable' ] ) { |
|
| 109 | + if (isset(Sensei()->settings->settings['learner_profile_enable']) && Sensei()->settings->settings['learner_profile_enable']) { |
|
| 110 | 110 | |
| 111 | - if( isset( $wp_query->query_vars['learner_profile'] ) ) { |
|
| 111 | + if (isset($wp_query->query_vars['learner_profile'])) { |
|
| 112 | 112 | |
| 113 | - Sensei_Templates::get_template( 'learner-profile/learner-info.php' ); |
|
| 113 | + Sensei_Templates::get_template('learner-profile/learner-info.php'); |
|
| 114 | 114 | |
| 115 | 115 | } |
| 116 | 116 | } |
@@ -122,14 +122,14 @@ discard block |
||
| 122 | 122 | * @param object $user Queried user object |
| 123 | 123 | * @return void |
| 124 | 124 | */ |
| 125 | - public function learner_profile_courses_heading( $user ) { |
|
| 126 | - if( strlen( $user->first_name ) > 0 ) { |
|
| 125 | + public function learner_profile_courses_heading($user) { |
|
| 126 | + if (strlen($user->first_name) > 0) { |
|
| 127 | 127 | $name = $user->first_name; |
| 128 | 128 | } else { |
| 129 | 129 | $name = $user->display_name; |
| 130 | 130 | } |
| 131 | - $name = apply_filters( 'sensei_learner_profile_courses_heading_name', $name ); |
|
| 132 | - echo '<h2>' . apply_filters( 'sensei_learner_profile_courses_heading', sprintf( __( 'Courses %s is taking', 'woothemes-sensei' ), $name ) ) . '</h2>'; |
|
| 131 | + $name = apply_filters('sensei_learner_profile_courses_heading_name', $name); |
|
| 132 | + echo '<h2>'.apply_filters('sensei_learner_profile_courses_heading', sprintf(__('Courses %s is taking', 'woothemes-sensei'), $name)).'</h2>'; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -138,14 +138,14 @@ discard block |
||
| 138 | 138 | * @param object $user Queried user object |
| 139 | 139 | * @return void |
| 140 | 140 | */ |
| 141 | - public static function user_info( $user ) { |
|
| 141 | + public static function user_info($user) { |
|
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | 144 | * This hooke fires inside the Sensei_Learner_Profiles::user_info function. |
| 145 | 145 | * just before the htmls is generated. |
| 146 | 146 | * @since 1.0.0 |
| 147 | 147 | */ |
| 148 | - do_action( 'sensei_learner_profile_info', $user ); |
|
| 148 | + do_action('sensei_learner_profile_info', $user); |
|
| 149 | 149 | |
| 150 | 150 | /** |
| 151 | 151 | * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @param false|string `<img>` $user_avatar |
| 157 | 157 | */ |
| 158 | - $learner_avatar = apply_filters( 'sensei_learner_profile_info_avatar', get_avatar( $user->ID, 120 ), $user->ID ); |
|
| 158 | + $learner_avatar = apply_filters('sensei_learner_profile_info_avatar', get_avatar($user->ID, 120), $user->ID); |
|
| 159 | 159 | |
| 160 | 160 | /** |
| 161 | 161 | * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @param string $user_display_name |
| 166 | 166 | * @param string $user_id |
| 167 | 167 | */ |
| 168 | - $learner_name = apply_filters( 'sensei_learner_profile_info_name', $user->display_name, $user->ID ); |
|
| 168 | + $learner_name = apply_filters('sensei_learner_profile_info_name', $user->display_name, $user->ID); |
|
| 169 | 169 | |
| 170 | 170 | /** |
| 171 | 171 | * This filter runs inside the Sensei_Learner_Profiles::user_info function. |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * @param string $user_description |
| 178 | 178 | * @param string $user_id |
| 179 | 179 | */ |
| 180 | - $learner_bio = apply_filters( 'sensei_learner_profile_info_bio', $user->description, $user->ID ); |
|
| 180 | + $learner_bio = apply_filters('sensei_learner_profile_info_bio', $user->description, $user->ID); |
|
| 181 | 181 | ?> |
| 182 | 182 | |
| 183 | 183 | <div id="learner-info"> |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | <h2><?php echo $learner_name; ?></h2> |
| 190 | 190 | |
| 191 | - <div class="description"><?php echo wpautop( $learner_bio ); ?></div> |
|
| 191 | + <div class="description"><?php echo wpautop($learner_bio); ?></div> |
|
| 192 | 192 | |
| 193 | 193 | </div> |
| 194 | 194 | |
@@ -202,9 +202,9 @@ discard block |
||
| 202 | 202 | * @param array $classes Existing classes |
| 203 | 203 | * @return array Modified classes |
| 204 | 204 | */ |
| 205 | - public function learner_profile_body_class( $classes ) { |
|
| 205 | + public function learner_profile_body_class($classes) { |
|
| 206 | 206 | global $wp_query; |
| 207 | - if( isset( $wp_query->query_vars['learner_profile'] ) ) { |
|
| 207 | + if (isset($wp_query->query_vars['learner_profile'])) { |
|
| 208 | 208 | $classes[] = 'learner-profile'; |
| 209 | 209 | } |
| 210 | 210 | return $classes; |
@@ -215,9 +215,9 @@ discard block |
||
| 215 | 215 | * |
| 216 | 216 | * @since 1.9.0 |
| 217 | 217 | */ |
| 218 | - public static function deprecate_sensei_learner_profile_content_hook(){ |
|
| 218 | + public static function deprecate_sensei_learner_profile_content_hook() { |
|
| 219 | 219 | |
| 220 | - sensei_do_deprecated_action( 'sensei_learner_profile_content', '1.9.0', 'sensei_learner_profile_content_before' ); |
|
| 220 | + sensei_do_deprecated_action('sensei_learner_profile_content', '1.9.0', 'sensei_learner_profile_content_before'); |
|
| 221 | 221 | |
| 222 | 222 | } |
| 223 | 223 | |