Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
1035106
#228 html validation bug fix
lightbulbman Mar 14, 2025
b2be2b8
wip
louiswol94 Jul 1, 2025
510e49e
wip
louiswol94 Jul 2, 2025
4fef005
wip
louiswol94 Jul 2, 2025
f65f5bc
wip
louiswol94 Jul 2, 2025
c7f3d3c
wip
louiswol94 Jul 2, 2025
29a540c
wip
louiswol94 Jul 2, 2025
c47c344
wip
louiswol94 Jul 2, 2025
b66db45
wip
louiswol94 Jul 2, 2025
55561ca
wip
louiswol94 Jul 2, 2025
f2720ac
wip
louiswol94 Jul 2, 2025
6477f86
wip
louiswol94 Jul 2, 2025
0eda7c9
wip
louiswol94 Jul 2, 2025
759aabd
wip
louiswol94 Jul 2, 2025
18bcfa3
wip
louiswol94 Jul 2, 2025
dc91357
wip
louiswol94 Jul 2, 2025
1d99420
wip
louiswol94 Jul 2, 2025
918e769
wip
louiswol94 Jul 2, 2025
737b3cf
wip
louiswol94 Jul 2, 2025
20ec189
wip
louiswol94 Jul 2, 2025
04e706d
wip
louiswol94 Jul 2, 2025
890481a
wip
louiswol94 Jul 5, 2025
3f5eea3
wip
louiswol94 Jul 5, 2025
69449a0
wip
louiswol94 Jul 5, 2025
91b7546
wip
louiswol94 Jul 5, 2025
0029e0f
wip
louiswol94 Jul 5, 2025
1a7789e
wip
louiswol94 Jul 5, 2025
dcc44ce
wip
louiswol94 Jul 5, 2025
87b9b2d
wip
louiswol94 Jul 5, 2025
9c168bf
wip
louiswol94 Jul 6, 2025
531ee35
wip
louiswol94 Jul 6, 2025
0b19d6e
wip
louiswol94 Jul 6, 2025
ff80d08
wip
louiswol94 Jul 6, 2025
b533854
wip
louiswol94 Jul 6, 2025
b983aa7
wip
louiswol94 Jul 6, 2025
e3a96ab
wip
louiswol94 Jul 6, 2025
a071dc8
wip
louiswol94 Jul 6, 2025
07f542b
wip
louiswol94 Jul 7, 2025
1970826
wip
louiswol94 Jul 7, 2025
4cd5ee8
wip
louiswol94 Jul 7, 2025
4d84a24
sync all changes from pro
louiswol94 Jul 24, 2025
d263c52
feat: Add version switch settings file to plugin initialization
imantsk Aug 22, 2025
2dce939
feat: add render callback
imantsk Aug 22, 2025
cb27853
feat: add version switch settings
imantsk Aug 22, 2025
cc8faf9
feat: add version switch section to settings
imantsk Aug 22, 2025
690d756
feat: implement version switching functionality for the plugin
imantsk Aug 22, 2025
fcd6831
feat: add version switch styles and update sections in settings
imantsk Aug 22, 2025
2e54814
feat: refactor version switch functions and improve error handling
imantsk Aug 22, 2025
5af841c
feat: move version warning to separate field
imantsk Aug 22, 2025
f6225ab
feat: enhance version switch UI with warning and button state management
imantsk Aug 22, 2025
1c3f8cd
feat: update version switch button styles and add warning box styling
imantsk Aug 22, 2025
9c23fee
fix: remove unused function import in version switch
imantsk Aug 22, 2025
4e16d45
Update version number and changelog for v3.7.0.
sheabunge Aug 29, 2025
6cee314
Merge branch 'core' into feat/version-switch
imantsk Aug 29, 2025
8279304
Merge branch 'core' into flat-file
louiswol94 Oct 7, 2025
89825fb
Merge branch 'edit-refresh/core' into flat-file
louiswol94 Oct 7, 2025
68d0d3a
sync changes from pro
louiswol94 Oct 7, 2025
5a43f3c
remove unrelated changes
louiswol94 Oct 7, 2025
b72b791
Merge branch 'core' into flat-file
louiswol94 Oct 9, 2025
f384c78
file bases E2E tests
louiswol94 Oct 9, 2025
347abe7
update playwright command
louiswol94 Oct 9, 2025
c331651
fix playwright storage state
louiswol94 Oct 9, 2025
555bb31
clear opcache cache on save
louiswol94 Oct 9, 2025
0d36e23
eslint fix
louiswol94 Oct 9, 2025
73672e2
fix e2e test snippet for list page tests
louiswol94 Oct 9, 2025
819f7c0
reusable playwright workflow
louiswol94 Oct 9, 2025
1df506b
remove debug steps from playwright workflow
louiswol94 Oct 9, 2025
3e4a082
add workflow permissions
louiswol94 Oct 9, 2025
350ba54
remove permissions
louiswol94 Oct 9, 2025
8187aab
remove permissions
louiswol94 Oct 9, 2025
1680b33
Merge remote-tracking branch 'origin/core/core-beta' into flat-file
imantsk Oct 16, 2025
79b0e56
Merge remote-tracking branch 'origin/core/core-beta' into feat/versio…
imantsk Oct 16, 2025
5e45f11
fix: refactor version switch JS
imantsk Oct 16, 2025
99a7ec6
feat: add debug option to enable version change section
imantsk Oct 16, 2025
616f251
fix: update version switch integration to use class-based implementation
imantsk Oct 16, 2025
964da43
chore: remove unnecessary code
imantsk Oct 16, 2025
2741138
fix: notice styles
imantsk Oct 16, 2025
b87a530
Merge pull request #258 from codesnippetspro/flat-file
imantsk Oct 16, 2025
9e0c194
Merge remote-tracking branch 'origin/core/core-beta' into fix/misc-bu…
imantsk Oct 16, 2025
c4ef01f
Merge pull request #248 from codesnippetspro/fix/misc-bug-fixes
code-snippets-bot Oct 16, 2025
fe9754f
chore(release): update changelog for v3.7.1-beta.1
code-snippets-bot Oct 16, 2025
4c174da
chore(release): update readme for v3.7.1-beta.1
code-snippets-bot Oct 16, 2025
9849128
chore(release): bump version to v3.7.1-beta.1
code-snippets-bot Oct 16, 2025
ccfedd1
fix: changelog
code-snippets-bot Oct 16, 2025
7a5b4c8
chore(release): update changelog for v3.7.1-beta.1
code-snippets-bot Oct 16, 2025
50c8cbc
chore(release): update readme for v3.7.1-beta.1
code-snippets-bot Oct 16, 2025
19b53ef
fix: changelog
code-snippets-bot Oct 16, 2025
f11817b
Merge pull request #262 from codesnippetspro/tag/v3.7.1-beta.1
code-snippets-bot Oct 16, 2025
6923968
Merge branch 'core' into core-beta
code-snippets-bot Oct 16, 2025
4b0df8a
Merge branch 'core' into core-beta
code-snippets-bot Oct 16, 2025
66543b8
fix: changelog
imantsk Oct 16, 2025
4c67b56
Merge pull request #263 from codesnippetspro/tag/v3.7.1-beta.1
code-snippets-bot Oct 16, 2025
236dea7
Merge branch 'core' into core-beta
code-snippets-bot Oct 16, 2025
e78d664
fix: changelog
imantsk Oct 16, 2025
fa4261f
Merge remote-tracking branch 'origin/core/core-beta' into tag/v3.7.1-…
imantsk Oct 16, 2025
ef425c8
Merge pull request #264 from codesnippetspro:tag/v3.7.1-beta.1
imantsk Oct 16, 2025
e39cb34
fix: correct version number in plugin header
imantsk Oct 21, 2025
0089f9b
Merge pull request #265 from codesnippetspro:fix/verions-nr
imantsk Oct 21, 2025
a698ecc
chore(release): bump version to v3.7.1-beta.1
code-snippets-bot Oct 21, 2025
e86b599
fix: version nr
imantsk Oct 21, 2025
7bd15a0
fix: double empty line
imantsk Oct 21, 2025
80e3118
fix: changelog
imantsk Oct 21, 2025
aba2e21
Merge pull request #266 from codesnippetspro/tag/v3.7.1-beta.1
imantsk Oct 21, 2025
8ca4a1b
fix: revert stable tag to 3.7.0
imantsk Oct 22, 2025
1730854
fix: conditionally update stable tag based on version type
imantsk Oct 22, 2025
cad3888
chore(release): bump version to v3.7.1-beta.1
code-snippets-bot Oct 22, 2025
55335e0
fix: version nr
imantsk Oct 22, 2025
2f606b6
Merge pull request #267 from codesnippetspro/tag/v3.7.1-beta.1
imantsk Oct 22, 2025
8c0b606
Merge pull request #251 from codesnippetspro/feat/version-switch
imantsk Oct 22, 2025
54fd5bd
chore(release): update changelog for v3.7.1-beta.2
code-snippets-bot Oct 22, 2025
5186122
chore(release): update readme for v3.7.1-beta.2
code-snippets-bot Oct 22, 2025
5a0c342
chore(release): bump version to v3.7.1-beta.2
code-snippets-bot Oct 22, 2025
9c468a3
fix: changelog
imantsk Oct 22, 2025
449b0da
fix: version
imantsk Oct 22, 2025
30b6276
Merge pull request #268 from codesnippetspro/tag/v3.7.1-beta.2
imantsk Oct 22, 2025
502965d
test: add REST API pagination test for snippets
imantsk Oct 22, 2025
fb9de70
fix: pagination support to snippets REST API endpoint
imantsk Oct 22, 2025
811be0b
fix: stylelint
imantsk Oct 22, 2025
df8af7b
fix: get_items method to support pagination
imantsk Oct 22, 2025
93c700a
fix: remove unused file
imantsk Oct 22, 2025
c0aa1a7
fix(copilot): comment style
imantsk Oct 22, 2025
ff72886
fix: improve pagination
imantsk Oct 22, 2025
1eb7967
Merge pull request #269 from codesnippetspro/fix/rest-api-pagination
imantsk Oct 22, 2025
e384432
chore(release): update changelog for v3.7.1-beta.3
code-snippets-bot Oct 22, 2025
c7d9c10
chore(release): update readme for v3.7.1-beta.3
code-snippets-bot Oct 22, 2025
e1e1269
chore(release): bump version to v3.7.1-beta.3
code-snippets-bot Oct 22, 2025
27a80f2
fix: changelog
imantsk Oct 22, 2025
95af256
fix: version
imantsk Oct 22, 2025
66cc3f9
Merge pull request #271 from codesnippetspro/tag/v3.7.1-beta.3
imantsk Oct 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .github/workflows/playwright-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Playwright Test Runner

on:
workflow_call:
inputs:
test-mode:
required: true
type: string
description: 'Test mode: default or file-based-execution'
project-name:
required: true
type: string
description: 'Playwright project name to run'

jobs:
playwright-test:
name: Playwright tests (${{ inputs.test-mode == 'default' && 'Default Mode' || 'File-based Execution' }})
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Set up PHP
uses: codesnippetspro/setup-php@v2
with:
php-version: "8.1"

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: 'npm'

- name: Compute dependency hash
id: deps-hash
run: |
set -euo pipefail
tmpfile=$(mktemp)
for f in src/composer.lock package-lock.json; do
if [ -f "$f" ]; then
cat "$f" >> "$tmpfile"
fi
done
if [ -s "$tmpfile" ]; then
deps_hash=$(shasum -a 1 "$tmpfile" | awk '{print $1}' | cut -c1-8)
else
deps_hash=$(echo "${GITHUB_SHA:-unknown}" | cut -c1-8)
fi
echo "deps_hash=$deps_hash" >> "$GITHUB_OUTPUT"

- name: Get build cache
id: deps-cache
uses: actions/cache/restore@v4
with:
path: |
node_modules
src/vendor
key: ${{ runner.os }}-deps-${{ steps.deps-hash.outputs.deps_hash }}
restore-keys: |
${{ runner.os }}-deps-

- name: Install workflow dependencies (wp-env, playwright)
if: steps.deps-cache.outputs.cache-hit != 'true'
run: npm run prepare-environment:ci && npm run bundle

- name: Save vendor and node_modules cache
if: steps.deps-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
src/vendor
node_modules
key: ${{ runner.os }}-deps-${{ steps.deps-hash.outputs.deps_hash }}

- name: Start WordPress environment
run: |
npx wp-env start

- name: Activate code-snippets plugin
run: npx wp-env run cli wp plugin activate code-snippets

- name: WordPress debug information
run: |
npx wp-env run cli wp core version
npx wp-env run cli wp --info

- name: Install playwright/test
run: |
npx playwright install chromium

- name: Run Playwright tests
run: npm run test:playwright -- --project=${{ inputs.project-name }}

- name: Stop WordPress environment
if: always()
run: npx wp-env stop

- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-test-results-${{ inputs.test-mode }}
path: test-results/
if-no-files-found: ignore
retention-days: 2
118 changes: 21 additions & 97 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,107 +24,31 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
Playwright:
name: Playwright test on PHP 8.1
runs-on: ubuntu-22.04
playwright-default:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Set up PHP
uses: codesnippetspro/setup-php@v2
with:
php-version: "8.1"

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: 'npm'

- name: Compute dependency hash
id: deps-hash
run: |
set -euo pipefail
# concatenate existing lock files (src/composer.lock and package-lock.json)
tmpfile=$(mktemp)
for f in src/composer.lock package-lock.json; do
if [ -f "$f" ]; then
cat "$f" >> "$tmpfile"
fi
done
if [ -s "$tmpfile" ]; then
deps_hash=$(shasum -a 1 "$tmpfile" | awk '{print $1}' | cut -c1-8)
else
# no lock files found, fall back to short commit sha
deps_hash=$(echo "${GITHUB_SHA:-unknown}" | cut -c1-8)
fi
echo "deps_hash=$deps_hash" >> "$GITHUB_OUTPUT"

- name: Get build cache
id: deps-cache
uses: actions/cache/restore@v4
with:
path: |
node_modules
src/vendor
key: ${{ runner.os }}-deps-${{ steps.deps-hash.outputs.deps_hash }}
restore-keys: |
${{ runner.os }}-deps-

- name: Install workflow dependencies (wp-env, playwright)
if: steps.deps-cache.outputs.cache-hit != 'true'
run: npm run prepare-environment:ci && npm run bundle

- name: Save vendor and node_modules cache
if: steps.deps-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
src/vendor
node_modules
key: ${{ runner.os }}-deps-${{ steps.deps-hash.outputs.deps_hash }}

- name: Start WordPress environment
run: |
npx wp-env start
uses: ./.github/workflows/playwright-test.yml
with:
test-mode: 'default'
project-name: 'chromium-db-snippets'

- name: Activate code-snippets plugin
run: npx wp-env run cli wp plugin activate code-snippets

- name: WordPress debug information
run: |
npx wp-env run cli wp core version
npx wp-env run cli wp --info

- name: Install playwright/test
run: |
npx playwright install chromium

- name: Run Playwright tests
run: npm run test:playwright

- name: Stop WordPress environment
if: always()
run: npx wp-env stop

- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-test-results
path: test-results/
if-no-files-found: ignore
retention-days: 2
playwright-file-based-execution:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
uses: ./.github/workflows/playwright-test.yml
with:
test-mode: 'file-based-execution'
project-name: 'chromium-file-based-snippets'

test-result:
needs: [Playwright]
if: always() && (needs.Playwright.result != 'skipped')
needs: [playwright-default, playwright-file-based-execution]
if: always() && (needs.playwright-default.result != 'skipped' || needs.playwright-file-based-execution.result != 'skipped')
runs-on: ubuntu-22.04
name: Playwright - Test Results
name: Playwright - Test Results Summary
steps:
- name: Test status
run: echo "Test status is - ${{ needs.Playwright.result }}"
- name: Check Playwright status
if: ${{ needs.Playwright.result != 'success' && needs.Playwright.result != 'skipped' }}
- name: Test status summary
run: |
echo "Default Mode: ${{ needs.playwright-default.result }}"
echo "File-based Execution: ${{ needs.playwright-file-based-execution.result }}"

- name: Check overall status
if: ${{ (needs.playwright-default.result != 'success' && needs.playwright-default.result != 'skipped') || (needs.playwright-file-based-execution.result != 'success' && needs.playwright-file-based-execution.result != 'skipped') }}
run: exit 1
25 changes: 24 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
# Changelog

## 3.7.1 ([unreleased])



## [3.7.1-beta.3] (2025-10-22)

### Added
* Snippets REST API now supports pagination via page and per_page query parameters.


## [3.7.1-beta.2] (2025-10-22)

### Added
* Implemented version switching with a new 'Version Switch' section in Settings

## [3.7.1-beta.1] (2025-10-16)

### Added
* Added @CarolinaOP and @louiswol94 as plugin contributors
* File-based execution mode for snippets (Optional in Plugin Settings)

### Changed
* Minor UI/UX tweaks to the editor form and sidebar
* Improved editor preview behavior.

### Fixed
* Improved reliability of snippet evaluation and front-end integration.
* Prefixed Composer packages to reduce collisions with other plugins, especially those using Guzzle.
* Functions conditions were loading before loop setup, resulting in some conditions not working. (PRO)
* JavaScript and CSS snippets loading twice due to a conditions bug. (PRO)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "code-snippets",
"description": "Manage code snippets running on a WordPress-powered site through a graphical interface.",
"homepage": "https://codesnippets.pro",
"version": "3.7.0",
"version": "3.7.1-beta.3",
"main": "src/dist/edit.js",
"directories": {
"test": "tests"
Expand Down
12 changes: 7 additions & 5 deletions scripts/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ replaceInFile(
.replace(/(?<prefix>'CODE_SNIPPETS_VERSION',\s+)'[\w-.]+'/, `$1'${plugin.version}'`)
)

replaceInFile(
'src/readme.txt',
contents => contents
.replace(/(?<prefix>Stable tag:\s+|@version\s+)\d+\.\d+[\w-.]+$/mg, `$1${plugin.version}`)
)
if (!/beta/i.test(plugin.version)) {
replaceInFile(
'src/readme.txt',
contents => contents
.replace(/(?<prefix>Stable tag:\s+|@version\s+)\d+\.\d+[\w-.]+$/mg, `$1${plugin.version}`)
)
}
6 changes: 3 additions & 3 deletions src/code-snippets.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
* License: GPL-2.0-or-later
* License URI: license.txt
* Text Domain: code-snippets
* Version: 3.7.0
* Version: 3.7.1-beta.3
* Requires PHP: 7.4
* Requires at least: 5.0
*
* @version 3.7.0
* @version 3.7.1-beta.3
* @package Code_Snippets
* @author Shea Bunge <shea@codesnippets.pro>
* @copyright 2012-2024 Code Snippets Pro
Expand All @@ -37,7 +37,7 @@
*
* @const string
*/
define( 'CODE_SNIPPETS_VERSION', '3.7.0' );
define( 'CODE_SNIPPETS_VERSION', '3.7.1-beta.3' );

/**
* The full path to the main file of this plugin.
Expand Down
Loading
Loading