Skip to content

Instantly share code, notes, and snippets.

@wilr
Created December 13, 2011 07:09
Show Gist options
  • Save wilr/1471003 to your computer and use it in GitHub Desktop.
Save wilr/1471003 to your computer and use it in GitHub Desktop.
Check theme folder exists (sapphire). Allows site dev to delete themes/
diff --git a/sapphire/core/i18n.php b/sapphire/core/i18n.php
index 25190b1..cbd7903 100755
--- a/sapphire/core/i18n.php
+++ b/sapphire/core/i18n.php
@@ -1872,13 +1872,15 @@ class i18n extends Object {
// Load translations from themes
$themesBase = $base . '/themes';
- foreach(scandir($themesBase) as $theme) {
- if(
- strpos($theme, SSViewer::current_theme()) === 0
- && file_exists($file = "$themesBase/$theme/lang/$locale.php")
- ) {
- if ($force_load) include($file);
- else include_once($file);
+ if(file_exists($themesBase)) {
+ foreach(scandir($themesBase) as $theme) {
+ if(
+ strpos($theme, SSViewer::current_theme()) === 0
+ && file_exists($file = "$themesBase/$theme/lang/$locale.php")
+ ) {
+ if ($force_load) include($file);
+ else include_once($file);
+ }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment