Révision 8c72e82a
Ajouté par Assos Assos il y a environ 7 ans
drupal7/sites/all/modules/i18n/README.txt | ||
---|---|---|
20 | 20 |
|
21 | 21 |
Support questions by email to the module maintainer will be simply ignored. Use the issue tracker. |
22 | 22 |
|
23 |
Now if you want professional (paid) support the module maintainer may be available occassionally.
|
|
23 |
Now if you want professional (paid) support the module maintainer may be available occasionally. |
|
24 | 24 |
Drop me a message to check availability and hourly rates, http://reyero.net/en/contact |
25 | 25 |
|
26 | 26 |
==================================================================== |
drupal7/sites/all/modules/i18n/i18n.info | ||
---|---|---|
8 | 8 |
files[] = i18n.test |
9 | 9 |
configure = admin/config/regional/i18n |
10 | 10 |
|
11 |
; Information added by Drupal.org packaging script on 2017-01-31
|
|
12 |
version = "7.x-1.15"
|
|
11 |
; Information added by Drupal.org packaging script on 2017-04-18
|
|
12 |
version = "7.x-1.17"
|
|
13 | 13 |
core = "7.x" |
14 | 14 |
project = "i18n" |
15 |
datestamp = "1485834792"
|
|
15 |
datestamp = "1492537747"
|
|
16 | 16 |
|
drupal7/sites/all/modules/i18n/i18n_block/i18n_block.info | ||
---|---|---|
8 | 8 |
files[] = i18n_block.test |
9 | 9 |
|
10 | 10 |
|
11 |
; Information added by Drupal.org packaging script on 2017-01-31
|
|
12 |
version = "7.x-1.15"
|
|
11 |
; Information added by Drupal.org packaging script on 2017-04-18
|
|
12 |
version = "7.x-1.17"
|
|
13 | 13 |
core = "7.x" |
14 | 14 |
project = "i18n" |
15 |
datestamp = "1485834792"
|
|
15 |
datestamp = "1492537747"
|
|
16 | 16 |
|
drupal7/sites/all/modules/i18n/i18n_block/i18n_block.test | ||
---|---|---|
72 | 72 |
|
73 | 73 |
$this->clickLink(t('translate')); |
74 | 74 |
|
75 |
// Title is a textarea, body is a text_format. |
|
75 | 76 |
$this->assertFieldByName('strings[blocks:block:' . $box2['delta'] . ':title]', $translations['title']['es']); |
76 |
$this->assertFieldByName('strings[blocks:block:' . $box2['delta'] . ':body]', $translations['body']['es']); |
|
77 |
$this->assertFieldByName('strings[blocks:block:' . $box2['delta'] . ':body][value]', $translations['body']['es']);
|
|
77 | 78 |
|
78 | 79 |
// Update the translation. |
79 | 80 |
$translations['title']['es'] = $this->randomName(10); |
80 | 81 |
$translations['body']['es'] = $this->randomName(20); |
81 | 82 |
$edit = array( |
82 | 83 |
'strings[blocks:block:' . $box2['delta'] . ':title]' => $translations['title']['es'], |
83 |
'strings[blocks:block:' . $box2['delta'] . ':body]' => $translations['body']['es'], |
|
84 |
'strings[blocks:block:' . $box2['delta'] . ':body][value]' => $translations['body']['es'],
|
|
84 | 85 |
); |
85 | 86 |
$this->drupalPost(NULL, $edit, t('Save translation')); |
86 | 87 |
$this->i18nAssertTranslations($translations['title'], '', 'Updated block title translation displayed.'); |
drupal7/sites/all/modules/i18n/i18n_contact/i18n_contact.info | ||
---|---|---|
5 | 5 |
package = Multilingual - Internationalization |
6 | 6 |
core = 7.x |
7 | 7 |
|
8 |
; Information added by Drupal.org packaging script on 2017-01-31
|
|
9 |
version = "7.x-1.15"
|
|
8 |
; Information added by Drupal.org packaging script on 2017-04-18
|
|
9 |
version = "7.x-1.17"
|
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "i18n" |
12 |
datestamp = "1485834792"
|
|
12 |
datestamp = "1492537747"
|
|
13 | 13 |
|
drupal7/sites/all/modules/i18n/i18n_field/i18n_field.info | ||
---|---|---|
6 | 6 |
core = 7.x |
7 | 7 |
files[] = i18n_field.inc |
8 | 8 |
files[] = i18n_field.test |
9 |
; Information added by Drupal.org packaging script on 2017-01-31
|
|
10 |
version = "7.x-1.15"
|
|
9 |
; Information added by Drupal.org packaging script on 2017-04-18
|
|
10 |
version = "7.x-1.17"
|
|
11 | 11 |
core = "7.x" |
12 | 12 |
project = "i18n" |
13 |
datestamp = "1485834792"
|
|
13 |
datestamp = "1492537747"
|
|
14 | 14 |
|
drupal7/sites/all/modules/i18n/i18n_forum/i18n_forum.info | ||
---|---|---|
7 | 7 |
core = 7.x |
8 | 8 |
files[] = i18n_forum.test |
9 | 9 |
|
10 |
; Information added by Drupal.org packaging script on 2017-01-31
|
|
11 |
version = "7.x-1.15"
|
|
10 |
; Information added by Drupal.org packaging script on 2017-04-18
|
|
11 |
version = "7.x-1.17"
|
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "i18n" |
14 |
datestamp = "1485834792"
|
|
14 |
datestamp = "1492537747"
|
|
15 | 15 |
|
drupal7/sites/all/modules/i18n/i18n_menu/i18n_menu.info | ||
---|---|---|
10 | 10 |
files[] = i18n_menu.inc |
11 | 11 |
files[] = i18n_menu.test |
12 | 12 |
|
13 |
; Information added by Drupal.org packaging script on 2017-01-31
|
|
14 |
version = "7.x-1.15"
|
|
13 |
; Information added by Drupal.org packaging script on 2017-04-18
|
|
14 |
version = "7.x-1.17"
|
|
15 | 15 |
core = "7.x" |
16 | 16 |
project = "i18n" |
17 |
datestamp = "1485834792"
|
|
17 |
datestamp = "1492537747"
|
|
18 | 18 |
|
drupal7/sites/all/modules/i18n/i18n_menu/i18n_menu.module | ||
---|---|---|
198 | 198 |
// We just make sure every link has a valid language property. |
199 | 199 |
if (!i18n_object_langcode($item)) { |
200 | 200 |
$item['language'] = LANGUAGE_NONE; |
201 |
$item['i18n_tsid'] = 0; |
|
202 | 201 |
} |
203 | 202 |
} |
204 | 203 |
|
... | ... | |
398 | 397 |
if (_i18n_menu_link_process($item['link'])) { |
399 | 398 |
if (!_i18n_menu_link_is_visible($item['link'], $langcode)) { |
400 | 399 |
// Remove links for other languages than current. |
401 |
// Links with language wont be localized. |
|
400 |
// Links with language won't be localized.
|
|
402 | 401 |
unset($tree[$index]); |
403 | 402 |
// @todo Research whether the above has any advantage over: |
404 | 403 |
// $item['hidden'] = TRUE; |
... | ... | |
600 | 599 |
} |
601 | 600 |
|
602 | 601 |
/** |
603 |
* Get localizable properties for menu link checking agains the router item. |
|
602 |
* Get localizable properties for menu link checking against the router item.
|
|
604 | 603 |
*/ |
605 | 604 |
function _i18n_menu_link_localizable_properties($link) { |
606 | 605 |
$props = array(); |
drupal7/sites/all/modules/i18n/i18n_node/i18n_node.info | ||
---|---|---|
9 | 9 |
files[]=i18n_node.test |
10 | 10 |
files[]=i18n_node.variable.inc |
11 | 11 |
|
12 |
; Information added by Drupal.org packaging script on 2017-01-31
|
|
13 |
version = "7.x-1.15"
|
|
12 |
; Information added by Drupal.org packaging script on 2017-04-18
|
|
13 |
version = "7.x-1.17"
|
|
14 | 14 |
core = "7.x" |
15 | 15 |
project = "i18n" |
16 |
datestamp = "1485834792"
|
|
16 |
datestamp = "1492537747"
|
|
17 | 17 |
|
drupal7/sites/all/modules/i18n/i18n_node/i18n_node.module | ||
---|---|---|
222 | 222 |
function i18n_node_node_prepare($node) { |
223 | 223 |
$options = variable_get('i18n_node_options_' . $node->type, array()); |
224 | 224 |
if (i18n_node_type_enabled($node) && empty($node->nid) && !i18n_object_langcode($node) && in_array('current', $options)) { |
225 |
$default = variable_get('i18n_node_default_language_for_' . $node->type, '-- current --'); |
|
226 |
|
|
225 | 227 |
// Set current language for new nodes if option enabled |
226 |
$node->language = i18n_language_content()->language; |
|
228 |
if ($default === '-- current --') { |
|
229 |
$node->language = i18n_language_content()->language; |
|
230 |
} |
|
231 |
// If a custom language was specified, apply it. |
|
232 |
else { |
|
233 |
$node->language = $default; |
|
234 |
} |
|
227 | 235 |
} |
228 | 236 |
} |
229 | 237 |
|
... | ... | |
417 | 425 |
// Some settings about node languages. Add variables for node type from variable definition |
418 | 426 |
if ($form['#node_type']->type) { |
419 | 427 |
variable_type_include('node_type'); |
420 |
$form['i18n'] += node_variable_type_subform($form['#node_type']->type, array('i18n_node_options', 'i18n_node_extended')); |
|
428 |
$form['i18n'] += node_variable_type_subform($form['#node_type']->type, array('i18n_node_options', 'i18n_node_default_language_for', 'i18n_node_extended')); |
|
429 |
// Only show custom default language field if "current" is checked. |
|
430 |
$form['i18n']['i18n_node_default_language_for']['#states'] = array( |
|
431 |
'visible' => array( |
|
432 |
':input[name="i18n_node_options[current]"]' => array('checked' => TRUE), |
|
433 |
), |
|
434 |
'required' => array( |
|
435 |
':input[name="i18n_node_options[current]"]' => array('checked' => TRUE), |
|
436 |
), |
|
437 |
); |
|
421 | 438 |
} |
422 | 439 |
// Add disabled message |
423 | 440 |
if ($disabled) { |
drupal7/sites/all/modules/i18n/i18n_node/i18n_node.variable.inc | ||
---|---|---|
45 | 45 |
'repeat' => array( |
46 | 46 |
'type' => 'options', |
47 | 47 |
'options' => array( |
48 |
'current' => t('Set current language as default for new content.', array(), $options), |
|
48 |
// Note: this was previously used only to mark new, translatable nodes |
|
49 |
// with the current language of the user. Now, this setting is extended |
|
50 |
// to allow a specific language to be chosen (defaulting to the current |
|
51 |
// language). This was done for backwards compatibility reasons. |
|
52 |
'current' => t('Set custom language as default for new content.', array(), $options), |
|
49 | 53 |
'required' => t('Require language (Do not allow Language Neutral).', array(), $options), |
50 | 54 |
'lock' => t('Lock language (Cannot be changed).', array(), $options), |
51 | 55 |
), |
52 | 56 |
), |
53 | 57 |
'group' => 'i18n', |
54 | 58 |
); |
59 |
// This field will only be displayed if "current" is checked above. |
|
60 |
$variables['i18n_node_default_language_for_[node_type]'] = array( |
|
61 |
'type' => 'multiple', |
|
62 |
'title' => t('Custom default language', array(), $options), |
|
63 |
'repeat' => array( |
|
64 |
'type' => 'select', |
|
65 |
'options' => array_merge(array( |
|
66 |
'-- current --' => t('Current language') |
|
67 |
), locale_language_list('name')), |
|
68 |
'default' => '-- current --', |
|
69 |
), |
|
70 |
'group' => 'i18n', |
|
71 |
); |
|
55 | 72 |
$variables['i18n_node_extended_[node_type]'] = array( |
56 | 73 |
'type' => 'multiple', |
57 | 74 |
'title' => t('Extended language support'), |
drupal7/sites/all/modules/i18n/i18n_path/i18n_path.info | ||
---|---|---|
6 | 6 |
|
7 | 7 |
files[] = i18n_path.inc |
8 | 8 |
files[] = i18n_path.test |
9 |
; Information added by Drupal.org packaging script on 2017-01-31
|
|
10 |
version = "7.x-1.15"
|
|
9 |
; Information added by Drupal.org packaging script on 2017-04-18
|
|
10 |
version = "7.x-1.17"
|
|
11 | 11 |
core = "7.x" |
12 | 12 |
project = "i18n" |
13 |
datestamp = "1485834792"
|
|
13 |
datestamp = "1492537747"
|
|
14 | 14 |
|
drupal7/sites/all/modules/i18n/i18n_redirect/i18n_redirect.info | ||
---|---|---|
4 | 4 |
package = Multilingual - Internationalization |
5 | 5 |
core = 7.x |
6 | 6 |
|
7 |
; Information added by Drupal.org packaging script on 2017-01-31
|
|
8 |
version = "7.x-1.15"
|
|
7 |
; Information added by Drupal.org packaging script on 2017-04-18
|
|
8 |
version = "7.x-1.17"
|
|
9 | 9 |
core = "7.x" |
10 | 10 |
project = "i18n" |
11 |
datestamp = "1485834792"
|
|
11 |
datestamp = "1492537747"
|
|
12 | 12 |
|
drupal7/sites/all/modules/i18n/i18n_select/i18n_select.info | ||
---|---|---|
6 | 6 |
configure = admin/config/regional/i18n/select |
7 | 7 |
files[] = i18n_select.test |
8 | 8 |
|
9 |
; Information added by Drupal.org packaging script on 2017-01-31
|
|
10 |
version = "7.x-1.15"
|
|
9 |
; Information added by Drupal.org packaging script on 2017-04-18
|
|
10 |
version = "7.x-1.17"
|
|
11 | 11 |
core = "7.x" |
12 | 12 |
project = "i18n" |
13 |
datestamp = "1485834792"
|
|
13 |
datestamp = "1492537747"
|
|
14 | 14 |
|
drupal7/sites/all/modules/i18n/i18n_string/i18n_string.inc | ||
---|---|---|
1166 | 1166 |
$info = is_array($info) ? $info : array('title' => $info); |
1167 | 1167 |
$field_name = isset($info['field']) ? $info['field'] : $field; |
1168 | 1168 |
$value = $this->get_field($field_name); |
1169 |
if (is_array($value) && isset($value['value'])) { |
|
1170 |
$format = isset($value['format']) ? $value['format'] : NULL; |
|
1171 |
$value = $value['value']; |
|
1172 |
} |
|
1173 |
else { |
|
1174 |
$format = isset($info['format']) ? $this->get_field($info['format']) : NULL; |
|
1175 |
} |
|
1169 | 1176 |
$strings[$this->get_textgroup()][$string_type][$object_id][$field] = array( |
1170 | 1177 |
'string' => is_array($value) || isset($info['empty']) && $value === $info['empty'] ? NULL : $value, |
1171 | 1178 |
'title' => $info['title'], |
1172 |
'format' => isset($info['format']) ? $this->get_field($info['format']) : NULL,
|
|
1179 |
'format' => $format,
|
|
1173 | 1180 |
'name' => array_merge($object_keys, array($field)), |
1174 | 1181 |
); |
1175 | 1182 |
} |
drupal7/sites/all/modules/i18n/i18n_string/i18n_string.info | ||
---|---|---|
10 | 10 |
files[] = i18n_string.test |
11 | 11 |
configure = admin/config/regional/i18n/strings |
12 | 12 |
|
13 |
; Information added by Drupal.org packaging script on 2017-01-31
|
|
14 |
version = "7.x-1.15"
|
|
13 |
; Information added by Drupal.org packaging script on 2017-04-18
|
|
14 |
version = "7.x-1.17"
|
|
15 | 15 |
core = "7.x" |
16 | 16 |
project = "i18n" |
17 |
datestamp = "1485834792"
|
|
17 |
datestamp = "1492537747"
|
|
18 | 18 |
|
drupal7/sites/all/modules/i18n/i18n_string/i18n_string.module | ||
---|---|---|
258 | 258 |
} |
259 | 259 |
} |
260 | 260 |
|
261 |
/** |
|
262 |
* Implements hook_element_info_alter(). |
|
263 |
* |
|
264 |
* We need to do this on the element info level as wysiwyg also does so and form |
|
265 |
* API (incorrectly) does not merge in the defaults for values that are arrays. |
|
266 |
*/ |
|
267 |
function i18n_string_element_info_alter(&$types) { |
|
268 |
$types['text_format']['#pre_render'][] = 'i18n_string_pre_render_text_format'; |
|
269 |
} |
|
270 |
|
|
271 |
/** |
|
272 |
* The '#pre_render' function to alter the text format element in a translation. |
|
273 |
* The text format for a translation is taken form the original, so the text |
|
274 |
* format drop down should be disabled. |
|
275 |
* |
|
276 |
* @param array $element |
|
277 |
* The text_format element which will be rendered. |
|
278 |
* |
|
279 |
* @return array |
|
280 |
* The altered text_format element with a disabled "Text format" select. |
|
281 |
*/ |
|
282 |
function i18n_string_pre_render_text_format($element) { |
|
283 |
if (!empty($element['#i18n_string_is_translation'])) { |
|
284 |
$element['format']['format']['#attributes']['disabled'] = TRUE; |
|
285 |
} |
|
286 |
return $element; |
|
287 |
} |
|
288 |
|
|
261 | 289 |
/** |
262 | 290 |
* Check if translation is required for this language code. |
263 | 291 |
* |
... | ... | |
334 | 362 |
} |
335 | 363 |
|
336 | 364 |
/** |
337 |
* Get textgroup handler |
|
365 |
* Get textgroup handler. |
|
366 |
* |
|
367 |
* @return i18n_string_textgroup_default |
|
368 |
* |
|
338 | 369 |
*/ |
339 | 370 |
function i18n_string_textgroup($textgroup) { |
340 | 371 |
$groups = &drupal_static(__FUNCTION__); |
... | ... | |
519 | 550 |
* |
520 | 551 |
* This function is intended to return translations for plain strings that have NO text format |
521 | 552 |
* |
522 |
* @param $name
|
|
553 |
* @param array|string name
|
|
523 | 554 |
* Array or string concatenated with ':' that contains textgroup and string context |
524 |
* @param $string |
|
525 |
* String in default language or array of strings to be translated |
|
526 |
* @param $options |
|
555 |
* @param array|string $string |
|
556 |
* A string in the default language, a string wth format (array with keys |
|
557 |
* value and format),or an array of strings (without format) to be translated. |
|
558 |
* @param array $options |
|
527 | 559 |
* An associative array of additional options, with the following keys: |
528 | 560 |
* - 'langcode' (defaults to the current language) The language code to translate to a language other than what is used to display the page. |
529 | 561 |
* - 'filter' Filtering callback to apply to the translated string only |
... | ... | |
531 | 563 |
* - 'callback' Callback to apply to the result (both to translated or untranslated string |
532 | 564 |
* - 'sanitize' Whether to filter the translation applying the text format if any, default is TRUE |
533 | 565 |
* - 'sanitize default' Whether to filter the default value if no translation found, default is FALSE |
566 |
* |
|
567 |
* @return string |
|
534 | 568 |
*/ |
535 | 569 |
function i18n_string_translate($name, $string, $options = array()) { |
570 |
if (is_array($string) && isset($string['value'])) { |
|
571 |
$string = $string['value']; |
|
572 |
} |
|
536 | 573 |
if (is_array($string)) { |
537 | 574 |
return i18n_string_translate_list($name, $string, $options); |
538 | 575 |
} |
drupal7/sites/all/modules/i18n/i18n_string/i18n_string.pages.inc | ||
---|---|---|
170 | 170 |
|
171 | 171 |
/** |
172 | 172 |
* Create field elements for strings |
173 |
* |
|
174 |
* @param i18n_string_object[] $strings |
|
175 |
* @param string $langcode |
|
176 |
* |
|
177 |
* @return array |
|
173 | 178 |
*/ |
174 | 179 |
function i18n_string_translate_page_form_strings($strings, $langcode) { |
175 |
$formats = filter_formats(); |
|
180 |
global $user; |
|
181 |
$form = array(); |
|
176 | 182 |
foreach ($strings as $item) { |
177 |
// We may have a source or not. Load it, our string may get the format from it. |
|
178 |
$source = $item->get_source(); |
|
179 |
$format_id = $source ? $source->format : $item->format; |
|
180 |
$description = ''; |
|
181 | 183 |
// Check permissions to translate this string, depends on format, etc.. |
182 | 184 |
if ($message = $item->check_translate_access()) { |
183 | 185 |
// We'll display a disabled element with the reason it cannot be translated. |
... | ... | |
188 | 190 |
$disabled = FALSE; |
189 | 191 |
$description = ''; |
190 | 192 |
// If we don't have a source and it can be translated, we create it. |
191 |
if (!$source) {
|
|
193 |
if (!$item->get_source()) {
|
|
192 | 194 |
// Enable messages just as a reminder these strings are not being updated properly. |
193 | 195 |
$status = $item->update(array('messages' => TRUE)); |
194 | 196 |
if ($status === FALSE || $status === SAVED_DELETED) { |
195 | 197 |
// We don't have a source string so nothing to translate here |
196 | 198 |
$disabled = TRUE; |
197 | 199 |
} |
198 |
else { |
|
199 |
$source = $item->get_source(); |
|
200 |
} |
|
201 | 200 |
} |
202 | 201 |
} |
203 | 202 |
|
204 | 203 |
$default_value = $item->format_translation($langcode, array('langcode' => $langcode, 'sanitize' => FALSE, 'debug' => FALSE)); |
204 |
$available_formats = array_keys(filter_formats($user)); |
|
205 |
if (!in_array($item->format, $available_formats)) { |
|
206 |
$item->format = NULL; |
|
207 |
} |
|
205 | 208 |
$form[$item->get_name()] = array( |
206 | 209 |
'#title' => $item->get_title(), |
207 |
'#type' => 'textarea', |
|
210 |
'#type' => $item->format ? 'text_format' : 'textarea',
|
|
208 | 211 |
'#default_value' => $default_value, |
212 |
'#format' => $item->format, |
|
213 |
// This will trigger i18n_string_pre_render_text_format() to actually |
|
214 |
// alter the element. |
|
215 |
'#i18n_string_is_translation' => TRUE, |
|
209 | 216 |
'#disabled' => $disabled, |
210 |
'#description' => $description . _i18n_string_translate_format_help($format_id), |
|
211 |
//'#i18n_string_format' => $source ? $source->format : 0, |
|
217 |
'#description' => $description, |
|
212 | 218 |
// If disabled, provide smaller textarea (that can be expanded anyway). |
213 | 219 |
'#rows' => $disabled ? 1 : min(ceil(str_word_count($default_value) / 12), 10), |
214 | 220 |
// Change the parent for disabled strings so we don't get empty values later |
... | ... | |
226 | 232 |
foreach ($form_state['values']['strings'] as $name => $value) { |
227 | 233 |
$count++; |
228 | 234 |
list($textgroup, $context) = i18n_string_context(explode(':', $name)); |
235 |
if (is_array($value)) { |
|
236 |
if (isset($value['value'])) { |
|
237 |
$value = $value['value']; |
|
238 |
$form_state['values']['strings'][$name] = $value; |
|
239 |
} |
|
240 |
else { |
|
241 |
form_set_error("strings][$name", t('Unable to get the translated string value.')); |
|
242 |
watchdog('locale', 'Unable to get the translated string value, string array is: %string', array('%string' => var_dump($value)), WATCHDOG_WARNING); |
|
243 |
} |
|
244 |
} |
|
229 | 245 |
$result = i18n_string_textgroup($textgroup)->update_translation($context, $form_state['values']['langcode'], $value); |
230 | 246 |
$success += ($result ? 1 : 0); |
231 | 247 |
} |
drupal7/sites/all/modules/i18n/i18n_sync/README.txt | ||
---|---|---|
3 | 3 |
========== |
4 | 4 |
Drupal module: i18n_sync (Synchronization) |
5 | 5 |
|
6 |
This module will handle content synchronization accross translations.
|
|
6 |
This module will handle content synchronization across translations. |
|
7 | 7 |
|
8 | 8 |
The available list of fields to synchronize will include standard node fields and cck fields. |
9 | 9 |
To have aditional fields, add the list in a variable in the settings.php file, like this: |
drupal7/sites/all/modules/i18n/i18n_sync/i18n_sync.info | ||
---|---|---|
1 | 1 |
name = Synchronize translations |
2 |
description = Synchronizes taxonomy and fields accross translations of the same content.
|
|
2 |
description = Synchronizes taxonomy and fields across translations of the same content. |
|
3 | 3 |
dependencies[] = i18n |
4 | 4 |
dependencies[] = translation |
5 | 5 |
package = Multilingual - Internationalization |
... | ... | |
10 | 10 |
files[] = i18n_sync.module.inc |
11 | 11 |
files[] = i18n_sync.node.inc |
12 | 12 |
files[] = i18n_sync.test |
13 |
; Information added by Drupal.org packaging script on 2017-01-31
|
|
14 |
version = "7.x-1.15"
|
|
13 |
; Information added by Drupal.org packaging script on 2017-04-18
|
|
14 |
version = "7.x-1.17"
|
|
15 | 15 |
core = "7.x" |
16 | 16 |
project = "i18n" |
17 |
datestamp = "1485834792"
|
|
17 |
datestamp = "1492537747"
|
|
18 | 18 |
|
drupal7/sites/all/modules/i18n/i18n_sync/i18n_sync.module | ||
---|---|---|
33 | 33 |
function i18n_sync_help($path, $arg) { |
34 | 34 |
switch ($path) { |
35 | 35 |
case 'admin/help#i18n_sync' : |
36 |
$output = '<p>' . t('This module synchronizes content taxonomy and fields accross translations:') . '</p>';
|
|
36 |
$output = '<p>' . t('This module synchronizes content taxonomy and fields across translations:') . '</p>'; |
|
37 | 37 |
$output .= '<p>' . t('First you need to select which fields should be synchronized. Then, after a node has been updated, all enabled vocabularies and fields will be synchronized as follows:') . '</p>'; |
38 | 38 |
$output .= '<ul>'; |
39 | 39 |
$output .= '<li>' . t('All the node fields selected for synchronization will be set to the same value for all translations.') . '</li>'; |
drupal7/sites/all/modules/i18n/i18n_sync/i18n_sync.node.inc | ||
---|---|---|
98 | 98 |
* Example: |
99 | 99 |
* English A references English B and English C. |
100 | 100 |
* English A and B are translated to German A and B, but English C is not. |
101 |
* The syncronization from English A to German A would it German B and English C. |
|
101 |
* The synchronization from English A to German A would it German B and English C.
|
|
102 | 102 |
*/ |
103 | 103 |
function i18n_sync_node_translation_reference_field(&$reference_node, $default_value, $langcode) { |
104 | 104 |
if (isset($reference_node->tnid) && translation_supported_type($reference_node->type)) { |
drupal7/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.info | ||
---|---|---|
11 | 11 |
files[] = i18n_taxonomy.admin.inc |
12 | 12 |
files[] = i18n_taxonomy.test |
13 | 13 |
|
14 |
; Information added by Drupal.org packaging script on 2017-01-31
|
|
15 |
version = "7.x-1.15"
|
|
14 |
; Information added by Drupal.org packaging script on 2017-04-18
|
|
15 |
version = "7.x-1.17"
|
|
16 | 16 |
core = "7.x" |
17 | 17 |
project = "i18n" |
18 |
datestamp = "1485834792"
|
|
18 |
datestamp = "1492537747"
|
|
19 | 19 |
|
drupal7/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module | ||
---|---|---|
377 | 377 |
* The array of valid terms for this field, keyed by term id. |
378 | 378 |
*/ |
379 | 379 |
function i18n_taxonomy_allowed_values($field) { |
380 |
global $language; |
|
380 | 381 |
$options = array(); |
381 | 382 |
foreach ($field['settings']['allowed_values'] as $tree) { |
382 | 383 |
if ($vocabulary = taxonomy_vocabulary_machine_name_load($tree['vocabulary'])) { |
383 |
if ($terms = taxonomy_get_tree($vocabulary->vid, $tree['parent'])) { |
|
384 |
if (i18n_taxonomy_vocabulary_mode($vocabulary->vid) == I18N_MODE_TRANSLATE) { |
|
385 |
$parent = i18n_taxonomy_translation_term_tid($tree['parent'], NULL, $tree['parent']); |
|
386 |
$language = i18n_language_context(); |
|
387 |
$terms = i18n_taxonomy_get_tree($vocabulary->vid, $language->language, $parent); |
|
388 |
} |
|
389 |
else { |
|
390 |
$terms = taxonomy_get_tree($vocabulary->vid, $tree['parent']); |
|
391 |
} |
|
392 |
if ($terms) { |
|
384 | 393 |
foreach ($terms as $term) { |
385 | 394 |
$options[$term->tid] = str_repeat('-', $term->depth) . i18n_taxonomy_term_name($term); |
386 | 395 |
} |
drupal7/sites/all/modules/i18n/i18n_translation/i18n_translation.info | ||
---|---|---|
6 | 6 |
|
7 | 7 |
files[] = i18n_translation.inc |
8 | 8 |
|
9 |
; Information added by Drupal.org packaging script on 2017-01-31
|
|
10 |
version = "7.x-1.15"
|
|
9 |
; Information added by Drupal.org packaging script on 2017-04-18
|
|
10 |
version = "7.x-1.17"
|
|
11 | 11 |
core = "7.x" |
12 | 12 |
project = "i18n" |
13 |
datestamp = "1485834792"
|
|
13 |
datestamp = "1492537747"
|
|
14 | 14 |
|
drupal7/sites/all/modules/i18n/i18n_translation/i18n_translation.module | ||
---|---|---|
20 | 20 |
* @param $queried_entities |
21 | 21 |
* Associative array of query results, keyed on the entity ID. |
22 | 22 |
* @param $revision_id |
23 |
* ID of the revision that was loaded, or FALSE if teh most current revision
|
|
23 |
* ID of the revision that was loaded, or FALSE if the most current revision
|
|
24 | 24 |
* was loaded. |
25 | 25 |
*/ |
26 | 26 |
protected function attachLoad(&$queried_entities, $revision_id = FALSE) { |
drupal7/sites/all/modules/i18n/i18n_user/i18n_user.info | ||
---|---|---|
4 | 4 |
package = Multilingual - Internationalization |
5 | 5 |
dependencies[] = i18n_variable |
6 | 6 |
|
7 |
; Information added by Drupal.org packaging script on 2017-01-31
|
|
8 |
version = "7.x-1.15"
|
|
7 |
; Information added by Drupal.org packaging script on 2017-04-18
|
|
8 |
version = "7.x-1.17"
|
|
9 | 9 |
core = "7.x" |
10 | 10 |
project = "i18n" |
11 |
datestamp = "1485834792"
|
|
11 |
datestamp = "1492537747"
|
|
12 | 12 |
|
drupal7/sites/all/modules/i18n/i18n_variable/i18n_variable.info | ||
---|---|---|
10 | 10 |
files[] = i18n_variable.class.inc |
11 | 11 |
files[] = i18n_variable.test |
12 | 12 |
|
13 |
; Information added by Drupal.org packaging script on 2017-01-31
|
|
14 |
version = "7.x-1.15"
|
|
13 |
; Information added by Drupal.org packaging script on 2017-04-18
|
|
14 |
version = "7.x-1.17"
|
|
15 | 15 |
core = "7.x" |
16 | 16 |
project = "i18n" |
17 |
datestamp = "1485834792"
|
|
17 |
datestamp = "1492537747"
|
|
18 | 18 |
|
drupal7/sites/all/modules/i18n/tests/i18n_test.info | ||
---|---|---|
7 | 7 |
core = 6.x |
8 | 8 |
hidden = TRUE |
9 | 9 |
|
10 |
; Information added by Drupal.org packaging script on 2017-01-31
|
|
11 |
version = "7.x-1.15"
|
|
10 |
; Information added by Drupal.org packaging script on 2017-04-18
|
|
11 |
version = "7.x-1.17"
|
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "i18n" |
14 |
datestamp = "1485834792"
|
|
14 |
datestamp = "1492537747"
|
|
15 | 15 |
|
drupal7/sites/all/modules/webform/components/date.inc | ||
---|---|---|
70 | 70 |
'#type' => 'radios', |
71 | 71 |
'#title' => t('Default value timezone'), |
72 | 72 |
'#default_value' => empty($component['extra']['timezone']) ? 'user' : $component['extra']['timezone'], |
73 |
'#description' => t('If using relative dates for a default value (e.g. "today") base the current day on this timezone.'),
|
|
73 |
'#description' => t('If using relative dates for a default value (for example, "today") base the current day on this timezone.'),
|
|
74 | 74 |
'#options' => array('user' => t('User timezone'), 'site' => t('Website timezone')), |
75 | 75 |
'#weight' => 2, |
76 | 76 |
'#access' => variable_get('configurable_timezones', 1), |
... | ... | |
131 | 131 |
} |
132 | 132 |
|
133 | 133 |
/** |
134 |
* Implements hook_form_id_validate. |
|
134 |
* Implements hook_form_id_validate().
|
|
135 | 135 |
* |
136 | 136 |
* Warns user about hiding all the date fields and not using the date picker. |
137 | 137 |
*/ |
... | ... | |
140 | 140 |
form_set_value($form['extra']['exclude'], array_filter(array_values($form_state['values']['extra']['exclude'])), $form_state); |
141 | 141 |
|
142 | 142 |
// Note that Drupal 7 doesn't support setting errors no checkboxes due to |
143 |
// browser issues. @see https://www.drupal.org/node/222380
|
|
143 |
// browser issues. See: https://www.drupal.org/node/222380
|
|
144 | 144 |
if (count($form_state['values']['extra']['exclude']) == 3) { |
145 | 145 |
form_set_error('extra][exclude', 'The day, month and year can\'t all be hidden.'); |
146 | 146 |
} |
... | ... | |
155 | 155 |
foreach (array('start_date', 'end_date') as $field) { |
156 | 156 |
if (trim($form_state['values']['extra'][$field]) && !($date[$field] = webform_strtodate('c', $form_state['values']['extra'][$field]))) { |
157 | 157 |
form_set_error("extra][$field", t('The @field could not be interpreted in <a href="http://www.gnu.org/software/tar/manual/html_chapter/Date-input-formats.html">GNU Date Input Format</a>.', |
158 |
array('@field' => $form['validation'][$field]['#title'])));
|
|
158 |
array('@field' => $form['validation'][$field]['#title']))); |
|
159 | 159 |
} |
160 | 160 |
} |
161 | 161 |
if (!empty($date['start_date']) && !empty($date['end_date']) && $date['end_date'] < $date['start_date']) { |
... | ... | |
213 | 213 |
*/ |
214 | 214 |
function webform_expand_date($element) { |
215 | 215 |
$timezone = $element['#timezone'] != 'user' ? NULL : 'user'; |
216 |
|
|
216 |
|
|
217 | 217 |
// Accept a string or array value for #default_value. |
218 | 218 |
if (!empty($element['#default_value']) && is_string($element['#default_value'])) { |
219 | 219 |
$timestring = webform_strtodate('c', $element['#default_value'], $timezone); |
... | ... | |
281 | 281 |
} |
282 | 282 |
else { |
283 | 283 |
$month_options = array_intersect_key($month_options, array_flip(range($range['start']['month'], 12))) + |
284 |
array_intersect_key($month_options, array_flip(range(1, $range['end']['month'])));
|
|
284 |
array_intersect_key($month_options, array_flip(range(1, $range['end']['month']))); |
|
285 | 285 |
} |
286 | 286 |
unset($month_options); // Drop PHP reference. |
287 | 287 |
if ($delta_months <= 1) { |
... | ... | |
297 | 297 |
// Range spans two months and at least one day would be omitted. |
298 | 298 |
$days_in_month = date('t', mktime(0, 0, 0, $range['start']['month'], 1, $range['start']['year'])); |
299 | 299 |
$day_options = array_intersect_key($day_options, array_flip(range($range['start']['day'], $days_in_month))) + |
300 |
array_intersect_key($day_options, array_flip(range(1, $range['end']['day'])));
|
|
300 |
array_intersect_key($day_options, array_flip(range(1, $range['end']['day']))); |
|
301 | 301 |
} |
302 | 302 |
unset($day_options); // Drop PHP reference. |
303 | 303 |
} |
... | ... | |
423 | 423 |
return; |
424 | 424 |
} |
425 | 425 |
|
426 |
// Ensure date is made up of integers. |
|
427 |
foreach (array('year', 'month', 'day') as $date_part) { |
|
428 |
$element[$date_part]['#value'] = (int) $element[$date_part]['#value']; |
|
429 |
} |
|
430 |
|
|
426 | 431 |
// Check for a valid date. |
427 | 432 |
if (!checkdate($element['month']['#value'], $element['day']['#value'], $element['year']['#value'])) { |
428 | 433 |
form_error($element, t('Entered !name is not a valid date.', array('!name' => $element['#title']))); |
drupal7/sites/all/modules/webform/components/email.inc | ||
---|---|---|
176 | 176 |
// pattern validation. This means that long format email addresses must be |
177 | 177 |
// rendered as text. |
178 | 178 |
$element['#attributes']['type'] = 'text'; |
179 |
|
|
179 |
|
|
180 | 180 |
// html5 patterns have implied delimters and start and end patterns. |
181 | 181 |
// The are also case sensitive, not global, and not multi-line. |
182 | 182 |
// See https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation |
... | ... | |
255 | 255 |
$component = $form_element['#webform_component']; |
256 | 256 |
$format = webform_variable_get('webform_email_address_format') == 'long' ? $component['extra']['format'] : 'short'; |
257 | 257 |
webform_email_validate($form_element['#value'], |
258 |
implode('][', $form_element ['#parents']),
|
|
259 |
TRUE, // Required validation is done elsewhere.
|
|
260 |
$component['extra']['multiple'],
|
|
261 |
FALSE, // No tokens are allowed in user input.
|
|
262 |
$format);
|
|
258 |
implode('][', $form_element ['#parents']), |
|
259 |
TRUE, // Required validation is done elsewhere. |
|
260 |
$component['extra']['multiple'], |
|
261 |
FALSE, // No tokens are allowed in user input. |
|
262 |
$format); |
|
263 | 263 |
} |
264 | 264 |
|
265 | 265 |
/** |
drupal7/sites/all/modules/webform/components/file.inc | ||
---|---|---|
222 | 222 |
if (!empty($element['#value'])) { |
223 | 223 |
$set_filesize = parse_size($element['#value']); |
224 | 224 |
if ($set_filesize == FALSE) { |
225 |
form_error($element, t('File size @value is not a valid filesize. Use a value such as 2 MB or 800 KB.', array('@value' => $element['#value']))); |
|
225 |
form_error($element, t('File size @value is not a valid file size. Use a value such as 2 MB or 800 KB.', array('@value' => $element['#value'])));
|
|
226 | 226 |
} |
227 | 227 |
else { |
228 | 228 |
$max_filesize = parse_size(file_upload_max_size()); |
229 | 229 |
if ($max_filesize < $set_filesize) { |
230 |
form_error($element, t('An upload size of @value is too large, you are allow to upload files @max or less.', array('@value' => $element['#value'], '@max' => format_size($max_filesize))));
|
|
230 |
form_error($element, t('An upload size of @value is too large. You are allowed to upload files that are @max or less.', array('@value' => $element['#value'], '@max' => format_size($max_filesize))));
|
|
231 | 231 |
} |
232 | 232 |
} |
233 | 233 |
} |
... | ... | |
389 | 389 |
* An associative array containing: |
390 | 390 |
* - element: A render element representing the file. |
391 | 391 |
* |
392 |
* @return string |
|
392 | 393 |
*/ |
393 | 394 |
function theme_webform_managed_file($variables) { |
394 | 395 |
$element = $variables['element']; |
drupal7/sites/all/modules/webform/components/grid.inc | ||
---|---|---|
366 | 366 |
* An array of options to be used for this row. |
367 | 367 |
* @return array |
368 | 368 |
* The $row_options with any missing options replaced with empty values. |
369 |
**/
|
|
369 |
*/ |
|
370 | 370 |
function webform_grid_remove_options($header, $row_options) { |
371 | 371 |
foreach ($header as $key => $value) { |
372 | 372 |
if (!isset($row_options[$key])) { |
... | ... | |
498 | 498 |
$value = drupal_render($element[$question_key]); |
499 | 499 |
} |
500 | 500 |
$items[] = ' - ' . _webform_grid_question_header($question_element['#title']) . ': ' . $value; |
501 |
} |
|
501 |
}
|
|
502 | 502 |
$output = implode("\n", $items); |
503 | 503 |
} |
504 | 504 |
|
... | ... | |
646 | 646 |
// Grids may contain nested multiple value select components. |
647 | 647 |
// Create a flat array of values. |
648 | 648 |
$values = array(); |
649 |
array_walk_recursive($element['#value'], function($a) use (&$values) { $values[] = $a; }); |
|
649 |
$element['#value'] = (array) $element['#value']; |
|
650 |
array_walk_recursive($element['#value'], function ($a) use (&$values) { $values[] = $a; }); |
|
650 | 651 |
|
651 | 652 |
$nr_unique = count(array_unique($values)); |
652 | 653 |
$nr_values = count($values); |
... | ... | |
795 | 796 |
foreach ($element['#parents'] as $key) { |
796 | 797 |
$values = isset($values[$key]) ? $values[$key] : $values; |
797 | 798 |
} |
798 |
$nr_values = array_reduce($values, function($count, $item) { return $count + (int)!is_null($item); }, 0); |
|
799 |
if (count($element['#grid_questions']) != $nr_values) { |
|
800 |
form_error($element, t('!name field is required.', array('!name' => $element['#title']))); |
|
799 |
// Remove any values that aren't grid question (i.e. nested components) |
|
800 |
$grid_questions = $element['#grid_questions']; |
|
801 |
$values = array_intersect_key($values, $grid_questions); |
|
802 |
// Remove any unanswered grid questions. |
|
803 |
$answers = array_filter($values, function($item) { return !is_null($item); }); |
|
804 |
// Give required errors for any questions that aren't answered. |
|
805 |
foreach (array_diff_key($grid_questions, $answers) as $question_key => $question) { |
|
806 |
form_error($element[$question_key], t('!question field within !name is required.', array('!question' => $question, '!name' => $element['#title']))); |
|
801 | 807 |
} |
802 | 808 |
} |
803 | 809 |
} |
drupal7/sites/all/modules/webform/components/number.inc | ||
---|---|---|
171 | 171 |
'#type' => 'checkbox', |
172 | 172 |
'#title' => t('Integer'), |
173 | 173 |
'#return_value' => 1, |
174 |
'#description' => t('Permit only integer values as input. e.g. 12.34 would be invalid.'),
|
|
174 |
'#description' => t('Permit only integer values as input. For example, 12.34 would be invalid.'),
|
|
175 | 175 |
'#weight' => 1.5, |
176 | 176 |
'#default_value' => $component['extra']['integer'], |
177 | 177 |
'#parents' => array('extra', 'integer'), |
... | ... | |
180 | 180 |
'#type' => 'textfield', |
181 | 181 |
'#title' => t('Minimum'), |
182 | 182 |
'#default_value' => $component['extra']['min'], |
183 |
'#description' => t('Minimum numeric value. e.g. 0 would ensure positive numbers.'),
|
|
183 |
'#description' => t('Minimum numeric value. For example, 0 would ensure positive numbers.'),
|
|
184 | 184 |
'#size' => 5, |
185 | 185 |
'#maxlength' => 10, |
186 | 186 |
'#weight' => 2.1, |
... | ... | |
202 | 202 |
'#type' => 'textfield', |
203 | 203 |
'#title' => t('Step'), |
204 | 204 |
'#default_value' => $component['extra']['step'], |
205 |
'#description' => t('Limit options to a specific increment. e.g. a step of "5" would allow values 5, 10, 15, etc.'),
|
|
205 |
'#description' => t('Limit options to a specific increment. For example, a step of "5" would allow values 5, 10, 15, etc.'),
|
|
206 | 206 |
'#size' => 5, |
207 | 207 |
'#maxlength' => 10, |
208 | 208 |
'#weight' => 3, |
... | ... | |
527 | 527 |
$limit[$key] = _webform_number_format($component, $value); |
528 | 528 |
} |
529 | 529 |
|
530 |
// Column headings (override potential theme uppercase, e.g. Seven in D7).
|
|
530 |
// Column headings (override potential theme uppercase, for example, Seven in D7).
|
|
531 | 531 |
$header = array( |
532 | 532 |
t('Normal Distribution'), |
533 | 533 |
array('data' => '-4' . $sigma, 'style' => 'text-transform: lowercase;'), |
... | ... | |
602 | 602 |
* The form element. May either be a select or a webform_number element. |
603 | 603 |
* @param $form_state |
604 | 604 |
* The full form state for the webform. |
605 |
* @return |
|
606 |
* None. Calls a form_set_error if the number is not valid. |
|
607 | 605 |
*/ |
608 | 606 |
function _webform_validate_number($element, &$form_state) { |
609 | 607 |
// Trim spaces for basic cleanup. |
... | ... | |
869 | 867 |
* The string value to be standardized into a numeric string. |
870 | 868 |
* @param $point |
871 | 869 |
* The point separator between the whole number and the decimals. |
870 |
* |
|
871 |
* @return mixed|string |
|
872 | 872 |
*/ |
873 | 873 |
function webform_number_standardize($value, $point) { |
874 | 874 |
// For simplicity, strip everything that's not the decimal point. |
drupal7/sites/all/modules/webform/components/select.inc | ||
---|---|---|
395 | 395 |
$option_value = reset($value); |
396 | 396 |
$element['#default_value'] = $option_value === '' ? NULL : $option_value; |
397 | 397 |
} |
398 |
|
|
398 |
|
|
399 | 399 |
if ($component['extra']['other_option'] && module_exists('select_or_other')) { |
400 | 400 |
// Set display as a select_or_other element: |
401 | 401 |
$element['#type'] = 'select_or_other'; |
... | ... | |
762 | 762 |
// Set the value as an array for multiple select or single value otherwise. |
763 | 763 |
if ($element['#type'] == 'checkboxes') { |
764 | 764 |
$checkbox_values = $element['#options']; |
765 |
array_walk($checkbox_values, function(&$value, $key) use($value) { |
|
766 |
$value = (int)(strval($key) === $value); |
|
765 |
array_walk($checkbox_values, function(&$option_value, $key) use($value) {
|
|
766 |
$option_value = (int)(strval($key) === $value);
|
|
767 | 767 |
}); |
768 | 768 |
} |
769 | 769 |
else { |
... | ... | |
1023 | 1023 |
$group = NULL; |
1024 | 1024 |
foreach ($rows as $option) { |
1025 | 1025 |
$option = trim($option); |
1026 |
/**
|
|
1026 |
/* |
|
1027 | 1027 |
* If the Key of the option is within < >, treat as an optgroup |
1028 | 1028 |
* |
1029 | 1029 |
* <Group 1> |
drupal7/sites/all/modules/webform/components/textfield.inc | ||
---|---|---|
19 | 19 |
'extra' => array( |
20 | 20 |
'width' => '', |
21 | 21 |
'maxlength' => '', |
22 |
'minlength' => '', |
|
22 | 23 |
'field_prefix' => '', |
23 | 24 |
'field_suffix' => '', |
24 | 25 |
'disabled' => 0, |
... | ... | |
126 | 127 |
'#weight' => 2, |
127 | 128 |
'#parents' => array('extra', 'maxlength'), |
128 | 129 |
); |
130 |
$form['validation']['minlength'] = array( |
|
131 |
'#type' => 'textfield', |
|
132 |
'#title' => t('Minlength'), |
|
133 |
'#default_value' => $component['extra']['minlength'], |
|
134 |
'#description' => t('Minimum length of the textfield value. The component may still be empty unless it is set as Required.'), |
|
135 |
'#size' => 5, |
|
136 |
'#maxlength' => 10, |
|
137 |
'#weight' => 3, |
|
138 |
'#parents' => array('extra', 'minlength'), |
|
139 |
); |
|
129 | 140 |
return $form; |
130 | 141 |
} |
131 | 142 |
|
... | ... | |
179 | 190 |
if ($component['extra']['maxlength'] > 0) { |
180 | 191 |
$element['#maxlength'] = $component['extra']['maxlength']; |
181 | 192 |
} |
193 |
if ($component['extra']['minlength'] > 0) { |
|
194 |
$element['#minlength'] = $component['extra']['minlength']; |
|
195 |
} |
|
182 | 196 |
|
183 | 197 |
if (isset($value[0])) { |
184 | 198 |
$element['#default_value'] = $value[0]; |
drupal7/sites/all/modules/webform/components/time.inc | ||
---|---|---|
86 | 86 |
'#type' => 'radios', |
87 | 87 |
'#title' => t('Default value timezone'), |
88 | 88 |
'#default_value' => $component['extra']['timezone'], |
89 |
'#description' => t('If using relative dates for a default value (e.g. "now") base the current time on this timezone.'),
|
|
89 |
'#description' => t('If using relative dates for a default value (for example, "now") base the current time on this timezone.'),
|
|
90 | 90 |
'#options' => array('user' => t('User timezone'), 'site' => t('Website timezone')), |
91 | 91 |
'#weight' => 2, |
92 | 92 |
'#access' => variable_get('configurable_timezones', 1), |
... | ... | |
118 | 118 |
} |
119 | 119 |
|
120 | 120 |
/** |
121 |
* Implements hook_form_id_validate. |
|
121 |
* Implements hook_form_id_validate().
|
|
122 | 122 |
* |
123 | 123 |
* Validate start and end times. |
124 | 124 |
*/ |
... | ... | |
214 | 214 |
} |
215 | 215 |
else { |
216 | 216 |
$hours = array_intersect_key($hours, array_flip(range($start_hour, 23))) + |
217 |
array_intersect_key($hours, array_flip(range(0, $end_hour)));
|
|
217 |
array_intersect_key($hours, array_flip(range(0, $end_hour))); |
|
218 | 218 |
} |
219 | 219 |
} |
220 | 220 |
|
... | ... | |
325 | 325 |
|
326 | 326 |
// Enforce the start and end times, if any. |
327 | 327 |
$timestamp = strtotime($element['hour']['#value'] . ':' . $element['minute']['#value'] . ' ' . |
328 |
(isset($element['ampm']) ? $element['ampm']['#value'] : ''));
|
|
328 |
(isset($element['ampm']) ? $element['ampm']['#value'] : '')); |
|
329 | 329 |
$start_time = strtotime($element['#start_time']); |
330 | 330 |
$end_time = strtotime($element['#end_time']); |
331 | 331 |
$subs = array( |
drupal7/sites/all/modules/webform/css/webform-admin.css | ||
---|---|---|
104 | 104 |
font-weight: bold; |
105 | 105 |
} |
106 | 106 |
|
107 |
/* Special theming for the options element widget (if installed) */ |
|
108 |
.webform-options-element thead { |
|
109 |
display: none; |
|
110 |
} |
|
111 |
.webform-options-element fieldset { |
|
112 |
border: none; |
|
113 |
background: none; |
|
114 |
margin: 0; |
|
115 |
padding: 0; |
|
116 |
} |
|
117 |
.webform-options-element fieldset legend { |
|
118 |
display: none; |
|
119 |
} |
|
120 |
|
|
121 | 107 |
/* Checkboxes for allowed file extensions */ |
122 | 108 |
table.webform-file-extensions td { |
123 | 109 |
vertical-align: top; |
drupal7/sites/all/modules/webform/includes/exporters/webform_exporter.inc | ||
---|---|---|
4 | 4 |
* @file |
5 | 5 |
* Base class defining the common methods available to exporters. |
6 | 6 |
*/ |
7 |
|
|
8 | 7 |
class webform_exporter { |
9 | 8 |
public $options = array(); |
10 | 9 |
public $export_wordrap; |
... | ... | |
40 | 39 |
*/ |
41 | 40 |
function wrappable($row, $column, $value) { |
42 | 41 |
return strpos($value, "\n") !== FALSE || |
43 |
$this->export_wordwrap && ($row > 2 || $column > 0 || $this->options['header_keys'] < 0);
|
|
42 |
$this->export_wordwrap && ($row > 2 || $column > 0 || $this->options['header_keys'] < 0); |
|
44 | 43 |
} |
45 | 44 |
|
46 | 45 |
/** |
... | ... | |
60 | 59 |
* Provide headers to the page when an export file is being downloaded. |
61 | 60 |
* |
62 | 61 |
* @param $filename |
63 |
* The name of the file being downloaded. e.g. export.xls.
|
|
62 |
* The name of the file being downloaded, for example, export.xls.
|
|
64 | 63 |
*/ |
65 | 64 |
function set_headers($filename) { |
66 | 65 |
drupal_add_http_header('Content-Type', 'application/force-download'); |
drupal7/sites/all/modules/webform/includes/exporters/webform_exporter_delimited.inc | ||
---|---|---|
4 | 4 |
* @file |
5 | 5 |
* Webform exporter for creating CSV/TSV delimited files. |
6 | 6 |
*/ |
7 |
|
|
8 | 7 |
class webform_exporter_delimited extends webform_exporter { |
9 | 8 |
public $line_ending; |
10 | 9 |
public $delimiter; |
drupal7/sites/all/modules/webform/includes/webform.components.inc | ||
---|---|---|
245 | 245 |
$row_data = array( |
246 | 246 |
array('data' => $indents . filter_xss($component['name']), 'class' => array('webform-component-name')), |
247 | 247 |
array('data' => check_plain($form_key), 'class' => array('webform-component-formkey')) + |
248 |
($component['form_key'] == $form_key ? array() : array('title' => $component['form_key'])),
|
|
248 |
((string) $component['form_key'] === (string) $form_key ? array() : array('title' => $component['form_key'])),
|
|
249 | 249 |
array('data' => $form['add']['type']['#options'][$component['type']], 'class' => array('webform-component-type')), |
250 | 250 |
array('data' => ($value == '') ? '-' : check_plain($value), 'class' => array('webform-component-value')) + |
251 | 251 |
($component['value'] == $value ? array() : array('title' => $component['value'])), |
... | ... | |
302 | 302 |
$parents = array(); |
303 | 303 |
if (isset($form_state['values']['components'])) { |
304 | 304 |
foreach ($form_state['values']['components'] as $cid => $component) { |
305 |
$form_key = $form['#node']->webform['components'][$cid]['form_key']; |
|
306 |
if (isset($parents[$component['pid']]) && ($existing = array_search($form_key, $parents[$component['pid']])) && $existing !== FALSE) { |
|
305 |
$form_key = (string) $form['#node']->webform['components'][$cid]['form_key'];
|
|
306 |
if (isset($parents[$component['pid']]) && ($existing = array_search($form_key, $parents[$component['pid']], TRUE)) && $existing !== FALSE) {
|
|
307 | 307 |
if (!isset($duplicates[$form_key])) { |
308 | 308 |
$duplicates[$form_key] = array($existing); |
309 | 309 |
} |
... | ... | |
721 | 721 |
if (webform_component_feature($component_type, 'group')) { |
722 | 722 |
$question = t('Delete the %name fieldset?', array('%name' => $node->webform['components'][$cid]['name'])); |
723 | 723 |
$description = t('This will immediately delete the %name @type component and all nested components within %name from the %webform webform. This cannot be undone.', |
724 |
array('%name' => $node->webform['components'][$cid]['name'],
|
|
725 |
'@type' => webform_component_property($component_type, 'label'),
|
|
726 |
'%webform' => $node->title));
|
|
724 |
array('%name' => $node->webform['components'][$cid]['name'], |
|
725 |
'@type' => webform_component_property($component_type, 'label'), |
|
726 |
'%webform' => $node->title)); |
|
727 | 727 |
} |
728 | 728 |
else { |
729 | 729 |
$question = t('Delete the %name component?', array('%name' => $node->webform['components'][$cid]['name'])); |
... | ... | |
764 | 764 |
* |
765 | 765 |
* @param $component |
766 | 766 |
* A full component containing fields from the component form. |
767 |
* |
|
768 |
* @return false|int |
|
769 |
* On success return identifier for the components within node. |
|
770 |
* FALSE on failure |
|
767 | 771 |
*/ |
768 | 772 |
function webform_component_insert(&$component) { |
769 | 773 |
// Allow modules to modify the component before saving. |
... | ... | |
946 | 950 |
* The node object containing the current webform. |
947 | 951 |
* @param $component |
948 | 952 |
* A full component containing fields from the component form. |
953 |
* |
|
954 |
* @return false|int |
|
955 |
* On success return identifier for the components within node. |
|
956 |
* FALSE on failure |
|
949 | 957 |
*/ |
950 | 958 |
function webform_component_clone(&$node, &$component) { |
951 | 959 |
$original_cid = $component['cid']; |
... | ... | |
1019 | 1027 |
* email, required, conditional) on which this list of components will be |
1020 | 1028 |
* restricted. |
1021 | 1029 |
* @param $prefix_group |
1022 |
* TRUE to indent with a hyphen, or 'path" to Prepend enclosing group (e.g.
|
|
1030 |
* TRUE to indent with a hyphen, or 'path" to Prepend enclosing group (for example,
|
|
1023 | 1031 |
* fieldset) name(s) |
1024 | 1032 |
* @param $pagebreak_groups |
1025 | 1033 |
* Determine if pagebreaks should be converted to option groups in the |
1026 | 1034 |
* returned list of options. |
1035 |
* |
|
1036 |
* @return array |
|
1027 | 1037 |
*/ |
1028 | 1038 |
function webform_component_list($node, $component_filter = NULL, $prepend_group = TRUE, $pagebreak_groups = FALSE) { |
1029 | 1039 |
$options = array(); |
... | ... | |
1034 | 1044 |
$feature = is_string($component_filter) ? $component_filter : NULL; |
1035 | 1045 |
|
1036 | 1046 |
foreach ($components as $cid => $component) { |
1037 |
// If this component is a group (e.g. fieldset), then remember its name, including any parents.
|
|
1047 |
// If this component is a group (for example, fieldset), then remember its name, including any parents.
|
|
1038 | 1048 |
if ($prepend_group && webform_component_feature($component['type'], 'group')) { |
1039 | 1049 |
$parent_names[$cid] = ($component['pid'] ? $parent_names[$component['pid']] : '') . |
1040 | 1050 |
($prepend_group === 'path' ? $component['name'] . ': ' : '-'); |
... | ... | |
1043 | 1053 |
// If this component is a pagebreak, then generate an option group, ensuring a unique name. |
1044 | 1054 |
if ($pagebreak_groups && $component['type'] == 'pagebreak') { |
1045 | 1055 |
$page_name = $component['name']; |
1056 |
|
|
1057 |
// When a $page_name consists only of digits, append a space to ensure it |
|
1058 |
// is never the same as a $cid. |
|
1059 |
if ((string) $page_name === (string) (int) $page_name) { |
|
1060 |
$page_name .= ' '; |
|
1061 |
} |
|
1062 |
|
|
1046 | 1063 |
$copy = 1; |
1047 | 1064 |
while (in_array($page_name, $page_names)) { |
1048 | 1065 |
$page_name = $component['name'] . '_' . ++$copy; |
... | ... | |
1144 | 1161 |
} |
1145 | 1162 |
|
1146 | 1163 |
/** |
1147 |
* Find a components parents within a node. |
|
1164 |
* Find a component's parents within a node. |
|
1165 |
* |
|
1166 |
* @param object $node |
|
1167 |
* The webform node. |
|
1168 |
* @param array $component |
|
1169 |
* The component to start with. |
|
1170 |
* @param string|true $what_to_return |
|
1171 |
* If TRUE, return complete component arrays. Otherwise, return the property |
|
1172 |
* of each component named in this parametre. |
|
1173 |
* |
|
1174 |
* @return array |
|
1175 |
* An array with a value for each parent and for the start component, in order |
|
1176 |
* ending with start component. What the value is is controlled by |
|
1177 |
* $what_to_return. |
|
1148 | 1178 |
*/ |
1149 |
function webform_component_parent_keys($node, $component) {
|
|
1150 |
$parents = array($component['form_key']);
|
|
1179 |
function webform_component_parent_keys($node, array $component, $what_to_return = 'form_key') {
|
|
1180 |
$parents = array(($what_to_return === TRUE) ? $component : $component[$what_to_return]);
|
|
1151 | 1181 |
$pid = $component['pid']; |
1152 | 1182 |
while ($pid) { |
1153 |
$parents[] = $node->webform['components'][$pid]['form_key'];
|
|
1183 |
$parents[] = ($what_to_return === TRUE) ? $node->webform['components'][$pid] : $node->webform['components'][$pid][$what_to_return];
|
|
1154 | 1184 |
$pid = $node->webform['components'][$pid]['pid']; |
1155 | 1185 |
} |
1156 | 1186 |
return array_reverse($parents); |
drupal7/sites/all/modules/webform/includes/webform.conditionals.inc | ||
---|---|---|
90 | 90 |
$cid = $action['target']; |
91 | 91 |
if ($action['action'] == 'require' && !$components[$cid]['required']) { |
92 | 92 |
drupal_set_message(t('Component %title must be configured as Required for Webform to conditionally change its required status. <a href="!url">Configure %title.</a>', |
93 |
array('%title' => $components[$cid]['name'],
|
|
94 |
'!url' => url("node/{$node->nid}/webform/components/$cid", array('query' => array('destination' => "node/{$node->nid}/webform/conditionals"))))
|
|
95 |
), 'error');
|
|
93 |
array('%title' => $components[$cid]['name'], |
|
94 |
'!url' => url("node/{$node->nid}/webform/components/$cid", array('query' => array('destination' => "node/{$node->nid}/webform/conditionals")))) |
|
95 |
), 'error'); |
|
96 | 96 |
} |
97 | 97 |
} |
98 | 98 |
$form['conditionals'][$rgid]['weight'] = array( |
... | ... | |
209 | 209 |
$target_id = $action['target']['#value']; |
210 | 210 |
if (isset($targets[$target_id][$operation])) { |
211 | 211 |
form_set_error('conditionals][' . $conditional_key . '][actions][' . $action_key . '][target', |
212 |
t('A operation %op cannot be made for a component more than once. (%target).',
|
|
213 |
array('%op' => $action['action']['#options'][$operation],
|
|
214 |
'%target' => $components[$action['target']['#value']]['name'])));
|
|
212 |
t('A operation %op cannot be made for a component more than once. (%target).', |
|
213 |
array('%op' => $action['action']['#options'][$operation], |
|
214 |
'%target' => $components[$action['target']['#value']]['name']))); |
|
215 | 215 |
} |
216 | 216 |
$component_type = $node->webform['components'][$action['target']['#value']]['type']; |
217 | 217 |
if (!webform_conditional_action_able($component_type, $action['action']['#value'])) { |
218 | 218 |
form_set_error('conditionals][' . $conditional_key . '][actions][' . $action_key . '][action', |
219 |
t('A component of type %type can\'t be %action. (%target)',
|
|
220 |
array(
|
|
221 |
'%action' => $action['action']['#options'][$action['action']['#value']],
|
|
222 |
'%type' => $component_options[$component_type],
|
|
223 |
'%target' => $components[$action['target']['#value']]['name'])));
|
|
219 |
t('A component of type %type can\'t be %action. (%target)', |
|
220 |
array( |
|
221 |
'%action' => $action['action']['#options'][$action['action']['#value']], |
|
222 |
'%type' => $component_options[$component_type], |
|
223 |
'%target' => $components[$action['target']['#value']]['name']))); |
|
224 | 224 |
} |
225 | 225 |
$targets[$target_id][$operation] = $target_id; |
226 | 226 |
} |
... | ... | |
229 | 229 |
// Validate component rules, but not conditional_start/end rules. |
230 | 230 |
if (is_numeric($rule_key) && $rule['source_type']['#value'] == 'component' && isset($targets[$rule['source']['#value']])) { |
231 | 231 |
form_set_error('conditionals][' . $conditional_key . '][rules][' . $rule_key . '][source', |
232 |
t('The subject of the conditional cannot be the same as the component that is changed (%target).',
|
|
233 |
array('%target' => $components[$rule['source']['#value']]['name'])));
|
|
232 |
t('The subject of the conditional cannot be the same as the component that is changed (%target).', |
|
233 |
array('%target' => $components[$rule['source']['#value']]['name']))); |
|
234 | 234 |
} |
235 | 235 |
} |
236 | 236 |
} |
... | ... | |
458 | 458 |
'#submit' => array('webform_conditional_element_add'), |
459 | 459 |
'#subconditional' => $subconditional, |
460 | 460 |
'#name' => implode('_', $element['#parents']) . '_rules_' . $rid . |
461 |
($subconditional ? '_add_subconditional' : '_add'),
|
|
461 |
($subconditional ? '_add_subconditional' : '_add'), |
|
462 | 462 |
'#attributes' => array('class' => array('webform-conditional-rule-add')), |
463 | 463 |
'#ajax' => array( |
464 | 464 |
'progress' => 'none', |
... | ... | |
653 | 653 |
* The starting rule id for the search |
654 | 654 |
* @param integer $target_delta_level |
655 | 655 |
* The level that is sought. 0 for current left. -1 for parent. |
656 |
* |
|
656 | 657 |
* @return integer |
657 | 658 |
* The rid of the found rule, or -1 if none. Note that NULL is not used as a |
658 | 659 |
* semaphore for "not found" because it casts to 0, which is a valid rule id. |
... | ... | |
681 | 682 |
/** |
682 | 683 |
* Helper. Find the matching start or end of a given subconditional. |
683 | 684 |
* |
684 |
* @see _webform_conditional_find_end().
|
|
685 |
* @see _webform_conditional_find_end() |
|
685 | 686 |
*/ |
686 | 687 |
function _webform_conditional_find_start($rules, $origin_rid, $target_delta_level = 0) { |
687 | 688 |
$rids = array_keys($rules); |
... | ... | |
999 | 1000 |
} |
1000 | 1001 |
|
1001 | 1002 |
/** |
1002 |
* Internal implementation of hook_webform_conditional_operator_info().
|
|
1003 |
* Implements hook_webform_conditional_operator_info().
|
|
1003 | 1004 |
* |
1004 | 1005 |
* Called from webform.module's webform_webform_conditional_operator_info(). |
1005 | 1006 |
*/ |
... | ... | |
1682 | 1683 |
*/ |
1683 | 1684 |
function webform_conditional_operator_datetime_after_equal($input_values, $rule_value) { |
1684 | 1685 |
return webform_conditional_operator_datetime_after($input_values, $rule_value) || |
1685 |
webform_conditional_operator_datetime_equal($input_values, $rule_value);
|
|
1686 |
webform_conditional_operator_datetime_equal($input_values, $rule_value); |
|
1686 | 1687 |
} |
1687 | 1688 |
|
1688 | 1689 |
/** |
... | ... | |
1698 | 1699 |
*/ |
1699 | 1700 |
function webform_conditional_operator_datetime_before_equal($input_values, $rule_value) { |
1700 | 1701 |
return webform_conditional_operator_datetime_before($input_values, $rule_value) || |
1701 |
webform_conditional_operator_datetime_equal($input_values, $rule_value);
|
|
1702 |
webform_conditional_operator_datetime_equal($input_values, $rule_value); |
|
1702 | 1703 |
} |
1703 | 1704 |
|
1704 | 1705 |
/** |
drupal7/sites/all/modules/webform/includes/webform.emails.inc | ||
---|---|---|
94 | 94 |
/** |
95 | 95 |
* Theme the node components form. Use a table to organize the components. |
96 | 96 |
* |
97 |
* @param $form |
|
98 |
* The form array. |
|
99 |
* @return |
|
97 |
* @param array $variables |
|
98 |
* Array with key "form" containing the form array. |
|
99 |
* |
|
100 |
* @return string |
|
100 | 101 |
* Formatted HTML form, ready for display. |
102 |
* |
|
103 |
* @throws Exception |
|
101 | 104 |
*/ |
102 | 105 |
function theme_webform_emails_form($variables) { |
103 | 106 |
$form = $variables['form']; |
... | ... | |
692 | 695 |
* |
693 | 696 |
* @param $email |
694 | 697 |
* An array of settings for sending an e-mail. |
698 |
* |
|
699 |
* @return int|false |
|
700 |
* The e-mail identifier for this row's settings on success else false. |
|
695 | 701 |
*/ |
696 | 702 |
function webform_email_insert($email) { |
697 | 703 |
// TODO: This is not race-condition safe. Switch to using transactions? |
... | ... | |
716 | 722 |
* |
717 | 723 |
* @param $email |
718 | 724 |
* An array of settings for sending an e-mail. |
725 |
* |
|
726 |
* @return false|int |
|
727 |
* The e-mail identifier for this row's settings on success else false. |
|
719 | 728 |
*/ |
720 | 729 |
function webform_email_clone($email) { |
721 | 730 |
$email['eid'] = NULL; |
... | ... | |
728 | 737 |
* @param $email |
729 | 738 |
* An array of settings for sending an e-mail containing a nid, eid, and all |
730 | 739 |
* other fields from the e-mail form. |
740 |
* |
|
741 |
* @return false|int |
|
742 |
* On success SAVED_NEW or SAVED_UPDATED, depending on the operation performed, |
|
743 |
* false on failure. |
|
731 | 744 |
*/ |
732 | 745 |
function webform_email_update($email) { |
733 | 746 |
$email['excluded_components'] = implode(',', $email['excluded_components']); |
drupal7/sites/all/modules/webform/includes/webform.export.inc | ||
---|---|---|
10 | 10 |
* |
11 | 11 |
* Defines the exporters this module implements. |
12 | 12 |
* |
13 |
* @return |
|
13 |
* @return array
|
|
14 | 14 |
* An "array of arrays", keyed by content-types. The 'handler' slot |
15 | 15 |
* should point to the PHP class implementing this flag. |
16 | 16 |
*/ |
drupal7/sites/all/modules/webform/includes/webform.options.inc | ||
---|---|---|
6 | 6 |
*/ |
7 | 7 |
|
8 | 8 |
/** |
9 |
* Private implementation of hook_webform_select_options_info().
|
|
9 |
* Implements hook_webform_select_options_info().
|
|
10 | 10 |
* |
11 | 11 |
* @see webform_webform_select_options_info() |
12 | 12 |
*/ |
... | ... | |
35 | 35 |
} |
36 | 36 |
|
37 | 37 |
/** |
38 |
* Implements callback_webform_options(). |
|
39 |
* |
|
38 | 40 |
* Option list containing the days of the week. |
39 | 41 |
*/ |
40 | 42 |
function webform_options_days($component, $flat, $arguments) { |
... | ... | |
58 | 60 |
} |
59 | 61 |
|
60 | 62 |
/** |
63 |
* Implements callback_webform_options(). |
|
64 |
* |
|
61 | 65 |
* Options list containing country names. |
62 | 66 |
*/ |
63 | 67 |
function webform_options_countries($component, $flat, $arguments) { |
... | ... | |
66 | 70 |
} |
67 | 71 |
|
68 | 72 |
/** |
73 |
* Implements callback_webform_options(). |
|
74 |
* |
|
69 | 75 |
* Options list containing United States states and territories. |
70 | 76 |
*/ |
71 | 77 |
function webform_options_united_states($component, $flat, $arguments) { |
drupal7/sites/all/modules/webform/includes/webform.pages.inc | ||
---|---|---|
412 | 412 |
} |
413 | 413 |
|
414 | 414 |
// Ensure only positive integers are entered as submission limits. |
415 |
foreach (array('total_submit_limit', 'submit_limit') as $field) {
|
|
415 |
foreach (array('total_submit_limit' => 'enforce_total_limit', 'submit_limit' => 'enforce_limit') as $field => $enforce_fk) {
|
|
416 | 416 |
$limit = $form['submission'][$field][$field]['#value']; |
417 |
if ($limit !== '' && (int) $limit < 1 && (int) $limit !== -1) { |
|
417 |
if ($form['submission'][$field][$enforce_fk]['#value'] !== 'no' && $limit !== '' && (int) $limit < 1 && (int) $limit !== -1) {
|
|
418 | 418 |
form_error($form['submission'][$field][$field], t('The submission limit must be at least 1.')); |
419 | 419 |
} |
420 | 420 |
} |
... | ... | |
427 | 427 |
// Note that FAPI doesn't actually support error highlighting on radio or |
428 | 428 |
// checkbox form elements. |
429 | 429 |
form_error($form['advanced']['confidential'], |
430 |
t('Choose a "Per user submission limit" or "Confidential submissions", but not both. Or ask the adminstrator to track anonymous users by cookie, rather than IP address only.'));
|
|
430 |
t('Choose a "Per user submission limit" or "Confidential submissions", but not both. Or ask the adminstrator to track anonymous users by cookie, rather than IP address only.')); |
|
431 | 431 |
} |
432 | 432 |
} |
433 | 433 |
|
... | ... | |
521 | 521 |
$next_serial = (int)$form_state['values']['next_serial']; |
522 | 522 |
if ($next_serial < $next_min) { |
523 | 523 |
drupal_set_message(t('The next submission number was increased to @min to make it higher than existing submissions.', |
Formats disponibles : Unified diff
Weekly update of contrib modules