Skip to content

Commit

Permalink
Fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
ronilaukkarinen committed Dec 19, 2024
2 parents a360bdc + ba43d4b commit d9e11a2
Show file tree
Hide file tree
Showing 18 changed files with 66 additions and 3,258 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/html.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,22 @@ jobs:
name: Test HTML and accessibility with NU HTML Checker
runs-on: ubuntu-20.04

# Test on macOS:
# brew install openjdk
# sudo ln -sfn $(brew --prefix)/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
steps:
- name: Run html-validator-cli
- name: Install Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Download vnu.jar
run: wget https://github.com/validator/validator/releases/download/latest/vnu.jar

- name: Run vnu validator
run: |
npm i -g html-validator-cli
html-validator "https://airwptheme.com/demo" --format=text --ignore='Error: CSS: “padding-top”: only “0” can be a “unit”. You must put a unit after your number.' --quiet
java -jar vnu.jar --skip-non-html --errors-only --format text \
--filterpattern ".*contain-intrinsic-size.*" \
--filterpattern ".*only.*0.*can be a.*unit.*" \
"https://airwptheme.com/demo"
1 change: 0 additions & 1 deletion .jshintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ gulp/*.js
gulp/*/*.js
js/prod/*.js
js/dev/*.js
js/src/legacy.js
js/src/modules/lazyload.js
js/src/modules/sticky-nav.js
js/src/modules/navigation.js
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
### [Unreleased]

* Add debug function to print all available blocks

### 9.4.7: 2024-12-04

* Fix body styles leaking to wp-admin
* Fix img proportions fallback for images that have width and height set, T-23188
* Fix image proportions for overlay images due to air-helper 3.1.1, T-23188
* Change HTML build CI to use vnu-jar instead of outdated html-validator-cli
* Remove polyfills, T-14767

### 9.4.6: 2024-11-19

Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,6 @@ All .js files in `/js/src/*` is built to production bundles in `/js/prod/` folde

If you want to add a piece of custom JS, create a file under `/js/src/modules/` and import or require it in `/js/src/front-end.js`. If you need a admin-specific JS, add a `/js/src/admin.js` and then enqueue `/js/dist/admin.js` with `enqueue_admin_scripts`

#### Legacy support

Our build uses babel to translate scripts to ES2015 compatible JS, so you can use modern JS syntax without thinking about backwards compatibility. There is a `/js/src/legacy.js` file, which contains the needed polyfills for browsers not supporting the ES2015 syntax and is automatically loaded on the header when such browser is detected.

#### Linter

We use [Airbnb](https://github.com/airbnb/javascript) es-lint presets spiced up with our own flavors.
Expand Down
2 changes: 1 addition & 1 deletion bin/tasks/additions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ chmod 777 ${PROJECT_PATH}/media

echo "${YELLOW}Generating default README.md...${TXTRESET}"

NEWEST_AIR_VERSION="9.4.6"
NEWEST_AIR_VERSION="9.4.7"
NEWEST_WORDPRESS_VERSION="6.7.0"
NEWEST_PHP_VERSION="8.3"
CURRENT_DATE=$(LC_TIME=en_US date '+%d %b %Y' |tr ' ' '_');
Expand Down
20 changes: 18 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* The current version of the theme.
*/
define( 'AIR_LIGHT_VERSION', '9.4.6' );
define( 'AIR_LIGHT_VERSION', '9.4.7' );

// We need to have some defaults as comments or empties so let's allow this:
// phpcs:disable Squiz.Commenting.InlineComment.SpacingBefore, WordPress.Arrays.ArrayDeclarationSpacing.SpaceInEmptyArray
Expand Down Expand Up @@ -141,7 +141,7 @@
// Accepts both string (all*/none-options only) and array (options + specific blocks)
'allowed_blocks' => [
'post' => 'all-core-blocks',
'page' => [],
'page' => 'all',
// 'page' => [
// 'all-acf-blocks',
// 'core/paragraph',
Expand All @@ -168,6 +168,22 @@
define( 'THEME_SETTINGS', $theme_settings );
} ); // end action after_setup_theme

/**
* Debug function to print all available blocks
*/
function debug_print_all_blocks() {
$blocks = \WP_Block_Type_Registry::get_instance()->get_all_registered();
$block_names = array_map(function( $block ) {
return "'" . $block->name . "',";
}, $blocks);
echo '<pre>' . implode( "\n", $block_names ) . '</pre>'; // phpcs:ignore
die();
}

// Uncomment the following line to see all available blocks:
// add_action('init', __NAMESPACE__ . '\\debug_print_all_blocks');


/**
* Required files
*/
Expand Down
1 change: 0 additions & 1 deletion inc/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
* Scripts and styles associated hooks
*/
require get_theme_file_path( 'inc/hooks/scripts-styles.php' );
add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_polyfills' );
add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_theme_scripts' );

// NB! If you use ajax functionality in Gravity Forms, remove this line
Expand Down
1 change: 1 addition & 0 deletions inc/hooks/gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Restrict blocks to only allowed blocks in the settings
*/
function allowed_block_types( $allowed_blocks, $editor_context ) { // phpcs:ignore

// If no allowed blocks are defined or it is set to none, return an empty array
if ( empty( THEME_SETTINGS['allowed_blocks'] ) || 'none' === THEME_SETTINGS['allowed_blocks'] ) {
return [];
Expand Down
28 changes: 0 additions & 28 deletions inc/hooks/scripts-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,34 +61,6 @@ function enqueue_theme_scripts() {
wp_localize_script( 'scripts', 'air_light_externalLinkDomains', THEME_SETTINGS['external_link_domains_exclude'] );
} // end air_light_scripts

/**
* Load polyfills for legacy browsers
*/
function enqueue_polyfills() {
// Include polyfills
$script = '
var supportsES6 = (function () {
try {
new Function("(a = 0) => a");
return true;
} catch (err) {
return false;
}
}());
var legacyScript ="' . esc_url( get_theme_file_uri( get_asset_file( 'legacy.js' ) ) ) . '";
if (!supportsES6) {
var script = document.createElement("script");
script.src = legacyScript;
document.head.appendChild(script);
}';

if ( file_exists( get_theme_file_path( get_asset_file( 'legacy.js' ) ) ) ) {
wp_register_script( 'air_light_legacy', '', [], filemtime( get_theme_file_path( get_asset_file( 'legacy.js' ) ) ), false );
wp_enqueue_script( 'air_light_legacy' );
wp_add_inline_script( 'air_light_legacy', $script, true );
}
} // end enqueue_polyfills

/**
* Returns the built asset filename and path depending on
* current environment.
Expand Down
Loading

0 comments on commit d9e11a2

Please sign in to comment.