Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
a7627eb
Update unit-tests.yml
ajaydsouza Dec 20, 2024
0fd0d74
Fix default image in related posts.
ajaydsouza Dec 21, 2024
2291867
Update PHP and PHPUnit versions, fix test workflow and improve build …
ajaydsouza Apr 11, 2025
805a0d3
Bump version to 3.0.0 and update PHPUnit requirements
ajaydsouza Apr 11, 2025
e60d2ba
New product taxonomy feature
ajaydsouza Apr 24, 2025
9e67cc8
Merge pull request #61 from WebberZone/product-migrator
ajaydsouza Apr 24, 2025
d4b6d62
Use Hook_Registry
ajaydsouza Apr 25, 2025
96d4822
Setup Wizard
ajaydsouza Apr 27, 2025
3cb5fda
Admin updates
ajaydsouza Apr 27, 2025
f5114f3
Updated breadcrumbs handling for product
ajaydsouza Apr 27, 2025
e59b336
Fixed infinite loop in subsections
ajaydsouza Apr 27, 2025
fdb887f
Update class-shortcodes.php
ajaydsouza Apr 27, 2025
9aec53a
Sanitize args
ajaydsouza Apr 28, 2025
12d233d
Redirect to setup wizard on install
ajaydsouza Apr 28, 2025
cb6cb91
Updated readme
ajaydsouza Apr 28, 2025
1e18383
New Product widget
ajaydsouza Apr 28, 2025
b499838
New Products block
ajaydsouza May 5, 2025
c76b5df
Block updates
ajaydsouza May 17, 2025
1c3f4ba
Merge branch 'hotfix/v2.3.1'
ajaydsouza Jun 4, 2025
51f63cd
Update class-breadcrumbs.php
ajaydsouza Jun 4, 2025
c479c76
Merge branch 'master' into develop
ajaydsouza Jul 16, 2025
5c1ae76
fix: sanitize taxonomy slugs before registering custom taxonomies
ajaydsouza Jul 16, 2025
4130f8e
chore: add zip script to composer.json for creating plugin distributi…
ajaydsouza Aug 22, 2025
68e6456
ci: simplify PHPCS workflow and update PHPUnit version constraints
ajaydsouza Sep 15, 2025
d60a9c2
Fixed colour contrast
ajaydsouza Sep 17, 2025
ee5768b
Txt fix
ajaydsouza Oct 4, 2025
9ceb025
refactor: rename settings 'options' key to 'default' for consistency
ajaydsouza Oct 5, 2025
64174bf
refactor: improve caching implementation with dedicated Cache class m…
ajaydsouza Oct 5, 2025
eb35faf
feat: add cache expiry and timestamp-based validation to Knowledge Ba…
ajaydsouza Oct 5, 2025
fe5ca73
refactor: improve CPT registration with proper name and front-end URL…
ajaydsouza Oct 5, 2025
acdfe9d
feat: enhance setup wizard UI with Pro features and improved navigation
ajaydsouza Oct 5, 2025
e948aa7
feat: add KB style selector and update WP version requirements
ajaydsouza Oct 12, 2025
2eec5f2
feat: enhance KB permalink handling with custom slug sanitization and…
ajaydsouza Oct 13, 2025
ba59a1e
Implemented PHPCompatibilityWP
ajaydsouza Oct 15, 2025
4ad40c2
Tweaked free plugin for beacon and rating system
ajaydsouza Oct 18, 2025
0cd547a
feat: add beacon color customization settings and spam protection fea…
ajaydsouza Oct 18, 2025
8252583
Enhance wizard interface and functionality
ajaydsouza Oct 19, 2025
f6f750a
Update RTL styles and improve alert color schemes
ajaydsouza Oct 19, 2025
97af2a1
feat: enhance setup wizard with progress indicators and improve admin…
ajaydsouza Oct 19, 2025
0a39442
fix: update product creation link in setup wizard for correct taxonomy
ajaydsouza Oct 19, 2025
fd56cc0
feat: add migration guide for transitioning from single-product to mu…
ajaydsouza Oct 19, 2025
949a0ae
Enhance documentation formatting and add new Permalinks tutorial
ajaydsouza Oct 21, 2025
9ad3bf6
Added related and search blocks
ajaydsouza Oct 25, 2025
9fbe737
Implemented Freemius
ajaydsouza Oct 25, 2025
29d98f6
Updated Freemius SDK to 2.13.0
ajaydsouza Nov 24, 2025
8aa7060
Fix PHPCompatibility dependency conflict
ajaydsouza Dec 1, 2025
6dae74e
Update unit test matrix to modern PHP/WP versions
ajaydsouza Dec 1, 2025
7a5056a
Fix continue-on-error evaluation in unit tests
ajaydsouza Dec 1, 2025
5d559f0
Exclude docs folder from zip build
ajaydsouza Dec 1, 2025
74a885c
Fix composer zip script to exclude .DS_Store files and package-lock.json
ajaydsouza Dec 5, 2025
682fb8f
refactor: use get_post_field() instead of get_the_title() for attachm…
ajaydsouza Dec 15, 2025
255db86
Exclude package-lock.json from release zip
ajaydsouza Dec 17, 2025
980cc7a
chore(ci): sync unit-tests workflow
ajaydsouza Dec 17, 2025
c9eac3a
Align zip script with comprehensive ignore list
ajaydsouza Dec 21, 2025
850e2de
Revamp blocks, frontend styles, and templates for the new KB experience.
ajaydsouza Dec 22, 2025
d3d4d3a
Synced Free with Pro
ajaydsouza Dec 23, 2025
8136655
Update class-rest-controller.php
ajaydsouza Dec 23, 2025
7900e4b
chore: standardize composer scripts
ajaydsouza Dec 24, 2025
4a1710e
refactor: extract admin banner to dedicated class with configuration-…
ajaydsouza Dec 29, 2025
ac31e7e
Add --wzkb-breadcrumb-separator-color CSS variable for consistent bre…
ajaydsouza Dec 29, 2025
4b1a868
Update copyright year to 2026
ajaydsouza Dec 31, 2025
f4e58c1
feat: sync from pro version and update for 2026
ajaydsouza Jan 1, 2026
52c9a59
fix: remove incorrect translator comment
ajaydsouza Jan 1, 2026
27e7933
Update phpunit install.sh with retry mechanism
ajaydsouza Jan 1, 2026
1ca127e
v3.0.0-beta2: Sync with pro version - update copyright to 2026, refre…
ajaydsouza Jan 3, 2026
dd066a5
feat: improve breadcrumb positioning and add custom CSS support to sh…
ajaydsouza Jan 6, 2026
066785b
Updated to latest KB Pro level
ajaydsouza Jan 8, 2026
bdb9ff7
Update knowledgebase.php
ajaydsouza Jan 8, 2026
2e07f90
refactor: migrate admin notices to centralized Admin_Notices_API system
ajaydsouza Jan 8, 2026
6ca5230
Synced from pro
ajaydsouza Jan 8, 2026
c3202d0
Update translation files
ajaydsouza Jan 8, 2026
439c704
Add context check for Knowledge Base content
ajaydsouza Jan 8, 2026
ae0f50f
feat: add Knowledge Base homepage mode setting and initialization
ajaydsouza Jan 9, 2026
e292ee1
refactor: remove duplicate Pro class initialization from Main constru…
ajaydsouza Jan 9, 2026
c462858
chore: Sync includes from pro version
ajaydsouza Jan 18, 2026
2d049df
Sync includes from pro
ajaydsouza Jan 18, 2026
6b8fbf5
Update composer.json: add build:vendor script and enhance zip exclusions
ajaydsouza Jan 18, 2026
0950b1d
Update Hook_Registry validation to use is_numeric() for consistency
ajaydsouza Jan 19, 2026
4a446bb
Update class-main.php
ajaydsouza Jan 20, 2026
1e3a52d
Update Settings API and translations
ajaydsouza Jan 25, 2026
d6503eb
Sync includes from pro version and update i18n files
ajaydsouza Jan 25, 2026
841e931
Sync with KB Pro v3.0.0-RC1
ajaydsouza Jan 25, 2026
61fde5a
Remove obsolete pro features comment from Main class initialization
ajaydsouza Jan 25, 2026
8d8b53b
refactor: modernize Settings_Wizard_API with null coalescing and PHP …
ajaydsouza Jan 31, 2026
7d49e70
chore: sync includes from pro version and remove Freemius premium checks
ajaydsouza Feb 2, 2026
d61dea6
Refactor Media_Handler::get_image_html() and add sanitize_image_attrs()
ajaydsouza Feb 6, 2026
6e9da69
Sync free knowledgebase from knowledgebase-pro
ajaydsouza Feb 8, 2026
125a4d3
Sync free knowledgebase from knowledgebase-pro
ajaydsouza Feb 8, 2026
de04e72
Improve help widget animation setting label and description
ajaydsouza Feb 8, 2026
2b7c7c6
Fix product slug default value and improve permalinks documentation
ajaydsouza Feb 8, 2026
36acb71
Remove Help Widget documentation file
ajaydsouza Feb 8, 2026
e1e302c
feat: Update Settings API to v2.8.0 with latest improvements
ajaydsouza Feb 9, 2026
6c52fc4
fix: Add missing ob_start() in callback_repeater function
ajaydsouza Feb 9, 2026
820e4a2
Add white border to product cards on hover for better contrast
ajaydsouza Feb 10, 2026
34d3822
Add FIFU (Featured Image from URL) plugin support to Media_Handler
ajaydsouza Feb 11, 2026
5f25245
Update readme.txt to document FIFU plugin support in Media Handler
ajaydsouza Feb 13, 2026
6b9b7a1
Add settings_errors rendering in Settings API plugin_settings method
ajaydsouza Feb 13, 2026
3957456
Update admin settings and readme files
ajaydsouza Feb 14, 2026
d2c6bbe
Improve Hook Registry callback hashing
ajaydsouza Feb 16, 2026
44c8433
Update settings_errors conditional logic to check for settings_page_ …
ajaydsouza Feb 19, 2026
02d60c9
Update: Consolidate wizard submenu logic and bump Settings API to v2.8.1
ajaydsouza Feb 21, 2026
860df57
Fix: Add missing 'show_in_menu' to Settings_Wizard_API defaults
ajaydsouza Feb 21, 2026
5ce48d0
Update zipitup.yml to exclude dev-helpers and update comments
ajaydsouza Feb 21, 2026
a594aa3
Update zipitup.yml to use ** for recursive exclusions
ajaydsouza Feb 21, 2026
f04bd69
Revert to single asterisk for zip exclusions
ajaydsouza Feb 21, 2026
24a2e6e
chore: Exclude build-assets.js from release zip
ajaydsouza Feb 21, 2026
2f4fdfc
Remove nopriv AJAX handler and relocate taxonomy_search_tom_select me…
ajaydsouza Feb 26, 2026
c70ea6b
Update Settings API from freemkit with bug fixes
ajaydsouza Mar 1, 2026
ed696eb
refactor: Remove deprecated taxonomy-suggest scripts and update depen…
ajaydsouza Mar 3, 2026
8eba84c
Add ABSPATH protection to sidebar.php
ajaydsouza Mar 4, 2026
a0fdd02
Sync admin files from FreemKit with RTL support and public properties
ajaydsouza Mar 5, 2026
4e0486c
Fix incorrect @package tags in admin settings
ajaydsouza Mar 12, 2026
e8f72e4
Build: Exclude CLAUDE.md from zip archive
ajaydsouza Mar 14, 2026
e64728d
Update admin sidebar and readme
ajaydsouza Mar 15, 2026
1227833
Add .claude/ to .gitignore
ajaydsouza Mar 15, 2026
64cbbdf
feat: Propagate updated Media_Handler class across all WebberZone plu…
ajaydsouza Mar 16, 2026
f6a7ca3
Update admin notices API and sanitize tax slugs
ajaydsouza Mar 18, 2026
1e5a6c3
Add CLAUDE.md for Claude Code guidance
ajaydsouza Mar 18, 2026
36050ca
chore: sync Settings API and Hook Registry updates
ajaydsouza Mar 22, 2026
cf1bab7
Sync tom-select init scripts from CRP Pro
ajaydsouza Mar 24, 2026
bdf776b
chore: sync free from pro and refresh i18n
ajaydsouza Mar 24, 2026
c4a3c1b
Tagged v3-RC1
ajaydsouza Mar 25, 2026
3c05b1b
Merge branch 'master' into develop
ajaydsouza Mar 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 1 addition & 10 deletions .github/workflows/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,15 @@ jobs:
tools: cs2pr
coverage: none

- name: 'Composer: set up PHPCS dependencies'
run: |
composer require --no-update squizlabs/php_codesniffer wp-coding-standards/wpcs phpcompatibility/phpcompatibility-wp dealerdirect/phpcodesniffer-composer-installer
composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies
uses: "ramsey/composer-install@v3"

- name: 'Run Composer Update'
run: |
composer update

# Check the code-style consistency of the PHP files.
- name: Check PHP code style
continue-on-error: true
run: vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml

- name: Show PHPCS results in PR
run: cs2pr --graceful-warnings ./phpcs-report.xml
run: cs2pr --graceful-warnings ./phpcs-report.xml
54 changes: 54 additions & 0 deletions .github/workflows/phpcompat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: PHP Compatibility

on:
push:
paths-ignore:
- '**.md'
- '**.txt'
pull_request:
paths-ignore:
- '**.md'
- '**.txt'
workflow_dispatch: {}

jobs:
phpcompat:
name: 'PHP Compatibility Check'
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
coverage: none

# Create isolated environment for PHPCompatibility with PHPCS 4.x
- name: Setup PHPCompatibility
run: |
mkdir phpcompat-tools
cd phpcompat-tools
composer init --name="temp/phpcompat" --type=project --no-interaction
composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require --dev \
squizlabs/php_codesniffer:"^4.0" \
phpcompatibility/php-compatibility:"dev-develop" \
dealerdirect/phpcodesniffer-composer-installer:"^1.0" \
--no-interaction

# Check PHP 7.4 through 8.5 compatibility
- name: Check PHP Compatibility (7.4-8.5)
run: |
cd phpcompat-tools
./vendor/bin/phpcs -p \
--standard=PHPCompatibility \
--runtime-set testVersion 7.4-8.5 \
--extensions=php \
--ignore=*/vendor/*,*/node_modules/*,*/tests/*,*/phpunit/*,*/freemius/* \
../ || exit_code=$?

# Exit with the phpcs exit code (if set)
exit ${exit_code:-0}
96 changes: 30 additions & 66 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Unit Tests

on:
# Run on all pushes and on all pull requests.
# Prevent the build from running when there are only irrelevant changes.
push:
paths-ignore:
- '**.md'
Expand All @@ -11,7 +9,6 @@ on:
paths-ignore:
- '**.md'
- '**.txt'
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
Expand All @@ -21,105 +18,72 @@ jobs:
strategy:
fail-fast: false
matrix:
# Notes regarding supported versions in WP:
# The base matrix only contains the PHP versions which are supported on all supported WP versions.
php: ['8.0', '8.1', '7.4']
php: ['7.4', '8.1', '8.2', '8.3']
wp: ['latest']
experimental: [false]
mysql: ['8.0']

include:
# Complement the builds run via the matrix with high/low WP builds for PHP 7.4 and 8.0.
# PHP 8.0 is sort of supported since WP 5.6.
# PHP 7.4 is supported since WP 5.3.
- php: '8.3'
wp: '6.6'
mysql: '8.0'
- php: '8.4'
wp: 'latest'
mysql: '8.0'
experimental: true
- php: '8.2'
- php: '8.5'
wp: 'latest'
mysql: '8.0'
experimental: true
- php: '8.2'
wp: '6.3'
experimental: true
- php: '8.0'
wp: '5.9'
experimental: true

name: "PHP ${{ matrix.php }} - WP ${{ matrix.wp }}"

continue-on-error: ${{ matrix.experimental }}

services:
mysql:
# WP 5.4 is the first WP version which largely supports MySQL 8.0.
# See: https://core.trac.wordpress.org/ticket/49344
# During the setting up of these tests, it became clear that MySQL 8.0
# in combination with PHP < 7.4 is not properly/sufficiently supported
# within WP Core.
# See: https://core.trac.wordpress.org/ticket/52496
image: mysql:${{ ( matrix.wp == 5.3 && '5.6' ) || ( (matrix.wp < 5.4 || matrix.php < 7.4) && '5.7' ) || '8.0' }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10
name: "PHP ${{ matrix.php }} - WP ${{ matrix.wp }} - MySQL ${{ matrix.mysql }}"
continue-on-error: ${{ matrix.experimental == true }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup MySQL
uses: ankane/setup-mysql@v1
with:
mysql-version: ${{ matrix.mysql }}

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mysqli, mysql
extensions: mysqli
coverage: none

# On WP 5.2, PHPUnit 5.x, 6.x and 7.x are supported.
# On PHP >= 8.0, PHPUnit 7.5+ is needed, no matter what.
- name: Determine supported PHPUnit version
id: set_phpunit
- name: Set PHPUnit version
run: |
if [[ "${{ matrix.php }}" > "8.0" ]]; then
echo "PHPUNIT=9.*" >> $GITHUB_ENV
else
echo "PHPUNIT=5.7.*||6.*||7.5.*||8.5.*" >> $GITHUB_ENV
fi

- name: 'Composer: set up PHPUnit'
env:
PHPUNIT: ${{ env.PHPUNIT }}
run: composer require --no-update phpunit/phpunit:"${{ env.PHPUNIT }}"
- name: Set up PHPUnit
run: composer require --no-update phpunit/phpunit:"$PHPUNIT"

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies for PHP < 8.0
- name: Install dependencies for PHP < 8.0
if: ${{ matrix.php < 8.0 }}
uses: "ramsey/composer-install@v2"
uses: ramsey/composer-install@v3

# For the PHP 8.0 and above, we need to install with ignore platform reqs as not all dependencies allow it yet.
- name: Install Composer dependencies for PHP >= 8.0
- name: Install dependencies for PHP >= 8.0
if: ${{ matrix.php >= 8.0 }}
uses: "ramsey/composer-install@v2"
uses: ramsey/composer-install@v3
with:
composer-options: --ignore-platform-reqs

- name: Install Subversion
run: sudo apt-get install subversion

- name: Set up WordPress
run: phpunit/install.sh wordpress_test root '' 127.0.0.1:3306 ${{ matrix.wp }}

- name: Tool versions
- name: Set up WordPress test environment
run: |
php --version
composer --version
./vendor/bin/phpunit --version
which ./vendor/bin/phpunit
sudo apt-get install -y subversion
bash phpunit/install.sh wordpress_test root '' 127.0.0.1:3306 ${{ matrix.wp }}

- name: Run the unit tests - single site
run: ./vendor/bin/phpunit
- name: Run tests (single site)
run: vendor/bin/phpunit

- name: Run the unit tests - multisite
- name: Run tests (multisite)
env:
WP_MULTISITE: 1
run: ./vendor/bin/phpunit
run: vendor/bin/phpunit
7 changes: 5 additions & 2 deletions .github/workflows/zipitup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build project
run: |
mkdir build

- name: Create artifact
uses: montudor/action-zip@v1
with:
args: zip -X -r build/${{ github.event.repository.name }}.zip . -x *.git* node_modules/\* .* "*/\.*" CODE_OF_CONDUCT.md CONTRIBUTING.md ISSUE_TEMPLATE.md PULL_REQUEST_TEMPLATE.md *.dist *.yml *.neon composer.* package.json dev-helpers** build** wporg-assets** phpunit**
args: zip -X -r build/${{ github.event.repository.name }}.zip . -x *.git* node_modules/\* .* "*/\.*" "*/.git*" "*/.DS_Store" CODE_OF_CONDUCT.md CONTRIBUTING.md ISSUE_TEMPLATE.md PULL_REQUEST_TEMPLATE.md CLAUDE.md *.dist *.yml *.neon composer.* package.json package-lock.json "dev-helpers/*" "build/*" "wporg-assets/*" "docs/*" "phpunit/*" phpstan-bootstrap.php build-assets.js

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
Expand All @@ -40,4 +43,4 @@ jobs:
with:
args: build/${{ github.event.repository.name }}.zip application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Ignore entire vendor except Freemius
/vendor/*
!/vendor/freemius/

# Tooling
/phpcompat-tools/
/node_modules/

# Lock files
package-lock.json
composer.lock

# Claude AI
.claude/
106 changes: 106 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Plugin Overview

WebberZone Knowledge Base is a free WordPress plugin (namespace `WebberZone\Knowledge_Base`) that creates a multi-product knowledge base system. This is the standalone free version — there is no `includes/pro/` directory here. The companion premium plugin (knowledgebase-pro) is a separate repository that extends this codebase with pro features.

- **Plugin entry**: `knowledgebase.php` (defines constants, loads Freemius, triggers autoloader)
- **PHP**: 7.4+ | **WordPress**: 6.7+
- **Custom post type**: `wz_knowledgebase` | **Taxonomies**: `wzkb_category`, `wzkb_product`, `wzkb_tag`
- **Constants**: `WZKB_VERSION`, `WZKB_PLUGIN_DIR`, `WZKB_PLUGIN_URL`, `WZKB_PLUGIN_FILE`, `WZKB_DEFAULT_THUMBNAIL_URL`

## Build & Development Commands

### PHP

```bash
composer install # Install dependencies
composer test # Run phpcs + phpcompat + phpstan
composer phpcs # WordPress coding standards check
composer phpcbf # Auto-fix coding standards
composer phpstan # Static analysis (Level 5)
composer phpcompat # PHP 7.4–8.5 compatibility check
vendor/bin/phpunit # Run unit tests
vendor/bin/phpunit --filter TestName # Run a single test by name
WP_MULTISITE=1 vendor/bin/phpunit # Run multisite unit tests
```

### JavaScript / Blocks

```bash
npm run build # Build all blocks (runs build:free + build:pro)
npm run build:free # Build all free blocks
npm run build:assets # Minify CSS/JS and generate RTL
npm run start # Watch mode for free blocks
npm run lint:js # Lint JavaScript
npm run lint:css # Lint CSS
npm run format # Auto-format JS and CSS
```

Individual block builds: `npm run build:[kb|articles|sections|products|search|breadcrumb|related|alerts]`

Note: `package.json` also contains `build:pro` and `build:rating` scripts that reference `includes/pro/` — these are irrelevant in this repository and will fail if run here.

### Distribution

```bash
composer zip # Create PHP distribution zip
npm run zip # Create full plugin zip (wp-scripts plugin-zip)
```

## Architecture

### Main Bootstrap Flow

1. `plugins_loaded` hook → `Main::get_instance()` (singleton)
2. `Main::init()` instantiates all component handlers and registers their hooks
3. Admin components only load on `is_admin()` (deferred to `init` action for translation readiness)
4. `Main` has `$pro` and `$is_pro_enabled` properties defined but they are never set in this repository — those are only used by the pro plugin

### Key Patterns

**Autoloader** (`includes/autoloader.php`): PSR-4 style. Converts `WebberZone\Knowledge_Base\Admin\Settings` → `includes/admin/class-settings.php`.

**Hook Registry** (`includes/util/class-hook-registry.php`): Custom wrapper around WordPress actions/filters with duplicate prevention and closure support. All components register hooks through this instead of calling `add_action()`/`add_filter()` directly.

**Settings**: Global `$wzkb_settings` populated at plugin load. Read via `wzkb_get_option( $key )` or `wzkb_get_settings()`. Settings page in `includes/admin/class-settings.php`. Stored as a single serialized array under option key `wzkb_settings`. All settings filters use the prefix `wzkb_` (e.g. `wzkb_get_option_{$key}`).

**Caching** (`includes/util/class-cache.php`): Term meta-based caching (not transients) with expiry timestamps. AJAX endpoint for admin cache clearing.

**Free/Pro coexistence**: The plugin includes deactivation logic in `knowledgebase.php` — activating either the free or pro plugin automatically deactivates the other and shows an admin notice.

### Component Map

| Directory | Responsibility |
|---|---|
| `includes/admin/` | Settings UI, columns, wizard, notices, activation |
| `includes/frontend/` | Templates, display, shortcodes, styles, search, breadcrumbs, related articles, feeds, patterns |
| `includes/blocks/` | 8 free Gutenberg blocks (React in `src/`, compiled to `build/`) |
| `includes/rest/` | REST API under `/wzkb/v1/` namespace |
| `includes/widgets/` | 4 classic WordPress widgets (Articles, Sections, Breadcrumb, Products) |
| `includes/util/` | Hook registry, caching utilities, helpers |

### Block Development

Blocks are in `includes/blocks/src/[block-name]/`. Each block has its own `block.json`, React `edit.js`, and server-side render via PHP. After editing block source, run `npm run build:[block-name]` — never edit files in `build/` directly.

### Public Helper Functions

`includes/functions.php` exposes the plugin's public API. Key functions:
- `wzkb_knowledge()` — render the full KB output
- `wzkb_get_option( $key )` / `wzkb_get_settings()` — read settings (prefer over `get_option()` directly)
- `wzkb_get_breadcrumb()`, `wzkb_get_search_form()`, `wzkb_get_alert()`, `wzkb_related_articles()` — frontend rendering helpers
- `wzkb_get_the_post_thumbnail()` — thumbnail retrieval (supports ACF image fields)
- `wzkb_get_kb_url()`, `wzkb_get_product_sections_list()`, `wzkb_get_term_hierarchy_path()` — URL and taxonomy helpers

### REST API

Endpoints under `/wzkb/v1/`: `/sections` (product sections), `/knowledgebase` (list), `/knowledgebase/{id}` (single). Responses are object-cached under group `wzkb_rest` (300 s TTL); cache is invalidated on post save/delete and term changes.

## Code Quality Configuration

- **PHPCS**: `phpcs.xml.dist` — WordPress coding standards
- **PHPStan**: `phpstan.neon.dist` — Level 5 strict analysis; baseline in `phpstan-baseline.neon`
- **PHPUnit**: `phpunit.xml.dist` — test configuration, tests in `phpunit/tests/`
Empty file modified LICENSE.txt
100755 → 100644
Empty file.
Loading
Loading