You are here

function _potx_find_version_number in Translation template extractor 6

Same name and namespace in other branches
  1. 8 potx.inc \_potx_find_version_number()
  2. 5.2 potx.inc \_potx_find_version_number()
  3. 5 potx.inc \_potx_find_version_number()
  4. 6.3 potx.inc \_potx_find_version_number()
  5. 6.2 potx.inc \_potx_find_version_number()
  6. 7.3 potx.inc \_potx_find_version_number()
  7. 7 potx.inc \_potx_find_version_number()
  8. 7.2 potx.inc \_potx_find_version_number()

Get the exact CVS version number from the file, so we can push that into the generated output.

Parameters

$code: Complete source code of the file parsed.

$file: Name of the file parsed.

$version_callback: Callback used to save the version information.

1 call to _potx_find_version_number()
_potx_process_file in ./potx.inc
Process a file and put extracted information to the given parameters.

File

./potx.inc, line 889
Extraction API used by the web and command line interface.

Code

function _potx_find_version_number($code, $file, $version_callback) {

  // Prevent CVS from replacing this pattern with actual info.
  if (preg_match('!\\$I' . 'd: ([^\\$]+) Exp \\$!', $code, $version_info)) {
    $version_callback($version_info[1], $file);
  }
  else {

    // Unknown version information.
    $version_callback($file . ': n/a', $file);
  }
}