• Resolved pavelevap

    (@pavelevap)


    I am using latest WP (localized Czech version) and Popup Maker. As soon as I activate plugin, localized quotes are broken.

    Example:
    – You wrote double quotes inside editor, for example "quote".
    – Function wptexturize() make them prettier, by replacing them to &#8220quote&#8221 (in English)
    – But when you switch to Czech version, this should be replaced to &#8222quote&#8220. And it does not work as soon as you activate Popup Maker.

    I tracked this problem to Freemius integration, because as soon as is function pum_fs(); (line 378 in popup-maker.php) commented out, everything works well.

    I tried also some other plugins with Freemius support and they work without problems so it has to be somehow connected to Popup Maker integration.

    Thank you for your help!

    https://www.ads-software.com/plugins/popup-maker/

Viewing 15 replies - 1 through 15 (of 25 total)
  • Plugin Author Daniel Iser

    (@danieliser)

    @pavelevap – Thanks for the report, I am baffled but I will reach out to Vova from freemius and get their thoughts on the matter right now. Hopefully he can shed some insight on the matter.

    Though I am not aware of any content filtering on their part.

    Here is a link for reference to the line that you commented out to fix it: https://github.com/PopupMaker/Popup-Maker/blob/master/popup-maker.php#L378

    And the freemius config: https://github.com/PopupMaker/Popup-Maker/blob/master/includes/class-pum-freemius.php

    @pavelevap – Since you have the Czech version already set up and can test disabling these lines a couple at a time to see if the issue resolves? This will require leaving pum_fs() uncommented but then trying to find the offending function.

    https://github.com/PopupMaker/Popup-Maker/blob/master/includes/class-pum-freemius.php#L83-L89

    If you comment them all out and its still happening then try commenting out this line:

    https://github.com/PopupMaker/Popup-Maker/blob/master/includes/class-pum-freemius.php#L83-L89

    If that doesn’t do it then I would have to defer to Team Freemius as it would be in the core of their code.

    Thread Starter pavelevap

    (@pavelevap)

    Hi, no problem. I did not know if I should contact you or directly Freemius, but then I tried NextGEN Gallery (which has also Freemius support) and there was no problem with quotes, so I chose you ??

    I tried to comment out these lines: https://github.com/PopupMaker/Popup-Maker/blob/master/includes/class-pum-freemius.php#L83-L89 but problem is still here. But both your latest links has the same URL, so I did not tried the last possibility.

    I also tried to play with some other functions, but I was not successful ?? I did not find any content filtering or something else inside Popup Maker, so this is really strange and it looks like it can be Freemius fault (hidden external process).

    You can test it very easily with Czech language, go to Settings – General and select “?e?tina” as your language. Swiching languages become easy process, no need to handle any other thing.

    Plugin Author Daniel Iser

    (@danieliser)

    @pavelevap – Sorry about that, the correct line for the second link is below.

    https://github.com/PopupMaker/Popup-Maker/blob/master/includes/class-pum-freemius.php#L39

    Will try to duplicate it locally.

    Thread Starter pavelevap

    (@pavelevap)

    Still no change ?? Quotes work only when I comment line 56 (and all other lines bellow related to fs_dynamic_init() call).

    Plugin Author Daniel Iser

    (@danieliser)

    @pavelevap – Going to update to the latest version of the Freemius SDK and push an update, maybe that will handle it, if not will dig in deeper.

    Hey @pavelevap,

    I’m Vova from Freemius. First of all – thanks for reporting about the issue. The problem you are describing sounds like a very strange edge case because we do not touch any strings.

    @danieliser to save you some time, maybe just send @pavelevap a zip with the updated SDK version to see if it solves the problem at all, before deploying to the repo. Just a suggestion ??

    I’m now subscribed to this thread, will follow your updates.

    Thread Starter pavelevap

    (@pavelevap)

    No problem, I can test also directly with latest code from Github.

    I also tried to debug wptexturize() function to see what is going on inside and I found following:

    $closing_quote returns non-localized quotes

    https://github.com/WordPress/WordPress/blob/2bdc11781d25436b9d037b0d64b611f1a346c1f8/wp-includes/formatting.php#L90

    But when you change $reset to true, you will see that only the first call of wptexturize() returns non-localized quotes and all other returns right localized quotes (but not used because of $reset param default caching).

    https://github.com/WordPress/WordPress/blob/2bdc11781d25436b9d037b0d64b611f1a346c1f8/wp-includes/formatting.php#L41

    It seems to me that wptexturize() is probably used by Freemius (or Popup Maker) too early somewhere (before localization files even loaded)?

    Thread Starter pavelevap

    (@pavelevap)

    Hi,

    any news about this issue?

    Thread Starter pavelevap

    (@pavelevap)

    Hi,

    any news about this issue?

    Plugin Author Daniel Iser

    (@danieliser)

    @pavelevap – Can you test the latest version? It has the most recent version of Freemius and we removed some freemius customizations we had in place as well.

    Thread Starter pavelevap

    (@pavelevap)

    Hi,

    sorry, but no change, quotes are still wrong until Popup Maker is deactivated ??

    Plugin Author Daniel Iser

    (@danieliser)

    @pavelevap – Hmm, you tracked it down to an issue with wptexturize, but the only place that would be called (just searched both freemius & PM) is as a filter for pum_popup_content. Those functions are not run until wp_footer, and even if forced the earliest would be wp_head. Both well after languages have been loaded.

    https://github.com/PopupMaker/Popup-Maker/search?utf8=%E2%9C%93&q=wptexturize

    Ignore the deprecated files as they don’t load.

    What is strange is we have even removed customizations we had in place with the last release in regaurd to freemius.

    Maybe try removing that filter and see if that does it, no idea how to get around that. Mainly because we emulated exactly what was applied to the_content, without having things like author boxes added to your popups.

    Thread Starter pavelevap

    (@pavelevap)

    Hi,

    I tried removing almost all filters, but it is coming probably from Freemius, because of pum_fs(). I noticed that there are several calls throughout their codebase which are used very early:

    require_once( ABSPATH . 'wp-admin/includes/plugin.php' );

    If some of these calls are used before localization files are correctly loaded, then wptexturize() can be wrong for the first load, because it is running inside this file, for example here.

    But I am not sure about it, because I tried following code and it did not help ??

    add_filter( 'run_wptexturize', '__return_false' );

    Are you able to reproduce this problem?

    Thread Starter pavelevap

    (@pavelevap)

    OK, I was able to backtrace it after further testing. I checked all wptexturize() calls and compare them with/without Popup Maker activated. And this was the particular call which broke quotes:

    require('C:\www\wordpress\src\wp-blog-header.php'), require_once('C:\www\wordpress\src\wp-load.php'), require_once('C:\www\wordpress\wp-config.php'), require_once('C:\www\wordpress\src\wp-settings.php'), include_once('C:\www\wordpress\src\wp-content\plugins\popup-maker\popup-maker.php'), pum_fs, PUM_Freemius::instance, PUM_Freemius->fs, fs_dynamic_init, Freemius::instance, Freemius->__construct, Freemius->_version_updates_handler, Freemius->get_plugin_version, Freemius->get_plugin_data, get_plugin_data, _get_plugin_data_markup_translate, wptexturize

    I commented in class-freemius.php particular line 282.

    But then there were other call:

    require('C:\www\wordpress\src\wp-blog-header.php'), require_once('C:\www\wordpress\src\wp-load.php'), require_once('C:\www\wordpress\wp-config.php'), require_once('C:\www\wordpress\src\wp-settings.php'), include_once('C:\www\wordpress\src\wp-content\plugins\popup-maker\popup-maker.php'), pum_fs, PUM_Freemius::instance, PUM_Freemius->fs, fs_dynamic_init, Freemius->dynamic_init, Freemius->parse_settings, Freemius->get_plugin_version, Freemius->get_plugin_data, get_plugin_data, _get_plugin_data_markup_translate, wptexturize

    So, I commented lines 2177 and 2178 and quotes magically work now.

    Root issue is hidden in wptexturize() call inside WP function _get_plugin_data_markup_translate() and related WP plugin functions are probably loaded inside Freemius before localization functions (or there is some other issue with them).

    Note: Filter run_wptexturize is for other purposes and does not influence $reset param.

    Plugin Author Daniel Iser

    (@danieliser)

    @pavelevap – Awesome, I will pass this info on to @vovafeldman right now. Hopefully we can get a patch for it quickly.

    In the mean time does commenting out those lines work for you as a temporary fix? If so I will close this issue and we can move further discussion into the freemius sdk github.

    One question. Can you check nextgens usage of the nextgen_fs() style function? Like pum_fs they will have an initiator function, we initialize immediately, they may be initializng theirs on a later event like plugins_loaded or similar. Happy to make adjustments of that nature from our end.

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘Freemius integration broke localized quotes’ is closed to new replies.