| @@ -32,8 +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 = ''; | |
| 38 | + | |
| 36 | 39 | $special_cases = array( |
| 37 | 40 | 'ca' => 'catalonia', |
| 38 | 41 | 'gd' => 'scotland', |
| 39 | 42 | 'cy' => 'wales', |
| @@ -62,17 +65,14 @@ | ||
| 62 | 65 | if ( isset( $special_cases[$locale] ) ) { |
| 63 | 66 | $file = $special_cases[$locale] . '.png'; |
| 64 | 67 | } elseif ( preg_match( '/_([A-Z]{2})$/', $locale, $matches ) ) { |
| 65 | 68 | $file = strtolower( $matches[1] ) . '.png'; |
| 66 | - } else { | |
| 67 | - $file = 'zz.png'; // 'zz.png' doesn't exist, just a dummy. | |
| 68 | 69 | } |
| 69 | 70 | |
| 70 | - $file = path_join( 'images/flag-icons', $file ); | |
| 71 | 71 | $url = ''; |
| 72 | 72 | |
| 73 | - if ( file_exists( path_join( BOGO_PLUGIN_DIR, $file ) ) ) { | |
| 74 | - $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 ); | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | return apply_filters( 'bogo_get_flag', $url, $locale ); |
| 78 | 78 | } |