当前位置: 首页>>代码示例>>PHP>>正文


PHP Controller::add_extension方法代码示例

本文整理汇总了PHP中Controller::add_extension方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::add_extension方法的具体用法?PHP Controller::add_extension怎么用?PHP Controller::add_extension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Controller的用法示例。


在下文中一共展示了Controller::add_extension方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUpOnce

 function setUpOnce()
 {
     if (!Controller::has_extension('AjaxControllerExtension')) {
         Controller::add_extension('AjaxControllerExtension');
     }
     parent::setUpOnce();
 }
开发者ID:helpfulrobot,项目名称:markguinn-silverstripe-ajax,代码行数:7,代码来源:AjaxResponseTest.php

示例2: setUp

 public function setUp()
 {
     parent::setUp();
     Controller::add_extension('ShopTestControllerExtension');
     $this->accountpage = $this->objFromFixture("AccountPage", "accountpage");
     $this->controller = new AccountPage_Controller($this->accountpage);
     $this->controller->init();
 }
开发者ID:burnbright,项目名称:silverstripe-shop,代码行数:8,代码来源:AccountPageTest.php

示例3: setUpOnce

 public function setUpOnce()
 {
     if (!ShoppingCart_Controller::has_extension('ShoppingCartAjax')) {
         ShoppingCart_Controller::add_extension('ShoppingCartAjax');
     }
     if (!VariationForm::has_extension('ShoppingCartAjax')) {
         VariationForm::add_extension('ShoppingCartAjax');
     }
     if (!Controller::has_extension('AjaxControllerExtension')) {
         Controller::add_extension('AjaxControllerExtension');
     }
     parent::setUpOnce();
 }
开发者ID:helpfulrobot,项目名称:markguinn-silverstripe-shop-ajax,代码行数:13,代码来源:ShoppingCartAjaxTest.php

示例4: activate

 public static function activate($code = null)
 {
     switch ($code) {
         case null:
             self::$google_analytics_code = null;
             break;
         case 'SiteConfig':
             SiteConfig::add_extension('GoogleAnalyticsLiteConfig');
             break;
         default:
             self::$google_analytics_code = $code;
     }
     Controller::add_extension('GoogleLiteLogger');
 }
开发者ID:helpfulrobot,项目名称:patjnr-googleanalytics-lite,代码行数:14,代码来源:GoogleLiteLogger.php

示例5: activate

 /**
  *	Activate the GoogleLogger
  *	
  *	@param $code mixed:
  *		String the Google Analytics code to be used in the JS snippet or
  *		String 'SiteConfig' for using the SiteConfig to configure this value or
  *		Null if you hardcode the JS snippet into your template. The JS snippet will not be included through Requirements
  *
  **/
 public static function activate($code = null)
 {
     switch ($code) {
         case null:
             self::$google_analytics_code = null;
             break;
         case 'SiteConfig':
             SiteConfig::add_extension('GoogleConfig');
             break;
         default:
             self::$google_analytics_code = $code;
     }
     Controller::add_extension('GoogleLogger');
     if (substr(GoogleAnalyzer::get_sapphire_version(), 0, 3) == '2.3') {
         Director::add_callback(array("GoogleLogger", "onAfterInit23"));
     }
 }
开发者ID:helpfulrobot,项目名称:jelicanin-silverstripe-googleanalytics,代码行数:26,代码来源:GoogleLogger.php

示例6: getDebugBar

 /**
  * Get the Debug Bar instance
  *
  * @global array $databaseConfig
  * @return DebugBar\StandardDebugBar
  */
 public static function getDebugBar()
 {
     if (self::$debugbar !== null) {
         return self::$debugbar;
     }
     if (!Director::isDev() || self::IsDisabled() || self::VendorNotInstalled() || self::NotLocalIp() || Director::is_cli() || self::IsDevUrl() || self::IsAdminUrl() && !self::config()->enabled_in_admin) {
         self::$debugbar = false;
         // No need to check again
         return;
     }
     // Add the controller extension programmaticaly because it might not be added properly through yml
     Controller::add_extension('DebugBarControllerExtension');
     // Add a custom logger that logs everything under the Messages tab
     SS_Log::add_writer(new DebugBarLogWriter(), SS_Log::DEBUG, '<=');
     self::$debugbar = $debugbar = new DebugBar\DebugBar();
     if (isset($_REQUEST['showqueries'])) {
         self::setShowQueries(true);
         echo "The queries above have been run before we started DebugBar";
         echo '<hr>';
         unset($_REQUEST['showqueries']);
     }
     $debugbar->addCollector(new DebugBar\DataCollector\PhpInfoCollector());
     $debugbar->addCollector(new DebugBar\DataCollector\MessagesCollector());
     $debugbar->addCollector(new DebugBar\DataCollector\TimeDataCollector());
     $debugbar->addCollector(new DebugBar\DataCollector\MemoryCollector());
     // On 3.1, PDO does not exist
     if (method_exists('DB', 'get_conn')) {
         if (!DB::get_conn()) {
             global $databaseConfig;
             if ($databaseConfig) {
                 DB::connect($databaseConfig);
             }
         }
         $connector = DB::get_connector();
         if (!self::config()->force_proxy && $connector instanceof PDOConnector) {
             // Use a little bit of magic to replace the pdo instance
             $refObject = new ReflectionObject($connector);
             $refProperty = $refObject->getProperty('pdoConnection');
             $refProperty->setAccessible(true);
             $traceablePdo = new DebugBar\DataCollector\PDO\TraceablePDO($refProperty->getValue($connector));
             $refProperty->setValue($connector, $traceablePdo);
             $debugbar->addCollector(new DebugBar\DataCollector\PDO\PDOCollector($traceablePdo));
         } else {
             DB::set_conn($db = new DebugBarDatabaseNewProxy(DB::get_conn()));
             $db->setShowQueries(self::getShowQueries());
             $debugbar->addCollector(new DebugBarDatabaseCollector($db));
         }
     } else {
         if (!DB::getConn()) {
             global $databaseConfig;
             if ($databaseConfig) {
                 DB::connect($databaseConfig);
             }
         }
         DB::setConn($db = new DebugBarDatabaseProxy(DB::getConn()));
         $db->setShowQueries(self::getShowQueries());
         $debugbar->addCollector(new DebugBarDatabaseCollector($db));
     }
     // Add some SilverStripe specific infos
     $debugbar->addCollector(new DebugBarSilverStripeCollector());
     if (self::config()->enable_storage) {
         $debugbar->setStorage(new DebugBar\Storage\FileStorage(TEMP_FOLDER . '/debugbar'));
     }
     // Since we buffer everything, why not enable all dev options ?
     if (self::config()->auto_debug) {
         $_REQUEST['debug'] = true;
         $_REQUEST['debug_request'] = true;
     }
     if (isset($_REQUEST['debug']) || isset($_REQUEST['debug_request'])) {
         self::$bufferingEnabled = true;
         ob_start();
         // We buffer everything until we have called an action
     }
     return $debugbar;
 }
开发者ID:lekoala,项目名称:silverstripe-debugbar,代码行数:81,代码来源:DebugBar.php

示例7: define

<?php

define('SS_NR_BASE', basename(dirname(__FILE__)));
Config::inst()->update('NewRelicPerformanceReport', 'menu_icon', SS_NR_BASE . '/images/new-relic.png');
//Configure new relic monitoring
if (extension_loaded('newrelic')) {
    //Bind to the controller class
    Controller::add_extension('NewRelicControllerHook');
    //If we have an application name constant ensure New Relic knows what the name is
    if (defined('SS_NR_APPLICATION_NAME')) {
        newrelic_set_appname(SS_NR_APPLICATION_NAME);
    }
    //If we're in cli make sure New Relic is aware that we are
    if (Director::is_cli()) {
        newrelic_background_job(true);
    }
    //New Relic error binders
    if (Director::isLive() || defined('SS_NR_FORCE_ENABLE_LOGGING')) {
        SS_Log::add_writer(new NewRelicErrorLogger(), SS_Log::NOTICE);
        SS_Log::add_writer(new NewRelicErrorLogger(), SS_Log::WARN);
        SS_Log::add_writer(new NewRelicErrorLogger(), SS_Log::ERR);
    }
}
开发者ID:webbuilders-group,项目名称:silverstripe-new-relic,代码行数:23,代码来源:_config.php

示例8:

<?php

SiteConfig::add_extension('SSTweaksSiteConfig');
SiteTree::add_extension('SSTweaksSiteTree');
Controller::add_extension('SSTweaksController');
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-sstweaks,代码行数:5,代码来源:_config.php

示例9:

<?php

global $project;
$project = 'app_config';
global $database;
// Use _ss_environment.php file for configuration
require_once "conf/ConfigureFromEnv.php";
Config::inst()->update('Email', 'admin_email', ADMIN_EMAIL);
Config::inst()->update('MySQLDatabase', 'connection_charset', 'utf8');
Config::inst()->update('GDBackend', 'default_quality', 100);
Controller::add_extension('AppControllerExtension');
Config::inst()->update('RootURLController', 'default_homepage_link', 'home');
Config::inst()->update('Security', 'default_login_dest', DEFAULT_LOGIN_DESTINATION);
// hash links will not be rewritten, to allow "Back to Top Button" and smooth scrolling on OnePagers
Config::inst()->update('SSViewer', 'rewrite_hash_links', false);
// Locale
LocaleGeoip::set_available_languages(array('en_US' => 'ENGLISH', 'de_DE' => 'GERMAN'));
// Country -> Locale Map (benötigt für die GeoIP erkennung und das mapping in die entsprechende Sprache)
LocaleGeoip::set_country_locale_code_map(array('US' => 'en_US', 'DE' => 'de_DE'));
LocaleGeoip::set_default_locale_code('en_US');
// apt-get install geoip-bin php5-geoip
Geoip::set_default_country_code('US');
开发者ID:andrelohmann,项目名称:vagrant-cloud,代码行数:22,代码来源:_config.php

示例10: unserialize

<?php

if (Director::isLive()) {
    Controller::add_extension('SS_MinifiedResponseExtension');
    Requirements::set_backend(new Minify_Requirements_Backend());
    if (defined('MINIFY_CACHE_BACKEND') && defined('MINIFY_CACHE_LIFETIME')) {
        $backend = unserialize(MINIFY_CACHE_BACKEND);
        SS_Cache::add_backend('MINIFY_CACHE_BACKEND', $backend['Type'], $backend['Options']);
        SS_Cache::set_cache_lifetime('MINIFY_CACHE_BACKEND', MINIFY_CACHE_LIFETIME, 100);
        SS_Cache::pick_backend('MINIFY_CACHE_BACKEND', 'MINIFY_CACHE', 100);
    }
}
开发者ID:andrelohmann,项目名称:silverstripe-minify,代码行数:12,代码来源:_config.php

示例11:

<?php

// Extentions
SiteConfig::add_extension('Ext_Commerce_SiteConfig');
Image::add_extension('Ext_Commerce_Image');
Controller::add_extension('Ext_Commerce_Controller');
Group::add_extension('Ext_Commerce_Group');
Member::add_extension('Ext_Commerce_Member');
if (class_exists('Users_Account_Controller')) {
    Users_Account_Controller::add_extension('Ext_Commerce_UsersController');
}
// If subsites is installed
if (class_exists('Subsite')) {
    Product::add_extension('Ext_Subsites_CommerceObject');
    ProductCategory::add_extension('Ext_Subsites_CommerceObject');
    Order::add_extension('Ext_Subsites_CommerceObject');
    CatalogueAdmin::add_extension('SubsiteMenuExtension');
    LocaliseAdmin::add_extension('SubsiteMenuExtension');
    OrderAdmin::add_extension('SubsiteMenuExtension');
}
LeftAndMain::add_extension('Ext_Commerce_LeftAndMain');
// Setup google sitemaps
if (class_exists("GoogleSitemap")) {
    GoogleSitemap::register_dataobject('Product');
    GoogleSitemap::register_dataobject('ProductCategory');
}
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-commerce,代码行数:26,代码来源:_config.php


注:本文中的Controller::add_extension方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。