Actualización

This commit is contained in:
Xes
2025-04-10 12:24:57 +02:00
parent 8969cc929d
commit 45420b6f0d
39760 changed files with 4303286 additions and 0 deletions

12
vendor/sabre/vobject/bin/bench.php vendored Normal file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env php
<?php
include __DIR__ . '/../vendor/autoload.php';
$data = stream_get_contents(STDIN);
$start = microtime(true);
$lol = Sabre\VObject\Reader::read($data);
echo "time: " . (microtime(true)-$start) . "\n";

View File

@@ -0,0 +1,47 @@
#!/usr/bin/env php
<?php
$windowsZonesUrl = 'http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml';
$outputFile = __DIR__ . '/../lib/timezonedata/windowszones.php';
echo "Fetching timezone map from: " . $windowsZonesUrl, "\n";
$data = file_get_contents($windowsZonesUrl);
$xml = simplexml_load_string($data);
$map = array();
foreach($xml->xpath('//mapZone') as $mapZone) {
$from = (string)$mapZone['other'];
$to = (string)$mapZone['type'];
list($to) = explode(' ', $to, 2);
if (!isset($map[$from])) {
$map[$from] = $to;
}
}
ksort($map);
echo "Writing to: $outputFile\n";
$f = fopen($outputFile,'w');
fwrite($f, "<?php\n\n");
fwrite($f, "/**\n");
fwrite($f, " * Automatically generated timezone file\n");
fwrite($f, " *\n");
fwrite($f, " * Last update: " . date(DATE_W3C) . "\n");
fwrite($f, " * Source: " .$windowsZonesUrl . "\n");
fwrite($f, " *\n");
fwrite($f, " * @copyright Copyright (C) 2007-2014 fruux GmbH (https://fruux.com/).\n");
fwrite($f, " * @license http://sabre.io/license/ Modified BSD License\n");
fwrite($f, " */\n");
fwrite($f, "\n");
fwrite($f, "return ");
fwrite($f, var_export($map, true) . ';');
fclose($f);
echo "Done\n";

241
vendor/sabre/vobject/bin/generate_vcards vendored Normal file
View File

@@ -0,0 +1,241 @@
#!/usr/bin/env php
<?php
namespace Sabre\VObject;
// This sucks.. we have to try to find the composer autoloader. But chances
// are, we can't find it this way. So we'll do our bestest
$paths = array(
__DIR__ . '/../vendor/autoload.php', // In case vobject is cloned directly
__DIR__ . '/../../../autoload.php', // In case vobject is a composer dependency.
);
foreach($paths as $path) {
if (file_exists($path)) {
include $path;
break;
}
}
if (!class_exists('Sabre\\VObject\\Version')) {
fwrite(STDERR, "Composer autoloader could not be properly loaded.\n");
die(1);
}
if ($argc < 2) {
$version = Version::VERSION;
$help = <<<HI
sabre/vobject $version
Usage:
generate_vcards [count]
Options:
count The number of random vcards to generate
Examples:
generate_vcards 1000 > testdata.vcf
HI;
fwrite(STDERR, $help);
exit(2);
}
$count = (int)$argv[1];
if ($count < 1) {
fwrite(STDERR, "Count must be at least 1\n");
exit(2);
}
fwrite(STDERR, "sabre/vobject " . Version::VERSION . "\n");
fwrite(STDERR, "Generating " . $count . " vcards in vCard 4.0 format\n");
/**
* The following list is just some random data we compiled from various
* sources online.
*
* Very little thought went into compiling this list, and certainly nothing
* political or ethical.
*
* We would _love_ more additions to this to add more variation to this list.
*
* Send us PR's and don't be shy adding your own first and last name for fun.
*/
$sets = array(
"nl" => array(
"country" => "Netherlands",
"boys" => array(
"Anno",
"Bram",
"Daan",
"Evert",
"Finn",
"Jayden",
"Jens",
"Jesse",
"Levi",
"Lucas",
"Luuk",
"Milan",
"René",
"Sem",
"Sibrand",
"Willem",
),
"girls" => array(
"Celia",
"Emma",
"Fenna",
"Geke",
"Inge",
"Julia",
"Lisa",
"Lotte",
"Mila",
"Sara",
"Sophie",
"Tess",
"Zoë",
),
"last" => array(
"Bakker",
"Bos",
"De Boer",
"De Groot",
"De Jong",
"De Vries",
"Jansen",
"Janssen",
"Meyer",
"Mulder",
"Peters",
"Smit",
"Van Dijk",
"Van den Berg",
"Visser",
"Vos",
),
),
"us" => array(
"country" => "United States",
"boys" => array(
"Aiden",
"Alexander",
"Charles",
"David",
"Ethan",
"Jacob",
"James",
"Jayden",
"John",
"Joseph",
"Liam",
"Mason",
"Michael",
"Noah",
"Richard",
"Robert",
"Thomas",
"William",
),
"girls" => array(
"Ava",
"Barbara",
"Chloe",
"Dorothy",
"Elizabeth",
"Emily",
"Emma",
"Isabella",
"Jennifer",
"Lily",
"Linda",
"Margaret",
"Maria",
"Mary",
"Mia",
"Olivia",
"Patricia",
"Roxy",
"Sophia",
"Susan",
"Zoe",
),
"last" => array(
"Smith",
"Johnson",
"Williams",
"Jones",
"Brown",
"Davis",
"Miller",
"Wilson",
"Moore",
"Taylor",
"Anderson",
"Thomas",
"Jackson",
"White",
"Harris",
"Martin",
"Thompson",
"Garcia",
"Martinez",
"Robinson",
),
),
);
$current = 0;
$r = function($arr) {
return $arr[mt_rand(0,count($arr)-1)];
};
$bdayStart = strtotime('-85 years');
$bdayEnd = strtotime('-20 years');
while($current < $count) {
$current++;
fwrite(STDERR, "\033[100D$current/$count");
$country = array_rand($sets);
$gender = mt_rand(0,1)?'girls':'boys';
$vcard = new Component\VCard(array(
'VERSION' => '4.0',
'FN' => $r($sets[$country][$gender]) . ' ' . $r($sets[$country]['last']),
'UID' => UUIDUtil::getUUID(),
));
$bdayRatio = mt_rand(0,9);
if($bdayRatio < 2) {
// 20% has a birthday property with a full date
$dt = new \DateTime('@' . mt_rand($bdayStart, $bdayEnd));
$vcard->add('BDAY', $dt->format('Ymd'));
} elseif ($bdayRatio < 3) {
// 10% we only know the month and date of
$dt = new \DateTime('@' . mt_rand($bdayStart, $bdayEnd));
$vcard->add('BDAY', '--' . $dt->format('md'));
}
if ($result = $vcard->validate()) {
ob_start();
echo "\nWe produced an invalid vcard somehow!\n";
foreach($result as $message) {
echo " " . $message['message'] . "\n";
}
fwrite(STDERR, ob_get_clean());
}
echo $vcard->serialize();
}
fwrite(STDERR,"\nDone.\n");

View File

@@ -0,0 +1,91 @@
#!/usr/bin/env php
<?php
use Sabre\VObject;
if ($argc<2) {
$cmd = $argv[0];
fwrite(STDERR, <<<HI
Fruux test data generator
This script generates a lot of test data. This is used for profiling and stuff.
Currently it just generates events in a single calendar.
The iCalendar output goes to stdout. Other messages to stderr.
{$cmd} [events]
HI
);
die();
}
$events = 100;
if (isset($argv[1])) $events = (int)$argv[1];
include __DIR__ . '/../vendor/autoload.php';
fwrite(STDERR, "Generating " . $events . " events\n");
$currentDate = new DateTime('-' . round($events/2) . ' days');
$calendar = VObject\Component::create('VCALENDAR');
$calendar->version = '2.0';
$calendar->calscale = 'GREGORIAN';
$ii=0;
while($ii < $events) {
$ii++;
$event = VObject\Component::create('VEVENT');
$event->DTSTART = 'bla';
$event->SUMMARY = 'Event #' . $ii;
$event->UID = md5(microtime(true));
$doctorRandom = mt_rand(1,1000);
switch($doctorRandom) {
// All-day event
case 1 :
$event->DTEND = 'bla';
$dtStart = clone $currentDate;
$dtEnd = clone $currentDate;
$dtEnd->modify('+' . mt_rand(1,3) . ' days');
$event->DTSTART->setDateTime($dtStart, VObject\Property\DateTime::DATE);
$event->DTEND->setDateTime($dtEnd, VObject\Property\DateTime::DATE);
break;
case 2 :
$event->RRULE = 'FREQ=DAILY;COUNT=' . mt_rand(1,10);
// No break intentional
default :
$dtStart = clone $currentDate;
$dtStart->setTime(mt_rand(1,23), mt_rand(0,59), mt_rand(0,59));
$event->DTSTART->setDateTime($dtStart, VObject\Property\DateTime::UTC);
$event->DURATION = 'PT'.mt_rand(1,3).'H';
break;
}
$calendar->add($event);
$currentDate->modify('+ ' . mt_rand(0,3) . ' days');
}
fwrite(STDERR, "Validating\n");
$result = $calendar->validate();
if ($result) {
fwrite(STDERR, "Errors!\n");
fwrite(STDERR, print_r($result,true));
die(-1);
}
fwrite(STDERR, "Serializing this beast\n");
echo $calendar->serialize();
fwrite(STDERR, "done.\n");

32
vendor/sabre/vobject/bin/rrulebench.php vendored Normal file
View File

@@ -0,0 +1,32 @@
<?php
include __DIR__ . '/../vendor/autoload.php';
if ($argc < 4) {
echo "sabre/vobject ", Sabre\VObject\Version::VERSION, " RRULE benchmark\n";
echo "\n";
echo "This script can be used to measure the speed of the 'recurrence expansion'\n";
echo "system.";
echo "\n";
echo "Usage: " . $argv[0] . " inputfile.ics startdate enddate\n";
die();
}
list(, $inputFile, $startDate, $endDate) = $argv;
$bench = new Hoa\Bench\Bench();
$bench->parse->start();
echo "Parsing.\n";
$vobj = Sabre\VObject\Reader::read(fopen($inputFile,'r'));
$bench->parse->stop();
echo "Expanding.\n";
$bench->expand->start();
$vobj->expand(new DateTime($startDate), new DateTime($endDate));
$bench->expand->stop();
echo $bench,"\n";

27
vendor/sabre/vobject/bin/vobject vendored Normal file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env php
<?php
namespace Sabre\VObject;
// This sucks.. we have to try to find the composer autoloader. But chances
// are, we can't find it this way. So we'll do our bestest
$paths = array(
__DIR__ . '/../vendor/autoload.php', // In case vobject is cloned directly
__DIR__ . '/../../../autoload.php', // In case vobject is a composer dependency.
);
foreach($paths as $path) {
if (file_exists($path)) {
include $path;
break;
}
}
if (!class_exists('Sabre\\VObject\\Version')) {
fwrite(STDERR, "Composer autoloader could not be loaded.\n");
die(1);
}
$cli = new Cli();
exit($cli->main($argv));