From 3b4540d8662459be15c73710b782e3fbaabf971b Mon Sep 17 00:00:00 2001 From: Johan Nielsen Date: Sun, 26 Aug 2018 12:43:55 +0200 Subject: [PATCH 1/7] Update gulpconfig.json just a little formatting --- gulpconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpconfig.json b/gulpconfig.json index 249ae4f..bb55944 100644 --- a/gulpconfig.json +++ b/gulpconfig.json @@ -12,7 +12,7 @@ "js": "./js", "css": "./css", "img": "./img", - "imgsrc": "./src/img", + "imgsrc": "./src/img", "sass": "./sass", "node": "./node_modules/", "bower": "./bower_components/", From 2f1228a812e6495498abac9380cf3daa3e61ccd1 Mon Sep 17 00:00:00 2001 From: IanDelMar <42134098+IanDelMar@users.noreply.github.com> Date: Thu, 30 Aug 2018 06:51:11 +0200 Subject: [PATCH 2/7] Fix for issue #785 Translatable widget area descriptions --- inc/widgets.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/inc/widgets.php b/inc/widgets.php index bf63ac2..88ffb91 100644 --- a/inc/widgets.php +++ b/inc/widgets.php @@ -54,7 +54,7 @@ if ( ! function_exists( 'understrap_widgets_init' ) ) { register_sidebar( array( 'name' => __( 'Right Sidebar', 'understrap' ), 'id' => 'right-sidebar', - 'description' => 'Right sidebar widget area', + 'description' => __( 'Right sidebar widget area', 'understrap' ), 'before_widget' => '', 'before_title' => '

', @@ -64,7 +64,7 @@ if ( ! function_exists( 'understrap_widgets_init' ) ) { register_sidebar( array( 'name' => __( 'Left Sidebar', 'understrap' ), 'id' => 'left-sidebar', - 'description' => 'Left sidebar widget area', + 'description' => __( 'Left sidebar widget area', 'understrap' ), 'before_widget' => '', 'before_title' => '

', @@ -74,7 +74,7 @@ if ( ! function_exists( 'understrap_widgets_init' ) ) { register_sidebar( array( 'name' => __( 'Hero Slider', 'understrap' ), 'id' => 'hero', - 'description' => 'Hero slider area. Place two or more widgets here and they will slide!', + 'description' => __( 'Hero slider area. Place two or more widgets here and they will slide!', 'understrap' ), 'before_widget' => '', 'before_title' => '', @@ -84,7 +84,7 @@ if ( ! function_exists( 'understrap_widgets_init' ) ) { register_sidebar( array( 'name' => __( 'Hero Canvas', 'understrap' ), 'id' => 'herocanvas', - 'description' => 'Full size canvas hero area for Bootstrap and other custom HTML markup', + 'description' => __( 'Full size canvas hero area for Bootstrap and other custom HTML markup', 'understrap' ), 'before_widget' => '', 'after_widget' => '', 'before_title' => '', @@ -94,7 +94,7 @@ if ( ! function_exists( 'understrap_widgets_init' ) ) { register_sidebar( array( 'name' => __( 'Top Full', 'understrap' ), 'id' => 'statichero', - 'description' => 'Full top widget with dynamic grid', + 'description' => __( 'Full top widget with dynamic grid', 'understrap' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', @@ -104,7 +104,7 @@ if ( ! function_exists( 'understrap_widgets_init' ) ) { register_sidebar( array( 'name' => __( 'Footer Full', 'understrap' ), 'id' => 'footerfull', - 'description' => 'Full sized footer widget with dynamic grid', + 'description' => __( 'Full sized footer widget with dynamic grid', 'understrap' ), 'before_widget' => '', 'before_title' => '

', From 1a78061efdc49a70cf4ad8d21cd0e1792497a3e6 Mon Sep 17 00:00:00 2001 From: IanDelMar <42134098+IanDelMar@users.noreply.github.com> Date: Sat, 1 Sep 2018 20:14:46 +0200 Subject: [PATCH 3/7] sidebar-footerfull.php: incorrect spacing --- sidebar-templates/sidebar-footerfull.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sidebar-templates/sidebar-footerfull.php b/sidebar-templates/sidebar-footerfull.php index 2017f6f..80b9f44 100644 --- a/sidebar-templates/sidebar-footerfull.php +++ b/sidebar-templates/sidebar-footerfull.php @@ -5,7 +5,7 @@ * @package understrap */ -$container = get_theme_mod( 'understrap_container_type' ); +$container = get_theme_mod( 'understrap_container_type' ); ?> From cc6d8727c775410647202d7b8eb7213392667355 Mon Sep 17 00:00:00 2001 From: IanDelMar <42134098+IanDelMar@users.noreply.github.com> Date: Sun, 2 Sep 2018 08:54:36 +0200 Subject: [PATCH 4/7] Stick to single quotes & other minor changes * Stick to single quotes * DocBlock for function understrap_theme_slug_sanitize_select * Formatting issues --- inc/customizer.php | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/inc/customizer.php b/inc/customizer.php index 483086f..2e0364f 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -40,19 +40,25 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) { 'priority' => 160, ) ); - //select sanitization function - function understrap_theme_slug_sanitize_select( $input, $setting ){ - - //input must be a slug: lowercase alphanumeric characters, dashes and underscores are allowed only - $input = sanitize_key($input); - - //get the list of possible select options - $choices = $setting->manager->get_control( $setting->id )->choices; - - //return input if valid or return default option - return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); - - } + /** + * Select sanitization function + * + * @param string $input Slug to sanitize. + * @param WP_Customize_Setting $setting Setting instance. + * @return string Sanitized slug if it is a valid choice; otherwise, the setting default. + */ + function understrap_theme_slug_sanitize_select( $input, $setting ){ + + // Ensure input is a slug (lowercase alphanumeric characters, dashes and underscores are allowed only). + $input = sanitize_key( $input ); + + // Get the list of possible select options. + $choices = $setting->manager->get_control( $setting->id )->choices; + + // If the input is a valid key, return it; otherwise, return the default. + return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); + + } $wp_customize->add_setting( 'understrap_container_type', array( 'default' => 'container', @@ -66,7 +72,7 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) { $wp_customize, 'understrap_container_type', array( 'label' => __( 'Container Width', 'understrap' ), - 'description' => __( "Choose between Bootstrap's container and container-fluid", 'understrap' ), + 'description' => __( 'Choose between Bootstrap\'s container and container-fluid', 'understrap' ), 'section' => 'understrap_theme_layout_options', 'settings' => 'understrap_container_type', 'type' => 'select', @@ -90,7 +96,7 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) { $wp_customize, 'understrap_sidebar_position', array( 'label' => __( 'Sidebar Positioning', 'understrap' ), - 'description' => __( "Set sidebar's default position. Can either be: right, left, both or none. Note: this can be overridden on individual pages.", + 'description' => __( 'Set sidebar\'s default position. Can either be: right, left, both or none. Note: this can be overridden on individual pages.', 'understrap' ), 'section' => 'understrap_theme_layout_options', 'settings' => 'understrap_sidebar_position', @@ -118,7 +124,8 @@ if ( ! function_exists( 'understrap_customize_preview_js' ) ) { */ function understrap_customize_preview_js() { wp_enqueue_script( 'understrap_customizer', get_template_directory_uri() . '/js/customizer.js', - array( 'customize-preview' ), '20130508', true ); + array( 'customize-preview' ), '20130508', true + ); } } add_action( 'customize_preview_init', 'understrap_customize_preview_js' ); From 0906f10e5d02c3289c613f11fd5a6712fdf5e093 Mon Sep 17 00:00:00 2001 From: IanDelMar <42134098+IanDelMar@users.noreply.github.com> Date: Sun, 2 Sep 2018 19:17:32 +0200 Subject: [PATCH 5/7] Define .screen-reader-text WP uses the class `.screen-reader-text` in some core stuff like widgets and therefore it should be properly defined. Also UnderStrap itself uses `.screen-reader-text` instead of `.sr-only` sometimes. --- sass/understrap/understrap.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sass/understrap/understrap.scss b/sass/understrap/understrap.scss index 0d92033..abd3dfa 100644 --- a/sass/understrap/understrap.scss +++ b/sass/understrap/understrap.scss @@ -24,7 +24,7 @@ .wp-caption-text { font-size: inherit; } -.screen-reader-text { font-size: inherit; } +.screen-reader-text { @extend .sr-only; } .alignleft { display: inline; From 43127350b5baf88a5759bbc82e4a14ec239385bc Mon Sep 17 00:00:00 2001 From: IanDelMar <42134098+IanDelMar@users.noreply.github.com> Date: Sun, 2 Sep 2018 19:30:14 +0200 Subject: [PATCH 6/7] Focusable 'Skip to content' * make 'Skip to content' focusable for sighted keyboard users * .sr-only makes .screen-reader-text obsolete --- header.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/header.php b/header.php index f93c894..ec9ba0e 100644 --- a/header.php +++ b/header.php @@ -29,7 +29,7 @@ $container = get_theme_mod( 'understrap_container_type' );
- +
diff --git a/header.php b/header.php index ec9ba0e..83cbb0d 100644 --- a/header.php +++ b/header.php @@ -7,6 +7,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + $container = get_theme_mod( 'understrap_container_type' ); ?> diff --git a/inc/class-wp-bootstrap-navwalker.php b/inc/class-wp-bootstrap-navwalker.php index 71b52d9..a343fcc 100644 --- a/inc/class-wp-bootstrap-navwalker.php +++ b/inc/class-wp-bootstrap-navwalker.php @@ -5,6 +5,10 @@ * @package WP-Bootstrap-Navwalker */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + /* * Class Name: WP_Bootstrap_Navwalker * Plugin Name: WP Bootstrap Navwalker diff --git a/inc/custom-comments.php b/inc/custom-comments.php index 70a4acc..d616cf6 100644 --- a/inc/custom-comments.php +++ b/inc/custom-comments.php @@ -5,6 +5,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + // Comments form. add_filter( 'comment_form_default_fields', 'understrap_bootstrap_comment_form_fields' ); diff --git a/inc/custom-header.php b/inc/custom-header.php index 7ee219a..b66a416 100644 --- a/inc/custom-header.php +++ b/inc/custom-header.php @@ -5,6 +5,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + add_action( 'after_setup_theme', 'understrap_custom_header_setup' ); if ( ! function_exists ( 'understrap_custom_header_setup' ) ) { diff --git a/inc/customizer.php b/inc/customizer.php index 2e0364f..6729d77 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -5,6 +5,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + /** * Add postMessage support for site title and description for the Theme Customizer. * diff --git a/inc/editor.php b/inc/editor.php index 86aafb3..4b71ee9 100644 --- a/inc/editor.php +++ b/inc/editor.php @@ -5,6 +5,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + /** * Registers an editor stylesheet for the theme. */ diff --git a/inc/enqueue.php b/inc/enqueue.php index 07bf264..9748b81 100644 --- a/inc/enqueue.php +++ b/inc/enqueue.php @@ -5,6 +5,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + if ( ! function_exists( 'understrap_scripts' ) ) { /** * Load theme's JavaScript and CSS sources. diff --git a/inc/extras.php b/inc/extras.php index 4789cd7..404dfb7 100644 --- a/inc/extras.php +++ b/inc/extras.php @@ -7,6 +7,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + add_filter( 'body_class', 'understrap_body_classes' ); if ( ! function_exists( 'understrap_body_classes' ) ) { diff --git a/inc/hooks.php b/inc/hooks.php index e63a9d6..2de6401 100644 --- a/inc/hooks.php +++ b/inc/hooks.php @@ -5,6 +5,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + if ( ! function_exists( 'understrap_site_info' ) ) { /** * Add site info hook to WP hook library. diff --git a/inc/jetpack.php b/inc/jetpack.php index b0c46f1..1c2579c 100644 --- a/inc/jetpack.php +++ b/inc/jetpack.php @@ -7,6 +7,10 @@ * @package UnderStrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + /** * Jetpack setup function. * diff --git a/inc/pagination.php b/inc/pagination.php index b582f73..9a6ff79 100644 --- a/inc/pagination.php +++ b/inc/pagination.php @@ -5,6 +5,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + if ( ! function_exists ( 'understrap_pagination' ) ) { function understrap_pagination( $args = array(), $class = 'pagination' ) { diff --git a/inc/setup.php b/inc/setup.php index dc74ac5..69d0aab 100644 --- a/inc/setup.php +++ b/inc/setup.php @@ -5,6 +5,9 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} // Set the content width based on the theme's design and stylesheet. if ( ! isset( $content_width ) ) { diff --git a/inc/template-tags.php b/inc/template-tags.php index 7b3a0d2..5e2cc65 100644 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -7,6 +7,9 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} /** * Prints HTML with meta information for the current post-date/time and author. diff --git a/inc/theme-settings.php b/inc/theme-settings.php index f91d8f1..9bee616 100755 --- a/inc/theme-settings.php +++ b/inc/theme-settings.php @@ -6,6 +6,10 @@ * */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + if ( ! function_exists ( 'understrap_setup_theme_default_settings' ) ) { function understrap_setup_theme_default_settings() { diff --git a/inc/widgets.php b/inc/widgets.php index 88ffb91..fdd6611 100644 --- a/inc/widgets.php +++ b/inc/widgets.php @@ -5,6 +5,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + /** * Count number of widgets in a sidebar * Used to add classes to widget areas so widgets can be displayed one, two, three or four per row diff --git a/inc/woocommerce.php b/inc/woocommerce.php index e1c800a..3cd8e9b 100644 --- a/inc/woocommerce.php +++ b/inc/woocommerce.php @@ -5,6 +5,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + add_action( 'after_setup_theme', 'understrap_woocommerce_support' ); if ( ! function_exists( 'understrap_woocommerce_support' ) ) { /** diff --git a/inc/wpcom.php b/inc/wpcom.php index 16b6dc0..ca42c38 100644 --- a/inc/wpcom.php +++ b/inc/wpcom.php @@ -7,6 +7,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + /** * Adds support for wp.com-specific theme functions. * diff --git a/index.php b/index.php index 53bd943..fddf5dd 100644 --- a/index.php +++ b/index.php @@ -11,6 +11,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + get_header(); $container = get_theme_mod( 'understrap_container_type' ); diff --git a/loop-templates/content-blank.php b/loop-templates/content-blank.php index c11985d..01ff3af 100644 --- a/loop-templates/content-blank.php +++ b/loop-templates/content-blank.php @@ -5,4 +5,8 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + the_content(); diff --git a/loop-templates/content-empty.php b/loop-templates/content-empty.php index a9e3f07..5681144 100644 --- a/loop-templates/content-empty.php +++ b/loop-templates/content-empty.php @@ -5,4 +5,8 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + the_content(); diff --git a/loop-templates/content-none.php b/loop-templates/content-none.php index 493a98b..250152a 100644 --- a/loop-templates/content-none.php +++ b/loop-templates/content-none.php @@ -7,6 +7,9 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} ?>
diff --git a/loop-templates/content-page.php b/loop-templates/content-page.php index 429d3e3..bb1fb2e 100644 --- a/loop-templates/content-page.php +++ b/loop-templates/content-page.php @@ -5,7 +5,11 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} ?> +
id="post-">
diff --git a/loop-templates/content-search.php b/loop-templates/content-search.php index ace9941..501cd92 100644 --- a/loop-templates/content-search.php +++ b/loop-templates/content-search.php @@ -5,7 +5,11 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} ?> +
id="post-">
diff --git a/loop-templates/content-single.php b/loop-templates/content-single.php index e57eae4..5f82da6 100644 --- a/loop-templates/content-single.php +++ b/loop-templates/content-single.php @@ -5,7 +5,11 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} ?> +
id="post-">
diff --git a/loop-templates/content.php b/loop-templates/content.php index 389fb33..3c0cb80 100644 --- a/loop-templates/content.php +++ b/loop-templates/content.php @@ -5,6 +5,9 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} ?>
id="post-"> diff --git a/page-templates/blank.php b/page-templates/blank.php index 1fe7a83..42210d3 100644 --- a/page-templates/blank.php +++ b/page-templates/blank.php @@ -7,6 +7,9 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} ?> > diff --git a/page-templates/both-sidebarspage.php b/page-templates/both-sidebarspage.php index eee340a..954be68 100644 --- a/page-templates/both-sidebarspage.php +++ b/page-templates/both-sidebarspage.php @@ -7,6 +7,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + get_header(); $container = get_theme_mod( 'understrap_container_type' ); ?> diff --git a/page-templates/empty.php b/page-templates/empty.php index da8f39e..2c11ff1 100644 --- a/page-templates/empty.php +++ b/page-templates/empty.php @@ -8,6 +8,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + get_header(); while ( have_posts() ) : the_post(); diff --git a/page-templates/fullwidthpage.php b/page-templates/fullwidthpage.php index 0f55bca..a028f6a 100644 --- a/page-templates/fullwidthpage.php +++ b/page-templates/fullwidthpage.php @@ -7,6 +7,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + get_header(); $container = get_theme_mod( 'understrap_container_type' ); ?> diff --git a/page-templates/left-sidebarpage.php b/page-templates/left-sidebarpage.php index 187592c..5b99dd1 100644 --- a/page-templates/left-sidebarpage.php +++ b/page-templates/left-sidebarpage.php @@ -7,6 +7,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + get_header(); $container = get_theme_mod( 'understrap_container_type' ); ?> diff --git a/page-templates/right-sidebarpage.php b/page-templates/right-sidebarpage.php index 6d4b8fc..bcd949e 100644 --- a/page-templates/right-sidebarpage.php +++ b/page-templates/right-sidebarpage.php @@ -7,6 +7,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + get_header(); $container = get_theme_mod( 'understrap_container_type' ); ?> diff --git a/page.php b/page.php index b721fe8..b7f0486 100644 --- a/page.php +++ b/page.php @@ -10,6 +10,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + get_header(); $container = get_theme_mod( 'understrap_container_type' ); diff --git a/search.php b/search.php index 536702d..09fe863 100644 --- a/search.php +++ b/search.php @@ -5,6 +5,10 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + get_header(); $container = get_theme_mod( 'understrap_container_type' ); diff --git a/searchform.php b/searchform.php index 48f8304..657e612 100644 --- a/searchform.php +++ b/searchform.php @@ -5,7 +5,11 @@ * @package understrap */ +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} ?> +