當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Varien_Autoload類代碼示例

本文整理匯總了PHP中Varien_Autoload的典型用法代碼示例。如果您正苦於以下問題:PHP Varien_Autoload類的具體用法?PHP Varien_Autoload怎麽用?PHP Varien_Autoload使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Varien_Autoload類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: register

 public static function register($base = false)
 {
     /* deprecated since 2.19.0
             if (defined('COMPILER_INCLUDE_PATH'))
             {
                 $paths = array();
                 $paths[] = BP . DS . 'app' . DS . 'code' . DS . 'local';
                 $paths[] = BP . DS . 'app' . DS . 'code' . DS . 'community';
                 #$paths[] = BP . DS . 'app' . DS . 'code' . DS . 'core';
                 #$paths[] = BP . DS . 'lib';
     
                 $appPath = implode(PS, $paths);
                 set_include_path($appPath . PS . get_include_path());
             }
             */
     $rewriter = new Aitoc_Aitsys_Model_Rewriter();
     $rewriter->preRegisterAutoloader($base);
     // unregistering all, and varien autoloaders to make our performing first
     $autoloaders = spl_autoload_functions();
     if ($autoloaders and is_array($autoloaders) && !empty($autoloaders)) {
         foreach ($autoloaders as $autoloader) {
             spl_autoload_unregister($autoloader);
         }
     }
     if (version_compare(Mage::getVersion(), '1.3.1', '>')) {
         spl_autoload_unregister(array(Varien_Autoload::instance(), 'autoload'));
     }
     spl_autoload_register(array(self::instance(), 'autoload'), false);
     if (version_compare(Mage::getVersion(), '1.3.1', '>')) {
         Varien_Autoload::register();
     } else {
         spl_autoload_register(array(self::instance(), 'performStandardAutoload'));
         #self::_loadOverwrittenClasses();
     }
 }
開發者ID:rajarshc,項目名稱:Rooja,代碼行數:35,代碼來源:Autoload.php

示例2: setRevalidateFlagAction

 /**
  * Set revalidate flag
  */
 public function setRevalidateFlagAction()
 {
     $flagFile = Varien_Autoload::getRevalidateFlagPath();
     if (file_put_contents($flagFile, date(DATE_ISO8601))) {
         echo "Success\n";
     } else {
         echo "Error while writing '{$flagFile}'\n";
         exit(1);
     }
 }
開發者ID:aoepeople,項目名稱:aoe_classpathcache,代碼行數:13,代碼來源:aoe_classpathcache.php

示例3: revalidateCache

 /**
  * Revalidate all currently cached entries
  */
 public function revalidateCache()
 {
     $start = microtime(true);
     $cache = Varien_Autoload::getCache();
     Varien_Autoload::setCache(array());
     foreach ($cache as $className => $path) {
         Varien_Autoload::getFullPath($className);
     }
     $duration = microtime(true) - $start;
     Mage::log('[ClassPathCache] Revalidated ' . count($cache) . ' classes (duration: ' . round($duration, 2) . ' sec)', 6, self::LOG_FILE);
 }
開發者ID:aoepeople,項目名稱:aoe_classpathcache,代碼行數:14,代碼來源:Data.php

示例4: bootMagento

 public static function bootMagento($path = '.')
 {
     if (!self::isLoaded()) {
         foreach (self::$magento as $file) {
             require_once $path . $file;
         }
         \Varien_Autoload::register();
         require_once $path . '/app/Mage.php';
         $app = \Mage::app('default', 'store', array());
         $app->getConfig()->loadEventObservers('global');
         $app->getConfig()->loadEventObservers('front');
         self::$loaded = true;
     }
 }
開發者ID:linusshops,項目名稱:prophet,代碼行數:14,代碼來源:Injector.php

示例5: getApplication

 /**
  * @return PHPUnit_Framework_MockObject_MockObject|Application
  */
 public function getApplication()
 {
     if ($this->application === null) {
         $root = $this->getTestMagentoRoot();
         $this->application = $this->getMock('N98\\Magento\\Application', array('getMagentoRootFolder'));
         $loader = (require __DIR__ . '/../../../../../vendor/autoload.php');
         $this->application->setAutoloader($loader);
         $this->application->expects($this->any())->method('getMagentoRootFolder')->will($this->returnValue($root));
         $this->application->init();
         $this->application->initMagento();
         if ($this->application->getMagentoMajorVersion() == Application::MAGENTO_MAJOR_VERSION_1) {
             spl_autoload_unregister(array(\Varien_Autoload::instance(), 'autoload'));
         }
     }
     return $this->application;
 }
開發者ID:brentwpeterson,項目名稱:n98-magerun2,代碼行數:19,代碼來源:TestCase.php

示例6: register

 public static function register()
 {
     if (self::instance()->getIsRegistered()) {
         return;
     }
     $path = BP . DS . 'var' . DS . 'goodahead' . DS . 'etm' . DS . 'includes';
     set_include_path($path . PS . get_include_path());
     if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
         spl_autoload_register(array(self::instance(), 'autoload'), false, true);
     } else {
         spl_autoload_register(array(self::instance(), 'autoload'), false);
         spl_autoload_unregister(array(Varien_Autoload::instance(), 'autoload'));
         Varien_Autoload::register();
     }
     self::instance()->setIsRegistered(true);
 }
開發者ID:eniuz,項目名稱:entitytype-manager,代碼行數:16,代碼來源:Autoload.php

示例7: getApplication

 /**
  * @throws \RuntimeException
  * @return PHPUnit_Framework_MockObject_MockObject|\IMI\Contao\Application
  */
 public function getApplication()
 {
     if ($this->application === null) {
         $root = getenv('IMI_MAGERUN_TEST_MAGENTO_ROOT');
         if (empty($root)) {
             throw new \RuntimeException('Please specify environment variable IMI_MAGERUN_TEST_MAGENTO_ROOT with path to your test
                 contao installation!');
         }
         $this->application = $this->getMock('IMI\\Contao\\Application', array('getContaoRootFolder'));
         $loader = (require __DIR__ . '/../../../../../vendor/autoload.php');
         $this->application->setAutoloader($loader);
         $this->application->expects($this->any())->method('getContaoRootFolder')->will($this->returnValue($root));
         $this->application->init();
         $this->application->initContao();
         if ($this->application->getContaoMajorVersion() == Application::MAGENTO_MAJOR_VERSION_1) {
             spl_autoload_unregister(array(\Varien_Autoload::instance(), 'autoload'));
         }
     }
     return $this->application;
 }
開發者ID:iMi-digital,項目名稱:imi-conrun,代碼行數:24,代碼來源:TestCase.php

示例8: testRegisterClassmap

    public function testRegisterClassmap()
    {
        define('OPTIMIZED_COMPOSER', true);
        $testClassname = 'c' . uniqid();
        $testClassfilename = BP . '/lib/' . $testClassname . '.php';
        $testClass = <<<CLASS
<?php
class {$testClassname} {}
CLASS;
        testfuncs\create_structure();
        file_put_contents($testClassfilename, $testClass);
        // Generate the classmap
        require BP . '/../src/classmap_generator.php';
        Varien_Autoload::register();
        $loader = (require __DIR__ . '/../vendor/autoload.php');
        $classMap = $loader->getClassMap();
        $this->assertArrayHasKey($testClassname, $classMap);
        unlink($testClassfilename);
        testfuncs\destroy_structure();
    }
開發者ID:KevinDonaldson,項目名稱:magento-composer-autoloader,代碼行數:20,代碼來源:AutoloadTest.php

示例9: addAutoloader

 public function addAutoloader()
 {
     if (!self::$shouldAdd) {
         return;
     }
     foreach ($this->getNamespacesToRegister() as $namespace) {
         if (is_dir(Mage::getBaseDir('lib') . DS . $namespace)) {
             $args = array($namespace, Mage::getBaseDir('lib') . DS . $namespace);
             $autoloader = Mage::getModel("psr0autoloader/splAutoloader", $args);
             $autoloader->register();
         }
     }
     if ($composerVendorPath = $this->getComposerVendorPath()) {
         require_once $composerVendorPath . '/autoload.php';
     }
     if ($this->shouldDisableBaseAutoloader()) {
         spl_autoload_unregister(array(Varien_Autoload::instance(), 'autoload'));
     }
     self::$shouldAdd = false;
 }
開發者ID:itmyprofession,項目名稱:Magento-PSR-0-Autoloader,代碼行數:20,代碼來源:Observer.php

示例10: checkAndServeCachedPage

 /**
  * Checks cache for cached pages.  If found the original response is served,
  * otherwise normal processing will occur.
  *
  * Observes: controller_action_predispatch
  *
  * @param $observer
  * @return void
  */
 public function checkAndServeCachedPage(Varien_Event_Observer $observer)
 {
     /**
      * @var $controllerAction Mage_Core_Controller_Varien_Action
      * @var $engine Brim_PageCache_Model_Engine
      */
     /*
      * controller_action_predispatch occurs before the autoloader sets the scope for the compiler. When the compiler
      * is enabled there is the possibility of creating a redeclare class fatal error if we need any class that is
      * included in the compilers current scope file.  ESP. an issue with the checkout scope.  Registering the scope
      * here prevents the fatal error from occurring.
      */
     if (defined('COMPILER_INCLUDE_PATH')) {
         $controllerAction = $observer->getControllerAction();
         Varien_Autoload::registerScope($controllerAction->getRequest()->getRouteName());
     }
     $engine = Mage::getSingleton('brim_pagecache/engine');
     if (!$engine->isEnabled()) {
         return;
     }
     $engine->servePage($this);
 }
開發者ID:AvalonKnight,項目名稱:brim_pagecache-2.1.3,代碼行數:31,代碼來源:Observer.php

示例11: register

 public static function register($base = false)
 {
     Mage::register('aitsys_autoload_initialized', true);
     $rewriter = new Aitoc_Aitsys_Model_Rewriter();
     $rewriter->preRegisterAutoloader($base);
     // unregistering all, and varien autoloaders to make our performing first
     $autoloaders = spl_autoload_functions();
     if ($autoloaders and is_array($autoloaders) && !empty($autoloaders)) {
         foreach ($autoloaders as $autoloader) {
             spl_autoload_unregister($autoloader);
         }
     }
     if (version_compare(Mage::getVersion(), '1.3.1', '>')) {
         spl_autoload_unregister(array(Varien_Autoload::instance(), 'autoload'));
     }
     spl_autoload_register(array(self::instance(), 'autoload'), false);
     if (version_compare(Mage::getVersion(), '1.3.1', '>')) {
         Varien_Autoload::register();
     } else {
         spl_autoload_register(array(self::instance(), 'performStandardAutoload'));
     }
 }
開發者ID:sagmahajan,項目名稱:aswan_release,代碼行數:22,代碼來源:Autoload.php

示例12: match

 public function match(Zend_Controller_Request_Http $request)
 {
     if (Mage::app()->getStore()->isAdmin()) {
         return false;
     }
     $pageId = $request->getPathInfo();
     // remove suffix if any
     $suffix = Mage::getStoreConfig('catalog/seo/category_url_suffix');
     if ($suffix && '/' != $suffix) {
         $pageId = str_replace($suffix, '', $pageId);
     }
     //add trailing slash
     $pageId = trim($pageId, '/') . '/';
     $reservedKey = Mage::getStoreConfig('amshopby/seo/key') . '/';
     //check if we have reserved word in the url
     if (false === strpos($pageId, '/' . $reservedKey)) {
         if (substr($pageId, 0, strlen($reservedKey)) != $reservedKey) {
             return false;
         }
     } else {
         $reservedKey = '/' . $reservedKey;
     }
     // get layered navigation params as string
     list($cat, $params) = explode($reservedKey, $pageId, 2);
     $params = trim($params, '/');
     if ($params) {
         $params = explode('/', $params);
     }
     // remember for futire use in the helper
     if ($params) {
         Mage::register('amshopby_current_params', $params);
     }
     $cat = trim($cat, '/');
     if ($cat) {
         // normal category
         // if somebody has old urls in the cache.
         if (!Mage::getStoreConfig('amshopby/seo/urls')) {
             return false;
         }
         Varien_Autoload::registerScope('catalog');
         $cat = $cat . $suffix;
         $urlRewrite = Mage::getModel('core/url_rewrite')->setStoreId(Mage::app()->getStore()->getId())->loadByRequestPath($cat);
         if (!$urlRewrite->getId()) {
             $store = $request->getParam('___from_store');
             $store = Mage::app()->getStore($store)->getId();
             if (!$store) {
                 return false;
             }
             $urlRewrite = Mage::getModel('core/url_rewrite')->setStoreId($store)->loadByRequestPath($cat);
         }
         if (!$urlRewrite->getId()) {
             return false;
         }
         $request->setPathInfo($cat);
         $request->setModuleName('catalog');
         $request->setControllerName('category');
         $request->setActionName('view');
         $request->setParam('id', $urlRewrite->getCategoryId());
         $urlRewrite->rewrite($request);
     } else {
         // root category
         $realModule = 'Amasty_Shopby';
         $request->setPathInfo(trim($reservedKey, '/'));
         $request->setModuleName('amshopby');
         $request->setRouteName('amshopby');
         $request->setControllerName('index');
         $request->setActionName('index');
         $request->setControllerModule($realModule);
         $file = Mage::getModuleDir('controllers', $realModule) . DS . 'IndexController.php';
         include $file;
         //compatibility with 1.3
         $class = $realModule . '_IndexController';
         $controllerInstance = new $class($request, $this->getFront()->getResponse());
         $request->setDispatched(true);
         $controllerInstance->dispatch('index');
     }
     return true;
 }
開發者ID:nilshopsahl,項目名稱:hasla.local,代碼行數:78,代碼來源:Router.php

示例13: getApplication

 /**
  * @return Application|PHPUnit_Framework_MockObject_MockObject
  */
 public function getApplication()
 {
     if ($this->application === null) {
         $root = $this->getTestMagentoRoot();
         /** @var Application|PHPUnit_Framework_MockObject_MockObject $application */
         $application = $this->getMock('N98\\Magento\\Application', array('getMagentoRootFolder'));
         // Get the composer bootstrap
         if (defined('PHPUNIT_COMPOSER_INSTALL')) {
             $loader = (require PHPUNIT_COMPOSER_INSTALL);
         } elseif (file_exists(__DIR__ . '/../../../../../../autoload.php')) {
             // Installed via composer, already in vendor
             $loader = (require __DIR__ . '/../../../../../../autoload.php');
         } else {
             // Check if testing root package without PHPUnit
             $loader = (require __DIR__ . '/../../../../vendor/autoload.php');
         }
         $application->setAutoloader($loader);
         $application->expects($this->any())->method('getMagentoRootFolder')->will($this->returnValue($root));
         spl_autoload_unregister(array(\Varien_Autoload::instance(), 'autoload'));
         $application->init();
         $application->initMagento();
         if ($application->getMagentoMajorVersion() == Application::MAGENTO_MAJOR_VERSION_1) {
             spl_autoload_unregister(array(\Varien_Autoload::instance(), 'autoload'));
         }
         $this->application = $application;
     }
     return $this->application;
 }
開發者ID:netz98,項目名稱:n98-magerun,代碼行數:31,代碼來源:TestCase.php

示例14: cw_class_loader

 function cw_class_loader($className)
 {
     return Varien_Autoload::instance()->autoload($className);
 }
開發者ID:jronatay,項目名稱:ultimo-magento-jron,代碼行數:4,代碼來源:Data.php

示例15: preDispatch

 /**
  * Dispatches event before action
  */
 public function preDispatch()
 {
     if (!$this->getFlag('', self::FLAG_NO_CHECK_INSTALLATION)) {
         if (!Mage::isInstalled()) {
             $this->setFlag('', self::FLAG_NO_DISPATCH, true);
             $this->_redirect('install');
             return;
         }
     }
     // Prohibit disabled store actions
     if (Mage::isInstalled() && !Mage::app()->getStore()->getIsActive()) {
         Mage::app()->throwStoreException();
     }
     if ($this->_rewrite()) {
         return;
     }
     if (!$this->getFlag('', self::FLAG_NO_START_SESSION)) {
         $checkCookie = in_array($this->getRequest()->getActionName(), $this->_cookieCheckActions);
         $checkCookie = $checkCookie && !$this->getRequest()->getParam('nocookie', false);
         $cookies = Mage::getSingleton('core/cookie')->get();
         if ($checkCookie && empty($cookies)) {
             $this->setFlag('', self::FLAG_NO_COOKIES_REDIRECT, true);
         }
         Mage::getSingleton('core/session', array('name' => $this->_sessionNamespace))->start();
     }
     Mage::app()->loadArea($this->getLayout()->getArea());
     if ($this->getFlag('', self::FLAG_NO_COOKIES_REDIRECT) && Mage::getStoreConfig('web/browser_capabilities/cookies')) {
         $this->_forward('noCookies', 'index', 'core');
         return;
     }
     if ($this->getFlag('', self::FLAG_NO_PRE_DISPATCH)) {
         return;
     }
     Mage::dispatchEvent('controller_action_predispatch', array('controller_action' => $this));
     Mage::dispatchEvent('controller_action_predispatch_' . $this->getRequest()->getRouteName(), array('controller_action' => $this));
     Varien_Autoload::registerScope($this->getRequest()->getRouteName());
     Mage::dispatchEvent('controller_action_predispatch_' . $this->getFullActionName(), array('controller_action' => $this));
 }
開發者ID:xiaoguizhidao,項目名稱:emporiodopara,代碼行數:41,代碼來源:Action.php


注:本文中的Varien_Autoload類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。