@@ -113,8 +113,7 @@ |
||
113 | 113 | '@second' => $usage[1], |
114 | 114 | '@count' => count($other_image_styles), |
115 | 115 | ]); |
116 | - } |
|
117 | - else { |
|
116 | + } else { |
|
118 | 117 | $usage_message = implode(', ', $usage); |
119 | 118 | } |
120 | 119 | $row['usage']['data']['#markup'] = $usage_message; |
@@ -129,7 +129,7 @@ |
||
129 | 129 | */ |
130 | 130 | public static function getCropTypeNames() { |
131 | 131 | return array_map( |
132 | - function ($bundle_info) { |
|
132 | + function($bundle_info) { |
|
133 | 133 | return $bundle_info['label']; |
134 | 134 | }, |
135 | 135 | \Drupal::service('entity_type.bundle.info')->getBundleInfo('crop') |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | $this->assertRaw($edit['description']); |
106 | 106 | |
107 | 107 | // See if crop type appears on image effect configuration form. |
108 | - $this->drupalGet('admin/config/media/image-styles/manage/' . $this->testStyle->id() . '/add/crop_crop'); |
|
108 | + $this->drupalGet('admin/config/media/image-styles/manage/'.$this->testStyle->id().'/add/crop_crop'); |
|
109 | 109 | $option = $this->xpath("//select[@id='edit-data-crop-type']/option"); |
110 | 110 | $this->assert(strpos($option[0]->asXML(), $edit['label']) !== FALSE, 'Crop type label found on image effect page.'); |
111 | - $this->drupalPostForm('admin/config/media/image-styles/manage/' . $this->testStyle->id() . '/add/crop_crop', ['data[crop_type]' => $edit['id']], t('Add effect')); |
|
111 | + $this->drupalPostForm('admin/config/media/image-styles/manage/'.$this->testStyle->id().'/add/crop_crop', ['data[crop_type]' => $edit['id']], t('Add effect')); |
|
112 | 112 | $this->assertText(t('The image effect was successfully applied.')); |
113 | 113 | $this->assertText(t('Manual crop uses @name crop type', ['@name' => $edit['label']])); |
114 | 114 | $this->testStyle = $this->container->get('entity.manager')->getStorage('image_style')->loadUnchanged($this->testStyle->id()); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | // Try to access edit form as anonymous user. |
124 | 124 | $this->drupalLogout(); |
125 | - $this->drupalGet('admin/config/media/crop/manage/' . $edit['id']); |
|
125 | + $this->drupalGet('admin/config/media/crop/manage/'.$edit['id']); |
|
126 | 126 | $this->assertResponse(403); |
127 | 127 | $this->drupalLogin($this->adminUser); |
128 | 128 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $this->assertLink('Test image style'); |
136 | 136 | $this->clickLink(t('Delete')); |
137 | 137 | $this->assertText(t('Are you sure you want to delete the crop type @name?', ['@name' => $edit['label']])); |
138 | - $this->drupalPostForm('admin/config/media/crop/manage/' . $edit['id'] . '/delete', [], t('Delete')); |
|
138 | + $this->drupalPostForm('admin/config/media/crop/manage/'.$edit['id'].'/delete', [], t('Delete')); |
|
139 | 139 | $this->assertRaw(t('The crop type %name has been deleted.', ['%name' => $edit['label']])); |
140 | 140 | $this->assertText(t('No crop types available.')); |
141 | 141 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | protected function doTestFileUriAlter() { |
149 | 149 | // Get the test file. |
150 | - file_unmanaged_copy(drupal_get_path('module', 'crop') . '/tests/files/sarajevo.png', PublicStream::basePath()); |
|
150 | + file_unmanaged_copy(drupal_get_path('module', 'crop').'/tests/files/sarajevo.png', PublicStream::basePath()); |
|
151 | 151 | $file_uri = 'public://sarajevo.png'; |
152 | 152 | $file = File::create(['uri' => $file_uri, 'status' => FILE_STATUS_PERMANENT]); |
153 | 153 | $file->save(); |
@@ -173,13 +173,13 @@ discard block |
||
173 | 173 | // This triggers crop_file_url_alter(). |
174 | 174 | $altered_image_style_url = file_create_url($image_style_url); |
175 | 175 | |
176 | - $shortened_hash = substr(md5(implode($crop->position()) . implode($crop->anchor())), 0, 8); |
|
176 | + $shortened_hash = substr(md5(implode($crop->position()).implode($crop->anchor())), 0, 8); |
|
177 | 177 | $this->assertTrue(strpos($altered_image_style_url, $shortened_hash) !== FALSE, 'The image style URL contains a shortened hash.'); |
178 | 178 | |
179 | 179 | // Update the crop to assert the hash has changed. |
180 | 180 | $crop->setPosition('80', '80')->save(); |
181 | 181 | $old_hash = $shortened_hash; |
182 | - $new_hash = substr(md5(implode($crop->position()) . implode($crop->anchor())), 0, 8); |
|
182 | + $new_hash = substr(md5(implode($crop->position()).implode($crop->anchor())), 0, 8); |
|
183 | 183 | $altered_image_style_url = file_create_url($image_style_url); |
184 | 184 | $this->assertFalse(strpos($altered_image_style_url, $old_hash) !== FALSE, 'The image style URL does not contain the old hash.'); |
185 | 185 | $this->assertTrue(strpos($altered_image_style_url, $new_hash) !== FALSE, 'The image style URL contains an updated hash.'); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | function crop_file_url_alter(&$uri) { |
116 | 116 | // Process only files that are stored in "styles" directory. |
117 | - if (strpos($uri, PublicStream::basePath() . '/styles/') !== FALSE) { |
|
117 | + if (strpos($uri, PublicStream::basePath().'/styles/') !== FALSE) { |
|
118 | 118 | // Handle the case of multiple "/styles/" in URI. |
119 | 119 | $uri_parts = explode('/styles/', $uri); |
120 | 120 | $image_style_part = end($uri_parts); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | // Get the file path without query parameter. |
126 | 126 | $parsed_uri = parse_url($match[3]); |
127 | 127 | // Get the file URI using parsed schema and file path. |
128 | - $file_uri = $match[2] . '://' . $parsed_uri['path']; |
|
128 | + $file_uri = $match[2].'://'.$parsed_uri['path']; |
|
129 | 129 | |
130 | 130 | /** @var \Drupal\image\Entity\ImageStyle $image_style */ |
131 | 131 | if (!$image_style = ImageStyle::load($image_style)) { |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | if ($crop_type && $crop = Crop::findCrop($file_uri, $crop_type)) { |
148 | 148 | // Found a crop for this image, append a hash of it to the URL, |
149 | 149 | // so that browsers reload the image and CDNs and proxies can be bypassed. |
150 | - $shortened_hash = substr(md5(implode($crop->position()) . implode($crop->anchor())), 0, 8); |
|
151 | - $uri .= '&h=' . $shortened_hash; |
|
150 | + $shortened_hash = substr(md5(implode($crop->position()).implode($crop->anchor())), 0, 8); |
|
151 | + $uri .= '&h='.$shortened_hash; |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | } |
@@ -173,8 +173,7 @@ |
||
173 | 173 | |
174 | 174 | if ($status == SAVED_UPDATED) { |
175 | 175 | drupal_set_message($this->t('The crop type %name has been updated.', $t_args)); |
176 | - } |
|
177 | - elseif ($status == SAVED_NEW) { |
|
176 | + } elseif ($status == SAVED_NEW) { |
|
178 | 177 | drupal_set_message($this->t('The crop type %name has been added.', $t_args)); |
179 | 178 | $context = array_merge($t_args, array('link' => Link::createFromRoute($this->t('View'), 'crop.overview_types')->toString())); |
180 | 179 | $this->logger('crop')->notice('Added crop type %name.', $context); |