Changeset 24582 for trunk/wp-includes/formatting.php
- Timestamp:
- 07/08/2013 01:00:34 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r24490 r24582 2134 2134 if ( empty( $to ) ) 2135 2135 $to = time(); 2136 2136 2137 $diff = (int) abs( $to - $from ); 2137 if ( $diff <= HOUR_IN_SECONDS ) { 2138 2139 if ( $diff < HOUR_IN_SECONDS ) { 2138 2140 $mins = round( $diff / MINUTE_IN_SECONDS ); 2139 if ( $mins <= 1 ) {2141 if ( $mins <= 1 ) 2140 2142 $mins = 1; 2141 }2142 2143 /* translators: min=minute */ 2143 2144 $since = sprintf( _n( '%s min', '%s mins', $mins ), $mins ); 2144 } elseif ( ( $diff <= DAY_IN_SECONDS ) && ( $diff > HOUR_IN_SECONDS )) {2145 } elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) { 2145 2146 $hours = round( $diff / HOUR_IN_SECONDS ); 2146 if ( $hours <= 1 ) {2147 if ( $hours <= 1 ) 2147 2148 $hours = 1; 2148 }2149 2149 $since = sprintf( _n( '%s hour', '%s hours', $hours ), $hours ); 2150 } elseif ( $diff >= DAY_IN_SECONDS ) {2150 } elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) { 2151 2151 $days = round( $diff / DAY_IN_SECONDS ); 2152 if ( $days <= 1 ) {2152 if ( $days <= 1 ) 2153 2153 $days = 1; 2154 }2155 2154 $since = sprintf( _n( '%s day', '%s days', $days ), $days ); 2156 } 2155 } elseif ( $diff < 30 * DAY_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) { 2156 $weeks = round( $diff / WEEK_IN_SECONDS ); 2157 if ( $weeks <= 1 ) 2158 $weeks = 1; 2159 $since = sprintf( _n( '%s week', '%s weeks', $weeks ), $weeks ); 2160 } elseif ( $diff < YEAR_IN_SECONDS && $diff >= 30 * DAY_IN_SECONDS ) { 2161 $months = round( $diff / ( 30 * DAY_IN_SECONDS ) ); 2162 if ( $months <= 1 ) 2163 $months = 1; 2164 $since = sprintf( _n( '%s month', '%s months', $months ), $months ); 2165 } elseif ( $diff >= YEAR_IN_SECONDS ) { 2166 $years = round( $diff / YEAR_IN_SECONDS ); 2167 if ( $years <= 1 ) 2168 $years = 1; 2169 $since = sprintf( _n( '%s year', '%s years', $years ), $years ); 2170 } 2171 2157 2172 return $since; 2158 2173 }
Note: See TracChangeset
for help on using the changeset viewer.