getting same results for every char, something is fucked

This commit is contained in:
Hash Borgir 2022-05-09 02:08:51 -06:00
parent bd7a2efed7
commit c4c1622902
34 changed files with 10884 additions and 128 deletions

1745
composer-setup.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
{ {
"require": { "require": {
"formr/formr": "^1.4"
} }
} }

66
composer.lock generated Normal file
View File

@ -0,0 +1,66 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "258b699c0424c13ac703f8354ef3c9bc",
"packages": [
{
"name": "formr/formr",
"version": "v1.4.4",
"source": {
"type": "git",
"url": "https://github.com/formr/Formr.git",
"reference": "ff1375f1723297f05acf4947612e863c5085e8e7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/formr/Formr/zipball/ff1375f1723297f05acf4947612e863c5085e8e7",
"reference": "ff1375f1723297f05acf4947612e863c5085e8e7",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"type": "library",
"autoload": {
"files": [
"class.formr.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0-only"
],
"authors": [
{
"name": "Tim Gavin",
"homepage": "https://formr.github.io",
"role": "Original Author"
}
],
"description": "Formr is a PHP micro-framework which helps you build and validate forms quickly, painlessly, and without all the messy overhead.",
"support": {
"issues": "https://github.com/formr/Formr/issues",
"source": "https://github.com/formr/Formr/tree/v1.4.4"
},
"funding": [
{
"url": "https://github.com/timgavin",
"type": "github"
}
],
"time": "2022-03-07T00:52:15+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.3.0"
}

BIN
composer.phar Normal file

Binary file not shown.

View File

@ -52,6 +52,9 @@ include "./_pdo.php";
include "./config.php"; include "./config.php";
require_once "./vendor/autoload.php";
if (!isset($_SESSION['modname']) || (!file_exists(APP_DB)) || (!file_exists($_SESSION['modname'] . ".db"))) { if (!isset($_SESSION['modname']) || (!file_exists(APP_DB)) || (!file_exists($_SESSION['modname'] . ".db"))) {
// first load, no active mod, go to switchmods to select mod // first load, no active mod, go to switchmods to select mod
header("Location: /switchMods.php"); header("Location: /switchMods.php");

View File

@ -52,7 +52,7 @@ function ddump($var) {
function dump($var) { function dump($var) {
echo "<pre>"; echo "<pre>";
echo "$var"; var_dump($var);
echo "</pre>"; echo "</pre>";
//header('Content-Type: application/json'); //header('Content-Type: application/json');

View File

@ -1,46 +1,29 @@
<?php <?php
require_once 'D2SaveFileStructureData.php'; require_once 'D2SaveFileStructureData.php';
require_once 'D2Files.php'; require_once 'D2Files.php';
class D2SaveFile { class D2SaveFile {
public $charData; public $charData;
public $sdata;
public $files;
public function __construct() { public function __construct() {
$sdata = new D2SaveFileStructureData(); $this->sdata = new D2SaveFileStructureData();
$D2Files = new D2Files(); $D2Files = new D2Files();
$files = $D2Files->getSaveFiles(); $this->files = $D2Files->getSaveFiles();
foreach ($files as $f) { foreach ($this->files as $f) {
$filePath = $_SESSION['savePath'] . $f; $filePath = $_SESSION['savePath'] . $f;
$fp = fopen($filePath, "rb+"); $fp = fopen($filePath, "rb+");
foreach ($sdata->qNorm as $k => $v) {
fseek($fp, $k);
$questsNorm[$k] = fread($fp, 2);
}
foreach ($sdata->qNM as $k => $v) {
fseek($fp, $k);
$questsNM[$k] = fread($fp, 2);
}
foreach ($sdata->qHell as $k => $v) {
fseek($fp, $k);
$questsHell[$k] = fread($fp, 2);
}
// read offsets here from sdata and put into $data which will be used for charData // read offsets here from sdata and put into $data which will be used for charData
foreach ($sdata->offsets as $k => $v) { foreach ($this->sdata->offsets as $k => $v) {
fseek($fp, $k); fseek($fp, $k);
$data[$k] = fread($fp, $v); $data[$k] = fread($fp, $v);
} }
@ -53,7 +36,11 @@ class D2SaveFile {
// $charData['Checksum'] = bin2hex($data['12']); // $charData['Checksum'] = bin2hex($data['12']);
// $charData['Activeweapon'] = unpack('l', $data['16']); // $charData['Activeweapon'] = unpack('l', $data['16']);
$charData['CharacterName'] = ($data[20]); $charData['CharacterName'] = str_replace("\0", "", $data[20]);
// ddump(str_replace("\0x00", '', $charData['CharacterName']));
$charData['CharacterStatus'] = array_filter(str_split(strtobits($data[36]))); $charData['CharacterStatus'] = array_filter(str_split(strtobits($data[36])));
@ -65,7 +52,7 @@ class D2SaveFile {
// $charData['Characterprogression'] = bindec($data['37']); // $charData['Characterprogression'] = bindec($data['37']);
$charData['CharacterClass'] = $sdata->class[unpack('C', $data[40])[1]]; $charData['CharacterClass'] = $this->sdata->class[unpack('C', $data[40])[1]];
$charData['CharacterLevel'] = unpack('C', $data[43])[1]; $charData['CharacterLevel'] = unpack('C', $data[43])[1];
@ -73,10 +60,10 @@ class D2SaveFile {
// $charData['Assignedskills'] = (unpack('i16', $data['56'])); // $charData['Assignedskills'] = (unpack('i16', $data['56']));
$charData['LeftmousebuttonskillID'] = $sdata->skills[unpack('i', $data[120])[1]]; $charData['LeftmousebuttonskillID'] = $this->sdata->skills[unpack('i', $data[120])[1]];
$charData['RightmousebuttonskillID'] = $sdata->skills[unpack('i', $data[124])[1]]; $charData['RightmousebuttonskillID'] = $this->sdata->skills[unpack('i', $data[124])[1]];
$charData['LeftswapmousebuttonskillID'] = $sdata->skills[unpack('i', $data[128])[1]]; $charData['LeftswapmousebuttonskillID'] = $this->sdata->skills[unpack('i', $data[128])[1]];
$charData['RightswapmousebuttonskillID'] = $sdata->skills[unpack('i', $data[132])[1]]; $charData['RightswapmousebuttonskillID'] = $this->sdata->skills[unpack('i', $data[132])[1]];
// $charData['Charactermenuappearance'] = unpack('i', $data[136]); // $charData['Charactermenuappearance'] = unpack('i', $data[136]);
@ -96,40 +83,108 @@ class D2SaveFile {
//$charData['Mercenaryexperience'] = $data['187']; //$charData['Mercenaryexperience'] = $data['187'];
foreach ($questsNorm as $k => $v) { $charData['Quests'][] = $this->getQuestData();
$x = array_filter(str_split(strtobits($v), 8));
if ($x[0][0]) {
$quests[] = ($sdata->qNorm[$k] . " => " . $x[0][0]);
}
}
foreach ($questsNM as $k => $v) {
$x = array_filter(str_split(strtobits($v), 8));
if ($x[0][0]) {
$quests[] = ($sdata->qNM[$k] . " => " . $x[0][0]);
}
}
foreach ($questsHell as $k => $v) {
$x = array_filter(str_split(strtobits($v), 8));
if ($x[0][0]) {
$quests[] = ($sdata->qHell[$k] . " => " . $x[0][0]);
}
}
$charData['Quests'] = $quests; $charData['Waypoints'] = $this->getWaypointsData();
$charData['Waypoints'] = $data[633];
$charData['NPCIntroductions'] = $data[714]; $charData['NPCIntroductions'] = $data[714];
$this->charData[] = $charData; $this->charData[] = $charData;
// ddump($charData); // ddump($charData);
} }
// ddump($this->charData);
return $this->charData; return $this->charData;
}
public function getQuestData() {
foreach ($this->files as $f) {
$questsNorm = null;
$questsNM = null;
$questsHell = null;
$quests = null;
$filePath = $_SESSION['savePath'] . $f;
$fp = fopen($filePath, "rb+");
foreach ($this->sdata->qNorm as $k => $v) {
fseek($fp, $k);
$questsNorm[$k] = fread($fp, 2);
}
foreach ($this->sdata->qNM as $k => $v) {
fseek($fp, $k);
$questsNM[$k] = fread($fp, 2);
}
foreach ($this->sdata->qHell as $k => $v) {
fseek($fp, $k);
$questsHell[$k] = fread($fp, 2);
}
foreach ($questsNorm as $k => $v) {
$x = (str_split(strtobits($v), 8));
//if ($x[0][0]) {
$quests['Norm'][$this->sdata->qNorm[$k]] = $x[0][0];
//}
}
foreach ($questsNM as $k => $v) {
$x = array_filter(str_split(strtobits($v), 8));
//if ($x[0][0]) {
$quests['NM'][$this->sdata->qNM[$k]] = $x[0][0];
//}
}
foreach ($questsHell as $k => $v) {
$x = array_filter(str_split(strtobits($v), 8));
//if ($x[0][0]) {
$quests['Hell'][$this->sdata->qHell[$k]] = $x[0][0];
//}
}
return $quests;
}
}
public function getWaypointsData() {
foreach ($this->files as $f) {
$filePath = $_SESSION['savePath'] . $f;
$fp = fopen($filePath, "rb+");
$wp = null;
fseek($fp, $this->sdata->wpOffsetsNorm);
$wp['Norm'] = (strtobits(fread($fp, 5)));
fseek($fp, $this->sdata->wpOffsetsNM);
$wp['NM'] = (strtobits(fread($fp, 5)));
fseek($fp, $this->sdata->wpOffsetsHell);
$wp['Hell'] = (strtobits(fread($fp, 5)));
// ddump($wp);
foreach ($wp['Norm'] as $k => $v) {
$waypoints['Norm'][$this->sdata->wpNames[$k]] = $v;
}
foreach ($wp['NM'] as $k => $v) {
$waypoints['NM'][$this->sdata->wpNames[$k]] = $v;
}
foreach ($wp['Hell'] as $k => $v) {
$waypoints['Hell'][$this->sdata->wpNames[$k]] = $v;
}
//ddump($waypoints);
return $wp;
}
} }
} }

View File

@ -99,9 +99,9 @@ class D2SaveFileStructureData {
395 => 'TheFallenAngel', 395 => 'TheFallenAngel',
397 => 'TerrorsEnd', 397 => 'TerrorsEnd',
399 => 'HellForge', 399 => 'HellForge',
401 => 'empty', 401 => 'empty1',
403 => 'empty', 403 => 'empty2',
405 => 'empty', 405 => 'empty3',
407 => 'traveledToAct5', 407 => 'traveledToAct5',
409 => 'completedTerrorsEnd', 409 => 'completedTerrorsEnd',
414 => 'SiegeOnHarrogath', 414 => 'SiegeOnHarrogath',
@ -140,9 +140,9 @@ class D2SaveFileStructureData {
488 => 'TheFallenAngelNM', 488 => 'TheFallenAngelNM',
490 => 'TerrorsEndNM', 490 => 'TerrorsEndNM',
492 => 'HellForgeNM', 492 => 'HellForgeNM',
494 => 'emptyNM', 494 => 'emptyNM1',
496 => 'emptyNM', 496 => 'emptyNM2',
498 => 'emptyNM', 498 => 'emptyNM3',
500 => 'traveledToAct5NM', 500 => 'traveledToAct5NM',
502 => 'completedTerrorsEndNM', 502 => 'completedTerrorsEndNM',
504 => 'SiegeOnHarrogathNM', 504 => 'SiegeOnHarrogathNM',
@ -181,9 +181,9 @@ class D2SaveFileStructureData {
578 => 'TheFallenAngelHell', 578 => 'TheFallenAngelHell',
580 => 'TerrorsEndHell', 580 => 'TerrorsEndHell',
582 => 'HellForgeHell', 582 => 'HellForgeHell',
584 => 'emptyHell', 584 => 'emptyHell1',
586 => 'emptyHell', 586 => 'emptyHell2',
588 => 'emptyHell', 588 => 'emptyHell3',
590 => 'traveledToAct5Hell', 590 => 'traveledToAct5Hell',
592 => 'completedTerrorsEndHell', 592 => 'completedTerrorsEndHell',
594 => 'SiegeOnHarrogathHell', 594 => 'SiegeOnHarrogathHell',
@ -202,6 +202,98 @@ class D2SaveFileStructureData {
96 => "v1.10+" 96 => "v1.10+"
]; ];
public $wpOffsetsNorm = 643;
public $wpOffsetsNM = 667;
public $wpOffsetsHell = 691;
public $wpRawNames = [
0 => 'Act 1 - Town',
1 => 'Act 1 - Wilderness 2',
2 => 'Act 1 - Wilderness 3',
3 => 'Act 1 - Wilderness 4',
4 => 'Act 1 - Wilderness 5',
5 => 'Act 1 - Courtyard 1',
6 => 'Act 1 - Jail 1',
7 => 'Act 1 - Courtyard 2',
8 => 'Act 1 - Catacombs 2',
9 => 'Act 2 - Town',
10 => 'Act 2 - Desert 2',
11 => 'Act 2 - Desert 3',
12 => 'Act 2 - Desert 4',
13 => 'Act 2 - Valley of the Kings',
14 => 'Act 2 - Sewer 1 B',
15 => 'Act 2 - Basement 1',
16 => 'Act 2 - Tomb 2 B',
17 => 'Act 2 - Arcane',
18 => 'Act 3 - Town',
19 => 'Act 3 - Jungle 1',
20 => 'Act 3 - Jungle 2',
21 => 'Act 3 - Jungle 3',
22 => 'Act 3 - Kurast 1',
23 => 'Act 3 - Kurast 2',
24 => 'Act 3 - Kurast 3',
25 => 'Act 3 - Travincal',
26 => 'Act 3 - Mephisto 2',
27 => 'Act 4 - Town',
28 => 'Act 4 - Mesa 3',
29 => 'Act 4 - Lava 1',
30 => 'Act 5 - Town',
31 => 'Act 5 - Barricade 1',
32 => 'Act 5 - Barricade 2',
33 => 'Act 5 - Ice Cave 1',
34 => 'Act 5 - Ice Cave 2',
35 => 'Act 5 - Barricade Snow',
36 => 'Act 5 - Ice Cave 3',
37 => 'Act 5 - Temple 2',
38 => 'Act 5 - Baal Temple 2'
];
public $wpNames = [
0 => 'Rogue Encampment',
1 => 'Cold Plains',
2 => 'Stony Field',
3 => 'Dark Wood',
4 => 'Black Marsh',
5 => 'Outer Cloister',
6 => 'Jail, level 1',
7 => 'Inner Cloister',
8 => 'Catacombs, level 2',
9 => 'Lut Gholein',
10 => 'Sewers, level 2',
11 => 'Dry Hills',
12 => 'Halls of the Dead, level 2',
13 => 'Far Oasis',
14 => 'Lost City',
15 => 'Palace Cellar, level 1',
16 => 'Arcane Sanctuary',
17 => 'Canyon of the Magi',
18 => 'Kurast Docks',
19 => 'Spider Forest',
20 => 'Great Marsh',
21 => 'Flayer Jungle',
22 => 'Lower Kurast',
23 => 'Kurast Bazaar',
24 => 'Upper Kurast',
25 => 'Travincal',
26 => 'Durance of Hate, level 2',
27 => 'Pandemonium Fortress',
28 => 'City of the Damned',
29 => 'River of Flames',
30 => 'Harrogath',
31 => 'Frigid Highlands',
32 => 'Arreat Plateau',
33 => 'Crystalline Passage',
34 => 'Halls of Pain',
35 => 'Glacial Trail',
36 => 'Frozen Tundra',
37 => "The Ancients' Way",
38 => 'Worldstone Keep, level 2'
];
/* /*
Initialize Skills From Skills.txt Initialize Skills From Skills.txt
*/ */

View File

@ -61,7 +61,7 @@
</div> </div>
<ul class="nav nav-tabs" id="Tabs" role="tablist"> <ul class="nav nav-tabs" id="Tabs" role="tablist">
<li class="nav-item" role="presentation"> <li class="nav-item" role="presentation">
<a class="nav-link active" id="Unique-tab" data-toggle="tab" href="#Unique" role="tab" aria-controls="Unique" aria-selected="true">Unique Items</a> <a class="nav-link" id="Unique-tab" data-toggle="tab" href="#Unique" role="tab" aria-controls="Unique" aria-selected="true">Unique Items</a>
</li> </li>
<!-- <li class="nav-item" role="presentation"> <!-- <li class="nav-item" role="presentation">
<a class="nav-link" id="Set-tab" data-toggle="tab" href="#Set" role="tab" aria-controls="Set" aria-selected="false">Set Items</a> <a class="nav-link" id="Set-tab" data-toggle="tab" href="#Set" role="tab" aria-controls="Set" aria-selected="false">Set Items</a>
@ -77,7 +77,7 @@
</li> </li>
--> -->
<li class="nav-item" role="presentation"> <li class="nav-item" role="presentation">
<a class="nav-link" id="Chars-tab" data-toggle="tab" href="#Chars" role="tab" aria-controls="Chars" aria-selected="false">Character Editor</a> <a class="nav-link active" id="Chars-tab" data-toggle="tab" href="#Chars" role="tab" aria-controls="Chars" aria-selected="false">Character Editor</a>
</li> </li>
<li class="nav-item" role="presentation"> <li class="nav-item" role="presentation">
@ -94,7 +94,7 @@
</div> </div>
</div> </div>
<div class="tab-content" id="TabContent"> <div class="tab-content" id="TabContent">
<div class="tab-pane fade show active" id="Unique" role="tabpanel" aria-labelledby="Unique-tab"> <div class="tab-pane fade" id="Unique" role="tabpanel" aria-labelledby="Unique-tab">
<?php require_once 'tabs/UniqueItems.php'; ?> <?php require_once 'tabs/UniqueItems.php'; ?>
</div> </div>
<div class="tab-pane fade" id="Set" role="tabpanel" aria-labelledby="Set-tab"> <div class="tab-pane fade" id="Set" role="tabpanel" aria-labelledby="Set-tab">
@ -113,7 +113,7 @@
<div class="tab-pane fade" id="Doc" role="tabpanel" aria-labelledby="Doc-tab"> <div class="tab-pane fade" id="Doc" role="tabpanel" aria-labelledby="Doc-tab">
<?php require_once 'tabs/Doc.php'; ?> <?php require_once 'tabs/Doc.php'; ?>
</div> </div>
<div class="tab-pane fade" id="Chars" role="tabpanel" aria-labelledby="Chars-tab"> <div class="tab-pane fade show active" id="Chars" role="tabpanel" aria-labelledby="Chars-tab">
<?php require_once 'tabs/Chars.php'; ?> <?php require_once 'tabs/Chars.php'; ?>
</div> </div>
<div class="tab-pane fade" id="Debug" role="tabpanel" aria-labelledby="Debug-tab"> <div class="tab-pane fade" id="Debug" role="tabpanel" aria-labelledby="Debug-tab">

View File

@ -1,4 +1,6 @@
<?php <?php
$form = new Formr\Formr();
/* /*
Copyright (C) 2021 Hash Borgir Copyright (C) 2021 Hash Borgir
@ -40,7 +42,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// var_dump($chars->charData); // dump($chars->charData);
?> ?>
@ -51,19 +53,24 @@
<ul class="nav nav-tabs" id="CTabs" role="tablist"> <ul class="nav nav-tabs" id="CTabs" role="tablist">
<?php <?php
$tabs = ''; $tabs = '';
foreach ($chars->charData as $c) { $counter = 1;
foreach ($chars->charData as $k => $c) {
$tabs .= <<<EOT if ($k == 0) {
$active = "active";
} else {
$active = "";
}
$tabs .= <<<EOT
<li class="nav-item" role="presentation"> <li class="nav-item" role="presentation">
<a class="nav-link btn btn-outline-danger" style="background: #ddd; border: 1px solid #888;" id="{$c['CharacterName']}-tab" data-toggle="tab" href="#{$c['CharacterName']}" role="tab" aria-controls="{$c['CharacterName']}" aria-selected="true"><img height="64" width="" src="img/chars/{$c['CharacterClass']}.gif">{$c['CharacterName']}</a> <a class="nav-link btn btn-outline-danger $active" style="background: #ddd; border: 1px solid #888;" id="{$c['CharacterName']}-tab" data-toggle="tab" href="#{$c['CharacterName']}" role="tab" aria-controls="{$c['CharacterName']}" aria-selected="true"><img height="64" width="" src="img/chars/{$c['CharacterClass']}.gif">{$c['CharacterName']}</a>
</li> </li>
EOT; EOT;
} }
echo $tabs; echo $tabs;
?> ?>
</ul> </ul>
@ -74,51 +81,68 @@ EOT;
<div class="tab-content" id="CTabContent"> <div class="tab-content" id="CTabContent">
<?php <?php
foreach ($c['Quests'] as $quest) {
foreach ($quest as $q) {
foreach ($q as $k => $v) {
$quest .= "$k = $v<br>";
}
}
}
foreach ($chars->charData as $k => $c) {
foreach ($c['Quests'] as $q) { if ($k == 0) {
$quest .= "<>"; $active = "active show";
} else {
$active = "";
} }
foreach ($chars->charData as $c) { // dump($c['Waypoints']);
$tabContent .= <<<EOT $tabContent .= <<<EOT
<div style="background: white;" class="tab-pane fade" id="{$c['CharacterName']}" role="tabpanel" aria-labelledby="{$c['CharacterName']}-tab"> <div style="background: white;" class="tab-pane fade $active" id="{$c['CharacterName']}" role="tabpanel" aria-labelledby="{$c['CharacterName']}-tab">
<h1 style="margin: 15px;">{$c['CharacterName']}</h1> <h1 style="margin: 15px;">{$c['CharacterName']}</h1>
<table>
<tr>
<td>
<img style="height: 240px;" src="img/chars/{$c['CharacterClass']}.gif">
</td>
<td>
<ul>
<li>Version: {$c['VersionID']}</li>
<li>Filesize: {$c['Filesize']}</li>
<li>CharacterStatus: {$c['CharacterStatus']}</li>
<li>CharacterClass: {$c['CharacterClass']}</li>
<li>CharacterLevel: {$c['CharacterLevel']}</li>
<li>Lastplayed: {$c['Lastplayed']}</li>
<li>LeftmousebuttonskillID: {$c['LeftmousebuttonskillID']}</li>
<li>LeftmousebuttonskillID: {$c['LeftmousebuttonskillID']}</li>
<li>LeftswapmousebuttonskillID: {$c['LeftswapmousebuttonskillID']}</li>
<li>RightswapmousebuttonskillID: {$c['RightswapmousebuttonskillID']}</li>
<li>Difficulty: {$c['Difficulty']}</li>
</ul>
</td>
<td>
<ul>
<li>{$c['Quests']}</li>
</ul>
</td> <div class="container" style="font-size: 14px;">
</tr> <div class="row">
</table> <div class="col">
<img src="/img/chars/{$c['CharacterClass']}.gif">
</div>
<div class="col">
<input type="text" id="ChracterName" name="ChracterName" maxlength="16" value="{$c['CharacterName']}">
<select id='CharacterClass'>
<option value="Amazon">Amazon</option>
<option value="Assassin">Assassin</option>
<option value="Barbarian">Barbarian</option>
<option value="Druid">Druid</option>
<option value="Paladin">Paladin</option>
<option value="Necromancer">Necromancer</option>
<option value="Sorceress">Sorceress</option>
</select>
<input type="number" id="CharacterLevel">
<input type="radio" id="DifficultyNormal" name="Difficulty" value="Normal">Normal<br>
<input type="radio" id="DifficultyNM" name="Difficulty" value="Normal">NM<br>
<input type="radio" id="DifficultyHell" name="Difficulty" value="Normal">Hell<br>
{$c['Waypoints']['Norm']}<br>
{$c['Waypoints']['NM']}<br>
{$c['Waypoints']['Hell']}<br>
</div>
<div class="col">$quest</div>
<div class="col">Col 3</div>
</div>
</div>
</div> </div>
EOT; EOT;
} }
echo $tabContent; echo $tabContent;
?> ?>
</div> </div>

12
vendor/autoload.php vendored Normal file
View File

@ -0,0 +1,12 @@
<?php
// autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
exit(1);
}
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitc002b0ed4ae15db45174e67795c09ce9::getLoader();

572
vendor/composer/ClassLoader.php vendored Normal file
View File

@ -0,0 +1,572 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see https://www.php-fig.org/psr/psr-0/
* @see https://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
/** @var ?string */
private $vendorDir;
// PSR-4
/**
* @var array[]
* @psalm-var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, array<int, string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, string>
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
* @var array[]
* @psalm-var array<string, array<string, string[]>>
*/
private $prefixesPsr0 = array();
/**
* @var array[]
* @psalm-var array<string, string>
*/
private $fallbackDirsPsr0 = array();
/** @var bool */
private $useIncludePath = false;
/**
* @var string[]
* @psalm-var array<string, string>
*/
private $classMap = array();
/** @var bool */
private $classMapAuthoritative = false;
/**
* @var bool[]
* @psalm-var array<string, bool>
*/
private $missingClasses = array();
/** @var ?string */
private $apcuPrefix;
/**
* @var self[]
*/
private static $registeredLoaders = array();
/**
* @param ?string $vendorDir
*/
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
}
/**
* @return string[]
*/
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
}
return array();
}
/**
* @return array[]
* @psalm-return array<string, array<int, string>>
*/
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
/**
* @return array[]
* @psalm-return array<string, string>
*/
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
/**
* @return array[]
* @psalm-return array<string, string>
*/
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
/**
* @return string[] Array of classname => path
* @psalm-return array<string, string>
*/
public function getClassMap()
{
return $this->classMap;
}
/**
* @param string[] $classMap Class to filename map
* @psalm-param array<string, string> $classMap
*
* @return void
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 base directories
*
* @return void
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*
* @return void
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*
* @return void
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*
* @return void
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*
* @return void
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
if (null === $this->vendorDir) {
return;
}
if ($prepend) {
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
} else {
unset(self::$registeredLoaders[$this->vendorDir]);
self::$registeredLoaders[$this->vendorDir] = $this;
}
}
/**
* Unregisters this instance as an autoloader.
*
* @return void
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
if (null !== $this->vendorDir) {
unset(self::$registeredLoaders[$this->vendorDir]);
}
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return true|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
return null;
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
/**
* Returns the currently registered loaders indexed by their corresponding vendor directories.
*
* @return self[]
*/
public static function getRegisteredLoaders()
{
return self::$registeredLoaders;
}
/**
* @param string $class
* @param string $ext
* @return string|false
*/
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*
* @param string $file
* @return void
* @private
*/
function includeFile($file)
{
include $file;
}

352
vendor/composer/InstalledVersions.php vendored Normal file
View File

@ -0,0 +1,352 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer;
use Composer\Autoload\ClassLoader;
use Composer\Semver\VersionParser;
/**
* This class is copied in every Composer installed project and available to all
*
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/
class InstalledVersions
{
/**
* @var mixed[]|null
* @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
*/
private static $installed;
/**
* @var bool|null
*/
private static $canGetVendors;
/**
* @var array[]
* @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/
private static $installedByVendor = array();
/**
* Returns a list of all package names which are present, either by being installed, replaced or provided
*
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
/**
* Returns a list of all package names with a specific type e.g. 'library'
*
* @param string $type
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackagesByType($type)
{
$packagesByType = array();
foreach (self::getInstalled() as $installed) {
foreach ($installed['versions'] as $name => $package) {
if (isset($package['type']) && $package['type'] === $type) {
$packagesByType[] = $name;
}
}
}
return $packagesByType;
}
/**
* Checks whether the given package is installed
*
* This also returns true if the package name is provided or replaced by another package
*
* @param string $packageName
* @param bool $includeDevRequirements
* @return bool
*/
public static function isInstalled($packageName, $includeDevRequirements = true)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
}
}
return false;
}
/**
* Checks whether the given package satisfies a version constraint
*
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
*
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
*
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
* @param string $packageName
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
* @return bool
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
/**
* Returns a version constraint representing all the range(s) which are installed for a given package
*
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
* whether a given version of a package is installed, and not just whether it exists
*
* @param string $packageName
* @return string Version constraint usable with composer/semver
*/
public static function getVersionRanges($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
$ranges = array();
if (isset($installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}
return $installed['versions'][$packageName]['version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getPrettyVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return $installed['versions'][$packageName]['pretty_version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
*/
public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
return $installed['versions'][$packageName]['reference'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
*/
public static function getInstallPath($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @return array
* @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
*/
public static function getRootPackage()
{
$installed = self::getInstalled();
return $installed[0]['root'];
}
/**
* Returns the raw installed.php data for custom implementations
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
* @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
*/
public static function getRawData()
{
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = include __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
return self::$installed;
}
/**
* Returns the raw data of all installed.php which are currently loaded for custom implementations
*
* @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/
public static function getAllRawData()
{
return self::getInstalled();
}
/**
* Lets you reload the static array from another file
*
* This is only useful for complex integrations in which a project needs to use
* this class but then also needs to execute another project's autoloader in process,
* and wants to ensure both projects have access to their version of installed.php.
*
* A typical case would be PHPUnit, where it would need to make sure it reads all
* the data it needs from this class, then call reload() with
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
* the project in which it runs can then also use this class safely, without
* interference between PHPUnit's dependencies and the project's dependencies.
*
* @param array[] $data A vendor/composer/installed.php data set
* @return void
*
* @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
*/
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
}
/**
* @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
}
}
}
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = require __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
$installed[] = self::$installed;
return $installed;
}
}

21
vendor/composer/LICENSE vendored Normal file
View File

@ -0,0 +1,21 @@
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

10
vendor/composer/autoload_classmap.php vendored Normal file
View File

@ -0,0 +1,10 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
);

10
vendor/composer/autoload_files.php vendored Normal file
View File

@ -0,0 +1,10 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'5640faacc2b60a961e5376b0effdd7ef' => $vendorDir . '/formr/formr/class.formr.php',
);

View File

@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
);

9
vendor/composer/autoload_psr4.php vendored Normal file
View File

@ -0,0 +1,9 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
);

57
vendor/composer/autoload_real.php vendored Normal file
View File

@ -0,0 +1,57 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitc002b0ed4ae15db45174e67795c09ce9
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInitc002b0ed4ae15db45174e67795c09ce9', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitc002b0ed4ae15db45174e67795c09ce9', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitc002b0ed4ae15db45174e67795c09ce9::getInitializer($loader));
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInitc002b0ed4ae15db45174e67795c09ce9::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequirec002b0ed4ae15db45174e67795c09ce9($fileIdentifier, $file);
}
return $loader;
}
}
/**
* @param string $fileIdentifier
* @param string $file
* @return void
*/
function composerRequirec002b0ed4ae15db45174e67795c09ce9($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
}

24
vendor/composer/autoload_static.php vendored Normal file
View File

@ -0,0 +1,24 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInitc002b0ed4ae15db45174e67795c09ce9
{
public static $files = array (
'5640faacc2b60a961e5376b0effdd7ef' => __DIR__ . '/..' . '/formr/formr/class.formr.php',
);
public static $classMap = array (
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->classMap = ComposerStaticInitc002b0ed4ae15db45174e67795c09ce9::$classMap;
}, null, ClassLoader::class);
}
}

56
vendor/composer/installed.json vendored Normal file
View File

@ -0,0 +1,56 @@
{
"packages": [
{
"name": "formr/formr",
"version": "v1.4.4",
"version_normalized": "1.4.4.0",
"source": {
"type": "git",
"url": "https://github.com/formr/Formr.git",
"reference": "ff1375f1723297f05acf4947612e863c5085e8e7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/formr/Formr/zipball/ff1375f1723297f05acf4947612e863c5085e8e7",
"reference": "ff1375f1723297f05acf4947612e863c5085e8e7",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"time": "2022-03-07T00:52:15+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"class.formr.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0-only"
],
"authors": [
{
"name": "Tim Gavin",
"homepage": "https://formr.github.io",
"role": "Original Author"
}
],
"description": "Formr is a PHP micro-framework which helps you build and validate forms quickly, painlessly, and without all the messy overhead.",
"support": {
"issues": "https://github.com/formr/Formr/issues",
"source": "https://github.com/formr/Formr/tree/v1.4.4"
},
"funding": [
{
"url": "https://github.com/timgavin",
"type": "github"
}
],
"install-path": "../formr/formr"
}
],
"dev": true,
"dev-package-names": []
}

32
vendor/composer/installed.php vendored Normal file
View File

@ -0,0 +1,32 @@
<?php return array(
'root' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'bd7a2efed7e2365f0ddffa28f04b1dd752ae988d',
'name' => '__root__',
'dev' => true,
),
'versions' => array(
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'bd7a2efed7e2365f0ddffa28f04b1dd752ae988d',
'dev_requirement' => false,
),
'formr/formr' => array(
'pretty_version' => 'v1.4.4',
'version' => '1.4.4.0',
'type' => 'library',
'install_path' => __DIR__ . '/../formr/formr',
'aliases' => array(),
'reference' => 'ff1375f1723297f05acf4947612e863c5085e8e7',
'dev_requirement' => false,
),
),
);

26
vendor/composer/platform_check.php vendored Normal file
View File

@ -0,0 +1,26 @@
<?php
// platform_check.php @generated by Composer
$issues = array();
if (!(PHP_VERSION_ID >= 50600)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.';
}
if ($issues) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
} elseif (!headers_sent()) {
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
}
}
trigger_error(
'Composer detected issues in your platform: ' . implode(' ', $issues),
E_USER_ERROR
);
}

View File

@ -0,0 +1,3 @@
# These are supported funding model platforms
github: [timgavin]

392
vendor/formr/formr/README.md vendored Normal file
View File

@ -0,0 +1,392 @@
# Formr
Formr is a ridiculously fast and easy PHP form builder, with support for Bootstrap and Bulma right out of the box!
Find docs here: [http://formr.github.io](http://formr.github.io)
If you find Formr useful, please consider starring the project and/or making a [donation](https://paypal.me/timgavin). Thank you!
## Features
- Create complex forms with server-side processing and validation in seconds
- Built-in support for Bootstrap and Bulma
- Built-in support for reCAPTCHA v3
- Built-in `POST` validation rules, including validating email, regex, comparisons, slugging, and hashing
- Instantly make one field required, all fields required, or all but one field required
- Create and validate radio groups and checkbox arrays in seconds
- Upload images: resize, rename, and create thumbnails
- Extensible: easily create and save your own field element wrappers
- Extensible: easily create and save your own dropdown menus
- Extensible: easily create and save your own form & validation sets
- Send plain text and HTML emails
- Generate CSRF tokens and honeypots
- Object-oriented; supports multiple forms per page
- Little helpers to assist in building, layout, testing and debugging
- And a ton of other cool stuff!
## Installation
#### Composer
Run the following command to install Formr with Composer
```bash
composer require formr/formr
```
Then include the `autoload.php` file and create a new form object.
```php
require_once 'vendor/autoload.php';
$form = new Formr\Formr();
```
#### Download
Download the .zip file and place the Formr folder in your project, then include the Formr class and create a new form object.
```php
require_once 'Formr/class.formr.php';
$form = new Formr\Formr();
```
## Bootstrap & Bulma Ready
Bootstrap and Bulma form classes are ready to go! Just tell Formr you want to use Bootstrap or Bulma when creating a new form and Formr will take care of the rest.
```php
$form = new Formr\Formr('bootstrap');
```
```php
$form = new Formr\Formr('bulma');
```
## Basic Example
Simply enter your form labels as a comma delimited string and Formr will build the form, complete with opening and closing tags, a submit button, and email validation - plus all values retained upon `POST`. Easy!
```php
$form = new Formr\Formr('bootstrap');
$form->create_form('Name, Email, Comments|textarea');
```
### Produces the following HTML
```html
<form action="/index.php" method="post" accept-charset="utf-8">
<div id="_name" class="form-group">
<label class="control-label" for="name">
Name
</label>
<input type="text" name="name" id="name" class="form-control">
</div>
<div id="_email" class="form-group">
<label class="control-label" for="email">
Email
</label>
<input type="email" name="email" id="email" class="form-control">
</div>
<div id="_comments" class="form-group">
<label class="control-label" for="comments">
Comments
</label>
<textarea name="comments" id="comments" class="form-control"></textarea>
</div>
<div id="_button" class="form-group">
<label class="sr-only" for="button"></label>
<button type="submit" name="button" id="button" class="btn btn-primary">Submit</button>
</div>
</form>
```
## Basic Example with More Control
Using the `create()` method tells Formr you want control over adding the form tags and submit button yourself. Otherwise it's the same as the Basic Example above.
```php
$form = new Formr\Formr('bootstrap');
$form->form_open();
$form->create('First name, Last name, Email address, Age|number, Comments|textarea');
$form->submit_button();
$form->form_close();
```
#### Produces the following HTML
```html
<form action="/index.php" method="post" accept-charset="utf-8">
<div id="_first_name" class="form-group">
<label class="control-label" for="first_name">
First name
</label>
<input type="text" name="first_name" id="first_name" class="form-control">
</div>
<div id="_last_name" class="form-group">
<label class="control-label" for="last_name">
Last name
</label>
<input type="text" name="last_name" id="last_name" class="form-control">
</div>
<div id="_email_address" class="form-group">
<label class="control-label" for="email_address">
Email address
</label>
<input type="email" name="email_address" id="email_address" class="form-control">
</div>
<div id="_age" class="form-group">
<label class="control-label" for="age">
Age
</label>
<input type="number" name="age" id="age" class="form-control">
</div>
<div id="_comments" class="form-group">
<label class="control-label" for="comments">
Comments
</label>
<textarea name="comments" id="comments" class="form-control"></textarea>
</div>
<div id="_submit" class="form-group">
<label class="sr-only" for="submit"></label>
<button type="submit" name="submit" id="submit" class="btn btn-primary">Submit</button>
</div>
</form>
```
## Pre-Built Forms
Formr has several common forms already baked in, and it's really easy to [create and save your own](https://github.com/formr/extend).
```php
$form = new Formr\Formr();
$form->fastform('contact');
```
#### Produces the following HTML
```html
<form action="/index.php" method="post" accept-charset="utf-8">
<fieldset>
<label for="fname">
First name:
</label>
<input type="text" name="fname" id="fname" class="input">
<label for="lname">
Last name:
</label>
<input type="text" name="lname" id="lname" class="input">
<label for="email">
Email:
</label>
<input type="email" name="email" id="email" class="input">
<label for="comments">
Comments:
</label>
<textarea name="comments" id="comments" class="input" ></textarea>
<input type="submit" name="submit" value="Submit" id="submit">
</fieldset>
</form>
```
## Build Forms With Arrays
```php
$data = [
'text' => 'name, Name:',
'email' => 'email, Email:',
'checkbox' => 'agree, I Agree',
];
$form = new Formr\Formr('bootstrap');
$form->fastform($data);
```
#### Produces the following HTML
```html
<form action="/index.php" method="post" accept-charset="utf-8">
<fieldset>
<div id="_name" class="form-group">
<label class="control-label" for="name">
Name:
</label>
<input type="text" name="name" class="form-control" id="name">
</div>
<div id="_email" class="form-group">
<label class="control-label" for="email">
Email:
</label>
<input type="email" name="email" class="form-control" id="email">
</div>
<div id="_agree" class="checkbox">
<label for="agree">
<input type="checkbox" name="agree" value="agree" id="agree"> I Agree
</label>
</div>
<div id="_submit" class="form-group">
<label class="sr-only" for="submit"></label>
<input type="submit" name="submit" value="Submit" id="submit" class="btn">
</div>
</fieldset>
</form>
```
## Build Forms in HTML
You have full control over how you build your forms...
```html
<div class="my-wrapper-class">
<?php $form->text('name', 'Name'); ?>
</div>
<div class="my-wrapper-class">
<?php $form->email('email', 'Email address', 'john@example.com', 'emailID', 'placeholder="email@domain.com"'); ?>
</div>
<div class="my-wrapper-class">
<input type="text" name="address" value="<?php $form->value('address') ?>">
</div>
```
#### Produces the following HTML
```html
<div class="my-wrapper-class">
<label for="name">
Name
</label>
<input type="text" name="name" id="name">
</div>
<div class="my-wrapper-class">
<label for="emailID">
Email address
</label>
<input type="email" name="email" id="emailID" value="john@example.com" placeholder="email@domain.com">
</div>
```
## Retrieving POST Values
It's super easy to retrieve your `$_POST` values and assign them to variables!
```php
$name = $form->post('name');
$email = $form->post('email');
```
## Validation
#### Formr can easly process and validate your forms
Like the `create()` method, we can pass a list of our form labels to the `validate()` method, which will get the `$_POST` values of our form fields and put them into an array. If your field name is `email`, a `valid_email` validation rule will be applied automatically!
#### Basic usage
```php
$form->validate('Name, Email, Comments');
```
Let's make sure the form was submitted, then we'll validate and get the value of our email field from the array.
```php
if($form->submitted()) {
$data = $form->validate('Name, Email, Comments');
$email = $data['email'];
}
```
#### Adding Rules
Let's make sure `Name` is a minimum of 2 characters and a maximum of 30 by adding our validation rules wrapped in parentheses.
```php
$form->validate('Name(min[2]|max[30]), Email, Comments');
```
## Fine-Tune Your Validation
Of course you can get more in-depth with your validation, and even add custom error messaging! The following is a basic example, however Formr's validation methods are quite powerful and include, among other things, comparing values between fields and hashing using `bcrypt()`
Let's get the value of our `email` field using the `post()` method.
```php
$email = $form->post('email');
```
Now let's make sure it's a valid email address by entering the `valid_email` validation rule in the third parameter. If there's an error, the text entered into the second parameter will notify the user to correct the `Email` field.
```php
$email = $form->post('email','Email','valid_email');
```
We can take that a step further and enter a full custom error message in the second parameter to make our forms even more user-friendly.
```php
$email = $form->post('email','Email|Please enter a valid email address','valid_email');
```
## Full Example
```php
<?php
// include the Formr class
require_once 'Formr/class.formr.php';
// create our form object and use Bootstrap 4 as our form wrapper
$form = new Formr\Formr('bootstrap');
// make all fields required
$form->required = '*';
// check if the form has been submitted
if($form->submitted())
{
// make sure our Message field has at least 10 characters
$form->validate('Message(min[10])');
// let's email the form
$to = 'me@email.com';
$from = 'donotreply@domain.com';
$subject = 'Contact Form Submission';
// this processes our form, cleans the input, and sends it as an HTML email
if($form->send_email($to, $subject, 'POST', $from, 'HTML'))
{
// email sent; print a thank you message
$form->success_message('Thank you for filling out our form!');
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Formr</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" crossorigin="anonymous">
</head>
<body>
<div class="container">
<?php
// print messages, formatted using Bootstrap alerts
$form->messages();
// create the form
$form->create_form('First name, Last name, Email address, Message|textarea');
?>
</div>
</body>
</html>
```

5217
vendor/formr/formr/class.formr.php vendored Normal file

File diff suppressed because it is too large Load Diff

27
vendor/formr/formr/composer.json vendored Normal file
View File

@ -0,0 +1,27 @@
{
"name": "formr/formr",
"description": "Formr is a PHP micro-framework which helps you build and validate forms quickly, painlessly, and without all the messy overhead.",
"type": "library",
"license": "GPL-2.0-only",
"require": {
"php": ">=5.6"
},
"authors": [
{
"name": "Tim Gavin",
"homepage": "https://formr.github.io",
"role": "Original Author"
}
],
"repositories": [
{
"type": "vcs",
"url": "https://github.com/formr/formr"
}
],
"autoload": {
"files": [
"class.formr.php"
]
}
}

View File

@ -0,0 +1,619 @@
<?php
class Dropdowns extends Formr\Formr
{
# these methods contain arrays which are to be used in dropdown menus.
# documentation: https://formr.github.io/methods/#drop-downs-use-strings
# extend formr and create your own: https://github.com/formr/extend
# months with full name as key
public static function months()
{
return [
'January' => 'January',
'February' => 'February',
'March' => 'March',
'April' => 'April',
'May' => 'May',
'June' => 'June',
'July' => 'July',
'August' => 'August',
'September' => 'September',
'October' => 'October',
'November' => 'November',
'December' => 'December'
];
}
public static function days()
{
$stop_day = 31;
# get the current year
$start_day = 1;
# initialize the years array
$days = [];
# starting with the current year,
# loop through the years until we reach the stop date
for ($i = $start_day; $i <= $stop_day; $i++) {
$days[$i] = $i;
}
return $days;
}
# displays every year starting from 1930, good for registration forms
public static function years()
{
$stop_date = date('Y');
# get the current year
$start_date = 1930;
# initialize the years array
$years = [];
# starting with the current year,
# loop through the years until we reach the stop date
for ($i = $start_date; $i <= $stop_date; $i++) {
$years[$i] = $i;
}
# reverse the array so we have 1930 at the bottom of the menu
$return = array_reverse($years, true);
return $return;
}
# displays months of the year with a numeric key
public static function months_alpha()
{
return [
1 => 'January',
2 => 'February',
3 => 'March',
4 => 'April',
5 => 'May',
6 => 'June',
7 => 'July',
8 => 'August',
9 => 'September',
10 => 'October',
11 => 'November',
12 => 'December'
];
}
# another months - good for credit cards
public static function cc_months()
{
return [
1 => '01 - January',
2 => '02 - February',
3 => '03 - March',
4 => '04 - April',
5 => '05 - May',
6 => '06 - June',
7 => '07 - July',
8 => '08 - August',
9 => '09 - September',
10 => '10 - October',
11 => '11 - November',
12 => '12 - December'
];
}
# years - for credit cards
public static function cc_years()
{
$stop_date = 2025;
# get the current year
$current_year = date('Y');
# initialize the years array
$years = [];
# starting with the current year,
# loop through the years until we reach the stop date
for ($i = $current_year; $i <= $stop_date; $i++) {
$years[$i] = $i;
}
return $years;
}
public static function height()
{
return [
'3-0' => "Under 4'",
'4-0' => "4' 0&quot",
'4-1' => "4' 1&quot",
'4-2' => "4' 2&quot",
'4-3' => "4' 3&quot",
'4-4' => "4' 4&quot",
'4-5' => "4' 5&quot",
'4-6' => "4' 6&quot",
'4-7' => "4' 7&quot",
'4-8' => "4' 8&quot",
'4-9' => "4' 9&quot",
'4-10' => "4' 10&quot",
'4-11' => "4' 11&quot",
'5-0' => "5' 0&quot",
'5-1' => "5' 1&quot",
'5-2' => "5' 2&quot",
'5-3' => "5' 3&quot",
'5-4' => "5' 4&quot",
'5-5' => "5' 5&quot",
'5-6' => "5' 6&quot",
'5-7' => "5' 7&quot",
'5-8' => "5' 8&quot",
'5-9' => "5' 9&quot",
'5-10' => "5' 10&quot",
'5-11' => "5' 11&quot",
'6-0' => "6' &amp; Over",
];
}
# makes sure a person is of a certain age - in this case: 18
public static function years_old()
{
$stop_date = date('Y', strtotime('-18 year'));
$start_date = 1930;
# initialize the years array
$years = [];
# starting with the current year,
# loop through the years until we reach the stop date
for ($i = $start_date; $i <= $stop_date; $i++) {
$years[$i] = $i;
}
# reverse the array so we have the start date at the bottom of the menu
$return = array_reverse($years, true);
return $return;
}
public static function age()
{
foreach (range(18, 24) as $value) {
$ages[$value] = $value;
}
$ages[25] = '25-29';
$ages[30] = '30-34';
$ages[35] = '35-39';
$ages[40] = '40-44';
$ages[45] = '45-49';
$ages[50] = '50+';
return $ages;
}
# u.s. states
public static function states()
{
return [
'' => 'Select a State...',
'AL' => 'Alabama',
'AK' => 'Alaska',
'AZ' => 'Arizona',
'AR' => 'Arkansas',
'CA' => 'California',
'CO' => 'Colorado',
'CT' => 'Connecticut',
'DE' => 'Delaware',
'FL' => 'Florida',
'GA' => 'Georgia',
'HI' => 'Hawaii',
'ID' => 'Idaho',
'IL' => 'Illinois',
'IN' => 'Indiana',
'IA' => 'Iowa',
'KS' => 'Kansas',
'KY' => 'Kentucky',
'LA' => 'Louisiana',
'ME' => 'Maine',
'MD' => 'Maryland',
'MA' => 'Massachusetts',
'MI' => 'Michigan',
'MN' => 'Minnesota',
'MS' => 'Mississippi',
'MO' => 'Missouri',
'MT' => 'Montana',
'NE' => 'Nebraska',
'NV' => 'Nevada',
'NH' => 'New Hampshire',
'NJ' => 'New Jersey',
'NM' => 'New Mexico',
'NY' => 'New York',
'NC' => 'North Carolina',
'ND' => 'North Dakota',
'OH' => 'Ohio',
'OK' => 'Oklahoma',
'OR' => 'Oregon',
'PA' => 'Pennsylvania',
'RI' => 'Rhode Island',
'SC' => 'South Carolina',
'SD' => 'South Dakota',
'TN' => 'Tennessee',
'TX' => 'Texas',
'UT' => 'Utah',
'VT' => 'Vermont',
'VA' => 'Virginia',
'WA' => 'Washington',
'DC' => 'Washington D.C.',
'WV' => 'West Virginia',
'WI' => 'Wisconsin',
'WY' => 'Wyoming'
];
}
# alias of states()
public static function state()
{
return static::states();
}
# canadian provinces and territories
public static function provinces()
{
return [
'' => 'Province or Territory...',
'AB' => 'Alberta',
'BC' => 'British Columbia',
'MB' => 'Manitoba',
'NB' => 'New Brunswick',
'NL' => 'Newfoundland and Labrador',
'NS' => 'Nova Scotia',
'NT' => 'Northwest Territories',
'NU' => 'Nunavut',
'ON' => 'Ontario',
'PE' => 'Prince Edward Island',
'QC' => 'Quebec',
'SK' => 'Saskatchewan',
'YT' => 'Yukon'
];
}
# u.s. states and canadian provinces
public static function states_provinces()
{
return [
'' => 'Select a State or Province...',
'States' => [
'AL' => 'Alabama',
'AK' => 'Alaska',
'AZ' => 'Arizona',
'AR' => 'Arkansas',
'CA' => 'California',
'CO' => 'Colorado',
'CT' => 'Connecticut',
'DE' => 'Delaware',
'FL' => 'Florida',
'GA' => 'Georgia',
'HI' => 'Hawaii',
'ID' => 'Idaho',
'IL' => 'Illinois',
'IN' => 'Indiana',
'IA' => 'Iowa',
'KS' => 'Kansas',
'KY' => 'Kentucky',
'LA' => 'Louisiana',
'ME' => 'Maine',
'MD' => 'Maryland',
'MA' => 'Massachusetts',
'MI' => 'Michigan',
'MN' => 'Minnesota',
'MS' => 'Mississippi',
'MO' => 'Missouri',
'MT' => 'Montana',
'NE' => 'Nebraska',
'NV' => 'Nevada',
'NH' => 'New Hampshire',
'NJ' => 'New Jersey',
'NM' => 'New Mexico',
'NY' => 'New York',
'NC' => 'North Carolina',
'ND' => 'North Dakota',
'OH' => 'Ohio',
'OK' => 'Oklahoma',
'OR' => 'Oregon',
'PA' => 'Pennsylvania',
'RI' => 'Rhode Island',
'SC' => 'South Carolina',
'SD' => 'South Dakota',
'TN' => 'Tennessee',
'TX' => 'Texas',
'UT' => 'Utah',
'VT' => 'Vermont',
'VA' => 'Virginia',
'WA' => 'Washington',
'DC' => 'Washington D.C.',
'WV' => 'West Virginia',
'WI' => 'Wisconsin',
'WY' => 'Wyoming'
],
'Provinces' => [
'AB' => 'Alberta',
'BC' => 'British Columbia',
'MB' => 'Manitoba',
'NB' => 'New Brunswick',
'NL' => 'Newfoundland and Labrador',
'NS' => 'Nova Scotia',
'NT' => 'Northwest Territories',
'NU' => 'Nunavut',
'ON' => 'Ontario',
'PE' => 'Prince Edward Island',
'QC' => 'Quebec',
'SK' => 'Saskatchewan',
'YT' => 'Yukon'
]
];
}
# countries
public static function countries()
{
return [
'' => 'Select a Country...',
'US' => 'United States ',
'CA' => 'Canada',
'GB' => 'United Kingdom',
' ' => '---------------',
'AF' => 'Afghanistan ',
'AL' => 'Albania ',
'DZ' => 'Algeria ',
'AS' => 'American Samoa',
'AD' => 'Andorra ',
'AO' => 'Angola',
'AI' => 'Anguilla',
'AQ' => 'Antarctica',
'AG' => 'Antigua and Barbuda ',
'AR' => 'Argentina ',
'AM' => 'Armenia ',
'AW' => 'Aruba ',
'AU' => 'Australia ',
'AT' => 'Austria ',
'AZ' => 'Azerbaijan',
'BS' => 'Bahamas ',
'BH' => 'Bahrain ',
'BD' => 'Bangladesh',
'BB' => 'Barbados',
'BY' => 'Belarus ',
'BE' => 'Belgium ',
'BZ' => 'Belize',
'BJ' => 'Benin ',
'BM' => 'Bermuda ',
'BT' => 'Bhutan',
'BO' => 'Bolivia ',
'BA' => 'Bosnia and Herzegowina',
'BW' => 'Botswana',
'BV' => 'Bouvet Island ',
'BR' => 'Brazil',
'IO' => 'British Indian Ocean Territory',
'BN' => 'Brunei Darussalam ',
'BG' => 'Bulgaria',
'BF' => 'Burkina Faso',
'BI' => 'Burundi ',
'KH' => 'Cambodia',
'CM' => 'Cameroon',
'CV' => 'Cape Verde',
'KY' => 'Cayman Islands',
'CF' => 'Central African Republic',
'TD' => 'Chad',
'CL' => 'Chile ',
'CN' => 'China ',
'CX' => 'Christmas Island',
'CC' => 'Cocos (Keeling) Islands ',
'CO' => 'Colombia',
'KM' => 'Comoros ',
'CG' => 'Congo ',
'CD' => 'Congo, the Democratic Republic of the ',
'CK' => 'Cook Islands',
'CR' => 'Costa Rica',
'CI' => 'Cote d\'Ivoire ',
'HR' => 'Croatia (Hrvatska)',
'CU' => 'Cuba',
'CY' => 'Cyprus',
'CZ' => 'Czech Republic',
'DK' => 'Denmark ',
'DJ' => 'Djibouti',
'DM' => 'Dominica',
'DO' => 'Dominican Republic',
'TP' => 'East Timor',
'EC' => 'Ecuador ',
'EG' => 'Egypt ',
'SV' => 'El Salvador ',
'GQ' => 'Equatorial Guinea ',
'ER' => 'Eritrea ',
'EE' => 'Estonia ',
'ET' => 'Ethiopia',
'FK' => 'Falkland Islands (Malvinas) ',
'FO' => 'Faroe Islands ',
'FJ' => 'Fiji',
'FI' => 'Finland ',
'FR' => 'France',
'FX' => 'France, Metropolitan',
'GF' => 'French Guiana ',
'PF' => 'French Polynesia',
'TF' => 'French Southern Territories ',
'GA' => 'Gabon ',
'GM' => 'Gambia',
'GE' => 'Georgia ',
'DE' => 'Germany ',
'GH' => 'Ghana ',
'GI' => 'Gibraltar ',
'GR' => 'Greece',
'GL' => 'Greenland ',
'GD' => 'Grenada ',
'GP' => 'Guadeloupe',
'GU' => 'Guam',
'GT' => 'Guatemala ',
'GN' => 'Guinea',
'GW' => 'Guinea-Bissau ',
'GY' => 'Guyana',
'HT' => 'Haiti ',
'HM' => 'Heard and Mc Donald Islands ',
'VA' => 'Holy See (Vatican City State) ',
'HN' => 'Honduras',
'HK' => 'Hong Kong ',
'HU' => 'Hungary ',
'IS' => 'Iceland ',
'IN' => 'India ',
'ID' => 'Indonesia ',
'IR' => 'Iran (Islamic Republic of)',
'IQ' => 'Iraq',
'IE' => 'Ireland ',
'IL' => 'Israel',
'IT' => 'Italy ',
'JM' => 'Jamaica ',
'JP' => 'Japan ',
'JO' => 'Jordan',
'KZ' => 'Kazakhstan',
'KE' => 'Kenya ',
'KI' => 'Kiribati',
'KP' => 'Korea, Democratic People\'s Republic of',
'KR' => 'Korea, Republic of',
'KW' => 'Kuwait',
'KG' => 'Kyrgyzstan',
'LA' => 'Lao People\'s Democratic Republic',
'LV' => 'Latvia',
'LB' => 'Lebanon ',
'LS' => 'Lesotho ',
'LR' => 'Liberia ',
'LY' => 'Libyan Arab Jamahiriya',
'LI' => 'Liechtenstein ',
'LT' => 'Lithuania ',
'LU' => 'Luxembourg',
'MO' => 'Macau ',
'MK' => 'Macedonia, The Former Yugoslav Republic of',
'MG' => 'Madagascar',
'MW' => 'Malawi',
'MY' => 'Malaysia',
'MV' => 'Maldives',
'ML' => 'Mali',
'MT' => 'Malta ',
'MH' => 'Marshall Islands',
'MQ' => 'Martinique',
'MR' => 'Mauritania',
'MU' => 'Mauritius ',
'YT' => 'Mayotte ',
'MX' => 'Mexico',
'FM' => 'Micronesia, Federated States of ',
'MD' => 'Moldova, Republic of',
'MC' => 'Monaco',
'MN' => 'Mongolia',
'MS' => 'Montserrat',
'MA' => 'Morocco ',
'MZ' => 'Mozambique',
'MM' => 'Myanmar ',
'NA' => 'Namibia ',
'NR' => 'Nauru ',
'NP' => 'Nepal ',
'NL' => 'Netherlands ',
'AN' => 'Netherlands Antilles',
'NC' => 'New Caledonia ',
'NZ' => 'New Zealand ',
'NI' => 'Nicaragua ',
'NE' => 'Niger ',
'NG' => 'Nigeria ',
'NU' => 'Niue',
'NF' => 'Norfolk Island',
'MP' => 'Northern Mariana Islands',
'NO' => 'Norway',
'OM' => 'Oman',
'PK' => 'Pakistan',
'PW' => 'Palau ',
'PA' => 'Panama',
'PG' => 'Papua New Guinea',
'PY' => 'Paraguay',
'PE' => 'Peru',
'PH' => 'Philippines ',
'PN' => 'Pitcairn',
'PL' => 'Poland',
'PT' => 'Portugal',
'PR' => 'Puerto Rico ',
'QA' => 'Qatar ',
'RE' => 'Reunion ',
'RO' => 'Romania ',
'RU' => 'Russian Federation',
'RW' => 'Rwanda',
'KN' => 'Saint Kitts and Nevis ',
'LC' => 'Saint LUCIA ',
'VC' => 'Saint Vincent and the Grenadines',
'WS' => 'Samoa ',
'SM' => 'San Marino',
'ST' => 'Sao Tome and Principe ',
'SA' => 'Saudi Arabia',
'SN' => 'Senegal ',
'SC' => 'Seychelles',
'SL' => 'Sierra Leone',
'SG' => 'Singapore ',
'SK' => 'Slovakia (Slovak Republic)',
'SI' => 'Slovenia',
'SB' => 'Solomon Islands ',
'SO' => 'Somalia ',
'ZA' => 'South Africa',
'GS' => 'South Georgia and the South Sandwich Islands',
'ES' => 'Spain ',
'LK' => 'Sri Lanka ',
'SH' => 'St. Helena',
'PM' => 'St. Pierre and Miquelon ',
'SD' => 'Sudan ',
'SR' => 'Suriname',
'SJ' => 'Svalbard and Jan Mayen Islands',
'SZ' => 'Swaziland ',
'SE' => 'Sweden',
'CH' => 'Switzerland ',
'SY' => 'Syrian Arab Republic',
'TW' => 'Taiwan',
'TJ' => 'Tajikistan',
'TZ' => 'Tanzania, United Republic of',
'TH' => 'Thailand',
'TG' => 'Togo',
'TK' => 'Tokelau ',
'TO' => 'Tonga ',
'TT' => 'Trinidad and Tobago ',
'TN' => 'Tunisia ',
'TR' => 'Turkey',
'TM' => 'Turkmenistan',
'TC' => 'Turks and Caicos Islands',
'TV' => 'Tuvalu',
'UG' => 'Uganda',
'UA' => 'Ukraine ',
'AE' => 'United Arab Emirates',
'UM' => 'United States Minor Outlying Islands',
'UY' => 'Uruguay ',
'UZ' => 'Uzbekistan',
'VU' => 'Vanuatu ',
'VE' => 'Venezuela ',
'VN' => 'Viet Nam',
'VG' => 'Virgin Islands (British)',
'VI' => 'Virgin Islands (U.S.) ',
'WF' => 'Wallis and Futuna Islands ',
'EH' => 'Western Sahara',
'YE' => 'Yemen ',
'YU' => 'Yugoslavia',
'ZM' => 'Zambia',
'ZW' => 'Zimbabwe'
];
}
# alias of countries()
public static function country()
{
return static::countries();
}
}

View File

@ -0,0 +1,146 @@
<?php
class Forms extends Formr\Formr
{
# these methods are used to wrap your form elements.
# documentation: https://github.com/formr/extend
public static function contact($validate = '')
{
if (!$validate)
{
/**
this section is where we'll build the form using an array. the array key contains
the input type, and the array value contains all of the field's attributes.
'array_key' => 'array value'
'field input type' => 'name , label text , value , input ID , string , .inline-text , selected/checked , $options'
*/
return [
'text1' => 'fname,First name:,,fname,,[please enter your first name]',
'text2' => 'lname,Last name:,,lname,,[please enter your last name]',
'email' => 'email,Email:,,email,,[please enter your email address]',
'text3' => 'city,City:,,city,,[please enter your city]',
'select1' => 'state,State:,,state,,[please select your state],,state',
'text4' => 'zip,Zip/Postal Code:,,zip,,[please enter your zip code]',
'select2' => 'country,Country:,,country,,[please select your country],US,country',
'textarea' => 'comments,Comments:,,comments,,[please enter some comments]',
'submit' => 'submit,,Submit Form,submit'
];
} else {
/**
now we'll build the corresponding key and human readable text and validation rules for the fastpost() method.
the key MUST match the field name! Separate your validation rules with a pipe | character, NOT a comma!
'field name' => '[human readable text, validation rules']
*/
return [
'fname' => ['Please enter your first name'],
'lname' => ['Please enter your last name'],
'email' => ['Please enter your email address', 'valid_email'],
'city' => ['Please enter your city'],
'state' => ['Please select your state'],
'zip' => ['Please enter your zip code', 'int|min_length[5]|max_length[10]'],
'country' => ['Please select your country'],
'comments' => ['Please enter your comments']
];
}
}
public static function short_contact($validate = '')
{
if (!$validate) {
# here we'll build the form array for the fastform() function
return [
'text1' => 'fname,First name:,,fname',
'text2' => 'lname,Last name:,,lname',
'email' => 'email,Email:,,email',
'textarea' => 'comments,Comments:,,comments'
];
} else {
# now we'll build the corresponding key and human readable text and validation rules for the fastpost() function
return [
'fname' => ['First name'],
'lname' => ['Last name'],
'email' => ['Email address', 'valid_email'],
'comments' => ['Comments']
];
}
}
public static function signup($validate = '')
{
if (!$validate) {
# here we'll build the form array for the fastform() function
return [
'text1' => 'email,Email:,,email',
'password2' => 'password,Password:,,password',
'password3' => 'confirm,Confirm password:,,confirm'
];
} else {
# now we'll build the corresponding key and human readable text and validation rules for the fastpost() function
return [
'email' => ['Email address', 'valid_email'],
'password' => ['Password', 'min_length[6]|hash'],
'confirm' => ['Confirm Password', 'min_length[6]|matches[password]']
];
}
}
# alias for signup
public static function registration($validate = '')
{
return static::signup($validate);
}
public static function login($validate = '')
{
if (!$validate) {
# here we'll build the form array for the fastform() function
return [
'text' => 'username,,,username,placeholder="username"',
'password' => 'password,,,password,placeholder="password"',
'submit' => 'submit,,Login'
];
} else {
# build the corresponding key and human readable text and validation rules for the fastpost() function
return [
'username' => ['Username', 'required'],
'password' => ['Password', 'required|hash']
];
}
}
public static function canadian_contact($validate = '')
{
if (!$validate) {
# here we'll build the form array for the fastform() function
return [
'text1' => 'fname,First name:,,fname',
'text2' => 'lname,Last name:,,lname',
'email' => 'email,Email:,,email',
'text3' => 'city,City:,,city',
'select1' => 'province,Province:,,province,,,,province',
'text4' => 'zip,Zip/Postal Code:,,zip',
'select2' => 'country,Country:,,country,,,CA,country',
'textarea' => 'comments,Comments:,,comments'
];
} else {
# build the cooresponding key, human readable text and validation rules for the fastpost() function
return [
'fname' => ['First name'],
'lname' => ['Last name'],
'email' => ['Email address', 'valid_email'],
'city' => ['City'],
'province' => ['Province'],
'postal' => ['Postal code', 'alphanumeric|min_length[6]|max_length[7]'],
'country' => ['Country'],
'comments' => ['Comments']
];
}
}
}

View File

@ -0,0 +1,137 @@
<?php
require_once 'wrappers/autoload.php';
class Wrapper extends Formr\Formr
{
use Bootstrap, Bulma;
public function __construct($instance) {
$this->formr = $instance;
$this->nl = "\r\n";
}
public static function default_css($key = '')
{
/*
These are Formr's default CSS classes; they are used if a framework is not specified when creating a form.
The array *value* is the class name that you would add to your CSS file.
<style>
.alert-error {
color: red;
}
</style>
*/
$array = [
'alert-e' => 'alert-error',
'alert-w' => 'alert-warning',
'alert-s' => 'alert-success',
'alert-i' => 'alert-info',
'button' => 'button',
'div' => 'field-wrap',
'file' => 'file',
'is-invalid' => 'is-invalid',
'label' => 'label',
'link' => 'link',
'list-dl' => 'list-dl',
'list-ol' => 'list-ol',
'list-ul' => 'list-ul',
'text-error' => 'text-error',
];
if ($key) {
return $array[$key];
} else {
return $array;
}
}
public function default_wrapper($wrapper, $element, $data)
{
# this is the default field wrapper; used if a framework is not specified
# enter the name of the css function so we can use it when calling css classes
$css = 'default_css';
# the type of lists Formr will accept as a wrapper
$list_tags = ['ul', 'ol', 'dl'];
# define our $return variable
$return = null;
# add a comment if $form->comments is enabled
$return .= $this->formr->_print_field_comment($data) . $this->nl;
# open the user-defined wrapper
if ($wrapper['open']) {
# don't print if wrapping with 'ul', 'li', or 'dl'
if (!in_array($wrapper['type'], $list_tags)) {
$return .= $wrapper['open'] . $this->nl;
}
} else {
# 'div' was entered
if($wrapper['type'] != '') {
$return .= '<div class="'.static::$css('div').'" id="_' . $this->formr->make_id($data) . '">' . $this->nl;
}
}
# add the list item tag if wrapping in a list
if ($wrapper['type'] == 'ul' || $wrapper['type'] == 'ol') {
$return .= '<li>' . $this->nl;
}
if ($wrapper['type'] == 'dl') {
$return .= '<dt>' . $this->nl;
}
# checkboxes and radios
if (in_array($data['type'], $this->formr->_input_types('checkbox'))) {
# wrap checkboxes and radios in a label
if (!empty($data['label'])) {
$return .= $this->formr->label_open($data['value'], $data['label'], $data['id']);
}
# add the field element
$return .= $element;
if (!empty($data['label'])) {
$return .= ' ' . $this->formr->label_close($data) . $this->nl;
}
} else {
# everything else
if (!empty($data['label'])) {
$return .= $this->formr->label($data);
}
# add the field element
$return .= $element . $this->nl;
}
# close the list tag if required
if ($wrapper['type'] == 'ul' || $wrapper['type'] == 'ol') {
$return .= '</li>' . $this->nl;
}
if ($wrapper['type'] == 'dl') {
$return .= '</dt>' . $this->nl;
}
# close the user-defined wrapper
if ($wrapper['close']) {
# don't print if wrapping with 'ul', 'li', or 'dl'
if (!in_array($wrapper['type'], $list_tags)) {
$return .= $wrapper['close'];
}
} else {
# close the div
if($wrapper['type'] != '') {
$return .= '</div>';
}
}
if ($this->formr->in_errors($data['name']) && $this->formr->inline_errors) {
$return .= '<div class="text-error">'.$this->formr->errors[$data['name']].'</div>';
}
return $return . $this->nl;
}
}

View File

@ -0,0 +1,5 @@
<?php
# load framework traits
require_once 'bootstrap.php';
require_once 'bulma.php';

View File

@ -0,0 +1,483 @@
<?php
trait Bootstrap
{
# Wrapper for the Bootstrap framework
# https://getbootstrap.com
# default Bootstrap CSS
public static function bootstrap_css($key = '')
{
return static::bootstrap5_css($key);
}
# default Bootstrap library
public function bootstrap($element = '', $data = '')
{
return $this->bootstrap5($element, $data);
}
public static function bootstrap5_css($key = '')
{
# bootstrap 4 css classes
$array = [
'alert-e' => 'alert alert-danger',
'alert-i' => 'alert alert-info',
'alert-s' => 'alert alert-success',
'alert-w' => 'alert alert-warning',
'button' => 'btn',
'button-danger' => 'btn btn-danger',
'button-primary' => 'btn btn-primary',
'button-secondary' => 'btn btn-secondary',
'checkbox' => 'form-check-input',
'checkbox-label' => 'form-check-label',
'checkbox-inline' => 'form-check-input',
'div' => 'mb-3',
'error' => 'invalid-feedback',
'file' => 'form-control-file',
'form-check-input' => 'form-check-input',
'help' => 'form-text',
'input' => 'form-control',
'is-invalid' => 'is-invalid',
'is-valid' => 'is-valid',
'label' => 'form-label',
'link' => 'alert-link',
'list-dl' => 'list-unstyled',
'list-ol' => 'list-unstyled',
'list-ul' => 'list-unstyled',
'radio' => 'form-check-input',
'success' => 'has-success',
'text-error' => 'text-danger',
'warning' => 'has-warning',
];
if ($key) {
return $array[$key];
} else {
return $array;
}
}
public function bootstrap5($element = '', $data = '')
{
# bootstrap 5 field wrapper
if (empty($data)) {
return false;
}
# create our $return variable
$return = $this->nl;
# optional: add a comment for easier debugging in the html
$return .= $this->formr->_print_field_comment($data);
# open the wrapping div
if ($this->formr->type_is_checkbox($data) && ! $this->formr->is_array($data['value'])) {
if (!empty($data['checkbox-inline'])) {
$return .= '<div class="form-check form-check-inline">' . $this->nl;
} else {
$return .= '<div class="form-check">' . $this->nl;
}
} else {
if ($this->formr->use_element_wrapper_div) {
$return .= '<div class="mb-3">' . $this->nl;
}
}
# checkbox or radio
if ($this->formr->type_is_checkbox($data)) {
$return .= $element;
$return .= '<label class="form-check-label" for="'.$this->formr->make_id($data).'">'.$data['label'].'</label>' . $this->nl;
} else {
# add the label
if ($this->formr->is_not_empty($data['label'])) {
$return .= '<label for="'.$this->formr->make_id($data).'" class="form-label">'.$data['label'].'</label>' . $this->nl;
}
# add the form element
$return .= $element;
}
# add inline help
if (! empty($data['inline'])) {
if ($this->formr->is_in_brackets($data['inline'])) {
if ($this->formr->in_errors($data['name'])) {
# if the text is surrounded by square brackets, show only on form error
# trim the brackets and show on error
$return .= '<div id="'.$data['name'].'Help" class="form-text text-danger">'.trim($data['inline'], '[]').'</div>' . $this->nl;
}
} else {
# show this text on page load
$return .= '<div id="'.$data['name'].'Help" class="form-text">'.$data['inline'].'</div>' . $this->nl;
}
} else {
# show error message
if ($this->formr->in_errors($data['name']) && $this->formr->inline_errors) {
$return .= '<div class="text-danger">'.$this->formr->errors[$data['name']].'</div>';
}
}
# close the wrapping div
if (($this->formr->type_is_checkbox($data) && ! $this->formr->is_array($data['value'])) || $this->formr->use_element_wrapper_div) {
$return .= '</div>' . $this->nl;
}
return $return;
}
public static function bootstrap4_css($key = '')
{
# bootstrap 4 css classes
$array = [
'alert-e' => 'alert alert-danger',
'alert-i' => 'alert alert-info',
'alert-s' => 'alert alert-success',
'alert-w' => 'alert alert-warning',
'button' => 'btn',
'button-danger' => 'btn btn-danger',
'button-primary' => 'btn btn-primary',
'button-secondary' => 'btn btn-secondary',
'checkbox' => 'form-check',
'checkbox-label' => 'form-check-label',
'checkbox-inline' => 'form-check form-check-inline',
'div' => 'form-group',
'error' => 'invalid-feedback',
'file' => 'form-control-file',
'form-check-input' => 'form-check-input',
'help' => 'form-text',
'input' => 'form-control',
'is-invalid' => 'is-invalid',
'is-valid' => 'is-valid',
'label' => 'control-label',
'link' => 'alert-link',
'list-dl' => 'list-unstyled',
'list-ol' => 'list-unstyled',
'list-ul' => 'list-unstyled',
'radio' => 'form-check',
'success' => 'has-success',
'text-error' => 'text-danger',
'warning' => 'has-warning',
];
if ($key) {
return $array[$key];
} else {
return $array;
}
}
public function bootstrap4($element = '', $data = '')
{
# bootstrap 4 field wrapper
if (empty($data)) {
return false;
}
# create our $return variable
$return = $this->nl;
# optional: add a comment for easier debugging in the html
$return .= $this->formr->_print_field_comment($data);
if ($this->formr->type_is_checkbox($data)) {
# input is a checkbox or radio
# don't print the <label> if we're printing an array
if (!$this->formr->is_array($data['value'])) {
# add an ID to the wrapping <div> so that we can access it via javascript
$return .= $this->nl . '<div id="_' . $this->formr->make_id($data) . '" class="';
if (!empty($data['checkbox-inline'])) {
# this is an inline checkbox
$return .= static::bootstrap4_css('checkbox-inline');
} else {
$return .= static::bootstrap4_css('checkbox');
}
# close the <div>
$return .= '">';
}
} else {
# open the wrapping <div> tag
if($this->formr->use_element_wrapper_div) {
$return .= $this->nl . '<div id="_' . $this->formr->make_id($data) . '" class="' . static::bootstrap4_css('div') . '">';
}
}
# add the checkbox/radio element here (before the <label>)
if ($this->formr->type_is_checkbox($data)) {
$return .= $this->nl . $element;
}
# if the <label> is empty add .sr-only
if ($this->formr->is_not_empty($data['label'])) {
if ($this->formr->type_is_checkbox($data)) {
$label_class = static::bootstrap4_css('checkbox-label');
} else {
$label_class = static::bootstrap4_css('label');
}
} else {
$label_class = 'sr-only';
}
# see if we're in a checkbox array...
if ($this->formr->is_array($data['name']) && $this->formr->type_is_checkbox($data)) {
# we are. we don't want to color each checkbox label if there's an error - we only want to color the main label for the group
# we'll add the label text later...
$return .= '<label for="' . $this->formr->make_id($data) . '">' . $this->nl;
} else {
# we are not in a checkbox array
if ($this->formr->type_is_checkbox($data)) {
# no default class on a checkbox or radio
if ($this->formr->is_not_empty($data['label'])) {
# open the <label>, but don't insert the label text here; we're doing it elsewhere
$return .= $this->nl . '<label class="' . $label_class . '" for="' . $this->formr->make_id($data) . '">';
}
} else {
# open the <label> and insert the label text
$return .= $this->nl . '<label class="' . $label_class . '" for="' . $data['name'] . '">' . $data['label'];
}
}
# add a required field indicator if applicable
if (!$this->formr->type_is_checkbox($data)) {
$return .= $this->formr->insert_required_indicator($data);
}
# close the <label> if NOT a checkbox or radio
if (!$this->formr->type_is_checkbox($data)) {
$return .= "</label>\r\n";
}
# add the field element here if NOT a checkbox or radio
if (!$this->formr->type_is_checkbox($data)) {
$return .= $element . $this->nl;
}
# inline help text
if (!empty($data['inline'])) {
# help-block text
# if the text is surrounded by square brackets, show only on form error
if ($this->formr->is_in_brackets($data['inline'])) {
if ($this->formr->in_errors($data['name'])) {
# trim the brackets and show on error
$return .= $this->nl . '<p class="'.static::bootstrap4_css('help').' '.static::bootstrap4_css('text-error').'">' . trim($data['inline'], '[]') . '</p>';
}
} else {
# show this text on page load
$return .= $this->nl . '<p class="'.static::bootstrap4_css('help').'">' . $data['inline'] . '</p>';
}
} else {
if ($this->formr->in_errors($data['name']) && $this->formr->inline_errors) {
$return .= '<div class="text-danger">'.$this->formr->errors[$data['name']].'</div>';
}
}
# checkbox/radio: add the label text and close the label tag
if ($this->formr->is_not_empty($data['label']) && $this->formr->type_is_checkbox($data)) {
# add label text
$return .= ' ' . $data['label'];
# add a required field indicator (*)
if ($this->formr->_check_required($data['name']) && $this->formr->is_not_empty($data['label'])) {
$return .= $this->formr->required_indicator;
}
# close the <label> tag
$return .= "</label>\r\n";
}
if (! $this->formr->is_array($data['value']) && $this->formr->use_element_wrapper_div) {
# close the wrapping <div>
$return .= "</div>\r\n";
}
return $return;
}
public static function bootstrap3_css($key = '')
{
# bootstrap 3 css classes
$array = [
'alert-e' => 'alert alert-danger',
'alert-w' => 'alert alert-warning',
'alert-s' => 'alert alert-success',
'alert-i' => 'alert alert-info',
'button' => 'btn',
'button-danger' => 'btn btn-danger',
'button-primary' => 'btn btn-primary',
'button-secondary' => 'btn btn-secondary',
'checkbox' => 'checkbox',
'checkbox-inline' => 'checkbox-inline',
'div' => 'form-group',
'error' => 'has-error',
'file' => 'form-control',
'form-check-input' => 'form-check-input',
'help' => 'help-block',
'input' => 'form-control',
'label' => 'control-label',
'link' => 'alert-link',
'list-dl' => 'list-unstyled',
'list-ol' => 'list-unstyled',
'list-ul' => 'list-unstyled',
'is-invalid' => 'is-invalid',
'is-valid' => 'is-valid',
'radio' => 'radio',
'success' => 'has-success',
'text-error' => 'text-danger',
'warning' => 'has-warning',
];
if ($key) {
return $array[$key];
} else {
return $array;
}
}
public function bootstrap3($element = '', $data = '')
{
# bootstrap 3 field wrapper
if (empty($data)) {
return false;
}
# set the label array value to null if a label is not present
if (!isset($data['label'])) {
$data['label'] = null;
}
$return = $this->nl;
if ($data['type'] == 'checkbox') {
# input is a checkbox
# notice that we're adding an id to the enclosing div, so that you may prepend/append jQuery, etc.
if (substr($data['value'], -1) != ']') {
$return = $this->nl . '<div id="_' . $this->formr->make_id($data) . '" class="';
# inline checkbox
if (!empty($data['checkbox-inline'])) {
$return .= static::bootstrap3_css('checkbox-inline');
} else {
$return .= static::bootstrap3_css('checkbox');
}
} else {
$return = $this->nl . '<div id="_' . $this->formr->make_id($data) . '" class="' . static::bootstrap3_css('div') . '">';
}
} elseif ($data['type'] == 'radio') {
# input is a radio
# don't print the label if we're printing an array
if (substr($data['value'], -1) != ']') {
$return = $this->nl . '<div id="_' . $this->formr->make_id($data) . '" class="' . static::bootstrap3_css('radio');
# inline radio
if (!empty($data['radio-inline'])) {
$return .= static::bootstrap3_css('radio-inline');
} else {
$return .= static::bootstrap3_css('radio');
}
} else {
$return = $this->nl . '<div id="_' . $this->formr->make_id($data) . '" class="' . static::bootstrap3_css('div') . '">';
}
} else {
$return = $this->nl . '<div id="_' . $this->formr->make_id($data) . '" class="' . static::bootstrap3_css('div');
}
# concatenate the error class if required
if ($this->formr->in_errors($data['name'])) {
$return .= ' ' . static::bootstrap3_css('error');
}
if (substr($data['value'], -1) != ']') {
$return .= '">';
}
# always add a label...
# if the label is empty add .sr-only, otherwise add .control-label
if ($this->formr->is_not_empty($data['label'])) {
$label_class = static::bootstrap3_css('label');
} else {
$label_class = 'sr-only';
}
# see if we're in a checkbox array...
if (substr($data['name'], -1) == ']' && ($data['type'] == 'checkbox' || $data['type'] == 'radio')) {
# we are. we don't want to color each checkbox label if there's an error - we only want to color the main label for the group
# we'll add the label text later...
$return .= '<label for="' . $this->formr->make_id($data) . '">' . $this->nl;
} else {
if ($data['type'] == 'checkbox' || $data['type'] == 'radio') {
# no default class on a checkbox or radio
# don't insert the label text here; we're doing it elsewhere
if ($this->formr->is_not_empty($data['label'])) {
$return .= $this->nl . '<label class="' . $label_class . '" for="' . $this->formr->make_id($data) . '">' . $this->nl;
}
} else {
$return .= $this->nl . '<label class="' . $label_class . '" for="' . $this->formr->make_id($data) . '">' . $data['label'];
}
}
# add a required field indicator
if ($this->formr->_check_required($data['name']) && $this->formr->is_not_empty($data['label'])) {
if ($data['type'] != 'checkbox' && $data['type'] != 'radio') {
$return .= $this->formr->required_indicator;
}
}
# close the label if NOT a checkbox or radio
if ($data['type'] != 'checkbox' && $data['type'] != 'radio') {
$return .= '</label>' . $this->nl;
}
# add the field element
$return .= $element;
# inline help text
if (!empty($data['inline'])) {
# help-block text
# if the text is surrounded by square brackets, show only on form error
if (mb_substr($data['inline'], 0, 1) == '[') {
if ($this->formr->in_errors($data['name'])) {
# trim the brackets and show on error
$return .= $this->nl . '<p class="' . static::bootstrap3_css('help') . '">' . trim($data['inline'], '[]') . '</p>';
}
} else {
# show this text on page load
$return .= $this->nl . '<p class="' . static::bootstrap3_css('help') . '">' . $data['inline'] . '</p>';
}
} else {
if ($this->formr->in_errors($data['name']) && $this->formr->inline_errors) {
$return .= '<div class="text-danger">'.$this->formr->errors[$data['name']].'</div>';
}
}
# checkbox/radio: add the label text and close the label tag
if (!empty($data['label']) && $data['type'] == 'checkbox' || $data['type'] == 'radio') {
$return .= ' ' . $data['label'];
# add a required field indicator
if ($this->formr->_check_required($data['name']) && $this->formr->is_not_empty($data['label'])) {
$return .= $this->formr->required_indicator;
}
$return .= $this->nl . '</label>' . $this->nl;
$return .= '</div>' . $this->nl;
} else {
# close the controls div
$return .= $this->nl . '</div>' . $this->nl;
}
return $return;
}
}

View File

@ -0,0 +1,212 @@
<?php
trait Bulma
{
# Wrapper for the Bulma framework
# https://bulma.io
public static function bulma_css($key = '')
{
$array = [
'alert-e' => 'is-danger',
'alert-i' => 'is-info',
'alert-s' => 'is-success',
'alert-w' => 'is-warning',
'button' => 'button',
'button-danger' => 'button is-danger',
'button-primary' => 'button is-primary',
'button-secondary' => 'button is-link',
'checkbox' => 'checkbox',
'div' => 'div',
'file' => 'file-input',
'help' => 'help',
'is-invalid' => 'is-danger',
'is-valid' => 'is-success',
'input' => 'input',
'label' => 'label',
'radio' => 'radio',
'textarea' => 'textarea',
];
if ($key) {
return $array[$key];
} else {
return $array;
}
}
public function bulma($element = '', $data = '')
{
if (empty($data)) {
return false;
}
# define our $return variable with a new line
$return = $this->nl;
# add a comment if $form->comments is enabled
$return .= $this->formr->_print_field_comment($data);
# build a checkbox
if ($data['type'] == 'checkbox' || $data['type'] == 'radio')
{
# open the wrapper
if ($data['type'] == 'checkbox' && $this->formr->use_element_wrapper_div) {
$return .= '<div class="field">' . $this->nl;
}
$return .= '<label class="' . $data['type'] . '">' . $this->nl;
$return .= $element . $this->nl;
$return .= $data['label'] . $this->nl;
$return .= '</label>' . $this->nl;
# show error message
if ($this->formr->submitted() && $this->formr->in_errors($data['name']) && $this->formr->inline_errors) {
$return .= '<p class="help is-danger">' . $this->formr->errors[$data['name']] . '</p>';
}
# close the wrapper
if ($this->formr->use_element_wrapper_div) {
$return .= '</div>' . $this->nl;
}
return $return;
}
elseif ($data['type'] == 'file') {
# file element
# open the wrapper
if ($this->formr->use_element_wrapper_div) {
$return .= '<div class="field">' . $this->nl;
}
if ($this->formr->is_not_empty($data['label'])) {
$return .= '<label class="label" for="' . $this->formr->make_id($data) . '">' . $this->nl;
$return .= "\t" . $data['label'];
$return .= $this->formr->insert_required_indicator($data) . $this->nl;
$return .= '</label>' . $this->nl;
}
$return .= ' <div class="file">' . $this->nl;
$return .= ' <label class="file-label">' . $this->nl;
$return .= $element . $this->nl;
$return .= ' <span class="file-cta">' . $this->nl;
$return .= ' <span class="file-icon">' . $this->nl;
$return .= ' <i class="fas fa-upload"></i>' . $this->nl;
$return .= ' </span>' . $this->nl;
$return .= ' <span class="file-label">' . $this->nl;
$return .= ' Choose file(s)...' . $this->nl;
$return .= ' </span>' . $this->nl;
$return .= ' </span>' . $this->nl;
$return .= ' </label>' . $this->nl;
$return .= ' </div>' . $this->nl;
# show error message
if ($this->formr->submitted() && $this->formr->in_errors($data['name']) && $this->formr->inline_errors) {
$return .= '<p class="help is-danger">' . $this->formr->errors[$data['name']] . '</p>';
}
# close the wrapper
if ($this->formr->use_element_wrapper_div) {
$return .= '</div>' . $this->nl;
}
return $return;
}
elseif ($data['type'] == 'select') {
#select menu
# open the wrapper
if ($this->formr->use_element_wrapper_div) {
$return .= '<div class="field">' . $this->nl;
}
if ($this->formr->is_not_empty($data['label'])) {
$return .= '<label class="label" for="' . $this->formr->make_id($data) . '">' . $this->nl;
$return .= "\t" . $data['label'];
$return .= $this->formr->insert_required_indicator($data) . $this->nl;
$return .= '</label>' . $this->nl;
}
$return .= ' <div class="control">' . $this->nl;
$return .= ' <div class="select">' . $this->nl;
$return .= $element . $this->nl;
$return .= ' </div>' . $this->nl;
$return .= ' </div>' . $this->nl;
# show error message
if ($this->formr->submitted() && $this->formr->in_errors($data['name']) && $this->formr->inline_errors) {
$return .= '<p class="help is-danger">' . $this->formr->errors[$data['name']] . '</p>';
}
# close the wrapper
if ($this->formr->use_element_wrapper_div) {
$return .= '</div>' . $this->nl;
}
return $return;
} else {
# everything else
# open the wrapper
if ($this->formr->use_element_wrapper_div) {
$return .= $this->nl . '<div id="_' . $this->formr->make_id($data) . '" class="field">' . $this->nl;
}
if ($this->formr->is_not_empty($data['label'])) {
$return .= '<label class="label" for="' . $this->formr->make_id($data) . '">' . $this->nl;
$return .= "\t" . $data['label'];
$return .= $this->formr->insert_required_indicator($data) . $this->nl;
$return .= '</label>' . $this->nl;
}
$return .= '<div class="control has-icons-right">' . $this->nl;
$return .= "\t" . $element . $this->nl;
# show fontawesome icons and highlight fields if error or success
if ($this->formr->submitted()) {
if ($this->formr->in_errors($data['name'])) {
$return .= '<span class="icon is-small is-right">' . $this->nl;
$return .= ' <i class="fas fa-exclamation-triangle"></i>' . $this->nl;
$return .= '</span>' . $this->nl;
} else {
if ($this->formr->show_valid && !in_array($data['type'], $this->formr->excluded_types)) {
$return .= '<span class="icon is-small is-right">' . $this->nl;
$return .= ' <i class="fas fa-check"></i>' . $this->nl;
$return .= '</span>' . $this->nl;
}
}
}
$return .= '</div>' . $this->nl;
# show inline help or error message
if (!empty($data['inline'])) {
if ($this->formr->is_in_brackets($data['inline'])) {
if ($this->formr->in_errors($data['name'])) {
$return .= '<p class="help is-danger">' . trim($data['inline'], '[]') . '</p>' . $this->nl;
}
} else {
$return .= '<p class="help">' . $data['inline'] . '</p>' . $this->nl;
}
} else {
if ($this->formr->submitted() && $this->formr->in_errors($data['name']) && $this->formr->inline_errors) {
$return .= '<p class="help is-danger">' . $this->formr->errors[$data['name']] . '</p>';
}
}
# close the wrapper
if ($this->formr->use_element_wrapper_div) {
$return .= '</div>' . $this->nl;
}
return $return . $this->nl;
}
}
}

339
vendor/formr/formr/license.txt vendored Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) {year} {fullname}
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.