if (function_exists('tidy_repair_string')) { $buffer = tidy_repair_string($buffer, array('indent' => TRUE, 'output-xhtml' => TRUE, 'wrap' => 0), 'utf8'); } file_put_contents($file, $buffer); } function getSubstring($buffer, $start, $end, $includeStart = TRUE, $includeEnd = TRUE, $strrpos = FALSE) { if ($includeStart) { $prefix = 0; } else { $prefix = strlen($start); } if ($includeEnd) { $suffix = strlen($end); } else { $suffix = 0; } $start = strpos($buffer, $start); if ($strrpos) { $_end = strrpos($buffer, $end); } else { $_end = strpos($buffer, $end, $start); } if ($start !== FALSE) { return substr($buffer, $start + $prefix, $_end - ($start + $prefix) + $suffix); } else { return ''; } } webifyDirectory($argv[1], $argv[2]);
$suffix = 0; } $start = strpos($buffer, $start); if ($strrpos) { $_end = strrpos($buffer, $end); } else { $_end = strpos($buffer, $end, $start); } if ($start !== FALSE) { return substr($buffer, $start + $prefix, $_end - ($start + $prefix) + $suffix); } else { return ''; } } function loadProperties($buildPropertiesFilename) { $return = array(); $buildProperties = parse_ini_file($buildPropertiesFilename); $return['longName'] = $buildProperties['docbook.longName']; $editions = explode(',', $buildProperties['docbook.editions']); foreach ($editions as $edition) { $parts = explode('-', $edition); $version = $parts[0]; $lang = $parts[1]; $return['editions'][$lang][] = $version; } return $return; } $properties = loadProperties($argv[1]); webifyDirectory($properties, $argv[2], $argv[3]);