Beispiel #1
0
function generatePrologDTDtyping($dtd)
{
    $table = "dtdFile";
    include_once realpath('') . '/includes/configuration/core_configuration.php';
    //Load the pear library
    require_once 'XML_DTD/DTD.php';
    ob_implicit_flush(true);
    $path = ini_get('include_path');
    $dtd = 'w3cDtds/' . $dtd;
    ini_set('include_path', realpath('..') . ":{$path}");
    $formElements = array();
    $formElements[0] = 'select';
    $formElements[1] = 'option';
    $formElements[2] = 'textarea';
    $formElements[3] = 'input';
    $typeRulesArray = array(":- multifile attributetype/3.\n\n");
    for ($index = 0; $index < sizeof($formElements); $index++) {
        $typeRule = dtd::findAttributes($formElements[$index], $dtd);
        $typeRulesArray = array_merge($typeRulesArray, $typeRule->toArray());
    }
    for ($index = 0; $index < sizeof($typeRulesArray); $index++) {
        echo "{$typeRulesArray[$index]}<br>";
    }
    writer::write('typedefinitions.pl', 'cgi-bin/htmlTyping/', $typeRulesArray);
}
Beispiel #2
0
 function transferToProlog($username, $dataArray)
 {
     //Generate filename
     $filename = sha1($username . date('U'));
     writer::write($filename, 'cgi-bin/transfer/', $dataArray);
     return $filename;
 }
Beispiel #3
0
 function testWriterWritingValid()
 {
     $file = 'test';
     $dir = '../';
     $this->assertNoErrors(writer::write($file, $dir, array(1)));
     $this->assertNoErrors(writer::write($file, $dir, array('x' => 1)));
 }
Beispiel #4
0
 protected static function writeLabelWithWriter($label, $value, $level, writer $writer)
 {
     return $writer->write(($level <= 0 ? '' : str_repeat(self::padding, $level)) . (preg_match('/^ +$/', $label) ? $label : rtrim($label)) . ': ' . trim($value));
 }