mirror of
https://github.com/danog/MadelineClient.git
synced 2024-11-30 04:19:12 +01:00
Create MadelineCLI
This commit is contained in:
commit
9ed6cad494
44
src/hearot/Functions/MadelineFunctions.php
Normal file
44
src/hearot/Functions/MadelineFunctions.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
if (!function_exists('readline')) {
|
||||
function readline($prompt = null)
|
||||
{
|
||||
if ($prompt) {
|
||||
echo $prompt;
|
||||
}
|
||||
$fp = fopen('php://stdin', 'r');
|
||||
$line = rtrim(fgets($fp, 1024));
|
||||
return $line;
|
||||
}
|
||||
}
|
||||
function latinreadline($message)
|
||||
{
|
||||
do {
|
||||
if (isset($res)) {
|
||||
echo 'Only latin letters, numbers, dashes (-) and underscores (_) can be used!' . PHP_EOL;
|
||||
}
|
||||
$res = readline($message);
|
||||
} while (!preg_match('/^[A-Za-z0-9_.-]+$/', $res));
|
||||
return $res;
|
||||
}
|
||||
function platinreadline($message)
|
||||
{
|
||||
do {
|
||||
if (isset($res)) {
|
||||
echo 'A project with this name already exists!' . PHP_EOL;
|
||||
}
|
||||
$res = latinreadline($message);
|
||||
} while (file_exists($res));
|
||||
return $res;
|
||||
}
|
||||
|
||||
function emailreadline($message)
|
||||
{
|
||||
do {
|
||||
if (isset($res)) {
|
||||
echo 'This is not a valid email!' . PHP_EOL;
|
||||
}
|
||||
$res = readline($message);
|
||||
} while (!filter_var($res, FILTER_VALIDATE_EMAIL));
|
||||
|
||||
return $res;
|
||||
}
|
207
src/hearot/MadelineClient/MadelineClient.php
Normal file
207
src/hearot/MadelineClient/MadelineClient.php
Normal file
File diff suppressed because one or more lines are too long
0
start_madelineclient.php
Normal file
0
start_madelineclient.php
Normal file
Loading…
Reference in New Issue
Block a user