wp/wp-admin/includes/class-wp-links-list-table.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
--- a/wp/wp-admin/includes/class-wp-links-list-table.php	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-admin/includes/class-wp-links-list-table.php	Tue Dec 15 13:49:49 2020 +0100
@@ -58,7 +58,7 @@
 			'hide_empty'     => 0,
 		);
 
-		if ( 'all' != $cat_id ) {
+		if ( 'all' !== $cat_id ) {
 			$args['category'] = $cat_id;
 		}
 		if ( ! empty( $s ) ) {
@@ -97,12 +97,12 @@
 	protected function extra_tablenav( $which ) {
 		global $cat_id;
 
-		if ( 'top' != $which ) {
+		if ( 'top' !== $which ) {
 			return;
 		}
 		?>
 		<div class="alignleft actions">
-		<?php
+			<?php
 			$dropdown_options = array(
 				'selected'        => $cat_id,
 				'name'            => 'cat_id',
@@ -117,7 +117,7 @@
 			echo '<label class="screen-reader-text" for="cat_id">' . __( 'Filter by category' ) . '</label>';
 			wp_dropdown_categories( $dropdown_options );
 			submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
-		?>
+			?>
 		</div>
 		<?php
 	}
@@ -169,7 +169,12 @@
 	 */
 	public function column_cb( $link ) {
 		?>
-		<label class="screen-reader-text" for="cb-select-<?php echo $link->link_id; ?>"><?php echo sprintf( __( 'Select %s' ), $link->link_name ); ?></label>
+		<label class="screen-reader-text" for="cb-select-<?php echo $link->link_id; ?>">
+			<?php
+			/* translators: %s: Link name. */
+			printf( __( 'Select %s' ), $link->link_name );
+			?>
+		</label>
 		<input type="checkbox" name="linkcheck[]" id="cb-select-<?php echo $link->link_id; ?>" value="<?php echo esc_attr( $link->link_id ); ?>" />
 		<?php
 	}
@@ -186,7 +191,7 @@
 		printf(
 			'<strong><a class="row-title" href="%s" aria-label="%s">%s</a></strong>',
 			$edit_link,
-			/* translators: %s: link name */
+			/* translators: %s: Link name. */
 			esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $link->link_name ) ),
 			$link->link_name
 		);
@@ -223,7 +228,7 @@
 				echo $cat->get_error_message();
 			}
 			$cat_name = $cat->name;
-			if ( $cat_id != $category ) {
+			if ( (int) $cat_id !== $category ) {
 				$cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
 			}
 			$cat_names[] = $cat_name;
@@ -309,7 +314,8 @@
 	 * @param object $link        Link being acted upon.
 	 * @param string $column_name Current column name.
 	 * @param string $primary     Primary column name.
-	 * @return string Row action output for links.
+	 * @return string Row actions output for links, or an empty string
+	 *                if the current column is not the primary column.
 	 */
 	protected function handle_row_actions( $link, $column_name, $primary ) {
 		if ( $primary !== $column_name ) {
@@ -320,7 +326,14 @@
 
 		$actions           = array();
 		$actions['edit']   = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
-		$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id ) . "' onclick=\"if ( confirm( '" . esc_js( sprintf( __( "You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete." ), $link->link_name ) ) . "' ) ) { return true;}return false;\">" . __( 'Delete' ) . '</a>';
+		$actions['delete'] = sprintf(
+			'<a class="submitdelete" href="%s" onclick="return confirm( \'%s\' );">%s</a>',
+			wp_nonce_url( "link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id ),
+			/* translators: %s: Link name. */
+			esc_js( sprintf( __( "You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete." ), $link->link_name ) ),
+			__( 'Delete' )
+		);
+
 		return $this->row_actions( $actions );
 	}
 }