Skip to content
Merged
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 @@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fixed View Only mode in the web app at coreframework.com/app. Opening someone else's public project with View Only still showed the Save buttons and saved on Cmd/Ctrl+S, because the buttons were removed before the editor had drawn them. View Only now hides both Save buttons and ignores the shortcut.
- Fixed saves in the web app at coreframework.com/app sometimes finishing without "Saved successfully" or an error. The editor listened for exactly one message after saving, so any other message arriving first, such as one from a browser extension, used it up and the site's answer was ignored. It now waits for the site's answer itself, and reports an error if none arrives within 30 seconds.
- 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.
- Fixed local Figma projects disappearing when the plugin reopened. The default presets exceeded Figma's 100 kB storage-entry limit, so variables could update while project storage failed. Local projects now use smaller storage entries, preserve the previous save if a write fails, and report success only after the project and variables have been saved. Existing local projects remain readable. Variable synchronization also leaves collections other than Core Framework untouched.

## [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