本文整理汇总了PHP中Director::isLive方法的典型用法代码示例。如果您正苦于以下问题:PHP Director::isLive方法的具体用法?PHP Director::isLive怎么用?PHP Director::isLive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Director
的用法示例。
在下文中一共展示了Director::isLive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendNotification
/**
* Sends a notification via Slack
* @param string $message
*/
public function sendNotification($message)
{
// Only send a notification if we are running in production mode
if (Director::isLive()) {
$config = SiteConfig::current_site_config();
$message = $config->Title . ' (' . Director::absoluteBaseURL() . ') - ' . $message;
$this->client->send($message);
}
}
示例2: init
/**
* Force SSL on live site.
*/
public function init()
{
if (Director::isLive()) {
Director::forceSSL();
}
parent::init();
}
示例3: GerritStatisticsReport
public function GerritStatisticsReport()
{
Requirements::block(SAPPHIRE_DIR . "/javascript/jquery_improvements.js");
Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.min.js');
Requirements::block(THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js');
if (Director::isLive()) {
Requirements::javascript('themes/openstack/javascript/jquery.min.js');
} else {
Requirements::javascript('themes/openstack/javascript/jquery.js');
}
Requirements::javascript('themes/openstack/javascript/jquery-migrate-1.2.1.min.js');
Requirements::javascript("themes/openstack/javascript/jquery.cookie.js");
Requirements::javascript("themes/openstack/javascript/bootstrap.min.js");
Requirements::css('themes/openstack/css/bootstrap.min.css');
Requirements::javascript(Director::protocol() . "maps.googleapis.com/maps/api/js?sensor=false");
Requirements::javascript("marketplace/code/ui/admin/js/utils.js");
Requirements::javascript("marketplace/code/ui/frontend/js/markerclusterer.js");
Requirements::javascript("marketplace/code/ui/frontend/js/oms.min.js");
Requirements::javascript("marketplace/code/ui/frontend/js/infobubble-compiled.js");
Requirements::javascript("marketplace/code/ui/frontend/js/google.maps.jquery.js");
Requirements::javascript('themes/openstack/javascript/Chart.js');
Requirements::javascript("gerrit_ingest/js/sangria.page.gerrit.statistics.report.js");
Requirements::css('gerrit_ingest/css/sangria.page.gerrit.statistics.report.css');
return $this->owner->getViewer('GerritStatisticsReport')->process($this->owner);
}
示例4: get_property_id
/**
* It's preferable to use this as an access point in case we
* add support for multiple property id's in the future (subsites for example)
* @return string
*/
public static function get_property_id()
{
if (self::config()->disable_on_dev && !Director::isLive()) {
return '';
}
return self::config()->web_property_id;
}
开发者ID:helpfulrobot,项目名称:burnbright-silverstripe-shop-googleanalytics,代码行数:12,代码来源:ShopGoogleAnalytics.php
示例5: XrequireDefaultRecords
public function XrequireDefaultRecords()
{
foreach ($this->config()->get('records') as $code => $record) {
if ($record['IsDev'] && Director::isDev() || $record['IsTest'] && Director::isTest() || $record['IsLive'] && Director::isLive()) {
if (!($discountType = StreakDiscountType::get_by_code($code))) {
$discountType = StreakDiscountType::create();
DB::alteration_message("Added discount type '{$code}'", "changed");
}
// if the record is using default code then update from config.
if ($code == self::DefaultCode) {
$record['Code'] = $this->config()->get('default_code');
} else {
$record['Code'] = $code;
}
$title = $record['Title'];
// if the record is using default title then update from config as hasn't changed, if different
// then leave alone
if ($title == self::DefaultTitle) {
$record['Title'] = $this->config()->get('default_title');
}
$data = array_diff_key($record, array_flip(array('IsDev', 'IsTest', 'IsLive')));
$discountType->update($data);
$discountType->write();
}
}
}
示例6: preRequest
public function preRequest(SS_HTTPRequest $request, Session $session, DataModel $model)
{
if (!$this->testSessionEnvironment->isRunningTests()) {
return;
}
$testState = $this->testSessionEnvironment->getState();
// Date and time
if (isset($testState->datetime)) {
SS_Datetime::set_mock_now($testState->datetime);
}
// Register mailer
if (isset($testState->mailer)) {
$mailer = $testState->mailer;
Email::set_mailer(new $mailer());
Config::inst()->update("Email", "send_all_emails_to", null);
}
// Allows inclusion of a PHP file, usually with procedural commands
// to set up required test state. The file can be generated
// through {@link TestSessionStubCodeWriter}, and the session state
// set through {@link TestSessionController->set()} and the
// 'testsession.stubfile' state parameter.
if (isset($testState->stubfile)) {
$file = $testState->stubfile;
if (!Director::isLive() && $file && file_exists($file)) {
// Connect to the database so the included code can interact with it
global $databaseConfig;
if ($databaseConfig) {
DB::connect($databaseConfig);
}
include_once $file;
}
}
}
示例7: Log
/**
* Log something into our log file
* @param $environment = string (minimum environment state for logging this message)
* @param $message = string (the message body)
**/
static function Log($message = '', $environment = 'dev')
{
// only proceed if LogJam is enabled
if (static::$enabled) {
// make sure our log level matches our environment level, otherwise break out
if (Director::isLive() && $environment != 'live') {
return false;
} else {
if (Director::isTest() && ($environment != 'live' || $environment != 'test')) {
return false;
}
}
// trace the origin call
$trace = SS_Backtrace::filtered_backtrace();
$trace = $trace[0];
$file = isset($trace['file']) ? $trace['file'] : '';
$line = isset($trace['line']) ? $trace['line'] : '';
// construct the line in our file
$output = 'LogJam: ';
$output .= $message;
$output .= ' (line ' . $line . ' in ' . $file . ')';
// piggy-back PHP error_log
return error_log($output);
}
return false;
}
示例8: ShowGoogleAnalytics
function ShowGoogleAnalytics()
{
$config = SiteConfig::current_site_config();
if (Director::isLive() && $config->GoogleAnalyticsID && strpos($_SERVER['REQUEST_URI'], '/admin') === false && strpos($_SERVER['REQUEST_URI'], '/Security') === false && strpos($_SERVER['REQUEST_URI'], '/dev') === false) {
return true;
}
return false;
}
开发者ID:helpfulrobot,项目名称:xini-silverstripe-googleanalytics,代码行数:8,代码来源:GoogleAnalyticsControllerExtension.php
示例9: index
public function index()
{
if (Director::isLive() && !Permission::check('CMS_ACCESS_CMSMain')) {
return Security::permissionFailure($this);
}
Requirements::css(STYLEGUIDE_DIR . '/css/styleguide.css');
return $this->renderWith(array(__CLASS__, 'Page'));
}
示例10: get_spt_merchant_id
static function get_spt_merchant_id()
{
if (!Director::isLive()) {
return 'TESTDIGISPL1';
} else {
return self::$spt_merchant_id;
}
}
示例11: SuppressWhitespace
public function SuppressWhitespace($html)
{
if ($this->config()->suppress == 'always' || $this->config()->suppress == 'live-only' && Director::isLive()) {
$html = preg_replace("/\\s+/", ' ', trim($html));
$html = str_replace(array('<!-- -->', ' //<![CDATA[', '//]]> '), '', $html);
// TODO: remove all comments?
}
return $html;
}
开发者ID:helpfulrobot,项目名称:unisolutions-silverstripe-whitespace-suppressor,代码行数:9,代码来源:WhitespaceSuppressorRequestProcessor.php
示例12: IsEnabled
public function IsEnabled()
{
if (Director::isLive()) {
return true;
} elseif (Director::isDev() && $this->IsEnabledInDev()) {
return true;
}
return false;
}
示例13: init
/**
* Check that we do not run this in production
*/
public function init()
{
// only allowed to do this in DEV or TEST environments for obivious reasons
if (Director::isLive()) {
echo Debug::text("Sorry, can't do this in production/live environments");
exit;
// maybe return?
}
parent::init();
}
示例14: init
public function init()
{
parent::init();
$this->extend('init');
$canAccess = !Director::isLive() && (Director::isDev() || Director::isTest() || Director::is_cli() || Permission::check("ADMIN"));
if (!$canAccess) {
return Security::permissionFailure($this);
}
Requirements::javascript('framework/thirdparty/jquery/jquery.js');
Requirements::javascript('testsession/javascript/testsession.js');
}
示例15: css
function css($file, $media = null)
{
/* Only initiate if webiste is in dev mode or a ?flush is called */
if (preg_match('/\\.less$/i', $file) || Director::isDev() || isset($_GET['flush'])) {
/* If file is CSS, check if there is a LESS file */
if (preg_match('/\\.css$/i', $file)) {
$less = preg_replace('/\\.css$/i', '.less', $file);
if (is_file(Director::getAbsFile($less))) {
$file = $less;
}
}
/* If less file exists, then check/compile it */
if (preg_match('/\\.less$/i', $file)) {
$out = preg_replace('/\\.less$/i', '.css', $file);
$css_file = Director::getAbsFile($out);
$options = array();
/* Automatically compress if in live mode */
if (Director::isLive()) {
$options['compress'] = true;
}
try {
/* Force recompile & only write to css if updated */
if (isset($_GET['flush']) || !Director::isLive()) {
/* Force deleting of all cache files on flush */
if (file_exists(self::$cacheDir) && isset($_GET['flush']) && !self::$already_flushed) {
$paths = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(self::$cacheDir, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST);
foreach ($paths as $path) {
$path->isDir() && !$path->isLink() ? rmdir($path->getPathname()) : unlink($path->getPathname());
}
/* make sure we only flush once per request and not for each *.less */
self::$already_flushed = true;
}
/* Set cache directory */
$options['cache_dir'] = self::$cacheDir;
/* Set cache method */
$options['cache_method'] = self::$cacheMethod;
/* Calculate the LESS file's parent URL */
$css_dir = dirname(Director::baseURL() . $file) . '/';
/* Generate and return cached file path */
$cached_file = self::$cacheDir . '/' . Less_Cache::Get(array(Director::getAbsFile($file) => $css_dir), $options, self::$variables);
/* check cache vs. css and overwrite if necessary */
if (!is_file($css_file) || md5_file($css_file) != md5_file($cached_file)) {
copy($cached_file, $css_file);
}
}
} catch (Exception $ex) {
trigger_error('Less.php fatal error: ' . $ex->getMessage(), E_USER_ERROR);
}
$file = $out;
}
}
/* Return css file path */
return parent::css($file, $media);
}