Plugin Directory

Changeset 3399453


Ignore:
Timestamp:
11/20/2025 07:29:00 AM (8 weeks ago)
Author:
Dency
Message:

Update Version 3.14.5

Location:
smartcrawl-seo
Files:
1641 added
10 edited

Legend:

Unmodified
Added
Removed
  • smartcrawl-seo/trunk/constants.php

    r3366486 r3399453  
    1010 * Internal constants, not to be overridden
    1111 */
    12 const SMARTCRAWL_VERSION     = '3.14.4';
    13 const SMARTCRAWL_BUILD       = '1758615725169';
     12const SMARTCRAWL_VERSION     = '3.14.5';
     13const SMARTCRAWL_BUILD       = '1763564261178';
    1414const SMARTCRAWL_BUILD_TYPE  = 'free';
    1515const SMARTCRAWL_SUI_VERSION = '2.12.23';
  • smartcrawl-seo/trunk/includes/class-init.php

    r3323297 r3399453  
    3535        $this->common();
    3636
    37         add_action( 'wpml_loaded', array( $this, 'wpml' ) );
    38 
     37        // Register WPML hook, but if wpml_loaded already fired, initialize immediately.
     38        // wpml_loaded fires on plugins_loaded, which happens before init hook.
     39        if ( did_action( 'wpml_loaded' ) ) {
     40            $this->wpml();
     41        } else {
     42            add_action( 'wpml_loaded', array( $this, 'wpml' ) );
     43        }
    3944        if ( is_admin() ) {
    4045            $this->admin();
     
    8590        Controllers\Cross_Sell_page::get()->run();
    8691        Instant_Indexing\Controller::get()->run();
     92        Controllers\Black_Friday::get()->run();
    8793    }
    8894
  • smartcrawl-seo/trunk/includes/core/wpml/class-controller.php

    r3211988 r3399453  
    4949     */
    5050    protected function init() {
    51         add_action( 'plugins_loaded', array( $this, 'hook_with_wpml' ) );
     51        $this->hook_with_wpml();
    5252    }
    5353
     
    8989        add_filter( 'wds_news_sitemap_include_post_ids', array( $this, 'limit_sitemap_posts_by_language' ), 10, 2 );
    9090        add_filter( 'wds_sitemap_cache_file_name', array( $this, 'append_language_code_to_cache' ) );
     91        add_filter( 'wds_sitemap_ignored_page_ids', array( $this, 'exclude_homepage_translations' ) );
    9192    }
    9293
     
    171172        add_filter( 'wds_full_sitemap_items', array( $this, 'add_homepage_versions' ) );
    172173        add_filter( 'wds_partial_sitemap_items', array( $this, 'add_homepage_versions_to_partial' ), 10, 3 );
     174        add_filter( 'wds_sitemap_ignored_page_ids', array( $this, 'exclude_homepage_translations' ) );
    173175    }
    174176
     
    301303     * We would rather use wpml_get_language_information, but it has internal caching that doesn't get purged the first time a post is saved.
    302304     *
     305     * Results are cached in a static variable to avoid repeated database queries during the same request.
     306     *
    303307     * @param int $post_id Post ID.
    304308     *
     
    306310     */
    307311    private function get_post_language_code( $post_id ) {
     312        static $cache = array();
     313
     314        $post_id = (int) $post_id;
     315        if ( ! $post_id ) {
     316            return null;
     317        }
     318
     319        if ( isset( $cache[ $post_id ] ) ) {
     320            return $cache[ $post_id ];
     321        }
     322
    308323        global $wpdb;
    309324
    310         return $wpdb->get_var( $wpdb->prepare( "SELECT language_code FROM {$wpdb->prefix}icl_translations WHERE element_id = %d", $post_id ) );
     325        $cache[ $post_id ] = $wpdb->get_var( $wpdb->prepare( "SELECT language_code FROM {$wpdb->prefix}icl_translations WHERE element_id = %d", $post_id ) );
     326
     327        return $cache[ $post_id ];
     328    }
     329
     330    /**
     331     * Gets all translation IDs for the homepage page.
     332     *
     333     * When a static page is set as homepage, this method retrieves all translation IDs
     334     * (including the original homepage ID) by querying WPML's translations table directly.
     335     *
     336     * We use direct database queries instead of WPML filters to avoid caching issues
     337     *
     338     * @return array Array of homepage translation IDs, or empty array if not applicable.
     339     */
     340    private function get_homepage_translation_ids() {
     341        static $cached_ids = null;
     342
     343        if ( null !== $cached_ids ) {
     344            return $cached_ids;
     345        }
     346
     347        // Only fetch if a static page is set as homepage.
     348        if ( 'page' !== get_option( 'show_on_front' ) ) {
     349            $cached_ids = array();
     350            return $cached_ids;
     351        }
     352
     353        $homepage_id = (int) get_option( 'page_on_front' );
     354        if ( ! $homepage_id ) {
     355            $cached_ids = array();
     356            return $cached_ids;
     357        }
     358
     359        // Get all translations of the homepage page by querying WPML translations table directly.
     360        $translation_ids = array( $homepage_id );
     361        global $wpdb;
     362        $trid = $wpdb->get_var(
     363            $wpdb->prepare(
     364                "SELECT trid FROM {$wpdb->prefix}icl_translations WHERE element_id = %d AND element_type = 'post_page'",
     365                $homepage_id
     366            )
     367        );
     368
     369        if ( $trid ) {
     370            $all_translations = $wpdb->get_col(
     371                $wpdb->prepare(
     372                    "SELECT element_id FROM {$wpdb->prefix}icl_translations WHERE trid = %d AND element_type = 'post_page'",
     373                    $trid
     374                )
     375            );
     376
     377            if ( ! empty( $all_translations ) ) {
     378                $translation_ids = array_map( 'intval', $all_translations );
     379            }
     380        }
     381
     382        $cached_ids = $translation_ids;
     383
     384        return $cached_ids;
     385    }
     386
     387    /**
     388     * Excludes homepage page and all its translations from the page sitemap.
     389     *
     390     * When a static page is set as homepage and WPML is active, the homepage page
     391     * and its translations are included in the page query results. This causes duplicates
     392     * because WPML's add_homepage_versions already adds homepage URLs for each language.
     393     *
     394     * @param array $ignored_ids Array of page IDs to ignore.
     395     *
     396     * @return array Modified array with homepage page and its translations excluded.
     397     */
     398    public function exclude_homepage_translations( $ignored_ids ) {
     399        $translation_ids = $this->get_homepage_translation_ids();
     400
     401        if ( empty( $translation_ids ) ) {
     402            return $ignored_ids;
     403        }
     404
     405        // Merge with existing ignored IDs.
     406        $ignored_ids = empty( $ignored_ids ) || ! is_array( $ignored_ids )
     407            ? array()
     408            : $ignored_ids;
     409
     410        return array_unique( array_merge( $ignored_ids, $translation_ids ) );
    311411    }
    312412}
  • smartcrawl-seo/trunk/languages/smartcrawl-seo.pot

    r3366486 r3399453  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: SmartCrawl Pro 3.14.4\n"
     5"Project-Id-Version: SmartCrawl Pro 3.14.5\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/build\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-09-23T08:21:53+00:00\n"
     12"POT-Creation-Date: 2025-11-19T14:57:28+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.12.0\n"
  • smartcrawl-seo/trunk/readme.txt

    r3366552 r3399453  
    149149
    150150== Changelog ==
     151
     152= 3.14.5 ( 2025-11-20 ) =
     153
     154- Enhance: Miscellaneousness improvements
     155- Fix: Duplicate homepage URLs appear in the sitemap when using WPML plugin
    151156
    152157= 3.14.4 ( 2025-09-23 ) =
  • smartcrawl-seo/trunk/vendor/autoload.php

    r3366486 r3399453  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInit1472f31b384a202913a938fc41d4ee02::getLoader();
     7return ComposerAutoloaderInit87491af33796722c6ca6543e05861550::getLoader();
  • smartcrawl-seo/trunk/vendor/composer/autoload_classmap.php

    r3323297 r3399453  
    6565    'SmartCrawl\\Controllers\\Analysis_Content' => $baseDir . '/includes/core/controllers/class-analysis-content.php',
    6666    'SmartCrawl\\Controllers\\Assets' => $baseDir . '/includes/core/controllers/class-assets.php',
     67    'SmartCrawl\\Controllers\\Black_Friday' => $baseDir . '/includes/core/controllers/class-black-friday.php',
    6768    'SmartCrawl\\Controllers\\Compatibility' => $baseDir . '/includes/core/controllers/class-compatibility.php',
    6869    'SmartCrawl\\Controllers\\Controller' => $baseDir . '/includes/core/controllers/class-controller.php',
  • smartcrawl-seo/trunk/vendor/composer/autoload_real.php

    r3366486 r3399453  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit1472f31b384a202913a938fc41d4ee02
     5class ComposerAutoloaderInit87491af33796722c6ca6543e05861550
    66{
    77    private static $loader;
     
    2323        }
    2424
    25         spl_autoload_register(array('ComposerAutoloaderInit1472f31b384a202913a938fc41d4ee02', 'loadClassLoader'), true, true);
     25        spl_autoload_register(array('ComposerAutoloaderInit87491af33796722c6ca6543e05861550', 'loadClassLoader'), true, true);
    2626        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
    27         spl_autoload_unregister(array('ComposerAutoloaderInit1472f31b384a202913a938fc41d4ee02', 'loadClassLoader'));
     27        spl_autoload_unregister(array('ComposerAutoloaderInit87491af33796722c6ca6543e05861550', 'loadClassLoader'));
    2828
    2929        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3131            require_once __DIR__ . '/autoload_static.php';
    3232
    33             call_user_func(\Composer\Autoload\ComposerStaticInit1472f31b384a202913a938fc41d4ee02::getInitializer($loader));
     33            call_user_func(\Composer\Autoload\ComposerStaticInit87491af33796722c6ca6543e05861550::getInitializer($loader));
    3434        } else {
    3535            $map = require __DIR__ . '/autoload_namespaces.php';
  • smartcrawl-seo/trunk/vendor/composer/autoload_static.php

    r3366486 r3399453  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit1472f31b384a202913a938fc41d4ee02
     7class ComposerStaticInit87491af33796722c6ca6543e05861550
    88{
    99    public static $classMap = array (
     
    6666        'SmartCrawl\\Controllers\\Analysis_Content' => __DIR__ . '/../..' . '/includes/core/controllers/class-analysis-content.php',
    6767        'SmartCrawl\\Controllers\\Assets' => __DIR__ . '/../..' . '/includes/core/controllers/class-assets.php',
     68        'SmartCrawl\\Controllers\\Black_Friday' => __DIR__ . '/../..' . '/includes/core/controllers/class-black-friday.php',
    6869        'SmartCrawl\\Controllers\\Compatibility' => __DIR__ . '/../..' . '/includes/core/controllers/class-compatibility.php',
    6970        'SmartCrawl\\Controllers\\Controller' => __DIR__ . '/../..' . '/includes/core/controllers/class-controller.php',
     
    312313    {
    313314        return \Closure::bind(function () use ($loader) {
    314             $loader->classMap = ComposerStaticInit1472f31b384a202913a938fc41d4ee02::$classMap;
     315            $loader->classMap = ComposerStaticInit87491af33796722c6ca6543e05861550::$classMap;
    315316
    316317        }, null, ClassLoader::class);
  • smartcrawl-seo/trunk/wpmu-dev-seo.php

    r3366486 r3399453  
    44 * Plugin URI: https://wpmudev.com/project/smartcrawl-wordpress-seo/
    55 * Description: Every SEO option that a site requires, in one easy bundle.
    6  * Version: 3.14.4
     6 * Version: 3.14.5
    77 * Network: true
    88 * Requires at least: 6.4
Note: See TracChangeset for help on using the changeset viewer.