6 public static function isUrlAllowed($url)
8 $urlDomain = parse_url($url, PHP_URL_HOST);
9 if (!in_array($urlDomain, $GLOBALS['phinde']['domains'])) {
15 public static function noSchema($url)
18 array('http://', 'https://'),
24 public static function addSchema($url)
26 if (substr($url, 0, 7) == 'http://'
27 || substr($url, 0, 8) == 'https://'
31 return 'http://' . $url;
34 public static function removeAnchor($url)
36 $parts = explode('#', $url, 2);
40 public static function sanitizeTitle($str)
44 array("\r", "\n", ' ', ' '),
45 array('', ' ', ' ', ' '),
52 * Create a full URL with protocol and host name
54 * @param string $path Path to the file, with leading /
56 * @return string Full URL
58 public static function fullUrl($path = '/')
60 if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']) {
65 return $prot . '://' . $_SERVER['HTTP_HOST'] . $path;
70 public static function start($timer = 'timer')
72 static::$timer[$timer] = microtime(true);
75 public static function stop($timer = 'timer')
77 $diff = microtime(true) - static::$timer[$timer];
78 echo '+timer: ' . number_format($diff, 3) . 'ms ' . $timer . "\n";
81 public static function baseDoc($url)
83 $esDoc = new \stdClass();
84 $esDoc->status = new \stdClass();
86 $esDoc->schemalessUrl = Helper::noSchema($url);