本文整理汇总了PHP中Strings::stringToUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Strings::stringToUrl方法的具体用法?PHP Strings::stringToUrl怎么用?PHP Strings::stringToUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Strings
的用法示例。
在下文中一共展示了Strings::stringToUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stringToMeta
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;
}
示例2: copyResize
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;
}
示例3: set_time_limit
// 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 {