Skip to content
Merged
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
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
=== GPSE Search ===
=== ACLabs Search for Google Custom Search ===
Contributors: ACLabs
Tags: search, google, gcse, programmable search, cse
Requires at least: 6.4
Expand All @@ -8,24 +8,24 @@ Requires PHP: 8.2
License: AGPL v3 or later
License URI: https://www.gnu.org/licenses/agpl-3.0.html

Redirects WordPress searches to display Google Programmable Search Engine (GCSE) results.
Redirects WordPress searches to display Google Custom Search results.

## Features

- **Seamless Integration**: Works with the standard WordPress Search block or your theme's search form.
- **Search Results Page**: Redirects all searches to a dedicated page of your choice.
- **Configurable**: Easy settings to add your Search Engine ID (CX) and select the results page.
- **Google-Powered Results**: Display Google CSE results using the GPSE Search Results block or `[gpse_results]` shortcode.
- **Google-Powered Results**: Display Google Custom Search results using the Google Custom Search Results block or `[gpse_results]` shortcode.

## Installation & Setup

1. **Install the Plugin**: Upload the `gpse` folder to your `/wp-content/plugins/` directory and activate it.
2. **Create a Results Page**:
* Create a new Page in WordPress (e.g., "Search Results").
* Add the **GPSE Search Results** block (or the `[gpse_results]` shortcode) to the page content.
* Add the **Google Custom Search Results** block (or the `[gpse_results]` shortcode) to the page content.
* Publish the page.
3. **Configure**:
* Go to **Settings > GPSE**.
* Go to **Settings > ACLabs Search**.
* Enter your **Google Search Engine ID (CX)**. (Get this from [programmablesearchengine.google.com](https://programmablesearchengine.google.com/)).
* Select your "Search Results" page from the dropdown.
* Save Changes.
Expand All @@ -37,4 +37,4 @@ Redirects WordPress searches to display Google Programmable Search Engine (GCSE)

* **Search Box**: Use the standard WordPress Search block or your theme's search form to allow users to search your site.
* **Redirection**: When a user searches (e.g., `/?s=myquery`), they are automatically redirected to your custom Results Page (e.g., `/search-results/?q=myquery`).
* **Google CSE Results**: The Results Page displays Google-powered search results using your configured Google Programmable Search Engine.
* **Google Custom Search Results**: The Results Page displays Google Custom Search results using your configured search engine.
4 changes: 2 additions & 2 deletions gpse/gpse.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Plugin Name: GPSE Search
* Description: Redirects WordPress searches to display Google Programmable Search Engine (GCSE) results.
* Plugin Name: ACLabs Search for Google Custom Search
* Description: Redirects WordPress searches to display Google Custom Search results.
* Version: 1.2.5
* Author: ACLabs
* Text Domain: gpse
Expand Down
18 changes: 9 additions & 9 deletions gpse/includes/class-wp-gpse-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}

/**
* GPSE Admin Settings Class
* ACLabs Search Admin Settings Class
*
* Handles all admin-related functionality including settings page,
* option registration, and admin interface rendering.
Expand Down Expand Up @@ -48,16 +48,16 @@ public function add_settings_link( $links ) {
/**
* Add plugin settings page to WordPress admin menu.
*
* Registers the GPSE settings page under Settings > GPSE in the
* Registers the ACLabs Search settings page under Settings > ACLabs Search in the
* WordPress admin menu. Requires 'manage_options' capability.
*
* @since 1.0.0
* @return void
*/
public function add_plugin_page() {
add_options_page(
esc_html__( 'GPSE Settings', 'gpse' ),
esc_html__( 'GPSE', 'gpse' ),
esc_html__( 'ACLabs Search Settings', 'gpse' ),
esc_html__( 'ACLabs Search', 'gpse' ),
'manage_options',
'gpse',
array( $this, 'create_admin_page' )
Expand All @@ -67,7 +67,7 @@ public function add_plugin_page() {
/**
* Render the admin settings page.
*
* Outputs the HTML for the GPSE settings page, including the form
* Outputs the HTML for the ACLabs Search settings page, including the form
* fields for CX ID, results page selection, and autocomplete margin.
*
* @since 1.0.0
Expand All @@ -80,7 +80,7 @@ public function create_admin_page() {
}
?>
<div class="wrap">
<h1><?php echo esc_html__( 'GPSE Search', 'gpse' ); ?></h1>
<h1><?php echo esc_html__( 'ACLabs Search for Google Custom Search', 'gpse' ); ?></h1>
<form method="post" action="options.php">
<?php
// settings_fields() handles nonce generation and verification automatically
Expand Down Expand Up @@ -168,14 +168,14 @@ public function page_init() {
/**
* Display settings section description.
*
* Outputs introductory text for the GPSE configuration section,
* Outputs introductory text for the ACLabs Search configuration section,
* displayed above the settings fields.
*
* @since 1.0.0
* @return void
*/
public function section_info() {
echo esc_html__( 'Enter your Google Programmable Search Engine details below.', 'gpse' );
echo esc_html__( 'Enter your Google Custom Search Engine details below.', 'gpse' );
}

/**
Expand All @@ -191,7 +191,7 @@ public function cx_id_callback() {
$cx_id = get_option( 'wp_gpse_cx_id' );
?>
<input type="text" name="wp_gpse_cx_id" value="<?php echo esc_attr( $cx_id ); ?>" class="regular-text" />
<p class="description"><?php echo esc_html__( 'You can find this in your Google Programmable Search Engine control panel.', 'gpse' ); ?></p>
<p class="description"><?php echo esc_html__( 'You can find this in your Google Custom Search Engine control panel.', 'gpse' ); ?></p>
<?php
}

Expand Down
4 changes: 2 additions & 2 deletions gpse/includes/class-wp-gpse-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}

/**
* GPSE Gutenberg Blocks Class
* ACLabs Search Gutenberg Blocks Class
*
* Handles registration and rendering of Gutenberg blocks for search form
* and search results display.
Expand All @@ -17,7 +17,7 @@ class WP_GPSE_Blocks {
/**
* Initialize Gutenberg blocks functionality.
*
* Hooks into WordPress 'init' action to register the GPSE blocks
* Hooks into WordPress 'init' action to register the ACLabs Search blocks
* for use in the block editor.
*
* @since 1.1.0
Expand Down
8 changes: 4 additions & 4 deletions gpse/includes/class-wp-gpse-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
}

/**
* GPSE Frontend Class
* ACLabs Search Frontend Class
*
* Handles all frontend functionality including shortcodes, search redirection,
* and Google CSE script/style enqueuing.
* and Google Custom Search script/style enqueuing.
*
* @since 1.0.0
*/
Expand Down Expand Up @@ -39,7 +39,7 @@ public function init() {
/**
* Enqueue plugin styles.
*
* Loads the main GPSE stylesheet and optionally adds inline CSS for
* Loads the main ACLabs Search stylesheet and optionally adds inline CSS for
* custom autocomplete margin adjustment if configured.
*
* @since 1.0.0
Expand Down Expand Up @@ -119,7 +119,7 @@ public function enqueue_init_script() {
* Redirect native WordPress search to custom results page.
*
* Intercepts native WordPress search queries (?s=query) and redirects
* them to the configured GPSE results page with the query parameter 'q'.
* them to the configured ACLabs Search results page with the query parameter 'q'.
* Only runs on frontend search pages when a results page is configured.
*
* @since 1.0.0
Expand Down
4 changes: 2 additions & 2 deletions gpse/includes/class-wp-gpse-helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
}

/**
* GPSE Helper Functions Class
* ACLabs Search Helper Functions Class
*
* Provides shared utility methods for generating Google CSE HTML markup.
* Provides shared utility methods for generating Google Custom Search HTML markup.
* Used by both shortcodes and Gutenberg blocks to avoid code duplication.
*
* @since 1.1.0
Expand Down
24 changes: 13 additions & 11 deletions gpse/readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
=== GPSE Search ===
=== ACLabs Search for Google Custom Search ===
Contributors: ACLabs
Tags: search, google, gcse, programmable search, cse
Requires at least: 6.4
Expand All @@ -8,11 +8,11 @@ Requires PHP: 8.2
License: AGPL v3 or later
License URI: https://www.gnu.org/licenses/agpl-3.0.html

Redirects WordPress searches to display Google Programmable Search Engine (GCSE) results.
Redirects WordPress searches to display Google Custom Search results.

== Description ==

Redirects WordPress searches to display Google Programmable Search Engine (GCSE) results. Works seamlessly with the standard WordPress Search block or your theme's search form.
Redirects WordPress searches to display Google Custom Search results. Works seamlessly with the standard WordPress Search block or your theme's search form.

Source code is publicly available on [GitHub](https://github.com/ACLabs-Code/wp-gpse).

Expand All @@ -21,23 +21,23 @@ Source code is publicly available on [GitHub](https://github.com/ACLabs-Code/wp-
* **Seamless Integration**: Works with the standard WordPress Search block or your theme's search form.
* **Search Results Page**: Redirects all searches to a dedicated page of your choice.
* **Configurable**: Easy settings to add your Search Engine ID (CX) and select the results page.
* **Google-Powered Results**: Display Google CSE results using the GPSE Search Results block or `[gpse_results]` shortcode.
* **Google-Powered Results**: Display Google Custom Search results using the Google Custom Search Results block or `[gpse_results]` shortcode.

=== How it Works ===

* **Search Box**: Use the standard WordPress Search block or your theme's search form to allow users to search your site.
* **Redirection**: When a user searches (e.g., `/?s=myquery`), they are automatically redirected to your custom Results Page (e.g., `/search-results/?q=myquery`).
* **Google CSE Results**: The Results Page displays Google-powered search results using your configured Google Programmable Search Engine.
* **Google Custom Search Results**: The Results Page displays Google Custom Search results using your configured search engine.

== Installation ==

1. **Install the Plugin**: Upload the `gpse` folder to your `/wp-content/plugins/` directory and activate it.
2. **Create a Results Page**:
* Create a new Page in WordPress (e.g., "Search Results").
* Add the **GPSE Search Results** block (or the `[gpse_results]` shortcode) to the page content.
* Add the **Google Custom Search Results** block (or the `[gpse_results]` shortcode) to the page content.
* Publish the page.
3. **Configure**:
* Go to **Settings > GPSE**.
* Go to **Settings > ACLabs Search**.
* Enter your **Google Search Engine ID (CX)**. (Get this from [programmablesearchengine.google.com](https://programmablesearchengine.google.com/)).
* Select your "Search Results" page from the dropdown.
* Save Changes.
Expand All @@ -47,20 +47,22 @@ Source code is publicly available on [GitHub](https://github.com/ACLabs-Code/wp-

== Third-Party Services ==

This plugin relies on Google Programmable Search Engine, an external service provided by Google LLC. When a visitor views your configured search results page, their browser loads a JavaScript file from `cse.google.com` and search queries are sent to Google's servers to retrieve results.
This plugin relies on Google Custom Search Engine, an external service provided by Google LLC. When a visitor views your configured search results page, their browser loads a JavaScript file from `cse.google.com` and search queries are sent to Google's servers to retrieve results.

By using this plugin you agree to be bound by Google's Terms of Service and acknowledge their Privacy Policy:

* [Google Terms of Service](https://policies.google.com/terms)
* [Google Privacy Policy](https://policies.google.com/privacy)
* [Google Programmable Search Engine](https://programmablesearchengine.google.com/)
* [Google Custom Search Engine](https://programmablesearchengine.google.com/)

== Changelog ==

= 1.2.6 =
* Renamed plugin to "ACLabs Search for Google Custom Search".
* Standardized terminology to "Google Custom Search" throughout.
* Confirmed compatibility with WordPress 7.0.
* Fixed URL encoding of Google CSE CX ID (rawurlencode instead of esc_attr).
* Removed spurious version query string from Google CSE script URL.
* Fixed URL encoding of Google Custom Search Engine CX ID.
* Removed spurious version query string from Google Custom Search script URL.
* Added `role: content` to block.json for correct editability in WordPress 7.0 contentOnly patterns.

= 1.2.5 =
Expand Down
2 changes: 1 addition & 1 deletion gpse/src/search-results/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"apiVersion": 3,
"name": "gpse/search-results",
"version": "1.0.0",
"title": "GPSE Search Results",
"title": "Google Custom Search Results",
"category": "widgets",
"icon": "welcome-widgets-menus",
"description": "Google Programmable Search Engine results list.",
Expand Down
2 changes: 1 addition & 1 deletion gpse/src/search-results/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Edit = () => {
<div { ...blockProps }>
<div className="gpse-block-placeholder">
<span className="dashicons dashicons-welcome-widgets-menus"></span>
{ __( 'GPSE Search Results', 'gpse' ) }
{ __( 'Google Custom Search Results', 'gpse' ) }
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion gpse/src/search-results/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe( 'gpse/search-results block metadata', () => {
} );

it( 'has correct title', () => {
expect( metadata.title ).toBe( 'GPSE Search Results' );
expect( metadata.title ).toBe( 'Google Custom Search Results' );
} );

it( 'uses Block API v3', () => {
Expand Down
4 changes: 2 additions & 2 deletions gpse/uninstall.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* GPSE Search Uninstall Handler
* ACLabs Search Uninstall Handler
*
* Fired when the plugin is uninstalled (deleted, not just deactivated).
* Removes all plugin data from the WordPress database.
*
* @package GPSE_Search
* @package ACLabs_Search
* @since 1.1.0
*/

Expand Down