WordPress.org

Ready to get started?Download WordPress

Forums

Dave's WordPress Live Search
apply_filters - localization desn't work (5 posts)

  1. 2046
    Member
    Posted 2 years ago #

    hello

    Weird thing happens.
    We use the xlanguage plugin and Relevanssi search. On top of that is the Dave's live search which supposed to return translated results for titles, excerpts etc.
    But it wont work. Check out this picture http://data.o----o.info/unspecified/daves-live-search.png

    You see? The title and the excerpt are not localized.

    Tha's all weird, because I went in to the Daves code and everything seams right..all the output runs through the localization filter.
    $result->post_title = apply_filters("localization", $result->post_title);
    But the filter does nothing :(
    I have tried out put xlanguage_current_language_code() from the same place as the filter is in the plugin and it gave me the right language code.

    So the only idea I come up is that the possible problem might be that the plugin runs before the Localization function is ready to perform,..But frankly I do not believe it can be true.

    Any Idea?

    http://wordpress.org/extend/plugins/daves-wordpress-live-search/

  2. Dave Ross
    Member
    Plugin Author

    Posted 2 years ago #

    Hi. I was cleaning out my Instapaper queue and saw your post. Sorry for not getting back sooner.

    It looks like the switch to WordPress's preferred AJAX interface (admin-ajax.php) broke compatibility with xlanguage. For historical reasons, admin-ajax.php reports that it's an admin page, even if called from a regular page.

    Xlanguage doesn't seem to register all the hooks it needs if it thinks it's on an admin page.

  3. 2046
    Member
    Posted 2 years ago #

    Interesting,
    So now I have to find a name of the hook and add it in the xlanguage settings, This sounds like easy task.

    thanks 2046

  4. a.blok
    Member
    Posted 2 years ago #

    Hi. It would be nice to know how to fix this issue! Can you guys please give me some insights?
    Thanks
    Alexander

  5. Dave Ross
    Member
    Plugin Author

    Posted 2 years ago #

    I haven't dug into it too deeply, but I'm thinking the problem is in language.php, around line 213:

    if (is_admin())
            {
                $this->admin->plugins_loaded();
            } else
            {
                $this->add_action('parse_request');
                $this->add_filter('query_vars');
                // and a bunch more filters & actions...

    I've confirmed that is_admin() returns true when my plugin is retrieving search results, since it uses admin-ajax.php.

    Now, admin-ajax.php defines a constant named DOING_AJAX that xLanguage could check:

    if(is_admin() && !defined('DOING_AJAX')) {
        // It's a real admin page
        $this->admin->plugins_loaded();
    }
    else {
        // It's a regular page or an AJAX call
        // ...
    }

    It looks like xLanguage hasn't been updated since 2009. Is anyone forking the code to make an updated version with fixes for things like this?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic