@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly |
|
2 | +if ( ! defined('ABSPATH')) return; // Exit if accessed directly |
|
3 | 3 | |
4 | 4 | class lsx_bootstrap_navwalker extends Walker_Nav_Menu { |
5 | 5 | |
@@ -10,15 +10,15 @@ discard block |
||
10 | 10 | * @param string $output Passed by reference. Used to append additional content. |
11 | 11 | * @param int $depth Depth of page. Used for padding. |
12 | 12 | */ |
13 | - public function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
14 | - $indent = str_repeat( "\t", $depth ); |
|
13 | + public function start_lvl(&$output, $depth = 0, $args = array()) { |
|
14 | + $indent = str_repeat("\t", $depth); |
|
15 | 15 | $output .= "\n$indent<ul role=\"menu\" class=\" dropdown-menu\">\n"; |
16 | 16 | } |
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @param string $item Passed by reference. Used to append additional content. |
20 | 20 | */ |
21 | - public function filter_default_pages( &$item ) { |
|
21 | + public function filter_default_pages(&$item) { |
|
22 | 22 | |
23 | 23 | return $item; |
24 | 24 | } |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | * @param int $current_page Menu item ID. |
34 | 34 | * @param object $args |
35 | 35 | */ |
36 | - public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
|
37 | - $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; |
|
36 | + public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { |
|
37 | + $indent = ($depth) ? str_repeat("\t", $depth) : ''; |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * If this is a default menu being called we need to fix |
41 | 41 | * the item object thats coming through. |
42 | 42 | */ |
43 | - if(!isset($item->title)){ |
|
43 | + if ( ! isset($item->title)) { |
|
44 | 44 | return; |
45 | 45 | } |
46 | 46 | |
@@ -52,63 +52,63 @@ discard block |
||
52 | 52 | * comparison that is not case sensitive. The strcasecmp() function returns |
53 | 53 | * a 0 if the strings are equal. |
54 | 54 | */ |
55 | - if ( strcasecmp( $item->attr_title, 'divider' ) == 0 && $depth === 1 ) { |
|
55 | + if (strcasecmp($item->attr_title, 'divider') == 0 && $depth === 1) { |
|
56 | 56 | $output .= $indent . '<li role="presentation" class="divider">'; |
57 | - } else if ( strcasecmp( $item->title, 'divider') == 0 && $depth === 1 ) { |
|
57 | + } else if (strcasecmp($item->title, 'divider') == 0 && $depth === 1) { |
|
58 | 58 | $output .= $indent . '<li role="presentation" class="divider">'; |
59 | - } else if ( strcasecmp( $item->attr_title, 'dropdown-header') == 0 && $depth === 1 ) { |
|
60 | - $output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr( $item->title ); |
|
61 | - } else if ( strcasecmp($item->attr_title, 'disabled' ) == 0 ) { |
|
62 | - $output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr( $item->title ) . '</a>'; |
|
59 | + } else if (strcasecmp($item->attr_title, 'dropdown-header') == 0 && $depth === 1) { |
|
60 | + $output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr($item->title); |
|
61 | + } else if (strcasecmp($item->attr_title, 'disabled') == 0) { |
|
62 | + $output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr($item->title) . '</a>'; |
|
63 | 63 | } else { |
64 | 64 | |
65 | 65 | $class_names = $value = ''; |
66 | 66 | |
67 | - $classes = empty( $item->classes ) ? array() : (array) $item->classes; |
|
67 | + $classes = empty($item->classes) ? array() : (array) $item->classes; |
|
68 | 68 | $classes[] = 'menu-item-' . $item->ID; |
69 | 69 | |
70 | - $classes = apply_filters( 'lsx_nav_menu_css_class', array_filter( $classes ), $item, $args , $depth ); |
|
70 | + $classes = apply_filters('lsx_nav_menu_css_class', array_filter($classes), $item, $args, $depth); |
|
71 | 71 | |
72 | - $class_names = join( ' ', $classes ); |
|
72 | + $class_names = join(' ', $classes); |
|
73 | 73 | |
74 | - if ( $args->has_children ) |
|
74 | + if ($args->has_children) |
|
75 | 75 | $class_names .= ' dropdown'; |
76 | 76 | |
77 | - if ( in_array( 'current-menu-item', $classes ) ) |
|
77 | + if (in_array('current-menu-item', $classes)) |
|
78 | 78 | $class_names .= ' active'; |
79 | 79 | |
80 | - if ( in_array( 'current-menu-parent', $classes ) ) |
|
80 | + if (in_array('current-menu-parent', $classes)) |
|
81 | 81 | $class_names .= ' active'; |
82 | 82 | |
83 | 83 | //Check if this is ment to be a "social" type menu |
84 | - $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; |
|
84 | + $class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : ''; |
|
85 | 85 | |
86 | - $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args ); |
|
87 | - $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; |
|
86 | + $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args); |
|
87 | + $id = $id ? ' id="' . esc_attr($id) . '"' : ''; |
|
88 | 88 | |
89 | - $output .= $indent . '<li' . $id . $value . $class_names .'>'; |
|
89 | + $output .= $indent . '<li' . $id . $value . $class_names . '>'; |
|
90 | 90 | |
91 | 91 | $atts = array(); |
92 | - $atts['title'] = ! empty( $item->title ) ? $item->title : ''; |
|
93 | - $atts['target'] = ! empty( $item->target ) ? $item->target : ''; |
|
94 | - $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; |
|
92 | + $atts['title'] = ! empty($item->title) ? $item->title : ''; |
|
93 | + $atts['target'] = ! empty($item->target) ? $item->target : ''; |
|
94 | + $atts['rel'] = ! empty($item->xfn) ? $item->xfn : ''; |
|
95 | 95 | |
96 | 96 | // If item has_children add atts to a. |
97 | - if ( $args->has_children ) { |
|
98 | - $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
99 | - $atts['data-toggle'] = 'dropdown'; |
|
100 | - $atts['class'] = 'dropdown-toggle'; |
|
101 | - $atts['aria-haspopup'] = 'true'; |
|
97 | + if ($args->has_children) { |
|
98 | + $atts['href'] = ! empty($item->url) ? $item->url : ''; |
|
99 | + $atts['data-toggle'] = 'dropdown'; |
|
100 | + $atts['class'] = 'dropdown-toggle'; |
|
101 | + $atts['aria-haspopup'] = 'true'; |
|
102 | 102 | } else { |
103 | - $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
103 | + $atts['href'] = ! empty($item->url) ? $item->url : ''; |
|
104 | 104 | } |
105 | 105 | |
106 | - $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args ); |
|
106 | + $atts = apply_filters('nav_menu_link_attributes', $atts, $item, $args); |
|
107 | 107 | |
108 | 108 | $attributes = ''; |
109 | - foreach ( $atts as $attr => $value ) { |
|
110 | - if ( ! empty( $value ) ) { |
|
111 | - $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); |
|
109 | + foreach ($atts as $attr => $value) { |
|
110 | + if ( ! empty($value)) { |
|
111 | + $value = ('href' === $attr) ? esc_url($value) : esc_attr($value); |
|
112 | 112 | $attributes .= ' ' . $attr . '="' . $value . '"'; |
113 | 113 | } |
114 | 114 | } |
@@ -122,19 +122,19 @@ discard block |
||
122 | 122 | * if there is a value in the attr_title property. If the attr_title |
123 | 123 | * property is NOT null we apply it as the class name for the glyphicon. |
124 | 124 | */ |
125 | - if ( ! empty( $item->attr_title ) ) { |
|
126 | - $item_output .= '<a'. $attributes .'"><span class="glyphicon ' . esc_attr( $item->attr_title ) . '"></span> '; |
|
125 | + if ( ! empty($item->attr_title)) { |
|
126 | + $item_output .= '<a' . $attributes . '"><span class="glyphicon ' . esc_attr($item->attr_title) . '"></span> '; |
|
127 | 127 | } else { |
128 | - $item_output .= '<a'. $attributes .'>'; |
|
128 | + $item_output .= '<a' . $attributes . '>'; |
|
129 | 129 | } |
130 | 130 | |
131 | - $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; |
|
132 | - $item_output .= ( $args->has_children && 0 === $depth ) ? ' <span class="caret"></span></a>' : '</a>'; |
|
131 | + $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after; |
|
132 | + $item_output .= ($args->has_children && 0 === $depth) ? ' <span class="caret"></span></a>' : '</a>'; |
|
133 | 133 | $item_output .= $args->after; |
134 | 134 | |
135 | 135 | |
136 | 136 | |
137 | - $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); |
|
137 | + $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
@@ -158,17 +158,17 @@ discard block |
||
158 | 158 | * @param string $output Passed by reference. Used to append additional content. |
159 | 159 | * @return null Null on failure with no changes to parameters. |
160 | 160 | */ |
161 | - public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { |
|
162 | - if ( ! $element ) |
|
161 | + public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output) { |
|
162 | + if ( ! $element) |
|
163 | 163 | return; |
164 | 164 | |
165 | 165 | $id_field = $this->db_fields['id']; |
166 | 166 | |
167 | 167 | // Display this element. |
168 | - if ( is_object( $args[0] ) ) |
|
169 | - $args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] ); |
|
168 | + if (is_object($args[0])) |
|
169 | + $args[0]->has_children = ! empty($children_elements[$element->$id_field]); |
|
170 | 170 | |
171 | - parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); |
|
171 | + parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -182,20 +182,20 @@ discard block |
||
182 | 182 | * @param array $args passed from the wp_nav_menu function. |
183 | 183 | * |
184 | 184 | */ |
185 | - public static function fallback( $args ) { |
|
186 | - if ( current_user_can( 'manage_options' ) ) { |
|
185 | + public static function fallback($args) { |
|
186 | + if (current_user_can('manage_options')) { |
|
187 | 187 | |
188 | - extract( $args ); |
|
188 | + extract($args); |
|
189 | 189 | |
190 | 190 | $fb_output = null; |
191 | 191 | |
192 | - if ( $container ) { |
|
192 | + if ($container) { |
|
193 | 193 | $fb_output = '<' . $container; |
194 | 194 | |
195 | - if ( $container_id ) |
|
195 | + if ($container_id) |
|
196 | 196 | $fb_output .= ' id="' . $container_id . '"'; |
197 | 197 | |
198 | - if ( $container_class ) |
|
198 | + if ($container_class) |
|
199 | 199 | $fb_output .= ' class="' . $container_class . '"'; |
200 | 200 | |
201 | 201 | $fb_output .= '>'; |
@@ -203,17 +203,17 @@ discard block |
||
203 | 203 | |
204 | 204 | $fb_output .= '<ul'; |
205 | 205 | |
206 | - if ( $menu_id ) |
|
206 | + if ($menu_id) |
|
207 | 207 | $fb_output .= ' id="' . $menu_id . '"'; |
208 | 208 | |
209 | - if ( $menu_class ) |
|
209 | + if ($menu_class) |
|
210 | 210 | $fb_output .= ' class="' . $menu_class . '"'; |
211 | 211 | |
212 | 212 | $fb_output .= '>'; |
213 | - $fb_output .= '<li><a href="' . admin_url( 'nav-menus.php' ) . '">'.__('Add a menu','lsx').'</a></li>'; |
|
213 | + $fb_output .= '<li><a href="' . admin_url('nav-menus.php') . '">' . __('Add a menu', 'lsx') . '</a></li>'; |
|
214 | 214 | $fb_output .= '</ul>'; |
215 | 215 | |
216 | - if ( $container ) |
|
216 | + if ($container) |
|
217 | 217 | $fb_output .= '</' . $container . '>'; |
218 | 218 | |
219 | 219 | echo $fb_output; |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | /** |
226 | 226 | * Add in our custom classes to the menus |
227 | 227 | */ |
228 | -function wpml_nav_language_switcher_fix( $items , $args ) { |
|
229 | - $items = str_replace('menu-item-language-current','menu-item-language-current dropdown',$items); |
|
230 | - $items = str_replace('submenu-languages','submenu-languages dropdown-menu',$items); |
|
228 | +function wpml_nav_language_switcher_fix($items, $args) { |
|
229 | + $items = str_replace('menu-item-language-current', 'menu-item-language-current dropdown', $items); |
|
230 | + $items = str_replace('submenu-languages', 'submenu-languages dropdown-menu', $items); |
|
231 | 231 | return $items; |
232 | 232 | } |
233 | -add_filter( 'wp_nav_menu_items', 'wpml_nav_language_switcher_fix', 10, 2 ); |
|
233 | +add_filter('wp_nav_menu_items', 'wpml_nav_language_switcher_fix', 10, 2); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly |
|
2 | +if ( ! defined('ABSPATH')) return; // Exit if accessed directly |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Theme Configuration File |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @package lsx |
9 | 9 | */ |
10 | 10 | |
11 | -if ( ! function_exists( 'lsx_setup' ) ) : |
|
11 | +if ( ! function_exists('lsx_setup')) : |
|
12 | 12 | /** |
13 | 13 | * Sets up theme defaults and registers support for various WordPress features. |
14 | 14 | * |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | function lsx_setup() { |
20 | 20 | global $content_width; |
21 | 21 | |
22 | - load_theme_textdomain( 'lsx', get_template_directory() . '/languages' ); |
|
22 | + load_theme_textdomain('lsx', get_template_directory() . '/languages'); |
|
23 | 23 | |
24 | 24 | $args = array( |
25 | 25 | 'header-text' => array( |
@@ -28,50 +28,50 @@ discard block |
||
28 | 28 | ), |
29 | 29 | 'size' => 'medium', |
30 | 30 | ); |
31 | - add_theme_support( 'site-logo', $args ); |
|
31 | + add_theme_support('site-logo', $args); |
|
32 | 32 | |
33 | - add_theme_support( 'custom-logo', array( |
|
33 | + add_theme_support('custom-logo', array( |
|
34 | 34 | 'height' => 50, |
35 | 35 | 'width' => 150, |
36 | 36 | 'flex-width' => true, |
37 | 37 | 'flex-height' => true, |
38 | - ) ); |
|
38 | + )); |
|
39 | 39 | |
40 | - add_theme_support( 'automatic-feed-links' ); |
|
41 | - add_theme_support( 'title-tag' ); |
|
42 | - add_theme_support( 'post-thumbnails' ); |
|
43 | - add_theme_support( 'post-formats', array('image', 'video', 'gallery', 'audio', 'link', 'quote', 'aside') ); |
|
40 | + add_theme_support('automatic-feed-links'); |
|
41 | + add_theme_support('title-tag'); |
|
42 | + add_theme_support('post-thumbnails'); |
|
43 | + add_theme_support('post-formats', array('image', 'video', 'gallery', 'audio', 'link', 'quote', 'aside')); |
|
44 | 44 | |
45 | 45 | // This theme uses wp_nav_menu() in one location. |
46 | - register_nav_menus( array( |
|
47 | - 'primary' => __( 'Primary Menu', 'lsx' ), |
|
48 | - 'top-menu'=> __( 'Top Menu' , 'lsx' ), |
|
49 | - 'social'=> __( 'Social Menu' , 'lsx' ), |
|
50 | - 'footer'=> __( 'Footer Menu' , 'lsx' ) |
|
51 | - ) ); |
|
46 | + register_nav_menus(array( |
|
47 | + 'primary' => __('Primary Menu', 'lsx'), |
|
48 | + 'top-menu'=> __('Top Menu', 'lsx'), |
|
49 | + 'social'=> __('Social Menu', 'lsx'), |
|
50 | + 'footer'=> __('Footer Menu', 'lsx') |
|
51 | + )); |
|
52 | 52 | |
53 | 53 | //Set the content width |
54 | 54 | $content_width = 1140; |
55 | 55 | |
56 | - add_editor_style( get_template_directory_uri() . '/css/editor-style.css' ); |
|
57 | - add_theme_support( 'html5', array( 'caption' ) ); |
|
56 | + add_editor_style(get_template_directory_uri() . '/css/editor-style.css'); |
|
57 | + add_theme_support('html5', array('caption')); |
|
58 | 58 | |
59 | - add_theme_support( 'woocommerce' ); |
|
60 | - add_theme_support( 'sensei' ); |
|
59 | + add_theme_support('woocommerce'); |
|
60 | + add_theme_support('sensei'); |
|
61 | 61 | } |
62 | 62 | endif; // lsx_setup |
63 | -add_action( 'after_setup_theme', 'lsx_setup' ); |
|
63 | +add_action('after_setup_theme', 'lsx_setup'); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Removes the "Custom Fields" meta box. |
67 | 67 | */ |
68 | 68 | function lsx_remove_meta_boxes() { |
69 | 69 | $post_types = get_post_types(); |
70 | - foreach($post_types as $post_type){ |
|
71 | - remove_meta_box( 'postcustom' , $post_type , 'normal' ); |
|
70 | + foreach ($post_types as $post_type) { |
|
71 | + remove_meta_box('postcustom', $post_type, 'normal'); |
|
72 | 72 | } |
73 | 73 | } |
74 | -add_action( 'admin_menu' , 'lsx_remove_meta_boxes' ); |
|
74 | +add_action('admin_menu', 'lsx_remove_meta_boxes'); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Overwrite the $content_width var, based on the layout of the page. |
@@ -83,34 +83,34 @@ discard block |
||
83 | 83 | function lsx_process_content_width() { |
84 | 84 | global $content_width; |
85 | 85 | |
86 | - if( |
|
86 | + if ( |
|
87 | 87 | is_page_template('page-templates/template-portfolio.php') || |
88 | 88 | is_page_template('page-templates/template-front-page.php') || |
89 | 89 | is_page_template('page-templates/template-full-width.php') || |
90 | 90 | is_post_type_archive('jetpack-portfolio') || |
91 | - is_tax(array('jetpack-portfolio-type','jetpack-portfolio-tag')) || |
|
91 | + is_tax(array('jetpack-portfolio-type', 'jetpack-portfolio-tag')) || |
|
92 | 92 | is_singular('jetpack-portfolio') |
93 | - ){ |
|
93 | + ) { |
|
94 | 94 | $content_width = 1140; |
95 | 95 | } |
96 | 96 | } |
97 | -add_action('wp_head','lsx_process_content_width'); |
|
97 | +add_action('wp_head', 'lsx_process_content_width'); |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Disable the comments form by default for the page post type. |
101 | 101 | * @package lsx |
102 | 102 | * @subpackage config |
103 | 103 | */ |
104 | -function lsx_page_comments_off( $data ) { |
|
104 | +function lsx_page_comments_off($data) { |
|
105 | 105 | |
106 | - if( $data['post_type'] == 'page' && $data['post_status'] == 'auto-draft' && $data['post_title'] == __('Auto Draft','lsx') ) { |
|
106 | + if ($data['post_type'] == 'page' && $data['post_status'] == 'auto-draft' && $data['post_title'] == __('Auto Draft', 'lsx')) { |
|
107 | 107 | $data['comment_status'] = 0; |
108 | 108 | $data['ping_status'] = 0; |
109 | 109 | } |
110 | 110 | |
111 | 111 | return $data; |
112 | 112 | } |
113 | -add_filter( 'wp_insert_post_data', 'lsx_page_comments_off' ); |
|
113 | +add_filter('wp_insert_post_data', 'lsx_page_comments_off'); |
|
114 | 114 | |
115 | 115 | /** |
116 | 116 | * Disable the comments form by default for the page post type. |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | */ |
120 | 120 | function lsx_is_legacy($data) { |
121 | 121 | |
122 | - if( $data['post_type'] == 'page' && $data['post_status'] == 'auto-draft' && $data['post_title'] == __('Auto Draft','lsx') ) { |
|
122 | + if ($data['post_type'] == 'page' && $data['post_status'] == 'auto-draft' && $data['post_title'] == __('Auto Draft', 'lsx')) { |
|
123 | 123 | $data['comment_status'] = 0; |
124 | 124 | $data['ping_status'] = 0; |
125 | 125 | } |
126 | 126 | |
127 | 127 | return $data; |
128 | 128 | } |
129 | -add_filter( 'wp_insert_post_data', 'lsx_page_comments_off' ); |
|
129 | +add_filter('wp_insert_post_data', 'lsx_page_comments_off'); |
|
130 | 130 | |
131 | 131 | /** |
132 | 132 | * Run the init command |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | * @subpackage config |
135 | 135 | */ |
136 | 136 | function lsx_init() { |
137 | - if(class_exists('WooCommerce')){ |
|
138 | - remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 ); |
|
137 | + if (class_exists('WooCommerce')) { |
|
138 | + remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0); |
|
139 | 139 | } |
140 | 140 | } |
141 | -add_action( 'init', 'lsx_init',100 ); |
|
141 | +add_action('init', 'lsx_init', 100); |
|
142 | 142 | |
143 | 143 | /** |
144 | 144 | * Run on the wp_head |
@@ -147,11 +147,11 @@ discard block |
||
147 | 147 | */ |
148 | 148 | function lsx_wp_head() { |
149 | 149 | |
150 | - $layout = get_theme_mod('lsx_layout','2cr'); |
|
151 | - $layout = apply_filters( 'lsx_layout', $layout ); |
|
150 | + $layout = get_theme_mod('lsx_layout', '2cr'); |
|
151 | + $layout = apply_filters('lsx_layout', $layout); |
|
152 | 152 | |
153 | - if('1c' === $layout && (is_author() || is_search() || (is_post_type_archive(array('post','page','jetpack-portfolio')) && !is_post_type_archive('tribe_events')) || is_tag() || is_category() || is_date() || is_tax('post_format')) ){ |
|
154 | - remove_action('lsx_content_top', 'lsx_breadcrumbs', 100 ); |
|
153 | + if ('1c' === $layout && (is_author() || is_search() || (is_post_type_archive(array('post', 'page', 'jetpack-portfolio')) && ! is_post_type_archive('tribe_events')) || is_tag() || is_category() || is_date() || is_tax('post_format'))) { |
|
154 | + remove_action('lsx_content_top', 'lsx_breadcrumbs', 100); |
|
155 | 155 | } |
156 | 156 | } |
157 | -add_action( 'wp_head', 'lsx_wp_head',100 ); |
|
157 | +add_action('wp_head', 'lsx_wp_head', 100); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly |
|
2 | +if ( ! defined('ABSPATH')) return; // Exit if accessed directly |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Layout hooks |
@@ -7,15 +7,15 @@ discard block |
||
7 | 7 | * @package lsx |
8 | 8 | */ |
9 | 9 | |
10 | -function lsx_layout_selector( $class, $area = 'site' ) { |
|
10 | +function lsx_layout_selector($class, $area = 'site') { |
|
11 | 11 | |
12 | - $layout = get_theme_mod('lsx_layout','2cr'); |
|
13 | - $layout = apply_filters( 'lsx_layout', $layout ); |
|
12 | + $layout = get_theme_mod('lsx_layout', '2cr'); |
|
13 | + $layout = apply_filters('lsx_layout', $layout); |
|
14 | 14 | |
15 | 15 | $default_size = 'sm'; |
16 | - $size = apply_filters( 'lsx_bootstrap_column_size', $default_size ); |
|
16 | + $size = apply_filters('lsx_bootstrap_column_size', $default_size); |
|
17 | 17 | |
18 | - switch ( $layout ) { |
|
18 | + switch ($layout) { |
|
19 | 19 | case '1c': |
20 | 20 | $main_class = 'col-' . $size . '-12'; |
21 | 21 | $sidebar_class = 'col-' . $size . '-12'; |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | break; |
35 | 35 | } |
36 | 36 | |
37 | - if ( $class == 'main' ) { |
|
37 | + if ($class == 'main') { |
|
38 | 38 | return $main_class; |
39 | 39 | } |
40 | 40 | |
41 | - if ( $class == 'sidebar' ) { |
|
41 | + if ($class == 'sidebar') { |
|
42 | 42 | return $sidebar_class; |
43 | 43 | } |
44 | 44 | } |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | * .main classes |
48 | 48 | */ |
49 | 49 | function lsx_main_class() { |
50 | - return lsx_layout_selector( 'main' ); |
|
50 | + return lsx_layout_selector('main'); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | function lsx_home_main_class() { |
54 | - return lsx_layout_selector( 'main', 'home' ); |
|
54 | + return lsx_layout_selector('main', 'home'); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | function lsx_index_main_class() { |
61 | 61 | |
62 | 62 | $show_on_front = get_option('show_on_front'); |
63 | - if('page' == $show_on_front){ |
|
64 | - return lsx_layout_selector( 'main', 'home' ); |
|
65 | - }else{ |
|
66 | - return lsx_layout_selector( 'main', 'site' ); |
|
63 | + if ('page' == $show_on_front) { |
|
64 | + return lsx_layout_selector('main', 'home'); |
|
65 | + } else { |
|
66 | + return lsx_layout_selector('main', 'site'); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | } |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | * .sidebar classes |
73 | 73 | */ |
74 | 74 | function lsx_sidebar_class() { |
75 | - return lsx_layout_selector( 'sidebar' ); |
|
75 | + return lsx_layout_selector('sidebar'); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | function lsx_home_sidebar_class() { |
79 | - return lsx_layout_selector( 'sidebar', 'home' ); |
|
79 | + return lsx_layout_selector('sidebar', 'home'); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | $classes = 'banner navbar navbar-default'; |
92 | 92 | |
93 | 93 | //Fixed header |
94 | - $fixed_header = get_theme_mod('lsx_header_fixed',false); |
|
95 | - if(false != $fixed_header){ |
|
94 | + $fixed_header = get_theme_mod('lsx_header_fixed', false); |
|
95 | + if (false != $fixed_header) { |
|
96 | 96 | $classes .= ' navbar-static-top'; |
97 | 97 | } |
98 | 98 | |
99 | - if(false != $additional){ |
|
100 | - $classes .= ' '.$additional; |
|
99 | + if (false != $additional) { |
|
100 | + $classes .= ' ' . $additional; |
|
101 | 101 | } |
102 | 102 | echo $classes; |
103 | 103 | } |
@@ -114,37 +114,37 @@ discard block |
||
114 | 114 | $classes = 'top-menu-default'; |
115 | 115 | |
116 | 116 | //Fixed header |
117 | - $fixed_header = get_theme_mod('lsx_header_fixed',false); |
|
118 | - if(false != $fixed_header){ |
|
117 | + $fixed_header = get_theme_mod('lsx_header_fixed', false); |
|
118 | + if (false != $fixed_header) { |
|
119 | 119 | $classes .= ' top-menu-fixed'; |
120 | 120 | } |
121 | 121 | |
122 | - if(false != $additional){ |
|
123 | - $classes .= ' '.$additional; |
|
122 | + if (false != $additional) { |
|
123 | + $classes .= ' ' . $additional; |
|
124 | 124 | } |
125 | 125 | echo $classes; |
126 | 126 | } |
127 | 127 | |
128 | -add_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' ); |
|
129 | -if ( ! function_exists( 'lsx_add_footer_sidebar_area' ) ) { |
|
128 | +add_action('lsx_footer_before', 'lsx_add_footer_sidebar_area'); |
|
129 | +if ( ! function_exists('lsx_add_footer_sidebar_area')) { |
|
130 | 130 | function lsx_add_footer_sidebar_area() { |
131 | - if ( is_active_sidebar( 'sidebar-footer-cta' ) ) : ?> |
|
131 | + if (is_active_sidebar('sidebar-footer-cta')) : ?> |
|
132 | 132 | <div id="footer-cta"> |
133 | 133 | <div class="container"> |
134 | 134 | <div class="lsx-full-width"> |
135 | 135 | <div class="lsx-hero-unit"> |
136 | - <?php dynamic_sidebar( 'sidebar-footer-cta' ); ?> |
|
136 | + <?php dynamic_sidebar('sidebar-footer-cta'); ?> |
|
137 | 137 | </div> |
138 | 138 | </div> |
139 | 139 | </div> |
140 | 140 | </div> |
141 | 141 | <?php endif; ?> |
142 | 142 | |
143 | - <?php if ( is_active_sidebar( 'sidebar-footer' ) ) : ?> |
|
143 | + <?php if (is_active_sidebar('sidebar-footer')) : ?> |
|
144 | 144 | <div id="footer-widgets"> |
145 | 145 | <div class="container"> |
146 | 146 | <div class="row"> |
147 | - <?php dynamic_sidebar( 'sidebar-footer' ); ?> |
|
147 | + <?php dynamic_sidebar('sidebar-footer'); ?> |
|
148 | 148 | </div> |
149 | 149 | </div> |
150 | 150 | </div> |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | <?php |
168 | 168 | else*/if (is_singular('post')) : |
169 | 169 | $format = get_post_format(); |
170 | - if ( false === $format ) { |
|
170 | + if (false === $format) { |
|
171 | 171 | $format = 'standard'; |
172 | 172 | } |
173 | 173 | $format_link = get_post_format_link($format); |
@@ -189,14 +189,14 @@ discard block |
||
189 | 189 | elseif (is_search()) : |
190 | 190 | ?> |
191 | 191 | <header class="archive-header"> |
192 | - <h1 class="archive-title"><?php printf( __( 'Search Results for: %s', 'lsx' ), '<span>' . get_search_query() . '</span>' ); ?></h1> |
|
192 | + <h1 class="archive-title"><?php printf(__('Search Results for: %s', 'lsx'), '<span>' . get_search_query() . '</span>'); ?></h1> |
|
193 | 193 | </header> |
194 | 194 | <?php |
195 | 195 | elseif (is_author()) : |
196 | 196 | ?> |
197 | 197 | <header class="archive-header"> |
198 | 198 | <h1 class="archive-title"> |
199 | - <?php printf( __( 'Author: %s', 'lsx' ), get_the_author() ); ?> |
|
199 | + <?php printf(__('Author: %s', 'lsx'), get_the_author()); ?> |
|
200 | 200 | </h1> |
201 | 201 | |
202 | 202 | <?php if (get_the_author_meta('description')) { ?> |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | ?> |
209 | 209 | <header class="archive-header"> |
210 | 210 | <h1 class="archive-title"> |
211 | - <?php if ( has_post_format() && !is_category() && !is_tag() && !is_date() && !is_tax('post_format') ) { ?> |
|
211 | + <?php if (has_post_format() && ! is_category() && ! is_tag() && ! is_date() && ! is_tax('post_format')) { ?> |
|
212 | 212 | Type: <?php the_archive_title(); ?> |
213 | 213 | <?php } else { ?> |
214 | 214 | <?php the_archive_title(); ?> |
@@ -246,16 +246,16 @@ discard block |
||
246 | 246 | ?> |
247 | 247 | <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"> |
248 | 248 | <?php } |
249 | -add_action( 'wp_head', 'lsx_add_viewport_meta_tag' ); |
|
249 | +add_action('wp_head', 'lsx_add_viewport_meta_tag'); |
|
250 | 250 | |
251 | 251 | |
252 | 252 | /** |
253 | 253 | * Add a search form to just above the nav menu |
254 | 254 | */ |
255 | 255 | function lsx_header_search_form() { |
256 | - $search_form = get_theme_mod( 'lsx_header_search', 0 ); |
|
257 | - if($search_form || is_customize_preview()){ |
|
258 | - get_search_form( true ); |
|
256 | + $search_form = get_theme_mod('lsx_header_search', 0); |
|
257 | + if ($search_form || is_customize_preview()) { |
|
258 | + get_search_form(true); |
|
259 | 259 | } |
260 | 260 | } |
261 | -add_action( 'lsx_nav_before', 'lsx_header_search_form', 0 ); |
|
262 | 261 | \ No newline at end of file |
262 | +add_action('lsx_nav_before', 'lsx_header_search_form', 0); |
|
263 | 263 | \ No newline at end of file |
@@ -1,42 +1,42 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly |
|
2 | +if ( ! defined('ABSPATH')) return; // Exit if accessed directly |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * LSX_Customize_Font_Control Class |
6 | 6 | **/ |
7 | -if( !class_exists( 'WP_Customize_Control' ) ){ |
|
7 | +if ( ! class_exists('WP_Customize_Control')) { |
|
8 | 8 | return; |
9 | 9 | } |
10 | -class LSX_Customize_Font_Control extends WP_Customize_Control{ |
|
10 | +class LSX_Customize_Font_Control extends WP_Customize_Control { |
|
11 | 11 | public $fonts; |
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Enqueue the styles and scripts |
15 | 15 | **/ |
16 | - public function enqueue(){ |
|
16 | + public function enqueue() { |
|
17 | 17 | // styles |
18 | - wp_enqueue_style( 'lsx-font-picker-custom-control', get_template_directory_uri() .'/css/customizer-font.css'); |
|
18 | + wp_enqueue_style('lsx-font-picker-custom-control', get_template_directory_uri() . '/css/customizer-font.css'); |
|
19 | 19 | |
20 | 20 | // scripts |
21 | - wp_enqueue_script( 'lsx-font-picker-custom-control', get_template_directory_uri() .'/js/customizer-font.js'); |
|
21 | + wp_enqueue_script('lsx-font-picker-custom-control', get_template_directory_uri() . '/js/customizer-font.js'); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Render the content on the theme customizer page |
26 | 26 | **/ |
27 | - public function render_content(){ |
|
28 | - if ( empty( $this->choices ) ){ |
|
27 | + public function render_content() { |
|
28 | + if (empty($this->choices)) { |
|
29 | 29 | // if there are no choices then don't print anything |
30 | 30 | return; |
31 | 31 | } |
32 | 32 | $fonts = array(); |
33 | - foreach( $this->choices as $slug=>$font ){ |
|
33 | + foreach ($this->choices as $slug=>$font) { |
|
34 | 34 | $fonts[] = $font['header']; |
35 | 35 | $fonts[] = $font['body']; |
36 | 36 | $this->choices[$slug] = $font; |
37 | 37 | } |
38 | 38 | |
39 | - $this->fonts = new LSX_Google_Font_Collection( $fonts ); |
|
39 | + $this->fonts = new LSX_Google_Font_Collection($fonts); |
|
40 | 40 | |
41 | 41 | $fonts = $this->fonts->getFontFamilyNameArray(); |
42 | 42 | //print links to css files |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | <div class="fontPickerCustomControl"> |
52 | 52 | <select <?php $this->link(); ?>> |
53 | 53 | <?php |
54 | - foreach ( $this->choices as $value => $conf ){ |
|
55 | - echo '<option value="' . esc_attr( $value ) . '">' . $value . '</option>'; |
|
54 | + foreach ($this->choices as $value => $conf) { |
|
55 | + echo '<option value="' . esc_attr($value) . '">' . $value . '</option>'; |
|
56 | 56 | } |
57 | 57 | ?> |
58 | 58 | </select> |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | <ul> |
61 | 61 | <?php |
62 | 62 | //$cssClassArray = $this->fonts->getCssClassArray(); |
63 | - foreach ($this->choices as $key => $font){ |
|
63 | + foreach ($this->choices as $key => $font) { |
|
64 | 64 | $class = null; |
65 | - if( $key == $set_value ){ |
|
65 | + if ($key == $set_value) { |
|
66 | 66 | $class = ' selected'; |
67 | 67 | } |
68 | 68 |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | * @param mixed $setting The setting for which the sanitizing is occurring. |
18 | 18 | * @return mixed The sanitized value. |
19 | 19 | */ |
20 | -function lsx_sanitize_choices( $value, $setting ) { |
|
21 | - if ( is_object( $setting ) ) { |
|
20 | +function lsx_sanitize_choices($value, $setting) { |
|
21 | + if (is_object($setting)) { |
|
22 | 22 | $setting = $setting->id; |
23 | 23 | } |
24 | - $choices = lsx_customizer_sanitize_get_choices( $setting ); |
|
25 | - $allowed_choices = array_keys( $choices ); |
|
26 | - if ( ! in_array( $value, $allowed_choices ) ) { |
|
27 | - $value = lsx_customizer_sanitize_get_default( $setting ); |
|
24 | + $choices = lsx_customizer_sanitize_get_choices($setting); |
|
25 | + $allowed_choices = array_keys($choices); |
|
26 | + if ( ! in_array($value, $allowed_choices)) { |
|
27 | + $value = lsx_customizer_sanitize_get_default($setting); |
|
28 | 28 | } |
29 | 29 | return $value; |
30 | 30 | } |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | * @return mixed $field |
40 | 40 | */ |
41 | 41 | |
42 | -function lsx_customizer_sanitize_get_choices( $id ) { |
|
42 | +function lsx_customizer_sanitize_get_choices($id) { |
|
43 | 43 | global $lsx_customizer; |
44 | 44 | //LSX_Theme_Customizer |
45 | 45 | |
46 | 46 | $field = $lsx_customizer->get_control($id); |
47 | 47 | |
48 | - if ( isset( $field['choices'] ) ) { |
|
48 | + if (isset($field['choices'])) { |
|
49 | 49 | return $field['choices']; |
50 | 50 | } |
51 | 51 | |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | * @return mixed $default |
62 | 62 | */ |
63 | 63 | |
64 | -function lsx_customizer_sanitize_get_default( $id ) { |
|
64 | +function lsx_customizer_sanitize_get_default($id) { |
|
65 | 65 | global $lsx_customizer; |
66 | 66 | //LSX_Theme_Customizer |
67 | 67 | |
68 | 68 | $setting = $lsx_customizer->get_setting($id); |
69 | 69 | |
70 | - if ( isset( $setting['default'] ) ) { |
|
70 | + if (isset($setting['default'])) { |
|
71 | 71 | return $setting['default']; |
72 | 72 | } |
73 | 73 | } |
@@ -82,12 +82,12 @@ discard block |
||
82 | 82 | * @param obj $setting |
83 | 83 | * @return string $default |
84 | 84 | */ |
85 | -function lsx_sanitize_email( $email, $setting ) { |
|
85 | +function lsx_sanitize_email($email, $setting) { |
|
86 | 86 | // Sanitize $input as a hex value without the hash prefix. |
87 | - $email = sanitize_email( $email ); |
|
87 | + $email = sanitize_email($email); |
|
88 | 88 | |
89 | 89 | // If $email is a valid email, return it; otherwise, return the default. |
90 | - return ( ! is_null( $email ) ? $email : $setting->default ); |
|
90 | + return ( ! is_null($email) ? $email : $setting->default); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | * @param array $input |
100 | 100 | * @return array $output |
101 | 101 | */ |
102 | -function lsx_sanitize_checkbox( $input ) { |
|
103 | - if ( $input ) { |
|
102 | +function lsx_sanitize_checkbox($input) { |
|
103 | + if ($input) { |
|
104 | 104 | $output = '1'; |
105 | 105 | } else { |
106 | 106 | $output = false; |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly |
|
2 | +if ( ! defined('ABSPATH')) return; // Exit if accessed directly |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Customize Swatch Control Class |
6 | 6 | * |
7 | 7 | * @since 1.0.0 |
8 | 8 | */ |
9 | -if( !class_exists( 'WP_Customize_Control' ) ){ |
|
9 | +if ( ! class_exists('WP_Customize_Control')) { |
|
10 | 10 | return; |
11 | 11 | } |
12 | 12 | class LSX_Customize_Core_Control extends WP_Customize_Control { |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | public function render_content() { |
23 | 23 | ?> |
24 | 24 | <label> |
25 | - <?php if ( ! empty( $this->label ) ) { ?> |
|
26 | - <span class="customize-control-title"><?php echo esc_html( $this->label ) ?></span> |
|
25 | + <?php if ( ! empty($this->label)) { ?> |
|
26 | + <span class="customize-control-title"><?php echo esc_html($this->label) ?></span> |
|
27 | 27 | <?php } |
28 | - if ( ! empty( $this->description ) ) { ?> |
|
28 | + if ( ! empty($this->description)) { ?> |
|
29 | 29 | <span class="description customize-control-description"><?php echo $this->description ?></span> |
30 | 30 | <?php } ?> |
31 | - <input <?php $this->link() ?> type="checkbox" value="<?php echo esc_attr( $this->value() ) ?>" <?php $this->input_attrs() ?>> |
|
31 | + <input <?php $this->link() ?> type="checkbox" value="<?php echo esc_attr($this->value()) ?>" <?php $this->input_attrs() ?>> |
|
32 | 32 | </label> |
33 | 33 | <?php |
34 | 34 | } |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function lsx_allowed_related_post_types($allowed_post_types) { |
21 | 21 | $allowed_post_types[] = 'jetpack-portfolio'; |
22 | - foreach($allowed_post_types as $key => $value){ |
|
23 | - if('page' == $value){ |
|
22 | + foreach ($allowed_post_types as $key => $value) { |
|
23 | + if ('page' == $value) { |
|
24 | 24 | unset($allowed_post_types[$key]); |
25 | 25 | } |
26 | 26 | } |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | * @category site-logo |
36 | 36 | */ |
37 | 37 | |
38 | -function lsx_site_logo_title_tag( $html) { |
|
38 | +function lsx_site_logo_title_tag($html) { |
|
39 | 39 | |
40 | - $html = str_replace('<a', '<a title="'.get_bloginfo('name').'" ', $html); |
|
40 | + $html = str_replace('<a', '<a title="' . get_bloginfo('name') . '" ', $html); |
|
41 | 41 | return $html; |
42 | 42 | } |
43 | -add_filter( 'jetpack_the_site_logo', 'lsx_site_logo_title_tag'); |
|
43 | +add_filter('jetpack_the_site_logo', 'lsx_site_logo_title_tag'); |
|
44 | 44 | |
45 | 45 | |
46 | 46 | /* |
@@ -54,19 +54,19 @@ discard block |
||
54 | 54 | * @subpackage jetpack |
55 | 55 | * @category portfolio |
56 | 56 | */ |
57 | -function lsx_portfolio_infinite_scroll(){ |
|
58 | - global $_wp_theme_features,$wp_query; |
|
57 | +function lsx_portfolio_infinite_scroll() { |
|
58 | + global $_wp_theme_features, $wp_query; |
|
59 | 59 | |
60 | - if(is_post_type_archive('jetpack-portfolio') || is_tax('jetpack-portfolio-type') || is_tax('jetpack-portfolio-tag')){ |
|
60 | + if (is_post_type_archive('jetpack-portfolio') || is_tax('jetpack-portfolio-type') || is_tax('jetpack-portfolio-tag')) { |
|
61 | 61 | |
62 | - if(class_exists('The_Neverending_Home_Page')){ |
|
62 | + if (class_exists('The_Neverending_Home_Page')) { |
|
63 | 63 | $_wp_theme_features['infinite-scroll'][0]['container'] = 'portfolio-infinite-scroll-wrapper'; |
64 | 64 | $_wp_theme_features['infinite-scroll'][0]['posts_per_page'] = -1; |
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | 68 | } |
69 | -add_action('wp_head','lsx_portfolio_infinite_scroll',1000); |
|
69 | +add_action('wp_head', 'lsx_portfolio_infinite_scroll', 1000); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Disables the infinite scroll on the portfolio archive |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | * @subpackage jetpack |
76 | 76 | * @category portfolio |
77 | 77 | */ |
78 | -function lsx_portfolio_infinite_scroll_disable($supported){ |
|
79 | - if(is_post_type_archive('jetpack-portfolio')){ |
|
78 | +function lsx_portfolio_infinite_scroll_disable($supported) { |
|
79 | + if (is_post_type_archive('jetpack-portfolio')) { |
|
80 | 80 | $supported = false; |
81 | 81 | } |
82 | 82 | return $supported; |
83 | 83 | } |
84 | -add_filter( 'infinite_scroll_archive_supported', 'lsx_portfolio_infinite_scroll_disable' , 1 , 10 ); |
|
84 | +add_filter('infinite_scroll_archive_supported', 'lsx_portfolio_infinite_scroll_disable', 1, 10); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Set the Portfolio to 9 posts per page |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | * @subpackage jetpack |
91 | 91 | * @category portfolio |
92 | 92 | */ |
93 | -function lsx_portfolio_archive_pagination( $query ) { |
|
94 | - if(!is_admin()){ |
|
95 | - if ( $query->is_post_type_archive(array('jetpack-portfolio')) && $query->is_main_query() && class_exists('The_Neverending_Home_Page')) { |
|
96 | - $query->set( 'posts_per_page', -1 ); |
|
93 | +function lsx_portfolio_archive_pagination($query) { |
|
94 | + if ( ! is_admin()) { |
|
95 | + if ($query->is_post_type_archive(array('jetpack-portfolio')) && $query->is_main_query() && class_exists('The_Neverending_Home_Page')) { |
|
96 | + $query->set('posts_per_page', -1); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | } |
100 | -add_action( 'pre_get_posts', 'lsx_portfolio_archive_pagination' , 100 ); |
|
100 | +add_action('pre_get_posts', 'lsx_portfolio_archive_pagination', 100); |
|
101 | 101 | |
102 | 102 | /** |
103 | 103 | * Remove the related posts from below the content area. |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | * @category portfolio |
108 | 108 | */ |
109 | 109 | function lsx_remove_portfolio_related_posts() { |
110 | - if ( is_single() && 'jetpack-portfolio' == get_post_type() && class_exists( 'Jetpack_RelatedPosts' ) ) { |
|
110 | + if (is_single() && 'jetpack-portfolio' == get_post_type() && class_exists('Jetpack_RelatedPosts')) { |
|
111 | 111 | $jprp = Jetpack_RelatedPosts::init(); |
112 | - $callback = array( $jprp, 'filter_add_target_to_dom' ); |
|
113 | - remove_filter( 'the_content', $callback, 40 ); |
|
112 | + $callback = array($jprp, 'filter_add_target_to_dom'); |
|
113 | + remove_filter('the_content', $callback, 40); |
|
114 | 114 | } |
115 | 115 | } |
116 | -add_filter( 'wp', 'lsx_remove_portfolio_related_posts', 20 ); |
|
116 | +add_filter('wp', 'lsx_remove_portfolio_related_posts', 20); |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Remove the related posts from below the content area. |
@@ -123,13 +123,13 @@ discard block |
||
123 | 123 | * @category portfolio |
124 | 124 | */ |
125 | 125 | function lsx_remove_single_related_posts() { |
126 | - if ( is_single() && class_exists( 'Jetpack_RelatedPosts' ) ) { |
|
126 | + if (is_single() && class_exists('Jetpack_RelatedPosts')) { |
|
127 | 127 | $jprp = Jetpack_RelatedPosts::init(); |
128 | - $callback = array( $jprp, 'filter_add_target_to_dom' ); |
|
129 | - remove_filter( 'the_content', $callback, 40 ); |
|
128 | + $callback = array($jprp, 'filter_add_target_to_dom'); |
|
129 | + remove_filter('the_content', $callback, 40); |
|
130 | 130 | } |
131 | 131 | } |
132 | -add_filter( 'wp', 'lsx_remove_single_related_posts', 20 ); |
|
132 | +add_filter('wp', 'lsx_remove_single_related_posts', 20); |
|
133 | 133 | |
134 | 134 | /** |
135 | 135 | * A template tag to call the Portfolios Related posts |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | * @subpackage jetpack |
139 | 139 | * @category portfolio |
140 | 140 | */ |
141 | -function lsx_portfolio_related_posts(){ |
|
142 | - if(class_exists('Jetpack_RelatedPosts')){ ?> |
|
141 | +function lsx_portfolio_related_posts() { |
|
142 | + if (class_exists('Jetpack_RelatedPosts')) { ?> |
|
143 | 143 | <div class="row"> |
144 | 144 | <div class="col-md-12"> |
145 | 145 | <?php echo do_shortcode('[jetpack-related-posts]'); ?> |
@@ -156,16 +156,16 @@ discard block |
||
156 | 156 | * @category portfolio |
157 | 157 | */ |
158 | 158 | function lsx_portfolio_remove_share() { |
159 | - if ( ( is_single() && 'jetpack-portfolio' == get_post_type() ) || is_page_template( 'page-templates/template-portfolio.php' ) ) { |
|
160 | - remove_filter( 'the_content', 'sharing_display',19 ); |
|
161 | - remove_filter( 'the_excerpt', 'sharing_display',19 ); |
|
159 | + if ((is_single() && 'jetpack-portfolio' == get_post_type()) || is_page_template('page-templates/template-portfolio.php')) { |
|
160 | + remove_filter('the_content', 'sharing_display', 19); |
|
161 | + remove_filter('the_excerpt', 'sharing_display', 19); |
|
162 | 162 | |
163 | - if ( class_exists( 'Jetpack_Likes' ) ) { |
|
164 | - remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 ); |
|
163 | + if (class_exists('Jetpack_Likes')) { |
|
164 | + remove_filter('the_content', array(Jetpack_Likes::init(), 'post_likes'), 30, 1); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
168 | -add_action( 'loop_start', 'lsx_portfolio_remove_share' ); |
|
168 | +add_action('loop_start', 'lsx_portfolio_remove_share'); |
|
169 | 169 | |
170 | 170 | /** |
171 | 171 | * Remove the sharing from single |
@@ -175,16 +175,16 @@ discard block |
||
175 | 175 | * @category post |
176 | 176 | */ |
177 | 177 | function lsx_single_remove_share() { |
178 | - if ( is_single() ) { |
|
179 | - remove_filter( 'the_content', 'sharing_display',19 ); |
|
180 | - remove_filter( 'the_excerpt', 'sharing_display',19 ); |
|
178 | + if (is_single()) { |
|
179 | + remove_filter('the_content', 'sharing_display', 19); |
|
180 | + remove_filter('the_excerpt', 'sharing_display', 19); |
|
181 | 181 | |
182 | - if ( class_exists( 'Jetpack_Likes' ) ) { |
|
183 | - remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 ); |
|
182 | + if (class_exists('Jetpack_Likes')) { |
|
183 | + remove_filter('the_content', array(Jetpack_Likes::init(), 'post_likes'), 30, 1); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
187 | -add_action( 'loop_start', 'lsx_single_remove_share' ); |
|
187 | +add_action('loop_start', 'lsx_single_remove_share'); |
|
188 | 188 | |
189 | 189 | /** |
190 | 190 | * Redirect the template archive to our one |
@@ -193,18 +193,18 @@ discard block |
||
193 | 193 | * @subpackage jetpack |
194 | 194 | * @category portfolio |
195 | 195 | */ |
196 | -function lsx_portfolio_taxonomy_template( $template ) { |
|
196 | +function lsx_portfolio_taxonomy_template($template) { |
|
197 | 197 | |
198 | - if ( is_tax(array('jetpack-portfolio-type','jetpack-portfolio-tag')) ) { |
|
199 | - $new_template = locate_template( array( 'archive-jetpack-portfolio.php' ) ); |
|
200 | - if ( '' != $new_template ) { |
|
201 | - return $new_template ; |
|
198 | + if (is_tax(array('jetpack-portfolio-type', 'jetpack-portfolio-tag'))) { |
|
199 | + $new_template = locate_template(array('archive-jetpack-portfolio.php')); |
|
200 | + if ('' != $new_template) { |
|
201 | + return $new_template; |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
205 | 205 | return $template; |
206 | 206 | } |
207 | -add_filter( 'template_include', 'lsx_portfolio_taxonomy_template', 99 ); |
|
207 | +add_filter('template_include', 'lsx_portfolio_taxonomy_template', 99); |
|
208 | 208 | |
209 | 209 | |
210 | 210 | /** |
@@ -214,38 +214,38 @@ discard block |
||
214 | 214 | * @subpackage jetpack |
215 | 215 | * @category portfolio |
216 | 216 | */ |
217 | -add_action( 'add_meta_boxes', 'lsx_add_portfolio_post_meta_boxes' ); |
|
218 | -add_action( 'save_post', 'lsx_save_portfolio_post_meta', 100, 2 ); |
|
217 | +add_action('add_meta_boxes', 'lsx_add_portfolio_post_meta_boxes'); |
|
218 | +add_action('save_post', 'lsx_save_portfolio_post_meta', 100, 2); |
|
219 | 219 | |
220 | -function lsx_save_portfolio_post_meta( $post_id, $post ) { |
|
220 | +function lsx_save_portfolio_post_meta($post_id, $post) { |
|
221 | 221 | |
222 | 222 | |
223 | - if ( (!isset( $_POST['lsx_website_nonce'] ) || !wp_verify_nonce( $_POST['lsx_website_nonce'], basename( __FILE__ ) )) |
|
224 | - || (!isset( $_POST['lsx_client_nonce'] ) || !wp_verify_nonce( $_POST['lsx_client_nonce'], basename( __FILE__ ) )) ) |
|
223 | + if (( ! isset($_POST['lsx_website_nonce']) || ! wp_verify_nonce($_POST['lsx_website_nonce'], basename(__FILE__))) |
|
224 | + || ( ! isset($_POST['lsx_client_nonce']) || ! wp_verify_nonce($_POST['lsx_client_nonce'], basename(__FILE__)))) |
|
225 | 225 | return $post_id; |
226 | 226 | |
227 | - $post_type = get_post_type_object( $post->post_type ); |
|
227 | + $post_type = get_post_type_object($post->post_type); |
|
228 | 228 | |
229 | - if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) |
|
229 | + if ( ! current_user_can($post_type->cap->edit_post, $post_id)) |
|
230 | 230 | return $post_id; |
231 | 231 | |
232 | 232 | |
233 | - $meta_keys = array('lsx-website','lsx-client'); |
|
233 | + $meta_keys = array('lsx-website', 'lsx-client'); |
|
234 | 234 | |
235 | - foreach($meta_keys as $meta_key){ |
|
235 | + foreach ($meta_keys as $meta_key) { |
|
236 | 236 | |
237 | - $new_meta_value = ( isset( $_POST[$meta_key] ) ? sanitize_text_field($_POST[$meta_key]) : '' ); |
|
237 | + $new_meta_value = (isset($_POST[$meta_key]) ? sanitize_text_field($_POST[$meta_key]) : ''); |
|
238 | 238 | |
239 | - $meta_value = get_post_meta( $post_id, $meta_key, true ); |
|
239 | + $meta_value = get_post_meta($post_id, $meta_key, true); |
|
240 | 240 | |
241 | - if ( $new_meta_value && '' == $meta_value ) |
|
242 | - add_post_meta( $post_id, $meta_key, $new_meta_value, true ); |
|
241 | + if ($new_meta_value && '' == $meta_value) |
|
242 | + add_post_meta($post_id, $meta_key, $new_meta_value, true); |
|
243 | 243 | |
244 | - elseif ( $new_meta_value && $new_meta_value != $meta_value ) |
|
245 | - update_post_meta( $post_id, $meta_key, $new_meta_value ); |
|
244 | + elseif ($new_meta_value && $new_meta_value != $meta_value) |
|
245 | + update_post_meta($post_id, $meta_key, $new_meta_value); |
|
246 | 246 | |
247 | - elseif ( '' == $new_meta_value && $meta_value ) |
|
248 | - delete_post_meta( $post_id, $meta_key, $meta_value ); |
|
247 | + elseif ('' == $new_meta_value && $meta_value) |
|
248 | + delete_post_meta($post_id, $meta_key, $meta_value); |
|
249 | 249 | |
250 | 250 | } |
251 | 251 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | |
255 | 255 | add_meta_box( |
256 | 256 | 'lsx_client_meta_box', |
257 | - esc_html__( 'Client', 'lsx' ), |
|
257 | + esc_html__('Client', 'lsx'), |
|
258 | 258 | 'lsx_client_meta_box', |
259 | 259 | 'jetpack-portfolio', |
260 | 260 | 'side', |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | |
264 | 264 | add_meta_box( |
265 | 265 | 'lsx_website_meta_box', |
266 | - esc_html__( 'Website', 'lsx' ), |
|
266 | + esc_html__('Website', 'lsx'), |
|
267 | 267 | 'lsx_website_meta_box', |
268 | 268 | 'jetpack-portfolio', |
269 | 269 | 'side', |
@@ -271,25 +271,25 @@ discard block |
||
271 | 271 | ); |
272 | 272 | } |
273 | 273 | |
274 | -function lsx_client_meta_box( $object, $box ) { ?> |
|
274 | +function lsx_client_meta_box($object, $box) { ?> |
|
275 | 275 | |
276 | - <?php wp_nonce_field( basename( __FILE__ ), 'lsx_client_nonce' ); ?> |
|
276 | + <?php wp_nonce_field(basename(__FILE__), 'lsx_client_nonce'); ?> |
|
277 | 277 | |
278 | 278 | <p> |
279 | - <input class="widefat" type="text" name="lsx-client" id="lsx-client" value="<?php echo esc_attr( get_post_meta( $object->ID, 'lsx-client', true ) ); ?>" size="30" /> |
|
279 | + <input class="widefat" type="text" name="lsx-client" id="lsx-client" value="<?php echo esc_attr(get_post_meta($object->ID, 'lsx-client', true)); ?>" size="30" /> |
|
280 | 280 | <br /><br /> |
281 | - <label for="lsx-client"><?php _e( "Enter the name of the project client", 'lsx' ); ?></label> |
|
281 | + <label for="lsx-client"><?php _e("Enter the name of the project client", 'lsx'); ?></label> |
|
282 | 282 | </p> |
283 | 283 | <?php } |
284 | 284 | |
285 | -function lsx_website_meta_box( $object, $box ) { ?> |
|
285 | +function lsx_website_meta_box($object, $box) { ?> |
|
286 | 286 | |
287 | - <?php wp_nonce_field( basename( __FILE__ ), 'lsx_website_nonce' ); ?> |
|
287 | + <?php wp_nonce_field(basename(__FILE__), 'lsx_website_nonce'); ?> |
|
288 | 288 | |
289 | 289 | <p> |
290 | - <input class="widefat" type="text" name="lsx-website" id="lsx-website" value="<?php echo esc_attr( get_post_meta( $object->ID, 'lsx-website', true ) ); ?>" size="30" /> |
|
290 | + <input class="widefat" type="text" name="lsx-website" id="lsx-website" value="<?php echo esc_attr(get_post_meta($object->ID, 'lsx-website', true)); ?>" size="30" /> |
|
291 | 291 | <br /><br /> |
292 | - <label for="lsx-website"><?php _e( "Enter the URL of the project website", 'lsx' ); ?></label> |
|
292 | + <label for="lsx-website"><?php _e("Enter the URL of the project website", 'lsx'); ?></label> |
|
293 | 293 | </p> |
294 | 294 | <?php } |
295 | 295 | |
@@ -302,15 +302,15 @@ discard block |
||
302 | 302 | * @category portfolio |
303 | 303 | */ |
304 | 304 | |
305 | -function lsx_portfolio_sorter(){ ?> |
|
305 | +function lsx_portfolio_sorter() { ?> |
|
306 | 306 | <ul id="filterNav" class="clearfix"> |
307 | 307 | <li class="allBtn"><a href="#" data-filter="*" class="selected"><?php _e('All', 'lsx'); ?></a></li> |
308 | 308 | <?php |
309 | 309 | $types = get_terms('jetpack-portfolio-type'); |
310 | 310 | |
311 | - if(is_array($types)){ |
|
311 | + if (is_array($types)) { |
|
312 | 312 | foreach ($types as $type) { |
313 | - $content = '<li><a href="#" data-filter=".'.$type->slug.'">'; |
|
313 | + $content = '<li><a href="#" data-filter=".' . $type->slug . '">'; |
|
314 | 314 | $content .= $type->name; |
315 | 315 | $content .= '</a></li>'; |
316 | 316 | echo $content; |
@@ -328,18 +328,18 @@ discard block |
||
328 | 328 | * @category portfolio |
329 | 329 | */ |
330 | 330 | |
331 | -function lsx_portfolio_naviagtion_labels($labels){ |
|
331 | +function lsx_portfolio_naviagtion_labels($labels) { |
|
332 | 332 | |
333 | - if(is_post_type_archive('jetpack-portfolio')){ |
|
333 | + if (is_post_type_archive('jetpack-portfolio')) { |
|
334 | 334 | $labels = array( |
335 | - 'next' => '<span class="meta-nav">←</span> '.__( 'Older', 'lsx' ), |
|
336 | - 'previous' => __( 'Newer', 'lsx' ).' <span class="meta-nav">→</span>', |
|
337 | - 'title' => __( 'Portfolio navigation', 'lsx' ) |
|
335 | + 'next' => '<span class="meta-nav">←</span> ' . __('Older', 'lsx'), |
|
336 | + 'previous' => __('Newer', 'lsx') . ' <span class="meta-nav">→</span>', |
|
337 | + 'title' => __('Portfolio navigation', 'lsx') |
|
338 | 338 | ); |
339 | 339 | } |
340 | 340 | return $labels; |
341 | 341 | } |
342 | -add_filter('lsx_post_navigation_labels','lsx_portfolio_naviagtion_labels',1,10); |
|
342 | +add_filter('lsx_post_navigation_labels', 'lsx_portfolio_naviagtion_labels', 1, 10); |
|
343 | 343 | |
344 | 344 | |
345 | 345 | /* |
@@ -353,11 +353,11 @@ discard block |
||
353 | 353 | * @subpackage jetpack |
354 | 354 | * @category related-posts |
355 | 355 | */ |
356 | -function lsx_remove_related_post_context(){ |
|
357 | - add_filter( 'jetpack_relatedposts_filter_post_context', '__return_empty_string' ); |
|
358 | - add_filter( 'rest_api_allowed_post_types', 'lsx_allowed_related_post_types' ); |
|
356 | +function lsx_remove_related_post_context() { |
|
357 | + add_filter('jetpack_relatedposts_filter_post_context', '__return_empty_string'); |
|
358 | + add_filter('rest_api_allowed_post_types', 'lsx_allowed_related_post_types'); |
|
359 | 359 | } |
360 | -add_action('init','lsx_remove_related_post_context',20); |
|
360 | +add_action('init', 'lsx_remove_related_post_context', 20); |
|
361 | 361 | |
362 | 362 | |
363 | 363 | /* |
@@ -374,13 +374,13 @@ discard block |
||
374 | 374 | $infinite_scroll_args = array( |
375 | 375 | 'container' => 'main', |
376 | 376 | 'type' => 'click', |
377 | - 'posts_per_page' => get_option('posts_per_page',10), |
|
377 | + 'posts_per_page' => get_option('posts_per_page', 10), |
|
378 | 378 | 'render' => 'lsx_infinite_scroll_render' |
379 | 379 | ); |
380 | 380 | |
381 | - add_theme_support( 'infinite-scroll', $infinite_scroll_args ); |
|
381 | + add_theme_support('infinite-scroll', $infinite_scroll_args); |
|
382 | 382 | } |
383 | -add_action( 'after_setup_theme', 'lsx_jetpack_infinite_scroll_after_setup' ); |
|
383 | +add_action('after_setup_theme', 'lsx_jetpack_infinite_scroll_after_setup'); |
|
384 | 384 | |
385 | 385 | /** |
386 | 386 | * Set the code to be rendered on for calling posts, |
@@ -393,13 +393,13 @@ discard block |
||
393 | 393 | function lsx_infinite_scroll_render() { |
394 | 394 | global $wp_query; |
395 | 395 | |
396 | - while(have_posts()){ |
|
396 | + while (have_posts()) { |
|
397 | 397 | the_post(); |
398 | 398 | |
399 | - if('jetpack-portfolio' == get_post_type()){ |
|
400 | - get_template_part( 'content', 'portfolio' ); |
|
401 | - }else{ |
|
402 | - get_template_part( 'content', get_post_type() ); |
|
399 | + if ('jetpack-portfolio' == get_post_type()) { |
|
400 | + get_template_part('content', 'portfolio'); |
|
401 | + } else { |
|
402 | + get_template_part('content', get_post_type()); |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | } |
@@ -411,8 +411,8 @@ discard block |
||
411 | 411 | * @subpackage jetpack |
412 | 412 | * @category related posts |
413 | 413 | */ |
414 | -function lsx_related_posts_headline( $headline ) { |
|
415 | - $headline = sprintf( '<h3 class="jp-relatedposts-headline"><em>%s</em></h3>', esc_html( 'Related Posts' ) ); |
|
414 | +function lsx_related_posts_headline($headline) { |
|
415 | + $headline = sprintf('<h3 class="jp-relatedposts-headline"><em>%s</em></h3>', esc_html('Related Posts')); |
|
416 | 416 | return $headline; |
417 | 417 | } |
418 | -add_filter( 'jetpack_relatedposts_filter_headline', 'lsx_related_posts_headline' ); |
|
418 | +add_filter('jetpack_relatedposts_filter_headline', 'lsx_related_posts_headline'); |
@@ -1,77 +1,77 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly |
|
2 | +if ( ! defined('ABSPATH')) return; // Exit if accessed directly |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Filter: lsx_customizer_colour_names |
6 | 6 | * |
7 | 7 | * Add two new colors (test) in main array of colors |
8 | 8 | */ |
9 | -function test_lsx_customizer_colour_names( $array ) { |
|
10 | - $array['test_text_color'] = esc_html__( 'TEST: Text', 'lsx' ); |
|
11 | - $array['test_text_color_hover'] = esc_html__( 'TEST: Text (hover)', 'lsx' ); |
|
9 | +function test_lsx_customizer_colour_names($array) { |
|
10 | + $array['test_text_color'] = esc_html__('TEST: Text', 'lsx'); |
|
11 | + $array['test_text_color_hover'] = esc_html__('TEST: Text (hover)', 'lsx'); |
|
12 | 12 | return $array; |
13 | 13 | } |
14 | -add_filter( 'lsx_customizer_colour_names', 'test_lsx_customizer_colour_names' ); |
|
14 | +add_filter('lsx_customizer_colour_names', 'test_lsx_customizer_colour_names'); |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * Filter: lsx_customizer_colour_choices_default |
18 | 18 | * |
19 | 19 | * Add the new colors (test) in default scheme |
20 | 20 | */ |
21 | -function test_lsx_customizer_colour_choices_default( $array ) { |
|
21 | +function test_lsx_customizer_colour_choices_default($array) { |
|
22 | 22 | $array[] = '#ddddd1'; |
23 | 23 | $array[] = '#eeeee1'; |
24 | 24 | return $array; |
25 | 25 | } |
26 | -add_filter( 'lsx_customizer_colour_choices_default', 'test_lsx_customizer_colour_choices_default' ); |
|
26 | +add_filter('lsx_customizer_colour_choices_default', 'test_lsx_customizer_colour_choices_default'); |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Filter: lsx_customizer_colour_choices_red |
30 | 30 | * |
31 | 31 | * Add the new colors (test) in red scheme |
32 | 32 | */ |
33 | -function test_lsx_customizer_colour_choices_red( $array ) { |
|
33 | +function test_lsx_customizer_colour_choices_red($array) { |
|
34 | 34 | $array[] = '#ddddd2'; |
35 | 35 | $array[] = '#eeeee2'; |
36 | 36 | return $array; |
37 | 37 | } |
38 | -add_filter( 'lsx_customizer_colour_choices_red', 'test_lsx_customizer_colour_choices_red' ); |
|
38 | +add_filter('lsx_customizer_colour_choices_red', 'test_lsx_customizer_colour_choices_red'); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Filter: lsx_customizer_colour_choices_orange |
42 | 42 | * |
43 | 43 | * Add the new colors (test) in orange scheme |
44 | 44 | */ |
45 | -function test_lsx_customizer_colour_choices_orange( $array ) { |
|
45 | +function test_lsx_customizer_colour_choices_orange($array) { |
|
46 | 46 | $array[] = '#ddddd3'; |
47 | 47 | $array[] = '#eeeee3'; |
48 | 48 | return $array; |
49 | 49 | } |
50 | -add_filter( 'lsx_customizer_colour_choices_orange', 'test_lsx_customizer_colour_choices_orange' ); |
|
50 | +add_filter('lsx_customizer_colour_choices_orange', 'test_lsx_customizer_colour_choices_orange'); |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Filter: lsx_customizer_colour_choices_green |
54 | 54 | * |
55 | 55 | * Add the new colors (test) in green scheme |
56 | 56 | */ |
57 | -function test_lsx_customizer_colour_choices_green( $array ) { |
|
57 | +function test_lsx_customizer_colour_choices_green($array) { |
|
58 | 58 | $array[] = '#ddddd4'; |
59 | 59 | $array[] = '#eeeee4'; |
60 | 60 | return $array; |
61 | 61 | } |
62 | -add_filter( 'lsx_customizer_colour_choices_green', 'test_lsx_customizer_colour_choices_green' ); |
|
62 | +add_filter('lsx_customizer_colour_choices_green', 'test_lsx_customizer_colour_choices_green'); |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * Filter: lsx_customizer_colour_choices_brown |
66 | 66 | * |
67 | 67 | * Add the new colors (test) in brown scheme |
68 | 68 | */ |
69 | -function test_lsx_customizer_colour_choices_brown( $array ) { |
|
69 | +function test_lsx_customizer_colour_choices_brown($array) { |
|
70 | 70 | $array[] = '#ddddd5'; |
71 | 71 | $array[] = '#eeeee5'; |
72 | 72 | return $array; |
73 | 73 | } |
74 | -add_filter( 'lsx_customizer_colour_choices_brown', 'test_lsx_customizer_colour_choices_brown' ); |
|
74 | +add_filter('lsx_customizer_colour_choices_brown', 'test_lsx_customizer_colour_choices_brown'); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Filter: lsx_customizer_colour_choices |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * Add a new scheme |
80 | 80 | * Also add the new colors (test) in new scheme |
81 | 81 | */ |
82 | -function test_lsx_customizer_colour_choices( $array ) { |
|
82 | +function test_lsx_customizer_colour_choices($array) { |
|
83 | 83 | $array['test'] = array( |
84 | - 'label' => __( 'Test', 'lsx' ), |
|
84 | + 'label' => __('Test', 'lsx'), |
|
85 | 85 | 'colors' => array( |
86 | 86 | // Button |
87 | 87 | '#428bca', '#2a6496', '#ffffff', '#ffffff', |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | |
111 | 111 | return $array; |
112 | 112 | } |
113 | -add_filter( 'lsx_customizer_colour_choices', 'test_lsx_customizer_colour_choices' ); |
|
113 | +add_filter('lsx_customizer_colour_choices', 'test_lsx_customizer_colour_choices'); |
|
114 | 114 | |
115 | 115 | /** |
116 | 116 | * Filter: lsx_customizer_colour_selectors_button |
117 | 117 | * |
118 | 118 | * Add new selectors in "button" group of colours |
119 | 119 | */ |
120 | -function test_lsx_customizer_colour_selectors_button( $css, $colors ) { |
|
120 | +function test_lsx_customizer_colour_selectors_button($css, $colors) { |
|
121 | 121 | $css .= <<<CSS |
122 | 122 | |
123 | 123 | /* Button TEST */ |
@@ -132,14 +132,14 @@ discard block |
||
132 | 132 | |
133 | 133 | return $css; |
134 | 134 | } |
135 | -add_filter( 'lsx_customizer_colour_selectors_button', 'test_lsx_customizer_colour_selectors_button', 10, 2 ); |
|
135 | +add_filter('lsx_customizer_colour_selectors_button', 'test_lsx_customizer_colour_selectors_button', 10, 2); |
|
136 | 136 | |
137 | 137 | /** |
138 | 138 | * Filter: lsx_customizer_colour_selectors_button_cta |
139 | 139 | * |
140 | 140 | * Add new selectors in "button cta" group of colours |
141 | 141 | */ |
142 | -function test_lsx_customizer_colour_selectors_button_cta( $css, $colors ) { |
|
142 | +function test_lsx_customizer_colour_selectors_button_cta($css, $colors) { |
|
143 | 143 | $css .= <<<CSS |
144 | 144 | |
145 | 145 | /* Button CTA TEST */ |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | |
155 | 155 | return $css; |
156 | 156 | } |
157 | -add_filter( 'lsx_customizer_colour_selectors_button_cta', 'test_lsx_customizer_colour_selectors_button_cta', 10, 2 ); |
|
157 | +add_filter('lsx_customizer_colour_selectors_button_cta', 'test_lsx_customizer_colour_selectors_button_cta', 10, 2); |
|
158 | 158 | |
159 | 159 | /** |
160 | 160 | * Filter: lsx_customizer_colour_selectors_top_menu |
161 | 161 | * |
162 | 162 | * Add new selectors in "top menu" group of colours |
163 | 163 | */ |
164 | -function test_lsx_customizer_colour_selectors_top_menu( $css, $colors ) { |
|
164 | +function test_lsx_customizer_colour_selectors_top_menu($css, $colors) { |
|
165 | 165 | $css .= <<<CSS |
166 | 166 | |
167 | 167 | /* Top Menu TEST */ |
@@ -175,14 +175,14 @@ discard block |
||
175 | 175 | |
176 | 176 | return $css; |
177 | 177 | } |
178 | -add_filter( 'lsx_customizer_colour_selectors_top_menu', 'test_lsx_customizer_colour_selectors_top_menu', 10, 2 ); |
|
178 | +add_filter('lsx_customizer_colour_selectors_top_menu', 'test_lsx_customizer_colour_selectors_top_menu', 10, 2); |
|
179 | 179 | |
180 | 180 | /** |
181 | 181 | * Filter: lsx_customizer_colour_selectors_header |
182 | 182 | * |
183 | 183 | * Add new selectors in "header" group of colours |
184 | 184 | */ |
185 | -function test_lsx_customizer_colour_selectors_header( $css, $colors ) { |
|
185 | +function test_lsx_customizer_colour_selectors_header($css, $colors) { |
|
186 | 186 | $css .= <<<CSS |
187 | 187 | |
188 | 188 | /* Header TEST */ |
@@ -197,14 +197,14 @@ discard block |
||
197 | 197 | |
198 | 198 | return $css; |
199 | 199 | } |
200 | -add_filter( 'lsx_customizer_colour_selectors_header', 'test_lsx_customizer_colour_selectors_header', 10, 2 ); |
|
200 | +add_filter('lsx_customizer_colour_selectors_header', 'test_lsx_customizer_colour_selectors_header', 10, 2); |
|
201 | 201 | |
202 | 202 | /** |
203 | 203 | * Filter: lsx_customizer_colour_selectors_main_menu |
204 | 204 | * |
205 | 205 | * Add new selectors in "main meun" group of colours |
206 | 206 | */ |
207 | -function test_lsx_customizer_colour_selectors_main_menu( $css, $colors ) { |
|
207 | +function test_lsx_customizer_colour_selectors_main_menu($css, $colors) { |
|
208 | 208 | $css .= <<<CSS |
209 | 209 | |
210 | 210 | /* Main Menu TEST */ |
@@ -220,14 +220,14 @@ discard block |
||
220 | 220 | |
221 | 221 | return $css; |
222 | 222 | } |
223 | -add_filter( 'lsx_customizer_colour_selectors_main_menu', 'test_lsx_customizer_colour_selectors_main_menu', 10, 2 ); |
|
223 | +add_filter('lsx_customizer_colour_selectors_main_menu', 'test_lsx_customizer_colour_selectors_main_menu', 10, 2); |
|
224 | 224 | |
225 | 225 | /** |
226 | 226 | * Filter: lsx_customizer_colour_selectors_banner |
227 | 227 | * |
228 | 228 | * Add new selectors in "banner" group of colours |
229 | 229 | */ |
230 | -function test_lsx_customizer_colour_selectors_banner( $css, $colors ) { |
|
230 | +function test_lsx_customizer_colour_selectors_banner($css, $colors) { |
|
231 | 231 | $css .= <<<CSS |
232 | 232 | |
233 | 233 | /* Banner TEST */ |
@@ -241,14 +241,14 @@ discard block |
||
241 | 241 | |
242 | 242 | return $css; |
243 | 243 | } |
244 | -add_filter( 'lsx_customizer_colour_selectors_banner', 'test_lsx_customizer_colour_selectors_banner', 10, 2 ); |
|
244 | +add_filter('lsx_customizer_colour_selectors_banner', 'test_lsx_customizer_colour_selectors_banner', 10, 2); |
|
245 | 245 | |
246 | 246 | /** |
247 | 247 | * Filter: lsx_customizer_colour_selectors_body |
248 | 248 | * |
249 | 249 | * Add new selectors in "body" group of colours |
250 | 250 | */ |
251 | -function test_lsx_customizer_colour_selectors_body( $css, $colors ) { |
|
251 | +function test_lsx_customizer_colour_selectors_body($css, $colors) { |
|
252 | 252 | $css .= <<<CSS |
253 | 253 | |
254 | 254 | /* Body TEST */ |
@@ -265,14 +265,14 @@ discard block |
||
265 | 265 | |
266 | 266 | return $css; |
267 | 267 | } |
268 | -add_filter( 'lsx_customizer_colour_selectors_body', 'test_lsx_customizer_colour_selectors_body', 10, 2 ); |
|
268 | +add_filter('lsx_customizer_colour_selectors_body', 'test_lsx_customizer_colour_selectors_body', 10, 2); |
|
269 | 269 | |
270 | 270 | /** |
271 | 271 | * Filter: lsx_customizer_colour_selectors_footer_cta |
272 | 272 | * |
273 | 273 | * Add new selectors in "footer cta" group of colours |
274 | 274 | */ |
275 | -function test_lsx_customizer_colour_selectors_footer_cta( $css, $colors ) { |
|
275 | +function test_lsx_customizer_colour_selectors_footer_cta($css, $colors) { |
|
276 | 276 | $css .= <<<CSS |
277 | 277 | |
278 | 278 | /* Footer CTA TEST */ |
@@ -287,14 +287,14 @@ discard block |
||
287 | 287 | |
288 | 288 | return $css; |
289 | 289 | } |
290 | -add_filter( 'lsx_customizer_colour_selectors_footer_cta', 'test_lsx_customizer_colour_selectors_footer_cta', 10, 2 ); |
|
290 | +add_filter('lsx_customizer_colour_selectors_footer_cta', 'test_lsx_customizer_colour_selectors_footer_cta', 10, 2); |
|
291 | 291 | |
292 | 292 | /** |
293 | 293 | * Filter: lsx_customizer_colour_selectors_footer_widgets |
294 | 294 | * |
295 | 295 | * Add new selectors in "footer widgets" group of colours |
296 | 296 | */ |
297 | -function test_lsx_customizer_colour_selectors_footer_widgets( $css, $colors ) { |
|
297 | +function test_lsx_customizer_colour_selectors_footer_widgets($css, $colors) { |
|
298 | 298 | $css .= <<<CSS |
299 | 299 | |
300 | 300 | /* Footer Widgets TEST */ |
@@ -309,14 +309,14 @@ discard block |
||
309 | 309 | |
310 | 310 | return $css; |
311 | 311 | } |
312 | -add_filter( 'lsx_customizer_colour_selectors_footer_widgets', 'test_lsx_customizer_colour_selectors_footer_widgets', 10, 2 ); |
|
312 | +add_filter('lsx_customizer_colour_selectors_footer_widgets', 'test_lsx_customizer_colour_selectors_footer_widgets', 10, 2); |
|
313 | 313 | |
314 | 314 | /** |
315 | 315 | * Filter: lsx_customizer_colour_selectors_footer |
316 | 316 | * |
317 | 317 | * Add new selectors in "footer" group of colours |
318 | 318 | */ |
319 | -function test_lsx_customizer_colour_selectors_footer( $css, $colors ) { |
|
319 | +function test_lsx_customizer_colour_selectors_footer($css, $colors) { |
|
320 | 320 | $css .= <<<CSS |
321 | 321 | |
322 | 322 | /* Footer TEST */ |
@@ -331,6 +331,6 @@ discard block |
||
331 | 331 | |
332 | 332 | return $css; |
333 | 333 | } |
334 | -add_filter( 'lsx_customizer_colour_selectors_footer', 'test_lsx_customizer_colour_selectors_footer', 10, 2 ); |
|
334 | +add_filter('lsx_customizer_colour_selectors_footer', 'test_lsx_customizer_colour_selectors_footer', 10, 2); |
|
335 | 335 | |
336 | 336 | ?> |
337 | 337 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) return; |
|
2 | +if ( ! defined('ABSPATH')) return; |
|
3 | 3 | |
4 | 4 | /* |
5 | 5 | * LSX Lazy Load Images Class |
@@ -25,138 +25,138 @@ discard block |
||
25 | 25 | protected static $noscripts = array(); |
26 | 26 | |
27 | 27 | static function init() { |
28 | - if ( is_admin() ) |
|
28 | + if (is_admin()) |
|
29 | 29 | return; |
30 | 30 | |
31 | - if ( get_theme_mod( 'lsx_lazyload_status', '1' ) === false ) { |
|
31 | + if (get_theme_mod('lsx_lazyload_status', '1') === false) { |
|
32 | 32 | self::$enabled = false; |
33 | 33 | return; |
34 | 34 | } |
35 | 35 | |
36 | - if ( ! apply_filters( 'lsx_lazyload_is_enabled', true ) ) { |
|
36 | + if ( ! apply_filters('lsx_lazyload_is_enabled', true)) { |
|
37 | 37 | self::$enabled = false; |
38 | 38 | return; |
39 | 39 | } |
40 | 40 | |
41 | - add_action( 'wp_enqueue_scripts', array( __CLASS__, 'add_scripts' ) ); |
|
42 | - add_action( 'wp_head', array( __CLASS__, 'setup_filters' ), 9999 ); |
|
41 | + add_action('wp_enqueue_scripts', array(__CLASS__, 'add_scripts')); |
|
42 | + add_action('wp_head', array(__CLASS__, 'setup_filters'), 9999); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | static function setup_filters() { |
46 | 46 | // WordPress |
47 | - add_filter( 'the_content', array( __CLASS__, 'filter_images' ), 200 ); |
|
48 | - add_filter( 'widget_text', array( __CLASS__, 'filter_images' ), 200 ); |
|
49 | - add_filter( 'post_thumbnail_html', array( __CLASS__, 'filter_images' ), 200 ); |
|
50 | - add_filter( 'get_avatar', array( __CLASS__, 'filter_images' ), 200 ); |
|
47 | + add_filter('the_content', array(__CLASS__, 'filter_images'), 200); |
|
48 | + add_filter('widget_text', array(__CLASS__, 'filter_images'), 200); |
|
49 | + add_filter('post_thumbnail_html', array(__CLASS__, 'filter_images'), 200); |
|
50 | + add_filter('get_avatar', array(__CLASS__, 'filter_images'), 200); |
|
51 | 51 | |
52 | 52 | // LSX |
53 | - add_filter( 'lsx_lazyload_filter_images', array( __CLASS__, 'filter_images' ), 200 ); |
|
53 | + add_filter('lsx_lazyload_filter_images', array(__CLASS__, 'filter_images'), 200); |
|
54 | 54 | |
55 | 55 | // Envira Gallery |
56 | - add_filter( 'envira_gallery_output_image', array( __CLASS__, 'filter_images' ), 200 ); |
|
56 | + add_filter('envira_gallery_output_image', array(__CLASS__, 'filter_images'), 200); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | static function add_scripts() { |
60 | - wp_enqueue_script( 'lazysizes', get_template_directory_uri() .'/js/vendor/lazysizes.min.js', array( 'jquery' ), null, true ); |
|
60 | + wp_enqueue_script('lazysizes', get_template_directory_uri() . '/js/vendor/lazysizes.min.js', array('jquery'), null, true); |
|
61 | 61 | // Plugin that enables use lazysizes in brackground images |
62 | 62 | //wp_enqueue_script( 'lazysizes', get_template_directory_uri() .'/js/vendor/ls.unveilhooks.min.js', array( 'jquery', 'lazysizes' ), null, true ); |
63 | 63 | } |
64 | 64 | |
65 | - static function filter_images( $content ) { |
|
66 | - if ( ! self::is_enabled() ) { |
|
65 | + static function filter_images($content) { |
|
66 | + if ( ! self::is_enabled()) { |
|
67 | 67 | return $content; |
68 | 68 | } |
69 | 69 | |
70 | - if ( is_feed() |
|
70 | + if (is_feed() |
|
71 | 71 | || is_preview() |
72 | - || intval( get_query_var( 'print' ) ) == 1 |
|
73 | - || intval( get_query_var( 'printpage' ) ) == 1 |
|
74 | - || strpos( $_SERVER['HTTP_USER_AGENT'], 'Opera Mini' ) !== false |
|
72 | + || intval(get_query_var('print')) == 1 |
|
73 | + || intval(get_query_var('printpage')) == 1 |
|
74 | + || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false |
|
75 | 75 | ) { |
76 | 76 | return $content; |
77 | 77 | } |
78 | 78 | |
79 | 79 | $skip_images_regex = '/class=".*(lazyload|disable-lazyload).*"/'; |
80 | - $placeholder_image = apply_filters( 'lsx_lazyload_placeholder_image', 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==' ); |
|
80 | + $placeholder_image = apply_filters('lsx_lazyload_placeholder_image', 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='); |
|
81 | 81 | |
82 | 82 | $matches = array(); |
83 | 83 | $search = array(); |
84 | 84 | $replace = array(); |
85 | 85 | |
86 | - $content = preg_replace_callback( '~<noscript.+?</noscript>~s', 'self::noscripts_remove', $content ); |
|
87 | - preg_match_all( '/<img[^>]*>/', $content, $matches ); |
|
86 | + $content = preg_replace_callback('~<noscript.+?</noscript>~s', 'self::noscripts_remove', $content); |
|
87 | + preg_match_all('/<img[^>]*>/', $content, $matches); |
|
88 | 88 | |
89 | - foreach ( $matches[0] as $img_html ) { |
|
90 | - if ( ! ( preg_match( $skip_images_regex, $img_html ) ) ) { |
|
89 | + foreach ($matches[0] as $img_html) { |
|
90 | + if ( ! (preg_match($skip_images_regex, $img_html))) { |
|
91 | 91 | $add_class = false; |
92 | 92 | |
93 | - if ( ! preg_match( '/src=[\'"]([^\'"]+)[\'"]/', $img_html ) && preg_match( '/srcset=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
94 | - $replace_html = preg_replace( '/<img(.*?)srcset=/i', '<img$1srcset="' . $placeholder_image . '" data-srcset=', $img_html ); |
|
93 | + if ( ! preg_match('/src=[\'"]([^\'"]+)[\'"]/', $img_html) && preg_match('/srcset=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
94 | + $replace_html = preg_replace('/<img(.*?)srcset=/i', '<img$1srcset="' . $placeholder_image . '" data-srcset=', $img_html); |
|
95 | 95 | |
96 | - if ( preg_match( '/sizes=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
97 | - $replace_html = preg_replace( '/sizes=/i', 'data-sizes=', $replace_html ); |
|
96 | + if (preg_match('/sizes=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
97 | + $replace_html = preg_replace('/sizes=/i', 'data-sizes=', $replace_html); |
|
98 | 98 | } else { |
99 | - $replace_html = preg_replace( '/data-srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html ); |
|
99 | + $replace_html = preg_replace('/data-srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $add_class = true; |
103 | - } elseif ( preg_match( '/src=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
104 | - $replace_html = preg_replace( '/<img(.*?)src=/i', '<img$1src="' . $placeholder_image . '" data-src=', $img_html ); |
|
103 | + } elseif (preg_match('/src=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
104 | + $replace_html = preg_replace('/<img(.*?)src=/i', '<img$1src="' . $placeholder_image . '" data-src=', $img_html); |
|
105 | 105 | |
106 | - if ( preg_match( '/srcset=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
107 | - if ( preg_match( '/sizes=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
108 | - $replace_html = preg_replace( '/srcset=/i', 'data-srcset=', $replace_html ); |
|
109 | - $replace_html = preg_replace( '/sizes=/i', 'data-sizes=', $replace_html ); |
|
106 | + if (preg_match('/srcset=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
107 | + if (preg_match('/sizes=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
108 | + $replace_html = preg_replace('/srcset=/i', 'data-srcset=', $replace_html); |
|
109 | + $replace_html = preg_replace('/sizes=/i', 'data-sizes=', $replace_html); |
|
110 | 110 | } else { |
111 | - $replace_html = preg_replace( '/srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html ); |
|
111 | + $replace_html = preg_replace('/srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | 115 | $add_class = true; |
116 | 116 | } |
117 | 117 | |
118 | - if ( $add_class ) { |
|
119 | - $replace_html = self::add_class( $replace_html, 'lazyload' ); |
|
118 | + if ($add_class) { |
|
119 | + $replace_html = self::add_class($replace_html, 'lazyload'); |
|
120 | 120 | $replace_html .= '<noscript>' . $img_html . '</noscript>'; |
121 | 121 | |
122 | - array_push( $search, $img_html ); |
|
123 | - array_push( $replace, $replace_html ); |
|
122 | + array_push($search, $img_html); |
|
123 | + array_push($replace, $replace_html); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | - $content = str_replace( $search, $replace, $content ); |
|
129 | - $content = preg_replace_callback( '~' . chr(20) . '([0-9]+)' . chr(20) . '~', 'self::noscripts_restore', $content ); |
|
128 | + $content = str_replace($search, $replace, $content); |
|
129 | + $content = preg_replace_callback('~' . chr(20) . '([0-9]+)' . chr(20) . '~', 'self::noscripts_restore', $content); |
|
130 | 130 | return $content; |
131 | 131 | } |
132 | 132 | |
133 | - static function noscripts_remove( $match ) { |
|
133 | + static function noscripts_remove($match) { |
|
134 | 134 | self::$noscript_id++; |
135 | 135 | self::$noscripts[self::$noscript_id] = $match[0]; |
136 | 136 | return chr(20) . self::$noscript_id . chr(20); |
137 | 137 | } |
138 | 138 | |
139 | - static function noscripts_restore( $match ) { |
|
139 | + static function noscripts_restore($match) { |
|
140 | 140 | return self::$noscripts[(int) $match[1]]; |
141 | 141 | } |
142 | 142 | |
143 | - static function add_class( $html_string = '', $new_class ) { |
|
143 | + static function add_class($html_string = '', $new_class) { |
|
144 | 144 | $pattern = '/class=[\'"]([^\'"]*)[\'"]/'; |
145 | 145 | |
146 | - if ( preg_match( $pattern, $html_string, $matches ) ) { |
|
147 | - $defined_classes = explode( ' ', $matches[1] ); |
|
146 | + if (preg_match($pattern, $html_string, $matches)) { |
|
147 | + $defined_classes = explode(' ', $matches[1]); |
|
148 | 148 | |
149 | - if ( ! in_array( $new_class, $defined_classes ) ) { |
|
149 | + if ( ! in_array($new_class, $defined_classes)) { |
|
150 | 150 | $defined_classes[] = $new_class; |
151 | 151 | |
152 | 152 | $html_string = str_replace( |
153 | 153 | $matches[0], |
154 | - sprintf( 'class="%s"', implode( ' ', $defined_classes ) ), |
|
154 | + sprintf('class="%s"', implode(' ', $defined_classes)), |
|
155 | 155 | $html_string |
156 | 156 | ); |
157 | 157 | } |
158 | 158 | } else { |
159 | - $html_string = preg_replace( '/(\<.+\s)/', sprintf( '$1class="%s" ', $new_class ), $html_string ); |
|
159 | + $html_string = preg_replace('/(\<.+\s)/', sprintf('$1class="%s" ', $new_class), $html_string); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | return $html_string; |
@@ -167,4 +167,4 @@ discard block |
||
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | -add_action( 'init', array( 'LSX_LazyLoadImages', 'init' ) ); |
|
170 | +add_action('init', array('LSX_LazyLoadImages', 'init')); |