Beispiel #1
0
 public static function isActive($theme)
 {
     if (trim(Options::get('themes')) !== $theme) {
         return false;
     }
     return true;
 }
Beispiel #2
0
 public static function isActive($plugin)
 {
     if (!in_array(strtolower($plugin), json_decode(Options::get('modules'), true))) {
         return false;
     }
     return true;
 }
Beispiel #3
0
 private static function prepare($parent)
 {
     $sql = "SELECT a.id `id`, a.parent `parent`, a.name `name`, a.url `url`, b.count `count` FROM menus a\r\n                LEFT OUTER JOIN (\r\n                  SELECT `parent`, COUNT(*) `count` FROM `menus` GROUP BY `parent`\r\n                ) b ON a.id = b.parent\r\n                INNER JOIN `menu_themes` c ON a.theme = c.id\r\n                WHERE a.parent = '" . $parent . "' AND c.name = '" . strtolower(trim(Options::get('themes'))) . "'\r\n                ORDER BY a.position ASC";
     $query = Database\SQL::getInstance()->results($sql);
     if (!$query) {
         return [];
     }
     return $query;
 }
Beispiel #4
0
 public static function dateFormat($date, $format = '')
 {
     $timezone = Options::get('site_timezone');
     $time = strtotime($date);
     $format = empty($format) ? 'j F Y H:i A T' : $format;
     $date = new \DateTime($date);
     $date->setTimezone(new \DateTimeZone($timezone));
     $newdate = $date->format($format);
     return $newdate;
 }
Beispiel #5
0
 public static function slugify($text)
 {
     # trim
     $text = trim($text, '-');
     # lowercase
     $text = strtolower($text);
     # strip tags
     $text = strip_tags($text);
     # replace non letter or digits by -
     $text = preg_replace('~[^\\pL\\d]+~u', '-', $text);
     # remove unwanted characters
     $text = preg_replace('~[^-\\w]+~', '', $text);
     # transliterate
     setlocale(LC_CTYPE, Options::get('country_id') . '.utf8');
     $text = iconv('utf-8', 'ASCII//TRANSLIT', $text);
     if (empty($text)) {
         return 'n-a';
     }
     return $text;
 }
Beispiel #6
0
 public static function lang($className = '')
 {
     $var = strtolower(Options::get('system_lang'));
     if (file_exists($file = APP . 'language/' . $var . '.php')) {
         $default_lang = (include $file);
     }
     $modules_lang = [];
     if (file_exists($file = MODULES_PATH . $className . '/language/' . $var . '.php')) {
         $modules_lang = (require $file);
     }
     return array_merge($default_lang, $modules_lang);
 }