update to 7.22

Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
bachy
2013-05-24 13:03:57 +02:00
parent d5097a4bc6
commit 5658794f17
265 changed files with 5551 additions and 8808 deletions

View File

@@ -326,7 +326,7 @@ function image_style_delete_form_submit($form, &$form_state) {
/**
* Confirmation form to revert a database style to its default.
*/
function image_style_revert_form($form, $form_state, $style) {
function image_style_revert_form($form, &$form_state, $style) {
$form_state['image_style'] = $style;
return confirm_form(

View File

@@ -7,8 +7,8 @@ dependencies[] = file
files[] = image.test
configure = admin/config/media/image-styles
; Information added by drupal.org packaging script on 2013-03-07
version = "7.21"
; Information added by drupal.org packaging script on 2013-04-03
version = "7.22"
project = "drupal"
datestamp = "1362616996"
datestamp = "1365027012"

View File

@@ -391,7 +391,8 @@ function image_update_7002(array &$sandbox) {
}
// Process the table at the top of the list.
$table = reset(array_keys($sandbox['tables']));
$keys = array_keys($sandbox['tables']);
$table = reset($keys);
$sandbox['processed'] += _image_update_7002_populate_dimensions($table, $sandbox['tables'][$table], $sandbox['last_fid']);
// Has the table been fully processed?

View File

@@ -254,7 +254,7 @@ function image_form_system_file_system_settings_alter(&$form, &$form_state) {
}
/**
* Submit handler for the file system settings form.
* Form submission handler for system_file_system_settings().
*
* Adds a menu rebuild after the public file path has been changed, so that the
* menu router item depending on that file path will be regenerated.
@@ -312,9 +312,9 @@ function image_file_download($uri) {
return -1;
}
// Private file access for the original files. Note that we only
// check access for non-temporary images, since file.module will
// grant access for all temporary files.
// Private file access for the original files. Note that we only check access
// for non-temporary images, since file.module will grant access for all
// temporary files.
$files = file_load_multiple(array(), array('uri' => $uri));
if (count($files)) {
$file = reset($files);
@@ -537,7 +537,7 @@ function image_field_update_instance($instance, $prior_instance) {
}
/**
* Clear cached versions of a specific file in all styles.
* Clears cached versions of a specific file in all styles.
*
* @param $path
* The Drupal file path to the original image.
@@ -553,7 +553,7 @@ function image_path_flush($path) {
}
/**
* Get an array of all styles and their settings.
* Gets an array of all styles and their settings.
*
* @return
* An array of styles keyed by the image style ID (isid).
@@ -614,7 +614,9 @@ function image_styles() {
}
/**
* Load a style by style name or ID. May be used as a loader for menu items.
* Loads a style by style name or ID.
*
* May be used as a loader for menu items.
*
* @param $name
* The name of the style.
@@ -623,6 +625,7 @@ function image_styles() {
* @param $include
* If set, this loader will restrict to a specific type of image style, may be
* one of the defined Image style storage constants.
*
* @return
* An image style array containing the following keys:
* - "isid": The unique image style ID.
@@ -660,12 +663,20 @@ function image_style_load($name = NULL, $isid = NULL, $include = NULL) {
}
/**
* Save an image style.
* Saves an image style.
*
* @param style
* An image style array.
* @return
* An image style array. In the case of a new style, 'isid' will be populated.
* @param array $style
* An image style array containing:
* - name: A unique name for the style.
* - isid: (optional) An image style ID.
*
* @return array
* An image style array containing:
* - name: An unique name for the style.
* - old_name: The original name for the style.
* - isid: An image style ID.
* - is_new: TRUE if this is a new style, and FALSE if it is an existing
* style.
*/
function image_style_save($style) {
if (isset($style['isid']) && is_numeric($style['isid'])) {
@@ -692,13 +703,14 @@ function image_style_save($style) {
}
/**
* Delete an image style.
* Deletes an image style.
*
* @param $style
* An image style array.
* @param $replacement_style_name
* (optional) When deleting a style, specify a replacement style name so
* that existing settings (if any) may be converted to a new style.
*
* @return
* TRUE on success.
*/
@@ -717,14 +729,17 @@ function image_style_delete($style, $replacement_style_name = '') {
}
/**
* Load all the effects for an image style.
* Loads all the effects for an image style.
*
* @param $style
* An image style array.
* @return
* @param array $style
* An image style array containing:
* - isid: The unique image style ID that contains this image effect.
*
* @return array
* An array of image effects associated with specified image style in the
* format array('isid' => array()), or an empty array if the specified style
* has no effects.
* @see image_effects()
*/
function image_style_effects($style) {
$effects = image_effects();
@@ -739,10 +754,11 @@ function image_style_effects($style) {
}
/**
* Get an array of image styles suitable for using as select list options.
* Gets an array of image styles suitable for using as select list options.
*
* @param $include_empty
* If TRUE a <none> option will be inserted in the options array.
*
* @return
* Array of image styles both key and value are set to style name.
*/
@@ -763,7 +779,7 @@ function image_style_options($include_empty = TRUE) {
}
/**
* Menu callback; Given a style and image path, generate a derivative.
* Page callback: Generates a derivative, given a style and image path.
*
* After generating an image, transfer it to the requesting agent.
*
@@ -931,7 +947,7 @@ function image_style_transform_dimensions($style_name, array &$dimensions) {
}
/**
* Flush cached media for a style.
* Flushes cached media for a style.
*
* @param $style
* An image style array.
@@ -963,12 +979,13 @@ function image_style_flush($style) {
}
/**
* Return the URL for an image derivative given a style and image path.
* Returns the URL for an image derivative given a style and image path.
*
* @param $style_name
* The name of the style to be used with this image.
* @param $path
* The path to the image.
*
* @return
* The absolute URL where a style image can be downloaded, suitable for use
* in an <img> tag. Requesting the URL will cause the image to be created.
@@ -979,7 +996,7 @@ function image_style_url($style_name, $path) {
// The token query is added even if the 'image_allow_insecure_derivatives'
// variable is TRUE, so that the emitted links remain valid if it is changed
// back to the default FALSE.
$token_query = array(IMAGE_DERIVATIVE_TOKEN => image_style_path_token($style_name, $path));
$token_query = array(IMAGE_DERIVATIVE_TOKEN => image_style_path_token($style_name, file_stream_wrapper_uri_normalize($path)));
// If not using clean URLs, the image derivative callback is only available
// with the query string. If the file does not exist, use url() to ensure
@@ -1017,7 +1034,7 @@ function image_style_path_token($style_name, $uri) {
}
/**
* Return the URI of an image when using a style.
* Returns the URI of an image when using a style.
*
* The path returned by this function may not exist. The default generation
* method only creates images when they are requested by a user's browser.
@@ -1026,6 +1043,7 @@ function image_style_path_token($style_name, $uri) {
* The name of the style to be used with this image.
* @param $uri
* The URI or path to the image.
*
* @return
* The URI to an image style image.
* @see image_style_url()
@@ -1043,10 +1061,11 @@ function image_style_path($style_name, $uri) {
}
/**
* Save a default image style to the database.
* Saves a default image style to the database.
*
* @param style
* An image style array provided by a module.
*
* @return
* An image style array. The returned style array will include the new 'isid'
* assigned to the style.
@@ -1064,7 +1083,7 @@ function image_default_style_save($style) {
}
/**
* Revert the changes made by users to a default image style.
* Reverts the changes made by users to a default image style.
*
* @param style
* An image style array.
@@ -1081,7 +1100,10 @@ function image_default_style_revert($style) {
}
/**
* Pull in image effects exposed by modules implementing hook_image_effect_info().
* Returns a set of image effects.
*
* These image effects are exposed by modules implementing
* hook_image_effect_info().
*
* @return
* An array of image effects to be used when transforming images.
@@ -1123,7 +1145,7 @@ function image_effect_definitions() {
}
/**
* Load the definition for an image effect.
* Loads the definition for an image effect.
*
* The effect definition is a set of core properties for an image effect, not
* containing any user-settings. The definition defines various functions to
@@ -1135,6 +1157,7 @@ function image_effect_definitions() {
* The name of the effect definition to load.
* @param $style
* An image style array to which this effect will be added.
*
* @return
* An array containing the image effect definition with the following keys:
* - "effect": The unique name for the effect being performed. Usually prefixed
@@ -1162,7 +1185,7 @@ function image_effect_definition_load($effect, $style_name = NULL) {
}
/**
* Load all image effects from the database.
* Loads all image effects from the database.
*
* @return
* An array of all image effects.
@@ -1194,7 +1217,7 @@ function image_effects() {
}
/**
* Load a single image effect.
* Loads a single image effect.
*
* @param $ieid
* The image effect ID.
@@ -1203,6 +1226,7 @@ function image_effects() {
* @param $include
* If set, this loader will restrict to a specific type of image style, may be
* one of the defined Image style storage constants.
*
* @return
* An image effect array, consisting of the following keys:
* - "ieid": The unique image effect ID.
@@ -1224,10 +1248,11 @@ function image_effect_load($ieid, $style_name, $include = NULL) {
}
/**
* Save an image effect.
* Saves an image effect.
*
* @param $effect
* An image effect array.
*
* @return
* An image effect array. In the case of a new effect, 'ieid' will be set.
*/
@@ -1244,7 +1269,7 @@ function image_effect_save($effect) {
}
/**
* Delete an image effect.
* Deletes an image effect.
*
* @param $effect
* An image effect array.
@@ -1256,12 +1281,13 @@ function image_effect_delete($effect) {
}
/**
* Given an image object and effect, perform the effect on the file.
* Applies an image effect to the image object.
*
* @param $image
* An image object returned by image_load().
* @param $effect
* An image effect array.
*
* @return
* TRUE on success. FALSE if unable to perform the image effect on the image.
*/
@@ -1312,7 +1338,7 @@ function theme_image_style($variables) {
}
/**
* Accept a keyword (center, top, left, etc) and return it as a pixel offset.
* Accepts a keyword (center, top, left, etc) and returns it as a pixel offset.
*
* @param $value
* @param $current_pixels

View File

@@ -167,10 +167,17 @@ class ImageStylesPathAndUrlTestCase extends DrupalWebTestCase {
$this->_testImageStyleUrlAndPath('private', FALSE);
}
/**
* Test image_style_url() with a file URL that has an extra slash in it.
*/
function testImageStyleUrlExtraSlash() {
$this->_testImageStyleUrlAndPath('public', TRUE, TRUE);
}
/**
* Test image_style_url().
*/
function _testImageStyleUrlAndPath($scheme, $clean_url = TRUE) {
function _testImageStyleUrlAndPath($scheme, $clean_url = TRUE, $extra_slash = FALSE) {
// Make the default scheme neither "public" nor "private" to verify the
// functions work for other than the default scheme.
variable_set('file_default_scheme', 'temporary');
@@ -196,6 +203,15 @@ class ImageStylesPathAndUrlTestCase extends DrupalWebTestCase {
$this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
$generate_url = image_style_url($this->style_name, $original_uri);
// Ensure that the tests still pass when the file is generated by accessing
// a poorly constructed (but still valid) file URL that has an extra slash
// in it.
if ($extra_slash) {
$modified_uri = str_replace('://', ':///', $original_uri);
$this->assertNotEqual($original_uri, $modified_uri, 'An extra slash was added to the generated file URI.');
$generate_url = image_style_url($this->style_name, $modified_uri);
}
if (!$clean_url) {
$this->assertTrue(strpos($generate_url, '?q=') !== FALSE, 'When using non-clean URLS, the system path contains the query string.');
}
@@ -224,6 +240,12 @@ class ImageStylesPathAndUrlTestCase extends DrupalWebTestCase {
$this->drupalGet($generate_url);
$this->assertResponse(200, t('Image was generated at the URL.'));
// Make sure that access is denied for existing style files if we do not
// have access.
variable_del('image_module_test_file_download');
$this->drupalGet($generate_url);
$this->assertResponse(403, 'Confirmed that access is denied for the private image style.');
// Repeat this with a different file that we do not have access to and
// make sure that access is denied.
$file_noaccess = array_shift($files);
@@ -805,7 +827,6 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
// Only verify HTTP headers when using private scheme and the headers are
// sent by Drupal.
$this->assertEqual($this->drupalGetHeader('Content-Type'), 'image/png', t('Content-Type header was sent.'));
$this->assertEqual($this->drupalGetHeader('Content-Disposition'), 'inline; filename="' . $test_image->filename . '"', t('Content-Disposition header was sent.'));
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'private', t('Cache-Control header was sent.'));
// Log out and try to access the file.

View File

@@ -6,8 +6,8 @@ core = 7.x
files[] = image_module_test.module
hidden = TRUE
; Information added by drupal.org packaging script on 2013-03-07
version = "7.21"
; Information added by drupal.org packaging script on 2013-04-03
version = "7.22"
project = "drupal"
datestamp = "1362616996"
datestamp = "1365027012"