-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#18 Update Context to 7.x-3.11 incl. SA-CONTRIB-2022-049
- Loading branch information
Jonathan Hunt
committed
Oct 5, 2022
1 parent
c5bab70
commit 0565143
Showing
11 changed files
with
1,228 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
339 changes: 339 additions & 0 deletions
339
docroot/sites/all/modules/contrib/imagecache_external/LICENSE.txt
Large diffs are not rendered by default.
Oops, something went wrong.
49 changes: 49 additions & 0 deletions
49
docroot/sites/all/modules/contrib/imagecache_external/README.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
======================== | ||
ABOUT | ||
------------------------ | ||
Imagecache External is a utility module that allows you to store external | ||
images on your server and apply your own imagecache (D6) / Image Styles (D7). | ||
|
||
======================== | ||
CONFIGURATION | ||
------------------------ | ||
To get the module to work, you need to visit | ||
admin/config/media/imagecache_external and either: | ||
|
||
- Add some domains to the whitelist -or- | ||
- De-activate whitelist functionality | ||
|
||
|
||
======================== | ||
USAGE INSTRUCTIONS | ||
------------------------ | ||
In your module or theme, you may call the following theme function to | ||
process an image via Imagecache External: | ||
|
||
<?php | ||
print theme('imagecache_external', array( | ||
'path' => 'https://drupal.org/files/druplicon.large_.png', | ||
'style_name'=> 'thumbnail', | ||
'alt' => 'Druplicon' | ||
)); | ||
|
||
or, in a render array, like this: | ||
|
||
<?php | ||
return array( | ||
'#theme' => 'imagecache_external', | ||
'#path' => 'https://drupal.org/files/druplicon.large_.png', | ||
'#style_name' => 'thumbnail', | ||
'#alt' => 'Druplicon', | ||
); | ||
?> | ||
|
||
You can also use external images without coding at all by adding an Text or | ||
Link field to a Node Type and then use the Imagecache External Image formatter. | ||
|
||
|
||
======================== | ||
ADDITIONAL RESOURCES | ||
------------------------ | ||
View the Imagecache External project page for additional information | ||
https://drupal.org/project/imagecache_external |
89 changes: 89 additions & 0 deletions
89
docroot/sites/all/modules/contrib/imagecache_external/imagecache_external.admin.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
/** | ||
* @file | ||
* Admin forms for this module. | ||
*/ | ||
|
||
/** | ||
* Form builder. | ||
*/ | ||
function imagecache_external_admin_form($form, $form_state) { | ||
$form = array(); | ||
|
||
$form['imagecache_directory'] = array( | ||
'#type' => 'textfield', | ||
'#title' => t('Imagecache Directory'), | ||
'#required' => TRUE, | ||
'#description' => t('Where, withing the files directory, should the downloaded images be stored?'), | ||
'#default_value' => variable_get('imagecache_directory', 'externals'), | ||
); | ||
|
||
$form['imagecache_external_management'] = array( | ||
'#type' => 'radios', | ||
'#title' => t('How should Drupal handle the files?'), | ||
'#description' => t('Managed files can be re-used elsewhere on the site, for instance in the Media Library if you use the Media module. Unmanaged files are not saved to the database, but can be cached using Image Styles.'), | ||
'#options' => array( | ||
'unmanaged' => t('Unmanaged: Only save the images to the files folder to be able to cache them. This is default.'), | ||
'managed' => t('Managed: Download the images and save its metadata to the database.'), | ||
), | ||
'#default_value' => variable_get('imagecache_external_management', 'unmanaged'), | ||
); | ||
|
||
$form['imagecache_external_use_whitelist'] = array( | ||
'#type' => 'checkbox', | ||
'#title' => t('Use whitelist'), | ||
'#description' => t('By default, all images are blocked except for images served from white-listed hosts. You can define hosts below.'), | ||
'#default_value' => variable_get('imagecache_external_use_whitelist', TRUE), | ||
); | ||
|
||
$form['imagecache_external_hosts'] = array( | ||
'#type' => 'textarea', | ||
'#title' => t('Imagecache External hosts'), | ||
'#description' => t('Add one host per line. You can use top-level domains to whitelist subdomains. Ex: staticflickr.com to whitelist farm1.staticflickr.com and farm2.staticflickr.com'), | ||
'#default_value' => variable_get('imagecache_external_hosts', ''), | ||
'#states' => array( | ||
'visible' => array( | ||
':input[name="imagecache_external_use_whitelist"]' => array('checked' => TRUE), | ||
), | ||
), | ||
); | ||
return system_settings_form($form); | ||
} | ||
|
||
/** | ||
* Validate callback for the admin form. | ||
*/ | ||
function imagecache_external_admin_form_validate($form, $form_state) { | ||
$scheme = file_default_scheme(); | ||
$directory = $scheme . '://' . $form_state['values']['imagecache_directory']; | ||
if (!file_prepare_directory($directory, FILE_CREATE_DIRECTORY)) { | ||
form_set_error('imagecache_directory', t('The directory %directory does not exist or is not writable.', array('%directory' => $directory))); | ||
watchdog('imagecache_external', 'The directory %directory does not exist or is not writable.', array('%directory' => $directory), WATCHDOG_ERROR); | ||
} | ||
} | ||
|
||
/** | ||
* Form builder. | ||
*/ | ||
function imagecache_external_flush_form($form, $form_state) { | ||
return confirm_form($form, | ||
t('Flush all external images?'), | ||
'admin/config/media/imagecache_external', | ||
t('Are you sure? This cannot be undone.'), | ||
t('Flush'), | ||
t('Cancel') | ||
); | ||
} | ||
|
||
/** | ||
* Submit handler. | ||
*/ | ||
function imagecache_external_flush_form_submit($form, &$form_state) { | ||
if (imagecache_external_flush_cache()) { | ||
drupal_set_message(t('Flushed external images')); | ||
} | ||
else { | ||
drupal_set_message(t('Could not flush external images'), 'error'); | ||
} | ||
$form_state['redirect'] = 'admin/config/media/imagecache_external'; | ||
} |
13 changes: 13 additions & 0 deletions
13
docroot/sites/all/modules/contrib/imagecache_external/imagecache_external.info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name = Imagecache External | ||
description = Allows you to fetch external images and use image styles on them. | ||
dependencies[] = image | ||
files[] = imagecache_external.test | ||
core = 7.x | ||
configure = admin/config/media/imagecache_external | ||
|
||
; Information added by Drupal.org packaging script on 2015-04-28 | ||
version = "7.x-2.1" | ||
core = "7.x" | ||
project = "imagecache_external" | ||
datestamp = "1430249582" | ||
|
74 changes: 74 additions & 0 deletions
74
docroot/sites/all/modules/contrib/imagecache_external/imagecache_external.install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
/** | ||
* @file | ||
* (Un)install and update functions. | ||
*/ | ||
|
||
/** | ||
* Implements hook_requirements(). | ||
*/ | ||
function imagecache_external_requirements($phase) { | ||
$requirements = array(); | ||
|
||
// Ensure translations don't break at install time. | ||
$t = get_t(); | ||
|
||
// Check the Imagecache External configuration. | ||
if ($phase == 'runtime') { | ||
$hosts = variable_get('imagecache_external_hosts', ''); | ||
$use_whitelist = variable_get('imagecache_external_use_whitelist', TRUE); | ||
if ($use_whitelist && empty($hosts)) { | ||
$requirements['imagecache_external'] = array( | ||
'title' => $t('Imagecache External'), | ||
'value' => $t('Not properly configured'), | ||
'description' => $t('The configuration is set to use a whitelist but no hostname(s) are configured. <a href="@link">Add one or more trusted hostnames</a> or <a href="@link">disable the whitelist functionality</a>.', array('@link' => url('admin/config/media/imagecache_external'))), | ||
'severity' => REQUIREMENT_WARNING, | ||
); | ||
} | ||
else { | ||
$requirements['imagecache_external'] = array( | ||
'title' => $t('Imagecache External'), | ||
'value' => $t('Properly configured'), | ||
'severity' => REQUIREMENT_OK, | ||
); | ||
} | ||
} | ||
|
||
return $requirements; | ||
} | ||
|
||
/** | ||
* Implements hook_uninstall(). | ||
*/ | ||
function imagecache_external_uninstall() { | ||
variable_del('imagecache_directory'); | ||
variable_del('imagecache_external_hosts'); | ||
variable_del('imagecache_external_option'); | ||
variable_del('imagecache_external_management'); | ||
variable_del('imagecache_external_allowed_mimetypes'); | ||
} | ||
|
||
/** | ||
* Set the File Mode to 'managed' as the new default is 'unmanaged'. | ||
*/ | ||
function imagecache_external_update_7100() { | ||
variable_set('imagecache_external_management', 'managed'); | ||
} | ||
|
||
/** | ||
* Set the Imagecache Externals directory to 'imagecache/external'. | ||
*/ | ||
function imagecache_external_update_7101() { | ||
variable_set('imagecache_directory', 'imagecache/external'); | ||
} | ||
|
||
/** | ||
* Change the white-/blacklist functionality to whitelist-only. | ||
*/ | ||
function imagecache_external_update_7102() { | ||
$use_whitelist = variable_get('imagecache_external_option', 'white') == 'white'; | ||
variable_set('imagecache_external_use_whitelist', $use_whitelist); | ||
variable_del('imagecache_external_option'); | ||
} | ||
|
||
|
Oops, something went wrong.