function get_domain($url) { $url = ltrim($url, "mailto:"); if (shortener::is_email($url)) { list($uname, $url) = split("@", $url); return $url; } return $this->get_base_domain($url); }
static function fixed_type($type, $content) { switch ($type) { case shortener::URL: if (shortener::is_email($content)) { return shortener::EMAIL; } else { if (shortener::is_url($content)) { return $type; } else { return shortener::TEXT; } } case shortener::EMAIL: if (shortener::is_url($content)) { return shortener::URL; } else { if (shortener::is_email($content)) { return $type; } else { return shortener::TEXT; } } case shortener::TEXT: return $type; case shortener::IMAGE: if (file_exists($content) || shortener::is_url($content)) { return $type; } else { if (shortener::is_email($content)) { return shortener::EMAIL; } else { return shortener::TEXT; } } default: throw new Exception("Type Not Found"); } }