@@ -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 outputting Lists of any Sensei content type. |
| 5 | 5 | * |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * |
| 21 | 21 | * @since 1.9.0 |
| 22 | 22 | */ |
| 23 | -do_action( 'sensei_loop_course_before' ); |
|
| 23 | +do_action('sensei_loop_course_before'); |
|
| 24 | 24 | ?> |
| 25 | 25 | |
| 26 | 26 | <ul class="course-container columns-<?php sensei_courses_per_row(); ?>" > |
@@ -32,16 +32,16 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @since 1.9.0 |
| 34 | 34 | */ |
| 35 | - do_action( 'sensei_loop_course_inside_before' ); |
|
| 35 | + do_action('sensei_loop_course_inside_before'); |
|
| 36 | 36 | ?> |
| 37 | 37 | |
| 38 | 38 | <?php |
| 39 | 39 | /* |
| 40 | 40 | * Loop through all courses |
| 41 | 41 | */ |
| 42 | - while ( have_posts() ) { the_post(); |
|
| 42 | + while (have_posts()) { the_post(); |
|
| 43 | 43 | |
| 44 | - sensei_load_template_part('content','course'); |
|
| 44 | + sensei_load_template_part('content', 'course'); |
|
| 45 | 45 | |
| 46 | 46 | } |
| 47 | 47 | ?> |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @since 1.9.0 |
| 55 | 55 | */ |
| 56 | - do_action( 'sensei_loop_course_inside_after' ); |
|
| 56 | + do_action('sensei_loop_course_inside_after'); |
|
| 57 | 57 | ?> |
| 58 | 58 | |
| 59 | 59 | </ul> |
@@ -65,5 +65,5 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @since 1.9.0 |
| 67 | 67 | */ |
| 68 | -do_action( 'sensei_loop_course_after' ); |
|
| 68 | +do_action('sensei_loop_course_after'); |
|
| 69 | 69 | ?> |
@@ -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 | * The Template for displaying the sensei login form |
@@ -19,10 +19,10 @@ discard block |
||
| 19 | 19 | * |
| 20 | 20 | * @since 1.9.0 |
| 21 | 21 | */ |
| 22 | -do_action( 'sensei_login_form_before' ); |
|
| 22 | +do_action('sensei_login_form_before'); |
|
| 23 | 23 | ?> |
| 24 | 24 | |
| 25 | -<h2><?php _e( 'Login', 'woothemes-sensei' ); ?></h2> |
|
| 25 | +<h2><?php _e('Login', 'woothemes-sensei'); ?></h2> |
|
| 26 | 26 | |
| 27 | 27 | <form method="post" name="sensi-login-form" id="loginform" class="login sensei"> |
| 28 | 28 | |
@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @since 1.6.2 |
| 34 | 34 | */ |
| 35 | - do_action( 'sensei_login_form_inside_before' ); |
|
| 35 | + do_action('sensei_login_form_inside_before'); |
|
| 36 | 36 | ?> |
| 37 | 37 | |
| 38 | 38 | <p class="sensei-login-username form-row form-row-wide"> |
| 39 | 39 | |
| 40 | - <label for="sensei_user_login"><?php _e('Username or Email','woothemes-sensei')?> </label> |
|
| 40 | + <label for="sensei_user_login"><?php _e('Username or Email', 'woothemes-sensei')?> </label> |
|
| 41 | 41 | |
| 42 | 42 | <input type="text" name="log" id="sensei_user_login" class="input" value="" size="20"> |
| 43 | 43 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | <p class="sensei-login-password form-row form-row-wide"> |
| 47 | 47 | |
| 48 | - <label for="sensei_user_pass"> <?php _e('Password','woothemes-sensei')?> </label> |
|
| 48 | + <label for="sensei_user_pass"> <?php _e('Password', 'woothemes-sensei')?> </label> |
|
| 49 | 49 | |
| 50 | 50 | <input type="password" name="pwd" id="sensei_user_pass" class="input txt text" value="" size="20"> |
| 51 | 51 | |
@@ -59,14 +59,14 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @since 1.6.2 |
| 61 | 61 | */ |
| 62 | - do_action( 'sensei_login_form_inside_after_password_field' ); |
|
| 62 | + do_action('sensei_login_form_inside_after_password_field'); |
|
| 63 | 63 | ?> |
| 64 | 64 | |
| 65 | 65 | <p class='sensei-login-submit'> |
| 66 | 66 | |
| 67 | - <input type="submit" class="button" name="login" value="<?php _e( 'Login', 'woothemes-sensei' ); ?>" /> |
|
| 67 | + <input type="submit" class="button" name="login" value="<?php _e('Login', 'woothemes-sensei'); ?>" /> |
|
| 68 | 68 | |
| 69 | - <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?', 'woothemes-sensei' ); ?></a> |
|
| 69 | + <a href="<?php echo esc_url(wp_lostpassword_url()); ?>"><?php _e('Lost your password?', 'woothemes-sensei'); ?></a> |
|
| 70 | 70 | |
| 71 | 71 | </p> |
| 72 | 72 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | <label for="rememberme" class="inline"> |
| 76 | 76 | |
| 77 | - <input name="rememberme" type="checkbox" id="rememberme" value="forever" /> <?php _e( 'Remember me', 'woothemes-sensei' ); ?> |
|
| 77 | + <input name="rememberme" type="checkbox" id="rememberme" value="forever" /> <?php _e('Remember me', 'woothemes-sensei'); ?> |
|
| 78 | 78 | |
| 79 | 79 | </label> |
| 80 | 80 | |
@@ -86,12 +86,12 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @since 1.6.2 |
| 88 | 88 | */ |
| 89 | - do_action( 'sensei_login_form_inside_after' ); |
|
| 89 | + do_action('sensei_login_form_inside_after'); |
|
| 90 | 90 | ?> |
| 91 | 91 | |
| 92 | - <?php wp_nonce_field( 'sensei-login' ); ?> |
|
| 92 | + <?php wp_nonce_field('sensei-login'); ?> |
|
| 93 | 93 | |
| 94 | - <input type="hidden" name="redirect" value="<?php echo esc_url_raw( sensei_get_current_page_url() ) ?>" /> |
|
| 94 | + <input type="hidden" name="redirect" value="<?php echo esc_url_raw(sensei_get_current_page_url()) ?>" /> |
|
| 95 | 95 | |
| 96 | 96 | <input type="hidden" name="form" value="sensei-login" /> |
| 97 | 97 | |
@@ -105,5 +105,5 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @since 1.9.0 |
| 107 | 107 | */ |
| 108 | -do_action( 'sensei_login_form_after' ); |
|
| 108 | +do_action('sensei_login_form_after'); |
|
| 109 | 109 | ?> |
| 110 | 110 | \ No newline at end of file |
@@ -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 the my course page data. |
| 5 | 5 | * |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * |
| 21 | 21 | * @since 1.9.0 |
| 22 | 22 | */ |
| 23 | -do_action( 'sensei_my_courses_before' ); |
|
| 23 | +do_action('sensei_my_courses_before'); |
|
| 24 | 24 | ?> |
| 25 | 25 | |
| 26 | 26 | <section id="main-course" class="course-container"> |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @since 1.9.0 |
| 34 | 34 | */ |
| 35 | - do_action( 'sensei_my_courses_content_inside_before' ); |
|
| 35 | + do_action('sensei_my_courses_content_inside_before'); |
|
| 36 | 36 | ?> |
| 37 | 37 | |
| 38 | 38 | <?php sensei_the_my_courses_content(); ?> |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @since 1.9.0 |
| 46 | 46 | */ |
| 47 | - do_action( 'sensei_my_courses_content_inside_after' ); |
|
| 47 | + do_action('sensei_my_courses_content_inside_after'); |
|
| 48 | 48 | ?> |
| 49 | 49 | |
| 50 | 50 | </section> |
@@ -57,5 +57,5 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @since 1.9.0 |
| 59 | 59 | */ |
| 60 | -do_action( 'sensei_my_courses_after' ); |
|
| 60 | +do_action('sensei_my_courses_after'); |
|
| 61 | 61 | ?> |
@@ -28,14 +28,14 @@ discard block |
||
| 28 | 28 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | - if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
| 31 | + if ( ! defined('ABSPATH')) exit; // Exit if accessed directly
|
|
| 32 | 32 | |
| 33 | - require_once( 'includes/class-sensei-autoloader.php' ); |
|
| 34 | - require_once( 'includes/lib/woo-functions.php' ); |
|
| 35 | - require_once( 'includes/sensei-functions.php' ); |
|
| 33 | + require_once('includes/class-sensei-autoloader.php');
|
|
| 34 | + require_once('includes/lib/woo-functions.php');
|
|
| 35 | + require_once('includes/sensei-functions.php');
|
|
| 36 | 36 | |
| 37 | - if ( ! is_admin() ) {
|
|
| 38 | - require_once( 'includes/template-functions.php' ); |
|
| 37 | + if ( ! is_admin()) {
|
|
| 38 | + require_once('includes/template-functions.php');
|
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @since 1.8.0 |
| 45 | 45 | */ |
| 46 | - function Sensei(){
|
|
| 46 | + function Sensei() {
|
|
| 47 | 47 | |
| 48 | 48 | return Sensei_Main::instance(); |
| 49 | 49 | |
@@ -59,16 +59,16 @@ discard block |
||
| 59 | 59 | /** |
| 60 | 60 | * Hook in WooCommerce functionality |
| 61 | 61 | */ |
| 62 | - if( Sensei_WC::is_woocommerce_active() ){
|
|
| 63 | - add_action('init', array( 'Sensei_WC', 'load_woocommerce_integration_hooks' ) );
|
|
| 62 | + if (Sensei_WC::is_woocommerce_active()) {
|
|
| 63 | + add_action('init', array('Sensei_WC', 'load_woocommerce_integration_hooks'));
|
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * Load all Template hooks |
| 68 | 68 | */ |
| 69 | - if(! is_admin() ){
|
|
| 69 | + if ( ! is_admin()) {
|
|
| 70 | 70 | |
| 71 | - require_once( 'includes/hooks/template.php' ); |
|
| 71 | + require_once('includes/hooks/template.php');
|
|
| 72 | 72 | |
| 73 | 73 | } |
| 74 | 74 | |
@@ -76,13 +76,13 @@ discard block |
||
| 76 | 76 | * Plugin updates |
| 77 | 77 | * @since 1.0.1 |
| 78 | 78 | */ |
| 79 | - woothemes_queue_update( plugin_basename( __FILE__ ), 'bad2a02a063555b7e2bee59924690763', 152116 ); |
|
| 79 | + woothemes_queue_update(plugin_basename(__FILE__), 'bad2a02a063555b7e2bee59924690763', 152116); |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Sensei Activation Hook registration |
| 83 | 83 | * @since 1.8.0 |
| 84 | 84 | */ |
| 85 | - register_activation_hook( __FILE__, 'activate_sensei' ); |
|
| 85 | + register_activation_hook(__FILE__, 'activate_sensei'); |
|
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * Activate_sensei |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * All the activation checks needed to ensure Sensei is ready for use |
| 91 | 91 | * @since 1.8.0 |
| 92 | 92 | */ |
| 93 | - function activate_sensei () {
|
|
| 93 | + function activate_sensei() {
|
|
| 94 | 94 | |
| 95 | 95 | // create the teacher role on activation and ensure that it has all the needed capabilities |
| 96 | 96 | Sensei()->teacher->create_role(); |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | Sensei()->updates->assign_role_caps(); |
| 102 | 102 | |
| 103 | 103 | //Flush rules |
| 104 | - add_action( 'activated_plugin' , array( 'Sensei_Main','activation_flush_rules' ), 10 ); |
|
| 104 | + add_action('activated_plugin', array('Sensei_Main', 'activation_flush_rules'), 10);
|
|
| 105 | 105 | |
| 106 | 106 | //Load the Welcome Screen |
| 107 | - add_action( 'activated_plugin' , array( 'Sensei_Welcome','redirect' ), 20 ); |
|
| 107 | + add_action('activated_plugin', array('Sensei_Welcome', 'redirect'), 20);
|
|
| 108 | 108 | |
| 109 | 109 | }// end activate_sensei |
@@ -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_courses] shortcode |
@@ -65,33 +65,33 @@ discard block |
||
| 65 | 65 | * @param string $content |
| 66 | 66 | * @param string $shortcode the shortcode that was called for this instance |
| 67 | 67 | */ |
| 68 | - public function __construct( $attributes, $content, $shortcode ){ |
|
| 68 | + public function __construct($attributes, $content, $shortcode) { |
|
| 69 | 69 | |
| 70 | 70 | // set up all argument need for constructing the course query |
| 71 | - $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '10'; |
|
| 72 | - $this->teacher = isset( $attributes['teacher'] ) ? $attributes['teacher'] : ''; |
|
| 73 | - $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'date'; |
|
| 71 | + $this->number = isset($attributes['number']) ? $attributes['number'] : '10'; |
|
| 72 | + $this->teacher = isset($attributes['teacher']) ? $attributes['teacher'] : ''; |
|
| 73 | + $this->orderby = isset($attributes['orderby']) ? $attributes['orderby'] : 'date'; |
|
| 74 | 74 | |
| 75 | 75 | // set the default for menu_order to be ASC |
| 76 | - if( 'menu_order' == $this->orderby && !isset( $attributes['order'] ) ){ |
|
| 76 | + if ('menu_order' == $this->orderby && ! isset($attributes['order'])) { |
|
| 77 | 77 | |
| 78 | - $this->order = 'ASC'; |
|
| 78 | + $this->order = 'ASC'; |
|
| 79 | 79 | |
| 80 | - }else{ |
|
| 80 | + } else { |
|
| 81 | 81 | |
| 82 | 82 | // for everything else use the value passed or the default DESC |
| 83 | - $this->order = isset( $attributes['order'] ) ? $attributes['order'] : 'DESC'; |
|
| 83 | + $this->order = isset($attributes['order']) ? $attributes['order'] : 'DESC'; |
|
| 84 | 84 | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - $category = isset( $attributes['category'] ) ? $attributes['category'] : ''; |
|
| 88 | - $this->category = is_numeric( $category ) ? intval( $category ) : $category; |
|
| 87 | + $category = isset($attributes['category']) ? $attributes['category'] : ''; |
|
| 88 | + $this->category = is_numeric($category) ? intval($category) : $category; |
|
| 89 | 89 | |
| 90 | - $ids = isset( $attributes['ids'] ) ? $attributes['ids'] : ''; |
|
| 91 | - $this->ids = empty( $ids ) ? '' : explode( ',', $ids ); |
|
| 90 | + $ids = isset($attributes['ids']) ? $attributes['ids'] : ''; |
|
| 91 | + $this->ids = empty($ids) ? '' : explode(',', $ids); |
|
| 92 | 92 | |
| 93 | - $exclude = isset( $attributes['exclude'] ) ? $attributes['exclude'] : ''; |
|
| 94 | - $this->exclude = empty( $exclude ) ? '' : explode( ',', $exclude ); |
|
| 93 | + $exclude = isset($attributes['exclude']) ? $attributes['exclude'] : ''; |
|
| 94 | + $this->exclude = empty($exclude) ? '' : explode(',', $exclude); |
|
| 95 | 95 | |
| 96 | 96 | // setup the course query that will be used when rendering |
| 97 | 97 | $this->setup_course_query(); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @since 1.9.0 |
| 105 | 105 | */ |
| 106 | - protected function setup_course_query(){ |
|
| 106 | + protected function setup_course_query() { |
|
| 107 | 107 | |
| 108 | 108 | // query defaults |
| 109 | 109 | $query_args = array( |
@@ -116,18 +116,18 @@ discard block |
||
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | 118 | // setup the teacher query if any teacher was specified |
| 119 | - if( !empty( $this->teacher )){ |
|
| 119 | + if ( ! empty($this->teacher)) { |
|
| 120 | 120 | |
| 121 | 121 | // when users passed in a csv |
| 122 | - if( strpos( $this->teacher, ',' ) ){ |
|
| 122 | + if (strpos($this->teacher, ',')) { |
|
| 123 | 123 | |
| 124 | - $teachers = explode( ',', $this->teacher ); |
|
| 124 | + $teachers = explode(',', $this->teacher); |
|
| 125 | 125 | |
| 126 | 126 | // for all user names given convert them to user ID's |
| 127 | - foreach( $teachers as $index => $teacher ){ |
|
| 127 | + foreach ($teachers as $index => $teacher) { |
|
| 128 | 128 | |
| 129 | 129 | //replace the teacher value with the teachers ID |
| 130 | - if( ! is_numeric( $teacher ) ){ |
|
| 130 | + if ( ! is_numeric($teacher)) { |
|
| 131 | 131 | |
| 132 | 132 | $user = get_user_by('login', $teacher); |
| 133 | 133 | $teachers[$index] = $user->ID; |
@@ -139,25 +139,25 @@ discard block |
||
| 139 | 139 | $teacher_query_by = 'author__in'; |
| 140 | 140 | $this->teacher = $teachers; |
| 141 | 141 | |
| 142 | - }else{ |
|
| 142 | + } else { |
|
| 143 | 143 | // when users passed in a single teacher value |
| 144 | - $teacher_query_by = is_numeric( $this->teacher )? 'author':'author_name'; |
|
| 144 | + $teacher_query_by = is_numeric($this->teacher) ? 'author' : 'author_name'; |
|
| 145 | 145 | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | // attach teacher query by and teacher query value to the course query |
| 149 | - $query_args[ $teacher_query_by ] = $this->teacher; |
|
| 149 | + $query_args[$teacher_query_by] = $this->teacher; |
|
| 150 | 150 | |
| 151 | 151 | }// end if empty teacher |
| 152 | 152 | |
| 153 | 153 | |
| 154 | 154 | // add the course category taxonomy query |
| 155 | - if( ! empty( $this->category ) ) { |
|
| 155 | + if ( ! empty($this->category)) { |
|
| 156 | 156 | |
| 157 | 157 | $tax_query = array(); |
| 158 | - $term_id = intval( term_exists($this->category) ); |
|
| 158 | + $term_id = intval(term_exists($this->category)); |
|
| 159 | 159 | |
| 160 | - if (! empty( $term_id) ) { |
|
| 160 | + if ( ! empty($term_id)) { |
|
| 161 | 161 | |
| 162 | 162 | $tax_query = array( |
| 163 | 163 | 'taxonomy' => 'course-category', |
@@ -172,20 +172,20 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // limit the query if the user supplied ids |
| 175 | - if( ! empty( $this->ids ) && is_array( $this->ids ) ) { |
|
| 175 | + if ( ! empty($this->ids) && is_array($this->ids)) { |
|
| 176 | 176 | |
| 177 | 177 | $query_args['post__in'] = $this->ids; |
| 178 | 178 | |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | // exclude the course by id fromt he query |
| 182 | - if( ! empty( $this->exclude ) && is_array( $this->exclude ) ) { |
|
| 182 | + if ( ! empty($this->exclude) && is_array($this->exclude)) { |
|
| 183 | 183 | |
| 184 | 184 | $query_args['post__not_in'] = $this->exclude; |
| 185 | 185 | |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - $this->query = new WP_Query( $query_args ); |
|
| 188 | + $this->query = new WP_Query($query_args); |
|
| 189 | 189 | |
| 190 | 190 | }// end setup _course_query |
| 191 | 191 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @return string $content |
| 196 | 196 | */ |
| 197 | - public function render(){ |
|
| 197 | + public function render() { |
|
| 198 | 198 | |
| 199 | 199 | global $wp_query; |
| 200 | 200 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | ob_start(); |
| 208 | 208 | Sensei_Templates::get_template('loop-course.php'); |
| 209 | - $shortcode_output = ob_get_clean(); |
|
| 209 | + $shortcode_output = ob_get_clean(); |
|
| 210 | 210 | |
| 211 | 211 | //restore old query |
| 212 | 212 | $wp_query = $current_global_query; |
@@ -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_lesson_page] shortcode. Display a single lesson based on the ID parameter given. |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | * @param string $content |
| 31 | 31 | * @param string $shortcode the shortcode that was called for this instance |
| 32 | 32 | */ |
| 33 | - public function __construct( $attributes, $content, $shortcode ){ |
|
| 33 | + public function __construct($attributes, $content, $shortcode) { |
|
| 34 | 34 | |
| 35 | - $this->id = isset( $attributes['id'] ) ? $attributes['id'] : ''; |
|
| 35 | + $this->id = isset($attributes['id']) ? $attributes['id'] : ''; |
|
| 36 | 36 | $this->setup_lesson_query(); |
| 37 | 37 | |
| 38 | 38 | } |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @return mixed |
| 44 | 44 | */ |
| 45 | - public function setup_lesson_query(){ |
|
| 45 | + public function setup_lesson_query() { |
|
| 46 | 46 | |
| 47 | - if( empty( $this->id ) ){ |
|
| 47 | + if (empty($this->id)) { |
|
| 48 | 48 | return; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | 'post_type' => 'lesson', |
| 53 | 53 | 'posts_per_page' => 1, |
| 54 | 54 | 'post_status' => 'publish', |
| 55 | - 'post__in' => array( $this->id ), |
|
| 55 | + 'post__in' => array($this->id), |
|
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | - $this->lesson_page_query = new WP_Query( $args ); |
|
| 58 | + $this->lesson_page_query = new WP_Query($args); |
|
| 59 | 59 | |
| 60 | 60 | } |
| 61 | 61 | |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return string $content |
| 66 | 66 | */ |
| 67 | - public function render(){ |
|
| 67 | + public function render() { |
|
| 68 | 68 | |
| 69 | - if( empty( $this->id ) ){ |
|
| 69 | + if (empty($this->id)) { |
|
| 70 | 70 | |
| 71 | - return __( 'Please supply a lesson ID for this shortcode.', 'woothemes-sensei' ); |
|
| 71 | + return __('Please supply a lesson ID for this shortcode.', 'woothemes-sensei'); |
|
| 72 | 72 | |
| 73 | 73 | } |
| 74 | 74 | |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | global $wp_query; |
| 77 | 77 | $wp_query = $this->lesson_page_query; |
| 78 | 78 | |
| 79 | - if( have_posts() ){ |
|
| 79 | + if (have_posts()) { |
|
| 80 | 80 | |
| 81 | 81 | the_post(); |
| 82 | 82 | |
| 83 | - }else{ |
|
| 83 | + } else { |
|
| 84 | 84 | |
| 85 | 85 | return __('No posts found.', 'woothemes-sensei'); |
| 86 | 86 | |
@@ -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 | * Sensei Feature Course rendering class |
| 5 | 5 | * |
@@ -49,22 +49,22 @@ discard block |
||
| 49 | 49 | * @param string $content |
| 50 | 50 | * @param string $shortcode the shortcode that was called for this instance |
| 51 | 51 | */ |
| 52 | - public function __construct( $attributes, $content, $shortcode ){ |
|
| 52 | + public function __construct($attributes, $content, $shortcode) { |
|
| 53 | 53 | |
| 54 | 54 | // set up all argument need for constructing the course query |
| 55 | - $this->number = isset( $attributes['number'] ) ? $attributes['number'] : '10'; |
|
| 56 | - $this->teacher = isset( $attributes['teacher'] ) ? $attributes['teacher'] : ''; |
|
| 57 | - $this->orderby = isset( $attributes['orderby'] ) ? $attributes['orderby'] : 'date'; |
|
| 55 | + $this->number = isset($attributes['number']) ? $attributes['number'] : '10'; |
|
| 56 | + $this->teacher = isset($attributes['teacher']) ? $attributes['teacher'] : ''; |
|
| 57 | + $this->orderby = isset($attributes['orderby']) ? $attributes['orderby'] : 'date'; |
|
| 58 | 58 | |
| 59 | 59 | // set the default for menu_order to be ASC |
| 60 | - if( 'menu_order' == $this->orderby && !isset( $attributes['order'] ) ){ |
|
| 60 | + if ('menu_order' == $this->orderby && ! isset($attributes['order'])) { |
|
| 61 | 61 | |
| 62 | - $this->order = 'ASC'; |
|
| 62 | + $this->order = 'ASC'; |
|
| 63 | 63 | |
| 64 | - }else{ |
|
| 64 | + } else { |
|
| 65 | 65 | |
| 66 | 66 | // for everything else use the value passed or the default DESC |
| 67 | - $this->order = isset( $attributes['order'] ) ? $attributes['order'] : 'DESC'; |
|
| 67 | + $this->order = isset($attributes['order']) ? $attributes['order'] : 'DESC'; |
|
| 68 | 68 | |
| 69 | 69 | } |
| 70 | 70 | |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @since 1.9.0 |
| 80 | 80 | */ |
| 81 | - protected function setup_course_query(){ |
|
| 81 | + protected function setup_course_query() { |
|
| 82 | 82 | |
| 83 | 83 | //for non numeric teacher arguments value query by author_name and not author |
| 84 | - $teacher_query_by = is_numeric( $this->teacher )? 'author':'author_name'; |
|
| 84 | + $teacher_query_by = is_numeric($this->teacher) ? 'author' : 'author_name'; |
|
| 85 | 85 | |
| 86 | 86 | $query_args = array( |
| 87 | 87 | 'post_type' => 'course', |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | 'suppress_filters' => 0, |
| 97 | 97 | ); |
| 98 | 98 | |
| 99 | - $this->query = new WP_Query( $query_args ); |
|
| 99 | + $this->query = new WP_Query($query_args); |
|
| 100 | 100 | |
| 101 | 101 | }// end setup _course_query |
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * Rendering the shortcode this class is responsible for. |
| 105 | 105 | */ |
| 106 | - public function render(){ |
|
| 106 | + public function render() { |
|
| 107 | 107 | |
| 108 | 108 | global $wp_query; |
| 109 | 109 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | ob_start(); |
| 117 | 117 | Sensei_Templates::get_template('loop-course.php'); |
| 118 | - $shortcode_output = ob_get_clean(); |
|
| 118 | + $shortcode_output = ob_get_clean(); |
|
| 119 | 119 | |
| 120 | 120 | //restore old query |
| 121 | 121 | $wp_query = $current_global_query; |
@@ -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_course_page] shortcode. Display a single course based on the ID parameter given |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | * @param string $content |
| 31 | 31 | * @param string $shortcode the shortcode that was called for this instance |
| 32 | 32 | */ |
| 33 | - public function __construct( $attributes, $content, $shortcode ){ |
|
| 33 | + public function __construct($attributes, $content, $shortcode) { |
|
| 34 | 34 | |
| 35 | - $this->id = isset( $attributes['id'] ) ? $attributes['id'] : ''; |
|
| 35 | + $this->id = isset($attributes['id']) ? $attributes['id'] : ''; |
|
| 36 | 36 | $this->setup_course_query(); |
| 37 | 37 | |
| 38 | 38 | } |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @return mixed |
| 44 | 44 | */ |
| 45 | - public function setup_course_query(){ |
|
| 45 | + public function setup_course_query() { |
|
| 46 | 46 | |
| 47 | - if( empty( $this->id ) ){ |
|
| 47 | + if (empty($this->id)) { |
|
| 48 | 48 | return; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | 'post_type' => 'course', |
| 53 | 53 | 'posts_per_page' => 1, |
| 54 | 54 | 'post_status' => 'publish', |
| 55 | - 'post__in' => array( $this->id ), |
|
| 55 | + 'post__in' => array($this->id), |
|
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | - $this->course_page_query = new WP_Query( $args ); |
|
| 58 | + $this->course_page_query = new WP_Query($args); |
|
| 59 | 59 | |
| 60 | 60 | } |
| 61 | 61 | |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return string $content |
| 66 | 66 | */ |
| 67 | - public function render(){ |
|
| 67 | + public function render() { |
|
| 68 | 68 | |
| 69 | - if( empty( $this->id ) ){ |
|
| 69 | + if (empty($this->id)) { |
|
| 70 | 70 | |
| 71 | - return sprintf( __( 'Please supply a course ID for the shortcode: %s', 'woothemes-sensei' ),'[sensei_course_page id=""]') ; |
|
| 71 | + return sprintf(__('Please supply a course ID for the shortcode: %s', 'woothemes-sensei'), '[sensei_course_page id=""]'); |
|
| 72 | 72 | |
| 73 | 73 | } |
| 74 | 74 | |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | $global_post_ref = $post; |
| 80 | 80 | $global_wp_query_ref = $wp_query; |
| 81 | 81 | |
| 82 | - $post = get_post( $this->id ); |
|
| 83 | - $wp_query->post = get_post( $this->id ); // set this in case some the course hooks resets the query |
|
| 82 | + $post = get_post($this->id); |
|
| 83 | + $wp_query->post = get_post($this->id); // set this in case some the course hooks resets the query |
|
| 84 | 84 | $wp_query = $this->course_page_query; |
| 85 | 85 | |
| 86 | 86 | ob_start(); |
@@ -103,13 +103,13 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @since 1.9.0 |
| 105 | 105 | */ |
| 106 | - public static function the_single_course_content(){ |
|
| 106 | + public static function the_single_course_content() { |
|
| 107 | 107 | ?> |
| 108 | 108 | |
| 109 | - <article <?php post_class( array( 'course', 'post' ) ); ?> > |
|
| 109 | + <article <?php post_class(array('course', 'post')); ?> > |
|
| 110 | 110 | |
| 111 | 111 | |
| 112 | - <?php do_action( 'sensei_single_course_content_inside_before' ); ?> |
|
| 112 | + <?php do_action('sensei_single_course_content_inside_before'); ?> |
|
| 113 | 113 | |
| 114 | 114 | <section class="entry fix"> |
| 115 | 115 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | </section> |
| 119 | 119 | |
| 120 | - <?php do_action( 'sensei_single_course_content_inside_after' ); ?> |
|
| 120 | + <?php do_action('sensei_single_course_content_inside_after'); ?> |
|
| 121 | 121 | |
| 122 | 122 | </article> |
| 123 | 123 | |
@@ -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_teachers] shortcode. Will show a list of teachers |
@@ -40,14 +40,14 @@ discard block |
||
| 40 | 40 | * @param string $content |
| 41 | 41 | * @param string $shortcode the shortcode that was called for this instance |
| 42 | 42 | */ |
| 43 | - public function __construct( $attributes, $content, $shortcode ){ |
|
| 43 | + public function __construct($attributes, $content, $shortcode) { |
|
| 44 | 44 | |
| 45 | - $include = isset( $attributes['include'] ) ? explode( ',', $attributes['include'] ) : ''; |
|
| 46 | - $exclude = isset( $attributes['exclude'] ) ? explode( ',', $attributes['exclude'] ) : ''; |
|
| 45 | + $include = isset($attributes['include']) ? explode(',', $attributes['include']) : ''; |
|
| 46 | + $exclude = isset($attributes['exclude']) ? explode(',', $attributes['exclude']) : ''; |
|
| 47 | 47 | |
| 48 | 48 | // convert teacher usernames given to the id |
| 49 | - $this->include = $this->convert_usernames_to_ids( $include ); |
|
| 50 | - $this->exclude = $this->convert_usernames_to_ids( $exclude ); |
|
| 49 | + $this->include = $this->convert_usernames_to_ids($include); |
|
| 50 | + $this->exclude = $this->convert_usernames_to_ids($exclude); |
|
| 51 | 51 | |
| 52 | 52 | $this->setup_teacher_query(); |
| 53 | 53 | |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @since 1.9.0 |
| 61 | 61 | */ |
| 62 | - protected function setup_teacher_query(){ |
|
| 62 | + protected function setup_teacher_query() { |
|
| 63 | 63 | |
| 64 | 64 | $user_query_args = array( |
| 65 | 65 | 'role' => 'teacher', |
| 66 | 66 | ); |
| 67 | 67 | |
| 68 | - $this->user_query = new WP_User_Query( $user_query_args ); |
|
| 68 | + $this->user_query = new WP_User_Query($user_query_args); |
|
| 69 | 69 | |
| 70 | 70 | }// end setup _course_query |
| 71 | 71 | |
@@ -74,41 +74,41 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @return string $content |
| 76 | 76 | */ |
| 77 | - public function render(){ |
|
| 77 | + public function render() { |
|
| 78 | 78 | |
| 79 | 79 | $all_users = $this->user_query->get_results(); |
| 80 | 80 | // if the user has specified more users add them as well. |
| 81 | - if( ! empty( $this->include ) ){ |
|
| 81 | + if ( ! empty($this->include)) { |
|
| 82 | 82 | |
| 83 | - $included_users_query = new WP_User_Query( array( 'include' => $this->include ) ); |
|
| 83 | + $included_users_query = new WP_User_Query(array('include' => $this->include)); |
|
| 84 | 84 | $included_users = $included_users_query->get_results(); |
| 85 | - if( ! empty( $included_users ) ){ |
|
| 85 | + if ( ! empty($included_users)) { |
|
| 86 | 86 | |
| 87 | - $merged_users = array_merge( $all_users, $included_users ); |
|
| 88 | - $all_users = $this->users_unique( $merged_users ); |
|
| 89 | - $all_users = $this->users_sort( $all_users ); |
|
| 87 | + $merged_users = array_merge($all_users, $included_users); |
|
| 88 | + $all_users = $this->users_unique($merged_users); |
|
| 89 | + $all_users = $this->users_sort($all_users); |
|
| 90 | 90 | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // exclude the users not wanted |
| 96 | - if( ! empty( $this->exclude ) ){ |
|
| 96 | + if ( ! empty($this->exclude)) { |
|
| 97 | 97 | |
| 98 | - $all_users = $this->exclude_users( $all_users, $this->exclude ); |
|
| 98 | + $all_users = $this->exclude_users($all_users, $this->exclude); |
|
| 99 | 99 | |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - if( ! count( $all_users )> 0 ){ |
|
| 102 | + if ( ! count($all_users) > 0) { |
|
| 103 | 103 | return ''; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
| 107 | 107 | $users_output = ''; |
| 108 | 108 | |
| 109 | - foreach ( $all_users as $user ) { |
|
| 109 | + foreach ($all_users as $user) { |
|
| 110 | 110 | |
| 111 | - $user_display_name = $this->get_user_public_name( $user ); |
|
| 111 | + $user_display_name = $this->get_user_public_name($user); |
|
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | 114 | * Sensei teachers shortcode list item filter |
@@ -118,11 +118,11 @@ discard block |
||
| 118 | 118 | * @param string $teacher_li the html for the teacher li |
| 119 | 119 | * @param WP_User $user |
| 120 | 120 | */ |
| 121 | - $users_output .= apply_filters( 'sensei_teachers_shortcode_list_item', '<li class="teacher"><a href="'. get_author_posts_url( $user->ID ) . '">'. $user_display_name . '<a/></li>', $user ); |
|
| 121 | + $users_output .= apply_filters('sensei_teachers_shortcode_list_item', '<li class="teacher"><a href="'.get_author_posts_url($user->ID).'">'.$user_display_name.'<a/></li>', $user); |
|
| 122 | 122 | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - return '<ul class="sensei-teachers">' . $users_output . '</ul>'; |
|
| 125 | + return '<ul class="sensei-teachers">'.$users_output.'</ul>'; |
|
| 126 | 126 | |
| 127 | 127 | }// end render |
| 128 | 128 | |
@@ -139,17 +139,17 @@ discard block |
||
| 139 | 139 | * @type WP_User |
| 140 | 140 | * } |
| 141 | 141 | */ |
| 142 | - public function users_unique( $users ){ |
|
| 142 | + public function users_unique($users) { |
|
| 143 | 143 | |
| 144 | 144 | $array_unique_users_ids = array(); |
| 145 | - foreach( $users as $index => $user ){ |
|
| 145 | + foreach ($users as $index => $user) { |
|
| 146 | 146 | |
| 147 | - if( in_array( $user->ID, $array_unique_users_ids) ){ |
|
| 147 | + if (in_array($user->ID, $array_unique_users_ids)) { |
|
| 148 | 148 | |
| 149 | 149 | // exclude this user as it is already in the list |
| 150 | - unset( $users[ $index ] ); |
|
| 150 | + unset($users[$index]); |
|
| 151 | 151 | |
| 152 | - }else{ |
|
| 152 | + } else { |
|
| 153 | 153 | |
| 154 | 154 | // add teh user to the list of users |
| 155 | 155 | $array_unique_users_ids[] = $user->ID; |
@@ -171,14 +171,14 @@ discard block |
||
| 171 | 171 | * @param array $exclude_ids |
| 172 | 172 | * @return array |
| 173 | 173 | */ |
| 174 | - public function exclude_users( $users, $exclude_ids ){ |
|
| 174 | + public function exclude_users($users, $exclude_ids) { |
|
| 175 | 175 | |
| 176 | - foreach( $users as $index => $user ){ |
|
| 176 | + foreach ($users as $index => $user) { |
|
| 177 | 177 | |
| 178 | - if( in_array( $user->ID, $exclude_ids ) ){ |
|
| 178 | + if (in_array($user->ID, $exclude_ids)) { |
|
| 179 | 179 | |
| 180 | 180 | // remove the user from the list |
| 181 | - unset( $users[ $index ] ); |
|
| 181 | + unset($users[$index]); |
|
| 182 | 182 | |
| 183 | 183 | } |
| 184 | 184 | |
@@ -194,16 +194,16 @@ discard block |
||
| 194 | 194 | * @param array $users |
| 195 | 195 | * @return array $users_ids |
| 196 | 196 | */ |
| 197 | - public function convert_usernames_to_ids( $users ){ |
|
| 197 | + public function convert_usernames_to_ids($users) { |
|
| 198 | 198 | |
| 199 | 199 | // backup |
| 200 | 200 | $users_ids = array(); |
| 201 | 201 | |
| 202 | - if ( is_array($users) ) { |
|
| 202 | + if (is_array($users)) { |
|
| 203 | 203 | |
| 204 | 204 | foreach ($users as $user_id_or_username) { |
| 205 | 205 | |
| 206 | - if (!is_numeric($user_id_or_username)) { |
|
| 206 | + if ( ! is_numeric($user_id_or_username)) { |
|
| 207 | 207 | |
| 208 | 208 | $user_name = $user_id_or_username; |
| 209 | 209 | $user = get_user_by('login', $user_name); |
@@ -233,11 +233,11 @@ discard block |
||
| 233 | 233 | * @param $user |
| 234 | 234 | * @return string $user_public_name |
| 235 | 235 | */ |
| 236 | - public function get_user_public_name( $user ){ |
|
| 236 | + public function get_user_public_name($user) { |
|
| 237 | 237 | |
| 238 | - if (!empty($user->first_name) && !empty($user->last_name)) { |
|
| 238 | + if ( ! empty($user->first_name) && ! empty($user->last_name)) { |
|
| 239 | 239 | |
| 240 | - $user_public_name = $user->first_name . ' ' . $user->last_name; |
|
| 240 | + $user_public_name = $user->first_name.' '.$user->last_name; |
|
| 241 | 241 | |
| 242 | 242 | } |
| 243 | 243 | |
@@ -259,11 +259,11 @@ discard block |
||
| 259 | 259 | * @param $users |
| 260 | 260 | * @return array $sorted_users |
| 261 | 261 | */ |
| 262 | - public function users_sort( $users ){ |
|
| 262 | + public function users_sort($users) { |
|
| 263 | 263 | |
| 264 | 264 | $sorted_users = $users; |
| 265 | 265 | |
| 266 | - uasort( $sorted_users, array( $this, 'custom_user_sort' ) ); |
|
| 266 | + uasort($sorted_users, array($this, 'custom_user_sort')); |
|
| 267 | 267 | |
| 268 | 268 | return $sorted_users; |
| 269 | 269 | } |
@@ -277,9 +277,9 @@ discard block |
||
| 277 | 277 | * @param $user_2 |
| 278 | 278 | * @return int |
| 279 | 279 | */ |
| 280 | - public function custom_user_sort($user_1, $user_2){ |
|
| 280 | + public function custom_user_sort($user_1, $user_2) { |
|
| 281 | 281 | |
| 282 | - return strcasecmp( $this->get_user_public_name( $user_1 ), $this->get_user_public_name( $user_2 ) ); |
|
| 282 | + return strcasecmp($this->get_user_public_name($user_1), $this->get_user_public_name($user_2)); |
|
| 283 | 283 | |
| 284 | 284 | }// end custom_user_sort |
| 285 | 285 | |