diff --git a/create.php b/create.php index 2ec3189f..f01a97cb 100644 --- a/create.php +++ b/create.php @@ -1,7 +1,7 @@ 1) { + return $y; + } else { + return $x; + } +} + +function human_time_diff( $from, $to = '' ) { + if ( empty( $to ) ) + $to = time(); + + $diff = (int) abs( $to - $from ); + + if ( $diff < HOUR_IN_SECONDS ) { + $mins = round( $diff / MINUTE_IN_SECONDS ); + if ( $mins <= 1 ) + $mins = 1; + /* translators: min=minute */ + $since = sprintf( _n( '%s min', '%s mins', $mins ), $mins ); + } elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) { + $hours = round( $diff / HOUR_IN_SECONDS ); + if ( $hours <= 1 ) + $hours = 1; + $since = sprintf( _n( '%s hour', '%s hours', $hours ), $hours ); + } elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) { + $days = round( $diff / DAY_IN_SECONDS ); + if ( $days <= 1 ) + $days = 1; + $since = sprintf( _n( '%s day', '%s days', $days ), $days ); + } elseif ( $diff < 30 * DAY_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) { + $weeks = round( $diff / WEEK_IN_SECONDS ); + if ( $weeks <= 1 ) + $weeks = 1; + $since = sprintf( _n( '%s week', '%s weeks', $weeks ), $weeks ); + } elseif ( $diff < YEAR_IN_SECONDS && $diff >= 30 * DAY_IN_SECONDS ) { + $months = round( $diff / ( 30 * DAY_IN_SECONDS ) ); + if ( $months <= 1 ) + $months = 1; + $since = sprintf( _n( '%s month', '%s months', $months ), $months ); + } elseif ( $diff >= YEAR_IN_SECONDS ) { + $years = round( $diff / YEAR_IN_SECONDS ); + if ( $years <= 1 ) + $years = 1; + $since = sprintf( _n( '%s year', '%s years', $years ), $years ); + } + + return $since; +} diff --git a/inc/instance-config.php b/inc/instance-config.php index 0990ef5d..88a47ef1 100644 --- a/inc/instance-config.php +++ b/inc/instance-config.php @@ -7,7 +7,7 @@ * * You can copy values from config.php (defaults) and paste them here. */ -require_once "htmlpurifier-4.5.0/library/HTMLPurifier.auto.php"; +require_once "lib/htmlpurifier-4.5.0/library/HTMLPurifier.auto.php"; require_once "8chan-functions.php"; diff --git a/inc/ayah/ayah.php b/inc/lib/ayah/ayah.php similarity index 100% rename from inc/ayah/ayah.php rename to inc/lib/ayah/ayah.php diff --git a/inc/ayah/ayah_config.php b/inc/lib/ayah/ayah_config.php similarity index 100% rename from inc/ayah/ayah_config.php rename to inc/lib/ayah/ayah_config.php diff --git a/inc/ayah/json.php b/inc/lib/ayah/json.php similarity index 100% rename from inc/ayah/json.php rename to inc/lib/ayah/json.php diff --git a/inc/ayah/sample.php b/inc/lib/ayah/sample.php similarity index 100% rename from inc/ayah/sample.php rename to inc/lib/ayah/sample.php