Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Backward Compatibility #26

Merged
merged 1 commit into from
Dec 15, 2023
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
2 changes: 1 addition & 1 deletion inc/classes/class-notice.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ public function display_notice() {
<?php

}
}
}
2 changes: 1 addition & 1 deletion inc/classes/class-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ protected function __construct() {

}

}
}
10 changes: 5 additions & 5 deletions inc/classes/class-search-engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ class Search_Engine {
*
* @var string
*/
private string $api_key = '';
private $api_key = '';

/**
* Custom Search Engine ID.
*
* @var string
*/
private string $cse_id = '';
private $cse_id = '';

/**
* Construct method.
Expand All @@ -51,7 +51,7 @@ protected function __construct() {
*
* @return void
*/
protected function init(): void {
protected function init() {

$this->api_key = get_option( 'gcs_api_key' );
$this->cse_id = get_option( 'gcs_cse_id' );
Expand All @@ -67,7 +67,7 @@ protected function init(): void {
*
* @return array|\WP_Error Posts or false if empty or error.
*/
public function get_search_results( string $search_query, int $page = 1, int $posts_per_page = 10 ): \WP_Error|array {
public function get_search_results( $search_query, $page = 1, $posts_per_page = 10 ) {

$item_details = array();
$total_results = 0;
Expand Down Expand Up @@ -161,7 +161,7 @@ public function get_search_results( string $search_query, int $page = 1, int $po
*
* @return float|int
*/
public function get_start_index( int $page, int $posts_per_page ): float|int {
public function get_start_index( $page, $posts_per_page ) {

return ( $page * $posts_per_page ) - ( $posts_per_page - 1 );

Expand Down
14 changes: 7 additions & 7 deletions inc/classes/class-search.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected function __construct() {
*
* @return void
*/
protected function setup_hooks(): void {
protected function setup_hooks() {

/**
* Filters.
Expand All @@ -48,7 +48,7 @@ protected function setup_hooks(): void {
*
* @return array|null Modified posts.
*/
public function filter_search_query( array|null $posts, \WP_Query $query ): array|null {
public function filter_search_query( $posts, $query ) {

if ( ! $query->is_search || is_admin() ) {
return $posts;
Expand Down Expand Up @@ -97,7 +97,7 @@ public function filter_search_query( array|null $posts, \WP_Query $query ): arra
*
* @return string
*/
public function get_transient_key( string $search_query, int $page, int $posts_per_page ): string {
public function get_transient_key( $search_query, $page, $posts_per_page ) {

return 'gcs_results_' . sanitize_title( $search_query ) . '_' . $page . '_' . $posts_per_page;

Expand All @@ -110,7 +110,7 @@ public function get_transient_key( string $search_query, int $page, int $posts_p
*
* @return array
*/
public function get_posts( array $items ): array {
public function get_posts( $items ) {

$posts = array();

Expand All @@ -131,7 +131,7 @@ public function get_posts( array $items ): array {
*
* @return \WP_Post
*/
public function get_post( array $item ): \WP_Post {
public function get_post( $item ) {

$post_id = - wp_rand( 1, 99999 ); // Negative ID, to avoid clash with a valid post.
$post = new \stdClass();
Expand Down Expand Up @@ -161,7 +161,7 @@ public function get_post( array $item ): \WP_Post {
*
* @return string
*/
public function get_post_name( string $url ): string {
public function get_post_name( $url ) {

$url_parse = wp_parse_url( $url );

Expand All @@ -177,7 +177,7 @@ public function get_post_name( string $url ): string {
*
* @return string Updated permalink.
*/
public function update_permalink( string $permalink, int $post_id ): string {
public function update_permalink( $permalink, $post_id ) {

$post = get_post( $post_id );

Expand Down
10 changes: 5 additions & 5 deletions inc/classes/class-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected function __construct() {
*
* @return void
*/
protected function setup_hooks(): void {
protected function setup_hooks() {

add_action( 'admin_init', array( $this, 'register_settings' ) );

Expand All @@ -40,7 +40,7 @@ protected function setup_hooks(): void {
*
* @return void
*/
public function register_settings(): void {
public function register_settings() {

$args = array(
'type' => 'string',
Expand Down Expand Up @@ -82,15 +82,15 @@ public function register_settings(): void {
*
* @return void
*/
public function cse_settings_section_cb(): void {
public function cse_settings_section_cb() {
}

/**
* API Key field markup.
*
* @return void
*/
public function cse_api_key_field_cb(): void {
public function cse_api_key_field_cb() {
// Get the value of the setting we've registered with register_setting().
$setting = get_option( 'gcs_api_key' );
// Output the field.
Expand All @@ -104,7 +104,7 @@ public function cse_api_key_field_cb(): void {
*
* @return void
*/
public function cse_id_field_cb(): void {
public function cse_id_field_cb() {
// Get the value of the setting we've registered with register_setting().
$setting = get_option( 'gcs_cse_id' );
// Output the field.
Expand Down
2 changes: 1 addition & 1 deletion inc/helpers/autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @return void
*/
function autoloader( string $resource = '' ): void {
function autoloader( $resource = '' ) {

$resource_path = false;
$namespace_root = 'RT\Search_With_Google\\';
Expand Down
2 changes: 1 addition & 1 deletion search-with-google.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*
* @return void
*/
function search_with_google_plugin_loader(): void {
function search_with_google_plugin_loader() {
\RT\Search_With_Google\Inc\Plugin::get_instance();
}

Expand Down
Loading