Skip to content

Commit

Permalink
Fix settings namespace issues v2 (#326)
Browse files Browse the repository at this point in the history
* Fix settings namespace issues

* Replace old translations namespace

* Update version
  • Loading branch information
pedromcp90 authored Sep 13, 2024
1 parent 4064440 commit 9cb246b
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 72 deletions.
51 changes: 48 additions & 3 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.3
* Version: 2.5.4
* Requires at least: 5.6
* Requires PHP: 7.0
* Author: Doofinder
Expand Down Expand Up @@ -38,7 +38,7 @@ class Doofinder_For_WordPress {
* @var string
*/

public static $version = '2.5.3';
public static $version = '2.5.4';

/**
* The only instance of Doofinder_For_WordPress
Expand Down Expand Up @@ -449,7 +449,52 @@ function () {
* @return array List of previous schedules + DooFinder ones.
*/
public static function add_schedules( $schedules ) {
return Settings::add_schedules( $schedules );
$df_schedules = array(
'wp_doofinder_each_5_minutes' => array(
/* translators: %s is replaced with an integer number representing the minutes. */
'display' => sprintf( __( 'Each %s minutes', 'wordpress-doofinder' ), 5 ),
'interval' => MINUTE_IN_SECONDS * 5,
),
'wp_doofinder_each_15_minutes' => array(
/* translators: %s is replaced with an integer number representing the minutes. */
'display' => sprintf( __( 'Each %s minutes', 'wordpress-doofinder' ), 15 ),
'interval' => MINUTE_IN_SECONDS * 15,
),
'wp_doofinder_each_30_minutes' => array(
/* translators: %s is replaced with an integer number representing the minutes. */
'display' => sprintf( __( 'Each %s minutes', 'wordpress-doofinder' ), 30 ),
'interval' => MINUTE_IN_SECONDS * 30,
),
'wp_doofinder_each_60_minutes' => array(
'display' => __( 'Each hour', 'wordpress-doofinder' ),
'interval' => HOUR_IN_SECONDS,
),
'wp_doofinder_each_2_hours' => array(
/* translators: %s is replaced with an integer number representing the hours. */
'display' => sprintf( __( 'Each %s hours', 'wordpress-doofinder' ), 2 ),
'interval' => HOUR_IN_SECONDS * 2,
),
'wp_doofinder_each_6_hours' => array(
/* translators: %s is replaced with an integer number representing the hours. */
'display' => sprintf( __( 'Each %s hours', 'wordpress-doofinder' ), 6 ),
'interval' => HOUR_IN_SECONDS * 6,
),
'wp_doofinder_each_12_hours' => array(
/* translators: %s is replaced with an integer number representing the hours. */
'display' => sprintf( __( 'Each %s hours', 'wordpress-doofinder' ), 12 ),
'interval' => HOUR_IN_SECONDS * 12,
),
'wp_doofinder_each_day' => array(
'display' => __( 'Once a day', 'wordpress-doofinder' ),
'interval' => DAY_IN_SECONDS,
),
'wp_doofinder_disabled' => array(
'display' => __( 'Disabled', 'wordpress-doofinder' ),
'interval' => DAY_IN_SECONDS,
),
);

return array_merge( $schedules, $df_schedules );
}
}

Expand Down
2 changes: 1 addition & 1 deletion doofinder-for-woocommerce/includes/class-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static function add_additional_settings() {
function () {
add_meta_box(
'doofinder-for-wp-visibility-settings',
__( 'Doofinder - Indexing', 'doofinder_for_wp' ),
__( 'Doofinder - Indexing', 'wordpress-doofinder' ),
function () {
self::render_html_indexing_visibility();
},
Expand Down
70 changes: 7 additions & 63 deletions doofinder-for-woocommerce/includes/class-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Settings {
*
* @var string
*/
public static $top_level_menu = 'doofinder_for_wp';
public static $top_level_menu = 'wordpress-doofinder';

/**
* List of keys that are reserved for custom attributes fields
Expand Down Expand Up @@ -137,14 +137,14 @@ private function __construct() {

self::$tabs = array(
'authentication' => array(
'label' => __( 'General Settings', 'doofinder_for_wp' ),
'label' => __( 'General Settings', 'wordpress-doofinder' ),
'fields_cb' => 'add_general_settings',
),
);

if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
self::$tabs['product_data'] = array(
'label' => __( 'Product Data', 'doofinder_for_wp' ),
'label' => __( 'Product Data', 'wordpress-doofinder' ),
'fields_cb' => 'add_product_data_settings',
);
}
Expand All @@ -166,7 +166,7 @@ function () {
add_settings_error(
'doofinder_for_wp_messages',
'doofinder_for_wp_message',
__( 'Custom Attributes updated successfully. <br/> Please, keep in mind that you need to reindex in order for the changes to be reflected in the search layer.', 'doofinder_for_wp' ),
__( 'Custom Attributes updated successfully. <br/> Please, keep in mind that you need to reindex in order for the changes to be reflected in the search layer.', 'wordpress-doofinder' ),
'success'
);
},
Expand All @@ -185,15 +185,15 @@ public static function get_additional_attributes_options() {
$fields = include_once 'settings/attributes.php';
$option_groups = array(
'base_attribute' => array(
'title' => __( 'Basic attributes', 'doofinder_for_wp' ),
'title' => __( 'Basic attributes', 'wordpress-doofinder' ),
'options' => array(),
),
'wc_attribute' => array(
'title' => __( 'Product attributes', 'doofinder_for_wp' ),
'title' => __( 'Product attributes', 'wordpress-doofinder' ),
'options' => array(),
),
'metafield' => array(
'title' => __( 'Metafields', 'doofinder_for_wp' ),
'title' => __( 'Metafields', 'wordpress-doofinder' ),
'options' => array(),
),
);
Expand Down Expand Up @@ -258,60 +258,4 @@ private static function filter_product_rest_attributes( $rest_attributes ) {
);
return array_diff( $rest_attributes, static::RESERVED_CUSTOM_ATTRIBUTES_NAMES );
}

/**
* Method that adds some custom schedules to be used in WP Cron.
*
* @param array $schedules Current WP Schedules as array.
*
* @return array List of previous schedules + DooFinder ones.
*/
public static function add_schedules( $schedules ) {
$df_schedules = array(
'wp_doofinder_each_5_minutes' => array(
/* translators: %s is replaced with an integer number representing the minutes. */
'display' => sprintf( __( 'Each %s minutes', 'doofinder_for_wp' ), 5 ),
'interval' => MINUTE_IN_SECONDS * 5,
),
'wp_doofinder_each_15_minutes' => array(
/* translators: %s is replaced with an integer number representing the minutes. */
'display' => sprintf( __( 'Each %s minutes', 'doofinder_for_wp' ), 15 ),
'interval' => MINUTE_IN_SECONDS * 15,
),
'wp_doofinder_each_30_minutes' => array(
/* translators: %s is replaced with an integer number representing the minutes. */
'display' => sprintf( __( 'Each %s minutes', 'doofinder_for_wp' ), 30 ),
'interval' => MINUTE_IN_SECONDS * 30,
),
'wp_doofinder_each_60_minutes' => array(
'display' => __( 'Each hour', 'doofinder_for_wp' ),
'interval' => HOUR_IN_SECONDS,
),
'wp_doofinder_each_2_hours' => array(
/* translators: %s is replaced with an integer number representing the hours. */
'display' => sprintf( __( 'Each %s hours', 'doofinder_for_wp' ), 2 ),
'interval' => HOUR_IN_SECONDS * 2,
),
'wp_doofinder_each_6_hours' => array(
/* translators: %s is replaced with an integer number representing the hours. */
'display' => sprintf( __( 'Each %s hours', 'doofinder_for_wp' ), 6 ),
'interval' => HOUR_IN_SECONDS * 6,
),
'wp_doofinder_each_12_hours' => array(
/* translators: %s is replaced with an integer number representing the hours. */
'display' => sprintf( __( 'Each %s hours', 'doofinder_for_wp' ), 12 ),
'interval' => HOUR_IN_SECONDS * 12,
),
'wp_doofinder_each_day' => array(
'display' => __( 'Once a day', 'doofinder_for_wp' ),
'interval' => DAY_IN_SECONDS,
),
'wp_doofinder_disabled' => array(
'display' => __( 'Disabled', 'doofinder_for_wp' ),
'interval' => DAY_IN_SECONDS,
),
);

return array_merge( $schedules, $df_schedules );
}
}
7 changes: 5 additions & 2 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.3
Version: 2.5.4
Requires at least: 5.6
Tested up to: 6.6.1
Requires PHP: 7.0
Stable tag: 2.5.3
Stable tag: 2.5.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

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

== Changelog ==

= 2.5.4 =
- Fixed other Settings namespace issues.

= 2.5.3 =
- Fixed issues with Settings namespace.

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.3",
"version": "2.5.4",
"description": "Integrate Doofinder in your WooCommerce site with (almost) no effort.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 9cb246b

Please sign in to comment.