Skip to content

Commit 0ab10ff

Browse files
Andrew Bakerclaude
andcommitted
Add missing plugin header fields and license URI
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 0496469 commit 0ab10ff

File tree

5 files changed

+180
-13
lines changed

5 files changed

+180
-13
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ deploy-wordpress.sh
1515
backup-s3.sh
1616
purge-cloudflare.sh
1717
rollback-wordpress.sh
18-
repo/
1918
.claude/
2019
.claude-flow/
20+
21+
# Help docs generator
22+
generate-help-docs.sh
23+
docs/screenshots/
24+
repo/
25+
*.backup

build-review.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
# Runs the full build with WordPress plugin standards review.
3+
# build.sh skips the review by default for speed.
4+
SKIP_REVIEW=0 bash "$(dirname "$0")/build.sh" "$@"

cs-code-block.php

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
* Version: 1.7.18
77
* Author: Andrew Baker
88
* Author URI: https://andrewbaker.ninja
9-
* License: GPL v2 or later
9+
* License: GPL-2.0-or-later
10+
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
11+
* Requires at least: 6.0
12+
* Requires PHP: 7.4
1013
* Text Domain: cs-code-block
1114
*
1215
* @package CloudScale_Code_Block
@@ -32,6 +35,7 @@ class CloudScale_Code_Block {
3235
const HLJS_VERSION = '11.11.1';
3336
const HLJS_CDN = 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/';
3437
const TOOLS_SLUG = 'cloudscale-code-sql';
38+
const MIGRATE_NONCE = 'cs_code_migrate_action';
3539

3640
/**
3741
* Returns the theme registry mapping slugs to CDN filenames and colour values.
@@ -1010,12 +1014,10 @@ public static function ajax_save_theme_setting(): void {
10101014

10111015
wp_send_json_success( [ 'theme' => $theme, 'theme_pair' => $pair ] );
10121016
}
1013-
10141017
/* ==================================================================
10151018
7. MIGRATION TOOL
1016-
================================================================== */
10171019
1018-
const MIGRATE_NONCE = 'cs_code_migrate_action';
1020+
================================================================== */
10191021

10201022
/* ==================================================================
10211023
7a. Migration: Block conversion logic
@@ -1233,10 +1235,12 @@ private static function get_migration_preview( $content ) {
12331235
* @return void Sends JSON response and exits.
12341236
*/
12351237
public static function ajax_scan() {
1236-
check_ajax_referer( self::MIGRATE_NONCE, 'nonce' );
1238+
if ( ! check_ajax_referer( self::MIGRATE_NONCE, 'nonce', false ) ) {
1239+
wp_send_json_error( 'Bad nonce', 403 );
1240+
}
12371241

12381242
if ( ! current_user_can( 'manage_options' ) ) {
1239-
wp_send_json_error( 'Insufficient permissions.' );
1243+
wp_send_json_error( 'Forbidden', 403 );
12401244
}
12411245

12421246
global $wpdb;
@@ -1287,10 +1291,12 @@ public static function ajax_scan() {
12871291
* @return void Sends JSON response and exits.
12881292
*/
12891293
public static function ajax_preview() {
1290-
check_ajax_referer( self::MIGRATE_NONCE, 'nonce' );
1294+
if ( ! check_ajax_referer( self::MIGRATE_NONCE, 'nonce', false ) ) {
1295+
wp_send_json_error( 'Bad nonce', 403 );
1296+
}
12911297

12921298
if ( ! current_user_can( 'manage_options' ) ) {
1293-
wp_send_json_error( 'Insufficient permissions.' );
1299+
wp_send_json_error( 'Forbidden', 403 );
12941300
}
12951301

12961302
$post_id = (int) ( $_POST['post_id'] ?? 0 );
@@ -1317,10 +1323,12 @@ public static function ajax_preview() {
13171323
* @return void Sends JSON response and exits.
13181324
*/
13191325
public static function ajax_migrate_single() {
1320-
check_ajax_referer( self::MIGRATE_NONCE, 'nonce' );
1326+
if ( ! check_ajax_referer( self::MIGRATE_NONCE, 'nonce', false ) ) {
1327+
wp_send_json_error( 'Bad nonce', 403 );
1328+
}
13211329

13221330
if ( ! current_user_can( 'manage_options' ) ) {
1323-
wp_send_json_error( 'Insufficient permissions.' );
1331+
wp_send_json_error( 'Forbidden', 403 );
13241332
}
13251333

13261334
$post_id = (int) ( $_POST['post_id'] ?? 0 );
@@ -1361,10 +1369,12 @@ public static function ajax_migrate_single() {
13611369
* @return void Sends JSON response and exits.
13621370
*/
13631371
public static function ajax_migrate_all() {
1364-
check_ajax_referer( self::MIGRATE_NONCE, 'nonce' );
1372+
if ( ! check_ajax_referer( self::MIGRATE_NONCE, 'nonce', false ) ) {
1373+
wp_send_json_error( 'Bad nonce', 403 );
1374+
}
13651375

13661376
if ( ! current_user_can( 'manage_options' ) ) {
1367-
wp_send_json_error( 'Insufficient permissions.' );
1377+
wp_send_json_error( 'Forbidden', 403 );
13681378
}
13691379

13701380
global $wpdb;

docs/generate-help-docs.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
'use strict';
2+
const helpLib = require('/Users/cp363412/Desktop/github/shared-help-docs/help-lib.js');
3+
4+
helpLib.run({
5+
baseUrl: process.env.WP_BASE_URL,
6+
cookies: process.env.WP_COOKIES,
7+
restUser: process.env.WP_REST_USER,
8+
restPass: process.env.WP_REST_PASS,
9+
docsDir: process.env.WP_DOCS_DIR,
10+
11+
pluginName: 'CloudScale Code Block',
12+
pluginDesc: 'Syntax highlighted code blocks with auto language detection, clipboard copy, dark/light mode toggle, a code block migrator from other plugins, and a read-only SQL query tool. Works as a Gutenberg block and as a [cs_code] shortcode.',
13+
pageTitle: 'Help & Documentation — Code Block',
14+
pageSlug: 'code-block-help',
15+
adminUrl: `${process.env.WP_BASE_URL}/wp-admin/tools.php?page=cloudscale-code-sql`,
16+
17+
sections: [
18+
{ id: 'code-block', label: 'Code Block Overview', file: 'panel-code-block.png' },
19+
{ id: 'sql-tool', label: 'SQL Query Tool', file: 'panel-sql-tool.png' },
20+
{ id: 'migrator', label: 'Code Block Migrator', file: 'panel-migrator.png' },
21+
],
22+
23+
docs: {
24+
'code-block': `
25+
<p>The <strong>CloudScale Code Block</strong> is a Gutenberg block and shortcode for displaying syntax-highlighted code in your posts and pages.</p>
26+
<ul>
27+
<li><strong>Auto language detection</strong> — the plugin detects the programming language from the code content and applies appropriate syntax highlighting automatically.</li>
28+
<li><strong>Manual language selection</strong> — override the auto-detected language from the block toolbar dropdown.</li>
29+
<li><strong>Copy to clipboard</strong> — a copy button appears on hover, letting readers copy the full code snippet with one click.</li>
30+
<li><strong>Dark / Light mode toggle</strong> — readers can switch the code block theme between dark and light to match their preference. The setting is remembered via localStorage.</li>
31+
<li><strong>Line numbers</strong> — optionally display line numbers alongside the code.</li>
32+
<li><strong>Shortcode usage:</strong> <code>[cs_code lang="php"]your code here[/cs_code]</code></li>
33+
</ul>`,
34+
35+
'sql-tool': `
36+
<p>The <strong>SQL Query Tool</strong> lets you run read-only SQL SELECT queries against your WordPress database directly from the admin — without needing phpMyAdmin or SSH access.</p>
37+
<ul>
38+
<li>Only <code>SELECT</code> statements are allowed — the tool blocks any query that could modify data (<code>INSERT</code>, <code>UPDATE</code>, <code>DELETE</code>, <code>DROP</code>, etc.).</li>
39+
<li>Results are displayed in a formatted table with column headers.</li>
40+
<li>Row count and query execution time are shown below the results.</li>
41+
<li>Useful for quick data lookups, verifying plugin data, and debugging without leaving WordPress admin.</li>
42+
</ul>
43+
<p><strong>Note:</strong> this tool is only accessible to WordPress administrators.</p>`,
44+
45+
'migrator': `
46+
<p>The <strong>Code Block Migrator</strong> converts code blocks from other WordPress plugins (such as Crayon Syntax Highlighter, SyntaxHighlighter Evolved, and others) to CloudScale Code Blocks in one operation.</p>
47+
<ul>
48+
<li><strong>Scan</strong> — finds all posts and pages containing shortcodes or HTML from supported legacy plugins.</li>
49+
<li><strong>Preview</strong> — shows what will be converted before making any changes.</li>
50+
<li><strong>Convert</strong> — replaces the old shortcodes/HTML with <code>[cs_code]</code> shortcodes, preserving the code content and language attribute where possible.</li>
51+
</ul>
52+
<p>Always take a backup before running the migrator.</p>`,
53+
},
54+
}).catch(err => { console.error('ERROR:', err.message); process.exit(1); });

docs/help-page.html

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<!DOCTYPE html>
2+
<html lang="en"><head><meta charset="UTF-8"><title>CloudScale Code Block — Help</title></head><body>
3+
<!-- wp:html -->
4+
<style>
5+
.cs-help-docs{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;color:#1a202c;line-height:1.7;max-width:900px;}
6+
.cs-help-docs a{color:#2563eb;}
7+
.cs-help-docs code{background:#f1f5f9;border:1px solid #e2e8f0;border-radius:4px;padding:1px 6px;font-size:.88em;}
8+
.cs-hero{background:linear-gradient(135deg,#0f172a 0%,#1e3a5f 60%,#0e6b8f 100%);color:#fff;border-radius:12px;padding:48px 40px;margin-bottom:40px;}
9+
.cs-hero h1{font-size:2.2em;font-weight:800;margin:0 0 12px;letter-spacing:-.02em;color:#fff;}
10+
.cs-hero p{font-size:1.1em;margin:0;opacity:.85;max-width:680px;}
11+
.cs-hero .cs-badge{display:inline-block;background:rgba(255,255,255,.15);border-radius:20px;padding:4px 14px;font-size:.8em;font-weight:600;margin-bottom:16px;letter-spacing:.05em;text-transform:uppercase;}
12+
.cs-toc{background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;padding:28px 36px;margin:32px 0;}
13+
.cs-toc-title{font-size:1em;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:#64748b;margin:0 0 16px;}
14+
.cs-toc ol{display:grid;grid-template-columns:1fr 1fr;gap:6px 32px;margin:0;padding-left:24px;}
15+
.cs-toc li a{color:#2563eb;text-decoration:none;font-weight:500;font-size:.97em;}
16+
.cs-tab-section{margin:56px 0 0;}
17+
.cs-tab-heading{font-size:2em;font-weight:800;color:#0f172a;padding:0 0 16px;border-bottom:3px solid #0e6b8f;margin:0 0 8px;}
18+
.cs-tab-intro{color:#475569;font-size:1.05em;margin:10px 0 32px;}
19+
.cs-panel-section{margin:36px 0 0;}
20+
.cs-panel-heading{font-size:1.45em;font-weight:700;color:#1e293b;margin:0 0 16px;padding:0 0 10px;border-bottom:2px solid #e2e8f0;display:flex;align-items:center;gap:10px;}
21+
.cs-panel-heading::before{content:"";display:inline-block;width:4px;height:1.2em;background:#0e6b8f;border-radius:2px;flex-shrink:0;}
22+
.cs-screenshot{margin:20px 0 24px;}
23+
.cs-screenshot img{max-width:100%;border-radius:8px;border:1px solid #d1d5db;box-shadow:0 4px 20px rgba(0,0,0,.10);display:block;}
24+
.cs-panel-body{color:#334155;}
25+
.cs-panel-body p{margin:0 0 12px;}
26+
.cs-panel-body ul,.cs-panel-body ol{padding-left:22px;margin:8px 0 16px;}
27+
.cs-panel-body li{margin:6px 0;}
28+
.cs-panel-body strong{color:#1e293b;}
29+
.cs-divider{border:none;border-top:1px solid #e2e8f0;margin:40px 0;}
30+
</style>
31+
<div class="cs-help-docs" style="max-width:900px;margin:0 auto;">
32+
<div class="cs-hero">
33+
<div class="cs-badge">Free &amp; Open Source</div>
34+
<h1>CloudScale Code Block</h1>
35+
<p>Syntax highlighted code blocks with auto language detection, clipboard copy, dark/light mode toggle, a code block migrator from other plugins, and a read-only SQL query tool. Works as a Gutenberg block and as a [cs_code] shortcode.</p>
36+
</div>
37+
38+
<div class="cs-toc">
39+
<div class="cs-toc-title">Contents</div>
40+
<ol><li><a href="#code-block">Code Block Overview</a></li>
41+
<li><a href="#sql-tool">SQL Query Tool</a></li>
42+
<li><a href="#migrator">Code Block Migrator</a></li></ol>
43+
</div>
44+
45+
<hr class="cs-divider"/>
46+
47+
48+
<div class="cs-panel-section">
49+
<h3 class="cs-panel-heading" id="code-block">Code Block Overview</h3>
50+
<figure class="cs-screenshot"><img src="https://andrewbaker.ninja/wp-content/uploads/2026/03/panel-code-block-1.jpg" alt="Code Block Overview" /></figure>
51+
<div class="cs-panel-body">
52+
<p>The <strong>CloudScale Code Block</strong> is a Gutenberg block and shortcode for displaying syntax-highlighted code in your posts and pages.</p>
53+
<ul>
54+
<li><strong>Auto language detection</strong> — the plugin detects the programming language from the code content and applies appropriate syntax highlighting automatically.</li>
55+
<li><strong>Manual language selection</strong> — override the auto-detected language from the block toolbar dropdown.</li>
56+
<li><strong>Copy to clipboard</strong> — a copy button appears on hover, letting readers copy the full code snippet with one click.</li>
57+
<li><strong>Dark / Light mode toggle</strong> — readers can switch the code block theme between dark and light to match their preference. The setting is remembered via localStorage.</li>
58+
<li><strong>Line numbers</strong> — optionally display line numbers alongside the code.</li>
59+
<li><strong>Shortcode usage:</strong> <code>[cs_code lang="php"]your code here[/cs_code]</code></li>
60+
</ul></div>
61+
</div>
62+
<hr class="cs-divider"/>
63+
64+
<div class="cs-panel-section">
65+
<h3 class="cs-panel-heading" id="sql-tool">SQL Query Tool</h3>
66+
<figure class="cs-screenshot"><img src="https://andrewbaker.ninja/wp-content/uploads/2026/03/panel-sql-tool-1.jpg" alt="SQL Query Tool" /></figure>
67+
<div class="cs-panel-body">
68+
<p>The <strong>SQL Query Tool</strong> lets you run read-only SQL SELECT queries against your WordPress database directly from the admin — without needing phpMyAdmin or SSH access.</p>
69+
<ul>
70+
<li>Only <code>SELECT</code> statements are allowed — the tool blocks any query that could modify data (<code>INSERT</code>, <code>UPDATE</code>, <code>DELETE</code>, <code>DROP</code>, etc.).</li>
71+
<li>Results are displayed in a formatted table with column headers.</li>
72+
<li>Row count and query execution time are shown below the results.</li>
73+
<li>Useful for quick data lookups, verifying plugin data, and debugging without leaving WordPress admin.</li>
74+
</ul>
75+
<p><strong>Note:</strong> this tool is only accessible to WordPress administrators.</p></div>
76+
</div>
77+
<hr class="cs-divider"/>
78+
79+
<div class="cs-panel-section">
80+
<h3 class="cs-panel-heading" id="migrator">Code Block Migrator</h3>
81+
<figure class="cs-screenshot"><img src="https://andrewbaker.ninja/wp-content/uploads/2026/03/panel-migrator-1.jpg" alt="Code Block Migrator" /></figure>
82+
<div class="cs-panel-body">
83+
<p>The <strong>Code Block Migrator</strong> converts code blocks from other WordPress plugins (such as Crayon Syntax Highlighter, SyntaxHighlighter Evolved, and others) to CloudScale Code Blocks in one operation.</p>
84+
<ul>
85+
<li><strong>Scan</strong> — finds all posts and pages containing shortcodes or HTML from supported legacy plugins.</li>
86+
<li><strong>Preview</strong> — shows what will be converted before making any changes.</li>
87+
<li><strong>Convert</strong> — replaces the old shortcodes/HTML with <code>[cs_code]</code> shortcodes, preserving the code content and language attribute where possible.</li>
88+
</ul>
89+
<p>Always take a backup before running the migrator.</p></div>
90+
</div>
91+
<hr class="cs-divider"/>
92+
</div>
93+
<!-- /wp:html -->
94+
</body></html>

0 commit comments

Comments
 (0)