Ejemplo n.º 1
0
     $contents .= file_get_contents(Koken::get_path('common/js/pulse.js'));
     $pulse_obj = array();
     $pulse_srcs = array();
     foreach (Shutter::$active_pulse_plugins as $arr) {
         $pulse_obj[] = "'{$arr['key']}': '{$arr['path']}'";
         $pulse_srcs[] = $arr['path'];
     }
     $pulse_str = '';
     if (!empty($pulse_obj)) {
         $pulse_obj = join(', ', $pulse_obj);
         $contents .= "\n\$K.pulse.plugins = { {$pulse_obj} };\n";
         foreach ($pulse_srcs as $src) {
             $contents .= file_get_contents($root_path . $src);
         }
     }
     $contents .= join("\n", Shutter::get_site_scripts());
     Koken::cache($contents);
     header('Content-type: text/javascript');
     die($contents);
 } else {
     // Loop through template defined routes and match URL
     foreach ($routes as $route => $page) {
         // Find magic :name variables in the route
         preg_match_all('/(\\:[a-z_-]+)/', $route, $variables);
         // We need to save the matched variables so we can reassign them after the match
         $match_variables = array();
         if (!empty($variables[0])) {
             foreach ($variables[1] as $str) {
                 // Save variable name for later
                 $match_variables[] = str_replace(':', '', $str);
                 // Replace magic :name variable with regular expression