/[drupal]/contributions/modules/module_builder/includes/process.inc
ViewVC logotype

Diff of /contributions/modules/module_builder/includes/process.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.23, Sat Oct 24 21:16:03 2009 UTC revision 1.1.2.24, Sat Oct 24 21:27:14 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: process.inc,v 1.1.2.22 2009/10/24 18:46:26 joachim Exp $  // $Id: process.inc,v 1.1.2.23 2009/10/24 21:16:03 joachim Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 106  function module_builder_get_hook_data($d Line 106  function module_builder_get_hook_data($d
106   * @param hook_file_data   * @param hook_file_data
107   *  An array of data about the files to process, keyed by (safe) filename:   *  An array of data about the files to process, keyed by (safe) filename:
108      [MODULE.FILENAME] => Array // eg system.core.php      [MODULE.FILENAME] => Array // eg system.core.php
109        [url] => URL        [path] => full path to the file
110        [destination] => %module.module        [destination] => %module.module
111        [group] => GROUP  // eg core        [group] => GROUP  // eg core
112     *  This is the same format as returned by update.inc.
113   * @return   * @return
114   *  An array keyed by originating file of the following form:   *  An array keyed by originating file of the following form:
115   *     [GROUP] => array(  // grouping for UI.   *     [GROUP] => array(  // grouping for UI.
# Line 119  function module_builder_get_hook_data($d Line 120  function module_builder_get_hook_data($d
120             [destination] => Destination module file for hook code from this file.             [destination] => Destination module file for hook code from this file.
121   */   */
122  function module_builder_process_hook_data($hook_file_data) {  function module_builder_process_hook_data($hook_file_data) {
   $directory = _module_builder_get_hooks_directory();  
123    /*    /*
124    // Get list of hook documentation files    // Get list of hook documentation files
125    $files = module_builder_get_doc_files($directory);    $files = module_builder_get_doc_files($directory);
# Line 135  function module_builder_process_hook_dat Line 135  function module_builder_process_hook_dat
135    // Build list of hooks    // Build list of hooks
136    $hook_groups = array();    $hook_groups = array();
137    foreach ($hook_file_data as $file => $file_data) {    foreach ($hook_file_data as $file => $file_data) {
138      $hook_data_raw = _module_builder_process_hook_file($directory, $file);      $hook_data_raw = _module_builder_process_hook_file($file_data['path']);
139    
140      $file_name = basename($file, '.php');      $file_name = basename($file, '.php');
141      $group = $file_data['group'];      $group = $file_data['group'];
# Line 164  function module_builder_process_hook_dat Line 164  function module_builder_process_hook_dat
164    //dsm($hook_groups);    //dsm($hook_groups);
165    //print_r($hook_groups);    //print_r($hook_groups);
166    
167      // Write the processed data to a file.
168      $directory = _module_builder_get_hooks_directory();
169    file_put_contents("$directory/hooks_processed.php", serialize($hook_groups));    file_put_contents("$directory/hooks_processed.php", serialize($hook_groups));
170    
171    return $hook_groups;    return $hook_groups;
# Line 222  function module_builder_get_doc_files() Line 224  function module_builder_get_doc_files()
224   *    [1]: Each hook's entire function declaration: "function name($params)"   *    [1]: Each hook's entire function declaration: "function name($params)"
225   *    [2]: Name of each hook   *    [2]: Name of each hook
226   */   */
227  function _module_builder_process_hook_file($directory, $file) {  function _module_builder_process_hook_file($filepath) {
228    
229    $contents = file_get_contents("$directory/$file");    $contents = file_get_contents("$filepath");
230    
231    // Get the destination stored at the top of the file.    // Get the destination stored at the top of the file.
232    preg_match('[^// module builder: (\S+)\n]', $contents, $matches_dest);    preg_match('[^// module builder: (\S+)\n]', $contents, $matches_dest);

Legend:
Removed from v.1.1.2.23  
changed lines
  Added in v.1.1.2.24

  ViewVC Help
Powered by ViewVC 1.1.2