示例#1
0
 public function run($args)
 {
     if ($this->options['json_map.is_gen']) {
         $tool = $args[1];
         $type = $args[2];
         $map = json_encode($tool->map[$type]);
         contents_to_file(C('JSON_MAP.PATH') . '/' . $type . C('JSON_MAP.SUFFIX') . '.json', $map);
     }
 }
示例#2
0
 /**
  * 导出配置
  * 包括belongMap,md5Map,revision
  */
 public static function export()
 {
     $path = C('INCRE.PATH') . '/' . C('INCRE.MAP_FILENAME');
     contents_to_file($path, MergeConfigWriter::configStringify(self::$belongMap));
     $path = C('INCRE.PATH') . '/' . C('INCRE.MD5_FILENAME');
     contents_to_file($path, MergeConfigWriter::configStringify(self::$md5Map));
     $path = C('INCRE.PATH') . '/' . C('INCRE.VER_FILENAME');
     contents_to_file($path, self::$revision);
 }
 private static function exportMaps($map, $type)
 {
     $maps = '<?php ' . PHP_EOL . '$' . $type . '_build_maps = ';
     $maps .= var_export($map['build'], true);
     $maps .= ';' . PHP_EOL;
     $maps .= '$' . $type . '_static_maps = ';
     $maps .= var_export($map['static'], true);
     $maps .= ';' . PHP_EOL;
     $maps .= '$' . $type . '_1on1_maps = ';
     $maps .= var_export($map['one_on_one'], true);
     $maps .= ';';
     // 格式化,满足规范
     $maps = str_replace(array("  ", 'NULL'), array("    ", 'null'), $maps);
     contents_to_file(C('IFRESH.PATH') . '/' . $type . '_build_maps.php', $maps);
 }
示例#4
0
 /**
  * 写入缓存
  * @param $path
  * @param $contents
  */
 private static function updateCache($path, $contents)
 {
     $file = self::$cacheDir . '/' . file_uid($path);
     contents_to_file($file, $contents);
     self::$cacheMap[$path] = $file;
 }
 /**
  * 写入大图配置
  */
 public function writeSpriteConfig($spriteConfig)
 {
     $path = $this->root . '/' . C('IMERGE_SPRITE_DIR');
     foreach ($spriteConfig as $type => $value) {
         $configFile = $path . '/' . $type . '.php';
         $contents = self::configStringify($value);
         contents_to_file($configFile, $contents);
     }
 }
示例#6
0
 /**
  * 导出map到文件
  * @param $type 预处理器类型
  */
 private function exportMapByType($type)
 {
     contents_to_file(C('SRC.M3D_MAP_PATH') . '/' . $type . C('SRC.M3D_MAP_SUFFIX') . '.php', array_to_string($this->map[$type]));
     // 派发map写入完成事件
     trigger('export_map_end', $this, $type);
 }