Skip to content

Commit ad3da6a

Browse files
committed
Rename plugin prefix from wz_cbh to wzcbh across all files
1 parent 2f71789 commit ad3da6a

27 files changed

Lines changed: 210 additions & 215 deletions

CLAUDE.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ npm run zip # Plugin zip
2929

3030
**Namespace:** `WebberZone\Code_Block_Highlighting`
3131

32-
Bootstrap: `wz_cbh()` singleton on `plugins_loaded` → instantiates `Frontend\Blocks`, `Frontend\Styles_Handler``Admin\Admin` on `init` (admin only).
32+
Bootstrap: `wzcbh()` singleton on `plugins_loaded` → instantiates `Frontend\Blocks`, `Frontend\Styles_Handler``Admin\Admin` on `init` (admin only).
3333

3434
Key files:
3535
- `includes/class-main.php` — bootstrap and object wiring
@@ -47,7 +47,7 @@ Always `require` the generated `.asset.php` manifest before enqueueing block scr
4747

4848
**`maxHeight`** — CSS-only: serialized as inline `style` by the block save function, not touched by the PHP render filter.
4949

50-
**`wz_cbh_languages` filter** — controls the editor UI dropdown only. Does not affect which Prism grammars are bundled. Adding a slug without a matching grammar import in `frontend.js` results in plain-text output.
50+
**`wzcbh_languages` filter** — controls the editor UI dropdown only. Does not affect which Prism grammars are bundled. Adding a slug without a matching grammar import in `frontend.js` results in plain-text output.
5151

5252
**Editor canvas styling**`enqueue_editor_canvas_styles()` extracts only `background` and `color` from the active Prism theme CSS and re-injects them with `.block-editor-block-list__layout` prepended to win the specificity race against the editor's own `pre` styles. Layout properties are intentionally excluded.
5353

@@ -59,15 +59,15 @@ Always `require` the generated `.asset.php` manifest before enqueueing block scr
5959

6060
## Asset loading
6161

62-
Prism assets load only on pages containing at least one `core/code` block (`Styles_Handler::enqueue_assets()`). Use `wz_cbh_force_load_assets` to override.
62+
Prism assets load only on pages containing at least one `core/code` block (`Styles_Handler::enqueue_assets()`). Use `wzcbh_force_load_assets` to override.
6363

6464
## Filters and routes
6565

66-
- `wz_cbh_languages` — language picker UI list (`slug => label`); UI only, not grammar loader
67-
- `wz_cbh_color_scheme_css_url` — override the Prism theme CSS URL
68-
- `wz_cbh_force_load_assets` — force Prism assets to load on every page
69-
- REST route: `wz-cbh/v1/default-settings`
70-
- Settings key: `wz_cbh_settings`
66+
- `wzcbh_languages` — language picker UI list (`slug => label`); UI only, not grammar loader
67+
- `wzcbh_color_scheme_css_url` — override the Prism theme CSS URL
68+
- `wzcbh_force_load_assets` — force Prism assets to load on every page
69+
- REST route: `wzcbh/v1/default-settings`
70+
- Settings key: `wzcbh_settings`
7171

7272
## Adding a Prism theme
7373

README.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# WebberZone Code Block Highlighting
22

3-
[![WordPress Plugin Version](https://github.com/WebberZone/webberzone-code-block-highlighting/blob/main/wporg-assets/banner-1544x500.png)](https://wordpress.org/plugins/webberzone-code-block-highlighting/)
4-
53
[![WordPress Plugin Version](https://img.shields.io/wordpress/plugin/v/webberzone-code-block-highlighting.svg?style=flat-square)](https://wordpress.org/plugins/webberzone-code-block-highlighting/)
64
[![License](https://img.shields.io/badge/license-GPL_v2%2B-orange.svg?style=flat-square)](http://opensource.org/licenses/GPL-2.0)
75
[![WordPress Tested](https://img.shields.io/wordpress/v/webberzone-code-block-highlighting.svg?style=flat-square)](https://wordpress.org/plugins/webberzone-code-block-highlighting/)
@@ -36,7 +34,7 @@ Simply activate the plugin and your code blocks will instantly display beautiful
3634

3735
### Supported languages
3836

39-
40 languages out of the box: Apache Config, Bash, C, C++, C#, CSS, Dart, Docker, F#, Go, GraphQL, Groovy, Haskell, HTML, Java, JavaScript, JSON, JSX, Kotlin, Lua, Markdown, Nginx, Objective-C, Perl, PHP, PowerShell, Python, R, Ruby, Rust, Sass, Scala, SQL, Swift, TOML, TSX, TypeScript, Vim, XML, and YAML. Use the `wz_cbh_languages` filter to add or remove entries from the language picker.
37+
40 languages out of the box: Apache Config, Bash, C, C++, C#, CSS, Dart, Docker, F#, Go, GraphQL, Groovy, Haskell, HTML, Java, JavaScript, JSON, JSX, Kotlin, Lua, Markdown, Nginx, Objective-C, Perl, PHP, PowerShell, Python, R, Ruby, Rust, Sass, Scala, SQL, Swift, TOML, TSX, TypeScript, Vim, XML, and YAML. Use the `wzcbh_languages` filter to add or remove entries from the language picker.
4038

4139
### Included themes (21)
4240

@@ -63,19 +61,16 @@ A11y Dark, Coldark Cold (Light), Coldark Dark, Dracula, Duotone Dark, Duotone Li
6361

6462
### Developer filters
6563

66-
* `wz_cbh_languages` — Filter the language list array (`slug => label`)
67-
* `wz_cbh_color_scheme_css_url` — Override the Prism theme CSS URL
68-
* `wz_cbh_force_load_assets` — Force Prism assets to load on every page
64+
* `wzcbh_languages` — Filter the language list array (`slug => label`)
65+
* `wzcbh_color_scheme_css_url` — Override the Prism theme CSS URL
66+
* `wzcbh_force_load_assets` — Force Prism assets to load on every page
6967

7068
### GDPR
7169

7270
WebberZone Code Block Highlighting does not collect personal data, set cookies, or communicate with any external services.
7371

7472
## Screenshots
7573

76-
![Code block in editor with highlighting options](https://raw.github.com/WebberZone/webberzone-code-block-highlighting/main/wporg-assets/screenshot-1.png)
77-
_Code block in editor with highlighting options_
78-
7974
More screenshots are available on the [WordPress plugin page](https://wordpress.org/plugins/webberzone-code-block-highlighting/screenshots/).
8075

8176
## Installation
@@ -102,10 +97,10 @@ __Does this plugin replace the core Code block?__
10297
No. The plugin uses JavaScript and PHP filters to extend `core/code`. Deactivating it leaves behind valid, standard WordPress blocks.
10398

10499
__Which languages are supported?__
105-
40 out of the box. Use the `wz_cbh_languages` filter to add or remove entries from the language picker — note the corresponding Prism.js grammar must also be available on the frontend.
100+
40 out of the box. Use the `wzcbh_languages` filter to add or remove entries from the language picker — note the corresponding Prism.js grammar must also be available on the frontend.
106101

107102
__Does Prism.js load on every page?__
108-
No. Assets are only enqueued on pages containing at least one code block. Use `wz_cbh_force_load_assets` to override.
103+
No. Assets are only enqueued on pages containing at least one code block. Use `wzcbh_force_load_assets` to override.
109104

110105
__How do I highlight specific lines?__
111106
Enter a comma-separated list of lines or ranges in the __Highlight Lines__ field in the sidebar (e.g. `1,3-5,8`).

includes/admin/class-admin-notices-api.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Admin_Notices_API {
3838
*
3939
* @param string $prefix Plugin prefix for AJAX actions, nonces, and storage keys. Default 'wzkb'.
4040
*/
41-
public function __construct( string $prefix = 'wz_cbh' ) {
41+
public function __construct( string $prefix = 'wzcbh' ) {
4242
$this->prefix = $prefix;
4343

4444
Hook_Registry::add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
@@ -58,7 +58,7 @@ public function enqueue_scripts() {
5858
$handle,
5959
plugins_url( "js/admin-notices{$minimize}.js", __FILE__ ),
6060
array( 'jquery' ),
61-
WZ_CBH_VERSION,
61+
WZCBH_VERSION,
6262
true
6363
);
6464

includes/admin/class-admin.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function __construct() {
6868
$this->settings_wizard = new Settings_Wizard();
6969
$this->admin_banner = new Admin_Banner( $this->get_admin_banner_config() );
7070

71-
Hook_Registry::add_filter( 'plugin_action_links_' . plugin_basename( WZ_CBH_PLUGIN_FILE ), array( $this, 'plugin_action_links' ) );
71+
Hook_Registry::add_filter( 'plugin_action_links_' . plugin_basename( WZCBH_PLUGIN_FILE ), array( $this, 'plugin_action_links' ) );
7272
}
7373

7474
/**
@@ -82,7 +82,7 @@ public function __construct() {
8282
public function plugin_action_links( array $links ): array {
8383
$settings_link = sprintf(
8484
'<a href="%s">%s</a>',
85-
esc_url( admin_url( 'options-general.php?page=wz_cbh_settings' ) ),
85+
esc_url( admin_url( 'options-general.php?page=wzcbh_settings' ) ),
8686
esc_html__( 'Settings', 'webberzone-code-block-highlighting' )
8787
);
8888

@@ -101,12 +101,12 @@ public function plugin_action_links( array $links ): array {
101101
private function get_admin_banner_config(): array {
102102
return array(
103103
'capability' => 'manage_options',
104-
'prefix' => 'wz-cbh',
104+
'prefix' => 'wzcbh',
105105
'screen_ids' => array(
106-
'settings_page_wz_cbh_settings',
106+
'settings_page_wzcbh_settings',
107107
),
108108
'page_slugs' => array(
109-
'wz_cbh_settings',
109+
'wzcbh_settings',
110110
),
111111
'strings' => array(
112112
'region_label' => esc_html__( 'Code Block Highlighting quick links', 'webberzone-code-block-highlighting' ),
@@ -118,9 +118,9 @@ private function get_admin_banner_config(): array {
118118
'sections' => array(
119119
'settings' => array(
120120
'label' => esc_html__( 'Settings', 'webberzone-code-block-highlighting' ),
121-
'url' => admin_url( 'admin.php?page=wz_cbh_settings' ),
122-
'screen_ids' => array( 'settings_page_wz_cbh_settings' ),
123-
'page_slugs' => array( 'wz_cbh_settings' ),
121+
'url' => admin_url( 'admin.php?page=wzcbh_settings' ),
122+
'screen_ids' => array( 'settings_page_wzcbh_settings' ),
123+
'page_slugs' => array( 'wzcbh_settings' ),
124124
),
125125
'plugins' => array(
126126
'label' => esc_html__( 'WebberZone Plugins', 'webberzone-code-block-highlighting' ),

includes/admin/class-settings-wizard.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ class Settings_Wizard extends Settings_Wizard_API {
3232
* @since 1.1.0
3333
*/
3434
public function __construct() {
35-
$settings_key = 'wz_cbh_settings';
36-
$prefix = 'wz_cbh';
35+
$settings_key = 'wzcbh_settings';
36+
$prefix = 'wzcbh';
3737

3838
$args = array(
3939
'steps' => $this->get_wizard_steps(),
4040
'translation_strings' => $this->get_translation_strings(),
41-
'page_slug' => 'wz_cbh_wizard',
41+
'page_slug' => 'wzcbh_wizard',
4242
'menu_args' => array(
43-
'parent' => 'wz_cbh_settings',
43+
'parent' => 'wzcbh_settings',
4444
'capability' => 'manage_options',
4545
),
4646
);
@@ -114,7 +114,7 @@ public function get_wizard_steps() {
114114
*
115115
* @param array $steps Wizard steps.
116116
*/
117-
return apply_filters( 'wz_cbh_wizard_steps', $steps ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
117+
return apply_filters( 'wzcbh_wizard_steps', $steps ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
118118
}
119119

120120
/**
@@ -148,18 +148,18 @@ public function get_translation_strings() {
148148
* @since 1.1.0
149149
*/
150150
public function register_wizard_notice() {
151-
$wz_cbh = \WebberZone\Code_Block_Highlighting\Main::get_instance();
152-
if ( ! isset( $wz_cbh->admin->admin_notices_api ) ) {
151+
$wzcbh = \WebberZone\Code_Block_Highlighting\Main::get_instance();
152+
if ( ! isset( $wzcbh->admin->admin_notices_api ) ) {
153153
return;
154154
}
155155

156-
$wz_cbh->admin->admin_notices_api->register_notice(
156+
$wzcbh->admin->admin_notices_api->register_notice(
157157
array(
158-
'id' => 'wz_cbh_wizard_notice',
158+
'id' => 'wzcbh_wizard_notice',
159159
'message' => sprintf(
160160
'<p>%s</p><p><a href="%s" class="button button-primary">%s</a></p>',
161161
esc_html__( 'Welcome to Code Block Highlighting! Would you like to run the setup wizard to configure the plugin?', 'webberzone-code-block-highlighting' ),
162-
esc_url( admin_url( 'admin.php?page=wz_cbh_wizard' ) ),
162+
esc_url( admin_url( 'admin.php?page=wzcbh_wizard' ) ),
163163
esc_html__( 'Run Setup Wizard', 'webberzone-code-block-highlighting' )
164164
),
165165
'type' => 'info',
@@ -170,9 +170,9 @@ function () {
170170
$page = sanitize_key( (string) filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) );
171171

172172
return ! $this->is_wizard_completed() &&
173-
! get_option( 'wz_cbh_wizard_notice_dismissed', false ) &&
174-
( get_transient( 'wz_cbh_show_wizard_activation_redirect' ) || get_option( 'wz_cbh_show_wizard', false ) ) &&
175-
'wz_cbh_wizard' !== $page;
173+
! get_option( 'wzcbh_wizard_notice_dismissed', false ) &&
174+
( get_transient( 'wzcbh_show_wizard_activation_redirect' ) || get_option( 'wzcbh_show_wizard', false ) ) &&
175+
'wzcbh_wizard' !== $page;
176176
},
177177
),
178178
)
@@ -187,6 +187,6 @@ function () {
187187
* @return string Redirect URL.
188188
*/
189189
protected function get_completion_redirect_url() {
190-
return admin_url( 'admin.php?page=wz_cbh_settings' );
190+
return admin_url( 'admin.php?page=wzcbh_settings' );
191191
}
192192
}

includes/admin/class-settings.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,21 @@ class Settings {
5757
*
5858
* @var string
5959
*/
60-
public static string $prefix = 'wz_cbh';
60+
public static string $prefix = 'wzcbh';
6161

6262
/**
6363
* Settings key (option name in the DB).
6464
*
6565
* @var string
6666
*/
67-
public static string $settings_key = 'wz_cbh_settings';
67+
public static string $settings_key = 'wzcbh_settings';
6868

6969
/**
7070
* Menu slug for the settings page.
7171
*
7272
* @var string
7373
*/
74-
public static string $menu_slug = 'wz_cbh_settings';
74+
public static string $menu_slug = 'wzcbh_settings';
7575

7676
/**
7777
* Settings API instance.
@@ -321,18 +321,18 @@ public function enqueue_language_data( string $hook ): void {
321321
* @return string
322322
*/
323323
public static function get_color_scheme_css( bool $return_path = false ): string {
324-
$option = wz_cbh_get_option( 'color-scheme', 'prism-onedark' );
324+
$option = wzcbh_get_option( 'color-scheme', 'prism-onedark' );
325325
if ( ! array_key_exists( $option, self::$color_schemes ) ) {
326326
$option = 'prism-onedark';
327327
}
328328
$rel_path = "includes/assets/{$option}.css";
329329

330-
if ( ! file_exists( WZ_CBH_PLUGIN_DIR . $rel_path ) ) {
330+
if ( ! file_exists( WZCBH_PLUGIN_DIR . $rel_path ) ) {
331331
$rel_path = 'includes/assets/prism-onedark.css';
332332
}
333333

334334
if ( $return_path ) {
335-
return WZ_CBH_PLUGIN_DIR . $rel_path;
335+
return WZCBH_PLUGIN_DIR . $rel_path;
336336
}
337337

338338
/**
@@ -342,6 +342,6 @@ public static function get_color_scheme_css( bool $return_path = false ): string
342342
*
343343
* @param string $url Absolute URL of the CSS file to enqueue.
344344
*/
345-
return apply_filters( 'wz_cbh_color_scheme_css_url', WZ_CBH_PLUGIN_URL . $rel_path ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
345+
return apply_filters( 'wzcbh_color_scheme_css_url', WZCBH_PLUGIN_URL . $rel_path ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
346346
}
347347
}

includes/admin/settings/sidebar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@
7272
<h2 class="metabox-holder"><span><?php esc_html_e( 'Follow us', 'webberzone-code-block-highlighting' ); ?></span></h2>
7373

7474
<div class="inside" style="text-align: center">
75-
<a href="https://x.com/webberzone/" target="_blank"><img src="<?php echo esc_url( WZ_CBH_PLUGIN_URL . 'includes/admin/images/x.png' ); ?>" width="100" height="100" alt="X (Twitter)"></a>
76-
<a href="https://facebook.com/webberzone/" target="_blank"><img src="<?php echo esc_url( WZ_CBH_PLUGIN_URL . 'includes/admin/images/fb.png' ); ?>" width="100" height="100" alt="Facebook"></a>
75+
<a href="https://x.com/webberzone/" target="_blank"><img src="<?php echo esc_url( WZCBH_PLUGIN_URL . 'includes/admin/images/x.png' ); ?>" width="100" height="100" alt="X (Twitter)"></a>
76+
<a href="https://facebook.com/webberzone/" target="_blank"><img src="<?php echo esc_url( WZCBH_PLUGIN_URL . 'includes/admin/images/fb.png' ); ?>" width="100" height="100" alt="Facebook"></a>
7777
</div><!-- /.inside -->
7878
</div><!-- /.postbox -->
7979
</div>

includes/admin/sidebar.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
?>
1414
<div class="postbox-container">
15-
<a href="https://wzn.io/donate-wz" target="_blank" rel="noopener noreferrer"><img src="<?php echo esc_url( WZ_CBH_PLUGIN_URL . 'includes/admin/images/support.webp' ); ?>" alt="<?php esc_attr_e( 'Support WebberZone Code Block Highlighting', 'webberzone-code-block-highlighting' ); ?>" style="max-width: 100%; height: auto;"></a>
15+
<a href="https://wzn.io/donate-wz" target="_blank" rel="noopener noreferrer"><img src="<?php echo esc_url( WZCBH_PLUGIN_URL . 'includes/admin/images/support.webp' ); ?>" alt="<?php esc_attr_e( 'Support WebberZone Code Block Highlighting', 'webberzone-code-block-highlighting' ); ?>" style="max-width: 100%; height: auto;"></a>
1616

1717
<div id="qlinksdiv" class="postbox meta-box-sortables">
1818
<h2 class="metabox-holder"><span><?php esc_html_e( 'Quick links', 'webberzone-code-block-highlighting' ); ?></span></h2>
@@ -75,8 +75,8 @@
7575
<h2 class="metabox-holder"><span><?php esc_html_e( 'Follow us', 'webberzone-code-block-highlighting' ); ?></span></h2>
7676

7777
<div class="inside" style="text-align: center">
78-
<a href="https://x.com/webberzone/" target="_blank" rel="noopener noreferrer"><img src="<?php echo esc_url( WZ_CBH_PLUGIN_URL . 'includes/admin/images/x.png' ); ?>" width="100" height="100" alt="X (Twitter)"></a>
79-
<a href="https://facebook.com/webberzone/" target="_blank" rel="noopener noreferrer"><img src="<?php echo esc_url( WZ_CBH_PLUGIN_URL . 'includes/admin/images/fb.png' ); ?>" width="100" height="100" alt="Facebook"></a>
78+
<a href="https://x.com/webberzone/" target="_blank" rel="noopener noreferrer"><img src="<?php echo esc_url( WZCBH_PLUGIN_URL . 'includes/admin/images/x.png' ); ?>" width="100" height="100" alt="X (Twitter)"></a>
79+
<a href="https://facebook.com/webberzone/" target="_blank" rel="noopener noreferrer"><img src="<?php echo esc_url( WZCBH_PLUGIN_URL . 'includes/admin/images/fb.png' ); ?>" width="100" height="100" alt="Facebook"></a>
8080
</div><!-- /.inside -->
8181
</div><!-- /.postbox -->
8282
</div>

0 commit comments

Comments
 (0)