Beispiel #1
0
 /**
  * Determines the installed state of the system
  *
  * @static
  * @return bool
  */
 public static function installed()
 {
     return Cache::rememberForever('site.installed', function () {
         return Schema::hasTable('main');
     });
 }
Beispiel #2
0
 /**
  * Return flags indicating whether each filter is
  * enabled or disabled
  *
  * @static
  * @return object
  */
 public static function flags()
 {
     return Cache::rememberForever('antispam.flags', function () {
         $flags = new stdClass();
         $services = Antispam::services();
         // Fetching all enabled filters. This value can be defined
         // from the antispam screen in the admin panel
         $enabled = preg_split('/\\||,/', Site::config('antispam')->services);
         foreach ($services as $service) {
             $flags->{$service} = in_array($service, $enabled);
         }
         return $flags;
     });
 }
 /**
  * Fetches a list of languages supported by GeSHi
  *
  * @access public
  * @param  bool  $csv
  * @return array|string
  */
 public function languages($csv = FALSE)
 {
     return Cache::rememberForever("site.languages.{$csv}", function () use($csv) {
         // get_supported_languages takes a param that tells whether or not
         // to return full names. We don't need full names if we just want CSV
         $langs = $this->geshi->get_supported_languages(!$csv);
         // Now, sort the languages for non-CSV scenario
         if (!$csv) {
             // First, we do a natural case-insensitive sort
             natcasesort($langs);
             // Now, get the language list from the cookie and push the most
             // used languages to the beginning of the list to allow easy access
             $historyLangs = Cookie::get('languages');
             if (!is_null($historyLangs)) {
                 foreach ($historyLangs as $lang) {
                     if (isset($langs[$lang])) {
                         // Get the language description
                         $langText = $langs[$lang];
                         // Remove the language from the array
                         unset($langs[$lang]);
                         // Add the language to the top of the array
                         $langs = array_merge(array($lang => $langText), $langs);
                     }
                 }
             }
         } else {
             $langs = implode(',', $langs);
         }
         return $langs;
     });
 }