From 176e32a65a4e265a0792fd099e013acdee791eed Mon Sep 17 00:00:00 2001 From: Rumperuu Date: Sun, 25 Apr 2021 18:49:35 +0100 Subject: [PATCH] chore: lint PHP files --- src/class/dashboard/layout.php | 2 ++ src/class/dashboard/subpage-main.php | 48 ++++++++++++++-------------- src/class/init.php | 2 +- src/class/task.php | 6 ++-- src/class/wysiwyg.php | 2 +- 5 files changed, 31 insertions(+), 29 deletions(-) diff --git a/src/class/dashboard/layout.php b/src/class/dashboard/layout.php index 40ce3e2..a5a596d 100644 --- a/src/class/dashboard/layout.php +++ b/src/class/dashboard/layout.php @@ -495,7 +495,9 @@ abstract class Footnotes_Layout_Engine { '', $l_str_value, // Only check for equality, not identity, WRT backlink symbol arrows. + // phpcs:disable WordPress.PHP.StrictComparisons.LooseComparison $l_str_value == $l_arr_data['value'] ? 'selected' : '', + // phpcs:enable WordPress.PHP.StrictComparisons.LooseComparison $l_str_caption ); } diff --git a/src/class/dashboard/subpage-main.php b/src/class/dashboard/subpage-main.php index 9aa05ac..cb03460 100644 --- a/src/class/dashboard/subpage-main.php +++ b/src/class/dashboard/subpage-main.php @@ -523,34 +523,34 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine { $l_obj_template->replace( array( - 'label-scroll-css' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_CSS_SMOOTH_SCROLLING, __( 'CSS-based smooth scrolling:', 'footnotes' ) ), - 'scroll-css' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_CSS_SMOOTH_SCROLLING, $l_arr_enable ), - 'notice-scroll-css' => __( 'May slightly disturb jQuery scrolling and is therefore disabled by default. Works in recent browsers.', 'footnotes' ), + 'label-scroll-css' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_CSS_SMOOTH_SCROLLING, __( 'CSS-based smooth scrolling:', 'footnotes' ) ), + 'scroll-css' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_CSS_SMOOTH_SCROLLING, $l_arr_enable ), + 'notice-scroll-css' => __( 'May slightly disturb jQuery scrolling and is therefore disabled by default. Works in recent browsers.', 'footnotes' ), - 'label-scroll-offset' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, __( 'Scroll offset:', 'footnotes' ) ), - 'scroll-offset' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, 0, 100 ), - 'notice-scroll-offset' => __( 'per cent viewport height from the upper edge', 'footnotes' ), + 'label-scroll-offset' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, __( 'Scroll offset:', 'footnotes' ) ), + 'scroll-offset' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, 0, 100 ), + 'notice-scroll-offset' => __( 'per cent viewport height from the upper edge', 'footnotes' ), - 'label-scroll-duration' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION, __( 'Scroll duration:', 'footnotes' ) ), - 'scroll-duration' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION, 0, 20000 ), - 'notice-scroll-duration' => __( 'milliseconds. If asymmetric scroll durations are enabled, this is the scroll-up duration.', 'footnotes' ), + 'label-scroll-duration' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION, __( 'Scroll duration:', 'footnotes' ) ), + 'scroll-duration' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION, 0, 20000 ), + 'notice-scroll-duration' => __( 'milliseconds. If asymmetric scroll durations are enabled, this is the scroll-up duration.', 'footnotes' ), // Enable scroll duration asymmetricity. - 'label-scroll-asymmetricity' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY, __( 'Enable asymmetric scroll durations:', 'footnotes' ) ), - 'scroll-asymmetricity' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY, $l_arr_enable ), - 'notice-scroll-asymmetricity' => __( 'With this option enabled, scrolling up may take longer than down, or conversely.', 'footnotes' ), + 'label-scroll-asymmetricity' => $this->add_label( Footnotes_Settings::C_STR_FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY, __( 'Enable asymmetric scroll durations:', 'footnotes' ) ), + 'scroll-asymmetricity' => $this->add_select_box( Footnotes_Settings::C_STR_FOOTNOTES_SCROLL_DURATION_ASYMMETRICITY, $l_arr_enable ), + 'notice-scroll-asymmetricity' => __( 'With this option enabled, scrolling up may take longer than down, or conversely.', 'footnotes' ), - 'label-scroll-down-duration' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DURATION, __( 'Scroll-down duration:', 'footnotes' ) ), - 'scroll-down-duration' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DURATION, 0, 20000 ), - 'notice-scroll-down-duration' => __( 'milliseconds', 'footnotes' ), + 'label-scroll-down-duration' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DURATION, __( 'Scroll-down duration:', 'footnotes' ) ), + 'scroll-down-duration' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DURATION, 0, 20000 ), + 'notice-scroll-down-duration' => __( 'milliseconds', 'footnotes' ), - 'label-scroll-down-delay' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DELAY, __( 'Scroll-down delay:', 'footnotes' ) ), - 'scroll-down-delay' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DELAY, 0, 20000 ), - 'notice-scroll-down-delay' => __( 'milliseconds. Useful to see the effect on input elements when referrers without hard links are clicked in form labels.', 'footnotes' ), + 'label-scroll-down-delay' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DELAY, __( 'Scroll-down delay:', 'footnotes' ) ), + 'scroll-down-delay' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DOWN_DELAY, 0, 20000 ), + 'notice-scroll-down-delay' => __( 'milliseconds. Useful to see the effect on input elements when referrers without hard links are clicked in form labels.', 'footnotes' ), - 'label-scroll-up-delay' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_UP_DELAY, __( 'Scroll-up delay:', 'footnotes' ) ), - 'scroll-up-delay' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_UP_DELAY, 0, 20000 ), - 'notice-scroll-up-delay' => __( 'milliseconds. Less useful than the scroll-down delay.', 'footnotes' ), + 'label-scroll-up-delay' => $this->add_label( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_UP_DELAY, __( 'Scroll-up delay:', 'footnotes' ) ), + 'scroll-up-delay' => $this->add_num_box( Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_UP_DELAY, 0, 20000 ), + 'notice-scroll-up-delay' => __( 'milliseconds. Less useful than the scroll-down delay.', 'footnotes' ), ) ); @@ -677,9 +677,9 @@ class Footnotes_Layout_Settings extends Footnotes_Layout_Engine { public function excerpts() { // Options for options select box. $l_arr_excerpt_mode = array( - 'yes' => __( 'Yes, generate excerpts from posts with effectively processed footnotes and other markup', 'footnotes' ), - 'no' => __( 'No, generate excerpts from posts but remove all footnotes and output plain text', 'footnotes' ), - 'manual' => __( 'Yes but run the process only to display tooltips in manual excerpts with footnote short codes', 'footnotes' ), + 'yes' => __( 'Yes, generate excerpts from posts with effectively processed footnotes and other markup', 'footnotes' ), + 'no' => __( 'No, generate excerpts from posts but remove all footnotes and output plain text', 'footnotes' ), + 'manual' => __( 'Yes but run the process only to display tooltips in manual excerpts with footnote short codes', 'footnotes' ), ); // Load template file. diff --git a/src/class/init.php b/src/class/init.php index 57f9f71..dd1b5e4 100644 --- a/src/class/init.php +++ b/src/class/init.php @@ -390,7 +390,7 @@ class Footnotes { * Enqueues external stylesheets, ONLY in development now. * * @since 2.1.4 optionally enqueue an extra stylesheet. - * + * * This optional layout fix is useful by lack of layout support. */ wp_enqueue_style( diff --git a/src/class/task.php b/src/class/task.php index bba43d9..256d82c 100644 --- a/src/class/task.php +++ b/src/class/task.php @@ -943,7 +943,7 @@ class Footnotes_Task { * Alternative tooltips. * * To streamline internal CSS, immutable rules are in external stylesheet. - * + * * @see dev-tooltips-alternative.css. */ } else { @@ -1280,7 +1280,7 @@ class Footnotes_Task { ); // Prevent the footnotes from altering the excerpt: previously hard-coded '5ED84D6'. - $l_int_placeholder = '@' . mt_rand( 100000000, 2147483647 ) . '@'; + $l_int_placeholder = '@' . wp_rand( 100000000, 2147483647 ) . '@'; $p_str_content = preg_replace( '#' . self::$a_str_start_tag_regex . '.+?' . self::$a_str_end_tag_regex . '#', $l_int_placeholder, @@ -2409,7 +2409,7 @@ class Footnotes_Task { * - Bugfix: Reference container: option to restore pre-2.0.0 layout with the backlink symbol in an extra column. * * @since 2.1.1 - */ + */ $l_bool_combine_identical_footnotes = Footnotes_Convert::to_bool( Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_COMBINE_IDENTICAL_FOOTNOTES ) ); // AMP compatibility requires a full set of AMP compatible table row templates. diff --git a/src/class/wysiwyg.php b/src/class/wysiwyg.php index f68ea8c..db2c16a 100644 --- a/src/class/wysiwyg.php +++ b/src/class/wysiwyg.php @@ -92,7 +92,7 @@ class Footnotes_WYSIWYG { $l_str_starting_tag = Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); $l_str_ending_tag = Footnotes_Settings::instance()->get( Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); } - echo json_encode( + echo wp_json_encode( array( 'start' => htmlspecialchars( $l_str_starting_tag ), 'end' => htmlspecialchars( $l_str_ending_tag ),