All pastes #840426 Raw Edit

Something

public php v1 · immutable
#840426 ·published 2007-12-31 20:52 UTC
rendered paste body
        function Display()        {            /* CLEAN THIS UP --Eric Fritz */            $this->block = $this->StripRoot( glob(PrependRoot("/KauriFramework/extensions/block/*")));            $this->close = $this->StripRoot( glob(PrependRoot("/KauriFramework/extensions/close/*")));                        foreach (glob(PrependRoot("/KauriFramework/extensions/block/*")) as $file)            {                include_once($file);            }                        foreach (glob(PrependRoot("/KauriFramework/extensions/close/*")) as $file)            {                include_once($file);            }                        $content = preg_replace("/\/\*([^\*]+)\*\//", "", $this->piece);                        $magicwords = array("_FILE_"=>$_SERVER['REQUEST_URI'],                                 "_TDIR_"=>"/".substr($this->tpldir, 0, -1),                                 "_SDIR_"=>dirname($_SERVER['PHP_SELF']));                                            foreach ($magicwords as $key=>$val)            {                $content = str_replace($key, $val, $content);            }                        $id = md5(uniqid(time()));            $content = str_replace("\\".$this->openingTag, $id, $content);                        while (true)            {                $chunk = $this->Parser($content);                if ($chunk === false)                {                    break;                }                else                {                    $tag = $this->HarvestTag($chunk);                    $fnname = "_handle_".$tag;                    $params = $this->HarvestParams($chunk);                                        if (in_array($tag, $this->block))                    {                        $outcomes = $this->HarvestBody($chunk);                        $parsed = $fnname($params, $outcomes, &$this->environment);                    }                    else                    {                            $parsed = $fnname($params, &$this->environment);                    }                                        $content = str_replace($chunk, $parsed, $content);                }            }                        $content = $this->ParseEnvironment($content);            return str_replace($id, $this->openingTag, $content);        }                function StripRoot($files)        {            foreach ($files as $file)            {                $new[] = str_replace(".php", "", basename($file));            }                        return $new;        }                function ParseEnvironment($content)        {            foreach ($this->environment as $key=>$val)            {                if (!is_array($val))                {                    $content = str_replace("%".$key."%", $val, $content);                }            }                        return $content;        }