Source for file gldom_element.php
Documentation is available at gldom_element.php
* GloryLands DOM Structure - Element Class
* GloryLands, a Web-Based, Massive Multiplayer Online RPG/Strategy Game
* Copyright (C) 2008-09 John Haralampidis <jïhnys2[at]gmail.cïm>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* For any help/suggestions or troubleshooting you can see the
* project community website at <http://www.glorylands.gr>
* @license GNU/GPLv3 GNU General Public License version 3
* @author John Haralampidis <jïhnys2[at]gmail.cïm>
* @copyright Copyright (C) 2007-2009, John Haralampidis
* This class provides the basic class that implements
if ($class != NULL) $this->classname = $class;
if ($id != NULL) $this->id = $id;
// Add the child and find it's ID
$object->root = &$this->root;
// Calculate next/previous
$object->previous = false;
$object->previous = &$this->children[$id- 1];
$object->previous->next = $object;
// Calculate the object id
// Make sure we have a valid id
if (($objid < 0) || ($objid === false)) return false;
$this->vars[$objid]->parent = false;
// Calculate previous/next
if ($this->vars[$objid]->previous !== false) {
$this->vars[$objid]->previous->next = &$this->vars[$objid]->next;
$this->vars[$objid]->previous = false;
$this->vars[$objid]->next = false;
$this->vars[$objid]->root = false;
* Return all the matching elements
* Find a child using the following search pattern simmilar
* to CSS selector on HTML DOM:
* [<classs>].[<id>] : Both Class and ID can be ommited. If ommited,
* everything will be selected
* @param string $search The search pattern
* @param int $count [Optional] The maximum entries to return
* @return array Return the child objects that match the criteria
// Extract class/id from search string
if ($class !== false) $match = $match && ($c->classname == $class);
if ($name !== false) $match = $match && ($c->id == $name);
// Check for maximum elements
if (($count != 0) && (sizeof($res) >= $count)) break;
* Return the first matching element
* Find a child using the following search pattern simmilar
* to CSS selector on HTML DOM:
* [<classs>].[<id>][@<index>]
* Both Class and ID can be ommited. If ommited, everything will be selected.
* Also, in contrast with find_children, you can specify a specific child
* instead of the first. <index> is 1-based.
* @param string $search The search pattern
* @return array|bool Return the child objects that match the criteria
if (isset ($items[$index])) {
|