Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
refactor: escape more HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
petenelson authored and rayrutjes committed Oct 17, 2018
1 parent b5c614f commit 38b5926
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
12 changes: 6 additions & 6 deletions includes/admin/class-algolia-admin-page-autocomplete.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ public function __construct( Algolia_Settings $settings, Algolia_Autocomplete_Co
public function add_page() {
add_menu_page(
'Algolia Search',
__( 'Algolia Search', 'algolia' ),
esc_html__( 'Algolia Search', 'algolia' ),
'manage_options',
'algolia',
array( $this, 'display_page' ),
''
);
add_submenu_page(
'algolia',
__( 'Autocomplete', 'algolia' ),
__( 'Autocomplete', 'algolia' ),
esc_html__( 'Autocomplete', 'algolia' ),
esc_html__( 'Autocomplete', 'algolia' ),
$this->capability,
$this->slug,
array( $this, 'display_page' )
Expand All @@ -76,15 +76,15 @@ public function add_settings() {

add_settings_field(
'algolia_autocomplete_enabled',
__( 'Enable autocomplete', 'algolia' ),
esc_html__( 'Enable autocomplete', 'algolia' ),
array( $this, 'autocomplete_enabled_callback' ),
$this->slug,
$this->section
);

add_settings_field(
'algolia_autocomplete_config',
__( 'Configuration', 'algolia' ),
esc_html__( 'Configuration', 'algolia' ),
array( $this, 'autocomplete_config_callback' ),
$this->slug,
$this->section
Expand Down Expand Up @@ -117,7 +117,7 @@ public function sanitize_autocomplete_enabled( $value ) {
add_settings_error(
$this->option_group,
'autocomplete_enabled',
__( 'Autocomplete configuration has been saved. Make sure to hit the "re-index" buttons of the different indices that are not indexed yet.', 'algolia' ),
esc_html__( 'Autocomplete configuration has been saved. Make sure to hit the "re-index" buttons of the different indices that are not indexed yet.', 'algolia' ),
'updated'
);

Expand Down
12 changes: 6 additions & 6 deletions includes/admin/class-algolia-admin-page-native-search.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public function __construct( Algolia_Plugin $plugin ) {
public function add_page() {
add_submenu_page(
'algolia',
__( 'Search Page', 'algolia' ),
__( 'Search Page', 'algolia' ),
esc_html__( 'Search Page', 'algolia' ),
esc_html__( 'Search Page', 'algolia' ),
$this->capability,
$this->slug,
array( $this, 'display_page' )
Expand All @@ -59,7 +59,7 @@ public function add_settings() {

add_settings_field(
'algolia_override_native_search',
__( 'Search results', 'algolia' ),
esc_html__( 'Search results', 'algolia' ),
array( $this, 'override_native_search_callback' ),
$this->slug,
$this->section
Expand All @@ -85,22 +85,22 @@ public function sanitize_override_native_search( $value ) {
add_settings_error(
$this->option_group,
'native_search_enabled',
__( 'WordPress search is now based on Algolia!', 'algolia' ),
esc_html__( 'WordPress search is now based on Algolia!', 'algolia' ),
'updated'
);
} elseif ( 'instantsearch' === $value ) {
add_settings_error(
$this->option_group,
'native_search_enabled',
__( 'WordPress search is now based on Algolia instantsearch.js!', 'algolia' ),
esc_html__( 'WordPress search is now based on Algolia instantsearch.js!', 'algolia' ),
'updated'
);
} else {
$value = 'native';
add_settings_error(
$this->option_group,
'native_search_disabled',
__( 'You chose to keep the WordPress native search instead of Algolia. If you are using the autocomplete feature of the plugin we highly recommend you turn Algolia search on instead of the WordPress native search.', 'algolia' ),
esc_html__( 'You chose to keep the WordPress native search instead of Algolia. If you are using the autocomplete feature of the plugin we highly recommend you turn Algolia search on instead of the WordPress native search.', 'algolia' ),
'updated'
);
}
Expand Down
32 changes: 16 additions & 16 deletions includes/admin/class-algolia-admin-page-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct( Algolia_Plugin $plugin ) {
public function add_action_links( array $links ) {
return array_merge(
$links, array(
'<a href="' . admin_url( 'admin.php?page=' . $this->slug ) . '">' . __( 'Settings' ) . '</a>',
'<a href="' . esc_url( admin_url( 'admin.php?page=' . $this->slug ) ) . '">' . esc_html__( 'Settings', 'algolia' ) . '</a>',
)
);
}
Expand All @@ -60,7 +60,7 @@ public function add_page() {
// Means this is the only reachable admin page, so make it the default one!
return add_menu_page(
'Algolia Search',
__( 'Algolia search', 'algolia' ),
esc_html__( 'Algolia search', 'algolia' ),
'manage_options',
$this->slug,
array( $this, 'display_page' ),
Expand All @@ -70,8 +70,8 @@ public function add_page() {

add_submenu_page(
'algolia',
__( 'Settings', 'algolia' ),
__( 'Settings', 'algolia' ),
esc_html__( 'Settings', 'algolia' ),
esc_html__( 'Settings', 'algolia' ),
$this->capability,
$this->slug,
array( $this, 'display_page' )
Expand All @@ -88,39 +88,39 @@ public function add_settings() {

add_settings_field(
'algolia_application_id',
__( 'Application ID', 'algolia' ),
esc_html__( 'Application ID', 'algolia' ),
array( $this, 'application_id_callback' ),
$this->slug,
$this->section
);

add_settings_field(
'algolia_search_api_key',
__( 'Search-only API key', 'algolia' ),
esc_html__( 'Search-only API key', 'algolia' ),
array( $this, 'search_api_key_callback' ),
$this->slug,
$this->section
);

add_settings_field(
'algolia_api_key',
__( 'Admin API key', 'algolia' ),
esc_html__( 'Admin API key', 'algolia' ),
array( $this, 'api_key_callback' ),
$this->slug,
$this->section
);

add_settings_field(
'algolia_index_name_prefix',
__( 'Index name prefix' ),
esc_html__( 'Index name prefix', 'algolia' ),
array( $this, 'index_name_prefix_callback' ),
$this->slug,
$this->section
);

add_settings_field(
'algolia_powered_by_enabled',
__( 'Remove Algolia powered by logo', 'algolia' ),
esc_html__( 'Remove Algolia powered by logo', 'algolia' ),
array( $this, 'powered_by_enabled_callback' ),
$this->slug,
$this->section
Expand Down Expand Up @@ -195,7 +195,7 @@ public function sanitize_application_id( $value ) {
add_settings_error(
$this->option_group,
'empty',
__( 'Application ID should not be empty.', 'algolia' )
esc_html__( 'Application ID should not be empty.', 'algolia' )
);

}
Expand All @@ -213,7 +213,7 @@ public function sanitize_search_api_key( $value ) {
add_settings_error(
$this->option_group,
'empty',
__( 'Search-only API key should not be empty.', 'algolia' )
esc_html__( 'Search-only API key should not be empty.', 'algolia' )
);
}

Expand All @@ -230,7 +230,7 @@ public function sanitize_api_key( $value ) {
add_settings_error(
$this->option_group,
'empty',
__( 'API key should not be empty', 'algolia' )
esc_html__( 'API key should not be empty', 'algolia' )
);
}
$errors = get_settings_errors( $this->option_group );
Expand All @@ -256,7 +256,7 @@ public function sanitize_api_key( $value ) {
add_settings_error(
$this->option_group,
'no_connection',
__(
esc_html__(
'We were unable to authenticate you against the Algolia servers with the provided information. Please ensure that you used an the Admin API key and a valid Application ID.',
'algolia'
)
Expand All @@ -267,7 +267,7 @@ public function sanitize_api_key( $value ) {
add_settings_error(
$this->option_group,
'wrong_search_API_key',
__(
esc_html__(
'It looks like your search API key is wrong. Ensure that the key you entered has only the search capability and nothing else. Also ensure that the key has no limited time validity.',
'algolia'
)
Expand All @@ -277,7 +277,7 @@ public function sanitize_api_key( $value ) {
add_settings_error(
$this->option_group,
'connection_success',
__( 'We succesfully managed to connect to the Algolia servers with the provided information. Your search API key has also been checked and is OK.', 'algolia' ),
esc_html__( 'We succesfully managed to connect to the Algolia servers with the provided information. Your search API key has also been checked and is OK.', 'algolia' ),
'updated'
);
$settings->set_api_is_reachable( true );
Expand Down Expand Up @@ -315,7 +315,7 @@ public function sanitize_index_name_prefix( $value ) {
add_settings_error(
$this->option_group,
'wrong_prefix',
__( 'Indices prefix can only contain alphanumeric characters and underscores.', 'algolia' )
esc_html__( 'Indices prefix can only contain alphanumeric characters and underscores.', 'algolia' )
);

$value = get_option( 'algolia_index_name_prefix' );
Expand Down

0 comments on commit 38b5926

Please sign in to comment.