Skip to content

Commit

Permalink
BUGFIX: Options not set when merging array
Browse files Browse the repository at this point in the history
  • Loading branch information
freddiemixell committed Jul 7, 2019
1 parent 9999309 commit 39d25c2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions fm-google-site-search.php
Original file line number Diff line number Diff line change
Expand Up @@ -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+
Expand All @@ -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__ );

Expand Down
2 changes: 1 addition & 1 deletion includes/class-fm-google-site-search.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) )
);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
17 changes: 13 additions & 4 deletions public/class-fm-google-site-search-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand All @@ -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' );
Expand Down

0 comments on commit 39d25c2

Please sign in to comment.