KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.62
System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
User : www ( 80)
PHP Version : 8.3.8
Disable Function : NONE
Directory :  /domains/irtiweb/CATS/lib/artichow/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /domains/irtiweb/CATS/lib/artichow/Pattern.class.php
<?php
/*
 * This work is hereby released into the Public Domain.
 * To view a copy of the public domain dedication,
 * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
 *
 */

require_once dirname(__FILE__)."/Graph.class.php";

/**
 * All patterns must derivate from this class
 *
 * @package Artichow
 */
abstract class awPattern {

	/**
	 * Pattern arguments
	 *
	 * @var array
	 */
	protected $args = array();

	/**
	 * Load a pattern
	 *
	 * @param string $pattern Pattern name
	 * @return Component
	 */
	public static function get($pattern) {

		$file = ARTICHOW_PATTERN.DIRECTORY_SEPARATOR.$pattern.'.php';

		if(is_file($file)) {

			require_once $file;

			$class = $pattern.'Pattern';

			if(class_exists($class)) {
				return new $class;
			} else {
				trigger_error("Class '".$class."' does not exist", E_USER_ERROR);
			}

		} else {
			trigger_error("Pattern '".$pattern."' does not exist", E_USER_ERROR);
		}

	}

	/**
	 * Change pattern argument
	 *
	 * @param string $name Argument name
	 * @param mixed $value Argument value
	 */
	public function setArg($name, $value) {
		if(is_string($name)) {
			$this->args[$name] = $value;
		}
	}

	/**
	 * Get an argument
	 *
	 * @param string $name
	 * @param mixed $default Default value if the argument does not exist (default to NULL)
	 * @return mixed Argument value
	 */
	protected function getArg($name, $default = NULL) {
		if(array_key_exists($name, $this->args)) {
			return $this->args[$name];
		} else {
			return $default;
		}
	}

	/**
	 * Change several arguments
	 *
	 * @param array $args New arguments
	 */
	public function setArgs($args) {
		if(is_array($args)) {
			foreach($args as $name => $value) {
				$this->setArg($name, $value);
			}
		}
	}

}

registerClass('Pattern', TRUE);
?>

Anon7 - 2021