$value) { $mixed[$key] = self::utf8ize($value); } } elseif (is_string($mixed)) { return mb_convert_encoding($mixed, "UTF-8", "UTF-8"); } return $mixed; } public static function getPostRoute(){ return self::$postRoute; } public static function setPostRoute($postRoute){ self::$postRoute = $postRoute; } public static function getUserShop(){ if(\Session::has('user_shop')){ if($user_shop = \Session::get('user_shop')){ return $user_shop; } } return false; } public static function getAuthUser(){ if(\Session::has('auth_user')){ if($auth_user = \Session::get('auth_user')){ return $auth_user; } } return false; } public static function addRoute($p = []){ $b = []; if(\Session::has('user_shop')){ if($user_shop = \Session::get('user_shop')){ $b = ['subdomain' => $user_shop->slug]; } } return array_merge($p, $b); } public static function isCheckout(){ if(\Session::has('isCheckout')){ if(\Session::get('isCheckout') == true){ return true; } } return false; } public static function getUserShopBackUrl($reference = ""){ if(\Session::has('user_shop')){ if(\Session::has('user_shop_domain')){ return \Session::get('user_shop_domain'); } if($user_shop = \Session::get('user_shop')){ return config('app.protocol').$user_shop->slug.".".config('app.domain').config('app.tld_care')."/back/to/shop/".$reference; } } return url("/"); } public static function getUserCardBackUrl($uri){ if(\Session::has('user_shop')){ if(\Session::has('user_shop_domain')){ return \Session::get('user_shop_domain'); } if($user_shop = \Session::get('user_shop')){ return config('app.protocol').$user_shop->slug.".".config('app.domain').config('app.tld_care').$uri; } } return url($uri); } public static function sanitize($string, $force_lowercase = true, $anal = false, $substr = false) { $strip = array("~", "`", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "=", "+", "[", "{", "]", "}", "\\", "|", ";", ":", "\"", "'", "‘", "’", "“", "”", "–", "—", "—", "–", ",", "<", ".", ">", "/", "?"); $clean = trim(str_replace($strip, "", strip_tags($string))); $clean = preg_replace('/\s+/', "_", $clean); $clean = ($anal) ? preg_replace("/[^a-zA-Z0-9]/", "", $clean) : $clean ; if($substr){ $clean = (strlen($clean) > 20) ? substr($clean,-20) : $clean; } return ($force_lowercase) ? (function_exists('mb_strtolower')) ? mb_strtolower($clean, 'UTF-8') : strtolower($clean) : $clean; } }