public function __construct()
 {
     $this->set_default(self::DEFAULT_LANG, self::DEFAULT_LANG_NAME);
     $this->directory(CRAYON_LANG_PATH);
     $this->relative_directory(CRAYON_LANG_DIR);
     $this->extension('txt');
     CrayonLog::debug("Setting lang directories");
     $upload = CrayonGlobalSettings::upload_path();
     if ($upload) {
         $this->user_directory($upload . CRAYON_LANG_DIR);
         if (!is_dir($this->user_directory())) {
             CrayonGlobalSettings::mkdir($this->user_directory());
             CrayonLog::debug($this->user_directory(), "LANG USER DIR");
         }
     } else {
         CrayonLog::syslog("Upload directory is empty: " . $upload . " cannot load languages.");
     }
     CrayonLog::debug($this->directory());
     CrayonLog::debug($this->user_directory());
 }
 function __construct()
 {
     $this->set_default(self::DEFAULT_FONT, self::DEFAULT_FONT_NAME);
     $this->directory(CRAYON_FONT_PATH);
     $this->relative_directory(CRAYON_FONT_DIR);
     $this->extension('css');
     CrayonLog::debug("Setting font directories");
     $upload = CrayonGlobalSettings::upload_path();
     if ($upload) {
         $this->user_directory($upload . CRAYON_FONT_DIR);
         if (!is_dir($this->user_directory())) {
             CrayonGlobalSettings::mkdir($this->user_directory());
             CrayonLog::debug($this->user_directory(), "THEME DIR");
         }
     } else {
         CrayonLog::syslog("Upload directory is empty: " . $upload);
     }
     CrayonLog::debug($this->directory());
     CrayonLog::debug($this->user_directory());
 }
 public static function load_settings($just_load_settings = FALSE)
 {
     if (self::$options === NULL) {
         // Load settings from db
         if (!(self::$options = get_option(self::OPTIONS))) {
             self::$options = CrayonSettings::get_defaults_array();
             update_option(self::OPTIONS, self::$options);
         }
         // Initialise default global settings and update them from db
         CrayonGlobalSettings::set(self::$options);
     }
     if (!self::$is_fully_loaded && !$just_load_settings) {
         // Load everything else as well
         // For local file loading
         // This is used to decouple WP functions from internal Crayon classes
         CrayonGlobalSettings::site_url(home_url());
         CrayonGlobalSettings::site_path(ABSPATH);
         CrayonGlobalSettings::plugin_path(plugins_url('', __FILE__));
         $upload = wp_upload_dir();
         CrayonLog::debug($upload, "WP UPLOAD FUNCTION");
         CrayonGlobalSettings::upload_path(CrayonUtil::path_slash($upload['basedir']) . CRAYON_DIR);
         CrayonGlobalSettings::upload_url($upload['baseurl'] . '/' . CRAYON_DIR);
         CrayonLog::debug(CrayonGlobalSettings::upload_path(), "UPLOAD PATH");
         CrayonGlobalSettings::set_mkdir('wp_mkdir_p');
         // Load all available languages and themes
         CrayonResources::langs()->load();
         CrayonResources::themes()->load();
         // Ensure all missing settings in db are replaced by default values
         $changed = FALSE;
         foreach (CrayonSettings::get_defaults_array() as $name => $value) {
             // Add missing settings
             if (!array_key_exists($name, self::$options)) {
                 self::$options[$name] = $value;
                 $changed = TRUE;
             }
         }
         // A setting was missing, update options
         if ($changed) {
             update_option(self::OPTIONS, self::$options);
         }
         self::$is_fully_loaded = TRUE;
     }
 }
 public static function upload_path($upload_path = NULL)
 {
     if ($upload_path === NULL) {
         return self::$upload_path;
     } else {
         self::$upload_path = CrayonUtil::path_slash($upload_path);
     }
 }