|
|
@@ -428,57 +428,58 @@ function getServer($over = false)
|
|
|
}
|
|
|
return isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : $_SERVER["SERVER_NAME"];
|
|
|
}
|
|
|
+
|
|
|
/* Function is to get all the contents from ics and explode all the datas according to the events and its sections */
|
|
|
function getIcsEventsAsArray($file)
|
|
|
{
|
|
|
- $icalString = file_get_contents_curl($file);
|
|
|
- $icsDates = array();
|
|
|
- /* Explode the ICs Data to get datas as array according to string ‘BEGIN:’ */
|
|
|
- $icsData = explode("BEGIN:", $icalString);
|
|
|
- /* Iterating the icsData value to make all the start end dates as sub array */
|
|
|
- foreach ($icsData as $key => $value) {
|
|
|
- $icsDatesMeta [$key] = explode("\n", $value);
|
|
|
- }
|
|
|
- /* Itearting the Ics Meta Value */
|
|
|
- foreach ($icsDatesMeta as $key => $value) {
|
|
|
- foreach ($value as $subKey => $subValue) {
|
|
|
- /* to get ics events in proper order */
|
|
|
- $icsDates = getICSDates($key, $subKey, $subValue, $icsDates);
|
|
|
- }
|
|
|
- }
|
|
|
- return $icsDates;
|
|
|
+ $icalString = file_get_contents_curl($file);
|
|
|
+ $icsDates = array();
|
|
|
+ /* Explode the ICs Data to get datas as array according to string ‘BEGIN:’ */
|
|
|
+ $icsData = explode("BEGIN:", $icalString);
|
|
|
+ /* Iterating the icsData value to make all the start end dates as sub array */
|
|
|
+ foreach ($icsData as $key => $value) {
|
|
|
+ $icsDatesMeta [$key] = explode("\n", $value);
|
|
|
+ }
|
|
|
+ /* Itearting the Ics Meta Value */
|
|
|
+ foreach ($icsDatesMeta as $key => $value) {
|
|
|
+ foreach ($value as $subKey => $subValue) {
|
|
|
+ /* to get ics events in proper order */
|
|
|
+ $icsDates = getICSDates($key, $subKey, $subValue, $icsDates);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $icsDates;
|
|
|
}
|
|
|
|
|
|
/* funcion is to avaid the elements wich is not having the proper start, end and summary informations */
|
|
|
function getICSDates($key, $subKey, $subValue, $icsDates)
|
|
|
{
|
|
|
- if ($key != 0 && $subKey == 0) {
|
|
|
- $icsDates [$key] ["BEGIN"] = $subValue;
|
|
|
- } else {
|
|
|
- $subValueArr = explode(":", $subValue, 2);
|
|
|
- if (isset ($subValueArr [1])) {
|
|
|
- $icsDates [$key] [$subValueArr [0]] = $subValueArr [1];
|
|
|
- }
|
|
|
- }
|
|
|
- return $icsDates;
|
|
|
+ if ($key != 0 && $subKey == 0) {
|
|
|
+ $icsDates [$key] ["BEGIN"] = $subValue;
|
|
|
+ } else {
|
|
|
+ $subValueArr = explode(":", $subValue, 2);
|
|
|
+ if (isset ($subValueArr [1])) {
|
|
|
+ $icsDates [$key] [$subValueArr [0]] = $subValueArr [1];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $icsDates;
|
|
|
}
|
|
|
|
|
|
function file_get_contents_curl($url)
|
|
|
{
|
|
|
+ $ch = curl_init();
|
|
|
+ curl_setopt($ch, CURLOPT_AUTOREFERER, true);
|
|
|
+ curl_setopt($ch, CURLOPT_HEADER, 0);
|
|
|
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
|
+ curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
|
|
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
|
|
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
|
|
+ $data = curl_exec($ch);
|
|
|
+ curl_close($ch);
|
|
|
+ return $data;
|
|
|
+}
|
|
|
|
|
|
- $ch = curl_init();
|
|
|
-
|
|
|
- curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
|
|
|
- curl_setopt($ch, CURLOPT_HEADER, 0);
|
|
|
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
|
- curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
|
|
|
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
|
|
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
|
|
-
|
|
|
- $data = curl_exec($ch);
|
|
|
- curl_close($ch);
|
|
|
-
|
|
|
- return $data;
|
|
|
-
|
|
|
+function getExtension($string)
|
|
|
+{
|
|
|
+ return preg_replace("#(.+)?\.(\w+)(\?.+)?#", "$2", $string);
|
|
|
}
|