public  function __construct($xmlFile = NULL)
  {
    if (isset($xmlFile) == true) {
      $this->setXmlFile($xmlFile);
    }

    $this->init();
    parent::__construct(NULL);
  }
示例#2
0
<?php 
php;
?>

<html>
    <head>
        <title>Open Pastebin</title>
    </head>
    <body>
        <?php 
require "highlight.php";
require "xmlparser.php";
$xml_parser = new CXmlParser();
$document = $xml_parser->parse("rules.xml");
?>
        <form method="post" action="submit.php">
            Select language:<br>
            <select name="input_language">
            <?php 
var_dump($document);
for ($i = 0; $i < count($document['RULE']); $i++) {
    print "<option value=\"" . $i . "\">";
    print $document['RULE'][$i]['attributes']['NAME'];
    print "</option>";
}
?>
            </select><br>
            Enter text here:<br>
            <textarea name="input_text" rows="25" cols="80"></textarea>
            <br><br>
示例#3
0
文件: view.php 项目: pikaj00/WebD3v11
<html>
    <head>
        <title>Open Pastebin</title>
    </head>
    <body>
        <?php 
require "database.php";
require "highlight.php";
require "xmlparser.php";
if (!isset($_REQUEST['id'])) {
    die("ID not specified!");
}
database_connect();
$array = database_retrieve($_REQUEST['id']);
$text = htmlentities($array['Text']);
$xml_parser = new CXmlParser();
$rules = $xml_parser->parse("rules.xml");
$highlighted_text = apply_rule($rules['RULE'][$array['Language']], $text);
$lines = explode("\n", $highlighted_text);
?>
        <table border="1" cellpadding="2">
            <tr>
                <td>
                    <?php 
print "Language: " . $rules['RULE'][$array['Language']]['attributes']['NAME'];
?>
                </td>
            </tr>
            <tr>
                <td>
                    <?php