Skip to content

Commit 3f66d2b

Browse files
authored
Branch 2.17.2 (#763)
* 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
1 parent fe7dd11 commit 3f66d2b

11 files changed

+194
-17
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ user guide for more information.
3636

3737
## Changelog ##
3838

39+
### 2.17.2 ###
40+
* Bug Fix: Change metabox text color to black to pass accessibility [#755](https://github.com/BoldGrid/boldgrid-theme-framework/issues/755)
41+
* Bug Fix: Changing Color Palette changes page content [#750](https://github.com/BoldGrid/boldgrid-theme-framework/issues/750)
42+
* Bug Fix: (SproutPRO) Can't access PDF's with Crio enabled [#146](https://github.com/BoldGrid/prime/issues/146)
43+
* Bug Fix: Sidebar hover effects incorrect [#741](https://github.com/BoldGrid/boldgrid-theme-framework/issues/741)
44+
3945
### 2.17.1 ###
4046
* Bug Fix: (Sprout) Crio doesn't load sa_templates properly [#620](https://github.com/BoldGrid/boldgrid-theme-framework/issues/620)
4147
* Bug Fix: btn-large not consistent between button-primary and button-secondary [#738](https://github.com/BoldGrid/boldgrid-theme-framework/issues/)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "boldgrid-theme-framework",
3-
"version": "2.17.1",
3+
"version": "2.17.2",
44
"description": "BoldGrid Theme Framework",
55
"main": "index.js",
66
"engines": {

src/assets/js/customizer/typography/link-preview.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,22 @@ export class LinkPreview {
122122
footerLinkColorHover = parseInt( footerLinkColorHover, 10 ) / 100,
123123
footerShiftedColorVal = colorLib.Color( footerLinkColor ).lightenByAmount( footerLinkColorHover ).toCSS();
124124

125+
let colorPaletteOption = JSON.parse( api( 'boldgrid_color_palette' )() );
126+
127+
let paletteColors = colorPaletteOption.state.palettes['palette-primary'].colors;
128+
let paletteNeutral = colorPaletteOption.state.palettes['palette-primary']['neutral-color'];
129+
130+
[ 1, 2, 3, 4, 5, 'neutral' ].map( sidebarColorClass => {
131+
var sidebarColor = 'neutral' === sidebarColorClass ? paletteNeutral : paletteColors[ sidebarColorClass - 1 ],
132+
sidebarColorHover = api( 'bgtfw_body_link_color_hover' )() || 0,
133+
sidebarAriColor;
134+
135+
sidebarColorHover = parseInt( sidebarColorHover, 10 ) / 100;
136+
sidebarAriColor = colorLib.Color( sidebarColor ).lightenByAmount( sidebarColorHover ).toCSS();
137+
138+
css += `.sidebar.color-${sidebarColorClass}-link-color a:not( .btn ):hover, .sidebar.color-${sidebarColorClass}-link-color a:not( .btn ):focus { color: ${sidebarAriColor} !important; }`;
139+
} );
140+
125141
css += `
126142
#colophon .bgtfw-footer.footer-content > a:not( .btn ),
127143
#colophon .bgtfw-footer.footer-content *:not( .menu-item ) > a:not( .btn ) {

src/assets/scss/attributes.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
display: inline;
3333
margin: 0;
3434
text-transform: capitalize;
35+
color: #3c434a;
36+
}
37+
.postbox .template-subtitle {
38+
color: #3c434a;
3539
}
3640

3741
#bgtfw-attributes-meta-box div.inside {

src/assets/scss/custom-color/color-classes.scss

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,13 @@ $names: background background-color;
105105
a:not( .btn ) {
106106
color: #{nth($colors, $each)};
107107
}
108-
a:not( .btn ):hover, a:not( .btn ):focus, a:not( .btn ):active, a:not( .btn ).highlighted {
109-
color: hover( nth($colors, $color), nth($colors, $each) );
110-
}
111108
}
112109
}
113110
@if variable-exists( palette-primary-neutral-color ) {
114111
&.color-neutral-link-color {
115112
a:not( .btn ) {
116113
color: $palette-primary-neutral-color;
117114
}
118-
a:not( .btn ):hover, a:not( .btn ):focus, a:not( .btn ):active, a:not( .btn ).highlighted {
119-
color: hover( nth($colors, $color), $palette-primary-neutral-color );
120-
}
121115
}
122116
&.color-neutral-sub-link-color.sm {
123117
ul {
@@ -159,9 +153,6 @@ $names: background background-color;
159153
a:not( .btn ) {
160154
color: #{nth($colors, $each)};
161155
}
162-
a:not( .btn ):hover, a:not( .btn ):focus, a:not( .btn ):active, a:not( .btn ).highlighted {
163-
color: hover( nth($colors, $color), nth($colors, $each) );
164-
}
165156
}
166157
}
167158
&.sm {
@@ -249,8 +240,10 @@ $names: background background-color;
249240
a {
250241
color: #{nth($colors, $each)};
251242
}
252-
a:hover, a:focus, a:active, a.highlighted {
253-
color: hover( $palette-primary-neutral-color, nth($colors, $each) );
243+
&:not( .sidebar ) {
244+
a:hover, a:focus, a:active, a.highlighted {
245+
color: hover( $palette-primary-neutral-color, nth($colors, $each) );
246+
}
254247
}
255248
}
256249
&.color-#{$each}-sub-link-color.sm {

src/boldgrid-theme-framework.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: BoldGrid Theme Framework
44
* Plugin URI: https://www.boldgrid.com/docs/configuration-file
55
* 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
6-
* Version: 2.17.1
6+
* Version: 2.17.2
77
* Author: BoldGrid.com <[email protected]>
88
* Author URI: https://www.boldgrid.com/
99
* Text Domain: bgtfw

src/includes/class-boldgrid-framework-links.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,17 @@ public function get_styles( $prefix ) {
168168
$footer_lightness = max( $footer_lightness, 0 );
169169
$footer_color_hover = $footer_ari_color->getNew( 'lightness', $footer_lightness )->toCSS( 'hsla' );
170170

171+
foreach ( array( '1', '2', '3', '4', '5', 'neutral' ) as $sidebar_color_class ) {
172+
$sidebar_color_value = BoldGrid::color_from_class( $sidebar_color_class );
173+
$sidebar_color_hover = get_theme_mod( 'bgtfw_body_link_color_hover' ) ? get_theme_mod( 'bgtfw_body_link_color_hover' ) : 0;
174+
$sidebar_ari_color = ariColor::newColor( $sidebar_color_value );
175+
$sidebar_lightness = min( $sidebar_ari_color->lightness + $sidebar_color_hover, 100 );
176+
$sidebar_lightness = max( $sidebar_lightness, 0 );
177+
$sidebar_color_hover = $sidebar_ari_color->getNew( 'lightness', $sidebar_lightness )->toCSS( 'hsla' );
178+
179+
$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; }";
180+
}
181+
171182
$css .= "#colophon .bgtfw-footer.footer-content *:not( .menu-item ) > a:not( .btn ) { text-decoration: ${decoration};}";
172183
$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};}";
173184
}

src/includes/class-boldgrid-framework-wrapper.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class Boldgrid_Framework_Wrapper {
6767
* @since 1.1
6868
*/
6969
public function __construct( $template = 'base.php' ) {
70-
$this->slug = sanitize_title( basename( $template, '.php' ) );
70+
$this->slug = sanitize_title( basename( $template, '.php' ) );
7171
$this->templates = array( $template );
7272

7373
if ( self::$base ) {
@@ -79,14 +79,16 @@ public function __construct( $template = 'base.php' ) {
7979
/**
8080
* Set the string value for object.
8181
*
82-
* This applies a filter to the final $templates array, before returning
82+
* This applies filters to the final $templates array, before returning
8383
* the full path to the most specific existing base template via
8484
* locate_template()
8585
*
8686
* @since 1.1
8787
*/
8888
public function __toString() {
8989
$this->templates = apply_filters( 'boldgrid/wrap_' . $this->slug, $this->templates );
90+
$this->templates = apply_filters( 'bgtfw_wrapper_templates', $this->templates, self::$base, self::$main_template );
91+
9092
return locate_template( $this->templates );
9193
}
9294

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

109111
self::$main_template = $main;
110-
self::$base = basename( self::$main_template, '.php' );
112+
self::$base = basename( self::$main_template, '.php' );
111113

112114
// Check if index.php is the base.
113115
if ( 'index' === self::$base ) {

src/includes/class-boldgrid-framework.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ private function load_dependencies() {
204204
// Load Customizer Files.
205205
$this->load_customizer_files();
206206

207+
$this->load_third_party_files();
208+
207209
// Load Pro Feature Cards.
208210
$this->load_pro_cards();
209211

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

221+
/**
222+
* Include third party compatibility files.
223+
*
224+
* @since 2.17.2
225+
* @access private
226+
*/
227+
private function load_third_party_files() {
228+
$third_party_files = array(
229+
'sprout-invoices',
230+
);
231+
232+
foreach ( $third_party_files as $filename ) {
233+
require_once trailingslashit( __DIR__ ) . 'third-party/class-boldgrid-framework-' . $filename . '.php';
234+
}
235+
236+
Boldgrid_Framework_Sprout_Invoices::add_hooks();
237+
}
238+
219239
/**
220240
* Include additional configuration options to assign.
221241
*

src/includes/customizer/class-boldgrid-framework-customizer-colors.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,13 @@ public function update_post_background_colors( $post, $colors, $neutral ) {
363363
return;
364364
}
365365

366+
libxml_use_internal_errors( true );
367+
366368
// Create an instance of DOMDocument
367369
$dom = new \DOMDocument();
368370

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

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

@@ -417,6 +419,8 @@ public function update_post_background_colors( $post, $colors, $neutral ) {
417419
}
418420

419421
$new_content = $dom->saveHTML();
422+
$new_content = str_replace( '<html>', '', $new_content );
423+
$new_content = str_replace( '</html>', '', $new_content );
420424

421425
// Update the post content.
422426
wp_update_post(
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<?php
2+
/**
3+
* File: class-boldgrid-framework-sprout-invoices.php
4+
*
5+
* This class is responsible for adding Sprout Invoices support to the BoldGrid Framework.
6+
*
7+
* @package Boldgrid_Framework
8+
*
9+
* @since 2.17.2
10+
*/
11+
12+
/**
13+
* Class: Boldgrid_Framework_Sprout_Invoices
14+
*
15+
* This class is responsible for adding Sprout Invoices support to the BoldGrid Framework.
16+
*
17+
* @since 2.17.2
18+
*/
19+
class Boldgrid_Framework_Sprout_Invoices {
20+
/**
21+
* Add hooks.
22+
*
23+
* @since 2.17.2
24+
*/
25+
public static function add_hooks() {
26+
add_filter( 'bgtfw_wrapper_templates', array( __CLASS__, 'bgtfw_wrapper_templates' ), 10, 3 );
27+
}
28+
29+
/**
30+
* BGTFW Wrapper Templates.
31+
*
32+
* Adjusts the templates used when various sprout invoices pages are loaded.
33+
*
34+
* @since 2.17.2
35+
*/
36+
public static function bgtfw_wrapper_templates( $templates, $base, $main_template ) {
37+
38+
if ( self::is_si_pdf( $base, $main_template ) ) {
39+
$templates = array( 'si-pdf-base.php' );
40+
} elseif ( self::is_si_invoice() ) {
41+
$templates = array( 'si-invoice-base.php' );
42+
} elseif ( self::is_si_estimate() ) {
43+
$templates = array( 'si-estimate-base.php' );
44+
}
45+
46+
return $templates;
47+
}
48+
49+
/**
50+
* Is this page an SI invoice?
51+
*
52+
* Determines if a page is a Sprout Invoices invoice
53+
* based on the SI_Invoice::is_invoice_query() method.
54+
*
55+
* @since 2.17.2
56+
*
57+
* @return boolean
58+
*/
59+
public static function is_si_invoice() {
60+
if ( class_exists( 'SI_Invoice' ) ) {
61+
return SI_Invoice::is_invoice_query();
62+
} else {
63+
return false;
64+
}
65+
}
66+
67+
/**
68+
* Is this page an SI estimate?
69+
*
70+
* @since 2.17.2
71+
*
72+
* @return boolean
73+
*/
74+
public static function is_si_estimate() {
75+
global $post;
76+
77+
if ( ! empty( $post ) && class_exists( 'SI_Invoice' ) ) {
78+
return 'sa_estimate' === $post->post_type;
79+
} else {
80+
return false;
81+
}
82+
}
83+
84+
/**
85+
* Is this page an SI PDF?
86+
*
87+
* @since 2.17.2
88+
*
89+
* @return boolean
90+
*/
91+
public static function is_si_pdf( $base, $main_template ) {
92+
global $post;
93+
94+
// If Sprout is not active, we won't be viewing a sprout pdf.
95+
if ( ! class_exists( 'SI_Invoice' ) ) {
96+
return false;
97+
}
98+
99+
// When viewing the sprout invoice, these two variables are always set.
100+
if ( ! $base || ! isset( $main_template ) ) {
101+
return false;
102+
}
103+
104+
// If template doesn't contain 'sprout-invoices' in it's path, it's not a sprout pdf.
105+
if ( false === strpos( $main_template, 'sprout-invoices' ) ) {
106+
return false;
107+
}
108+
109+
// At this point, we know its a sprout page. If it's a pdf redirected page, we know it's a pdf.
110+
if ( isset( $_SERVER['REDIRECT_QUERY_STRING'] ) && 'pdf=1' === $_SERVER['REDIRECT_QUERY_STRING'] ) {
111+
return true;
112+
}
113+
114+
// If the base name contians '-pdf', then it's a sprout pdf.
115+
if ( false !== strpos( $base, '-pdf' ) ) {
116+
return true;
117+
}
118+
119+
return false;
120+
}
121+
}

0 commit comments

Comments
 (0)