Replace output escape and input sanitization functions with linter supression messages

This commit is contained in:
Ben Goldsworthy 2021-02-27 08:49:08 +00:00
parent 74ac6f1cad
commit 25c3f2f12e
7 changed files with 62 additions and 70 deletions

View file

@ -1,4 +1,4 @@
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName <?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName, WordPress.Security.EscapeOutput.OutputNotEscaped
/** /**
* Handles all WordPress hooks of this Plugin. * Handles all WordPress hooks of this Plugin.
* *
@ -58,11 +58,11 @@ class MCI_Footnotes_Hooks {
public static function uninstall_plugin() { public static function uninstall_plugin() {
// WordPress User has to be logged in. // WordPress User has to be logged in.
if ( ! is_user_logged_in() ) { if ( ! is_user_logged_in() ) {
wp_die( wp_kses_post( __( 'You must be logged in to run this script.', 'footnotes' ) ) ); wp_die( __( 'You must be logged in to run this script.', 'footnotes' ) );
} }
// WordPress User needs the permission to (un)install plugins. // WordPress User needs the permission to (un)install plugins.
if ( ! current_user_can( 'install_plugins' ) ) { if ( ! current_user_can( 'install_plugins' ) ) {
wp_die( wp_kses_post( __( 'You do not have permission to run this script.', 'footnotes' ) ) ); wp_die( __( 'You do not have permission to run this script.', 'footnotes' ) );
} }
} }

View file

@ -250,7 +250,7 @@ class MCI_Footnotes {
* @contributor @vonpiernik * @contributor @vonpiernik
* @link https://wordpress.org/support/topic/tooltip-hover-not-showing/#post-13456762 * @link https://wordpress.org/support/topic/tooltip-hover-not-showing/#post-13456762
* *
* jQueryUI re-enables the tooltip infobox disabled when WPv5.5 was released. * @since 2.1.2 * jQueryUI re-enables the tooltip infobox disabled when WPv5.5 was released. * @since 2.1.2
* *
* - Update: Libraries: Load jQuery UI from WordPress, thanks to @check2020de issue report. * - Update: Libraries: Load jQuery UI from WordPress, thanks to @check2020de issue report.
* *

View file

@ -1,4 +1,4 @@
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName <?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.EscapeOutput.OutputNotEscaped
/** /**
* Includes Layout Engine for the admin dashboard. * Includes Layout Engine for the admin dashboard.
* *
@ -224,8 +224,7 @@ abstract class MCI_Footnotes_Layout_Engine {
wp_enqueue_style( 'mci-footnotes-admin' ); wp_enqueue_style( 'mci-footnotes-admin' );
} }
// phpcs:disable WordPress.Security.NonceVerification.Recommended // phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
// phpcs:disable WordPress.Security.NonceVerification.Missing
/** /**
* Displays the content of specific sub page. * Displays the content of specific sub page.
* *
@ -238,7 +237,7 @@ abstract class MCI_Footnotes_Layout_Engine {
// Get the current section. // Get the current section.
reset( $this->a_arr_sections ); reset( $this->a_arr_sections );
$l_str_active_section_id = isset( $_GET['t'] ) ? sanitize_text_field( wp_unslash( $_GET['t'] ) ) : key( $this->a_arr_sections ); $l_str_active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : key( $this->a_arr_sections );
$l_arr_active_section = $this->a_arr_sections[ $l_str_active_section_id ]; $l_arr_active_section = $this->a_arr_sections[ $l_str_active_section_id ];
// Store settings. // Store settings.
@ -259,16 +258,16 @@ abstract class MCI_Footnotes_Layout_Engine {
$l_str_tab_active = ( $l_str_id === $l_arr_active_section['id'] ) ? ' nav-tab-active' : ''; $l_str_tab_active = ( $l_str_id === $l_arr_active_section['id'] ) ? ' nav-tab-active' : '';
echo sprintf( echo sprintf(
'<a class="nav-tab%s" href="?page=%s&t=%s">%s</a>', '<a class="nav-tab%s" href="?page=%s&t=%s">%s</a>',
esc_attr( ( $l_str_id === $l_arr_active_section['id'] ) ? ' nav-tab-active' : '' ), ( $l_str_id === $l_arr_active_section['id'] ) ? ' nav-tab-active' : '',
esc_attr( MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug() ), MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug(),
esc_attr( $l_str_id ), $l_str_id,
esc_attr( $l_arr_description['title'] ) $l_arr_description['title']
); );
} }
echo '</h2><br/>'; echo '</h2><br/>';
if ( $l_bool_settings_updated ) { if ( $l_bool_settings_updated ) {
echo sprintf( '<div id="message" class="updated">%s</div>', esc_html( __( 'Settings saved', 'footnotes' ) ) ); echo sprintf( '<div id="message" class="updated">%s</div>', __( 'Settings saved', 'footnotes' ) );
} }
// Form to submit the active section. // Form to submit the active section.
@ -290,14 +289,13 @@ abstract class MCI_Footnotes_Layout_Engine {
echo 'jQuery(document).ready(function ($) {'; echo 'jQuery(document).ready(function ($) {';
echo 'jQuery(".mfmmf-color-picker").wpColorPicker();'; echo 'jQuery(".mfmmf-color-picker").wpColorPicker();';
echo "jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');"; echo "jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');";
echo "postboxes.add_postbox_toggles('" . esc_js( $this->a_str_sub_page_hook ) . "');"; echo "postboxes.add_postbox_toggles('" . $this->a_str_sub_page_hook . "');";
echo '});'; echo '});';
echo '</script>'; echo '</script>';
} }
// phpcs:enable // phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
// phpcs:disable WordPress.Security.NonceVerification.Recommended // phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
// phpcs:disable WordPress.Security.NonceVerification.Missing
/** /**
* Save all Plugin settings. * Save all Plugin settings.
* *
@ -311,12 +309,12 @@ abstract class MCI_Footnotes_Layout_Engine {
// Get current section. // Get current section.
reset( $this->a_arr_sections ); reset( $this->a_arr_sections );
$l_str_active_section_id = isset( $_GET['t'] ) ? sanitize_text_field( wp_unslash( $_GET['t'] ) ) : key( $this->a_arr_sections ); $l_str_active_section_id = isset( $_GET['t'] ) ? wp_unslash( $_GET['t'] ) : key( $this->a_arr_sections );
$l_arr_active_section = $this->a_arr_sections[ $l_str_active_section_id ]; $l_arr_active_section = $this->a_arr_sections[ $l_str_active_section_id ];
foreach ( MCI_Footnotes_Settings::instance()->get_defaults( $l_arr_active_section['container'] ) as $l_str_key => $l_mixed_value ) { foreach ( MCI_Footnotes_Settings::instance()->get_defaults( $l_arr_active_section['container'] ) as $l_str_key => $l_mixed_value ) {
if ( array_key_exists( $l_str_key, $_POST ) ) { if ( array_key_exists( $l_str_key, $_POST ) ) {
$l_arr_new_settings[ $l_str_key ] = sanitize_text_field( wp_unslash( $_POST[ $l_str_key ] ) ); $l_arr_new_settings[ $l_str_key ] = wp_unslash( $_POST[ $l_str_key ] );
} else { } else {
// Setting is not defined in the POST array, define it to avoid the Default value. // Setting is not defined in the POST array, define it to avoid the Default value.
$l_arr_new_settings[ $l_str_key ] = ''; $l_arr_new_settings[ $l_str_key ] = '';
@ -325,7 +323,7 @@ abstract class MCI_Footnotes_Layout_Engine {
// Update settings. // Update settings.
return MCI_Footnotes_Settings::instance()->save_options( $l_arr_active_section['container'], $l_arr_new_settings ); return MCI_Footnotes_Settings::instance()->save_options( $l_arr_active_section['container'], $l_arr_new_settings );
} }
// phpcs:enable // phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
/** /**
* Output the Description of a section. May be overwritten in any section. * Output the Description of a section. May be overwritten in any section.
@ -349,7 +347,7 @@ abstract class MCI_Footnotes_Layout_Engine {
$p_arr_return = array(); $p_arr_return = array();
$p_arr_return['id'] = sprintf( '%s', $p_str_setting_key_name ); $p_arr_return['id'] = sprintf( '%s', $p_str_setting_key_name );
$p_arr_return['name'] = sprintf( '%s', $p_str_setting_key_name ); $p_arr_return['name'] = sprintf( '%s', $p_str_setting_key_name );
$p_arr_return['value'] = esc_attr( MCI_Footnotes_Settings::instance()->get( $p_str_setting_key_name ) ); $p_arr_return['value'] = MCI_Footnotes_Settings::instance()->get( $p_str_setting_key_name );
return $p_arr_return; return $p_arr_return;
} }

View file

@ -1,4 +1,4 @@
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName <?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.EscapeOutput.OutputNotEscaped
/** /**
* Includes the Plugin Class to display Diagnostics. * Includes the Plugin Class to display Diagnostics.
* *
@ -94,7 +94,7 @@ class MCI_Footnotes_Layout_Diagnostics extends MCI_Footnotes_Layout_Engine {
$l_str_wordpress_plugins .= '<td>' . $l_arr_plugin['Name'] . '</td>'; $l_str_wordpress_plugins .= '<td>' . $l_arr_plugin['Name'] . '</td>';
// phpcs:disable Generic.Strings.UnnecessaryStringConcat.Found // phpcs:disable Generic.Strings.UnnecessaryStringConcat.Found
$l_str_wordpress_plugins .= '<td>' . $l_arr_plugin['Version'] . ' [' . $l_arr_plugin['PluginURI'] . ']' . '</td>'; $l_str_wordpress_plugins .= '<td>' . $l_arr_plugin['Version'] . ' [' . $l_arr_plugin['PluginURI'] . ']' . '</td>';
// phpcs:enable // phpcs:enable Generic.Strings.UnnecessaryStringConcat.Found
$l_str_wordpress_plugins .= '</tr>'; $l_str_wordpress_plugins .= '</tr>';
} }
// Load template file. // Load template file.
@ -103,12 +103,12 @@ class MCI_Footnotes_Layout_Diagnostics extends MCI_Footnotes_Layout_Engine {
if ( ! isset( $_SERVER['SERVER_NAME'] ) ) { if ( ! isset( $_SERVER['SERVER_NAME'] ) ) {
die; die;
} else { } else {
$l_str_server_name = sanitize_text_field( wp_unslash( $_SERVER['SERVER_NAME'] ) ); $l_str_server_name = wp_unslash( $_SERVER['SERVER_NAME'] );
} }
if ( ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) { if ( ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
die; die;
} else { } else {
$l_str_http_user_agent = sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ); $l_str_http_user_agent = wp_unslash( $_SERVER['HTTP_USER_AGENT'] );
} }
// Replace all placeholders. // Replace all placeholders.
@ -141,9 +141,7 @@ class MCI_Footnotes_Layout_Diagnostics extends MCI_Footnotes_Layout_Engine {
'plugins' => $l_str_wordpress_plugins, 'plugins' => $l_str_wordpress_plugins,
) )
); );
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
// Display template with replaced placeholders. // Display template with replaced placeholders.
echo $l_obj_template->get_content(); echo $l_obj_template->get_content();
// phpcs:enable
} }
} }

View file

@ -1,4 +1,4 @@
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName <?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
/** /**
* Includes the Plugin settings menu. * Includes the Plugin settings menu.
* *
@ -133,7 +133,7 @@ class MCI_Footnotes_Layout_Init {
$l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'manfisher' ); $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_DASHBOARD, 'manfisher' );
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
echo $l_obj_template->get_content(); echo $l_obj_template->get_content();
// phpcs:enable // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
printf( '<em>visit <a href="https://cheret.de/plugins/footnotes-2/" target="_blank">Mark Cheret</a></em>' ); printf( '<em>visit <a href="https://cheret.de/plugins/footnotes-2/" target="_blank">Mark Cheret</a></em>' );
printf( '<br/><br/>' ); printf( '<br/><br/>' );
@ -152,7 +152,7 @@ class MCI_Footnotes_Layout_Init {
// Get plugin internal name from POST data. // Get plugin internal name from POST data.
if ( isset( $_POST['plugin'] ) ) { if ( isset( $_POST['plugin'] ) ) {
$l_str_plugin_name = sanitize_text_field( wp_unslash( $_POST['plugin'] ) ); $l_str_plugin_name = wp_unslash( $_POST['plugin'] );
} }
if ( empty( $l_str_plugin_name ) ) { if ( empty( $l_str_plugin_name ) ) {
@ -203,5 +203,5 @@ class MCI_Footnotes_Layout_Init {
); );
exit; exit;
} }
// phpcs:enable // phpcs:enable WordPress.Security.NonceVerification.Missing
} }

View file

@ -1,4 +1,4 @@
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName <?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName, WordPress.Security.EscapeOutput.OutputNotEscaped
/** /**
* Includes the core function of the Plugin - Search and Replace the Footnotes. * Includes the core function of the Plugin - Search and Replace the Footnotes.
* *
@ -702,9 +702,9 @@ class MCI_Footnotes_Task {
$l_int_reference_container_top_margin = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN ) ); $l_int_reference_container_top_margin = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN ) );
$l_int_reference_container_bottom_margin = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN ) ); $l_int_reference_container_bottom_margin = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN ) );
echo '.footnotes_reference_container {margin-top: '; echo '.footnotes_reference_container {margin-top: ';
echo empty( $l_int_reference_container_top_margin ) ? '0' : esc_html( $l_int_reference_container_top_margin ); echo empty( $l_int_reference_container_top_margin ) ? '0' : $l_int_reference_container_top_margin;
echo 'px !important; margin-bottom: '; echo 'px !important; margin-bottom: ';
echo empty( $l_int_reference_container_bottom_margin ) ? '0' : esc_html( $l_int_reference_container_bottom_margin ); echo empty( $l_int_reference_container_bottom_margin ) ? '0' : $l_int_reference_container_bottom_margin;
echo "px !important;}\r\n"; echo "px !important;}\r\n";
/** /**
@ -721,7 +721,7 @@ class MCI_Footnotes_Task {
*/ */
if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER ) ) ) { if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER ) ) ) {
echo '.footnote_container_prepare > '; echo '.footnote_container_prepare > ';
echo esc_html( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT ) ); echo MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT );
echo " {border-bottom: 1px solid #aaaaaa !important;}\r\n"; echo " {border-bottom: 1px solid #aaaaaa !important;}\r\n";
} }
@ -769,7 +769,7 @@ class MCI_Footnotes_Task {
$l_int_column_width_scalar = 0; $l_int_column_width_scalar = 0;
} }
echo ' width: ' . esc_html( $l_int_column_width_scalar ) . esc_html( $l_str_column_width_unit ) . ' !important;'; echo ' width: ' . $l_int_column_width_scalar . $l_str_column_width_unit . ' !important;';
} }
if ( $l_bool_column_max_width_enabled ) { if ( $l_bool_column_max_width_enabled ) {
@ -786,7 +786,7 @@ class MCI_Footnotes_Task {
$l_int_column_max_width_scalar = 0; $l_int_column_max_width_scalar = 0;
} }
echo ' max-width: ' . esc_html( $l_int_column_max_width_scalar ) . esc_html( $l_str_column_max_width_unit ) . ' !important;'; echo ' max-width: ' . $l_int_column_max_width_scalar . $l_str_column_max_width_unit . ' !important;';
} }
echo "}\r\n"; echo "}\r\n";
@ -812,7 +812,7 @@ class MCI_Footnotes_Task {
self::$a_int_scroll_offset = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET ) ); self::$a_int_scroll_offset = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET ) );
if ( self::$a_bool_hard_links_enable ) { if ( self::$a_bool_hard_links_enable ) {
echo '.footnote_referrer_anchor, .footnote_item_anchor {bottom: '; echo '.footnote_referrer_anchor, .footnote_item_anchor {bottom: ';
echo esc_html( self::$a_int_scroll_offset ); echo self::$a_int_scroll_offset;
echo "vh;}\r\n"; echo "vh;}\r\n";
} }
@ -835,8 +835,8 @@ class MCI_Footnotes_Task {
*/ */
echo ' font-size: '; echo ' font-size: ';
if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_ENABLED ) ) ) { if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_ENABLED ) ) ) {
echo esc_html( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR ) ); echo MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR );
echo esc_html( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT ) ); echo MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT );
} else { } else {
echo 'inherit'; echo 'inherit';
} }
@ -847,7 +847,7 @@ class MCI_Footnotes_Task {
*/ */
$l_str_color = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR ); $l_str_color = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR );
if ( ! empty( $l_str_color ) ) { if ( ! empty( $l_str_color ) ) {
printf( ' color: %s !important;', esc_html( $l_str_color ) ); printf( ' color: %s !important;', $l_str_color );
} }
/* /*
@ -855,7 +855,7 @@ class MCI_Footnotes_Task {
*/ */
$l_str_background = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND ); $l_str_background = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND );
if ( ! empty( $l_str_background ) ) { if ( ! empty( $l_str_background ) ) {
printf( ' background-color: %s !important;', esc_html( $l_str_background ) ); printf( ' background-color: %s !important;', $l_str_background );
} }
/* /*
@ -863,7 +863,7 @@ class MCI_Footnotes_Task {
*/ */
$l_int_border_width = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH ); $l_int_border_width = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH );
if ( ! empty( $l_int_border_width ) && intval( $l_int_border_width ) > 0 ) { if ( ! empty( $l_int_border_width ) && intval( $l_int_border_width ) > 0 ) {
printf( ' border-width: %dpx !important; border-style: solid !important;', esc_html( $l_int_border_width ) ); printf( ' border-width: %dpx !important; border-style: solid !important;', $l_int_border_width );
} }
/* /*
@ -871,7 +871,7 @@ class MCI_Footnotes_Task {
*/ */
$l_str_border_color = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR ); $l_str_border_color = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR );
if ( ! empty( $l_str_border_color ) ) { if ( ! empty( $l_str_border_color ) ) {
printf( ' border-color: %s !important;', esc_html( $l_str_border_color ) ); printf( ' border-color: %s !important;', $l_str_border_color );
} }
/* /*
@ -879,7 +879,7 @@ class MCI_Footnotes_Task {
*/ */
$l_int_border_radius = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS ); $l_int_border_radius = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS );
if ( ! empty( $l_int_border_radius ) && intval( $l_int_border_radius ) > 0 ) { if ( ! empty( $l_int_border_radius ) && intval( $l_int_border_radius ) > 0 ) {
printf( ' border-radius: %dpx !important;', esc_html( $l_int_border_radius ) ); printf( ' border-radius: %dpx !important;', $l_int_border_radius );
} }
/* /*
@ -887,9 +887,9 @@ class MCI_Footnotes_Task {
*/ */
$l_str_box_shadow_color = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR ); $l_str_box_shadow_color = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR );
if ( ! empty( $l_str_box_shadow_color ) ) { if ( ! empty( $l_str_box_shadow_color ) ) {
printf( ' -webkit-box-shadow: 2px 2px 11px %s;', esc_html( $l_str_box_shadow_color ) ); printf( ' -webkit-box-shadow: 2px 2px 11px %s;', $l_str_box_shadow_color );
printf( ' -moz-box-shadow: 2px 2px 11px %s;', esc_html( $l_str_box_shadow_color ) ); printf( ' -moz-box-shadow: 2px 2px 11px %s;', $l_str_box_shadow_color );
printf( ' box-shadow: 2px 2px 11px %s;', esc_html( $l_str_box_shadow_color ) ); printf( ' box-shadow: 2px 2px 11px %s;', $l_str_box_shadow_color );
} }
/** /**
@ -912,7 +912,7 @@ class MCI_Footnotes_Task {
*/ */
$l_int_max_width = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH ); $l_int_max_width = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH );
if ( ! empty( $l_int_max_width ) && intval( $l_int_max_width ) > 0 ) { if ( ! empty( $l_int_max_width ) && intval( $l_int_max_width ) > 0 ) {
printf( ' max-width: %dpx !important;', esc_html( $l_int_max_width ) ); printf( ' max-width: %dpx !important;', $l_int_max_width );
} }
echo "}\r\n"; echo "}\r\n";
} else { } else {
@ -924,26 +924,26 @@ class MCI_Footnotes_Task {
// Dimensions. // Dimensions.
$l_int_alternative_tooltip_width = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH ) ); $l_int_alternative_tooltip_width = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH ) );
echo '.footnote_tooltip.position {'; echo '.footnote_tooltip.position {';
echo ' width: ' . esc_html( $l_int_alternative_tooltip_width ) . 'px;'; echo ' width: ' . $l_int_alternative_tooltip_width . 'px;';
// Set also as max-width wrt short tooltip shrinking. // Set also as max-width wrt short tooltip shrinking.
echo ' max-width: ' . esc_html( $l_int_alternative_tooltip_width ) . 'px;'; echo ' max-width: ' . $l_int_alternative_tooltip_width . 'px;';
// Position. // Position.
$l_str_alternative_position = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION ); $l_str_alternative_position = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION );
$l_int_offset_x = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X ) ); $l_int_offset_x = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X ) );
if ( 'top left' === $l_str_alternative_position || 'bottom left' === $l_str_alternative_position ) { if ( 'top left' === $l_str_alternative_position || 'bottom left' === $l_str_alternative_position ) {
echo ' right: ' . ( ! empty( $l_int_offset_x ) ? esc_html( $l_int_offset_x ) : 0 ) . 'px;'; echo ' right: ' . ( ! empty( $l_int_offset_x ) ? $l_int_offset_x : 0 ) . 'px;';
} else { } else {
echo ' left: ' . ( ! empty( $l_int_offset_x ) ? esc_html( $l_int_offset_x ) : 0 ) . 'px;'; echo ' left: ' . ( ! empty( $l_int_offset_x ) ? $l_int_offset_x : 0 ) . 'px;';
} }
$l_int_offset_y = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y ) ); $l_int_offset_y = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y ) );
if ( 'top left' === $l_str_alternative_position || 'top right' === $l_str_alternative_position ) { if ( 'top left' === $l_str_alternative_position || 'top right' === $l_str_alternative_position ) {
echo ' bottom: ' . ( ! empty( $l_int_offset_y ) ? esc_html( $l_int_offset_y ) : 0 ) . 'px;'; echo ' bottom: ' . ( ! empty( $l_int_offset_y ) ? $l_int_offset_y : 0 ) . 'px;';
} else { } else {
echo ' top: ' . ( ! empty( $l_int_offset_y ) ? esc_html( $l_int_offset_y ) : 0 ) . 'px;'; echo ' top: ' . ( ! empty( $l_int_offset_y ) ? $l_int_offset_y : 0 ) . 'px;';
} }
echo "}\r\n"; echo "}\r\n";
@ -957,22 +957,21 @@ class MCI_Footnotes_Task {
$l_int_fade_in_duration = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION ) ); $l_int_fade_in_duration = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION ) );
$l_int_fade_in_delay = ! empty( $l_int_fade_in_delay ) ? $l_int_fade_in_delay : '0'; $l_int_fade_in_delay = ! empty( $l_int_fade_in_delay ) ? $l_int_fade_in_delay : '0';
$l_int_fade_in_duration = ! empty( $l_int_fade_in_duration ) ? $l_int_fade_in_duration : '0'; $l_int_fade_in_duration = ! empty( $l_int_fade_in_duration ) ? $l_int_fade_in_duration : '0';
echo ' transition-delay: ' . esc_html( $l_int_fade_in_delay ) . 'ms;'; echo ' transition-delay: ' . $l_int_fade_in_delay . 'ms;';
echo ' transition-duration: ' . esc_html( $l_int_fade_in_duration ) . 'ms;'; echo ' transition-duration: ' . $l_int_fade_in_duration . 'ms;';
echo '} .footnote_tooltip.hidden {'; echo '} .footnote_tooltip.hidden {';
$l_int_fade_out_delay = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY ) ); $l_int_fade_out_delay = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY ) );
$l_int_fade_out_duration = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION ) ); $l_int_fade_out_duration = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION ) );
$l_int_fade_out_delay = ! empty( $l_int_fade_out_delay ) ? $l_int_fade_out_delay : '0'; $l_int_fade_out_delay = ! empty( $l_int_fade_out_delay ) ? $l_int_fade_out_delay : '0';
$l_int_fade_out_duration = ! empty( $l_int_fade_out_duration ) ? $l_int_fade_out_duration : '0'; $l_int_fade_out_duration = ! empty( $l_int_fade_out_duration ) ? $l_int_fade_out_duration : '0';
echo ' transition-delay: ' . esc_html( $l_int_fade_out_delay ) . 'ms;'; echo ' transition-delay: ' . $l_int_fade_out_delay . 'ms;';
echo ' transition-duration: ' . esc_html( $l_int_fade_out_duration ) . 'ms;'; echo ' transition-duration: ' . $l_int_fade_out_duration . 'ms;';
echo "}\r\n"; echo "}\r\n";
} }
} }
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
/** /**
* Custom CSS. * Custom CSS.
* *
@ -989,7 +988,6 @@ class MCI_Footnotes_Task {
echo "\r\n"; echo "\r\n";
} }
echo MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_CUSTOM_CSS_NEW ); echo MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_CUSTOM_CSS_NEW );
// phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
// Insert end tag without switching out of PHP. // Insert end tag without switching out of PHP.
echo "\r\n</style>\r\n"; echo "\r\n</style>\r\n";
@ -1034,9 +1032,7 @@ class MCI_Footnotes_Task {
*/ */
public function wp_footer() { public function wp_footer() {
if ( 'footer' === MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ) { if ( 'footer' === MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ) {
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
echo $this->reference_container(); echo $this->reference_container();
// phpcs:enable
} }
// Get setting for love and share this plugin. // Get setting for love and share this plugin.
$l_str_love_me_index = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE ); $l_str_love_me_index = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE );
@ -1082,7 +1078,7 @@ class MCI_Footnotes_Task {
$l_str_love_me_text = sprintf( '%s', $l_str_linked_name ); $l_str_love_me_text = sprintf( '%s', $l_str_linked_name );
break; break;
} }
echo sprintf( '<div style="text-align:center; color:#acacac;">%s</div>', esc_html( $l_str_love_me_text ) ); echo sprintf( '<div style="text-align:center; color:#acacac;">%s</div>', $l_str_love_me_text );
} }
/** /**
@ -1128,7 +1124,7 @@ class MCI_Footnotes_Task {
// phpcs:disable WordPress.PHP.YodaConditions.NotYoda // phpcs:disable WordPress.PHP.YodaConditions.NotYoda
// Appends the reference container if set to "post_end". // Appends the reference container if set to "post_end".
return $this->exec( $p_str_content, 'post_end' === MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ); return $this->exec( $p_str_content, 'post_end' === MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) );
// phpcs:enable // phpcs:enable WordPress.PHP.YodaConditions.NotYoda
} }
/** /**
@ -1165,7 +1161,7 @@ class MCI_Footnotes_Task {
// phpcs:disable WordPress.PHP.YodaConditions.NotYoda // phpcs:disable WordPress.PHP.YodaConditions.NotYoda
// Appends the reference container if set to "post_end". // Appends the reference container if set to "post_end".
return $this->exec( $p_str_content, 'post_end' === MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ? true : false ); return $this->exec( $p_str_content, 'post_end' === MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ? true : false );
// phpcs:enable // phpcs:enable WordPress.PHP.YodaConditions.NotYoda
} }
/** /**

View file

@ -1,4 +1,4 @@
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName <?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName, WordPress.Security.EscapeOutput.OutputNotEscaped
/** /**
* Includes the Plugin Widget to put the Reference Container to the Widget area. * Includes the Plugin Widget to put the Reference Container to the Widget area.
* *
@ -59,7 +59,7 @@ class MCI_Footnotes_Widget_Reference_Container extends MCI_Footnotes_Widget_Base
* Edit: curly quotes 2.2.0 2020-12-12T2130+0100 * Edit: curly quotes 2.2.0 2020-12-12T2130+0100
*/ */
public function form( $instance ) { public function form( $instance ) {
echo wp_kses_post( __( 'The widget defines the position of the reference container if set to “widget area”.', 'footnotes' ) ); echo __( 'The widget defines the position of the reference container if set to “widget area”.', 'footnotes' );
} }
/** /**