本文整理汇总了PHP中Requirements::clear_combined_files方法的典型用法代码示例。如果您正苦于以下问题:PHP Requirements::clear_combined_files方法的具体用法?PHP Requirements::clear_combined_files怎么用?PHP Requirements::clear_combined_files使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Requirements
的用法示例。
在下文中一共展示了Requirements::clear_combined_files方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onBeforeHTTPError
/**
* Retrieve the correct error page for the current multisite instance.
* @param integer
* @param SS_HTTPRequest
* @throws SS_HTTPResponse_Exception
*/
public function onBeforeHTTPError($code, $request)
{
$errorPage = ErrorPage::get()->filter(array('ErrorCode' => $code, 'SiteID' => Multisites::inst()->getCurrentSiteId()))->first();
if ($errorPage) {
Requirements::clear();
Requirements::clear_combined_files();
$response = ModelAsController::controller_for($errorPage)->handleRequest($request, DataModel::inst());
throw new SS_HTTPResponse_Exception($response, $code);
}
}
开发者ID:helpfulrobot,项目名称:sheadawson-silverstripe-multisites,代码行数:16,代码来源:MultisitesControllerExtension.php
示例2: response_for
/**
* Get a {@link SS_HTTPResponse} to response to a HTTP error code if an
* {@link ErrorPage} for that code is present.
*
* @param int $statusCode
*
* @return SS_HTTPResponse
*/
public static function response_for($statusCode)
{
// first attempt to dynamically generate the error page
if ($errorPage = DataObject::get_one('ErrorPage', "\"ErrorPage\".\"ErrorCode\" = {$statusCode}")) {
Requirements::clear();
Requirements::clear_combined_files();
return ModelAsController::controller_for($errorPage)->handleRequest(new SS_HTTPRequest('GET', ''), DataModel::inst());
}
// then fall back on a cached version
$cachedPath = self::get_filepath_for_errorcode($statusCode, class_exists('Translatable') ? Translatable::get_current_locale() : null);
if (file_exists($cachedPath)) {
$response = new SS_HTTPResponse();
$response->setStatusCode($statusCode);
$response->setBody(file_get_contents($cachedPath));
return $response;
}
}
示例3: response_for
/**
* Get a {@link SS_HTTPResponse} to response to a HTTP error code if an
* {@link ErrorPage} for that code is present. First tries to serve it
* through the standard SilverStripe request method. Falls back to a static
* file generated when the user hit's save and publish in the CMS
*
* @param int $statusCode
* @return SS_HTTPResponse
*/
public static function response_for($statusCode)
{
// first attempt to dynamically generate the error page
$errorPage = ErrorPage::get()->filter(array("ErrorCode" => $statusCode))->first();
if ($errorPage) {
Requirements::clear();
Requirements::clear_combined_files();
return ModelAsController::controller_for($errorPage)->handleRequest(new SS_HTTPRequest('GET', ''), DataModel::inst());
}
// then fall back on a cached version
$content = self::get_content_for_errorcode($statusCode);
if ($content) {
$response = new SS_HTTPResponse();
$response->setStatusCode($statusCode);
$response->setBody($content);
return $response;
}
}
示例4: httpError
/**
* Display an error page on invalid request.
*
* @parameter <{ERROR_CODE}> integer
* @parameter <{ERROR_MESSAGE}> string
*/
public function httpError($code, $message = null)
{
// Determine the error page for the given status code.
$errorPages = ClassInfo::exists('SiteTree') ? ErrorPage::get()->filter('ErrorCode', $code) : null;
// Allow extension customisation.
$this->extend('updateErrorPages', $errorPages);
// Retrieve the error page response.
if ($errorPages && ($errorPage = $errorPages->first())) {
Requirements::clear();
Requirements::clear_combined_files();
$response = ModelAsController::controller_for($errorPage)->handleRequest(new SS_HTTPRequest('GET', ''), DataModel::inst());
throw new SS_HTTPResponse_Exception($response, $code);
} else {
if ($errorPages && file_exists($cachedPage = ErrorPage::get_filepath_for_errorcode($code, class_exists('Translatable') ? Translatable::get_current_locale() : null))) {
$response = new SS_HTTPResponse();
$response->setStatusCode($code);
$response->setBody(file_get_contents($cachedPage));
throw new SS_HTTPResponse_Exception($response, $code);
} else {
return parent::httpError($code, $message);
}
}
}
示例5: init
/**
* Bootstraps the module, adds JavaScript
*/
public function init()
{
parent::init();
Requirements::clear();
Requirements::css(KICKASSETS_DIR . '/javascript/build/main.css');
Requirements::add_i18n_javascript(KICKASSETS_DIR . '/lang');
$js = $this->config()->js_file;
Requirements::javascript(KICKASSETS_DIR . "/javascript/build/{$js}");
Requirements::clear_combined_files();
}
示例6: __construct
function __construct($controller, $name, $fields, $validator, $readonly, $dataObject) {
$this->dataObject = $dataObject;
Requirements::clear();
Requirements::clear_combined_files();
Requirements::javascript(THIRDPARTY_DIR.'/jquery/jquery.js');
Requirements::javascript(THIRDPARTY_DIR.'/jquery-livequery/jquery.livequery.js');
Requirements::block(THIRDPARTY_DIR.'/behaviour.js');
Requirements::block(SAPPHIRE_DIR.'/javascript/Validator.js');
Requirements::block(THIRDPARTY_DIR.'/prototype.js');
Requirements::clear(THIRDPARTY_DIR.'/behavior.js');
Requirements::block(THIRDPARTY_DIR.'/behavior.js');
Requirements::block(SAPPHIRE_DIR.'/javascript/ComplexTableField.js');
Requirements::block(SAPPHIRE_DIR.'/javascript/TableListField.js');
Requirements::block(THIRDPARTY_DIR.'/greybox/greybox.js');
Requirements::block(THIRDPARTY_DIR.'/greybox/AmiJS.js');
Requirements::block(THIRDPARTY_DIR.'/greybox/greybox.css');
Requirements::block(SAPPHIRE_DIR.'/css/TableListField.css');
Requirements::block(SAPPHIRE_DIR.'/css/ComplexTableField.css');
Requirements::block(ASSETS_DIR.'/leftandmain.js');
Requirements::block(ASSETS_DIR.'/base.js');
Requirements::block(SAPPHIRE_DIR.'/javascript/lang/en_US.js');
Requirements::css(SAPPHIRE_DIR . '/css/Form.css');
Requirements::css(CMS_DIR . '/css/typography.css');
Requirements::css(CMS_DIR . '/css/cms_right.css');
Requirements::css('dataobject_manager/css/dataobject_manager.css');
if($this->dataObject->hasMethod('getRequirementsForPopup')) {
$this->dataObject->getRequirementsForPopup();
}
Requirements::javascript('dataobject_manager/javascript/dataobjectmanager_popup.js');
$actions = new FieldSet();
if(!$readonly) {
$actions->push(
$saveAction = new FormAction("saveComplexTableField", _t('DataObjectManager.SAVE','Save'))
);
$saveAction->addExtraClass('save');
}
parent::__construct($controller, $name, $fields, $actions, $validator);
if ($this->validator instanceof Validator) {
$this->validator->setJavascriptValidationHandler('none');
}
else {
$this->unsetValidator();
}
if($this->getNestedDOMs()) {
Requirements::javascript(THIRDPARTY_DIR.'/jquery-livequery/jquery.livequery.js');
Requirements::javascript('dataobject_manager/javascript/dom_jquery_ui.js');
Requirements::javascript('dataobject_manager/javascript/tooltip.js');
Requirements::javascript('dataobject_manager/javascript/dataobject_manager.js');
}
$this->NestedController = $this->controller->isNested;
}
示例7: setupCombinedRequirements
/**
* This is a bit of a hack, as it alters the Requirements
* statics globally for all tests.
*
* @todo Refactor Requirements to work on test instance level
*/
protected function setupCombinedRequirements() {
Requirements::clear();
// clearing all previously generated requirements (just in case)
Requirements::clear_combined_files();
Requirements::delete_combined_files('RequirementsTest_bc.js');
// require files normally (e.g. called from a FormField instance)
Requirements::javascript(SAPPHIRE_DIR . '/tests/forms/RequirementsTest_a.js');
Requirements::javascript(SAPPHIRE_DIR . '/tests/forms/RequirementsTest_b.js');
Requirements::javascript(SAPPHIRE_DIR . '/tests/forms/RequirementsTest_c.js');
// require two of those files as combined includes
Requirements::combine_files(
'RequirementsTest_bc.js',
array(
SAPPHIRE_DIR . '/tests/forms/RequirementsTest_b.js',
SAPPHIRE_DIR . '/tests/forms/RequirementsTest_c.js'
)
);
}