Exemplo n.º 1
0
 public function index01Action()
 {
     echo "<h3 style='color:red;font-weight:bold'>" . __METHOD__ . "</h3>";
     $autoLoader = new \Zend\Loader\StandardAutoloader(array("autoregister_zf" => true));
     $autoLoader->registerNamespace("Database", LIB_PATH . "/Database");
     $autoLoader->registerPrefix("Mail", LIB_PATH . "/Mail");
     $autoLoader->register();
     $student = new \Database\Student();
     $teacher = new \Database\Teacher();
     $people = new \Database\basetada\People();
     $sender = new \Mail_Sender();
     $google_sender = new \Mail_google_sender();
     return false;
 }
Exemplo n.º 2
0
 public static function get_instance()
 {
     if (self::$instance == null) {
         // Инициализируем автолоадер. Он ищет сначала в каталоге приложения, если класса нет и есть такой же с префиксом k_ в ядре, содает класс обертку с запрашиваемым именем и наследует ее от найденного в ядре класса
         spl_autoload_register(function ($class) {
             $is_zend = substr($class, 0, 5) == 'Zend\\';
             if ($is_zend) {
                 if (application::$zend_icluded) {
                     return;
                 }
                 include_once PATH_ROOT . '/' . DIR_LIBRARY . '/lib/Zend/Loader/StandardAutoloader.php';
                 $loader = new Zend\Loader\StandardAutoloader();
                 $loader->registerNamespace('Zend', PATH_ROOT . '/' . DIR_LIBRARY . '/lib/Zend');
                 $loader->register();
                 if ($class !== 'Zend\\Loader\\StandardAutoloader') {
                     $loader->autoload($class);
                 }
             } else {
                 $is_kernel = substr($class, 0, 2) == 'k_';
                 $fn = str_replace('_', '/', $is_kernel ? preg_replace('/^k\\_/', '', $class) : $class) . '.php';
                 if (!$is_kernel && file_exists(PATH_ROOT . '/' . DIR_APPLICATION . '/' . $fn)) {
                     require_once PATH_ROOT . '/' . DIR_APPLICATION . '/' . $fn;
                 } else {
                     if (!$is_kernel && defined('DIR_ZLIBRARY') && file_exists(PATH_ROOT . '/' . DIR_ZLIBRARY . '/' . $fn)) {
                         require_once PATH_ROOT . '/' . DIR_ZLIBRARY . '/' . $fn;
                     } else {
                         if (file_exists(PATH_ROOT . '/' . DIR_LIBRARY . '/' . $fn)) {
                             require_once PATH_ROOT . '/' . DIR_LIBRARY . '/' . $fn;
                             if (!$is_kernel && class_exists('k_' . $class)) {
                                 eval('class ' . $class . ' extends k_' . $class . ' {};');
                             }
                         } else {
                             if (class_exists('common') && method_exists('common', 'autoload')) {
                                 common::autoload($class);
                             }
                         }
                     }
                 }
             }
         });
         // Экземпляр приложения создается не из текущего класса, а из класса, который находится в папке приложения
         application::$instance = new application();
     }
     return application::$instance;
 }
/* set this path to the location of Zend/Loader/StandardAutoloader.php, 
 * the client library can be used with any other php5.3 namespace style autoloaders (for example symfony2 & doctrine2)
*/
define('ZEND_AUTOLOADER_PATH', '/_path_/_to_/_zend_/_framework_/Zend/Loader/StandardAutoloader.php');
define('CONFIG_FILE', 'config.ini');
use Kaltura\Client\Configuration as KalturaConfiguration;
use Kaltura\Client\Client as KalturaClient;
use Kaltura\Client\Enum\SessionType as KalturaSessionType;
use Kaltura\Client\ApiException;
use Kaltura\Client\ClientException;
// load zend framework 2
require_once ZEND_AUTOLOADER_PATH;
$loader = new \Zend\Loader\StandardAutoloader();
// register Kaltura namespace
$loader->registerNamespace('Kaltura', dirname(__FILE__) . '/../library/Kaltura');
$loader->registerNamespace('Test', dirname(__FILE__) . '/Test');
$loader->register();
$testerConfig = parse_ini_file(dirname(__FILE__) . '/' . CONFIG_FILE);
if ($testerConfig['partnerId'] == 123) {
    die('Please edit the configuration file (config.ini)');
}
// init kaltura configuration
$config = new KalturaConfiguration($testerConfig['partnerId']);
$config->setServiceUrl($testerConfig['serviceUrl']);
$config->setCurlTimeout(30);
$config->setLogger(new \Test\SampleLoggerImplementation());
// init kaltura client
$client = new KalturaClient($config);
// generate session
$ks = $client->generateSession($testerConfig['adminSecret'], $testerConfig['userId'], KalturaSessionType::ADMIN, $config->getPartnerId());
Exemplo n.º 4
0
<?php

use Zend\EventManager\EventManager;
define('ZF2_PATH', getenv('ZF2_PATH') ? getenv('ZF2_PATH') : realpath(__DIR__ . '/library/Zend'));
require_once ZF2_PATH . '/Loader/StandardAutoloader.php';
$autoLoader = new Zend\Loader\StandardAutoloader();
// register our StandardAutoloader with the SPL autoloader
$autoLoader->register();
// register the Zend namespace
$autoLoader->registerNamespace('Zend', ZF2_PATH);
class ValidatePost
{
    public function validate($event)
    {
        $data = $event->getParams();
        if (!isset($data['title']) or !isset($data['slug'])) {
            throw new \InvalidArgumentException('Need a title and a slug!');
        }
        return $data;
    }
}
class SlugifyPost
{
    public function slugify($event)
    {
        $data = $event->getParams();
        $event->setParam('slug', strtolower(str_replace(' ', '-', $data['title'])));
        return $data;
    }
}
class Post
Exemplo n.º 5
0
<pre>
<?php 
use Br\Gov\Filter\Acentuacao;
define('DS', DIRECTORY_SEPARATOR);
define('PS', PATH_SEPARATOR);
set_include_path(get_include_path() . PS . '/home/brainfork/zend-framework/zf2/library');
require_once 'Zend' . DS . 'Loader' . DS . 'StandardAutoloader.php';
$autoloader = new Zend\Loader\StandardAutoloader();
$autoloader->register();
$autoloader->registerNamespace('Br', __DIR__ . DS . '../library' . DS . 'Br');
$a = new Acentuacao();
$f = $a->filter('Cinqüênta pássaros se vão e caçoam da àguia. Pão-de-ló e café!');
Zend\Debug::dump($f);
Exemplo n.º 6
0
<?php

require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
$loader = new Zend\Loader\StandardAutoloader();
// Register the "Nel" namespace:
$loader->registerNamespace('Nel', dirname(__DIR__) . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'Nel');
// Register with spl_autoload:
$loader->register();
Exemplo n.º 7
0
 protected function _init($env)
 {
     $profile = $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION);
     $appConfigFileResource = $profile->search('applicationConfigFile');
     if ($appConfigFileResource == false) {
         throw new \Zend\Tool\Project\Exception('A project with an application config file is required to use this provider.');
     }
     $appConfigFilePath = $appConfigFileResource->getPath();
     $this->_config = new \Zend\Config\Ini($appConfigFilePath, $env);
     require_once 'Zend/Loader/StandardAutoloader.php';
     $autoloader = new \Zend\Loader\StandardAutoloader();
     $autoloader->registerNamespace('Akrabat', realpath(__DIR__ . '/../'));
     $autoloader->register();
 }
Exemplo n.º 8
0
<?php

require_once __DIR__ . '/../../vendor/zendframework/zend-loader/Zend/Loader/StandardAutoloader.php';
$loader = new Zend\Loader\StandardAutoloader();
$loader->registerNamespace('Respect', __DIR__ . '/../../vendor/respect/validation/library/Respect');
$loader->registerNamespace('Symfony\\Component\\Validator', __DIR__ . '/../../vendor/symfony/validator/Symfony/Component/Validator');
$loader->registerNamespace('Symfony\\Component\\PropertyAccess', __DIR__ . '/../../vendor/symfony/property-access/Symfony/Component/PropertyAccess');
$loader->registerNamespace('Symfony\\Component\\Translation', __DIR__ . '/../../vendor/symfony/translation/Symfony/Component/Translation');
$loader->registerNamespace('HybridLogic', __DIR__ . '/../../vendor/hybridlogic/validation/src/HybridLogic');
$loader->registerNamespace('Fuel', __DIR__ . '/../../vendor/fuelphp/validation/src/Fuel');
$loader->registerNamespace('Zend\\Validator', __DIR__ . '/../../vendor/zendframework/zend-validator/Zend/Validator');
$loader->registerNamespace('Zend\\Stdlib', __DIR__ . '/../../vendor/zendframework/zend-stdlib/Zend/Stdlib');
$loader->registerNamespace('Kpacha\\ComponentBenchmark', __DIR__ . '/../../src/Kpacha/ComponentBenchmark');
$loader->registerNamespace('Kpacha\\BenchmarkTool', __DIR__ . '/../../vendor/kpacha/php-benchmark-tool/src/Kpacha/BenchmarkTool');
$loader->registerNamespace('Symfony\\Component\\Finder', __DIR__ . '/../../vendor/symfony/finder/Symfony/Component/Finder');
$loader->register();
include __DIR__ . '/common.php';
Exemplo n.º 9
0
namespace CB;

use CB\DataModel as DM;
$cron_id = 'check_core_email';
$execution_timeout = 60;
//default is 60 seconds
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'init.php';
$coreName = Config::get('core_name');
require_once 'Zend/Loader/StandardAutoloader.php';
require_once 'mail_functions.php';
/** DURING INSTANTIATION **/
$loader = new \Zend\Loader\StandardAutoloader(array('Zend' => ZEND_PATH . 'Zend'));
/** AFTER INSTANTIATION **/
$loader = new \Zend\Loader\StandardAutoloader();
// the path can be absolute or relative below:
$loader->registerNamespace('Zend', ZEND_PATH . 'Zend');
/** TO START AUTOLOADING */
$loader->register();
$mail_requirements = "\nMail requirements are:\n    1. Subject of email should contain target folder in the following format: <Message title> (/target/folder)\n    2. target folder should exist in the database.\n    3. Your email address should be specified in your casebox user profile.\n\n    If at least one condition is not satisfied then the email would not be processed and is deleted automatically.\n";
// skip core if no email is set in config
if (!defined('config\\mail_user')) {
    exit;
}
echo " (" . config\mail_user . ") ...";
$cd = prepareCron($cron_id, $execution_timeout);
if (!$cd['success']) {
    echo "\nFailed to prepare cron\n";
    exit;
    //skip this core if cron preparation fails
}
/* check if this core has an email template defined */
<?php

require_once 'library/Zend/Loader/StandardAutoloader.php';
$loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
$loader->registerNamespace('SON', 'library/SON');
$loader->register();
$components = array('SON');
foreach ($components as $component) {
    $diCompiler = new Zend\Di\Definition\CompilerDefinition();
    $diCompiler->addDirectory('library/' . $component);
    $diCompiler->compile();
    file_put_contents('data/di/' . $component . '-definition.php', '<?php return ' . var_export($diCompiler->toArrayDefinition()->toArray(), true) . ';');
}
Exemplo n.º 11
0
<?php

// Set used namespaces
use Zend\Locale\Locale;
use Zend\Registry;
use Zend\Service\LiveDocx\Helper;
// Turn up error reporting
error_reporting(E_ALL | E_STRICT);
// Set up autoloader
$base = dirname(dirname(dirname(dirname(__DIR__))));
require_once "{$base}/library/Zend/Loader/StandardAutoloader.php";
$loader = new \Zend\Loader\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 default locale
Locale::setDefault(Helper::LOCALE);
$locale = new Locale(Locale::ZFDEFAULT);
Registry::set('Zend_Locale', $locale);
// Ensure LiveDocx credentials are available
if (false === Helper::credentialsAvailable()) {
    Helper::printLine(Helper::credentialsHowTo());
    exit;
}
unset($base);
Exemplo n.º 12
0
<?php

require_once __DIR__ . '/vendor/autoload.php';
$loader = new \Zend\Loader\StandardAutoloader();
$loader->registerNamespace('App', __DIR__ . '/App');
$loader->register();
Exemplo n.º 13
0
<?php

// autoloading from composer
require_once dirname(__FILE__) . '/vendor/autoload.php';
$loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
$loader->registerNamespace('StefanTeitge\\Merville', 'src');
$loader->register();
use StefanTeitge\Merville\Merville;
/*
Daux.io
==================
Description
-----------
This is a tool for auto-generating documentation based on markdown files
located in the /docs folder of the project. To see all of the available
options and to read more about how to use the generator, visit:
http://daux.io
Author
------
Justin Walsh (Todaymade): justin@todaymade.com, @justin_walsh
Garrett Moon (Todaymade): garrett@todaymade.com, @garrett_moon
Stefan Teitge : stefan.teitge@gmail.com, @stefanteitge
Feedback & Suggestions
----
To give us feedback or to suggest an idea, please create an request on the the
GitHub issue tracker:
https://github.com/stefanteitge/merville/issues
Bugs
----
To file bug reports please create an issue using the github issue tracker:
https://github.com/stefanteitge/merville/issues
Exemplo n.º 14
0
 * - Configures the DB adapter
 * - Configures the Zend dependency injector
 */
/*****************************************
 * CONFIGURE AUTOLOADING
*****************************************/
$sImporterPath = dirname(__FILE__);
chdir($sImporterPath);
$sScriptPath = substr($sImporterPath, 0, strrpos($sImporterPath, DIRECTORY_SEPARATOR));
$sIncludePath = $sImporterPath . PATH_SEPARATOR . $sScriptPath . PATH_SEPARATOR;
set_include_path(get_include_path() . PATH_SEPARATOR . $sIncludePath);
require 'Zend/Loader/StandardAutoloader.php';
$autoloader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
$sImporterClassNameSpacePath = $sImporterPath . DIRECTORY_SEPARATOR . 'Classes';
$sInstallerNameSpacePath = $sScriptPath . DIRECTORY_SEPARATOR . 'installer' . DIRECTORY_SEPARATOR . 'Reports' . DIRECTORY_SEPARATOR;
$autoloader->registerNamespace('Classes', $sImporterClassNameSpacePath, $sInstallerNameSpacePath);
$autoloader->register();
/*****************************************
 * LOAD CONFIGURATION
 *****************************************/
$oConfig = new Zend\Config\Reader\Ini();
$oConfig->setNestSeparator(' : ');
$aConfig = $oConfig->fromFile('config.ini.php');
// First attempt to load relevant section based on host name
if (isset($_SERVER['HTTP_HOST'])) {
    $sServerHost = $_SERVER['HTTP_HOST'];
    foreach ($aConfig as $sSection => $aConfigSection) {
        if (isset($aConfigSection['common']) and isset($aConfigSection['common']['host'])) {
            $sHost = $aConfigSection['common']['host'];
            if ($sHost != '' and $sHost === $sServerHost) {
                $sConfigSection = $sSection;
Exemplo n.º 15
0
<?php

set_include_path(get_include_path() . ':/Shared/ZF2rc03/library');
date_default_timezone_set('America/Los_Angeles');
require_once 'Zend/Loader/StandardAutoloader.php';
$loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
$loader->registerNamespace('NedVisol', __DIR__ . '/../vendor/NedVisol/library/NedVisol');
$loader->registerNamespace('NedVisol\\Orm\\Definition', __DIR__ . '/../vendor/NedVisol/generated/NedVisol/Orm/Definition');
// Register with spl_autoload:
$loader->register();
define('HBASE_THRIFT_HOST', 'hbase-thrift');
define('HBASE_THRIFT_PORT', '9090');
Exemplo n.º 16
0
 /**
  * bootstrap modules
  */
 protected function initModules()
 {
     // app
     $app = $this->app;
     // di container
     $container = $app->getContainer();
     // navigation
     $navigation = array();
     // view paths
     $viewModules = array();
     // loader
     $loader = new \Zend\Loader\StandardAutoloader();
     // for each module
     foreach ($this->modules as $module) {
         require_once $this->modulePath . '/' . $module . "/Module.php";
         $m = "\\{$module}\\Module";
         $m = new $m();
         // autoloader
         if (method_exists($m, 'getAutoloaderConfig')) {
             $cfg = $m->getAutoloaderConfig();
             // register module namespace
             foreach ($cfg as $key => $value) {
                 $loader->registerNamespace($key, $value);
             }
             // register namespaces
             $loader->register();
         }
         // routes
         if (method_exists($m, 'getRouterConfig')) {
             $cfg = $m->getRouterConfig();
             // load routes
             foreach ($cfg as $value) {
                 foreach (glob($value . "/*.php") as $filename) {
                     require_once $filename;
                 }
             }
         }
         // views
         if (method_exists($m, 'getViewConfig')) {
             $cfg = $m->getViewConfig();
             // get view paths
             foreach ($cfg as $key => $value) {
                 // get module view path
                 // store path in app to register it with template engine
                 $viewModules[$key] = $value;
             }
         }
         // navigation
         if (method_exists($m, 'getNavigationConfig')) {
             // get navigation config
             $cfg = $m->getNavigationConfig();
             // merge navigation recursiv
             $navigation = array_merge_recursive($navigation, $cfg);
         }
         // middleware
         if (method_exists($m, 'getMiddlewareConfig')) {
             $cfg = $m->getMiddlewareConfig();
             // load routes
             foreach ($cfg as $value) {
                 foreach (glob($value . "/*.php") as $filename) {
                     require_once $filename;
                 }
             }
         }
     }
     // save view modules
     $container->viewModules = $viewModules;
     // save navigation
     $container->navigation = $navigation;
 }