*/
public static function getPocheUrl()
{
+ $baseUrl = "";
+
$https = (!empty($_SERVER['HTTPS'])
&& (strtolower($_SERVER['HTTPS']) == 'on'))
|| (isset($_SERVER["SERVER_PORT"])
$serverport = '';
}
- return 'http' . ($https ? 's' : '') . '://'
- . $host . $serverport . $scriptname;
+ // check if BASE_URL is configured
+ if(BASE_URL) {
+ $baseUrl = BASE_URL;
+ } else {
+ $baseUrl = 'http' . ($https ? 's' : '') . '://' . $host . $serverport;
+ }
+
+ return $baseUrl . $scriptname;
+
}
/**
public static function getFile($url)
{
$timeout = 15;
- $useragent = "Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0";
+ $useragent = "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0";
if (in_array ('curl', get_loaded_extensions())) {
# Fetch feed from URL
exit();
}
+ /**
+ * UTF-8 encode array of string
+ *
+ * @param $data
+ */
+ public static function utf8ize($data)
+ {
+ if (is_array($data))
+ {
+ foreach ($data as $k => $v)
+ {
+ $data[$k] = self::utf8ize($v);
+ }
+ }
+ else if (is_string ($data) && '' == mb_detect_encoding($data))
+ {
+ return utf8_encode($data);
+ }
+ return $data;
+ }
+
/**
* Create new line in log file
*
);
foreach ($files as $fileInfo) {
- $todo = ($fileInfo->isDir() ? 'rmdir' : 'unlink');
- $todo($fileInfo->getRealPath());
+ $filename = $fileInfo->getFilename();
+ if (!$filename[0] == '.') {
+ $todo = ($fileInfo->isDir() ? 'rmdir' : 'unlink');
+ $todo($fileInfo->getRealPath());
+ }
}
Tools::logm('empty cache');
return str_replace('+', '', $token);
}
+ /**
+ *
+ * Returns the doctype for an HTML document (used for Mozilla Bookmarks)
+ * @param simple_html_dom $doc
+ * @return doctype $el
+ *
+ */
+
+ public static function get_doctype($doc)
+ {
+ $els = $doc->find('unknown');
+
+ foreach ($els as $e => $el)
+ if ($el->parent()->tag == 'root')
+ return $el;
+
+ return NULL;
+ }
+
}