PluginProbe
Bogo / 2.6
Bogo v2.6
3.9.3 trunk 1.0 1.1 2.0 2.0.1 2.1 2.1.1 2.1.2 2.1.3 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.6 2.6.1 2.7 2.8 2.8.1 2.9 3.0 3.0.1 All 52 releases
← All changes | includes/flags.php +8 -6 2.42.6 View file →
@@ -32,10 +32,11 @@
32 32 echo '</style>' . "\n";
33 33 }
34 34
35 35 function bogo_get_flag( $locale ) {
36 - $dir = '/images/flag-icons';
37 - $file = '';
36 + $locale = explode( '_', $locale );
37 + $locale = array_slice( $locale, 0, 2 ); // de_DE_formal => de_DE
38 + $locale = implode( '_', $locale );
38 39
39 40 $special_cases = array(
40 41 'ca' => 'catalonia',
41 42 'gd' => 'scotland',
@@ -65,16 +66,17 @@
65 66 if ( isset( $special_cases[$locale] ) ) {
66 67 $file = $special_cases[$locale] . '.png';
67 68 } elseif ( preg_match( '/_([A-Z]{2})$/', $locale, $matches ) ) {
68 69 $file = strtolower( $matches[1] ) . '.png';
70 + } else {
71 + $file = 'zz.png'; // 'zz.png' doesn't exist, just a dummy.
69 72 }
70 73
74 + $file = path_join( 'images/flag-icons', $file );
71 75 $url = '';
72 76
73 - if ( $file && file_exists( path_join( BOGO_PLUGIN_DIR . $dir, $file ) ) ) {
74 - $url = path_join( BOGO_PLUGIN_URL . $dir, $file );
77 + if ( file_exists( path_join( BOGO_PLUGIN_DIR, $file ) ) ) {
78 + $url = bogo_plugin_url( $file );
75 79 }
76 80
77 81 return apply_filters( 'bogo_get_flag', $url, $locale );
78 82 }
79 -
80 -?>