當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Requirements::unblock方法代碼示例

本文整理匯總了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');
 }
開發者ID:racontemoi,項目名稱:shibuichi,代碼行數:33,代碼來源:RequirementsTest.php

示例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;
 }
開發者ID:helpfulrobot,項目名稱:azt3k-abc-silverstripe,代碼行數:15,代碼來源:RequirementsHelper.php


注:本文中的Requirements::unblock方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。