<?php
class FarODPNode {
var $children = array();
var $i = 0;
var $level = 0;
function FarODPNode() {
}
function setLevel($level) {
$this->level = $level;
}
function addNode($node) {
$this->children[$this->i] = $node;
$this->i++;
}
function hasChildren() {
return (count($this->children) > 0) ? true : false;
}
function getElementsByClassName($class) {
$out = array();
// PHP4 returns classes only in lowercase.
if (strtolower(get_class($this)) == strtolower($class)) {
$out[] = $this;
}
if ($this->hasChildren()) {
foreach ($this->children as $c) {
$out = array_merge($out, $c->getElementsByClassName($class));
}
}
return $out;
}
function accept($v, $level) {
$v->visit($this, 0);
if (count($this->children) > 0) {
foreach ($this->children as $n) {
$n->accept($v, $level + 1);
}
}
}
}
class AbstractVisitor {
var $i = 0;
function visit($v, $level) {
$nodeClass = get_class($v);
$m = 'visit' . substr($nodeClass, 3);
$this->$m($v, $level);
}
}
class AstCurCat extends FarODPNode {
var $cat;
function AstCurCat($cat) {
$this->cat = $cat;
}
}
class AstAToZItem extends FarODPNode {
var $name;
var $cat;
function AstAToZItem($name, $cat) {
$this->name = $name;
$this->cat = $cat;
}
}
class AstAToZ extends FarODPNode {
function AstAToZ() {
}
}
class AstBrowseCategoryContainer extends FarODPNode {
function AstBrowseCategoryContainer() {
}
}
class AstBrowseCategorySection extends FarODPNode {
function AstBrowseCategorySection() {
}
}
class AstCategoryBlock extends FarODPNode {
var $cat;
var $name;
function AstCategoryBlock($cat, $name) {
$this->cat = $cat;
$this->name = $name;
}
}
class AstCategoryBlockExample extends FarODPNode {
var $cat;
var $name;
function AstCategoryBlockExample($cat, $name) {
$this->cat = $cat;
$this->name = $name;
}
}
class AstBrowseCategory extends FarODPNode {
var $cat;
var $name;
var $count;
function AstBrowseCategory($cat, $name, $count) {
$this->cat = $cat;
$this->name = $name;
$this->count = $count;
}
}
class AstBrowseCategorySymbolic extends FarODPNode {
var $cat;
var $name;
var $count;
function AstBrowseCategorySymbolic($cat, $name, $count) {
$this->cat = $cat;
$this->name = $name;
$this->count = $count;
}
}
class AstBrowseCategoryRelatedSection extends FarODPNode {
function AstBrowseCategoryRelatedSection() {
}
}
class AstBrowseCategoryRelated extends FarODPNode {
var $cat;
var $name;
var $count;
function AstBrowseCategoryRelated($cat, $name, $count) {
$this->cat = $cat;
$this->name = $name;
$this->count = $count;
}
}
class AstBrowseListingContainer extends FarODPNode {
function AstBrowseListingContainer() {
}
}
class AstBrowseListing extends FarODPNode {
var $url;
var $title;
var $description;
var $isStar;
var $nofollow;
function AstBrowseListing($url, $title, $description, $isStar = false, $nofollow = false) {
$this->url = $url;
$this->title = $title;
$this->description = $description;
$this->isStar = $isStar;
$this->nofollow = $nofollow;
}
}
class AstSearchListingContainer extends FarODPNode {
function AstSearchListingContainer() {
}
}
class AstSearchListing extends FarODPNode {
var $url;
var $title;
var $description;
var $isStar;
var $category;
var $nofollow;
function AstSearchListing($url, $title, $description, $isStar, $category, $nofollow = false) {
$this->url = $url;
$this->title = $title;
$this->description = $description;
$this->isStar = $isStar;
$this->category = $category;
$this->nofollow = $nofollow;
}
}
?>