aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject/bin/vobjectvalidate.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-05-10 17:26:44 -0700
committerredmatrix <git@macgirvin.com>2016-05-10 17:26:44 -0700
commit0b02a6d123b2014705998c94ddf3d460948d3eac (patch)
tree78ff2cab9944a4f5ab3f80ec93cbe1120de90bb2 /vendor/sabre/vobject/bin/vobjectvalidate.php
parent40b5b6e9d2da7ab65c8b4d38cdceac83a4d78deb (diff)
downloadvolse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.tar.gz
volse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.tar.bz2
volse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.zip
initial sabre upgrade (needs lots of work - to wit: authentication, redo the browser interface, and rework event export/import)
Diffstat (limited to 'vendor/sabre/vobject/bin/vobjectvalidate.php')
-rwxr-xr-xvendor/sabre/vobject/bin/vobjectvalidate.php139
1 files changed, 0 insertions, 139 deletions
diff --git a/vendor/sabre/vobject/bin/vobjectvalidate.php b/vendor/sabre/vobject/bin/vobjectvalidate.php
deleted file mode 100755
index e0b2a479f..000000000
--- a/vendor/sabre/vobject/bin/vobjectvalidate.php
+++ /dev/null
@@ -1,139 +0,0 @@
-#!/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);
-}
-
-fwrite(STDERR, "SabreTooth VObject validator " . Version::VERSION . "\n");
-
-
-$repair = false;
-$posArgs = array();
-
-// Argument parsing:
-foreach($argv as $k=>$v) {
-
- if ($k===0) {
- continue;
- }
- if (substr($v,0,2)==='--') {
- switch($v) {
- case '--repair' :
- $repair = true;
- break;
- default :
- throw new InvalidArgumentException('Unknown option: ' . $v);
- break;
- }
- continue;
- }
- $posArgs[] = $v;
-
-}
-
-function help() {
-
- global $argv;
-
- fwrite(STDERR, <<<HELP
-Usage instructions:
-
- {$argv[0]} [--repair] inputfile [outputfile]
-
- inputfile Input .vcf or .ics file.
- outputfile Output .vcf or .ics file. This is only used with --repair.
- --repair Attempt to automatically repair broken files.
-
-For both the output- and inputfile "-" can be specified, to use STDIN and STDOUT
-respectively.
-
-All other output from this script is sent to STDERR.
-
-https://github.com/fruux/sabre-vobject
-
-HELP
-);
-
-}
-
-if (count($posArgs) < 1) {
- help();
- die();
-}
-
-if ($posArgs[0]!=='-') {
- $input = fopen($posArgs[0],'r');
-} else {
- $input = STDIN;
-}
-
-if (isset($posArgs[1]) && $posArgs[1]!=='-') {
- $output = fopen($posArgs[1],'w');
-} else {
- $output = STDOUT;
-}
-
-// This is a bit of a hack to easily support multiple objects in a single file.
-$inputStr = "BEGIN:X-SABRE-WRAPPER\r\n" . stream_get_contents($input);
-
-$inputStr = rtrim($inputStr, "\r\n") . "\r\nEND:X-SABRE-WRAPPER\r\n";
-
-// Now the actual work.
-$vObj = Reader::read($inputStr);
-
-$objects = $vObj->children();
-
-foreach($objects as $child) {
-
- switch($child->name) {
- case 'VCALENDAR' :
- fwrite(STDERR, "iCalendar: " . (string)$child->VERSION . "\n");
- break;
- case 'VCARD' :
- fwrite(STDERR, "vCard: " . (string)$child->VERSION . "\n");
- break;
- default :
- fwrite(STDERR, "This was an unknown object, but it did parse. It's likely that validation will give you unexpected results.\n");
- break;
- }
-
- $options = 0;
- if ($repair) $options |= Node::REPAIR;
-
- $warnings = $child->validate($options);
-
- if (!count($warnings)) {
- fwrite(STDERR, "[GOOD NEWS] No warnings!\n");
- } else {
- foreach($warnings as $warn) {
-
- fwrite(STDERR, $warn['message'] . "\n");
-
- }
-
- }
-
- if ($repair) {
- fwrite($output, $child->serialize());
- }
-
-}
-