header('Pragma: no-cache'); // Autoload class files spl_autoload_register(function ($classname) { $classname = strtolower($classname); $error = '"' . $classname . '.php" file could not be included!'; if (!@(include './' . $classname . '.php')) { echo '(document.getElementById (\'hashover\') || document.body).innerHTML += \'' . $error . '\';'; exit; } }); // Instantiate HashOver class $hashover = new HashOver('javascript'); $hashover->setup->setPageURL('request'); $hashover->setup->setPageTitle('request'); $hashover->initiate(); $hashover->parsePrimary($hashover->setup->collapsesComments); $hashover->parsePopular(); $hashover->finalize(); // Start output buffer ob_start(); // Attempt to include JavaScript frontend code if (!(include './javascript-mode.php')) { ob_end_clean(); exit('document.getElementById (\'hashover\').innerHTML = \'<b>HashOver - Error:</b> file "javascript-mode.php" could not be included!\';'); } // Get output buffer contents and turn off output buffering $javascript = ob_get_contents(); ob_end_clean(); // Minify JavaScript if enabled, and non-minified version isn't requested if ($hashover->setup->minifiesJavaScript === true) { if (!isset($_GET['hashover-unminified'])) {
// Tell browser this is XML/RSS header('Content-Type: application/xml; charset=utf-8'); // Autoload class files spl_autoload_register(function ($classname) { $classname = strtolower($classname); $error = '"' . $classname . '.php" file could not be included!'; if (!@(include '../scripts/' . $classname . '.php')) { echo '(document.getElementById (\'hashover\') || document.body).innerHTML += \'' . $error . '\';'; exit; } }); // Instantiate HashOver class $hashover = new HashOver('api'); $hashover->setup->setPageURL('request'); $hashover->initiate(); $hashover->parsePrimary(); // Create new DOM document. $xml = new DOMDocument('1.0', 'UTF-8'); $xml->preserveWhiteSpace = false; $xml->formatOutput = true; // Create main RSS element $rss = $xml->createElement('rss'); $rss->setAttribute('version', '2.0'); $rss->setAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); $rss->setAttribute('xmlns:content', 'http://purl.org/rss/1.0/modules/content/'); $rss->setAttribute('xmlns:atom', 'http://www.w3.org/2005/Atom'); // Display error if the API is disabled if ($hashover->setup->APIStatus('rss') === 'disabled') { $title = $xml->createElement('title'); $title_value = $xml->createTextNode('HashOver: RSS API is not enabled.'); $title->appendChild($title_value);
// Autoload class files spl_autoload_register(function ($classname) { $classname = strtolower($classname); $error = '"' . $classname . '.php" file could not be included!'; if (!@(include '../scripts/' . $classname . '.php')) { echo '(document.getElementById (\'hashover\') || document.body).innerHTML += \'' . $error . '\';'; exit; } }); // Instantiate HashOver class $hashover = new HashOver('api'); // Display error if the API is disabled if (!isset($_POST['ajax']) and $hashover->setup->APIStatus('json') === 'disabled') { exit(json_encode(array('error' => '<b>HashOver</b>: This API is not enabled.'))); } // Configure HashOver and load comments $hashover->setup->setPageURL('request'); $hashover->initiate(); // Setup where to start reading comments $start = !empty($_POST['start']) ? $_POST['start'] : 0; // Check for comments if ($hashover->readComments->totalCount > 1) { // Parse primary comments // TODO: Use starting point $hashover->parsePrimary(false, 0); // Display as JSON data echo json_encode($hashover->comments); } else { // Return no comments message echo json_encode(array('No comments.')); }