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 -9 3.02.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',
@@ -52,9 +51,8 @@
52 51 'ht' => 'ht',
53 52 'hy' => 'am',
54 53 'ja' => 'jp',
55 54 'kk' => 'kz',
56 - 'km' => 'kh',
57 55 'lo' => 'la',
58 56 'lv' => 'lv',
59 57 'mn' => 'mn',
60 58 'sq' => 'al',
@@ -67,17 +65,16 @@
67 65 if ( isset( $special_cases[$locale] ) ) {
68 66 $file = $special_cases[$locale] . '.png';
69 67 } elseif ( preg_match( '/_([A-Z]{2})$/', $locale, $matches ) ) {
70 68 $file = strtolower( $matches[1] ) . '.png';
71 - } else {
72 - $file = 'zz.png'; // 'zz.png' doesn't exist, just a dummy.
73 69 }
74 70
75 - $file = path_join( 'images/flag-icons', $file );
76 71 $url = '';
77 72
78 - if ( file_exists( path_join( BOGO_PLUGIN_DIR, $file ) ) ) {
79 - $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 );
80 75 }
81 76
82 77 return apply_filters( 'bogo_get_flag', $url, $locale );
83 78 }
79 +
80 +?>