@@ -6,11 +6,11 @@ discard block |
||
| 6 | 6 | * @subpackage comment-walker |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | -if ( ! function_exists( 'lsx_get_avatar' ) ) : |
|
| 13 | +if ( ! function_exists('lsx_get_avatar')) : |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Comment Form Field Filter. |
@@ -18,25 +18,25 @@ discard block |
||
| 18 | 18 | * @package lsx |
| 19 | 19 | * @subpackage comment-walker |
| 20 | 20 | */ |
| 21 | - function lsx_get_avatar( $avatar ) { |
|
| 22 | - $avatar = str_replace( "class='avatar", "class='avatar pull-left media-object ", $avatar ); |
|
| 23 | - $avatar = str_replace( 'class="avatar', 'class="avatar pull-left media-object ', $avatar ); |
|
| 21 | + function lsx_get_avatar($avatar) { |
|
| 22 | + $avatar = str_replace("class='avatar", "class='avatar pull-left media-object ", $avatar); |
|
| 23 | + $avatar = str_replace('class="avatar', 'class="avatar pull-left media-object ', $avatar); |
|
| 24 | 24 | return $avatar; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | endif; |
| 28 | 28 | |
| 29 | -add_filter( 'get_avatar', 'lsx_get_avatar' ); |
|
| 29 | +add_filter('get_avatar', 'lsx_get_avatar'); |
|
| 30 | 30 | |
| 31 | -add_action( 'admin_bar_menu', function() { |
|
| 32 | - remove_filter( 'get_avatar', 'lsx_get_avatar' ); |
|
| 33 | -}, 0 ); |
|
| 31 | +add_action('admin_bar_menu', function() { |
|
| 32 | + remove_filter('get_avatar', 'lsx_get_avatar'); |
|
| 33 | +}, 0); |
|
| 34 | 34 | |
| 35 | -add_action( 'wp_after_admin_bar_render', function() { |
|
| 36 | - add_filter( 'get_avatar', 'lsx_get_avatar' ); |
|
| 35 | +add_action('wp_after_admin_bar_render', function() { |
|
| 36 | + add_filter('get_avatar', 'lsx_get_avatar'); |
|
| 37 | 37 | } ); |
| 38 | 38 | |
| 39 | -if ( ! function_exists( 'lsx_comment_form_fields_filter' ) ) : |
|
| 39 | +if ( ! function_exists('lsx_comment_form_fields_filter')) : |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * Comment Form Field Filter. |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | * @package lsx |
| 45 | 45 | * @subpackage comment-walker |
| 46 | 46 | */ |
| 47 | - function lsx_comment_form_fields_filter( $fields ) { |
|
| 48 | - foreach ( $fields as &$field ) { |
|
| 49 | - if ( stristr( 'class=', $field ) ) { |
|
| 50 | - $field = str_replace( 'class="', 'class="form-control ', $field ); |
|
| 47 | + function lsx_comment_form_fields_filter($fields) { |
|
| 48 | + foreach ($fields as &$field) { |
|
| 49 | + if (stristr('class=', $field)) { |
|
| 50 | + $field = str_replace('class="', 'class="form-control ', $field); |
|
| 51 | 51 | } else { |
| 52 | - $field = str_replace( '<input', '<input class="form-control" ', $field ); |
|
| 52 | + $field = str_replace('<input', '<input class="form-control" ', $field); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
@@ -58,4 +58,4 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | endif; |
| 60 | 60 | |
| 61 | -add_filter( 'comment_form_default_fields', 'lsx_comment_form_fields_filter' ); |
|
| 61 | +add_filter('comment_form_default_fields', 'lsx_comment_form_fields_filter'); |
|
@@ -7,54 +7,54 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | - exit; |
|
| 10 | + exit; |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | if ( ! function_exists( 'lsx_get_avatar' ) ) : |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Comment Form Field Filter. |
|
| 17 | - * |
|
| 18 | - * @package lsx |
|
| 19 | - * @subpackage comment-walker |
|
| 20 | - */ |
|
| 21 | - function lsx_get_avatar( $avatar ) { |
|
| 22 | - $avatar = str_replace( "class='avatar", "class='avatar pull-left media-object ", $avatar ); |
|
| 23 | - $avatar = str_replace( 'class="avatar', 'class="avatar pull-left media-object ', $avatar ); |
|
| 24 | - return $avatar; |
|
| 25 | - } |
|
| 15 | + /** |
|
| 16 | + * Comment Form Field Filter. |
|
| 17 | + * |
|
| 18 | + * @package lsx |
|
| 19 | + * @subpackage comment-walker |
|
| 20 | + */ |
|
| 21 | + function lsx_get_avatar( $avatar ) { |
|
| 22 | + $avatar = str_replace( "class='avatar", "class='avatar pull-left media-object ", $avatar ); |
|
| 23 | + $avatar = str_replace( 'class="avatar', 'class="avatar pull-left media-object ', $avatar ); |
|
| 24 | + return $avatar; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | 27 | endif; |
| 28 | 28 | |
| 29 | 29 | add_filter( 'get_avatar', 'lsx_get_avatar' ); |
| 30 | 30 | |
| 31 | 31 | add_action( 'admin_bar_menu', function() { |
| 32 | - remove_filter( 'get_avatar', 'lsx_get_avatar' ); |
|
| 32 | + remove_filter( 'get_avatar', 'lsx_get_avatar' ); |
|
| 33 | 33 | }, 0 ); |
| 34 | 34 | |
| 35 | 35 | add_action( 'wp_after_admin_bar_render', function() { |
| 36 | - add_filter( 'get_avatar', 'lsx_get_avatar' ); |
|
| 36 | + add_filter( 'get_avatar', 'lsx_get_avatar' ); |
|
| 37 | 37 | } ); |
| 38 | 38 | |
| 39 | 39 | if ( ! function_exists( 'lsx_comment_form_fields_filter' ) ) : |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Comment Form Field Filter. |
|
| 43 | - * |
|
| 44 | - * @package lsx |
|
| 45 | - * @subpackage comment-walker |
|
| 46 | - */ |
|
| 47 | - function lsx_comment_form_fields_filter( $fields ) { |
|
| 48 | - foreach ( $fields as &$field ) { |
|
| 49 | - if ( stristr( 'class=', $field ) ) { |
|
| 50 | - $field = str_replace( 'class="', 'class="form-control ', $field ); |
|
| 51 | - } else { |
|
| 52 | - $field = str_replace( '<input', '<input class="form-control" ', $field ); |
|
| 53 | - } |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - return $fields; |
|
| 57 | - } |
|
| 41 | + /** |
|
| 42 | + * Comment Form Field Filter. |
|
| 43 | + * |
|
| 44 | + * @package lsx |
|
| 45 | + * @subpackage comment-walker |
|
| 46 | + */ |
|
| 47 | + function lsx_comment_form_fields_filter( $fields ) { |
|
| 48 | + foreach ( $fields as &$field ) { |
|
| 49 | + if ( stristr( 'class=', $field ) ) { |
|
| 50 | + $field = str_replace( 'class="', 'class="form-control ', $field ); |
|
| 51 | + } else { |
|
| 52 | + $field = str_replace( '<input', '<input class="form-control" ', $field ); |
|
| 53 | + } |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + return $fields; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | 59 | endif; |
| 60 | 60 | |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @subpackage sensei |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; // Exit if accessed directly. |
| 11 | 11 | } |
| 12 | 12 | |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | * Constructor. |
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | - add_action( 'init', array( $this, 'init' ) ); |
|
| 30 | - add_action( 'widgets_init', array( $this, 'lsx_widget_area_sensei_init' ), 100 ); |
|
| 31 | - add_filter( 'body_class', array( $this, 'lsx_widget_area_sensei_is_active' ) ); |
|
| 29 | + add_action('init', array($this, 'init')); |
|
| 30 | + add_action('widgets_init', array($this, 'lsx_widget_area_sensei_init'), 100); |
|
| 31 | + add_filter('body_class', array($this, 'lsx_widget_area_sensei_is_active')); |
|
| 32 | 32 | } // End __construct() |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @return self |
| 38 | 38 | */ |
| 39 | 39 | public static function instance() { |
| 40 | - if ( ! self::$instance ) { |
|
| 40 | + if ( ! self::$instance) { |
|
| 41 | 41 | self::$instance = new self(); |
| 42 | 42 | } |
| 43 | 43 | return self::$instance; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * Run our changes. |
| 48 | 48 | */ |
| 49 | 49 | public function init() { |
| 50 | - add_action( 'lsx_content_top', array( $this, 'lsx_sensei_lesson_sidebar' ) ); |
|
| 50 | + add_action('lsx_content_top', array($this, 'lsx_sensei_lesson_sidebar')); |
|
| 51 | 51 | |
| 52 | 52 | } |
| 53 | 53 | |
@@ -57,15 +57,15 @@ discard block |
||
| 57 | 57 | * @return void |
| 58 | 58 | */ |
| 59 | 59 | public function lsx_widget_area_sensei_init() { |
| 60 | - if ( class_exists( 'Sensei_Course_Participants' ) || class_exists( 'Sensei_Course_Progress' ) ) { |
|
| 61 | - register_sidebar( array( |
|
| 62 | - 'name' => esc_html__( 'LSX Sensei Sidebar', 'lsx' ), |
|
| 60 | + if (class_exists('Sensei_Course_Participants') || class_exists('Sensei_Course_Progress')) { |
|
| 61 | + register_sidebar(array( |
|
| 62 | + 'name' => esc_html__('LSX Sensei Sidebar', 'lsx'), |
|
| 63 | 63 | 'id' => 'lsx-sensei-sidebar', |
| 64 | 64 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
| 65 | 65 | 'after_widget' => '</aside>', |
| 66 | 66 | 'before_title' => '<h3 class="widget-title">', |
| 67 | 67 | 'after_title' => '</h3>', |
| 68 | - ) ); |
|
| 68 | + )); |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | * @param [type] $classes |
| 76 | 76 | * @return classes |
| 77 | 77 | */ |
| 78 | - public function lsx_widget_area_sensei_is_active( $classes ) { |
|
| 78 | + public function lsx_widget_area_sensei_is_active($classes) { |
|
| 79 | 79 | |
| 80 | - if ( class_exists( 'Sensei_Lesson' ) && is_active_sidebar( 'lsx-sensei-sidebar' ) ) { |
|
| 80 | + if (class_exists('Sensei_Lesson') && is_active_sidebar('lsx-sensei-sidebar')) { |
|
| 81 | 81 | $classes[] = 'lsx-sensei-sidebar-active'; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | * @return void |
| 91 | 91 | */ |
| 92 | 92 | public function lsx_sensei_lesson_sidebar() { |
| 93 | - if ( class_exists( 'Sensei_Lesson' ) && ( class_exists( 'Sensei_Course_Participants' ) || class_exists( 'Sensei_Course_Progress' ) ) ) { |
|
| 94 | - if ( ( is_single() && ( is_singular( 'lesson' ) ) ) || ( is_single() && ( is_singular( 'quiz' ) ) ) ) { |
|
| 95 | - if ( is_active_sidebar( 'lsx-sensei-sidebar' ) ) { |
|
| 93 | + if (class_exists('Sensei_Lesson') && (class_exists('Sensei_Course_Participants') || class_exists('Sensei_Course_Progress'))) { |
|
| 94 | + if ((is_single() && (is_singular('lesson'))) || (is_single() && (is_singular('quiz')))) { |
|
| 95 | + if (is_active_sidebar('lsx-sensei-sidebar')) { |
|
| 96 | 96 | echo '<div id="secondary" class="widget-area lsx-sensei-sidebar">'; |
| 97 | - dynamic_sidebar( 'lsx-sensei-sidebar' ); |
|
| 97 | + dynamic_sidebar('lsx-sensei-sidebar'); |
|
| 98 | 98 | echo '</div>'; |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | - exit; // Exit if accessed directly. |
|
| 10 | + exit; // Exit if accessed directly. |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | /** |
@@ -15,91 +15,91 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | class LSX_Sensei_Lesson { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Instance of class. |
|
| 20 | - * |
|
| 21 | - * @var self |
|
| 22 | - */ |
|
| 23 | - private static $instance; |
|
| 18 | + /** |
|
| 19 | + * Instance of class. |
|
| 20 | + * |
|
| 21 | + * @var self |
|
| 22 | + */ |
|
| 23 | + private static $instance; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Constructor. |
|
| 27 | - */ |
|
| 28 | - public function __construct() { |
|
| 29 | - add_action( 'init', array( $this, 'init' ) ); |
|
| 30 | - add_action( 'widgets_init', array( $this, 'lsx_widget_area_sensei_init' ), 100 ); |
|
| 31 | - add_filter( 'body_class', array( $this, 'lsx_widget_area_sensei_is_active' ) ); |
|
| 32 | - } // End __construct() |
|
| 25 | + /** |
|
| 26 | + * Constructor. |
|
| 27 | + */ |
|
| 28 | + public function __construct() { |
|
| 29 | + add_action( 'init', array( $this, 'init' ) ); |
|
| 30 | + add_action( 'widgets_init', array( $this, 'lsx_widget_area_sensei_init' ), 100 ); |
|
| 31 | + add_filter( 'body_class', array( $this, 'lsx_widget_area_sensei_is_active' ) ); |
|
| 32 | + } // End __construct() |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Fetches an instance of the class. |
|
| 36 | - * |
|
| 37 | - * @return self |
|
| 38 | - */ |
|
| 39 | - public static function instance() { |
|
| 40 | - if ( ! self::$instance ) { |
|
| 41 | - self::$instance = new self(); |
|
| 42 | - } |
|
| 43 | - return self::$instance; |
|
| 44 | - } |
|
| 34 | + /** |
|
| 35 | + * Fetches an instance of the class. |
|
| 36 | + * |
|
| 37 | + * @return self |
|
| 38 | + */ |
|
| 39 | + public static function instance() { |
|
| 40 | + if ( ! self::$instance ) { |
|
| 41 | + self::$instance = new self(); |
|
| 42 | + } |
|
| 43 | + return self::$instance; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Run our changes. |
|
| 48 | - */ |
|
| 49 | - public function init() { |
|
| 50 | - add_action( 'lsx_content_top', array( $this, 'lsx_sensei_lesson_sidebar' ) ); |
|
| 46 | + /** |
|
| 47 | + * Run our changes. |
|
| 48 | + */ |
|
| 49 | + public function init() { |
|
| 50 | + add_action( 'lsx_content_top', array( $this, 'lsx_sensei_lesson_sidebar' ) ); |
|
| 51 | 51 | |
| 52 | - } |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Register a sidebar when Sensei Participants or Sensei Progress plugins are active. |
|
| 56 | - * |
|
| 57 | - * @return void |
|
| 58 | - */ |
|
| 59 | - public function lsx_widget_area_sensei_init() { |
|
| 60 | - if ( class_exists( 'Sensei_Course_Participants' ) || class_exists( 'Sensei_Course_Progress' ) ) { |
|
| 61 | - register_sidebar( array( |
|
| 62 | - 'name' => esc_html__( 'LSX Sensei Sidebar', 'lsx' ), |
|
| 63 | - 'id' => 'lsx-sensei-sidebar', |
|
| 64 | - 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
|
| 65 | - 'after_widget' => '</aside>', |
|
| 66 | - 'before_title' => '<h3 class="widget-title">', |
|
| 67 | - 'after_title' => '</h3>', |
|
| 68 | - ) ); |
|
| 69 | - } |
|
| 70 | - } |
|
| 54 | + /** |
|
| 55 | + * Register a sidebar when Sensei Participants or Sensei Progress plugins are active. |
|
| 56 | + * |
|
| 57 | + * @return void |
|
| 58 | + */ |
|
| 59 | + public function lsx_widget_area_sensei_init() { |
|
| 60 | + if ( class_exists( 'Sensei_Course_Participants' ) || class_exists( 'Sensei_Course_Progress' ) ) { |
|
| 61 | + register_sidebar( array( |
|
| 62 | + 'name' => esc_html__( 'LSX Sensei Sidebar', 'lsx' ), |
|
| 63 | + 'id' => 'lsx-sensei-sidebar', |
|
| 64 | + 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
|
| 65 | + 'after_widget' => '</aside>', |
|
| 66 | + 'before_title' => '<h3 class="widget-title">', |
|
| 67 | + 'after_title' => '</h3>', |
|
| 68 | + ) ); |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Widget Area for sensei. |
|
| 74 | - * |
|
| 75 | - * @param [type] $classes |
|
| 76 | - * @return classes |
|
| 77 | - */ |
|
| 78 | - public function lsx_widget_area_sensei_is_active( $classes ) { |
|
| 72 | + /** |
|
| 73 | + * Widget Area for sensei. |
|
| 74 | + * |
|
| 75 | + * @param [type] $classes |
|
| 76 | + * @return classes |
|
| 77 | + */ |
|
| 78 | + public function lsx_widget_area_sensei_is_active( $classes ) { |
|
| 79 | 79 | |
| 80 | - if ( class_exists( 'Sensei_Lesson' ) && is_active_sidebar( 'lsx-sensei-sidebar' ) ) { |
|
| 81 | - $classes[] = 'lsx-sensei-sidebar-active'; |
|
| 82 | - } |
|
| 80 | + if ( class_exists( 'Sensei_Lesson' ) && is_active_sidebar( 'lsx-sensei-sidebar' ) ) { |
|
| 81 | + $classes[] = 'lsx-sensei-sidebar-active'; |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - return $classes; |
|
| 85 | - } |
|
| 84 | + return $classes; |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * Adds the widget content to the lesson template if the lsx-sensei-sidebar is active. |
|
| 89 | - * |
|
| 90 | - * @return void |
|
| 91 | - */ |
|
| 92 | - public function lsx_sensei_lesson_sidebar() { |
|
| 93 | - if ( class_exists( 'Sensei_Lesson' ) && ( class_exists( 'Sensei_Course_Participants' ) || class_exists( 'Sensei_Course_Progress' ) ) ) { |
|
| 94 | - if ( ( is_single() && ( is_singular( 'lesson' ) ) ) || ( is_single() && ( is_singular( 'quiz' ) ) ) ) { |
|
| 95 | - if ( is_active_sidebar( 'lsx-sensei-sidebar' ) ) { |
|
| 96 | - echo '<div id="secondary" class="widget-area lsx-sensei-sidebar">'; |
|
| 97 | - dynamic_sidebar( 'lsx-sensei-sidebar' ); |
|
| 98 | - echo '</div>'; |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - } |
|
| 87 | + /** |
|
| 88 | + * Adds the widget content to the lesson template if the lsx-sensei-sidebar is active. |
|
| 89 | + * |
|
| 90 | + * @return void |
|
| 91 | + */ |
|
| 92 | + public function lsx_sensei_lesson_sidebar() { |
|
| 93 | + if ( class_exists( 'Sensei_Lesson' ) && ( class_exists( 'Sensei_Course_Participants' ) || class_exists( 'Sensei_Course_Progress' ) ) ) { |
|
| 94 | + if ( ( is_single() && ( is_singular( 'lesson' ) ) ) || ( is_single() && ( is_singular( 'quiz' ) ) ) ) { |
|
| 95 | + if ( is_active_sidebar( 'lsx-sensei-sidebar' ) ) { |
|
| 96 | + echo '<div id="secondary" class="widget-area lsx-sensei-sidebar">'; |
|
| 97 | + dynamic_sidebar( 'lsx-sensei-sidebar' ); |
|
| 98 | + echo '</div>'; |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | 104 | } // End Class |
| 105 | 105 | new LSX_Sensei_Lesson(); |
@@ -7,15 +7,15 @@ discard block |
||
| 7 | 7 | * @category core |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | +if ( ! defined('ABSPATH')) { |
|
| 11 | 11 | exit; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -if ( ! class_exists( 'WP_Customize_Control' ) ) { |
|
| 14 | +if ( ! class_exists('WP_Customize_Control')) { |
|
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( 'LSX_Customize_Core_Control' ) ) : |
|
| 18 | +if ( ! class_exists('LSX_Customize_Core_Control')) : |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * LSX_Customize_Core_Control Class |
@@ -35,16 +35,16 @@ discard block |
||
| 35 | 35 | ?> |
| 36 | 36 | <label> |
| 37 | 37 | <?php |
| 38 | - if ( ! empty( $this->label ) ) { |
|
| 38 | + if ( ! empty($this->label)) { |
|
| 39 | 39 | ?> |
| 40 | - <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
| 40 | + <span class="customize-control-title"><?php echo esc_html($this->label); ?></span> |
|
| 41 | 41 | <?php |
| 42 | 42 | } |
| 43 | - if ( ! empty( $this->description ) ) { |
|
| 43 | + if ( ! empty($this->description)) { |
|
| 44 | 44 | ?> |
| 45 | - <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
|
| 45 | + <span class="description customize-control-description"><?php echo esc_html($this->description); ?></span> |
|
| 46 | 46 | <?php } ?> |
| 47 | - <input <?php $this->link(); ?> type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->input_attrs(); ?>> |
|
| 47 | + <input <?php $this->link(); ?> type="checkbox" value="<?php echo esc_attr($this->value()); ?>" <?php $this->input_attrs(); ?>> |
|
| 48 | 48 | </label> |
| 49 | 49 | <?php |
| 50 | 50 | } |
@@ -8,47 +8,47 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | - exit; |
|
| 11 | + exit; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | if ( ! class_exists( 'WP_Customize_Control' ) ) { |
| 15 | - return; |
|
| 15 | + return; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | if ( ! class_exists( 'LSX_Customize_Core_Control' ) ) : |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * LSX_Customize_Core_Control Class |
|
| 22 | - * |
|
| 23 | - * @package lsx |
|
| 24 | - * @subpackage customizer |
|
| 25 | - * @category core |
|
| 26 | - */ |
|
| 27 | - class LSX_Customize_Core_Control extends WP_Customize_Control { |
|
| 28 | - |
|
| 29 | - public $type = 'core'; |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * Render output. |
|
| 33 | - */ |
|
| 34 | - public function render_content() { |
|
| 35 | - ?> |
|
| 20 | + /** |
|
| 21 | + * LSX_Customize_Core_Control Class |
|
| 22 | + * |
|
| 23 | + * @package lsx |
|
| 24 | + * @subpackage customizer |
|
| 25 | + * @category core |
|
| 26 | + */ |
|
| 27 | + class LSX_Customize_Core_Control extends WP_Customize_Control { |
|
| 28 | + |
|
| 29 | + public $type = 'core'; |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * Render output. |
|
| 33 | + */ |
|
| 34 | + public function render_content() { |
|
| 35 | + ?> |
|
| 36 | 36 | <label> |
| 37 | 37 | <?php |
| 38 | - if ( ! empty( $this->label ) ) { |
|
| 39 | - ?> |
|
| 38 | + if ( ! empty( $this->label ) ) { |
|
| 39 | + ?> |
|
| 40 | 40 | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
| 41 | 41 | <?php |
| 42 | - } |
|
| 43 | - if ( ! empty( $this->description ) ) { |
|
| 44 | - ?> |
|
| 42 | + } |
|
| 43 | + if ( ! empty( $this->description ) ) { |
|
| 44 | + ?> |
|
| 45 | 45 | <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
| 46 | 46 | <?php } ?> |
| 47 | 47 | <input <?php $this->link(); ?> type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->input_attrs(); ?>> |
| 48 | 48 | </label> |
| 49 | 49 | <?php |
| 50 | - } |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - } |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | endif; |
@@ -6,11 +6,11 @@ discard block |
||
| 6 | 6 | * @subpackage customizer |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | -if ( ! class_exists( 'LSX_Theme_Customizer' ) ) : |
|
| 13 | +if ( ! class_exists('LSX_Theme_Customizer')) : |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Customizer Configuration File |
@@ -26,22 +26,22 @@ discard block |
||
| 26 | 26 | /** |
| 27 | 27 | * Initialize the plugin by setting localization and loading public scripts and styles. |
| 28 | 28 | */ |
| 29 | - public function __construct( $controls ) { |
|
| 29 | + public function __construct($controls) { |
|
| 30 | 30 | require get_template_directory() . '/includes/classes/class-lsx-customize-core-control.php'; |
| 31 | 31 | require get_template_directory() . '/includes/classes/class-lsx-customize-layout-control.php'; |
| 32 | 32 | require get_template_directory() . '/includes/classes/class-lsx-customize-header-layout-control.php'; |
| 33 | 33 | |
| 34 | 34 | $this->controls = $controls; |
| 35 | 35 | |
| 36 | - add_action( 'customize_preview_init', array( $this, 'customize_preview_js' ), 20 ); |
|
| 37 | - add_action( 'customize_register', array( $this, 'customizer' ), 11 ); |
|
| 36 | + add_action('customize_preview_init', array($this, 'customize_preview_js'), 20); |
|
| 37 | + add_action('customize_register', array($this, 'customizer'), 11); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. |
| 42 | 42 | */ |
| 43 | 43 | public function customize_preview_js() { |
| 44 | - wp_enqueue_script( 'lsx_customizer', get_template_directory_uri() . '/assets/js/admin/customizer.js', array( 'customize-preview' ), LSX_VERSION, true ); |
|
| 44 | + wp_enqueue_script('lsx_customizer', get_template_directory_uri() . '/assets/js/admin/customizer.js', array('customize-preview'), LSX_VERSION, true); |
|
| 45 | 45 | |
| 46 | 46 | wp_localize_script( |
| 47 | 47 | 'lsx_customizer', |
@@ -55,52 +55,52 @@ discard block |
||
| 55 | 55 | /** |
| 56 | 56 | * Create customiser controls. |
| 57 | 57 | */ |
| 58 | - public function customizer( $wp_customize ) { |
|
| 58 | + public function customizer($wp_customize) { |
|
| 59 | 59 | // Start panels. |
| 60 | - if ( ! empty( $this->controls['panels'] ) ) { |
|
| 61 | - foreach ( $this->controls['panels'] as $panel_slug => $args ) { |
|
| 62 | - $this->add_panel( $panel_slug, $args, $wp_customize ); |
|
| 60 | + if ( ! empty($this->controls['panels'])) { |
|
| 61 | + foreach ($this->controls['panels'] as $panel_slug => $args) { |
|
| 62 | + $this->add_panel($panel_slug, $args, $wp_customize); |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // Start sections. |
| 67 | - if ( ! empty( $this->controls['sections'] ) ) { |
|
| 68 | - foreach ( $this->controls['sections'] as $section_slug => $args ) { |
|
| 69 | - $this->add_section( $section_slug, $args, $wp_customize ); |
|
| 67 | + if ( ! empty($this->controls['sections'])) { |
|
| 68 | + foreach ($this->controls['sections'] as $section_slug => $args) { |
|
| 69 | + $this->add_section($section_slug, $args, $wp_customize); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // Start settings. |
| 74 | - if ( ! empty( $this->controls['settings'] ) ) { |
|
| 75 | - foreach ( $this->controls['settings'] as $settings_slug => $args ) { |
|
| 76 | - $this->add_setting( $settings_slug, $args, $wp_customize ); |
|
| 74 | + if ( ! empty($this->controls['settings'])) { |
|
| 75 | + foreach ($this->controls['settings'] as $settings_slug => $args) { |
|
| 76 | + $this->add_setting($settings_slug, $args, $wp_customize); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // Start fields. |
| 81 | - if ( ! empty( $this->controls['fields'] ) ) { |
|
| 82 | - foreach ( $this->controls['fields'] as $field_slug => $args ) { |
|
| 83 | - $this->add_control( $field_slug, $args, $wp_customize ); |
|
| 81 | + if ( ! empty($this->controls['fields'])) { |
|
| 82 | + foreach ($this->controls['fields'] as $field_slug => $args) { |
|
| 83 | + $this->add_control($field_slug, $args, $wp_customize); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // Start selective refresh. |
| 88 | - if ( ! empty( $this->controls['selective_refresh'] ) ) { |
|
| 89 | - foreach ( $this->controls['selective_refresh'] as $field_slug => $args ) { |
|
| 90 | - $this->add_selective_refresh( $field_slug, $args, $wp_customize ); |
|
| 88 | + if ( ! empty($this->controls['selective_refresh'])) { |
|
| 89 | + foreach ($this->controls['selective_refresh'] as $field_slug => $args) { |
|
| 90 | + $this->add_selective_refresh($field_slug, $args, $wp_customize); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
|
| 95 | - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
|
| 96 | - $wp_customize->get_setting( 'background_color' )->transport = 'postMessage'; |
|
| 94 | + $wp_customize->get_setting('blogname')->transport = 'postMessage'; |
|
| 95 | + $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; |
|
| 96 | + $wp_customize->get_setting('background_color')->transport = 'postMessage'; |
|
| 97 | 97 | |
| 98 | 98 | $wp_customize->selective_refresh->add_partial( |
| 99 | 99 | 'blogname', |
| 100 | 100 | array( |
| 101 | 101 | 'selector' => 'h1.site-title a', |
| 102 | 102 | 'render_callback' => function() { |
| 103 | - bloginfo( 'name' ); |
|
| 103 | + bloginfo('name'); |
|
| 104 | 104 | }, |
| 105 | 105 | ) |
| 106 | 106 | ); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | array( |
| 111 | 111 | 'selector' => '.site-description', |
| 112 | 112 | 'render_callback' => function() { |
| 113 | - bloginfo( 'description' ); |
|
| 113 | + bloginfo('description'); |
|
| 114 | 114 | }, |
| 115 | 115 | ) |
| 116 | 116 | ); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | /** |
| 120 | 120 | * Create a panel. |
| 121 | 121 | */ |
| 122 | - private function add_panel( $slug, $args, $wp_customize ) { |
|
| 122 | + private function add_panel($slug, $args, $wp_customize) { |
|
| 123 | 123 | $default_args = array( |
| 124 | 124 | 'title' => null, |
| 125 | 125 | 'description' => null, |
@@ -127,26 +127,26 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | $wp_customize->add_panel( |
| 129 | 129 | $slug, |
| 130 | - array_merge( $default_args, $args ) |
|
| 130 | + array_merge($default_args, $args) |
|
| 131 | 131 | ); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | 135 | * Create a section. |
| 136 | 136 | */ |
| 137 | - private function add_section( $slug, $args, $wp_customize ) { |
|
| 137 | + private function add_section($slug, $args, $wp_customize) { |
|
| 138 | 138 | $default_args = array( |
| 139 | 139 | 'capability' => 'edit_theme_options', |
| 140 | 140 | 'description' => null, |
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | - $wp_customize->add_section( $slug, array_merge( $default_args, $args ) ); |
|
| 143 | + $wp_customize->add_section($slug, array_merge($default_args, $args)); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
| 147 | 147 | * Create a setting. |
| 148 | 148 | */ |
| 149 | - private function add_setting( $slug, $args, $wp_customize ) { |
|
| 149 | + private function add_setting($slug, $args, $wp_customize) { |
|
| 150 | 150 | $wp_customize->add_setting( |
| 151 | 151 | $slug, |
| 152 | 152 | array_merge( |
@@ -165,23 +165,23 @@ discard block |
||
| 165 | 165 | /** |
| 166 | 166 | * Create a control. |
| 167 | 167 | */ |
| 168 | - private function add_control( $slug, $args, $wp_customize ) { |
|
| 168 | + private function add_control($slug, $args, $wp_customize) { |
|
| 169 | 169 | $default_args = array(); |
| 170 | 170 | |
| 171 | - if ( isset( $args['control'] ) && class_exists( $args['control'] ) ) { |
|
| 171 | + if (isset($args['control']) && class_exists($args['control'])) { |
|
| 172 | 172 | $control_class = $args['control']; |
| 173 | - unset( $args['control'] ); |
|
| 173 | + unset($args['control']); |
|
| 174 | 174 | |
| 175 | - $control = new $control_class( $wp_customize, $slug, array_merge( $default_args, $args ) ); |
|
| 176 | - $wp_customize->add_control( $control ); |
|
| 175 | + $control = new $control_class($wp_customize, $slug, array_merge($default_args, $args)); |
|
| 176 | + $wp_customize->add_control($control); |
|
| 177 | 177 | } else { |
| 178 | - if ( isset( $args['control'] ) ) { |
|
| 179 | - unset( $args['control'] ); |
|
| 178 | + if (isset($args['control'])) { |
|
| 179 | + unset($args['control']); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | $wp_customize->add_control( |
| 183 | 183 | $slug, |
| 184 | - array_merge( $default_args, $args ) |
|
| 184 | + array_merge($default_args, $args) |
|
| 185 | 185 | ); |
| 186 | 186 | } |
| 187 | 187 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | /** |
| 190 | 190 | * Create a selective refresh. |
| 191 | 191 | */ |
| 192 | - private function add_selective_refresh( $slug, $args, $wp_customize ) { |
|
| 192 | + private function add_selective_refresh($slug, $args, $wp_customize) { |
|
| 193 | 193 | $default_args = array( |
| 194 | 194 | 'selector' => null, |
| 195 | 195 | 'render_callback' => null, |
@@ -197,23 +197,23 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | $wp_customize->selective_refresh->add_partial( |
| 199 | 199 | $slug, |
| 200 | - array_merge( $default_args, $args ) |
|
| 200 | + array_merge($default_args, $args) |
|
| 201 | 201 | ); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
| 205 | 205 | * Returns a registered field. |
| 206 | 206 | */ |
| 207 | - public function get_control( $id ) { |
|
| 208 | - $field = $this->controls['fields'][ $id ]; |
|
| 207 | + public function get_control($id) { |
|
| 208 | + $field = $this->controls['fields'][$id]; |
|
| 209 | 209 | return $field; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
| 213 | 213 | * Returns a registered setting. |
| 214 | 214 | */ |
| 215 | - public function get_setting( $id ) { |
|
| 216 | - $setting = $this->controls['settings'][ $id ]; |
|
| 215 | + public function get_setting($id) { |
|
| 216 | + $setting = $this->controls['settings'][$id]; |
|
| 217 | 217 | return $setting; |
| 218 | 218 | } |
| 219 | 219 | |
@@ -7,217 +7,217 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | - exit; |
|
| 10 | + exit; |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | if ( ! class_exists( 'LSX_Theme_Customizer' ) ) : |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Customizer Configuration File |
|
| 17 | - * |
|
| 18 | - * @package lsx |
|
| 19 | - * @subpackage customizer |
|
| 20 | - */ |
|
| 21 | - class LSX_Theme_Customizer { |
|
| 22 | - |
|
| 23 | - public $post_types = array(); |
|
| 24 | - private $controls = array(); |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * Initialize the plugin by setting localization and loading public scripts and styles. |
|
| 28 | - */ |
|
| 29 | - public function __construct( $controls ) { |
|
| 30 | - require get_template_directory() . '/includes/classes/class-lsx-customize-core-control.php'; |
|
| 31 | - require get_template_directory() . '/includes/classes/class-lsx-customize-layout-control.php'; |
|
| 32 | - require get_template_directory() . '/includes/classes/class-lsx-customize-header-layout-control.php'; |
|
| 33 | - require get_template_directory() . '/includes/classes/class-lsx-customize-mobile-header-layout-control.php'; |
|
| 34 | - |
|
| 35 | - $this->controls = $controls; |
|
| 36 | - |
|
| 37 | - add_action( 'customize_preview_init', array( $this, 'customize_preview_js' ), 20 ); |
|
| 38 | - add_action( 'customize_register', array( $this, 'customizer' ), 11 ); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. |
|
| 43 | - */ |
|
| 44 | - public function customize_preview_js() { |
|
| 45 | - wp_enqueue_script( 'lsx_customizer', get_template_directory_uri() . '/assets/js/admin/customizer.js', array( 'customize-preview' ), LSX_VERSION, true ); |
|
| 46 | - |
|
| 47 | - wp_localize_script( |
|
| 48 | - 'lsx_customizer', |
|
| 49 | - 'lsx_customizer_params', |
|
| 50 | - array( |
|
| 51 | - 'template_directory' => get_template_directory_uri(), |
|
| 52 | - ) |
|
| 53 | - ); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * Create customiser controls. |
|
| 58 | - */ |
|
| 59 | - public function customizer( $wp_customize ) { |
|
| 60 | - // Start panels. |
|
| 61 | - if ( ! empty( $this->controls['panels'] ) ) { |
|
| 62 | - foreach ( $this->controls['panels'] as $panel_slug => $args ) { |
|
| 63 | - $this->add_panel( $panel_slug, $args, $wp_customize ); |
|
| 64 | - } |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - // Start sections. |
|
| 68 | - if ( ! empty( $this->controls['sections'] ) ) { |
|
| 69 | - foreach ( $this->controls['sections'] as $section_slug => $args ) { |
|
| 70 | - $this->add_section( $section_slug, $args, $wp_customize ); |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - // Start settings. |
|
| 75 | - if ( ! empty( $this->controls['settings'] ) ) { |
|
| 76 | - foreach ( $this->controls['settings'] as $settings_slug => $args ) { |
|
| 77 | - $this->add_setting( $settings_slug, $args, $wp_customize ); |
|
| 78 | - } |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - // Start fields. |
|
| 82 | - if ( ! empty( $this->controls['fields'] ) ) { |
|
| 83 | - foreach ( $this->controls['fields'] as $field_slug => $args ) { |
|
| 84 | - $this->add_control( $field_slug, $args, $wp_customize ); |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - // Start selective refresh. |
|
| 89 | - if ( ! empty( $this->controls['selective_refresh'] ) ) { |
|
| 90 | - foreach ( $this->controls['selective_refresh'] as $field_slug => $args ) { |
|
| 91 | - $this->add_selective_refresh( $field_slug, $args, $wp_customize ); |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
|
| 96 | - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
|
| 97 | - $wp_customize->get_setting( 'background_color' )->transport = 'postMessage'; |
|
| 98 | - |
|
| 99 | - $wp_customize->selective_refresh->add_partial( |
|
| 100 | - 'blogname', |
|
| 101 | - array( |
|
| 102 | - 'selector' => 'h1.site-title a', |
|
| 103 | - 'render_callback' => function() { |
|
| 104 | - bloginfo( 'name' ); |
|
| 105 | - }, |
|
| 106 | - ) |
|
| 107 | - ); |
|
| 108 | - |
|
| 109 | - $wp_customize->selective_refresh->add_partial( |
|
| 110 | - 'blogdescription', |
|
| 111 | - array( |
|
| 112 | - 'selector' => '.site-description', |
|
| 113 | - 'render_callback' => function() { |
|
| 114 | - bloginfo( 'description' ); |
|
| 115 | - }, |
|
| 116 | - ) |
|
| 117 | - ); |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * Create a panel. |
|
| 122 | - */ |
|
| 123 | - private function add_panel( $slug, $args, $wp_customize ) { |
|
| 124 | - $default_args = array( |
|
| 125 | - 'title' => null, |
|
| 126 | - 'description' => null, |
|
| 127 | - ); |
|
| 128 | - |
|
| 129 | - $wp_customize->add_panel( |
|
| 130 | - $slug, |
|
| 131 | - array_merge( $default_args, $args ) |
|
| 132 | - ); |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * Create a section. |
|
| 137 | - */ |
|
| 138 | - private function add_section( $slug, $args, $wp_customize ) { |
|
| 139 | - $default_args = array( |
|
| 140 | - 'capability' => 'edit_theme_options', |
|
| 141 | - 'description' => null, |
|
| 142 | - ); |
|
| 143 | - |
|
| 144 | - $wp_customize->add_section( $slug, array_merge( $default_args, $args ) ); |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - /** |
|
| 148 | - * Create a setting. |
|
| 149 | - */ |
|
| 150 | - private function add_setting( $slug, $args, $wp_customize ) { |
|
| 151 | - $wp_customize->add_setting( |
|
| 152 | - $slug, |
|
| 153 | - array_merge( |
|
| 154 | - array( |
|
| 155 | - 'default' => null, |
|
| 156 | - 'type' => 'theme_mod', |
|
| 157 | - 'capability' => 'edit_theme_options', |
|
| 158 | - 'transport' => 'postMessage', |
|
| 159 | - 'sanitize_callback' => 'lsx_sanitize_choices', |
|
| 160 | - ), |
|
| 161 | - $args |
|
| 162 | - ) |
|
| 163 | - ); |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - /** |
|
| 167 | - * Create a control. |
|
| 168 | - */ |
|
| 169 | - private function add_control( $slug, $args, $wp_customize ) { |
|
| 170 | - $default_args = array(); |
|
| 171 | - |
|
| 172 | - if ( isset( $args['control'] ) && class_exists( $args['control'] ) ) { |
|
| 173 | - $control_class = $args['control']; |
|
| 174 | - unset( $args['control'] ); |
|
| 175 | - |
|
| 176 | - $control = new $control_class( $wp_customize, $slug, array_merge( $default_args, $args ) ); |
|
| 177 | - $wp_customize->add_control( $control ); |
|
| 178 | - } else { |
|
| 179 | - if ( isset( $args['control'] ) ) { |
|
| 180 | - unset( $args['control'] ); |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - $wp_customize->add_control( |
|
| 184 | - $slug, |
|
| 185 | - array_merge( $default_args, $args ) |
|
| 186 | - ); |
|
| 187 | - } |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - /** |
|
| 191 | - * Create a selective refresh. |
|
| 192 | - */ |
|
| 193 | - private function add_selective_refresh( $slug, $args, $wp_customize ) { |
|
| 194 | - $default_args = array( |
|
| 195 | - 'selector' => null, |
|
| 196 | - 'render_callback' => null, |
|
| 197 | - ); |
|
| 198 | - |
|
| 199 | - $wp_customize->selective_refresh->add_partial( |
|
| 200 | - $slug, |
|
| 201 | - array_merge( $default_args, $args ) |
|
| 202 | - ); |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * Returns a registered field. |
|
| 207 | - */ |
|
| 208 | - public function get_control( $id ) { |
|
| 209 | - $field = $this->controls['fields'][ $id ]; |
|
| 210 | - return $field; |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - /** |
|
| 214 | - * Returns a registered setting. |
|
| 215 | - */ |
|
| 216 | - public function get_setting( $id ) { |
|
| 217 | - $setting = $this->controls['settings'][ $id ]; |
|
| 218 | - return $setting; |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - } |
|
| 15 | + /** |
|
| 16 | + * Customizer Configuration File |
|
| 17 | + * |
|
| 18 | + * @package lsx |
|
| 19 | + * @subpackage customizer |
|
| 20 | + */ |
|
| 21 | + class LSX_Theme_Customizer { |
|
| 22 | + |
|
| 23 | + public $post_types = array(); |
|
| 24 | + private $controls = array(); |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * Initialize the plugin by setting localization and loading public scripts and styles. |
|
| 28 | + */ |
|
| 29 | + public function __construct( $controls ) { |
|
| 30 | + require get_template_directory() . '/includes/classes/class-lsx-customize-core-control.php'; |
|
| 31 | + require get_template_directory() . '/includes/classes/class-lsx-customize-layout-control.php'; |
|
| 32 | + require get_template_directory() . '/includes/classes/class-lsx-customize-header-layout-control.php'; |
|
| 33 | + require get_template_directory() . '/includes/classes/class-lsx-customize-mobile-header-layout-control.php'; |
|
| 34 | + |
|
| 35 | + $this->controls = $controls; |
|
| 36 | + |
|
| 37 | + add_action( 'customize_preview_init', array( $this, 'customize_preview_js' ), 20 ); |
|
| 38 | + add_action( 'customize_register', array( $this, 'customizer' ), 11 ); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. |
|
| 43 | + */ |
|
| 44 | + public function customize_preview_js() { |
|
| 45 | + wp_enqueue_script( 'lsx_customizer', get_template_directory_uri() . '/assets/js/admin/customizer.js', array( 'customize-preview' ), LSX_VERSION, true ); |
|
| 46 | + |
|
| 47 | + wp_localize_script( |
|
| 48 | + 'lsx_customizer', |
|
| 49 | + 'lsx_customizer_params', |
|
| 50 | + array( |
|
| 51 | + 'template_directory' => get_template_directory_uri(), |
|
| 52 | + ) |
|
| 53 | + ); |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * Create customiser controls. |
|
| 58 | + */ |
|
| 59 | + public function customizer( $wp_customize ) { |
|
| 60 | + // Start panels. |
|
| 61 | + if ( ! empty( $this->controls['panels'] ) ) { |
|
| 62 | + foreach ( $this->controls['panels'] as $panel_slug => $args ) { |
|
| 63 | + $this->add_panel( $panel_slug, $args, $wp_customize ); |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + // Start sections. |
|
| 68 | + if ( ! empty( $this->controls['sections'] ) ) { |
|
| 69 | + foreach ( $this->controls['sections'] as $section_slug => $args ) { |
|
| 70 | + $this->add_section( $section_slug, $args, $wp_customize ); |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + // Start settings. |
|
| 75 | + if ( ! empty( $this->controls['settings'] ) ) { |
|
| 76 | + foreach ( $this->controls['settings'] as $settings_slug => $args ) { |
|
| 77 | + $this->add_setting( $settings_slug, $args, $wp_customize ); |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + // Start fields. |
|
| 82 | + if ( ! empty( $this->controls['fields'] ) ) { |
|
| 83 | + foreach ( $this->controls['fields'] as $field_slug => $args ) { |
|
| 84 | + $this->add_control( $field_slug, $args, $wp_customize ); |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + // Start selective refresh. |
|
| 89 | + if ( ! empty( $this->controls['selective_refresh'] ) ) { |
|
| 90 | + foreach ( $this->controls['selective_refresh'] as $field_slug => $args ) { |
|
| 91 | + $this->add_selective_refresh( $field_slug, $args, $wp_customize ); |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
|
| 96 | + $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
|
| 97 | + $wp_customize->get_setting( 'background_color' )->transport = 'postMessage'; |
|
| 98 | + |
|
| 99 | + $wp_customize->selective_refresh->add_partial( |
|
| 100 | + 'blogname', |
|
| 101 | + array( |
|
| 102 | + 'selector' => 'h1.site-title a', |
|
| 103 | + 'render_callback' => function() { |
|
| 104 | + bloginfo( 'name' ); |
|
| 105 | + }, |
|
| 106 | + ) |
|
| 107 | + ); |
|
| 108 | + |
|
| 109 | + $wp_customize->selective_refresh->add_partial( |
|
| 110 | + 'blogdescription', |
|
| 111 | + array( |
|
| 112 | + 'selector' => '.site-description', |
|
| 113 | + 'render_callback' => function() { |
|
| 114 | + bloginfo( 'description' ); |
|
| 115 | + }, |
|
| 116 | + ) |
|
| 117 | + ); |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * Create a panel. |
|
| 122 | + */ |
|
| 123 | + private function add_panel( $slug, $args, $wp_customize ) { |
|
| 124 | + $default_args = array( |
|
| 125 | + 'title' => null, |
|
| 126 | + 'description' => null, |
|
| 127 | + ); |
|
| 128 | + |
|
| 129 | + $wp_customize->add_panel( |
|
| 130 | + $slug, |
|
| 131 | + array_merge( $default_args, $args ) |
|
| 132 | + ); |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * Create a section. |
|
| 137 | + */ |
|
| 138 | + private function add_section( $slug, $args, $wp_customize ) { |
|
| 139 | + $default_args = array( |
|
| 140 | + 'capability' => 'edit_theme_options', |
|
| 141 | + 'description' => null, |
|
| 142 | + ); |
|
| 143 | + |
|
| 144 | + $wp_customize->add_section( $slug, array_merge( $default_args, $args ) ); |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + /** |
|
| 148 | + * Create a setting. |
|
| 149 | + */ |
|
| 150 | + private function add_setting( $slug, $args, $wp_customize ) { |
|
| 151 | + $wp_customize->add_setting( |
|
| 152 | + $slug, |
|
| 153 | + array_merge( |
|
| 154 | + array( |
|
| 155 | + 'default' => null, |
|
| 156 | + 'type' => 'theme_mod', |
|
| 157 | + 'capability' => 'edit_theme_options', |
|
| 158 | + 'transport' => 'postMessage', |
|
| 159 | + 'sanitize_callback' => 'lsx_sanitize_choices', |
|
| 160 | + ), |
|
| 161 | + $args |
|
| 162 | + ) |
|
| 163 | + ); |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * Create a control. |
|
| 168 | + */ |
|
| 169 | + private function add_control( $slug, $args, $wp_customize ) { |
|
| 170 | + $default_args = array(); |
|
| 171 | + |
|
| 172 | + if ( isset( $args['control'] ) && class_exists( $args['control'] ) ) { |
|
| 173 | + $control_class = $args['control']; |
|
| 174 | + unset( $args['control'] ); |
|
| 175 | + |
|
| 176 | + $control = new $control_class( $wp_customize, $slug, array_merge( $default_args, $args ) ); |
|
| 177 | + $wp_customize->add_control( $control ); |
|
| 178 | + } else { |
|
| 179 | + if ( isset( $args['control'] ) ) { |
|
| 180 | + unset( $args['control'] ); |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + $wp_customize->add_control( |
|
| 184 | + $slug, |
|
| 185 | + array_merge( $default_args, $args ) |
|
| 186 | + ); |
|
| 187 | + } |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + /** |
|
| 191 | + * Create a selective refresh. |
|
| 192 | + */ |
|
| 193 | + private function add_selective_refresh( $slug, $args, $wp_customize ) { |
|
| 194 | + $default_args = array( |
|
| 195 | + 'selector' => null, |
|
| 196 | + 'render_callback' => null, |
|
| 197 | + ); |
|
| 198 | + |
|
| 199 | + $wp_customize->selective_refresh->add_partial( |
|
| 200 | + $slug, |
|
| 201 | + array_merge( $default_args, $args ) |
|
| 202 | + ); |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * Returns a registered field. |
|
| 207 | + */ |
|
| 208 | + public function get_control( $id ) { |
|
| 209 | + $field = $this->controls['fields'][ $id ]; |
|
| 210 | + return $field; |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + /** |
|
| 214 | + * Returns a registered setting. |
|
| 215 | + */ |
|
| 216 | + public function get_setting( $id ) { |
|
| 217 | + $setting = $this->controls['settings'][ $id ]; |
|
| 218 | + return $setting; |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + } |
|
| 222 | 222 | |
| 223 | 223 | endif; |
@@ -7,15 +7,15 @@ discard block |
||
| 7 | 7 | * @category header-layout |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | +if ( ! defined('ABSPATH')) { |
|
| 11 | 11 | exit; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -if ( ! class_exists( 'WP_Customize_Control' ) ) { |
|
| 14 | +if ( ! class_exists('WP_Customize_Control')) { |
|
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( 'LSX_Customize_Header_Layout_Control' ) ) : |
|
| 18 | +if ( ! class_exists('LSX_Customize_Header_Layout_Control')) : |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * LSX_Customize_Header_Layout_Control Class |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | public $statuses; |
| 31 | 31 | public $layouts = array(); |
| 32 | 32 | |
| 33 | - public function __construct( $manager, $id, $args = array() ) { |
|
| 34 | - parent::__construct( $manager, $id, $args ); |
|
| 33 | + public function __construct($manager, $id, $args = array()) { |
|
| 34 | + parent::__construct($manager, $id, $args); |
|
| 35 | 35 | |
| 36 | - if ( ! empty( $args['choices'] ) ) { |
|
| 36 | + if ( ! empty($args['choices'])) { |
|
| 37 | 37 | $this->layouts = $args['choices']; |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -42,39 +42,39 @@ discard block |
||
| 42 | 42 | * Enqueue scripts/styles for the color picker. |
| 43 | 43 | */ |
| 44 | 44 | public function enqueue() { |
| 45 | - wp_enqueue_script( 'lsx-header-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-header-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
| 45 | + wp_enqueue_script('lsx-header-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-header-layout.js', array('jquery'), LSX_VERSION, true); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Render output. |
| 50 | 50 | */ |
| 51 | 51 | public function render_content() { |
| 52 | - $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
| 52 | + $post_id = 'customize-control-' . str_replace('[', '-', str_replace(']', '', $this->id)); |
|
| 53 | 53 | $class = 'customize-control customize-control-' . $this->type; |
| 54 | 54 | $value = $this->value(); |
| 55 | 55 | ?> |
| 56 | 56 | <label> |
| 57 | 57 | <?php |
| 58 | - if ( ! empty( $this->label ) ) { |
|
| 58 | + if ( ! empty($this->label)) { |
|
| 59 | 59 | ?> |
| 60 | - <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
| 60 | + <span class="customize-control-title"><?php echo esc_html($this->label); ?></span> |
|
| 61 | 61 | <?php |
| 62 | 62 | } |
| 63 | - if ( ! empty( $this->description ) ) { |
|
| 63 | + if ( ! empty($this->description)) { |
|
| 64 | 64 | ?> |
| 65 | - <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
|
| 65 | + <span class="description customize-control-description"><?php echo esc_html($this->description); ?></span> |
|
| 66 | 66 | <?php } ?> |
| 67 | 67 | <div class="header-layouts-selector"> |
| 68 | 68 | <?php |
| 69 | - foreach ( $this->layouts as $layout ) { |
|
| 69 | + foreach ($this->layouts as $layout) { |
|
| 70 | 70 | $sel = 'border: 1px solid transparent;'; |
| 71 | - if ( $value === $layout ) { |
|
| 71 | + if ($value === $layout) { |
|
| 72 | 72 | $sel = 'border: 1px solid rgb(43, 166, 203);'; |
| 73 | 73 | } |
| 74 | - echo '<img class="header-layout-button" style="padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/header-' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
| 74 | + echo '<img class="header-layout-button" style="padding:2px;' . esc_attr($sel) . '" src="' . esc_attr(get_template_directory_uri()) . '/assets/images/admin/header-' . esc_attr($layout) . '.png" data-option="' . esc_attr($layout) . '">'; |
|
| 75 | 75 | } |
| 76 | 76 | ?> |
| 77 | - <input <?php $this->link(); ?> class="selected-header-layout <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $post_id ); ?>" type="hidden" value="<?php echo esc_attr( $value ); ?>" <?php $this->input_attrs(); ?>> |
|
| 77 | + <input <?php $this->link(); ?> class="selected-header-layout <?php echo esc_attr($class); ?>" id="<?php echo esc_attr($post_id); ?>" type="hidden" value="<?php echo esc_attr($value); ?>" <?php $this->input_attrs(); ?>> |
|
| 78 | 78 | </div> |
| 79 | 79 | </label> |
| 80 | 80 | <?php |
@@ -8,78 +8,78 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | - exit; |
|
| 11 | + exit; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | if ( ! class_exists( 'WP_Customize_Control' ) ) { |
| 15 | - return; |
|
| 15 | + return; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | if ( ! class_exists( 'LSX_Customize_Header_Layout_Control' ) ) : |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * LSX_Customize_Header_Layout_Control Class |
|
| 22 | - * |
|
| 23 | - * @package lsx |
|
| 24 | - * @subpackage customizer |
|
| 25 | - * @category header-layout |
|
| 26 | - */ |
|
| 27 | - class LSX_Customize_Header_Layout_Control extends WP_Customize_Control { |
|
| 20 | + /** |
|
| 21 | + * LSX_Customize_Header_Layout_Control Class |
|
| 22 | + * |
|
| 23 | + * @package lsx |
|
| 24 | + * @subpackage customizer |
|
| 25 | + * @category header-layout |
|
| 26 | + */ |
|
| 27 | + class LSX_Customize_Header_Layout_Control extends WP_Customize_Control { |
|
| 28 | 28 | |
| 29 | - public $type = 'layout'; |
|
| 30 | - public $statuses; |
|
| 31 | - public $layouts = array(); |
|
| 29 | + public $type = 'layout'; |
|
| 30 | + public $statuses; |
|
| 31 | + public $layouts = array(); |
|
| 32 | 32 | |
| 33 | - public function __construct( $manager, $id, $args = array() ) { |
|
| 34 | - parent::__construct( $manager, $id, $args ); |
|
| 33 | + public function __construct( $manager, $id, $args = array() ) { |
|
| 34 | + parent::__construct( $manager, $id, $args ); |
|
| 35 | 35 | |
| 36 | - if ( ! empty( $args['choices'] ) ) { |
|
| 37 | - $this->layouts = $args['choices']; |
|
| 38 | - } |
|
| 39 | - } |
|
| 36 | + if ( ! empty( $args['choices'] ) ) { |
|
| 37 | + $this->layouts = $args['choices']; |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Enqueue scripts/styles for the color picker. |
|
| 43 | - */ |
|
| 44 | - public function enqueue() { |
|
| 45 | - wp_enqueue_script( 'lsx-header-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-header-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
| 46 | - } |
|
| 41 | + /** |
|
| 42 | + * Enqueue scripts/styles for the color picker. |
|
| 43 | + */ |
|
| 44 | + public function enqueue() { |
|
| 45 | + wp_enqueue_script( 'lsx-header-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-header-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Render output. |
|
| 50 | - */ |
|
| 51 | - public function render_content() { |
|
| 52 | - $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
| 53 | - $class = 'customize-control customize-control-' . $this->type; |
|
| 54 | - $value = $this->value(); |
|
| 55 | - ?> |
|
| 48 | + /** |
|
| 49 | + * Render output. |
|
| 50 | + */ |
|
| 51 | + public function render_content() { |
|
| 52 | + $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
| 53 | + $class = 'customize-control customize-control-' . $this->type; |
|
| 54 | + $value = $this->value(); |
|
| 55 | + ?> |
|
| 56 | 56 | <label> |
| 57 | 57 | <?php |
| 58 | - if ( ! empty( $this->label ) ) { |
|
| 59 | - ?> |
|
| 58 | + if ( ! empty( $this->label ) ) { |
|
| 59 | + ?> |
|
| 60 | 60 | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
| 61 | 61 | <?php |
| 62 | - } |
|
| 63 | - if ( ! empty( $this->description ) ) { |
|
| 64 | - ?> |
|
| 62 | + } |
|
| 63 | + if ( ! empty( $this->description ) ) { |
|
| 64 | + ?> |
|
| 65 | 65 | <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
| 66 | 66 | <?php } ?> |
| 67 | 67 | <div class="header-layouts-selector"> |
| 68 | 68 | <?php |
| 69 | - foreach ( $this->layouts as $layout ) { |
|
| 70 | - $sel = 'border: 1px solid transparent;'; |
|
| 71 | - if ( $value === $layout ) { |
|
| 72 | - $sel = 'border: 1px solid rgb(43, 166, 203);'; |
|
| 73 | - } |
|
| 74 | - echo '<img class="header-layout-button" style="padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/header-' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
| 75 | - } |
|
| 76 | - ?> |
|
| 69 | + foreach ( $this->layouts as $layout ) { |
|
| 70 | + $sel = 'border: 1px solid transparent;'; |
|
| 71 | + if ( $value === $layout ) { |
|
| 72 | + $sel = 'border: 1px solid rgb(43, 166, 203);'; |
|
| 73 | + } |
|
| 74 | + echo '<img class="header-layout-button" style="padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/header-' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
| 75 | + } |
|
| 76 | + ?> |
|
| 77 | 77 | <input <?php $this->link(); ?> class="selected-header-layout <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $post_id ); ?>" type="hidden" value="<?php echo esc_attr( $value ); ?>" <?php $this->input_attrs(); ?>> |
| 78 | 78 | </div> |
| 79 | 79 | </label> |
| 80 | 80 | <?php |
| 81 | - } |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - } |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | 85 | endif; |
@@ -5,35 +5,35 @@ discard block |
||
| 5 | 5 | * @package lsx |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -if ( post_password_required() ) { |
|
| 8 | +if (post_password_required()) { |
|
| 9 | 9 | return; |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | $commenter = wp_get_current_commenter(); |
| 13 | -$req = get_option( 'require_name_email' ); |
|
| 14 | -$aria_req = ( $req ? " aria-required='true'" : '' ); |
|
| 15 | -$html_req = ( $req ? " required='required'" : '' ); |
|
| 13 | +$req = get_option('require_name_email'); |
|
| 14 | +$aria_req = ($req ? " aria-required='true'" : ''); |
|
| 15 | +$html_req = ($req ? " required='required'" : ''); |
|
| 16 | 16 | |
| 17 | 17 | $comment_form_args = array( |
| 18 | - 'comment_field' => '<p class="comment-form-comment"><textarea placeholder="' . esc_html__( 'Comment', 'lsx' ) . '" id="comment" class="form-control" name="comment" cols="45" rows="8"' . $aria_req . $html_req . '></textarea></p>', |
|
| 18 | + 'comment_field' => '<p class="comment-form-comment"><textarea placeholder="' . esc_html__('Comment', 'lsx') . '" id="comment" class="form-control" name="comment" cols="45" rows="8"' . $aria_req . $html_req . '></textarea></p>', |
|
| 19 | 19 | |
| 20 | 20 | 'fields' => array( |
| 21 | - 'author' => '<p class="comment-form-author"><label for="author">' . esc_html__( 'Name', 'lsx' ) . '</label> ' . |
|
| 22 | - ( $req ? '<span class="required">*</span>' : '' ) . |
|
| 23 | - '<input class="form-control" placeholder="' . esc_html__( 'Name', 'lsx' ) . '" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 21 | + 'author' => '<p class="comment-form-author"><label for="author">' . esc_html__('Name', 'lsx') . '</label> ' . |
|
| 22 | + ($req ? '<span class="required">*</span>' : '') . |
|
| 23 | + '<input class="form-control" placeholder="' . esc_html__('Name', 'lsx') . '" id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 24 | 24 | |
| 25 | - 'email' => '<p class="comment-form-email"><label for="email">' . esc_html__( 'Email', 'lsx' ) . '</label> ' . |
|
| 26 | - ( $req ? '<span class="required">*</span>' : '' ) . |
|
| 27 | - '<input class="form-control" placeholder="' . esc_html__( 'Email', 'lsx' ) . '" id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 25 | + 'email' => '<p class="comment-form-email"><label for="email">' . esc_html__('Email', 'lsx') . '</label> ' . |
|
| 26 | + ($req ? '<span class="required">*</span>' : '') . |
|
| 27 | + '<input class="form-control" placeholder="' . esc_html__('Email', 'lsx') . '" id="email" name="email" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 28 | 28 | |
| 29 | - 'url' => '<p class="comment-form-url"><label for="url">' . esc_html__( 'Website', 'lsx' ) . '</label>' . |
|
| 30 | - '<input class="form-control" placeholder="' . esc_html__( 'Website', 'lsx' ) . '" id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30"></p>', |
|
| 29 | + 'url' => '<p class="comment-form-url"><label for="url">' . esc_html__('Website', 'lsx') . '</label>' . |
|
| 30 | + '<input class="form-control" placeholder="' . esc_html__('Website', 'lsx') . '" id="url" name="url" type="text" value="' . esc_attr($commenter['comment_author_url']) . '" size="30"></p>', |
|
| 31 | 31 | ), |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | -comment_form( $comment_form_args ); |
|
| 34 | +comment_form($comment_form_args); |
|
| 35 | 35 | |
| 36 | -if ( have_comments() ) : ?> |
|
| 36 | +if (have_comments()) : ?> |
|
| 37 | 37 | |
| 38 | 38 | <?php lsx_comments_before(); ?> |
| 39 | 39 | |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | <?php |
| 43 | 43 | $comments_number = get_comments_number(); |
| 44 | 44 | |
| 45 | - if ( '1' === $comments_number ) { |
|
| 45 | + if ('1' === $comments_number) { |
|
| 46 | 46 | printf( |
| 47 | 47 | /* Translators: %s: post title */ |
| 48 | - esc_html_x( 'One Response to “%s”', 'comments.php', 'lsx' ), |
|
| 48 | + esc_html_x('One Response to “%s”', 'comments.php', 'lsx'), |
|
| 49 | 49 | get_the_title() |
| 50 | 50 | ); |
| 51 | 51 | } else { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | 'lsx' |
| 61 | 61 | ) |
| 62 | 62 | ), |
| 63 | - esc_html( number_format_i18n( $comments_number ) ), |
|
| 63 | + esc_html(number_format_i18n($comments_number)), |
|
| 64 | 64 | get_the_title() |
| 65 | 65 | ); |
| 66 | 66 | } |
@@ -79,24 +79,24 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | <?php |
| 81 | 81 | $comment_pages_count = get_comment_pages_count(); |
| 82 | - if ( $comment_pages_count > 1 && get_option( 'page_comments' ) ) : |
|
| 82 | + if ($comment_pages_count > 1 && get_option('page_comments')) : |
|
| 83 | 83 | ?> |
| 84 | 84 | <nav> |
| 85 | 85 | <ul class="pager"> |
| 86 | - <?php if ( get_previous_comments_link() ) : ?> |
|
| 87 | - <li class="previous"><?php previous_comments_link( esc_html__( '← Older comments', 'lsx' ) ); ?></li> |
|
| 86 | + <?php if (get_previous_comments_link()) : ?> |
|
| 87 | + <li class="previous"><?php previous_comments_link(esc_html__('← Older comments', 'lsx')); ?></li> |
|
| 88 | 88 | <?php endif; ?> |
| 89 | 89 | |
| 90 | - <?php if ( get_next_comments_link() ) : ?> |
|
| 91 | - <li class="next"><?php next_comments_link( esc_html__( 'Newer comments →', 'lsx' ) ); ?></li> |
|
| 90 | + <?php if (get_next_comments_link()) : ?> |
|
| 91 | + <li class="next"><?php next_comments_link(esc_html__('Newer comments →', 'lsx')); ?></li> |
|
| 92 | 92 | <?php endif; ?> |
| 93 | 93 | </ul> |
| 94 | 94 | </nav> |
| 95 | 95 | <?php endif; ?> |
| 96 | 96 | |
| 97 | - <?php if ( ! comments_open() && ! is_page() && post_type_supports( get_post_type(), 'comments' ) ) : ?> |
|
| 97 | + <?php if ( ! comments_open() && ! is_page() && post_type_supports(get_post_type(), 'comments')) : ?> |
|
| 98 | 98 | <div class="alert alert-warning"> |
| 99 | - <?php esc_html_e( 'Comments are closed.', 'lsx' ); ?> |
|
| 99 | + <?php esc_html_e('Comments are closed.', 'lsx'); ?> |
|
| 100 | 100 | </div> |
| 101 | 101 | <?php endif; ?> |
| 102 | 102 | </section><!-- /#comments --> |
@@ -105,11 +105,11 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | <?php endif; ?> |
| 107 | 107 | |
| 108 | -<?php if ( ! have_comments() && ! comments_open() && post_type_supports( get_post_type(), 'comments' ) ) : ?> |
|
| 108 | +<?php if ( ! have_comments() && ! comments_open() && post_type_supports(get_post_type(), 'comments')) : ?> |
|
| 109 | 109 | |
| 110 | 110 | <section id="comments"> |
| 111 | 111 | <div class="alert alert-warning"> |
| 112 | - <?php esc_html_e( 'Comments are closed.', 'lsx' ); ?> |
|
| 112 | + <?php esc_html_e('Comments are closed.', 'lsx'); ?> |
|
| 113 | 113 | </div> |
| 114 | 114 | </section><!-- /#comments --> |
| 115 | 115 | |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | if ( post_password_required() ) { |
| 9 | - return; |
|
| 9 | + return; |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | $commenter = wp_get_current_commenter(); |
@@ -15,20 +15,20 @@ discard block |
||
| 15 | 15 | $html_req = ( $req ? " required='required'" : '' ); |
| 16 | 16 | |
| 17 | 17 | $comment_form_args = array( |
| 18 | - 'comment_field' => '<p class="comment-form-comment"><textarea placeholder="' . esc_html__( 'Comment', 'lsx' ) . '" id="comment" class="form-control" name="comment" cols="45" rows="8"' . $aria_req . $html_req . '></textarea></p>', |
|
| 18 | + 'comment_field' => '<p class="comment-form-comment"><textarea placeholder="' . esc_html__( 'Comment', 'lsx' ) . '" id="comment" class="form-control" name="comment" cols="45" rows="8"' . $aria_req . $html_req . '></textarea></p>', |
|
| 19 | 19 | |
| 20 | - 'fields' => array( |
|
| 21 | - 'author' => '<p class="comment-form-author"><label for="author">' . esc_html__( 'Name', 'lsx' ) . '</label> ' . |
|
| 22 | - ( $req ? '<span class="required">*</span>' : '' ) . |
|
| 23 | - '<input class="form-control" placeholder="' . esc_html__( 'Name', 'lsx' ) . '" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 20 | + 'fields' => array( |
|
| 21 | + 'author' => '<p class="comment-form-author"><label for="author">' . esc_html__( 'Name', 'lsx' ) . '</label> ' . |
|
| 22 | + ( $req ? '<span class="required">*</span>' : '' ) . |
|
| 23 | + '<input class="form-control" placeholder="' . esc_html__( 'Name', 'lsx' ) . '" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 24 | 24 | |
| 25 | - 'email' => '<p class="comment-form-email"><label for="email">' . esc_html__( 'Email', 'lsx' ) . '</label> ' . |
|
| 26 | - ( $req ? '<span class="required">*</span>' : '' ) . |
|
| 27 | - '<input class="form-control" placeholder="' . esc_html__( 'Email', 'lsx' ) . '" id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 25 | + 'email' => '<p class="comment-form-email"><label for="email">' . esc_html__( 'Email', 'lsx' ) . '</label> ' . |
|
| 26 | + ( $req ? '<span class="required">*</span>' : '' ) . |
|
| 27 | + '<input class="form-control" placeholder="' . esc_html__( 'Email', 'lsx' ) . '" id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 28 | 28 | |
| 29 | - 'url' => '<p class="comment-form-url"><label for="url">' . esc_html__( 'Website', 'lsx' ) . '</label>' . |
|
| 30 | - '<input class="form-control" placeholder="' . esc_html__( 'Website', 'lsx' ) . '" id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30"></p>', |
|
| 31 | - ), |
|
| 29 | + 'url' => '<p class="comment-form-url"><label for="url">' . esc_html__( 'Website', 'lsx' ) . '</label>' . |
|
| 30 | + '<input class="form-control" placeholder="' . esc_html__( 'Website', 'lsx' ) . '" id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30"></p>', |
|
| 31 | + ), |
|
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | 34 | comment_form( $comment_form_args ); |
@@ -40,47 +40,47 @@ discard block |
||
| 40 | 40 | <section id="comments"> |
| 41 | 41 | <h3> |
| 42 | 42 | <?php |
| 43 | - $comments_number = get_comments_number(); |
|
| 44 | - |
|
| 45 | - if ( '1' === $comments_number ) { |
|
| 46 | - printf( |
|
| 47 | - /* Translators: %s: post title */ |
|
| 48 | - esc_html_x( 'One Response to “%s”', 'comments.php', 'lsx' ), |
|
| 49 | - get_the_title() |
|
| 50 | - ); |
|
| 51 | - } else { |
|
| 52 | - printf( |
|
| 53 | - esc_html( |
|
| 54 | - /* Translators: 1: number of comments, 2: post title */ |
|
| 55 | - _nx( |
|
| 56 | - '%1$s Response to “%2$s”', |
|
| 57 | - '%1$s Responses to “%2$s”', |
|
| 58 | - $comments_number, |
|
| 59 | - 'comments.php', |
|
| 60 | - 'lsx' |
|
| 61 | - ) |
|
| 62 | - ), |
|
| 63 | - esc_html( number_format_i18n( $comments_number ) ), |
|
| 64 | - get_the_title() |
|
| 65 | - ); |
|
| 66 | - } |
|
| 67 | - ?> |
|
| 43 | + $comments_number = get_comments_number(); |
|
| 44 | + |
|
| 45 | + if ( '1' === $comments_number ) { |
|
| 46 | + printf( |
|
| 47 | + /* Translators: %s: post title */ |
|
| 48 | + esc_html_x( 'One Response to “%s”', 'comments.php', 'lsx' ), |
|
| 49 | + get_the_title() |
|
| 50 | + ); |
|
| 51 | + } else { |
|
| 52 | + printf( |
|
| 53 | + esc_html( |
|
| 54 | + /* Translators: 1: number of comments, 2: post title */ |
|
| 55 | + _nx( |
|
| 56 | + '%1$s Response to “%2$s”', |
|
| 57 | + '%1$s Responses to “%2$s”', |
|
| 58 | + $comments_number, |
|
| 59 | + 'comments.php', |
|
| 60 | + 'lsx' |
|
| 61 | + ) |
|
| 62 | + ), |
|
| 63 | + esc_html( number_format_i18n( $comments_number ) ), |
|
| 64 | + get_the_title() |
|
| 65 | + ); |
|
| 66 | + } |
|
| 67 | + ?> |
|
| 68 | 68 | </h3> |
| 69 | 69 | |
| 70 | 70 | <ol class="media-list"> |
| 71 | 71 | <?php |
| 72 | - wp_list_comments( |
|
| 73 | - array( |
|
| 74 | - 'walker' => new LSX_Walker_Comment(), |
|
| 75 | - ) |
|
| 76 | - ); |
|
| 77 | - ?> |
|
| 72 | + wp_list_comments( |
|
| 73 | + array( |
|
| 74 | + 'walker' => new LSX_Walker_Comment(), |
|
| 75 | + ) |
|
| 76 | + ); |
|
| 77 | + ?> |
|
| 78 | 78 | </ol> |
| 79 | 79 | |
| 80 | 80 | <?php |
| 81 | - $comment_pages_count = get_comment_pages_count(); |
|
| 82 | - if ( $comment_pages_count > 1 && get_option( 'page_comments' ) ) : |
|
| 83 | - ?> |
|
| 81 | + $comment_pages_count = get_comment_pages_count(); |
|
| 82 | + if ( $comment_pages_count > 1 && get_option( 'page_comments' ) ) : |
|
| 83 | + ?> |
|
| 84 | 84 | <nav> |
| 85 | 85 | <ul class="pager"> |
| 86 | 86 | <?php if ( get_previous_comments_link() ) : ?> |
@@ -116,5 +116,5 @@ discard block |
||
| 116 | 116 | <?php lsx_comments_after(); ?> |
| 117 | 117 | |
| 118 | 118 | <?php |
| 119 | - endif; |
|
| 119 | + endif; |
|
| 120 | 120 | ?> |
@@ -7,15 +7,15 @@ discard block |
||
| 7 | 7 | * @category mobile-header-layout |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | +if ( ! defined('ABSPATH')) { |
|
| 11 | 11 | exit; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -if ( ! class_exists( 'WP_Customize_Control' ) ) { |
|
| 14 | +if ( ! class_exists('WP_Customize_Control')) { |
|
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( 'LSX_Customize_Mobile_Header_Layout_Control' ) ) : |
|
| 18 | +if ( ! class_exists('LSX_Customize_Mobile_Header_Layout_Control')) : |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * LSX_Customize_Mobile_Header_Layout_Control Class |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | public $statuses; |
| 31 | 31 | public $layouts = array(); |
| 32 | 32 | |
| 33 | - public function __construct( $manager, $id, $args = array() ) { |
|
| 34 | - parent::__construct( $manager, $id, $args ); |
|
| 33 | + public function __construct($manager, $id, $args = array()) { |
|
| 34 | + parent::__construct($manager, $id, $args); |
|
| 35 | 35 | |
| 36 | - if ( ! empty( $args['choices'] ) ) { |
|
| 36 | + if ( ! empty($args['choices'])) { |
|
| 37 | 37 | $this->layouts = $args['choices']; |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -42,39 +42,39 @@ discard block |
||
| 42 | 42 | * Enqueue scripts/styles for the color picker. |
| 43 | 43 | */ |
| 44 | 44 | public function enqueue() { |
| 45 | - wp_enqueue_script( 'lsx-mobile-header-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-mobile-header-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
| 45 | + wp_enqueue_script('lsx-mobile-header-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-mobile-header-layout.js', array('jquery'), LSX_VERSION, true); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Render output. |
| 50 | 50 | */ |
| 51 | 51 | public function render_content() { |
| 52 | - $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
| 52 | + $post_id = 'customize-control-' . str_replace('[', '-', str_replace(']', '', $this->id)); |
|
| 53 | 53 | $class = 'customize-control customize-control-' . $this->type; |
| 54 | 54 | $value = $this->value(); |
| 55 | 55 | ?> |
| 56 | 56 | <label> |
| 57 | 57 | <?php |
| 58 | - if ( ! empty( $this->label ) ) { |
|
| 58 | + if ( ! empty($this->label)) { |
|
| 59 | 59 | ?> |
| 60 | - <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
| 60 | + <span class="customize-control-title"><?php echo esc_html($this->label); ?></span> |
|
| 61 | 61 | <?php |
| 62 | 62 | } |
| 63 | - if ( ! empty( $this->description ) ) { |
|
| 63 | + if ( ! empty($this->description)) { |
|
| 64 | 64 | ?> |
| 65 | - <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
|
| 65 | + <span class="description customize-control-description"><?php echo esc_html($this->description); ?></span> |
|
| 66 | 66 | <?php } ?> |
| 67 | 67 | <div class="mobile-header-layouts-selector"> |
| 68 | 68 | <?php |
| 69 | - foreach ( $this->layouts as $layout ) { |
|
| 69 | + foreach ($this->layouts as $layout) { |
|
| 70 | 70 | $sel = 'border: 1px solid transparent;'; |
| 71 | - if ( $value === $layout ) { |
|
| 71 | + if ($value === $layout) { |
|
| 72 | 72 | $sel = 'border: 1px solid rgb(43, 166, 203);'; |
| 73 | 73 | } |
| 74 | - echo '<img class="mobile-header-layout-button" style="max-width:180px;padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/header-' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
| 74 | + echo '<img class="mobile-header-layout-button" style="max-width:180px;padding:2px;' . esc_attr($sel) . '" src="' . esc_attr(get_template_directory_uri()) . '/assets/images/admin/header-' . esc_attr($layout) . '.png" data-option="' . esc_attr($layout) . '">'; |
|
| 75 | 75 | } |
| 76 | 76 | ?> |
| 77 | - <input <?php $this->link(); ?> class="selected-mobile-header-layout <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $post_id ); ?>" type="hidden" value="<?php echo esc_attr( $value ); ?>" <?php $this->input_attrs(); ?>> |
|
| 77 | + <input <?php $this->link(); ?> class="selected-mobile-header-layout <?php echo esc_attr($class); ?>" id="<?php echo esc_attr($post_id); ?>" type="hidden" value="<?php echo esc_attr($value); ?>" <?php $this->input_attrs(); ?>> |
|
| 78 | 78 | </div> |
| 79 | 79 | </label> |
| 80 | 80 | <?php |
@@ -8,78 +8,78 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | - exit; |
|
| 11 | + exit; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | if ( ! class_exists( 'WP_Customize_Control' ) ) { |
| 15 | - return; |
|
| 15 | + return; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | if ( ! class_exists( 'LSX_Customize_Mobile_Header_Layout_Control' ) ) : |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * LSX_Customize_Mobile_Header_Layout_Control Class |
|
| 22 | - * |
|
| 23 | - * @package lsx |
|
| 24 | - * @subpackage customizer |
|
| 25 | - * @category mobile-header-layout |
|
| 26 | - */ |
|
| 27 | - class LSX_Customize_Mobile_Header_Layout_Control extends WP_Customize_Control { |
|
| 20 | + /** |
|
| 21 | + * LSX_Customize_Mobile_Header_Layout_Control Class |
|
| 22 | + * |
|
| 23 | + * @package lsx |
|
| 24 | + * @subpackage customizer |
|
| 25 | + * @category mobile-header-layout |
|
| 26 | + */ |
|
| 27 | + class LSX_Customize_Mobile_Header_Layout_Control extends WP_Customize_Control { |
|
| 28 | 28 | |
| 29 | - public $type = 'layout'; |
|
| 30 | - public $statuses; |
|
| 31 | - public $layouts = array(); |
|
| 29 | + public $type = 'layout'; |
|
| 30 | + public $statuses; |
|
| 31 | + public $layouts = array(); |
|
| 32 | 32 | |
| 33 | - public function __construct( $manager, $id, $args = array() ) { |
|
| 34 | - parent::__construct( $manager, $id, $args ); |
|
| 33 | + public function __construct( $manager, $id, $args = array() ) { |
|
| 34 | + parent::__construct( $manager, $id, $args ); |
|
| 35 | 35 | |
| 36 | - if ( ! empty( $args['choices'] ) ) { |
|
| 37 | - $this->layouts = $args['choices']; |
|
| 38 | - } |
|
| 39 | - } |
|
| 36 | + if ( ! empty( $args['choices'] ) ) { |
|
| 37 | + $this->layouts = $args['choices']; |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Enqueue scripts/styles for the color picker. |
|
| 43 | - */ |
|
| 44 | - public function enqueue() { |
|
| 45 | - wp_enqueue_script( 'lsx-mobile-header-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-mobile-header-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
| 46 | - } |
|
| 41 | + /** |
|
| 42 | + * Enqueue scripts/styles for the color picker. |
|
| 43 | + */ |
|
| 44 | + public function enqueue() { |
|
| 45 | + wp_enqueue_script( 'lsx-mobile-header-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-mobile-header-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Render output. |
|
| 50 | - */ |
|
| 51 | - public function render_content() { |
|
| 52 | - $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
| 53 | - $class = 'customize-control customize-control-' . $this->type; |
|
| 54 | - $value = $this->value(); |
|
| 55 | - ?> |
|
| 48 | + /** |
|
| 49 | + * Render output. |
|
| 50 | + */ |
|
| 51 | + public function render_content() { |
|
| 52 | + $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
| 53 | + $class = 'customize-control customize-control-' . $this->type; |
|
| 54 | + $value = $this->value(); |
|
| 55 | + ?> |
|
| 56 | 56 | <label> |
| 57 | 57 | <?php |
| 58 | - if ( ! empty( $this->label ) ) { |
|
| 59 | - ?> |
|
| 58 | + if ( ! empty( $this->label ) ) { |
|
| 59 | + ?> |
|
| 60 | 60 | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
| 61 | 61 | <?php |
| 62 | - } |
|
| 63 | - if ( ! empty( $this->description ) ) { |
|
| 64 | - ?> |
|
| 62 | + } |
|
| 63 | + if ( ! empty( $this->description ) ) { |
|
| 64 | + ?> |
|
| 65 | 65 | <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
| 66 | 66 | <?php } ?> |
| 67 | 67 | <div class="mobile-header-layouts-selector"> |
| 68 | 68 | <?php |
| 69 | - foreach ( $this->layouts as $layout ) { |
|
| 70 | - $sel = 'border: 1px solid transparent;'; |
|
| 71 | - if ( $value === $layout ) { |
|
| 72 | - $sel = 'border: 1px solid rgb(43, 166, 203);'; |
|
| 73 | - } |
|
| 74 | - echo '<img class="mobile-header-layout-button" style="max-width:180px;padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/header-' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
| 75 | - } |
|
| 76 | - ?> |
|
| 69 | + foreach ( $this->layouts as $layout ) { |
|
| 70 | + $sel = 'border: 1px solid transparent;'; |
|
| 71 | + if ( $value === $layout ) { |
|
| 72 | + $sel = 'border: 1px solid rgb(43, 166, 203);'; |
|
| 73 | + } |
|
| 74 | + echo '<img class="mobile-header-layout-button" style="max-width:180px;padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/header-' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
| 75 | + } |
|
| 76 | + ?> |
|
| 77 | 77 | <input <?php $this->link(); ?> class="selected-mobile-header-layout <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $post_id ); ?>" type="hidden" value="<?php echo esc_attr( $value ); ?>" <?php $this->input_attrs(); ?>> |
| 78 | 78 | </div> |
| 79 | 79 | </label> |
| 80 | 80 | <?php |
| 81 | - } |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - } |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | 85 | endif; |
@@ -9,8 +9,8 @@ discard block |
||
| 9 | 9 | * @package TribeEventsCalendarPro |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | - die( '-1' ); |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | + die('-1'); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // Setup an array of venue details for use later in the template. |
@@ -21,46 +21,46 @@ discard block |
||
| 21 | 21 | $venue_address = tribe_get_address(); |
| 22 | 22 | |
| 23 | 23 | // Venue. |
| 24 | -$has_venue_address = ( ! empty( $venue_details['address'] ) ) ? ' location' : ''; |
|
| 24 | +$has_venue_address = ( ! empty($venue_details['address'])) ? ' location' : ''; |
|
| 25 | 25 | |
| 26 | 26 | // Organizer. |
| 27 | 27 | $organizer = tribe_get_organizer(); |
| 28 | 28 | |
| 29 | 29 | // Event Image. |
| 30 | -echo wp_kses_post( tribe_event_featured_image( null, 'medium' ) ); |
|
| 30 | +echo wp_kses_post(tribe_event_featured_image(null, 'medium')); |
|
| 31 | 31 | ?> |
| 32 | 32 | |
| 33 | 33 | <div class="tribe-events-event-content"> |
| 34 | 34 | <!-- Event Title --> |
| 35 | - <?php do_action( 'tribe_events_before_the_event_title' ); ?> |
|
| 35 | + <?php do_action('tribe_events_before_the_event_title'); ?> |
|
| 36 | 36 | <h2 class="tribe-events-list-event-title"> |
| 37 | - <a class="tribe-event-url" href="<?php echo esc_url( tribe_get_event_link() ); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"> |
|
| 37 | + <a class="tribe-event-url" href="<?php echo esc_url(tribe_get_event_link()); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"> |
|
| 38 | 38 | <?php the_title(); ?> |
| 39 | 39 | </a> |
| 40 | 40 | </h2> |
| 41 | - <?php do_action( 'tribe_events_after_the_event_title' ); ?> |
|
| 41 | + <?php do_action('tribe_events_after_the_event_title'); ?> |
|
| 42 | 42 | |
| 43 | 43 | <!-- Event Meta --> |
| 44 | - <?php do_action( 'tribe_events_before_the_meta' ); ?> |
|
| 44 | + <?php do_action('tribe_events_before_the_meta'); ?> |
|
| 45 | 45 | <div class="tribe-events-event-meta"> |
| 46 | - <div class="author <?php echo esc_attr( $has_venue_address ); ?>"> |
|
| 46 | + <div class="author <?php echo esc_attr($has_venue_address); ?>"> |
|
| 47 | 47 | |
| 48 | 48 | <!-- Schedule & Recurrence Details --> |
| 49 | 49 | <div class="tribe-event-schedule-details"> |
| 50 | - <?php echo wp_kses_post( tribe_events_event_schedule_details() ); ?> |
|
| 50 | + <?php echo wp_kses_post(tribe_events_event_schedule_details()); ?> |
|
| 51 | 51 | </div> |
| 52 | 52 | |
| 53 | - <?php if ( $venue_details ) : ?> |
|
| 53 | + <?php if ($venue_details) : ?> |
|
| 54 | 54 | <!-- Venue Display Info --> |
| 55 | 55 | <div class="tribe-events-venue-details"> |
| 56 | 56 | <?php |
| 57 | - $address_delimiter = empty( $venue_address ) ? ' ' : ', '; |
|
| 57 | + $address_delimiter = empty($venue_address) ? ' ' : ', '; |
|
| 58 | 58 | |
| 59 | 59 | // These details are already escaped in various ways earlier in the process. |
| 60 | - echo implode( $address_delimiter, $venue_details ); |
|
| 60 | + echo implode($address_delimiter, $venue_details); |
|
| 61 | 61 | |
| 62 | - if ( tribe_show_google_map_link() ) { |
|
| 63 | - echo wp_kses_post( tribe_get_map_link_html() ); |
|
| 62 | + if (tribe_show_google_map_link()) { |
|
| 63 | + echo wp_kses_post(tribe_get_map_link_html()); |
|
| 64 | 64 | } |
| 65 | 65 | ?> |
| 66 | 66 | </div> <!-- .tribe-events-venue-details --> |
@@ -70,29 +70,29 @@ discard block |
||
| 70 | 70 | </div><!-- .tribe-events-event-meta --> |
| 71 | 71 | |
| 72 | 72 | <!-- Event Cost --> |
| 73 | - <?php if ( tribe_get_cost() ) : ?> |
|
| 73 | + <?php if (tribe_get_cost()) : ?> |
|
| 74 | 74 | <div class="tribe-events-event-cost"> |
| 75 | - <?php esc_html_e( 'Price:', 'lsx' ); ?> |
|
| 76 | - <span class="ticket-cost"><?php echo tribe_get_cost( null, true ); ?></span> |
|
| 75 | + <?php esc_html_e('Price:', 'lsx'); ?> |
|
| 76 | + <span class="ticket-cost"><?php echo tribe_get_cost(null, true); ?></span> |
|
| 77 | 77 | <?php |
| 78 | 78 | /** |
| 79 | 79 | * Runs after cost is displayed in list style views |
| 80 | 80 | * |
| 81 | 81 | * @since 4.5 |
| 82 | 82 | */ |
| 83 | - do_action( 'tribe_events_inside_cost' ) |
|
| 83 | + do_action('tribe_events_inside_cost') |
|
| 84 | 84 | ?> |
| 85 | 85 | </div> |
| 86 | 86 | <?php endif; ?> |
| 87 | 87 | |
| 88 | - <?php do_action( 'tribe_events_after_the_meta' ); ?> |
|
| 88 | + <?php do_action('tribe_events_after_the_meta'); ?> |
|
| 89 | 89 | |
| 90 | 90 | <!-- Event Content --> |
| 91 | - <?php do_action( 'tribe_events_before_the_content' ); ?> |
|
| 91 | + <?php do_action('tribe_events_before_the_content'); ?> |
|
| 92 | 92 | <div class="tribe-events-list-event-description tribe-events-content description entry-summary"> |
| 93 | - <?php echo wp_kses_post( tribe_events_get_the_excerpt() ); ?> |
|
| 94 | - <a href="<?php echo esc_url( tribe_get_event_link() ); ?>" class="tribe-events-read-more" rel="bookmark"><?php esc_html_e( 'Find out more', 'lsx' ); ?></a> |
|
| 93 | + <?php echo wp_kses_post(tribe_events_get_the_excerpt()); ?> |
|
| 94 | + <a href="<?php echo esc_url(tribe_get_event_link()); ?>" class="tribe-events-read-more" rel="bookmark"><?php esc_html_e('Find out more', 'lsx'); ?></a> |
|
| 95 | 95 | </div><!-- .tribe-events-list-event-description --> |
| 96 | 96 | |
| 97 | - <?php do_action( 'tribe_events_after_the_content' ); ?> |
|
| 97 | + <?php do_action('tribe_events_after_the_content'); ?> |
|
| 98 | 98 | </div> |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | - die( '-1' ); |
|
| 13 | + die( '-1' ); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // Setup an array of venue details for use later in the template. |
@@ -54,15 +54,15 @@ discard block |
||
| 54 | 54 | <!-- Venue Display Info --> |
| 55 | 55 | <div class="tribe-events-venue-details"> |
| 56 | 56 | <?php |
| 57 | - $address_delimiter = empty( $venue_address ) ? ' ' : ', '; |
|
| 57 | + $address_delimiter = empty( $venue_address ) ? ' ' : ', '; |
|
| 58 | 58 | |
| 59 | - // These details are already escaped in various ways earlier in the process. |
|
| 60 | - echo implode( $address_delimiter, $venue_details ); |
|
| 59 | + // These details are already escaped in various ways earlier in the process. |
|
| 60 | + echo implode( $address_delimiter, $venue_details ); |
|
| 61 | 61 | |
| 62 | - if ( tribe_show_google_map_link() ) { |
|
| 63 | - echo wp_kses_post( tribe_get_map_link_html() ); |
|
| 64 | - } |
|
| 65 | - ?> |
|
| 62 | + if ( tribe_show_google_map_link() ) { |
|
| 63 | + echo wp_kses_post( tribe_get_map_link_html() ); |
|
| 64 | + } |
|
| 65 | + ?> |
|
| 66 | 66 | </div> <!-- .tribe-events-venue-details --> |
| 67 | 67 | <?php endif; ?> |
| 68 | 68 | |
@@ -75,13 +75,13 @@ discard block |
||
| 75 | 75 | <?php esc_html_e( 'Price:', 'lsx' ); ?> |
| 76 | 76 | <span class="ticket-cost"><?php echo tribe_get_cost( null, true ); ?></span> |
| 77 | 77 | <?php |
| 78 | - /** |
|
| 79 | - * Runs after cost is displayed in list style views |
|
| 80 | - * |
|
| 81 | - * @since 4.5 |
|
| 82 | - */ |
|
| 83 | - do_action( 'tribe_events_inside_cost' ) |
|
| 84 | - ?> |
|
| 78 | + /** |
|
| 79 | + * Runs after cost is displayed in list style views |
|
| 80 | + * |
|
| 81 | + * @since 4.5 |
|
| 82 | + */ |
|
| 83 | + do_action( 'tribe_events_inside_cost' ) |
|
| 84 | + ?> |
|
| 85 | 85 | </div> |
| 86 | 86 | <?php endif; ?> |
| 87 | 87 | |
@@ -9,52 +9,52 @@ discard block |
||
| 9 | 9 | * @package TribeEventsCalendarPro |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | - die( '-1' ); |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | + die('-1'); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // Setup an array of venue details for use later in the template. |
| 17 | 17 | $venue_details = tribe_get_venue_details(); |
| 18 | 18 | |
| 19 | 19 | // Venue. |
| 20 | -$has_venue_address = ( ! empty( $venue_details['address'] ) ) ? ' location' : ''; |
|
| 20 | +$has_venue_address = ( ! empty($venue_details['address'])) ? ' location' : ''; |
|
| 21 | 21 | |
| 22 | 22 | // Organizer. |
| 23 | 23 | $organizer = tribe_get_organizer(); |
| 24 | 24 | |
| 25 | 25 | // Event Image. |
| 26 | -echo wp_kses_post( tribe_event_featured_image( null, 'large' ) ); |
|
| 26 | +echo wp_kses_post(tribe_event_featured_image(null, 'large')); |
|
| 27 | 27 | ?> |
| 28 | 28 | |
| 29 | 29 | <div class="tribe-events-event-content"> |
| 30 | 30 | <!-- Event Title --> |
| 31 | - <?php do_action( 'tribe_events_before_the_event_title' ); ?> |
|
| 31 | + <?php do_action('tribe_events_before_the_event_title'); ?> |
|
| 32 | 32 | <h2 class="tribe-events-list-event-title"> |
| 33 | - <a class="tribe-event-url" href="<?php echo esc_url( tribe_get_event_link() ); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"> |
|
| 33 | + <a class="tribe-event-url" href="<?php echo esc_url(tribe_get_event_link()); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"> |
|
| 34 | 34 | <?php the_title(); ?> |
| 35 | 35 | </a> |
| 36 | 36 | |
| 37 | - <span class="label label-default"><?php esc_html_e( 'Featured', 'lsx' ); ?></span> |
|
| 37 | + <span class="label label-default"><?php esc_html_e('Featured', 'lsx'); ?></span> |
|
| 38 | 38 | </h2> |
| 39 | - <?php do_action( 'tribe_events_after_the_event_title' ); ?> |
|
| 39 | + <?php do_action('tribe_events_after_the_event_title'); ?> |
|
| 40 | 40 | |
| 41 | 41 | <!-- Event Meta --> |
| 42 | - <?php do_action( 'tribe_events_before_the_meta' ); ?> |
|
| 42 | + <?php do_action('tribe_events_before_the_meta'); ?> |
|
| 43 | 43 | <div class="tribe-events-event-meta"> |
| 44 | - <div class="author <?php echo esc_attr( $has_venue_address ); ?>"> |
|
| 44 | + <div class="author <?php echo esc_attr($has_venue_address); ?>"> |
|
| 45 | 45 | |
| 46 | 46 | <!-- Schedule & Recurrence Details --> |
| 47 | 47 | <div class="tribe-event-schedule-details"> |
| 48 | - <?php echo wp_kses_post( tribe_events_event_schedule_details() ); ?> |
|
| 48 | + <?php echo wp_kses_post(tribe_events_event_schedule_details()); ?> |
|
| 49 | 49 | </div> |
| 50 | 50 | |
| 51 | - <?php if ( $venue_details ) : ?> |
|
| 51 | + <?php if ($venue_details) : ?> |
|
| 52 | 52 | <!-- Venue Display Info --> |
| 53 | 53 | <div class="tribe-events-venue-details"> |
| 54 | - <?php echo wp_kses_post( implode( ', ', $venue_details ) ); ?> |
|
| 54 | + <?php echo wp_kses_post(implode(', ', $venue_details)); ?> |
|
| 55 | 55 | <?php |
| 56 | - if ( tribe_show_google_map_link() ) { |
|
| 57 | - echo wp_kses_post( tribe_get_map_link_html() ); |
|
| 56 | + if (tribe_show_google_map_link()) { |
|
| 57 | + echo wp_kses_post(tribe_get_map_link_html()); |
|
| 58 | 58 | } |
| 59 | 59 | ?> |
| 60 | 60 | </div> <!-- .tribe-events-venue-details --> |
@@ -62,26 +62,26 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | </div> |
| 64 | 64 | </div><!-- .tribe-events-event-meta --> |
| 65 | - <?php do_action( 'tribe_events_after_the_meta' ); ?> |
|
| 65 | + <?php do_action('tribe_events_after_the_meta'); ?> |
|
| 66 | 66 | |
| 67 | 67 | <!-- Event Cost --> |
| 68 | - <?php if ( tribe_get_cost() ) : ?> |
|
| 68 | + <?php if (tribe_get_cost()) : ?> |
|
| 69 | 69 | <div class="tribe-events-event-cost featured-event"> |
| 70 | - <?php esc_html_e( 'Price:', 'lsx' ); ?> |
|
| 71 | - <span class="ticket-cost"><?php echo esc_html( tribe_get_cost( null, true ) ); ?></span> |
|
| 70 | + <?php esc_html_e('Price:', 'lsx'); ?> |
|
| 71 | + <span class="ticket-cost"><?php echo esc_html(tribe_get_cost(null, true)); ?></span> |
|
| 72 | 72 | <?php |
| 73 | 73 | /** This action is documented in the-events-calendar/src/views/list/single-event.php */ |
| 74 | - do_action( 'tribe_events_inside_cost' ) |
|
| 74 | + do_action('tribe_events_inside_cost') |
|
| 75 | 75 | ?> |
| 76 | 76 | </div> |
| 77 | 77 | <?php endif; ?> |
| 78 | 78 | |
| 79 | 79 | <!-- Event Content --> |
| 80 | - <?php do_action( 'tribe_events_before_the_content' ); ?> |
|
| 80 | + <?php do_action('tribe_events_before_the_content'); ?> |
|
| 81 | 81 | <div class="tribe-events-list-event-description tribe-events-content"> |
| 82 | - <?php echo wp_kses_post( tribe_events_get_the_excerpt() ); ?> |
|
| 83 | - <a href="<?php echo esc_url( tribe_get_event_link() ); ?>" class="tribe-events-read-more" rel="bookmark"><?php esc_html_e( 'Find out more', 'lsx' ); ?></a> |
|
| 82 | + <?php echo wp_kses_post(tribe_events_get_the_excerpt()); ?> |
|
| 83 | + <a href="<?php echo esc_url(tribe_get_event_link()); ?>" class="tribe-events-read-more" rel="bookmark"><?php esc_html_e('Find out more', 'lsx'); ?></a> |
|
| 84 | 84 | </div><!-- .tribe-events-list-event-description --> |
| 85 | 85 | |
| 86 | - <?php do_action( 'tribe_events_after_the_content' ); ?> |
|
| 86 | + <?php do_action('tribe_events_after_the_content'); ?> |
|
| 87 | 87 | </div> |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | - die( '-1' ); |
|
| 13 | + die( '-1' ); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // Setup an array of venue details for use later in the template. |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | <div class="tribe-events-venue-details"> |
| 54 | 54 | <?php echo wp_kses_post( implode( ', ', $venue_details ) ); ?> |
| 55 | 55 | <?php |
| 56 | - if ( tribe_show_google_map_link() ) { |
|
| 57 | - echo wp_kses_post( tribe_get_map_link_html() ); |
|
| 58 | - } |
|
| 59 | - ?> |
|
| 56 | + if ( tribe_show_google_map_link() ) { |
|
| 57 | + echo wp_kses_post( tribe_get_map_link_html() ); |
|
| 58 | + } |
|
| 59 | + ?> |
|
| 60 | 60 | </div> <!-- .tribe-events-venue-details --> |
| 61 | 61 | <?php endif; ?> |
| 62 | 62 | |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | <?php esc_html_e( 'Price:', 'lsx' ); ?> |
| 71 | 71 | <span class="ticket-cost"><?php echo esc_html( tribe_get_cost( null, true ) ); ?></span> |
| 72 | 72 | <?php |
| 73 | - /** This action is documented in the-events-calendar/src/views/list/single-event.php */ |
|
| 74 | - do_action( 'tribe_events_inside_cost' ) |
|
| 75 | - ?> |
|
| 73 | + /** This action is documented in the-events-calendar/src/views/list/single-event.php */ |
|
| 74 | + do_action( 'tribe_events_inside_cost' ) |
|
| 75 | + ?> |
|
| 76 | 76 | </div> |
| 77 | 77 | <?php endif; ?> |
| 78 | 78 | |