diff --git a/README.md b/README.md index 796918c3..b71fe95c 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,8 @@ [![Build Status](http://img.shields.io/travis/Anahkiasen/former.svg?style=flat)](https://travis-ci.org/Anahkiasen/former) [![Latest Stable Version](http://img.shields.io/packagist/v/anahkiasen/former.svg?style=flat)](https://packagist.org/packages/anahkiasen/former) [![Total Downloads](http://img.shields.io/packagist/dt/anahkiasen/former.svg?style=flat)](https://packagist.org/packages/anahkiasen/former) -[![Scrutinizer Quality Score](http://img.shields.io/scrutinizer/g/Anahkiasen/former.svg?style=flat)](https://scrutinizer-ci.com/g/Anahkiasen/former/) -[![Code Coverage](http://img.shields.io/scrutinizer/coverage/g/Anahkiasen/former.svg?style=flat)](https://scrutinizer-ci.com/g/Anahkiasen/former/) -[![Dependency Status](https://www.versioneye.com/user/projects/54363f5eb2a9c51d400000d0/badge.svg?style=flat)](https://www.versioneye.com/user/projects/54363f5eb2a9c51d400000d0) -[![Support via Gittip](http://img.shields.io/gittip/Anahkiasen.svg?style=flat)](https://www.gittip.com/Anahkiasen/) -### For Laravel 5, use the [4.0 branch](https://github.com/Anahkiasen/former/tree/4.0) +### For Laravel 5, use the [4.0 branch](https://github.com/formers/former/tree/4.0) Former is the name of a little project I'd like to present you — it's a PHP package that allows you to do all kinds of powerful stuff with forms while remaining pretty simple to use. It's also a really nice guy too once you get to know him. @@ -43,12 +39,10 @@ Former::close(); ``` Every time you call a method that doesn't actually exist, Former assumes you're trying to set an attribute and creates it magically. That's why you can do in the above example `->rows(10)` ; in case you want to set attributes that contain dashes, just replace them by underscores : `->data_foo('bar')` equals `data-foo="bar"`. -Now of course in case you want to set an attribute that actually contains an underscore (jeez aren't you the little smartass) you can always use the fallback method `setAttribute('data_foo', 'bar')`. You're welcome. +Now of course in case you want to set an attribute that actually contains an underscore you can always use the fallback method `setAttribute('data_foo', 'bar')`. You're welcome. This is the core of it, but Former offers a lot more. I invite you to consult the wiki to see the extend of what Former does. -Former is developed by [Maxime Fabre][] and [Peter Coles][]. - ----- ### Table of contents @@ -57,8 +51,6 @@ Former is developed by [Maxime Fabre][] and [Peter Coles][]. - [Features][] - [Anatomy][] - [Peter Coles]: http://petercoles.com - [Maxime Fabre]: http://autopergamene.eu - [Anatomy]: https://github.com/Anahkiasen/former/wiki/Anatomy - [Features]: https://github.com/Anahkiasen/former/wiki/Features - [Getting started]: https://github.com/Anahkiasen/former/wiki/Getting-started + [Anatomy]: https://github.com/formers/former/wiki/Anatomy + [Features]: https://github.com/formers/former/wiki/Features + [Getting started]: https://github.com/formers/former/wiki/Getting-started diff --git a/composer.json b/composer.json index a561de8a..0274739e 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "illuminate/translation": "~4.2" }, "require-dev": { - "phpunit/phpunit": "~4.1.6", + "phpunit/phpunit": "~4", "mockery/mockery": "~0.9.1", "illuminate/database": "~4.2" }, diff --git a/src/Former/Traits/Checkable.php b/src/Former/Traits/Checkable.php index 9d1d11b1..98b8a8a6 100644 --- a/src/Former/Traits/Checkable.php +++ b/src/Former/Traits/Checkable.php @@ -368,6 +368,10 @@ protected function createCheckable($item, $fallbackValue = 1) if ($this->isOfType('checkbox', 'checkboxes')) { if ($this->isPushed or ($this->app['former']->getOption('push_checkboxes') and $this->isPushed !== false)) { $field = $this->app['former']->hidden($name)->forceValue($this->app['former']->getOption('unchecked_value')).$field->render(); + + // app['former.field'] was overwritten by Former::hidden() call in the line above, so here + // we reset it to $this to enable $this->app['former']->getErrors() to retrieve the correct object + $this->app->instance('former.field', $this); } } diff --git a/src/Laravel/File.php b/src/Laravel/File.php index dce59d3f..6a4769f8 100644 --- a/src/Laravel/File.php +++ b/src/Laravel/File.php @@ -56,6 +56,9 @@ class File 'mpg' => 'video/mpeg', 'mpga' => 'audio/mpeg', 'oda' => 'application/oda', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'odt' => 'application/vnd.oasis.opendocument.text', 'pdf' => array('application/pdf', 'application/x-download'), 'php' => array('application/x-httpd-php', 'text/x-php'), 'php3' => 'application/x-httpd-php', @@ -63,7 +66,10 @@ class File 'phps' => 'application/x-httpd-php-source', 'phtml' => 'application/x-httpd-php', 'png' => 'image/png', - 'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint'), + 'pps' => array('application/mspowerpoint', 'application/vnd.ms-powerpoint'), + 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'ppt' => array('application/vnd.ms-powerpoint', 'application/powerpoint'), + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'ps' => 'application/postscript', 'psd' => 'application/x-photoshop', 'qt' => 'video/quicktime', @@ -71,7 +77,7 @@ class File 'ram' => 'audio/x-pn-realaudio', 'rm' => 'audio/x-pn-realaudio', 'rpm' => 'audio/x-pn-realaudio-plugin', - 'rtf' => 'text/rtf', + 'rtf' => array('application/rtf', 'text/rtf'), 'rtx' => 'text/richtext', 'rv' => 'video/vnd.rn-realvideo', 'sea' => 'application/octet-stream', diff --git a/tests/Fields/CheckboxTest.php b/tests/Fields/CheckboxTest.php index 27e28d41..81eee5e1 100644 --- a/tests/Fields/CheckboxTest.php +++ b/tests/Fields/CheckboxTest.php @@ -59,7 +59,7 @@ private function matchCheckbox( $radio = 'attributes($checkAttr).'>'; if (!$inline && $this->former->framework() === 'TwitterBootstrap3') { - unset($labelAttr['class']); + $labelAttr['class'] = ""; } $control = $label ? 'attributes($labelAttr).'>'.$radio.$label.'' : $radio; diff --git a/tests/Fields/PlainTextTest.php b/tests/Fields/PlainTextTest.php index 2943008c..18b3a4c8 100644 --- a/tests/Fields/PlainTextTest.php +++ b/tests/Fields/PlainTextTest.php @@ -85,7 +85,7 @@ public function matchPlainTextInput() */ protected function formStaticGroup( $input = '
bar
', - $label = '' + $label = '' ) { return $this->formGroup($input, $label); } diff --git a/tests/Fields/RadioTest.php b/tests/Fields/RadioTest.php index 8b058764..6412d786 100644 --- a/tests/Fields/RadioTest.php +++ b/tests/Fields/RadioTest.php @@ -58,7 +58,7 @@ private function matchRadio( $radio = 'attributes($radioAttr).'>'; if (!$inline && $this->former->framework() === 'TwitterBootstrap3') { - unset($labelAttr['class']); + $labelAttr['class'] = ""; } $control = $label ? 'attributes($labelAttr).'>'.$radio.$label.'' : $radio; diff --git a/tests/TestCases/FormerTests.php b/tests/TestCases/FormerTests.php index 1e69131b..b939be5b 100644 --- a/tests/TestCases/FormerTests.php +++ b/tests/TestCases/FormerTests.php @@ -316,7 +316,8 @@ protected function controlGroupRequired($input, $label = '