Skip to content

Commit a742c67

Browse files
committed
Use time constants
Makes the code more readable. Fixes bradyvercher#43.
1 parent 19a8f17 commit a742c67

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

includes/class-gistpress.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ public function get_gist_html( $url, array $args ) {
348348

349349
if ( empty( $html ) ) {
350350
$html = get_transient( $raw_key );
351-
$transient_expire = 86400; // 60 * 60 * 24 = 1 day
351+
$transient_expire = DAY_IN_SECONDS;
352352

353353
if ( $html && $this->unknown() != $html ) {
354354
$html = $this->process_gist_html( $html, $args );
@@ -384,7 +384,7 @@ public function get_gist_html( $url, array $args ) {
384384
$html = $this->process_gist_html( $fallback, $args );
385385

386386
// Cache the fallback for an hour.
387-
$transient_expire = 3600; // 60 * 60 = 1 hour
387+
$transient_expire = HOUR_IN_SECONDS;
388388

389389
$this->debug_log( __( '<strong>Raw Source:</strong> Post Meta Fallback', 'gistpress' ), $shortcode_hash );
390390
$this->debug_log( __( '<strong>Output Source:</strong> Processed Raw Source', 'gistpress' ), $shortcode_hash );
@@ -679,9 +679,9 @@ protected function get_file_name( $sanitized_filename, $delimiter, $id ) {
679679

680680
if ( $json && ! empty( $json->files ) ) {
681681
$gist_files = $json->files;
682-
set_transient( $transient_key, $gist_files, 604800 ); // 60 * 60 * 24 * 7 = 1 week
682+
set_transient( $transient_key, $gist_files, WEEK_IN_SECONDS );
683683
} else {
684-
set_transient( $transient_key, array(), 900 ); // 60 * 15 = 15 minutes
684+
set_transient( $transient_key, array(), MINUTE_IN_SECONDS * 15 );
685685
}
686686
}
687687

0 commit comments

Comments
 (0)