public static function stringToMeta($string)
 {
     $string = strtolower(Strings::stringToUrl($string));
     $remove = 'da,das,de,do,dos,no,nos,na,nas,ou,a,as,e,i,o,os,com,para,em';
     $array = explode(',', $remove);
     foreach ($array as $item) {
         $excessoes[] = '-' . trim($item) . '-';
         $replace[] = '-';
     }
     $string = str_replace($excessoes, $replace, $string);
     $string = str_replace('--', '-', $string);
     return $string;
 }
 public static function copyResize($file, $pastaDestino, $values, $limitName = 20, $imgName = '', $watermark = '')
 {
     $result = false;
     if (is_file($file)) {
         $largImg = $values[0];
         $altImg = $values[1];
         $imgProporc = $values[2];
         $corBg = @$values[3] ? $values[3] : 'ffffff';
         $imgQualidade = @$values[4] ? $values[4] : 100;
         $imgMenor = @$values[5] ? $values[5] : false;
         $largThumb = @$values[6];
         $altThumb = @$values[7];
         $thumbProporc = @$values[8];
         $geraThumb = $largThumb && $altThumb && $thumbProporc ? true : false;
         // se possuir todas as especificações, gera a miniatura
         $fileName = basename($file);
         $extensao = strtolower(strrchr($fileName, '.'));
         if (strstr('*.jpg;*.jpeg;*.gif;*.png', $extensao)) {
             $newName = $imgName ? $imgName : str_replace($extensao, '', $fileName);
             $newName = Strings::stringToUrl($newName);
             $newName = strtolower(substr($newName, 0, $limitName - 8) . $extensao);
             $newName = NwdGD::autoRename($pastaDestino, $newName);
             if (!is_dir('_temp')) {
                 mkdir('_temp', 0755);
                 sleep(1);
             }
             $imageOutput = $pastaDestino . $newName;
             $imageResize = NwdGD::imgResize($file, $imageOutput, $largImg, $altImg, $imgProporc, $corBg, $imgQualidade, $imgMenor, $watermark);
             if ($geraThumb) {
                 if (!is_dir($pastaDestino . 'thumbs')) {
                     mkdir($pastaDestino . 'thumbs', 0755);
                 }
                 $thumbOutput = $pastaDestino . 'thumbs/' . $newName;
                 $thumbResize = NwdGD::imgResize($file, $thumbOutput, $largThumb, $altThumb, $thumbProporc, $corBg, $imgQualidade, $imgMenor);
             }
             if ($imageResize) {
                 $result = $newName;
             }
         }
     }
     return $result;
 }
 // CADASTRAR
 //----------------------------------------------------------------------------------------------------------------------
 case 'Cadastrar':
     set_time_limit(0);
     $extensoesPermitidas = explode('|', $arqtypes);
     $error = '';
     if (!is_dir($pathUp . $pastaDestino)) {
         mkdir($pathUp . $pastaDestino, 0755);
         sleep(1);
     }
     $file = $_FILES['arquivos'];
     $fileName = $file['name'];
     $extensao = strtolower(str_replace('.', '', strrchr($fileName, '.')));
     if (in_array($extensao, $extensoesPermitidas)) {
         $newName = $imgName ? $imgName : str_replace($extensao, '', $fileName);
         $newName = Strings::stringToUrl($newName);
         $newName = strtolower(substr($newName, 0, $limitName - 8) . '.' . $extensao);
         $newName = NWD::autoRename($pathUp . $pastaDestino, $newName);
         $arqMove = move_uploaded_file($file['tmp_name'], $pathUp . $pastaDestino . $newName);
         if (@$arqMove) {
             $cod = md5(microtime());
             $lastPos = mysql_fetch_assoc(mysql_query("SELECT `pos` FROM `arquivos` WHERE `categ` = '{$catid}' ORDER BY `pos` DESC LIMIT 1"));
             $pos = $lastPos['pos'] + 1;
             $insert = mysql_query("INSERT INTO `arquivos` (`pos`, `categ`, `arquivo`, `cod`, `ativo`) \n\t\t\t\t\t\tVALUES ('{$pos}', '{$catid}', '{$newName}', '{$cod}', '1')");
         }
         if (@$insert) {
             $success = 'Enviado';
         } else {
             $error = 'Erro!';
         }
     } else {