• Resolved mcdeth

    (@mcdeth)


    permalink-manager.php runs run_permalink_manager() immediately; the classes it loads (e.g. permalink-manager-settings.php) call __() while building settings arrays during plugin bootstrap. Because this happens before init, the permalink-manager domain is also being loaded too early.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Maciej Bis

    (@mbis)

    Hi @mcdeth,

    Technically, the texdomain is loaded with ‘init’ as the official docs suggest. The translated strings in settings screen are hooked to ‘permalink_manager_sections‘ filter which itself is not called until ‘admin_init‘ action hook. The plugin’s textdomain is loaded with ‘localize_me‘ that is called with ‘init‘ hook.

    If you are using Pro version, could you check if the same warning is displayed also when Lite version is temp. used instead?

    • This reply was modified 3 months, 3 weeks ago by Maciej Bis.
    Thread Starter mcdeth

    (@mcdeth)

    Thanks for the prompt reply. Yes, indeed, it’s the Pro version on the client’s website. Unfortunately, I won’t be able to test the free version – setting up the environment would take too much time and it’s bit more cosmetical bug for me. I just wanted to clean up the debug log. This is what I got from codex:

    In permalink-manager.php the plugin calls run_permalink_manager() immediately when the file loads (line 388). That instantiates Permalink_Manager_Class, which (a) registers get_options_and_globals() on plugins_loaded and (b) instantiates all helper classes, including Permalink_Manager_Pro_Functions (lines 50–109, 115–134).
    When plugins_loaded fires, get_options_and_globals() runs (lines 146–162). It calls apply_filters( 'permalink_manager_alerts', array() ), so every alert callback runs before init.
    One of those callbacks is Permalink_Manager_Pro_Functions::pro_alerts() (see permalink-manager-pro-functions.php (line 268)). That method calls self::get_expiration_date() (lines 166–237), which uses multiple __() translations (e.g., lines 186, 191, 196, 200, 205, 211, 216, 221).
    Because those __() calls fire on plugins_loaded (i.e., before init and before localize_me() loads the text domain at init), WordPress’ just‑in‑time translation loader kicks in early and triggers the “Translation loading for the permalink-manager domain was triggered too early” notice.
    To avoid the notice, either (1) defer the alert building until init (e.g., move get_options_and_globals() to init or gate the permalink_manager_alerts filter until then), or (2) ensure the text domain is loaded before those translations run (e.g., call load_plugin_textdomain( 'permalink-manager', ... ) earlier, or avoid translation functions until init).

    I hope it helps and it’s not a false positive. It has helped me so far find five other sources.

    Plugin Author Maciej Bis

    (@mbis)

    It seems like you are using the outdated or possibly nulled version of Permalink Manager Pro.

    As other users reported the same issue in past, I moved ‘permalink_manager_alerts’ and other UI-related hooks to separate method get_output_globals() in 2.5.0 version:
    https://plugins.trac.ww.wp.xz.cn/browser/permalink-manager/trunk/permalink-manager.php#L159

    which is hooked to ‘init’ in line #125:
    https://plugins.trac.ww.wp.xz.cn/browser/permalink-manager/trunk/permalink-manager.php#L125

    You can easily confirm this by comparing your copy of the plugin with the main file permalink-manager.php. Besides the comments in the beginning, the rest of code is exactly the same in Lite & Pro variants.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.