Skip to content

Commit

Permalink
Branch 2.17.2 (#763)
Browse files Browse the repository at this point in the history
* change color of template subtitles (#760)

* resolve missing tags in saveHTML() (#759)

* change logic for determining base template with SI (#762)

* change logic for determining base template with SI

* add return false;

* move filters to 3rd party Sprout Invoices class

* Issue 741 (#761)

* set widget link hover to match body link hover

* fix linting issues

* fix link preview

* update version for RC

* Update package.json

* Update boldgrid-theme-framework.php

* Update README.md
  • Loading branch information
jamesros161 authored Nov 2, 2022
1 parent fe7dd11 commit 3f66d2b
Show file tree
Hide file tree
Showing 11 changed files with 194 additions and 17 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ user guide for more information.

## Changelog ##

### 2.17.2 ###
* Bug Fix: Change metabox text color to black to pass accessibility [#755](https://github.com/BoldGrid/boldgrid-theme-framework/issues/755)
* Bug Fix: Changing Color Palette changes page content [#750](https://github.com/BoldGrid/boldgrid-theme-framework/issues/750)
* Bug Fix: (SproutPRO) Can't access PDF's with Crio enabled [#146](https://github.com/BoldGrid/prime/issues/146)
* Bug Fix: Sidebar hover effects incorrect [#741](https://github.com/BoldGrid/boldgrid-theme-framework/issues/741)

### 2.17.1 ###
* Bug Fix: (Sprout) Crio doesn't load sa_templates properly [#620](https://github.com/BoldGrid/boldgrid-theme-framework/issues/620)
* Bug Fix: btn-large not consistent between button-primary and button-secondary [#738](https://github.com/BoldGrid/boldgrid-theme-framework/issues/)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "boldgrid-theme-framework",
"version": "2.17.1",
"version": "2.17.2",
"description": "BoldGrid Theme Framework",
"main": "index.js",
"engines": {
Expand Down
16 changes: 16 additions & 0 deletions src/assets/js/customizer/typography/link-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,22 @@ export class LinkPreview {
footerLinkColorHover = parseInt( footerLinkColorHover, 10 ) / 100,
footerShiftedColorVal = colorLib.Color( footerLinkColor ).lightenByAmount( footerLinkColorHover ).toCSS();

let colorPaletteOption = JSON.parse( api( 'boldgrid_color_palette' )() );

let paletteColors = colorPaletteOption.state.palettes['palette-primary'].colors;
let paletteNeutral = colorPaletteOption.state.palettes['palette-primary']['neutral-color'];

[ 1, 2, 3, 4, 5, 'neutral' ].map( sidebarColorClass => {
var sidebarColor = 'neutral' === sidebarColorClass ? paletteNeutral : paletteColors[ sidebarColorClass - 1 ],
sidebarColorHover = api( 'bgtfw_body_link_color_hover' )() || 0,
sidebarAriColor;

sidebarColorHover = parseInt( sidebarColorHover, 10 ) / 100;
sidebarAriColor = colorLib.Color( sidebarColor ).lightenByAmount( sidebarColorHover ).toCSS();

css += `.sidebar.color-${sidebarColorClass}-link-color a:not( .btn ):hover, .sidebar.color-${sidebarColorClass}-link-color a:not( .btn ):focus { color: ${sidebarAriColor} !important; }`;
} );

css += `
#colophon .bgtfw-footer.footer-content > a:not( .btn ),
#colophon .bgtfw-footer.footer-content *:not( .menu-item ) > a:not( .btn ) {
Expand Down
4 changes: 4 additions & 0 deletions src/assets/scss/attributes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
display: inline;
margin: 0;
text-transform: capitalize;
color: #3c434a;
}
.postbox .template-subtitle {
color: #3c434a;
}

#bgtfw-attributes-meta-box div.inside {
Expand Down
15 changes: 4 additions & 11 deletions src/assets/scss/custom-color/color-classes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,13 @@ $names: background background-color;
a:not( .btn ) {
color: #{nth($colors, $each)};
}
a:not( .btn ):hover, a:not( .btn ):focus, a:not( .btn ):active, a:not( .btn ).highlighted {
color: hover( nth($colors, $color), nth($colors, $each) );
}
}
}
@if variable-exists( palette-primary-neutral-color ) {
&.color-neutral-link-color {
a:not( .btn ) {
color: $palette-primary-neutral-color;
}
a:not( .btn ):hover, a:not( .btn ):focus, a:not( .btn ):active, a:not( .btn ).highlighted {
color: hover( nth($colors, $color), $palette-primary-neutral-color );
}
}
&.color-neutral-sub-link-color.sm {
ul {
Expand Down Expand Up @@ -159,9 +153,6 @@ $names: background background-color;
a:not( .btn ) {
color: #{nth($colors, $each)};
}
a:not( .btn ):hover, a:not( .btn ):focus, a:not( .btn ):active, a:not( .btn ).highlighted {
color: hover( nth($colors, $color), nth($colors, $each) );
}
}
}
&.sm {
Expand Down Expand Up @@ -249,8 +240,10 @@ $names: background background-color;
a {
color: #{nth($colors, $each)};
}
a:hover, a:focus, a:active, a.highlighted {
color: hover( $palette-primary-neutral-color, nth($colors, $each) );
&:not( .sidebar ) {
a:hover, a:focus, a:active, a.highlighted {
color: hover( $palette-primary-neutral-color, nth($colors, $each) );
}
}
}
&.color-#{$each}-sub-link-color.sm {
Expand Down
2 changes: 1 addition & 1 deletion src/boldgrid-theme-framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: BoldGrid Theme Framework
* Plugin URI: https://www.boldgrid.com/docs/configuration-file
* Description: BoldGrid Theme Framework is a library that allows you to easily make BoldGrid themes. Please see our reference guide for more information: https://www.boldgrid.com/docs/configuration-file
* Version: 2.17.1
* Version: 2.17.2
* Author: BoldGrid.com <wpb@boldgrid.com>
* Author URI: https://www.boldgrid.com/
* Text Domain: bgtfw
Expand Down
11 changes: 11 additions & 0 deletions src/includes/class-boldgrid-framework-links.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,17 @@ public function get_styles( $prefix ) {
$footer_lightness = max( $footer_lightness, 0 );
$footer_color_hover = $footer_ari_color->getNew( 'lightness', $footer_lightness )->toCSS( 'hsla' );

foreach ( array( '1', '2', '3', '4', '5', 'neutral' ) as $sidebar_color_class ) {
$sidebar_color_value = BoldGrid::color_from_class( $sidebar_color_class );
$sidebar_color_hover = get_theme_mod( 'bgtfw_body_link_color_hover' ) ? get_theme_mod( 'bgtfw_body_link_color_hover' ) : 0;
$sidebar_ari_color = ariColor::newColor( $sidebar_color_value );
$sidebar_lightness = min( $sidebar_ari_color->lightness + $sidebar_color_hover, 100 );
$sidebar_lightness = max( $sidebar_lightness, 0 );
$sidebar_color_hover = $sidebar_ari_color->getNew( 'lightness', $sidebar_lightness )->toCSS( 'hsla' );

$css .= ".sidebar.color-${sidebar_color_class}-link-color a:not( .btn ):hover, .sidebar.color-${sidebar_color_class}-link-color a:not( .btn ):focus { color: ${sidebar_color_hover} !important; }";
}

$css .= "#colophon .bgtfw-footer.footer-content *:not( .menu-item ) > a:not( .btn ) { text-decoration: ${decoration};}";
$css .= "#colophon .bgtfw-footer.footer-content *:not( .menu-item ) > a:not( .btn ):hover, .bgtfw-footer.footer-content *:not( .menu-item ) > a:not( .btn ):focus {color: ${footer_color_hover};text-decoration: ${decoration_hover};}";
}
Expand Down
8 changes: 5 additions & 3 deletions src/includes/class-boldgrid-framework-wrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Boldgrid_Framework_Wrapper {
* @since 1.1
*/
public function __construct( $template = 'base.php' ) {
$this->slug = sanitize_title( basename( $template, '.php' ) );
$this->slug = sanitize_title( basename( $template, '.php' ) );
$this->templates = array( $template );

if ( self::$base ) {
Expand All @@ -79,14 +79,16 @@ public function __construct( $template = 'base.php' ) {
/**
* Set the string value for object.
*
* This applies a filter to the final $templates array, before returning
* This applies filters to the final $templates array, before returning
* the full path to the most specific existing base template via
* locate_template()
*
* @since 1.1
*/
public function __toString() {
$this->templates = apply_filters( 'boldgrid/wrap_' . $this->slug, $this->templates );
$this->templates = apply_filters( 'bgtfw_wrapper_templates', $this->templates, self::$base, self::$main_template );

return locate_template( $this->templates );
}

Expand All @@ -107,7 +109,7 @@ public static function wrap( $main ) {
}

self::$main_template = $main;
self::$base = basename( self::$main_template, '.php' );
self::$base = basename( self::$main_template, '.php' );

// Check if index.php is the base.
if ( 'index' === self::$base ) {
Expand Down
20 changes: 20 additions & 0 deletions src/includes/class-boldgrid-framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ private function load_dependencies() {
// Load Customizer Files.
$this->load_customizer_files();

$this->load_third_party_files();

// Load Pro Feature Cards.
$this->load_pro_cards();

Expand All @@ -216,6 +218,24 @@ private function load_dependencies() {
$this->loader = new Boldgrid_Framework_Loader();
}

/**
* Include third party compatibility files.
*
* @since 2.17.2
* @access private
*/
private function load_third_party_files() {
$third_party_files = array(
'sprout-invoices',
);

foreach ( $third_party_files as $filename ) {
require_once trailingslashit( __DIR__ ) . 'third-party/class-boldgrid-framework-' . $filename . '.php';
}

Boldgrid_Framework_Sprout_Invoices::add_hooks();
}

/**
* Include additional configuration options to assign.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,13 @@ public function update_post_background_colors( $post, $colors, $neutral ) {
return;
}

libxml_use_internal_errors( true );

// Create an instance of DOMDocument
$dom = new \DOMDocument();

// Handle UTF-8, otherwise problems will occur with UTF-8 characters.
$dom->loadHTML( mb_convert_encoding( $post_content, 'HTML-ENTITIES', 'UTF-8' ), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD );
$dom->loadHTML( mb_convert_encoding( '<html>' . $post_content . '</html>', 'HTML-ENTITIES', 'UTF-8' ), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD );

$elements = $dom->getElementsByTagName( '*' );

Expand Down Expand Up @@ -417,6 +419,8 @@ public function update_post_background_colors( $post, $colors, $neutral ) {
}

$new_content = $dom->saveHTML();
$new_content = str_replace( '<html>', '', $new_content );
$new_content = str_replace( '</html>', '', $new_content );

// Update the post content.
wp_update_post(
Expand Down
121 changes: 121 additions & 0 deletions src/includes/third-party/class-boldgrid-framework-sprout-invoices.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?php
/**
* File: class-boldgrid-framework-sprout-invoices.php
*
* This class is responsible for adding Sprout Invoices support to the BoldGrid Framework.
*
* @package Boldgrid_Framework
*
* @since 2.17.2
*/

/**
* Class: Boldgrid_Framework_Sprout_Invoices
*
* This class is responsible for adding Sprout Invoices support to the BoldGrid Framework.
*
* @since 2.17.2
*/
class Boldgrid_Framework_Sprout_Invoices {
/**
* Add hooks.
*
* @since 2.17.2
*/
public static function add_hooks() {
add_filter( 'bgtfw_wrapper_templates', array( __CLASS__, 'bgtfw_wrapper_templates' ), 10, 3 );
}

/**
* BGTFW Wrapper Templates.
*
* Adjusts the templates used when various sprout invoices pages are loaded.
*
* @since 2.17.2
*/
public static function bgtfw_wrapper_templates( $templates, $base, $main_template ) {