public static function getInstance() { if (self::$_instance === NULL) { self::$_instance = new self(); } return self::$_instance; }
function __init() { parent::__init(); $this->graph = ARC2::getComponent('PMJ_ResourceGraphPlugin', array('ns' => $this->ns)); if (!isset($this->currURI)) { $this->currURI = isset($this->a['currURI']) ? $this->expandPName($this->a['currURI']) : false; } if (!isset($this->revProp)) { $this->revProp = isset($this->a['revProp']) ? $this->expandPName($this->a['revProp']) : false; } if (!isset($this->revURI)) { $this->revURI = isset($this->a['revURI']) ? $this->expandPName($this->a['revURI']) : false; } $this->storeGraphURI = isset($this->a['storeGraphURI']) ? $this->expandPName($this->a['storeGraphURI']) : ''; $this->subNegotiators = array(); $this->store = isset($this->a['store']) ? $this->a['store'] : false; $this->selector = isset($this->a['selector']) ? $this->a['selector'] : NegotiatorSelector::getInstance(); $this->source = isset($this->a['source']) ? $this->a['source'] : false; $this->ns['rdfs'] = 'http://www.w3.org/2000/01/rdf-schema#'; $this->ns['rdf'] = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'; $this->ns['xsd'] = "http://www.w3.org/2001/XMLSchema#"; }
$this->setNegotiators(); } public function setNegotiators() { if ($handle = opendir('./')) { while (false !== ($file = readdir($handle))) { if (substr($file, 0, 11) == 'negotiators_' && substr($file, -1) != '~') { include_once $file; $this->negotiators[] = rtrim($file, '.php'); } } closedir($handle); } } public function applyTestOnNegotiator($n, $val) { return call_user_func(array($n, 'applyTest'), $val); } public function getNegotiators($val, $nArray = false) { $retArray = array(); $nArray = $nArray ? $nArray : $this->negotiators; foreach ($this->negotiators as $n) { if ($this->applyTestOnNegotiator($n, $val)) { $retArray[] = ARC2::getComponent($n); } } } } $ns = new NegotiatorSelector(); echo $ns->applyTests();