Rename File prop from key to hash

This commit is contained in:
Corey McKrill 2023-10-20 16:17:29 -07:00
parent 112cfef33e
commit 566d2dfd91
No known key found for this signature in database
GPG Key ID: 84BBFE669C4D97B8
2 changed files with 9 additions and 9 deletions

View File

@ -30,11 +30,11 @@ class File {
protected $created;
/**
* The key property of the file, derived from the filename.
* The hash property of the file, derived from the filename.
*
* @var string
*/
protected $key;
protected $hash;
/**
* Class File
@ -66,11 +66,11 @@ class File {
if ( count( $segments ) >= 5 ) {
$this->source = implode( '-', array_slice( $segments, 0, -4 ) );
$this->created = strtotime( implode( '-', array_slice( $segments, -4, 3 ) ) );
$this->key = array_slice( $segments, -1 )[0];
$this->hash = array_slice( $segments, -1 )[0];
} else {
$this->source = implode( '-', $segments );
$this->created = filemtime( $this->path );
$this->key = $this->source;
$this->hash = $this->source;
}
}
@ -93,12 +93,12 @@ class File {
}
/**
* Get the file's key property.
* Get the file's hash property.
*
* @return string
*/
public function get_key() {
return $this->key;
public function get_hash() {
return $this->hash;
}
/**

View File

@ -220,12 +220,12 @@ class ListTable extends WP_List_Table {
ob_start();
?>
<input
id="cb-select-<?php echo esc_attr( $item->get_key() ); ?>"
id="cb-select-<?php echo esc_attr( $item->get_hash() ); ?>"
type="checkbox"
name="file[]"
value="<?php echo esc_attr( $item->get_basename() ); ?>"
/>
<label for="cb-select-<?php echo esc_attr( $item->get_key() ); ?>">
<label for="cb-select-<?php echo esc_attr( $item->get_hash() ); ?>">
<span class="screen-reader-text">
<?php
printf(