Plugin Directory

Changeset 3159410


Ignore:
Timestamp:
09/29/2024 03:44:51 AM (18 months ago)
Author:
mvpis
Message:

Updates with improvements and bug fixes

Location:
fluentc-translation
Files:
365 added
9 edited

Legend:

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

    r3159297 r3159410  
    77 * Plugin URI: https://github.com/fluentc/wordpress-plugin
    88 * Description: A plugin that enables website owners to easily install the FluentC Translation on their WordPress site.
    9  * Version: 1.9.1
     9 * Version: 1.9.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', "1.9.1" );
     19define( 'FLUENTC_TRANSLATION_VERSION', "1.9.2" );
    2020define( 'FLUENTC_TRANSLATION_PLUGIN_DIR', plugin_dir_path(__FILE__) );
    2121define( 'FLUENTC_TRANSLATION_PLUGIN_URL', plugin_dir_url(__FILE__) );
  • fluentc-translation/trunk/readme.txt

    r3159297 r3159410  
    55Requires at least: 4.6
    66Tested up to: 6.6.2
    7 Stable tag: 1.9.1
     7Stable tag: 1.9.2
    88Requires PHP: 7.3
    99License: GPLv2 or later
  • fluentc-translation/trunk/src/actions/class-wordpress.php

    r3159297 r3159410  
    487487            $html = preg_replace('/<root>|<\/root>/', '', $html);
    488488           
    489             do_action('qm/info', 'Raw processed HTML: ' . substr($html, 0, 100) . '...');
    490489           
    491490            if ($html !== null && $html !== '' && is_string($html) && strlen(trim($html)) > 0) {
     
    502501                }, $processed_html);
    503502
    504                 do_action('qm/info', 'Final processed HTML: ' . substr($processed_html, 0, 100) . '...');
    505503                return $processed_html;
    506             } else {
    507                 do_action('qm/info', 'Invalid HTML after processing');
    508             }
     504            }
    509505        } catch (\Exception $e) {
    510506            do_action('qm/error', 'Error in get_processed_html: ' . $e->getMessage());
  • fluentc-translation/trunk/src/class-polylang.php

    r3151087 r3159410  
    1717class Polylang {
    1818    public $links_model;
    19 
     19    public $options;
    2020    public $model;
    2121
     
    2424        $this->links_model = new FluentC_Links_Model();
    2525        $this->model = new PLL_Language();
     26        $this->options = $this->links_model->options;
    2627        add_action( 'init', array( $this, 'init_hooks' ), 1 );
    2728    }
  • fluentc-translation/trunk/src/fluentc_pll_api.php

    r3159297 r3159410  
    185185 * @return PLL_Frontend|PLL_Admin|PLL_Settings|PLL_REST_Request
    186186 */
    187 function PLL() { // PHPCS:ignore WordPress.NamingConventions.ValidFunctionName
    188     return $GLOBALS['polylang'];
     187function PLL() {
     188    if (!isset($GLOBALS['polylang'])) {
     189        $GLOBALS['polylang'] = new FluentC\Polylang();
     190    }
     191    return $GLOBALS['polylang'];
    189192}
  • fluentc-translation/trunk/src/models/class-fluentc-links-model.php

    r3126655 r3159410  
    2525        return array(
    2626            'force_lang' => '2',
    27             'hide_default' => 'true',
     27            'hide_default' => true
    2828            // Add more options as needed.
    2929        );
  • fluentc-translation/trunk/src/models/class-htmltags.php

    r3148988 r3159410  
    184184     * @since 1.2
    185185     */
    186     public function add_language_code_to_link( $language_code, $url ) {
    187        
     186    public function add_language_code_to_link($language_code, $url) {
    188187        // Modify the permalink to add the language code.
    189         $url_parts = wp_parse_url( $url );
    190         $path      = '/' . $language_code . $url_parts['path'];
    191 
    192         // Rebuild the URL with the language code.
    193         $new_permalink = $url_parts['scheme'] . '://' . $url_parts['host'] . $path;
    194         if ( ! empty( $url_parts['query'] ) ) {
     188        $url_parts = wp_parse_url($url);
     189   
     190        // Check if 'path' exists, if not, use an empty string
     191        $original_path = isset($url_parts['path']) ? $url_parts['path'] : '';
     192        $path = '/' . $language_code . $original_path;
     193   
     194        // Start rebuilding the URL
     195        $new_permalink = '';
     196   
     197        // Add scheme and host if they exist
     198        if (isset($url_parts['scheme']) && isset($url_parts['host'])) {
     199            $new_permalink = $url_parts['scheme'] . '://' . $url_parts['host'];
     200        }
     201   
     202        // Add the path
     203        $new_permalink .= $path;
     204   
     205        // Add query string if it exists
     206        if (!empty($url_parts['query'])) {
    195207            $new_permalink .= '?' . $url_parts['query'];
    196208        }
    197         if ( ! empty( $url_parts['fragment'] ) ) {
     209   
     210        // Add fragment if it exists
     211        if (!empty($url_parts['fragment'])) {
    198212            $new_permalink .= '#' . $url_parts['fragment'];
    199213        }
    200 
     214   
    201215        return $new_permalink;
    202216    }
  • fluentc-translation/trunk/src/services/class-html.php

    r3155849 r3159410  
    247247public function find_and_replace($html, $json, $language_code, $regex_lang) {
    248248   
    249     //do_action('qm/debug', 'Raw processed HTML: ' . substr($html, 0, 200) . '...');
    250249    $dom = new Dom();
    251250    $options = new Options();
  • fluentc-translation/trunk/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Dom/Node/Collection.php

    r3155849 r3159410  
    131131     * @return mixed
    132132     */
    133     public function offsetGet($offset)
     133    public function offsetGet(mixed $offset): mixed
    134134    {
    135135        return $this->collection[$offset] ?? null;
Note: See TracChangeset for help on using the changeset viewer.