Rename File prop from key to hash
This commit is contained in:
parent
112cfef33e
commit
566d2dfd91
|
@ -30,11 +30,11 @@ class File {
|
||||||
protected $created;
|
protected $created;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The key property of the file, derived from the filename.
|
* The hash property of the file, derived from the filename.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $key;
|
protected $hash;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class File
|
* Class File
|
||||||
|
@ -66,11 +66,11 @@ class File {
|
||||||
if ( count( $segments ) >= 5 ) {
|
if ( count( $segments ) >= 5 ) {
|
||||||
$this->source = implode( '-', array_slice( $segments, 0, -4 ) );
|
$this->source = implode( '-', array_slice( $segments, 0, -4 ) );
|
||||||
$this->created = strtotime( implode( '-', array_slice( $segments, -4, 3 ) ) );
|
$this->created = strtotime( implode( '-', array_slice( $segments, -4, 3 ) ) );
|
||||||
$this->key = array_slice( $segments, -1 )[0];
|
$this->hash = array_slice( $segments, -1 )[0];
|
||||||
} else {
|
} else {
|
||||||
$this->source = implode( '-', $segments );
|
$this->source = implode( '-', $segments );
|
||||||
$this->created = filemtime( $this->path );
|
$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
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_key() {
|
public function get_hash() {
|
||||||
return $this->key;
|
return $this->hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -220,12 +220,12 @@ class ListTable extends WP_List_Table {
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
<input
|
<input
|
||||||
id="cb-select-<?php echo esc_attr( $item->get_key() ); ?>"
|
id="cb-select-<?php echo esc_attr( $item->get_hash() ); ?>"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
name="file[]"
|
name="file[]"
|
||||||
value="<?php echo esc_attr( $item->get_basename() ); ?>"
|
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">
|
<span class="screen-reader-text">
|
||||||
<?php
|
<?php
|
||||||
printf(
|
printf(
|
||||||
|
|
Loading…
Reference in New Issue