aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/jbroadway/urlify/scripts/filter.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-10-22 07:46:30 +0000
committerMario <mario@mariovavti.com>2021-10-22 07:46:30 +0000
commit22588e58f31f60586445c19031979aaffcd95714 (patch)
tree2df842da4a6a826668d95d392566e2b4a5e37399 /vendor/jbroadway/urlify/scripts/filter.php
parent69ba4eb0558938845fdc96957850672940965e11 (diff)
downloadvolse-hubzilla-22588e58f31f60586445c19031979aaffcd95714.tar.gz
volse-hubzilla-22588e58f31f60586445c19031979aaffcd95714.tar.bz2
volse-hubzilla-22588e58f31f60586445c19031979aaffcd95714.zip
install urlify via composer
Diffstat (limited to 'vendor/jbroadway/urlify/scripts/filter.php')
-rw-r--r--vendor/jbroadway/urlify/scripts/filter.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/vendor/jbroadway/urlify/scripts/filter.php b/vendor/jbroadway/urlify/scripts/filter.php
new file mode 100644
index 000000000..d20c31594
--- /dev/null
+++ b/vendor/jbroadway/urlify/scripts/filter.php
@@ -0,0 +1,25 @@
+<?php
+
+//
+// Filter the provided argument or stdin if the argument was not present
+//
+
+require_once \dirname(__DIR__) . '/vendor/autoload.php';
+require_once \dirname(__DIR__) . '/URLify.php';
+
+// Print usage and exit if arguments are invalid
+if ($argc < 1 || $argc > 2) {
+ die('Usage (argument): php ' . \basename(__FILE__) . " \"<text to filter>\"\nUsage (pipe): <Arbitrary command> | php " . \basename(__FILE__) . "\n");
+}
+
+// Process the provided argument
+$piped = false;
+if ($argc === 2) {
+ $s = $argv[1];
+// Or read from stdin if the argument wasn't present
+} else {
+ $piped = true;
+ $s = \file_get_contents('php://stdin');
+}
+
+echo URLify::filter($s) . ($piped ? "\n" : '');