mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-13 16:34:23 -05:00
getting same results for every char, something is fucked
This commit is contained in:
3
vendor/formr/formr/.github/FUNDING.yml
vendored
Normal file
3
vendor/formr/formr/.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [timgavin]
|
392
vendor/formr/formr/README.md
vendored
Normal file
392
vendor/formr/formr/README.md
vendored
Normal 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
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
27
vendor/formr/formr/composer.json
vendored
Normal 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"
|
||||
]
|
||||
}
|
||||
}
|
619
vendor/formr/formr/lib/class.formr.dropdowns.php
vendored
Normal file
619
vendor/formr/formr/lib/class.formr.dropdowns.php
vendored
Normal 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"",
|
||||
'4-1' => "4' 1"",
|
||||
'4-2' => "4' 2"",
|
||||
'4-3' => "4' 3"",
|
||||
'4-4' => "4' 4"",
|
||||
'4-5' => "4' 5"",
|
||||
'4-6' => "4' 6"",
|
||||
'4-7' => "4' 7"",
|
||||
'4-8' => "4' 8"",
|
||||
'4-9' => "4' 9"",
|
||||
'4-10' => "4' 10"",
|
||||
'4-11' => "4' 11"",
|
||||
'5-0' => "5' 0"",
|
||||
'5-1' => "5' 1"",
|
||||
'5-2' => "5' 2"",
|
||||
'5-3' => "5' 3"",
|
||||
'5-4' => "5' 4"",
|
||||
'5-5' => "5' 5"",
|
||||
'5-6' => "5' 6"",
|
||||
'5-7' => "5' 7"",
|
||||
'5-8' => "5' 8"",
|
||||
'5-9' => "5' 9"",
|
||||
'5-10' => "5' 10"",
|
||||
'5-11' => "5' 11"",
|
||||
'6-0' => "6' & 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();
|
||||
}
|
||||
}
|
146
vendor/formr/formr/lib/class.formr.forms.php
vendored
Normal file
146
vendor/formr/formr/lib/class.formr.forms.php
vendored
Normal 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']
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
137
vendor/formr/formr/lib/class.formr.wrappers.php
vendored
Normal file
137
vendor/formr/formr/lib/class.formr.wrappers.php
vendored
Normal 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;
|
||||
}
|
||||
}
|
5
vendor/formr/formr/lib/wrappers/autoload.php
vendored
Normal file
5
vendor/formr/formr/lib/wrappers/autoload.php
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
# load framework traits
|
||||
require_once 'bootstrap.php';
|
||||
require_once 'bulma.php';
|
483
vendor/formr/formr/lib/wrappers/bootstrap.php
vendored
Normal file
483
vendor/formr/formr/lib/wrappers/bootstrap.php
vendored
Normal 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;
|
||||
}
|
||||
}
|
212
vendor/formr/formr/lib/wrappers/bulma.php
vendored
Normal file
212
vendor/formr/formr/lib/wrappers/bulma.php
vendored
Normal 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
339
vendor/formr/formr/license.txt
vendored
Normal 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.
|
Reference in New Issue
Block a user