@@ -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); |
|
@@ -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,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')); |
|
@@ -19,10 +19,10 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | function lsx_buddypress_page_columns($layout) { |
| 21 | 21 | |
| 22 | - if(bp_is_profile_component()|| bp_is_settings_component() || bp_is_activity_component() || bp_is_group() || bp_is_messages_component() |
|
| 23 | - || bp_is_members_directory() || bp_is_groups_directory() || bp_is_groups_component() || bp_is_members_component()){ |
|
| 22 | + if (bp_is_profile_component() || bp_is_settings_component() || bp_is_activity_component() || bp_is_group() || bp_is_messages_component() |
|
| 23 | + || bp_is_members_directory() || bp_is_groups_directory() || bp_is_groups_component() || bp_is_members_component()) { |
|
| 24 | 24 | $layout = '1c'; |
| 25 | 25 | } |
| 26 | 26 | return $layout; |
| 27 | 27 | } |
| 28 | - add_filter( 'lsx_layout', 'lsx_buddypress_page_columns' , 1 , 100 ); |
|
| 29 | 28 | \ No newline at end of file |
| 29 | + add_filter('lsx_layout', 'lsx_buddypress_page_columns', 1, 100); |
|
| 30 | 30 | \ No newline at end of file |
@@ -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 | * Cleaner walker for wp_nav_menu() |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $item_html = ''; |
| 26 | 26 | |
| 27 | 27 | //If there is no menu set, dont use the pages, the objects are not the same as whats supposed to be used. |
| 28 | - if(isset($item->title)){ |
|
| 28 | + if (isset($item->title)) { |
|
| 29 | 29 | |
| 30 | 30 | parent::start_el($item_html, $item, $depth, $args); |
| 31 | 31 | |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output) { |
| 48 | - $element->is_dropdown = ((!empty($children_elements[$element->ID]) && (($depth+1) < $max_depth || ($max_depth === 0)))); |
|
| 48 | + $element->is_dropdown = (( ! empty($children_elements[$element->ID]) && (($depth + 1) < $max_depth || ($max_depth === 0)))); |
|
| 49 | 49 | |
| 50 | 50 | if ($element->is_dropdown) { |
| 51 | - if ($depth>0) { |
|
| 51 | + if ($depth > 0) { |
|
| 52 | 52 | $element->classes[] = 'dropdown-submenu'; |
| 53 | 53 | } else { |
| 54 | 54 | $element->classes[] = 'dropdown'; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $classes = preg_replace('/(current(-menu-|[-_]page[-_])(item|parent|ancestor))/', 'active', $classes); |
| 69 | 69 | $classes = preg_replace('/^((menu|page)[-_\w+]+)+/', '', $classes); |
| 70 | 70 | |
| 71 | - $classes[] = 'menu-'.$slug; |
|
| 71 | + $classes[] = 'menu-' . $slug; |
|
| 72 | 72 | |
| 73 | 73 | $classes = array_unique($classes); |
| 74 | 74 | |
@@ -86,15 +86,15 @@ discard block |
||
| 86 | 86 | function lsx_nav_menu_args($args = '') { |
| 87 | 87 | $roots_nav_menu_args['container'] = false; |
| 88 | 88 | |
| 89 | - if (!$args['items_wrap']) { |
|
| 89 | + if ( ! $args['items_wrap']) { |
|
| 90 | 90 | $roots_nav_menu_args['items_wrap'] = '<ul class="%2$s">%3$s</ul>'; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if (current_theme_supports('bootstrap-top-navbar') && !$args['depth']) { |
|
| 93 | + if (current_theme_supports('bootstrap-top-navbar') && ! $args['depth']) { |
|
| 94 | 94 | $roots_nav_menu_args['depth'] = 2; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if (!$args['walker']) { |
|
| 97 | + if ( ! $args['walker']) { |
|
| 98 | 98 | $roots_nav_menu_args['walker'] = new LSX_Nav_Walker(); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -1,5 +1,5 @@ |
||
| 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 | * Google_Font Class |
| 5 | 5 | **/ |
@@ -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 | * lsx Comment Walker |
@@ -29,12 +29,12 @@ discard block |
||
| 29 | 29 | $GLOBALS['comment_depth'] = $depth; |
| 30 | 30 | $GLOBALS['comment'] = $comment; |
| 31 | 31 | |
| 32 | - if (!empty($args['callback'])) { |
|
| 32 | + if ( ! empty($args['callback'])) { |
|
| 33 | 33 | call_user_func($args['callback'], $comment, $args, $depth); |
| 34 | 34 | return; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - extract($args, EXTR_SKIP);?> |
|
| 37 | + extract($args, EXTR_SKIP); ?> |
|
| 38 | 38 | |
| 39 | 39 | <li id="comment-<?php comment_ID(); ?>" <?php comment_class('media comment-' . get_comment_ID()); ?>> |
| 40 | 40 | <?php get_template_part('comment'); ?> |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | function end_el(&$output, $comment, $depth = 0, $args = array()) { |
| 45 | - if (!empty($args['end-callback'])) { |
|
| 45 | + if ( ! empty($args['end-callback'])) { |
|
| 46 | 46 | call_user_func($args['end-callback'], $comment, $args, $depth); |
| 47 | 47 | return; |
| 48 | 48 | } |
@@ -64,13 +64,13 @@ discard block |
||
| 64 | 64 | * @subpackage layout |
| 65 | 65 | */ |
| 66 | 66 | function lsx_comment_form_fields_filter($fields) { |
| 67 | - foreach($fields as &$field){ |
|
| 68 | - if(stristr('class=', $field)){ |
|
| 67 | + foreach ($fields as &$field) { |
|
| 68 | + if (stristr('class=', $field)) { |
|
| 69 | 69 | $field = str_replace('class="', 'class="form-control ', $field); |
| 70 | - }else{ |
|
| 70 | + } else { |
|
| 71 | 71 | $field = str_replace('<input', '<input class="form-control" ', $field); |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | return $fields; |
| 75 | 75 | } |
| 76 | -add_filter( 'comment_form_default_fields', 'lsx_comment_form_fields_filter'); |
|
| 76 | +add_filter('comment_form_default_fields', 'lsx_comment_form_fields_filter'); |
|
@@ -1,54 +1,54 @@ 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 | * Register widgetized area and update sidebar with default widgets. |
| 6 | 6 | */ |
| 7 | 7 | function lsx_widget_area_init() { |
| 8 | 8 | |
| 9 | - register_sidebar( array( |
|
| 10 | - 'name' => __( 'Home', 'lsx' ), |
|
| 9 | + register_sidebar(array( |
|
| 10 | + 'name' => __('Home', 'lsx'), |
|
| 11 | 11 | 'id' => 'sidebar-home', |
| 12 | 12 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
| 13 | 13 | 'after_widget' => '</aside>', |
| 14 | 14 | 'before_title' => '<h3 class="widget-title">', |
| 15 | 15 | 'after_title' => '</h3>', |
| 16 | - ) ); |
|
| 16 | + )); |
|
| 17 | 17 | |
| 18 | - register_sidebar( array( |
|
| 19 | - 'name' => __( 'Sidebar', 'lsx' ), |
|
| 18 | + register_sidebar(array( |
|
| 19 | + 'name' => __('Sidebar', 'lsx'), |
|
| 20 | 20 | 'id' => 'sidebar-1', |
| 21 | 21 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
| 22 | 22 | 'after_widget' => '</aside>', |
| 23 | 23 | 'before_title' => '<h3 class="widget-title">', |
| 24 | 24 | 'after_title' => '</h3>', |
| 25 | - ) ); |
|
| 25 | + )); |
|
| 26 | 26 | |
| 27 | - register_sidebar( array( |
|
| 28 | - 'name' => __( 'Footer', 'lsx' ), |
|
| 27 | + register_sidebar(array( |
|
| 28 | + 'name' => __('Footer', 'lsx'), |
|
| 29 | 29 | 'id' => 'sidebar-footer', |
| 30 | 30 | 'before_widget' => '<div class="styler"><aside id="%1$s" class="widget %2$s">', |
| 31 | 31 | 'after_widget' => '</aside></div>', |
| 32 | 32 | 'before_title' => '<h3 class="widget-title">', |
| 33 | 33 | 'after_title' => '</h3>', |
| 34 | - ) ); |
|
| 34 | + )); |
|
| 35 | 35 | |
| 36 | - register_sidebar( array( |
|
| 37 | - 'name' => __( 'Footer Call to Action', 'lsx' ), |
|
| 36 | + register_sidebar(array( |
|
| 37 | + 'name' => __('Footer Call to Action', 'lsx'), |
|
| 38 | 38 | 'id' => 'sidebar-footer-cta', |
| 39 | 39 | 'before_widget' => '<div class="styler"><aside id="%1$s" class="widget %2$s">', |
| 40 | 40 | 'after_widget' => '</aside></div>', |
| 41 | 41 | 'before_title' => '<h3 class="widget-title">', |
| 42 | 42 | 'after_title' => '</h3>', |
| 43 | - ) ); |
|
| 43 | + )); |
|
| 44 | 44 | } |
| 45 | -add_action( 'widgets_init', 'lsx_widget_area_init' ); |
|
| 45 | +add_action('widgets_init', 'lsx_widget_area_init'); |
|
| 46 | 46 | |
| 47 | -function lsx_sidebar_footer_params( $params ) { |
|
| 47 | +function lsx_sidebar_footer_params($params) { |
|
| 48 | 48 | |
| 49 | 49 | $sidebar_id = $params[0]['id']; |
| 50 | 50 | |
| 51 | - if ( $sidebar_id == 'sidebar-footer' ) { |
|
| 51 | + if ($sidebar_id == 'sidebar-footer') { |
|
| 52 | 52 | |
| 53 | 53 | $total_widgets = wp_get_sidebars_widgets(); |
| 54 | 54 | $sidebar_widgets = count($total_widgets[$sidebar_id]); |
@@ -58,4 +58,4 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | return $params; |
| 60 | 60 | } |
| 61 | -add_filter( 'dynamic_sidebar_params', 'lsx_sidebar_footer_params' ); |
|
| 62 | 61 | \ No newline at end of file |
| 62 | +add_filter('dynamic_sidebar_params', 'lsx_sidebar_footer_params'); |
|
| 63 | 63 | \ No newline at end of file |
@@ -14,6 +14,6 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | 16 | function lsx_wp_job_manager_styles() { |
| 17 | - wp_enqueue_style( 'wp_job_manager', get_template_directory_uri() . '/css/wp-job-manager.css' ); |
|
| 17 | + wp_enqueue_style('wp_job_manager', get_template_directory_uri() . '/css/wp-job-manager.css'); |
|
| 18 | 18 | } |
| 19 | -add_action( 'wp_enqueue_scripts', 'lsx_wp_job_manager_styles' ); |
|
| 20 | 19 | \ No newline at end of file |
| 20 | +add_action('wp_enqueue_scripts', 'lsx_wp_job_manager_styles'); |
|
| 21 | 21 | \ No newline at end of file |