Ejemplo n.º 1
0
	private static function _spot($sid,$tag=false,$class=false,$styles=false,$ignoreEmpty=false)
	{
		if($tag && (!is_string($tag)))$tag="div";
		$mods=self::modsInSpot($sid);
		$empty=(count($mods)===0);
		$methodDef=self::$c->modHookName("render");
		$methodDefDeep=self::$c->modHookName("renderDeep");
		if($sid==self::$config["contentSpot"])
		{
			content::title(true,true);
			self::_spot(2,true,false,false,true);
			@call_user_func(array(__NAMESPACE__."\\"."content",$methodDef));
		}
		else
		{
			if($tag && (!$empty || !$ignoreEmpty))
			{
				if(is_array($styles))$styles=self::_spotStyles($sid,$styles);
				else $styles=self::_spotStyles($sid);
?>
		<<?php 
echo $tag;
?>
 id="<?php 
echo self::$class;
?>
-spot-<?php 
echo $sid;
?>
" <?php 
echo is_string($class) ? " class=\"{$class}\"" : "";
echo $styles ? $styles : "";
?>
>
<?
			}
		}
		foreach($mods as $mod)
		{
			$args="";
			$method="";
			if($mod["args"]!=="")$args=explode(",",$mod["args"]);
			if(@class_exists(__NAMESPACE__."\\".$mod["class"]))
			{
				if(@method_exists(__NAMESPACE__."\\".$mod["class"],$methodDefDeep))
				{
					$method=$methodDefDeep;
					if(!is_array($args))$args=array($mod["class"],$mod["method"]);
					else
					{
						array_unshift($args,$mod["method"]);
						array_unshift($args,$mod["class"]);
					}
				}
				else
				{
					$method=$mod["method"];
					if(!$method)$method=$methodDef;
					if(!@method_exists(__NAMESPACE__."\\".$mod["class"],$method))$method="";
				}
			}
			if($method)
			{
				if(is_array($args))
					@call_user_func_array(array(__NAMESPACE__."\\".$mod["class"],$method),$args);
				else
					@call_user_func(array(__NAMESPACE__."\\".$mod["class"],$method));
			}
		}
		if($sid==self::$config["contentSpot"])self::_spot(3,true,false,false,true);
		else
		{
			if($tag && (!$empty || !$ignoreEmpty))
			{
?>
		</<?php 
echo $tag;
?>
>
<?
			}
		}
	}