Actualizacion 7.1.2
This commit is contained in:
+1
-1
@@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInita50e6b304efbc99120a5f1c6ce16f39b::getLoader();
|
||||
return ComposerAutoloaderInitda5118e07739bcc2a9ee8b03eeea8972::getLoader();
|
||||
|
||||
-80
@@ -1,80 +0,0 @@
|
||||
---
|
||||
name: beads
|
||||
description: Use when working in a repository that uses bd or Beads for durable project task tracking, issue dependencies, blocker management, multi-session handoff, or shared work memory. Trigger when the user asks to find ready work, claim or close tasks, create follow-up work, inspect blockers, recover project context, or choose between local planning and persistent project tracking.
|
||||
---
|
||||
|
||||
# Beads
|
||||
|
||||
Use Beads as the shared project task system. Local plans, scratch files, and personal memories are useful, but they are not the durable source of truth for project work.
|
||||
|
||||
## First Step
|
||||
|
||||
Run:
|
||||
|
||||
```bash
|
||||
bd prime
|
||||
```
|
||||
|
||||
If that prints nothing, check whether the repository has an active Beads workspace:
|
||||
|
||||
```bash
|
||||
bd where
|
||||
```
|
||||
|
||||
## Preferred Route
|
||||
|
||||
Use the `bd` CLI when shell access is available. It is the most compact and direct Beads interface.
|
||||
|
||||
## Core CLI Workflow
|
||||
|
||||
1. Find work:
|
||||
|
||||
```bash
|
||||
bd ready
|
||||
bd list --status=open
|
||||
bd list --status=in_progress
|
||||
```
|
||||
|
||||
2. Inspect before editing:
|
||||
|
||||
```bash
|
||||
bd show <id>
|
||||
```
|
||||
|
||||
3. Claim work atomically:
|
||||
|
||||
```bash
|
||||
bd update <id> --claim
|
||||
```
|
||||
|
||||
4. Create durable follow-up work when implementation reveals new tasks:
|
||||
|
||||
```bash
|
||||
bd create "Short title" --description="Why this exists and what needs to be done" --type=task --priority=2
|
||||
```
|
||||
|
||||
5. Close completed work:
|
||||
|
||||
```bash
|
||||
bd close <id> --reason="Completed"
|
||||
```
|
||||
|
||||
## What Belongs In Beads
|
||||
|
||||
Use Beads for:
|
||||
|
||||
- shared project tasks
|
||||
- blockers and dependencies
|
||||
- discovered follow-up work
|
||||
- work that must survive thread reset, compaction, or handoff
|
||||
- status that another person or agent should be able to resume
|
||||
|
||||
Use agent-local planning tools only for the current turn's execution checklist. Do not treat them as shared project state.
|
||||
|
||||
## Rules
|
||||
|
||||
- Do not create markdown TODO files as the source of truth when Beads is available.
|
||||
- Do not use `bd edit`; it opens an interactive editor. Use `bd update` flags instead.
|
||||
- Prefer `--json` when parsing `bd` output programmatically.
|
||||
- If hooks are installed, `bd prime` may already be injected. Run it manually when context is missing.
|
||||
- Do not auto-close or mutate tasks unless the work is actually complete.
|
||||
Vendored
-4
@@ -1,4 +0,0 @@
|
||||
interface:
|
||||
display_name: "Beads"
|
||||
short_description: "Project task tracking with bd"
|
||||
default_prompt: "Use $beads to inspect ready work and manage durable project tasks."
|
||||
@@ -1,68 +0,0 @@
|
||||
# Beads Configuration File
|
||||
# This file configures default behavior for all bd commands in this repository
|
||||
# All settings can also be set via environment variables (BD_* prefix)
|
||||
# or overridden with command-line flags
|
||||
|
||||
# Issue prefix for this repository (used by bd init)
|
||||
# If not set, bd init will auto-detect from directory name
|
||||
# Example: issue-prefix: "myproject" creates issues like "myproject-1", "myproject-2", etc.
|
||||
# issue-prefix: ""
|
||||
|
||||
# Use no-db mode: JSONL-only, no Dolt database
|
||||
# When true, .beads/issues.jsonl is the only local store
|
||||
# no-db: false
|
||||
|
||||
# Enable JSON output by default
|
||||
# json: false
|
||||
|
||||
# Feedback title formatting for mutating commands (create/update/close/dep/edit)
|
||||
# 0 = hide titles, N > 0 = truncate to N characters
|
||||
# output:
|
||||
# title-length: 255
|
||||
|
||||
# Default actor for audit trails (overridden by BEADS_ACTOR or --actor)
|
||||
# actor: ""
|
||||
|
||||
# Export events (audit trail) to .beads/events.jsonl on each flush/sync
|
||||
# When enabled, new events are appended incrementally using a high-water mark.
|
||||
# Use 'bd export --events' to trigger manually regardless of this setting.
|
||||
# events-export: false
|
||||
|
||||
# Multi-repo configuration (experimental - bd-307)
|
||||
# Allows hydrating from multiple repositories and routing writes to the correct database
|
||||
# repos:
|
||||
# primary: "." # Primary repo (where this database lives)
|
||||
# additional: # Additional repos to hydrate from (read-only)
|
||||
# - ~/beads-planning # Personal planning repo
|
||||
# - ~/work-planning # Work planning repo
|
||||
|
||||
# Dolt-native backup (periodic backup for off-machine recovery)
|
||||
# This is full database backup only. Cross-machine sync uses Dolt remotes.
|
||||
# backup:
|
||||
# enabled: false # Disable auto-backup entirely
|
||||
# interval: 15m # Minimum time between auto-backups
|
||||
# git-push: false # Disable git push (backup locally only)
|
||||
# git-repo: "" # Separate git repo for backups (default: project repo)
|
||||
|
||||
# Optional JSONL auto-export for viewers, interchange, and issue-level migration.
|
||||
# Disabled by default; enable only when an integration needs fresh .beads/issues.jsonl.
|
||||
# Use relative paths under .beads/ for JSONL import/export filenames.
|
||||
# export:
|
||||
# auto: false
|
||||
# path: issues.jsonl
|
||||
# interval: 60s
|
||||
# git-add: false
|
||||
# import:
|
||||
# path: issues.jsonl
|
||||
|
||||
# Integration settings (access with 'bd config get/set')
|
||||
# Non-secret keys (stored in the database):
|
||||
# - jira.url, jira.project
|
||||
# - linear.team_id
|
||||
# - github.org, github.repo
|
||||
#
|
||||
# Secret keys (stored in this file but prefer env vars to avoid git exposure):
|
||||
# - linear.api_key → use LINEAR_API_KEY env var instead
|
||||
# - github.token → use GITHUB_TOKEN env var instead
|
||||
|
||||
sync.remote: "git+ssh://git@github.com/CMB2/CMB2.git"
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
# --- BEGIN BEADS INTEGRATION v1.0.5 ---
|
||||
# This section is managed by beads. Do not remove these markers.
|
||||
if command -v bd >/dev/null 2>&1; then
|
||||
export BD_GIT_HOOK=1
|
||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||
_bd_used_perl=0
|
||||
if command -v timeout >/dev/null 2>&1; then
|
||||
timeout "$_bd_timeout" bd hooks run post-checkout "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v gtimeout >/dev/null 2>&1; then
|
||||
gtimeout "$_bd_timeout" bd hooks run post-checkout "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v perl >/dev/null 2>&1; then
|
||||
_bd_used_perl=1
|
||||
perl -e 'alarm shift; exec @ARGV' "$_bd_timeout" bd hooks run post-checkout "$@"
|
||||
_bd_exit=$?
|
||||
else
|
||||
echo >&2 "beads: hook 'post-checkout' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||
bd hooks run post-checkout "$@"
|
||||
_bd_exit=$?
|
||||
fi
|
||||
if [ $_bd_exit -eq 124 ] || { [ $_bd_used_perl -eq 1 ] && [ $_bd_exit -eq 142 ]; }; then
|
||||
echo >&2 "beads: hook 'post-checkout' timed out after ${_bd_timeout}s — continuing without beads"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -eq 3 ]; then
|
||||
echo >&2 "beads: database not initialized — skipping hook 'post-checkout'"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
|
||||
fi
|
||||
# --- END BEADS INTEGRATION v1.0.5 ---
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
# --- BEGIN BEADS INTEGRATION v1.0.5 ---
|
||||
# This section is managed by beads. Do not remove these markers.
|
||||
if command -v bd >/dev/null 2>&1; then
|
||||
export BD_GIT_HOOK=1
|
||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||
_bd_used_perl=0
|
||||
if command -v timeout >/dev/null 2>&1; then
|
||||
timeout "$_bd_timeout" bd hooks run post-merge "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v gtimeout >/dev/null 2>&1; then
|
||||
gtimeout "$_bd_timeout" bd hooks run post-merge "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v perl >/dev/null 2>&1; then
|
||||
_bd_used_perl=1
|
||||
perl -e 'alarm shift; exec @ARGV' "$_bd_timeout" bd hooks run post-merge "$@"
|
||||
_bd_exit=$?
|
||||
else
|
||||
echo >&2 "beads: hook 'post-merge' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||
bd hooks run post-merge "$@"
|
||||
_bd_exit=$?
|
||||
fi
|
||||
if [ $_bd_exit -eq 124 ] || { [ $_bd_used_perl -eq 1 ] && [ $_bd_exit -eq 142 ]; }; then
|
||||
echo >&2 "beads: hook 'post-merge' timed out after ${_bd_timeout}s — continuing without beads"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -eq 3 ]; then
|
||||
echo >&2 "beads: database not initialized — skipping hook 'post-merge'"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
|
||||
fi
|
||||
# --- END BEADS INTEGRATION v1.0.5 ---
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
# --- BEGIN BEADS INTEGRATION v1.0.5 ---
|
||||
# This section is managed by beads. Do not remove these markers.
|
||||
if command -v bd >/dev/null 2>&1; then
|
||||
export BD_GIT_HOOK=1
|
||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||
_bd_used_perl=0
|
||||
if command -v timeout >/dev/null 2>&1; then
|
||||
timeout "$_bd_timeout" bd hooks run pre-commit "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v gtimeout >/dev/null 2>&1; then
|
||||
gtimeout "$_bd_timeout" bd hooks run pre-commit "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v perl >/dev/null 2>&1; then
|
||||
_bd_used_perl=1
|
||||
perl -e 'alarm shift; exec @ARGV' "$_bd_timeout" bd hooks run pre-commit "$@"
|
||||
_bd_exit=$?
|
||||
else
|
||||
echo >&2 "beads: hook 'pre-commit' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||
bd hooks run pre-commit "$@"
|
||||
_bd_exit=$?
|
||||
fi
|
||||
if [ $_bd_exit -eq 124 ] || { [ $_bd_used_perl -eq 1 ] && [ $_bd_exit -eq 142 ]; }; then
|
||||
echo >&2 "beads: hook 'pre-commit' timed out after ${_bd_timeout}s — continuing without beads"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -eq 3 ]; then
|
||||
echo >&2 "beads: database not initialized — skipping hook 'pre-commit'"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
|
||||
fi
|
||||
# --- END BEADS INTEGRATION v1.0.5 ---
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
# --- BEGIN BEADS INTEGRATION v1.0.5 ---
|
||||
# This section is managed by beads. Do not remove these markers.
|
||||
if command -v bd >/dev/null 2>&1; then
|
||||
export BD_GIT_HOOK=1
|
||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||
_bd_used_perl=0
|
||||
if command -v timeout >/dev/null 2>&1; then
|
||||
timeout "$_bd_timeout" bd hooks run pre-push "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v gtimeout >/dev/null 2>&1; then
|
||||
gtimeout "$_bd_timeout" bd hooks run pre-push "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v perl >/dev/null 2>&1; then
|
||||
_bd_used_perl=1
|
||||
perl -e 'alarm shift; exec @ARGV' "$_bd_timeout" bd hooks run pre-push "$@"
|
||||
_bd_exit=$?
|
||||
else
|
||||
echo >&2 "beads: hook 'pre-push' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||
bd hooks run pre-push "$@"
|
||||
_bd_exit=$?
|
||||
fi
|
||||
if [ $_bd_exit -eq 124 ] || { [ $_bd_used_perl -eq 1 ] && [ $_bd_exit -eq 142 ]; }; then
|
||||
echo >&2 "beads: hook 'pre-push' timed out after ${_bd_timeout}s — continuing without beads"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -eq 3 ]; then
|
||||
echo >&2 "beads: database not initialized — skipping hook 'pre-push'"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
|
||||
fi
|
||||
# --- END BEADS INTEGRATION v1.0.5 ---
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
# --- BEGIN BEADS INTEGRATION v1.0.5 ---
|
||||
# This section is managed by beads. Do not remove these markers.
|
||||
if command -v bd >/dev/null 2>&1; then
|
||||
export BD_GIT_HOOK=1
|
||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||
_bd_used_perl=0
|
||||
if command -v timeout >/dev/null 2>&1; then
|
||||
timeout "$_bd_timeout" bd hooks run prepare-commit-msg "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v gtimeout >/dev/null 2>&1; then
|
||||
gtimeout "$_bd_timeout" bd hooks run prepare-commit-msg "$@"
|
||||
_bd_exit=$?
|
||||
elif command -v perl >/dev/null 2>&1; then
|
||||
_bd_used_perl=1
|
||||
perl -e 'alarm shift; exec @ARGV' "$_bd_timeout" bd hooks run prepare-commit-msg "$@"
|
||||
_bd_exit=$?
|
||||
else
|
||||
echo >&2 "beads: hook 'prepare-commit-msg' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||
bd hooks run prepare-commit-msg "$@"
|
||||
_bd_exit=$?
|
||||
fi
|
||||
if [ $_bd_exit -eq 124 ] || { [ $_bd_used_perl -eq 1 ] && [ $_bd_exit -eq 142 ]; }; then
|
||||
echo >&2 "beads: hook 'prepare-commit-msg' timed out after ${_bd_timeout}s — continuing without beads"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -eq 3 ]; then
|
||||
echo >&2 "beads: database not initialized — skipping hook 'prepare-commit-msg'"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
|
||||
fi
|
||||
# --- END BEADS INTEGRATION v1.0.5 ---
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
{"id":"int-f6186c1fddd8774503e521dfa8b8670e","kind":"field_change","created_at":"2026-05-31T00:00:12.920701Z","actor":"Justin Sternberg","issue_id":"cmb2-g75","extra":{"field":"status","new_value":"closed","old_value":"open","reason":"Pinned wp-env to 2622/2623, updated all 8889 refs, self-starting phptests; verified cold start + 214 tests pass"}}
|
||||
{"id":"int-f05369fcf819c002c87a25c82ac472de","kind":"field_change","created_at":"2026-05-31T00:14:44.983827Z","actor":"Justin Sternberg","issue_id":"cmb2-kr3","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Baseline screenshots/observations captured on WP 6.3.1 + develop; bug confirmed absent on pre-7.0."}}
|
||||
{"id":"int-afd5b3d83029cda4cf16d048e98c36b2","kind":"field_change","created_at":"2026-05-31T00:31:09.412889Z","actor":"Justin Sternberg","issue_id":"cmb2-oyp","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Bug reproduced on WP 7.0 + develop on both settings and post-edit surfaces; confirmed visually + via computed background-color."}}
|
||||
{"id":"int-9549a1593d112d2b39bba593ea15d1bd","kind":"field_change","created_at":"2026-05-31T00:34:04.776317Z","actor":"Justin Sternberg","issue_id":"cmb2-tl6","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"qa-1557 branch = develop + PR fix, ready to build."}}
|
||||
{"id":"int-7f549a6dc21af415f57991c1d16ff278","kind":"field_change","created_at":"2026-05-31T00:34:30.301373Z","actor":"Justin Sternberg","issue_id":"cmb2-8ww","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"npm run build:css clean; compiled CSS across all variants carries the :not(checkbox/radio):focus rule + fresh banner."}}
|
||||
{"id":"int-821e7108d8898d670ccfefa51b97fce6","kind":"field_change","created_at":"2026-05-31T00:37:37.67524Z","actor":"Justin Sternberg","issue_id":"cmb2-6j0","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"PR :not() fix verified on WP 7.0, both surfaces, via focus-independent CSSOM matches() check + computed style."}}
|
||||
{"id":"int-9a1a03859bd9b3d391abfef7cbad5ecc","kind":"field_change","created_at":"2026-05-31T00:39:28.329499Z","actor":"Justin Sternberg","issue_id":"cmb2-7ku","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"No back-compat regression on 6.3.1 with the :not() fix; checkbox/radio indicators (::before) unaffected, text tint preserved."}}
|
||||
{"id":"int-0399e8dc4cc2eabb55268aadbe84dd8d","kind":"field_change","created_at":"2026-05-31T00:40:54.575881Z","actor":"Justin Sternberg","issue_id":"cmb2-ec8","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Option B (full removal of focus-background rule) implemented and built; #fffff8 gone from all compiled CSS."}}
|
||||
{"id":"int-acef19ce9398e511d870cd408bb4608a","kind":"field_change","created_at":"2026-05-31T00:43:35.529154Z","actor":"Justin Sternberg","issue_id":"cmb2-8at","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Option B verified across 6.3.1 + 7.0 (both surfaces): fixes bug on 7.0, no regression on 6.3.1, intended text-tint removal only."}}
|
||||
{"id":"int-e2ce899d2f9c0628d914c2dc721064bf","kind":"field_change","created_at":"2026-05-31T00:56:22.447965Z","actor":"Justin Sternberg","issue_id":"cmb2-vr3","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"PR #1557 force-updated to clean Option B commit; title/description/QA-comment posted; awaiting merge."}}
|
||||
{"id":"int-b0d259257f751a7cc46d807c8171e59f","kind":"field_change","created_at":"2026-05-31T00:56:22.609131Z","actor":"Justin Sternberg","issue_id":"cmb2-14j","extra":{"field":"status","new_value":"closed","old_value":"open","reason":"QA epic complete: bug reproduced + Option B fix verified on WP 7.0 and 6.3.1 (both surfaces); PR #1557 finalized with Option B."}}
|
||||
{"id":"int-609ac7c3963b63f52c482951e37a77cf","kind":"field_change","created_at":"2026-05-31T01:13:10.673448Z","actor":"Justin Sternberg","issue_id":"cmb2-do9","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Migrated wp-env off deprecated env/testsPort/testsEnvironment: dev env in .wp-env.json (2622, testsEnvironment:false) + isolated tests env in new .wp-env-tests.json (2623) via --config. Updated phptests (runs in cli container now, no tests-cli), env:tests:* scripts, Playwright webServer, CI test.yml, CLAUDE.md, playwright README. Verified: no deprecation warning, phpunit 214 pass, Playwright plugin+metabox specs pass."}}
|
||||
{"id":"int-fa30a19689a3cc8554fe4ffdb54845b6","kind":"field_change","created_at":"2026-05-31T01:28:09.672662Z","actor":"Justin Sternberg","issue_id":"cmb2-0sq","extra":{"field":"status","new_value":"in_progress","old_value":"open"}}
|
||||
{"id":"int-a18293201847231d3c19f8ee5825a9be","kind":"field_change","created_at":"2026-05-31T01:34:39.67677Z","actor":"Justin Sternberg","issue_id":"cmb2-cfj","extra":{"field":"status","new_value":"in_progress","old_value":"open"}}
|
||||
{"id":"int-bbff1f9ac7c003e0a91ee801fe7f5330","kind":"field_change","created_at":"2026-05-31T01:37:06.473028Z","actor":"Justin Sternberg","issue_id":"cmb2-0sq","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Set WP_DEBUG=true + WP_DEBUG_DISPLAY=false in .wp-env-tests.json: logs PHP deprecations without rendering into pages (verified visual suite stable). aec1d71"}}
|
||||
{"id":"int-6539bee7eabbcfa7c726d8833ca65a10","kind":"field_change","created_at":"2026-05-31T01:37:06.622781Z","actor":"Justin Sternberg","issue_id":"cmb2-cfj","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Simplified Playwright webServer command to 'npm run env:tests:start'; removed dead CI echo branch. aec1d71"}}
|
||||
{"id":"int-34391301c83184ac337692c0e67e01a9","kind":"field_change","created_at":"2026-05-31T02:04:33.067846Z","actor":"Justin Sternberg","issue_id":"cmb2-cz6","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Re-scoped Mobile/Tablet visual tests from fullPage post-new.php screenshots to the opened #cmb2_integration_tests_default_closed metabox element at 375px/768px viewports. Local baselines regenerated (mobile 353x230, tablet 746x193 — fields reflow captured); full visual suite passes deterministically across 2 consecutive runs. Committed to develop 74551bc (no PR). No CI impact (suite is CI-skipped)."}}
|
||||
@@ -1 +0,0 @@
|
||||
{"_type":"issue","id":"cmb2-u2a","title":"Harden #[AllowDynamicProperties] coverage across CMB2 class roots","description":"The PHP 8.2+ dynamic-property deprecation fix shipped only on the CMB2 class (a leaf), leaving CMB2_Field, all CMB2_Type_* field types, and all CMB2_Display_* classes still emitting deprecations when user code/extensions assign undeclared properties (CMB2's most common customization idiom). None of these classes define __set, so the deprecation fires. Not a regression (2.11.0 had zero coverage) but incomplete. Fix: place #[AllowDynamicProperties] on the extension-surface roots (CMB2_Base covers CMB2 + CMB2_Field via inheritance; CMB2_Type_Base; CMB2_Field_Display) and remove the now-redundant leaf attribute on CMB2. Parsed as a harmless # comment on PHP 7.4-7.x.","status":"closed","priority":1,"issue_type":"task","owner":"justin@dsgnwrks.pro","created_at":"2026-05-30T18:02:19Z","created_by":"Justin Sternberg","updated_at":"2026-05-30T18:13:36Z","started_at":"2026-05-30T18:02:24Z","closed_at":"2026-05-30T18:13:36Z","close_reason":"Widened #[AllowDynamicProperties] to CMB2_Base, CMB2_Type_Base, CMB2_Field_Display; pushed in f372385","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"database": "dolt",
|
||||
"backend": "dolt",
|
||||
"dolt_mode": "server",
|
||||
"dolt_server_port": 3308,
|
||||
"dolt_database": "beads_cmb2",
|
||||
"project_id": "0ab5e157-ff0a-4c5d-8948-2d6166a6d85b"
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
[features]
|
||||
hooks = true
|
||||
@@ -0,0 +1,8 @@
|
||||
# Shell and CI environment variables override these local development values.
|
||||
WP_BASE_URL=http://localhost:2623
|
||||
WP_USERNAME=admin
|
||||
WP_PASSWORD=replace-with-local-password
|
||||
|
||||
# Use 1 only when WordPress is already running or its availability is known.
|
||||
SKIP_WP_SERVER=0
|
||||
SKIP_WP_CHECK=0
|
||||
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"immed": true,
|
||||
"latedef": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"sub": true,
|
||||
"unused": true,
|
||||
"undef": true,
|
||||
"boss": true,
|
||||
"eqnull": true,
|
||||
"globals": {
|
||||
"exports": true,
|
||||
"module": false
|
||||
},
|
||||
"predef": [
|
||||
"document",
|
||||
"window",
|
||||
"jQuery",
|
||||
"cmb2_l10",
|
||||
"wp",
|
||||
"tinyMCEPreInit",
|
||||
"tinyMCE",
|
||||
"console",
|
||||
"postboxes",
|
||||
"pagenow",
|
||||
"QTags",
|
||||
"quicktags",
|
||||
"_"
|
||||
]
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"port": 2623,
|
||||
"plugins": ["."],
|
||||
"testsEnvironment": false,
|
||||
"config": {
|
||||
"WP_DEBUG": true,
|
||||
"WP_DEBUG_DISPLAY": false,
|
||||
"SCRIPT_DEBUG": false
|
||||
},
|
||||
"mappings": {
|
||||
"wp-content/mu-plugins/cmb2-test-fields.php": "./tests/playwright/fixtures/test-fields.php"
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
# Agent Instructions
|
||||
|
||||
This project uses **bd** (beads) for issue tracking. Run `bd onboard` to get started.
|
||||
|
||||
## Quick Reference
|
||||
|
||||
```bash
|
||||
bd ready # Find available work
|
||||
bd show <id> # View issue details
|
||||
bd update <id> --claim # Claim work atomically
|
||||
bd close <id> # Complete work
|
||||
bd sync # Sync with git
|
||||
```
|
||||
|
||||
## Non-Interactive Shell Commands
|
||||
|
||||
**ALWAYS use non-interactive flags** with file operations to avoid hanging on confirmation prompts.
|
||||
|
||||
Shell commands like `cp`, `mv`, and `rm` may be aliased to include `-i` (interactive) mode on some systems, causing the agent to hang indefinitely waiting for y/n input.
|
||||
|
||||
**Use these forms instead:**
|
||||
```bash
|
||||
# Force overwrite without prompting
|
||||
cp -f source dest # NOT: cp source dest
|
||||
mv -f source dest # NOT: mv source dest
|
||||
rm -f file # NOT: rm file
|
||||
|
||||
# For recursive operations
|
||||
rm -rf directory # NOT: rm -r directory
|
||||
cp -rf source dest # NOT: cp -r source dest
|
||||
```
|
||||
|
||||
**Other commands that may prompt:**
|
||||
- `scp` - use `-o BatchMode=yes` for non-interactive
|
||||
- `ssh` - use `-o BatchMode=yes` to fail instead of prompting
|
||||
- `apt-get` - use `-y` flag
|
||||
- `brew` - use `HOMEBREW_NO_AUTO_UPDATE=1` env var
|
||||
|
||||
<!-- BEGIN BEADS INTEGRATION v:1 profile:minimal hash:970c3bf2 -->
|
||||
## Beads Issue Tracker
|
||||
|
||||
This project uses **bd (beads)** for issue tracking. Run `bd prime` to see full workflow context and commands.
|
||||
|
||||
### Quick Reference
|
||||
|
||||
```bash
|
||||
bd ready # Find available work
|
||||
bd show <id> # View issue details
|
||||
bd update <id> --claim # Claim work
|
||||
bd close <id> # Complete work
|
||||
```
|
||||
|
||||
### Rules
|
||||
|
||||
- Use `bd` for ALL task tracking — do NOT use TodoWrite, TaskCreate, or markdown TODO lists
|
||||
- Run `bd prime` for detailed command reference and session close protocol
|
||||
- Use `bd remember` for persistent knowledge — do NOT use MEMORY.md files
|
||||
|
||||
**Architecture in one line:** issues live in a local Dolt DB; sync uses `refs/dolt/data` on your git remote; `.beads/issues.jsonl` is a passive export. See https://github.com/gastownhall/beads/blob/main/docs/SYNC_CONCEPTS.md for details and anti-patterns.
|
||||
|
||||
## Agent Context Profiles
|
||||
|
||||
The managed Beads block is task-tracking guidance, not permission to override repository, user, or orchestrator instructions.
|
||||
|
||||
- **Conservative (default)**: Use `bd` for task tracking. Do not run git commits, git pushes, or Dolt remote sync unless explicitly asked. At handoff, report changed files, validation, and suggested next commands.
|
||||
- **Minimal**: Keep tool instruction files as pointers to `bd prime`; use the same conservative git policy unless active instructions say otherwise.
|
||||
- **Team-maintainer**: Only when the repository explicitly opts in, agents may close beads, run quality gates, commit, and push as part of session close. A current "do not commit" or "do not push" instruction still wins.
|
||||
|
||||
## Session Completion
|
||||
|
||||
This protocol applies when ending a Beads implementation workflow. It is subordinate to explicit user, repository, and orchestrator instructions.
|
||||
|
||||
1. **File issues for remaining work** - Create beads for anything that needs follow-up
|
||||
2. **Run quality gates** (if code changed) - Tests, linters, builds
|
||||
3. **Update issue status** - Close finished work, update in-progress items
|
||||
4. **Handle git/sync by active profile**:
|
||||
```bash
|
||||
# Conservative/minimal/default: report status and proposed commands; wait for approval.
|
||||
git status
|
||||
|
||||
# Team-maintainer opt-in only, unless current instructions forbid it:
|
||||
git pull --rebase
|
||||
bd dolt push
|
||||
git push
|
||||
git status
|
||||
```
|
||||
5. **Hand off** - Summarize changes, validation, issue status, and any blocked sync/commit/push step
|
||||
|
||||
**Critical rules:**
|
||||
- Explicit user or orchestrator instructions override this Beads block.
|
||||
- Do not commit or push without clear authority from the active profile or the current user request.
|
||||
- If a required sync or push is blocked, stop and report the exact command and error.
|
||||
<!-- END BEADS INTEGRATION -->
|
||||
|
||||
<!-- BEGIN BEADS CODEX SETUP: generated by bd setup codex -->
|
||||
## Beads Issue Tracker
|
||||
|
||||
Use Beads (`bd`) for durable task tracking in repositories that include it. Use the `beads` skill at `.agents/skills/beads/SKILL.md` (project install) or `~/.agents/skills/beads/SKILL.md` (global install) for Beads workflow guidance, then use the `bd` CLI for issue operations.
|
||||
|
||||
### Quick Reference
|
||||
|
||||
```bash
|
||||
bd ready # Find available work
|
||||
bd show <id> # View issue details
|
||||
bd update <id> --claim # Claim work
|
||||
bd close <id> # Complete work
|
||||
bd prime # Refresh Beads context
|
||||
```
|
||||
|
||||
### Rules
|
||||
|
||||
- Use `bd` for all task tracking; do not create markdown TODO lists.
|
||||
- Run `bd prime` when Beads context is missing or stale. Codex 0.129.0+ can load Beads context automatically through native hooks; use `/hooks` to inspect or toggle them.
|
||||
- Keep persistent project memory in Beads via `bd remember`; do not create ad hoc memory files.
|
||||
|
||||
**Architecture in one line:** issues live in a local Dolt DB; sync uses `refs/dolt/data` on your git remote; `.beads/issues.jsonl` is a passive export. See https://github.com/gastownhall/beads/blob/main/docs/SYNC_CONCEPTS.md for details and anti-patterns.
|
||||
<!-- END BEADS CODEX SETUP -->
|
||||
@@ -0,0 +1,167 @@
|
||||
# CMB2 Conventions & Blast-Radius Notes
|
||||
|
||||
CMB2 is an opinionated, 10+-year-old library bundled inside hundreds of themes
|
||||
and plugins. This file is the compounding knowledge base of its conventions,
|
||||
architectural seams, and back-compat blast radii — written for both human
|
||||
contributors and AI agents.
|
||||
|
||||
**Reading rule:** consult this file before changing anything under `includes/`,
|
||||
`bootstrap.php`, or `init.php`.
|
||||
|
||||
**Capture rule:** when a code review catches a convention violation or a
|
||||
back-compat near-miss, the fix must land alongside a new or updated entry here,
|
||||
on the same branch. Each entry cites the canonical in-code example — the code
|
||||
is the spec; this file is the index to it.
|
||||
|
||||
**Delegation rule (AI agents):** subagents don't inherit this context. Work
|
||||
orders delegating changes must quote the relevant entries verbatim.
|
||||
|
||||
---
|
||||
|
||||
## C1 — Per-box features hook up via `cmb2_init_hookup_{$cmb_id}`
|
||||
|
||||
**Rule:** A feature that attaches to boxes (hookup, REST, notices, anything
|
||||
box-aware) registers a `maybe_init_and_hookup( CMB2 $cmb )` static on the
|
||||
box-specific `cmb2_init_hookup_{$cmb_id}` action, added in the `CMB2`
|
||||
constructor. The feature class *self-guards*: it receives every box and decides
|
||||
for itself whether it applies (e.g. `CMB2_REST` checks `show_in_rest`).
|
||||
|
||||
**Canonical example:** `includes/CMB2.php` constructor (the
|
||||
`CMB2_Hookup`/`CMB2_REST` `add_action` pair); fired from `bootstrap.php`'s
|
||||
`cmb2_init_hookup_{$cmb->cmb_id}` loop; contract in
|
||||
`CMB2_Hookup_Base::maybe_init_and_hookup()`.
|
||||
|
||||
**Anti-pattern:** registering a global hook elsewhere and scanning
|
||||
`CMB2_Boxes::get_all()` to find relevant boxes. Two sources of truth for
|
||||
"which boxes does this apply to", misses late-registered boxes, and bypasses
|
||||
the per-box action seam developers use to unhook features from a single box.
|
||||
|
||||
**Blast radius:** extenders unhook/re-order `cmb2_init_hookup_*` callbacks per
|
||||
box; a feature wired outside that seam won't respect their customizations.
|
||||
|
||||
## C2 — `bootstrap.php` is generic lifecycle only
|
||||
|
||||
**Rule:** `bootstrap.php` contains only the init ceremony: `do_action` /
|
||||
`apply_filters` lifecycle events and the box-instantiation loops. No
|
||||
feature-specific class references, ever. Feature wiring belongs in the `CMB2`
|
||||
constructor (per-box features, see C1) or in the feature's own file.
|
||||
|
||||
**Canonical example:** `bootstrap.php` — note it ends "End. That's it, folks!"
|
||||
and has barely changed since 2.2.0.
|
||||
|
||||
## C3 — The self-electing loader makes every behavior change site-wide
|
||||
|
||||
**Rule:** `init.php` version-elects: when multiple copies of CMB2 are bundled
|
||||
(themes + plugins commonly each ship one), the *newest* copy wins and serves
|
||||
ALL registered boxes on the site. Any default-behavior change therefore
|
||||
propagates to every bundling product the moment one of them updates.
|
||||
|
||||
**Consequence:** behavior flips ship staged — opt-in first (default-off filter
|
||||
+ notice + docs), default-on only in a later release. Never flip a default in
|
||||
the same release that introduces the switch.
|
||||
|
||||
**Canonical example:** `init.php` (the `CMB2_Bootstrap_*` priority dance);
|
||||
staged-rollout example: the `cmb2_rest_enforce_options_page_read_permissions`
|
||||
filter (default false).
|
||||
|
||||
## C4 — REST reads are public by design; permission filters are the escape hatch
|
||||
|
||||
**Rule:** Boxes with `show_in_rest` readable expose reads publicly — this
|
||||
mirrors WP core's `show_in_rest` semantics for object meta and is intentional,
|
||||
not an oversight. Per-request overrides go through the existing
|
||||
`cmb2_api_get_box_permissions_check` / `cmb2_api_get_field_permissions_check`
|
||||
filters, which always run last and have final say. New permission logic must
|
||||
run *before* them and must not remove them.
|
||||
|
||||
**Canonical example:** `CMB2_REST_Controller_Boxes::get_item_permissions_check_filter()`;
|
||||
pinned by tests in `tests/test-cmb-rest-controllers.php`.
|
||||
|
||||
**Blast radius:** headless/decoupled front-ends read box data anonymously for
|
||||
public display. Tightening reads by default breaks them — hence the staged
|
||||
approach in C3, scoped only to options-page boxes (matching core's
|
||||
settings-vs-meta distinction).
|
||||
|
||||
## C5 — The `capability` box prop means "who sees the admin screen"
|
||||
|
||||
**Rule:** `capability` (default `manage_options` for options pages) governs the
|
||||
admin page. Reusing it for other gates (REST, front-end) conflates concerns —
|
||||
acceptable only where the semantic genuinely matches (e.g. options-page REST
|
||||
reads mirror the settings screen), and even then behind its own switch.
|
||||
|
||||
**Canonical example:** `includes/CMB2.php` `$mb_defaults['capability']` usage in
|
||||
`CMB2_Options_Hookup`.
|
||||
|
||||
**Where the semantic does match:** an options-page target's *object id is the
|
||||
option name* the data lands in, so "may write this option" and "may use this
|
||||
settings screen" are the same question — see
|
||||
`CMB2_Ajax::can_cache_for_options_page()`. Note the shape: the box that
|
||||
declared the option key is also the only place a capability for it exists, so
|
||||
looking the box up both supplies the check and bounds the accepted option keys
|
||||
to ones a box declared. An id no box claims has no capability to consult, and
|
||||
is therefore not a target.
|
||||
|
||||
## C6 — Autoloader paths are case-sensitive by prefix
|
||||
|
||||
**Rule:** `cmb2_autoload_classes()` maps `CMB2_REST`/`CMB2_REST_*` (exact case)
|
||||
to `includes/rest-api/`, `CMB2_Type*` to `includes/types/`, everything else to
|
||||
`includes/`. A class named `CMB2_Rest_Foo` (lowercase "est") deliberately lands
|
||||
in `includes/` — name classes with full awareness of which directory the prefix
|
||||
routes to, and match filename to class name exactly.
|
||||
|
||||
**Canonical example:** `includes/helper-functions.php` `cmb2_autoload_classes()`.
|
||||
|
||||
## C7 — PHP floor is 7.4; local tests don't prove it
|
||||
|
||||
**Rule:** All code must run on PHP 7.4. Local `npm run phptests` runs PHP 8.3
|
||||
only; the 7.4 floor is guarded exclusively by the CI matrix (`phpunit.yml`).
|
||||
"Passes locally" is necessary, never sufficient. (Tooling details: CLAUDE.md
|
||||
"Testing Strategy".)
|
||||
|
||||
## C8 — Configuration over code: box props are the primary interface
|
||||
|
||||
**Rule:** A new per-box behavior must be reachable as a **box registration
|
||||
property**. The registration array is the interface CMB2 developers actually
|
||||
use — and the one a bundling theme/plugin can ship per box — so it is the
|
||||
primary layer; filters are the secondary, site-wide layer for cross-cutting
|
||||
policy. When a behavior has both, the box prop wins outright and the filter
|
||||
governs only the boxes that left the prop unset. That way a box declares its
|
||||
intent once, in the array where it was registered, and keeps it across a later
|
||||
default flip (C3).
|
||||
|
||||
**Canonical examples:** `includes/CMB2.php` `$mb_defaults` — `show_in_rest`,
|
||||
`capability`, and `rest_read_capability`. The last one is the shape to copy,
|
||||
reading exactly as plain English: `false` = "no" (REST reads disabled for
|
||||
everyone, via core's `do_not_allow`); `true` = "yes, everyone" (alias of
|
||||
`'exist'`, the capability WP grants every visitor); `'box-capability'` = the
|
||||
box's own `capability` prop (the only non-duplicating spelling — naming the cap
|
||||
copies a value that lives elsewhere and can drift); any other capability string
|
||||
= only its holders; unset = the default policy (and the staged flip, C3). It
|
||||
cascades field → box → default like `show_in_rest`. Precedence is resolved in one
|
||||
place, `CMB2_REST::get_rest_read_capability()`, and consumed by
|
||||
`CMB2_REST_Controller::maybe_gate_read_by_capability()`.
|
||||
|
||||
**Value semantics — a prop value must read correctly in plain English.** A
|
||||
config value is documentation; if its plain-English reading is ambiguous or
|
||||
contradicts its behavior, it's the wrong value. `rest_read_capability` went
|
||||
through this exact wringer: `false` originally meant "reads are public (no
|
||||
capability required)" — but it *reads* as "REST read capability? no", i.e.
|
||||
reads disabled. The fix wasn't banning the boolean; it was making the meaning
|
||||
match the reading (`false` now disables reads; `true` now means everyone).
|
||||
Corollaries: booleans are fine only when yes/no is the honest answer to the
|
||||
prop's name read as a question; when the answer is a *which* (which
|
||||
capability?), every value is a real answer; and prefer WP-canonical vocabulary
|
||||
over invented sentinels — `'exist'` (granted to everyone) and `do_not_allow`
|
||||
(denied to everyone) bound the range, so neither "public" nor "disabled" needs
|
||||
special-casing.
|
||||
|
||||
**Anti-pattern:** shipping a filter-only interface for per-box behavior. It
|
||||
forces every developer to write a callback that re-derives "which box is this?"
|
||||
from the filter args, cannot be expressed in the registration array a theme or
|
||||
plugin already ships, and leaves no way to declare per-box intent — the filter
|
||||
answers site-wide, so a site with a single box needing the old behavior has to
|
||||
special-case every box by hand.
|
||||
|
||||
**Blast radius:** props are public API forever — name them for the behavior,
|
||||
not the implementation. Adding one to `$mb_defaults` also changes the array
|
||||
pinned by `Test_CMB2_Core::test_defaults_set()`; update that fixture in the same
|
||||
commit.
|
||||
@@ -0,0 +1,26 @@
|
||||
# Security Policy
|
||||
|
||||
## Reporting a vulnerability
|
||||
|
||||
**Please report security issues privately — not in a public issue.**
|
||||
|
||||
Use GitHub's [private vulnerability reporting](https://github.com/CMB2/CMB2/security/advisories/new). It goes directly to the maintainers, and nothing is public until an advisory is published.
|
||||
|
||||
Please include:
|
||||
|
||||
1. The CMB2 and WordPress versions you tested.
|
||||
2. Steps to reproduce, plus the metabox/field registration code needed to trigger it (a [gist](https://gist.github.com/) is fine).
|
||||
3. The impact: what an attacker can do, and what role or capability they need to do it.
|
||||
4. Whether the issue still reproduces on the [`develop`](https://github.com/CMB2/CMB2/tree/develop) branch.
|
||||
|
||||
## Supported versions
|
||||
|
||||
CMB2 maintains a single line — the latest release. Security fixes land in the next patch release; there are no backports to older versions. Note that CMB2 is often bundled inside a theme or plugin rather than installed from wordpress.org, so "upgrade" may mean updating that bundled copy.
|
||||
|
||||
## What to expect
|
||||
|
||||
* Acknowledgement within 7 days.
|
||||
* An assessment — accepted, needs more information, or not a vulnerability — within 14 days.
|
||||
* A fix in the next patch release, with a GitHub Security Advisory crediting you unless you ask otherwise.
|
||||
|
||||
Please give us a reasonable window to ship a fix before disclosing publicly. If you have had no response after 14 days, open a public issue to nudge the thread — without any vulnerability details.
|
||||
@@ -1,50 +0,0 @@
|
||||
{
|
||||
"name": "cmb2/cmb2",
|
||||
"description": "CMB2 is a metabox, custom fields, and forms library for WordPress that will blow your mind.",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Justin Sternberg",
|
||||
"email": "justin@dsgnwrks.pro",
|
||||
"homepage": "https://dsgnwrks.pro",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "WebDevStudios",
|
||||
"email": "contact@webdevstudios.com",
|
||||
"homepage": "https://github.com/WebDevStudios",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"keywords": ["wordpress", "plugin", "metabox"],
|
||||
"homepage": "https://github.com/CMB2/CMB2",
|
||||
"type": "wordpress-plugin",
|
||||
"support": {
|
||||
"issues": "https://github.com/CMB2/CMB2/issues",
|
||||
"source": "http://wordpress.org/support/plugin/cmb2"
|
||||
},
|
||||
"require": {
|
||||
"php": ">7.4"
|
||||
},
|
||||
"suggest": {
|
||||
"composer/installers": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"yoast/phpunit-polyfills": "^1.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": [
|
||||
"vendor/bin/phpunit"
|
||||
],
|
||||
"phpcs:install": "@composer install --working-dir=tools/phpcs --no-interaction",
|
||||
"phpcs": "@php tools/phpcs/run.php phpcs",
|
||||
"phpcbf": "@php tools/phpcs/run.php phpcbf",
|
||||
"post-install-cmd": [
|
||||
"@php tools/phpcs/maybe-install.php"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php tools/phpcs/maybe-install.php"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* CMB2 - v2.12.0 - 2026-05-31
|
||||
* CMB2 - v2.13.0 - 2026-09-20
|
||||
* https://cmb2.io
|
||||
* Copyright (c) 2026
|
||||
* Licensed GPLv2+
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*! CMB2 - v2.12.0 - 2026-05-31 | https://cmb2.io | Copyright (c) 2026 CMB2 team | Licensed GPLv2 */
|
||||
/*! CMB2 - v2.13.0 - 2026-09-20 | https://cmb2.io | Copyright (c) 2026 CMB2 team | Licensed GPLv2 */
|
||||
/*!
|
||||
* CMB2 - v2.12.0 - 2026-05-31
|
||||
* CMB2 - v2.13.0 - 2026-09-20
|
||||
* https://cmb2.io
|
||||
* Copyright (c) 2026
|
||||
* Licensed GPLv2+
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* CMB2 - v2.12.0 - 2026-05-31
|
||||
* CMB2 - v2.13.0 - 2026-09-20
|
||||
* https://cmb2.io
|
||||
* Copyright (c) 2026
|
||||
* Licensed GPLv2+
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*! CMB2 - v2.12.0 - 2026-05-31 | https://cmb2.io | Copyright (c) 2026 CMB2 team | Licensed GPLv2 */
|
||||
/*! CMB2 - v2.13.0 - 2026-09-20 | https://cmb2.io | Copyright (c) 2026 CMB2 team | Licensed GPLv2 */
|
||||
/*!
|
||||
* CMB2 - v2.12.0 - 2026-05-31
|
||||
* CMB2 - v2.13.0 - 2026-09-20
|
||||
* https://cmb2.io
|
||||
* Copyright (c) 2026
|
||||
* Licensed GPLv2+
|
||||
|
||||
@@ -101,6 +101,29 @@ class CMB2 extends CMB2_Base {
|
||||
'new_user_section' => 'add-new-user', // or 'add-existing-user'.
|
||||
'new_term_section' => true,
|
||||
'show_in_rest' => false,
|
||||
|
||||
/*
|
||||
* Declares who may read this box via the REST API (only applicable when
|
||||
* 'show_in_rest' is readable). Accepts:
|
||||
*
|
||||
* - false No one may read it, administrators included.
|
||||
* - true Everyone may read it, logged-out visitors included.
|
||||
* - 'box-capability' Only holders of this box's 'capability' may read it
|
||||
* (falling back to 'manage_options').
|
||||
* - 'a_capability' Only holders of the named capability may read it,
|
||||
* e.g. 'edit_posts'.
|
||||
* - null (default) CMB2's current behavior: reads are public, unless
|
||||
* the box is an options page and the site-wide
|
||||
* `cmb2_rest_enforce_options_page_read_permissions` filter is
|
||||
* enabled.
|
||||
*
|
||||
* The same property may be set on an individual field, where it takes precedence
|
||||
* over the box's for reads of that field.
|
||||
*
|
||||
* The `cmb2_api_get_box_permissions_check`/`cmb2_api_get_field_permissions_check`
|
||||
* filters still run afterward and have the final say.
|
||||
*/
|
||||
'rest_read_capability' => null,
|
||||
'classes' => null, // Optionally add classes to the CMB2 wrapper.
|
||||
'classes_cb' => '', // Optionally add classes to the CMB2 wrapper (via a callback).
|
||||
|
||||
@@ -250,6 +273,9 @@ class CMB2 extends CMB2_Base {
|
||||
|
||||
// Hook in the rest api functionality.
|
||||
add_action( "cmb2_init_hookup_{$this->cmb_id}", array( 'CMB2_REST', 'maybe_init_and_hookup' ) );
|
||||
|
||||
// Hook in the notice about the upcoming REST read-permissions alignment.
|
||||
add_action( "cmb2_init_hookup_{$this->cmb_id}", array( 'CMB2_Rest_Read_Permissions_Notice', 'maybe_init_and_hookup' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+103
-5
@@ -68,7 +68,7 @@ class CMB2_Ajax {
|
||||
}
|
||||
|
||||
// Sanitize our search string.
|
||||
$oembed_string = sanitize_text_field( $_REQUEST['oembed_url'] );
|
||||
$oembed_string = sanitize_text_field( wp_unslash( $_REQUEST['oembed_url'] ) );
|
||||
|
||||
// Send back error if empty.
|
||||
if ( empty( $oembed_string ) ) {
|
||||
@@ -86,20 +86,118 @@ class CMB2_Ajax {
|
||||
'width' => $embed_width,
|
||||
);
|
||||
|
||||
$object_id = isset( $_REQUEST['object_id'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['object_id'] ) ) : '';
|
||||
$object_type = isset( $_REQUEST['object_type'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['object_type'] ) ) : 'post';
|
||||
|
||||
/*
|
||||
* The lookup result gets cached against the requested object, so only accept a
|
||||
* target the caller already has rights over -- matching what CMB2's other write
|
||||
* paths require (see CMB2_Hookup::save_post()/save_term()/taxonomy_can_save()).
|
||||
* An empty object_id caches nothing against an object, so it needs no rights.
|
||||
*/
|
||||
if ( '' !== $object_id && ! $this->can_cache_for_object( $object_type, $object_id ) ) {
|
||||
wp_send_json_error( '<p class="ui-state-error-text">' . esc_html__( 'Please Try Again', 'cmb2' ) . '</p>' );
|
||||
}
|
||||
|
||||
$this->ajax_update = true;
|
||||
|
||||
// Get embed code (or fallback link).
|
||||
$html = $this->get_oembed( array(
|
||||
'url' => $oembed_url,
|
||||
'object_id' => $_REQUEST['object_id'],
|
||||
'object_type' => isset( $_REQUEST['object_type'] ) ? $_REQUEST['object_type'] : 'post',
|
||||
'object_id' => $object_id,
|
||||
'object_type' => $object_type,
|
||||
'oembed_args' => $embed_args,
|
||||
'field_id' => $_REQUEST['field_id'],
|
||||
'field_id' => isset( $_REQUEST['field_id'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['field_id'] ) ) : '',
|
||||
) );
|
||||
|
||||
wp_send_json_success( $html );
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the current user may have an oEmbed result cached against the requested object.
|
||||
*
|
||||
* Both the object type and the object id arrive in the request, and together they
|
||||
* decide where the result is written -- the object's metadata, or, for an
|
||||
* options-page target, the option whose name IS the object id. An object type
|
||||
* outside CMB2's core set names no store to check rights against.
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @param string $object_type Object type the result would be cached against.
|
||||
* @param string|int $object_id Object id (an option key for an options-page target).
|
||||
* @return bool Whether the caller may write to that target.
|
||||
*/
|
||||
protected function can_cache_for_object( $object_type, $object_id ) {
|
||||
switch ( $object_type ) {
|
||||
case 'post':
|
||||
return current_user_can( 'edit_post', $object_id );
|
||||
|
||||
case 'user':
|
||||
return current_user_can( 'edit_user', $object_id );
|
||||
|
||||
case 'comment':
|
||||
return current_user_can( 'edit_comment', $object_id );
|
||||
|
||||
case 'term':
|
||||
return $this->can_cache_for_term( $object_id );
|
||||
|
||||
case 'options-page':
|
||||
return $this->can_cache_for_options_page( $object_id );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the current user may have a result cached against a term.
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @param string|int $term_id Term id.
|
||||
* @return bool Whether the caller may write to the term's meta.
|
||||
*/
|
||||
protected function can_cache_for_term( $term_id ) {
|
||||
$term = get_term( absint( $term_id ) );
|
||||
|
||||
if ( ! $term || is_wp_error( $term ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$taxonomy = get_taxonomy( $term->taxonomy );
|
||||
|
||||
// The same check CMB2_Hookup::taxonomy_can_save() makes before writing term meta.
|
||||
return isset( $taxonomy->cap->edit_terms ) && current_user_can( $taxonomy->cap->edit_terms );
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the current user may have a result cached into an options-page option.
|
||||
*
|
||||
* The result is stored in the option value itself, so the gate is the registered
|
||||
* box's 'capability' prop -- the value that already governs that options page.
|
||||
* An option key no registered box declared has no such value to consult, and so
|
||||
* is not an accepted target.
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @param string $option_key Option key the result would be cached into.
|
||||
* @return bool Whether the caller may write to that option.
|
||||
*/
|
||||
protected function can_cache_for_options_page( $option_key ) {
|
||||
foreach ( CMB2_Boxes::get_all() as $cmb ) {
|
||||
$keys = (array) $cmb->options_page_keys();
|
||||
|
||||
if ( ! in_array( $option_key, $keys, true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( current_user_can( $cmb->prop( 'capability' ) ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves oEmbed from url/object ID
|
||||
*
|
||||
@@ -178,7 +276,7 @@ class CMB2_Ajax {
|
||||
|
||||
// Send back our embed.
|
||||
if ( $oembed['embed'] && $oembed['embed'] != $oembed['fallback'] ) {
|
||||
return '<div class="cmb2-oembed embed-status">' . $oembed['embed'] . '<p class="cmb2-remove-wrapper"><a href="#" class="cmb2-remove-file-button" rel="' . $oembed['args']['field_id'] . '">' . esc_html__( 'Remove Embed', 'cmb2' ) . '</a></p></div>';
|
||||
return '<div class="cmb2-oembed embed-status">' . $oembed['embed'] . '<p class="cmb2-remove-wrapper"><a href="#" class="cmb2-remove-file-button" rel="' . esc_attr( $oembed['args']['field_id'] ) . '">' . esc_html__( 'Remove Embed', 'cmb2' ) . '</a></p></div>';
|
||||
}
|
||||
|
||||
// Otherwise, send back error info that no oEmbeds were found.
|
||||
|
||||
+15
-7
@@ -347,16 +347,22 @@ abstract class CMB2_Base {
|
||||
/**
|
||||
* Checks if this object has parameter corresponding to the given filter
|
||||
* which is callable. If so, it registers the callback, and if not,
|
||||
* converts the maybe-modified $val to a boolean for return.
|
||||
* converts the declared parameter to a boolean for return.
|
||||
*
|
||||
* The registered handlers will have a parameter name which matches the filter, except:
|
||||
* - The 'cmb2_api' prefix will be removed
|
||||
* - A '_cb' suffix will be added (to stay inline with other '*_cb' parameters).
|
||||
*
|
||||
* Only a declared parameter is consulted. The caller's default is deliberately not
|
||||
* passed to prop() as a fallback: prop() stores a truthy fallback on the object, so
|
||||
* doing that would turn one request's default into a declared parameter for every
|
||||
* later call — see the `$val` note below.
|
||||
*
|
||||
* @since 2.2.3
|
||||
*
|
||||
* @param string $hook_name The hook name.
|
||||
* @param bool $val The default value.
|
||||
* @param bool $val The default value, returned as-is when the parameter
|
||||
* is not declared on this object.
|
||||
* @param string $hook_function The hook function. Default: 'add_filter'.
|
||||
*
|
||||
* @return null|bool Null if hook is registered, or bool for value.
|
||||
@@ -366,11 +372,13 @@ abstract class CMB2_Base {
|
||||
// Remove filter prefix, add param suffix.
|
||||
$parameter = substr( $hook_name, strlen( 'cmb2_api_' ) ) . '_cb';
|
||||
|
||||
return self::maybe_hook(
|
||||
$this->prop( $parameter, $val ),
|
||||
$hook_name,
|
||||
$hook_function
|
||||
);
|
||||
$declared = $this->prop( $parameter );
|
||||
|
||||
if ( null === $declared ) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return self::maybe_hook( $declared, $hook_name, $hook_function );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -200,7 +200,7 @@ class CMB2_Options_Hookup extends CMB2_Hookup {
|
||||
<h2><?php echo wp_kses_post( $this->cmb->prop( 'title' ) ); ?></h2>
|
||||
<?php endif; ?>
|
||||
<?php $this->options_page_tab_nav_output(); ?>
|
||||
<form class="cmb-form" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="POST" id="<?php echo $this->cmb->cmb_id; ?>" enctype="multipart/form-data" encoding="multipart/form-data">
|
||||
<form class="cmb-form" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="POST" id="<?php echo esc_attr( $this->cmb->cmb_id ); ?>" enctype="multipart/form-data" encoding="multipart/form-data">
|
||||
<input type="hidden" name="action" value="<?php echo esc_attr( $this->option_key ); ?>">
|
||||
<?php $this->options_page_metabox(); ?>
|
||||
<?php submit_button( esc_attr( $this->cmb->prop( 'save_button' ) ), 'primary', 'submit-cmb' ); ?>
|
||||
|
||||
Vendored
+235
@@ -0,0 +1,235 @@
|
||||
<?php
|
||||
/**
|
||||
* Admin notice announcing the upcoming alignment of CMB2's REST API read
|
||||
* permissions for settings data with WordPress core conventions.
|
||||
*
|
||||
* Shown only when the site actually registers a REST-readable options/settings
|
||||
* box and the alignment has not already been enabled, so sites that need no
|
||||
* action (or that already opted in) are not nagged.
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @category WordPress_Plugin
|
||||
* @package CMB2
|
||||
* @author CMB2 team
|
||||
* @license GPL-2.0+
|
||||
* @link https://cmb2.io
|
||||
*/
|
||||
class CMB2_Rest_Read_Permissions_Notice {
|
||||
|
||||
/**
|
||||
* Default URL for the explainer guide.
|
||||
*
|
||||
* @var string
|
||||
* @since 2.13.0
|
||||
*/
|
||||
const GUIDE_URL = 'https://cmb2.io/docs/REST-API-Read-Permissions';
|
||||
|
||||
/**
|
||||
* Option key used to persist notice dismissal.
|
||||
*
|
||||
* @var string
|
||||
* @since 2.13.0
|
||||
*/
|
||||
const DISMISSED_OPTION = 'cmb2_rest_read_permissions_notice_dismissed';
|
||||
|
||||
/**
|
||||
* Nonce/action name used for the dismissal AJAX request.
|
||||
*
|
||||
* @var string
|
||||
* @since 2.13.0
|
||||
*/
|
||||
const AJAX_ACTION = 'cmb2_dismiss_rest_read_permissions_notice';
|
||||
|
||||
/**
|
||||
* Affected (REST-readable options-page) boxes fed in via the per-box hookup,
|
||||
* keyed by cmb_id.
|
||||
*
|
||||
* @var CMB2[]
|
||||
* @since 2.13.0
|
||||
*/
|
||||
protected static $tracked_boxes = array();
|
||||
|
||||
/**
|
||||
* Per-box hookup, matching CMB2's `cmb2_init_hookup_{$cmb_id}` convention
|
||||
* (see CMB2_Hookup::maybe_init_and_hookup / CMB2_REST::maybe_init_and_hookup).
|
||||
*
|
||||
* Tracks each affected box so the notice can consult only the boxes actually
|
||||
* registered on this request, and registers the admin render + dismissal
|
||||
* handlers once, when the first affected box is seen.
|
||||
*
|
||||
* A box which declares a `rest_read_capability` has stated its intent and will
|
||||
* not be affected by a future default change, so it is not an affected box at
|
||||
* all — filtering it out here (rather than in should_show()) keeps "affected"
|
||||
* defined in one place and leaves should_show() to the single remaining
|
||||
* question: are any affected boxes still ungated?
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @param CMB2 $cmb The CMB2 object being hooked up.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function maybe_init_and_hookup( CMB2 $cmb ) {
|
||||
if ( ! is_admin() || ! CMB2_REST::is_options_page_box( $cmb ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( CMB2_REST::has_explicit_rest_read_capability( $cmb ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$first_box = empty( self::$tracked_boxes );
|
||||
|
||||
self::$tracked_boxes[ $cmb->cmb_id ] = $cmb;
|
||||
|
||||
if ( $first_box ) {
|
||||
add_action( 'admin_notices', array( __CLASS__, 'render' ) );
|
||||
add_action( 'wp_ajax_' . self::AJAX_ACTION, array( __CLASS__, 'ajax_dismiss' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets tracked-box state.
|
||||
*
|
||||
* @internal Intended for test isolation.
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function reset() {
|
||||
self::$tracked_boxes = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the notice has been dismissed.
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function is_dismissed() {
|
||||
return (bool) get_option( self::DISMISSED_OPTION, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Persists dismissal of the notice.
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function dismiss() {
|
||||
update_option( self::DISMISSED_OPTION, 1, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the notice is eligible to be shown.
|
||||
*
|
||||
* Eligible only when at least one tracked affected box (fed in via
|
||||
* maybe_init_and_hookup) still has ungated reads (the alignment filter is
|
||||
* returning its default false), and the notice has not already been dismissed.
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function should_show() {
|
||||
if ( self::is_dismissed() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ( self::$tracked_boxes as $cmb ) {
|
||||
// If any affected box is still ungated, the owner should be informed.
|
||||
if ( ! apply_filters( 'cmb2_rest_enforce_options_page_read_permissions', false, $cmb ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the admin notice, when eligible and the user can manage options.
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function render() {
|
||||
if ( ! current_user_can( 'manage_options' ) || ! self::should_show() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$guide_url = self::GUIDE_URL;
|
||||
$nonce = wp_create_nonce( self::AJAX_ACTION );
|
||||
?>
|
||||
<div class="notice notice-info is-dismissible cmb2-rest-read-permissions-notice" data-cmb2-notice-nonce="<?php echo esc_attr( $nonce ); ?>">
|
||||
<p>
|
||||
<strong><?php esc_html_e( 'CMB2: Upcoming change to REST API read permissions for settings data', 'cmb2' ); ?></strong>
|
||||
</p>
|
||||
<p>
|
||||
<?php esc_html_e( 'This site uses CMB2 (a custom-fields library that is usually bundled inside a theme or plugin) to register one or more settings pages that are readable through the WordPress REST API. To align with WordPress core conventions, a future CMB2 release will limit REST API reads of settings-page data to users who can manage those settings (administrators, typically). Most sites need no action, and nothing changes yet. If your site has a custom integration that reads these settings through the REST API, please share the guide below with your developer.', 'cmb2' ); ?>
|
||||
</p>
|
||||
<p>
|
||||
<a class="button button-secondary" href="<?php echo esc_url( $guide_url ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Read the guide', 'cmb2' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
<script>
|
||||
( function () {
|
||||
var notice = document.querySelector( '.cmb2-rest-read-permissions-notice' );
|
||||
if ( ! notice ) {
|
||||
return;
|
||||
}
|
||||
notice.addEventListener( 'click', function ( event ) {
|
||||
if ( ! event.target.classList.contains( 'notice-dismiss' ) ) {
|
||||
return;
|
||||
}
|
||||
var body = new URLSearchParams();
|
||||
body.append( 'action', '<?php echo esc_js( self::AJAX_ACTION ); ?>' );
|
||||
body.append( 'nonce', notice.getAttribute( 'data-cmb2-notice-nonce' ) );
|
||||
// keepalive lets the request finish if the user navigates right away;
|
||||
// a dismissal that fails to persist would otherwise be silent.
|
||||
window.fetch( window.ajaxurl, {
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
keepalive: true,
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
|
||||
body: body.toString()
|
||||
} ).then( function ( response ) {
|
||||
if ( ! response.ok ) {
|
||||
throw new Error( response.status );
|
||||
}
|
||||
return response.text();
|
||||
} ).catch( function ( err ) {
|
||||
if ( window.console ) {
|
||||
console.warn( 'CMB2: notice dismissal may not have persisted.', err );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
} )();
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX handler that persists dismissal of the notice.
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function ajax_dismiss() {
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
wp_send_json_error( '', 403 );
|
||||
}
|
||||
|
||||
check_ajax_referer( self::AJAX_ACTION, 'nonce' );
|
||||
|
||||
self::dismiss();
|
||||
|
||||
wp_send_json_success();
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -335,13 +335,13 @@ class CMB2_Types {
|
||||
$this->_desc( true, true, true );
|
||||
?>
|
||||
|
||||
<div id="<?php echo $table_id; ?>" class="cmb-repeat-table cmb-nested">
|
||||
<div id="<?php echo esc_attr( $table_id ); ?>" class="cmb-repeat-table cmb-nested">
|
||||
<div class="cmb-tbody cmb-field-list">
|
||||
<?php $this->repeatable_rows(); ?>
|
||||
</div>
|
||||
</div>
|
||||
<p class="cmb-add-row">
|
||||
<button type="button" data-selector="<?php echo $table_id; ?>" class="cmb-add-row-button button-secondary"><?php echo esc_html( $this->_text( 'add_row_text', esc_html__( 'Add Row', 'cmb2' ) ) ); ?></button>
|
||||
<button type="button" data-selector="<?php echo esc_attr( $table_id ); ?>" class="cmb-add-row-button button-secondary"><?php echo esc_html( $this->_text( 'add_row_text', esc_html__( 'Add Row', 'cmb2' ) ) ); ?></button>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
|
||||
+165
@@ -807,6 +807,171 @@ class CMB2_REST extends CMB2_Hookup_Base {
|
||||
return self::$boxes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a box is a REST-readable options-page box.
|
||||
*
|
||||
* WordPress core exposes object meta reads publicly, but gates settings/options
|
||||
* reads behind a capability (see WP_REST_Settings_Controller). This helper
|
||||
* identifies the CMB2 boxes that map to that options/settings category so their
|
||||
* REST reads can be aligned with the same core convention.
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @param CMB2 $cmb The CMB2 box object to check.
|
||||
*
|
||||
* @return bool Whether the box is an options-page box exposed for REST reads.
|
||||
*/
|
||||
public static function is_options_page_box( CMB2 $cmb ) {
|
||||
return $cmb->is_options_page_mb() && self::is_readable( $cmb->prop( 'show_in_rest' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a box explicitly declares how its REST reads are permissioned.
|
||||
*
|
||||
* A box which sets the `rest_read_capability` property to a recognized value
|
||||
* (`false`, `true`, or a capability string) has declared its intent, so CMB2 should
|
||||
* neither second-guess it via the site-wide alignment filter nor nag about it.
|
||||
*
|
||||
* Only the box property is consulted: a field-level declaration speaks for that
|
||||
* field, not for the box.
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @param CMB2 $cmb The CMB2 box object to check.
|
||||
*
|
||||
* @return bool Whether the box declares an explicit read permission.
|
||||
*/
|
||||
public static function has_explicit_rest_read_capability( CMB2 $cmb ) {
|
||||
return null !== self::declared_read_capability( $cmb->prop( 'rest_read_capability' ), $cmb );
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a `rest_read_capability` declaration into the capability it requires.
|
||||
*
|
||||
* Recognized values, all of which resolve to a capability string so the caller has
|
||||
* a single kind of answer to act on:
|
||||
*
|
||||
* - false Reads are not permitted, for anyone. Maps to WordPress's
|
||||
* `do_not_allow` pseudo-capability, which WP_User::has_cap()
|
||||
* denies unconditionally — administrators included.
|
||||
* - true Reads are permitted for everyone. Maps to WordPress's `exist`
|
||||
* pseudo-capability, which WP_User::has_cap() grants
|
||||
* unconditionally to every visitor, logged out included
|
||||
* ("Everyone is allowed to exist").
|
||||
* - 'box-capability' Reads require the box's own `capability` property (falling
|
||||
* back to `manage_options`). This is a reserved value, not a
|
||||
* real WordPress capability: it is the only spelling of "gate by
|
||||
* this box's capability" which does not duplicate a value that
|
||||
* lives elsewhere and can drift out of sync. On a field, it
|
||||
* means "gate this field by whatever the box's capability is".
|
||||
* - string Reads require the named capability, e.g. `edit_posts`. Since
|
||||
* the two booleans are spelled as capabilities, `'exist'` and
|
||||
* `'do_not_allow'` work as literal strings too, with the same
|
||||
* meanings.
|
||||
*
|
||||
* Anything else (null, an empty string, other types) is not a declaration.
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @param mixed $declared The declared value.
|
||||
* @param CMB2 $cmb The CMB2 box object the declaration was made on or within.
|
||||
*
|
||||
* @return string|null The capability to require, or null if the value is not a
|
||||
* declaration.
|
||||
*/
|
||||
protected static function declared_read_capability( $declared, CMB2 $cmb ) {
|
||||
if ( is_bool( $declared ) ) {
|
||||
return $declared ? 'exist' : 'do_not_allow';
|
||||
}
|
||||
|
||||
if ( 'box-capability' === $declared ) {
|
||||
return self::get_box_capability( $cmb );
|
||||
}
|
||||
|
||||
if ( is_string( $declared ) && '' !== trim( $declared ) ) {
|
||||
return $declared;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the capability which gates REST reads of the given box or field, if any.
|
||||
*
|
||||
* The `rest_read_capability` property is the primary interface, and takes
|
||||
* precedence over the site-wide filter entirely. It is resolved in the same
|
||||
* cascading order as `show_in_rest` (see declare_read_edit_fields()): the field's
|
||||
* own declaration wins, else the box's, else the default policy.
|
||||
*
|
||||
* See declared_read_capability() for the recognized values. With no declaration at
|
||||
* either level, CMB2's historical behavior applies: reads are public, except that
|
||||
* options-page box reads are gated by the box `capability` when the
|
||||
* `cmb2_rest_enforce_options_page_read_permissions` filter is enabled.
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @param CMB2 $cmb The CMB2 box object being read.
|
||||
* @param CMB2_Field|array|null $field The field being read, when the read is of a
|
||||
* single field rather than the box itself.
|
||||
*
|
||||
* @return string|null The capability to require, or null when reads are not gated.
|
||||
*/
|
||||
public static function get_rest_read_capability( CMB2 $cmb, $field = null ) {
|
||||
$field_args = $field instanceof CMB2_Field ? $field->args() : $field;
|
||||
|
||||
if ( is_array( $field_args ) && isset( $field_args['rest_read_capability'] ) ) {
|
||||
$capability = self::declared_read_capability( $field_args['rest_read_capability'], $cmb );
|
||||
|
||||
if ( null !== $capability ) {
|
||||
return $capability;
|
||||
}
|
||||
}
|
||||
|
||||
$capability = self::declared_read_capability( $cmb->prop( 'rest_read_capability' ), $cmb );
|
||||
|
||||
if ( null !== $capability ) {
|
||||
return $capability;
|
||||
}
|
||||
|
||||
// Declared at neither level: only options-page boxes, and only when opted in site-wide.
|
||||
if ( ! self::is_options_page_box( $cmb ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to align options-page box REST reads with WordPress core's
|
||||
* settings/options convention (reads gated behind a capability).
|
||||
*
|
||||
* Defaults to false, preserving CMB2's historical public-read behavior. Only
|
||||
* consulted for boxes which have not declared a `rest_read_capability`.
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @param bool $enforce Whether to gate options-page reads behind a capability.
|
||||
* @param CMB2 $cmb The CMB2 box object being read.
|
||||
*/
|
||||
if ( ! apply_filters( 'cmb2_rest_enforce_options_page_read_permissions', false, $cmb ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return self::get_box_capability( $cmb );
|
||||
}
|
||||
|
||||
/**
|
||||
* The box's `capability` property, falling back to `manage_options`.
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @param CMB2 $cmb The CMB2 box object.
|
||||
*
|
||||
* @return string The capability.
|
||||
*/
|
||||
protected static function get_box_capability( CMB2 $cmb ) {
|
||||
$capability = $cmb->prop( 'capability' );
|
||||
|
||||
return empty( $capability ) ? 'manage_options' : $capability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if given value is readable.
|
||||
*
|
||||
|
||||
Vendored
+37
@@ -141,6 +141,43 @@ abstract class CMB2_REST_Controller extends WP_REST_Controller {
|
||||
return $default_access;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optionally gates a read behind a capability, aligning with WordPress core.
|
||||
*
|
||||
* WordPress core exposes object meta reads publicly, but gates settings/options
|
||||
* reads behind a capability (WP_REST_Settings_Controller). CMB2's
|
||||
* `rest_read_capability` property is how a box (or a single field on it) declares
|
||||
* which side of that line it sits on; see CMB2_REST::get_rest_read_capability() for
|
||||
* the full precedence. With the property left unset, CMB2 keeps its historical
|
||||
* public-read behavior unless the box is an options page and the site-wide
|
||||
* `cmb2_rest_enforce_options_page_read_permissions` filter is enabled.
|
||||
*
|
||||
* @since 2.13.0
|
||||
*
|
||||
* @param bool $can_access The default access for this read request.
|
||||
* @param CMB2_Field|array|null $field The field being read, when the read is of
|
||||
* a single field rather than the box.
|
||||
*
|
||||
* @return bool The possibly-adjusted access value.
|
||||
*/
|
||||
protected function maybe_gate_read_by_capability( $can_access, $field = null ) {
|
||||
if ( ! $this->rest_box && $this->request->get_param( 'cmb_id' ) ) {
|
||||
$this->rest_box = CMB2_REST::get_rest_box( $this->request->get_param( 'cmb_id' ) );
|
||||
}
|
||||
|
||||
if ( ! $this->rest_box || is_wp_error( $this->rest_box ) ) {
|
||||
return $can_access;
|
||||
}
|
||||
|
||||
$capability = CMB2_REST::get_rest_read_capability( $this->rest_box->cmb, $field );
|
||||
|
||||
if ( null === $capability ) {
|
||||
return $can_access;
|
||||
}
|
||||
|
||||
return current_user_can( $capability );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the CMB2 box has any registered callback parameters for the given filter.
|
||||
*
|
||||
|
||||
+3
@@ -169,6 +169,9 @@ class CMB2_REST_Controller_Boxes extends CMB2_REST_Controller {
|
||||
* @return WP_Error|boolean
|
||||
*/
|
||||
public function get_item_permissions_check_filter( $can_access = true ) {
|
||||
// Optionally gate the read behind a capability, per the box's declaration.
|
||||
$can_access = $this->maybe_gate_read_by_capability( $can_access );
|
||||
|
||||
/**
|
||||
* By default, no special permissions needed.
|
||||
*
|
||||
|
||||
+11
@@ -164,6 +164,17 @@ class CMB2_REST_Controller_Fields extends CMB2_REST_Controller_Boxes {
|
||||
* @return WP_Error|boolean
|
||||
*/
|
||||
public function get_item_permissions_check_filter( $can_access = true ) {
|
||||
/*
|
||||
* Optionally gate the read behind a capability, per the field's declaration,
|
||||
* falling back to the box's. Passing the field is what makes this per-field:
|
||||
* the fields collection sets $this->field before each call, so a field the
|
||||
* current user cannot read is left out of the collection.
|
||||
*/
|
||||
$can_access = $this->maybe_gate_read_by_capability(
|
||||
$can_access,
|
||||
$this->field instanceof CMB2_Field ? $this->field : null
|
||||
);
|
||||
|
||||
/**
|
||||
* By default, no special permissions needed.
|
||||
*
|
||||
|
||||
+10
-10
@@ -20,7 +20,7 @@
|
||||
* Bill Erickson (@billerickson / billerickson.net)
|
||||
* Andrew Norcross (@norcross / andrewnorcross.com)
|
||||
*
|
||||
* Version: 2.12.0
|
||||
* Version: 2.13.0
|
||||
*
|
||||
* Text Domain: cmb2
|
||||
* Domain Path: languages
|
||||
@@ -53,7 +53,7 @@
|
||||
* ***********************************************************************
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'CMB2_Bootstrap_2120', false ) ) {
|
||||
if ( ! class_exists( 'CMB2_Bootstrap_2130', false ) ) {
|
||||
|
||||
/**
|
||||
* Handles checking for and loading the newest version of CMB2
|
||||
@@ -66,7 +66,7 @@ if ( ! class_exists( 'CMB2_Bootstrap_2120', false ) ) {
|
||||
* @license GPL-2.0+
|
||||
* @link https://cmb2.io
|
||||
*/
|
||||
class CMB2_Bootstrap_2120 {
|
||||
class CMB2_Bootstrap_2130 {
|
||||
|
||||
/**
|
||||
* Current version number
|
||||
@@ -74,7 +74,7 @@ if ( ! class_exists( 'CMB2_Bootstrap_2120', false ) ) {
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
const VERSION = '2.12.0';
|
||||
const VERSION = '2.13.0';
|
||||
|
||||
/**
|
||||
* Current version hook priority.
|
||||
@@ -83,20 +83,20 @@ if ( ! class_exists( 'CMB2_Bootstrap_2120', false ) ) {
|
||||
* @var int
|
||||
* @since 2.0.0
|
||||
*/
|
||||
const PRIORITY = 9956;
|
||||
const PRIORITY = 9955;
|
||||
|
||||
/**
|
||||
* Single instance of the CMB2_Bootstrap_2120 object
|
||||
* Single instance of the CMB2_Bootstrap_2130 object
|
||||
*
|
||||
* @var CMB2_Bootstrap_2120
|
||||
* @var CMB2_Bootstrap_2130
|
||||
*/
|
||||
public static $single_instance = null;
|
||||
|
||||
/**
|
||||
* Creates/returns the single instance CMB2_Bootstrap_2120 object
|
||||
* Creates/returns the single instance CMB2_Bootstrap_2130 object
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return CMB2_Bootstrap_2120 Single instance object
|
||||
* @return CMB2_Bootstrap_2130 Single instance object
|
||||
*/
|
||||
public static function initiate() {
|
||||
if ( null === self::$single_instance ) {
|
||||
@@ -192,6 +192,6 @@ if ( ! class_exists( 'CMB2_Bootstrap_2120', false ) ) {
|
||||
}
|
||||
|
||||
// Make it so...
|
||||
CMB2_Bootstrap_2120::initiate();
|
||||
CMB2_Bootstrap_2130::initiate();
|
||||
|
||||
}// End if().
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
const { defineConfig, devices } = require('@playwright/test');
|
||||
|
||||
/**
|
||||
* @see https://playwright.dev/docs/test-configuration
|
||||
*/
|
||||
module.exports = defineConfig({
|
||||
testDir: './tests/playwright',
|
||||
/* Run tests in files in parallel */
|
||||
fullyParallel: true,
|
||||
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||
forbidOnly: !!process.env.CI,
|
||||
/* Retry on CI only */
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
/* Single worker on CI — tests share one WordPress instance so parallel
|
||||
execution causes session/state interference (e.g., logout kills other sessions). */
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||
reporter: process.env.CI ? 'github' : 'list',
|
||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||
use: {
|
||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||
baseURL: process.env.WP_BASE_URL || 'http://localhost:2623',
|
||||
|
||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||
trace: 'on-first-retry',
|
||||
|
||||
/* Screenshot on failure */
|
||||
screenshot: 'only-on-failure',
|
||||
|
||||
/* Video on retry */
|
||||
video: 'retain-on-failure',
|
||||
},
|
||||
|
||||
/* Configure projects for major browsers */
|
||||
projects: [
|
||||
/* Auth setup — runs first, saves login state for other projects */
|
||||
{
|
||||
name: 'setup',
|
||||
testMatch: /auth\.setup\.js/,
|
||||
},
|
||||
|
||||
{
|
||||
name: 'chromium',
|
||||
use: {
|
||||
...devices['Desktop Chrome'],
|
||||
storageState: 'tests/playwright/.auth/user.json',
|
||||
},
|
||||
dependencies: ['setup'],
|
||||
testIgnore: /auth\.setup\.js/,
|
||||
},
|
||||
|
||||
{
|
||||
name: 'firefox',
|
||||
use: {
|
||||
...devices['Desktop Firefox'],
|
||||
storageState: 'tests/playwright/.auth/user.json',
|
||||
},
|
||||
dependencies: ['setup'],
|
||||
testIgnore: /auth\.setup\.js/,
|
||||
},
|
||||
|
||||
{
|
||||
name: 'webkit',
|
||||
use: {
|
||||
...devices['Desktop Safari'],
|
||||
storageState: 'tests/playwright/.auth/user.json',
|
||||
},
|
||||
dependencies: ['setup'],
|
||||
testIgnore: /auth\.setup\.js/,
|
||||
},
|
||||
],
|
||||
|
||||
/* Run your local dev server before starting the tests */
|
||||
webServer: process.env.SKIP_WP_SERVER ? undefined : {
|
||||
command: 'npm run env:tests:start',
|
||||
url: process.env.WP_BASE_URL || 'http://localhost:2623',
|
||||
reuseExistingServer: !process.env.CI,
|
||||
timeout: 180 * 1000,
|
||||
stdout: 'pipe',
|
||||
stderr: 'pipe',
|
||||
},
|
||||
|
||||
/* Global setup and teardown */
|
||||
globalSetup: './tests/playwright/global-setup.js',
|
||||
globalTeardown: './tests/playwright/global-teardown.js',
|
||||
});
|
||||
@@ -1,89 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* CSS banner injection and minification script.
|
||||
*
|
||||
* Usage:
|
||||
* node scripts/build-banner.js # Add expanded banners to CSS files
|
||||
* node scripts/build-banner.js --minify # Create .min.css files with one-line banner
|
||||
*/
|
||||
|
||||
const fs = require( 'fs' );
|
||||
const path = require( 'path' );
|
||||
|
||||
const pkg = require( path.join( __dirname, '..', 'package.json' ) );
|
||||
const date = new Date().toISOString().slice( 0, 10 );
|
||||
const year = new Date().getFullYear();
|
||||
|
||||
const cssFiles = [
|
||||
'css/cmb2.css',
|
||||
'css/cmb2-front.css',
|
||||
'css/cmb2-display.css',
|
||||
'css/cmb2-rtl.css',
|
||||
'css/cmb2-front-rtl.css',
|
||||
'css/cmb2-display-rtl.css',
|
||||
];
|
||||
|
||||
const expandedBanner =
|
||||
'/*!\n' +
|
||||
' * ' + pkg.title + ' - v' + pkg.version + ' - ' + date + '\n' +
|
||||
' * ' + pkg.homepage + '\n' +
|
||||
' * Copyright (c) ' + year + '\n' +
|
||||
' * Licensed GPLv2+\n' +
|
||||
' */\n';
|
||||
|
||||
const minBanner =
|
||||
'/*! ' + pkg.title + ' - v' + pkg.version + ' - ' + date +
|
||||
' | ' + pkg.homepage +
|
||||
' | Copyright (c) ' + year + ' ' + pkg.author.name +
|
||||
' | Licensed ' + pkg.license +
|
||||
' */';
|
||||
|
||||
const isMinify = process.argv.includes( '--minify' );
|
||||
|
||||
if ( isMinify ) {
|
||||
// Minify mode: create .min.css files with one-line banner.
|
||||
let CleanCSS;
|
||||
try {
|
||||
CleanCSS = require( 'clean-css' );
|
||||
} catch ( e1 ) {
|
||||
try {
|
||||
// clean-css may be nested inside clean-css-cli
|
||||
CleanCSS = require( 'clean-css-cli/node_modules/clean-css' );
|
||||
} catch ( e2 ) {
|
||||
console.error( 'clean-css not found. Install clean-css-cli: npm install clean-css-cli' );
|
||||
process.exit( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
const cleancss = new CleanCSS( { level: 1 } );
|
||||
|
||||
cssFiles.forEach( function( file ) {
|
||||
const content = fs.readFileSync( file, 'utf8' );
|
||||
const result = cleancss.minify( content );
|
||||
|
||||
if ( result.errors.length ) {
|
||||
console.error( 'Error minifying ' + file + ':', result.errors );
|
||||
process.exit( 1 );
|
||||
}
|
||||
|
||||
const outFile = file.replace( '.css', '.min.css' );
|
||||
fs.writeFileSync( outFile, minBanner + '\n' + result.styles );
|
||||
console.log( 'Minified: ' + outFile );
|
||||
} );
|
||||
} else {
|
||||
// Banner mode: prepend expanded banner to CSS files.
|
||||
cssFiles.forEach( function( file ) {
|
||||
if ( ! fs.existsSync( file ) ) {
|
||||
console.warn( 'Skipping (not found): ' + file );
|
||||
return;
|
||||
}
|
||||
|
||||
const content = fs.readFileSync( file, 'utf8' );
|
||||
|
||||
// Strip any existing banner before adding new one.
|
||||
const stripped = content.replace( /^\/\*![\s\S]*?\*\/\s*/, '' );
|
||||
fs.writeFileSync( file, expandedBanner + '\n' + stripped );
|
||||
console.log( 'Banner added: ' + file );
|
||||
} );
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"name": "cmb2/phpcs-tools",
|
||||
"description": "Isolated PHP_CodeSniffer toolchain for linting CMB2. Kept out of the root require-dev so the PHPUnit test matrix (PHP 7.4-8.1) is not forced to resolve sniffer packages that require PHP 8.2+ (e.g. spryker/code-sniffer via fig-r/psr2r-sniffer). Installed only by the PHP 8.3 PHPCS CI job.",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"require": {
|
||||
"squizlabs/php_codesniffer": "^3.9",
|
||||
"wp-coding-standards/wpcs": "^3.1",
|
||||
"phpcompatibility/phpcompatibility-wp": "^2.1",
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
|
||||
"sirbrillig/phpcs-variable-analysis": "^2.11",
|
||||
"fig-r/psr2r-sniffer": "^1.5"
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||
}
|
||||
}
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Auto-install the isolated PHPCS toolchain after a root `composer install`.
|
||||
*
|
||||
* Wired to root composer.json post-install-cmd / post-update-cmd. It is GUARDED
|
||||
* so it never runs during the PHPUnit CI matrix:
|
||||
*
|
||||
* - Skips on PHP < 8.2. The toolchain pulls fig-r/psr2r-sniffer ->
|
||||
* spryker/code-sniffer, which requires PHP 8.2+. Running it on the
|
||||
* 7.4/8.0/8.1 test legs would fail `composer install` (the exact bug this
|
||||
* setup avoids — see commit history around composer.lock removal).
|
||||
* - Skips when CI is set. CI installs the toolchain explicitly in the PHPCS
|
||||
* job (.github/workflows/phpcs.yml), so it must stay out of the test matrix.
|
||||
*
|
||||
* The install is best-effort: this script always exits 0 so a phpcs tooling
|
||||
* hiccup never fails the developer's root `composer install`.
|
||||
*
|
||||
* @package CMB2
|
||||
*/
|
||||
|
||||
if ( PHP_VERSION_ID < 80200 || getenv( 'CI' ) ) {
|
||||
echo "phpcs: skipping tools/phpcs auto-install (needs PHP 8.2+, skipped in CI). Run `composer phpcs:install` manually if needed.\n";
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
$composer = getenv( 'COMPOSER_BINARY' );
|
||||
if ( ! $composer ) {
|
||||
echo "phpcs: COMPOSER_BINARY not set; run `composer phpcs:install` to set up linting.\n";
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
echo "phpcs: installing isolated toolchain in tools/phpcs ...\n";
|
||||
|
||||
$cmd = escapeshellarg( PHP_BINARY )
|
||||
. ' ' . escapeshellarg( $composer )
|
||||
. ' install --working-dir=' . escapeshellarg( __DIR__ )
|
||||
. ' --no-interaction --no-progress';
|
||||
|
||||
passthru( $cmd );
|
||||
|
||||
// Never fail the parent install on a tooling hiccup.
|
||||
exit( 0 );
|
||||
@@ -1,51 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Ensure the isolated PHPCS toolchain is installed, then run phpcs or phpcbf.
|
||||
*
|
||||
* Backs the `composer phpcs` / `composer phpcbf` scripts so a fresh checkout
|
||||
* works in one command: if tools/phpcs/vendor is missing, it is installed on
|
||||
* demand. Unlike the post-install hook (maybe-install.php), an explicit phpcs
|
||||
* invocation on PHP < 8.2 errors clearly rather than skipping — the caller
|
||||
* asked to lint, so a confusing skip would be worse than an honest failure.
|
||||
*
|
||||
* Usage (via composer): composer phpcs | composer phpcbf
|
||||
*
|
||||
* @package CMB2
|
||||
*/
|
||||
|
||||
$tool = $argv[1] ?? 'phpcs';
|
||||
if ( ! in_array( $tool, array( 'phpcs', 'phpcbf' ), true ) ) {
|
||||
fwrite( STDERR, "usage: run.php phpcs|phpcbf\n" );
|
||||
exit( 2 );
|
||||
}
|
||||
|
||||
if ( PHP_VERSION_ID < 80200 ) {
|
||||
fwrite( STDERR, 'phpcs requires PHP 8.2+ (the ruleset uses sniffers that need it); you are on ' . PHP_VERSION . ".\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
$bin = __DIR__ . '/vendor/bin/' . $tool;
|
||||
|
||||
if ( ! is_file( $bin ) ) {
|
||||
$composer = getenv( 'COMPOSER_BINARY' );
|
||||
if ( ! $composer ) {
|
||||
fwrite( STDERR, "phpcs: tooling not installed and composer binary not detected. Run `composer phpcs:install`.\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
fwrite( STDERR, "phpcs: tooling not installed; installing in tools/phpcs ...\n" );
|
||||
$install = escapeshellarg( PHP_BINARY )
|
||||
. ' ' . escapeshellarg( $composer )
|
||||
. ' install --working-dir=' . escapeshellarg( __DIR__ )
|
||||
. ' --no-interaction --no-progress';
|
||||
passthru( $install, $install_code );
|
||||
|
||||
if ( 0 !== $install_code || ! is_file( $bin ) ) {
|
||||
fwrite( STDERR, "phpcs: tooling install failed.\n" );
|
||||
exit( $install_code ?: 1 );
|
||||
}
|
||||
}
|
||||
|
||||
// Run from the repo root so the .phpcs.xml.dist and includes/ init.php paths resolve.
|
||||
passthru( escapeshellarg( $bin ) . ' --standard=.phpcs.xml.dist includes/ init.php', $code );
|
||||
exit( $code );
|
||||
@@ -15,6 +15,7 @@ return array(
|
||||
'RankMath\\AI_Visibility\\Api\\Checkout_Controller' => $baseDir . '/includes/modules/ai-visibility/Api/class-checkout-controller.php',
|
||||
'RankMath\\AI_Visibility\\Api\\Trial_Controller' => $baseDir . '/includes/modules/ai-visibility/Api/class-trial-controller.php',
|
||||
'RankMath\\AI_Visibility\\Cache' => $baseDir . '/includes/modules/ai-visibility/class-cache.php',
|
||||
'RankMath\\AI_Visibility\\Platforms' => $baseDir . '/includes/modules/ai-visibility/class-platforms.php',
|
||||
'RankMath\\Abilities\\AI_Visibility\\Create_AI_Visibility_Brand' => $baseDir . '/includes/abilities/ai-visibility/class-create-ai-visibility-brand.php',
|
||||
'RankMath\\Abilities\\AI_Visibility\\Get_AI_Visibility_Brand_Insights' => $baseDir . '/includes/abilities/ai-visibility/class-get-ai-visibility-brand-insights.php',
|
||||
'RankMath\\Abilities\\AI_Visibility\\Get_AI_Visibility_Brand_Queries' => $baseDir . '/includes/abilities/ai-visibility/class-get-ai-visibility-brand-queries.php',
|
||||
@@ -34,6 +35,8 @@ return array(
|
||||
'RankMath\\Abilities\\Link_Genius\\Link_Report_Runner' => $baseDir . '/includes/abilities/link-genius/class-link-report-runner.php',
|
||||
'RankMath\\Abilities\\Link_Genius\\Post_Links_Runner' => $baseDir . '/includes/abilities/link-genius/class-post-links-runner.php',
|
||||
'RankMath\\Abilities\\Link_Genius\\Subscriber' => $baseDir . '/includes/abilities/link-genius/class-subscriber.php',
|
||||
'RankMath\\Abilities\\Monitor_404\\Get_404_Logs' => $baseDir . '/includes/abilities/monitor-404/class-get-404-logs.php',
|
||||
'RankMath\\Abilities\\Monitor_404\\Subscriber' => $baseDir . '/includes/abilities/monitor-404/class-subscriber.php',
|
||||
'RankMath\\Abilities\\Post_SEO\\Get_Post_SEO_Meta' => $baseDir . '/includes/abilities/post-seo/class-get-post-seo-meta.php',
|
||||
'RankMath\\Abilities\\Post_SEO\\Subscriber' => $baseDir . '/includes/abilities/post-seo/class-subscriber.php',
|
||||
'RankMath\\Abilities\\Redirections\\Get_Redirections' => $baseDir . '/includes/abilities/redirections/class-get-redirections.php',
|
||||
@@ -63,6 +66,8 @@ return array(
|
||||
'RankMath\\Abilities\\Settings\\Set_Sitemap_Settings' => $baseDir . '/includes/abilities/settings/class-set-sitemap-settings.php',
|
||||
'RankMath\\Abilities\\Settings\\Set_Website_Identity' => $baseDir . '/includes/abilities/settings/class-set-website-identity.php',
|
||||
'RankMath\\Abilities\\Settings\\Subscriber' => $baseDir . '/includes/abilities/settings/class-subscriber.php',
|
||||
'RankMath\\Abilities\\Sitemap\\Get_Sitemap_Status' => $baseDir . '/includes/abilities/sitemap/class-get-sitemap-status.php',
|
||||
'RankMath\\Abilities\\Sitemap\\Subscriber' => $baseDir . '/includes/abilities/sitemap/class-subscriber.php',
|
||||
'RankMath\\Abilities\\Subscriber_Interface' => $baseDir . '/includes/abilities/interface-subscriber.php',
|
||||
'RankMath\\Admin\\Admin' => $baseDir . '/includes/admin/class-admin.php',
|
||||
'RankMath\\Admin\\Admin_Breadcrumbs' => $baseDir . '/includes/admin/class-admin-breadcrumbs.php',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInita50e6b304efbc99120a5f1c6ce16f39b
|
||||
class ComposerAutoloaderInitda5118e07739bcc2a9ee8b03eeea8972
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@@ -24,18 +24,18 @@ class ComposerAutoloaderInita50e6b304efbc99120a5f1c6ce16f39b
|
||||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInita50e6b304efbc99120a5f1c6ce16f39b', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitda5118e07739bcc2a9ee8b03eeea8972', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInita50e6b304efbc99120a5f1c6ce16f39b', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitda5118e07739bcc2a9ee8b03eeea8972', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInita50e6b304efbc99120a5f1c6ce16f39b::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitda5118e07739bcc2a9ee8b03eeea8972::getInitializer($loader));
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInita50e6b304efbc99120a5f1c6ce16f39b::$files;
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInitda5118e07739bcc2a9ee8b03eeea8972::$files;
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequirea50e6b304efbc99120a5f1c6ce16f39b($fileIdentifier, $file);
|
||||
composerRequireda5118e07739bcc2a9ee8b03eeea8972($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
@@ -47,7 +47,7 @@ class ComposerAutoloaderInita50e6b304efbc99120a5f1c6ce16f39b
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequirea50e6b304efbc99120a5f1c6ce16f39b($fileIdentifier, $file)
|
||||
function composerRequireda5118e07739bcc2a9ee8b03eeea8972($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInita50e6b304efbc99120a5f1c6ce16f39b
|
||||
class ComposerStaticInitda5118e07739bcc2a9ee8b03eeea8972
|
||||
{
|
||||
public static $files = array (
|
||||
'6c592737b91137905268e9a0eb968869' => __DIR__ . '/..' . '/wp-media/apply-filters-typed/functions.php',
|
||||
@@ -61,6 +61,7 @@ class ComposerStaticInita50e6b304efbc99120a5f1c6ce16f39b
|
||||
'RankMath\\AI_Visibility\\Api\\Checkout_Controller' => __DIR__ . '/../..' . '/includes/modules/ai-visibility/Api/class-checkout-controller.php',
|
||||
'RankMath\\AI_Visibility\\Api\\Trial_Controller' => __DIR__ . '/../..' . '/includes/modules/ai-visibility/Api/class-trial-controller.php',
|
||||
'RankMath\\AI_Visibility\\Cache' => __DIR__ . '/../..' . '/includes/modules/ai-visibility/class-cache.php',
|
||||
'RankMath\\AI_Visibility\\Platforms' => __DIR__ . '/../..' . '/includes/modules/ai-visibility/class-platforms.php',
|
||||
'RankMath\\Abilities\\AI_Visibility\\Create_AI_Visibility_Brand' => __DIR__ . '/../..' . '/includes/abilities/ai-visibility/class-create-ai-visibility-brand.php',
|
||||
'RankMath\\Abilities\\AI_Visibility\\Get_AI_Visibility_Brand_Insights' => __DIR__ . '/../..' . '/includes/abilities/ai-visibility/class-get-ai-visibility-brand-insights.php',
|
||||
'RankMath\\Abilities\\AI_Visibility\\Get_AI_Visibility_Brand_Queries' => __DIR__ . '/../..' . '/includes/abilities/ai-visibility/class-get-ai-visibility-brand-queries.php',
|
||||
@@ -80,6 +81,8 @@ class ComposerStaticInita50e6b304efbc99120a5f1c6ce16f39b
|
||||
'RankMath\\Abilities\\Link_Genius\\Link_Report_Runner' => __DIR__ . '/../..' . '/includes/abilities/link-genius/class-link-report-runner.php',
|
||||
'RankMath\\Abilities\\Link_Genius\\Post_Links_Runner' => __DIR__ . '/../..' . '/includes/abilities/link-genius/class-post-links-runner.php',
|
||||
'RankMath\\Abilities\\Link_Genius\\Subscriber' => __DIR__ . '/../..' . '/includes/abilities/link-genius/class-subscriber.php',
|
||||
'RankMath\\Abilities\\Monitor_404\\Get_404_Logs' => __DIR__ . '/../..' . '/includes/abilities/monitor-404/class-get-404-logs.php',
|
||||
'RankMath\\Abilities\\Monitor_404\\Subscriber' => __DIR__ . '/../..' . '/includes/abilities/monitor-404/class-subscriber.php',
|
||||
'RankMath\\Abilities\\Post_SEO\\Get_Post_SEO_Meta' => __DIR__ . '/../..' . '/includes/abilities/post-seo/class-get-post-seo-meta.php',
|
||||
'RankMath\\Abilities\\Post_SEO\\Subscriber' => __DIR__ . '/../..' . '/includes/abilities/post-seo/class-subscriber.php',
|
||||
'RankMath\\Abilities\\Redirections\\Get_Redirections' => __DIR__ . '/../..' . '/includes/abilities/redirections/class-get-redirections.php',
|
||||
@@ -109,6 +112,8 @@ class ComposerStaticInita50e6b304efbc99120a5f1c6ce16f39b
|
||||
'RankMath\\Abilities\\Settings\\Set_Sitemap_Settings' => __DIR__ . '/../..' . '/includes/abilities/settings/class-set-sitemap-settings.php',
|
||||
'RankMath\\Abilities\\Settings\\Set_Website_Identity' => __DIR__ . '/../..' . '/includes/abilities/settings/class-set-website-identity.php',
|
||||
'RankMath\\Abilities\\Settings\\Subscriber' => __DIR__ . '/../..' . '/includes/abilities/settings/class-subscriber.php',
|
||||
'RankMath\\Abilities\\Sitemap\\Get_Sitemap_Status' => __DIR__ . '/../..' . '/includes/abilities/sitemap/class-get-sitemap-status.php',
|
||||
'RankMath\\Abilities\\Sitemap\\Subscriber' => __DIR__ . '/../..' . '/includes/abilities/sitemap/class-subscriber.php',
|
||||
'RankMath\\Abilities\\Subscriber_Interface' => __DIR__ . '/../..' . '/includes/abilities/interface-subscriber.php',
|
||||
'RankMath\\Admin\\Admin' => __DIR__ . '/../..' . '/includes/admin/class-admin.php',
|
||||
'RankMath\\Admin\\Admin_Breadcrumbs' => __DIR__ . '/../..' . '/includes/admin/class-admin-breadcrumbs.php',
|
||||
@@ -743,9 +748,9 @@ class ComposerStaticInita50e6b304efbc99120a5f1c6ce16f39b
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInita50e6b304efbc99120a5f1c6ce16f39b::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInita50e6b304efbc99120a5f1c6ce16f39b::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInita50e6b304efbc99120a5f1c6ce16f39b::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitda5118e07739bcc2a9ee8b03eeea8972::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitda5118e07739bcc2a9ee8b03eeea8972::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitda5118e07739bcc2a9ee8b03eeea8972::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
||||
@@ -55,17 +55,17 @@
|
||||
},
|
||||
{
|
||||
"name": "cmb2/cmb2",
|
||||
"version": "v2.12.0",
|
||||
"version_normalized": "2.12.0.0",
|
||||
"version": "v2.13.0",
|
||||
"version_normalized": "2.13.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/CMB2/CMB2.git",
|
||||
"reference": "9a3686d42539ee3c1113bd09623f4ffbbee94397"
|
||||
"reference": "06783dbfdde0f23e89e088652451525d07bcd03a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/CMB2/CMB2/zipball/9a3686d42539ee3c1113bd09623f4ffbbee94397",
|
||||
"reference": "9a3686d42539ee3c1113bd09623f4ffbbee94397",
|
||||
"url": "https://api.github.com/repos/CMB2/CMB2/zipball/06783dbfdde0f23e89e088652451525d07bcd03a",
|
||||
"reference": "06783dbfdde0f23e89e088652451525d07bcd03a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -78,7 +78,7 @@
|
||||
"suggest": {
|
||||
"composer/installers": "~1.0"
|
||||
},
|
||||
"time": "2026-05-31T02:21:57+00:00",
|
||||
"time": "2026-09-21T01:10:54+00:00",
|
||||
"type": "wordpress-plugin",
|
||||
"installation-source": "dist",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php return array(
|
||||
'root' => array(
|
||||
'name' => 'rankmath/seo-by-rank-math',
|
||||
'pretty_version' => 'v1.0.278',
|
||||
'version' => '1.0.278.0',
|
||||
'reference' => '4a307ad98c67cec9721608cf92a996b96f3f50a7',
|
||||
'pretty_version' => 'v1.0.279',
|
||||
'version' => '1.0.279.0',
|
||||
'reference' => 'f9c63fe7ff6c3cf2d90470a6a60b2fbcfbd48f99',
|
||||
'type' => 'wordpress-plugin',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
@@ -20,9 +20,9 @@
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'cmb2/cmb2' => array(
|
||||
'pretty_version' => 'v2.12.0',
|
||||
'version' => '2.12.0.0',
|
||||
'reference' => '9a3686d42539ee3c1113bd09623f4ffbbee94397',
|
||||
'pretty_version' => 'v2.13.0',
|
||||
'version' => '2.13.0.0',
|
||||
'reference' => '06783dbfdde0f23e89e088652451525d07bcd03a',
|
||||
'type' => 'wordpress-plugin',
|
||||
'install_path' => __DIR__ . '/../cmb2/cmb2',
|
||||
'aliases' => array(),
|
||||
@@ -38,9 +38,9 @@
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'rankmath/seo-by-rank-math' => array(
|
||||
'pretty_version' => 'v1.0.278',
|
||||
'version' => '1.0.278.0',
|
||||
'reference' => '4a307ad98c67cec9721608cf92a996b96f3f50a7',
|
||||
'pretty_version' => 'v1.0.279',
|
||||
'version' => '1.0.279.0',
|
||||
'reference' => 'f9c63fe7ff6c3cf2d90470a6a60b2fbcfbd48f99',
|
||||
'type' => 'wordpress-plugin',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
||||
Reference in New Issue
Block a user