mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Update ide helpers and remember to include new utils class
This commit is contained in:
parent
28b5b5f9c2
commit
bad9f8bf0b
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* An helper file for Laravel 4, to provide autocomplete information to your IDE
|
||||
* Generated for Laravel 4.1.25 on 2014-10-01.
|
||||
* Generated for Laravel 4.1.25 on 2014-10-06.
|
||||
*
|
||||
* @author Barry vd. Heuvel <barryvdh@gmail.com>
|
||||
* @see https://github.com/barryvdh/laravel-ide-helper
|
||||
|
1207
_ide_helper_models.php
Normal file
1207
_ide_helper_models.php
Normal file
File diff suppressed because it is too large
Load Diff
55
app/libraries/timesheet_utils.php
Normal file
55
app/libraries/timesheet_utils.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
class TimesheetUtils
|
||||
{
|
||||
public static function parseEventSummary($summary) {
|
||||
if (preg_match('/^\s*([^\s:\/]+)(?:\/([^:]+))?\s*:\s*([^)].*$|$)$/s', $summary, $matches)) {
|
||||
return [strtoupper($matches[1]), strtolower($matches[2]), $matches[3]];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function parseICALEvent($eventstr) {
|
||||
if (preg_match_all('/(?:^|\r?\n)([^;:]+)[;:]([^\r\n]+)/s', $eventstr, $matches)) {
|
||||
// Build ICAL event array
|
||||
$data = ['summary' => ''];
|
||||
foreach ($matches[1] as $i => $key) {
|
||||
# Convert escaped linebreakes to linebreak
|
||||
$value = preg_replace("/\r?\n\s/", "", $matches[2][$i]);
|
||||
# Unescape , and ;
|
||||
$value = preg_replace('/\\\\([,;])/s', '$1', $value);
|
||||
$data[strtolower($key)] = $value;
|
||||
}
|
||||
return $data;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function parseICALDate($datestr) {
|
||||
$dt = null;
|
||||
$timezone = null;
|
||||
if (preg_match('/^TZID=(.+?):([12]\d\d\d)(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)$/', $datestr, $m)) {
|
||||
$timezone = $m[1];
|
||||
$dt = new DateTime("{$m[2]}-{$m[3]}-{$m[4]}T{$m[5]}:{$m[6]}:{$m[7]}", new DateTimeZone($m[1]));
|
||||
|
||||
} else if (preg_match('/^VALUE=DATE:([12]\d\d\d)(\d\d)(\d\d)$/', $datestr, $m)) {
|
||||
$dt = new DateTime("{$m[1]}-{$m[2]}-{$m[3]}T00:00:00", new DateTimeZone("UTC"));
|
||||
|
||||
} else if (preg_match('/^([12]\d\d\d)(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)Z$/', $datestr, $m)) {
|
||||
$dt = new DateTime("{$m[1]}-{$m[2]}-{$m[3]}T{$m[4]}:{$m[5]}:{$m[6]}", new DateTimeZone("UTC"));
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Convert all to UTC
|
||||
if($dt->getTimezone()->getName() != 'UTC') {
|
||||
$dt->setTimezone(new DateTimeZone('UTC'));
|
||||
}
|
||||
|
||||
return [$dt, $timezone];
|
||||
}
|
||||
}
|
@ -48,6 +48,7 @@
|
||||
"post-update-cmd": [
|
||||
"php artisan clear-compiled",
|
||||
"php artisan ide-helper:generate",
|
||||
"php artisan ide-helper:models -N",
|
||||
"php artisan optimize",
|
||||
"php artisan debugbar:publish"
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user