Example #1
0
 public static function url($files)
 {
     $ident = self::ident($files);
     if (!\SYSTEM\CACHE\cache_js::get($ident)) {
         \LIB\lib_minify::php();
         $minifier = new \MatthiasMullie\Minify\JS();
         foreach ($files as $f) {
             $minifier->add($f->SERVERPATH());
         }
         \SYSTEM\CACHE\cache_js::put($ident, $minifier->minify());
     }
     return './api.php?call=cache&id=' . self::CACHE_JS . '&ident=' . $ident;
 }
Example #2
0
 private static function js()
 {
     return \SYSTEM\HTML\html::script(\LIB\lib_jquery::js()->WEBPATH()) . \SYSTEM\HTML\html::script(\LIB\lib_bootstrap::js()->WEBPATH()) . \SYSTEM\HTML\html::script(\LIB\lib_tablesorter::js()->WEBPATH()) . \SYSTEM\HTML\html::script(\LIB\lib_bootstrap_growl::js()->WEBPATH()) . \SYSTEM\HTML\html::script(\LIB\lib_tinymce::js()->WEBPATH(false)) . \SYSTEM\HTML\html::script(\SYSTEM\CACHE\cache_js::url(array(\LIB\lib_system::js(), new \SYSTEM\PSAI('page/js/sai.js')))) . \SYSTEM\HTML\html::script('https://www.google.com/jsapi') . '<script type="text/javascript">google.load("visualization", "1", {packages:["corechart"]});</script>';
 }
Example #3
0
 public static function get($group, $state, $returnasjson = true)
 {
     //seperate state from vars
     $state_vars = \explode(';', $state);
     //parse substates
     $state_all = \explode('(', $state_vars[0]);
     $state_name = $state_all[0];
     $substate = substr($state_vars[0], strlen($state_name));
     $substate = self::parse_substate($substate);
     //vars
     $vars = array();
     for ($i = 1; $i < count($state_vars); $i++) {
         $var = \explode('.', $state_vars[$i]);
         $vars[$var[0]] = $var[1];
     }
     $result = array();
     $res = \SYSTEM\SQL\SYS_PAGE_GROUP::QQ(array($group, $state_name));
     while ($row = $res->next()) {
         if (!self::is_loaded($row, $substate, $state_name, $row['parent_id'])) {
             continue;
         }
         if ($row['login'] == 1 && !\SYSTEM\SECURITY\Security::isLoggedIn() || $row['login'] == 2 && \SYSTEM\SECURITY\Security::isLoggedIn()) {
             continue;
         }
         $row['url'] = \SYSTEM\PAGE\replace::replace($row['url'], $vars);
         $row['url'] = \SYSTEM\PAGE\replace::clean($row['url']);
         //clean url of empty variables
         //$row['url'] = preg_replace('/&.*?=(&|$)/', '&', $row['url']);
         $row['url'] = preg_replace('/[^=&]+=(&|$)/', '&', $row['url']);
         $row['url'] = preg_replace('/&&$/', '', $row['url']);
         $row['css'] = $row['js'] = array();
         if (\class_exists($row['php_class']) && \method_exists($row['php_class'], 'css') && \is_callable($row['php_class'] . '::css')) {
             $row['css'] = array_merge($row['css'], \call_user_func($row['php_class'] . '::css'));
         }
         $row['css'] = count($row['css']) > 0 ? array(\SYSTEM\CACHE\cache_css::url($row['css'])) : array();
         if (\class_exists($row['php_class']) && \method_exists($row['php_class'], 'scss') && \is_callable($row['php_class'] . '::scss')) {
             $scss = \call_user_func($row['php_class'] . '::scss');
             foreach ($scss as $s) {
                 $row['css'][] = \SYSTEM\CACHE\cache_scss::url($s);
             }
         }
         if (\class_exists($row['php_class']) && \method_exists($row['php_class'], 'js') && \is_callable($row['php_class'] . '::js')) {
             $row['js'] = array_merge($row['js'], \call_user_func($row['php_class'] . '::js'));
         }
         $row['js'] = count($row['js']) > 0 ? array(\SYSTEM\CACHE\cache_js::url($row['js'])) : array();
         unset($row['php_class']);
         $skip = false;
         for ($i = 0; $i < count($result); $i++) {
             if ($result[$i]['div'] == $row['div']) {
                 $skip = true;
                 if ($row['type'] == 1) {
                     $result[$i] = $row;
                 }
                 break;
             }
         }
         if (!$skip) {
             $result[] = $row;
         }
     }
     return $returnasjson ? \SYSTEM\LOG\JsonResult::toString($result) : $result;
 }