@@ -12,16 +12,16 @@ discard block |
||
| 12 | 12 | <html <?php language_attributes(); ?>> |
| 13 | 13 | <head> |
| 14 | 14 | <?php lsx_head_top(); ?> |
| 15 | -<meta charset="<?php bloginfo( 'charset' ); ?>"> |
|
| 15 | +<meta charset="<?php bloginfo('charset'); ?>"> |
|
| 16 | 16 | <link rel="profile" href="http://gmpg.org/xfn/11"> |
| 17 | -<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"> |
|
| 17 | +<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>"> |
|
| 18 | 18 | <?php lsx_head_bottom(); ?> |
| 19 | 19 | <?php wp_head(); ?> |
| 20 | 20 | </head> |
| 21 | -<body <?php body_class( 'lsx' ); ?>> |
|
| 21 | +<body <?php body_class('lsx'); ?>> |
|
| 22 | 22 | <?php lsx_body_top(); ?> |
| 23 | 23 | |
| 24 | -<?php if ( !is_singular('landing-page') ) { ?> |
|
| 24 | +<?php if ( ! is_singular('landing-page')) { ?> |
|
| 25 | 25 | |
| 26 | 26 | <?php lsx_header_before(); ?> |
| 27 | 27 | <header class="<?php lsx_header_classes(); ?>"> |
@@ -57,17 +57,17 @@ discard block |
||
| 57 | 57 | </div> |
| 58 | 58 | |
| 59 | 59 | <div class="header-links"> |
| 60 | - <strong><?php esc_html_e( 'Get your Tourism Establishment Online', 'lsx' ); ?></strong> |
|
| 60 | + <strong><?php esc_html_e('Get your Tourism Establishment Online', 'lsx'); ?></strong> |
|
| 61 | 61 | |
| 62 | 62 | <?php |
| 63 | - if(is_singular('landing-page')){ |
|
| 64 | - $email_address = get_post_meta(get_the_ID(),'email_address',true); |
|
| 65 | - if(false === $email_address){ |
|
| 63 | + if (is_singular('landing-page')) { |
|
| 64 | + $email_address = get_post_meta(get_the_ID(), 'email_address', true); |
|
| 65 | + if (false === $email_address) { |
|
| 66 | 66 | $email_address = '[email protected]'; |
| 67 | 67 | } |
| 68 | 68 | } ?> |
| 69 | 69 | |
| 70 | - <span class="email-address"><?php esc_html_e( 'Questions? Email Us: ', 'lsx' ); ?><a href="mailto:<?php echo esc_attr( $email_address ); ?>"><?php echo esc_html( $email_address ); ?></a></span> |
|
| 70 | + <span class="email-address"><?php esc_html_e('Questions? Email Us: ', 'lsx'); ?><a href="mailto:<?php echo esc_attr($email_address); ?>"><?php echo esc_html($email_address); ?></a></span> |
|
| 71 | 71 | </div> |
| 72 | 72 | </div> |
| 73 | 73 | |
@@ -60,12 +60,12 @@ |
||
| 60 | 60 | <strong><?php esc_html_e( 'Get your Tourism Establishment Online', 'lsx' ); ?></strong> |
| 61 | 61 | |
| 62 | 62 | <?php |
| 63 | - if(is_singular('landing-page')){ |
|
| 64 | - $email_address = get_post_meta(get_the_ID(),'email_address',true); |
|
| 65 | - if(false === $email_address){ |
|
| 63 | + if(is_singular('landing-page')){ |
|
| 64 | + $email_address = get_post_meta(get_the_ID(),'email_address',true); |
|
| 65 | + if(false === $email_address){ |
|
| 66 | 66 | $email_address = '[email protected]'; |
| 67 | 67 | } |
| 68 | - } ?> |
|
| 68 | + } ?> |
|
| 69 | 69 | |
| 70 | 70 | <span class="email-address"><?php esc_html_e( 'Questions? Email Us: ', 'lsx' ); ?><a href="mailto:<?php echo esc_attr( $email_address ); ?>"><?php echo esc_html( $email_address ); ?></a></span> |
| 71 | 71 | </div> |
@@ -10,22 +10,22 @@ |
||
| 10 | 10 | |
| 11 | 11 | <section class="no-results not-found"> |
| 12 | 12 | <header class="page-header"> |
| 13 | - <h1 class="page-title"><?php esc_html_e( 'Nothing Found', 'lsx' ); ?></h1> |
|
| 13 | + <h1 class="page-title"><?php esc_html_e('Nothing Found', 'lsx'); ?></h1> |
|
| 14 | 14 | </header><!-- .page-header --> |
| 15 | 15 | |
| 16 | 16 | <div class="page-content"> |
| 17 | - <?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?> |
|
| 17 | + <?php if (is_home() && current_user_can('publish_posts')) : ?> |
|
| 18 | 18 | |
| 19 | - <p><?php esc_html_e( 'Ready to publish your first post?', 'lsx' ); ?> <a href="<?php echo esc_url( admin_url( 'post-new.php' ) ) ?>"><?php esc_html_e( 'Get started here', 'lsx' ); ?></a></p> |
|
| 19 | + <p><?php esc_html_e('Ready to publish your first post?', 'lsx'); ?> <a href="<?php echo esc_url(admin_url('post-new.php')) ?>"><?php esc_html_e('Get started here', 'lsx'); ?></a></p> |
|
| 20 | 20 | |
| 21 | - <?php elseif ( is_search() ) : ?> |
|
| 21 | + <?php elseif (is_search()) : ?> |
|
| 22 | 22 | |
| 23 | - <p><?php esc_html_e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'lsx' ); ?></p> |
|
| 23 | + <p><?php esc_html_e('Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'lsx'); ?></p> |
|
| 24 | 24 | <?php get_search_form(); ?> |
| 25 | 25 | |
| 26 | 26 | <?php else : ?> |
| 27 | 27 | |
| 28 | - <p><?php esc_html_e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'lsx' ); ?></p> |
|
| 28 | + <p><?php esc_html_e('It seems we can’t find what you’re looking for. Perhaps searching can help.', 'lsx'); ?></p> |
|
| 29 | 29 | <?php get_search_form(); ?> |
| 30 | 30 | |
| 31 | 31 | <?php endif; ?> |
@@ -23,9 +23,12 @@ |
||
| 23 | 23 | <p><?php esc_html_e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'lsx' ); ?></p> |
| 24 | 24 | <?php get_search_form(); ?> |
| 25 | 25 | |
| 26 | - <?php else : ?> |
|
| 26 | + <?php else { |
|
| 27 | + : ?> |
|
| 27 | 28 | |
| 28 | - <p><?php esc_html_e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'lsx' ); ?></p> |
|
| 29 | + <p><?php esc_html_e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'lsx' ); |
|
| 30 | +} |
|
| 31 | +?></p> |
|
| 29 | 32 | <?php get_search_form(); ?> |
| 30 | 33 | |
| 31 | 34 | <?php endif; ?> |
@@ -30,7 +30,6 @@ |
||
| 30 | 30 | * @param string $output Passed by reference. Used to append additional content. |
| 31 | 31 | * @param object $item Menu item data object. |
| 32 | 32 | * @param int $depth Depth of menu item. Used for padding. |
| 33 | - * @param int $current_page Menu item ID. |
|
| 34 | 33 | * @param object $args |
| 35 | 34 | */ |
| 36 | 35 | public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
@@ -159,17 +159,17 @@ |
||
| 159 | 159 | * @return null Null on failure with no changes to parameters. |
| 160 | 160 | */ |
| 161 | 161 | public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { |
| 162 | - if ( ! $element ) |
|
| 163 | - return; |
|
| 162 | + if ( ! $element ) |
|
| 163 | + return; |
|
| 164 | 164 | |
| 165 | - $id_field = $this->db_fields['id']; |
|
| 165 | + $id_field = $this->db_fields['id']; |
|
| 166 | 166 | |
| 167 | - // Display this element. |
|
| 168 | - if ( is_object( $args[0] ) ) |
|
| 169 | - $args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] ); |
|
| 167 | + // Display this element. |
|
| 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 ); |
|
| 172 | - } |
|
| 171 | + parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); |
|
| 172 | + } |
|
| 173 | 173 | |
| 174 | 174 | /** |
| 175 | 175 | * Menu Fallback |
@@ -1,5 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + return; |
|
| 4 | +} |
|
| 5 | +// Exit if accessed directly |
|
| 3 | 6 | |
| 4 | 7 | class Lsx_Bootstrap_Navwalker extends Walker_Nav_Menu { |
| 5 | 8 | |
@@ -71,14 +74,17 @@ discard block |
||
| 71 | 74 | |
| 72 | 75 | $class_names = join( ' ', $classes ); |
| 73 | 76 | |
| 74 | - if ( $args->has_children ) |
|
| 75 | - $class_names .= ' dropdown'; |
|
| 77 | + if ( $args->has_children ) { |
|
| 78 | + $class_names .= ' dropdown'; |
|
| 79 | + } |
|
| 76 | 80 | |
| 77 | - if ( in_array( 'current-menu-item', $classes ) ) |
|
| 78 | - $class_names .= ' active'; |
|
| 81 | + if ( in_array( 'current-menu-item', $classes ) ) { |
|
| 82 | + $class_names .= ' active'; |
|
| 83 | + } |
|
| 79 | 84 | |
| 80 | - if ( in_array( 'current-menu-parent', $classes ) ) |
|
| 81 | - $class_names .= ' active'; |
|
| 85 | + if ( in_array( 'current-menu-parent', $classes ) ) { |
|
| 86 | + $class_names .= ' active'; |
|
| 87 | + } |
|
| 82 | 88 | |
| 83 | 89 | //Check if this is ment to be a "social" type menu |
| 84 | 90 | $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; |
@@ -159,14 +165,16 @@ discard block |
||
| 159 | 165 | * @return null Null on failure with no changes to parameters. |
| 160 | 166 | */ |
| 161 | 167 | public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { |
| 162 | - if ( ! $element ) |
|
| 163 | - return; |
|
| 168 | + if ( ! $element ) { |
|
| 169 | + return; |
|
| 170 | + } |
|
| 164 | 171 | |
| 165 | 172 | $id_field = $this->db_fields['id']; |
| 166 | 173 | |
| 167 | 174 | // Display this element. |
| 168 | - if ( is_object( $args[0] ) ) |
|
| 169 | - $args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] ); |
|
| 175 | + if ( is_object( $args[0] ) ) { |
|
| 176 | + $args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] ); |
|
| 177 | + } |
|
| 170 | 178 | |
| 171 | 179 | parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); |
| 172 | 180 | } |
@@ -189,29 +197,34 @@ discard block |
||
| 189 | 197 | if ( $args['container'] ) { |
| 190 | 198 | $fb_output = '<' . $args['container']; |
| 191 | 199 | |
| 192 | - if ( $args['container_id'] ) |
|
| 193 | - $fb_output .= ' id="' . $args['container_id'] . '"'; |
|
| 200 | + if ( $args['container_id'] ) { |
|
| 201 | + $fb_output .= ' id="' . $args['container_id'] . '"'; |
|
| 202 | + } |
|
| 194 | 203 | |
| 195 | - if ( $args['container_class'] ) |
|
| 196 | - $fb_output .= ' class="' . $args['container_class'] . '"'; |
|
| 204 | + if ( $args['container_class'] ) { |
|
| 205 | + $fb_output .= ' class="' . $args['container_class'] . '"'; |
|
| 206 | + } |
|
| 197 | 207 | |
| 198 | 208 | $fb_output .= '>'; |
| 199 | 209 | } |
| 200 | 210 | |
| 201 | 211 | $fb_output .= '<ul'; |
| 202 | 212 | |
| 203 | - if ( $args['menu_id'] ) |
|
| 204 | - $fb_output .= ' id="' . $args['menu_id'] . '"'; |
|
| 213 | + if ( $args['menu_id'] ) { |
|
| 214 | + $fb_output .= ' id="' . $args['menu_id'] . '"'; |
|
| 215 | + } |
|
| 205 | 216 | |
| 206 | - if ( $args['menu_class'] ) |
|
| 207 | - $fb_output .= ' class="' . $args['menu_class'] . '"'; |
|
| 217 | + if ( $args['menu_class'] ) { |
|
| 218 | + $fb_output .= ' class="' . $args['menu_class'] . '"'; |
|
| 219 | + } |
|
| 208 | 220 | |
| 209 | 221 | $fb_output .= '>'; |
| 210 | 222 | $fb_output .= '<li><a href="' . admin_url( 'nav-menus.php' ) . '">' . esc_html__( 'Add a menu', 'lsx' ) . '</a></li>'; |
| 211 | 223 | $fb_output .= '</ul>'; |
| 212 | 224 | |
| 213 | - if ( $args['container'] ) |
|
| 214 | - $fb_output .= '</' . $args['container'] . '>'; |
|
| 225 | + if ( $args['container'] ) { |
|
| 226 | + $fb_output .= '</' . $args['container'] . '>'; |
|
| 227 | + } |
|
| 215 | 228 | |
| 216 | 229 | echo wp_kses_post( $fb_output ); |
| 217 | 230 | } |
@@ -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,62 +52,62 @@ 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 ( 0 == strcasecmp( $item->attr_title, 'divider' ) && 1 === $depth ) { |
|
| 55 | + if (0 == strcasecmp($item->attr_title, 'divider') && 1 === $depth) { |
|
| 56 | 56 | $output .= $indent . '<li role="presentation" class="divider">'; |
| 57 | - } elseif ( 0 == strcasecmp( $item->title, 'divider' ) && 1 === $depth ) { |
|
| 57 | + } elseif (0 == strcasecmp($item->title, 'divider') && 1 === $depth) { |
|
| 58 | 58 | $output .= $indent . '<li role="presentation" class="divider">'; |
| 59 | - } elseif ( 0 == strcasecmp( $item->attr_title, 'dropdown-header' ) && 1 === $depth ) { |
|
| 60 | - $output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr( $item->title ); |
|
| 61 | - } elseif ( 0 == strcasecmp( $item->attr_title, 'disabled' ) ) { |
|
| 62 | - $output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr( $item->title ) . '</a>'; |
|
| 59 | + } elseif (0 == strcasecmp($item->attr_title, 'dropdown-header') && 1 === $depth) { |
|
| 60 | + $output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr($item->title); |
|
| 61 | + } elseif (0 == strcasecmp($item->attr_title, 'disabled')) { |
|
| 62 | + $output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr($item->title) . '</a>'; |
|
| 63 | 63 | } else { |
| 64 | 64 | $class_names = $value = ''; |
| 65 | 65 | |
| 66 | - $classes = empty( $item->classes ) ? array() : (array) $item->classes; |
|
| 66 | + $classes = empty($item->classes) ? array() : (array) $item->classes; |
|
| 67 | 67 | $classes[] = 'menu-item-' . $item->ID; |
| 68 | 68 | |
| 69 | - $classes = apply_filters( 'lsx_nav_menu_css_class', array_filter( $classes ), $item, $args , $depth ); |
|
| 69 | + $classes = apply_filters('lsx_nav_menu_css_class', array_filter($classes), $item, $args, $depth); |
|
| 70 | 70 | |
| 71 | - $class_names = join( ' ', $classes ); |
|
| 71 | + $class_names = join(' ', $classes); |
|
| 72 | 72 | |
| 73 | - if ( $args->has_children ) |
|
| 73 | + if ($args->has_children) |
|
| 74 | 74 | $class_names .= ' dropdown'; |
| 75 | 75 | |
| 76 | - if ( in_array( 'current-menu-item', $classes ) ) |
|
| 76 | + if (in_array('current-menu-item', $classes)) |
|
| 77 | 77 | $class_names .= ' active'; |
| 78 | 78 | |
| 79 | - if ( in_array( 'current-menu-parent', $classes ) ) |
|
| 79 | + if (in_array('current-menu-parent', $classes)) |
|
| 80 | 80 | $class_names .= ' active'; |
| 81 | 81 | |
| 82 | 82 | //Check if this is ment to be a "social" type menu |
| 83 | - $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; |
|
| 83 | + $class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : ''; |
|
| 84 | 84 | |
| 85 | - $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args ); |
|
| 86 | - $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; |
|
| 85 | + $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args); |
|
| 86 | + $id = $id ? ' id="' . esc_attr($id) . '"' : ''; |
|
| 87 | 87 | |
| 88 | - $output .= $indent . '<li' . $id . $value . $class_names .'>'; |
|
| 88 | + $output .= $indent . '<li' . $id . $value . $class_names . '>'; |
|
| 89 | 89 | |
| 90 | 90 | $atts = array(); |
| 91 | - $atts['title'] = ! empty( $item->title ) ? $item->title : ''; |
|
| 92 | - $atts['target'] = ! empty( $item->target ) ? $item->target : ''; |
|
| 93 | - $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; |
|
| 91 | + $atts['title'] = ! empty($item->title) ? $item->title : ''; |
|
| 92 | + $atts['target'] = ! empty($item->target) ? $item->target : ''; |
|
| 93 | + $atts['rel'] = ! empty($item->xfn) ? $item->xfn : ''; |
|
| 94 | 94 | |
| 95 | 95 | // If item has_children add atts to a. |
| 96 | - if ( $args->has_children ) { |
|
| 97 | - $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
| 98 | - $atts['data-toggle'] = 'dropdown'; |
|
| 99 | - $atts['class'] = 'dropdown-toggle'; |
|
| 100 | - $atts['aria-haspopup'] = 'true'; |
|
| 96 | + if ($args->has_children) { |
|
| 97 | + $atts['href'] = ! empty($item->url) ? $item->url : ''; |
|
| 98 | + $atts['data-toggle'] = 'dropdown'; |
|
| 99 | + $atts['class'] = 'dropdown-toggle'; |
|
| 100 | + $atts['aria-haspopup'] = 'true'; |
|
| 101 | 101 | } else { |
| 102 | - $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
| 102 | + $atts['href'] = ! empty($item->url) ? $item->url : ''; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args ); |
|
| 105 | + $atts = apply_filters('nav_menu_link_attributes', $atts, $item, $args); |
|
| 106 | 106 | |
| 107 | 107 | $attributes = ''; |
| 108 | - foreach ( $atts as $attr => $value ) { |
|
| 109 | - if ( ! empty( $value ) ) { |
|
| 110 | - $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); |
|
| 108 | + foreach ($atts as $attr => $value) { |
|
| 109 | + if ( ! empty($value)) { |
|
| 110 | + $value = ('href' === $attr) ? esc_url($value) : esc_attr($value); |
|
| 111 | 111 | $attributes .= ' ' . $attr . '="' . $value . '"'; |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -121,19 +121,19 @@ discard block |
||
| 121 | 121 | * if there is a value in the attr_title property. If the attr_title |
| 122 | 122 | * property is NOT null we apply it as the class name for the glyphicon. |
| 123 | 123 | */ |
| 124 | - if ( ! empty( $item->attr_title ) ) { |
|
| 125 | - $item_output .= '<a'. $attributes .'"><span class="glyphicon ' . esc_attr( $item->attr_title ) . '"></span> '; |
|
| 124 | + if ( ! empty($item->attr_title)) { |
|
| 125 | + $item_output .= '<a' . $attributes . '"><span class="glyphicon ' . esc_attr($item->attr_title) . '"></span> '; |
|
| 126 | 126 | } else { |
| 127 | - $item_output .= '<a'. $attributes .'>'; |
|
| 127 | + $item_output .= '<a' . $attributes . '>'; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; |
|
| 131 | - $item_output .= ( $args->has_children && 0 === $depth ) ? ' <span class="caret"></span></a>' : '</a>'; |
|
| 130 | + $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after; |
|
| 131 | + $item_output .= ($args->has_children && 0 === $depth) ? ' <span class="caret"></span></a>' : '</a>'; |
|
| 132 | 132 | $item_output .= $args->after; |
| 133 | 133 | |
| 134 | 134 | |
| 135 | 135 | |
| 136 | - $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); |
|
| 136 | + $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
@@ -157,17 +157,17 @@ discard block |
||
| 157 | 157 | * @param string $output Passed by reference. Used to append additional content. |
| 158 | 158 | * @return null Null on failure with no changes to parameters. |
| 159 | 159 | */ |
| 160 | - public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { |
|
| 161 | - if ( ! $element ) |
|
| 160 | + public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output) { |
|
| 161 | + if ( ! $element) |
|
| 162 | 162 | return; |
| 163 | 163 | |
| 164 | 164 | $id_field = $this->db_fields['id']; |
| 165 | 165 | |
| 166 | 166 | // Display this element. |
| 167 | - if ( is_object( $args[0] ) ) |
|
| 168 | - $args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] ); |
|
| 167 | + if (is_object($args[0])) |
|
| 168 | + $args[0]->has_children = ! empty($children_elements[$element->$id_field]); |
|
| 169 | 169 | |
| 170 | - parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); |
|
| 170 | + parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -181,17 +181,17 @@ discard block |
||
| 181 | 181 | * @param array $args passed from the wp_nav_menu function. |
| 182 | 182 | * |
| 183 | 183 | */ |
| 184 | - public static function fallback( $args ) { |
|
| 185 | - if ( current_user_can( 'manage_options' ) ) { |
|
| 184 | + public static function fallback($args) { |
|
| 185 | + if (current_user_can('manage_options')) { |
|
| 186 | 186 | $fb_output = null; |
| 187 | 187 | |
| 188 | - if ( $args['container'] ) { |
|
| 188 | + if ($args['container']) { |
|
| 189 | 189 | $fb_output = '<' . $args['container']; |
| 190 | 190 | |
| 191 | - if ( $args['container_id'] ) |
|
| 191 | + if ($args['container_id']) |
|
| 192 | 192 | $fb_output .= ' id="' . $args['container_id'] . '"'; |
| 193 | 193 | |
| 194 | - if ( $args['container_class'] ) |
|
| 194 | + if ($args['container_class']) |
|
| 195 | 195 | $fb_output .= ' class="' . $args['container_class'] . '"'; |
| 196 | 196 | |
| 197 | 197 | $fb_output .= '>'; |
@@ -199,20 +199,20 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | $fb_output .= '<ul'; |
| 201 | 201 | |
| 202 | - if ( $args['menu_id'] ) |
|
| 202 | + if ($args['menu_id']) |
|
| 203 | 203 | $fb_output .= ' id="' . $args['menu_id'] . '"'; |
| 204 | 204 | |
| 205 | - if ( $args['menu_class'] ) |
|
| 205 | + if ($args['menu_class']) |
|
| 206 | 206 | $fb_output .= ' class="' . $args['menu_class'] . '"'; |
| 207 | 207 | |
| 208 | 208 | $fb_output .= '>'; |
| 209 | - $fb_output .= '<li><a href="' . admin_url( 'nav-menus.php' ) . '">' . esc_html__( 'Add a menu', 'lsx' ) . '</a></li>'; |
|
| 209 | + $fb_output .= '<li><a href="' . admin_url('nav-menus.php') . '">' . esc_html__('Add a menu', 'lsx') . '</a></li>'; |
|
| 210 | 210 | $fb_output .= '</ul>'; |
| 211 | 211 | |
| 212 | - if ( $args['container'] ) |
|
| 212 | + if ($args['container']) |
|
| 213 | 213 | $fb_output .= '</' . $args['container'] . '>'; |
| 214 | 214 | |
| 215 | - echo wp_kses_post( $fb_output ); |
|
| 215 | + echo wp_kses_post($fb_output); |
|
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -221,9 +221,9 @@ discard block |
||
| 221 | 221 | /** |
| 222 | 222 | * Add in our custom classes to the menus |
| 223 | 223 | */ |
| 224 | -function wpml_nav_language_switcher_fix( $items , $args ) { |
|
| 225 | - $items = str_replace('menu-item-language-current','menu-item-language-current dropdown',$items); |
|
| 226 | - $items = str_replace('submenu-languages','submenu-languages dropdown-menu',$items); |
|
| 224 | +function wpml_nav_language_switcher_fix($items, $args) { |
|
| 225 | + $items = str_replace('menu-item-language-current', 'menu-item-language-current dropdown', $items); |
|
| 226 | + $items = str_replace('submenu-languages', 'submenu-languages dropdown-menu', $items); |
|
| 227 | 227 | return $items; |
| 228 | 228 | } |
| 229 | -add_filter( 'wp_nav_menu_items', 'wpml_nav_language_switcher_fix', 10, 2 ); |
|
| 229 | +add_filter('wp_nav_menu_items', 'wpml_nav_language_switcher_fix', 10, 2); |
|
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | <?php lsx_content_wrap_before(); ?> |
| 7 | 7 | |
| 8 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
| 8 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
| 9 | 9 | |
| 10 | 10 | <?php lsx_content_before(); ?> |
| 11 | 11 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | <?php lsx_content_top(); ?> |
| 15 | 15 | |
| 16 | - <?php while ( have_posts() ) : the_post(); ?> |
|
| 16 | + <?php while (have_posts()) : the_post(); ?> |
|
| 17 | 17 | |
| 18 | 18 | <?php lsx_entry_before(); ?> |
| 19 | 19 | |
@@ -22,28 +22,28 @@ discard block |
||
| 22 | 22 | <?php lsx_entry_top(); ?> |
| 23 | 23 | |
| 24 | 24 | <div class="entry-content"> |
| 25 | - <h2><?php esc_html_e( 'The Last 30 Posts', 'lsx' ); ?></h3> |
|
| 25 | + <h2><?php esc_html_e('The Last 30 Posts', 'lsx'); ?></h3> |
|
| 26 | 26 | <ul> |
| 27 | - <?php $loop = new WP_Query( array( 'posts_per_page' => 30 ) ); ?> |
|
| 28 | - <?php if ( $loop->have_posts() ) { while ( $loop->have_posts() ) { $loop->the_post(); ?> |
|
| 27 | + <?php $loop = new WP_Query(array('posts_per_page' => 30)); ?> |
|
| 28 | + <?php if ($loop->have_posts()) { while ($loop->have_posts()) { $loop->the_post(); ?> |
|
| 29 | 29 | <?php $loop->is_home = false; ?> |
| 30 | - <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> - <?php the_time( get_option( 'date_format' ) ); ?> - <?php echo esc_html( $post->comment_count ); ?> <?php esc_html_e( 'comments', 'lsx' ); ?></li> |
|
| 30 | + <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> - <?php the_time(get_option('date_format')); ?> - <?php echo esc_html($post->comment_count); ?> <?php esc_html_e('comments', 'lsx'); ?></li> |
|
| 31 | 31 | <?php } } wp_reset_postdata(); ?> |
| 32 | 32 | </ul> |
| 33 | 33 | |
| 34 | - <h2><?php esc_html_e( 'Categories', 'lsx' ); ?></h3> |
|
| 34 | + <h2><?php esc_html_e('Categories', 'lsx'); ?></h3> |
|
| 35 | 35 | |
| 36 | 36 | <ul> |
| 37 | - <?php wp_list_categories( 'title_li=&hierarchical=0&show_count=1' ); ?> |
|
| 37 | + <?php wp_list_categories('title_li=&hierarchical=0&show_count=1'); ?> |
|
| 38 | 38 | </ul> |
| 39 | 39 | |
| 40 | - <h2><?php esc_html_e( 'Monthly Archives', 'lsx' ); ?></h3> |
|
| 40 | + <h2><?php esc_html_e('Monthly Archives', 'lsx'); ?></h3> |
|
| 41 | 41 | |
| 42 | 42 | <ul> |
| 43 | - <?php wp_get_archives( 'type=monthly&show_post_count=1' ); ?> |
|
| 43 | + <?php wp_get_archives('type=monthly&show_post_count=1'); ?> |
|
| 44 | 44 | </ul> |
| 45 | 45 | </div><!-- .entry-content --> |
| 46 | - <?php edit_post_link( esc_html__( 'Edit', 'lsx' ), '<footer class="entry-meta"><span class="edit-link">', '</span></footer>' ); ?> |
|
| 46 | + <?php edit_post_link(esc_html__('Edit', 'lsx'), '<footer class="entry-meta"><span class="edit-link">', '</span></footer>'); ?> |
|
| 47 | 47 | |
| 48 | 48 | <?php lsx_entry_bottom(); ?> |
| 49 | 49 | |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | <?php lsx_content_top(); ?> |
| 19 | 19 | |
| 20 | - <?php if(have_posts()) { ?> |
|
| 21 | - <?php while(have_posts()) { the_post(); ?> |
|
| 20 | + <?php if (have_posts()) { ?> |
|
| 21 | + <?php while (have_posts()) { the_post(); ?> |
|
| 22 | 22 | <div class="entry-content"> |
| 23 | 23 | |
| 24 | 24 | <?php the_content(); ?> |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | <?php } ?> |
| 30 | 30 | |
| 31 | 31 | <?php |
| 32 | - if ( get_query_var( 'paged' ) ) : |
|
| 33 | - $paged = get_query_var( 'paged' ); |
|
| 34 | - elseif ( get_query_var( 'page' ) ) : |
|
| 35 | - $paged = get_query_var( 'page' ); |
|
| 32 | + if (get_query_var('paged')) : |
|
| 33 | + $paged = get_query_var('paged'); |
|
| 34 | + elseif (get_query_var('page')) : |
|
| 35 | + $paged = get_query_var('page'); |
|
| 36 | 36 | else : |
| 37 | 37 | $paged = 1; |
| 38 | 38 | endif; |
@@ -41,18 +41,18 @@ discard block |
||
| 41 | 41 | 'post_type' => 'jetpack-portfolio', |
| 42 | 42 | 'posts_per_page' => 99, |
| 43 | 43 | ); |
| 44 | - $project_query = new WP_Query ( $args ); |
|
| 45 | - if ( post_type_exists( 'jetpack-portfolio' ) && $project_query -> have_posts() ) : |
|
| 44 | + $project_query = new WP_Query($args); |
|
| 45 | + if (post_type_exists('jetpack-portfolio') && $project_query -> have_posts()) : |
|
| 46 | 46 | ?> |
| 47 | 47 | |
| 48 | 48 | <?php lsx_portfolio_sorter(); ?> |
| 49 | 49 | |
| 50 | 50 | <div class="filter-items-wrapper lsx-portfolio-wrapper"> |
| 51 | 51 | <div class="filter-items-container lsx-portfolio masonry"> |
| 52 | - <?php while ( $project_query -> have_posts() ) : $project_query -> the_post(); ?> |
|
| 52 | + <?php while ($project_query -> have_posts()) : $project_query -> the_post(); ?> |
|
| 53 | 53 | |
| 54 | - <?php if(has_post_thumbnail()) { ?> |
|
| 55 | - <?php get_template_part( 'content', 'portfolio' ); ?> |
|
| 54 | + <?php if (has_post_thumbnail()) { ?> |
|
| 55 | + <?php get_template_part('content', 'portfolio'); ?> |
|
| 56 | 56 | <?php } ?> |
| 57 | 57 | |
| 58 | 58 | <?php endwhile; ?> |
@@ -63,17 +63,17 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | <section class="no-results not-found"> |
| 65 | 65 | <header class="page-header"> |
| 66 | - <h1 class="page-title"><?php esc_html_e( 'Nothing Found', 'lsx' ); ?></h1> |
|
| 66 | + <h1 class="page-title"><?php esc_html_e('Nothing Found', 'lsx'); ?></h1> |
|
| 67 | 67 | </header><!-- .page-header --> |
| 68 | 68 | |
| 69 | 69 | <div class="page-content"> |
| 70 | - <?php if ( current_user_can( 'publish_posts' ) ) : ?> |
|
| 70 | + <?php if (current_user_can('publish_posts')) : ?> |
|
| 71 | 71 | |
| 72 | - <p><?php esc_html_e( 'Ready to publish your first project?', 'lsx' ); ?> <a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=jetpack-portfolio' ) ) ?>"><?php esc_html_e( 'Get started here', 'lsx' ); ?></a></p> |
|
| 72 | + <p><?php esc_html_e('Ready to publish your first project?', 'lsx'); ?> <a href="<?php echo esc_url(admin_url('post-new.php?post_type=jetpack-portfolio')) ?>"><?php esc_html_e('Get started here', 'lsx'); ?></a></p> |
|
| 73 | 73 | |
| 74 | 74 | <?php else : ?> |
| 75 | 75 | |
| 76 | - <p><?php esc_html_e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'lsx' ); ?></p> |
|
| 76 | + <p><?php esc_html_e('It seems we can’t find what you’re looking for. Perhaps searching can help.', 'lsx'); ?></p> |
|
| 77 | 77 | <?php get_search_form(); ?> |
| 78 | 78 | |
| 79 | 79 | <?php endif; ?> |
@@ -33,8 +33,10 @@ discard block |
||
| 33 | 33 | $paged = get_query_var( 'paged' ); |
| 34 | 34 | elseif ( get_query_var( 'page' ) ) : |
| 35 | 35 | $paged = get_query_var( 'page' ); |
| 36 | - else : |
|
| 36 | + else { |
|
| 37 | + : |
|
| 37 | 38 | $paged = 1; |
| 39 | + } |
|
| 38 | 40 | endif; |
| 39 | 41 | |
| 40 | 42 | $args = array( |
@@ -59,11 +61,14 @@ discard block |
||
| 59 | 61 | </div> |
| 60 | 62 | </div><!-- .portfolio-wrapper --> |
| 61 | 63 | |
| 62 | - <?php else : ?> |
|
| 64 | + <?php else { |
|
| 65 | + : ?> |
|
| 63 | 66 | |
| 64 | 67 | <section class="no-results not-found"> |
| 65 | 68 | <header class="page-header"> |
| 66 | - <h1 class="page-title"><?php esc_html_e( 'Nothing Found', 'lsx' ); ?></h1> |
|
| 69 | + <h1 class="page-title"><?php esc_html_e( 'Nothing Found', 'lsx' ); |
|
| 70 | +} |
|
| 71 | +?></h1> |
|
| 67 | 72 | </header><!-- .page-header --> |
| 68 | 73 | |
| 69 | 74 | <div class="page-content"> |
@@ -71,9 +76,12 @@ discard block |
||
| 71 | 76 | |
| 72 | 77 | <p><?php esc_html_e( 'Ready to publish your first project?', 'lsx' ); ?> <a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=jetpack-portfolio' ) ) ?>"><?php esc_html_e( 'Get started here', 'lsx' ); ?></a></p> |
| 73 | 78 | |
| 74 | - <?php else : ?> |
|
| 79 | + <?php else { |
|
| 80 | + : ?> |
|
| 75 | 81 | |
| 76 | - <p><?php esc_html_e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'lsx' ); ?></p> |
|
| 82 | + <p><?php esc_html_e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'lsx' ); |
|
| 83 | +} |
|
| 84 | +?></p> |
|
| 77 | 85 | <?php get_search_form(); ?> |
| 78 | 86 | |
| 79 | 87 | <?php endif; ?> |
@@ -8,19 +8,19 @@ |
||
| 8 | 8 | // This is to help the customizer function better |
| 9 | 9 | $style = ''; |
| 10 | 10 | |
| 11 | -if ( is_customize_preview() ) { |
|
| 12 | - $search_form = get_theme_mod( 'lsx_header_search', 0 ); |
|
| 11 | +if (is_customize_preview()) { |
|
| 12 | + $search_form = get_theme_mod('lsx_header_search', 0); |
|
| 13 | 13 | |
| 14 | - if ( ! $search_form ) { |
|
| 14 | + if ( ! $search_form) { |
|
| 15 | 15 | $style = 'display:none;'; |
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 | ?> |
| 19 | 19 | |
| 20 | -<form role="search" method="get" style="<?php echo esc_attr( $style ); ?>" class="search-form form-inline" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>"> |
|
| 20 | +<form role="search" method="get" style="<?php echo esc_attr($style); ?>" class="search-form form-inline" id="searchform" action="<?php echo esc_url(home_url('/')); ?>"> |
|
| 21 | 21 | <div class="input-group"> |
| 22 | - <input type="search" value="<?php if (is_search()) { echo get_search_query(); } ?>" name="s" class="search-field form-control" placeholder="<?php esc_attr_e( 'Search', 'lsx' ); ?> <?php echo esc_attr( get_bloginfo( 'name' ) ); ?>"> |
|
| 23 | - <label class="hide"><?php esc_attr_e( 'Search for:', 'lsx' ); ?></label> |
|
| 22 | + <input type="search" value="<?php if (is_search()) { echo get_search_query(); } ?>" name="s" class="search-field form-control" placeholder="<?php esc_attr_e('Search', 'lsx'); ?> <?php echo esc_attr(get_bloginfo('name')); ?>"> |
|
| 23 | + <label class="hide"><?php esc_attr_e('Search for:', 'lsx'); ?></label> |
|
| 24 | 24 | <span class="input-group-btn"> |
| 25 | 25 | <button type="submit" class="search-submit btn btn-default"><span class="fa fa-search"></span></button> |
| 26 | 26 | </span> |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | // Add post/page slug |
| 16 | 16 | if (is_single() || is_page() && !is_front_page()) { |
| 17 | - $classes[] = basename(get_permalink()); |
|
| 17 | + $classes[] = basename(get_permalink()); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | if(!class_exists('Lsx_Banners')){ |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | // Remove unnecessary classes |
| 39 | 39 | $home_id_class = 'page-id-' . get_option('page_on_front'); |
| 40 | 40 | $remove_classes = array( |
| 41 | - 'page-template-default', |
|
| 42 | - $home_id_class |
|
| 41 | + 'page-template-default', |
|
| 42 | + $home_id_class |
|
| 43 | 43 | ); |
| 44 | 44 | $classes = array_diff($classes, $remove_classes); |
| 45 | 45 | |
@@ -271,12 +271,12 @@ discard block |
||
| 271 | 271 | || (is_singular('jetpack-portfolio')) ) { ?> |
| 272 | 272 | |
| 273 | 273 | <?php |
| 274 | - $bg_image = ''; |
|
| 275 | - if(has_post_thumbnail()){ |
|
| 276 | - $bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),'full'); |
|
| 277 | - $bg_image = $bg_image[0]; |
|
| 278 | - } |
|
| 279 | - ?> |
|
| 274 | + $bg_image = ''; |
|
| 275 | + if(has_post_thumbnail()){ |
|
| 276 | + $bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),'full'); |
|
| 277 | + $bg_image = $bg_image[0]; |
|
| 278 | + } |
|
| 279 | + ?> |
|
| 280 | 280 | |
| 281 | 281 | <?php if ( ! empty( $bg_image ) ) : ?> |
| 282 | 282 | |
@@ -309,8 +309,8 @@ discard block |
||
| 309 | 309 | * @category mobile |
| 310 | 310 | */ |
| 311 | 311 | function lsx_allow_sms_protocol( $protocols ) { |
| 312 | - $protocols[] = 'sms'; |
|
| 313 | - return $protocols; |
|
| 312 | + $protocols[] = 'sms'; |
|
| 313 | + return $protocols; |
|
| 314 | 314 | } |
| 315 | 315 | add_filter( 'kses_allowed_protocols', 'lsx_allow_sms_protocol' ); |
| 316 | 316 | |
@@ -322,27 +322,27 @@ discard block |
||
| 322 | 322 | $http_user_agent = sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ); |
| 323 | 323 | $http_user_agent = ! empty( $http_user_agent ) ? $http_user_agent : ''; |
| 324 | 324 | |
| 325 | - global $is_lynx, $is_gecko, $is_ie, $is_opera, $is_ns4, $is_safari, $is_chrome, $is_iphone; |
|
| 326 | - if($is_lynx) $classes[] = 'lynx'; |
|
| 327 | - elseif($is_gecko) $classes[] = 'gecko'; |
|
| 328 | - elseif($is_opera) $classes[] = 'opera'; |
|
| 329 | - elseif($is_ns4) $classes[] = 'ns4'; |
|
| 330 | - elseif($is_safari) $classes[] = 'safari'; |
|
| 331 | - elseif($is_chrome) $classes[] = 'chrome'; |
|
| 332 | - elseif($is_ie) { |
|
| 333 | - $classes[] = 'ie'; |
|
| 334 | - if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version)) |
|
| 335 | - $classes[] = 'ie'.$browser_version[1]; |
|
| 336 | - } else $classes[] = 'unknown'; |
|
| 337 | - if($is_iphone) $classes[] = 'iphone'; |
|
| 338 | - if ( stristr( $http_user_agent, "mac") ) { |
|
| 339 | - $classes[] = 'osx'; |
|
| 340 | - } elseif ( stristr( $http_user_agent, "linux") ) { |
|
| 341 | - $classes[] = 'linux'; |
|
| 342 | - } elseif ( stristr( $http_user_agent, "windows") ) { |
|
| 343 | - $classes[] = 'windows'; |
|
| 344 | - } |
|
| 345 | - return $classes; |
|
| 325 | + global $is_lynx, $is_gecko, $is_ie, $is_opera, $is_ns4, $is_safari, $is_chrome, $is_iphone; |
|
| 326 | + if($is_lynx) $classes[] = 'lynx'; |
|
| 327 | + elseif($is_gecko) $classes[] = 'gecko'; |
|
| 328 | + elseif($is_opera) $classes[] = 'opera'; |
|
| 329 | + elseif($is_ns4) $classes[] = 'ns4'; |
|
| 330 | + elseif($is_safari) $classes[] = 'safari'; |
|
| 331 | + elseif($is_chrome) $classes[] = 'chrome'; |
|
| 332 | + elseif($is_ie) { |
|
| 333 | + $classes[] = 'ie'; |
|
| 334 | + if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version)) |
|
| 335 | + $classes[] = 'ie'.$browser_version[1]; |
|
| 336 | + } else $classes[] = 'unknown'; |
|
| 337 | + if($is_iphone) $classes[] = 'iphone'; |
|
| 338 | + if ( stristr( $http_user_agent, "mac") ) { |
|
| 339 | + $classes[] = 'osx'; |
|
| 340 | + } elseif ( stristr( $http_user_agent, "linux") ) { |
|
| 341 | + $classes[] = 'linux'; |
|
| 342 | + } elseif ( stristr( $http_user_agent, "windows") ) { |
|
| 343 | + $classes[] = 'windows'; |
|
| 344 | + } |
|
| 345 | + return $classes; |
|
| 346 | 346 | } |
| 347 | 347 | add_filter('body_class','mv_browser_body_class'); |
| 348 | 348 | |
@@ -197,6 +197,7 @@ discard block |
||
| 197 | 197 | * @package lsx |
| 198 | 198 | * @subpackage extras |
| 199 | 199 | * @category thumbnails |
| 200 | + * @param string $size |
|
| 200 | 201 | */ |
| 201 | 202 | function lsx_get_thumbnail($size,$image_src = false){ |
| 202 | 203 | |
@@ -251,6 +252,7 @@ discard block |
||
| 251 | 252 | * @package lsx |
| 252 | 253 | * @subpackage extras |
| 253 | 254 | * @category thumbnails |
| 255 | + * @param boolean $image_src |
|
| 254 | 256 | */ |
| 255 | 257 | function lsx_get_attachment_id_from_src( $image_src ) { |
| 256 | 258 | $post_id = wp_cache_get( $image_src, 'lsx_get_attachment_id_from_src' ); |
@@ -1,5 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + return; |
|
| 4 | +} |
|
| 5 | +// Exit if accessed directly |
|
| 3 | 6 | |
| 4 | 7 | /** |
| 5 | 8 | * Enable extra attributes (srcset, sizes) in img tag |
@@ -203,10 +206,10 @@ discard block |
||
| 203 | 206 | if(false === $image_src){ |
| 204 | 207 | $post_id = get_the_ID(); |
| 205 | 208 | $post_thumbnail_id = get_post_thumbnail_id( $post_id ); |
| 206 | - }elseif(false != $image_src ){ |
|
| 209 | + } elseif(false != $image_src ){ |
|
| 207 | 210 | if(is_numeric($image_src)){ |
| 208 | 211 | $post_thumbnail_id = $image_src; |
| 209 | - }else{ |
|
| 212 | + } else{ |
|
| 210 | 213 | $post_thumbnail_id = lsx_get_attachment_id_from_src($image_src); |
| 211 | 214 | } |
| 212 | 215 | } |
@@ -334,18 +337,29 @@ discard block |
||
| 334 | 337 | $http_user_agent = ! empty( $http_user_agent ) ? $http_user_agent : ''; |
| 335 | 338 | |
| 336 | 339 | global $is_lynx, $is_gecko, $is_ie, $is_opera, $is_ns4, $is_safari, $is_chrome, $is_iphone; |
| 337 | - if($is_lynx) $classes[] = 'lynx'; |
|
| 338 | - elseif($is_gecko) $classes[] = 'gecko'; |
|
| 339 | - elseif($is_opera) $classes[] = 'opera'; |
|
| 340 | - elseif($is_ns4) $classes[] = 'ns4'; |
|
| 341 | - elseif($is_safari) $classes[] = 'safari'; |
|
| 342 | - elseif($is_chrome) $classes[] = 'chrome'; |
|
| 343 | - elseif($is_ie) { |
|
| 340 | + if($is_lynx) { |
|
| 341 | + $classes[] = 'lynx'; |
|
| 342 | + } elseif($is_gecko) { |
|
| 343 | + $classes[] = 'gecko'; |
|
| 344 | + } elseif($is_opera) { |
|
| 345 | + $classes[] = 'opera'; |
|
| 346 | + } elseif($is_ns4) { |
|
| 347 | + $classes[] = 'ns4'; |
|
| 348 | + } elseif($is_safari) { |
|
| 349 | + $classes[] = 'safari'; |
|
| 350 | + } elseif($is_chrome) { |
|
| 351 | + $classes[] = 'chrome'; |
|
| 352 | + } elseif($is_ie) { |
|
| 344 | 353 | $classes[] = 'ie'; |
| 345 | - if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version)) |
|
| 346 | - $classes[] = 'ie'.$browser_version[1]; |
|
| 347 | - } else $classes[] = 'unknown'; |
|
| 348 | - if($is_iphone) $classes[] = 'iphone'; |
|
| 354 | + if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version)) { |
|
| 355 | + $classes[] = 'ie'.$browser_version[1]; |
|
| 356 | + } |
|
| 357 | + } else { |
|
| 358 | + $classes[] = 'unknown'; |
|
| 359 | + } |
|
| 360 | + if($is_iphone) { |
|
| 361 | + $classes[] = 'iphone'; |
|
| 362 | + } |
|
| 349 | 363 | if ( stristr( $http_user_agent, "mac") ) { |
| 350 | 364 | $classes[] = 'osx'; |
| 351 | 365 | } elseif ( stristr( $http_user_agent, "linux") ) { |
@@ -403,8 +417,7 @@ discard block |
||
| 403 | 417 | |
| 404 | 418 | if ( ! empty( $pagination ) ) { |
| 405 | 419 | $excerpt .= $pagination; |
| 406 | - } |
|
| 407 | - else { |
|
| 420 | + } else { |
|
| 408 | 421 | $excerpt .= '<p><a class="moretag" href="'.get_permalink().'">'.esc_html__('Continue reading','lsx').'</a></p>'; |
| 409 | 422 | } |
| 410 | 423 | } |
@@ -1,16 +1,16 @@ 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 | * Enable extra attributes (srcset, sizes) in img tag |
| 6 | 6 | */ |
| 7 | -function lsx_kses_allowed_html( $allowedtags, $context ) { |
|
| 7 | +function lsx_kses_allowed_html($allowedtags, $context) { |
|
| 8 | 8 | $allowedtags['img']['srcset'] = true; |
| 9 | 9 | $allowedtags['img']['sizes'] = true; |
| 10 | 10 | |
| 11 | 11 | return $allowedtags; |
| 12 | 12 | } |
| 13 | -add_filter( 'wp_kses_allowed_html', 'lsx_kses_allowed_html', 10, 2 ); |
|
| 13 | +add_filter('wp_kses_allowed_html', 'lsx_kses_allowed_html', 10, 2); |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Add and remove body_class() classes |
@@ -19,21 +19,21 @@ discard block |
||
| 19 | 19 | /* |
| 20 | 20 | * Add the header layout class |
| 21 | 21 | */ |
| 22 | - $header_layout = get_theme_mod('lsx_header_layout','inline'); |
|
| 23 | - $classes[] = 'header-'.$header_layout; |
|
| 22 | + $header_layout = get_theme_mod('lsx_header_layout', 'inline'); |
|
| 23 | + $classes[] = 'header-' . $header_layout; |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | // Add post/page slug |
| 27 | - if (is_single() || is_page() && !is_front_page()) { |
|
| 27 | + if (is_single() || is_page() && ! is_front_page()) { |
|
| 28 | 28 | $classes[] = basename(get_permalink()); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - if(!class_exists('Lsx_Banners')){ |
|
| 32 | - $post_types = array('page','post'); |
|
| 33 | - $post_types = apply_filters('lsx_allowed_post_type_banners',$post_types); |
|
| 31 | + if ( ! class_exists('Lsx_Banners')) { |
|
| 32 | + $post_types = array('page', 'post'); |
|
| 33 | + $post_types = apply_filters('lsx_allowed_post_type_banners', $post_types); |
|
| 34 | 34 | |
| 35 | - if((is_singular($post_types) && has_post_thumbnail()) |
|
| 36 | - || (is_singular('jetpack-portfolio'))){ |
|
| 35 | + if ((is_singular($post_types) && has_post_thumbnail()) |
|
| 36 | + || (is_singular('jetpack-portfolio'))) { |
|
| 37 | 37 | $classes[] = 'page-has-banner'; |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $classes[] = 'has-top-menu'; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if ( get_theme_mod( 'lsx_preloader_content_status', '1' ) === '1' ) { |
|
| 45 | + if (get_theme_mod('lsx_preloader_content_status', '1') === '1') { |
|
| 46 | 46 | $classes[] = 'preloader-content-enable'; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -66,30 +66,30 @@ discard block |
||
| 66 | 66 | * @param string $sep Optional separator. |
| 67 | 67 | * @return string The filtered title. |
| 68 | 68 | */ |
| 69 | -function lsx_wp_title( $title, $sep ) { |
|
| 69 | +function lsx_wp_title($title, $sep) { |
|
| 70 | 70 | global $page, $paged; |
| 71 | 71 | |
| 72 | - if ( is_feed() ) { |
|
| 72 | + if (is_feed()) { |
|
| 73 | 73 | return $title; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // Add the blog name |
| 77 | - $title .= get_bloginfo( 'name' ); |
|
| 77 | + $title .= get_bloginfo('name'); |
|
| 78 | 78 | |
| 79 | 79 | // Add the blog description for the home/front page. |
| 80 | - $site_description = get_bloginfo( 'description', 'display' ); |
|
| 81 | - if ( $site_description && ( is_home() || is_front_page() ) ) { |
|
| 80 | + $site_description = get_bloginfo('description', 'display'); |
|
| 81 | + if ($site_description && (is_home() || is_front_page())) { |
|
| 82 | 82 | $title .= " $sep $site_description"; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // Add a page number if necessary: |
| 86 | - if ( $paged >= 2 || $page >= 2 ) { |
|
| 87 | - $title .= " $sep " . sprintf( __( 'Page %s', 'lsx' ), max( $paged, $page ) ); |
|
| 86 | + if ($paged >= 2 || $page >= 2) { |
|
| 87 | + $title .= " $sep " . sprintf(__('Page %s', 'lsx'), max($paged, $page)); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | return $title; |
| 91 | 91 | } |
| 92 | -add_filter( 'wp_title', 'lsx_wp_title', 10, 2 ); |
|
| 92 | +add_filter('wp_title', 'lsx_wp_title', 10, 2); |
|
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | function lsx_remove_self_closing_tags($input) { |
| 111 | 111 | return str_replace(' />', '>', $input); |
| 112 | 112 | } |
| 113 | -add_filter('get_avatar', 'lsx_remove_self_closing_tags'); // <img /> |
|
| 114 | -add_filter('comment_id_fields', 'lsx_remove_self_closing_tags'); // <input /> |
|
| 113 | +add_filter('get_avatar', 'lsx_remove_self_closing_tags'); // <img /> |
|
| 114 | +add_filter('comment_id_fields', 'lsx_remove_self_closing_tags'); // <input /> |
|
| 115 | 115 | add_filter('post_thumbnail_html', 'lsx_remove_self_closing_tags'); // <img /> |
| 116 | 116 | |
| 117 | 117 | |
| 118 | -if (!function_exists('lsx_get_attachment_id')) { |
|
| 118 | +if ( ! function_exists('lsx_get_attachment_id')) { |
|
| 119 | 119 | /** |
| 120 | 120 | * Get the Attachment ID for a given image URL. |
| 121 | 121 | * |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | function lsx_get_attachment_id($url) { |
| 127 | 127 | $dir = wp_upload_dir(); |
| 128 | 128 | // baseurl never has a trailing slash |
| 129 | - if (false === strpos($url, $dir['baseurl'].'/')) { |
|
| 129 | + if (false === strpos($url, $dir['baseurl'] . '/')) { |
|
| 130 | 130 | // URL points to a place outside of upload directory |
| 131 | 131 | return false; |
| 132 | 132 | } |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | $query['meta_query'][0]['key'] = '_wp_attached_file'; |
| 145 | 145 | // query attachments |
| 146 | 146 | $ids = get_posts($query); |
| 147 | - if (!empty($ids)) { |
|
| 147 | + if ( ! empty($ids)) { |
|
| 148 | 148 | foreach ($ids as $id) { |
| 149 | 149 | // first entry of returned array is the URL |
| 150 | - $temp_url = wp_get_attachment_image_src( $id, 'full' ); |
|
| 151 | - if ( array_shift( $temp_url ) === $url ) { |
|
| 150 | + $temp_url = wp_get_attachment_image_src($id, 'full'); |
|
| 151 | + if (array_shift($temp_url) === $url) { |
|
| 152 | 152 | return $id; |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | foreach ($ids as $id) { |
| 163 | 163 | $meta = wp_get_attachment_metadata($id); |
| 164 | - foreach ( $meta['sizes'] as $size => $values ) { |
|
| 165 | - if ( $values['file'] === $file && array_shift( wp_get_attachment_image_src( $id, $size ) ) === $url ) { |
|
| 164 | + foreach ($meta['sizes'] as $size => $values) { |
|
| 165 | + if ($values['file'] === $file && array_shift(wp_get_attachment_image_src($id, $size)) === $url) { |
|
| 166 | 166 | return $id; |
| 167 | 167 | } |
| 168 | 168 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | function lsx_is_element_empty($element) { |
| 189 | 189 | $element = trim($element); |
| 190 | - return empty($element)?false:true; |
|
| 190 | + return empty($element) ? false : true; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | |
@@ -198,39 +198,39 @@ discard block |
||
| 198 | 198 | * @subpackage extras |
| 199 | 199 | * @category thumbnails |
| 200 | 200 | */ |
| 201 | -function lsx_get_thumbnail($size,$image_src = false){ |
|
| 201 | +function lsx_get_thumbnail($size, $image_src = false) { |
|
| 202 | 202 | |
| 203 | - if(false === $image_src){ |
|
| 203 | + if (false === $image_src) { |
|
| 204 | 204 | $post_id = get_the_ID(); |
| 205 | - $post_thumbnail_id = get_post_thumbnail_id( $post_id ); |
|
| 206 | - }elseif(false != $image_src ){ |
|
| 207 | - if(is_numeric($image_src)){ |
|
| 205 | + $post_thumbnail_id = get_post_thumbnail_id($post_id); |
|
| 206 | + }elseif (false != $image_src) { |
|
| 207 | + if (is_numeric($image_src)) { |
|
| 208 | 208 | $post_thumbnail_id = $image_src; |
| 209 | - }else{ |
|
| 209 | + } else { |
|
| 210 | 210 | $post_thumbnail_id = lsx_get_attachment_id_from_src($image_src); |
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | - $size = apply_filters('lsx_thumbnail_size',$size); |
|
| 213 | + $size = apply_filters('lsx_thumbnail_size', $size); |
|
| 214 | 214 | $img = false; |
| 215 | - if ( 'lsx-thumbnail-wide' === $size || 'thumbnail' === $size ) { |
|
| 215 | + if ('lsx-thumbnail-wide' === $size || 'thumbnail' === $size) { |
|
| 216 | 216 | $srcset = false; |
| 217 | - $img = wp_get_attachment_image_src($post_thumbnail_id,$size); |
|
| 217 | + $img = wp_get_attachment_image_src($post_thumbnail_id, $size); |
|
| 218 | 218 | $img = $img[0]; |
| 219 | 219 | } else { |
| 220 | 220 | $srcset = true; |
| 221 | - $img = wp_get_attachment_image_srcset($post_thumbnail_id,$size); |
|
| 222 | - if ( false == $img ) { |
|
| 221 | + $img = wp_get_attachment_image_srcset($post_thumbnail_id, $size); |
|
| 222 | + if (false == $img) { |
|
| 223 | 223 | $srcset = false; |
| 224 | - $img = wp_get_attachment_image_src($post_thumbnail_id,$size); |
|
| 224 | + $img = wp_get_attachment_image_src($post_thumbnail_id, $size); |
|
| 225 | 225 | $img = $img[0]; |
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | - if ( $srcset ) { |
|
| 229 | - $img = '<img alt="'.get_the_title(get_the_ID()).'" class="attachment-responsive wp-post-image lsx-responsive" srcset="'.$img.'" />'; |
|
| 228 | + if ($srcset) { |
|
| 229 | + $img = '<img alt="' . get_the_title(get_the_ID()) . '" class="attachment-responsive wp-post-image lsx-responsive" srcset="' . $img . '" />'; |
|
| 230 | 230 | } else { |
| 231 | - $img = '<img alt="'.get_the_title(get_the_ID()).'" class="attachment-responsive wp-post-image lsx-responsive" src="'.$img.'" />'; |
|
| 231 | + $img = '<img alt="' . get_the_title(get_the_ID()) . '" class="attachment-responsive wp-post-image lsx-responsive" src="' . $img . '" />'; |
|
| 232 | 232 | } |
| 233 | - $img = apply_filters('lsx_lazyload_filter_images',$img); |
|
| 233 | + $img = apply_filters('lsx_lazyload_filter_images', $img); |
|
| 234 | 234 | return $img; |
| 235 | 235 | } |
| 236 | 236 | |
@@ -241,8 +241,8 @@ discard block |
||
| 241 | 241 | * @subpackage extras |
| 242 | 242 | * @category thumbnails |
| 243 | 243 | */ |
| 244 | -function lsx_thumbnail( $size = 'thumbnail', $image_src = false ) { |
|
| 245 | - echo wp_kses_post( lsx_get_thumbnail( $size, $image_src ) ); |
|
| 244 | +function lsx_thumbnail($size = 'thumbnail', $image_src = false) { |
|
| 245 | + echo wp_kses_post(lsx_get_thumbnail($size, $image_src)); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | |
@@ -252,13 +252,13 @@ discard block |
||
| 252 | 252 | * @subpackage extras |
| 253 | 253 | * @category thumbnails |
| 254 | 254 | */ |
| 255 | -function lsx_get_attachment_id_from_src( $image_src ) { |
|
| 256 | - $post_id = wp_cache_get( $image_src, 'lsx_get_attachment_id_from_src' ); |
|
| 255 | +function lsx_get_attachment_id_from_src($image_src) { |
|
| 256 | + $post_id = wp_cache_get($image_src, 'lsx_get_attachment_id_from_src'); |
|
| 257 | 257 | |
| 258 | - if ( false === $post_id ) { |
|
| 258 | + if (false === $post_id) { |
|
| 259 | 259 | global $wpdb; |
| 260 | - $post_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE guid='%s' LIMIT 1", $image_src ) ); |
|
| 261 | - wp_cache_set( $image_src, $post_id, 'lsx_get_attachment_id_from_src', 3600 ); |
|
| 260 | + $post_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE guid='%s' LIMIT 1", $image_src)); |
|
| 261 | + wp_cache_set($image_src, $post_id, 'lsx_get_attachment_id_from_src', 3600); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | return $post_id; |
@@ -272,28 +272,28 @@ discard block |
||
| 272 | 272 | * @subpackage extras |
| 273 | 273 | * @category banner |
| 274 | 274 | */ |
| 275 | -if (!function_exists('lsx_page_banner')) { |
|
| 275 | +if ( ! function_exists('lsx_page_banner')) { |
|
| 276 | 276 | function lsx_page_banner() { |
| 277 | 277 | |
| 278 | - $post_types = array('page','post'); |
|
| 279 | - $post_types = apply_filters('lsx_allowed_post_type_banners',$post_types); |
|
| 278 | + $post_types = array('page', 'post'); |
|
| 279 | + $post_types = apply_filters('lsx_allowed_post_type_banners', $post_types); |
|
| 280 | 280 | |
| 281 | - if ( (is_singular($post_types) && has_post_thumbnail()) |
|
| 282 | - || (is_singular('jetpack-portfolio')) ) { ?> |
|
| 281 | + if ((is_singular($post_types) && has_post_thumbnail()) |
|
| 282 | + || (is_singular('jetpack-portfolio'))) { ?> |
|
| 283 | 283 | |
| 284 | 284 | <?php |
| 285 | 285 | $bg_image = ''; |
| 286 | - if(has_post_thumbnail()){ |
|
| 287 | - $bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),'full'); |
|
| 286 | + if (has_post_thumbnail()) { |
|
| 287 | + $bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full'); |
|
| 288 | 288 | $bg_image = $bg_image[0]; |
| 289 | 289 | } |
| 290 | 290 | ?> |
| 291 | 291 | |
| 292 | - <?php if ( ! empty( $bg_image ) ) : ?> |
|
| 292 | + <?php if ( ! empty($bg_image)) : ?> |
|
| 293 | 293 | |
| 294 | 294 | <div class="page-banner-wrap"> |
| 295 | 295 | <div class="page-banner"> |
| 296 | - <div class="page-banner-image" style="background-image:url(<?php echo esc_attr( $bg_image ); ?>);"></div> |
|
| 296 | + <div class="page-banner-image" style="background-image:url(<?php echo esc_attr($bg_image); ?>);"></div> |
|
| 297 | 297 | |
| 298 | 298 | <div class="container"> |
| 299 | 299 | <header class="page-header"> |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | <?php } |
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | -add_action( 'lsx_header_after', 'lsx_page_banner' ); |
|
| 312 | +add_action('lsx_header_after', 'lsx_page_banner'); |
|
| 313 | 313 | |
| 314 | 314 | |
| 315 | 315 | /** |
@@ -319,43 +319,43 @@ discard block |
||
| 319 | 319 | * @subpackage extras |
| 320 | 320 | * @category mobile |
| 321 | 321 | */ |
| 322 | -function lsx_allow_sms_protocol( $protocols ) { |
|
| 322 | +function lsx_allow_sms_protocol($protocols) { |
|
| 323 | 323 | $protocols[] = 'sms'; |
| 324 | 324 | return $protocols; |
| 325 | 325 | } |
| 326 | -add_filter( 'kses_allowed_protocols', 'lsx_allow_sms_protocol' ); |
|
| 326 | +add_filter('kses_allowed_protocols', 'lsx_allow_sms_protocol'); |
|
| 327 | 327 | |
| 328 | 328 | |
| 329 | 329 | /** |
| 330 | 330 | * Adding browser and user-agent classes to body |
| 331 | 331 | */ |
| 332 | 332 | function mv_browser_body_class($classes) { |
| 333 | - $http_user_agent = sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ); |
|
| 334 | - $http_user_agent = ! empty( $http_user_agent ) ? $http_user_agent : ''; |
|
| 333 | + $http_user_agent = sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT'])); |
|
| 334 | + $http_user_agent = ! empty($http_user_agent) ? $http_user_agent : ''; |
|
| 335 | 335 | |
| 336 | 336 | global $is_lynx, $is_gecko, $is_ie, $is_opera, $is_ns4, $is_safari, $is_chrome, $is_iphone; |
| 337 | - if($is_lynx) $classes[] = 'lynx'; |
|
| 338 | - elseif($is_gecko) $classes[] = 'gecko'; |
|
| 339 | - elseif($is_opera) $classes[] = 'opera'; |
|
| 340 | - elseif($is_ns4) $classes[] = 'ns4'; |
|
| 341 | - elseif($is_safari) $classes[] = 'safari'; |
|
| 342 | - elseif($is_chrome) $classes[] = 'chrome'; |
|
| 343 | - elseif($is_ie) { |
|
| 337 | + if ($is_lynx) $classes[] = 'lynx'; |
|
| 338 | + elseif ($is_gecko) $classes[] = 'gecko'; |
|
| 339 | + elseif ($is_opera) $classes[] = 'opera'; |
|
| 340 | + elseif ($is_ns4) $classes[] = 'ns4'; |
|
| 341 | + elseif ($is_safari) $classes[] = 'safari'; |
|
| 342 | + elseif ($is_chrome) $classes[] = 'chrome'; |
|
| 343 | + elseif ($is_ie) { |
|
| 344 | 344 | $classes[] = 'ie'; |
| 345 | - if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version)) |
|
| 346 | - $classes[] = 'ie'.$browser_version[1]; |
|
| 345 | + if (preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version)) |
|
| 346 | + $classes[] = 'ie' . $browser_version[1]; |
|
| 347 | 347 | } else $classes[] = 'unknown'; |
| 348 | - if($is_iphone) $classes[] = 'iphone'; |
|
| 349 | - if ( stristr( $http_user_agent, "mac") ) { |
|
| 348 | + if ($is_iphone) $classes[] = 'iphone'; |
|
| 349 | + if (stristr($http_user_agent, "mac")) { |
|
| 350 | 350 | $classes[] = 'osx'; |
| 351 | - } elseif ( stristr( $http_user_agent, "linux") ) { |
|
| 351 | + } elseif (stristr($http_user_agent, "linux")) { |
|
| 352 | 352 | $classes[] = 'linux'; |
| 353 | - } elseif ( stristr( $http_user_agent, "windows") ) { |
|
| 353 | + } elseif (stristr($http_user_agent, "windows")) { |
|
| 354 | 354 | $classes[] = 'windows'; |
| 355 | 355 | } |
| 356 | 356 | return $classes; |
| 357 | 357 | } |
| 358 | -add_filter('body_class','mv_browser_body_class'); |
|
| 358 | +add_filter('body_class', 'mv_browser_body_class'); |
|
| 359 | 359 | |
| 360 | 360 | |
| 361 | 361 | /** |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | * @param $form Object |
| 369 | 369 | * @return String |
| 370 | 370 | */ |
| 371 | -function lsx_form_submit_button($button, $form){ |
|
| 371 | +function lsx_form_submit_button($button, $form) { |
|
| 372 | 372 | return "<button class='btn btn-primary' id='gform_submit_button_{$form["id"]}'><span>Submit</span></button>"; |
| 373 | 373 | } |
| 374 | 374 | add_filter("gform_submit_button", "lsx_form_submit_button", 10, 2); |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | //return ' ... <a class="moretag" href="'. get_permalink($post->ID) . '">'.esc_html__('Continue reading','lsx').'</a>'; |
| 383 | 383 | return '...'; |
| 384 | 384 | } |
| 385 | -add_filter( 'excerpt_more', 'lsx_excerpt_more' ); |
|
| 385 | +add_filter('excerpt_more', 'lsx_excerpt_more'); |
|
| 386 | 386 | |
| 387 | 387 | |
| 388 | 388 | /** |
@@ -391,44 +391,44 @@ discard block |
||
| 391 | 391 | function lsx_the_excerpt_filter($excerpt) { |
| 392 | 392 | $show_full_content = has_post_format(apply_filters('lsx_the_excerpt_filter_post_types', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio'))); |
| 393 | 393 | |
| 394 | - if (!$show_full_content) { |
|
| 395 | - if ('' !== $excerpt && !stristr($excerpt, 'moretag')) { |
|
| 396 | - $pagination = wp_link_pages( array( |
|
| 394 | + if ( ! $show_full_content) { |
|
| 395 | + if ('' !== $excerpt && ! stristr($excerpt, 'moretag')) { |
|
| 396 | + $pagination = wp_link_pages(array( |
|
| 397 | 397 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
| 398 | 398 | 'after' => '</div></div>', |
| 399 | 399 | 'link_before' => '<span>', |
| 400 | 400 | 'link_after' => '</span>', |
| 401 | 401 | 'echo' => 0 |
| 402 | - ) ); |
|
| 402 | + )); |
|
| 403 | 403 | |
| 404 | - if ( ! empty( $pagination ) ) { |
|
| 404 | + if ( ! empty($pagination)) { |
|
| 405 | 405 | $excerpt .= $pagination; |
| 406 | 406 | } |
| 407 | 407 | else { |
| 408 | - $excerpt .= '<p><a class="moretag" href="'.get_permalink().'">'.esc_html__('Continue reading','lsx').'</a></p>'; |
|
| 408 | + $excerpt .= '<p><a class="moretag" href="' . get_permalink() . '">' . esc_html__('Continue reading', 'lsx') . '</a></p>'; |
|
| 409 | 409 | } |
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | return $excerpt; |
| 414 | 414 | } |
| 415 | -add_filter( 'the_excerpt', 'lsx_the_excerpt_filter' , 1 , 20 ); |
|
| 415 | +add_filter('the_excerpt', 'lsx_the_excerpt_filter', 1, 20); |
|
| 416 | 416 | |
| 417 | 417 | |
| 418 | 418 | /** |
| 419 | 419 | * Allow HTML tags in excerpt |
| 420 | 420 | */ |
| 421 | -if ( ! function_exists( 'wpse_custom_wp_trim_excerpt' ) ) { |
|
| 421 | +if ( ! function_exists('wpse_custom_wp_trim_excerpt')) { |
|
| 422 | 422 | function wpse_custom_wp_trim_excerpt($wpse_excerpt) { |
| 423 | 423 | global $post; |
| 424 | 424 | $raw_excerpt = $wpse_excerpt; |
| 425 | 425 | |
| 426 | - if ( '' == $wpse_excerpt ) { |
|
| 426 | + if ('' == $wpse_excerpt) { |
|
| 427 | 427 | $wpse_excerpt = get_the_content(''); |
| 428 | 428 | $show_full_content = has_post_format(array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio')); |
| 429 | 429 | |
| 430 | - if (!$show_full_content) { |
|
| 431 | - $wpse_excerpt = strip_shortcodes( $wpse_excerpt ); |
|
| 430 | + if ( ! $show_full_content) { |
|
| 431 | + $wpse_excerpt = strip_shortcodes($wpse_excerpt); |
|
| 432 | 432 | $wpse_excerpt = apply_filters('the_content', $wpse_excerpt); |
| 433 | 433 | $wpse_excerpt = str_replace(']]>', ']]>', $wpse_excerpt); |
| 434 | 434 | $wpse_excerpt = strip_tags($wpse_excerpt, '<blockquote>,<p>,<br>,<b>,<strong>,<i>,<u>,<ul>,<li>,<span>,<div>'); |
@@ -456,12 +456,12 @@ discard block |
||
| 456 | 456 | $wpse_excerpt = trim(force_balance_tags($excerpt_output)); |
| 457 | 457 | |
| 458 | 458 | if ($has_more) { |
| 459 | - $excerpt_end = '<a class="moretag" href="'.get_permalink().'">'.esc_html__('More','lsx').'</a>'; |
|
| 459 | + $excerpt_end = '<a class="moretag" href="' . get_permalink() . '">' . esc_html__('More', 'lsx') . '</a>'; |
|
| 460 | 460 | $excerpt_end = apply_filters('excerpt_more', ' ' . $excerpt_end); |
| 461 | 461 | |
| 462 | 462 | $pos = strrpos($wpse_excerpt, '</'); |
| 463 | 463 | |
| 464 | - if ( false !== $pos ) { |
|
| 464 | + if (false !== $pos) { |
|
| 465 | 465 | // Inside last HTML tag |
| 466 | 466 | $wpse_excerpt = substr_replace($wpse_excerpt, $excerpt_end, $pos, 0); /* Add read more next to last word */ |
| 467 | 467 | } else { |
@@ -1,24 +1,24 @@ |
||
| 1 | 1 | <?php |
| 2 | - if ( isset( $GLOBALS['comment_depth'] ) ) { |
|
| 3 | - $depth = intval( $GLOBALS['comment_depth'] ); |
|
| 2 | + if (isset($GLOBALS['comment_depth'])) { |
|
| 3 | + $depth = intval($GLOBALS['comment_depth']); |
|
| 4 | 4 | } else { |
| 5 | 5 | $depth = 1; |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | - $max_depth = intval( get_option( 'thread_comments_depth' ) ); |
|
| 8 | + $max_depth = intval(get_option('thread_comments_depth')); |
|
| 9 | 9 | ?> |
| 10 | 10 | |
| 11 | 11 | <?php echo get_avatar($comment, '64'); ?> |
| 12 | 12 | <div class="media-body"> |
| 13 | 13 | <h4 class="media-heading"><?php echo get_comment_author_link(); ?></h4> |
| 14 | - <time datetime="<?php echo comment_date('c'); ?>"><a href="<?php echo esc_url(get_comment_link($comment->comment_ID)); ?>"><?php printf(esc_html__('%1$s on %2$s', 'lsx'), get_comment_date(), get_comment_time()); ?></a></time> |
|
| 14 | + <time datetime="<?php echo comment_date('c'); ?>"><a href="<?php echo esc_url(get_comment_link($comment->comment_ID)); ?>"><?php printf(esc_html__('%1$s on %2$s', 'lsx'), get_comment_date(), get_comment_time()); ?></a></time> |
|
| 15 | 15 | <?php edit_comment_link(esc_html__('(Edit)', 'lsx'), '', ''); ?> |
| 16 | 16 | |
| 17 | - <?php if ( '0' == $comment->comment_approved ) : ?> |
|
| 17 | + <?php if ('0' == $comment->comment_approved) : ?> |
|
| 18 | 18 | <div class="alert alert-info"> |
| 19 | 19 | <?php esc_html_e('Your comment is awaiting moderation.', 'lsx'); ?> |
| 20 | 20 | </div> |
| 21 | 21 | <?php endif; ?> |
| 22 | 22 | |
| 23 | 23 | <?php comment_text(); ?> |
| 24 | -<?php comment_reply_link( array( 'depth' => $depth, 'max_depth' => $max_depth ) ); |
|
| 25 | 24 | \ No newline at end of file |
| 25 | +<?php comment_reply_link(array('depth' => $depth, 'max_depth' => $max_depth)); |
|
| 26 | 26 | \ No newline at end of file |
@@ -243,14 +243,13 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | $meta_value = get_post_meta( $post_id, $meta_key, true ); |
| 245 | 245 | |
| 246 | - if ( $new_meta_value && '' == $meta_value ) |
|
| 247 | - add_post_meta( $post_id, $meta_key, $new_meta_value, true ); |
|
| 248 | - |
|
| 249 | - elseif ( $new_meta_value && $new_meta_value != $meta_value ) |
|
| 250 | - update_post_meta( $post_id, $meta_key, $new_meta_value ); |
|
| 251 | - |
|
| 252 | - elseif ( '' == $new_meta_value && $meta_value ) |
|
| 253 | - delete_post_meta( $post_id, $meta_key, $meta_value ); |
|
| 246 | + if ( $new_meta_value && '' == $meta_value ) { |
|
| 247 | + add_post_meta( $post_id, $meta_key, $new_meta_value, true ); |
|
| 248 | + } elseif ( $new_meta_value && $new_meta_value != $meta_value ) { |
|
| 249 | + update_post_meta( $post_id, $meta_key, $new_meta_value ); |
|
| 250 | + } elseif ( '' == $new_meta_value && $meta_value ) { |
|
| 251 | + delete_post_meta( $post_id, $meta_key, $meta_value ); |
|
| 252 | + } |
|
| 254 | 253 | } |
| 255 | 254 | } |
| 256 | 255 | |
@@ -402,7 +401,7 @@ discard block |
||
| 402 | 401 | |
| 403 | 402 | if('jetpack-portfolio' == get_post_type()){ |
| 404 | 403 | get_template_part( 'content', 'portfolio' ); |
| 405 | - }else{ |
|
| 404 | + } else{ |
|
| 406 | 405 | get_template_part( 'content', get_post_type() ); |
| 407 | 406 | } |
| 408 | 407 | } |
@@ -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'] = 99; |
| 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,43 +214,43 @@ 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 ) { |
|
| 221 | - if ( 'jetpack-portfolio' != $post->post_type ) { |
|
| 220 | +function lsx_save_portfolio_post_meta($post_id, $post) { |
|
| 221 | + if ('jetpack-portfolio' != $post->post_type) { |
|
| 222 | 222 | return; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - if ( ! isset( $_POST['lsx-website'] ) && ! isset( $_POST['lsx-client'] ) ) { |
|
| 225 | + if ( ! isset($_POST['lsx-website']) && ! isset($_POST['lsx-client'])) { |
|
| 226 | 226 | return; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - $post_type = get_post_type_object( $post->post_type ); |
|
| 229 | + $post_type = get_post_type_object($post->post_type); |
|
| 230 | 230 | |
| 231 | - if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) { |
|
| 231 | + if ( ! current_user_can($post_type->cap->edit_post, $post_id)) { |
|
| 232 | 232 | return; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - check_admin_referer( 'lsx_save_portfolio', '_lsx_client_nonce' ); |
|
| 236 | - check_admin_referer( 'lsx_save_portfolio', '_lsx_website_nonce' ); |
|
| 235 | + check_admin_referer('lsx_save_portfolio', '_lsx_client_nonce'); |
|
| 236 | + check_admin_referer('lsx_save_portfolio', '_lsx_website_nonce'); |
|
| 237 | 237 | |
| 238 | - $meta_keys = array('lsx-website','lsx-client'); |
|
| 238 | + $meta_keys = array('lsx-website', 'lsx-client'); |
|
| 239 | 239 | |
| 240 | - foreach($meta_keys as $meta_key){ |
|
| 241 | - $new_meta_value = sanitize_text_field( wp_unslash( $_POST[$meta_key] ) ); |
|
| 242 | - $new_meta_value = ! empty( $new_meta_value ) ? $new_meta_value : ''; |
|
| 240 | + foreach ($meta_keys as $meta_key) { |
|
| 241 | + $new_meta_value = sanitize_text_field(wp_unslash($_POST[$meta_key])); |
|
| 242 | + $new_meta_value = ! empty($new_meta_value) ? $new_meta_value : ''; |
|
| 243 | 243 | |
| 244 | - $meta_value = get_post_meta( $post_id, $meta_key, true ); |
|
| 244 | + $meta_value = get_post_meta($post_id, $meta_key, true); |
|
| 245 | 245 | |
| 246 | - if ( $new_meta_value && '' == $meta_value ) |
|
| 247 | - add_post_meta( $post_id, $meta_key, $new_meta_value, true ); |
|
| 246 | + if ($new_meta_value && '' == $meta_value) |
|
| 247 | + add_post_meta($post_id, $meta_key, $new_meta_value, true); |
|
| 248 | 248 | |
| 249 | - elseif ( $new_meta_value && $new_meta_value != $meta_value ) |
|
| 250 | - update_post_meta( $post_id, $meta_key, $new_meta_value ); |
|
| 249 | + elseif ($new_meta_value && $new_meta_value != $meta_value) |
|
| 250 | + update_post_meta($post_id, $meta_key, $new_meta_value); |
|
| 251 | 251 | |
| 252 | - elseif ( '' == $new_meta_value && $meta_value ) |
|
| 253 | - delete_post_meta( $post_id, $meta_key, $meta_value ); |
|
| 252 | + elseif ('' == $new_meta_value && $meta_value) |
|
| 253 | + delete_post_meta($post_id, $meta_key, $meta_value); |
|
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | add_meta_box( |
| 260 | 260 | 'lsx_client_meta_box', |
| 261 | - esc_html__( 'Client', 'lsx' ), |
|
| 261 | + esc_html__('Client', 'lsx'), |
|
| 262 | 262 | 'lsx_client_meta_box', |
| 263 | 263 | 'jetpack-portfolio', |
| 264 | 264 | 'side', |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | |
| 268 | 268 | add_meta_box( |
| 269 | 269 | 'lsx_website_meta_box', |
| 270 | - esc_html__( 'Website', 'lsx' ), |
|
| 270 | + esc_html__('Website', 'lsx'), |
|
| 271 | 271 | 'lsx_website_meta_box', |
| 272 | 272 | 'jetpack-portfolio', |
| 273 | 273 | 'side', |
@@ -275,25 +275,25 @@ discard block |
||
| 275 | 275 | ); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | -function lsx_client_meta_box( $object, $box ) { ?> |
|
| 278 | +function lsx_client_meta_box($object, $box) { ?> |
|
| 279 | 279 | |
| 280 | - <?php wp_nonce_field( 'lsx_save_portfolio', '_lsx_client_nonce' ); ?> |
|
| 280 | + <?php wp_nonce_field('lsx_save_portfolio', '_lsx_client_nonce'); ?> |
|
| 281 | 281 | |
| 282 | 282 | <p> |
| 283 | - <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" /> |
|
| 283 | + <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" /> |
|
| 284 | 284 | <br /><br /> |
| 285 | - <label for="lsx-client"><?php esc_html_e( 'Enter the name of the project client', 'lsx' ); ?></label> |
|
| 285 | + <label for="lsx-client"><?php esc_html_e('Enter the name of the project client', 'lsx'); ?></label> |
|
| 286 | 286 | </p> |
| 287 | 287 | <?php } |
| 288 | 288 | |
| 289 | -function lsx_website_meta_box( $object, $box ) { ?> |
|
| 289 | +function lsx_website_meta_box($object, $box) { ?> |
|
| 290 | 290 | |
| 291 | - <?php wp_nonce_field( 'lsx_save_portfolio', '_lsx_website_nonce' ); ?> |
|
| 291 | + <?php wp_nonce_field('lsx_save_portfolio', '_lsx_website_nonce'); ?> |
|
| 292 | 292 | |
| 293 | 293 | <p> |
| 294 | - <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" /> |
|
| 294 | + <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" /> |
|
| 295 | 295 | <br /><br /> |
| 296 | - <label for="lsx-website"><?php esc_html_e( 'Enter the URL of the project website', 'lsx' ); ?></label> |
|
| 296 | + <label for="lsx-website"><?php esc_html_e('Enter the URL of the project website', 'lsx'); ?></label> |
|
| 297 | 297 | </p> |
| 298 | 298 | <?php } |
| 299 | 299 | |
@@ -306,18 +306,18 @@ discard block |
||
| 306 | 306 | * @category portfolio |
| 307 | 307 | */ |
| 308 | 308 | |
| 309 | -function lsx_portfolio_sorter(){ ?> |
|
| 309 | +function lsx_portfolio_sorter() { ?> |
|
| 310 | 310 | <ul id="filterNav" class="clearfix"> |
| 311 | - <li class="allBtn"><a href="#" data-filter="*" class="selected"><?php esc_html_e( 'All', 'lsx' ); ?></a></li> |
|
| 311 | + <li class="allBtn"><a href="#" data-filter="*" class="selected"><?php esc_html_e('All', 'lsx'); ?></a></li> |
|
| 312 | 312 | <?php |
| 313 | 313 | $types = get_terms('jetpack-portfolio-type'); |
| 314 | 314 | |
| 315 | - if(is_array($types)){ |
|
| 315 | + if (is_array($types)) { |
|
| 316 | 316 | foreach ($types as $type) { |
| 317 | - $content = '<li><a href="#" data-filter=".'.$type->slug.'">'; |
|
| 317 | + $content = '<li><a href="#" data-filter=".' . $type->slug . '">'; |
|
| 318 | 318 | $content .= $type->name; |
| 319 | 319 | $content .= '</a></li>'; |
| 320 | - echo wp_kses_post( $content ); |
|
| 320 | + echo wp_kses_post($content); |
|
| 321 | 321 | echo "\n"; |
| 322 | 322 | } |
| 323 | 323 | }?> |
@@ -332,18 +332,18 @@ discard block |
||
| 332 | 332 | * @category portfolio |
| 333 | 333 | */ |
| 334 | 334 | |
| 335 | -function lsx_portfolio_naviagtion_labels($labels){ |
|
| 335 | +function lsx_portfolio_naviagtion_labels($labels) { |
|
| 336 | 336 | |
| 337 | - if(is_post_type_archive('jetpack-portfolio')){ |
|
| 337 | + if (is_post_type_archive('jetpack-portfolio')) { |
|
| 338 | 338 | $labels = array( |
| 339 | - 'next' => '<span class="meta-nav">←</span> '.esc_html__( 'Older', 'lsx' ), |
|
| 340 | - 'previous' => esc_html__( 'Newer', 'lsx' ).' <span class="meta-nav">→</span>', |
|
| 341 | - 'title' => esc_html__( 'Portfolio navigation', 'lsx' ) |
|
| 339 | + 'next' => '<span class="meta-nav">←</span> ' . esc_html__('Older', 'lsx'), |
|
| 340 | + 'previous' => esc_html__('Newer', 'lsx') . ' <span class="meta-nav">→</span>', |
|
| 341 | + 'title' => esc_html__('Portfolio navigation', 'lsx') |
|
| 342 | 342 | ); |
| 343 | 343 | } |
| 344 | 344 | return $labels; |
| 345 | 345 | } |
| 346 | -add_filter('lsx_post_navigation_labels','lsx_portfolio_naviagtion_labels',1,10); |
|
| 346 | +add_filter('lsx_post_navigation_labels', 'lsx_portfolio_naviagtion_labels', 1, 10); |
|
| 347 | 347 | |
| 348 | 348 | |
| 349 | 349 | /* |
@@ -357,11 +357,11 @@ discard block |
||
| 357 | 357 | * @subpackage jetpack |
| 358 | 358 | * @category related-posts |
| 359 | 359 | */ |
| 360 | -function lsx_remove_related_post_context(){ |
|
| 361 | - add_filter( 'jetpack_relatedposts_filter_post_context', '__return_empty_string' ); |
|
| 362 | - add_filter( 'rest_api_allowed_post_types', 'lsx_allowed_related_post_types' ); |
|
| 360 | +function lsx_remove_related_post_context() { |
|
| 361 | + add_filter('jetpack_relatedposts_filter_post_context', '__return_empty_string'); |
|
| 362 | + add_filter('rest_api_allowed_post_types', 'lsx_allowed_related_post_types'); |
|
| 363 | 363 | } |
| 364 | -add_action('init','lsx_remove_related_post_context',20); |
|
| 364 | +add_action('init', 'lsx_remove_related_post_context', 20); |
|
| 365 | 365 | |
| 366 | 366 | |
| 367 | 367 | /* |
@@ -378,13 +378,13 @@ discard block |
||
| 378 | 378 | $infinite_scroll_args = array( |
| 379 | 379 | 'container' => 'main', |
| 380 | 380 | 'type' => 'click', |
| 381 | - 'posts_per_page' => get_option('posts_per_page',10), |
|
| 381 | + 'posts_per_page' => get_option('posts_per_page', 10), |
|
| 382 | 382 | 'render' => 'lsx_infinite_scroll_render' |
| 383 | 383 | ); |
| 384 | 384 | |
| 385 | - add_theme_support( 'infinite-scroll', $infinite_scroll_args ); |
|
| 385 | + add_theme_support('infinite-scroll', $infinite_scroll_args); |
|
| 386 | 386 | } |
| 387 | -add_action( 'after_setup_theme', 'lsx_jetpack_infinite_scroll_after_setup' ); |
|
| 387 | +add_action('after_setup_theme', 'lsx_jetpack_infinite_scroll_after_setup'); |
|
| 388 | 388 | |
| 389 | 389 | /** |
| 390 | 390 | * Set the code to be rendered on for calling posts, |
@@ -397,13 +397,13 @@ discard block |
||
| 397 | 397 | function lsx_infinite_scroll_render() { |
| 398 | 398 | global $wp_query; |
| 399 | 399 | |
| 400 | - while(have_posts()){ |
|
| 400 | + while (have_posts()) { |
|
| 401 | 401 | the_post(); |
| 402 | 402 | |
| 403 | - if('jetpack-portfolio' == get_post_type()){ |
|
| 404 | - get_template_part( 'content', 'portfolio' ); |
|
| 405 | - }else{ |
|
| 406 | - get_template_part( 'content', get_post_type() ); |
|
| 403 | + if ('jetpack-portfolio' == get_post_type()) { |
|
| 404 | + get_template_part('content', 'portfolio'); |
|
| 405 | + } else { |
|
| 406 | + get_template_part('content', get_post_type()); |
|
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | 409 | } |
@@ -415,8 +415,8 @@ discard block |
||
| 415 | 415 | * @subpackage jetpack |
| 416 | 416 | * @category related posts |
| 417 | 417 | */ |
| 418 | -function lsx_related_posts_headline( $headline ) { |
|
| 419 | - $headline = sprintf( '<h3 class="jp-relatedposts-headline"><em>%s</em></h3>', esc_html__( 'Related Posts', 'lsx' ) ); |
|
| 418 | +function lsx_related_posts_headline($headline) { |
|
| 419 | + $headline = sprintf('<h3 class="jp-relatedposts-headline"><em>%s</em></h3>', esc_html__('Related Posts', 'lsx')); |
|
| 420 | 420 | return $headline; |
| 421 | 421 | } |
| 422 | -add_filter( 'jetpack_relatedposts_filter_headline', 'lsx_related_posts_headline' ); |
|
| 422 | +add_filter('jetpack_relatedposts_filter_headline', 'lsx_related_posts_headline'); |
|
@@ -123,11 +123,11 @@ discard block |
||
| 123 | 123 | * @category portfolio |
| 124 | 124 | */ |
| 125 | 125 | function lsx_remove_single_related_posts() { |
| 126 | - if ( is_single() && class_exists( 'Jetpack_RelatedPosts' ) ) { |
|
| 127 | - $jprp = Jetpack_RelatedPosts::init(); |
|
| 128 | - $callback = array( $jprp, 'filter_add_target_to_dom' ); |
|
| 129 | - remove_filter( 'the_content', $callback, 40 ); |
|
| 130 | - } |
|
| 126 | + if ( is_single() && class_exists( 'Jetpack_RelatedPosts' ) ) { |
|
| 127 | + $jprp = Jetpack_RelatedPosts::init(); |
|
| 128 | + $callback = array( $jprp, 'filter_add_target_to_dom' ); |
|
| 129 | + remove_filter( 'the_content', $callback, 40 ); |
|
| 130 | + } |
|
| 131 | 131 | } |
| 132 | 132 | add_filter( 'wp', 'lsx_remove_single_related_posts', 20 ); |
| 133 | 133 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | if(is_array($types)){ |
| 316 | 316 | foreach ($types as $type) { |
| 317 | 317 | $content = '<li><a href="#" data-filter=".'.$type->slug.'">'; |
| 318 | - $content .= $type->name; |
|
| 318 | + $content .= $type->name; |
|
| 319 | 319 | $content .= '</a></li>'; |
| 320 | 320 | echo wp_kses_post( $content ); |
| 321 | 321 | echo "\n"; |