diff --git a/fm-google-site-search.php b/fm-google-site-search.php index 1b1b71f..88b04d7 100755 --- a/fm-google-site-search.php +++ b/fm-google-site-search.php @@ -16,7 +16,7 @@ * Plugin Name: Easy Google Custom Search * Plugin URI: https://github.com/freddiemixell/wordpress-google-search * Description: This is a short description of what the plugin does. It's displayed in the WordPress admin area. - * Version: 1.0.0 + * Version: 1.1.1 * Author: Freddie Mixell * Author URI: https://github.com/freddiemixell * License: GPL-2.0+ @@ -35,7 +35,7 @@ * Start at version 1.0.0 and use SemVer - https://semver.org * Rename this for your plugin and update it as you release new versions. */ -define( 'FM_GOOGLE_SITE_SEARCH_VERSION', '1.1.0' ); +define( 'FM_GOOGLE_SITE_SEARCH_VERSION', '1.1.1' ); define( 'FM_GOOGLE_SITE_SEARCH_PATH', __DIR__ ); diff --git a/includes/class-fm-google-site-search.php b/includes/class-fm-google-site-search.php index 419d078..67b6b14 100755 --- a/includes/class-fm-google-site-search.php +++ b/includes/class-fm-google-site-search.php @@ -79,7 +79,7 @@ public function __construct() { $this->plugin_name = 'fm-google-site-search'; $this->textdomain = 'fm-google-site-search'; $this->options = array_merge( - get_option( 'google-options' ), + is_array(get_option( 'google-options' )) ? get_option( 'google-options' ) : array('api_key' => '', 'search_id' => ''), array( 'search_url_id' => get_option( 'fm-google-site-search-results-id' ) ) ); diff --git a/package.json b/package.json index 1b4ac15..90a8d63 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fm-google-site-search", - "version": "1.1.0", + "version": "1.1.1", "description": "WordPress Google Search", "main": "index.js", "license": "MIT", diff --git a/public/class-fm-google-site-search-public.php b/public/class-fm-google-site-search-public.php index a7de17e..ec6bb8a 100755 --- a/public/class-fm-google-site-search-public.php +++ b/public/class-fm-google-site-search-public.php @@ -75,6 +75,17 @@ public function redirect_search() { public function search_results() { + /* + Do we have our api key and cx? + If not don't display the form + */ + if ( + ! $this->options['api_key'] || + ! $this->options['search_id'] + ) { + return; + } + require_once( FM_GOOGLE_SITE_SEARCH_PATH . '/public/partials/fm-google-site-search-public-results.php'); } @@ -85,15 +96,13 @@ public function search_box() { */ if ( ! $this->options['api_key'] || - ! $this->options['search_id'] || - ! $this->options['search_url_id'] + ! $this->options['search_id'] ) { return; } $data = array( - 'textdomain' => $this->textdomain, - 'search_url_id' => $this->options['search_url_id'], + 'textdomain' => $this->textdomain ); require_once( FM_GOOGLE_SITE_SEARCH_PATH . '/public/partials/fm-google-site-search-public-display.php' );