Plugin Directory

Changeset 3284129


Ignore:
Timestamp:
04/29/2025 01:18:20 PM (9 months ago)
Author:
rtcamp
Message:

Update to version 1.2.3 from GitHub

Location:
search-with-google
Files:
20 edited
1 copied

Legend:

Unmodified
Added
Removed
  • search-with-google/tags/1.2.3/inc/classes/class-assets.php

    r3013212 r3284129  
    2323
    2424        $this->setup_hooks();
    25 
    2625    }
    2726
     
    3433
    3534        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) );
    36 
    3735    }
    3836
  • search-with-google/tags/1.2.3/inc/classes/class-notice.php

    r3013212 r3284129  
    2323
    2424        $this->setup_hooks();
    25 
    2625    }
    2726
     
    3736         */
    3837        add_action( 'admin_notices', array( $this, 'display_notice' ) );
    39 
    4038    }
    4139
     
    7472        </div>
    7573        <?php
    76 
    7774    }
    7875}
  • search-with-google/tags/1.2.3/inc/classes/class-plugin.php

    r3013212 r3284129  
    2727        Search::get_instance();
    2828        Notice::get_instance();
    29 
    3029    }
    31 
    3230}
  • search-with-google/tags/1.2.3/inc/classes/class-search-engine.php

    r3013212 r3284129  
    3737
    3838        $this->init();
    39 
    4039    }
    4140
     
    4948        $this->api_key = get_option( 'gcs_api_key' );
    5049        $this->cse_id  = get_option( 'gcs_cse_id' );
    51 
    5250    }
    5351
     
    106104        } elseif ( 200 !== $response_code ) {
    107105            return new \WP_Error( $response_code, __( 'Unknown error occurred', 'search-with-google' ) );
    108         } else {
     106        } elseif ( ! is_wp_error( $response ) ) {
    109107
    110             if ( ! is_wp_error( $response ) ) {
    111108
    112109                $response_body = wp_remote_retrieve_body( $response );
    113110                $result        = json_decode( $response_body );
    114111
    115                 if ( ! is_wp_error( $result ) ) {
     112            if ( ! is_wp_error( $result ) ) {
    116113
    117                     if ( isset( $result->searchInformation->totalResults ) && isset( $result->items ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
     114                if ( isset( $result->searchInformation->totalResults ) && isset( $result->items ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
    118115
    119                         $total_results = (int) $result->searchInformation->totalResults; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
     116                    $total_results = (int) $result->searchInformation->totalResults; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
    120117
    121                         // If no results found and pagination request then try another request.
    122                         if ( 0 === $total_results && $page > 1 ) {
    123                             return $this->get_search_results( $search_query, $page - 1, $posts_per_page );
    124                         }
     118                    // If no results found and pagination request then try another request.
     119                    if ( 0 === $total_results && $page > 1 ) {
     120                        return $this->get_search_results( $search_query, $page - 1, $posts_per_page );
     121                    }
    125122
    126                         if ( ! empty( $result->items ) ) {
    127                             foreach ( $result->items as $item ) {
     123                    if ( ! empty( $result->items ) ) {
     124                        foreach ( $result->items as $item ) {
    128125
    129                                 $item_detail['title']   = $item->title;
    130                                 $item_detail['link']    = $item->link;
    131                                 $item_detail['snippet'] = $item->snippet;
     126                            $item_detail['title']   = $item->title;
     127                            $item_detail['link']    = $item->link;
     128                            $item_detail['snippet'] = $item->snippet;
    132129
    133                                 $item_details[] = $item_detail;
    134                             }
     130                            $item_details[] = $item_detail;
    135131                        }
    136132                    }
    137                 } else {
    138                     return new \WP_Error( $response_code, __( 'Unknown error occurred', 'search-with-google' ) );
    139133                }
     134            } else {
     135                return new \WP_Error( $response_code, __( 'Unknown error occurred', 'search-with-google' ) );
    140136            }
    141137        }
     
    158154
    159155        return ( $page * $posts_per_page ) - ( $posts_per_page - 1 );
    160 
    161156    }
    162157
     
    176171
    177172        return $api_url;
    178 
    179173    }
    180174}
  • search-with-google/tags/1.2.3/inc/classes/class-search.php

    r3013212 r3284129  
    2323
    2424        $this->setup_hooks();
    25 
    2625    }
    2726
     
    3837        add_filter( 'posts_pre_query', array( $this, 'filter_search_query' ), 10, 2 );
    3938        add_filter( 'page_link', array( $this, 'update_permalink' ), 10, 2 );
    40 
    4139    }
    4240
     
    8684
    8785        return $posts;
    88 
    8986    }
    9087
     
    10198
    10299        return 'gcs_results_' . sanitize_title( $search_query ) . '_' . $page . '_' . $posts_per_page;
    103 
    104100    }
    105101
     
    122118
    123119        return $posts;
    124 
    125120    }
    126121
     
    152147        // Convert to WP_Post object.
    153148        return new \WP_Post( $post );
    154 
    155149    }
    156150
     
    167161
    168162        return ltrim( $url_parse['path'], '/' );
    169 
    170163    }
    171164
     
    187180
    188181        return $permalink;
    189 
    190182    }
    191183}
  • search-with-google/tags/1.2.3/inc/classes/class-settings.php

    r3013212 r3284129  
    2323
    2424        $this->setup_hooks();
    25 
    2625    }
    2726    /**
     
    3332
    3433        add_action( 'admin_init', array( $this, 'register_settings' ) );
    35 
    3634    }
    3735
     
    8583            'cse_settings_section'
    8684        );
    87 
    8885    }
    8986
     
    147144        </div>
    148145        <?php
    149 
    150146    }
    151147}
  • search-with-google/tags/1.2.3/inc/helpers/autoloader.php

    r2402707 r3284129  
    1111 * Auto loader function.
    1212 *
    13  * @param string $resource Source namespace.
     13 * @param string $loader_resource Source namespace.
    1414 *
    1515 * @return void
    1616 */
    17 function autoloader( $resource = '' ) {
     17function autoloader( $loader_resource = '' ) {
    1818
    19     $resource_path  = false;
    20     $namespace_root = 'RT\Search_With_Google\\';
    21     $resource       = trim( $resource, '\\' );
     19    $resource_path   = false;
     20    $namespace_root  = 'RT\Search_With_Google\\';
     21    $loader_resource = trim( $loader_resource, '\\' );
    2222
    23     if ( empty( $resource ) || strpos( $resource, '\\' ) === false || strpos( $resource, $namespace_root ) !== 0 ) {
     23    if ( empty( $loader_resource ) || strpos( $loader_resource, '\\' ) === false || strpos( $loader_resource, $namespace_root ) !== 0 ) {
    2424        // Not our namespace, bail out.
    2525        return;
     
    2727
    2828    // Remove our root namespace.
    29     $resource = str_replace( $namespace_root, '', $resource );
     29    $loader_resource = str_replace( $namespace_root, '', $loader_resource );
    3030
    3131    $path = explode(
    3232        '\\',
    33         str_replace( '_', '-', strtolower( $resource ) )
     33        str_replace( '_', '-', strtolower( $loader_resource ) )
    3434    );
    3535
     
    8181        require_once( $resource_path ); // phpcs:ignore
    8282    }
    83 
    8483}
    8584
  • search-with-google/tags/1.2.3/inc/traits/trait-singleton.php

    r3013212 r3284129  
    8484
    8585        return $instance[ $called_class ];
    86 
    8786    }
    88 
    8987} // End trait
  • search-with-google/tags/1.2.3/readme.txt

    r3231781 r3284129  
    44Tags: google, search, cse, custom search engine, programmable search, programmable search engine, google cse, google custom search engine, google programmable search, google programmable search engine, google search
    55Requires at least: 4.8
    6 Tested up to: 6.7.1
    7 Stable tag: 1.2.2
     6Tested up to: 6.8
     7Stable tag: 1.2.3
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    7070== Changelog ==
    7171
     72= 1.2.3 =
     73* Compatible with WordPress 6.8
     74
    7275= 1.2.2 =
    7376* Compatible with WordPress 6.7.1
     
    8790== Upgrade Notice ==
    8891
     92= 1.2.3 =
     93* Compatible with WordPress 6.8
     94
    8995= 1.2.2 =
    9096* Compatible with WordPress 6.7.1
    9197* Updates element selectors for automated testing
    92  
    93 = 1.1 =
    94 * Compatible with WordPress 6.4.2
    95 * Updated PHP code to be compatible with PHP 8.2
    96 * Fixed WordPress coding standards issues
    97 * Used VIP compatible code for WordPress VIP compatibility
    98 * Added support for the Custom JSON API
    99 * Added Deprecation notice for the Custom site-restricted JSON API
  • search-with-google/tags/1.2.3/search-with-google.php

    r3231781 r3284129  
    33 * Plugin Name: Search with Google
    44 * Description: Replace WordPress default search with Google Custom Search results.
    5  * Version:     1.2.2
     5 * Version:     1.2.3
    66 * Author:      rtCamp
    77 * Author URI:  https://rtCamp.com
  • search-with-google/trunk/inc/classes/class-assets.php

    r3013212 r3284129  
    2323
    2424        $this->setup_hooks();
    25 
    2625    }
    2726
     
    3433
    3534        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) );
    36 
    3735    }
    3836
  • search-with-google/trunk/inc/classes/class-notice.php

    r3013212 r3284129  
    2323
    2424        $this->setup_hooks();
    25 
    2625    }
    2726
     
    3736         */
    3837        add_action( 'admin_notices', array( $this, 'display_notice' ) );
    39 
    4038    }
    4139
     
    7472        </div>
    7573        <?php
    76 
    7774    }
    7875}
  • search-with-google/trunk/inc/classes/class-plugin.php

    r3013212 r3284129  
    2727        Search::get_instance();
    2828        Notice::get_instance();
    29 
    3029    }
    31 
    3230}
  • search-with-google/trunk/inc/classes/class-search-engine.php

    r3013212 r3284129  
    3737
    3838        $this->init();
    39 
    4039    }
    4140
     
    4948        $this->api_key = get_option( 'gcs_api_key' );
    5049        $this->cse_id  = get_option( 'gcs_cse_id' );
    51 
    5250    }
    5351
     
    106104        } elseif ( 200 !== $response_code ) {
    107105            return new \WP_Error( $response_code, __( 'Unknown error occurred', 'search-with-google' ) );
    108         } else {
     106        } elseif ( ! is_wp_error( $response ) ) {
    109107
    110             if ( ! is_wp_error( $response ) ) {
    111108
    112109                $response_body = wp_remote_retrieve_body( $response );
    113110                $result        = json_decode( $response_body );
    114111
    115                 if ( ! is_wp_error( $result ) ) {
     112            if ( ! is_wp_error( $result ) ) {
    116113
    117                     if ( isset( $result->searchInformation->totalResults ) && isset( $result->items ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
     114                if ( isset( $result->searchInformation->totalResults ) && isset( $result->items ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
    118115
    119                         $total_results = (int) $result->searchInformation->totalResults; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
     116                    $total_results = (int) $result->searchInformation->totalResults; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
    120117
    121                         // If no results found and pagination request then try another request.
    122                         if ( 0 === $total_results && $page > 1 ) {
    123                             return $this->get_search_results( $search_query, $page - 1, $posts_per_page );
    124                         }
     118                    // If no results found and pagination request then try another request.
     119                    if ( 0 === $total_results && $page > 1 ) {
     120                        return $this->get_search_results( $search_query, $page - 1, $posts_per_page );
     121                    }
    125122
    126                         if ( ! empty( $result->items ) ) {
    127                             foreach ( $result->items as $item ) {
     123                    if ( ! empty( $result->items ) ) {
     124                        foreach ( $result->items as $item ) {
    128125
    129                                 $item_detail['title']   = $item->title;
    130                                 $item_detail['link']    = $item->link;
    131                                 $item_detail['snippet'] = $item->snippet;
     126                            $item_detail['title']   = $item->title;
     127                            $item_detail['link']    = $item->link;
     128                            $item_detail['snippet'] = $item->snippet;
    132129
    133                                 $item_details[] = $item_detail;
    134                             }
     130                            $item_details[] = $item_detail;
    135131                        }
    136132                    }
    137                 } else {
    138                     return new \WP_Error( $response_code, __( 'Unknown error occurred', 'search-with-google' ) );
    139133                }
     134            } else {
     135                return new \WP_Error( $response_code, __( 'Unknown error occurred', 'search-with-google' ) );
    140136            }
    141137        }
     
    158154
    159155        return ( $page * $posts_per_page ) - ( $posts_per_page - 1 );
    160 
    161156    }
    162157
     
    176171
    177172        return $api_url;
    178 
    179173    }
    180174}
  • search-with-google/trunk/inc/classes/class-search.php

    r3013212 r3284129  
    2323
    2424        $this->setup_hooks();
    25 
    2625    }
    2726
     
    3837        add_filter( 'posts_pre_query', array( $this, 'filter_search_query' ), 10, 2 );
    3938        add_filter( 'page_link', array( $this, 'update_permalink' ), 10, 2 );
    40 
    4139    }
    4240
     
    8684
    8785        return $posts;
    88 
    8986    }
    9087
     
    10198
    10299        return 'gcs_results_' . sanitize_title( $search_query ) . '_' . $page . '_' . $posts_per_page;
    103 
    104100    }
    105101
     
    122118
    123119        return $posts;
    124 
    125120    }
    126121
     
    152147        // Convert to WP_Post object.
    153148        return new \WP_Post( $post );
    154 
    155149    }
    156150
     
    167161
    168162        return ltrim( $url_parse['path'], '/' );
    169 
    170163    }
    171164
     
    187180
    188181        return $permalink;
    189 
    190182    }
    191183}
  • search-with-google/trunk/inc/classes/class-settings.php

    r3013212 r3284129  
    2323
    2424        $this->setup_hooks();
    25 
    2625    }
    2726    /**
     
    3332
    3433        add_action( 'admin_init', array( $this, 'register_settings' ) );
    35 
    3634    }
    3735
     
    8583            'cse_settings_section'
    8684        );
    87 
    8885    }
    8986
     
    147144        </div>
    148145        <?php
    149 
    150146    }
    151147}
  • search-with-google/trunk/inc/helpers/autoloader.php

    r2402707 r3284129  
    1111 * Auto loader function.
    1212 *
    13  * @param string $resource Source namespace.
     13 * @param string $loader_resource Source namespace.
    1414 *
    1515 * @return void
    1616 */
    17 function autoloader( $resource = '' ) {
     17function autoloader( $loader_resource = '' ) {
    1818
    19     $resource_path  = false;
    20     $namespace_root = 'RT\Search_With_Google\\';
    21     $resource       = trim( $resource, '\\' );
     19    $resource_path   = false;
     20    $namespace_root  = 'RT\Search_With_Google\\';
     21    $loader_resource = trim( $loader_resource, '\\' );
    2222
    23     if ( empty( $resource ) || strpos( $resource, '\\' ) === false || strpos( $resource, $namespace_root ) !== 0 ) {
     23    if ( empty( $loader_resource ) || strpos( $loader_resource, '\\' ) === false || strpos( $loader_resource, $namespace_root ) !== 0 ) {
    2424        // Not our namespace, bail out.
    2525        return;
     
    2727
    2828    // Remove our root namespace.
    29     $resource = str_replace( $namespace_root, '', $resource );
     29    $loader_resource = str_replace( $namespace_root, '', $loader_resource );
    3030
    3131    $path = explode(
    3232        '\\',
    33         str_replace( '_', '-', strtolower( $resource ) )
     33        str_replace( '_', '-', strtolower( $loader_resource ) )
    3434    );
    3535
     
    8181        require_once( $resource_path ); // phpcs:ignore
    8282    }
    83 
    8483}
    8584
  • search-with-google/trunk/inc/traits/trait-singleton.php

    r3013212 r3284129  
    8484
    8585        return $instance[ $called_class ];
    86 
    8786    }
    88 
    8987} // End trait
  • search-with-google/trunk/readme.txt

    r3231781 r3284129  
    44Tags: google, search, cse, custom search engine, programmable search, programmable search engine, google cse, google custom search engine, google programmable search, google programmable search engine, google search
    55Requires at least: 4.8
    6 Tested up to: 6.7.1
    7 Stable tag: 1.2.2
     6Tested up to: 6.8
     7Stable tag: 1.2.3
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    7070== Changelog ==
    7171
     72= 1.2.3 =
     73* Compatible with WordPress 6.8
     74
    7275= 1.2.2 =
    7376* Compatible with WordPress 6.7.1
     
    8790== Upgrade Notice ==
    8891
     92= 1.2.3 =
     93* Compatible with WordPress 6.8
     94
    8995= 1.2.2 =
    9096* Compatible with WordPress 6.7.1
    9197* Updates element selectors for automated testing
    92  
    93 = 1.1 =
    94 * Compatible with WordPress 6.4.2
    95 * Updated PHP code to be compatible with PHP 8.2
    96 * Fixed WordPress coding standards issues
    97 * Used VIP compatible code for WordPress VIP compatibility
    98 * Added support for the Custom JSON API
    99 * Added Deprecation notice for the Custom site-restricted JSON API
  • search-with-google/trunk/search-with-google.php

    r3231781 r3284129  
    33 * Plugin Name: Search with Google
    44 * Description: Replace WordPress default search with Google Custom Search results.
    5  * Version:     1.2.2
     5 * Version:     1.2.3
    66 * Author:      rtCamp
    77 * Author URI:  https://rtCamp.com
Note: See TracChangeset for help on using the changeset viewer.