Exemplo n.º 1
0
 static function getServiceContainer($conf = 'config/conf.xml')
 {
     if (!self::$sc) {
         self::$sc = new sfServiceContainerBuilder();
         $loader = new sfServiceContainerLoaderFileXml(self::$sc);
         $loader->load(JACK_PROJECT_DIR . $conf);
     }
     return self::$sc;
 }
Exemplo n.º 2
0
<?php

define("JACK_PROJECT_DIR", dirname(__FILE__) . '/');
define("JACK_WEBROOT", "http://" . $_SERVER['HTTP_HOST'] . str_replace("/index.php", "", $_SERVER['SCRIPT_NAME']));
include_once JACK_PROJECT_DIR . "/inc/demoinit.php";
/* traditionally without dependency injection */
/*
$config = array('transport' => 'davex', 'url' => 'http://localhost:8080/server', 'workspace' => 'default', 'user' => 'admin', 'pass' => 'admin');
$session = demoinit::initAppAndGetSession($config);
*/
/* With dependency injection */
include_once JACK_PROJECT_DIR . "/inc/demoinitWithDI.php";
$config = 'conf/config.xml';
$session = demoinitWithDI::initAppAndGetSession($config);
try {
    $wiki = new demowiki($session);
    if (isset($_SERVER['PATH_INFO'])) {
        $path = "/" . trim($_SERVER['PATH_INFO'], "/");
    } else {
        $path = "";
    }
    include JACK_PROJECT_DIR . "tmpl/head.php";
    try {
        if (!isset($_GET['action'])) {
            print $wiki->viewAction($path);
        } else {
            $method = $_GET['action'] . "Action";
            if (method_exists($wiki, $method)) {
                print $wiki->{$method}($path);
            } else {
                print $wiki->viewAction($path);