Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function include_mostrecent()
- {
- global $nen, $prj;
- $ret = '';
- $me_long = 'most recent';
- $me = str_replace( ' ', '', $me_long );
- $ext_array = array( '.7z', '.zip' );
- $ext_pcre = str_replace( '.', '\\.', implode( '|', $ext_array ) );
- $toc = fasttoc( 'showcase/vault/' . $prj . '/builds', $ext_array );
- if( count( $toc ) === 0 )
- {
- $nen['swap.ct'][$me] = count( $toc );
- $ret = '';
- return $ret;
- }
- $ct = 0;
- $span = 4;
- $count = 0;
- $pattern = '/(?<project>.*)(?<ts>(?<yyyy>[0-9]{4})-(?<mmdd>[0-9]{4})-(?<hhmm>[0-9]{4}))(?<comment>.*)(?<ext>\.(7x|zip))/';
- $latest = '0000-0000-0000';
- $latest_filename = '';
- $index = 0;
- for( $index = 0; $index < count( $toc ); $index++ )
- {
- preg_match( $pattern, $toc[ $index ], $matches );
- $timestamp = $matches['ts'];
- if( $timestamp > $latest )
- {
- $latest = $timestamp;
- $latest_filename = $toc[ $index ];
- }
- }
- $ret .= '<tr><td colspan="1" style="width:25%;text-align:center;font-size:170%;bold;">';
- $ret .= '<h2><a href="./showcase/vault/' . $prj . '/builds/' . $latest_filename . '">' . $latest_filename . '</a></h2>';
- $ret .= '</td>';
- $ret .= '</tr>';
- if ( strlen( $ret ) !== 0)
- {
- $ret = '<table colspan="' . $span . '" style="width:100%;"><th colspan="' . $span . '"><h2 style="text-align:center;" id="' . $me . '">' . ucwords( $prj ) . ' :: ' . ucwords($me_long) . '</h2></th>' . $ret . '</table>';
- }
- $nen[ 'swap.ct' ][ $me ] = count($toc);
- return $ret;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement