diff Flag.inc @ 108:f2996720e6d6

Embed some flags, support for overriding.
author Tom Fredrik "BFG" Klaussen <bfg@blenning.no>
date Mon, 07 Mar 2016 20:44:43 +0100
parents d98e315308cd
children 6f5939bf53c3
line wrap: on
line diff
--- a/Flag.inc	Mon Mar 07 20:44:15 2016 +0100
+++ b/Flag.inc	Mon Mar 07 20:44:43 2016 +0100
@@ -45,10 +45,14 @@
 
 
     $this->lang = $lang;
-    $this->name = "../img/flag-${lang}";
-    if ($this->active)
-      $this->name .= "-active";
-    $this->name .= ".png";
+    foreach ( [ 'img', '../img' ] as $dir) {
+      $this->name = "${dir}/flag-${lang}";
+      if ($this->active)
+	$this->name .= "-active";
+      $this->name .= ".png";
+      if (file_exists($this->name))
+	break;
+    }
 
     $cache = new CacheTimeCheck($this->name);
     $cache->setMaxAge(86400);