PluginProbe
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls / 6.5.1
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls v6.5.1
6.5.1 6.5.0 6.4.9 6.4.8 6.4.7 6.4.6 6.4.5 6.4.4 6.4.3 6.4.2 6.4.1 6.4.0 6.3.9 6.3.8 6.3.7 6.3.6 6.3.5 6.3.4 6.3.3 5.6.0 5.6.1 5.6.2 5.6.3 5.6.4 5.6.5 All 154 releases
← All changes | includes/class-poll-maker-ays-i18n.php +30 -6 5.6.4 → 6.5.1 View file →
@@ -31,15 +31,39 @@
31 31 * Load the plugin text domain for translation.
32 32 *
33 33 * @since 1.0.0
34 34 */
35 - public function load_plugin_textdomain() {
35 + public function load_plugin_textdomain() {
36 36
37 - load_plugin_textdomain(
38 - 'poll-maker',
39 - false,
40 - dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
41 - );
37 + if ( version_compare( get_bloginfo( 'version' ), '6.7', '>=' ) ) {
38 + $plugin = 'poll-maker';
39 +
40 + if( is_admin() ){
41 + $locale = get_user_locale();
42 + } else {
43 + $locale = get_locale();
44 + }
45 +
46 + if ( is_textdomain_loaded( $plugin ) ) {
47 + unload_textdomain( $plugin );
48 + }
49 + $mofile = sprintf( '%s-%s.mo', $plugin, $locale );
50 + // check the plugin language folder.
51 + $domain_path = path_join( WP_PLUGIN_DIR, "{$plugin}/languages" );
52 + $loaded = load_textdomain( $plugin, path_join( $domain_path, $mofile ) );
53 +
54 + if ( ! $loaded ) { //else, check the installation language path first.
55 + $domain_path = path_join( WP_LANG_DIR, 'plugins' );
56 + load_textdomain( $plugin, path_join( $domain_path, $mofile ) );
57 + }
58 + } else {
59 + load_plugin_textdomain(
60 + 'poll-maker',
61 + false,
62 + dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
63 + );
64 +
65 + }
42 66
43 67 }
44 68
45 69