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

PLUGINRANGERS-3053 | Solved an issue regarding force normalization with multilang #349

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: 12 additions & 0 deletions doofinder-for-woocommerce/assets/img/doofinder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions doofinder-for-woocommerce/doofinder-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: DOOFINDER Search and Discovery for WP & WooCommerce
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Version: 2.5.17
* Version: 2.5.18
* Requires at least: 5.6
* Requires PHP: 7.0
* Author: Doofinder
Expand Down Expand Up @@ -32,13 +32,15 @@
*/
class Doofinder_For_WordPress {

const PLUGIN_DIR = __DIR__;

/**
* Plugin version.
*
* @var string
*/

public static $version = '2.5.17';
public static $version = '2.5.18';

/**
* The only instance of Doofinder_For_WordPress
Expand Down
13 changes: 7 additions & 6 deletions doofinder-for-woocommerce/includes/api/class-store-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,17 @@ public function normalize_store_and_indices() {
);

foreach ( $store_payload['search_engines'] as $search_engine ) {
$lang = Helpers::get_language_from_locale( $search_engine['language'] );
$base_lang = Helpers::get_language_from_locale( $this->language->get_base_language() );
$lang_country = Helpers::format_locale_to_underscore( $search_engine['language'] );
$lang = Helpers::get_language_from_locale( $search_engine['language'] );
$base_lang = Helpers::get_language_from_locale( $this->language->get_base_language() );

// If the installation is not multilanguage or it's the base language, replace the lang with ''.
if ( is_a( $this->language, No_Language_Plugin::class ) || $lang === $base_lang ) {
$lang = '';
$lang_country = '';
}

if ( isset( $api_keys[ $lang ] ) ) {
$se_hashid = $api_keys[ $lang ]['hash'];
if ( isset( $api_keys[ $lang_country ] ) ) {
$se_hashid = $api_keys[ $lang_country ]['hash'];
$payload['search_engines'][ $se_hashid ] = array( 'lang' => $lang );
} else {
$this->log->log( 'No search engine retrieved for the language - ' . $lang );
Expand Down Expand Up @@ -267,7 +268,7 @@ private function build_search_engines( $api_keys, $primary_language ) {
$search_engines[] = array(
'name' => $domain . ( $code ? ' (' . strtoupper( $code ) . ')' : '' ),
'language' => $code,
'locale' => $item['lang']['code'],
'locale' => $item['lang']['code'] ?? $primary_language,
'currency' => $currency,
'site_url' => $home_url,
'feed_type' => is_plugin_active( 'woocommerce/woocommerce.php' ) ? 'product' : 'posts',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Doofinder\WP\Settings;

use Doofinder\WP\Doofinder_For_WordPress;
use Doofinder\WP\Multilanguage\Language_Plugin;
use Doofinder\WP\Settings;

Expand Down Expand Up @@ -315,6 +316,15 @@ private function add_settings_page() {
add_action(
'admin_menu',
function () {
$icon = 'dashicons-search';
$svg_file_path = Doofinder_For_WordPress::PLUGIN_DIR . '/assets/img/doofinder.svg';
if ( file_exists( $svg_file_path ) ) {
ob_start();
include $svg_file_path;
$svg = ob_get_clean();
$icon = 'data:image/svg+xml;base64,' . base64_encode( $svg ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions
}

add_menu_page(
'Doofinder WP & WooCommerce Search',
'Doofinder',
Expand All @@ -323,7 +333,7 @@ function () {
function () {
$this->render_html_settings_page();
},
'dashicons-search'
$icon
);
}
);
Expand Down
10 changes: 7 additions & 3 deletions doofinder-for-woocommerce/readme.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
=== DOOFINDER Search and Discovery for WP & WooCommerce ===
Contributors: Doofinder
Tags: search, autocomplete
Version: 2.5.17
Version: 2.5.18
Requires at least: 5.6
Tested up to: 6.6.1
Tested up to: 6.7.1
Requires PHP: 7.0
Stable tag: 2.5.17
Stable tag: 2.5.18
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -126,6 +126,10 @@ You can report security bugs through the Patchstack Vulnerability Disclosure Pro

== Changelog ==

= 2.5.18 =
- Added custom Doofinder logo to the sidebar menu item.
- Solved an issue regarding indices normalization on multilanguages.

= 2.5.17 =
- Fixed update on save in multi-lang.
- Solved bug regarding HTML escaping in error output + undefined variable.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "doofinder-woocommerce",
"version": "2.5.17",
"version": "2.5.18",
"description": "Integrate Doofinder in your WooCommerce site with (almost) no effort.",
"main": "index.js",
"scripts": {
Expand Down
Loading