Index: potx-cli.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/potx/Attic/potx-cli.php,v
retrieving revision 1.1.2.6.4.4
diff -u -p -r1.1.2.6.4.4 potx-cli.php
--- potx-cli.php 13 Oct 2008 21:55:18 -0000 1.1.2.6.4.4
+++ potx-cli.php 22 Aug 2009 20:39:23 -0000
@@ -20,13 +20,13 @@ if (isset($_SERVER['REQUEST_METHOD'])) {
// Functions shared with web based interface
include dirname(__FILE__) .'/potx.inc';
-// We need a lot of resources probably, so try to set memory
+// We need a lot of resources probably, so try to set memory
// limit higher and set unlimited time for our work.
$memory_limit = @ini_get('memory_limit');
if ($memory_limit != '' && (int)$memory_limit < 16) {
// ini_get returns the original set value, such as "32M",
// so we check for the int version. Before PHP 5.2, this
- // limit was less then 16M.
+ // limit was less then 16M.
@ini_set('memory_limit', 16777216);
}
@set_time_limit(0);
@@ -61,7 +61,7 @@ Possible options:
Only perform a 'self test'.
--help
Display this message.
-
+
END;
return 1;
break;
Index: potx.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/potx/Attic/potx.inc,v
retrieving revision 1.1.2.17.2.7.2.19.4.1
diff -u -p -r1.1.2.17.2.7.2.19.4.1 potx.inc
--- potx.inc 19 Jul 2009 12:54:42 -0000 1.1.2.17.2.7.2.19.4.1
+++ potx.inc 22 Aug 2009 20:39:23 -0000
@@ -34,7 +34,7 @@ define('POTX_STATUS_MESSAGE', 1);
/**
* Command line status reporting.
- *
+ *
* Status goes to standard output, errors to standard error.
*/
define('POTX_STATUS_CLI', 2);
@@ -88,14 +88,14 @@ define('POTX_API_5', 5);
/**
* Parse source files in Drupal 6.x format.
- *
+ *
* Changes since 5.x documented at http://drupal.org/node/114774
*/
define('POTX_API_6', 6);
/**
* Parse source files in Drupal 7.x format.
- *
+ *
* Changes since 6.x documented at http://drupal.org/node/224333
*/
define('POTX_API_7', 7);
@@ -211,7 +211,7 @@ function _potx_process_file($file_path,
if ($api_version < POTX_API_7) {
_potx_find_perm_hook($file_name, $name_parts['filename'], $save_callback);
}
- if ($api_version > POTX_API_5) {
+ if ($api_version > POTX_API_5) {
_potx_find_menu_hook($file_name, $name_parts['filename'], $save_callback);
}
}
@@ -293,14 +293,14 @@ function _potx_build_files($string_mode
}
$last_location = dirname($file);
}
-
+
// Mark duplicate strings (both translated in the app and in the installer).
$comment = join(" ", $occured);
if (strpos($comment, '(dup)') !== FALSE) {
$comment = '(duplicate) '. str_replace('(dup)', '', $comment);
}
$output = "#: $comment\n";
-
+
if ($build_mode == POTX_BUILD_SINGLE) {
// File name forcing in single mode.
$file_name = $force_name;
@@ -323,8 +323,8 @@ function _potx_build_files($string_mode
$file_name = str_replace('/', '-', $last_location);
}
}
-
-
+
+
if (strpos($string, "\0") !== FALSE) {
// Plural strings have a null byte delimited format.
list($singular, $plural) = explode("\0", $string);
@@ -389,14 +389,14 @@ function _potx_build_files($string_mode
*/
function _potx_translation_export($translation_export_langcode, $string, $plural = NULL, $api_version = POTX_API_6) {
include_once 'includes/locale.inc';
-
+
// Stip out slash escapes.
$string = stripcslashes($string);
-
+
// Column and table name changed between versions.
$language_column = $api_version > POTX_API_5 ? 'language' : 'locale';
$language_table = $api_version > POTX_API_5 ? 'languages' : 'locales_meta';
-
+
if (!isset($plural)) {
// Single string to look translation up for.
if ($translation = db_result(db_query("SELECT t.translation FROM {locales_source} s LEFT JOIN {locales_target} t ON t.lid = s.lid WHERE s.source = '%s' AND t.{$language_column} = '%s'", $string, $translation_export_langcode))) {
@@ -404,7 +404,7 @@ function _potx_translation_export($trans
}
return "msgstr \"\"\n";
}
-
+
else {
// String with plural variants. Fill up source string array first.
$plural = stripcslashes($plural);
@@ -427,7 +427,7 @@ function _potx_translation_export($trans
}
$plural_index++;
}
-
+
$output = '';
if (count($strings)) {
// Source string array was done, so export translations.
@@ -522,7 +522,7 @@ function _potx_write_files($http_filenam
$filelist = 'No version information was available in the source files.';
}
$output = str_replace('--VERSIONS--', $filelist, $contents['header'] . $contents['strings']);
-
+
if ($http_filename) {
// HTTP output.
header('Content-Type: text/plain; charset=utf-8');
@@ -579,7 +579,7 @@ function _potx_format_quoted_string($str
*/
function _potx_marker_error($file, $line, $marker, $ti, $error, $docs_url = NULL) {
global $_potx_tokens;
-
+
$tokens = '';
$ti += 2;
$tc = count($_potx_tokens);
@@ -627,7 +627,7 @@ function _potx_marker_error($file, $line
function potx_status($op, $value = NULL, $file = NULL, $line = NULL, $excerpt = NULL, $docs_url = NULL) {
static $mode = POTX_STATUS_CLI;
static $messages = array();
-
+
switch ($op) {
case 'set':
// Setting the reporting mode.
@@ -644,7 +644,7 @@ function potx_status($op, $value = NULL,
case 'error':
case 'status':
-
+
// Location information is required in 3 of the four possible reporting
// modes as part of the error message. The structured mode needs the
// file, line and excerpt info separately, not in the text.
@@ -667,13 +667,13 @@ function potx_status($op, $value = NULL,
}
}
}
-
+
// Documentation helpers are provided as readable text in most modes.
$read_more = '';
if (($mode != POTX_STATUS_STRUCTURED) && isset($docs_url)) {
$read_more = ($mode == POTX_STATUS_CLI) ? t('Read more at @url', array('@url' => $docs_url)) : t('Read more at @url', array('@url' => $docs_url));
}
-
+
// Error message or progress text to display.
switch ($mode) {
case POTX_STATUS_MESSAGE:
@@ -717,7 +717,7 @@ function potx_status($op, $value = NULL,
*/
function _potx_find_t_calls($file, $save_callback, $function_name = 't', $string_mode = POTX_STRING_RUNTIME) {
global $_potx_tokens, $_potx_lookup;
-
+
// Lookup tokens by function name.
if (isset($_potx_lookup[$function_name])) {
foreach ($_potx_lookup[$function_name] as $ti) {
@@ -760,7 +760,7 @@ function _potx_find_t_calls($file, $save
*/
function _potx_find_t_calls_with_context($file, $save_callback, $function_name = 't', $string_mode = POTX_STRING_RUNTIME) {
global $_potx_tokens, $_potx_lookup;
-
+
// Lookup tokens by function name.
if (isset($_potx_lookup[$function_name])) {
foreach ($_potx_lookup[$function_name] as $ti) {
@@ -804,7 +804,7 @@ function _potx_find_t_calls_with_context
*/
function _potx_find_watchdog_calls($file, $save_callback) {
global $_potx_tokens, $_potx_lookup;
-
+
// Lookup tokens by function name.
if (isset($_potx_lookup['watchdog'])) {
foreach ($_potx_lookup['watchdog'] as $ti) {
@@ -984,7 +984,7 @@ function _potx_skip_args($here) {
$nesting = 0;
// Go through to either the end of the function call or to a comma
// after the current position on the same nesting level.
- while (!(($_potx_tokens[$here] == ',' && $nesting == 0) ||
+ while (!(($_potx_tokens[$here] == ',' && $nesting == 0) ||
($_potx_tokens[$here] == ')' && $nesting == -1))) {
$here++;
if (!is_array($_potx_tokens[$here])) {
@@ -997,7 +997,7 @@ function _potx_skip_args($here) {
}
}
// If we run out of nesting, it means we reached the end of the function call,
- // so we skipped the arguments but did not find meat for looking at the
+ // so we skipped the arguments but did not find meat for looking at the
// specified context.
return ($nesting == 0 ? $here : FALSE);
}
@@ -1021,7 +1021,7 @@ function _potx_find_context($tf, $ti, $f
// Start from after the comma and skip the possible arguments for the function
// so we can look for the context.
if (($ti = _potx_skip_args($ti)) && ($_potx_tokens[$ti] == ',')) {
- // Now we actually might have some definition for a context. The $options
+ // Now we actually might have some definition for a context. The $options
// argument is coming up, which might have a key for context.
list($com, $arr, $par) = array($_potx_tokens[$ti], $_potx_tokens[$ti+1], $_potx_tokens[$ti+2]);
if ($com == ',' && $arr[1] == 'array' && $par == '(') {
@@ -1029,7 +1029,7 @@ function _potx_find_context($tf, $ti, $f
$ti += 3;
// Go through to either the end of the array or to the key definition of
// context on the same nesting level.
- while (!((is_array($_potx_tokens[$ti]) && (in_array($_potx_tokens[$ti][1], array('"context"', "'context'"))) && ($_potx_tokens[$ti][0] == T_CONSTANT_ENCAPSED_STRING) && ($nesting == 0)) ||
+ while (!((is_array($_potx_tokens[$ti]) && (in_array($_potx_tokens[$ti][1], array('"context"', "'context'"))) && ($_potx_tokens[$ti][0] == T_CONSTANT_ENCAPSED_STRING) && ($nesting == 0)) ||
($_potx_tokens[$ti] == ')' && $nesting == -1))) {
$ti++;
if (!is_array($_potx_tokens[$ti])) {
@@ -1061,7 +1061,7 @@ function _potx_find_context($tf, $ti, $f
}
}
}
-
+
// After skipping args, we did not find a comma to look for $options.
return POTX_CONTEXT_NONE;
}
@@ -1078,7 +1078,7 @@ function _potx_find_context($tf, $ti, $f
*/
function _potx_find_menu_hook($file, $filebase, $save_callback) {
global $_potx_tokens, $_potx_lookup;
-
+
if (isset($_potx_lookup[$filebase .'_menu']) && is_array($_potx_lookup[$filebase .'_menu'])) {
// We have a menu hook in this file.
foreach ($_potx_lookup[$filebase .'_menu'] as $ti) {
@@ -1126,7 +1126,7 @@ function _potx_find_language_names($file
break;
}
}
-
+
$end = _potx_find_end_of_function($ti);
$ti += 7; // function name, (, ), {, return, array, (
while ($ti < $end) {
@@ -1296,7 +1296,7 @@ function _potx_find_info_file_strings($f
$save_callback($info[$key], POTX_CONTEXT_NONE, $file_name);
}
}
-
+
// Add regions names from themes.
if (isset($info['regions']) && is_array($info['regions'])) {
foreach ($info['regions'] as $region => $region_name) {
@@ -1316,7 +1316,7 @@ function _potx_find_info_file_strings($f
*/
function _potx_parse_js_file($code, $file, $save_callback) {
$js_string_regex = '(?:(?:\'(?:\\\\\'|[^\'])*\'|"(?:\\\\"|[^"])*")(?:\s*\+\s*)?)+';
-
+
// Match all calls to Drupal.t() in an array.
// Note: \s also matches newlines with the 's' modifier.
preg_match_all('~[^\w]Drupal\s*\.\s*t\s*\(\s*('. $js_string_regex .')\s*[,\)]~s', $code, $t_matches, PREG_SET_ORDER);
@@ -1345,7 +1345,7 @@ function _potx_parse_js_file($code, $fil
);
}
}
-
+
// Any remaining Drupal.t() or Drupal.formatPlural() calls are evil. This
// regex is not terribly accurate (ie. code wrapped inside will confuse
// the match), but we only need some unique part to identify the faulty calls.
@@ -1402,7 +1402,7 @@ function _potx_explore_dir($path = '', $
}
}
}
-
+
// Grab subdirectories.
$dirs = glob($path .'*', GLOB_ONLYDIR);
if (is_array($dirs)) {
@@ -1412,7 +1412,7 @@ function _potx_explore_dir($path = '', $
}
}
}
- // Skip our own files, because we don't want to get strings from them
+ // Skip our own files, because we don't want to get strings from them
// to appear in the output, especially with the command line interface.
// TODO: fix this to be able to autogenerate templates for potx itself.
foreach ($files as $id => $file_name) {
@@ -1436,7 +1436,7 @@ function _potx_explore_dir($path = '', $
*/
function _potx_save_version($value = NULL, $file = NULL) {
global $_potx_versions;
-
+
if (isset($value)) {
$_potx_versions[$file] = $value;
}
@@ -1454,7 +1454,7 @@ function _potx_save_version($value = NUL
* The string value. If NULL, the array of collected values
* are returned for the given $string_mode.
* @param $context
- * From Drupal 7, separate contexts are supported. POTX_CONTEXT_NONE is
+ * From Drupal 7, separate contexts are supported. POTX_CONTEXT_NONE is
* the default, if the code does not specify a context otherwise.
* @param $file
* Name of file where the string was found.
@@ -1466,7 +1466,7 @@ function _potx_save_version($value = NUL
*/
function _potx_save_string($value = NULL, $context = NULL, $file = NULL, $line = 0, $string_mode = POTX_STRING_RUNTIME) {
global $_potx_strings, $_potx_install;
-
+
if (isset($value)) {
switch ($string_mode) {
case POTX_STRING_BOTH:
@@ -1503,11 +1503,11 @@ if (!function_exists('drupal_parse_info_
// Directly copied from common.inc,v 1.704 2007/10/19 10:30:54 goba Exp.
function drupal_parse_info_file($filename) {
$info = array();
-
+
if (!file_exists($filename)) {
return $info;
}
-
+
$data = file_get_contents($filename);
if (preg_match_all('
@^\s* # Start at the beginning of a line, ignoring leading whitespace
@@ -1529,12 +1529,12 @@ if (!function_exists('drupal_parse_info_
$$var = isset($match[++$i]) ? $match[$i] : '';
}
$value = stripslashes(substr($value1, 1, -1)) . stripslashes(substr($value2, 1, -1)) . $value3;
-
+
// Parse array syntax
$keys = preg_split('/\]?\[/', rtrim($key, ']'));
$last = array_pop($keys);
$parent = &$info;
-
+
// Create nested arrays
foreach ($keys as $key) {
if ($key == '') {
@@ -1545,12 +1545,12 @@ if (!function_exists('drupal_parse_info_
}
$parent = &$parent[$key];
}
-
+
// Handle PHP constants
if (defined($value)) {
$value = constant($value);
}
-
+
// Insert actual value
if ($last == '') {
$last = count($parent);
@@ -1558,7 +1558,7 @@ if (!function_exists('drupal_parse_info_
$parent[$last] = $value;
}
}
-
+
return $info;
}
}
Index: potx.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/potx/Attic/potx.install,v
retrieving revision 1.1.2.1.4.1
diff -u -p -r1.1.2.1.4.1 potx.install
--- potx.install 19 Jul 2009 12:54:42 -0000 1.1.2.1.4.1
+++ potx.install 22 Aug 2009 20:39:23 -0000
@@ -8,7 +8,7 @@
/**
* Implementation of hook_requirements().
- *
+ *
* The translation template extractor requires the PHP token extension to
* be enabled. We should not let Drupal to install the module if this is
* not available. Also, if it was available, but the site was moved or
@@ -17,7 +17,7 @@
function potx_requirements($phase) {
$requirements = array();
$t = get_t();
-
+
$requirements['potx_tokenizer'] = array(
'title' => $t('PHP tokenizer for Translation template extractor'),
'value' => function_exists('token_get_all') ? $t('Available') : $t('Not available')
@@ -26,11 +26,11 @@ function potx_requirements($phase) {
$requirements['potx_tokenizer']['description'] = $t('The PHP tokenizer functions are required.', array('@tokenizer' => 'http://php.net/tokenizer'));
$requirements['potx_tokenizer']['severity'] = REQUIREMENT_ERROR;
}
-
+
if (module_exists('l10n_community')) {
- // If l10n_server is already installed and enabled, check its version by
- // looking at the specific API piece which lets us fingerprint the right
- // version. The compatible branch introduced
+ // If l10n_server is already installed and enabled, check its version by
+ // looking at the specific API piece which lets us fingerprint the right
+ // version. The compatible branch introduced
// l10n_community_require_potx_with_context().
include_once drupal_get_path('module', 'l10n_community') .'/l10n_community.install';
@@ -44,6 +44,6 @@ function potx_requirements($phase) {
$requirements['potx_l10n_server']['value'] = $t('Not compatible with Translation template extractor');
}
}
-
+
return $requirements;
}
Index: potx.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/potx/Attic/potx.module,v
retrieving revision 1.1.2.12.2.2.2.10
diff -u -p -r1.1.2.12.2.2.2.10 potx.module
--- potx.module 13 Mar 2009 10:13:14 -0000 1.1.2.12.2.2.2.10
+++ potx.module 22 Aug 2009 20:39:23 -0000
@@ -44,7 +44,7 @@ function potx_select_form() {
$form = array();
$components = _potx_component_list();
_potx_component_selector($form, $components);
-
+
// Generate translation file for a specific language if possible.
$languages = language_list();
if (count($languages) > 1 || !isset($languages['en'])) {
@@ -75,7 +75,7 @@ function potx_select_form() {
'#type' => 'submit',
'#value' => t('Extract'),
);
-
+
return $form;
}
@@ -107,7 +107,7 @@ function potx_select_form_submit($form,
// sites/all/modules/coder
// sites/all/modules/i18n/i18n.module
// themes/garland
-
+
$component = $form_state['values']['component'];
$pathinfo = pathinfo($component);
if (!isset($pathinfo['filename'])) {
@@ -117,7 +117,7 @@ function potx_select_form_submit($form,
$strip_prefix = 0;
if (isset($pathinfo['extension'])) {
- // A specific module or theme file was requested (otherwise there should be no extension).
+ // A specific module or theme file was requested (otherwise there should be no extension).
$files = _potx_explore_dir($pathinfo['dirname'] .'/', $pathinfo['filename']);
$strip_prefix = 1 + strlen($pathinfo['dirname']);
$outputname = $pathinfo['filename'];
@@ -128,7 +128,7 @@ function potx_select_form_submit($form,
$strip_prefix = 1 + strlen($component);
$outputname = $pathinfo['basename'];
}
-
+
// Decide on template or translation file generation.
$template_langcode = $translation_langcode = NULL;
if (isset($form_state['values']['langcode']) && ($form_state['values']['langcode'] != 'n/a')) {
@@ -145,14 +145,14 @@ function potx_select_form_submit($form,
else {
$outputname .= '.pot';
}
-
+
// Collect every string in affected files. Installer related strings are discared.
foreach ($files as $file) {
_potx_process_file($file, $strip_prefix);
}
// Need to include full parameter list to get to passing the language codes.
_potx_build_files(POTX_STRING_RUNTIME, POTX_BUILD_SINGLE, 'general', '_potx_save_string', '_potx_save_version', '_potx_get_header', $template_langcode, $translation_langcode);
-
+
_potx_write_files($outputname, 'attachment');
exit;
@@ -178,9 +178,9 @@ function _potx_component_selector(&$form
//ksort($components);
$dirkeys = array_keys($components);
-
+
// A directory with one component.
- if (isset($component_count) && (count($components) == 1)) {
+ if (isset($component_count) && (count($components) == 1)) {
$component = array_shift($components);
$dirname = dirname($component->filename);
$form[_potx_form_id('dir', $dirname)] = array(
@@ -292,7 +292,7 @@ function _potx_component_list() {
$dir['#'. $component->basename] = $component;
$dir['#-count'] = isset($dir['#-count']) ? $dir['#-count'] + 1 : 1;
}
-
+
return $components;
}