Exemplo n.º 1
0
 /**
  * Calls all init functions of the WCF class.
  */
 public function __construct()
 {
     // add autoload directory
     self::$autoloadDirectories['wcf'] = WCF_DIR . 'lib/';
     // define tmp directory
     if (!defined('TMP_DIR')) {
         define('TMP_DIR', FileUtil::getTempFolder());
     }
     // register additional autoloaders
     require_once WCF_DIR . 'lib/system/api/phpline/phpline.phar';
     require_once WCF_DIR . 'lib/system/api/zend/Loader/StandardAutoloader.php';
     $zendLoader = new ZendLoader(array(ZendLoader::AUTOREGISTER_ZF => true));
     $zendLoader->register();
     $argv = new ArgvParser(array('packageID=i' => ''));
     $argv->setOption(ArgvParser::CONFIG_FREEFORM_FLAGS, true);
     $argv->parse();
     define('PACKAGE_ID', $argv->packageID ?: 1);
     // disable benchmark
     define('ENABLE_BENCHMARK', 0);
     // start initialization
     $this->initDB();
     $this->loadOptions();
     $this->initSession();
     $this->initLanguage();
     $this->initTPL();
     $this->initCoreObjects();
     $this->initApplications();
     // the destructor registered in core.functions.php will only call the destructor of the parent class
     register_shutdown_function(array('wcf\\system\\CLIWCF', 'destruct'));
     $this->initArgv();
     $this->initPHPLine();
     $this->initAuth();
     $this->checkForUpdates();
     $this->initCommands();
 }
Exemplo n.º 2
0
 public function setUp()
 {
     if (!class_exists('Archive_Tar')) {
         $autoloader = new StandardAutoloader();
         $autoloader->setFallbackAutoloader(true);
         if (!$autoloader->autoload('Archive_Tar')) {
             $this->markTestSkipped('This filter needs PEARs Archive_Tar');
         }
     }
     $files = array(dirname(__DIR__) . '/_files/zipextracted.txt', dirname(__DIR__) . '/_files/_compress/Compress/First/Second/zipextracted.txt', dirname(__DIR__) . '/_files/_compress/Compress/First/Second', dirname(__DIR__) . '/_files/_compress/Compress/First/zipextracted.txt', dirname(__DIR__) . '/_files/_compress/Compress/First', dirname(__DIR__) . '/_files/_compress/Compress/zipextracted.txt', dirname(__DIR__) . '/_files/_compress/Compress', dirname(__DIR__) . '/_files/_compress/zipextracted.txt', dirname(__DIR__) . '/_files/_compress', dirname(__DIR__) . '/_files/compressed.tar');
     foreach ($files as $file) {
         if (file_exists($file)) {
             if (is_dir($file)) {
                 rmdir($file);
             } else {
                 unlink($file);
             }
         }
     }
     if (!file_exists(dirname(__DIR__) . '/_files/Compress/First/Second')) {
         mkdir(dirname(__DIR__) . '/_files/Compress/First/Second', 0777, true);
         file_put_contents(dirname(__DIR__) . '/_files/Compress/First/Second/zipextracted.txt', 'compress me');
         file_put_contents(dirname(__DIR__) . '/_files/Compress/First/zipextracted.txt', 'compress me');
         file_put_contents(dirname(__DIR__) . '/_files/Compress/zipextracted.txt', 'compress me');
     }
 }
Exemplo n.º 3
0
 public static function register()
 {
     /**
      * Register ModSync namespace
      */
     $autoLoader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
     $autoLoader->registerNamespace('ModSync', Base::getCoreComponentsDir() . DIRECTORY_SEPARATOR . __NAMESPACE__);
     $autoLoader->register();
     /**
      * Register all other namespaces
      */
     $components = new DirectoryIterator(Base::getCoreComponentsDir());
     foreach ($components as $component) {
         if ($component->isDot()) {
             continue;
         }
         if ($component->getFilename() == 'ModSync') {
             continue;
         }
         $componentFile = new SplFileInfo($component->getPathname() . DIRECTORY_SEPARATOR . 'Component' . DIRECTORY_SEPARATOR . 'Component.php');
         if ($componentFile->isFile()) {
             $autoLoader->registerNamespace($component->getFilename(), $component->getPathname());
         }
     }
 }
Exemplo n.º 4
0
<?php

use Zend\Loader\StandardAutoloader;
chdir(dirname(__DIR__));
include 'init_autoloader.php';
$loader = new StandardAutoloader();
$loader->registerNamespace('ZfDealsTest', __DIR__ . '/ZfDealsTest');
$loader->register();
Zend\Mvc\Application::init(include 'config/application.config.php');
Exemplo n.º 5
0
<?php

use Zend\ServiceManager\ServiceManager;
use Zend\Mvc\Service\ServiceManagerConfig;
use Zend\Loader\StandardAutoloader;
chdir(__DIR__);
$previousDir = '.';
while (!file_exists('config/application.config.php')) {
    $dir = dirname(`pwd`);
    if ($previousDir === $dir) {
        throw new RuntimeException('Unable to locate "config/application.config.php":' . ' is SxMail in a sub-directory of your application skeleton?');
    }
    $previousDir = $dir;
    chdir($dir);
}
if (!@(include_once __DIR__ . '/../../vendor/autoload.php') && !@(include_once __DIR__ . '/../../../autoload.php')) {
    throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?');
}
if (!($config = @(include __DIR__ . '/TestConfiguration.php'))) {
    $config = (require __DIR__ . '/TestConfiguration.php.dist');
}
$loader = new StandardAutoloader();
$loader->registerNamespace('SxMail', __DIR__ . '/../src/SxMail');
$loader->registerNamespace('SxMailTest', __DIR__ . '/SxMailTest');
$loader->register();
$serviceManager = new ServiceManager(new ServiceManagerConfig(isset($config['service_manager']) ? $config['service_manager'] : array()));
$serviceManager->setService('ApplicationConfig', $config);
/* @var $moduleManager \Zend\ModuleManager\ModuleManager */
$moduleManager = $serviceManager->get('ModuleManager');
$moduleManager->loadModules();
$libPath = getenv('LIB_PATH') ? getenv('LIB_PATH') : __DIR__ . '/../library';
if (!is_dir($libPath)) {
    // Try to load StandardAutoloader from include_path
    if (false === (include 'Zend/Loader/StandardAutoloader.php')) {
        echo "Unable to locate autoloader via include_path; aborting" . PHP_EOL;
        exit(2);
    }
} else {
    // Try to load StandardAutoloader from library
    if (false === (include $libPath . '/Zend/Loader/StandardAutoloader.php')) {
        echo "Unable to locate autoloader via library; aborting" . PHP_EOL;
        exit(2);
    }
}
// Setup autoloading
$loader = new StandardAutoloader(array('autoregister_zf' => true));
$loader->register();
$rules = array('help|h' => 'Get usage message', 'library|l-s' => 'Library to parse; if none provided, assumes current directory', 'output|o-s' => 'Where to write plugin map file; if not provided, assumes "plugin_classmap.php" in library directory', 'append|a' => 'Append to plugin map file if it exists', 'overwrite|w' => 'Whether or not to overwrite existing autoload file');
try {
    $opts = new Console\Getopt($rules);
    $opts->parse();
} catch (Console\Exception\RuntimeException $e) {
    echo $e->getUsageMessage();
    exit(2);
}
if ($opts->getOption('h')) {
    echo $opts->getUsageMessage();
    exit;
}
$path = $libPath;
if (array_key_exists('PWD', $_SERVER)) {
Exemplo n.º 7
0
 public function testAutoloadsNamespacedClassesWithUnderscores()
 {
     $loader = new StandardAutoloader();
     $loader->registerNamespace('ZendTest\\UnusualNamespace', __DIR__ . '/TestAsset');
     $loader->autoload('ZendTest\\UnusualNamespace\\Name_Space\\Namespaced_Class');
     $this->assertTrue(class_exists('ZendTest\\UnusualNamespace\\Name_Space\\Namespaced_Class', false));
 }
Exemplo n.º 8
0
 public function testRegisterRegistersCallbackWithSplAutoload()
 {
     $loader = new StandardAutoloader();
     $loader->register();
     $loaders = spl_autoload_functions();
     $this->assertTrue(count($this->loaders) < count($loaders));
     $test = array_pop($loaders);
     $this->assertEquals(array($loader, 'autoload'), $test);
 }
Exemplo n.º 9
0
 /**
  * Setup autoloader. Phrozn uses Zend Framework 2 autoloader.
  *
  * @return void
  */
 private function __construct()
 {
     if (strpos('@PHP-BIN@', '@PHP-BIN') === 0) {
         $base = dirname(__FILE__) . '/';
         set_include_path($base . PATH_SEPARATOR . get_include_path());
     } else {
         $base = '@PEAR-DIR@/Phrozn/';
     }
     require_once $base . 'Vendor/Zend/Loader/StandardAutoloader.php';
     $loader = new Loader();
     $loader->registerNamespace('Zend', $base . 'Vendor/Zend')->registerNamespace('Phrozn', $base)->registerNamespace('Symfony', $base . 'Vendor/Symfony')->registerNamespace('Twig', $base . 'Vendor/Twig')->setFallbackAutoloader(true)->register();
     // allow to use plugins from project's .phrozn/plugins
     $plugins = getcwd();
     if (strpos($plugins, '.phrozn') === false) {
         $plugins .= '/.phrozn';
     }
     $plugins .= '/plugins/';
     if (is_dir($plugins)) {
         $loader->registerNamespace('PhroznPlugin', $plugins);
     }
     $this->loader = $loader;
 }
Exemplo n.º 10
0
 /**
  * @param StandardAutoloader &$loader
  * @return StandardAutoloader $loader
  */
 protected static function registerAddtionalNamespace(StandardAutoloader &$loader) : StandardAutoloader
 {
     $loader->registerNamespace('Gz3Base\\Test', __DIR__);
     return $loader;
 }
Exemplo n.º 11
0
<?php

define("__FORM__", "Application\\Form\\Type\\");
define("__ENTITY__", "Application\\Model\\Entity\\");
use Silex\Application;
use Zend\Loader\StandardAutoloader;
use Zend\Loader\ClassMapAutoloader;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Loader\YamlFileLoader;
$standarAutoloader = new StandardAutoloader();
$classmapAutoloader = new ClassMapAutoloader();
$standarAutoloader->registerNamespaces(array('Application\\' => __DIR__ . '/../'));
$classmapAutoloader->registerAutoloadMap(array('PHPExcel' => __DIR__ . '/../../lib/excel/PHPExcel.php', 'PHPMailer' => __DIR__ . '/../../lib/mailer/phpmailer.php', 'SMTP' => __DIR__ . '/../../lib/mailer/class.smtp.php', 'vcalendar' => __DIR__ . '/../../lib/calendar/ical/iCalcreator.class.php'));
$standarAutoloader->register();
$classmapAutoloader->register();
$app["debug"] = true;
$c = new \vcalendar(array('unique_id' => $_SERVER['HTTP_HOST']));
$t =& $c->newComponent('vtodo');
$t->setProperty('dtstart', '19970415T133000 GMT');
$t->setProperty('due', '19970416T045959 GMT');
$t->setProperty('summary', '1996 Income Tax Preparation');
$t->setProperty('class', 'CONFIDENTIAL');
$t->setProperty('categories', 'FAMILY');
$t->setProperty('categories', 'FINANCE');
$t->setProperty('priority', 1);
$t->setProperty('status', 'NEEDS-ACTION');
$str = $c->createCalendar();
$calendarPath = __DIR__ . '/../tmp/Calendar';
file_put_contents($calendarPath . '/sample.ics', $str);
//echo $str;
 /**
  * @param string $namespace
  * @param string $namespaceDirectory
  */
 protected function registerEntityFilesNamespace($namespace, $namespaceDirectory)
 {
     $loader = new StandardAutoloader();
     $loader->registerNamespace($namespace, $namespaceDirectory);
     $loader->register();
 }
Exemplo n.º 13
0
<?php

/**
 * This makes our life easier when dealing with paths. Everything is relative
 * to the application root now.
 */
chdir(dirname(__DIR__));
// Setup autoloading
require 'vendor/autoload.php';
require 'module/Debug.php';
use Zend\Loader\StandardAutoloader;
$autoloader = new StandardAutoloader();
$autoloader->registerNamespace('ApplicationTest', __DIR__ . '/ApplicationTest/');
$autoloader->registerNamespace('TheodiaTest', __DIR__ . '/TheodiaTest/');
$autoloader->register();
// All tests always execute with a mocked 'now' time
$myClassReflection = new \ReflectionClass(Application\Utility::class);
$nowProperty = $myClassReflection->getProperty('now');
$nowProperty->setAccessible(true);
$nowProperty->setValue(null, new \DateTimeImmutable('2015-01-02T03:04:00', new \DateTimeZone('UTC')));
Exemplo n.º 14
0
<?php

use Zend\Loader\StandardAutoloader;
require_once '../../../zendframework/zendframework/library/Zend/Loader/StandardAutoloader.php';
$loader = new StandardAutoloader(array('autoregister_zf' => true));
$loader->registerNamespace('Skpd\\Bootstrap\\', '../src');
$loader->register();
$view = new \Zend\View\Renderer\PhpRenderer();
$view->getHelperPluginManager()->setInvokableClass('form', 'Skpd\\Bootstrap\\Form\\View\\Helper\\Form');
$view->getHelperPluginManager()->setInvokableClass('formColor', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormColor');
$view->getHelperPluginManager()->setInvokableClass('formDateTime', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormDateTime');
$view->getHelperPluginManager()->setInvokableClass('formEmail', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormEmail');
$view->getHelperPluginManager()->setInvokableClass('formFile', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormFile');
$view->getHelperPluginManager()->setInvokableClass('formInput', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormInput');
$view->getHelperPluginManager()->setInvokableClass('formMonth', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormMonth');
$view->getHelperPluginManager()->setInvokableClass('formNumber', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormNumber');
$view->getHelperPluginManager()->setInvokableClass('formPassword', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormPassword');
$view->getHelperPluginManager()->setInvokableClass('formRow', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormRow');
$view->getHelperPluginManager()->setInvokableClass('formSelect', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormSelect');
$view->getHelperPluginManager()->setInvokableClass('formTel', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormTel');
$view->getHelperPluginManager()->setInvokableClass('formText', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormText');
$view->getHelperPluginManager()->setInvokableClass('formTextArea', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormTextarea');
$view->getHelperPluginManager()->setInvokableClass('formUrl', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormUrl');
$view->getHelperPluginManager()->setInvokableClass('formCollection', 'Skpd\\Bootstrap\\Form\\View\\Helper\\FormCollection');
$view->getHelperPluginManager()->setInvokableClass('formLabel', 'Zend\\Form\\View\\Helper\\FormLabel');
$view->getHelperPluginManager()->setInvokableClass('formElement', 'Zend\\Form\\View\\Helper\\FormElement');
$view->getHelperPluginManager()->setInvokableClass('formElementErrors', 'Zend\\Form\\View\\Helper\\FormElementErrors');
$view->getHelperPluginManager()->setInvokableClass('formCheckbox', 'Zend\\Form\\View\\Helper\\FormCheckbox');
$view->getHelperPluginManager()->setInvokableClass('formSubmit', 'Zend\\Form\\View\\Helper\\FormSubmit');
$view->getHelperPluginManager()->setInvokableClass('formButton', 'Zend\\Form\\View\\Helper\\FormButton');
$view->getHelperPluginManager()->setInvokableClass('headScript', 'Zend\\View\\Helper\\HeadScript');
Exemplo n.º 15
0
    /**
     * borrowed from Zend\Loader\StandardAutoloader
     */
    public function testCanActAsFallbackAutoloader()
    {
        $loader = new StandardAutoloader();
        $loader->setFallbackAutoloader(true);
        set_include_path(__DIR__ . '/TestAsset/' . PATH_SEPARATOR . $this->includePath);
        $loader->autoload('TestNamespace\TestProvider');
        $loader->autoload('TestNamespace\TestInvalidProvider');

        //initialize ini
        $ini = __DIR__. '/_files/enable.ini';
        file_put_contents($ini, '');

        $clientConfig = new ClientConfig;
        $clientConfig->setConfigFilePath($ini);
        $this->_registry->setConfig($clientConfig);
        $config = $this->_configProvider;

        // Test enable provider 
        try {
            $config->enableProvider('TestNamespace\TestInvalidProvider');
            $this->fail('RuntimeException was expected but not thrown');
        } catch (RuntimeException $re) {
        }

        $config->enableProvider('TestNamespace\TestProvider');
        $configs = $clientConfig->basicloader->classes;
        $this->assertEquals('TestNamespace\TestProvider', $configs->current());
        
        // Test disable provider
        try {
            $config->disableProvider('TestNamespace\TestInvalidProvider');
            $this->fail('RuntimeException was expected but not thrown');
        } catch (RuntimeException $re) {
        }

        $config->disableProvider('TestNamespace\TestProvider');
        $this->assertEmpty($configs->current(), 'No config setting will exists');

        /**
         * manifest test
         */
        $loader->autoload('TestNamespace\TestManifest');
        $loader->autoload('TestNamespace\TestInvalidManifest');

        try {
            $config->enableManifest('TestNamespace\TestInvalidManifest');
            $this->fail('RuntimeException was expected but not thrown');
        } catch (RuntimeException $re) {
        }

        $config->enableManifest('TestNamespace\TestManifest');

        $configs = $clientConfig->basicloader->classes;
        $this->assertEquals('TestNamespace\TestManifest', $configs->current());

        try {
            $config->disableManifest('TestNamespace\TestInvalidManifest');
            $this->fail('RuntimeException was expected but not thrown');
        } catch (RuntimeException $re) {
        }

        $config->disableManifest('TestNamespace\TestManifest');
        $this->assertEmpty($configs->current(), 'No config setting will exists');

        // cleanup
        file_put_contents($ini, '');
    }
Exemplo n.º 16
0
<?php

use Zend\Loader\StandardAutoloader;
chdir(dirname(dirname(__DIR__)));
$loader = null;
if (file_exists('vendor/autoload.php')) {
    $loader = (include 'vendor/autoload.php');
} else {
    throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?');
}
// Config
$appConfig = (include __DIR__ . '/config/test.config.php');
// Init the framework
Zend\Mvc\Application::init($appConfig);
$loader = new StandardAutoloader();
$loader->registerNamespace('DmMailerTest', __DIR__ . '/../library/DmMailerTest');
$loader->registerNamespace('TestUtil', __DIR__ . '/TestUtil');
$loader->registerNamespace('TestFixture', __DIR__ . '/TestFixture');
$loader->register();
TestUtil\ServiceManagerFactory::setApplicationConfig($appConfig);
Exemplo n.º 17
0
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright notice,
 *       this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * The names of its contributors may not be used to endorse or promote
 *       products derived from this software without specific prior written
 *       permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
require_once './vendor/autoload.php';
use Zend\Loader\StandardAutoloader;
$autoloader = new StandardAutoloader();
$autoloader->registerNamespace('Pants', './library/Pants')->register();
// Setup PHPUnit autoloading
//require_once 'PHPUnit/Autoload.php';
// Set the error reporting
error_reporting(E_ALL | E_STRICT);
date_default_timezone_set('UTC');
Exemplo n.º 18
0
<?php

use Zend\Loader\StandardAutoloader;
if (!@(include_once __DIR__ . '/../vendor/autoload.php') && !@(include_once __DIR__ . '/../../../autoload.php')) {
    throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?');
}
$loader = new StandardAutoloader();
$loader->registerNamespace('Aubiplus\\Seo', __DIR__ . '/../src/Seo');
$loader->registerNamespace('Aubiplus\\SeoTest', __DIR__ . '/SeoTest');
$loader->register();
Exemplo n.º 19
0
 public function testWillLoopThroughAllNamespacesUntilMatchIsFoundWhenAutoloading()
 {
     $loader = new StandardAutoloader();
     $loader->registerNamespace('ZendTest\\Loader\\TestAsset\\Parent', __DIR__ . '/TestAsset/Parent');
     $loader->registerNamespace('ZendTest\\Loader\\TestAsset\\Parent\\Child', __DIR__ . '/TestAsset/Child');
     $result = $loader->autoload('ZendTest\\Loader\\TestAsset\\Parent\\Child\\Subclass');
     $this->assertTrue($result !== false);
     $this->assertTrue(class_exists('ZendTest\\Loader\\TestAsset\\Parent\\Child\\Subclass', false));
 }
Exemplo n.º 20
0
 /**
  * Execute the task
  *
  * @return Docblox
  * @throw BuildException
  */
 public function execute()
 {
     if (!class_exists('Parser')) {
         if (!$this->getLibraryPath()) {
             throw new BuildException('No Docblox library path set');
         }
         $libraryPath = $this->filterProperties($this->getLibraryPath());
         set_include_path(get_include_path() . PATH_SEPARATOR . $libraryPath);
         require_once 'markdown.php';
         $autoloader = new StandardAutoloader();
         $autoloader->registerPrefix('Zend', "{$libraryPath}/Zend")->registerPrefix('DocBlox', "{$libraryPath}/DocBlox")->setFallbackAutoloader(true)->register();
     }
     $parser = new Parser();
     ParserAbstract::$event_dispatcher = new sfEventDispatcher();
     if ($this->getForce()) {
         $parser->setForced($this->getForce());
     }
     if ($this->getMarkers()) {
         $parser->setMarkers($this->getMarkers());
     }
     if ($this->getTitle()) {
         $parser->setTitle($this->filterProperties($this->getTitle()));
     }
     if ($this->getValidate()) {
         $parser->setValidate($this->getValidate());
     }
     $files = new Files();
     foreach ($this->getFiles() as $file) {
         $files->addFile($this->filterProperties($file));
     }
     $xml = $parser->parseFiles($files);
     $transformer = new Transformer();
     $transformer->setSource($xml);
     if ($this->getParsePrivate()) {
         $transformer->setParseprivate($this->getParsePrivate());
     }
     if ($this->getTarget()) {
         $transformer->setTarget($this->filterProperties($this->getTarget()));
     }
     if ($this->getThemesPath()) {
         $transformer->setThemesPath($this->filterProperties($this->getThemesPath()));
     } else {
         $transformer->setThemesPath(CoreAbstract::config()->paths->themes);
     }
     if ($this->getTemplates()) {
         $transformer->setTemplates($this->getTemplates());
     } else {
         $transformer->setTemplates(CoreAbstract::config()->transformations->template->name);
     }
     $transformer->execute();
     return $this;
 }
Exemplo n.º 21
0
<?php

// Set used namespaces
use Zend\Loader\StandardAutoloader;
use Zend\Locale\Locale;
use Zend\Service\LiveDocx\Helper;
// Turn up error reporting
error_reporting(E_ALL | E_STRICT);
// Library base
$base = dirname(dirname(dirname(dirname(__DIR__))));
// Set up autoloader
require_once "{$base}/library/Zend/Loader/StandardAutoloader.php";
$loader = new StandardAutoloader();
$loader->registerNamespace('Zend', "{$base}/library/Zend");
$loader->register();
// Include utility class
require_once "{$base}/demos/Zend/Service/LiveDocx/library/Zend/Service/LiveDocx/Helper.php";
// Set fallback locale
Locale::setFallback(Helper::LOCALE);
// Ensure LiveDocx credentials are available
if (false === Helper::credentialsAvailable()) {
    Helper::printLine(Helper::credentialsHowTo());
    exit;
}
unset($base);
Exemplo n.º 22
0
<?php

use Zend\Loader\StandardAutoloader;
chdir(dirname(dirname(__DIR__)));
$loader = null;
if (file_exists('vendor/autoload.php')) {
    $loader = (include 'vendor/autoload.php');
} else {
    throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?');
}
$loader = new StandardAutoloader();
$loader->registerNamespace('DmMailerTest', __DIR__ . '/DmMailerTest');
$loader->register();
Exemplo n.º 23
0
    /**
     * borrowed from Zend\Loader\StandardAutoloader
     */
    public function testCanActAsFallbackAutoloader()
    {
        $loader = new StandardAutoloader();
        $loader->setFallbackAutoloader(true);
        set_include_path(__DIR__ . '/TestAsset/' . PATH_SEPARATOR . $this->includePath);
        $loader->autoload('TestNamespace\TestProvider');
        $loader->autoload('TestNamespace\TestInvalidProvider');

        //initialize ini
        $ini = __DIR__. '/_files/enable.ini';
        file_put_contents($ini, '');

        $clientConfig = new ClientConfig;
        $clientConfig->setConfigFilePath($ini);
        $this->_registry->setConfig($clientConfig);
        $config = $this->_configProvider;

        try {
            $config->enableProvider('TestNamespace\TestInvalidProvider');
            $this->fail('RuntimeException was expected but not thrown');
        } catch (RuntimeException $re) {
        }

        $config->enableProvider('TestNamespace\TestProvider');
        $providers = $clientConfig->basicloader->classes->toArray();
        $this->assertEquals('TestNamespace\TestProvider', current($providers));
        
        file_put_contents($ini, '');
    }
Exemplo n.º 24
0
 /**
  * Constructor
  *
  * Initialize application. Potentially initializes include_paths, PHP
  * settings, and bootstrap class.
  *
  * @param  string                   $environment
  * @param  string|array|Traversable $options String path to configuration file, or array/Traversable of configuration options
  * @throws Exception When invalid options are provided
  * @return void
  */
 public function __construct($environment, $options = null)
 {
     $this->_environment = (string) $environment;
     /**
      * @todo Make this configurable?
      */
     if (file_exists(__DIR__ . '/../../../../../library/Zend/Loader/StandardAutoloader.php')) {
         require_once __DIR__ . '/../../../../../library/Zend/Loader/StandardAutoloader.php';
     } else {
         require_once 'Zend/Loader/StandardAutoloader.php';
     }
     $autoloader = new StandardAutoloader();
     $autoloader->register();
     $this->setAutoloader($autoloader);
     if (null !== $options) {
         if (is_string($options)) {
             $options = $this->_loadConfig($options);
         } elseif ($options instanceof Traversable) {
             $options = ArrayUtils::iteratorToArray($options);
         } elseif (!is_array($options)) {
             throw new Exception\InvalidArgumentException('Invalid options provided; must be location of config file, a config object, or an array');
         }
         $this->setOptions($options);
     }
 }
Exemplo n.º 25
0
<?php

use Zend\Loader\StandardAutoloader;
require dirname(__DIR__) . '/vendor/autoload.php';
error_reporting(E_ALL | E_STRICT);
$autoloaderConfig = array('namespaces' => array('TillikumTest' => __DIR__ . '/TillikumTest'));
$autoloader = new StandardAutoloader($autoloaderConfig);
$autoloader->register();
unset($autoloaderConfig);
unset($autoloader);