diff --git a/class/hooks.php b/class/hooks.php index 617a658..f5c90d1 100644 --- a/class/hooks.php +++ b/class/hooks.php @@ -1,4 +1,4 @@ -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 ]; // 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' : ''; echo sprintf( '%s', - esc_attr( ( $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() ), - esc_attr( $l_str_id ), - esc_attr( $l_arr_description['title'] ) + ( $l_str_id === $l_arr_active_section['id'] ) ? ' nav-tab-active' : '', + MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->get_sub_page_slug(), + $l_str_id, + $l_arr_description['title'] ); } echo '
'; if ( $l_bool_settings_updated ) { - echo sprintf( '
%s
', esc_html( __( 'Settings saved', 'footnotes' ) ) ); + echo sprintf( '
%s
', __( 'Settings saved', 'footnotes' ) ); } // Form to submit the active section. @@ -290,14 +289,13 @@ abstract class MCI_Footnotes_Layout_Engine { echo 'jQuery(document).ready(function ($) {'; echo 'jQuery(".mfmmf-color-picker").wpColorPicker();'; 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 ''; } - // phpcs:enable + // phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing - // phpcs:disable WordPress.Security.NonceVerification.Recommended - // phpcs:disable WordPress.Security.NonceVerification.Missing + // phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing /** * Save all Plugin settings. * @@ -311,12 +309,12 @@ abstract class MCI_Footnotes_Layout_Engine { // Get current section. 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 ]; 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 ) ) { - $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 { // Setting is not defined in the POST array, define it to avoid the Default value. $l_arr_new_settings[ $l_str_key ] = ''; @@ -325,7 +323,7 @@ abstract class MCI_Footnotes_Layout_Engine { // Update 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. @@ -349,7 +347,7 @@ abstract class MCI_Footnotes_Layout_Engine { $p_arr_return = array(); $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['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; } diff --git a/class/layout/diagnostics.php b/class/layout/diagnostics.php index 502f293..1a30015 100644 --- a/class/layout/diagnostics.php +++ b/class/layout/diagnostics.php @@ -1,4 +1,4 @@ -' . $l_arr_plugin['Name'] . ''; // phpcs:disable Generic.Strings.UnnecessaryStringConcat.Found $l_str_wordpress_plugins .= '' . $l_arr_plugin['Version'] . ' [' . $l_arr_plugin['PluginURI'] . ']' . ''; - // phpcs:enable + // phpcs:enable Generic.Strings.UnnecessaryStringConcat.Found $l_str_wordpress_plugins .= ''; } // Load template file. @@ -103,12 +103,12 @@ class MCI_Footnotes_Layout_Diagnostics extends MCI_Footnotes_Layout_Engine { if ( ! isset( $_SERVER['SERVER_NAME'] ) ) { die; } 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'] ) ) { die; } 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. @@ -141,9 +141,7 @@ class MCI_Footnotes_Layout_Diagnostics extends MCI_Footnotes_Layout_Engine { 'plugins' => $l_str_wordpress_plugins, ) ); - // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped // Display template with replaced placeholders. echo $l_obj_template->get_content(); - // phpcs:enable } } diff --git a/class/layout/init.php b/class/layout/init.php index 72c347d..31e5b24 100644 --- a/class/layout/init.php +++ b/class/layout/init.php @@ -1,4 +1,4 @@ -get_content(); - // phpcs:enable + // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped printf( 'visit Mark Cheret' ); printf( '

' ); @@ -152,7 +152,7 @@ class MCI_Footnotes_Layout_Init { // Get plugin internal name from POST data. 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 ) ) { @@ -203,5 +203,5 @@ class MCI_Footnotes_Layout_Init { ); exit; } - // phpcs:enable + // phpcs:enable WordPress.Security.NonceVerification.Missing } diff --git a/class/task.php b/class/task.php index 48f0f37..e39a7e4 100644 --- a/class/task.php +++ b/class/task.php @@ -1,4 +1,4 @@ -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 ) ); 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 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"; /** @@ -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 ) ) ) { 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"; } @@ -769,7 +769,7 @@ class MCI_Footnotes_Task { $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 ) { @@ -786,7 +786,7 @@ class MCI_Footnotes_Task { $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"; @@ -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 ) ); if ( self::$a_bool_hard_links_enable ) { 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"; } @@ -835,8 +835,8 @@ class MCI_Footnotes_Task { */ 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 ) ) ) { - echo esc_html( 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_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR ); + echo MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT ); } else { 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 ); 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 ); 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 ); 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 ); 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 ); 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 ); if ( ! empty( $l_str_box_shadow_color ) ) { - printf( ' -webkit-box-shadow: 2px 2px 11px %s;', esc_html( $l_str_box_shadow_color ) ); - printf( ' -moz-box-shadow: 2px 2px 11px %s;', esc_html( $l_str_box_shadow_color ) ); - printf( ' 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;', $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 ); 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"; } else { @@ -924,26 +924,26 @@ class MCI_Footnotes_Task { // Dimensions. $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 ' 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. - echo ' max-width: ' . esc_html( $l_int_alternative_tooltip_width ) . 'px;'; + echo ' max-width: ' . $l_int_alternative_tooltip_width . 'px;'; // 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 ) ); 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 { - 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 ) ); 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 { - 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"; @@ -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_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'; - echo ' transition-delay: ' . esc_html( $l_int_fade_in_delay ) . 'ms;'; - echo ' transition-duration: ' . esc_html( $l_int_fade_in_duration ) . 'ms;'; + echo ' transition-delay: ' . $l_int_fade_in_delay . 'ms;'; + echo ' transition-duration: ' . $l_int_fade_in_duration . 'ms;'; 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_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_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-duration: ' . esc_html( $l_int_fade_out_duration ) . 'ms;'; + echo ' transition-delay: ' . $l_int_fade_out_delay . 'ms;'; + echo ' transition-duration: ' . $l_int_fade_out_duration . 'ms;'; echo "}\r\n"; } } - // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped /** * Custom CSS. * @@ -989,7 +988,6 @@ class MCI_Footnotes_Task { echo "\r\n"; } 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. echo "\r\n\r\n"; @@ -1034,9 +1032,7 @@ class MCI_Footnotes_Task { */ public function wp_footer() { 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(); - // phpcs:enable } // 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 ); @@ -1082,7 +1078,7 @@ class MCI_Footnotes_Task { $l_str_love_me_text = sprintf( '%s', $l_str_linked_name ); break; } - echo sprintf( '
%s
', esc_html( $l_str_love_me_text ) ); + echo sprintf( '
%s
', $l_str_love_me_text ); } /** @@ -1128,7 +1124,7 @@ class MCI_Footnotes_Task { // phpcs:disable WordPress.PHP.YodaConditions.NotYoda // 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 ) ); - // phpcs:enable + // phpcs:enable WordPress.PHP.YodaConditions.NotYoda } /** @@ -1165,7 +1161,7 @@ class MCI_Footnotes_Task { // phpcs:disable WordPress.PHP.YodaConditions.NotYoda // 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 ); - // phpcs:enable + // phpcs:enable WordPress.PHP.YodaConditions.NotYoda } /** diff --git a/class/widgets/reference-container.php b/class/widgets/reference-container.php index 4a75d11..1a628a7 100644 --- a/class/widgets/reference-container.php +++ b/class/widgets/reference-container.php @@ -1,4 +1,4 @@ -