コード例 #1
0
ファイル: SpiritEngine.php プロジェクト: neel/bong
        }
        //TODO throw Exception as Controller not Existing
        assert('/*Throw SpiritAbstractorNotFound Exception on path ' . $controller . ' */');
    }
    private function layout($spiritName, $methodName)
    {
        $layouts = array(Path::instance()->currentProject("*{$spiritName}.view.-{$methodName}.@layout.php"), Path::instance()->currentProject("*{$spiritName}.view.@layout.php"), Path::instance()->currentProject("*common.view.@layout.php"));
        foreach ($layouts as $layout) {
            if (file_exists($layout)) {
                return $layout;
            }
        }
        //TODO throw Exception as no Layout found Existing
        assert('/*Throw SpiritLayoutNotFound Exception*/');
        print_r($layouts);
    }
    private function coordinator($spiritName)
    {
        return Path::instance()->currentProject("*{$spiritName}.@coordinator.php");
    }
    public function &_spirits()
    {
        return $this->spirits;
    }
    public function &_instances()
    {
        return $this->instances;
    }
}
EngineFactory::register("SpiritEngine");
コード例 #2
0
ファイル: AppXMLServiceEngine.php プロジェクト: neel/bong
<?php

class AppXMLServiceEngine extends ServiceEngine
{
    public function __construct()
    {
        parent::__construct(new MVCEngine(), new XMLDeliveryTrait());
    }
}
EngineFactory::register('AppXMLServiceEngine');
コード例 #3
0
ファイル: SpiritXMLServiceEngine.php プロジェクト: neel/bong
<?php

class SpiritXMLServiceEngine extends ServiceEngine
{
    public function __construct()
    {
        parent::__construct(new SpiritEngineProxy(), new XMLDeliveryTrait());
    }
}
EngineFactory::register('SpiritXMLServiceEngine');
コード例 #4
0
ファイル: SpiritJSONServiceEngine.php プロジェクト: neel/bong
<?php

class SpiritJSONServiceEngine extends ServiceEngine
{
    public function __construct()
    {
        parent::__construct(new SpiritEngineProxy(), new JSONDeliveryTrait());
    }
}
EngineFactory::register('SpiritJSONServiceEngine');
コード例 #5
0
<?php

class SpiritPropertyServiceEngine extends ServiceEngine
{
    public function __construct()
    {
        parent::__construct(new SpiritEngineProxy(), new PropertyDeliveryTrait());
    }
}
EngineFactory::register('SpiritPropertyServiceEngine');
コード例 #6
0
ファイル: MVCEngine.php プロジェクト: neel/bong
     * FIXME Exceptions Not Handled
     * \algo
     * $this->responceBuffer: The XSLT as String
     * $xdoPath: Path to XML DataObject
     * \endalgo
     * @param string $xdoPath
     */
    private function processXSLView($xdoPath)
    {
        $xdo = new DOMDocument();
        $xdo->load($xdoPath);
        $xslt = new DOMDocument();
        if (!@$xslt->loadXML($this->responseBuffer)) {
            //TODO Handle Exceptions
            echo $this->responseBuffer;
            assert("/*Response Malformed Not Parsable as XML TODO Throw Exception*/");
        }
        $transformer = new XSLTProcessor();
        if (!@$transformer->importStylesheet($xslt)) {
            //TODO Handle Exceptions
            echo $transformer->saveXML();
            assert("/*Response Not XSL TODO Throw Exception*/");
        }
        $responseXML = $transformer->transformToDoc($xdo);
        //Response as a DOMDocument
        $this->responseBuffer = $responseXML->saveHTML();
        //TODO will it be HTML or XML should be decided based upon Content Mime Type
    }
}
EngineFactory::register("MVCEngine");
コード例 #7
0
ファイル: AppJSONServiceEngine.php プロジェクト: neel/bong
<?php

class AppJSONServiceEngine extends ServiceEngine
{
    public function __construct()
    {
        parent::__construct(new MVCEngine(), new JSONDeliveryTrait());
    }
}
EngineFactory::register('AppJSONServiceEngine');
コード例 #8
0
ファイル: FSMEngine.php プロジェクト: neel/bong
<?php

class FSMEngine extends ContentEngine
{
    protected function validate()
    {
    }
    public function executeLogic()
    {
    }
    public function run()
    {
        $fsm = \FSM\Engine::parse('site');
        $path = Path::instance()->evaluate('common') . '/fsm.php';
        ob_start();
        require $path;
        $this->responseBuffer = ob_get_contents();
        ob_end_clean();
    }
}
EngineFactory::register("FSMEngine");
コード例 #9
0
<?php

class AppResponseServiceEngine extends ServiceEngine
{
    public function __construct()
    {
        parent::__construct(new MVCEngine(), new ResponseDeliveryTrait());
    }
}
EngineFactory::register('AppResponseServiceEngine');
コード例 #10
0
ファイル: ResourceEngine.php プロジェクト: neel/bong
                        case 'xslt':
                            http::contentType('text/xml+xslt');
                            break;
                        case 'scrap':
                            http::contentType('text/plain');
                            break;
                        default:
                    }
                    switch ($this->navigation->resourceType) {
                        case 'img':
                            $this->responseBuffer = file_get_contents($resourcePath);
                            break;
                        default:
                            ob_start();
                            require $resourcePath;
                            $this->responseBuffer = ob_get_contents();
                            ob_end_clean();
                    }
                } else {
                    throw new FileNotFoundException($resourcePath ? $resourcePath : 'null <Resource Path Could not be Resolved> ');
                }
            } else {
                throw new ProjectDirNotFoundException($this->projectName);
            }
        } else {
            throw new ProjectNotFoundException($this->projectName);
        }
    }
}
EngineFactory::register('ResourceEngine');
コード例 #11
0
<?php

class SpiritResponseServiceEngine extends ServiceEngine
{
    public function __construct()
    {
        parent::__construct(new SpiritEngineProxy(), new ResponseDeliveryTrait());
    }
}
EngineFactory::register('SpiritResponseServiceEngine');