Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Stopped disabled shades and tints from appearing as variables in the Oxygen and Bricks builders. The generated CSS already left out a color's shades or tints once you switched them off, but the builder variable dropdowns and Oxygen Classic's Alt-click variable panel still listed them, so picking one pointed at a custom property that did not exist.
- Fixed the block editor and Site Editor marking a clean post, template or template part as modified ("Review changes") as soon as it opened. The Core Framework class panel wrote an empty class name to every block before loading its saved classes, which counted as an edit. The panel now starts from the block's saved classes and only writes when a class actually changes.
- Restored the Core Framework dark and light preview toggle in the Bricks 2.4 toolbar. Bricks 2.4 replaced its single toolbar with several position-specific ones, so the toggle never appeared. It now sits last in the toolbar, comes back when Bricks rebuilds its toolbars, works from the keyboard, and follows an "auto" theme preference.
- Core Framework's own WordPress version check now runs. It read a plugin header the plugin never declared, so a site running Core Framework on a WordPress version older than it requires (for example after copying the plugin files in by hand, or downgrading WordPress) kept the plugin active. The plugin now deactivates itself on those sites and shows a notice naming the version it needs.

## [2.0.2] - 2026-08-28

Expand Down
36 changes: 36 additions & 0 deletions packages/wp/Tests/PluginHeadersTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

use CoreFramework\Config\Plugin;
use PHPUnit\Framework\TestCase;

final class PluginHeadersTest extends TestCase {
/**
* Reads a header the way WordPress's get_file_data() does.
*/
private function header( string $file, string $name ): string {
$contents = file_get_contents( dirname( __DIR__ ) . '/' . $file );

if ( ! preg_match( '/^(?:[ \t]*<\?php)?[ \t\/*#@]*' . preg_quote( $name, '/' ) . ':(.*)$/mi', $contents, $match ) ) {
return '';
}

return trim( preg_replace( '/\s*(?:\*\/|\?>).*/', '', $match[1] ) );
}

public function test_every_header_the_plugin_reads_is_declared(): void {
foreach ( Plugin::HEADERS as $key => $name ) {
$this->assertNotSame( '', $this->header( 'core-framework.php', $name ), "core-framework.php does not declare \"{$name}\", so Plugin '{$key}' is empty." );
}
}

public function test_requirement_headers_match_the_readme(): void {
$this->assertSame(
$this->header( 'readme.txt', 'Requires at least' ),
$this->header( 'core-framework.php', Plugin::HEADERS['required-wp'] )
);
$this->assertSame(
$this->header( 'readme.txt', 'Requires PHP' ),
$this->header( 'core-framework.php', Plugin::HEADERS['required-php'] )
);
}
}
37 changes: 20 additions & 17 deletions packages/wp/wp/Config/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,25 @@ final class Plugin {
*/
use Singleton;

/**
* Root file headers read into the plugin data, keyed by data key
*
* @since 2.1.0
*/
public const HEADERS = array(
'name' => 'Plugin Name',
'uri' => 'Plugin URI',
'description' => 'Description',
'version' => 'Version',
'author' => 'Author',
'author-uri' => 'Author URI',
'text-domain' => 'Text Domain',
'domain-path' => 'Domain Path',
'required-php' => 'Requires PHP',
'required-wp' => 'Requires at least',
'namespace' => 'Namespace',
);

/**
* Get the plugin meta data from the root file and include own data
*
Expand All @@ -47,23 +66,7 @@ public function data(): array {
return array_merge(
\apply_filters(
'core_framework_plugin_meta_data',
\get_file_data(
CORE_FRAMEWORK_ABSOLUTE,
array(
'name' => 'Plugin Name',
'uri' => 'Plugin URI',
'description' => 'Description',
'version' => 'Version',
'author' => 'Author',
'author-uri' => 'Author URI',
'text-domain' => 'Text Domain',
'domain-path' => 'Domain Path',
'required-php' => 'Requires PHP',
'required-wp' => 'Requires WP',
'namespace' => 'Namespace',
),
'plugin'
)
\get_file_data( CORE_FRAMEWORK_ABSOLUTE, self::HEADERS, 'plugin' )
),
$plugin_data
);
Expand Down
Loading