-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
3,104 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
plugins/.registry/.channel.pear.symfony-project.com/symfony.reg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
a:18:{s:4:"name";s:7:"symfony";s:7:"attribs";a:5:{s:7:"version";s:3:"2.0";s:5:"xmlns";s:35:"http://pear.php.net/dtd/package-2.0";s:11:"xmlns:tasks";s:33:"http://pear.php.net/dtd/tasks-1.0";s:9:"xmlns:xsi";s:41:"http://www.w3.org/2001/XMLSchema-instance";s:18:"xsi:schemaLocation";s:159:"http://pear.php.net/dtd/tasks-1.0 | ||
http://pear.php.net/dtd/tasks-1.0.xsd | ||
http://pear.php.net/dtd/package-2.0 | ||
http://pear.php.net/dtd/package-2.0.xsd";}s:7:"channel";s:24:"pear.symfony-project.com";s:7:"summary";s:7:"symfony";s:11:"description";s:7:"symfony";s:4:"lead";a:4:{s:4:"name";s:16:"Fabien Potencier";s:4:"user";s:6:"fabpot";s:5:"email";s:36:"[email protected]";s:6:"active";s:3:"yes";}s:4:"date";s:10:"2010-06-30";s:7:"version";a:2:{s:7:"release";s:5:"1.4.5";s:3:"api";s:5:"1.4.0";}s:9:"stability";a:2:{s:7:"release";s:6:"stable";s:3:"api";s:6:"stable";}s:7:"license";s:11:"MIT License";s:5:"notes";s:1:"-";s:8:"contents";a:1:{s:3:"dir";a:1:{s:7:"attribs";a:1:{s:4:"name";s:1:"/";}}}s:12:"dependencies";a:1:{s:8:"required";a:2:{s:3:"php";a:1:{s:3:"min";s:5:"5.2.4";}s:13:"pearinstaller";a:1:{s:3:"min";s:5:"1.4.3";}}}s:10:"phprelease";a:0:{}s:8:"filelist";a:0:{}s:3:"old";a:7:{s:7:"version";s:5:"1.4.5";s:12:"release_date";s:10:"2010-06-30";s:13:"release_state";s:6:"stable";s:15:"release_license";s:11:"MIT License";s:13:"release_notes";s:1:"-";s:12:"release_deps";a:2:{i:0;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"5.2.4";s:8:"optional";s:2:"no";}i:1;a:6:{s:4:"type";s:3:"pkg";s:7:"channel";s:12:"pear.php.net";s:4:"name";s:4:"PEAR";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.4.3";s:8:"optional";s:2:"no";}}s:11:"maintainers";a:1:{i:0;a:5:{s:4:"name";s:16:"Fabien Potencier";s:5:"email";s:36:"[email protected]";s:6:"active";s:3:"yes";s:6:"handle";s:6:"fabpot";s:4:"role";s:4:"lead";}}}s:10:"xsdversion";s:3:"2.0";s:13:"_lastmodified";i:1277912614;} | ||
http://pear.php.net/dtd/package-2.0.xsd";}s:7:"channel";s:24:"pear.symfony-project.com";s:7:"summary";s:7:"symfony";s:11:"description";s:7:"symfony";s:4:"lead";a:4:{s:4:"name";s:16:"Fabien Potencier";s:4:"user";s:6:"fabpot";s:5:"email";s:36:"[email protected]";s:6:"active";s:3:"yes";}s:4:"date";s:10:"2010-07-01";s:7:"version";a:2:{s:7:"release";s:5:"1.4.5";s:3:"api";s:5:"1.4.0";}s:9:"stability";a:2:{s:7:"release";s:6:"stable";s:3:"api";s:6:"stable";}s:7:"license";s:11:"MIT License";s:5:"notes";s:1:"-";s:8:"contents";a:1:{s:3:"dir";a:1:{s:7:"attribs";a:1:{s:4:"name";s:1:"/";}}}s:12:"dependencies";a:1:{s:8:"required";a:2:{s:3:"php";a:1:{s:3:"min";s:5:"5.2.4";}s:13:"pearinstaller";a:1:{s:3:"min";s:5:"1.4.3";}}}s:10:"phprelease";a:0:{}s:8:"filelist";a:0:{}s:3:"old";a:7:{s:7:"version";s:5:"1.4.5";s:12:"release_date";s:10:"2010-07-01";s:13:"release_state";s:6:"stable";s:15:"release_license";s:11:"MIT License";s:13:"release_notes";s:1:"-";s:12:"release_deps";a:2:{i:0;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"5.2.4";s:8:"optional";s:2:"no";}i:1;a:6:{s:4:"type";s:3:"pkg";s:7:"channel";s:12:"pear.php.net";s:4:"name";s:4:"PEAR";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.4.3";s:8:"optional";s:2:"no";}}s:11:"maintainers";a:1:{i:0;a:5:{s:4:"name";s:16:"Fabien Potencier";s:5:"email";s:36:"[email protected]";s:6:"active";s:3:"yes";s:6:"handle";s:6:"fabpot";s:4:"role";s:4:"lead";}}}s:10:"xsdversion";s:3:"2.0";s:13:"_lastmodified";i:1277991439;} |
3 changes: 3 additions & 0 deletions
3
plugins/.registry/.channel.plugins.symfony-project.org/sfformextraplugin.reg
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2008 Fabien Potencier | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is furnished | ||
to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
sfFormExtraPlugin | ||
================= | ||
|
||
The `sfFormExtraPlugin` packages useful validators, widgets, and forms. | ||
|
||
This collection holds validators, widgets, and forms which we don't want to | ||
include with the main symfony package because they are too specific or have | ||
external dependencies. | ||
|
||
As no third party libraries is bundled in the plugin, you need to install and | ||
load the required dependencies like JQuery, JQuery UI, or TinyMCE by yourself. | ||
|
||
Installation | ||
------------ | ||
|
||
* Install the plugin | ||
|
||
$ symfony plugin:install sfFormExtraPlugin | ||
|
||
* Clear the cache | ||
|
||
$ symfony cache:clear | ||
|
||
Documentation | ||
------------- | ||
|
||
All classes have full API and usage documentation. The best way to learn each widget or validator | ||
is to read the API. | ||
|
||
You will also find some articles on the symfony blog about this plugin: | ||
|
||
* [Play with the user language](http://www.symfony-project.org/blog/2008/10/16/play-with-the-user-language) | ||
* [Make your Choice!](http://www.symfony-project.org/blog/2008/10/14/new-in-symfony-1-2-make-your-choice) | ||
* [Spice up your forms with some nice widgets and validators](http://www.symfony-project.org/blog/2008/10/18/spice-up-your-forms-with-some-nice-widgets-and-validators) | ||
|
||
Forms | ||
----- | ||
|
||
* sfFormLanguage: A form to change the symfony user culture | ||
|
||
Validators | ||
---------- | ||
|
||
* sfValidatorDoctrineNestedSetLevel: Checks wether or not the max level of a nested set object (nestedSet behavior) is achieved | ||
* sfValidatorReCaptcha: Validates a ReCaptcha (see sfWidgetFormReCaptcha) | ||
* sfValidatorBlacklist: Validates that a value is not one of the configured forbidden ones | ||
* sfValidatorSchemaTimeInterval: Validates a time interval between two dates provided by a widget schema | ||
|
||
Widgets | ||
------- | ||
|
||
* sfWidgetFormReCaptcha: Displays a ReCaptcha widget (see sfValidatorReCaptcha) | ||
* sfWidgetFormSelectDoubleList: Displays a double list widget | ||
* sfWidgetFormJQueryDate: Displays a date using JQuery UI | ||
* sfWidgetFormJQueryAutocompleter: Displays an input tag with autocomplete support using JQuery | ||
* sfWidgetFormPropelChoiceGrouped: Displays a grouped set of choices tied to a Propel model | ||
* sfWidgetFormPropelJQueryAutocompleter: Displays an autocomplete widget tied to a Propel model | ||
* sfWidgetFormTextareaTinyMCE: A rich textarea rendered with TinyMCE | ||
* sfWidgetFormSelectUSState: A select menu of US states | ||
|
||
As no third party libraries is bundled in the plugin, you need to install and load the required | ||
dependencies like JQuery, JQuery UI, or TinyMCE by yourself. | ||
|
||
How to contribute. | ||
------------------ | ||
|
||
If you want to contribute a validator, a widget, or a form, follow these steps: | ||
|
||
* Check the prerequisites | ||
* The license must be MIT | ||
* You must have a unit test suite (100% coverage) | ||
* You must have PHPdoc for all classes and methods with a documentation usage | ||
* You must follow symfony coding standards | ||
* The contribution must not be too specific | ||
* You must be sure you will be able to maintain your contribution | ||
* Create a ticket and attach a patch | ||
* Choose `sfFormExtraPlugin` as the component | ||
* Change the qualification to `Ready for core team` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the symfony package. | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
require_once dirname(__FILE__).'/../test/bootstrap.php'; | ||
|
||
$h = new lime_harness(new lime_output_color()); | ||
$h->base_dir = realpath(dirname(__FILE__).'/../test'); | ||
$h->register(sfFinder::type('file')->name('*Test.php')->in($h->base_dir)); | ||
$h->run(); |
109 changes: 109 additions & 0 deletions
109
plugins/sfFormExtraPlugin/lib/form/sfFormLanguage.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the symfony package. | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/** | ||
* sfFormLanguage is a form to change the symfony user culture. | ||
* | ||
* Usage: | ||
* | ||
* class mainActions extends sfActions | ||
* { | ||
* public function executeChangeLanguage($request) | ||
* { | ||
* $this->form = new sfFormLanguage($this->getUser(), array('languages' => array('en', 'fr'))); | ||
* if ($this->form->process($request)) | ||
* { | ||
* // culture has changed | ||
* return $this->redirect('@homepage'); | ||
* } | ||
* | ||
* // the form is not valid (can't happen... but you never know) | ||
* return $this->redirect('@homepage'); | ||
* } | ||
* } | ||
* | ||
* @package symfony | ||
* @subpackage form | ||
* @author Fabien Potencier <[email protected]> | ||
* @version SVN: $Id: sfFormLanguage.class.php 24547 2009-11-30 09:57:41Z fabien $ | ||
*/ | ||
class sfFormLanguage extends sfForm | ||
{ | ||
protected | ||
$user = null; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param sfUser A sfUser instance | ||
* @param array An array of options | ||
* @param string A CSRF secret (false to disable CSRF protection, null to use the global CSRF secret) | ||
* | ||
* @see sfForm | ||
*/ | ||
public function __construct(sfUser $user, $options = array(), $CSRFSecret = null) | ||
{ | ||
$this->user = $user; | ||
|
||
if (!isset($options['languages'])) | ||
{ | ||
throw new RuntimeException(sprintf('%s requires a "languages" option.', get_class($this))); | ||
} | ||
|
||
parent::__construct(array('language' => $user->getCulture()), $options, $CSRFSecret); | ||
} | ||
|
||
/** | ||
* Changes the current user culture. | ||
*/ | ||
public function save() | ||
{ | ||
$this->user->setCulture($this->getValue('language')); | ||
} | ||
|
||
/** | ||
* Processes the current request. | ||
* | ||
* @param sfRequest A sfRequest instance | ||
* | ||
* @return Boolean true if the form is valid, false otherwise | ||
*/ | ||
public function process(sfRequest $request) | ||
{ | ||
$data = array('language' => $request->getParameter('language')); | ||
if ($request->hasParameter(self::$CSRFFieldName)) | ||
{ | ||
$data[self::$CSRFFieldName] = $request->getParameter(self::$CSRFFieldName); | ||
} | ||
|
||
$this->bind($data); | ||
|
||
if ($isValid = $this->isValid()) | ||
{ | ||
$this->save(); | ||
} | ||
|
||
return $isValid; | ||
} | ||
|
||
/** | ||
* @see sfForm | ||
*/ | ||
public function configure() | ||
{ | ||
$this->setValidators(array( | ||
'language' => new sfValidatorI18nChoiceLanguage(array('culture' => $this->user->getCulture(), 'languages' => $this->options['languages'])), | ||
)); | ||
|
||
$this->setWidgets(array( | ||
'language' => new sfWidgetFormI18nChoiceLanguage(array('culture' => $this->user->getCulture(), 'languages' => $this->options['languages'])), | ||
)); | ||
} | ||
} |
Oops, something went wrong.