예제 #1
0
파일: Kernel.php 프로젝트: notbrain/symfony
 public function __construct()
 {
     $this->tmpDir = sys_get_temp_dir() . '/sf2_' . rand(1, 9999);
     if (!is_dir($this->tmpDir)) {
         if (false === @mkdir($this->tmpDir)) {
             die(sprintf('Unable to create a temporary directory (%s)', $this->tmpDir));
         }
     } elseif (!is_writable($this->tmpDir)) {
         die(sprintf('Unable to write in a temporary directory (%s)', $this->tmpDir));
     }
     parent::__construct('env', true);
     $loader = new UniversalClassLoader();
     $loader->registerNamespaces(array('TestBundle' => __DIR__ . '/Fixtures/', 'TestApplication' => __DIR__ . '/Fixtures/'));
     $loader->register();
 }
예제 #2
0
<?php

namespace phpOpenNOS;

require_once __DIR__ . '/../vendor/Symfony/Component/HttpFoundation/UniversalClassLoader.php';
use Symfony\Component\HttpFoundation\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array('phpOpenNOS' => dirname(__FILE__) . '/..'));
$loader->register();
use phpOpenNOS\Model\Article;
use phpOpenNOS\Model\Video;
use phpOpenNOS\Model\Audio;
use phpOpenNOS\Model\Dayguide;
class OpenNOS
{
    const NEWS = 'nieuws';
    const SPORT = 'sport';
    const SORT_SCORE = 'score';
    const SORT_DATE = 'date';
    protected $apikey;
    protected $typeMapping = array('artikel' => 'phpOpenNOS\\Model\\Article', 'video' => 'phpOpenNOS\\Model\\Video', 'audio' => 'phpOpenNOS\\Model\\Audio');
    public function __construct($apikey)
    {
        $this->apikey = $apikey;
    }
    /**
     * Get the latest articles for the specified category
     *
     * @param string $category
     * @return array
     */
예제 #3
0
<?php

// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development');
/**
 * Autoloaders
 */
// This line is needed for Zend Framework to work correctly, and for Symfony Universal Class Loader to be found correctly
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path())));
use Symfony\Component\HttpFoundation\UniversalClassLoader;
// http://docs.symfony-reloaded.org/guides/tools/autoloader.html
require_once 'Symfony/Component/HttpFoundation/UniversalClassLoader.php';
$uLoader = new UniversalClassLoader();
$uLoader->registerNamespaces(array('Symfony' => '../library/', 'Doctrine' => '../library/', 'DoctrineExtensions' => '../library/Doctrine/Extensions/', 'App' => '../library/'));
$uLoader->registerPrefix('Zend_', '../library/');
$uLoader->register();
/**
 * Zend_Application
 */
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, realpath(APPLICATION_PATH . '/../config') . '/application.ini');
$application->bootstrap()->run();