Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .github/workflows/playground.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ jobs:
- name: Update plugin version with PR number
run: |
set -euxo pipefail
PLUGIN_FILE="${{ steps.prep.outputs.PKG_DIR }}/${{ github.event.repository.name }}.php"
# Find the main plugin file (contains "Plugin Name:" header).
PLUGIN_FILE=$(grep -rl "Plugin Name:" "${{ steps.prep.outputs.PKG_DIR }}"/*.php | head -1)
PR_NUMBER="${{ github.event.number }}"

# Extract current version
Expand Down
4 changes: 2 additions & 2 deletions .wordpress-org/blueprints/blueprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"networking": true
},
"plugins": [
"pp-glossary"
"your-glossary"
],
"steps": [
{
Expand All @@ -19,7 +19,7 @@
},
{
"step": "runPHP",
"code": "<?php require_once '/wordpress/wp-load.php'; update_option( 'pp_glossary_settings', array( 'glossary_page' => 10 ) ); ?>"
"code": "<?php require_once '/wordpress/wp-load.php'; update_option( 'your_glossary_settings', array( 'glossary_page' => 10 ) ); ?>"
}
]
}
24 changes: 12 additions & 12 deletions assets/css/glossary.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* Glossary Styles
*
* @package PP_Glossary
* @package Your_Glossary
*/

/* ==========================================================================
Screen Reader Only (visually hidden but accessible)
========================================================================== */

.pp-glossary-sr-only {
.your-glossary-sr-only {
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
Expand All @@ -28,7 +28,7 @@ dfn {
font-style: normal;
}

dfn.pp-glossary-term span {
dfn.your-glossary-term span {
color: inherit;
text-decoration: underline;
text-decoration-style: dotted;
Expand All @@ -42,12 +42,12 @@ dfn.pp-glossary-term span {
border-bottom: none;
}

dfn.pp-glossary-term span:hover,
dfn.pp-glossary-term span:focus {
dfn.your-glossary-term span:hover,
dfn.your-glossary-term span:focus {
text-decoration-color: var(--glossary-underline-hover-color, rgba(0, 0, 0, 0.7));
}

dfn.pp-glossary-term span:focus-visible {
dfn.your-glossary-term span:focus-visible {
outline: 2px solid var(--glossary-focus-color, #005a87);
outline-offset: 2px;
border-radius: 2px;
Expand All @@ -57,7 +57,7 @@ dfn.pp-glossary-term span:focus-visible {
Nested Glossary Links (within definitions)
========================================================================== */

.pp-glossary-link {
.your-glossary-link {
color: inherit;
text-decoration: underline;
text-decoration-style: dotted;
Expand All @@ -66,12 +66,12 @@ dfn.pp-glossary-term span:focus-visible {
text-underline-offset: 3px;
}

.pp-glossary-link:hover,
.pp-glossary-link:focus {
.your-glossary-link:hover,
.your-glossary-link:focus {
text-decoration-color: var(--glossary-underline-hover-color, rgba(0, 0, 0, 0.7));
}

.pp-glossary-link:focus-visible {
.your-glossary-link:focus-visible {
outline: 2px solid var(--glossary-focus-color, #005a87);
outline-offset: 2px;
border-radius: 2px;
Expand Down Expand Up @@ -146,7 +146,7 @@ aside[popover] > p a:focus-visible {
Glossary Block Styles
========================================================================== */

.pp-glossary-block {
.your-glossary-block {
margin: 2rem 0;
}

Expand Down Expand Up @@ -301,7 +301,7 @@ aside[popover] > p a:focus-visible {
display: none;
}

dfn.pp-glossary-term span {
dfn.your-glossary-term span {
text-decoration: none;
cursor: inherit;
}
Expand Down
16 changes: 8 additions & 8 deletions assets/js/admin.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* Admin synonyms management for Glossary entries.
*
* @package PP_Glossary
* @package Your_Glossary
*/

document.addEventListener( 'DOMContentLoaded', function () {
const addButton = document.getElementById( 'pp-glossary-add-synonym' );
const container = document.getElementById( 'pp-glossary-synonyms-container' );
const addButton = document.getElementById( 'your-glossary-add-synonym' );
const container = document.getElementById( 'your-glossary-synonyms-container' );

if ( ! addButton || ! container ) {
return;
Expand All @@ -19,19 +19,19 @@ document.addEventListener( 'DOMContentLoaded', function () {
e.preventDefault();

const row = document.createElement( 'div' );
row.className = 'pp-glossary-synonym-row';
row.className = 'your-glossary-synonym-row';
row.style.cssText = 'margin-bottom: 10px; display: flex; gap: 10px;';

const input = document.createElement( 'input' );
input.type = 'text';
input.name = 'pp_glossary_synonyms[]';
input.name = 'your_glossary_synonyms[]';
input.value = '';
input.className = 'regular-text';
input.placeholder = placeholder;

const button = document.createElement( 'button' );
button.type = 'button';
button.className = 'button pp-glossary-remove-synonym';
button.className = 'button your-glossary-remove-synonym';
button.textContent = removeText;

row.appendChild( input );
Expand All @@ -40,9 +40,9 @@ document.addEventListener( 'DOMContentLoaded', function () {
} );

container.addEventListener( 'click', function ( e ) {
if ( e.target.classList.contains( 'pp-glossary-remove-synonym' ) ) {
if ( e.target.classList.contains( 'your-glossary-remove-synonym' ) ) {
e.preventDefault();
e.target.closest( '.pp-glossary-synonym-row' ).remove();
e.target.closest( '.your-glossary-synonym-row' ).remove();
}
} );
} );
2 changes: 1 addition & 1 deletion assets/js/glossary.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Handles click and keyboard-based popover display and accessibility features.
*
* @package PP_Glossary
* @package Your_Glossary
*/

(function () {
Expand Down
4 changes: 2 additions & 2 deletions blocks/glossary-list/block.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "pp-glossary/glossary-list",
"name": "your-glossary/glossary-list",
"title": "Glossary List",
"category": "widgets",
"icon": "book-alt",
"description": "Display an alphabetical list of all glossary entries.",
"keywords": ["glossary", "terms", "definitions", "dictionary"],
"textdomain": "pp-glossary",
"textdomain": "your-glossary",
"supports": {
"html": false,
"align": ["wide", "full"]
Expand Down
8 changes: 4 additions & 4 deletions blocks/glossary-list/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
const { __ } = wp.i18n;
const { createElement: el } = wp.element;

registerBlockType('pp-glossary/glossary-list', {
registerBlockType('your-glossary/glossary-list', {
edit: function (props) {
return el(
'div',
{
className: 'pp-glossary-block-editor',
className: 'your-glossary-block-editor',
style: {
padding: '2rem',
backgroundColor: '#f9f9f9',
Expand All @@ -22,8 +22,8 @@
},
},
el('span', { className: 'dashicons dashicons-book-alt', style: { fontSize: '48px', color: '#0073aa' } }),
el('h3', {}, __('Glossary List', 'pp-glossary')),
el('p', {}, __('The glossary entries will be displayed here on the frontend.', 'pp-glossary'))
el('h3', {}, __('Glossary List', 'your-glossary')),
el('p', {}, __('The glossary entries will be displayed here on the frontend.', 'your-glossary'))
);
},

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "progress-planner/glossary",
"name": "progress-planner/your-glossary",
"description": "An accessible WordPress glossary plugin with auto-linking definitions, popovers, and structured data.",
"type": "wordpress-plugin",
"license": "GPL-2.0-or-later",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

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

18 changes: 9 additions & 9 deletions includes/class-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
/**
* Frontend Assets for Glossary.
*
* @package PP_Glossary
* @package Your_Glossary
*/

namespace PP_Glossary;
namespace Your_Glossary;

// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
Expand All @@ -30,22 +30,22 @@ public static function init(): void {
public static function enqueue_assets(): void {

// Only enqueue assets if terms have been found in the post content or on Glossary page.
if ( ! class_exists( '\\PP_Glossary\\Content_Filter' ) || ! Content_Filter::$terms_found_on_page ) {
if ( ! class_exists( '\\Your_Glossary\\Content_Filter' ) || ! Content_Filter::$terms_found_on_page ) {
return;
}

wp_enqueue_style(
'pp-glossary',
\PP_GLOSSARY_PLUGIN_URL . 'assets/css/glossary.css',
'your-glossary',
\YOUR_GLOSSARY_PLUGIN_URL . 'assets/css/glossary.css',
[],
\PP_GLOSSARY_VERSION
\YOUR_GLOSSARY_VERSION
);

wp_enqueue_script(
'pp-glossary',
\PP_GLOSSARY_PLUGIN_URL . 'assets/js/glossary.js',
'your-glossary',
\YOUR_GLOSSARY_PLUGIN_URL . 'assets/js/glossary.js',
[],
\PP_GLOSSARY_VERSION,
\YOUR_GLOSSARY_VERSION,
[
'strategy' => 'defer',
]
Expand Down
32 changes: 16 additions & 16 deletions includes/class-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
/**
* Block Registration for Glossary
*
* @package PP_Glossary
* @package Your_Glossary
*/

namespace PP_Glossary;
namespace Your_Glossary;

// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
Expand All @@ -30,18 +30,18 @@ public static function init(): void {
public static function register_blocks(): void {
// Register the editor script.
wp_register_script(
'pp-glossary-block-editor',
PP_GLOSSARY_PLUGIN_URL . 'blocks/glossary-list/editor.js',
'your-glossary-block-editor',
YOUR_GLOSSARY_PLUGIN_URL . 'blocks/glossary-list/editor.js',
[ 'wp-blocks', 'wp-element', 'wp-block-editor', 'wp-components', 'wp-i18n' ],
PP_GLOSSARY_VERSION,
YOUR_GLOSSARY_VERSION,
true
);

// Register the block type.
register_block_type(
PP_GLOSSARY_PLUGIN_DIR . 'blocks/glossary-list',
YOUR_GLOSSARY_PLUGIN_DIR . 'blocks/glossary-list',
[
'editor_script' => 'pp-glossary-block-editor',
'editor_script' => 'your-glossary-block-editor',
'render_callback' => [ __CLASS__, 'render_glossary_list_block' ],
]
);
Expand All @@ -65,19 +65,19 @@ public static function render_glossary_list_block() {

ob_start();
?>
<div class="pp-glossary-block"<?php echo $schema_attrs; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div class="your-glossary-block"<?php echo $schema_attrs; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php if ( ! empty( $grouped_entries ) ) : ?>
<?php
// Hidden schema name for microdata.
if ( $use_microdata && $glossary_page_id ) {
echo '<meta itemprop="name" content="' . esc_attr( get_the_title( $glossary_page_id ) ) . '">';
}
?>
<nav class="glossary-navigation" aria-label="<?php esc_attr_e( 'Glossary alphabet navigation', 'pp-glossary' ); ?>">
<nav class="glossary-navigation" aria-label="<?php esc_attr_e( 'Glossary alphabet navigation', 'your-glossary' ); ?>">
<ul class="glossary-alphabet">
<?php foreach ( $grouped_entries as $letter => $entries ) : ?>
<li>
<a href="#letter-<?php echo esc_attr( pp_glossary_strtolower( $letter ) ); ?>">
<a href="#letter-<?php echo esc_attr( your_glossary_strtolower( $letter ) ); ?>">
<?php echo esc_html( $letter ); ?>
</a>
</li>
Expand All @@ -87,7 +87,7 @@ public static function render_glossary_list_block() {

<div class="glossary-entries">
<?php foreach ( $grouped_entries as $letter => $entries ) : ?>
<section class="glossary-letter-section" id="letter-<?php echo esc_attr( pp_glossary_strtolower( $letter ) ); ?>">
<section class="glossary-letter-section" id="letter-<?php echo esc_attr( your_glossary_strtolower( $letter ) ); ?>">
<h3 class="glossary-letter-heading"><?php echo esc_html( $letter ); ?></h3>

<?php foreach ( $entries as $entry ) : ?>
Expand All @@ -105,14 +105,14 @@ public static function render_glossary_list_block() {
<?php if ( current_user_can( 'edit_post', $entry['id'] ) ) : ?>
<p class="glossary-edit-link">
<a href="<?php echo esc_url( get_edit_post_link( $entry['id'] ) ); ?>">
<?php esc_html_e( 'Edit', 'pp-glossary' ); ?>
<?php esc_html_e( 'Edit', 'your-glossary' ); ?>
</a>
</p>
<?php endif; ?>

<?php if ( ! empty( $entry['synonyms'] ) ) : ?>
<div class="glossary-synonyms">
<span class="synonyms-label"><?php esc_html_e( 'Also known as:', 'pp-glossary' ); ?></span>
<span class="synonyms-label"><?php esc_html_e( 'Also known as:', 'your-glossary' ); ?></span>
<span><?php echo esc_html( implode( ', ', $entry['synonyms'] ) ); ?></span>
<?php
// Output multiple meta tags for Microdata (array of alternateName).
Expand Down Expand Up @@ -142,7 +142,7 @@ public static function render_glossary_list_block() {
</div>

<?php else : ?>
<p><?php esc_html_e( 'No glossary entries found.', 'pp-glossary' ); ?></p>
<p><?php esc_html_e( 'No glossary entries found.', 'your-glossary' ); ?></p>
<?php endif; ?>
</div>
<?php
Expand All @@ -156,10 +156,10 @@ public static function render_glossary_list_block() {
*/
private static function get_grouped_entries(): array {
$grouped = [];
$entries = pp_glossary_get_entries();
$entries = your_glossary_get_entries();

foreach ( $entries as $entry ) {
$letter = pp_glossary_strtoupper( pp_glossary_substr( $entry['title'], 0, 1 ) );
$letter = your_glossary_strtoupper( your_glossary_substr( $entry['title'], 0, 1 ) );

// Handle numbers and special characters.
// Match Latin (including extended), Cyrillic, and Greek letters.
Expand Down
Loading
Loading