aurovrata / cf7-polylang

Contact Form 7 Polylang extension
GNU General Public License v2.0
1 stars 1 forks source link

Cf7_Polylang_Admin::get_cf7_translations() running on every (!) page load #5

Open diggy opened 7 years ago

diggy commented 7 years ago

Is what the plugin seems to be currently doing, back and front end.

This is problematic because the method includes a call to api.wordpress.org

cf. https://github.com/aurovrata/cf7-polylang/blob/76916fb91136e061bfa4f9604636f245a149d351/includes/class-cf7-polylang.php#L178

aurovrata commented 7 years ago

sure, but it skips most of the execution of the function if the number of language files found on your installation match the number of languages you have installed in polylang. Admitedly I could add an extra check to see if this a dashboard page load with is_admin() which would make things a wee faster

diggy commented 7 years ago

Right, missed that part :) I noticed the behaviour on a site which had some translation files missing, and the WP_HTTP_BLOCK_EXTERNAL constant set to true. So I was seeing warnings all over the place. Thanks!

aurovrata commented 7 years ago

I'll stick in an is_admin() on the next update to reduce front end checks. You can switch-off the debugging msg if you want... define( 'WP_GURUS_DEBUG_MSG', false) in your wp-config.php file

aurovrata commented 7 years ago

I have a new cf7 extension in the pipeline which is pretty much a re-write of the dashboard edit page of cf7 posts aligned with wp core coding practices. This will make cf7 play nice with a lot more plugins in teh backend, including Polylang.. which means that this plugin will become practically redundant. It will only have to check/download the translation files as everything else will be handled by Polylang itself