本文整理汇总了PHP中Requirements::unblock方法的典型用法代码示例。如果您正苦于以下问题:PHP Requirements::unblock方法的具体用法?PHP Requirements::unblock怎么用?PHP Requirements::unblock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Requirements
的用法示例。
在下文中一共展示了Requirements::unblock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBlockedCombinedJavascript
function testBlockedCombinedJavascript()
{
$combinedFilePath = Director::baseFolder() . '/' . 'RequirementsTest_bc.js';
/* BLOCKED COMBINED FILES ARE NOT INCLUDED */
$this->setupCombinedRequirements();
Requirements::block('RequirementsTest_bc.js');
Requirements::delete_combined_files('RequirementsTest_bc.js');
clearstatcache();
// needed to get accurate file_exists() results
$html = Requirements::includeInHTML(false, self::$html_template);
$this->assertFalse((bool) preg_match('/src=".*\\/RequirementsTest_bc\\.js/', $html), 'blocked combined files are not included ');
Requirements::unblock('RequirementsTest_bc.js');
/* BLOCKED UNCOMBINED FILES ARE NOT INCLUDED */
// need to re-add requirements, as Requirements::process_combined_includes() alters the
// original arrays grml...
$this->setupCombinedRequirements();
Requirements::block('sapphire/tests/forms/RequirementsTest_b.js');
Requirements::delete_combined_files('RequirementsTest_bc.js');
clearstatcache();
// needed to get accurate file_exists() results
$html = Requirements::includeInHTML(false, self::$html_template);
$this->assertFalse(strpos(file_get_contents($combinedFilePath), "alert('b')") !== false, 'blocked uncombined files are not included');
Requirements::unblock('RequirementsTest_b.js');
/* A SINGLE FILE CAN'T BE INCLUDED IN TWO COMBINED FILES */
$this->setupCombinedRequirements();
clearstatcache();
// needed to get accurate file_exists() results
// This throws a notice-level error, so we prefix with @
@Requirements::combine_files('RequirementsTest_ac.js', array('sapphire/tests/forms/RequirementsTest_a.js', 'sapphire/tests/forms/RequirementsTest_c.js'));
$combinedFiles = Requirements::get_combine_files();
$this->assertEquals(array_keys($combinedFiles), array('RequirementsTest_bc.js'), "A single file can't be included in two combined files");
Requirements::delete_combined_files('RequirementsTest_bc.js');
}
示例2: process_requirements
/**
* @return string the name of the called class
*/
public static function process_requirements()
{
$class = get_called_class();
$requirements = $class::get_requirements();
foreach ($requirements['block'] as $file) {
Requirements::block($file);
}
foreach ($requirements['unblock'] as $file) {
Requirements::unblock($file);
}
return $class;
}