コード例 #1
0
 private function getMap(PreprocessTool $tool)
 {
     $ret = array();
     $mapKey = comma_str_to_array($this->options['requirejs.map']);
     foreach ($mapKey as $key) {
         $ret = array_merge($ret, $tool->getMap($key));
     }
     // 去掉自身
     unset($ret[str_replace(C('SRC.SRC_PATH'), '', $this->options['requirejs.path'])]);
     // map中地址为实际地址,将其变为引用地址
     // 为value加入cdn
     $ret = array_combine(array_map(create_function('$key', 'return Tool::getVirtualPath($key);'), array_keys($ret)), array_map(create_function('$value', 'return Tool::addCdn($value);'), array_values($ret)));
     return $ret;
 }
コード例 #2
0
 public function index()
 {
     // Server Sent Event
     //        header('Content-Type: text/event-stream');
     header('Content-Type: text/octet-stream');
     header('Cache-Control: no-cache');
     $t1 = microtime(true);
     define('PROJECT_SITE_PATH', C('PROJECT.SITE_PATH') . '/' . $_GET['site']);
     define('PROJECT_MODULE_NAME', $_GET['module']);
     $path = PROJECT_SITE_PATH . '/' . C('PROJECT.SRC_DIR') . '/' . PROJECT_MODULE_NAME . '/' . C('M3D_FILENAME');
     $tool = new PreprocessTool($path);
     $tool->run();
     mark('处理完成!', 'emphasize');
     $t2 = microtime(true);
     show_json('编译用时:' . round($t2 - $t1, 2) . 's');
 }