WP-Filebase Pro › Forums › Templates › Version truncating the filename in the filebrowser. › Reply To: Version truncating the filename in the filebrowser.
2013-08-10 at 18:51
#620
fafdk
Participant
I put the lines in again, and changed this line:
if(preg_match('/[-_\.]v?([0-9]{1,2}\.[0-9]{1,2}(\.[0-9]{1,2}){0,2})(-[a-zA-Z_]+)?$/', $fnwv, $matches)) {
`
to this:
if(preg_match('/[\]v?([0-9]{1,2}\.[0-9]{1,2}(\.[0-9]{1,2}){0,2})(-[a-zA-Z_]+)?$/', $fnwv, $matches)) {
From here:
static function ParseFileNameVersion($file_name, $file_version) {
$fnwv = substr($file_name, 0, strrpos($file_name, '.'));// remove extension
if(empty($file_version)) {
$matches = array();
if(preg_match('/[-_\.]v?([0-9]{1,2}\.[0-9]{1,2}(\.[0-9]{1,2}){0,2})(-[a-zA-Z_]+)?$/', $fnwv, $matches)) {
$file_version = $matches[1];
if((strlen($fnwv)-strlen($matches[0])) > 1)
$fnwv = substr($fnwv, 0, -strlen($matches[0]));
}
} elseif(substr($fnwv, -strlen($file_version)) == $file_version) {
$fnwv = trim(substr($fnwv, 0, -strlen($file_version)), '-');
}
$title = WPFB_Core::GetOpt('no_name_formatting') ? $fnwv : wpfb_call('Output', 'Filename2Title', array($fnwv, false), true);
return array('title' => empty($title) ? $file_name : $title, 'version' => $file_version);
}
Maybe it’s a rough hack, but it seems to work.
I’ll wait for a proper update.
/FAF