@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if ( ! defined('ABSPATH')) { |
|
| 4 | 4 | exit; // Exit if accessed directly |
| 5 | 5 | } |
| 6 | 6 | |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | * Initialize the language pack manager |
| 29 | 29 | */ |
| 30 | 30 | public function __construct() { |
| 31 | - add_action( 'update_option_WPLANG', array( $this, 'updated_language_option' ), 10, 2 ); |
|
| 32 | - add_filter( 'admin_init', array( $this, 'language_package_actions' ), 10 ); |
|
| 31 | + add_action('update_option_WPLANG', array($this, 'updated_language_option'), 10, 2); |
|
| 32 | + add_filter('admin_init', array($this, 'language_package_actions'), 10); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @return string |
| 41 | 41 | */ |
| 42 | - public static function get_package_uri( $locale ) { |
|
| 43 | - return self::$repo . Sensei()->version . '/packages/' . $locale . '.zip'; |
|
| 42 | + public static function get_package_uri($locale) { |
|
| 43 | + return self::$repo.Sensei()->version.'/packages/'.$locale.'.zip'; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @return string |
| 52 | 52 | */ |
| 53 | - protected static function get_settings_uri( $action ) { |
|
| 54 | - return wp_nonce_url( admin_url( 'admin.php?page=woothemes-sensei-settings&action=' . $action ), 'language_pack', '_sensei_language_nonce' ); |
|
| 53 | + protected static function get_settings_uri($action) { |
|
| 54 | + return wp_nonce_url(admin_url('admin.php?page=woothemes-sensei-settings&action='.$action), 'language_pack', '_sensei_language_nonce'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @return string |
| 61 | 61 | */ |
| 62 | 62 | public static function get_install_uri() { |
| 63 | - return self::get_settings_uri( 'language_pack_install' ); |
|
| 63 | + return self::get_settings_uri('language_pack_install'); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @return string |
| 70 | 70 | */ |
| 71 | 71 | public static function get_dismiss_uri() { |
| 72 | - return self::get_settings_uri( 'dismiss_language_pack_notice' ); |
|
| 72 | + return self::get_settings_uri('dismiss_language_pack_notice'); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | * @param string $old |
| 79 | 79 | * @param string $new |
| 80 | 80 | */ |
| 81 | - public function updated_language_option( $old, $new ) { |
|
| 82 | - self::has_language_pack_available( $new ); |
|
| 81 | + public function updated_language_option($old, $new) { |
|
| 82 | + self::has_language_pack_available($new); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -89,42 +89,42 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @return bool |
| 91 | 91 | */ |
| 92 | - public static function has_language_pack_available( $locale = null ) { |
|
| 92 | + public static function has_language_pack_available($locale = null) { |
|
| 93 | 93 | |
| 94 | - if ( is_null( $locale ) ) { |
|
| 94 | + if (is_null($locale)) { |
|
| 95 | 95 | |
| 96 | 96 | $locale = get_locale(); |
| 97 | 97 | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if ( 'en_US' === $locale ) { |
|
| 100 | + if ('en_US' === $locale) { |
|
| 101 | 101 | |
| 102 | 102 | return false; |
| 103 | 103 | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - if ( 'yes' === get_option( 'sensei_needs_language_pack_install' ) ) { |
|
| 106 | + if ('yes' === get_option('sensei_needs_language_pack_install')) { |
|
| 107 | 107 | |
| 108 | 108 | return true; |
| 109 | 109 | |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if( isset( $_GET['translation_updated'] ) && 5 == $_GET['translation_updated'] ){ |
|
| 112 | + if (isset($_GET['translation_updated']) && 5 == $_GET['translation_updated']) { |
|
| 113 | 113 | |
| 114 | 114 | return false; |
| 115 | 115 | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - $version = get_option( 'woothemes_sensei_language_pack_version', array( '0', $locale ) ); |
|
| 118 | + $version = get_option('woothemes_sensei_language_pack_version', array('0', $locale)); |
|
| 119 | 119 | |
| 120 | - if ( ! is_array( $version ) || version_compare( $version[0], Sensei()->version, '<' ) || $version[1] !== $locale ) { |
|
| 121 | - if ( self::check_if_language_pack_exists( $locale ) ) { |
|
| 122 | - update_option( 'sensei_needs_language_pack_install', 'yes' ); |
|
| 120 | + if ( ! is_array($version) || version_compare($version[0], Sensei()->version, '<') || $version[1] !== $locale) { |
|
| 121 | + if (self::check_if_language_pack_exists($locale)) { |
|
| 122 | + update_option('sensei_needs_language_pack_install', 'yes'); |
|
| 123 | 123 | |
| 124 | 124 | return true; |
| 125 | 125 | } else { |
| 126 | 126 | // Updated the woothemes_sensei_language_pack_version to avoid searching translations for this release again |
| 127 | - self::update_language_pack_version( $locale ); |
|
| 127 | + self::update_language_pack_version($locale); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | * |
| 138 | 138 | * @return bool |
| 139 | 139 | */ |
| 140 | - public static function check_if_language_pack_exists( $locale ) { |
|
| 141 | - $response = wp_safe_remote_get( self::get_package_uri( $locale ), array( 'timeout' => 60 ) ); |
|
| 140 | + public static function check_if_language_pack_exists($locale) { |
|
| 141 | + $response = wp_safe_remote_get(self::get_package_uri($locale), array('timeout' => 60)); |
|
| 142 | 142 | |
| 143 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
| 143 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
| 144 | 144 | return true; |
| 145 | 145 | } else { |
| 146 | 146 | return false; |
@@ -152,12 +152,12 @@ discard block |
||
| 152 | 152 | * |
| 153 | 153 | * @param string $locale |
| 154 | 154 | */ |
| 155 | - public static function update_language_pack_version( $locale ) { |
|
| 155 | + public static function update_language_pack_version($locale) { |
|
| 156 | 156 | // Update the language pack version |
| 157 | - update_option( 'woothemes_sensei_language_pack_version', array( Sensei()->version, $locale ) ); |
|
| 157 | + update_option('woothemes_sensei_language_pack_version', array(Sensei()->version, $locale)); |
|
| 158 | 158 | |
| 159 | 159 | // Remove the translation upgrade notice |
| 160 | - update_option( 'sensei_needs_language_pack_install', 'no' ); |
|
| 160 | + update_option('sensei_needs_language_pack_install', 'no'); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -166,17 +166,17 @@ discard block |
||
| 166 | 166 | public function language_package_actions() { |
| 167 | 167 | if ( |
| 168 | 168 | is_admin() |
| 169 | - && current_user_can( 'update_plugins' ) |
|
| 170 | - && isset( $_GET['page'] ) |
|
| 169 | + && current_user_can('update_plugins') |
|
| 170 | + && isset($_GET['page']) |
|
| 171 | 171 | && 'woothemes-sensei-settings' === $_GET['page'] |
| 172 | - && isset( $_GET['action'] ) |
|
| 172 | + && isset($_GET['action']) |
|
| 173 | 173 | ) { |
| 174 | 174 | |
| 175 | - if ( 'language_pack_install' === $_GET['action'] ) { |
|
| 175 | + if ('language_pack_install' === $_GET['action']) { |
|
| 176 | 176 | $this->language_pack_install(); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if ( 'dismiss_language_pack_notice' ) { |
|
| 179 | + if ('dismiss_language_pack_notice') { |
|
| 180 | 180 | $this->dismiss_language_pack_notice(); |
| 181 | 181 | } |
| 182 | 182 | } |
@@ -186,66 +186,66 @@ discard block |
||
| 186 | 186 | * Install language pack. |
| 187 | 187 | */ |
| 188 | 188 | protected function language_pack_install() { |
| 189 | - $url = wp_nonce_url( admin_url( 'admin.php?page=woothemes-sensei-settings&action=language_pack_install' ), 'language_install' ); |
|
| 190 | - $settings_url = admin_url( 'admin.php?page=woothemes-sensei-settings' ); |
|
| 189 | + $url = wp_nonce_url(admin_url('admin.php?page=woothemes-sensei-settings&action=language_pack_install'), 'language_install'); |
|
| 190 | + $settings_url = admin_url('admin.php?page=woothemes-sensei-settings'); |
|
| 191 | 191 | $locale = get_locale(); |
| 192 | 192 | |
| 193 | - if ( ! isset( $_REQUEST['_sensei_language_nonce'] ) && wp_verify_nonce( $_REQUEST['_sensei_language_nonce'], 'language_pack' ) ) { |
|
| 194 | - wp_redirect( add_query_arg( array( 'translation_updated' => 2 ), $settings_url ) ); |
|
| 193 | + if ( ! isset($_REQUEST['_sensei_language_nonce']) && wp_verify_nonce($_REQUEST['_sensei_language_nonce'], 'language_pack')) { |
|
| 194 | + wp_redirect(add_query_arg(array('translation_updated' => 2), $settings_url)); |
|
| 195 | 195 | exit; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - if ( 'en_US' === $locale || ! self::check_if_language_pack_exists( $locale ) ) { |
|
| 199 | - wp_redirect( add_query_arg( array( 'translation_updated' => 3 ), $settings_url ) ); |
|
| 198 | + if ('en_US' === $locale || ! self::check_if_language_pack_exists($locale)) { |
|
| 199 | + wp_redirect(add_query_arg(array('translation_updated' => 3), $settings_url)); |
|
| 200 | 200 | exit; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - if ( false === ( $creds = request_filesystem_credentials( $url, '', false, false, null ) ) ) { |
|
| 204 | - wp_redirect( add_query_arg( array( 'translation_updated' => 4 ), $settings_url ) ); |
|
| 203 | + if (false === ($creds = request_filesystem_credentials($url, '', false, false, null))) { |
|
| 204 | + wp_redirect(add_query_arg(array('translation_updated' => 4), $settings_url)); |
|
| 205 | 205 | exit; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - if ( ! WP_Filesystem( $creds ) ) { |
|
| 209 | - request_filesystem_credentials( $url, '', true, false, null ); |
|
| 208 | + if ( ! WP_Filesystem($creds)) { |
|
| 209 | + request_filesystem_credentials($url, '', true, false, null); |
|
| 210 | 210 | |
| 211 | - wp_redirect( add_query_arg( array( 'translation_updated' => 4 ), $settings_url ) ); |
|
| 211 | + wp_redirect(add_query_arg(array('translation_updated' => 4), $settings_url)); |
|
| 212 | 212 | exit; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | // Download the language pack |
| 216 | - $response = wp_safe_remote_get( self::get_package_uri( $locale ), array( 'timeout' => 60 ) ); |
|
| 217 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
| 216 | + $response = wp_safe_remote_get(self::get_package_uri($locale), array('timeout' => 60)); |
|
| 217 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
| 218 | 218 | global $wp_filesystem; |
| 219 | 219 | |
| 220 | 220 | $upload_dir = wp_upload_dir(); |
| 221 | - $file = trailingslashit( $upload_dir['path'] ) . $locale . '.zip'; |
|
| 221 | + $file = trailingslashit($upload_dir['path']).$locale.'.zip'; |
|
| 222 | 222 | |
| 223 | 223 | // Save the zip file |
| 224 | - if ( ! $wp_filesystem->put_contents( $file, $response['body'], FS_CHMOD_FILE ) ) { |
|
| 225 | - wp_redirect( add_query_arg( array( 'translation_updated' => 4 ), $settings_url ) ); |
|
| 224 | + if ( ! $wp_filesystem->put_contents($file, $response['body'], FS_CHMOD_FILE)) { |
|
| 225 | + wp_redirect(add_query_arg(array('translation_updated' => 4), $settings_url)); |
|
| 226 | 226 | exit; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | // Unzip the file to wp-content/languages/plugins directory |
| 230 | - $dir = trailingslashit( WP_LANG_DIR ) . 'plugins/'; |
|
| 231 | - $unzip = unzip_file( $file, $dir ); |
|
| 232 | - if ( true !== $unzip ) { |
|
| 233 | - wp_redirect( add_query_arg( array( 'translation_updated' => 4 ), $settings_url ) ); |
|
| 230 | + $dir = trailingslashit(WP_LANG_DIR).'plugins/'; |
|
| 231 | + $unzip = unzip_file($file, $dir); |
|
| 232 | + if (true !== $unzip) { |
|
| 233 | + wp_redirect(add_query_arg(array('translation_updated' => 4), $settings_url)); |
|
| 234 | 234 | exit; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | // Delete the package file |
| 238 | - $wp_filesystem->delete( $file ); |
|
| 238 | + $wp_filesystem->delete($file); |
|
| 239 | 239 | |
| 240 | 240 | // Update version and remove notice |
| 241 | - self::update_language_pack_version( $locale ); |
|
| 241 | + self::update_language_pack_version($locale); |
|
| 242 | 242 | |
| 243 | 243 | // Redirect and show a success message |
| 244 | - wp_redirect( add_query_arg( array( 'translation_updated' => 1 ), $settings_url ) ); |
|
| 244 | + wp_redirect(add_query_arg(array('translation_updated' => 1), $settings_url)); |
|
| 245 | 245 | exit; |
| 246 | 246 | } else { |
| 247 | 247 | // Don't have a valid package for the current language! |
| 248 | - wp_redirect( add_query_arg( array( 'translation_updated' => 5 ), $settings_url ) ); |
|
| 248 | + wp_redirect(add_query_arg(array('translation_updated' => 5), $settings_url)); |
|
| 249 | 249 | exit; |
| 250 | 250 | } |
| 251 | 251 | } |
@@ -254,38 +254,38 @@ discard block |
||
| 254 | 254 | * Hide language pack notice. |
| 255 | 255 | */ |
| 256 | 256 | protected function dismiss_language_pack_notice() { |
| 257 | - if ( ! isset( $_REQUEST['_sensei_language_nonce'] ) && wp_verify_nonce( $_REQUEST['_sensei_language_nonce'], 'language_pack' ) ) { |
|
| 258 | - wp_die( __( 'Cheatin’ huh?', 'woothemes-sensei' ) ); |
|
| 257 | + if ( ! isset($_REQUEST['_sensei_language_nonce']) && wp_verify_nonce($_REQUEST['_sensei_language_nonce'], 'language_pack')) { |
|
| 258 | + wp_die(__('Cheatin’ huh?', 'woothemes-sensei')); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | // Update version and remove notice |
| 262 | - self::update_language_pack_version( get_locale() ); |
|
| 262 | + self::update_language_pack_version(get_locale()); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | 266 | * Language pack messages |
| 267 | 267 | */ |
| 268 | 268 | public static function messages() { |
| 269 | - if ( empty( $_GET['translation_updated'] ) ) { |
|
| 269 | + if (empty($_GET['translation_updated'])) { |
|
| 270 | 270 | return; |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - switch ( $_GET['translation_updated'] ) { |
|
| 273 | + switch ($_GET['translation_updated']) { |
|
| 274 | 274 | case 2 : |
| 275 | - echo '<div class="error"><p>' . __( 'Failed to install/update the translation:', 'woothemes-sensei' ) . ' ' . __( 'Seems you don\'t have permission to do this!', 'woothemes-sensei' ) . '</p></div>'; |
|
| 275 | + echo '<div class="error"><p>'.__('Failed to install/update the translation:', 'woothemes-sensei').' '.__('Seems you don\'t have permission to do this!', 'woothemes-sensei').'</p></div>'; |
|
| 276 | 276 | break; |
| 277 | 277 | case 3 : |
| 278 | - echo '<div class="error"><p>' . __( 'Failed to install/update the translation:', 'woothemes-sensei' ) . ' ' . __( 'There is no translation available for your language!', 'woothemes-sensei' ) . '</p></div>'; |
|
| 278 | + echo '<div class="error"><p>'.__('Failed to install/update the translation:', 'woothemes-sensei').' '.__('There is no translation available for your language!', 'woothemes-sensei').'</p></div>'; |
|
| 279 | 279 | break; |
| 280 | 280 | case 4 : |
| 281 | - echo '<div class="error"><p>' . __( 'Failed to install/update the translation:', 'woothemes-sensei' ) . ' ' . sprintf( __( 'An authentication error occurred while updating the translation. Please try again or configure your %sUpgrade Constants%s.', 'woothemes-sensei' ), '<a href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants">', '</a>' ) . '</p></div>'; |
|
| 281 | + echo '<div class="error"><p>'.__('Failed to install/update the translation:', 'woothemes-sensei').' '.sprintf(__('An authentication error occurred while updating the translation. Please try again or configure your %sUpgrade Constants%s.', 'woothemes-sensei'), '<a href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants">', '</a>').'</p></div>'; |
|
| 282 | 282 | break; |
| 283 | 283 | case 5 : |
| 284 | - echo '<div class="error"><p>' . __( 'Failed to install/update the translation:', 'woothemes-sensei' ) . ' ' . __( 'Sorry but there is no translation available for your language =/', 'woothemes-sensei' ) . '</p></div>'; |
|
| 284 | + echo '<div class="error"><p>'.__('Failed to install/update the translation:', 'woothemes-sensei').' '.__('Sorry but there is no translation available for your language =/', 'woothemes-sensei').'</p></div>'; |
|
| 285 | 285 | break; |
| 286 | 286 | |
| 287 | 287 | default : |
| 288 | - echo '<div class="updated"><p>' . __( 'Translations installed/updated successfully!', 'woothemes-sensei' ) . '</p></div>'; |
|
| 288 | + echo '<div class="updated"><p>'.__('Translations installed/updated successfully!', 'woothemes-sensei').'</p></div>'; |
|
| 289 | 289 | break; |
| 290 | 290 | } |
| 291 | 291 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | ?> |
| 13 | 13 | |
| 14 | -<?php get_sensei_header(); ?> |
|
| 14 | +<?php get_sensei_header(); ?> |
|
| 15 | 15 | |
| 16 | 16 | <article <?php post_class(); ?> > |
| 17 | 17 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @hooked WooThemes_Sensei_Messages::the_title - 20 |
| 27 | 27 | * @hooked WooThemes_Sensei_Messages::the_message_sent_by_title - 40 |
| 28 | 28 | */ |
| 29 | - do_action( 'sensei_single_message_content_inside_before', get_the_ID()); |
|
| 29 | + do_action('sensei_single_message_content_inside_before', get_the_ID()); |
|
| 30 | 30 | ?> |
| 31 | 31 | |
| 32 | 32 | <section class="entry"> |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @param integer $message_id |
| 45 | 45 | */ |
| 46 | - do_action( 'sensei_single_message_content_inside_after', get_the_ID()); |
|
| 46 | + do_action('sensei_single_message_content_inside_after', get_the_ID()); |
|
| 47 | 47 | |
| 48 | 48 | ?> |
| 49 | 49 | </article><!-- .post --> |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | ?> |
| 13 | 13 | |
| 14 | -<?php get_sensei_header(); ?> |
|
| 14 | +<?php get_sensei_header(); ?> |
|
| 15 | 15 | |
| 16 | 16 | <article <?php post_class(); ?>> |
| 17 | 17 | |
@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | * @param integer $quiz_id |
| 28 | 28 | * |
| 29 | 29 | */ |
| 30 | - do_action( 'sensei_single_quiz_content_inside_before', get_the_ID() ); |
|
| 30 | + do_action('sensei_single_quiz_content_inside_before', get_the_ID()); |
|
| 31 | 31 | |
| 32 | 32 | ?> |
| 33 | 33 | |
| 34 | 34 | <section class="entry quiz-questions"> |
| 35 | 35 | |
| 36 | - <?php if ( sensei_quiz_has_questions() ): ?> |
|
| 36 | + <?php if (sensei_quiz_has_questions()): ?> |
|
| 37 | 37 | |
| 38 | - <form method="POST" action="<?php echo esc_url_raw( get_permalink() ); ?>" enctype="multipart/form-data"> |
|
| 38 | + <form method="POST" action="<?php echo esc_url_raw(get_permalink()); ?>" enctype="multipart/form-data"> |
|
| 39 | 39 | |
| 40 | 40 | <?php |
| 41 | 41 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @param string $the_quiz_id |
| 48 | 48 | */ |
| 49 | - do_action( 'sensei_single_quiz_questions_before', get_the_id() ); |
|
| 49 | + do_action('sensei_single_quiz_questions_before', get_the_id()); |
|
| 50 | 50 | |
| 51 | 51 | ?> |
| 52 | 52 | |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | <ol id="sensei-quiz-list"> |
| 56 | 56 | |
| 57 | - <?php while ( sensei_quiz_has_questions() ): sensei_setup_the_question(); ?> |
|
| 57 | + <?php while (sensei_quiz_has_questions()): sensei_setup_the_question(); ?> |
|
| 58 | 58 | |
| 59 | - <li class="<?php sensei_the_question_class();?>"> |
|
| 59 | + <li class="<?php sensei_the_question_class(); ?>"> |
|
| 60 | 60 | |
| 61 | 61 | <?php |
| 62 | 62 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * @since 1.9.0 |
| 72 | 72 | * @param string $the_question_id |
| 73 | 73 | */ |
| 74 | - do_action( 'sensei_quiz_question_inside_before', sensei_get_the_question_id() ); |
|
| 74 | + do_action('sensei_quiz_question_inside_before', sensei_get_the_question_id()); |
|
| 75 | 75 | |
| 76 | 76 | ?> |
| 77 | 77 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @param string $the_question_id |
| 88 | 88 | */ |
| 89 | - do_action( 'sensei_quiz_question_inside_after', sensei_get_the_question_id() ); |
|
| 89 | + do_action('sensei_quiz_question_inside_after', sensei_get_the_question_id()); |
|
| 90 | 90 | |
| 91 | 91 | ?> |
| 92 | 92 | |
@@ -103,21 +103,21 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @param string $the_quiz_id |
| 105 | 105 | */ |
| 106 | - do_action( 'sensei_single_quiz_questions_after', get_the_id() ); |
|
| 106 | + do_action('sensei_single_quiz_questions_after', get_the_id()); |
|
| 107 | 107 | |
| 108 | 108 | ?> |
| 109 | 109 | |
| 110 | 110 | </form> |
| 111 | 111 | <?php else: ?> |
| 112 | 112 | |
| 113 | - <div class="sensei-message alert"> <?php _e( 'There are no questions for this Quiz yet. Check back soon.', 'woothemes-sensei' ); ?></div> |
|
| 113 | + <div class="sensei-message alert"> <?php _e('There are no questions for this Quiz yet. Check back soon.', 'woothemes-sensei'); ?></div> |
|
| 114 | 114 | |
| 115 | 115 | <?php endif; // End If have questions ?> |
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | <?php |
| 119 | 119 | $quiz_lesson = Sensei()->quiz->data->quiz_lesson; |
| 120 | - do_action( 'sensei_quiz_back_link', $quiz_lesson ); |
|
| 120 | + do_action('sensei_quiz_back_link', $quiz_lesson); |
|
| 121 | 121 | ?> |
| 122 | 122 | |
| 123 | 123 | </section> |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @param integer $quiz_id |
| 133 | 133 | * |
| 134 | 134 | */ |
| 135 | - do_action( 'sensei_single_quiz_content_inside_after', get_the_ID() ); |
|
| 135 | + do_action('sensei_single_quiz_content_inside_after', get_the_ID()); |
|
| 136 | 136 | |
| 137 | 137 | ?> |
| 138 | 138 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 2 | +if ( ! defined('ABSPATH')) exit; |
|
| 3 | 3 | /** |
| 4 | 4 | * Content-course.php template file |
| 5 | 5 | * |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | ?> |
| 16 | 16 | |
| 17 | -<li <?php post_class( WooThemes_Sensei_Course::get_course_loop_content_class() ); ?> > |
|
| 17 | +<li <?php post_class(WooThemes_Sensei_Course::get_course_loop_content_class()); ?> > |
|
| 18 | 18 | |
| 19 | 19 | <?php |
| 20 | 20 | /** |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @param integer $course_id |
| 27 | 27 | */ |
| 28 | - do_action( 'sensei_course_content_before', get_the_ID() ); |
|
| 28 | + do_action('sensei_course_content_before', get_the_ID()); |
|
| 29 | 29 | ?> |
| 30 | 30 | |
| 31 | 31 | <section class="course-content"> |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @hooked Sensei()->course->course_image - 10 |
| 45 | 45 | * @hooked Sensei()->course->the_course_meta - 20 |
| 46 | 46 | */ |
| 47 | - do_action('sensei_course_content_inside_before', get_the_ID() ); |
|
| 47 | + do_action('sensei_course_content_inside_before', get_the_ID()); |
|
| 48 | 48 | ?> |
| 49 | 49 | |
| 50 | 50 | <p class="course-excerpt"> |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @hooked Sensei()->course->the_course_free_lesson_preview - 20 |
| 65 | 65 | */ |
| 66 | - do_action('sensei_course_content_inside_after', get_the_ID() ); |
|
| 66 | + do_action('sensei_course_content_inside_after', get_the_ID()); |
|
| 67 | 67 | ?> |
| 68 | 68 | |
| 69 | 69 | </section> <!-- section .entry --> |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @hooked Sensei()->course->the_course_free_lesson_preview - 20 |
| 82 | 82 | */ |
| 83 | - do_action('sensei_course_content_after', get_the_ID() ); |
|
| 83 | + do_action('sensei_course_content_after', get_the_ID()); |
|
| 84 | 84 | ?> |
| 85 | 85 | |
| 86 | 86 | |
| 87 | -</li> <!-- article .(<?php esc_attr_e( join( ' ', get_post_class( array( 'course', 'post' ) ) ) ); ?> --> |
|
| 88 | 87 | \ No newline at end of file |
| 88 | +</li> <!-- article .(<?php esc_attr_e(join(' ', get_post_class(array('course', 'post')))); ?> --> |
|
| 89 | 89 | \ No newline at end of file |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | ?> |
| 13 | 13 | |
| 14 | -<?php get_sensei_header(); ?> |
|
| 14 | +<?php get_sensei_header(); ?> |
|
| 15 | 15 | |
| 16 | 16 | <?php the_post(); ?> |
| 17 | 17 | |
| 18 | -<article <?php post_class( array( 'lesson', 'post' ) ); ?>> |
|
| 18 | +<article <?php post_class(array('lesson', 'post')); ?>> |
|
| 19 | 19 | |
| 20 | 20 | <?php |
| 21 | 21 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @hooked Sensei_Lesson::lesson_image() - 17 |
| 32 | 32 | * @hooked deprecate_lesson_single_main_content_hook - 20 |
| 33 | 33 | */ |
| 34 | - do_action( 'sensei_single_lesson_content_inside_before', get_the_ID() ); |
|
| 34 | + do_action('sensei_single_lesson_content_inside_before', get_the_ID()); |
|
| 35 | 35 | |
| 36 | 36 | ?> |
| 37 | 37 | |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | <?php |
| 41 | 41 | |
| 42 | - if ( sensei_can_user_view_lesson() ) { |
|
| 42 | + if (sensei_can_user_view_lesson()) { |
|
| 43 | 43 | |
| 44 | - if( apply_filters( 'sensei_video_position', 'top', $post->ID ) == 'top' ) { |
|
| 44 | + if (apply_filters('sensei_video_position', 'top', $post->ID) == 'top') { |
|
| 45 | 45 | |
| 46 | - do_action( 'sensei_lesson_video', $post->ID ); |
|
| 46 | + do_action('sensei_lesson_video', $post->ID); |
|
| 47 | 47 | |
| 48 | 48 | } |
| 49 | 49 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @hooked Sensei()->frontend->sensei_breadcrumb - 30 |
| 74 | 74 | */ |
| 75 | - do_action( 'sensei_single_lesson_content_inside_after', get_the_ID() ); |
|
| 75 | + do_action('sensei_single_lesson_content_inside_after', get_the_ID()); |
|
| 76 | 76 | |
| 77 | 77 | ?> |
| 78 | 78 | |
@@ -11,9 +11,9 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | ?> |
| 13 | 13 | |
| 14 | -<?php get_sensei_header(); ?> |
|
| 14 | +<?php get_sensei_header(); ?> |
|
| 15 | 15 | |
| 16 | -<article <?php post_class( array( 'course', 'post' ) ); ?>> |
|
| 16 | +<article <?php post_class(array('course', 'post')); ?>> |
|
| 17 | 17 | |
| 18 | 18 | <?php |
| 19 | 19 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @hooked Sensei()->message->send_message_link - 35 |
| 33 | 33 | * @hooked Sensei_Course::the_course_video - 40 |
| 34 | 34 | */ |
| 35 | - do_action( 'sensei_single_course_content_inside_before', get_the_ID() ); |
|
| 35 | + do_action('sensei_single_course_content_inside_before', get_the_ID()); |
|
| 36 | 36 | |
| 37 | 37 | ?> |
| 38 | 38 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @param integer $course_id |
| 53 | 53 | * |
| 54 | 54 | */ |
| 55 | - do_action( 'sensei_single_course_content_inside_after', get_the_ID() ); |
|
| 55 | + do_action('sensei_single_course_content_inside_after', get_the_ID()); |
|
| 56 | 56 | |
| 57 | 57 | ?> |
| 58 | 58 | </article><!-- .post .single-course --> |
@@ -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,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,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 |