当前位置: 首页>>代码示例>>PHP>>正文


PHP Requirements::get_combine_files方法代码示例

本文整理汇总了PHP中Requirements::get_combine_files方法的典型用法代码示例。如果您正苦于以下问题:PHP Requirements::get_combine_files方法的具体用法?PHP Requirements::get_combine_files怎么用?PHP Requirements::get_combine_files使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Requirements的用法示例。


在下文中一共展示了Requirements::get_combine_files方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: CombineThemeRelativeFile

 public static function CombineThemeRelativeFile($combine_name, $pathrelativetotheme, $makeFirstItem = false)
 {
     $themedir = SSViewer::current_theme();
     $file = "themes/{$themedir}/{$pathrelativetotheme}";
     $to_combine = array($file);
     $combine_name = "{$themedir}-{$combine_name}";
     $previously_included = Requirements::get_combine_files();
     // append to existing array, if any
     if (array_key_exists($combine_name, $previously_included)) {
         if ($makeFirstItem) {
             $to_combine = array_merge($to_combine, $previously_included[$combine_name]);
         } else {
             $to_combine = array_merge($previously_included[$combine_name], $to_combine);
         }
     }
     Requirements::combine_files($combine_name, $to_combine);
 }
开发者ID:micschk,项目名称:silverstripe-cmstweaks,代码行数:17,代码来源:PageHelpersExtension.php

示例3: httpError

 /**
  * Returns the HTTP error response.
  * 
  * @param string $code    Error code
  * @param string $message Error message
  * 
  * @return void
  * 
  * @throws SS_HTTPResponse_Exception
  * @author Sebastian Diel <sdiel@pixeltricks.de>
  * @since 07.05.2015
  */
 public function httpError($code, $message = null)
 {
     $combined_files = Requirements::get_combine_files();
     try {
         $response = parent::httpError($code, $message);
     } catch (SS_HTTPResponse_Exception $e) {
         $originalResponse = $e->getResponse();
         Requirements::restore();
         foreach ($combined_files as $combinedFileName => $files) {
             Requirements::combine_files($combinedFileName, $files);
             Requirements::process_combined_files();
         }
         $response = $this->request->isMedia() ? null : self::error_response_for($code);
         throw new SS_HTTPResponse_Exception($response ? $response : ($originalResponse ? $originalResponse : $message), $code);
     }
 }
开发者ID:silvercart,项目名称:silvercart,代码行数:28,代码来源:SilvercartPage.php


注:本文中的Requirements::get_combine_files方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。