PluginProbe
Bogo / 2.4
Bogo v2.4
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 +6 -8 2.52.4 View file →
@@ -32,11 +32,10 @@
32 32 echo '</style>' . "\n";
33 33 }
34 34
35 35 function bogo_get_flag( $locale ) {
36 - $locale = explode( '_', $locale );
37 - $locale = array_slice( $locale, 0, 2 ); // de_DE_formal => de_DE
38 - $locale = implode( '_', $locale );
36 + $dir = '/images/flag-icons';
37 + $file = '';
39 38
40 39 $special_cases = array(
41 40 'ca' => 'catalonia',
42 41 'gd' => 'scotland',
@@ -66,17 +65,16 @@
66 65 if ( isset( $special_cases[$locale] ) ) {
67 66 $file = $special_cases[$locale] . '.png';
68 67 } elseif ( preg_match( '/_([A-Z]{2})$/', $locale, $matches ) ) {
69 68 $file = strtolower( $matches[1] ) . '.png';
70 - } else {
71 - $file = 'zz.png'; // 'zz.png' doesn't exist, just a dummy.
72 69 }
73 70
74 - $file = path_join( 'images/flag-icons', $file );
75 71 $url = '';
76 72
77 - if ( file_exists( path_join( BOGO_PLUGIN_DIR, $file ) ) ) {
78 - $url = bogo_plugin_url( $file );
73 + if ( $file && file_exists( path_join( BOGO_PLUGIN_DIR . $dir, $file ) ) ) {
74 + $url = path_join( BOGO_PLUGIN_URL . $dir, $file );
79 75 }
80 76
81 77 return apply_filters( 'bogo_get_flag', $url, $locale );
82 78 }
79 +
80 +?>