@@ -9,66 +9,66 @@ |
||
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 | $venue_details = tribe_get_venue_details(); |
17 | 17 | |
18 | 18 | // Venue microformats. |
19 | -$has_venue = ( $venue_details ) ? ' vcard' : ''; |
|
20 | -$has_venue_address = ( ! empty( $venue_details['address'] ) ) ? ' location' : ''; |
|
19 | +$has_venue = ($venue_details) ? ' vcard' : ''; |
|
20 | +$has_venue_address = ( ! empty($venue_details['address'])) ? ' location' : ''; |
|
21 | 21 | |
22 | 22 | // Event Image. |
23 | -echo wp_kses_post( tribe_event_featured_image( null, 'large' ) ); |
|
23 | +echo wp_kses_post(tribe_event_featured_image(null, 'large')); |
|
24 | 24 | ?> |
25 | 25 | |
26 | 26 | <div class="tribe-events-event-content"> |
27 | 27 | <!-- Event Title --> |
28 | - <?php do_action( 'tribe_events_before_the_event_title' ); ?> |
|
28 | + <?php do_action('tribe_events_before_the_event_title'); ?> |
|
29 | 29 | <h2 class="tribe-events-list-event-title summary"> |
30 | - <a class="url" href="<?php echo esc_url( tribe_get_event_link() ); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"> |
|
30 | + <a class="url" href="<?php echo esc_url(tribe_get_event_link()); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"> |
|
31 | 31 | <?php the_title(); ?> |
32 | 32 | </a> |
33 | 33 | </h2> |
34 | - <?php do_action( 'tribe_events_after_the_event_title' ); ?> |
|
34 | + <?php do_action('tribe_events_after_the_event_title'); ?> |
|
35 | 35 | |
36 | 36 | <!-- Event Meta --> |
37 | - <?php do_action( 'tribe_events_before_the_meta' ); ?> |
|
38 | - <div class="tribe-events-event-meta <?php echo esc_attr( $has_venue . $has_venue_address ); ?>"> |
|
37 | + <?php do_action('tribe_events_before_the_meta'); ?> |
|
38 | + <div class="tribe-events-event-meta <?php echo esc_attr($has_venue . $has_venue_address); ?>"> |
|
39 | 39 | |
40 | 40 | <!-- Schedule & Recurrence Details --> |
41 | 41 | <div class="tribe-updated published time-details"> |
42 | - <?php echo wp_kses_post( tribe_events_event_schedule_details() ); ?> |
|
42 | + <?php echo wp_kses_post(tribe_events_event_schedule_details()); ?> |
|
43 | 43 | </div> |
44 | 44 | |
45 | - <?php if ( $venue_details ) : ?> |
|
45 | + <?php if ($venue_details) : ?> |
|
46 | 46 | <!-- Venue Display Info --> |
47 | 47 | <div class="tribe-events-venue-details"> |
48 | - <?php echo implode( ', ', $venue_details ); ?> |
|
48 | + <?php echo implode(', ', $venue_details); ?> |
|
49 | 49 | </div> <!-- .tribe-events-venue-details --> |
50 | 50 | <?php endif; ?> |
51 | 51 | |
52 | 52 | </div><!-- .tribe-events-event-meta --> |
53 | - <?php do_action( 'tribe_events_after_the_meta' ); ?> |
|
53 | + <?php do_action('tribe_events_after_the_meta'); ?> |
|
54 | 54 | |
55 | - <?php if ( tribe_get_cost() ) : ?> |
|
55 | + <?php if (tribe_get_cost()) : ?> |
|
56 | 56 | <div class="tribe-events-event-cost"> |
57 | - <?php esc_html_e( 'Price:', 'lsx' ); ?> |
|
58 | - <span class="ticket-cost"><?php echo tribe_get_cost( null, true ); ?></span> |
|
57 | + <?php esc_html_e('Price:', 'lsx'); ?> |
|
58 | + <span class="ticket-cost"><?php echo tribe_get_cost(null, true); ?></span> |
|
59 | 59 | <?php |
60 | 60 | /** This action is documented in the-events-calendar/src/views/list/single-event.php */ |
61 | - do_action( 'tribe_events_inside_cost' ) |
|
61 | + do_action('tribe_events_inside_cost') |
|
62 | 62 | ?> |
63 | 63 | </div> |
64 | 64 | <?php endif; ?> |
65 | 65 | |
66 | 66 | <!-- Event Content --> |
67 | - <?php do_action( 'tribe_events_before_the_content' ); ?> |
|
67 | + <?php do_action('tribe_events_before_the_content'); ?> |
|
68 | 68 | <div class="tribe-events-list-event-description tribe-events-content description entry-summary"> |
69 | - <?php echo wp_kses_post( tribe_events_get_the_excerpt() ); ?> |
|
70 | - <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> |
|
69 | + <?php echo wp_kses_post(tribe_events_get_the_excerpt()); ?> |
|
70 | + <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> |
|
71 | 71 | </div><!-- .tribe-events-list-event-description --> |
72 | 72 | |
73 | - <?php do_action( 'tribe_events_after_the_content' ); ?> |
|
73 | + <?php do_action('tribe_events_after_the_content'); ?> |
|
74 | 74 | </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 | $venue_details = tribe_get_venue_details(); |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | <?php esc_html_e( 'Price:', 'lsx' ); ?> |
58 | 58 | <span class="ticket-cost"><?php echo tribe_get_cost( null, true ); ?></span> |
59 | 59 | <?php |
60 | - /** This action is documented in the-events-calendar/src/views/list/single-event.php */ |
|
61 | - do_action( 'tribe_events_inside_cost' ) |
|
62 | - ?> |
|
60 | + /** This action is documented in the-events-calendar/src/views/list/single-event.php */ |
|
61 | + do_action( 'tribe_events_inside_cost' ) |
|
62 | + ?> |
|
63 | 63 | </div> |
64 | 64 | <?php endif; ?> |
65 | 65 |
@@ -14,31 +14,31 @@ |
||
14 | 14 | * @package TribeEventsCalendarPro |
15 | 15 | */ |
16 | 16 | |
17 | -if ( ! defined( 'ABSPATH' ) ) { |
|
18 | - die( '-1' ); |
|
17 | +if ( ! defined('ABSPATH')) { |
|
18 | + die('-1'); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $posts = tribe_get_related_posts(); |
22 | 22 | |
23 | -if ( is_array( $posts ) && ! empty( $posts ) ) : ?> |
|
23 | +if (is_array($posts) && ! empty($posts)) : ?> |
|
24 | 24 | <?php /* Translators: %s: related */ ?> |
25 | -<h3 class="tribe-events-related-events-title"><?php printf( esc_html__( 'Related %s', 'lsx' ), esc_html( tribe_get_event_label_plural() ) ); ?></h3> |
|
25 | +<h3 class="tribe-events-related-events-title"><?php printf(esc_html__('Related %s', 'lsx'), esc_html(tribe_get_event_label_plural())); ?></h3> |
|
26 | 26 | |
27 | 27 | <ul class="tribe-related-events tribe-clearfix"> |
28 | - <?php foreach ( $posts as $post ) : ?> |
|
28 | + <?php foreach ($posts as $post) : ?> |
|
29 | 29 | <li> |
30 | - <?php $thumb = ( has_post_thumbnail( $post->ID ) ) ? get_the_post_thumbnail( $post->ID, 'large' ) : '<img src="' . esc_url( trailingslashit( Tribe__Events__Pro__Main::instance()->pluginUrl ) . 'src/resources/images/tribe-related-events-placeholder.png' ) . '" alt="' . esc_attr( get_the_title( $post->ID ) ) . '" />'; ?> |
|
30 | + <?php $thumb = (has_post_thumbnail($post->ID)) ? get_the_post_thumbnail($post->ID, 'large') : '<img src="' . esc_url(trailingslashit(Tribe__Events__Pro__Main::instance()->pluginUrl) . 'src/resources/images/tribe-related-events-placeholder.png') . '" alt="' . esc_attr(get_the_title($post->ID)) . '" />'; ?> |
|
31 | 31 | <div class="tribe-related-events-thumbnail"> |
32 | - <a href="<?php echo esc_url( tribe_get_event_link( $post ) ); ?>" class="url" rel="bookmark"><?php echo wp_kses_post( $thumb ); ?></a> |
|
32 | + <a href="<?php echo esc_url(tribe_get_event_link($post)); ?>" class="url" rel="bookmark"><?php echo wp_kses_post($thumb); ?></a> |
|
33 | 33 | </div> |
34 | 34 | <div class="tribe-related-event-info"> |
35 | - <h3 class="tribe-related-events-title"><a href="<?php echo esc_url( tribe_get_event_link( $post ) ); ?>" class="tribe-event-url" rel="bookmark"><?php echo get_the_title( $post->ID ); ?></a></h3> |
|
35 | + <h3 class="tribe-related-events-title"><a href="<?php echo esc_url(tribe_get_event_link($post)); ?>" class="tribe-event-url" rel="bookmark"><?php echo get_the_title($post->ID); ?></a></h3> |
|
36 | 36 | <?php |
37 | - if ( Tribe__Events__Main::POSTTYPE === $post->post_type ) { |
|
38 | - echo wp_kses_post( tribe_events_event_schedule_details( $post ) ); |
|
37 | + if (Tribe__Events__Main::POSTTYPE === $post->post_type) { |
|
38 | + echo wp_kses_post(tribe_events_event_schedule_details($post)); |
|
39 | 39 | } |
40 | 40 | ?> |
41 | - <a href="<?php echo esc_url( tribe_get_event_link( $post ) ); ?>" class="moretag"><?php esc_html_e( 'View event', 'lsx' ); ?></a> |
|
41 | + <a href="<?php echo esc_url(tribe_get_event_link($post)); ?>" class="moretag"><?php esc_html_e('View event', 'lsx'); ?></a> |
|
42 | 42 | </div> |
43 | 43 | </li> |
44 | 44 | <?php endforeach; ?> |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | |
17 | 17 | if ( ! defined( 'ABSPATH' ) ) { |
18 | - die( '-1' ); |
|
18 | + die( '-1' ); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $posts = tribe_get_related_posts(); |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | <div class="tribe-related-event-info"> |
35 | 35 | <h3 class="tribe-related-events-title"><a href="<?php echo esc_url( tribe_get_event_link( $post ) ); ?>" class="tribe-event-url" rel="bookmark"><?php echo get_the_title( $post->ID ); ?></a></h3> |
36 | 36 | <?php |
37 | - if ( Tribe__Events__Main::POSTTYPE === $post->post_type ) { |
|
38 | - echo wp_kses_post( tribe_events_event_schedule_details( $post ) ); |
|
39 | - } |
|
40 | - ?> |
|
37 | + if ( Tribe__Events__Main::POSTTYPE === $post->post_type ) { |
|
38 | + echo wp_kses_post( tribe_events_event_schedule_details( $post ) ); |
|
39 | + } |
|
40 | + ?> |
|
41 | 41 | <a href="<?php echo esc_url( tribe_get_event_link( $post ) ); ?>" class="moretag"><?php esc_html_e( 'View event', 'lsx' ); ?></a> |
42 | 42 | </div> |
43 | 43 | </li> |
@@ -6,11 +6,11 @@ discard block |
||
6 | 6 | * @subpackage widgets |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
13 | -if ( ! function_exists( 'lsx_widget_area_init' ) ) : |
|
13 | +if ( ! function_exists('lsx_widget_area_init')) : |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Register widgetized area and update sidebar with default widgets. |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | function lsx_widget_area_init() { |
22 | 22 | register_sidebar( |
23 | 23 | array( |
24 | - 'name' => esc_html__( 'Home', 'lsx' ), |
|
24 | + 'name' => esc_html__('Home', 'lsx'), |
|
25 | 25 | 'id' => 'sidebar-home', |
26 | 26 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
27 | 27 | 'after_widget' => '</aside>', |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | register_sidebar( |
34 | 34 | array( |
35 | - 'name' => esc_html__( 'Sidebar', 'lsx' ), |
|
35 | + 'name' => esc_html__('Sidebar', 'lsx'), |
|
36 | 36 | 'id' => 'sidebar-1', |
37 | 37 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
38 | 38 | 'after_widget' => '</aside>', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | register_sidebar( |
45 | 45 | array( |
46 | - 'name' => esc_html__( 'Footer', 'lsx' ), |
|
46 | + 'name' => esc_html__('Footer', 'lsx'), |
|
47 | 47 | 'id' => 'sidebar-footer', |
48 | 48 | 'before_widget' => '<div class="styler"><aside id="%1$s" class="widget %2$s">', |
49 | 49 | 'after_widget' => '</aside></div>', |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | register_sidebar( |
56 | 56 | array( |
57 | - 'name' => esc_html__( 'Footer Call to Action', 'lsx' ), |
|
57 | + 'name' => esc_html__('Footer Call to Action', 'lsx'), |
|
58 | 58 | 'id' => 'sidebar-footer-cta', |
59 | 59 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
60 | 60 | 'after_widget' => '</aside>', |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | |
67 | 67 | endif; |
68 | 68 | |
69 | -add_action( 'widgets_init', 'lsx_widget_area_init' ); |
|
69 | +add_action('widgets_init', 'lsx_widget_area_init'); |
|
70 | 70 | |
71 | -if ( ! function_exists( 'lsx_sidebar_footer_params' ) ) : |
|
71 | +if ( ! function_exists('lsx_sidebar_footer_params')) : |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Register widgetized area and update sidebar with default widgets. |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | * @subpackage widgets |
78 | 78 | * @return $params |
79 | 79 | */ |
80 | - function lsx_sidebar_footer_params( $params ) { |
|
80 | + function lsx_sidebar_footer_params($params) { |
|
81 | 81 | $sidebar_id = $params[0]['id']; |
82 | 82 | |
83 | - if ( 'sidebar-footer' === $sidebar_id ) { |
|
83 | + if ('sidebar-footer' === $sidebar_id) { |
|
84 | 84 | $total_widgets = wp_get_sidebars_widgets(); |
85 | - $sidebar_widgets = count( $total_widgets[ $sidebar_id ] ); |
|
86 | - $params[0]['before_widget'] = str_replace( 'class="styler', 'class="col-md-' . floor( 12 / $sidebar_widgets ), $params[0]['before_widget'] ); |
|
85 | + $sidebar_widgets = count($total_widgets[$sidebar_id]); |
|
86 | + $params[0]['before_widget'] = str_replace('class="styler', 'class="col-md-' . floor(12 / $sidebar_widgets), $params[0]['before_widget']); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | return $params; |
@@ -91,4 +91,4 @@ discard block |
||
91 | 91 | |
92 | 92 | endif; |
93 | 93 | |
94 | -add_filter( 'dynamic_sidebar_params', 'lsx_sidebar_footer_params' ); |
|
94 | +add_filter('dynamic_sidebar_params', 'lsx_sidebar_footer_params'); |
@@ -7,62 +7,62 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
10 | - exit; |
|
10 | + exit; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | if ( ! function_exists( 'lsx_widget_area_init' ) ) : |
14 | 14 | |
15 | - /** |
|
16 | - * Register widgetized area and update sidebar with default widgets. |
|
17 | - * |
|
18 | - * @package lsx |
|
19 | - * @subpackage widgets |
|
20 | - */ |
|
21 | - function lsx_widget_area_init() { |
|
22 | - register_sidebar( |
|
23 | - array( |
|
24 | - 'name' => esc_html__( 'Home', 'lsx' ), |
|
25 | - 'id' => 'sidebar-home', |
|
26 | - 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
|
27 | - 'after_widget' => '</aside>', |
|
28 | - 'before_title' => '<h3 class="widget-title">', |
|
29 | - 'after_title' => '</h3>', |
|
30 | - ) |
|
31 | - ); |
|
15 | + /** |
|
16 | + * Register widgetized area and update sidebar with default widgets. |
|
17 | + * |
|
18 | + * @package lsx |
|
19 | + * @subpackage widgets |
|
20 | + */ |
|
21 | + function lsx_widget_area_init() { |
|
22 | + register_sidebar( |
|
23 | + array( |
|
24 | + 'name' => esc_html__( 'Home', 'lsx' ), |
|
25 | + 'id' => 'sidebar-home', |
|
26 | + 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
|
27 | + 'after_widget' => '</aside>', |
|
28 | + 'before_title' => '<h3 class="widget-title">', |
|
29 | + 'after_title' => '</h3>', |
|
30 | + ) |
|
31 | + ); |
|
32 | 32 | |
33 | - register_sidebar( |
|
34 | - array( |
|
35 | - 'name' => esc_html__( 'Sidebar', 'lsx' ), |
|
36 | - 'id' => 'sidebar-1', |
|
37 | - 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
|
38 | - 'after_widget' => '</aside>', |
|
39 | - 'before_title' => '<h3 class="widget-title">', |
|
40 | - 'after_title' => '</h3>', |
|
41 | - ) |
|
42 | - ); |
|
33 | + register_sidebar( |
|
34 | + array( |
|
35 | + 'name' => esc_html__( 'Sidebar', 'lsx' ), |
|
36 | + 'id' => 'sidebar-1', |
|
37 | + 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
|
38 | + 'after_widget' => '</aside>', |
|
39 | + 'before_title' => '<h3 class="widget-title">', |
|
40 | + 'after_title' => '</h3>', |
|
41 | + ) |
|
42 | + ); |
|
43 | 43 | |
44 | - register_sidebar( |
|
45 | - array( |
|
46 | - 'name' => esc_html__( 'Footer', 'lsx' ), |
|
47 | - 'id' => 'sidebar-footer', |
|
48 | - 'before_widget' => '<div class="styler"><aside id="%1$s" class="widget %2$s">', |
|
49 | - 'after_widget' => '</aside></div>', |
|
50 | - 'before_title' => '<h3 class="widget-title">', |
|
51 | - 'after_title' => '</h3>', |
|
52 | - ) |
|
53 | - ); |
|
44 | + register_sidebar( |
|
45 | + array( |
|
46 | + 'name' => esc_html__( 'Footer', 'lsx' ), |
|
47 | + 'id' => 'sidebar-footer', |
|
48 | + 'before_widget' => '<div class="styler"><aside id="%1$s" class="widget %2$s">', |
|
49 | + 'after_widget' => '</aside></div>', |
|
50 | + 'before_title' => '<h3 class="widget-title">', |
|
51 | + 'after_title' => '</h3>', |
|
52 | + ) |
|
53 | + ); |
|
54 | 54 | |
55 | - register_sidebar( |
|
56 | - array( |
|
57 | - 'name' => esc_html__( 'Footer Call to Action', 'lsx' ), |
|
58 | - 'id' => 'sidebar-footer-cta', |
|
59 | - 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
|
60 | - 'after_widget' => '</aside>', |
|
61 | - 'before_title' => '<h3 class="widget-title">', |
|
62 | - 'after_title' => '</h3>', |
|
63 | - ) |
|
64 | - ); |
|
65 | - } |
|
55 | + register_sidebar( |
|
56 | + array( |
|
57 | + 'name' => esc_html__( 'Footer Call to Action', 'lsx' ), |
|
58 | + 'id' => 'sidebar-footer-cta', |
|
59 | + 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
|
60 | + 'after_widget' => '</aside>', |
|
61 | + 'before_title' => '<h3 class="widget-title">', |
|
62 | + 'after_title' => '</h3>', |
|
63 | + ) |
|
64 | + ); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | endif; |
68 | 68 | |
@@ -70,24 +70,24 @@ discard block |
||
70 | 70 | |
71 | 71 | if ( ! function_exists( 'lsx_sidebar_footer_params' ) ) : |
72 | 72 | |
73 | - /** |
|
74 | - * Register widgetized area and update sidebar with default widgets. |
|
75 | - * |
|
76 | - * @package lsx |
|
77 | - * @subpackage widgets |
|
78 | - * @return $params |
|
79 | - */ |
|
80 | - function lsx_sidebar_footer_params( $params ) { |
|
81 | - $sidebar_id = $params[0]['id']; |
|
73 | + /** |
|
74 | + * Register widgetized area and update sidebar with default widgets. |
|
75 | + * |
|
76 | + * @package lsx |
|
77 | + * @subpackage widgets |
|
78 | + * @return $params |
|
79 | + */ |
|
80 | + function lsx_sidebar_footer_params( $params ) { |
|
81 | + $sidebar_id = $params[0]['id']; |
|
82 | 82 | |
83 | - if ( 'sidebar-footer' === $sidebar_id ) { |
|
84 | - $total_widgets = wp_get_sidebars_widgets(); |
|
85 | - $sidebar_widgets = count( $total_widgets[ $sidebar_id ] ); |
|
86 | - $params[0]['before_widget'] = str_replace( 'class="styler', 'class="col-md-' . floor( 12 / $sidebar_widgets ), $params[0]['before_widget'] ); |
|
87 | - } |
|
83 | + if ( 'sidebar-footer' === $sidebar_id ) { |
|
84 | + $total_widgets = wp_get_sidebars_widgets(); |
|
85 | + $sidebar_widgets = count( $total_widgets[ $sidebar_id ] ); |
|
86 | + $params[0]['before_widget'] = str_replace( 'class="styler', 'class="col-md-' . floor( 12 / $sidebar_widgets ), $params[0]['before_widget'] ); |
|
87 | + } |
|
88 | 88 | |
89 | - return $params; |
|
90 | - } |
|
89 | + return $params; |
|
90 | + } |
|
91 | 91 | |
92 | 92 | endif; |
93 | 93 |
@@ -6,11 +6,11 @@ discard block |
||
6 | 6 | * @subpackage config |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
13 | -if ( ! function_exists( 'lsx_setup' ) ) : |
|
13 | +if ( ! function_exists('lsx_setup')) : |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Theme after_setup_theme action. |
@@ -22,26 +22,26 @@ discard block |
||
22 | 22 | global $content_width; |
23 | 23 | $content_width = 1140; |
24 | 24 | |
25 | - load_theme_textdomain( 'lsx', get_template_directory() . '/languages' ); |
|
25 | + load_theme_textdomain('lsx', get_template_directory() . '/languages'); |
|
26 | 26 | |
27 | - add_image_size( 'lsx-thumbnail-carousel', 350, 230, true ); |
|
28 | - add_image_size( 'lsx-thumbnail-wide', 360, 168, true ); |
|
29 | - add_image_size( 'lsx-thumbnail-square', 350, 350, true ); |
|
30 | - add_image_size( 'lsx-thumbnail-single', 750, 350, true ); |
|
31 | - add_image_size( 'lsx-banner', 1920, 600, true ); |
|
27 | + add_image_size('lsx-thumbnail-carousel', 350, 230, true); |
|
28 | + add_image_size('lsx-thumbnail-wide', 360, 168, true); |
|
29 | + add_image_size('lsx-thumbnail-square', 350, 350, true); |
|
30 | + add_image_size('lsx-thumbnail-single', 750, 350, true); |
|
31 | + add_image_size('lsx-banner', 1920, 600, true); |
|
32 | 32 | |
33 | 33 | register_nav_menus( |
34 | 34 | array( |
35 | - 'primary' => esc_html__( 'Primary Menu', 'lsx' ), |
|
36 | - 'top-menu' => esc_html__( 'Top Menu (right)', 'lsx' ), |
|
37 | - 'top-menu-left' => esc_html__( 'Top Menu (left)', 'lsx' ), |
|
38 | - 'social' => esc_html__( 'Social Menu', 'lsx' ), |
|
39 | - 'footer' => esc_html__( 'Footer Menu', 'lsx' ), |
|
35 | + 'primary' => esc_html__('Primary Menu', 'lsx'), |
|
36 | + 'top-menu' => esc_html__('Top Menu (right)', 'lsx'), |
|
37 | + 'top-menu-left' => esc_html__('Top Menu (left)', 'lsx'), |
|
38 | + 'social' => esc_html__('Social Menu', 'lsx'), |
|
39 | + 'footer' => esc_html__('Footer Menu', 'lsx'), |
|
40 | 40 | ) |
41 | 41 | ); |
42 | 42 | |
43 | - add_theme_support( 'automatic-feed-links' ); |
|
44 | - add_theme_support( 'custom-background' ); |
|
43 | + add_theme_support('automatic-feed-links'); |
|
44 | + add_theme_support('custom-background'); |
|
45 | 45 | |
46 | 46 | add_theme_support( |
47 | 47 | 'custom-logo', |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | ) |
54 | 54 | ); |
55 | 55 | |
56 | - add_theme_support( 'html5', array( 'caption' ) ); |
|
56 | + add_theme_support('html5', array('caption')); |
|
57 | 57 | |
58 | 58 | add_theme_support( |
59 | 59 | 'post-formats', |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | ) |
67 | 67 | ); |
68 | 68 | |
69 | - add_theme_support( 'post-thumbnails' ); |
|
70 | - add_theme_support( 'sensei' ); |
|
69 | + add_theme_support('post-thumbnails'); |
|
70 | + add_theme_support('sensei'); |
|
71 | 71 | |
72 | 72 | add_theme_support( |
73 | 73 | 'site-logo', |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | ) |
81 | 81 | ); |
82 | 82 | |
83 | - add_theme_support( 'title-tag' ); |
|
83 | + add_theme_support('title-tag'); |
|
84 | 84 | |
85 | 85 | /* |
86 | 86 | * @TODO - Necessary to test it |
87 | 87 | */ |
88 | 88 | |
89 | 89 | // add_theme_support( 'woocommerce' );. |
90 | - add_theme_support( 'starter-content', array( |
|
90 | + add_theme_support('starter-content', array( |
|
91 | 91 | 'widgets' => array( |
92 | 92 | 'sidebar-home' => array( |
93 | 93 | 'custom_widget_1' => array( |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | array( |
97 | 97 | 'title' => '', |
98 | - 'text' => wp_kses_post( '<div class="row"><div class="col-sm-12 text-center"><h3>Build your perfect website <small>with the LSX theme</small></h3></div></div><div class="row"><div class="col-sm-4 text-center"><h4>Fast</h4><p>"Quick" isn\'t a word most people use when describing their website building experience.</p></div><div class="col-sm-4 text-center"><h4>Easy</h4><p>We\'ve built websites for countless clients, and we know what kind of back-end makes sense easily.</p></div><div class="col-sm-4 text-center"><h4>Comprehensive</h4><p>The LSX extensions come with features out the box that are essential.</p></div></div>' ), |
|
98 | + 'text' => wp_kses_post('<div class="row"><div class="col-sm-12 text-center"><h3>Build your perfect website <small>with the LSX theme</small></h3></div></div><div class="row"><div class="col-sm-4 text-center"><h4>Fast</h4><p>"Quick" isn\'t a word most people use when describing their website building experience.</p></div><div class="col-sm-4 text-center"><h4>Easy</h4><p>We\'ve built websites for countless clients, and we know what kind of back-end makes sense easily.</p></div><div class="col-sm-4 text-center"><h4>Comprehensive</h4><p>The LSX extensions come with features out the box that are essential.</p></div></div>'), |
|
99 | 99 | ), |
100 | 100 | ), |
101 | 101 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | array( |
106 | 106 | 'title' => '', |
107 | - 'text' => wp_kses_post( '<div class="lsx-full-width-alt"><div class="row"><div class="col-xs-12"><h3>A big CTA title</h3><p class="text-center"><a class="btn cta-btn" href="http://www.lsdeb.biz/" target="_blank" rel="noreferrer noopener">Hire Us</a><p></div></div></div>' ), |
|
107 | + 'text' => wp_kses_post('<div class="lsx-full-width-alt"><div class="row"><div class="col-xs-12"><h3>A big CTA title</h3><p class="text-center"><a class="btn cta-btn" href="http://www.lsdeb.biz/" target="_blank" rel="noreferrer noopener">Hire Us</a><p></div></div></div>'), |
|
108 | 108 | ), |
109 | 109 | ), |
110 | 110 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | array( |
115 | 115 | 'title' => '', |
116 | - 'text' => wp_kses_post( '<div class="row"><div class="col-xs-12"><h3>Homepage Widget</h3><p>Lorem ipsum dolor sit amet, <a href="#">consectetuer adipiscing elit</a>. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.</p></div></div>' ), |
|
116 | + 'text' => wp_kses_post('<div class="row"><div class="col-xs-12"><h3>Homepage Widget</h3><p>Lorem ipsum dolor sit amet, <a href="#">consectetuer adipiscing elit</a>. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.</p></div></div>'), |
|
117 | 117 | ), |
118 | 118 | ), |
119 | 119 | ), |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | 'text', |
124 | 124 | |
125 | 125 | array( |
126 | - 'title' => esc_html__( 'Space for Footer Widgets', 'lsx' ), |
|
127 | - 'text' => esc_html__( 'This is here to showcase some footer widgets. You can decide what to add and what to hide. Nam nostrum evertitur ad, ut pri nibh veniam, urbanitas definitionem eum ex.', 'lsx' ), |
|
126 | + 'title' => esc_html__('Space for Footer Widgets', 'lsx'), |
|
127 | + 'text' => esc_html__('This is here to showcase some footer widgets. You can decide what to add and what to hide. Nam nostrum evertitur ad, ut pri nibh veniam, urbanitas definitionem eum ex.', 'lsx'), |
|
128 | 128 | ), |
129 | 129 | ), |
130 | 130 | |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | 'text', |
133 | 133 | |
134 | 134 | array( |
135 | - 'title' => esc_html__( 'Space for Footer Widgets', 'lsx' ), |
|
136 | - 'text' => esc_html__( 'This is here to showcase some footer widgets. You can decide what to add and what to hide. Nam nostrum evertitur ad, ut pri nibh veniam, urbanitas definitionem eum ex.', 'lsx' ), |
|
135 | + 'title' => esc_html__('Space for Footer Widgets', 'lsx'), |
|
136 | + 'text' => esc_html__('This is here to showcase some footer widgets. You can decide what to add and what to hide. Nam nostrum evertitur ad, ut pri nibh veniam, urbanitas definitionem eum ex.', 'lsx'), |
|
137 | 137 | ), |
138 | 138 | ), |
139 | 139 | |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | 'text', |
142 | 142 | |
143 | 143 | array( |
144 | - 'title' => esc_html__( 'Contact us:', 'lsx' ), |
|
145 | - 'text' => wp_kses_post( '<a href="mailto:[email protected]><i class="fa fa-envelope fa-fw"></i> [email protected]</a><br><a href="tel:+27214489843"><i class="fa fa-phone fa-fw"></i> +27 21 448 9843</a><br><i class="fa fa-skype fa-fw"></i> /lightspeeddevelopment' ), |
|
144 | + 'title' => esc_html__('Contact us:', 'lsx'), |
|
145 | + 'text' => wp_kses_post('<a href="mailto:[email protected]><i class="fa fa-envelope fa-fw"></i> [email protected]</a><br><a href="tel:+27214489843"><i class="fa fa-phone fa-fw"></i> +27 21 448 9843</a><br><i class="fa fa-skype fa-fw"></i> /lightspeeddevelopment'), |
|
146 | 146 | ), |
147 | 147 | ), |
148 | 148 | ), |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | 'text', |
153 | 153 | |
154 | 154 | array( |
155 | - 'title' => esc_html__( 'A Footer Call to Action', 'lsx' ), |
|
156 | - 'text' => esc_html__( 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.', 'lsx' ), |
|
155 | + 'title' => esc_html__('A Footer Call to Action', 'lsx'), |
|
156 | + 'text' => esc_html__('Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.', 'lsx'), |
|
157 | 157 | ), |
158 | 158 | ), |
159 | 159 | ), |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | 'home' => array( |
164 | 164 | 'template' => 'page-templates/template-front-page.php', |
165 | 165 | 'thumbnail' => '{{image-banner-example-01}}', |
166 | - 'post_title' => esc_html__( 'LSX is a free WordPress theme', 'lsx' ), |
|
166 | + 'post_title' => esc_html__('LSX is a free WordPress theme', 'lsx'), |
|
167 | 167 | 'post_content' => '', |
168 | 168 | ), |
169 | 169 | |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | |
181 | 181 | 'attachments' => array( |
182 | 182 | 'image-banner-example-01' => array( |
183 | - 'post_title' => esc_html_x( 'Banner Example 01', 'Theme starter content', 'lsx' ), |
|
183 | + 'post_title' => esc_html_x('Banner Example 01', 'Theme starter content', 'lsx'), |
|
184 | 184 | 'file' => 'assets/images/admin/banner-example-01.jpg', |
185 | 185 | ), |
186 | 186 | |
187 | 187 | 'image-banner-example-02' => array( |
188 | - 'post_title' => esc_html_x( 'Banner Example 02', 'Theme starter content', 'lsx' ), |
|
188 | + 'post_title' => esc_html_x('Banner Example 02', 'Theme starter content', 'lsx'), |
|
189 | 189 | 'file' => 'assets/images/admin/banner-example-02.jpg', |
190 | 190 | ), |
191 | 191 | |
192 | 192 | 'image-banner-example-03' => array( |
193 | - 'post_title' => esc_html_x( 'Banner Example 03', 'Theme starter content', 'lsx' ), |
|
193 | + 'post_title' => esc_html_x('Banner Example 03', 'Theme starter content', 'lsx'), |
|
194 | 194 | 'file' => 'assets/images/admin/banner-example-03.jpg', |
195 | 195 | ), |
196 | 196 | ), |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | 'show_on_front' => 'page', |
200 | 200 | 'page_on_front' => '{{home}}', |
201 | 201 | 'page_for_posts' => '{{blog}}', |
202 | - 'blogdescription' => esc_html__( 'LSX starter content example', 'lsx' ), |
|
202 | + 'blogdescription' => esc_html__('LSX starter content example', 'lsx'), |
|
203 | 203 | ), |
204 | 204 | |
205 | 205 | 'nav_menus' => array( |
206 | 206 | 'primary' => array( |
207 | - 'name' => esc_html__( 'Primary Menu', 'lsx' ), |
|
207 | + 'name' => esc_html__('Primary Menu', 'lsx'), |
|
208 | 208 | |
209 | 209 | 'items' => array( |
210 | 210 | 'page_home', |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | ), |
216 | 216 | |
217 | 217 | 'top-menu' => array( |
218 | - 'name' => esc_html__( 'Top Menu', 'lsx' ), |
|
218 | + 'name' => esc_html__('Top Menu', 'lsx'), |
|
219 | 219 | |
220 | 220 | 'items' => array( |
221 | 221 | 'custom_link_1' => array( |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | ), |
244 | 244 | |
245 | 245 | 'social' => array( |
246 | - 'name' => esc_html__( 'Social Menu', 'lsx' ), |
|
246 | + 'name' => esc_html__('Social Menu', 'lsx'), |
|
247 | 247 | |
248 | 248 | 'items' => array( |
249 | 249 | 'link_facebook', |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | ), |
259 | 259 | |
260 | 260 | 'footer' => array( |
261 | - 'name' => esc_html__( 'Footer Menu', 'lsx' ), |
|
261 | + 'name' => esc_html__('Footer Menu', 'lsx'), |
|
262 | 262 | |
263 | 263 | 'items' => array( |
264 | 264 | 'page_about', |
@@ -272,14 +272,14 @@ discard block |
||
272 | 272 | 'lsx_header_search' => false, |
273 | 273 | 'lsx_layout' => '1c', |
274 | 274 | ), |
275 | - ) ); |
|
275 | + )); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | endif; |
279 | 279 | |
280 | -add_action( 'after_setup_theme', 'lsx_setup' ); |
|
280 | +add_action('after_setup_theme', 'lsx_setup'); |
|
281 | 281 | |
282 | -if ( ! function_exists( 'lsx_init' ) ) : |
|
282 | +if ( ! function_exists('lsx_init')) : |
|
283 | 283 | |
284 | 284 | /** |
285 | 285 | * Theme init action. |
@@ -288,20 +288,20 @@ discard block |
||
288 | 288 | * @subpackage config |
289 | 289 | */ |
290 | 290 | function lsx_init() { |
291 | - add_post_type_support( 'page', 'excerpt' ); |
|
291 | + add_post_type_support('page', 'excerpt'); |
|
292 | 292 | |
293 | - if ( class_exists( 'WooCommerce' ) ) { |
|
294 | - remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 ); |
|
293 | + if (class_exists('WooCommerce')) { |
|
294 | + remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20); |
|
295 | 295 | } |
296 | 296 | |
297 | - remove_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce', 10 ); |
|
297 | + remove_action('comment_form', 'wp_comment_form_unfiltered_html_nonce', 10); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | endif; |
301 | 301 | |
302 | -add_action( 'init', 'lsx_init', 100 ); |
|
302 | +add_action('init', 'lsx_init', 100); |
|
303 | 303 | |
304 | -if ( ! function_exists( 'lsx_process_content_width' ) ) : |
|
304 | +if ( ! function_exists('lsx_process_content_width')) : |
|
305 | 305 | |
306 | 306 | /** |
307 | 307 | * Overwrite the $content_width var, based on the layout of the page. |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | global $content_width; |
314 | 314 | |
315 | 315 | if ( |
316 | - is_page_template( 'page-templates/template-front-page.php' ) || |
|
317 | - is_page_template( 'page-templates/template-full-width.php' ) |
|
316 | + is_page_template('page-templates/template-front-page.php') || |
|
317 | + is_page_template('page-templates/template-full-width.php') |
|
318 | 318 | ) { |
319 | 319 | $content_width = 1140; |
320 | 320 | } |
@@ -322,9 +322,9 @@ discard block |
||
322 | 322 | |
323 | 323 | endif; |
324 | 324 | |
325 | -add_action( 'wp_head', 'lsx_process_content_width' ); |
|
325 | +add_action('wp_head', 'lsx_process_content_width'); |
|
326 | 326 | |
327 | -if ( ! function_exists( 'lsx_file_get_contents' ) ) : |
|
327 | +if ( ! function_exists('lsx_file_get_contents')) : |
|
328 | 328 | |
329 | 329 | /** |
330 | 330 | * Get file contents. |
@@ -332,19 +332,19 @@ discard block |
||
332 | 332 | * @package lsx |
333 | 333 | * @subpackage config |
334 | 334 | */ |
335 | - function lsx_file_get_contents( $file ) { |
|
336 | - if ( file_exists( $file ) ) { |
|
335 | + function lsx_file_get_contents($file) { |
|
336 | + if (file_exists($file)) { |
|
337 | 337 | global $wp_filesystem; |
338 | 338 | |
339 | - if ( empty( $wp_filesystem ) ) { |
|
339 | + if (empty($wp_filesystem)) { |
|
340 | 340 | require_once ABSPATH . 'wp-admin/includes/file.php'; |
341 | 341 | WP_Filesystem(); |
342 | 342 | } |
343 | 343 | |
344 | - if ( $wp_filesystem ) { |
|
345 | - $contents = $wp_filesystem->get_contents( $file ); |
|
344 | + if ($wp_filesystem) { |
|
345 | + $contents = $wp_filesystem->get_contents($file); |
|
346 | 346 | |
347 | - if ( ! empty( $contents ) ) { |
|
347 | + if ( ! empty($contents)) { |
|
348 | 348 | return $contents; |
349 | 349 | } |
350 | 350 | } |
@@ -7,273 +7,273 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
10 | - exit; |
|
10 | + exit; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | if ( ! function_exists( 'lsx_setup' ) ) : |
14 | 14 | |
15 | - /** |
|
16 | - * Theme after_setup_theme action. |
|
17 | - * |
|
18 | - * @package lsx |
|
19 | - * @subpackage config |
|
20 | - */ |
|
21 | - function lsx_setup() { |
|
22 | - global $content_width; |
|
23 | - $content_width = 1140; |
|
24 | - |
|
25 | - load_theme_textdomain( 'lsx', get_template_directory() . '/languages' ); |
|
26 | - |
|
27 | - add_image_size( 'lsx-thumbnail-carousel', 350, 230, true ); |
|
28 | - add_image_size( 'lsx-thumbnail-wide', 360, 168, true ); |
|
29 | - add_image_size( 'lsx-thumbnail-square', 350, 350, true ); |
|
30 | - add_image_size( 'lsx-thumbnail-single', 750, 350, true ); |
|
31 | - add_image_size( 'lsx-banner', 1920, 600, true ); |
|
32 | - |
|
33 | - register_nav_menus( |
|
34 | - array( |
|
35 | - 'primary' => esc_html__( 'Primary Menu', 'lsx' ), |
|
36 | - 'top-menu' => esc_html__( 'Top Menu (right)', 'lsx' ), |
|
37 | - 'top-menu-left' => esc_html__( 'Top Menu (left)', 'lsx' ), |
|
38 | - 'social' => esc_html__( 'Social Menu', 'lsx' ), |
|
39 | - 'footer' => esc_html__( 'Footer Menu', 'lsx' ), |
|
40 | - ) |
|
41 | - ); |
|
42 | - |
|
43 | - add_theme_support( 'automatic-feed-links' ); |
|
44 | - add_theme_support( 'custom-background' ); |
|
45 | - |
|
46 | - add_theme_support( |
|
47 | - 'custom-logo', |
|
48 | - array( |
|
49 | - 'height' => 50, |
|
50 | - 'width' => 160, |
|
51 | - 'flex-width' => true, |
|
52 | - 'flex-height' => true, |
|
53 | - ) |
|
54 | - ); |
|
55 | - |
|
56 | - add_theme_support( 'html5', array( 'caption' ) ); |
|
57 | - |
|
58 | - add_theme_support( |
|
59 | - 'post-formats', |
|
60 | - array( |
|
61 | - 'image', |
|
62 | - 'video', |
|
63 | - 'gallery', |
|
64 | - 'audio', |
|
65 | - 'quote', |
|
66 | - ) |
|
67 | - ); |
|
68 | - |
|
69 | - add_theme_support( 'post-thumbnails' ); |
|
70 | - add_theme_support( 'sensei' ); |
|
71 | - |
|
72 | - add_theme_support( |
|
73 | - 'site-logo', |
|
74 | - array( |
|
75 | - 'header-text' => array( |
|
76 | - 'site-title', |
|
77 | - 'site-description', |
|
78 | - ), |
|
79 | - 'size' => 'medium', |
|
80 | - ) |
|
81 | - ); |
|
82 | - |
|
83 | - add_theme_support( 'title-tag' ); |
|
84 | - |
|
85 | - /* |
|
15 | + /** |
|
16 | + * Theme after_setup_theme action. |
|
17 | + * |
|
18 | + * @package lsx |
|
19 | + * @subpackage config |
|
20 | + */ |
|
21 | + function lsx_setup() { |
|
22 | + global $content_width; |
|
23 | + $content_width = 1140; |
|
24 | + |
|
25 | + load_theme_textdomain( 'lsx', get_template_directory() . '/languages' ); |
|
26 | + |
|
27 | + add_image_size( 'lsx-thumbnail-carousel', 350, 230, true ); |
|
28 | + add_image_size( 'lsx-thumbnail-wide', 360, 168, true ); |
|
29 | + add_image_size( 'lsx-thumbnail-square', 350, 350, true ); |
|
30 | + add_image_size( 'lsx-thumbnail-single', 750, 350, true ); |
|
31 | + add_image_size( 'lsx-banner', 1920, 600, true ); |
|
32 | + |
|
33 | + register_nav_menus( |
|
34 | + array( |
|
35 | + 'primary' => esc_html__( 'Primary Menu', 'lsx' ), |
|
36 | + 'top-menu' => esc_html__( 'Top Menu (right)', 'lsx' ), |
|
37 | + 'top-menu-left' => esc_html__( 'Top Menu (left)', 'lsx' ), |
|
38 | + 'social' => esc_html__( 'Social Menu', 'lsx' ), |
|
39 | + 'footer' => esc_html__( 'Footer Menu', 'lsx' ), |
|
40 | + ) |
|
41 | + ); |
|
42 | + |
|
43 | + add_theme_support( 'automatic-feed-links' ); |
|
44 | + add_theme_support( 'custom-background' ); |
|
45 | + |
|
46 | + add_theme_support( |
|
47 | + 'custom-logo', |
|
48 | + array( |
|
49 | + 'height' => 50, |
|
50 | + 'width' => 160, |
|
51 | + 'flex-width' => true, |
|
52 | + 'flex-height' => true, |
|
53 | + ) |
|
54 | + ); |
|
55 | + |
|
56 | + add_theme_support( 'html5', array( 'caption' ) ); |
|
57 | + |
|
58 | + add_theme_support( |
|
59 | + 'post-formats', |
|
60 | + array( |
|
61 | + 'image', |
|
62 | + 'video', |
|
63 | + 'gallery', |
|
64 | + 'audio', |
|
65 | + 'quote', |
|
66 | + ) |
|
67 | + ); |
|
68 | + |
|
69 | + add_theme_support( 'post-thumbnails' ); |
|
70 | + add_theme_support( 'sensei' ); |
|
71 | + |
|
72 | + add_theme_support( |
|
73 | + 'site-logo', |
|
74 | + array( |
|
75 | + 'header-text' => array( |
|
76 | + 'site-title', |
|
77 | + 'site-description', |
|
78 | + ), |
|
79 | + 'size' => 'medium', |
|
80 | + ) |
|
81 | + ); |
|
82 | + |
|
83 | + add_theme_support( 'title-tag' ); |
|
84 | + |
|
85 | + /* |
|
86 | 86 | * @TODO - Necessary to test it |
87 | 87 | */ |
88 | 88 | |
89 | - // add_theme_support( 'woocommerce' );. |
|
90 | - add_theme_support( 'starter-content', array( |
|
91 | - 'widgets' => array( |
|
92 | - 'sidebar-home' => array( |
|
93 | - 'custom_widget_1' => array( |
|
94 | - 'text', |
|
95 | - |
|
96 | - array( |
|
97 | - 'title' => '', |
|
98 | - 'text' => wp_kses_post( '<div class="row"><div class="col-sm-12 text-center"><h3>Build your perfect website <small>with the LSX theme</small></h3></div></div><div class="row"><div class="col-sm-4 text-center"><h4>Fast</h4><p>"Quick" isn\'t a word most people use when describing their website building experience.</p></div><div class="col-sm-4 text-center"><h4>Easy</h4><p>We\'ve built websites for countless clients, and we know what kind of back-end makes sense easily.</p></div><div class="col-sm-4 text-center"><h4>Comprehensive</h4><p>The LSX extensions come with features out the box that are essential.</p></div></div>' ), |
|
99 | - ), |
|
100 | - ), |
|
101 | - |
|
102 | - 'custom_widget_2' => array( |
|
103 | - 'text', |
|
104 | - |
|
105 | - array( |
|
106 | - 'title' => '', |
|
107 | - 'text' => wp_kses_post( '<div class="lsx-full-width-alt"><div class="row"><div class="col-xs-12"><h3>A big CTA title</h3><p class="text-center"><a class="btn cta-btn" href="http://www.lsdeb.biz/" target="_blank" rel="noreferrer noopener">Hire Us</a><p></div></div></div>' ), |
|
108 | - ), |
|
109 | - ), |
|
110 | - |
|
111 | - 'custom_widget_3' => array( |
|
112 | - 'text', |
|
113 | - |
|
114 | - array( |
|
115 | - 'title' => '', |
|
116 | - 'text' => wp_kses_post( '<div class="row"><div class="col-xs-12"><h3>Homepage Widget</h3><p>Lorem ipsum dolor sit amet, <a href="#">consectetuer adipiscing elit</a>. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.</p></div></div>' ), |
|
117 | - ), |
|
118 | - ), |
|
119 | - ), |
|
120 | - |
|
121 | - 'sidebar-footer' => array( |
|
122 | - 'custom_widget_1' => array( |
|
123 | - 'text', |
|
124 | - |
|
125 | - array( |
|
126 | - 'title' => esc_html__( 'Space for Footer Widgets', 'lsx' ), |
|
127 | - 'text' => esc_html__( 'This is here to showcase some footer widgets. You can decide what to add and what to hide. Nam nostrum evertitur ad, ut pri nibh veniam, urbanitas definitionem eum ex.', 'lsx' ), |
|
128 | - ), |
|
129 | - ), |
|
130 | - |
|
131 | - 'custom_widget_2' => array( |
|
132 | - 'text', |
|
133 | - |
|
134 | - array( |
|
135 | - 'title' => esc_html__( 'Space for Footer Widgets', 'lsx' ), |
|
136 | - 'text' => esc_html__( 'This is here to showcase some footer widgets. You can decide what to add and what to hide. Nam nostrum evertitur ad, ut pri nibh veniam, urbanitas definitionem eum ex.', 'lsx' ), |
|
137 | - ), |
|
138 | - ), |
|
139 | - |
|
140 | - 'custom_widget_3' => array( |
|
141 | - 'text', |
|
142 | - |
|
143 | - array( |
|
144 | - 'title' => esc_html__( 'Contact us:', 'lsx' ), |
|
145 | - 'text' => wp_kses_post( '<a href="mailto:[email protected]><i class="fa fa-envelope fa-fw"></i> [email protected]</a><br><a href="tel:+27214489843"><i class="fa fa-phone fa-fw"></i> +27 21 448 9843</a><br><i class="fa fa-skype fa-fw"></i> /lightspeeddevelopment' ), |
|
146 | - ), |
|
147 | - ), |
|
148 | - ), |
|
149 | - |
|
150 | - 'sidebar-footer-cta' => array( |
|
151 | - 'custom_widget_1' => array( |
|
152 | - 'text', |
|
153 | - |
|
154 | - array( |
|
155 | - 'title' => esc_html__( 'A Footer Call to Action', 'lsx' ), |
|
156 | - 'text' => esc_html__( 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.', 'lsx' ), |
|
157 | - ), |
|
158 | - ), |
|
159 | - ), |
|
160 | - ), |
|
161 | - |
|
162 | - 'posts' => array( |
|
163 | - 'home' => array( |
|
164 | - 'template' => 'page-templates/template-front-page.php', |
|
165 | - 'thumbnail' => '{{image-banner-example-01}}', |
|
166 | - 'post_title' => esc_html__( 'LSX is a free WordPress theme', 'lsx' ), |
|
167 | - 'post_content' => '', |
|
168 | - ), |
|
169 | - |
|
170 | - 'about' => array( |
|
171 | - 'thumbnail' => '{{image-banner-example-02}}', |
|
172 | - ), |
|
173 | - |
|
174 | - 'blog', |
|
175 | - |
|
176 | - 'contact' => array( |
|
177 | - 'thumbnail' => '{{image-banner-example-03}}', |
|
178 | - ), |
|
179 | - ), |
|
180 | - |
|
181 | - 'attachments' => array( |
|
182 | - 'image-banner-example-01' => array( |
|
183 | - 'post_title' => esc_html_x( 'Banner Example 01', 'Theme starter content', 'lsx' ), |
|
184 | - 'file' => 'assets/images/admin/banner-example-01.jpg', |
|
185 | - ), |
|
186 | - |
|
187 | - 'image-banner-example-02' => array( |
|
188 | - 'post_title' => esc_html_x( 'Banner Example 02', 'Theme starter content', 'lsx' ), |
|
189 | - 'file' => 'assets/images/admin/banner-example-02.jpg', |
|
190 | - ), |
|
191 | - |
|
192 | - 'image-banner-example-03' => array( |
|
193 | - 'post_title' => esc_html_x( 'Banner Example 03', 'Theme starter content', 'lsx' ), |
|
194 | - 'file' => 'assets/images/admin/banner-example-03.jpg', |
|
195 | - ), |
|
196 | - ), |
|
197 | - |
|
198 | - 'options' => array( |
|
199 | - 'show_on_front' => 'page', |
|
200 | - 'page_on_front' => '{{home}}', |
|
201 | - 'page_for_posts' => '{{blog}}', |
|
202 | - 'blogdescription' => esc_html__( 'LSX starter content example', 'lsx' ), |
|
203 | - ), |
|
204 | - |
|
205 | - 'nav_menus' => array( |
|
206 | - 'primary' => array( |
|
207 | - 'name' => esc_html__( 'Primary Menu', 'lsx' ), |
|
208 | - |
|
209 | - 'items' => array( |
|
210 | - 'page_home', |
|
211 | - 'page_about', |
|
212 | - 'page_blog', |
|
213 | - 'page_contact', |
|
214 | - ), |
|
215 | - ), |
|
216 | - |
|
217 | - 'top-menu' => array( |
|
218 | - 'name' => esc_html__( 'Top Menu', 'lsx' ), |
|
219 | - |
|
220 | - 'items' => array( |
|
221 | - 'custom_link_1' => array( |
|
222 | - 'title' => 'View Map', |
|
223 | - 'url' => 'https://www.google.com/maps/place/LightSpeed+WordPress+Development/@-33.92945,18.45345,17z/data=!3m1!4b1!4m2!3m1!1s0x1dcc5da1b2446d25:0xc8ecdb1cc8afd170', |
|
224 | - 'classes' => 'map', |
|
225 | - ), |
|
226 | - |
|
227 | - 'custom_link_2' => array( |
|
228 | - 'title' => '+27 21 448 9843', |
|
229 | - 'url' => 'tel:+27214489843', |
|
230 | - 'classes' => 'tel', |
|
231 | - ), |
|
232 | - |
|
233 | - 'custom_link_3' => array( |
|
234 | - 'title' => '[email protected]', |
|
235 | - 'url' => 'mailto:[email protected]', |
|
236 | - 'classes' => 'email', |
|
237 | - ), |
|
238 | - |
|
239 | - 'page_contact' => array( |
|
240 | - 'classes' => 'cta', |
|
241 | - ), |
|
242 | - ), |
|
243 | - ), |
|
244 | - |
|
245 | - 'social' => array( |
|
246 | - 'name' => esc_html__( 'Social Menu', 'lsx' ), |
|
247 | - |
|
248 | - 'items' => array( |
|
249 | - 'link_facebook', |
|
250 | - 'link_foursquare', |
|
251 | - 'link_github', |
|
252 | - 'link_instagram', |
|
253 | - 'link_linkedin', |
|
254 | - 'link_pinterest', |
|
255 | - 'link_twitter', |
|
256 | - 'link_youtube', |
|
257 | - ), |
|
258 | - ), |
|
259 | - |
|
260 | - 'footer' => array( |
|
261 | - 'name' => esc_html__( 'Footer Menu', 'lsx' ), |
|
262 | - |
|
263 | - 'items' => array( |
|
264 | - 'page_about', |
|
265 | - 'page_contact', |
|
266 | - ), |
|
267 | - ), |
|
268 | - ), |
|
269 | - |
|
270 | - 'theme_mods' => array( |
|
271 | - 'lsx_header_fixed' => true, |
|
272 | - 'lsx_header_search' => false, |
|
273 | - 'lsx_layout' => '1c', |
|
274 | - ), |
|
275 | - ) ); |
|
276 | - } |
|
89 | + // add_theme_support( 'woocommerce' );. |
|
90 | + add_theme_support( 'starter-content', array( |
|
91 | + 'widgets' => array( |
|
92 | + 'sidebar-home' => array( |
|
93 | + 'custom_widget_1' => array( |
|
94 | + 'text', |
|
95 | + |
|
96 | + array( |
|
97 | + 'title' => '', |
|
98 | + 'text' => wp_kses_post( '<div class="row"><div class="col-sm-12 text-center"><h3>Build your perfect website <small>with the LSX theme</small></h3></div></div><div class="row"><div class="col-sm-4 text-center"><h4>Fast</h4><p>"Quick" isn\'t a word most people use when describing their website building experience.</p></div><div class="col-sm-4 text-center"><h4>Easy</h4><p>We\'ve built websites for countless clients, and we know what kind of back-end makes sense easily.</p></div><div class="col-sm-4 text-center"><h4>Comprehensive</h4><p>The LSX extensions come with features out the box that are essential.</p></div></div>' ), |
|
99 | + ), |
|
100 | + ), |
|
101 | + |
|
102 | + 'custom_widget_2' => array( |
|
103 | + 'text', |
|
104 | + |
|
105 | + array( |
|
106 | + 'title' => '', |
|
107 | + 'text' => wp_kses_post( '<div class="lsx-full-width-alt"><div class="row"><div class="col-xs-12"><h3>A big CTA title</h3><p class="text-center"><a class="btn cta-btn" href="http://www.lsdeb.biz/" target="_blank" rel="noreferrer noopener">Hire Us</a><p></div></div></div>' ), |
|
108 | + ), |
|
109 | + ), |
|
110 | + |
|
111 | + 'custom_widget_3' => array( |
|
112 | + 'text', |
|
113 | + |
|
114 | + array( |
|
115 | + 'title' => '', |
|
116 | + 'text' => wp_kses_post( '<div class="row"><div class="col-xs-12"><h3>Homepage Widget</h3><p>Lorem ipsum dolor sit amet, <a href="#">consectetuer adipiscing elit</a>. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.</p></div></div>' ), |
|
117 | + ), |
|
118 | + ), |
|
119 | + ), |
|
120 | + |
|
121 | + 'sidebar-footer' => array( |
|
122 | + 'custom_widget_1' => array( |
|
123 | + 'text', |
|
124 | + |
|
125 | + array( |
|
126 | + 'title' => esc_html__( 'Space for Footer Widgets', 'lsx' ), |
|
127 | + 'text' => esc_html__( 'This is here to showcase some footer widgets. You can decide what to add and what to hide. Nam nostrum evertitur ad, ut pri nibh veniam, urbanitas definitionem eum ex.', 'lsx' ), |
|
128 | + ), |
|
129 | + ), |
|
130 | + |
|
131 | + 'custom_widget_2' => array( |
|
132 | + 'text', |
|
133 | + |
|
134 | + array( |
|
135 | + 'title' => esc_html__( 'Space for Footer Widgets', 'lsx' ), |
|
136 | + 'text' => esc_html__( 'This is here to showcase some footer widgets. You can decide what to add and what to hide. Nam nostrum evertitur ad, ut pri nibh veniam, urbanitas definitionem eum ex.', 'lsx' ), |
|
137 | + ), |
|
138 | + ), |
|
139 | + |
|
140 | + 'custom_widget_3' => array( |
|
141 | + 'text', |
|
142 | + |
|
143 | + array( |
|
144 | + 'title' => esc_html__( 'Contact us:', 'lsx' ), |
|
145 | + 'text' => wp_kses_post( '<a href="mailto:[email protected]><i class="fa fa-envelope fa-fw"></i> [email protected]</a><br><a href="tel:+27214489843"><i class="fa fa-phone fa-fw"></i> +27 21 448 9843</a><br><i class="fa fa-skype fa-fw"></i> /lightspeeddevelopment' ), |
|
146 | + ), |
|
147 | + ), |
|
148 | + ), |
|
149 | + |
|
150 | + 'sidebar-footer-cta' => array( |
|
151 | + 'custom_widget_1' => array( |
|
152 | + 'text', |
|
153 | + |
|
154 | + array( |
|
155 | + 'title' => esc_html__( 'A Footer Call to Action', 'lsx' ), |
|
156 | + 'text' => esc_html__( 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.', 'lsx' ), |
|
157 | + ), |
|
158 | + ), |
|
159 | + ), |
|
160 | + ), |
|
161 | + |
|
162 | + 'posts' => array( |
|
163 | + 'home' => array( |
|
164 | + 'template' => 'page-templates/template-front-page.php', |
|
165 | + 'thumbnail' => '{{image-banner-example-01}}', |
|
166 | + 'post_title' => esc_html__( 'LSX is a free WordPress theme', 'lsx' ), |
|
167 | + 'post_content' => '', |
|
168 | + ), |
|
169 | + |
|
170 | + 'about' => array( |
|
171 | + 'thumbnail' => '{{image-banner-example-02}}', |
|
172 | + ), |
|
173 | + |
|
174 | + 'blog', |
|
175 | + |
|
176 | + 'contact' => array( |
|
177 | + 'thumbnail' => '{{image-banner-example-03}}', |
|
178 | + ), |
|
179 | + ), |
|
180 | + |
|
181 | + 'attachments' => array( |
|
182 | + 'image-banner-example-01' => array( |
|
183 | + 'post_title' => esc_html_x( 'Banner Example 01', 'Theme starter content', 'lsx' ), |
|
184 | + 'file' => 'assets/images/admin/banner-example-01.jpg', |
|
185 | + ), |
|
186 | + |
|
187 | + 'image-banner-example-02' => array( |
|
188 | + 'post_title' => esc_html_x( 'Banner Example 02', 'Theme starter content', 'lsx' ), |
|
189 | + 'file' => 'assets/images/admin/banner-example-02.jpg', |
|
190 | + ), |
|
191 | + |
|
192 | + 'image-banner-example-03' => array( |
|
193 | + 'post_title' => esc_html_x( 'Banner Example 03', 'Theme starter content', 'lsx' ), |
|
194 | + 'file' => 'assets/images/admin/banner-example-03.jpg', |
|
195 | + ), |
|
196 | + ), |
|
197 | + |
|
198 | + 'options' => array( |
|
199 | + 'show_on_front' => 'page', |
|
200 | + 'page_on_front' => '{{home}}', |
|
201 | + 'page_for_posts' => '{{blog}}', |
|
202 | + 'blogdescription' => esc_html__( 'LSX starter content example', 'lsx' ), |
|
203 | + ), |
|
204 | + |
|
205 | + 'nav_menus' => array( |
|
206 | + 'primary' => array( |
|
207 | + 'name' => esc_html__( 'Primary Menu', 'lsx' ), |
|
208 | + |
|
209 | + 'items' => array( |
|
210 | + 'page_home', |
|
211 | + 'page_about', |
|
212 | + 'page_blog', |
|
213 | + 'page_contact', |
|
214 | + ), |
|
215 | + ), |
|
216 | + |
|
217 | + 'top-menu' => array( |
|
218 | + 'name' => esc_html__( 'Top Menu', 'lsx' ), |
|
219 | + |
|
220 | + 'items' => array( |
|
221 | + 'custom_link_1' => array( |
|
222 | + 'title' => 'View Map', |
|
223 | + 'url' => 'https://www.google.com/maps/place/LightSpeed+WordPress+Development/@-33.92945,18.45345,17z/data=!3m1!4b1!4m2!3m1!1s0x1dcc5da1b2446d25:0xc8ecdb1cc8afd170', |
|
224 | + 'classes' => 'map', |
|
225 | + ), |
|
226 | + |
|
227 | + 'custom_link_2' => array( |
|
228 | + 'title' => '+27 21 448 9843', |
|
229 | + 'url' => 'tel:+27214489843', |
|
230 | + 'classes' => 'tel', |
|
231 | + ), |
|
232 | + |
|
233 | + 'custom_link_3' => array( |
|
234 | + 'title' => '[email protected]', |
|
235 | + 'url' => 'mailto:[email protected]', |
|
236 | + 'classes' => 'email', |
|
237 | + ), |
|
238 | + |
|
239 | + 'page_contact' => array( |
|
240 | + 'classes' => 'cta', |
|
241 | + ), |
|
242 | + ), |
|
243 | + ), |
|
244 | + |
|
245 | + 'social' => array( |
|
246 | + 'name' => esc_html__( 'Social Menu', 'lsx' ), |
|
247 | + |
|
248 | + 'items' => array( |
|
249 | + 'link_facebook', |
|
250 | + 'link_foursquare', |
|
251 | + 'link_github', |
|
252 | + 'link_instagram', |
|
253 | + 'link_linkedin', |
|
254 | + 'link_pinterest', |
|
255 | + 'link_twitter', |
|
256 | + 'link_youtube', |
|
257 | + ), |
|
258 | + ), |
|
259 | + |
|
260 | + 'footer' => array( |
|
261 | + 'name' => esc_html__( 'Footer Menu', 'lsx' ), |
|
262 | + |
|
263 | + 'items' => array( |
|
264 | + 'page_about', |
|
265 | + 'page_contact', |
|
266 | + ), |
|
267 | + ), |
|
268 | + ), |
|
269 | + |
|
270 | + 'theme_mods' => array( |
|
271 | + 'lsx_header_fixed' => true, |
|
272 | + 'lsx_header_search' => false, |
|
273 | + 'lsx_layout' => '1c', |
|
274 | + ), |
|
275 | + ) ); |
|
276 | + } |
|
277 | 277 | |
278 | 278 | endif; |
279 | 279 | |
@@ -281,21 +281,21 @@ discard block |
||
281 | 281 | |
282 | 282 | if ( ! function_exists( 'lsx_init' ) ) : |
283 | 283 | |
284 | - /** |
|
285 | - * Theme init action. |
|
286 | - * |
|
287 | - * @package lsx |
|
288 | - * @subpackage config |
|
289 | - */ |
|
290 | - function lsx_init() { |
|
291 | - add_post_type_support( 'page', 'excerpt' ); |
|
284 | + /** |
|
285 | + * Theme init action. |
|
286 | + * |
|
287 | + * @package lsx |
|
288 | + * @subpackage config |
|
289 | + */ |
|
290 | + function lsx_init() { |
|
291 | + add_post_type_support( 'page', 'excerpt' ); |
|
292 | 292 | |
293 | - if ( class_exists( 'WooCommerce' ) ) { |
|
294 | - remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 ); |
|
295 | - } |
|
293 | + if ( class_exists( 'WooCommerce' ) ) { |
|
294 | + remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 ); |
|
295 | + } |
|
296 | 296 | |
297 | - remove_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce', 10 ); |
|
298 | - } |
|
297 | + remove_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce', 10 ); |
|
298 | + } |
|
299 | 299 | |
300 | 300 | endif; |
301 | 301 | |
@@ -303,22 +303,22 @@ discard block |
||
303 | 303 | |
304 | 304 | if ( ! function_exists( 'lsx_process_content_width' ) ) : |
305 | 305 | |
306 | - /** |
|
307 | - * Overwrite the $content_width var, based on the layout of the page. |
|
308 | - * |
|
309 | - * @package lsx |
|
310 | - * @subpackage config |
|
311 | - */ |
|
312 | - function lsx_process_content_width() { |
|
313 | - global $content_width; |
|
314 | - |
|
315 | - if ( |
|
316 | - is_page_template( 'page-templates/template-front-page.php' ) || |
|
317 | - is_page_template( 'page-templates/template-full-width.php' ) |
|
318 | - ) { |
|
319 | - $content_width = 1140; |
|
320 | - } |
|
321 | - } |
|
306 | + /** |
|
307 | + * Overwrite the $content_width var, based on the layout of the page. |
|
308 | + * |
|
309 | + * @package lsx |
|
310 | + * @subpackage config |
|
311 | + */ |
|
312 | + function lsx_process_content_width() { |
|
313 | + global $content_width; |
|
314 | + |
|
315 | + if ( |
|
316 | + is_page_template( 'page-templates/template-front-page.php' ) || |
|
317 | + is_page_template( 'page-templates/template-full-width.php' ) |
|
318 | + ) { |
|
319 | + $content_width = 1140; |
|
320 | + } |
|
321 | + } |
|
322 | 322 | |
323 | 323 | endif; |
324 | 324 | |
@@ -326,31 +326,31 @@ discard block |
||
326 | 326 | |
327 | 327 | if ( ! function_exists( 'lsx_file_get_contents' ) ) : |
328 | 328 | |
329 | - /** |
|
330 | - * Get file contents. |
|
331 | - * |
|
332 | - * @package lsx |
|
333 | - * @subpackage config |
|
334 | - */ |
|
335 | - function lsx_file_get_contents( $file ) { |
|
336 | - if ( file_exists( $file ) ) { |
|
337 | - global $wp_filesystem; |
|
338 | - |
|
339 | - if ( empty( $wp_filesystem ) ) { |
|
340 | - require_once ABSPATH . 'wp-admin/includes/file.php'; |
|
341 | - WP_Filesystem(); |
|
342 | - } |
|
343 | - |
|
344 | - if ( $wp_filesystem ) { |
|
345 | - $contents = $wp_filesystem->get_contents( $file ); |
|
346 | - |
|
347 | - if ( ! empty( $contents ) ) { |
|
348 | - return $contents; |
|
349 | - } |
|
350 | - } |
|
351 | - } |
|
352 | - |
|
353 | - return ''; |
|
354 | - } |
|
329 | + /** |
|
330 | + * Get file contents. |
|
331 | + * |
|
332 | + * @package lsx |
|
333 | + * @subpackage config |
|
334 | + */ |
|
335 | + function lsx_file_get_contents( $file ) { |
|
336 | + if ( file_exists( $file ) ) { |
|
337 | + global $wp_filesystem; |
|
338 | + |
|
339 | + if ( empty( $wp_filesystem ) ) { |
|
340 | + require_once ABSPATH . 'wp-admin/includes/file.php'; |
|
341 | + WP_Filesystem(); |
|
342 | + } |
|
343 | + |
|
344 | + if ( $wp_filesystem ) { |
|
345 | + $contents = $wp_filesystem->get_contents( $file ); |
|
346 | + |
|
347 | + if ( ! empty( $contents ) ) { |
|
348 | + return $contents; |
|
349 | + } |
|
350 | + } |
|
351 | + } |
|
352 | + |
|
353 | + return ''; |
|
354 | + } |
|
355 | 355 | |
356 | 356 | endif; |
@@ -6,11 +6,11 @@ discard block |
||
6 | 6 | * @subpackage sanitize |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
13 | -if ( ! function_exists( 'lsx_sanitize_choices' ) ) : |
|
13 | +if ( ! function_exists('lsx_sanitize_choices')) : |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Sanitize a value from a list of allowed values. |
@@ -22,18 +22,18 @@ discard block |
||
22 | 22 | * @param mixed $setting The setting for which the sanitizing is occurring. |
23 | 23 | * @return mixed The sanitized value. |
24 | 24 | */ |
25 | - function lsx_sanitize_choices( $value, $setting ) { |
|
26 | - if ( is_object( $setting ) ) { |
|
25 | + function lsx_sanitize_choices($value, $setting) { |
|
26 | + if (is_object($setting)) { |
|
27 | 27 | $setting = $setting->id; |
28 | 28 | } |
29 | 29 | |
30 | - $choices = lsx_customizer_sanitize_get_choices( $setting ); |
|
30 | + $choices = lsx_customizer_sanitize_get_choices($setting); |
|
31 | 31 | |
32 | - if ( ! is_wp_error( $choices ) && ! empty( $choices ) ) { |
|
33 | - $allowed_choices = array_keys( $choices ); |
|
32 | + if ( ! is_wp_error($choices) && ! empty($choices)) { |
|
33 | + $allowed_choices = array_keys($choices); |
|
34 | 34 | |
35 | - if ( ! in_array( $value, $allowed_choices ) ) { |
|
36 | - $value = lsx_customizer_sanitize_get_default( $setting ); |
|
35 | + if ( ! in_array($value, $allowed_choices)) { |
|
36 | + $value = lsx_customizer_sanitize_get_default($setting); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | return $value; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | endif; |
46 | 46 | |
47 | -if ( ! function_exists( 'lsx_customizer_sanitize_get_choices' ) ) : |
|
47 | +if ( ! function_exists('lsx_customizer_sanitize_get_choices')) : |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Helper function to return the choices for a field. |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | * @param string |
56 | 56 | * @return mixed $field |
57 | 57 | */ |
58 | - function lsx_customizer_sanitize_get_choices( $id ) { |
|
58 | + function lsx_customizer_sanitize_get_choices($id) { |
|
59 | 59 | global $lsx_customizer; |
60 | 60 | |
61 | - $can_validate = method_exists( 'WP_Customize_Setting', 'validate' ); |
|
62 | - $field = $lsx_customizer->get_control( $id ); |
|
61 | + $can_validate = method_exists('WP_Customize_Setting', 'validate'); |
|
62 | + $field = $lsx_customizer->get_control($id); |
|
63 | 63 | |
64 | - if ( ! isset( $field['choices'] ) ) { |
|
65 | - return $can_validate ? new WP_Error( 'notexists', esc_html__( 'Choice doesn\'t exist', 'lsx' ) ) : false; |
|
64 | + if ( ! isset($field['choices'])) { |
|
65 | + return $can_validate ? new WP_Error('notexists', esc_html__('Choice doesn\'t exist', 'lsx')) : false; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | return $field['choices']; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | endif; |
72 | 72 | |
73 | -if ( ! function_exists( 'lsx_customizer_sanitize_get_default' ) ) : |
|
73 | +if ( ! function_exists('lsx_customizer_sanitize_get_default')) : |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Helper function to return defaults. |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | * @param string |
82 | 82 | * @return mixed $default |
83 | 83 | */ |
84 | - function lsx_customizer_sanitize_get_default( $id ) { |
|
84 | + function lsx_customizer_sanitize_get_default($id) { |
|
85 | 85 | global $lsx_customizer; |
86 | - $setting = $lsx_customizer->get_setting( $id ); |
|
86 | + $setting = $lsx_customizer->get_setting($id); |
|
87 | 87 | |
88 | - if ( isset( $setting['default'] ) ) { |
|
88 | + if (isset($setting['default'])) { |
|
89 | 89 | return $setting['default']; |
90 | 90 | } |
91 | 91 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | endif; |
96 | 96 | |
97 | -if ( ! function_exists( 'lsx_sanitize_checkbox' ) ) : |
|
97 | +if ( ! function_exists('lsx_sanitize_checkbox')) : |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Sanitizes an single or multiple checkbox input. |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | * @param array $input |
106 | 106 | * @return array $output |
107 | 107 | */ |
108 | - function lsx_sanitize_checkbox( $input ) { |
|
109 | - $can_validate = method_exists( 'WP_Customize_Setting', 'validate' ); |
|
108 | + function lsx_sanitize_checkbox($input) { |
|
109 | + $can_validate = method_exists('WP_Customize_Setting', 'validate'); |
|
110 | 110 | |
111 | - if ( ! is_bool( $input ) ) { |
|
112 | - return $can_validate ? new WP_Error( 'notboolean', esc_html__( 'Not a boolean', 'lsx' ) ) : false; |
|
111 | + if ( ! is_bool($input)) { |
|
112 | + return $can_validate ? new WP_Error('notboolean', esc_html__('Not a boolean', 'lsx')) : false; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return $input; |
@@ -7,112 +7,112 @@ |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
10 | - exit; |
|
10 | + exit; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | if ( ! function_exists( 'lsx_sanitize_choices' ) ) : |
14 | 14 | |
15 | - /** |
|
16 | - * Sanitize a value from a list of allowed values. |
|
17 | - * |
|
18 | - * @package lsx |
|
19 | - * @subpackage sanitize |
|
20 | - * |
|
21 | - * @param mixed $value The value to sanitize. |
|
22 | - * @param mixed $setting The setting for which the sanitizing is occurring. |
|
23 | - * @return mixed The sanitized value. |
|
24 | - */ |
|
25 | - function lsx_sanitize_choices( $value, $setting ) { |
|
26 | - if ( is_object( $setting ) ) { |
|
27 | - $setting = $setting->id; |
|
28 | - } |
|
29 | - |
|
30 | - $choices = lsx_customizer_sanitize_get_choices( $setting ); |
|
31 | - |
|
32 | - if ( ! is_wp_error( $choices ) && ! empty( $choices ) ) { |
|
33 | - $allowed_choices = array_keys( $choices ); |
|
34 | - |
|
35 | - if ( ! in_array( $value, $allowed_choices ) ) { |
|
36 | - $value = lsx_customizer_sanitize_get_default( $setting ); |
|
37 | - } |
|
38 | - |
|
39 | - return $value; |
|
40 | - } else { |
|
41 | - return $choices; |
|
42 | - } |
|
43 | - } |
|
15 | + /** |
|
16 | + * Sanitize a value from a list of allowed values. |
|
17 | + * |
|
18 | + * @package lsx |
|
19 | + * @subpackage sanitize |
|
20 | + * |
|
21 | + * @param mixed $value The value to sanitize. |
|
22 | + * @param mixed $setting The setting for which the sanitizing is occurring. |
|
23 | + * @return mixed The sanitized value. |
|
24 | + */ |
|
25 | + function lsx_sanitize_choices( $value, $setting ) { |
|
26 | + if ( is_object( $setting ) ) { |
|
27 | + $setting = $setting->id; |
|
28 | + } |
|
29 | + |
|
30 | + $choices = lsx_customizer_sanitize_get_choices( $setting ); |
|
31 | + |
|
32 | + if ( ! is_wp_error( $choices ) && ! empty( $choices ) ) { |
|
33 | + $allowed_choices = array_keys( $choices ); |
|
34 | + |
|
35 | + if ( ! in_array( $value, $allowed_choices ) ) { |
|
36 | + $value = lsx_customizer_sanitize_get_default( $setting ); |
|
37 | + } |
|
38 | + |
|
39 | + return $value; |
|
40 | + } else { |
|
41 | + return $choices; |
|
42 | + } |
|
43 | + } |
|
44 | 44 | |
45 | 45 | endif; |
46 | 46 | |
47 | 47 | if ( ! function_exists( 'lsx_customizer_sanitize_get_choices' ) ) : |
48 | 48 | |
49 | - /** |
|
50 | - * Helper function to return the choices for a field. |
|
51 | - * |
|
52 | - * @package lsx |
|
53 | - * @subpackage sanitize |
|
54 | - * |
|
55 | - * @param string |
|
56 | - * @return mixed $field |
|
57 | - */ |
|
58 | - function lsx_customizer_sanitize_get_choices( $id ) { |
|
59 | - global $lsx_customizer; |
|
49 | + /** |
|
50 | + * Helper function to return the choices for a field. |
|
51 | + * |
|
52 | + * @package lsx |
|
53 | + * @subpackage sanitize |
|
54 | + * |
|
55 | + * @param string |
|
56 | + * @return mixed $field |
|
57 | + */ |
|
58 | + function lsx_customizer_sanitize_get_choices( $id ) { |
|
59 | + global $lsx_customizer; |
|
60 | 60 | |
61 | - $can_validate = method_exists( 'WP_Customize_Setting', 'validate' ); |
|
62 | - $field = $lsx_customizer->get_control( $id ); |
|
61 | + $can_validate = method_exists( 'WP_Customize_Setting', 'validate' ); |
|
62 | + $field = $lsx_customizer->get_control( $id ); |
|
63 | 63 | |
64 | - if ( ! isset( $field['choices'] ) ) { |
|
65 | - return $can_validate ? new WP_Error( 'notexists', esc_html__( 'Choice doesn\'t exist', 'lsx' ) ) : false; |
|
66 | - } |
|
64 | + if ( ! isset( $field['choices'] ) ) { |
|
65 | + return $can_validate ? new WP_Error( 'notexists', esc_html__( 'Choice doesn\'t exist', 'lsx' ) ) : false; |
|
66 | + } |
|
67 | 67 | |
68 | - return $field['choices']; |
|
69 | - } |
|
68 | + return $field['choices']; |
|
69 | + } |
|
70 | 70 | |
71 | 71 | endif; |
72 | 72 | |
73 | 73 | if ( ! function_exists( 'lsx_customizer_sanitize_get_default' ) ) : |
74 | 74 | |
75 | - /** |
|
76 | - * Helper function to return defaults. |
|
77 | - * |
|
78 | - * @package lsx |
|
79 | - * @subpackage sanitize |
|
80 | - * |
|
81 | - * @param string |
|
82 | - * @return mixed $default |
|
83 | - */ |
|
84 | - function lsx_customizer_sanitize_get_default( $id ) { |
|
85 | - global $lsx_customizer; |
|
86 | - $setting = $lsx_customizer->get_setting( $id ); |
|
87 | - |
|
88 | - if ( isset( $setting['default'] ) ) { |
|
89 | - return $setting['default']; |
|
90 | - } |
|
91 | - |
|
92 | - return false; |
|
93 | - } |
|
75 | + /** |
|
76 | + * Helper function to return defaults. |
|
77 | + * |
|
78 | + * @package lsx |
|
79 | + * @subpackage sanitize |
|
80 | + * |
|
81 | + * @param string |
|
82 | + * @return mixed $default |
|
83 | + */ |
|
84 | + function lsx_customizer_sanitize_get_default( $id ) { |
|
85 | + global $lsx_customizer; |
|
86 | + $setting = $lsx_customizer->get_setting( $id ); |
|
87 | + |
|
88 | + if ( isset( $setting['default'] ) ) { |
|
89 | + return $setting['default']; |
|
90 | + } |
|
91 | + |
|
92 | + return false; |
|
93 | + } |
|
94 | 94 | |
95 | 95 | endif; |
96 | 96 | |
97 | 97 | if ( ! function_exists( 'lsx_sanitize_checkbox' ) ) : |
98 | 98 | |
99 | - /** |
|
100 | - * Sanitizes an single or multiple checkbox input. |
|
101 | - * |
|
102 | - * @package lsx |
|
103 | - * @subpackage sanitize |
|
104 | - * |
|
105 | - * @param array $input |
|
106 | - * @return array $output |
|
107 | - */ |
|
108 | - function lsx_sanitize_checkbox( $input ) { |
|
109 | - $can_validate = method_exists( 'WP_Customize_Setting', 'validate' ); |
|
110 | - |
|
111 | - if ( ! is_bool( $input ) ) { |
|
112 | - return $can_validate ? new WP_Error( 'notboolean', esc_html__( 'Not a boolean', 'lsx' ) ) : false; |
|
113 | - } |
|
114 | - |
|
115 | - return $input; |
|
116 | - } |
|
99 | + /** |
|
100 | + * Sanitizes an single or multiple checkbox input. |
|
101 | + * |
|
102 | + * @package lsx |
|
103 | + * @subpackage sanitize |
|
104 | + * |
|
105 | + * @param array $input |
|
106 | + * @return array $output |
|
107 | + */ |
|
108 | + function lsx_sanitize_checkbox( $input ) { |
|
109 | + $can_validate = method_exists( 'WP_Customize_Setting', 'validate' ); |
|
110 | + |
|
111 | + if ( ! is_bool( $input ) ) { |
|
112 | + return $can_validate ? new WP_Error( 'notboolean', esc_html__( 'Not a boolean', 'lsx' ) ) : false; |
|
113 | + } |
|
114 | + |
|
115 | + return $input; |
|
116 | + } |
|
117 | 117 | |
118 | 118 | endif; |
@@ -7,15 +7,15 @@ discard block |
||
7 | 7 | * @category 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_Layout_Control' ) ) : |
|
18 | +if ( ! class_exists('LSX_Customize_Layout_Control')) : |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * LSX_Customize_Layout_Control Class. |
@@ -30,9 +30,9 @@ 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 ); |
|
35 | - if ( ! empty( $args['choices'] ) ) { |
|
33 | + public function __construct($manager, $id, $args = array()) { |
|
34 | + parent::__construct($manager, $id, $args); |
|
35 | + if ( ! empty($args['choices'])) { |
|
36 | 36 | $this->layouts = $args['choices']; |
37 | 37 | } |
38 | 38 | } |
@@ -41,39 +41,39 @@ discard block |
||
41 | 41 | * Enqueue scripts/styles for the color picker. |
42 | 42 | */ |
43 | 43 | public function enqueue() { |
44 | - wp_enqueue_script( 'lsx-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
44 | + wp_enqueue_script('lsx-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-layout.js', array('jquery'), LSX_VERSION, true); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Render output. |
49 | 49 | */ |
50 | 50 | public function render_content() { |
51 | - $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
51 | + $post_id = 'customize-control-' . str_replace('[', '-', str_replace(']', '', $this->id)); |
|
52 | 52 | $class = 'customize-control customize-control-' . $this->type; |
53 | 53 | $value = $this->value(); |
54 | 54 | ?> |
55 | 55 | <label> |
56 | 56 | <?php |
57 | - if ( ! empty( $this->label ) ) { |
|
57 | + if ( ! empty($this->label)) { |
|
58 | 58 | ?> |
59 | - <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
59 | + <span class="customize-control-title"><?php echo esc_html($this->label); ?></span> |
|
60 | 60 | <?php |
61 | 61 | } |
62 | - if ( ! empty( $this->description ) ) { |
|
62 | + if ( ! empty($this->description)) { |
|
63 | 63 | ?> |
64 | - <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
|
64 | + <span class="description customize-control-description"><?php echo esc_html($this->description); ?></span> |
|
65 | 65 | <?php } ?> |
66 | 66 | <div class="layouts-selector"> |
67 | 67 | <?php |
68 | - foreach ( $this->layouts as $layout ) { |
|
68 | + foreach ($this->layouts as $layout) { |
|
69 | 69 | $sel = 'border: 1px solid transparent;'; |
70 | - if ( $value === $layout ) { |
|
70 | + if ($value === $layout) { |
|
71 | 71 | $sel = 'border: 1px solid rgb(43, 166, 203);'; |
72 | 72 | } |
73 | - echo '<img class="layout-button" style="padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
73 | + echo '<img class="layout-button" style="padding:2px;' . esc_attr($sel) . '" src="' . esc_attr(get_template_directory_uri()) . '/assets/images/admin/' . esc_attr($layout) . '.png" data-option="' . esc_attr($layout) . '">'; |
|
74 | 74 | } |
75 | 75 | ?> |
76 | - <input <?php $this->link(); ?> class="selected-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(); ?>> |
|
76 | + <input <?php $this->link(); ?> class="selected-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 | 77 | </div> |
78 | 78 | </label> |
79 | 79 | <?php |
@@ -8,77 +8,77 @@ |
||
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_Layout_Control' ) ) : |
19 | 19 | |
20 | - /** |
|
21 | - * LSX_Customize_Layout_Control Class. |
|
22 | - * |
|
23 | - * @package lsx |
|
24 | - * @subpackage customizer |
|
25 | - * @category layout |
|
26 | - */ |
|
27 | - class LSX_Customize_Layout_Control extends WP_Customize_Control { |
|
20 | + /** |
|
21 | + * LSX_Customize_Layout_Control Class. |
|
22 | + * |
|
23 | + * @package lsx |
|
24 | + * @subpackage customizer |
|
25 | + * @category layout |
|
26 | + */ |
|
27 | + class LSX_Customize_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 ); |
|
35 | - if ( ! empty( $args['choices'] ) ) { |
|
36 | - $this->layouts = $args['choices']; |
|
37 | - } |
|
38 | - } |
|
33 | + public function __construct( $manager, $id, $args = array() ) { |
|
34 | + parent::__construct( $manager, $id, $args ); |
|
35 | + if ( ! empty( $args['choices'] ) ) { |
|
36 | + $this->layouts = $args['choices']; |
|
37 | + } |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Enqueue scripts/styles for the color picker. |
|
42 | - */ |
|
43 | - public function enqueue() { |
|
44 | - wp_enqueue_script( 'lsx-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
45 | - } |
|
40 | + /** |
|
41 | + * Enqueue scripts/styles for the color picker. |
|
42 | + */ |
|
43 | + public function enqueue() { |
|
44 | + wp_enqueue_script( 'lsx-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Render output. |
|
49 | - */ |
|
50 | - public function render_content() { |
|
51 | - $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
52 | - $class = 'customize-control customize-control-' . $this->type; |
|
53 | - $value = $this->value(); |
|
54 | - ?> |
|
47 | + /** |
|
48 | + * Render output. |
|
49 | + */ |
|
50 | + public function render_content() { |
|
51 | + $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
52 | + $class = 'customize-control customize-control-' . $this->type; |
|
53 | + $value = $this->value(); |
|
54 | + ?> |
|
55 | 55 | <label> |
56 | 56 | <?php |
57 | - if ( ! empty( $this->label ) ) { |
|
58 | - ?> |
|
57 | + if ( ! empty( $this->label ) ) { |
|
58 | + ?> |
|
59 | 59 | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
60 | 60 | <?php |
61 | - } |
|
62 | - if ( ! empty( $this->description ) ) { |
|
63 | - ?> |
|
61 | + } |
|
62 | + if ( ! empty( $this->description ) ) { |
|
63 | + ?> |
|
64 | 64 | <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
65 | 65 | <?php } ?> |
66 | 66 | <div class="layouts-selector"> |
67 | 67 | <?php |
68 | - foreach ( $this->layouts as $layout ) { |
|
69 | - $sel = 'border: 1px solid transparent;'; |
|
70 | - if ( $value === $layout ) { |
|
71 | - $sel = 'border: 1px solid rgb(43, 166, 203);'; |
|
72 | - } |
|
73 | - echo '<img class="layout-button" style="padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
74 | - } |
|
75 | - ?> |
|
68 | + foreach ( $this->layouts as $layout ) { |
|
69 | + $sel = 'border: 1px solid transparent;'; |
|
70 | + if ( $value === $layout ) { |
|
71 | + $sel = 'border: 1px solid rgb(43, 166, 203);'; |
|
72 | + } |
|
73 | + echo '<img class="layout-button" style="padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
74 | + } |
|
75 | + ?> |
|
76 | 76 | <input <?php $this->link(); ?> class="selected-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 | 77 | </div> |
78 | 78 | </label> |
79 | 79 | <?php |
80 | - } |
|
80 | + } |
|
81 | 81 | |
82 | - } |
|
82 | + } |
|
83 | 83 | |
84 | 84 | endif; |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return bool True if it has schema, false if not. |
20 | 20 | */ |
21 | - public static function is_type( $post_type = null, $comparison_type = null ) { |
|
22 | - if ( is_null( $comparison_type ) ) { |
|
21 | + public static function is_type($post_type = null, $comparison_type = null) { |
|
22 | + if (is_null($comparison_type)) { |
|
23 | 23 | return false; |
24 | 24 | } |
25 | - if ( is_null( $post_type ) ) { |
|
25 | + if (is_null($post_type)) { |
|
26 | 26 | $post_type = get_post_type(); |
27 | 27 | } |
28 | 28 | /** |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @api string[] $post_types The post types for which we output Review. |
32 | 32 | */ |
33 | - $post_types = apply_filters( 'wpseo_schema_' . $comparison_type . '_post_types', array( $comparison_type ) ); |
|
34 | - return in_array( $post_type, $post_types ); |
|
33 | + $post_types = apply_filters('wpseo_schema_' . $comparison_type . '_post_types', array($comparison_type)); |
|
34 | + return in_array($post_type, $post_types); |
|
35 | 35 | } |
36 | 36 | /** |
37 | 37 | * Retrieve a users Schema ID. |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return string The user's schema ID. |
44 | 44 | */ |
45 | - public static function get_places_schema_id( $place_id, $type, $context ) { |
|
46 | - $url = $context->site_url . '#/schema/' . strtolower( $type ) . '/' . wp_hash( $place_id . get_the_title( $place_id ) ); |
|
47 | - return trailingslashit( $url ); |
|
45 | + public static function get_places_schema_id($place_id, $type, $context) { |
|
46 | + $url = $context->site_url . '#/schema/' . strtolower($type) . '/' . wp_hash($place_id . get_the_title($place_id)); |
|
47 | + return trailingslashit($url); |
|
48 | 48 | } |
49 | 49 | /** |
50 | 50 | * Retrieve a users Schema ID. |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return string The user's schema ID. |
56 | 56 | */ |
57 | - public static function get_subtrip_schema_id( $name, $context ) { |
|
58 | - $url = $context->site_url . '#/subtrip/' . wp_hash( $name . $context->id ); |
|
59 | - return trailingslashit( $url ); |
|
57 | + public static function get_subtrip_schema_id($name, $context) { |
|
58 | + $url = $context->site_url . '#/subtrip/' . wp_hash($name . $context->id); |
|
59 | + return trailingslashit($url); |
|
60 | 60 | } |
61 | 61 | /** |
62 | 62 | * Retrieve an offer Schema ID. |
@@ -67,15 +67,15 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return string The user's schema ID. |
69 | 69 | */ |
70 | - public static function get_offer_schema_id( $id, $context, $local = false ) { |
|
71 | - if ( false === $local ) { |
|
70 | + public static function get_offer_schema_id($id, $context, $local = false) { |
|
71 | + if (false === $local) { |
|
72 | 72 | $url = $context->site_url; |
73 | 73 | } else { |
74 | - $url = get_permalink( $context->id ); |
|
74 | + $url = get_permalink($context->id); |
|
75 | 75 | } |
76 | 76 | $url .= '#/schema/offer/'; |
77 | - $url .= wp_hash( $id . get_the_title( $id ) ); |
|
78 | - return trailingslashit( $url ); |
|
77 | + $url .= wp_hash($id . get_the_title($id)); |
|
78 | + return trailingslashit($url); |
|
79 | 79 | } |
80 | 80 | /** |
81 | 81 | * Retrieve an review Schema ID. |
@@ -86,15 +86,15 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return string The user's schema ID. |
88 | 88 | */ |
89 | - public static function get_review_schema_id( $id, $context, $local = false ) { |
|
90 | - if ( false === $local ) { |
|
89 | + public static function get_review_schema_id($id, $context, $local = false) { |
|
90 | + if (false === $local) { |
|
91 | 91 | $url = $context->site_url; |
92 | 92 | } else { |
93 | - $url = get_permalink( $context->id ); |
|
93 | + $url = get_permalink($context->id); |
|
94 | 94 | } |
95 | 95 | $url .= '#/schema/review/'; |
96 | - $url .= wp_hash( $id . get_the_title( $id ) ); |
|
97 | - return trailingslashit( $url ); |
|
96 | + $url .= wp_hash($id . get_the_title($id)); |
|
97 | + return trailingslashit($url); |
|
98 | 98 | } |
99 | 99 | /** |
100 | 100 | * Retrieve an Article Schema ID. |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return string The user's schema ID. |
107 | 107 | */ |
108 | - public static function get_article_schema_id( $id, $context, $local = false ) { |
|
109 | - if ( false === $local ) { |
|
110 | - $url = get_permalink( $id ) . \WPSEO_Schema_IDs::ARTICLE_HASH; |
|
108 | + public static function get_article_schema_id($id, $context, $local = false) { |
|
109 | + if (false === $local) { |
|
110 | + $url = get_permalink($id) . \WPSEO_Schema_IDs::ARTICLE_HASH; |
|
111 | 111 | } else { |
112 | - $url = get_permalink( $context->id ) . '#/schema/article/' . wp_hash( $id . get_the_title( $id ) ); |
|
112 | + $url = get_permalink($context->id) . '#/schema/article/' . wp_hash($id . get_the_title($id)); |
|
113 | 113 | } |
114 | - return trailingslashit( $url ); |
|
114 | + return trailingslashit($url); |
|
115 | 115 | } |
116 | 116 | /** |
117 | 117 | * Retrieve a users Schema ID. |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return string The user's schema ID. |
123 | 123 | */ |
124 | - public static function get_author_schema_id( $name, $email, $context ) { |
|
125 | - return $context->site_url . \WPSEO_Schema_IDs::PERSON_HASH . wp_hash( $name . $email ); |
|
124 | + public static function get_author_schema_id($name, $email, $context) { |
|
125 | + return $context->site_url . \WPSEO_Schema_IDs::PERSON_HASH . wp_hash($name . $email); |
|
126 | 126 | } |
127 | 127 | /** |
128 | 128 | * Generates the place graph piece for the subtrip / Itinerary arrays. |
@@ -135,16 +135,16 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return mixed array $data Place data. |
137 | 137 | */ |
138 | - public static function add_place( $data, $type, $post_id, $context, $contained_in = false ) { |
|
139 | - $at_id = self::get_places_schema_id( $post_id, $type, $context ); |
|
138 | + public static function add_place($data, $type, $post_id, $context, $contained_in = false) { |
|
139 | + $at_id = self::get_places_schema_id($post_id, $type, $context); |
|
140 | 140 | $place = array( |
141 | 141 | '@type' => $type, |
142 | 142 | '@id' => $at_id, |
143 | - 'name' => get_the_title( $post_id ), |
|
144 | - 'description' => get_the_excerpt( $post_id ), |
|
145 | - 'url' => get_permalink( $post_id ), |
|
143 | + 'name' => get_the_title($post_id), |
|
144 | + 'description' => get_the_excerpt($post_id), |
|
145 | + 'url' => get_permalink($post_id), |
|
146 | 146 | ); |
147 | - if ( false !== $contained_in ) { |
|
147 | + if (false !== $contained_in) { |
|
148 | 148 | $place['containedInPlace'] = array( |
149 | 149 | '@type' => 'Country', |
150 | 150 | '@id' => $contained_in, |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return array $data The Review data. |
163 | 163 | */ |
164 | - public static function add_image( $data, $context ) { |
|
165 | - if ( $context->has_image ) { |
|
164 | + public static function add_image($data, $context) { |
|
165 | + if ($context->has_image) { |
|
166 | 166 | $data['image'] = array( |
167 | 167 | '@id' => $context->canonical . \WPSEO_Schema_IDs::PRIMARY_IMAGE_HASH, |
168 | 168 | ); |
@@ -176,18 +176,18 @@ discard block |
||
176 | 176 | * @param string $type The schema type. |
177 | 177 | * @return array $schema An array of the schema markup. |
178 | 178 | */ |
179 | - public static function get_item_reviewed( $items = array(), $type = '' ) { |
|
179 | + public static function get_item_reviewed($items = array(), $type = '') { |
|
180 | 180 | $schema = array(); |
181 | - if ( false !== $items && ! empty( $items ) && '' !== $type ) { |
|
182 | - array_unique( $items ); |
|
183 | - foreach ( $items as $item ) { |
|
184 | - $title = get_the_title( $item ); |
|
185 | - if ( '' !== $title ) { |
|
181 | + if (false !== $items && ! empty($items) && '' !== $type) { |
|
182 | + array_unique($items); |
|
183 | + foreach ($items as $item) { |
|
184 | + $title = get_the_title($item); |
|
185 | + if ('' !== $title) { |
|
186 | 186 | $item_schema = array( |
187 | 187 | '@type' => $type, |
188 | 188 | 'name' => $title, |
189 | 189 | ); |
190 | - $schema[] = $item_schema; |
|
190 | + $schema[] = $item_schema; |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | } |
@@ -203,18 +203,18 @@ discard block |
||
203 | 203 | * |
204 | 204 | * @return mixed array $data Review data. |
205 | 205 | */ |
206 | - public static function add_terms( $data, $post_id, $key, $taxonomy ) { |
|
207 | - $terms = get_the_terms( $post_id, $taxonomy ); |
|
208 | - if ( is_array( $terms ) ) { |
|
206 | + public static function add_terms($data, $post_id, $key, $taxonomy) { |
|
207 | + $terms = get_the_terms($post_id, $taxonomy); |
|
208 | + if (is_array($terms)) { |
|
209 | 209 | $keywords = array(); |
210 | - foreach ( $terms as $term ) { |
|
210 | + foreach ($terms as $term) { |
|
211 | 211 | // We are checking against the WordPress internal translation. |
212 | 212 | // @codingStandardsIgnoreLine |
213 | - if ( __( 'Uncategorized', 'lsx' ) !== $term->name ) { |
|
213 | + if (__('Uncategorized', 'lsx') !== $term->name) { |
|
214 | 214 | $keywords[] = $term->name; |
215 | 215 | } |
216 | 216 | } |
217 | - $data[ $key ] = implode( ',', $keywords ); |
|
217 | + $data[$key] = implode(',', $keywords); |
|
218 | 218 | } |
219 | 219 | return $data; |
220 | 220 | } |
@@ -10,212 +10,212 @@ |
||
10 | 10 | * @since 11.6 |
11 | 11 | */ |
12 | 12 | class LSX_Schema_Utils { |
13 | - /** |
|
14 | - * Determines whether a given post type should have Review schema. |
|
15 | - * |
|
16 | - * @param string $post_type Post type to check. |
|
17 | - * @param string $comparison_type Post type to check against. |
|
18 | - * |
|
19 | - * @return bool True if it has schema, false if not. |
|
20 | - */ |
|
21 | - public static function is_type( $post_type = null, $comparison_type = null ) { |
|
22 | - if ( is_null( $comparison_type ) ) { |
|
23 | - return false; |
|
24 | - } |
|
25 | - if ( is_null( $post_type ) ) { |
|
26 | - $post_type = get_post_type(); |
|
27 | - } |
|
28 | - /** |
|
29 | - * Filter: 'wpseo_schema_$this->post_type_post_types' - Allow changing for which post types we output Review schema. |
|
30 | - * |
|
31 | - * @api string[] $post_types The post types for which we output Review. |
|
32 | - */ |
|
33 | - $post_types = apply_filters( 'wpseo_schema_' . $comparison_type . '_post_types', array( $comparison_type ) ); |
|
34 | - return in_array( $post_type, $post_types ); |
|
35 | - } |
|
36 | - /** |
|
37 | - * Retrieve a users Schema ID. |
|
38 | - * |
|
39 | - * @param string $place_id The Name of the Reviewer you need a for. |
|
40 | - * @param string $type the type of the place. |
|
41 | - * @param WPSEO_Schema_Context $context A value object with context variables. |
|
42 | - * |
|
43 | - * @return string The user's schema ID. |
|
44 | - */ |
|
45 | - public static function get_places_schema_id( $place_id, $type, $context ) { |
|
46 | - $url = $context->site_url . '#/schema/' . strtolower( $type ) . '/' . wp_hash( $place_id . get_the_title( $place_id ) ); |
|
47 | - return trailingslashit( $url ); |
|
48 | - } |
|
49 | - /** |
|
50 | - * Retrieve a users Schema ID. |
|
51 | - * |
|
52 | - * @param string $name The Name of the Reviewer you need a for. |
|
53 | - * @param WPSEO_Schema_Context $context A value object with context variables. |
|
54 | - * |
|
55 | - * @return string The user's schema ID. |
|
56 | - */ |
|
57 | - public static function get_subtrip_schema_id( $name, $context ) { |
|
58 | - $url = $context->site_url . '#/subtrip/' . wp_hash( $name . $context->id ); |
|
59 | - return trailingslashit( $url ); |
|
60 | - } |
|
61 | - /** |
|
62 | - * Retrieve an offer Schema ID. |
|
63 | - * |
|
64 | - * @param string $id post ID of the place being added. |
|
65 | - * @param WPSEO_Schema_Context $context A value object with context variables. |
|
66 | - * @param string $local if the Schema is local true / false. |
|
67 | - * |
|
68 | - * @return string The user's schema ID. |
|
69 | - */ |
|
70 | - public static function get_offer_schema_id( $id, $context, $local = false ) { |
|
71 | - if ( false === $local ) { |
|
72 | - $url = $context->site_url; |
|
73 | - } else { |
|
74 | - $url = get_permalink( $context->id ); |
|
75 | - } |
|
76 | - $url .= '#/schema/offer/'; |
|
77 | - $url .= wp_hash( $id . get_the_title( $id ) ); |
|
78 | - return trailingslashit( $url ); |
|
79 | - } |
|
80 | - /** |
|
81 | - * Retrieve an review Schema ID. |
|
82 | - * |
|
83 | - * @param string $id post ID of the place being added. |
|
84 | - * @param WPSEO_Schema_Context $context A value object with context variables. |
|
85 | - * @param string $local if the Schema is local true / false. |
|
86 | - * |
|
87 | - * @return string The user's schema ID. |
|
88 | - */ |
|
89 | - public static function get_review_schema_id( $id, $context, $local = false ) { |
|
90 | - if ( false === $local ) { |
|
91 | - $url = $context->site_url; |
|
92 | - } else { |
|
93 | - $url = get_permalink( $context->id ); |
|
94 | - } |
|
95 | - $url .= '#/schema/review/'; |
|
96 | - $url .= wp_hash( $id . get_the_title( $id ) ); |
|
97 | - return trailingslashit( $url ); |
|
98 | - } |
|
99 | - /** |
|
100 | - * Retrieve an Article Schema ID. |
|
101 | - * |
|
102 | - * @param string $id post ID of the place being added. |
|
103 | - * @param WPSEO_Schema_Context $context A value object with context variables. |
|
104 | - * @param string $local if the Schema is local true / false. |
|
105 | - * |
|
106 | - * @return string The user's schema ID. |
|
107 | - */ |
|
108 | - public static function get_article_schema_id( $id, $context, $local = false ) { |
|
109 | - if ( false === $local ) { |
|
110 | - $url = get_permalink( $id ) . \WPSEO_Schema_IDs::ARTICLE_HASH; |
|
111 | - } else { |
|
112 | - $url = get_permalink( $context->id ) . '#/schema/article/' . wp_hash( $id . get_the_title( $id ) ); |
|
113 | - } |
|
114 | - return trailingslashit( $url ); |
|
115 | - } |
|
116 | - /** |
|
117 | - * Retrieve a users Schema ID. |
|
118 | - * |
|
119 | - * @param string $name The Name of the Reviewer you need a for. |
|
120 | - * @param WPSEO_Schema_Context $context A value object with context variables. |
|
121 | - * |
|
122 | - * @return string The user's schema ID. |
|
123 | - */ |
|
124 | - public static function get_author_schema_id( $name, $email, $context ) { |
|
125 | - return $context->site_url . \WPSEO_Schema_IDs::PERSON_HASH . wp_hash( $name . $email ); |
|
126 | - } |
|
127 | - /** |
|
128 | - * Generates the place graph piece for the subtrip / Itinerary arrays. |
|
129 | - * |
|
130 | - * @param array $data subTrip / itinerary data. |
|
131 | - * @param string $type The type in data to save the terms in. |
|
132 | - * @param string $post_id The post ID of the current Place to add. |
|
133 | - * @param WPSEO_Schema_Context $context The post ID of the current Place to add. |
|
134 | - * @param string $contained_in The @id of the containedIn place. |
|
135 | - * |
|
136 | - * @return mixed array $data Place data. |
|
137 | - */ |
|
138 | - public static function add_place( $data, $type, $post_id, $context, $contained_in = false ) { |
|
139 | - $at_id = self::get_places_schema_id( $post_id, $type, $context ); |
|
140 | - $place = array( |
|
141 | - '@type' => $type, |
|
142 | - '@id' => $at_id, |
|
143 | - 'name' => get_the_title( $post_id ), |
|
144 | - 'description' => get_the_excerpt( $post_id ), |
|
145 | - 'url' => get_permalink( $post_id ), |
|
146 | - ); |
|
147 | - if ( false !== $contained_in ) { |
|
148 | - $place['containedInPlace'] = array( |
|
149 | - '@type' => 'Country', |
|
150 | - '@id' => $contained_in, |
|
151 | - ); |
|
152 | - } |
|
153 | - $data[] = $place; |
|
154 | - return $data; |
|
155 | - } |
|
156 | - /** |
|
157 | - * Adds an image node if the post has a featured image. |
|
158 | - * |
|
159 | - * @param array $data The Review data. |
|
160 | - * @param WPSEO_Schema_Context $context The post ID of the current Place to add. |
|
161 | - * |
|
162 | - * @return array $data The Review data. |
|
163 | - */ |
|
164 | - public static function add_image( $data, $context ) { |
|
165 | - if ( $context->has_image ) { |
|
166 | - $data['image'] = array( |
|
167 | - '@id' => $context->canonical . \WPSEO_Schema_IDs::PRIMARY_IMAGE_HASH, |
|
168 | - ); |
|
169 | - } |
|
170 | - return $data; |
|
171 | - } |
|
172 | - /** |
|
173 | - * Generates the itemReviewed schema |
|
174 | - * |
|
175 | - * @param array $items The array of IDS. |
|
176 | - * @param string $type The schema type. |
|
177 | - * @return array $schema An array of the schema markup. |
|
178 | - */ |
|
179 | - public static function get_item_reviewed( $items = array(), $type = '' ) { |
|
180 | - $schema = array(); |
|
181 | - if ( false !== $items && ! empty( $items ) && '' !== $type ) { |
|
182 | - array_unique( $items ); |
|
183 | - foreach ( $items as $item ) { |
|
184 | - $title = get_the_title( $item ); |
|
185 | - if ( '' !== $title ) { |
|
186 | - $item_schema = array( |
|
187 | - '@type' => $type, |
|
188 | - 'name' => $title, |
|
189 | - ); |
|
190 | - $schema[] = $item_schema; |
|
191 | - } |
|
192 | - } |
|
193 | - } |
|
194 | - return $schema; |
|
195 | - } |
|
196 | - /** |
|
197 | - * Adds a term or multiple terms, comma separated, to a field. |
|
198 | - * |
|
199 | - * @param array $data Review data. |
|
200 | - * @param string $post_id The ID of the item to fetch terms. |
|
201 | - * @param string $key The key in data to save the terms in. |
|
202 | - * @param string $taxonomy The taxonomy to retrieve the terms from. |
|
203 | - * |
|
204 | - * @return mixed array $data Review data. |
|
205 | - */ |
|
206 | - public static function add_terms( $data, $post_id, $key, $taxonomy ) { |
|
207 | - $terms = get_the_terms( $post_id, $taxonomy ); |
|
208 | - if ( is_array( $terms ) ) { |
|
209 | - $keywords = array(); |
|
210 | - foreach ( $terms as $term ) { |
|
211 | - // We are checking against the WordPress internal translation. |
|
212 | - // @codingStandardsIgnoreLine |
|
213 | - if ( __( 'Uncategorized', 'lsx' ) !== $term->name ) { |
|
214 | - $keywords[] = $term->name; |
|
215 | - } |
|
216 | - } |
|
217 | - $data[ $key ] = implode( ',', $keywords ); |
|
218 | - } |
|
219 | - return $data; |
|
220 | - } |
|
13 | + /** |
|
14 | + * Determines whether a given post type should have Review schema. |
|
15 | + * |
|
16 | + * @param string $post_type Post type to check. |
|
17 | + * @param string $comparison_type Post type to check against. |
|
18 | + * |
|
19 | + * @return bool True if it has schema, false if not. |
|
20 | + */ |
|
21 | + public static function is_type( $post_type = null, $comparison_type = null ) { |
|
22 | + if ( is_null( $comparison_type ) ) { |
|
23 | + return false; |
|
24 | + } |
|
25 | + if ( is_null( $post_type ) ) { |
|
26 | + $post_type = get_post_type(); |
|
27 | + } |
|
28 | + /** |
|
29 | + * Filter: 'wpseo_schema_$this->post_type_post_types' - Allow changing for which post types we output Review schema. |
|
30 | + * |
|
31 | + * @api string[] $post_types The post types for which we output Review. |
|
32 | + */ |
|
33 | + $post_types = apply_filters( 'wpseo_schema_' . $comparison_type . '_post_types', array( $comparison_type ) ); |
|
34 | + return in_array( $post_type, $post_types ); |
|
35 | + } |
|
36 | + /** |
|
37 | + * Retrieve a users Schema ID. |
|
38 | + * |
|
39 | + * @param string $place_id The Name of the Reviewer you need a for. |
|
40 | + * @param string $type the type of the place. |
|
41 | + * @param WPSEO_Schema_Context $context A value object with context variables. |
|
42 | + * |
|
43 | + * @return string The user's schema ID. |
|
44 | + */ |
|
45 | + public static function get_places_schema_id( $place_id, $type, $context ) { |
|
46 | + $url = $context->site_url . '#/schema/' . strtolower( $type ) . '/' . wp_hash( $place_id . get_the_title( $place_id ) ); |
|
47 | + return trailingslashit( $url ); |
|
48 | + } |
|
49 | + /** |
|
50 | + * Retrieve a users Schema ID. |
|
51 | + * |
|
52 | + * @param string $name The Name of the Reviewer you need a for. |
|
53 | + * @param WPSEO_Schema_Context $context A value object with context variables. |
|
54 | + * |
|
55 | + * @return string The user's schema ID. |
|
56 | + */ |
|
57 | + public static function get_subtrip_schema_id( $name, $context ) { |
|
58 | + $url = $context->site_url . '#/subtrip/' . wp_hash( $name . $context->id ); |
|
59 | + return trailingslashit( $url ); |
|
60 | + } |
|
61 | + /** |
|
62 | + * Retrieve an offer Schema ID. |
|
63 | + * |
|
64 | + * @param string $id post ID of the place being added. |
|
65 | + * @param WPSEO_Schema_Context $context A value object with context variables. |
|
66 | + * @param string $local if the Schema is local true / false. |
|
67 | + * |
|
68 | + * @return string The user's schema ID. |
|
69 | + */ |
|
70 | + public static function get_offer_schema_id( $id, $context, $local = false ) { |
|
71 | + if ( false === $local ) { |
|
72 | + $url = $context->site_url; |
|
73 | + } else { |
|
74 | + $url = get_permalink( $context->id ); |
|
75 | + } |
|
76 | + $url .= '#/schema/offer/'; |
|
77 | + $url .= wp_hash( $id . get_the_title( $id ) ); |
|
78 | + return trailingslashit( $url ); |
|
79 | + } |
|
80 | + /** |
|
81 | + * Retrieve an review Schema ID. |
|
82 | + * |
|
83 | + * @param string $id post ID of the place being added. |
|
84 | + * @param WPSEO_Schema_Context $context A value object with context variables. |
|
85 | + * @param string $local if the Schema is local true / false. |
|
86 | + * |
|
87 | + * @return string The user's schema ID. |
|
88 | + */ |
|
89 | + public static function get_review_schema_id( $id, $context, $local = false ) { |
|
90 | + if ( false === $local ) { |
|
91 | + $url = $context->site_url; |
|
92 | + } else { |
|
93 | + $url = get_permalink( $context->id ); |
|
94 | + } |
|
95 | + $url .= '#/schema/review/'; |
|
96 | + $url .= wp_hash( $id . get_the_title( $id ) ); |
|
97 | + return trailingslashit( $url ); |
|
98 | + } |
|
99 | + /** |
|
100 | + * Retrieve an Article Schema ID. |
|
101 | + * |
|
102 | + * @param string $id post ID of the place being added. |
|
103 | + * @param WPSEO_Schema_Context $context A value object with context variables. |
|
104 | + * @param string $local if the Schema is local true / false. |
|
105 | + * |
|
106 | + * @return string The user's schema ID. |
|
107 | + */ |
|
108 | + public static function get_article_schema_id( $id, $context, $local = false ) { |
|
109 | + if ( false === $local ) { |
|
110 | + $url = get_permalink( $id ) . \WPSEO_Schema_IDs::ARTICLE_HASH; |
|
111 | + } else { |
|
112 | + $url = get_permalink( $context->id ) . '#/schema/article/' . wp_hash( $id . get_the_title( $id ) ); |
|
113 | + } |
|
114 | + return trailingslashit( $url ); |
|
115 | + } |
|
116 | + /** |
|
117 | + * Retrieve a users Schema ID. |
|
118 | + * |
|
119 | + * @param string $name The Name of the Reviewer you need a for. |
|
120 | + * @param WPSEO_Schema_Context $context A value object with context variables. |
|
121 | + * |
|
122 | + * @return string The user's schema ID. |
|
123 | + */ |
|
124 | + public static function get_author_schema_id( $name, $email, $context ) { |
|
125 | + return $context->site_url . \WPSEO_Schema_IDs::PERSON_HASH . wp_hash( $name . $email ); |
|
126 | + } |
|
127 | + /** |
|
128 | + * Generates the place graph piece for the subtrip / Itinerary arrays. |
|
129 | + * |
|
130 | + * @param array $data subTrip / itinerary data. |
|
131 | + * @param string $type The type in data to save the terms in. |
|
132 | + * @param string $post_id The post ID of the current Place to add. |
|
133 | + * @param WPSEO_Schema_Context $context The post ID of the current Place to add. |
|
134 | + * @param string $contained_in The @id of the containedIn place. |
|
135 | + * |
|
136 | + * @return mixed array $data Place data. |
|
137 | + */ |
|
138 | + public static function add_place( $data, $type, $post_id, $context, $contained_in = false ) { |
|
139 | + $at_id = self::get_places_schema_id( $post_id, $type, $context ); |
|
140 | + $place = array( |
|
141 | + '@type' => $type, |
|
142 | + '@id' => $at_id, |
|
143 | + 'name' => get_the_title( $post_id ), |
|
144 | + 'description' => get_the_excerpt( $post_id ), |
|
145 | + 'url' => get_permalink( $post_id ), |
|
146 | + ); |
|
147 | + if ( false !== $contained_in ) { |
|
148 | + $place['containedInPlace'] = array( |
|
149 | + '@type' => 'Country', |
|
150 | + '@id' => $contained_in, |
|
151 | + ); |
|
152 | + } |
|
153 | + $data[] = $place; |
|
154 | + return $data; |
|
155 | + } |
|
156 | + /** |
|
157 | + * Adds an image node if the post has a featured image. |
|
158 | + * |
|
159 | + * @param array $data The Review data. |
|
160 | + * @param WPSEO_Schema_Context $context The post ID of the current Place to add. |
|
161 | + * |
|
162 | + * @return array $data The Review data. |
|
163 | + */ |
|
164 | + public static function add_image( $data, $context ) { |
|
165 | + if ( $context->has_image ) { |
|
166 | + $data['image'] = array( |
|
167 | + '@id' => $context->canonical . \WPSEO_Schema_IDs::PRIMARY_IMAGE_HASH, |
|
168 | + ); |
|
169 | + } |
|
170 | + return $data; |
|
171 | + } |
|
172 | + /** |
|
173 | + * Generates the itemReviewed schema |
|
174 | + * |
|
175 | + * @param array $items The array of IDS. |
|
176 | + * @param string $type The schema type. |
|
177 | + * @return array $schema An array of the schema markup. |
|
178 | + */ |
|
179 | + public static function get_item_reviewed( $items = array(), $type = '' ) { |
|
180 | + $schema = array(); |
|
181 | + if ( false !== $items && ! empty( $items ) && '' !== $type ) { |
|
182 | + array_unique( $items ); |
|
183 | + foreach ( $items as $item ) { |
|
184 | + $title = get_the_title( $item ); |
|
185 | + if ( '' !== $title ) { |
|
186 | + $item_schema = array( |
|
187 | + '@type' => $type, |
|
188 | + 'name' => $title, |
|
189 | + ); |
|
190 | + $schema[] = $item_schema; |
|
191 | + } |
|
192 | + } |
|
193 | + } |
|
194 | + return $schema; |
|
195 | + } |
|
196 | + /** |
|
197 | + * Adds a term or multiple terms, comma separated, to a field. |
|
198 | + * |
|
199 | + * @param array $data Review data. |
|
200 | + * @param string $post_id The ID of the item to fetch terms. |
|
201 | + * @param string $key The key in data to save the terms in. |
|
202 | + * @param string $taxonomy The taxonomy to retrieve the terms from. |
|
203 | + * |
|
204 | + * @return mixed array $data Review data. |
|
205 | + */ |
|
206 | + public static function add_terms( $data, $post_id, $key, $taxonomy ) { |
|
207 | + $terms = get_the_terms( $post_id, $taxonomy ); |
|
208 | + if ( is_array( $terms ) ) { |
|
209 | + $keywords = array(); |
|
210 | + foreach ( $terms as $term ) { |
|
211 | + // We are checking against the WordPress internal translation. |
|
212 | + // @codingStandardsIgnoreLine |
|
213 | + if ( __( 'Uncategorized', 'lsx' ) !== $term->name ) { |
|
214 | + $keywords[] = $term->name; |
|
215 | + } |
|
216 | + } |
|
217 | + $data[ $key ] = implode( ',', $keywords ); |
|
218 | + } |
|
219 | + return $data; |
|
220 | + } |
|
221 | 221 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | <?php lsx_content_wrap_before(); ?> |
11 | 11 | |
12 | -<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
12 | +<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
13 | 13 | |
14 | 14 | <?php lsx_content_before(); ?> |
15 | 15 | |
@@ -17,18 +17,18 @@ discard block |
||
17 | 17 | |
18 | 18 | <?php lsx_content_top(); ?> |
19 | 19 | |
20 | - <?php if ( have_posts() ) : ?> |
|
20 | + <?php if (have_posts()) : ?> |
|
21 | 21 | |
22 | 22 | <?php |
23 | - while ( have_posts() ) : |
|
23 | + while (have_posts()) : |
|
24 | 24 | the_post(); |
25 | 25 | ?> |
26 | 26 | |
27 | 27 | <?php |
28 | - if ( is_singular( 'post' ) ) { |
|
29 | - get_template_part( 'partials/content', 'post' ); |
|
28 | + if (is_singular('post')) { |
|
29 | + get_template_part('partials/content', 'post'); |
|
30 | 30 | } else { |
31 | - get_template_part( 'partials/content', 'custom' ); |
|
31 | + get_template_part('partials/content', 'custom'); |
|
32 | 32 | } |
33 | 33 | ?> |
34 | 34 | |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | <?php lsx_content_after(); ?> |
44 | 44 | |
45 | 45 | <?php |
46 | - if ( is_singular( 'post' ) ) { |
|
46 | + if (is_singular('post')) { |
|
47 | 47 | lsx_post_nav(); |
48 | 48 | } |
49 | 49 | ?> |
50 | 50 | |
51 | 51 | <?php |
52 | - if ( comments_open() ) { |
|
52 | + if (comments_open()) { |
|
53 | 53 | comments_template(); |
54 | 54 | } |
55 | 55 | ?> |
@@ -20,17 +20,17 @@ discard block |
||
20 | 20 | <?php if ( have_posts() ) : ?> |
21 | 21 | |
22 | 22 | <?php |
23 | - while ( have_posts() ) : |
|
24 | - the_post(); |
|
25 | - ?> |
|
23 | + while ( have_posts() ) : |
|
24 | + the_post(); |
|
25 | + ?> |
|
26 | 26 | |
27 | 27 | <?php |
28 | - if ( is_singular( 'post' ) ) { |
|
29 | - get_template_part( 'partials/content', 'post' ); |
|
30 | - } else { |
|
31 | - get_template_part( 'partials/content', 'custom' ); |
|
32 | - } |
|
33 | - ?> |
|
28 | + if ( is_singular( 'post' ) ) { |
|
29 | + get_template_part( 'partials/content', 'post' ); |
|
30 | + } else { |
|
31 | + get_template_part( 'partials/content', 'custom' ); |
|
32 | + } |
|
33 | + ?> |
|
34 | 34 | |
35 | 35 | <?php endwhile; ?> |
36 | 36 | |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | <?php lsx_content_after(); ?> |
44 | 44 | |
45 | 45 | <?php |
46 | - if ( is_singular( 'post' ) ) { |
|
47 | - lsx_post_nav(); |
|
48 | - } |
|
49 | - ?> |
|
46 | + if ( is_singular( 'post' ) ) { |
|
47 | + lsx_post_nav(); |
|
48 | + } |
|
49 | + ?> |
|
50 | 50 | |
51 | 51 | <?php |
52 | - if ( comments_open() ) { |
|
53 | - comments_template(); |
|
54 | - } |
|
55 | - ?> |
|
52 | + if ( comments_open() ) { |
|
53 | + comments_template(); |
|
54 | + } |
|
55 | + ?> |
|
56 | 56 | |
57 | 57 | </div><!-- #primary --> |
58 | 58 |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | |
21 | 21 | <?php lsx_content_top(); ?> |
22 | 22 | |
23 | - <?php if ( have_posts() ) : ?> |
|
23 | + <?php if (have_posts()) : ?> |
|
24 | 24 | |
25 | 25 | <?php |
26 | - while ( have_posts() ) : |
|
26 | + while (have_posts()) : |
|
27 | 27 | the_post(); |
28 | 28 | ?> |
29 | 29 | |
30 | - <?php get_template_part( 'partials/content', 'page' ); ?> |
|
30 | + <?php get_template_part('partials/content', 'page'); ?> |
|
31 | 31 | |
32 | 32 | <?php endwhile; ?> |
33 | 33 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | <?php lsx_content_bottom(); ?> |
37 | 37 | |
38 | 38 | <?php |
39 | - if ( comments_open() ) { |
|
39 | + if (comments_open()) { |
|
40 | 40 | comments_template(); |
41 | 41 | } |
42 | 42 | ?> |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | <?php if ( have_posts() ) : ?> |
24 | 24 | |
25 | 25 | <?php |
26 | - while ( have_posts() ) : |
|
27 | - the_post(); |
|
28 | - ?> |
|
26 | + while ( have_posts() ) : |
|
27 | + the_post(); |
|
28 | + ?> |
|
29 | 29 | |
30 | 30 | <?php get_template_part( 'partials/content', 'page' ); ?> |
31 | 31 | |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | <?php lsx_content_bottom(); ?> |
37 | 37 | |
38 | 38 | <?php |
39 | - if ( comments_open() ) { |
|
40 | - comments_template(); |
|
41 | - } |
|
42 | - ?> |
|
39 | + if ( comments_open() ) { |
|
40 | + comments_template(); |
|
41 | + } |
|
42 | + ?> |
|
43 | 43 | |
44 | 44 | </main><!-- #main --> |
45 | 45 |