Uname: Linux premium264.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
Software: LiteSpeed
PHP version: 8.3.22 [ PHP INFO ] PHP os: Linux
Server Ip: 69.57.162.13
Your Ip: 216.73.216.219
User: workvvfb (1129) | Group: workvvfb (1084)
Safe Mode: OFF
Disable Function:
NONE

name : LiveProperty.php
<?php

namespace WPDaddy\Dom;

/**
 * Calls prop_* methods to provide live properties through the
 * __get and __set magic methods.
 *
 * If the class with this trait has its own __get method, for compatibility
 * it should call the __get_live method after its own processing.
 *
 * @property-read Document $ownerDocument
 */
trait LiveProperty {
	public function __get($name){
		return self::__get_live($name);
	}

	public function __set($name, $value){
		return self::__set_live($name, $value);
	}

	private function __get_live($name){
		$methodName = "prop_get_$name";
		if(method_exists($this, $methodName)) {
			return $this->$methodName();
		}

		$props = PropertyAttribute::PROPERTY_ATTRIBUTE_MAP;
		if(isset($props[$name])) {
			$attribute = PropertyAttribute::PROPERTY_ATTRIBUTE_MAP[$name];
			if($attribute === true) {
				return $this->hasAttribute($name);
			}

			return $this->getAttribute($name);
		}
	}

	private function __set_live($name, $value){
		$methodName = "prop_set_$name";
		if(method_exists($this, $methodName)) {
			return $this->$methodName($value);
		}
		$props = PropertyAttribute::PROPERTY_ATTRIBUTE_MAP;

		if(isset($props[$name])) {
			$attribute = PropertyAttribute::PROPERTY_ATTRIBUTE_MAP[$name];
			if($attribute === true) {
				$newAttr = $this->ownerDocument->createAttribute($name);

				if($value) {
					$this->setAttributeNode($newAttr);
				} else {
					$this->removeAttribute($name);
				}
			} else {
				$this->setAttribute($attribute, $value);
			}
		}

		return null;
	}
}
© 2025 GrazzMean