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


PHP Regex::process方法代码示例

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


在下文中一共展示了Regex::process方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 public static function process($directory = "", $defaults, $config = array())
 {
     PipelineHooks::beforeProcessingFilesIn($directory, $defaults, $config);
     // Hook for before this directory is processed
     $configPath = $directory . "config.json";
     if (file_exists($configPath)) {
         CL::printDebug("Config File at: " . $configPath, 1);
     }
     $config = Secretary::getJSON($configPath, $config);
     if (array_key_exists("Content", $config)) {
         CL::println("WARNING: You've declared field \"Content\" in JSON file: " . $directory . "config.json", 0, Colour::Red);
         CL::println("The \"Content\" keyword is reserved for storing the file contents in.", 0, Colour::Red);
         CL::println("The value for \"Content\" stored in the JSON file will be ignored.", 0, Colour::Red);
     }
     $files = array();
     $markdowns = glob($directory . "*.md");
     foreach ($markdowns as $markdown) {
         CL::printDebug("Processing: " . $markdown);
         $file = new File($markdown);
         // Set up our @data
         $data = array_merge($config, $file->data);
         // Renaming to make more semantic sense as we're now working with the "data"
         $data["Content"] = $file->contents;
         // Pass in our file contents
         $raw = $data;
         // Store raw data before processing
         // Process our data through data extensions
         if (array_key_exists("DataExtensions", $defaults)) {
             $data = DataProcessor::process($data, $defaults["DataExtensions"]);
             // Process our data to be filled in
             CL::printDebug("Processed data", 1, Colour::Green);
         } else {
             CL::printDebug("No data extensions declared", 1);
         }
         $data["Content"] = Regex::process($data["Content"]);
         // Now regex it all
         CL::printDebug("Processed Regex", 1, Colour::Green);
         $templateFile = Templater::process($data["Template"]);
         // Generate our template
         CL::printDebug("Processed template: " . $data["Template"], 1, Colour::Green);
         $processedFile = LTM::process($templateFile, $data, $raw);
         // Fill in any conditions and optionals
         CL::printDebug("Processed LTM", 1, Colour::Green);
         $file->contents = $processedFile;
         // Store the complete processed file back into the file object
         array_push($files, $file);
         // Add it to the array ready to be exported!
     }
     PipelineHooks::afterProcessing($files, $directory, $defaults, $config);
     // Hook for after this directory is processed - and lets pass some files!
     $directories = glob($directory . "*", GLOB_ONLYDIR);
     foreach ($directories as $directory) {
         $newFiles = self::process($directory . "/", $defaults, $config);
         foreach ($newFiles as $newFile) {
             array_push($files, $newFile);
         }
     }
     return $files;
 }
开发者ID:OhItsShaun,项目名称:Warehouse,代码行数:59,代码来源:class.FilesProcessor.php


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