From e12b9da23c02921fe54faad237358ab977900f47 Mon Sep 17 00:00:00 2001 From: jomurgel Date: Fri, 23 Mar 2018 10:56:51 -0600 Subject: [PATCH 1/4] uses subfield, else checks for get_field for non-flexible content use of the global block options --- inc/acf.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/acf.php b/inc/acf.php index e464c6125..83d7c1b44 100644 --- a/inc/acf.php +++ b/inc/acf.php @@ -33,10 +33,10 @@ function _s_display_content_blocks() { function _s_display_block_options( $args = array() ) { // Get block background options. - $background_options = get_sub_field( 'background_options' ); + $background_options = get_sub_field( 'background_options' ) ? get_sub_field( 'background_options' ) : get_field( 'background_options' )['background_options']; // Get block other options. - $other_options = get_sub_field( 'other_options' ); + $other_options = get_sub_field( 'other_options' ) ? get_sub_field( 'other_options' ) : get_field( 'other_options' )['other_options']; // Setup defaults. $defaults = array( From 06be32734b88334a4f9800f35e8a037778e1ec7c Mon Sep 17 00:00:00 2001 From: jomurgel Date: Fri, 23 Mar 2018 10:57:46 -0600 Subject: [PATCH 2/4] lint --- inc/acf.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/inc/acf.php b/inc/acf.php index 83d7c1b44..236be07a6 100644 --- a/inc/acf.php +++ b/inc/acf.php @@ -58,17 +58,17 @@ function _s_display_block_options( $args = array() ) { if ( $args['background_type'] ) { if ( 'color' === $args['background_type'] ) { $background_color = $background_options['background_color']; - $inline_style .= 'background-color: ' . $background_color . '; '; + $inline_style .= 'background-color: ' . $background_color . '; '; } if ( 'image' === $args['background_type'] ) { $background_image = $background_options['background_image']; - $inline_style .= 'background-image: url(' . esc_url( $background_image['sizes']['full-width'] ) . ');'; - $args['class'] .= ' image-as-background'; + $inline_style .= 'background-image: url(' . esc_url( $background_image['sizes']['full-width'] ) . ');'; + $args['class'] .= ' image-as-background'; } if ( 'video' === $args['background_type'] ) { - $background_video = $background_options['background_video']; + $background_video = $background_options['background_video']; $background_video_markup = ''; } From a3270795493db0746f6cc71c1b95fea53fa735aa Mon Sep 17 00:00:00 2001 From: jomurgel Date: Fri, 23 Mar 2018 11:01:39 -0600 Subject: [PATCH 3/4] lints --- inc/extras.php | 10 +++++----- inc/hooks.php | 4 ++-- inc/scaffolding.php | 19 +++++++++---------- inc/template-tags.php | 17 +++++++++-------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/inc/extras.php b/inc/extras.php index 7f654af8f..d2de74565 100644 --- a/inc/extras.php +++ b/inc/extras.php @@ -92,10 +92,10 @@ function _s_get_placeholder_image( $args = array() ) { $args = wp_parse_args( $args, $default_args ); // Extract the vars we want to work with. - $width = $args['width']; - $height = $args['height']; + $width = $args['width']; + $height = $args['height']; $background_color = $args['background_color']; - $text_color = $args['text_color']; + $text_color = $args['text_color']; // Perform some quick data validation. if ( ! is_numeric( $width ) ) { @@ -177,7 +177,7 @@ function _s_get_placeholder_unsplash( $args = array() ) { // Apply a category if desired. if ( ! empty( $args['category'] ) ) { $category = rawurlencode( $args['category'] ); - $url .= "category/$category/"; + $url .= "category/$category/"; } // Dimensions go after category but before search keywords. @@ -185,7 +185,7 @@ function _s_get_placeholder_unsplash( $args = array() ) { if ( ! empty( $args['keywords'] ) ) { $keywords = rawurlencode( $args['keywords'] ); - $url .= "?$keywords"; + $url .= "?$keywords"; } // Text that will be utilized by screen readers. diff --git a/inc/hooks.php b/inc/hooks.php index 6bb8a4188..16018535d 100644 --- a/inc/hooks.php +++ b/inc/hooks.php @@ -77,7 +77,7 @@ function _s_category_transient_flusher() { delete_transient( '_s_categories' ); } add_action( 'delete_category', '_s_category_transient_flusher' ); -add_action( 'save_post', '_s_category_transient_flusher' ); +add_action( 'save_post', '_s_category_transient_flusher' ); /** * Customize "Read More" string on with the_content(); @@ -105,7 +105,7 @@ function _s_excerpt_more( $more ) { * @return array Updated allowed mime types. */ function _s_custom_mime_types( $mimes ) { - $mimes['svg'] = 'image/svg+xml'; + $mimes['svg'] = 'image/svg+xml'; $mimes['svgz'] = 'image/svg+xml'; return $mimes; } diff --git a/inc/scaffolding.php b/inc/scaffolding.php index ba03c4cdf..a1b99c20f 100644 --- a/inc/scaffolding.php +++ b/inc/scaffolding.php @@ -17,12 +17,12 @@ function _s_display_scaffolding_section( $args = array() ) { // Set defaults. $defaults = array( - 'title' => '', // The scaffolding title. - 'description' => '', // The scaffolding description. - 'usage' => '', // The template tag or markup needed to display the scaffolding. - 'parameters' => array(), // Does the scaffolding have params? Like $args? - 'arguments' => array(), // If the scaffolding has params, what are the $args? - 'output' => '', // Use the template tag or scaffolding HTML markup here. It will be sanitized displayed. + 'title' => '', // The scaffolding title. + 'description' => '', // The scaffolding description. + 'usage' => '', // The template tag or markup needed to display the scaffolding. + 'parameters' => array(), // Does the scaffolding have params? Like $args? + 'arguments' => array(), // If the scaffolding has params, what are the $args? + 'output' => '', // Use the template tag or scaffolding HTML markup here. It will be sanitized displayed. ); // Parse arguments. @@ -105,14 +105,14 @@ function _s_scaffolding_allowed_html() { // Add additional HTML tags to the wp_kses() allowed html filter. $allowed_tags = array_merge( wp_kses_allowed_html( 'post' ), array( - 'svg' => array( + 'svg' => array( 'aria-hidden' => true, 'class' => true, 'id' => true, 'role' => true, 'title' => true, ), - 'use' => array( + 'use' => array( 'xlink:href' => true, ), 'input' => array( @@ -197,11 +197,10 @@ function _s_display_global_scaffolding_section( $args = array() ) {

:

- + - From c8e324a31dc836b66ff6cd8c7d0b5bc0807429ce Mon Sep 17 00:00:00 2001 From: jomurgel Date: Fri, 23 Mar 2018 11:06:35 -0600 Subject: [PATCH 4/4] changes `null : None` to `none : None` in Background Type field --- acf-json/group_58ebcc07bfbd7.json | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/acf-json/group_58ebcc07bfbd7.json b/acf-json/group_58ebcc07bfbd7.json index f54cff580..16ad2f989 100644 --- a/acf-json/group_58ebcc07bfbd7.json +++ b/acf-json/group_58ebcc07bfbd7.json @@ -1,6 +1,6 @@ { "key": "group_58ebcc07bfbd7", - "title": "Group: Background Options - To Clone", + "title": "Group: Background Options — To Clone", "fields": [ { "key": "field_596d115a08097", @@ -42,17 +42,19 @@ "required": 0, "conditional_logic": 0, "wrapper": { - "width": "", + "width": "33", "class": "", "id": "" }, "choices": { - "null": "None", + "none": "None", "color": "Color", "image": "Image", "video": "Video" }, - "default_value": [], + "default_value": [ + "none" + ], "allow_null": 0, "multiple": 0, "ui": 0, @@ -77,7 +79,7 @@ ] ], "wrapper": { - "width": "", + "width": "66", "class": "", "id": "" }, @@ -100,7 +102,7 @@ ] ], "wrapper": { - "width": "", + "width": "66", "class": "", "id": "" }, @@ -132,7 +134,7 @@ ] ], "wrapper": { - "width": "", + "width": "66", "class": "", "id": "" }, @@ -162,5 +164,5 @@ "hide_on_screen": "", "active": 0, "description": "", - "modified": 1521739612 + "modified": 1521824780 } \ No newline at end of file