Rename File prop from key to hash
This commit is contained in:
parent
112cfef33e
commit
566d2dfd91
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue