Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 1fc0b06

Browse files
authored
Define arrays out of foreach
1 parent 39a75b6 commit 1fc0b06

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

includes/class-creativecommons-image.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ function add_image_license_metadata($form_fields, $post)
295295

296296
function save_image_license_metadata($post, $attachment)
297297
{
298-
foreach ( array( 'license_url', 'attribution_url', 'source_work_url', 'extra_permissions_url' ) as $field) {
298+
$image_meta = array( 'license_url', 'attribution_url', 'source_work_url', 'extra_permissions_url' );
299+
foreach ( $image_meta as $field ) {
299300
if (isset($attachment[$field])) {
300301
update_post_meta(
301302
$post['ID'],
@@ -304,7 +305,9 @@ function save_image_license_metadata($post, $attachment)
304305
);
305306
}
306307
}
307-
foreach ( array( 'attribution_name' ) as $field) {
308+
309+
$image_meta_no_sanitization = array( 'attribution_name' );
310+
foreach ( $image_meta_no_sanitization as $field ) {
308311
if (isset($attachment[$field])) {
309312
update_post_meta(
310313
$post['ID'],

0 commit comments

Comments
 (0)