本文整理汇总了PHP中Director::forceSSL方法的典型用法代码示例。如果您正苦于以下问题:PHP Director::forceSSL方法的具体用法?PHP Director::forceSSL怎么用?PHP Director::forceSSL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Director
的用法示例。
在下文中一共展示了Director::forceSSL方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Force SSL on live site.
*/
public function init()
{
if (Director::isLive()) {
Director::forceSSL();
}
parent::init();
}
示例2: init
/**
* Initialisierung
*
* @return void
*
* @author Sascha Koehler <skoehler@pixeltricks.de>
* @since 02.12.2010
*/
public function init()
{
if (SilvercartConfig::EnableSSL()) {
Director::forceSSL();
}
parent::init();
}
示例3: testForceSSLAlternateDomain
public function testForceSSLAlternateDomain()
{
Config::inst()->update('Director', 'alternate_base_url', '/');
$_SERVER['REQUEST_URI'] = Director::baseURL() . 'admin';
$output = Director::forceSSL(array('/^admin/'), 'secure.mysite.com');
$this->assertEquals($output, 'https://secure.mysite.com/admin');
}
示例4: testForceSSLWithPatternDoesNotMatchOtherPages
public function testForceSSLWithPatternDoesNotMatchOtherPages()
{
$_SERVER['REQUEST_URI'] = Director::baseURL() . 'normal-page';
$output = Director::forceSSL(array('/^admin/'));
$this->assertFalse($output);
$_SERVER['REQUEST_URI'] = Director::baseURL() . 'just-another-page/sub-url';
$output = Director::forceSSL(array('/^admin/', '/^Security/'));
$this->assertFalse($output);
}
示例5: init
/**
* statements to be called on object initialisation
*
* @author Roland Lehmann <rlehmann@pixeltricks.de>
* @since 18.11.2010
* @return void
*/
public function init()
{
if (SilvercartConfig::EnableSSL()) {
Director::forceSSL();
}
Session::clear("redirect");
//if customer has been to the checkout yet this is set to direct him back to the checkout after address editing
parent::init();
$this->registerCustomHtmlForm('SilvercartLoginForm', new SilvercartLoginForm($this));
}
示例6:
global $project;
$project = 'mysite';
global $database;
//!!! YOU HAVE TO DEFINE YOUR DATABASE FIRST, MAN. !!!
$database = 'iowa-parents';
// Use _ss_environment.php file for configuration
require_once "conf/ConfigureFromEnv.php";
// Set the site locale
i18n::set_locale('en_US');
FulltextSearchable::enable();
// Enable nested URLs for this site (e.g. page/sub-page/)
if (class_exists('SiteTree')) {
SiteTree::enable_nested_urls();
}
if (Director::isLive()) {
Director::forceSSL();
}
Requirements::set_force_js_to_bottom(true);
// add a button to remove formatting
HtmlEditorConfig::get('cms')->insertButtonsBefore('styleselect', 'removeformat');
// tell the button which tags it may remove
HtmlEditorConfig::get('cms')->setOption('removeformat_selector', 'b,strong,em,i,span,ins');
//remove font->span conversion
HtmlEditorConfig::get('cms')->setOption('convert_fonts_to_spans', 'false,');
HtmlEditorConfig::get('cms')->setOptions(array('valid_elements' => "@[id|class|style|title],#a[id|rel|rev|dir|tabindex|accesskey|type|name|href|target|title|class],-strong/-b[class],-em/-i[class],-strike[class],-u[class],#p[id|dir|class|align|style],-ol[class],-ul[class],-li[class],br,img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align],-sub[class],-sup[class],-blockquote[dir|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|dir|id|style],-tr[id|dir|class|rowspan|width|height|align|valign|bgcolor|background|bordercolor|style],tbody[id|class|style],thead[id|class|style],tfoot[id|class|style],#td[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],-th[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],caption[id|dir|class],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|dir|class|align|style],hr[class],dd[id|class|title|dir],dl[id|class|title|dir],dt[id|class|title|dir],@[id,style,class],small", 'extended_valid_elements' => "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|usemap],#iframe[src|name|width|height|align|frameborder|marginwidth|marginheight|scrolling],object[width|height|data|type],param[name|value],map[class|name|id],area[shape|coords|href|target|alt]"));
// TinyMCE cleanup on paste
HtmlEditorConfig::get('cms')->setOption('paste_auto_cleanup_on_paste', 'true');
HtmlEditorConfig::get('cms')->setOption('paste_remove_styles', 'true');
HtmlEditorConfig::get('cms')->setOption('paste_remove_styles_if_webkit', 'true');
HtmlEditorConfig::get('cms')->setOption('paste_strip_class_attributes', 'true');
GD::set_default_quality(80);
示例7: force_ssl
/**
* Forces HTTPS mode if set in the configuration
*/
private static function force_ssl()
{
$mode = self::config()->force_ssl;
if (!is_bool($mode)) {
user_error("Expected boolean in SSPSecurity::force_ssl", E_USER_ERROR);
}
if ($mode) {
Director::forceSSL(null, $_SERVER['HTTP_HOST']);
}
}
示例8: init
/**
* Initializes the step form. Includes forms and requirements.
*
* @return void
*
* @author Sebastian Diel <sdiel@pixeltricks.de>,
* Sascha Koehler <skoehler@pixeltricks.de>
* @since 15.11.2014
*/
public function init()
{
$this->preferences['templateDir'] = PIXELTRICKS_CHECKOUT_BASE_PATH_REL . 'templates/Layout/';
if (SilvercartConfig::EnableSSL()) {
Director::forceSSL();
}
parent::init();
// Inject payment and shippingmethods to shoppingcart, if available
$member = SilvercartCustomer::currentUser();
if ($member) {
$stepData = $this->getCombinedStepData();
$shoppingCart = $member->getCart();
// If minimum order value is set and shoppingcart value is below we
// have to redirect the customer to the shoppingcart page and set
// an appropriate error message.
if ($this->getCurrentStep() < 5 && SilvercartConfig::UseMinimumOrderValue() && SilvercartConfig::MinimumOrderValue() && SilvercartConfig::MinimumOrderValue()->getAmount() > $shoppingCart->getAmountTotalWithoutFees()->getAmount()) {
$silvercartSessionErrors = Session::get('Silvercart.errors');
$silvercartSessionErrors[] = sprintf(_t('SilvercartShoppingCart.ERROR_MINIMUMORDERVALUE_NOT_REACHED'), SilvercartConfig::MinimumOrderValue()->Nice());
Session::set('Silvercart.errors', $silvercartSessionErrors);
Session::save();
$this->redirect(SilvercartPage_Controller::PageByIdentifierCode('SilvercartCartPage')->Link());
}
if (isset($stepData['ShippingMethod'])) {
$shoppingCart->setShippingMethodID($stepData['ShippingMethod']);
}
if (isset($stepData['PaymentMethod'])) {
$shoppingCart->setPaymentMethodID($stepData['PaymentMethod']);
}
$requestParams = $this->getRequest()->allParams();
if ($requestParams['Action'] == 'editAddress') {
$addressID = (int) $requestParams['ID'];
$membersAddresses = SilvercartCustomer::currentUser()->SilvercartAddresses();
$membersAddress = $membersAddresses->find('ID', $addressID);
if ($membersAddress instanceof SilvercartAddress && $membersAddress->exists()) {
Session::set("redirect", $this->Link());
$preferences = array();
$preferences['submitAction'] = 'editAddress/' . $addressID . '/customHtmlFormSubmit';
$this->registerCustomHtmlForm('SilvercartEditAddressForm', new SilvercartEditAddressForm($this, array('addressID' => $addressID), $preferences));
}
} elseif ($requestParams['Action'] == 'addNewAddress') {
Session::set("redirect", $this->Link());
$preferences = array();
$preferences['submitAction'] = 'addNewAddress/customHtmlFormSubmit';
$this->registerCustomHtmlForm('SilvercartAddAddressForm', new SilvercartAddAddressForm($this, array(), $preferences));
}
}
}
示例9: array
// Use _ss_environment.php file for configuration
require_once "conf/ConfigureFromEnv.php";
// Register custom site configuration extension
DataObject::add_extension('SiteConfig', 'CustomSiteConfig');
// Set the site locale
i18n::set_locale('en_US');
//Turn on Silverstripe Translation
Object::add_extension('SiteTree', 'Translatable');
Object::add_extension('SiteConfig', 'Translatable');
Translatable::set_allowed_locales(array('en_US', 'de_DE', 'es_ES', 'ja_JP'));
//Turn on Silverstripe Translation
// Search index for Orgs
Object::add_extension('Org', 'AutocompleteOrgDecorator');
// Enable SSL for specific subdomains
if (Director::isLive()) {
Director::forceSSL(array('/^Security/', '/^profile/', '/^join/', '/^user-survey/', '/^summit/', '/^news-manage/', '/^vote-vancouver/'));
}
// Email errors and warnings
global $email_log;
SS_Log::add_writer(new SS_LogFileWriter(Director::baseFolder() . '/logs/site.log'), SS_Log::ERR);
$email_log_writer = new Custom_SS_LogEmailWriter($email_log);
$email_log_writer->setFormatter(new SS_CustomLogErrorEmailFormatter());
SS_Log::add_writer($email_log_writer, SS_Log::ERR, '<=');
// Default From address for email
global $email_from;
Config::inst()->update('Email', 'admin_email', $email_from);
//Register Shortcodes
ShortcodeParser::get()->register('Sched', array('Page', 'SchedShortCodeHandler'));
ShortcodeParser::get()->register('outlink', array('Page', 'ExternalLinkShortCodeHandler'));
ShortcodeParser::get()->register('icon', array('Page', 'IconShortCodeHandler'));
//cache configuration
示例10: init
/**
* initialisation of the form object
* logged in members get logged out
*
* @author Sascha Koehler <skoehler@pixeltricks.de> Roland Lehmann <rlehmann@pixeltricks.de>
* @since 20.10.2010
* @return void
*/
public function init()
{
if (SilvercartConfig::EnableSSL()) {
Director::forceSSL();
}
$this->registerCustomHtmlForm('SilvercartRegisterRegularCustomerForm', new SilvercartRegisterRegularCustomerForm($this));
parent::init();
}