Giter Site home page Giter Site logo

macder / wfv-validation Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 952 KB

Input validation API for WordPress

Home Page: https://macder.github.io/wfv/

License: BSD 3-Clause "New" or "Revised" License

PHP 93.25% Shell 6.75%
wordpress validation form-validation input-validation form-helper php wordpress-plugin wordpress-api wordpress-php-library

wfv-validation's People

Contributors

macder avatar

Watchers

 avatar  avatar

wfv-validation's Issues

Create a helper method to render the required hidden fields

albeit this goes against my philosophy of 'do not return rendered markup,' it will make templates cleaner.

idea is to have an option to avoid doing:

<input type="hidden" name="action" value="<?php echo $contact_form->get('action'); ?>">
<?php echo $contact_form->get('nonce_field'); ?>

and instead:

<?php echo $contact_form->action_token(); ?>

New unit tests for FormComposite

Certain parts of FormComposite have been refactored. Good opportunity to create new tests instead of trying to adapt the old ones

Create new validator class that receives a single validation strategy (ValidateInterface) for each field rule

Currently the FormComposite holds an array of validation strategies (ValidateInterface) and loops through them during validation. This is somewhat confusing, making it unclear that a strategy pattern is being used. It also add's too much responsibility to the FormComposite.

The new Validator class will be added to the FormComposite as a class member, and the FormComposite will feed it a single strategy at a time.

The only validation responsibility the FormComposite should have is providing correct strategies to the Validator

Switch validation library from Valitron to Respect\Validation

Valitron uses a God class, so only way to add new rules is either with callback or extending the Valitron class. Both approaches would get messy fast, therefore this library needs to be replaced.

Respect\Validation is more flexible. Can create a validator class for each rule and then use a strategy pattern to validate input.

This opens the door to creating an unlimited amount of built in rules by just adding new validator classes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.