Skip to content

Commit

Permalink
change _e to esc_html_e
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdiraized committed Sep 9, 2024
1 parent a81944a commit 0274c4d
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions custom-api-creator.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,16 @@ public function render_api_details_meta_box($post)
?>
<table class="form-table">
<tr>
<th scope="row"><label for="custom_api_endpoint"><?php _e('API Endpoint', 'custom-api-creator'); ?></label></th>
<th scope="row"><label
for="custom_api_endpoint"><?php esc_html_e('API Endpoint', 'custom-api-creator'); ?></label></th>
<td>
<input type="text" id="custom_api_endpoint" name="custom_api_endpoint"
value="<?php echo esc_attr($endpoint); ?>" class="regular-text" required>
<p class="description"><?php _e('Example: my-custom-api/[parameter]', 'custom-api-creator'); ?></p>
<p class="description"><?php esc_html_e('Example: my-custom-api/[parameter]', 'custom-api-creator'); ?></p>
</td>
</tr>
<tr>
<th scope="row"><?php _e('API Sections', 'custom-api-creator'); ?></th>
<th scope="row"><?php esc_html_e('API Sections', 'custom-api-creator'); ?></th>
<td>
<div id="api_sections">
<?php
Expand All @@ -151,28 +152,28 @@ public function render_api_details_meta_box($post)
?>
</div>
<button type="button" id="add_section"
class="button"><?php _e('Add Section', 'custom-api-creator'); ?></button>
class="button"><?php esc_html_e('Add Section', 'custom-api-creator'); ?></button>
</td>
</tr>
<tr>
<th scope="row"><?php _e('Access Type', 'custom-api-creator'); ?></th>
<th scope="row"><?php esc_html_e('Access Type', 'custom-api-creator'); ?></th>
<td>
<fieldset>
<legend class="screen-reader-text"><?php _e('Access Type', 'custom-api-creator'); ?></legend>
<legend class="screen-reader-text"><?php esc_html_e('Access Type', 'custom-api-creator'); ?></legend>
<label>
<input type="radio" name="custom_api_access_type" value="public" <?php checked($access_type, 'public'); ?>>
<?php _e('Public', 'custom-api-creator'); ?>
<?php esc_html_e('Public', 'custom-api-creator'); ?>
</label>
<br>
<label>
<input type="radio" name="custom_api_access_type" value="private" <?php checked($access_type, 'private'); ?>>
<?php _e('Private', 'custom-api-creator'); ?>
<?php esc_html_e('Private', 'custom-api-creator'); ?>
</label>
</fieldset>
</td>
</tr>
<tr id="custom_api_roles_row" style="<?php echo $access_type === 'private' ? '' : 'display: none;'; ?>">
<th scope="row"><?php _e('User Roles', 'custom-api-creator'); ?></th>
<th scope="row"><?php esc_html_e('User Roles', 'custom-api-creator'); ?></th>
<td>
<?php foreach ($all_roles as $role => $name):
$checked = in_array($role, $roles);
Expand All @@ -193,14 +194,14 @@ private function render_section_fields($post_types, $all_taxonomies, $index, $se
<h4><?php printf(__('Section %d', 'custom-api-creator'), $index + 1); ?></h4>

Check failure on line 194 in custom-api-creator.php

View workflow job for this annotation

GitHub Actions / test

WordPress.WP.I18n.MissingTranslatorsComment

A function call to __() with texts containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders.

Check failure on line 194 in custom-api-creator.php

View workflow job for this annotation

GitHub Actions / test

WordPress.Security.EscapeOutput.OutputNotEscaped

All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.

Check failure on line 194 in custom-api-creator.php

View workflow job for this annotation

GitHub Actions / test

WordPress.Security.EscapeOutput.OutputNotEscaped

All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$index'.
<p>
<label>
<?php _e('Property Name:', 'custom-api-creator'); ?>
<?php esc_html_e('Property Name:', 'custom-api-creator'); ?>
<input type="text" name="custom_api_sections[<?php echo $index; ?>][name]"

Check failure on line 198 in custom-api-creator.php

View workflow job for this annotation

GitHub Actions / test

WordPress.Security.EscapeOutput.OutputNotEscaped

All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$index'.
value="<?php echo esc_attr($section['name']); ?>" class="regular-text">
</label>
</p>
<p>
<label>
<?php _e('Post Type:', 'custom-api-creator'); ?>
<?php esc_html_e('Post Type:', 'custom-api-creator'); ?>
<select name="custom_api_sections[<?php echo $index; ?>][post_type]" class="section-post-type">

Check failure on line 205 in custom-api-creator.php

View workflow job for this annotation

GitHub Actions / test

WordPress.Security.EscapeOutput.OutputNotEscaped

All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$index'.
<?php foreach ($post_types as $pt): ?>
<option value="<?php echo esc_attr($pt->name); ?>" <?php selected($section['post_type'], $pt->name); ?>>
Expand All @@ -211,7 +212,7 @@ private function render_section_fields($post_types, $all_taxonomies, $index, $se
</label>
</p>
<p>
<label><?php _e('Fields:', 'custom-api-creator'); ?></label><br>
<label><?php esc_html_e('Fields:', 'custom-api-creator'); ?></label><br>
<?php
$available_fields = array('title', 'content', 'excerpt', 'categories', 'tags');
foreach ($available_fields as $field):
Expand All @@ -223,7 +224,7 @@ private function render_section_fields($post_types, $all_taxonomies, $index, $se
<?php endforeach; ?>
</p>
<p>
<label><?php _e('Taxonomies:', 'custom-api-creator'); ?></label><br>
<label><?php esc_html_e('Taxonomies:', 'custom-api-creator'); ?></label><br>
<?php foreach ($all_taxonomies as $tax):
$checked = in_array($tax->name, $section['taxonomies']);
?>
Expand All @@ -233,7 +234,8 @@ private function render_section_fields($post_types, $all_taxonomies, $index, $se
<?php endforeach; ?>
</p>
<?php if ($index > 0): ?>
<button type="button" class="button remove-section"><?php _e('Remove Section', 'custom-api-creator'); ?></button>
<button type="button"
class="button remove-section"><?php esc_html_e('Remove Section', 'custom-api-creator'); ?></button>
<?php endif; ?>
</div>
<?php
Expand Down

0 comments on commit 0274c4d

Please sign in to comment.