phpQuery::removeData PHP Method

removeData() public static method

public static removeData ( $node, $name, $documentID )
    public static function removeData($node, $name, $documentID)
    {
        if (!$documentID) {
            // TODO check if this works
            $documentID = self::getDocumentID($node);
        }
        $document = self::$documents[$documentID];
        $node = self::dataSetupNode($node, $documentID);
        $id = $node->dataID;
        if ($name) {
            if (isset($document->data[$id][$name])) {
                unset($document->data[$id][$name]);
            }
            $name = null;
            foreach ($document->data[$id] as $name) {
                break;
            }
            if (!$name) {
                self::removeData($node, $name, $documentID);
            }
        } else {
            self::dataRemoveNode($node, $documentID);
        }
    }

Usage Example

Example #1
0
 /**
  * Enter description here...
  * 
  * @param <type> $key
  */
 public function removeData($key)
 {
     foreach ($this as $node) {
         phpQuery::removeData($node, $key, $this->getDocumentID());
     }
     return $this;
 }