File tree Expand file tree Collapse file tree 5 files changed +34
-4
lines changed
Expand file tree Collapse file tree 5 files changed +34
-4
lines changed Original file line number Diff line number Diff line change 3838 } else if ($ cluster_field ['key ' ] == 'country ' ) {
3939 $ value = array ();
4040 foreach ($ cluster_field ['value ' ] as $ k => $ v ) {
41- $ value [] = ' <div class="famfamfam-flag- ' . strtolower ( h ( $ v )) . '" ></div> ' . h ($ v );
41+ $ value [] = $ this -> Icon -> countryFlag ( $ v ) . ' ' . h ($ v );
4242 }
4343 $ dataValue .= nl2br (implode ("\n" , $ value ));
4444 } else {
Original file line number Diff line number Diff line change 4545 } else if ($ cluster_field ['key ' ] == 'country ' ) {
4646 $ value = array ();
4747 foreach ($ cluster_field ['value ' ] as $ k => $ v ) {
48- $ value [] = ' <span class="famfamfam-flag- ' . strtolower ( h ( $ v )) . '" ></span> ' . h ($ v );
48+ $ value [] = $ this -> Icon -> countryFlag ( $ v ) . ' ' . h ($ v );
4949 }
5050 $ value_contents = nl2br (implode ("\n" , $ value ));
5151 } else {
Original file line number Diff line number Diff line change 1+ <?php
2+ App::uses ('AppHelper ' , 'View/Helper ' );
3+
4+ class IconHelper extends AppHelper {
5+ /**
6+ * @param string $countryCode ISO 3166-1 alpha-2 two-letter country code
7+ * @return string
8+ */
9+ public function countryFlag ($ countryCode )
10+ {
11+ if (strlen ($ countryCode ) !== 2 ) {
12+ return '' ;
13+ }
14+
15+ return '<span class="famfamfam-flag- ' . strtolower (h ($ countryCode )) . '" ></span> ' ;
16+ /* Unicode version
17+ $output = '';
18+ foreach (str_split(strtolower($countryCode)) as $letter) {
19+ $letterCode = ord($letter);
20+ if ($letterCode < 97 || $letterCode > 122) {
21+ return ''; // invalid letter
22+ }
23+
24+ // UTF-8 representation
25+ $output .= "\xF0\x9F\x87" . chr(0xa6 + ($letterCode - 97));
26+ }
27+
28+ return $output;*/
29+ }
30+ }
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ foreach ($orgs as $org): ?>
119119 <td ondblclick="document.location.href ='<?php echo $ baseurl . "/organisations/view/ " . $ org ['Organisation ' ]['id ' ];?> '"><?php echo h ($ org ['Organisation ' ]['description ' ]); ?> </td>
120120 <td class="short" ondblclick="document.location.href ='<?php echo $ baseurl . "/organisations/view/ " . $ org ['Organisation ' ]['id ' ];?> '"><?php
121121 if (isset ($ org ['Organisation ' ]['country_code ' ])) {
122- echo ' <span class="famfamfam-flag- ' . strtolower ( h ( $ org ['Organisation ' ]['country_code ' ])) . '" ></span> ' ;
122+ echo $ this -> Icon -> countryFlag ( $ org ['Organisation ' ]['country_code ' ]) . ' ' ;
123123 }
124124 if ($ org ['Organisation ' ]['nationality ' ] !== 'Not specified ' ) {
125125 echo h ($ org ['Organisation ' ]['nationality ' ]);
Original file line number Diff line number Diff line change 3333 if (!empty (trim ($ org ['Organisation ' ]['nationality ' ]))) {
3434 $ html = '' ;
3535 if (isset ($ org ['Organisation ' ]['country_code ' ])) {
36- $ html .= ' <span class="famfamfam-flag- ' . strtolower ( h ( $ org ['Organisation ' ]['country_code ' ])) . '" ></span> ' ;
36+ $ html .= $ this -> Icon -> countryFlag ( $ org ['Organisation ' ]['country_code ' ]) . ' ' ;
3737 }
3838 $ html .= trim (h ($ org ['Organisation ' ]['nationality ' ]));
3939 $ table_data [] = array (
You can’t perform that action at this time.
0 commit comments