You are here

protected function FileFieldPathsTextReplaceTestCase::getPathVariations in File (Field) Paths 7

Generates all variations of the URI for text replacement.

Parameters

$uri:

string $type:

Return value

mixed

1 call to FileFieldPathsTextReplaceTestCase::getPathVariations()
FileFieldPathsTextReplaceTestCase::testTextReplace in tests/filefield_paths.text_replace.test
Test text replace with multiple file uploads.

File

tests/filefield_paths.text_replace.test, line 31
Tests for the File (Field) Paths module.

Class

FileFieldPathsTextReplaceTestCase
Class FileFieldPathsTextReplaceTestCase

Code

protected function getPathVariations($uri, $type = 'image') {

  // Force clean urls on.
  $GLOBALS['conf']['clean_url'] = TRUE;
  $variations['uri'] = $uri;
  $variations['absolute'] = urldecode(file_create_url($uri));
  $variations['relative'] = parse_url($variations['absolute'], PHP_URL_PATH);
  if ($type == 'image') {
    $variations['image_style'] = urldecode(image_style_url('thumbnail', $uri));
    $variations['image_style_relative'] = parse_url($variations['image_style'], PHP_URL_PATH) . '?' . parse_url($variations['image_style'], PHP_URL_QUERY);
  }
  foreach ($variations as $key => $value) {
    $variations["{$key}_urlencode"] = urlencode($value);
    $variations["{$key}_drupal_encode_path"] = drupal_encode_path($value);
  }
  return $variations;
}