Changeset 3253494
- Timestamp:
- 03/10/2025 05:06:45 PM (13 months ago)
- Location:
- fluentc-translation
- Files:
-
- 79 added
- 3 edited
-
tags/2.4.2 (added)
-
tags/2.4.2/LICENSE (added)
-
tags/2.4.2/README.md (added)
-
tags/2.4.2/bootstrap.php (added)
-
tags/2.4.2/fluentc_autoload.php (added)
-
tags/2.4.2/fluentc_plugin.php (added)
-
tags/2.4.2/fluentc_settings.php (added)
-
tags/2.4.2/fluentc_wordpress_plugin.php (added)
-
tags/2.4.2/languages (added)
-
tags/2.4.2/languages/fluentc-translation.pot (added)
-
tags/2.4.2/readme.txt (added)
-
tags/2.4.2/src (added)
-
tags/2.4.2/src/actions (added)
-
tags/2.4.2/src/actions/class-admin.php (added)
-
tags/2.4.2/src/actions/class-aioseo.php (added)
-
tags/2.4.2/src/actions/class-heartbeat.php (added)
-
tags/2.4.2/src/actions/class-insert.php (added)
-
tags/2.4.2/src/actions/class-links.php (added)
-
tags/2.4.2/src/actions/class-rankmath.php (added)
-
tags/2.4.2/src/actions/class-translationstatus.php (added)
-
tags/2.4.2/src/actions/class-wordpress.php (added)
-
tags/2.4.2/src/actions/class-yoast.php (added)
-
tags/2.4.2/src/blocks (added)
-
tags/2.4.2/src/blocks/fluentc-languages-block.js (added)
-
tags/2.4.2/src/class-bootstrap-fluentc.php (added)
-
tags/2.4.2/src/class-fluentc-manager.php (added)
-
tags/2.4.2/src/class-polylang.php (added)
-
tags/2.4.2/src/class-sitepress.php (added)
-
tags/2.4.2/src/fluentc_language_functions.php (added)
-
tags/2.4.2/src/fluentc_pll_api.php (added)
-
tags/2.4.2/src/includes (added)
-
tags/2.4.2/src/includes/admin_top_bar.css (added)
-
tags/2.4.2/src/includes/css (added)
-
tags/2.4.2/src/includes/css/fluentc-translations.css (added)
-
tags/2.4.2/src/includes/css/translation-status.css (added)
-
tags/2.4.2/src/includes/fluentc-logo.png (added)
-
tags/2.4.2/src/includes/fluentc-styles.css (added)
-
tags/2.4.2/src/includes/js (added)
-
tags/2.4.2/src/includes/js/translation-status.js (added)
-
tags/2.4.2/src/includes/js/translations.js (added)
-
tags/2.4.2/src/models (added)
-
tags/2.4.2/src/models/class-body.php (added)
-
tags/2.4.2/src/models/class-fluentc-links-model.php (added)
-
tags/2.4.2/src/models/class-hooks.php (added)
-
tags/2.4.2/src/models/class-htmltags.php (added)
-
tags/2.4.2/src/models/interface-translatable-node.php (added)
-
tags/2.4.2/src/services (added)
-
tags/2.4.2/src/services/class-api-key-validator.php (added)
-
tags/2.4.2/src/services/class-cache.php (added)
-
tags/2.4.2/src/services/class-connect.php (added)
-
tags/2.4.2/src/services/class-fluentc-translations.php (added)
-
tags/2.4.2/src/services/class-html-processor.php (added)
-
tags/2.4.2/src/services/class-json-processor.php (added)
-
tags/2.4.2/src/services/class-pll-language.php (added)
-
tags/2.4.2/src/services/class-scan.php (added)
-
tags/2.4.2/src/services/class-support-report.php (added)
-
tags/2.4.2/src/services/class-translation-manager.php (added)
-
tags/2.4.2/src/services/class-translation-processor.php (added)
-
tags/2.4.2/src/services/class-url.php (added)
-
tags/2.4.2/src/services/class-widget.php (added)
-
tags/2.4.2/src/templates (added)
-
tags/2.4.2/src/templates/manage-translations-page.php (added)
-
tags/2.4.2/src/templates/translation-status.php (added)
-
tags/2.4.2/src/utils (added)
-
tags/2.4.2/src/utils/class-language.php (added)
-
tags/2.4.2/src/utils/class-performance-monitor.php (added)
-
tags/2.4.2/vendor (added)
-
tags/2.4.2/vendor/autoload.php (added)
-
tags/2.4.2/vendor/composer (added)
-
tags/2.4.2/vendor/composer/ClassLoader.php (added)
-
tags/2.4.2/vendor/composer/InstalledVersions.php (added)
-
tags/2.4.2/vendor/composer/LICENSE (added)
-
tags/2.4.2/vendor/composer/autoload_classmap.php (added)
-
tags/2.4.2/vendor/composer/autoload_namespaces.php (added)
-
tags/2.4.2/vendor/composer/autoload_psr4.php (added)
-
tags/2.4.2/vendor/composer/autoload_real.php (added)
-
tags/2.4.2/vendor/composer/autoload_static.php (added)
-
tags/2.4.2/vendor/composer/installed.json (added)
-
tags/2.4.2/vendor/composer/installed.php (added)
-
trunk/fluentc_wordpress_plugin.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/src/actions/class-links.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fluentc-translation/trunk/fluentc_wordpress_plugin.php
r3252669 r3253494 7 7 * Plugin URI: https://www.fluentc.ai 8 8 * Description: A plugin that enables website owners to easily install the FluentC Translation on their WordPress site. 9 * Version: 2.4. 19 * Version: 2.4.2 10 10 * Author: FluentC 11 11 * Author URI: https://www.fluentc.ai … … 17 17 define( 'FLUENTC_DIR', __DIR__ ); 18 18 define( 'FLUENTC_SLUG', 'fluentc_translation' ); 19 define( 'FLUENTC_TRANSLATION_VERSION', "2.4. 1" );19 define( 'FLUENTC_TRANSLATION_VERSION', "2.4.2" ); 20 20 define( 'FLUENTC_TRANSLATION_PLUGIN_DIR', plugin_dir_path(__FILE__) ); 21 21 define( 'FLUENTC_TRANSLATION_PLUGIN_URL', plugin_dir_url(__FILE__) ); -
fluentc-translation/trunk/readme.txt
r3252669 r3253494 5 5 Requires at least: 4.6 6 6 Tested up to: 6.6.2 7 Stable tag: 2.4. 17 Stable tag: 2.4.2 8 8 Requires PHP: 7.3 9 9 License: GPLv2 or later -
fluentc-translation/trunk/src/actions/class-links.php
r3249935 r3253494 254 254 } 255 255 256 /**256 /** 257 257 * Modify rewrite rules to handle language prefixes for all existing rules 258 * with special handling for the home page 258 * with special handling for the home page and non-English source languages 259 259 * 260 260 * @param array $rules WordPress rewrite rules … … 318 318 return $final_rules; 319 319 } 320 320 321 /** 321 322 * Filter the template for home page in different languages 323 * Enhanced to properly handle non-English source languages 322 324 */ 323 325 public function filter_template_for_home_page() { 324 326 global $wp_query; 325 327 326 // Check if this is a language-prefixed home page 327 if (isset($wp_query->query_vars['fluentc_language']) && 328 is_home() && 329 !is_front_page()) { 330 331 // Check if a static page is set as the front page 332 $show_on_front = get_option('show_on_front'); 333 $page_on_front = get_option('page_on_front'); 334 335 if ($show_on_front === 'page' && $page_on_front) { 336 // Set up the main query to load the front page 337 $wp_query->is_home = false; 338 $wp_query->is_page = true; 339 $wp_query->is_singular = true; 340 $wp_query->is_front_page = true; 328 // Check if this is a language-prefixed page 329 if (!isset($wp_query->query_vars['fluentc_language'])) { 330 return; 331 } 332 333 $language = $wp_query->query_vars['fluentc_language']; 334 $source_language = $this->fluentc_language->fluentc_site_language(); 335 336 // Only proceed if this is a different language than the source 337 // and either we have no posts or this is detected as home when it shouldn't be 338 if ($language !== $source_language && 339 (empty($wp_query->posts) || (is_home() && !empty($wp_query->query)))) { 340 341 // Get the requested path 342 $request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; 343 $path = wp_parse_url($request_uri, PHP_URL_PATH); 344 345 // Remove language prefix from path to get the source path 346 $path = preg_replace('/^\/' . preg_quote($language, '/') . '\//', '/', $path); 347 $path = rtrim($path, '/'); 348 $slug = trim($path, '/'); 349 350 // Check if we're dealing with homepage or a specific page 351 if (empty($slug) || $slug === $language) { 352 // This is the homepage in a different language 353 $show_on_front = get_option('show_on_front'); 354 $page_on_front = get_option('page_on_front'); 341 355 342 // Set the queried object to be the front page 343 $front_page = get_post($page_on_front); 344 $wp_query->queried_object = $front_page; 345 $wp_query->queried_object_id = $page_on_front; 356 if ($show_on_front === 'page' && $page_on_front) { 357 // Set up the main query to load the front page 358 $wp_query->is_home = false; 359 $wp_query->is_page = true; 360 $wp_query->is_singular = true; 361 $wp_query->is_front_page = true; 362 363 // Set the queried object to be the front page 364 $front_page = get_post($page_on_front); 365 $wp_query->queried_object = $front_page; 366 $wp_query->queried_object_id = $page_on_front; 367 $wp_query->post = $front_page; 368 $wp_query->posts = array($front_page); 369 $wp_query->post_count = 1; 370 371 // Force using the page template 372 add_filter('template_include', function($template) use ($front_page) { 373 if (is_object($front_page) && isset($front_page->ID)) { 374 $page_template = get_page_template_slug($front_page->ID); 375 if ($page_template) { 376 $templates = array($page_template); 377 } else { 378 $templates = array('page.php', 'singular.php', 'index.php'); 379 } 380 381 $new_template = locate_template($templates); 382 if ($new_template) { 383 return $new_template; 384 } 385 } 386 return $template; 387 }, 99); 388 } 389 } else if (empty($wp_query->posts)) { 390 // This is a specific page that failed to resolve - try to find it 391 $page = get_page_by_path($slug); 346 392 347 // Force using the page template348 add_filter('template_include', function($template) use ($front_page) {349 if (is_object($front_page) && $front_page->ID) {350 $page_template = get_page_template_slug($front_page->ID);351 if ($page_template) {352 $templates = array($page_template);353 } else {354 $templates = array('page.php', 'singular.php', 'index.php');355 }356 357 $new_template = locate_template($templates);358 if ($new_template) {359 return $new_template;360 }393 if ($page) { 394 // Set up the query to display this page 395 $wp_query->is_home = false; 396 $wp_query->is_page = true; 397 $wp_query->is_singular = true; 398 $wp_query->post = $page; 399 $wp_query->posts = array($page); 400 $wp_query->post_count = 1; 401 $wp_query->queried_object = $page; 402 $wp_query->queried_object_id = $page->ID; 403 404 // Add debugging info if needed 405 if (defined('WP_DEBUG') && WP_DEBUG) { 406 error_log('FluentC: Resolved page ' . $slug . ' to ID ' . $page->ID); 361 407 } 362 return $template; 363 }, 99); 408 } else if (defined('WP_DEBUG') && WP_DEBUG) { 409 // Log for debugging if the page couldn't be found 410 error_log('FluentC: Could not resolve page for path: ' . $slug); 411 } 364 412 } 365 413 }
Note: See TracChangeset
for help on using the changeset viewer.