Example #1
0
function changeTitle($str)
{
    $str = stripUnicode($str);
    $str = str_replace("?", "", $str);
    $str = str_replace("&", "", $str);
    $str = str_replace("'", "", $str);
    $str = str_replace("  ", " ", $str);
    $str = trim($str);
    $str = mb_convert_case($str, MB_CASE_LOWER, 'utf-8');
    // MB_CASE_UPPER/MB_CASE_TITLE/MB_CASE_LOWER
    $str = str_replace(" ", "-", $str);
    $str = str_replace("---", "-", $str);
    $str = str_replace("--", "-", $str);
    $str = str_replace('"', '', $str);
    $str = str_replace('"', "", $str);
    $str = str_replace(":", "", $str);
    $str = str_replace("(", "", $str);
    $str = str_replace(")", "", $str);
    $str = str_replace(",", "", $str);
    $str = str_replace(".", "", $str);
    $str = str_replace(".", "", $str);
    $str = str_replace(".", "", $str);
    $str = str_replace("%", "", $str);
    return $str;
}
Example #2
0
function changeTitle($str)
{
    $str = trim($str);
    if ($str == "") {
        return "";
    }
    $str = str_replace('"', '', $str);
    $str = str_replace("'", '', $str);
    $str = str_replace(":", '', $str);
    $str = str_replace("%", '', $str);
    $str = str_replace("?", '', $str);
    $str = str_replace("–", '', $str);
    $str = str_replace("-", '', $str);
    $str = str_replace("_", '', $str);
    $str = str_replace(".", '', $str);
    $str = str_replace(",", '', $str);
    $str = str_replace("“", '', $str);
    $str = str_replace("”", '', $str);
    $str = str_replace("(", '', $str);
    $str = str_replace(")", '', $str);
    $str = str_replace("&", '', $str);
    $str = str_replace("*", '', $str);
    $str = str_replace("+", '', $str);
    $str = str_replace("  ", ' ', $str);
    $str = stripUnicode($str);
    $str = strtolower($str);
    //$str = mb_convert_case($str,MB_CASE_TITLE,'utf-8');
    // MB_CASE_UPPER / MB_CASE_TITLE / MB_CASE_LOWER
    $str = str_replace(' ', '-', $str);
    return $str;
}
Example #3
0
function changeTitle($str){
	$str = stripUnicode($str);
	$str = mb_convert_case($str,MB_CASE_TITLE,'utf-8');
	// MB_CASE_UPPER / MB_CASE_TITLE / MB_CASE_LOWER
	$str = str_replace(' ','-',$str);
	$str = str_replace("'",' ',$str);
	$str = str_replace('"',' ',$str);
	return $str;
}
Example #4
0
 public function searchPlace($key, $category)
 {
     $diadiem = stripUnicode($key);
     if ($category != 0) {
         $location = DB::table('location')->join('category', 'location.category_id', '=', 'category.category_id')->select('location.*', 'category.category_name as category_name', 'category.link as category_link')->where('location.link', 'like', '%' . $diadiem . '%')->where('location.category_id', $category)->where('actived', '=', 1);
     } else {
         $location = DB::table('location')->join('category', 'location.category_id', '=', 'category.category_id')->select('location.*', 'category.category_name as category_name', 'category.link as category_link')->where('location.link', 'like', '%' . $diadiem . '%')->where('actived', '=', 1);
     }
     return $location;
 }
function changeTitle($str)
{
    $str = trim($str);
    if ($str == "") {
        return "";
    }
    $str = str_replace('"', '', $str);
    $str = str_replace("'", '', $str);
    $str = stripUnicode($str);
    $str = mb_convert_case($str, MB_CASE_LOWER, 'utf-8');
    $str = str_replace(' ', '-', $str);
    return $str;
}
 function safe_title($text, $special_char = "-")
 {
     $text = post_db_parse_html($text);
     $text = stripUnicode($text);
     $text = _name_cleaner($text, $special_char);
     $text = str_replace("----", "-", $text);
     $text = str_replace("---", "-", $text);
     $text = str_replace("--", "-", $text);
     $text = trim($text, '-');
     $text = str_replace("/", "", $text);
     if ($text) {
         return $text;
     } else {
         return "";
     }
 }
 private function findData($str)
 {
     if (empty($str)) {
         return false;
     }
     //echo $str."\n";
     $str = explode(' ', removeSpecialChars($str));
     foreach ($str as $k => $v) {
         $str[$k] = strtoupper($v);
     }
     $str_upper = implode(' ', $str);
     //print_r($str);
     $keywords = explode(' ', removeSpecialChars(stripUnicode($this->keywords)));
     foreach ($keywords as $v) {
         $v = strtoupper($v);
         if (!in_array($v, $str) && !$this->match($v, $str_upper)) {
             return false;
         }
     }
     return true;
 }
Example #8
0
function str2url($str = NULL, $sperator = "-")
{
    if (!$str) {
        return NULL;
    }
    //$str = mb_strtolower($str,'utf-8');
    $str = stripUnicode($str);
    $str = preg_replace('/[^0-9a-z]/is', ' ', $str);
    $str = trim($str);
    $str = preg_replace('/\\s+/', $sperator, $str);
    return str_replace(' ', $sperator, $str);
}
Example #9
0
 public function updateImage(Request $request, $id)
 {
     $input = $request->all();
     if (isset($input['btnSubmit'])) {
         $location = new Location();
         $location = $location->findId($id)->first();
         foreach ($input['fileAnh'] as $anh) {
             if ($anh) {
                 $image = new Image();
                 $save_up = 'public/images/';
                 $_avatar = $location->link;
                 $_avatar = rand(0, 1000) . stripUnicode($_avatar) . '.jpg';
                 $image->location_id = $location->id;
                 $image->link = $save_up . $_avatar;
                 $anh->move($save_up, $_avatar);
                 $image->save();
             }
         }
     } else {
         $id_xoa = $input['checkbox'];
         foreach ($id_xoa as $id) {
             $result = DB::table('images')->where('image_id', $id)->delete();
         }
     }
     return Redirect::back();
 }
 function getEasyCompareString($inputString, $charactersToRemove = " -_/\\!?@#\$%^&*'\"()[]{}<>", $forceLowerCase = true, $trimString = true, $stripUnicodeCharacters = true, $replaceCharsWith = '', $killRepeatingReplacements = true)
 {
     $ret = $inputString;
     if (is_null($charactersToRemove)) {
         $charactersToRemove = " -_/\\!?@#\$%^&*'\"()[]{}<>";
     }
     if (!is_array($charactersToRemove)) {
         $charactersToRemove = str_split($charactersToRemove);
     }
     $charactersToRemove[] = '%20';
     foreach ($charactersToRemove as $charToRemove) {
         $ret = str_replace($charToRemove, $replaceCharsWith, $ret);
     }
     if ($forceLowerCase) {
         $ret = strtolower($ret);
     }
     if ($trimString) {
         $ret = trim($ret);
     }
     if ($stripUnicodeCharacters) {
         $ret = stripUnicode($ret, $replaceCharsWith);
     }
     if ($replaceCharsWith !== '' && $killRepeatingReplacements == true) {
         while (strpos($ret, $replaceCharsWith . $replaceCharsWith) !== false) {
             $ret = str_replace($replaceCharsWith . $replaceCharsWith, $replaceCharsWith, $ret);
         }
     }
     return $ret;
 }