예제 #1
0
파일: Less.php 프로젝트: jwlayug/jbst
 /**
  * Saves the source map to a file
  *
  * @param string $file The absolute path to a file
  * @param string $content The content to write
  * @throws Exception If the file could not be saved
  */
 protected function saveMap($file, $content)
 {
     $dir = dirname($file);
     // directory does not exist
     if (!is_dir($dir)) {
         // FIXME: create the dir automatically?
         throw new Exception(sprintf('The directory "%s" does not exist. Cannot save the source map.', $dir));
     }
     // FIXME: proper saving, with dir write check!
     if (fpc($file, $content) === false) {
         throw new Exception(sprintf('Cannot save the source map to "%s"', $file));
     }
     return true;
 }
예제 #2
0
파일: editor.php 프로젝트: Ben749/racetrack
    } else {
        $x['maxid']++;
        $id = $x['maxid'];
    }
    #new id
    unset($_POST['id']);
    $_POST['url'] = $id . '.' . trim(preg_replace('~-{2,}~', '-', preg_replace("~[^a-z0-9]~i", '-', $_POST['title'])), '-');
    $x['post'][$id] = array_filter($_POST);
    $ve = var_export($_POST, 1);
    #reduce produced string
    $ve = str_replace(["array (\n  ", ",\n  "], ['[', ','], $ve);
    if (substr($ve, -3) == ",\n)") {
        $ve = str_replace(",\n)", ']', $ve);
    }
    fpc('contents/ve.' . $fi . '.' . $id . '-.php', '<?$x=' . $ve . ';');
    fpc($file, $x);
    r302("?fi={$fi}&id={$id}#saved");
}
$id = $title = $content = '';
$id = $_GET['id'];
if ($id and $x['post'] and $x['post'][$id]) {
    extract($x['post'][$id]);
}
#print_r(compact('id','x'));
edit:
foreach ($x['post'] as $k => $t) {
    $options .= "<option value='{$k}'>" . $t['title'] . "</option>";
    $list[] = "<a href='?fi={$fi}&id={$k}'>" . $t['title'] . "</a>";
}
html:
?>