Prep Plugin for release on WordPress.org (#23)
* Update translation text domain * Escape everything that should be escaped. * Add nonce checks where needed. * Sanitize all inputs. * Apply Code style changes across the codebase. * Correct many deprecation notices. * Optimize load order of many filters. * Add Proper Build script * Use emojii flags * Fix i18n deprecation notice for translating too early * Put all scripts in footer and load async
This commit is contained in:
@ -11,14 +11,12 @@
|
||||
wp_enqueue_media();
|
||||
wp_enqueue_script('media');
|
||||
|
||||
$suffix = WU_Scripts()->suffix();
|
||||
|
||||
wp_enqueue_script('wu-field-button-upload', WP_Ultimo()->get_asset("wu-field-image$suffix.js", 'js'));
|
||||
wp_enqueue_script('wu-field-button-upload', wu_get_asset('wu-field-image.js', 'js'), [], wu_get_version(), true);
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="<?php echo $field_slug; ?>"><?php echo $field['title']; ?></label></th>
|
||||
<th scope="row"><label for="<?php echo esc_attr($field_slug); ?>"><?php echo esc_html($field['title']); ?></label></th>
|
||||
<td>
|
||||
|
||||
<?php
|
||||
@ -29,33 +27,32 @@ wp_enqueue_script('wu-field-button-upload', WP_Ultimo()->get_asset("wu-field-ima
|
||||
}
|
||||
|
||||
if ( $image_url ) {
|
||||
$image = '<img id="%s" src="%s" alt="%s" style="width:%s; height:auto">';
|
||||
printf(
|
||||
$image,
|
||||
$field_slug . '-preview',
|
||||
$image_url,
|
||||
get_bloginfo('name'),
|
||||
$field['width'] . 'px'
|
||||
'<img id="%s" src="%s" alt="%s" style="width:%s; height:auto">',
|
||||
esc_attr($field_slug . '-preview'),
|
||||
esc_attr($image_url),
|
||||
esc_attr(get_bloginfo('name')),
|
||||
esc_attr($field['width'] . 'px')
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
<br>
|
||||
|
||||
<a href="#" class="button wu-field-button-upload" data-target="<?php echo $field_slug; ?>">
|
||||
<?php echo $field['button']; ?>
|
||||
<a href="#" class="button wu-field-button-upload" data-target="<?php echo esc_attr($field_slug); ?>">
|
||||
<?php echo esc_html($field['button']); ?>
|
||||
</a>
|
||||
|
||||
<a data-default="<?php echo $field['default']; ?>" href="#" class="button wu-field-button-upload-remove" data-target="<?php echo $field_slug; ?>">
|
||||
<?php _e('Remove Image', 'wp-ultimo'); ?>
|
||||
<a data-default="<?php echo esc_attr($field['default']); ?>" href="#" class="button wu-field-button-upload-remove" data-target="<?php echo esc_attr($field_slug); ?>">
|
||||
<?php esc_html_e('Remove Image', 'wp-multisite-waas'); ?>
|
||||
</a>
|
||||
|
||||
<?php if ( ! empty($field['desc'])) : ?>
|
||||
<p class="description" id="<?php echo $field_slug; ?>-desc">
|
||||
<?php echo $field['desc']; ?>
|
||||
<p class="description" id="<?php echo esc_attr($field_slug); ?>-desc">
|
||||
<?php echo esc_html($field['desc']); ?>
|
||||
</p>
|
||||
|
||||
<input type="hidden" name="<?php echo $field_slug; ?>" id="<?php echo $field_slug; ?>" value="<?php echo wu_get_setting($field_slug) ?: $field['default']; ?>">
|
||||
<input type="hidden" name="<?php echo esc_attr($field_slug); ?>" id="<?php echo esc_attr($field_slug); ?>" value="<?php echo esc_attr(wu_get_setting($field_slug) ?: $field['default']); ?>">
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
@ -35,13 +35,13 @@
|
||||
unset($_settings[ $key ]);
|
||||
|
||||
continue;
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$value = $field['options'][ $key ];
|
||||
} // end foreach;
|
||||
}
|
||||
|
||||
$field['options'] = $_settings + $field['options'];
|
||||
} // end if;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -71,7 +71,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<button type="button" data-select-all="multiselect-<?php echo $field_slug; ?>" class="button wu-select-all"><?php _e('Check / Uncheck All', 'wp-ultimo'); ?></button>
|
||||
<button type="button" data-select-all="multiselect-<?php echo $field_slug; ?>" class="button wu-select-all"><?php esc_html_e('Check / Uncheck All', 'wp-multisite-waas'); ?></button>
|
||||
|
||||
<br>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
<label for="<?php echo esc_attr($field->id); ?>">
|
||||
|
||||
<?php echo $field->title; ?>
|
||||
<?php echo esc_html($field->title); ?>
|
||||
|
||||
</label>
|
||||
|
||||
@ -21,19 +21,19 @@
|
||||
|
||||
<div class="wu-w-2/3">
|
||||
|
||||
<input <?php echo $field->html_attr ? $field->get_html_attributes() : ''; ?> <?php echo $field->disabled ? 'disabled="disabled"' : ''; ?> name="<?php echo esc_attr($field->id); ?>" type="<?php echo esc_attr($field->type); ?>" id="<?php echo esc_attr($field->id); ?>" class="regular-text" value="<?php echo wu_get_setting($field->id); ?>" placeholder="<?php echo $field->placeholder ?: ''; ?>">
|
||||
<input <?php echo $field->html_attr ? $field->get_html_attributes() : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> <?php echo $field->disabled ? 'disabled="disabled"' : ''; ?> name="<?php echo esc_attr($field->id); ?>" type="<?php echo esc_attr($field->type); ?>" id="<?php echo esc_attr($field->id); ?>" class="regular-text" value="<?php echo esc_attr(wu_get_setting($field->id)); ?>" placeholder="<?php echo esc_attr($field->placeholder ?: ''); ?>">
|
||||
|
||||
<?php if (isset($field->append) && ! empty($field->append)) : ?>
|
||||
|
||||
<?php echo $field->append; ?>
|
||||
<?php echo $field->append; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($field->desc) : ?>
|
||||
|
||||
<p class="description" id="<?php echo $field->id; ?>-desc">
|
||||
<p class="description" id="<?php echo esc_attr($field->id); ?>-desc">
|
||||
|
||||
<?php echo $field->desc; ?>
|
||||
<?php echo $field->desc; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
|
||||
</p>
|
||||
|
||||
@ -43,6 +43,4 @@
|
||||
|
||||
</div>
|
||||
|
||||
<?php // if (isset($field['tooltip'])) {echo WU_Util::tooltip($field['tooltip']);} ?>
|
||||
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user