/** * @param array $attributes Input an array of attributes to create a filename from * @param string $type type of the file * * @return string a nice slugged filename */ private function createImageFilename($attributes = array(), $type = 'png') { if (is_array($attributes) && sizeof($attributes) > 0) { $rawFilename = null; foreach ($attributes as $attribute) { $rawFilename .= $attribute . '_'; } $rawFilename = substr($rawFilename, 0, sizeof($rawFilename) - 2); return utf8_decode(PhInflector::slug($rawFilename)) . '.' . $type; } else { return null; } }
<?php echo "Inflector Test"; require 'PhInflector.php'; echo "<hr>"; echo PhInflector::slug('Höäpeäöäich Médsui27:;;,.1! *"29p'); echo "<hr>"; echo PhInflector::slug('HIJO"$(/&T §!"(/&T"§:;;,.1! *"29p'); echo "<hr>"; echo PhInflector::slug('38917 jiodj d ! *"29p'); echo "<hr>"; echo PhInflector::slug('каи циефле ///!!!');