Plugin Directory

Changeset 3310718


Ignore:
Timestamp:
06/12/2025 09:10:10 PM (10 months ago)
Author:
mvpis
Message:

Updates and Improvements

Location:
fluentc-translation
Files:
82 added
3 edited

Legend:

Unmodified
Added
Removed
  • fluentc-translation/trunk/fluentc_wordpress_plugin.php

    r3297628 r3310718  
    77 * Plugin URI: https://www.fluentc.ai
    88 * Description: A plugin that enables website owners to easily install the FluentC Translation on their WordPress site.
    9  * Version: 2.6.1
     9 * Version: 2.6.2
    1010 * Author: FluentC
    1111 * Author URI: https://www.fluentc.ai
     
    1717define( 'FLUENTC_DIR', __DIR__ );
    1818define( 'FLUENTC_SLUG', 'fluentc_translation' );
    19 define( 'FLUENTC_TRANSLATION_VERSION', "2.6.1" );
     19define( 'FLUENTC_TRANSLATION_VERSION', "2.6.2" );
    2020define( 'POLYLANG_VERSION', "2.5.2" );
    2121define( 'FLUENTC_TRANSLATION_PLUGIN_DIR', plugin_dir_path(__FILE__) );
  • fluentc-translation/trunk/readme.txt

    r3297628 r3310718  
    44Tags: translation, multilingual, translate, language switcher, automatic translation
    55Requires at least: 4.6
    6 Tested up to: 6.8
    7 Stable tag: 2.6.1
     6Tested up to: 6.8.1
     7Stable tag: 2.6.2
    88Requires PHP: 7.3
    99License: GPLv2 or later
  • fluentc-translation/trunk/src/actions/class-links.php

    r3297628 r3310718  
    7070            add_filter('rewrite_rules_array', array($this, 'fluentc_rewrite_rules_new'), 100);
    7171            add_action('template_redirect', array($this, 'filter_template_for_home_page'), 1);
     72            add_filter('redirect_canonical', array($this, 'redirect_canonical_filter'), 10, 2);
    7273        }
    7374       
     
    199200        return $new_permalink;
    200201    }
    201 
     202/**
     203 * Redirect Canonical Filter
     204 *
     205 * @param string $redirect_url redirect_url.
     206 * @param string $requested_url requested_url.
     207 */
     208    public function redirect_canonical_filter($redirect_url, $requested_url) {
     209        $api_key = get_option('fluentc_api_key');
     210        $languages = $this->fluentc_connect->get_language_list($api_key);
     211        if (empty($languages)) {
     212            return $redirect_url;
     213        }
     214       
     215        // Check if the requested URL contains any language code
     216        foreach ($languages as $lang) {
     217            if (strpos($requested_url, '/' . $lang . '/') !== false ||
     218                strpos($requested_url, '/' . $lang) !== false) {
     219                return false;
     220            }
     221        }
     222       
     223        return $redirect_url;
     224    }
    202225    /**
    203226     * Updates Permalink for Cart Link
Note: See TracChangeset for help on using the changeset viewer.