Révision 388c412d
Ajouté par Assos Assos il y a environ 7 ans
drupal7/sites/all/modules/date/date.info | ||
---|---|---|
15 | 15 |
files[] = tests/date_views_popup.test |
16 | 16 |
files[] = tests/date_form.test |
17 | 17 |
|
18 |
; Information added by Drupal.org packaging script on 2017-03-29
|
|
19 |
version = "7.x-2.10-rc2"
|
|
18 |
; Information added by Drupal.org packaging script on 2017-04-07
|
|
19 |
version = "7.x-2.10" |
|
20 | 20 |
core = "7.x" |
21 | 21 |
project = "date" |
22 |
datestamp = "1490783291"
|
|
22 |
datestamp = "1491562090"
|
|
23 | 23 |
|
drupal7/sites/all/modules/date/date_all_day/date_all_day.info | ||
---|---|---|
5 | 5 |
package = Date/Time |
6 | 6 |
core = 7.x |
7 | 7 |
|
8 |
; Information added by Drupal.org packaging script on 2017-03-29
|
|
9 |
version = "7.x-2.10-rc2"
|
|
8 |
; Information added by Drupal.org packaging script on 2017-04-07
|
|
9 |
version = "7.x-2.10" |
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "date" |
12 |
datestamp = "1490783291"
|
|
12 |
datestamp = "1491562090"
|
|
13 | 13 |
|
drupal7/sites/all/modules/date/date_api/date_api.info | ||
---|---|---|
9 | 9 |
files[] = date_api.module |
10 | 10 |
files[] = date_api_sql.inc |
11 | 11 |
|
12 |
; Information added by Drupal.org packaging script on 2017-03-29
|
|
13 |
version = "7.x-2.10-rc2"
|
|
12 |
; Information added by Drupal.org packaging script on 2017-04-07
|
|
13 |
version = "7.x-2.10" |
|
14 | 14 |
core = "7.x" |
15 | 15 |
project = "date" |
16 |
datestamp = "1490783291"
|
|
16 |
datestamp = "1491562090"
|
|
17 | 17 |
|
drupal7/sites/all/modules/date/date_context/date_context.info | ||
---|---|---|
8 | 8 |
|
9 | 9 |
files[] = date_context.module |
10 | 10 |
files[] = plugins/date_context_date_condition.inc |
11 |
; Information added by Drupal.org packaging script on 2017-03-29
|
|
12 |
version = "7.x-2.10-rc2"
|
|
11 |
; Information added by Drupal.org packaging script on 2017-04-07
|
|
12 |
version = "7.x-2.10" |
|
13 | 13 |
core = "7.x" |
14 | 14 |
project = "date" |
15 |
datestamp = "1490783291"
|
|
15 |
datestamp = "1491562090"
|
|
16 | 16 |
|
drupal7/sites/all/modules/date/date_migrate/date_migrate.info | ||
---|---|---|
4 | 4 |
package = Date/Time |
5 | 5 |
hidden = TRUE |
6 | 6 |
|
7 |
; Information added by Drupal.org packaging script on 2017-03-29
|
|
8 |
version = "7.x-2.10-rc2"
|
|
7 |
; Information added by Drupal.org packaging script on 2017-04-07
|
|
8 |
version = "7.x-2.10" |
|
9 | 9 |
core = "7.x" |
10 | 10 |
project = "date" |
11 |
datestamp = "1490783290"
|
|
11 |
datestamp = "1491562090"
|
|
12 | 12 |
|
drupal7/sites/all/modules/date/date_migrate/date_migrate_example/date_migrate_example.info | ||
---|---|---|
20 | 20 |
project = "date_migrate_example" |
21 | 21 |
version = "7.x-2.0" |
22 | 22 |
|
23 |
; Information added by Drupal.org packaging script on 2017-03-29
|
|
24 |
version = "7.x-2.10-rc2"
|
|
23 |
; Information added by Drupal.org packaging script on 2017-04-07
|
|
24 |
version = "7.x-2.10" |
|
25 | 25 |
core = "7.x" |
26 | 26 |
project = "date" |
27 |
datestamp = "1490783290"
|
|
27 |
datestamp = "1491562090"
|
|
28 | 28 |
|
drupal7/sites/all/modules/date/date_popup/date_popup.info | ||
---|---|---|
7 | 7 |
|
8 | 8 |
stylesheets[all][] = themes/datepicker.1.7.css |
9 | 9 |
|
10 |
; Information added by Drupal.org packaging script on 2017-03-29
|
|
11 |
version = "7.x-2.10-rc2"
|
|
10 |
; Information added by Drupal.org packaging script on 2017-04-07
|
|
11 |
version = "7.x-2.10" |
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "date" |
14 |
datestamp = "1490783290"
|
|
14 |
datestamp = "1491562090"
|
|
15 | 15 |
|
drupal7/sites/all/modules/date/date_repeat/date_repeat.info | ||
---|---|---|
7 | 7 |
files[] = tests/date_repeat.test |
8 | 8 |
files[] = tests/date_repeat_form.test |
9 | 9 |
|
10 |
; Information added by Drupal.org packaging script on 2017-03-29
|
|
11 |
version = "7.x-2.10-rc2"
|
|
10 |
; Information added by Drupal.org packaging script on 2017-04-07
|
|
11 |
version = "7.x-2.10" |
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "date" |
14 |
datestamp = "1490783290"
|
|
14 |
datestamp = "1491562090"
|
|
15 | 15 |
|
drupal7/sites/all/modules/date/date_repeat_field/date_repeat_field.info | ||
---|---|---|
7 | 7 |
package = Date/Time |
8 | 8 |
core = 7.x |
9 | 9 |
|
10 |
; Information added by Drupal.org packaging script on 2017-03-29
|
|
11 |
version = "7.x-2.10-rc2"
|
|
10 |
; Information added by Drupal.org packaging script on 2017-04-07
|
|
11 |
version = "7.x-2.10" |
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "date" |
14 |
datestamp = "1490783290"
|
|
14 |
datestamp = "1491562090"
|
|
15 | 15 |
|
drupal7/sites/all/modules/date/date_tools/date_tools.info | ||
---|---|---|
6 | 6 |
configure = admin/config/date/tools |
7 | 7 |
files[] = tests/date_tools.test |
8 | 8 |
|
9 |
; Information added by Drupal.org packaging script on 2017-03-29
|
|
10 |
version = "7.x-2.10-rc2"
|
|
9 |
; Information added by Drupal.org packaging script on 2017-04-07
|
|
10 |
version = "7.x-2.10" |
|
11 | 11 |
core = "7.x" |
12 | 12 |
project = "date" |
13 |
datestamp = "1490783290"
|
|
13 |
datestamp = "1491562090"
|
|
14 | 14 |
|
drupal7/sites/all/modules/date/date_views/date_views.info | ||
---|---|---|
12 | 12 |
files[] = includes/date_views.views.inc |
13 | 13 |
files[] = includes/date_views_plugin_pager.inc |
14 | 14 |
|
15 |
; Information added by Drupal.org packaging script on 2017-03-29
|
|
16 |
version = "7.x-2.10-rc2"
|
|
15 |
; Information added by Drupal.org packaging script on 2017-04-07
|
|
16 |
version = "7.x-2.10" |
|
17 | 17 |
core = "7.x" |
18 | 18 |
project = "date" |
19 |
datestamp = "1490783290"
|
|
19 |
datestamp = "1491562090"
|
|
20 | 20 |
|
drupal7/sites/all/modules/date/tests/date_test/date_test.info | ||
---|---|---|
6 | 6 |
hidden = TRUE |
7 | 7 |
dependencies[] = date |
8 | 8 |
|
9 |
; Information added by Drupal.org packaging script on 2017-03-29
|
|
10 |
version = "7.x-2.10-rc2"
|
|
9 |
; Information added by Drupal.org packaging script on 2017-04-07
|
|
10 |
version = "7.x-2.10" |
|
11 | 11 |
core = "7.x" |
12 | 12 |
project = "date" |
13 |
datestamp = "1490783290"
|
|
13 |
datestamp = "1491562090"
|
|
14 | 14 |
|
drupal7/sites/all/modules/media/includes/MediaEntityTranslationHandler.inc | ||
---|---|---|
37 | 37 |
|
38 | 38 |
if ($this->getPathScheme() == 'media') { |
39 | 39 |
$language = $GLOBALS[LANGUAGE_TYPE_CONTENT]; |
40 |
$form_langcode = $this->getFormLanguage();
|
|
40 |
$form_langcode = $this->getActiveLanguage();
|
|
41 | 41 |
$source_langcode = $this->getSourceLanguage(); |
42 | 42 |
$translations = $this->getTranslations(); |
43 | 43 |
|
drupal7/sites/all/modules/media/includes/media.fields.inc | ||
---|---|---|
126 | 126 |
// on the elements for further usage in media_element_process(). |
127 | 127 |
if (module_invoke('entity_translation', 'enabled', $element['#entity_type'], $element['#entity'])) { |
128 | 128 |
$translation_handler = entity_translation_get_handler($element['#entity_type'], $element['#entity']); |
129 |
$element['#media_parent_entity_form_langcode'] = $translation_handler->getFormLanguage();
|
|
129 |
$element['#media_parent_entity_form_langcode'] = $translation_handler->getActiveLanguage();
|
|
130 | 130 |
if ($source_langcode = $translation_handler->getSourceLanguage()) { |
131 | 131 |
$element['#media_parent_entity_source_langcode'] = $source_langcode; |
132 | 132 |
} |
drupal7/sites/all/modules/media/includes/media.pages.inc | ||
---|---|---|
19 | 19 |
if (isset($languages[$_GET['media_parent_entity_form_langcode']])) { |
20 | 20 |
$langcode = $_GET['media_parent_entity_form_langcode']; |
21 | 21 |
$translation_handler = entity_translation_get_handler('file', $file); |
22 |
$translation_handler->setFormLanguage($langcode);
|
|
22 |
$translation_handler->setActiveLanguage($langcode);
|
|
23 | 23 |
$translations = $translation_handler->getTranslations(); |
24 | 24 |
if (!isset($translations->data[$langcode])) { |
25 | 25 |
if (!empty($_GET['media_parent_entity_source_langcode']) && is_string($_GET['media_parent_entity_source_langcode']) && isset($translations->data[$_GET['media_parent_entity_source_langcode']])) { |
drupal7/sites/all/modules/media/media.info | ||
---|---|---|
24 | 24 |
; We have to add a fake version so Git checkouts do not fail Media dependencies |
25 | 25 |
version = 7.x-2.x-dev |
26 | 26 |
|
27 |
; Information added by Drupal.org packaging script on 2017-03-05
|
|
28 |
version = "7.x-2.0-rc12"
|
|
27 |
; Information added by Drupal.org packaging script on 2017-04-06
|
|
28 |
version = "7.x-2.0" |
|
29 | 29 |
core = "7.x" |
30 | 30 |
project = "media" |
31 |
datestamp = "1488724088"
|
|
31 |
datestamp = "1491500288"
|
|
32 | 32 |
|
drupal7/sites/all/modules/media/media.install | ||
---|---|---|
122 | 122 |
} |
123 | 123 |
} |
124 | 124 |
|
125 |
if (module_exists('entity_translation')) { |
|
126 |
if ($phase == 'update' || $phase == 'install' || $phase == 'runtime' ) { |
|
127 |
$entity_translation_info = system_get_info('module', 'entity_translation'); |
|
128 |
$et_installed_version = $entity_translation_info['version']; |
|
129 |
$et_installed_datestamp = $entity_translation_info['datestamp']; |
|
130 |
$march3rd_entity_translation_timestamp = 1488530885; |
|
131 |
if (!isset($entity_translation_info['version']) || !isset($entity_translation_info['datestamp'])) { |
|
132 |
$et_installed_datestamp = 1488530884; |
|
133 |
} |
|
134 |
|
|
135 |
if ($et_installed_datestamp < $march3rd_entity_translation_timestamp) { |
|
136 |
$description = $t('Your entity_translation installation version: %version is too old. media requires entity_translation at least beta6 from march 3 2017 or newer. Your choice is to either upgrade entity_translation or to disable it.', array('%version' => $et_installed_version)); |
|
137 |
$requirements['entity_translation']['description'] = $description; |
|
138 |
$requirements['entity_translation']['severity'] = REQUIREMENT_ERROR; |
|
139 |
$requirements['entity_translation']['value'] = $et_installed_version; |
|
140 |
$requirements['entity_translation']['title'] = $t('Entity translation (when installed) with Media'); |
|
141 |
drupal_set_message($description, 'error', TRUE); |
|
142 |
} |
|
143 |
} |
|
144 |
} |
|
125 | 145 |
return $requirements; |
126 | 146 |
} |
127 | 147 |
|
drupal7/sites/all/modules/media/media.module | ||
---|---|---|
368 | 368 |
// Add a validation function to any field instance which uses the media widget |
369 | 369 |
// to ensure that the upload destination scheme is one of the allowed schemes |
370 | 370 |
// if any defined by settings. |
371 |
if ($form['instance']['widget']['type']['#value'] == 'media_generic' && isset($form['#field']['settings']['uri_scheme'])) { |
|
371 |
if (isset($form['instance']['widget']) && $form['instance']['widget']['type']['#value'] == 'media_generic' && isset($form['#field']['settings']['uri_scheme'])) {
|
|
372 | 372 |
$form['#validate'][] = 'media_field_instance_validate'; |
373 | 373 |
} |
374 | 374 |
} |
... | ... | |
833 | 833 |
$element_js_class = drupal_html_class('js-media-element-' . $element['#id']); |
834 | 834 |
$element['upload']['#attributes']['class'][] = $element_js_class; |
835 | 835 |
|
836 |
// Add the media options to the page as JavaScript settings. |
|
836 |
// Cache the media options and pass the cache ID as a JavaScript setting. |
|
837 |
$cid = drupal_get_token(drupal_random_bytes(32)); |
|
838 |
cache_set('media_options:' . $cid, $element['#media_options']['global'], 'cache_form', REQUEST_TIME + 21600); |
|
839 |
|
|
837 | 840 |
$element['browse_button']['#attached']['js'] = array( |
838 | 841 |
array( |
839 | 842 |
'type' => 'setting', |
840 |
'data' => array('media' => array('elements' => array('.' . $element_js_class => $element['#media_options'])))
|
|
843 |
'data' => array('media' => array('elements' => array('.' . $element_js_class => array('global' => array('options' => $cid))))),
|
|
841 | 844 |
) |
842 | 845 |
); |
843 | 846 |
|
... | ... | |
1202 | 1205 |
if (empty($params)) { |
1203 | 1206 |
// Build out browser settings. Permissions- and security-related behaviors |
1204 | 1207 |
// should not rely on these parameters, since they come from the HTTP query. |
1205 |
// @TODO make sure we treat parameters as user input. |
|
1206 |
$params = drupal_get_query_parameters() + array( |
|
1207 |
'types' => array(), |
|
1208 |
'multiselect' => FALSE, |
|
1209 |
); |
|
1208 |
// There are two ways of passing secure data: |
|
1209 |
// - Store the options in the 'cache_form' cache bin, using a random key |
|
1210 |
// prefixed with 'media_options:'. Pass the random key in the 'options' |
|
1211 |
// query argument. |
|
1212 |
// - Inject the options by altering the browser parameters. |
|
1213 |
// @see hook_media_browser_params_alter() |
|
1214 |
$params = drupal_get_query_parameters(); |
|
1215 |
|
|
1216 |
$insecure_settings = array( |
|
1217 |
'file_directory', |
|
1218 |
'file_extensions', |
|
1219 |
'max_filesize', |
|
1220 |
'uri_scheme', |
|
1221 |
); |
|
1222 |
|
|
1223 |
// Filter out insecure_settings. |
|
1224 |
foreach(array_keys($params) as $key) { |
|
1225 |
if (in_array($key, $insecure_settings)) { |
|
1226 |
unset($params[$key]); |
|
1227 |
} |
|
1228 |
} |
|
1229 |
|
|
1230 |
// Retrieve the security sensitive options from the cache. |
|
1231 |
if (!empty($params['options']) && is_string($params['options']) && $options = cache_get('media_options:' . $params['options'], 'cache_form')) { |
|
1232 |
$params = array_merge($options->data, $params); |
|
1233 |
} |
|
1210 | 1234 |
|
1211 | 1235 |
// Transform text 'true' and 'false' to actual booleans. |
1212 | 1236 |
foreach ($params as $k => $v) { |
... | ... | |
1220 | 1244 |
|
1221 | 1245 |
array_walk_recursive($params, 'media_recursive_check_plain'); |
1222 | 1246 |
|
1247 |
// Provide some default parameters. |
|
1248 |
$params += array( |
|
1249 |
'types' => array(), |
|
1250 |
'multiselect' => FALSE, |
|
1251 |
); |
|
1252 |
|
|
1223 | 1253 |
// Allow modules to alter the parameters. |
1224 | 1254 |
drupal_alter('media_browser_params', $params); |
1225 | 1255 |
} |
drupal7/sites/all/modules/media/modules/media_bulk_upload/media_bulk_upload.info | ||
---|---|---|
15 | 15 |
files[] = includes/MediaBrowserBulkUpload.inc |
16 | 16 |
files[] = tests/media_bulk_upload.test |
17 | 17 |
|
18 |
; Information added by Drupal.org packaging script on 2017-03-05
|
|
19 |
version = "7.x-2.0-rc12"
|
|
18 |
; Information added by Drupal.org packaging script on 2017-04-06
|
|
19 |
version = "7.x-2.0" |
|
20 | 20 |
core = "7.x" |
21 | 21 |
project = "media" |
22 |
datestamp = "1488724088"
|
|
22 |
datestamp = "1491500288"
|
|
23 | 23 |
|
drupal7/sites/all/modules/media/modules/media_internet/media_internet.info | ||
---|---|---|
12 | 12 |
files[] = includes/MediaInternetValidationException.inc |
13 | 13 |
files[] = tests/media_internet.test |
14 | 14 |
|
15 |
; Information added by Drupal.org packaging script on 2017-03-05
|
|
16 |
version = "7.x-2.0-rc12"
|
|
15 |
; Information added by Drupal.org packaging script on 2017-04-06
|
|
16 |
version = "7.x-2.0" |
|
17 | 17 |
core = "7.x" |
18 | 18 |
project = "media" |
19 |
datestamp = "1488724088"
|
|
19 |
datestamp = "1491500288"
|
|
20 | 20 |
|
drupal7/sites/all/modules/media/modules/media_internet/tests/media_internet_test.info | ||
---|---|---|
7 | 7 |
files[] = includes/MediaInternetTestStreamWrapper.inc |
8 | 8 |
files[] = includes/MediaInternetTestHandler.inc |
9 | 9 |
|
10 |
; Information added by Drupal.org packaging script on 2017-03-05
|
|
11 |
version = "7.x-2.0-rc12"
|
|
10 |
; Information added by Drupal.org packaging script on 2017-04-06
|
|
11 |
version = "7.x-2.0" |
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "media" |
14 |
datestamp = "1488724088"
|
|
14 |
datestamp = "1491500288"
|
|
15 | 15 |
|
drupal7/sites/all/modules/media/modules/media_migrate_file_types/media_migrate_file_types.info | ||
---|---|---|
8 | 8 |
|
9 | 9 |
configure = admin/structure/file-types/upgrade |
10 | 10 |
|
11 |
; Information added by Drupal.org packaging script on 2017-03-05
|
|
12 |
version = "7.x-2.0-rc12"
|
|
11 |
; Information added by Drupal.org packaging script on 2017-04-06
|
|
12 |
version = "7.x-2.0" |
|
13 | 13 |
core = "7.x" |
14 | 14 |
project = "media" |
15 |
datestamp = "1488724088"
|
|
15 |
datestamp = "1491500288"
|
|
16 | 16 |
|
drupal7/sites/all/modules/media/modules/media_wysiwyg/js/media_wysiwyg.filter.js | ||
---|---|---|
238 | 238 |
if (info.attributes[a]) { |
239 | 239 |
element.attr(a, info.attributes[a]); |
240 | 240 |
} |
241 |
else if (element.attr(a)) { |
|
242 |
// If the element has the attribute, but the value is empty, be |
|
243 |
// sure to clear it. |
|
244 |
element.removeAttr(a); |
|
245 |
} |
|
241 | 246 |
}); |
242 | 247 |
delete(info.attributes); |
243 | 248 |
|
drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.info | ||
---|---|---|
15 | 15 |
|
16 | 16 |
configure = admin/config/media/browser |
17 | 17 |
|
18 |
; Information added by Drupal.org packaging script on 2017-03-05
|
|
19 |
version = "7.x-2.0-rc12"
|
|
18 |
; Information added by Drupal.org packaging script on 2017-04-06
|
|
19 |
version = "7.x-2.0" |
|
20 | 20 |
core = "7.x" |
21 | 21 |
project = "media" |
22 |
datestamp = "1488724088"
|
|
22 |
datestamp = "1491500288"
|
|
23 | 23 |
|
drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.module | ||
---|---|---|
694 | 694 |
drupal_write_record('media_restrict_wysiwyg', $record); |
695 | 695 |
} |
696 | 696 |
} |
697 |
|
|
698 |
/** |
|
699 |
* Implements hook_media_browser_params_alter(). |
|
700 |
*/ |
|
701 |
function media_wysiwyg_media_browser_params_alter(&$params) { |
|
702 |
// Set the media browser options as defined in the interface. |
|
703 |
if (!empty($params['id']) && $params['id'] === 'media_wysiwyg') { |
|
704 |
$params = array( |
|
705 |
'enabledPlugins' => variable_get('media_wysiwyg_wysiwyg_browser_plugins', array()), |
|
706 |
'file_directory' => variable_get('media_wysiwyg_wysiwyg_upload_directory', ''), |
|
707 |
'types' => variable_get('media_wysiwyg_wysiwyg_allowed_types', array('audio', 'image', 'video', 'document')), |
|
708 |
'id' => 'media_wysiwyg', |
|
709 |
) + $params; |
|
710 |
} |
|
711 |
} |
drupal7/sites/all/modules/media/modules/media_wysiwyg/wysiwyg_plugins/media.inc | ||
---|---|---|
22 | 22 |
'css file' => 'media_wysiwyg.css', |
23 | 23 |
'settings' => array( |
24 | 24 |
'global' => array( |
25 |
'enabledPlugins' => variable_get('media_wysiwyg_wysiwyg_browser_plugins', array()), |
|
26 |
'file_directory' => variable_get('media_wysiwyg_wysiwyg_upload_directory', ''), |
|
27 |
'types' => variable_get('media_wysiwyg_wysiwyg_allowed_types', array('audio', 'image', 'video', 'document')), |
|
28 | 25 |
'id' => 'media_wysiwyg', |
29 | 26 |
), |
30 | 27 |
), |
drupal7/sites/all/modules/media/modules/media_wysiwyg_view_mode/media_wysiwyg_view_mode.info | ||
---|---|---|
3 | 3 |
package = Media |
4 | 4 |
core = 7.x |
5 | 5 |
|
6 |
; Information added by Drupal.org packaging script on 2017-03-05
|
|
7 |
version = "7.x-2.0-rc12"
|
|
6 |
; Information added by Drupal.org packaging script on 2017-04-06
|
|
7 |
version = "7.x-2.0" |
|
8 | 8 |
core = "7.x" |
9 | 9 |
project = "media" |
10 |
datestamp = "1488724088"
|
|
10 |
datestamp = "1491500288"
|
|
11 | 11 |
|
drupal7/sites/all/modules/media/modules/mediafield/mediafield.info | ||
---|---|---|
4 | 4 |
core = 7.x |
5 | 5 |
dependencies[] = media |
6 | 6 |
|
7 |
; Information added by Drupal.org packaging script on 2017-03-05
|
|
8 |
version = "7.x-2.0-rc12"
|
|
7 |
; Information added by Drupal.org packaging script on 2017-04-06
|
|
8 |
version = "7.x-2.0" |
|
9 | 9 |
core = "7.x" |
10 | 10 |
project = "media" |
11 |
datestamp = "1488724088"
|
|
11 |
datestamp = "1491500288"
|
|
12 | 12 |
|
drupal7/sites/all/modules/media/tests/media.test | ||
---|---|---|
685 | 685 |
foreach ($settings['extension'] as $extension) { |
686 | 686 |
$file = $this->createFileEntity(array('scheme' => $scheme, 'uid' => $this->admin_user->uid, 'type' => $type, 'filemime' => media_get_extension_mimetype($extension))); |
687 | 687 |
|
688 |
// Some of the settings such as the scheme and extension are unsafe to |
|
689 |
// pass as query arguments, cache them and pass the cache ID. |
|
688 | 690 |
$options = array( |
689 |
'query' => array( |
|
690 |
'enabledPlugins' => array( |
|
691 |
'media_default--media_browser_1' => 'media_default--media_browser_1', |
|
692 |
), |
|
693 |
'schemes' => array($scheme), |
|
694 |
'types' => array($type), |
|
695 |
'file_extensions' => $extension, |
|
691 |
'enabledPlugins' => array( |
|
692 |
'media_default--media_browser_1' => 'media_default--media_browser_1', |
|
696 | 693 |
), |
694 |
'schemes' => array($scheme), |
|
695 |
'types' => array($type), |
|
696 |
'file_extensions' => $extension, |
|
697 | 697 |
); |
698 | 698 |
|
699 |
$cid = drupal_get_token(drupal_random_bytes(32)); |
|
700 |
cache_set('media_options:' . $cid, $options, 'cache_form', REQUEST_TIME + 21600); |
|
701 |
|
|
699 | 702 |
// Verify that the file is displayed. |
700 |
$this->drupalGet('media/browser', $options);
|
|
703 |
$this->drupalGet('media/browser', array('query' => array('options' => $cid)));
|
|
701 | 704 |
$this->assertResponse(200); |
702 | 705 |
$xpath = $this->buildXPathQuery('//ul[@class="media-list-thumbnails"]/li/div[@data-fid=:fid]/@data-fid', array( |
703 | 706 |
':fid' => $file->fid, |
... | ... | |
714 | 717 |
// Perform the tests with none and all of the restrictions. |
715 | 718 |
foreach (array('none', 'all') as $restrictions) { |
716 | 719 |
$options = array( |
717 |
'query' => array( |
|
718 |
'enabledPlugins' => array( |
|
719 |
'media_default--media_browser_1' => 'media_default--media_browser_1', |
|
720 |
), |
|
720 |
'enabledPlugins' => array( |
|
721 |
'media_default--media_browser_1' => 'media_default--media_browser_1', |
|
721 | 722 |
), |
722 | 723 |
); |
723 | 724 |
|
724 | 725 |
switch ($restrictions) { |
725 | 726 |
case 'none': |
726 |
$options['query']['schemes'] = array();
|
|
727 |
$options['query']['types'] = array();
|
|
728 |
$options['query']['file_extensions'] = array();
|
|
727 |
$options['schemes'] = array(); |
|
728 |
$options['types'] = array(); |
|
729 |
$options['file_extensions'] = array(); |
|
729 | 730 |
break; |
730 | 731 |
case 'all': |
731 |
$options['query']['schemes'] = $settings['scheme'];
|
|
732 |
$options['query']['types'] = $settings['type'];
|
|
733 |
$options['query']['file_extensions'] = implode(' ', $settings['extension']);
|
|
732 |
$options['schemes'] = $settings['scheme']; |
|
733 |
$options['types'] = $settings['type']; |
|
734 |
$options['file_extensions'] = implode(' ', $settings['extension']); |
|
734 | 735 |
break; |
735 | 736 |
} |
736 | 737 |
|
738 |
$cid = drupal_get_token(drupal_random_bytes(32)); |
|
739 |
cache_set('media_options:' . $cid, $options, 'cache_form', REQUEST_TIME + 21600); |
|
740 |
|
|
737 | 741 |
// Verify that all of the files are displayed. |
738 |
$this->drupalGet('media/browser', $options);
|
|
742 |
$this->drupalGet('media/browser', array('query' => array('options' => $cid)));
|
|
739 | 743 |
$this->assertResponse(200); |
740 | 744 |
$files = $this->xpath('//ul[@class="media-list-thumbnails"]/li/div[@data-fid]'); |
741 | 745 |
$this->assertEqual(count($files), 8, format_string('All of the files were displayed when %restrictions of the restrictions were enabled.', array('%restrictions' => $restrictions))); |
... | ... | |
749 | 753 |
$file = $this->createFileEntity(array('scheme' => $scheme, 'uid' => $this->admin_user->uid, 'type' => $type, 'filemime' => media_get_extension_mimetype($extension))); |
750 | 754 |
|
751 | 755 |
$options = array( |
752 |
'query' => array( |
|
753 |
'enabledPlugins' => array( |
|
754 |
'media_default--media_browser_1' => 'media_default--media_browser_1', |
|
755 |
), |
|
756 |
'schemes' => array($scheme, 'public'), // Include a local stream wrapper in order to trigger extension restrictions. |
|
757 |
'types' => array($type), |
|
758 |
'file_extensions' => 'fake', // Use an invalid file extension to ensure that it does not affect restrictions. |
|
756 |
'enabledPlugins' => array( |
|
757 |
'media_default--media_browser_1' => 'media_default--media_browser_1', |
|
759 | 758 |
), |
759 |
'schemes' => array($scheme, 'public'), // Include a local stream wrapper in order to trigger extension restrictions. |
|
760 |
'types' => array($type), |
|
761 |
'file_extensions' => 'fake', // Use an invalid file extension to ensure that it does not affect restrictions. |
|
760 | 762 |
); |
761 | 763 |
|
764 |
$cid = drupal_get_token(drupal_random_bytes(32)); |
|
765 |
cache_set('media_options:' . $cid, $options, 'cache_form', REQUEST_TIME + 21600); |
|
766 |
|
|
762 | 767 |
// Verify that the file is displayed. |
763 |
$this->drupalGet('media/browser', $options);
|
|
768 |
$this->drupalGet('media/browser', array('query' => array('options' => $cid)));
|
|
764 | 769 |
$this->assertResponse(200); |
765 | 770 |
$xpath = $this->buildXPathQuery('//ul[@class="media-list-thumbnails"]/li/div[@data-fid=:fid]/@data-fid', array( |
766 | 771 |
':fid' => $file->fid, |
... | ... | |
896 | 901 |
$this->assertTrue(strpos($javascript, $settings) > 0, 'Rendered media element adds the global settings.'); |
897 | 902 |
} |
898 | 903 |
|
904 |
/** |
|
905 |
* Tests that the field widget does not contain the insecure settings. |
|
906 |
*/ |
|
907 |
function testInsecureSettings() { |
|
908 |
// Use 'page' instead of 'article', so that the 'article' image field does |
|
909 |
// not conflict with this test. If in the future the 'page' type gets its |
|
910 |
// own default file or image field, this test can be made more robust by |
|
911 |
// using a custom node type. |
|
912 |
$type_name = 'page'; |
|
913 |
$field_name = strtolower($this->randomName()); |
|
914 |
$this->createFileField($field_name, $type_name); |
|
915 |
$this->drupalGet("node/add/$type_name"); |
|
916 |
|
|
917 |
$insecure_settings = array( |
|
918 |
'file_directory', |
|
919 |
'file_extensions', |
|
920 |
'max_filesize', |
|
921 |
'uri_scheme', |
|
922 |
); |
|
923 |
foreach ($insecure_settings as $setting) { |
|
924 |
$this->assertNoRaw($setting, format_string('Media file field widget does not contain the insecure element-specific setting @setting.', array( |
|
925 |
'@setting' => $setting, |
|
926 |
))); |
|
927 |
} |
|
928 |
} |
|
929 |
|
|
899 | 930 |
/** |
900 | 931 |
* Tests the media file field widget settings. |
901 | 932 |
*/ |
... | ... | |
934 | 965 |
), |
935 | 966 |
); |
936 | 967 |
$settings = drupal_json_encode(drupal_array_merge_deep_array($field_widget)); |
937 |
$this->assertTrue(strpos($javascript, $settings) > 0, 'Media file field widget adds element-specific settings.'); |
|
968 |
$string_with_options = '-0-upload":{"global":{"options":"'; |
|
969 |
$index_of_cid = strpos($javascript, $string_with_options) + strlen($string_with_options); |
|
970 |
$index_end_of_cid = strpos($javascript, '"', $index_of_cid + 1); |
|
971 |
$cid = substr($javascript, $index_of_cid, ($index_end_of_cid - $index_of_cid)); |
|
972 |
|
|
973 |
// Retrieve the security sensitive options from the cache using the cid parsed out from the $javascript variable |
|
974 |
$retrieved_settings = cache_get('media_options:' . $cid, 'cache_form'); |
|
975 |
$retrieved_settings = array('.js-media-element-edit-' . $field_name . '-' . LANGUAGE_NONE . '-0-upload' => array( |
|
976 |
'global' => $retrieved_settings->data)); |
|
977 |
$retrieved_settings_json = drupal_json_encode($retrieved_settings); |
|
978 |
|
|
979 |
$this->assertTrue($retrieved_settings_json == $settings, 'Media file field widget retrieved from cache and has element-specific settings.'); |
|
980 |
$this->assertTrue(strpos($javascript, $cid) > 0, 'Media file field widget is cached and its` cache id is found.'); |
|
938 | 981 |
} |
939 | 982 |
} |
940 | 983 |
|
drupal7/sites/all/modules/media/tests/media_module_test.info | ||
---|---|---|
6 | 6 |
|
7 | 7 |
files[] = includes/MediaModuleTest.inc |
8 | 8 |
|
9 |
; Information added by Drupal.org packaging script on 2017-03-05
|
|
10 |
version = "7.x-2.0-rc12"
|
|
9 |
; Information added by Drupal.org packaging script on 2017-04-06
|
|
10 |
version = "7.x-2.0" |
|
11 | 11 |
core = "7.x" |
12 | 12 |
project = "media" |
13 |
datestamp = "1488724088"
|
|
13 |
datestamp = "1491500288"
|
|
14 | 14 |
|
drupal7/sites/all/themes/bootstrap/bootstrap.info | ||
---|---|---|
208 | 208 |
multipliers[screen-lg-min][] = 1.5x |
209 | 209 |
multipliers[screen-lg-min][] = 2x |
210 | 210 |
|
211 |
; Information added by Drupal.org packaging script on 2017-02-27
|
|
212 |
version = "7.x-3.12"
|
|
211 |
; Information added by Drupal.org packaging script on 2017-04-10
|
|
212 |
version = "7.x-3.13"
|
|
213 | 213 |
core = "7.x" |
214 | 214 |
project = "bootstrap" |
215 |
datestamp = "1488215888"
|
|
215 |
datestamp = "1491858546"
|
|
216 | 216 |
|
drupal7/sites/all/themes/bootstrap/js/misc/autocomplete.js | ||
---|---|---|
1 | 1 |
(function ($) { |
2 | 2 |
|
3 |
/** |
|
4 |
* Attaches the autocomplete behavior to all required fields. |
|
5 |
*/ |
|
6 |
Drupal.behaviors.autocomplete = { |
|
7 |
attach: function (context) { |
|
8 |
var $context = $(context); |
|
9 |
var acdb = []; |
|
10 |
$context.find('input.autocomplete').once('autocomplete', function () { |
|
11 |
var uri = this.value; |
|
12 |
if (!acdb[uri]) { |
|
13 |
acdb[uri] = new Drupal.ACDB(uri); |
|
14 |
} |
|
15 |
var $input = $context.find('#' + this.id.substr(0, this.id.length - 13)) |
|
16 |
.attr('autocomplete', 'OFF') |
|
17 |
.attr('aria-autocomplete', 'list'); |
|
18 |
$context.find($input[0].form).submit(Drupal.autocompleteSubmit); |
|
19 |
$input.parents('.form-item') |
|
20 |
.attr('role', 'application') |
|
21 |
.append($('<span class="element-invisible" aria-live="assertive"></span>') |
|
22 |
.attr('id', $input.attr('id') + '-autocomplete-aria-live') |
|
23 |
); |
|
24 |
new Drupal.jsAC($input, acdb[uri], $context); |
|
3 |
/** |
|
4 |
* Attaches the autocomplete behavior to all required fields. |
|
5 |
*/ |
|
6 |
Drupal.behaviors.autocomplete = { |
|
7 |
attach: function (context) { |
|
8 |
var $context = $(context); |
|
9 |
var acdb = []; |
|
10 |
$context.find('input.autocomplete').once('autocomplete', function () { |
|
11 |
var uri = this.value; |
|
12 |
if (!acdb[uri]) { |
|
13 |
acdb[uri] = new Drupal.ACDB(uri); |
|
14 |
} |
|
15 |
var $input = $context.find('#' + this.id.substr(0, this.id.length - 13)) |
|
16 |
.attr('autocomplete', 'OFF') |
|
17 |
.attr('aria-autocomplete', 'list'); |
|
18 |
$context.find($input[0].form).submit(Drupal.autocompleteSubmit); |
|
19 |
$input.parents('.form-item') |
|
20 |
.attr('role', 'application') |
|
21 |
.append($('<span class="element-invisible" aria-live="assertive"></span>') |
|
22 |
.attr('id', $input.attr('id') + '-autocomplete-aria-live') |
|
23 |
); |
|
24 |
new Drupal.jsAC($input, acdb[uri], $context); |
|
25 |
}); |
|
26 |
} |
|
27 |
}; |
|
28 |
|
|
29 |
/** |
|
30 |
* Prevents the form from submitting if the suggestions popup is open |
|
31 |
* and closes the suggestions popup when doing so. |
|
32 |
*/ |
|
33 |
Drupal.autocompleteSubmit = function () { |
|
34 |
$('.form-autocomplete > .dropdown').each(function () { |
|
35 |
this.owner.hidePopup(); |
|
25 | 36 |
}); |
26 |
} |
|
27 |
}; |
|
28 |
|
|
29 |
/** |
|
30 |
* Prevents the form from submitting if the suggestions popup is open |
|
31 |
* and closes the suggestions popup when doing so. |
|
32 |
*/ |
|
33 |
Drupal.autocompleteSubmit = function () { |
|
34 |
$('.form-autocomplete > .dropdown').each(function () { |
|
35 |
this.owner.hidePopup(); |
|
36 |
}); |
|
37 |
|
|
38 |
// Always return true to make it possible to submit even when there was an |
|
39 |
// autocomplete suggestion list open. |
|
37 |
|
|
38 |
// Always return true to make it possible to submit even when there was an |
|
39 |
// autocomplete suggestion list open. |
|
40 | 40 |
return true; |
41 |
}; |
|
42 |
|
|
43 |
/** |
|
44 |
* Highlights a suggestion. |
|
45 |
*/ |
|
46 |
Drupal.jsAC.prototype.highlight = function (node) { |
|
47 |
if (this.selected) { |
|
48 |
$(this.selected).removeClass('active'); |
|
49 |
} |
|
50 |
$(node).addClass('active'); |
|
51 |
this.selected = node; |
|
52 |
$(this.ariaLive).html($(this.selected).html()); |
|
53 |
}; |
|
54 |
|
|
55 |
/** |
|
56 |
* Unhighlights a suggestion. |
|
57 |
*/ |
|
58 |
Drupal.jsAC.prototype.unhighlight = function (node) { |
|
59 |
$(node).removeClass('active'); |
|
60 |
this.selected = false; |
|
61 |
$(this.ariaLive).empty(); |
|
62 |
}; |
|
63 |
|
|
64 |
/** |
|
65 |
* Positions the suggestions popup and starts a search. |
|
66 |
*/ |
|
67 |
Drupal.jsAC.prototype.populatePopup = function () { |
|
68 |
var $input = $(this.input); |
|
69 |
// Show popup. |
|
70 |
if (this.popup) { |
|
71 |
$(this.popup).remove(); |
|
72 |
} |
|
73 |
this.selected = false; |
|
74 |
this.popup = $('<div class="dropdown"></div>')[0]; |
|
75 |
this.popup.owner = this; |
|
76 |
$input.parent().after(this.popup); |
|
77 |
|
|
78 |
// Do search. |
|
79 |
this.db.owner = this; |
|
80 |
this.db.search(this.input.value); |
|
81 |
}; |
|
82 |
|
|
83 |
/** |
|
84 |
* Fills the suggestion popup with any matches received. |
|
85 |
*/ |
|
86 |
Drupal.jsAC.prototype.found = function (matches) { |
|
87 |
// If no value in the textfield, do not show the popup. |
|
88 |
if (!this.input.value.length) { |
|
89 |
return false; |
|
90 |
} |
|
91 |
|
|
92 |
// Prepare matches. |
|
93 |
var ul = $('<ul class="dropdown-menu"></ul>'); |
|
94 |
var ac = this; |
|
95 |
ul.css({ |
|
96 |
display: 'block', |
|
97 |
right: 0 |
|
98 |
}); |
|
99 |
for (var key in matches) { |
|
100 |
$('<li></li>') |
|
101 |
.html($('<a href="#"></a>').html(matches[key]).on('click', function (e) { e.preventDefault(); })) |
|
102 |
.on('mousedown', function () { ac.hidePopup(this); }) |
|
103 |
.on('mouseover', function () { ac.highlight(this); }) |
|
104 |
.on('mouseout', function () { ac.unhighlight(this); }) |
|
105 |
.data('autocompleteValue', key) |
|
106 |
.appendTo(ul); |
|
107 |
} |
|
108 |
|
|
109 |
// Show popup with matches, if any. |
|
110 |
if (this.popup) { |
|
111 |
if (ul.children().length) { |
|
112 |
$(this.popup).empty().append(ul).show(); |
|
113 |
$(this.ariaLive).html(Drupal.t('Autocomplete popup')); |
|
41 |
}; |
|
42 |
|
|
43 |
/** |
|
44 |
* Highlights a suggestion. |
|
45 |
*/ |
|
46 |
Drupal.jsAC.prototype.highlight = function (node) { |
|
47 |
if (this.selected) { |
|
48 |
$(this.selected).removeClass('active'); |
|
49 |
} |
|
50 |
$(node).addClass('active'); |
|
51 |
this.selected = node; |
|
52 |
$(this.ariaLive).html($(this.selected).html()); |
|
53 |
}; |
|
54 |
|
|
55 |
/** |
|
56 |
* Unhighlights a suggestion. |
|
57 |
*/ |
|
58 |
Drupal.jsAC.prototype.unhighlight = function (node) { |
|
59 |
$(node).removeClass('active'); |
|
60 |
this.selected = false; |
|
61 |
$(this.ariaLive).empty(); |
|
62 |
}; |
|
63 |
|
|
64 |
/** |
|
65 |
* Positions the suggestions popup and starts a search. |
|
66 |
*/ |
|
67 |
Drupal.jsAC.prototype.populatePopup = function () { |
|
68 |
var $input = $(this.input); |
|
69 |
// Show popup. |
|
70 |
if (this.popup) { |
|
71 |
$(this.popup).remove(); |
|
72 |
} |
|
73 |
this.selected = false; |
|
74 |
this.popup = $('<div class="dropdown"></div>')[0]; |
|
75 |
this.popup.owner = this; |
|
76 |
$input.parent().after(this.popup); |
|
77 |
|
|
78 |
// Do search. |
|
79 |
this.db.owner = this; |
|
80 |
this.db.search(this.input.value); |
|
81 |
}; |
|
82 |
|
|
83 |
/** |
|
84 |
* Fills the suggestion popup with any matches received. |
|
85 |
*/ |
|
86 |
Drupal.jsAC.prototype.found = function (matches) { |
|
87 |
// If no value in the textfield, do not show the popup. |
|
88 |
if (!this.input.value.length) { |
|
89 |
return false; |
|
90 |
} |
|
91 |
|
|
92 |
// Prepare matches. |
|
93 |
var ul = $('<ul class="dropdown-menu"></ul>'); |
|
94 |
var ac = this; |
|
95 |
ul.css({ |
|
96 |
display: 'block', |
|
97 |
right: 0 |
|
98 |
}); |
|
99 |
for (var key in matches) { |
|
100 |
$('<li></li>') |
|
101 |
.html($('<a href="#"></a>').html(matches[key]).on('click', function (e) { |
|
102 |
e.preventDefault(); |
|
103 |
})) |
|
104 |
.on('mousedown', function () { |
|
105 |
ac.hidePopup(this); |
|
106 |
}) |
|
107 |
.on('mouseover', function () { |
|
108 |
ac.highlight(this); |
|
109 |
}) |
|
110 |
.on('mouseout', function () { |
|
111 |
ac.unhighlight(this); |
|
112 |
}) |
|
113 |
.data('autocompleteValue', key) |
|
114 |
.appendTo(ul); |
|
115 |
} |
|
116 |
|
|
117 |
// Show popup with matches, if any. |
|
118 |
if (this.popup) { |
|
119 |
if (ul.children().length) { |
|
120 |
$(this.popup).empty().append(ul).show(); |
|
121 |
$(this.ariaLive).html(Drupal.t('Autocomplete popup')); |
|
122 |
} |
|
123 |
else { |
|
124 |
$(this.popup).css({visibility: 'hidden'}); |
|
125 |
this.hidePopup(); |
|
126 |
} |
|
127 |
} |
|
128 |
}; |
|
129 |
|
|
130 |
/** |
|
131 |
* Finds the next sibling item. |
|
132 |
*/ |
|
133 |
Drupal.jsAC.prototype.findNextSibling = function (element) { |
|
134 |
var sibling = element && element.nextSibling; |
|
135 |
if (sibling && !this.validItem(sibling)) { |
|
136 |
return this.findNextSibling(sibling.nextSibling); |
|
137 |
} |
|
138 |
return sibling; |
|
139 |
}; |
|
140 |
|
|
141 |
/** |
|
142 |
* Finds the previous sibling item. |
|
143 |
*/ |
|
144 |
Drupal.jsAC.prototype.findPreviousSibling = function (element) { |
|
145 |
var sibling = element && element.previousSibling; |
|
146 |
if (sibling && !this.validItem(sibling)) { |
|
147 |
return this.findPreviousSibling(sibling.previousSibling); |
|
148 |
} |
|
149 |
return sibling; |
|
150 |
}; |
|
151 |
|
|
152 |
/** |
|
153 |
* Highlights the next suggestion. |
|
154 |
*/ |
|
155 |
Drupal.jsAC.prototype.selectDown = function () { |
|
156 |
var sibling = this.findNextSibling(this.selected); |
|
157 |
if (sibling) { |
|
158 |
this.highlight(sibling); |
|
159 |
} |
|
160 |
else if (this.popup) { |
|
161 |
var lis = $('li', this.popup); |
|
162 |
if (lis.length > 0) { |
|
163 |
if (this.validItem(lis[0])) { |
|
164 |
this.highlight(lis[0]); |
|
165 |
} |
|
166 |
else { |
|
167 |
this.highlight(this.findNextSibling(lis[0])); |
|
168 |
} |
|
169 |
} |
|
170 |
} |
|
171 |
}; |
|
172 |
|
|
173 |
/** |
|
174 |
* Highlights the previous suggestion. |
|
175 |
*/ |
|
176 |
Drupal.jsAC.prototype.selectUp = function () { |
|
177 |
var sibling = this.findPreviousSibling(this.selected); |
|
178 |
if (sibling) { |
|
179 |
this.highlight(sibling); |
|
180 |
} |
|
181 |
else if (this.popup) { |
|
182 |
var lis = $('li', this.popup); |
|
183 |
if (lis.length > 0) { |
|
184 |
if (this.validItem(lis[lis.length - 1])) { |
|
185 |
this.highlight(lis[lis.length - 1]); |
|
186 |
} |
|
187 |
else { |
|
188 |
this.highlight(this.findPreviousSibling(lis[lis.length - 1])); |
|
189 |
} |
|
190 |
} |
|
114 | 191 |
} |
115 |
else { |
|
116 |
$(this.popup).css({ visibility: 'hidden' }); |
|
117 |
this.hidePopup(); |
|
192 |
}; |
|
193 |
|
|
194 |
/** |
|
195 |
* Ensures the item is valid. |
|
196 |
*/ |
|
197 |
Drupal.jsAC.prototype.validItem = function (element) { |
|
198 |
return !$(element).is('.dropdown-header, .divider, .disabled'); |
|
199 |
}; |
|
200 |
|
|
201 |
Drupal.jsAC.prototype.setStatus = function (status) { |
|
202 |
var $throbber = $(this.input).parent().find('.glyphicon-refresh, .autocomplete-throbber').first(); |
|
203 |
var throbbingClass = $throbber.is('.autocomplete-throbber') ? 'throbbing' : 'glyphicon-spin'; |
|
204 |
switch (status) { |
|
205 |
case 'begin': |
|
206 |
$throbber.addClass(throbbingClass); |
|
207 |
$(this.ariaLive).html(Drupal.t('Searching for matches...')); |
|
208 |
break; |
|
209 |
case 'cancel': |
|
210 |
case 'error': |
|
211 |
case 'found': |
|
212 |
$throbber.removeClass(throbbingClass); |
|
213 |
break; |
|
118 | 214 |
} |
119 |
} |
|
120 |
}; |
|
121 |
|
|
122 |
Drupal.jsAC.prototype.setStatus = function (status) { |
|
123 |
var $throbber = $(this.input).parent().find('.glyphicon-refresh, .autocomplete-throbber').first(); |
|
124 |
var throbbingClass = $throbber.is('.autocomplete-throbber') ? 'throbbing' : 'glyphicon-spin'; |
|
125 |
switch (status) { |
|
126 |
case 'begin': |
|
127 |
$throbber.addClass(throbbingClass); |
|
128 |
$(this.ariaLive).html(Drupal.t('Searching for matches...')); |
|
129 |
break; |
|
130 |
case 'cancel': |
|
131 |
case 'error': |
|
132 |
case 'found': |
|
133 |
$throbber.removeClass(throbbingClass); |
|
134 |
break; |
|
135 |
} |
|
136 |
}; |
|
137 |
|
|
138 |
// Save the previous autocomplete prototype. |
|
139 |
var oldPrototype = Drupal.jsAC.prototype; |
|
140 |
|
|
141 |
/** |
|
142 |
* Override the autocomplete constructor. |
|
143 |
*/ |
|
144 |
Drupal.jsAC = function ($input, db, context) { |
|
145 |
var ac = this; |
|
146 |
|
|
147 |
// Context is normally passed by Drupal.behaviors.autocomplete above. However, |
|
148 |
// if a module has manually invoked this method they will likely not know |
|
149 |
// about this feature and a global fallback context to document must be used. |
|
150 |
// @see https://www.drupal.org/node/2594243 |
|
151 |
// @see https://www.drupal.org/node/2315295 |
|
152 |
this.$context = context && $(context) || $(document); |
|
153 |
|
|
154 |
this.input = $input[0]; |
|
155 |
this.ariaLive = this.$context.find('#' + this.input.id + '-autocomplete-aria-live'); |
|
156 |
this.db = db; |
|
157 |
$input |
|
158 |
.keydown(function (event) { return ac.onkeydown(this, event); }) |
|
159 |
.keyup(function (event) { ac.onkeyup(this, event); }) |
|
160 |
.blur(function () { ac.hidePopup(); ac.db.cancel(); }); |
|
161 |
}; |
|
162 |
|
|
163 |
// Restore the previous prototype. |
|
164 |
Drupal.jsAC.prototype = oldPrototype; |
|
215 |
}; |
|
216 |
|
|
217 |
// Save the previous autocomplete prototype. |
|
218 |
var oldPrototype = Drupal.jsAC.prototype; |
|
219 |
|
|
220 |
/** |
|
221 |
* Override the autocomplete constructor. |
|
222 |
*/ |
|
223 |
Drupal.jsAC = function ($input, db, context) { |
|
224 |
var ac = this; |
|
225 |
|
|
226 |
// Context is normally passed by Drupal.behaviors.autocomplete above. However, |
|
227 |
// if a module has manually invoked this method they will likely not know |
|
228 |
// about this feature and a global fallback context to document must be used. |
|
229 |
// @see https://www.drupal.org/node/2594243 |
|
230 |
// @see https://www.drupal.org/node/2315295 |
|
231 |
this.$context = context && $(context) || $(document); |
|
232 |
|
|
233 |
this.input = $input[0]; |
|
234 |
this.ariaLive = this.$context.find('#' + this.input.id + '-autocomplete-aria-live'); |
|
235 |
this.db = db; |
|
236 |
$input |
|
237 |
.keydown(function (event) { |
|
238 |
return ac.onkeydown(this, event); |
|
239 |
}) |
|
240 |
.keyup(function (event) { |
|
241 |
ac.onkeyup(this, event); |
|
242 |
}) |
|
243 |
.blur(function () { |
|
244 |
ac.hidePopup(); |
|
245 |
ac.db.cancel(); |
|
246 |
}); |
|
247 |
}; |
|
248 |
|
|
249 |
// Restore the previous prototype. |
|
250 |
Drupal.jsAC.prototype = oldPrototype; |
|
165 | 251 |
|
166 | 252 |
})(jQuery); |
drupal7/sites/all/themes/bootstrap/js/modules/user/user.js | ||
---|---|---|
27 | 27 |
$input: this.$wrapper.find('input.password-confirm') |
28 | 28 |
}; |
29 | 29 |
this.confirm.$wrapper = this.confirm.$input.parent().addClass('col-sm-6 col-md-4 has-feedback').appendTo(self.$row); |
30 |
this.confirm.$icon = $('<span class="glyphicon form-control-feedback"></span>'); |
|
30 |
this.confirm.$icon = $('<span class="glyphicon form-control-feedback"></span>').appendTo(this.confirm.$wrapper);
|
|
31 | 31 |
|
32 | 32 |
// Bind events. |
33 | 33 |
this.password.$input.on('keyup focus blur', function () { |
drupal7/sites/all/themes/bootstrap/templates/image/image-widget.func.php | ||
---|---|---|
35 | 35 |
} |
36 | 36 |
else { |
37 | 37 |
$element['upload']['#prefix'] = '<div class="input-group">'; |
38 |
$element['upload']['#suffix'] = '</div>'; |
|
38 | 39 |
$element['upload_button']['#prefix'] = '<span class="input-group-btn">'; |
39 |
$element['upload_button']['#suffix'] = '</span></div>';
|
|
40 |
$element['upload_button']['#suffix'] = '</span>'; |
|
40 | 41 |
} |
41 | 42 |
|
42 | 43 |
$output .= drupal_render_children($element); |
drupal7/sites/all/themes/bootstrap/templates/menu/menu-local-task.func.php | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* @file |
|
4 |
* Stub file for bootstrap_menu_local_task(). |
|
5 |
*/ |
|
6 |
|
|
7 |
/** |
|
8 |
* Returns HTML for a single local task link. |
|
9 |
* |
|
10 |
* @param array $variables |
|
11 |
* An associative array containing: |
|
12 |
* - element: A render element containing: |
|
13 |
* - #link: A menu link array with 'title', 'href', and 'localized_options' |
|
14 |
* keys. |
|
15 |
* - #active: A boolean indicating whether the local task is active. |
|
16 |
* |
|
17 |
* @return string |
|
18 |
* The constructed HTML. |
|
19 |
* |
|
20 |
* @see theme_menu_local_task() |
|
21 |
* |
|
22 |
* @ingroup theme_functions |
|
23 |
*/ |
|
24 |
function bootstrap_menu_local_task($variables) { |
|
25 |
$link = $variables['element']['#link']; |
|
26 |
|
|
27 |
$options = isset($link['localized_options']) ? $link['localized_options'] : array(); |
|
28 |
|
|
29 |
// Filter the title if the "html" is not set, otherwise l() will automatically |
|
30 |
// sanitize using check_plain(), so no need to call that here. |
|
31 |
$title = empty($options['html']) ? filter_xss_admin($link['title']) : $link['title']; |
|
32 |
|
|
33 |
$href = $link['href']; |
|
34 |
$attributes = array(); |
|
35 |
|
|
36 |
// Add text to indicate active tab for non-visual users. |
|
37 |
if (!empty($variables['element']['#active'])) { |
|
38 |
$options['html'] = TRUE; |
|
39 |
$attributes['class'][] = 'active'; |
|
40 |
$title = t('!local-task-title!active', array( |
|
41 |
'!local-task-title' => $title, |
|
42 |
'!active' => '<span class="element-invisible">' . t('(active tab)') . '</span>', |
|
43 |
)); |
|
44 |
} |
|
45 |
|
|
46 |
return '<li' . drupal_attributes($attributes) . '>' . l($title, $href, $options) . "</li>\n"; |
|
47 |
} |
drupal7/sites/all/themes/bootstrap/templates/system/html.vars.php | ||
---|---|---|
18 | 18 |
// @see https://www.drupal.org/node/1077566 |
19 | 19 |
// @see https://www.drupal.org/node/1164926 |
20 | 20 |
|
21 |
// HTML element attributes. |
|
21 |
// Create a dedicated attributes array for the HTML element. |
|
22 |
// By default, core does not provide a way to target the HTML element. |
|
23 |
// The only arrays currently available technically belong to the BODY element. |
|
22 | 24 |
$variables['html_attributes_array'] = array( |
23 | 25 |
'lang' => $variables['language']->language, |
24 | 26 |
'dir' => $variables['language']->dir, |
... | ... | |
36 | 38 |
$variables['rdf_namespaces'] = drupal_attributes($rdf); |
37 | 39 |
} |
38 | 40 |
|
39 |
// BODY element attributes. |
|
40 |
$variables['body_attributes_array'] = array( |
|
41 |
'class' => &$variables['classes_array'], |
|
42 |
); |
|
43 |
$variables['body_attributes_array'] += $variables['attributes_array']; |
|
41 |
// Create a dedicated attributes array for the BODY element. |
|
42 |
if (!isset($variables['body_attributes_array'])) { |
|
43 |
$variables['body_attributes_array'] = array(); |
|
44 |
} |
|
45 |
|
|
46 |
// Ensure there is at least a class array. |
|
47 |
if (!isset($variables['body_attributes_array']['class'])) { |
|
48 |
$variables['body_attributes_array']['class'] = array(); |
|
49 |
} |
|
44 | 50 |
|
45 | 51 |
// Navbar position. |
46 | 52 |
switch (bootstrap_setting('navbar_position')) { |
... | ... | |
63 | 69 |
* |
64 | 70 |
* See template for list of available variables. |
65 | 71 |
* |
72 |
* **WARNING**: It is not recommended that this function be copied to a |
|
73 |
* sub-theme. There is rarely any need to process the same variables twice. |
|
74 |
* |
|
75 |
* If you need to add something to the "html_attributes_array" or |
|
76 |
* "body_attributes_array" arrays, you should do so in a hook_preprocess_html() |
|
77 |
* function since process functions will always run after all preprocess |
|
78 |
* functions have been executed. |
|
79 |
* |
|
80 |
* If there is a need to implement a hook_process_html() function in your |
|
81 |
* sub-theme (to process your own custom variables), ensure that it doesn't |
|
82 |
* add this base theme's logic and risk introducing breakage and performance |
|
83 |
* issues. |
|
84 |
* |
|
66 | 85 |
* @see html.tpl.php |
67 | 86 |
* |
68 | 87 |
* @ingroup theme_process |
69 | 88 |
*/ |
70 | 89 |
function bootstrap_process_html(&$variables) { |
90 |
// Merge in (not reference!) core's ambiguous and separate "attribute" and |
|
91 |
// "class" arrays. These arrays are meant for the BODY element, but it must |
|
92 |
// be done at the process level in case sub-themes wish to add classes to |
|
93 |
// core's non-standard arrays (which are for the BODY element only). |
|
94 |
// @see https://www.drupal.org/node/2868426 |
|
95 |
$variables['body_attributes_array'] = drupal_array_merge_deep($variables['body_attributes_array'], $variables['attributes_array']); |
|
96 |
|
|
97 |
// Use this project's class helper (to eliminate any duplicate classes). |
|
98 |
_bootstrap_add_class($variables['classes_array'], $variables, 'body_attributes_array'); |
|
99 |
|
|
100 |
// Finally, convert the arrays into proper attribute strings. |
|
71 | 101 |
$variables['html_attributes'] = drupal_attributes($variables['html_attributes_array']); |
72 | 102 |
$variables['body_attributes'] = drupal_attributes($variables['body_attributes_array']); |
73 | 103 |
} |
drupal7/sites/all/themes/bootstrap/templates/system/textfield.func.php | ||
---|---|---|
34 | 34 |
|
35 | 35 |
$output = '<input' . drupal_attributes($element['#attributes']) . ' />'; |
36 | 36 |
|
37 |
$extra = ''; |
|
38 | 37 |
if ($element['#autocomplete_path'] && !empty($element['#autocomplete_input'])) { |
39 | 38 |
drupal_add_library('system', 'drupal.autocomplete'); |
40 | 39 |
$element['#attributes']['class'][] = 'form-autocomplete'; |
41 | 40 |
|
42 |
$attributes = array(); |
|
43 |
$attributes['type'] = 'hidden'; |
|
44 |
$attributes['id'] = $element['#autocomplete_input']['#id']; |
|
45 |
$attributes['value'] = $element['#autocomplete_input']['#url_value']; |
|
46 |
$attributes['disabled'] = 'disabled'; |
|
47 |
$attributes['class'][] = 'autocomplete'; |
|
48 |
// Uses icon for autocomplete "throbber". |
|
49 |
if ($icon = _bootstrap_icon('refresh')) { |
|
50 |
$output = '<div class="input-group">' . $output . '<span class="input-group-addon">' . $icon . '</span></div>'; |
|
41 |
// Append a hidden autocomplete element. |
|
42 |
$autocomplete = array( |
|
43 |
'#type' => 'hidden', |
|
44 |
'#value' => $element['#autocomplete_input']['#url_value'], |
|
45 |
'#attributes' => array( |
|
46 |
'class' => array('autocomplete'), |
|
47 |
'disabled' => 'disabled', |
|
48 |
'id' => $element['#autocomplete_input']['#id'], |
|
49 |
), |
|
50 |
); |
|
51 |
$output .= drupal_render($autocomplete); |
|
52 |
|
|
53 |
// Append icon for autocomplete "throbber" or use core's default throbber |
|
54 |
// whose background image must be set here because sites may not be |
|
55 |
// at the root of the domain (ie: /) and this value cannot be set via CSS. |
|
56 |
if (!isset($element['#autocomplete_icon'])) { |
|
57 |
$element['#autocomplete_icon'] = _bootstrap_icon('refresh', '<span class="autocomplete-throbber" style="background-image:url(' . file_create_url('misc/throbber.gif') . ')"></span>'); |
|
51 | 58 |
} |
52 |
// Fallback to using core's throbber. |
|
53 |
else { |
|
54 |
$output = '<div class="input-group">' . $output . '<span class="input-group-addon">'; |
|
55 |
// The throbber's background image must be set here because sites may not |
|
56 |
// be at the root of the domain (ie: /) and this value cannot be set via |
|
57 |
// CSS. |
|
58 |
$output .= '<span class="autocomplete-throbber" style="background-image:url(' . file_create_url('misc/throbber.gif') . ')"></span>'; |
|
59 |
$output .= '</span></div>'; |
|
59 |
|
|
60 |
// Only add an icon if there is one. |
|
61 |
if ($element['#autocomplete_icon']) { |
|
62 |
$output .= '<span class="input-group-addon">' . $element['#autocomplete_icon'] . '</span>'; |
|
63 |
|
|
64 |
// Wrap entire element in a input group if not already in one. |
|
65 |
if (!isset($element['#input_group']) && !isset($element['#input_group_button'])) { |
|
66 |
$input_group_attributes = isset($element['#input_group_attributes']) ? $element['#input_group_attributes'] : array(); |
|
67 |
if (!isset($input_group_attributes['class'])) { |
|
68 |
$input_group_attributes['class'] = array(); |
|
69 |
} |
|
70 |
if (!in_array('input-group', $input_group_attributes['class'])) { |
|
71 |
$input_group_attributes['class'][] = 'input-group'; |
|
72 |
} |
|
73 |
$output = '<div' . drupal_attributes($input_group_attributes) . '>' . $output . '</div>'; |
|
74 |
} |
|
60 | 75 |
} |
61 |
$extra = '<input' . drupal_attributes($attributes) . ' />'; |
|
62 | 76 |
} |
63 | 77 |
|
64 |
return $output . $extra;
|
|
78 |
return $output; |
|
65 | 79 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules