├── LICENSE.md
├── README.md
├── Zebra_Form.php
├── composer.json
├── examples
├── includes
│ ├── contact-custom.php
│ ├── contact-horizontal.php
│ ├── contact-vertical.php
│ ├── container-html
│ │ └── container.html
│ ├── custom-templates
│ │ ├── contact.php
│ │ ├── divs-login.php
│ │ ├── example1-dependencies.php
│ │ ├── example2-dependencies.php
│ │ ├── registration.php
│ │ ├── reservation.php
│ │ └── tables-login.php
│ ├── dependencies-example1-custom.php
│ ├── dependencies-example2-custom.php
│ ├── fileupload-basic-image-vertical.php
│ ├── fileupload-basic-vertical.php
│ ├── login-divs-custom.php
│ ├── login-horizontal.php
│ ├── login-labels-inside.php
│ ├── login-tables-custom.php
│ ├── login-vertical.php
│ ├── registration-custom.php
│ ├── registration-horizontal.php
│ ├── registration-vertical.php
│ ├── reservation-autofill-vertical.php
│ ├── reservation-custom.php
│ ├── reservation-horizontal.php
│ ├── reservation-vertical.php
│ └── validation-vertical.php
├── index.html
├── index.php
├── libraries
│ └── highlight
│ │ └── public
│ │ ├── AUTHORS.en.txt
│ │ ├── LICENSE
│ │ ├── css
│ │ ├── dark.css
│ │ ├── default.css
│ │ ├── ir_black.css
│ │ ├── sunburst.css
│ │ └── zenburn.css
│ │ ├── javascript
│ │ ├── css.js
│ │ ├── highlight.js
│ │ ├── html-xml.js
│ │ ├── javascript.js
│ │ └── php.js
│ │ └── readme.eng.txt
└── public
│ ├── css
│ ├── reset.css
│ └── style.css
│ ├── images
│ ├── comment.png
│ ├── letter.png
│ └── user.png
│ └── javascript
│ ├── core.js
│ └── jquery-1.12.0.js
├── includes
├── Button.php
├── Captcha.php
├── Checkbox.php
├── Control.php
├── Date.php
├── File.php
├── Hidden.php
├── Image.php
├── Label.php
├── Note.php
├── Password.php
├── Radio.php
├── Reset.php
├── Select.php
├── Submit.php
├── Text.php
├── Textarea.php
├── Time.php
├── XSSClean.php
├── babelsans-bold.ttf
└── index.html
├── index.html
├── languages
├── afrikaans.php
├── albanian.php
├── catalan.php
├── deutsch.php
├── dutch.php
├── english.php
├── espanol.php
├── francais.php
├── index.html
├── italiano.php
├── japanese.php
├── romana.php
├── russian.php
└── türk.php
├── mimes.json
├── process.php
└── public
├── css
├── button-background.gif
├── calendar-disabled.png
├── calendar.png
├── close.png
├── ico-close.gif
├── ico-close.png
├── ico-refresh.gif
├── ico-refresh.png
├── ico-warning.gif
├── ico-warning.png
├── index.html
├── note.gif
├── spinner.gif
├── textbox-background.gif
└── zebra_form.css
├── index.html
└── javascript
├── index.html
├── readme.txt
├── zebra_form.js
└── zebra_form.src.js
/LICENSE.md:
--------------------------------------------------------------------------------
1 | ### GNU LESSER GENERAL PUBLIC LICENSE
2 |
3 | Version 3, 29 June 2007
4 |
5 | Copyright (C) 2007 Free Software Foundation, Inc.
6 |
Note the uneditable prefixes (text and images) for some of the fields.
4 | 5 |Check the "Template source" tab to see how it's done!
6 | 7 | add('label', 'label_name', 'name', 'Your name:'); 17 | 18 | // add the "name" element 19 | $obj = $form->add('text', 'name', '', array('style' => 'width: 195px', 'data-prefix' => 'img:public/images/user.png')); 20 | 21 | // set rules 22 | $obj->set_rule(array( 23 | 24 | // error messages will be sent to a variable called "error", usable in custom templates 25 | 'required' => array('error', 'Name is required!') 26 | 27 | )); 28 | 29 | // "email" 30 | $form->add('label', 'label_email', 'email', 'Your email address:'); 31 | $obj = $form->add('text', 'email', '', array('style' => 'width: 195px', 'data-prefix' => 'img:public/images/letter.png')); 32 | $obj->set_rule(array( 33 | 'required' => array('error', 'Email is required!'), 34 | 'email' => array('error', 'Email address seems to be invalid!'), 35 | )); 36 | $form->add('note', 'note_email', 'email', 'Your email address will not be published.'); 37 | 38 | // "website" 39 | $form->add('label', 'label_website', 'website', 'Your website:'); 40 | $obj = $form->add('text', 'website', '', array('style' => 'width: 400px', 'data-prefix' => 'http://')); 41 | $obj->set_rule(array( 42 | 'url' => array(true, 'error', 'Invalid URL specified!'), 43 | )); 44 | $form->add('note', 'note_website', 'website', 'Enter the URL of your website, if you have one.'); 45 | 46 | // "subject" 47 | $form->add('label', 'label_subject', 'subject', 'Subject'); 48 | $obj = $form->add('text', 'subject', '', array('style' => 'width: 400px', 'data-prefix' => 'img:public/images/comment.png')); 49 | $obj->set_rule(array( 50 | 'required' => array('error', 'Subject is required!') 51 | )); 52 | 53 | // "message" 54 | $form->add('label', 'label_message', 'message', 'Message:'); 55 | $obj = $form->add('textarea', 'message'); 56 | $obj->set_rule(array( 57 | 'required' => array('error', 'Message is required!'), 58 | 'length' => array(0, 140, 'error', 'Maximum length is 140 characters!', true), 59 | )); 60 | 61 | // "submit" 62 | $form->add('submit', 'btnsubmit', 'Submit'); 63 | 64 | // if the form is valid 65 | if ($form->validate()) { 66 | 67 | // show results 68 | show_results(); 69 | 70 | // otherwise 71 | } else 72 | 73 | // generate output using a custom template 74 | $form->render('includes/custom-templates/contact.php'); 75 | 76 | ?> -------------------------------------------------------------------------------- /examples/includes/contact-horizontal.php: -------------------------------------------------------------------------------- 1 |Note the uneditable prefixes (text and images) for some of the fields.
4 | 5 | add('label', 'label_name', 'name', 'Your name:'); 15 | 16 | // add the "name" element 17 | $obj = $form->add('text', 'name', '', array('data-prefix' => 'img:public/images/user.png')); 18 | 19 | // set rules 20 | $obj->set_rule(array( 21 | 22 | // error messages will be sent to a variable called "error", usable in custom templates 23 | 'required' => array('error', 'Name is required!') 24 | 25 | )); 26 | 27 | // "email" 28 | $form->add('label', 'label_email', 'email', 'Your email address:'); 29 | $obj = $form->add('text', 'email', '', array('data-prefix' => 'img:public/images/letter.png')); 30 | $obj->set_rule(array( 31 | 'required' => array('error', 'Email is required!'), 32 | 'email' => array('error', 'Email address seems to be invalid!'), 33 | )); 34 | $form->add('note', 'note_email', 'email', 'Your email address will not be published.'); 35 | 36 | // "website" 37 | $form->add('label', 'label_website', 'website', 'Your website:'); 38 | $obj = $form->add('text', 'website', '', array('data-prefix' => 'http://')); 39 | $obj->set_rule(array( 40 | 'url' => array(true, 'error', 'Invalid URL specified!'), 41 | )); 42 | $form->add('note', 'note_website', 'website', 'Enter the URL of your website, if you have one.'); 43 | 44 | // "subject" 45 | $form->add('label', 'label_subject', 'subject', 'Subject'); 46 | $obj = $form->add('text', 'subject', '', array('data-prefix' => 'img:public/images/comment.png')); 47 | $obj->set_rule(array( 48 | 'required' => array('error', 'Subject is required!') 49 | )); 50 | 51 | // "message" 52 | $form->add('label', 'label_message', 'message', 'Message:'); 53 | $obj = $form->add('textarea', 'message'); 54 | $obj->set_rule(array( 55 | 'required' => array('error', 'Message is required!'), 56 | 'length' => array(0, 140, 'error', 'Maximum length is 140 characters!', true), 57 | )); 58 | 59 | // "submit" 60 | $form->add('submit', 'btn_submit', 'Submit'); 61 | 62 | // if the form is valid 63 | if ($form->validate()) { 64 | 65 | // show results 66 | show_results(); 67 | 68 | // otherwise 69 | } else 70 | 71 | // generate output using a custom template 72 | $form->render('*horizontal'); 73 | 74 | ?> -------------------------------------------------------------------------------- /examples/includes/contact-vertical.php: -------------------------------------------------------------------------------- 1 |Note the uneditable prefixes (text and images) for some of the fields.
4 | 5 | add('label', 'label_name', 'name', 'Your name:'); 15 | 16 | // add the "name" element 17 | $obj = $form->add('text', 'name', '', array('data-prefix' => 'img:public/images/user.png')); 18 | 19 | // set rules 20 | $obj->set_rule(array( 21 | 22 | // error messages will be sent to a variable called "error", usable in custom templates 23 | 'required' => array('error', 'Name is required!') 24 | 25 | )); 26 | 27 | // "email" 28 | $form->add('label', 'label_email', 'email', 'Your email address:'); 29 | $obj = $form->add('text', 'email', '', array('data-prefix' => 'img:public/images/letter.png')); 30 | $obj->set_rule(array( 31 | 'required' => array('error', 'Email is required!'), 32 | 'email' => array('error', 'Email address seems to be invalid!'), 33 | )); 34 | $form->add('note', 'note_email', 'email', 'Your email address will not be published.'); 35 | 36 | // "website" 37 | $form->add('label', 'label_website', 'website', 'Your website:'); 38 | $obj = $form->add('text', 'website', '', array('data-prefix' => 'http://')); 39 | $obj->set_rule(array( 40 | 'url' => array(true, 'error', 'Invalid URL specified!'), 41 | )); 42 | $form->add('note', 'note_website', 'website', 'Enter the URL of your website, if you have one.'); 43 | 44 | // "subject" 45 | $form->add('label', 'label_subject', 'subject', 'Subject'); 46 | $obj = $form->add('text', 'subject', '', array('style' => 'width:400px', 'data-prefix' => 'img:public/images/comment.png')); 47 | $obj->set_rule(array( 48 | 'required' => array('error', 'Subject is required!') 49 | )); 50 | 51 | // "message" 52 | $form->add('label', 'label_message', 'message', 'Message:'); 53 | $obj = $form->add('textarea', 'message'); 54 | $obj->set_rule(array( 55 | 'required' => array('error', 'Message is required!'), 56 | 'length' => array(0, 140, 'error', 'Maximum length is 140 characters!', true) 57 | )); 58 | 59 | // "submit" 60 | $form->add('submit', 'btnsubmit', 'Submit'); 61 | 62 | // if the form is valid 63 | if ($form->validate()) { 64 | 65 | // show results 66 | show_results(); 67 | 68 | // otherwise 69 | } else 70 | 71 | // generate output using a custom template 72 | $form->render(); 73 | 74 | ?> -------------------------------------------------------------------------------- /examples/includes/container-html/container.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |13 | | 14 | |
20 | | 21 | |
25 | | 26 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | | 36 |
42 | | 43 | |
Showcasing how elements can be validated only if other elements meet certain conditions and how callback functions for the "dependencies" rule work.
4 | 5 | add('label', 'label_name', 'name', 'Your name'); 15 | $obj = $form->add('text', 'name'); 16 | 17 | // set rules 18 | $obj->set_rule(array( 19 | 'required' => array('error', 'Name is required!'), 20 | )); 21 | 22 | // "notifications" 23 | $form->add('label', 'label_notifications', 'notifications', 'Would you like to be informed about promotional offers?'); 24 | $obj = $form->add('radios', 'notifications', array( 25 | 'yes' => 'Yes', 26 | 'no' => 'No', 27 | )); 28 | $obj->set_rule(array( 29 | 'required' => array('error', 'Please select an answer!'), 30 | )); 31 | 32 | // "method" 33 | $form->add('label', 'label_method', 'method', 'Please specify how you would like to be notified about promotional offers:'); 34 | $obj = $form->add('checkboxes', 'method[]', array( 35 | 'email' => 'By e-mail', 36 | 'phone' => 'By phone', 37 | 'post' => 'By land mail', 38 | )); 39 | $obj->set_rule(array( 40 | 'required' => array('error', 'Please specify how you would like to be notified about promotional offers!'), 41 | 'dependencies' => array(array( 42 | 'notifications' => 'yes', 43 | // whenever the value of "notification" changes, call this function and pass as second argument the value "1" 44 | ), 'mycallback, 1'), 45 | )); 46 | 47 | // "email" 48 | $form->add('label', 'label_email', 'email', 'Your email address:'); 49 | $obj = $form->add('text', 'email'); 50 | $obj->set_rule(array( 51 | 'required' => array('error', 'Email is required!'), 52 | 'email' => array('error', 'Email address seems to be invalid!'), 53 | 'dependencies' => array(array( 54 | 'method' => 'email', 55 | ), 'mycallback, 2'), 56 | )); 57 | $form->add('note', 'note_email', 'email', 'Your email address will not be published.'); 58 | 59 | // "phone" 60 | $form->add('label', 'label_phone', 'phone', 'Your telephone number:'); 61 | $obj = $form->add('text', 'phone'); 62 | $obj->set_rule(array( 63 | 'required' => array('error', 'Phone number is required!'), 64 | 'digits' => array('', 'error', 'Phone number must contain only digits!'), 65 | 'dependencies' => array(array( 66 | 'method' => 'phone', 67 | ), 'mycallback, 3'), 68 | )); 69 | $form->add('note', 'note_phone', 'phone', 'Enter your phone number using digits only'); 70 | 71 | // "post" 72 | $form->add('label', 'label_post', 'post', 'Your postal address:'); 73 | $obj = $form->add('text', 'post'); 74 | $obj->set_rule(array( 75 | 'required' => array('error', 'Postal address is required!'), 76 | 'dependencies' => array(array( 77 | 'method' => 'post', 78 | ), 'mycallback, 4'), 79 | )); 80 | $form->add('note', 'note_post', 'post', 'Enter the address where the notifications about promotional offers should be delivered'); 81 | 82 | // "why" 83 | $form->add('label', 'label_why', 'why', 'Please tell us why:'); 84 | $obj = $form->add('textarea', 'why'); 85 | $obj->set_rule(array( 86 | 'required' => array('error', 'Please leave us a message!'), 87 | 'dependencies' => array(array( 88 | 'notifications' => 'no', 89 | ), 'mycallback, 5'), 90 | )); 91 | 92 | // "submit" 93 | $form->add('submit', 'btnsubmit', 'Submit'); 94 | 95 | // if the form is valid 96 | if ($form->validate()) { 97 | 98 | // show results 99 | show_results(); 100 | 101 | // otherwise 102 | } else 103 | 104 | $form->render('includes/custom-templates/example1-dependencies.php'); 105 | 106 | ?> 107 | -------------------------------------------------------------------------------- /examples/includes/dependencies-example2-custom.php: -------------------------------------------------------------------------------- 1 |Notice how the elements from the "Add new person" section are validated *only* when the "Add new" button is clicked
4 | 5 | add('label', 'label_name', 'name', 'Name'); 15 | $obj = $form->add('text', 'name'); 16 | 17 | // set rules 18 | $obj->set_rule(array( 19 | 'required' => array('error', 'Name is required!'), 20 | )); 21 | 22 | // add the "surname" element 23 | $form->add('label', 'label_surname', 'surname', 'Surname'); 24 | $obj = $form->add('text', 'surname'); 25 | 26 | // set rules 27 | $obj->set_rule(array( 28 | 'required' => array('error', 'Surname is required!'), 29 | )); 30 | 31 | // elements for adding a new person 32 | 33 | // add the "name" element 34 | $form->add('label', 'label_add_name', 'add_name', 'Name'); 35 | $obj = $form->add('text', 'add_name'); 36 | 37 | // set rules 38 | // validate *only* if the "Add new" button is clicked 39 | $obj->set_rule(array( 40 | 'required' => array('error', 'Name is required!'), 41 | 'dependencies' => array( 42 | 'btnadd' => 'click', 43 | ), 44 | )); 45 | 46 | // add the "surname" element 47 | $form->add('label', 'label_add_surname', 'add_surname', 'Surame'); 48 | $obj = $form->add('text', 'add_surname'); 49 | 50 | // set rules 51 | $obj->set_rule(array( 52 | 'required' => array('error', 'Surname is required!'), 53 | 'dependencies' => array( 54 | 'btnadd' => 'click', 55 | ), 56 | )); 57 | 58 | // "add" 59 | $form->add('submit', 'btnadd', 'Add new'); 60 | 61 | // "submit" 62 | $form->add('submit', 'btnsubmit', 'Finish'); 63 | 64 | // if the form is valid 65 | if ($form->validate()) { 66 | 67 | // show results 68 | show_results(); 69 | 70 | // otherwise 71 | } else 72 | 73 | $form->render('includes/custom-templates/example2-dependencies.php'); 74 | 75 | ?> 76 | -------------------------------------------------------------------------------- /examples/includes/fileupload-basic-image-vertical.php: -------------------------------------------------------------------------------- 1 |We're checking for file types
4 | 5 | add('label', 'label_file', 'file', 'Upload an image'); 15 | 16 | // add the "file" element 17 | $obj = $form->add('file', 'file'); 18 | 19 | // set rules 20 | $obj->set_rule(array( 21 | 22 | // error messages will be sent to a variable called "error", usable in custom templates 23 | 'required' => array('error', 'An image is required!'), 24 | 'upload' => array('tmp', ZEBRA_FORM_UPLOAD_RANDOM_NAMES, 'error', 'Could not upload file!'); 44 | print_r($form->file_upload); 45 | die(); 46 | 47 | } 48 | 49 | // auto generate output, labels above form elements 50 | $form->render(); 51 | 52 | ?> -------------------------------------------------------------------------------- /examples/includes/fileupload-basic-vertical.php: -------------------------------------------------------------------------------- 1 |Basic file upload
2 | 3 |Once you upload the file, don't forget to look into the "tmp" folder inside the "examples" folder for the result.
4 | 5 | add('label', 'label_file', 'file', 'Upload Microsoft Word document'); 15 | 16 | // add the "file" element 17 | $obj = $form->add('file', 'file'); 18 | 19 | // set rules 20 | $obj->set_rule(array( 21 | 22 | // error messages will be sent to a variable called "error", usable in custom templates 23 | 'required' => array('error', 'A Microsoft Word document is required!'), 24 | 'upload' => array('tmp', ZEBRA_FORM_UPLOAD_RANDOM_NAMES, 'error', 'Could not upload file!
Check that the "tmp" folder exists inside the "examples" folder and that it is writable'), 25 | 'filetype' => array('doc, docx', 'error', 'File must be a Microsoft Word document!'), 26 | 'filesize' => array(102400, 'error', 'File size must not exceed 100Kb!'), 27 | 28 | )); 29 | 30 | // attach a note 31 | $form->add('note', 'note_file', 'file', 'File must have the .doc or .docx extension, and no more than 100Kb!'); 32 | 33 | // "submit" 34 | $form->add('submit', 'btnsubmit', 'Submit'); 35 | 36 | // validate the form 37 | if ($form->validate()) { 38 | 39 | // do stuff here 40 | print_r(''); 41 | print_r($form->file_upload); 42 | die(); 43 | 44 | } 45 | 46 | // auto generate output, labels above form elements 47 | $form->render(); 48 | 49 | ?> -------------------------------------------------------------------------------- /examples/includes/login-divs-custom.php: -------------------------------------------------------------------------------- 1 |A login form
2 | 3 |In this demo we're creating a custom template using only divs; this is suitable for creating "vertical" templates (when 4 | a control's label is above the control), but when we want some elements to be side-by-side. Don't forget to check the 5 | "Template source" tab to see how it's done.
6 | 7 | 'off')); 14 | 15 | // the label for the "email" element 16 | $form->add('label', 'label_email', 'email', 'Email'); 17 | 18 | // add the "email" element 19 | $obj = $form->add('text', 'email'); 20 | 21 | // set rules 22 | $obj->set_rule(array( 23 | 24 | // error messages will be sent to a variable called "error", usable in custom templates 25 | 'required' => array('error', 'Email is required!'), 26 | 'email' => array('error', 'Email address seems to be invalid!'), 27 | 28 | )); 29 | 30 | // "password" 31 | $form->add('label', 'label_password', 'password', 'Password'); 32 | 33 | $obj = $form->add('password', 'password'); 34 | 35 | $obj->set_rule(array( 36 | 37 | 'required' => array('error', 'Password is required!'), 38 | 'length' => array(6, 10, 'error', 'The password must have between 6 and 10 characters!'), 39 | 40 | )); 41 | 42 | // "remember me" 43 | $form->add('checkbox', 'remember_me', 'yes'); 44 | 45 | $form->add('label', 'label_remember_me_yes', 'remember_me_yes', 'Remember me', array('style' => 'font-weight:normal')); 46 | 47 | // "submit" 48 | $form->add('submit', 'btnsubmit', 'Submit'); 49 | 50 | // if the form is valid 51 | if ($form->validate()) { 52 | 53 | // show results 54 | show_results(); 55 | 56 | // otherwise 57 | } else 58 | 59 | // generate output using a custom template 60 | $form->render('includes/custom-templates/divs-login.php'); 61 | 62 | ?> 63 | -------------------------------------------------------------------------------- /examples/includes/login-horizontal.php: -------------------------------------------------------------------------------- 1 |A login form
2 | 3 | 'off')); 10 | 11 | // the label for the "email" element 12 | $form->add('label', 'label_email', 'email', 'Email'); 13 | 14 | // add the "email" element 15 | $obj = $form->add('text', 'email'); 16 | 17 | // set rules 18 | $obj->set_rule(array( 19 | 20 | // error messages will be sent to a variable called "error", usable in custom templates 21 | 'required' => array('error', 'Email is required!'), 22 | 'email' => array('error', 'Email address seems to be invalid!'), 23 | 24 | )); 25 | 26 | // "password" 27 | $form->add('label', 'label_password', 'password', 'Password'); 28 | $obj = $form->add('password', 'password'); 29 | $obj->set_rule(array( 30 | 'required' => array('error', 'Password is required!'), 31 | 'length' => array(6, 10, 'error', 'The password must have between 6 and 10 characters!'), 32 | )); 33 | 34 | // "remember me" 35 | $form->add('checkbox', 'remember_me', 'yes'); 36 | $form->add('label', 'label_remember_me_yes', 'remember_me_yes', 'Remember me', array('style' => 'font-weight:normal')); 37 | 38 | // "submit" 39 | $form->add('submit', 'btnsubmit', 'Submit'); 40 | 41 | // if the form is valid 42 | if ($form->validate()) { 43 | 44 | // show results 45 | show_results(); 46 | 47 | // otherwise 48 | } else 49 | 50 | // generate output using a custom template 51 | $form->render('*horizontal'); 52 | 53 | ?> 54 | -------------------------------------------------------------------------------- /examples/includes/login-labels-inside.php: -------------------------------------------------------------------------------- 1 |A login form
2 | 3 | 'off')); 10 | 11 | // the label for the "email" element 12 | $form->add('label', 'label_email', 'email', 'Email address', array('inside' => true)); 13 | 14 | // add the "email" element 15 | $obj = $form->add('text', 'email'); 16 | 17 | // set rules 18 | $obj->set_rule(array( 19 | 20 | // error messages will be sent to a variable called "error", usable in custom templates 21 | 'required' => array('error', 'Email is required!'), 22 | 'email' => array('error', 'Email address seems to be invalid!'), 23 | 24 | )); 25 | 26 | // "password" 27 | $form->add('label', 'label_password', 'password', 'Password', array('inside' => true)); 28 | $obj = $form->add('password', 'password'); 29 | $obj->set_rule(array( 30 | 'required' => array('error', 'Password is required!'), 31 | 'length' => array(6, 10, 'error', 'The password must have between 6 and 10 characters!'), 32 | )); 33 | 34 | // "remember me" 35 | $form->add('checkbox', 'remember_me', 'yes'); 36 | $form->add('label', 'label_remember_me_yes', 'remember_me_yes', 'Remember me', array('style' => 'font-weight:normal')); 37 | 38 | // "submit" 39 | $form->add('submit', 'btnsubmit', 'Submit'); 40 | 41 | // if the form is valid 42 | if ($form->validate()) { 43 | 44 | // show results 45 | show_results(); 46 | 47 | // otherwise 48 | } else 49 | 50 | // generate output using a custom template 51 | $form->render(); 52 | 53 | ?> 54 | -------------------------------------------------------------------------------- /examples/includes/login-tables-custom.php: -------------------------------------------------------------------------------- 1 |A login form
2 | 3 |In this demo we're creating a custom template using tables; this is suitable for creating "horizontal" templates (when 4 | a control's label is to the left of the control). Don't forget to check the "Template source" tab to see how it's done.
5 | 6 | 'off')); 13 | 14 | // the label for the "email" element 15 | $form->add('label', 'label_email', 'email', 'Email'); 16 | 17 | // add the "email" element 18 | $obj = $form->add('text', 'email'); 19 | 20 | // set rules 21 | $obj->set_rule(array( 22 | 23 | // error messages will be sent to a variable called "error", usable in custom templates 24 | 'required' => array('error', 'Email is required!'), 25 | 'email' => array('error', 'Email address seems to be invalid!'), 26 | 27 | )); 28 | 29 | // "password" 30 | $form->add('label', 'label_password', 'password', 'Password'); 31 | $obj = $form->add('password', 'password'); 32 | $obj->set_rule(array( 33 | 'required' => array('error', 'Password is required!'), 34 | 'length' => array(6, 10, 'error', 'The password must have between 6 and 10 characters!'), 35 | )); 36 | 37 | // "remember me" 38 | $form->add('checkbox', 'remember_me', 'yes'); 39 | $form->add('label', 'label_remember_me_yes', 'remember_me_yes', 'Remember me', array('style' => 'font-weight:normal')); 40 | 41 | // "submit" 42 | $form->add('submit', 'btnsubmit', 'Submit'); 43 | 44 | // if the form is valid 45 | if ($form->validate()) { 46 | 47 | // show results 48 | show_results(); 49 | 50 | // otherwise 51 | } else 52 | 53 | // generate output using a custom template 54 | $form->render('includes/custom-templates/tables-login.php'); 55 | 56 | ?> 57 | -------------------------------------------------------------------------------- /examples/includes/login-vertical.php: -------------------------------------------------------------------------------- 1 |A login form
2 | 3 | 'off')); 10 | 11 | // the label for the "email" element 12 | $form->add('label', 'label_email', 'email', 'Email'); 13 | 14 | // add the "email" element 15 | $obj = $form->add('text', 'email'); 16 | 17 | // set rules 18 | $obj->set_rule(array( 19 | 20 | // error messages will be sent to a variable called "error", usable in custom templates 21 | 'required' => array('error', 'Email is required!'), 22 | 'email' => array('error', 'Email address seems to be invalid!'), 23 | 24 | )); 25 | 26 | // "password" 27 | $form->add('label', 'label_password', 'password', 'Password'); 28 | $obj = $form->add('password', 'password'); 29 | $obj->set_rule(array( 30 | 'required' => array('error', 'Password is required!'), 31 | 'length' => array(6, 10, 'error', 'The password must have between 6 and 10 characters!'), 32 | )); 33 | 34 | // "remember me" 35 | $form->add('checkbox', 'remember_me', 'yes'); 36 | $form->add('label', 'label_remember_me_yes', 'remember_me_yes', 'Remember me', array('style' => 'font-weight:normal')); 37 | 38 | // "submit" 39 | $form->add('submit', 'btnsubmit', 'Submit'); 40 | 41 | // if the form is valid 42 | if ($form->validate()) { 43 | 44 | // show results 45 | show_results(); 46 | 47 | // otherwise 48 | } else 49 | 50 | // auto generate output, labels above form elements 51 | $form->render(); 52 | 53 | ?> 54 | -------------------------------------------------------------------------------- /examples/includes/registration-custom.php: -------------------------------------------------------------------------------- 1 |A registration form
2 | 3 |Check the "Template source" tab to see how it's done!
4 | 5 | 'off')); 12 | 13 | // the label for the "first name" element 14 | $form->add('label', 'label_firstname', 'firstname', 'First name:'); 15 | 16 | // add the "first name" element 17 | $obj = $form->add('text', 'firstname'); 18 | 19 | // set rules 20 | $obj->set_rule(array( 21 | 22 | // error messages will be sent to a variable called "error", usable in custom templates 23 | 'required' => array('error', 'First name is required!'), 24 | 25 | )); 26 | 27 | // "last name" 28 | $form->add('label', 'label_lastname', 'lastname', 'Last name:'); 29 | $obj = $form->add('text', 'lastname'); 30 | $obj->set_rule(array( 31 | 'required' => array('error', 'Last name is required!') 32 | )); 33 | 34 | // "email" 35 | $form->add('label', 'label_email', 'email', 'Email address:'); 36 | $obj = $form->add('text', 'email'); 37 | $obj->set_rule(array( 38 | 'required' => array('error', 'Email is required!'), 39 | 'email' => array('error', 'Email address seems to be invalid!') 40 | )); 41 | 42 | // attach a note to the email element 43 | $form->add('note', 'note_email', 'email', 'Please enter a valid email address. An email will be sent to this 44 | address with a link you need to click on in order to activate your account', array('style'=>'width:200px')); 45 | 46 | // "password" 47 | $form->add('label', 'label_password', 'password', 'Choose a password:'); 48 | $obj = $form->add('password', 'password'); 49 | $obj->set_rule(array( 50 | 'required' => array('error', 'Password is required!'), 51 | 'length' => array(6, 10, 'error', 'The password must have between 6 and 10 characters'), 52 | )); 53 | $form->add('note', 'note_password', 'password', 'Password must be have between 6 and 10 characters.', array('style' => 'width: 180px')); 54 | 55 | // "confirm password" 56 | $form->add('label', 'label_confirm_password', 'confirm_password', 'Confirm password:'); 57 | $obj = $form->add('password', 'confirm_password'); 58 | $obj->set_rule(array( 59 | 'compare' => array('password', 'error', 'Password not confirmed correctly!') 60 | )); 61 | 62 | // "captcha" 63 | $form->add('captcha', 'captcha_image', 'captcha_code'); 64 | $form->add('label', 'label_captcha_code', 'captcha_code', 'Are you human?'); 65 | $obj = $form->add('text', 'captcha_code'); 66 | $form->add('note', 'note_captcha', 'captcha_code', 'You must enter the characters with black color that stand 67 | out from the other characters', array('style'=>'width: 200px')); 68 | $obj->set_rule(array( 69 | 'required' => array('error', 'Enter the characters from the image above!'), 70 | 'captcha' => array('error', 'Characters from image entered incorrectly!') 71 | )); 72 | 73 | // "submit" 74 | $form->add('submit', 'btnsubmit', 'Submit'); 75 | 76 | // if the form is valid 77 | if ($form->validate()) { 78 | 79 | // show results 80 | show_results(); 81 | 82 | // otherwise 83 | } else 84 | 85 | // generate output using a custom template 86 | $form->render('includes/custom-templates/registration.php'); 87 | 88 | ?> -------------------------------------------------------------------------------- /examples/includes/registration-horizontal.php: -------------------------------------------------------------------------------- 1 |A registration form
2 | 3 | 'off')); 10 | 11 | // the label for the "first name" element 12 | $form->add('label', 'label_firstname', 'firstname', 'First name:'); 13 | 14 | // add the "first name" element 15 | $obj = $form->add('text', 'firstname'); 16 | 17 | // set rules 18 | $obj->set_rule(array( 19 | 20 | // error messages will be sent to a variable called "error", usable in custom templates 21 | 'required' => array('error', 'First name is required!'), 22 | 23 | )); 24 | 25 | // "last name" 26 | $form->add('label', 'label_lastname', 'lastname', 'Last name:'); 27 | $obj = $form->add('text', 'lastname'); 28 | $obj->set_rule(array( 29 | 'required' => array('error', 'Last name is required!') 30 | )); 31 | 32 | // "email" 33 | $form->add('label', 'label_email', 'email', 'Email address:'); 34 | $obj = $form->add('text', 'email'); 35 | $obj->set_rule(array( 36 | 'required' => array('error', 'Email is required!'), 37 | 'email' => array('error', 'Email address seems to be invalid!') 38 | )); 39 | 40 | // attach a note to the email element 41 | $form->add('note', 'note_email', 'email', 'Please enter a valid email address. An email will be sent to this 42 | address with a link you need to click on in order to activate your account', array('style'=>'width:200px')); 43 | 44 | // "password" 45 | $form->add('label', 'label_password', 'password', 'Choose a password:'); 46 | $obj = $form->add('password', 'password'); 47 | $obj->set_rule(array( 48 | 'required' => array('error', 'Password is required!'), 49 | 'length' => array(6, 10, 'error', 'The password must have between 6 and 10 characters'), 50 | )); 51 | $form->add('note', 'note_password', 'password', 'Password must be have between 6 and 10 characters.'); 52 | 53 | // "confirm password" 54 | $form->add('label', 'label_confirm_password', 'confirm_password', 'Confirm password:'); 55 | $obj = $form->add('password', 'confirm_password'); 56 | $obj->set_rule(array( 57 | 'compare' => array('password', 'error', 'Password not confirmed correctly!') 58 | )); 59 | 60 | // "captcha" 61 | $form->add('captcha', 'captcha_image', 'captcha_code'); 62 | $form->add('label', 'label_captcha_code', 'captcha_code', 'Are you human?'); 63 | $obj = $form->add('text', 'captcha_code'); 64 | $form->add('note', 'note_captcha', 'captcha_code', 'You must enter the characters with black color that stand 65 | out from the other characters', array('style'=>'width: 200px')); 66 | $obj->set_rule(array( 67 | 'required' => array('error', 'Enter the characters from the image above!'), 68 | 'captcha' => array('error', 'Characters from image entered incorrectly!') 69 | )); 70 | 71 | // "submit" 72 | $form->add('submit', 'btnsubmit', 'Submit'); 73 | 74 | // if the form is valid 75 | if ($form->validate()) { 76 | 77 | // show results 78 | show_results(); 79 | 80 | // otherwise 81 | } else 82 | 83 | // generate output using a custom template 84 | $form->render('*horizontal'); 85 | 86 | ?> -------------------------------------------------------------------------------- /examples/includes/registration-vertical.php: -------------------------------------------------------------------------------- 1 |A registration form
2 | 3 | 'off')); 10 | 11 | // the label for the "first name" element 12 | $form->add('label', 'label_firstname', 'firstname', 'First name:'); 13 | 14 | // add the "first name" element 15 | $obj = $form->add('text', 'firstname'); 16 | 17 | // set rules 18 | $obj->set_rule(array( 19 | 20 | // error messages will be sent to a variable called "error", usable in custom templates 21 | 'required' => array('error', 'First name is required!'), 22 | 23 | )); 24 | 25 | // "last name" 26 | $form->add('label', 'label_lastname', 'lastname', 'Last name:'); 27 | $obj = $form->add('text', 'lastname'); 28 | $obj->set_rule(array( 29 | 'required' => array('error', 'Last name is required!') 30 | )); 31 | 32 | // "email" 33 | $form->add('label', 'label_email', 'email', 'Email address:'); 34 | $obj = $form->add('text', 'email'); 35 | $obj->set_rule(array( 36 | 'required' => array('error', 'Email is required!'), 37 | 'email' => array('error', 'Email address seems to be invalid!') 38 | )); 39 | 40 | // attach a note to the email element 41 | $form->add('note', 'note_email', 'email', 'Please enter a valid email address. An email will be sent to this 42 | address with a link you need to click on in order to activate your account', array('style'=>'width:200px')); 43 | 44 | // "password" 45 | $form->add('label', 'label_password', 'password', 'Choose a password:'); 46 | $obj = $form->add('password', 'password'); 47 | $obj->set_rule(array( 48 | 'required' => array('error', 'Password is required!'), 49 | 'length' => array(6, 10, 'error', 'The password must have between 6 and 10 characters'), 50 | )); 51 | $form->add('note', 'note_password', 'password', 'Password must be have between 6 and 10 characters.'); 52 | 53 | // "confirm password" 54 | $form->add('label', 'label_confirm_password', 'confirm_password', 'Confirm password:'); 55 | $obj = $form->add('password', 'confirm_password'); 56 | $obj->set_rule(array( 57 | 'compare' => array('password', 'error', 'Password not confirmed correctly!') 58 | )); 59 | 60 | // "captcha" 61 | $form->add('captcha', 'captcha_image', 'captcha_code'); 62 | $form->add('label', 'label_captcha_code', 'captcha_code', 'Are you human?'); 63 | $obj = $form->add('text', 'captcha_code'); 64 | $form->add('note', 'note_captcha', 'captcha_code', 'You must enter the characters with black color that stand 65 | out from the other characters', array('style'=>'width: 200px')); 66 | $obj->set_rule(array( 67 | 'required' => array('error', 'Enter the characters from the image above!'), 68 | 'captcha' => array('error', 'Characters from image entered incorrectly!') 69 | )); 70 | 71 | // "submit" 72 | $form->add('submit', 'btnsubmit', 'Submit'); 73 | 74 | // if the form is valid 75 | if ($form->validate()) { 76 | 77 | // show results 78 | show_results(); 79 | 80 | // otherwise 81 | } else 82 | 83 | // generate output using a custom template 84 | $form->render(); 85 | 86 | ?> -------------------------------------------------------------------------------- /examples/includes/reservation-autofill-vertical.php: -------------------------------------------------------------------------------- 1 |A meeting room reservation form
2 | 3 |All fields will be automatically filled with random values - very useful for when debugging forms. The random values will obey the rules set for each element!
4 | 5 | auto_fill(); 16 | 17 | // the label for the "name" element 18 | $form->add('label', 'label_name', 'name', 'Your name:'); 19 | 20 | // add the "name" element 21 | $obj = $form->add('text', 'name'); 22 | 23 | // set rules 24 | $obj->set_rule(array( 25 | 26 | // error messages will be sent to a variable called "error", usable in custom templates 27 | 'required' => array('error', 'Name is required!') 28 | 29 | )); 30 | 31 | // "email" 32 | $form->add('label', 'label_email', 'email', 'Your email address:'); 33 | $obj = $form->add('text', 'email'); 34 | $obj->set_rule(array( 35 | 'required' => array('error', 'Email is required!'), 36 | 'email' => array('error', 'Email address seems to be invalid!'), 37 | )); 38 | 39 | // "department" 40 | $form->add('label', 'label_department', 'department', 'Department:'); 41 | $obj = $form->add('select', 'department', '', array('other' => true)); 42 | $obj->add_options(array( 43 | 'Marketing', 44 | 'Operations', 45 | 'Customer Service', 46 | 'Human Resources', 47 | 'Sales Department', 48 | 'Accounting Department', 49 | 'Legal Department', 50 | )); 51 | $obj->set_rule(array( 52 | 'required' => array('error', 'Department is required!') 53 | )); 54 | 55 | // "room" 56 | $form->add('label', 'label_room', 'room', 'Which room would you like to reserve:'); 57 | $obj = $form->add('radios', 'room', array( 58 | 'A' => 'Room A', 59 | 'B' => 'Room B', 60 | 'C' => 'Room C', 61 | )); 62 | $obj->set_rule(array( 63 | 'required' => array('error', 'Room selection is required!') 64 | )); 65 | 66 | // "extra" 67 | $form->add('label', 'label_extra', 'extra', 'Extra requirements:'); 68 | $obj = $form->add('checkboxes', 'extra[]', array( 69 | 'flipchard' => 'Flipchard and pens', 70 | 'plasma' => 'Plasma TV screen', 71 | 'beverages' => 'Coffee, tea and mineral water', 72 | )); 73 | 74 | // "date" 75 | $form->add('label', 'label_date', 'date', 'Reservation date'); 76 | $date = $form->add('date', 'date'); 77 | $date->set_rule(array( 78 | 'required' => array('error', 'Date is required!'), 79 | 'date' => array('error', 'Date is invalid!'), 80 | )); 81 | 82 | // date format 83 | // don't forget to use $date->get_date() if the form is valid to get the date in YYYY-MM-DD format ready to be used 84 | // in a database or with PHP's strtotime function! 85 | $date->format('M d, Y'); 86 | 87 | $form->add('note', 'note_date', 'date', 'Date format is M d, Y'); 88 | 89 | // "time" 90 | $form->add('label', 'label_time', 'time', 'Reservation time :'); 91 | $obj = $form->add('time', 'time', '', array( 92 | 'format' => 'hm', 93 | 'hours' => array(9, 10, 11, 12, 13, 14, 15, 16, 17), 94 | 'minutes' => array(0, 30), 95 | )); 96 | 97 | $obj->set_rule(array( 98 | 'required' => array('error', 'Time is required!'), 99 | )); 100 | 101 | // "submit" 102 | $form->add('submit', 'btnsubmit', 'Submit'); 103 | 104 | // if the form is valid 105 | if ($form->validate()) { 106 | 107 | // show results 108 | show_results(); 109 | 110 | // otherwise 111 | } else 112 | 113 | // generate output using a custom template 114 | $form->render(); 115 | 116 | ?> -------------------------------------------------------------------------------- /examples/includes/reservation-custom.php: -------------------------------------------------------------------------------- 1 |A meeting room reservation form
2 | 3 |Check the "Template source" tab to see how it's done!
4 | 5 | add('label', 'label_name', 'name', 'Your name:'); 15 | 16 | // add the "name" element 17 | $obj = $form->add('text', 'name'); 18 | 19 | // set rules 20 | $obj->set_rule(array( 21 | 22 | // error messages will be sent to a variable called "error", usable in custom templates 23 | 'required' => array('error', 'Name is required!') 24 | 25 | )); 26 | 27 | // "email" 28 | $form->add('label', 'label_email', 'email', 'Your email address:'); 29 | $obj = $form->add('text', 'email'); 30 | $obj->set_rule(array( 31 | 'required' => array('error', 'Email is required!'), 32 | 'email' => array('error', 'Email address seems to be invalid!'), 33 | )); 34 | 35 | // "department" 36 | $form->add('label', 'label_department', 'department', 'Department:'); 37 | $obj = $form->add('select', 'department', '', array('other' => true)); 38 | $obj->add_options(array( 39 | 'Marketing', 40 | 'Operations', 41 | 'Customer Service', 42 | 'Human Resources', 43 | 'Sales Department', 44 | 'Accounting Department', 45 | 'Legal Department', 46 | )); 47 | $obj->set_rule(array( 48 | 'required' => array('error', 'Department is required!') 49 | )); 50 | 51 | // "room" 52 | $form->add('label', 'label_room', 'room', 'Which room would you like to reserve:'); 53 | $obj = $form->add('radios', 'room', array( 54 | 'A' => 'Room A', 55 | 'B' => 'Room B', 56 | 'C' => 'Room C', 57 | )); 58 | $obj->set_rule(array( 59 | 'required' => array('error', 'Room selection is required!') 60 | )); 61 | 62 | // "extra" 63 | $form->add('label', 'label_extra', 'extra', 'Extra requirements:'); 64 | $obj = $form->add('checkboxes', 'extra[]', array( 65 | 'flipchard' => 'Flipchard and pens', 66 | 'plasma' => 'Plasma TV screen', 67 | 'beverages' => 'Coffee, tea and mineral water', 68 | )); 69 | 70 | // "date" 71 | $form->add('label', 'label_date', 'date', 'Reservation date'); 72 | $date = $form->add('date', 'date'); 73 | $date->set_rule(array( 74 | 'required' => array('error', 'Date is required!'), 75 | 'date' => array('error', 'Date is invalid!'), 76 | )); 77 | 78 | // date format 79 | // don't forget to use $date->get_date() if the form is valid to get the date in YYYY-MM-DD format ready to be used 80 | // in a database or with PHP's strtotime function! 81 | $date->format('M d, Y'); 82 | 83 | // selectable dates are starting with the current day 84 | $date->direction(1); 85 | 86 | $form->add('note', 'note_date', 'date', 'Date format is M d, Y'); 87 | 88 | // "time" 89 | $form->add('label', 'label_time', 'time', 'Reservation time :'); 90 | $form->add('time', 'time', '', array( 91 | 'hours' => array(9, 10, 11, 12, 13, 14, 15, 16, 17), 92 | 'minutes' => array(0, 30), 93 | )); 94 | 95 | // "submit" 96 | $form->add('submit', 'btnsubmit', 'Submit'); 97 | 98 | // if the form is valid 99 | if ($form->validate()) { 100 | 101 | // show results 102 | show_results(); 103 | 104 | // otherwise 105 | } else 106 | 107 | // generate output using a custom template 108 | $form->render('includes/custom-templates/reservation.php'); 109 | 110 | ?> -------------------------------------------------------------------------------- /examples/includes/reservation-horizontal.php: -------------------------------------------------------------------------------- 1 |A meeting room reservation form
2 | 3 | add('label', 'label_name', 'name', 'Your name:'); 13 | 14 | // add the "name" element 15 | $obj = $form->add('text', 'name'); 16 | 17 | // set rules 18 | $obj->set_rule(array( 19 | 20 | // error messages will be sent to a variable called "error", usable in custom templates 21 | 'required' => array('error', 'Name is required!') 22 | 23 | )); 24 | 25 | // "email" 26 | $form->add('label', 'label_email', 'email', 'Your email address:'); 27 | $obj = $form->add('text', 'email'); 28 | $obj->set_rule(array( 29 | 'required' => array('error', 'Email is required!'), 30 | 'email' => array('error', 'Email address seems to be invalid!'), 31 | )); 32 | 33 | // "department" 34 | $form->add('label', 'label_department', 'department', 'Department:'); 35 | $obj = $form->add('select', 'department', '', array('other' => true)); 36 | $obj->add_options(array( 37 | 'Marketing', 38 | 'Operations', 39 | 'Customer Service', 40 | 'Human Resources', 41 | 'Sales Department', 42 | 'Accounting Department', 43 | 'Legal Department', 44 | )); 45 | $obj->set_rule(array( 46 | 'required' => array('error', 'Department is required!') 47 | )); 48 | 49 | // "room" 50 | $form->add('label', 'label_room', 'room', 'Which room would you like to reserve:'); 51 | $obj = $form->add('radios', 'room', array( 52 | 'A' => 'Room A', 53 | 'B' => 'Room B', 54 | 'C' => 'Room C', 55 | )); 56 | $obj->set_rule(array( 57 | 'required' => array('error', 'Room selection is required!') 58 | )); 59 | 60 | // "extra" 61 | $form->add('label', 'label_extra', 'extra', 'Extra requirements:'); 62 | $obj = $form->add('checkboxes', 'extra[]', array( 63 | 'flipchard' => 'Flipchard and pens', 64 | 'plasma' => 'Plasma TV screen', 65 | 'beverages' => 'Coffee, tea and mineral water', 66 | )); 67 | 68 | // "date" 69 | $form->add('label', 'label_date', 'date', 'Reservation date'); 70 | $date = $form->add('date', 'date'); 71 | $date->set_rule(array( 72 | 'required' => array('error', 'Date is required!'), 73 | 'date' => array('error', 'Date is invalid!'), 74 | )); 75 | 76 | // date format 77 | // don't forget to use $date->get_date() if the form is valid to get the date in YYYY-MM-DD format ready to be used 78 | // in a database or with PHP's strtotime function! 79 | $date->format('M d, Y'); 80 | 81 | // selectable dates are starting with the current day 82 | $date->direction(1); 83 | 84 | $form->add('note', 'note_date', 'date', 'Date format is M d, Y'); 85 | 86 | // "time" 87 | $form->add('label', 'label_time', 'time', 'Reservation time :'); 88 | $form->add('time', 'time', '', array( 89 | 'hours' => array(9, 10, 11, 12, 13, 14, 15, 16, 17), 90 | 'minutes' => array(0, 30), 91 | )); 92 | 93 | // "submit" 94 | $form->add('submit', 'btnsubmit', 'Submit'); 95 | 96 | // if the form is valid 97 | if ($form->validate()) { 98 | 99 | // show results 100 | show_results(); 101 | 102 | // otherwise 103 | } else 104 | 105 | // generate output using a custom template 106 | $form->render('*horizontal'); 107 | 108 | ?> -------------------------------------------------------------------------------- /examples/includes/reservation-vertical.php: -------------------------------------------------------------------------------- 1 |A meeting room reservation form
2 | 3 | add('label', 'label_name', 'name', 'Your name:'); 13 | 14 | // add the "name" element 15 | $obj = $form->add('text', 'name'); 16 | 17 | // set rules 18 | $obj->set_rule(array( 19 | 20 | // error messages will be sent to a variable called "error", usable in custom templates 21 | 'required' => array('error', 'Name is required!') 22 | 23 | )); 24 | 25 | // "email" 26 | $form->add('label', 'label_email', 'email', 'Your email address:'); 27 | $obj = $form->add('text', 'email'); 28 | $obj->set_rule(array( 29 | 'required' => array('error', 'Email is required!'), 30 | 'emails' => array('error', 'Email address seems to be invalid!'), 31 | )); 32 | 33 | // "department" 34 | $form->add('label', 'label_department', 'department', 'Department:'); 35 | $obj = $form->add('select', 'department', '', array('other' => true)); 36 | $obj->add_options(array( 37 | 'Marketing', 38 | 'Operations', 39 | 'Customer Service', 40 | 'Human Resources', 41 | 'Sales Department', 42 | 'Accounting Department', 43 | 'Legal Department', 44 | )); 45 | $obj->set_rule(array( 46 | 'required' => array('error', 'Department is required!') 47 | )); 48 | 49 | // "room" 50 | $form->add('label', 'label_room', 'room', 'Which room would you like to reserve:'); 51 | $obj = $form->add('radios', 'room', array( 52 | 'A' => 'Room A', 53 | 'B' => 'Room B', 54 | 'C' => 'Room C', 55 | )); 56 | $obj->set_rule(array( 57 | 'required' => array('error', 'Room selection is required!') 58 | )); 59 | 60 | // "extra" 61 | $form->add('label', 'label_extra', 'extra', 'Extra requirements:'); 62 | $obj = $form->add('checkboxes', 'extra[]', array( 63 | 'flipchard' => 'Flipchard and pens', 64 | 'plasma' => 'Plasma TV screen', 65 | 'beverages' => 'Coffee, tea and mineral water', 66 | )); 67 | 68 | // "date" 69 | $form->add('label', 'label_date', 'date', 'Reservation date'); 70 | $date = $form->add('date', 'date'); 71 | $date->set_rule(array( 72 | 'required' => array('error', 'Date is required!'), 73 | 'date' => array('error', 'Date is invalid!'), 74 | )); 75 | 76 | // date format 77 | // don't forget to use $date->get_date() if the form is valid to get the date in YYYY-MM-DD format ready to be used 78 | // in a database or with PHP's strtotime function! 79 | $date->format('M d, Y'); 80 | 81 | $form->add('note', 'note_date', 'date', 'Date format is M d, Y'); 82 | 83 | // "time" 84 | $form->add('label', 'label_time', 'time', 'Reservation time :'); 85 | $obj = $form->add('time', 'time', '', array( 86 | 'format' => 'hm', 87 | 'hours' => array(9, 10, 11, 12, 13, 14, 15, 16, 17), 88 | 'minutes' => array(0, 30), 89 | )); 90 | 91 | $obj->set_rule(array( 92 | 'required' => array('error', 'Time is required!'), 93 | )); 94 | 95 | // "submit" 96 | $form->add('submit', 'btnsubmit', 'Submit'); 97 | 98 | // if the form is valid 99 | if ($form->validate()) { 100 | 101 | // show results 102 | show_results(); 103 | 104 | // otherwise 105 | } else 106 | 107 | // generate output using a custom template 108 | $form->render(); 109 | 110 | ?> -------------------------------------------------------------------------------- /examples/includes/validation-vertical.php: -------------------------------------------------------------------------------- 1 |More validation rules
2 | 3 | add('label', 'label_alphabet', 'alphabet', 'Alphabet:'); 13 | 14 | $obj = $form->add('text', 'alphabet'); 15 | 16 | // set rules 17 | $obj->set_rule(array( 18 | 19 | // error messages will be sent to a variable called "error", usable in custom templates 20 | 'required' => array('error', 'This field is required!'), 21 | 'alphabet' => array('', 'error', 'Accepts only characters from the alphabet (case-insensitive a to z)') 22 | 23 | )); 24 | 25 | // attach a note 26 | $form->add('note', 'note_alphabet', 'alphabet', 'Accepts only characters from the alphabet (case-insensitive a to z)'); 27 | 28 | // "alphanumeric" 29 | $form->add('label', 'label_alphanumeric', 'alphanumeric', 'Alphanumeric:'); 30 | $obj = $form->add('text', 'alphanumeric'); 31 | $obj->set_rule(array( 32 | 'required' => array('error', 'This field is required!'), 33 | 'alphanumeric' => array('', 'error', 'Accepts only characters from the alphabet (case-insensitive a to z) and digits (0 to 9)') 34 | )); 35 | $form->add('note', 'note_alphanumeric', 'alphanumeric', 'Accepts only characters from the alphabet (case-insensitive a to z) and digits (0 to 9)'); 36 | 37 | // "digits" 38 | $form->add('label', 'label_digits', 'digits', 'Digits:'); 39 | $obj = $form->add('text', 'digits'); 40 | $obj->set_rule(array( 41 | 'required' => array('error', 'This field is required!'), 42 | 'digits' => array('', 'error', 'Accepts only digits (0 to 9)') 43 | )); 44 | $form->add('note', 'note_digits', 'digits', 'Accepts only digits (0 to 9)'); 45 | 46 | // "float" 47 | $form->add('label', 'label_float', 'float', 'Float:'); 48 | $obj = $form->add('text', 'float'); 49 | $obj->set_rule(array( 50 | 'required' => array('error', 'This field is required!'), 51 | 'float' => array('', 'error', 'Accepts only digits (0 to 9) and/or one dot (but not as the very first character) and/or one minus sign (but only if it is the very first character)') 52 | )); 53 | $form->add('note', 'note_float', 'float', 'Accepts only digits (0 to 9) and/or one dot (but not as the very first character) and/or one minus sign (but only if it is the very first character)'); 54 | 55 | // "length" 56 | $form->add('label', 'label_length', 'length', 'Length:'); 57 | $obj = $form->add('text', 'length'); 58 | $obj->set_rule(array( 59 | 'required' => array('error', 'This field is required!'), 60 | 'length' => array(6, 12, 'error', 'Must contain between 6 and 12 characters!') 61 | )); 62 | $form->add('note', 'note_length', 'length', 'Must contain between 6 and 12 characters'); 63 | 64 | // "number" 65 | $form->add('label', 'label_number', 'number', 'Number:'); 66 | $obj = $form->add('text', 'number'); 67 | $obj->set_rule(array( 68 | 'required' => array('error', 'This field is required!'), 69 | 'number' => array('', 'error', 'Accepts only digits (0 to 9) and/or one minus sign (but only if it is the very first character)') 70 | )); 71 | $form->add('note', 'note_number', 'number', 'Accepts only digits (0 to 9) and/or one minus sign (but only if it is the very first character)'); 72 | 73 | // "regular expression" 74 | $form->add('label', 'label_regexp', 'regexp', 'Regular expression:'); 75 | $obj = $form->add('text', 'regexp'); 76 | $obj->set_rule(array( 77 | 'required' => array('error', 'This field is required!'), 78 | 'regexp' => array('^07[0-9]{8}$', 'error', 'Validates only if the value matches the following regular expression: ^07[0-9]{8}$') 79 | )); 80 | $form->add('note', 'note_regexp', 'regexp', 'Validates if the value satisfies the following regular expression: ^07[0-9]{8}$'); 81 | 82 | // "change case" 83 | $form->add('label', 'label_case', 'case', 'Change case:'); 84 | $obj = $form->add('text', 'case'); 85 | $obj->set_rule(array( 86 | 'required' => array('error', 'This field is required!'), 87 | )); 88 | // force all characters to be upper-case 89 | $obj->change_case('upper'); 90 | $form->add('note', 'note_case', 'case', 'All entered characters will be upper-case'); 91 | 92 | // "submit" 93 | $form->add('submit', 'btnsubmit', 'Submit'); 94 | 95 | // if the form is valid 96 | if ($form->validate()) { 97 | 98 | // show results 99 | show_results(); 100 | 101 | // otherwise 102 | } else 103 | 104 | // generate output using a custom template 105 | $form->render(); 106 | 107 | ?> -------------------------------------------------------------------------------- /examples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |403 Forbidden 4 | 5 | 6 |Directory access is forbidden.
7 | 8 | -------------------------------------------------------------------------------- /examples/libraries/highlight/public/AUTHORS.en.txt: -------------------------------------------------------------------------------- 1 | Syntax highlighting with language autodetection. 2 | 3 | URL: http://softwaremaniacs.org/soft/highlight/en/ 4 | 5 | Original author and current maintainer: 6 | Ivan Sagalaev7 | 8 | Contributors: 9 | 10 | - Peter Leonov 11 | - Victor Karamzin 12 | - Vsevolod Solovyov 13 | - Anton Kovalyov 14 | - Nikita Ledyaev 15 | - Konstantin Evdokimenko 16 | - Dmitri Roudakov 17 | - Yuri Ivanov 18 | - Vladimir Ermakov 19 | - Vladimir Gubarkov 20 | - Brian Beck 21 | - MajestiC 22 | - Vasily Polovnyov 23 | - Vladimir Epifanov 24 | - Alexander Makarov (http://rmcreative.ru/) 25 | - Vah 26 | - Shuen-Huei Guan 27 | - Jason Diamond 28 | - Michal Gabrukiewicz 29 | - Ruslan Keba 30 | - Sergey Baranov 31 | - Zaripov Yura 32 | - Oleg Volchkov 33 | - Vasily Mikhailitchenko 34 | - Jan Berkel 35 | - Vladimir Moskva 36 | - Loren Segal 37 | - Andrew Fedorov 38 | - Igor Kalnitsky 39 | -------------------------------------------------------------------------------- /examples/libraries/highlight/public/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006, Ivan Sagalaev 2 | All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of highlight.js nor the names of its contributors 12 | may be used to endorse or promote products derived from this software 13 | without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY 16 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /examples/libraries/highlight/public/css/dark.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Dark style from softwaremaniacs.org (c) Ivan Sagalaev 4 | 5 | */ 6 | 7 | pre code { 8 | display: block; padding: 0.5em; 9 | background: #444; 10 | } 11 | 12 | pre .keyword, 13 | pre .literal, 14 | pre .change, 15 | pre .winutils, 16 | pre .flow, 17 | pre .lisp .title, 18 | pre .tex .special { 19 | color: white; 20 | } 21 | 22 | pre code, 23 | pre .ruby .subst { 24 | color: #DDD; 25 | } 26 | 27 | pre .string, 28 | pre .function .title, 29 | pre .class .title, 30 | pre .ini .title, 31 | pre .tag .value, 32 | pre .css .rules .value, 33 | pre .preprocessor, 34 | pre .ruby .symbol, 35 | pre .ruby .symbol .string, 36 | pre .ruby .symbol .keyword, 37 | pre .ruby .symbol .keymethods, 38 | pre .ruby .instancevar, 39 | pre .ruby .class .parent, 40 | pre .built_in, 41 | pre .sql .aggregate, 42 | pre .django .template_tag, 43 | pre .django .variable, 44 | pre .smalltalk .class, 45 | pre .javadoc, 46 | pre .ruby .string, 47 | pre .django .filter .argument, 48 | pre .smalltalk .localvars, 49 | pre .smalltalk .array, 50 | pre .attr_selector, 51 | pre .pseudo, 52 | pre .addition, 53 | pre .stream, 54 | pre .envvar, 55 | pre .apache .tag, 56 | pre .apache .cbracket, 57 | pre .tex .command { 58 | color: #D88; 59 | } 60 | 61 | pre .comment, 62 | pre .java .annotation, 63 | pre .python .decorator, 64 | pre .template_comment, 65 | pre .pi, 66 | pre .doctype, 67 | pre .deletion, 68 | pre .shebang, 69 | pre .apache .sqbracket, 70 | pre .tex .formula { 71 | color: #777; 72 | } 73 | 74 | pre .keyword, 75 | pre .literal, 76 | pre .css .id, 77 | pre .phpdoc, 78 | pre .function .title, 79 | pre .class .title, 80 | pre .vbscript .built_in, 81 | pre .sql .aggregate, 82 | pre .rsl .built_in, 83 | pre .smalltalk .class, 84 | pre .xml .tag .title, 85 | pre .diff .header, 86 | pre .chunk, 87 | pre .winutils, 88 | pre .bash .variable, 89 | pre .lisp .title, 90 | pre .apache .tag, 91 | pre .tex .special { 92 | font-weight: bold; 93 | } 94 | 95 | pre .html .css, 96 | pre .html .javascript, 97 | pre .html .vbscript, 98 | pre .tex .formula { 99 | opacity: 0.5; 100 | } 101 | -------------------------------------------------------------------------------- /examples/libraries/highlight/public/css/default.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Original style from softwaremaniacs.org (c) Ivan Sagalaev 4 | 5 | */ 6 | 7 | pre code { 8 | display: block; padding: 0.5em; 9 | background: #F0F0F0; 10 | } 11 | 12 | pre code, 13 | pre .ruby .subst, 14 | pre .tag .title, 15 | pre .lisp .title { 16 | color: black; 17 | } 18 | 19 | pre .string, 20 | pre .title, 21 | pre .constant, 22 | pre .parent, 23 | pre .tag .value, 24 | pre .rules .value, 25 | pre .rules .value .number, 26 | pre .preprocessor, 27 | pre .ruby .symbol, 28 | pre .ruby .symbol .string, 29 | pre .ruby .symbol .keyword, 30 | pre .ruby .symbol .keymethods, 31 | pre .instancevar, 32 | pre .aggregate, 33 | pre .template_tag, 34 | pre .django .variable, 35 | pre .smalltalk .class, 36 | pre .addition, 37 | pre .flow, 38 | pre .stream, 39 | pre .bash .variable, 40 | pre .apache .tag, 41 | pre .apache .cbracket, 42 | pre .tex .command, 43 | pre .tex .special { 44 | color: #800; 45 | } 46 | 47 | pre .comment, 48 | pre .annotation, 49 | pre .template_comment, 50 | pre .diff .header, 51 | pre .chunk { 52 | color: #888; 53 | } 54 | 55 | pre .number, 56 | pre .date, 57 | pre .regexp, 58 | pre .literal, 59 | pre .smalltalk .symbol, 60 | pre .smalltalk .char, 61 | pre .change { 62 | color: #080; 63 | } 64 | 65 | pre .label, 66 | pre .javadoc, 67 | pre .ruby .string, 68 | pre .decorator, 69 | pre .filter .argument, 70 | pre .localvars, 71 | pre .array, 72 | pre .attr_selector, 73 | pre .important, 74 | pre .pseudo, 75 | pre .pi, 76 | pre .doctype, 77 | pre .deletion, 78 | pre .envvar, 79 | pre .shebang, 80 | pre .apache .sqbracket, 81 | pre .nginx .built_in, 82 | pre .tex .formula { 83 | color: #88F; 84 | } 85 | 86 | pre .javadoctag, 87 | pre .phpdoc, 88 | pre .yardoctag { 89 | font-weight: bold; 90 | } 91 | 92 | pre .keyword, 93 | pre .id, 94 | pre .phpdoc, 95 | pre .title, 96 | pre .built_in, 97 | pre .aggregate, 98 | pre .smalltalk .class, 99 | pre .winutils, 100 | pre .bash .variable, 101 | pre .apache .tag, 102 | pre .tex .command { 103 | font-weight: bold; 104 | } 105 | 106 | pre .nginx .built_in { 107 | font-weight: normal; 108 | } 109 | 110 | pre .html .css, 111 | pre .html .javascript, 112 | pre .html .vbscript, 113 | pre .tex .formula { 114 | opacity: 0.5; 115 | } 116 | -------------------------------------------------------------------------------- /examples/libraries/highlight/public/css/ir_black.css: -------------------------------------------------------------------------------- 1 | /* 2 | IR_Black style (c) Vasily Mikhailitchenko 3 | */ 4 | 5 | pre code { 6 | display: block; padding: 0.5em; 7 | background: #222; color: #f8f8f8; 8 | font-size: 11px 9 | } 10 | 11 | pre .shebang, 12 | pre .comment, 13 | pre .template_comment, 14 | pre .javadoc { 15 | color: #7c7c7c; 16 | } 17 | 18 | pre .keyword, 19 | pre .tag, 20 | pre .ruby .function .keyword, 21 | pre .tex .command { 22 | color: #96CBFE; 23 | } 24 | 25 | pre .function .keyword, 26 | pre .sub .keyword, 27 | pre .method, 28 | pre .list .title { 29 | color: #FFFFB6; 30 | } 31 | 32 | pre .string, 33 | pre .tag .value, 34 | pre .cdata, 35 | pre .filter .argument, 36 | pre .attr_selector, 37 | pre .apache .cbracket, 38 | pre .date { 39 | color: #A8FF60; 40 | } 41 | 42 | pre .subst { 43 | color: #DAEFA3; 44 | } 45 | 46 | pre .regexp { 47 | color: #E9C062; 48 | } 49 | 50 | pre .function .title, 51 | pre .sub .identifier, 52 | pre .pi, 53 | pre .decorator, 54 | pre .ini .title, 55 | pre .tex .special { 56 | color: #FFFFB6; 57 | } 58 | 59 | pre .class .title, 60 | pre .constant, 61 | pre .smalltalk .class, 62 | pre .javadoctag, 63 | pre .yardoctag, 64 | pre .phpdoc, 65 | pre .nginx .built_in { 66 | color: #FFFFB6; 67 | } 68 | 69 | pre .symbol, 70 | pre .ruby .symbol .string, 71 | pre .ruby .symbol .keyword, 72 | pre .ruby .symbol .keymethods, 73 | pre .number, 74 | pre .variable, 75 | pre .vbscript, 76 | pre .literal { 77 | color: #C6C5FE; 78 | } 79 | 80 | pre .css .keyword { 81 | color: #96CBFE; 82 | } 83 | 84 | pre .css .rule .keyword, 85 | pre .css .id { 86 | color: #FFFFB6; 87 | } 88 | 89 | pre .css .class { 90 | color: #FFF; 91 | } 92 | 93 | pre .hexcolor { 94 | color: #C6C5FE; 95 | } 96 | 97 | pre .number { 98 | color:#FF73FD; 99 | } 100 | 101 | pre .tex .formula { 102 | opacity: 0.7; 103 | } 104 | -------------------------------------------------------------------------------- /examples/libraries/highlight/public/css/sunburst.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Sunburst-like style (c) Vasily Polovnyov 4 | 5 | */ 6 | 7 | pre code { 8 | display: block; padding: 0.5em; 9 | font: 1em / 1.3em 'Lucida Console', 'courier new', monospace; 10 | background: #000; color: #f8f8f8; 11 | } 12 | 13 | pre .comment, 14 | pre .template_comment, 15 | pre .javadoc { 16 | color: #aeaeae; 17 | font-style: italic; 18 | } 19 | 20 | pre .keyword, 21 | pre .ruby .function .keyword { 22 | color: #E28964; 23 | } 24 | 25 | pre .function .keyword, 26 | pre .sub .keyword, 27 | pre .method, 28 | pre .list .title { 29 | color: #99CF50; 30 | } 31 | 32 | pre .string, 33 | pre .tag .value, 34 | pre .cdata, 35 | pre .filter .argument, 36 | pre .attr_selector, 37 | pre .apache .cbracket, 38 | pre .date, 39 | pre .tex .command { 40 | color: #65B042; 41 | } 42 | 43 | pre .subst { 44 | color: #DAEFA3; 45 | } 46 | 47 | pre .regexp { 48 | color: #E9C062; 49 | } 50 | 51 | pre .function .title, 52 | pre .sub .identifier, 53 | pre .pi, 54 | pre .tag, 55 | pre .tag .keyword, 56 | pre .decorator, 57 | pre .ini .title, 58 | pre .shebang { 59 | color: #89BDFF; 60 | } 61 | 62 | pre .class .title, 63 | pre .smalltalk .class, 64 | pre .javadoctag, 65 | pre .yardoctag, 66 | pre .phpdoc { 67 | text-decoration: underline; 68 | } 69 | 70 | pre .symbol, 71 | pre .ruby .symbol .string, 72 | pre .ruby .symbol .keyword, 73 | pre .ruby .symbol .keymethods, 74 | pre .number { 75 | color: #3387CC; 76 | } 77 | 78 | pre .params, 79 | pre .variable { 80 | color: #3E87E3; 81 | } 82 | 83 | pre .css .keyword, 84 | pre .pseudo, 85 | pre .tex .special { 86 | color: #CDA869; 87 | } 88 | 89 | pre .css .class { 90 | color: #9B703F; 91 | } 92 | 93 | pre .rules .keyword { 94 | color: #C5AF75; 95 | } 96 | 97 | pre .rules .value { 98 | color: #CF6A4C; 99 | } 100 | 101 | pre .css .id { 102 | color: #8B98AB; 103 | } 104 | 105 | pre .annotation, 106 | pre .apache .sqbracket, 107 | pre .nginx .built_in { 108 | color: #9B859D; 109 | } 110 | 111 | pre .preprocessor { 112 | color: #8996A8; 113 | } 114 | 115 | pre .hexcolor, 116 | pre .css .value .number { 117 | color: #DD7B3B; 118 | } 119 | 120 | pre .css .function { 121 | color: #DAD085; 122 | } 123 | 124 | pre .diff .header, 125 | pre .chunk, 126 | pre .tex .formula { 127 | background-color: #0E2231; 128 | color: #F8F8F8; 129 | font-style: italic; 130 | } 131 | 132 | pre .diff .change { 133 | background-color: #4A410D; 134 | color: #F8F8F8; 135 | } 136 | 137 | pre .addition { 138 | background-color: #253B22; 139 | color: #F8F8F8; 140 | } 141 | 142 | pre .deletion { 143 | background-color: #420E09; 144 | color: #F8F8F8; 145 | } 146 | -------------------------------------------------------------------------------- /examples/libraries/highlight/public/css/zenburn.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Zenburn style from voldmar.ru (c) Vladimir Epifanov 4 | based on dark.css by Ivan Sagalaev 5 | 6 | */ 7 | 8 | pre code { 9 | display: block; padding: 0.5em; 10 | background: #3F3F3F; 11 | color: #DCDCDC; 12 | } 13 | 14 | pre .keyword, 15 | pre .tag, 16 | pre .django .tag, 17 | pre .django .keyword, 18 | pre .css .class, 19 | pre .css .id, 20 | pre .lisp .title { 21 | color: #E3CEAB; 22 | } 23 | 24 | pre .django .template_tag, 25 | pre .django .variable, 26 | pre .django .filter .argument { 27 | color: #DCDCDC; 28 | } 29 | 30 | pre .number, 31 | pre .date { 32 | color: #8CD0D3; 33 | } 34 | 35 | pre .dos .envvar, 36 | pre .dos .stream, 37 | pre .variable, 38 | pre .apache .sqbracket { 39 | color: #EFDCBC; 40 | } 41 | 42 | pre .dos .flow, 43 | pre .diff .change, 44 | pre .python .exception, 45 | pre .python .built_in, 46 | pre .literal, 47 | pre .tex .special { 48 | color: #EFEFAF; 49 | } 50 | 51 | pre .diff .chunk, 52 | pre .ruby .subst { 53 | color: #8F8F8F; 54 | } 55 | 56 | pre .dos .keyword, 57 | pre .python .decorator, 58 | pre .class .title, 59 | pre .function .title, 60 | pre .ini .title, 61 | pre .diff .header, 62 | pre .ruby .class .parent, 63 | pre .apache .tag, 64 | pre .nginx .built_in, 65 | pre .tex .command { 66 | color: #efef8f; 67 | } 68 | 69 | pre .dos .winutils, 70 | pre .ruby .symbol, 71 | pre .ruby .symbol .string, 72 | pre .ruby .symbol .keyword, 73 | pre .ruby .symbol .keymethods, 74 | pre .ruby .string, 75 | pre .ruby .instancevar { 76 | color: #DCA3A3; 77 | } 78 | 79 | pre .diff .deletion, 80 | pre .string, 81 | pre .tag .value, 82 | pre .preprocessor, 83 | pre .built_in, 84 | pre .sql .aggregate, 85 | pre .javadoc, 86 | pre .smalltalk .class, 87 | pre .smalltalk .localvars, 88 | pre .smalltalk .array, 89 | pre .css .rules .value, 90 | pre .attr_selector, 91 | pre .pseudo, 92 | pre .apache .cbracket, 93 | pre .tex .formula { 94 | color: #CC9393; 95 | } 96 | 97 | pre .shebang, 98 | pre .diff .addition, 99 | pre .comment, 100 | pre .java .annotation, 101 | pre .template_comment, 102 | pre .pi, 103 | pre .doctype { 104 | color: #7F9F7F; 105 | } 106 | 107 | pre .html .css, 108 | pre .html .javascript, 109 | pre .tex .formula { 110 | opacity: 0.5; 111 | } 112 | 113 | -------------------------------------------------------------------------------- /examples/libraries/highlight/public/javascript/css.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: CSS 3 | Requires: html-xml.js 4 | */ 5 | 6 | hljs.LANGUAGES.css = { 7 | defaultMode: { 8 | contains: ['at_rule', 'id', 'class', 'attr_selector', 'pseudo', 'rules', 'comment'], 9 | keywords: hljs.HTML_TAGS, 10 | lexems: [hljs.IDENT_RE], 11 | illegal: '=' 12 | }, 13 | case_insensitive: true, 14 | modes: [ 15 | { 16 | className: 'at_rule', 17 | begin: '@', end: '[{;]', 18 | excludeEnd: true, 19 | lexems: [hljs.IDENT_RE], 20 | keywords: {'import': 1, 'page': 1, 'media': 1, 'charset': 1, 'font-face': 1}, 21 | contains: ['function', 'string', 'number', 'pseudo'] 22 | }, 23 | { 24 | className: 'id', 25 | begin: '\\#[A-Za-z0-9_-]+', end: hljs.IMMEDIATE_RE 26 | }, 27 | { 28 | className: 'class', 29 | begin: '\\.[A-Za-z0-9_-]+', end: hljs.IMMEDIATE_RE, 30 | relevance: 0 31 | }, 32 | { 33 | className: 'attr_selector', 34 | begin: '\\[', end: '\\]', 35 | illegal: '$' 36 | }, 37 | { 38 | className: 'pseudo', 39 | begin: ':(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\"\\\']+', end: hljs.IMMEDIATE_RE 40 | }, 41 | { 42 | className: 'rules', 43 | begin: '{', end: '}', 44 | contains: [ 45 | { 46 | className: 'rule', 47 | begin: '[A-Z\\_\\.\\-]+\\s*:', end: ';', endsWithParent: true, 48 | lexems: ['[A-Za-z-]+'], 49 | keywords: {'play-during': 1, 'counter-reset': 1, 'counter-increment': 1, 'min-height': 1, 'quotes': 1, 'border-top': 1, 'pitch': 1, 'font': 1, 'pause': 1, 'list-style-image': 1, 'border-width': 1, 'cue': 1, 'outline-width': 1, 'border-left': 1, 'elevation': 1, 'richness': 1, 'speech-rate': 1, 'border-bottom': 1, 'border-spacing': 1, 'background': 1, 'list-style-type': 1, 'text-align': 1, 'page-break-inside': 1, 'orphans': 1, 'page-break-before': 1, 'text-transform': 1, 'line-height': 1, 'padding-left': 1, 'font-size': 1, 'right': 1, 'word-spacing': 1, 'padding-top': 1, 'outline-style': 1, 'bottom': 1, 'content': 1, 'border-right-style': 1, 'padding-right': 1, 'border-left-style': 1, 'voice-family': 1, 'background-color': 1, 'border-bottom-color': 1, 'outline-color': 1, 'unicode-bidi': 1, 'max-width': 1, 'font-family': 1, 'caption-side': 1, 'border-right-width': 1, 'pause-before': 1, 'border-top-style': 1, 'color': 1, 'border-collapse': 1, 'border-bottom-width': 1, 'float': 1, 'height': 1, 'max-height': 1, 'margin-right': 1, 'border-top-width': 1, 'speak': 1, 'speak-header': 1, 'top': 1, 'cue-before': 1, 'min-width': 1, 'width': 1, 'font-variant': 1, 'border-top-color': 1, 'background-position': 1, 'empty-cells': 1, 'direction': 1, 'border-right': 1, 'visibility': 1, 'padding': 1, 'border-style': 1, 'background-attachment': 1, 'overflow': 1, 'border-bottom-style': 1, 'cursor': 1, 'margin': 1, 'display': 1, 'border-left-width': 1, 'letter-spacing': 1, 'vertical-align': 1, 'clip': 1, 'border-color': 1, 'list-style': 1, 'padding-bottom': 1, 'pause-after': 1, 'speak-numeral': 1, 'margin-left': 1, 'widows': 1, 'border': 1, 'font-style': 1, 'border-left-color': 1, 'pitch-range': 1, 'background-repeat': 1, 'table-layout': 1, 'margin-bottom': 1, 'speak-punctuation': 1, 'font-weight': 1, 'border-right-color': 1, 'page-break-after': 1, 'position': 1, 'white-space': 1, 'text-indent': 1, 'background-image': 1, 'volume': 1, 'stress': 1, 'outline': 1, 'clear': 1, 'z-index': 1, 'text-decoration': 1, 'margin-top': 1, 'azimuth': 1, 'cue-after': 1, 'left': 1, 'list-style-position': 1}, 50 | contains: [ 51 | { 52 | className: 'value', 53 | begin: hljs.IMMEDIATE_RE, endsWithParent: true, excludeEnd: true, 54 | contains: ['function', 'number', 'hexcolor', 'string', 'important', 'comment'] 55 | } 56 | ] 57 | }, 58 | 'comment' 59 | ], 60 | illegal: '[^\\s]' 61 | }, 62 | hljs.C_BLOCK_COMMENT_MODE, 63 | { 64 | className: 'number', 65 | begin: hljs.NUMBER_RE, end: hljs.IMMEDIATE_RE 66 | }, 67 | { 68 | className: 'hexcolor', 69 | begin: '\\#[0-9A-F]+', end: hljs.IMMEDIATE_RE 70 | }, 71 | { 72 | className: 'function', 73 | begin: hljs.IDENT_RE + '\\(', end: '\\)', 74 | contains: [ 75 | { 76 | className: 'params', 77 | begin: hljs.IMMEDIATE_RE, endsWithParent: true, excludeEnd: true, 78 | contains: ['number', 'string'] 79 | } 80 | ] 81 | }, 82 | { 83 | className: 'important', 84 | begin: '!important', end: hljs.IMMEDIATE_RE 85 | }, 86 | hljs.APOS_STRING_MODE, 87 | hljs.QUOTE_STRING_MODE, 88 | hljs.BACKSLASH_ESCAPE 89 | ] 90 | }; 91 | -------------------------------------------------------------------------------- /examples/libraries/highlight/public/javascript/html-xml.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: HTML, XML 3 | */ 4 | 5 | (function(){ 6 | 7 | var XML_IDENT_RE = '[A-Za-z0-9\\._:-]+'; 8 | 9 | var PI = { 10 | className: 'pi', 11 | begin: '<\\?', end: '\\?>', 12 | relevance: 10 13 | }; 14 | var DOCTYPE = { 15 | className: 'doctype', 16 | begin: '', 17 | relevance: 10 18 | }; 19 | var COMMENT = { 20 | className: 'comment', 21 | begin: '' 22 | }; 23 | var TAG = { 24 | className: 'tag', 25 | begin: '?', end: '/?>', 26 | contains: ['title', 'tag_internal'] 27 | }; 28 | var TITLE = { 29 | className: 'title', 30 | begin: XML_IDENT_RE, end: hljs.IMMEDIATE_RE 31 | }; 32 | var TAG_INTERNAL = { 33 | className: 'tag_internal', 34 | begin: hljs.IMMEDIATE_RE, endsWithParent: true, noMarkup: true, 35 | contains: ['attribute', 'value_container'], 36 | relevance: 0 37 | }; 38 | var ATTR = { 39 | className: 'attribute', 40 | begin: XML_IDENT_RE, end: hljs.IMMEDIATE_RE, 41 | relevance: 0 42 | }; 43 | var VALUE_CONTAINER_QUOT = { 44 | className: 'value_container', 45 | begin: '="', returnBegin: true, end: '"', noMarkup: true, 46 | contains: [{ 47 | className: 'value', 48 | begin: '"', endsWithParent: true 49 | }] 50 | }; 51 | var VALUE_CONTAINER_APOS = { 52 | className: 'value_container', 53 | begin: '=\'', returnBegin: true, end: '\'', noMarkup: true, 54 | contains: [{ 55 | className: 'value', 56 | begin: '\'', endsWithParent: true 57 | }] 58 | }; 59 | 60 | hljs.LANGUAGES.xml = { 61 | defaultMode: { 62 | contains: ['pi', 'doctype', 'comment', 'cdata', 'tag'] 63 | }, 64 | case_insensitive: true, 65 | modes: [ 66 | { 67 | className: 'cdata', 68 | begin: '<\\!\\[CDATA\\[', end: '\\]\\]>', 69 | relevance: 10 70 | }, 71 | PI, 72 | DOCTYPE, 73 | COMMENT, 74 | TAG, 75 | hljs.inherit(TITLE, {relevance: 1.75}), 76 | TAG_INTERNAL, 77 | ATTR, 78 | VALUE_CONTAINER_QUOT, 79 | VALUE_CONTAINER_APOS 80 | ] 81 | }; 82 | 83 | var HTML_TAGS = { 84 | 'code': 1, 'kbd': 1, 'font': 1, 'noscript': 1, 'style': 1, 'img': 1, 85 | 'title': 1, 'menu': 1, 'tt': 1, 'tr': 1, 'param': 1, 'li': 1, 'tfoot': 1, 86 | 'th': 1, 'input': 1, 'td': 1, 'dl': 1, 'blockquote': 1, 'fieldset': 1, 87 | 'big': 1, 'dd': 1, 'abbr': 1, 'optgroup': 1, 'dt': 1, 'button': 1, 88 | 'isindex': 1, 'p': 1, 'small': 1, 'div': 1, 'dir': 1, 'em': 1, 'frame': 1, 89 | 'meta': 1, 'sub': 1, 'bdo': 1, 'label': 1, 'acronym': 1, 'sup': 1, 'body': 1, 90 | 'basefont': 1, 'base': 1, 'br': 1, 'address': 1, 'strong': 1, 'legend': 1, 91 | 'ol': 1, 'script': 1, 'caption': 1, 's': 1, 'col': 1, 'h2': 1, 'h3': 1, 92 | 'h1': 1, 'h6': 1, 'h4': 1, 'h5': 1, 'table': 1, 'select': 1, 'noframes': 1, 93 | 'span': 1, 'area': 1, 'dfn': 1, 'strike': 1, 'cite': 1, 'thead': 1, 94 | 'head': 1, 'option': 1, 'form': 1, 'hr': 1, 'var': 1, 'link': 1, 'b': 1, 95 | 'colgroup': 1, 'ul': 1, 'applet': 1, 'del': 1, 'iframe': 1, 'pre': 1, 96 | 'frameset': 1, 'ins': 1, 'tbody': 1, 'html': 1, 'samp': 1, 'map': 1, 97 | 'object': 1, 'a': 1, 'xmlns': 1, 'center': 1, 'textarea': 1, 'i': 1, 'q': 1, 98 | 'u': 1, 'section': 1, 'nav': 1, 'article': 1, 'aside': 1, 'hgroup': 1, 99 | 'header': 1, 'footer': 1, 'figure': 1, 'figurecaption': 1, 'time': 1, 100 | 'mark': 1, 'wbr': 1, 'embed': 1, 'video': 1, 'audio': 1, 'source': 1, 101 | 'canvas': 1, 'datalist': 1, 'keygen': 1, 'output': 1, 'progress': 1, 102 | 'meter': 1, 'details': 1, 'summary': 1, 'command': 1 103 | }; 104 | 105 | hljs.LANGUAGES.html = { 106 | defaultMode: { 107 | contains: ['comment', 'pi', 'doctype', 'vbscript', 'tag'] 108 | }, 109 | case_insensitive: true, 110 | modes: [ 111 | { 112 | className: 'tag', 113 | begin: '', returnEnd: true, 128 | subLanguage: 'css' 129 | }, 130 | { 131 | className: 'javascript', 132 | end: '', returnEnd: true, 133 | subLanguage: 'javascript' 134 | }, 135 | { 136 | className: 'vbscript', 137 | begin: '<%', end: '%>', 138 | subLanguage: 'vbscript' 139 | }, 140 | COMMENT, 141 | PI, 142 | DOCTYPE, 143 | hljs.inherit(TAG), 144 | hljs.inherit(TITLE, { 145 | lexems: [hljs.IDENT_RE], keywords: HTML_TAGS 146 | }), 147 | hljs.inherit(TAG_INTERNAL), 148 | ATTR, 149 | VALUE_CONTAINER_QUOT, 150 | VALUE_CONTAINER_APOS, 151 | { 152 | className: 'value_container', 153 | begin: '=', end: hljs.IMMEDIATE_RE, 154 | contains: [ 155 | { 156 | className: 'unquoted_value', displayClassName: 'value', 157 | begin: '[^\\s/>]+', end: hljs.IMMEDIATE_RE 158 | } 159 | ] 160 | } 161 | ] 162 | }; 163 | 164 | })(); 165 | -------------------------------------------------------------------------------- /examples/libraries/highlight/public/javascript/javascript.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Javascript 3 | */ 4 | 5 | hljs.LANGUAGES.javascript = { 6 | defaultMode: { 7 | lexems: [hljs.UNDERSCORE_IDENT_RE], 8 | contains: ['string', 'comment', 'number', 'regexp_container', 'function'], 9 | keywords: { 10 | 'keyword': {'in': 1, 'if': 1, 'for': 1, 'while': 1, 'finally': 1, 'var': 1, 'new': 1, 'function': 1, 'do': 1, 'return': 1, 'void': 1, 'else': 1, 'break': 1, 'catch': 1, 'instanceof': 1, 'with': 1, 'throw': 1, 'case': 1, 'default': 1, 'try': 1, 'this': 1, 'switch': 1, 'continue': 1, 'typeof': 1, 'delete': 1}, 11 | 'literal': {'true': 1, 'false': 1, 'null': 1} 12 | } 13 | }, 14 | modes: [ 15 | hljs.C_LINE_COMMENT_MODE, 16 | hljs.C_BLOCK_COMMENT_MODE, 17 | hljs.C_NUMBER_MODE, 18 | hljs.APOS_STRING_MODE, 19 | hljs.QUOTE_STRING_MODE, 20 | hljs.BACKSLASH_ESCAPE, 21 | { 22 | className: 'regexp_container', 23 | begin: '(' + hljs.RE_STARTERS_RE + '|case|return|throw)\\s*', end: hljs.IMMEDIATE_RE, noMarkup: true, 24 | lexems: [hljs.IDENT_RE], 25 | keywords: {'return': 1, 'throw': 1, 'case': 1}, 26 | contains: [ 27 | 'comment', 28 | { 29 | className: 'regexp', 30 | begin: '/.*?[^\\\\/]/[gim]*', end: hljs.IMMEDIATE_RE 31 | } 32 | ], 33 | relevance: 0 34 | }, 35 | { 36 | className: 'function', 37 | begin: '\\bfunction\\b', end: '{', 38 | lexems: [hljs.UNDERSCORE_IDENT_RE], 39 | keywords: {'function': 1}, 40 | contains: [ 41 | { 42 | className: 'title', 43 | begin: '[A-Za-z$_][0-9A-Za-z$_]*', end: hljs.IMMEDIATE_RE 44 | }, 45 | { 46 | className: 'params', 47 | begin: '\\(', end: '\\)', 48 | contains: ['string', 'comment'] 49 | } 50 | ] 51 | } 52 | ] 53 | }; 54 | -------------------------------------------------------------------------------- /examples/libraries/highlight/public/javascript/php.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: PHP 3 | Author: Victor Karamzin 4 | */ 5 | 6 | hljs.LANGUAGES.php = { 7 | defaultMode: { 8 | lexems: [hljs.IDENT_RE], 9 | contains: ['comment', 'number', 'string', 'variable', 'preprocessor'], 10 | keywords: { 11 | 'and': 1, 'include_once': 1, 'list': 1, 'abstract': 1, 'global': 1, 12 | 'private': 1, 'echo': 1, 'interface': 1, 'as': 1, 'static': 1, 13 | 'endswitch': 1, 'array': 1, 'null': 1, 'if': 1, 'endwhile': 1, 'or': 1, 14 | 'const': 1, 'for': 1, 'endforeach': 1, 'self': 1, 'var': 1, 'while': 1, 15 | 'isset': 1, 'public': 1, 'protected': 1, 'exit': 1, 'foreach': 1, 16 | 'throw': 1, 'elseif': 1, 'extends': 1, 'include': 1, '__FILE__': 1, 17 | 'empty': 1, 'require_once': 1, 'function': 1, 'do': 1, 'xor': 1, 18 | 'return': 1, 'implements': 1, 'parent': 1, 'clone': 1, 'use': 1, 19 | '__CLASS__': 1, '__LINE__': 1, 'else': 1, 'break': 1, 'print': 1, 20 | 'eval': 1, 'new': 1, 'catch': 1, '__METHOD__': 1, 'class': 1, 'case': 1, 21 | 'exception': 1, 'php_user_filter': 1, 'default': 1, 'die': 1, 22 | 'require': 1, '__FUNCTION__': 1, 'enddeclare': 1, 'final': 1, 'try': 1, 23 | 'this': 1, 'switch': 1, 'continue': 1, 'endfor': 1, 'endif': 1, 24 | 'declare': 1, 'unset': 1, 'true': 1, 'false': 1, 'namespace': 1 25 | } 26 | }, 27 | case_insensitive: true, 28 | modes: [ 29 | hljs.C_LINE_COMMENT_MODE, 30 | hljs.HASH_COMMENT_MODE, 31 | { 32 | className: 'comment', 33 | begin: '/\\*', end: '\\*/', 34 | contains: [{ 35 | className: 'phpdoc', 36 | begin: '\\s@[A-Za-z]+', end: hljs.IMMEDIATE_RE, 37 | relevance: 10 38 | }] 39 | }, 40 | hljs.C_NUMBER_MODE, 41 | { 42 | className: 'string', 43 | begin: '\'', end: '\'', 44 | contains: ['escape'], 45 | relevance: 0 46 | }, 47 | { 48 | className: 'string', 49 | begin: '"', end: '"', 50 | contains: ['escape'], 51 | relevance: 0 52 | }, 53 | hljs.BACKSLASH_ESCAPE, 54 | { 55 | className: 'variable', 56 | begin: '\\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*', end: hljs.IMMEDIATE_RE 57 | }, 58 | { 59 | className: 'preprocessor', 60 | begin: '<\\?php', end: hljs.IMMEDIATE_RE, 61 | relevance: 10 62 | }, 63 | { 64 | className: 'preprocessor', 65 | begin: '\\?>', end: hljs.IMMEDIATE_RE 66 | } 67 | ] 68 | }; 69 | -------------------------------------------------------------------------------- /examples/public/css/reset.css: -------------------------------------------------------------------------------- 1 | /* = FONT STACKS 2 | ----------------------------------------------------------------------------------------------------------------------*/ 3 | body { font-family: Geneva, 'Lucida Sans', 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif } /* "wide" sans serif */ 4 | /*body { font-family: Tahoma, Arial, Helvetica, sans-serif } /* "narrow" sans serif */ 5 | /*body { font-family: Georgia, Utopia, Palatino, 'Palatino Linotype', serif } /* "wide" serif */ 6 | /*body { font-family: 'Times New Roman', Times, serif } /* "narrow" serif */ 7 | 8 | 9 | /* transform the font size so that 1em is 10px so that you can use em's 10 | but think in pixels as now 1em is 10px, 1.2em is 12px and so on */ 11 | 12 | html { font-size: 62.5% } 13 | 14 | body { 15 | font-size: 1.3em; 16 | margin: 0; 17 | padding: 0; 18 | outline: 0; 19 | border: 0; 20 | text-align: center; /* this is for IE6 so that it will center the main wrapper */ 21 | line-height: 1.2; /* unit-less line-height does not inherit a percentage value of its parent element */ 22 | /* but instead is based on a multiplier of the font-size */ 23 | } 24 | 25 | div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, aabbr, acronym, address, 26 | big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, 27 | center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { 28 | 29 | margin: 0; 30 | padding: 0; 31 | outline: 0; 32 | border: 0; 33 | font-family: inherit; 34 | font-weight: inherit; 35 | font-style: inherit; 36 | line-height: inherit; 37 | 38 | } 39 | 40 | a, blockquote, dd, div, dl, dt, fieldset, form, h1, h2, h3, h4, h5, h6, img, input, label, li, ol, p, pre, span, table, ul { 41 | 42 | position: relative 43 | 44 | } 45 | 46 | h1, h2, h3, h4, h5, h6 { font-weight: normal; line-height: 1 } 47 | 48 | p { font-size: 100% } 49 | h1 { font-size: 220% } 50 | h2 { font-size: 200% } 51 | h3 { font-size: 180% } 52 | h4 { font-size: 160% } 53 | h5 { font-size: 140% } 54 | h6 { font-size: 120% } 55 | 56 | small, 57 | sup, 58 | sub { font-size: 70% } 59 | 60 | p small { display: block; line-height: 1 } 61 | 62 | strong, b { font-weight: bold } 63 | em, i { font-style: italic } 64 | 65 | /* = CLEARFIX 66 | ----------------------------------------------------------------------------------------------------------------------*/ 67 | .clearfix:before, 68 | .clearfix:after { content: "\0020"; display: block; height: 0; visibility: hidden; font-size: 0 } 69 | .clearfix:after { clear: both } 70 | .clearfix { *zoom: 1 } /* for IE only */ 71 | 72 | /* = TABLES 73 | ----------------------------------------------------------------------------------------------------------------------*/ 74 | table { 75 | 76 | border-collapse: collapse; 77 | border-spacing: 0; 78 | /* tables still need cellspacing="0" */ 79 | 80 | } 81 | 82 | /* = LISTS 83 | ----------------------------------------------------------------------------------------------------------------------*/ 84 | ul, ol { list-style: none } 85 | 86 | ul.float li, 87 | ol.float li { float: left } 88 | 89 | ul.default, 90 | ol.default, 91 | ol.default ul, 92 | ul.default ul, 93 | ul.default ol, 94 | ol.default ol { padding-left: 1.5em } 95 | 96 | ul.default, 97 | ol.default ul, 98 | ul.default ul { list-style-type: square } 99 | 100 | ol.default, 101 | ul.default ol, 102 | ol.default ol { list-style-type: decimal } -------------------------------------------------------------------------------- /examples/public/css/style.css: -------------------------------------------------------------------------------- 1 | body { text-align: left; margin: 20px } 2 | 3 | .header { background: #888; padding: 10px 5px; font-weight: bold } 4 | .header a { color: #FFF; text-decoration: none } 5 | .header span { font-weight: normal } 6 | .example { background: #ABCDEF; padding: 10px 5px; font-weight: bold; margin: 0 0 20px } 7 | .example a { color: #123456; font-weight: normal } 8 | 9 | h1 { margin-bottom: 1em } 10 | h1 span { display: block; font-size: 11px; color: #666 } 11 | 12 | .navigation { border-right: 1px solid #DEDEDE; padding-right: 20px; margin-right: 20px } 13 | .navigation li { font-weight: bold; margin: 0 } 14 | .navigation li ul { color: #AAA; margin: 10px 0 } 15 | .navigation a { color: #000066; white-space: nowrap; font-weight: normal; text-decoration: none; display: block; padding: 2px } 16 | .navigation a.selected { color: #DDD; background: #222 } 17 | 18 | .tabs { } 19 | .tabs a { display: block; background: #000; color: #FFF; padding: 4px 10px; text-decoration: none; margin-right: 1px; font-weight: bold } 20 | .tabs a:hover, 21 | .tabs a.selected { background: #DEDEDE; color: #222 } 22 | 23 | .tab { border: 1px solid #DEDEDE; padding: 20px; display: none } 24 | 25 | .tab h2 { font-weight: bold; margin: 0 0 20px } 26 | .tab p { color: #999; margin: 0 0 20px; font-size: 12px } 27 | 28 | ul.notes { color: #999; font-size: 11px; margin: 20px 0 0 } 29 | 30 | table.results { border-collapse: collapse } 31 | table.results th, 32 | table.results td { padding: 5px; border: 1px solid #DEDEDE } 33 | table.results th { font-weight: bold } 34 | table.results thead td { background: #666; color: #FFF; font-weight: bold } 35 | 36 | img.Zebra_Form_Input_Prefix { width: 16px; height: 16px } 37 | 38 | .tab a { color: #0000FF; text-decoration: none } 39 | 40 | /* = MISCELLANEOUS 41 | ----------------------------------------------------------------------------------------------------------------------*/ 42 | .align-center { text-align: center } 43 | .align-left { text-align: left } 44 | .align-right { text-align: right } 45 | .block { display: block } 46 | .bottom { margin-bottom: 0; padding-bottom: 0 } 47 | .center { text-align: center } 48 | .clear { clear: both } 49 | .first { margin-left: 0; padding-left: 0 } 50 | .hidden { visibility: hidden } 51 | .highlight { background: #ccf } 52 | .inline { display: inline } 53 | .last { margin-right: 0; padding-right: 0 } 54 | .left { float: left } 55 | .none { display: none } 56 | .nowrap { white-space: nowrap } 57 | .right { float: right } 58 | .stretch { width: 100% } 59 | .top { margin-top: 0; padding-top: 0 } 60 | .visible { visibility: visible } 61 | 62 | img.Zebra_Form_prefix { width: 16px; height: 16px } -------------------------------------------------------------------------------- /examples/public/images/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefangabos/Zebra_Form/8012285955ad311a0bc8ea13572b971e4aed5e74/examples/public/images/comment.png -------------------------------------------------------------------------------- /examples/public/images/letter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefangabos/Zebra_Form/8012285955ad311a0bc8ea13572b971e4aed5e74/examples/public/images/letter.png -------------------------------------------------------------------------------- /examples/public/images/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefangabos/Zebra_Form/8012285955ad311a0bc8ea13572b971e4aed5e74/examples/public/images/user.png -------------------------------------------------------------------------------- /examples/public/javascript/core.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | 3 | hljs.initHighlightingOnLoad(); 4 | 5 | $('a').bind('click', function() { this.blur() }); 6 | 7 | var tab_selectors = $('.tabs a'); 8 | 9 | var tabs = $('.tab'); 10 | 11 | tab_selectors.each(function(index, selector) { 12 | $(selector).bind('click', function(e) { 13 | e.preventDefault(); 14 | tab_selectors.removeClass('selected'); 15 | $(this).addClass('selected'); 16 | tabs.css('display', 'none'); 17 | $(tabs[index]).css({ 18 | 'opacity': 0, 19 | 'display': 'block' 20 | }); 21 | $(tabs[index]).animate({'opacity': 1}, 250); 22 | }); 23 | }); 24 | 25 | }); -------------------------------------------------------------------------------- /includes/Button.php: -------------------------------------------------------------------------------- 1 | 7 | * @copyright (c) 2006 - 2016 Stefan Gabos 8 | * @package Controls 9 | */ 10 | class Zebra_Form_Button extends Zebra_Form_Control 11 | { 12 | 13 | /** 14 | * Constructor of the class 15 | * 16 | * Adds an