Plugin Directory

Changeset 1507416


Ignore:
Timestamp:
10/03/2016 11:23:39 AM (10 years ago)
Author:
spindogs
Message:

release v1.2.3

Location:
wp-platform/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-platform/trunk/classes/Filter.php

    r1505732 r1507416  
    112112        return $str;
    113113
     114    }
     115
     116    /**
     117     * @param mixed $bool
     118     * @return string
     119     */
     120    public static function yesno($bool)
     121    {
     122        if ($bool) {
     123            return 'Yes';
     124        } else {
     125            return 'No';
     126        }
    114127    }
    115128
  • wp-platform/trunk/classes/Form.php

    r1505671 r1507416  
    7676            'options' => array(),
    7777            'initial' => '',
    78             'required' => NULL,
     78            'required' => null,
    7979            'attrs' => array()
    8080        );
     
    153153        $initial = $params['initial'];
    154154        $label = $params['label'];
     155        $type = $params['type'];
    155156
    156157        if (!$this->submitted()) {
     
    162163        }
    163164
    164         if (!$value) {
    165             $value = ''; //convert all types of false to string
    166         }
    167 
    168165        $this->addField($name, $params);
    169166        $this->setValue($name, $value);
     
    173170        if ($this->submitted()) {
    174171
    175             if ($required && !$value) {
     172            if ($required && $value == '') {
    176173                $this->error($label.' not provided', $name);
    177174            }
     
    239236     * @return void
    240237    */
    241     public function text($name, $label, $initial='', $required=NULL, $attrs=array())
     238    public function text($name, $label, $initial='', $required=null, $attrs=array())
    242239    {
    243240        $params = get_defined_vars();
     
    254251     * @return void
    255252    */
    256     public function textarea($name, $label, $initial='', $required=NULL, $attrs=array())
     253    public function textarea($name, $label, $initial='', $required=null, $attrs=array())
    257254    {
    258255
     
    290287     * @return void
    291288    */
    292     public function select($name, $label, $options, $initial=false, $required=NULL, $attrs=array())
     289    public function select($name, $label, $options, $initial=false, $required=null, $attrs=array())
    293290    {
    294291        $params = get_defined_vars();
     
    393390     * @return void
    394391    */
    395     public function multiselect($name, $label, $options, $initial=false, $required=NULL, $attrs=array())
     392    public function multiselect($name, $label, $options, $initial=false, $required=null, $attrs=array())
    396393    {
    397394        $attrs['is_multi'] = true;
     
    408405     * @return void
    409406    */
    410     public function radiobuttons($name, $label, $options, $initial=false, $required=NULL, $attrs=array())
     407    public function radiobuttons($name, $label, $options, $initial=false, $required=null, $attrs=array())
    411408    {
    412409        $params = get_defined_vars();
     
    422419        foreach ($options as $key => $text) {
    423420
    424             if ($key == $value && $value !== false && $value !== '' && $value !== NULL) {
     421            if ($key == $value && $value !== false && $value !== '' && $value !== null) {
    425422                $checked = ' checked="checked"';
    426423            } else {
     
    454451     * @return void
    455452    */
    456     public function checkboxes($name, $label, $options, $initial=array(), $required=NULL, $attrs=array())
     453    public function checkboxes($name, $label, $options, $initial=array(), $required=null, $attrs=array())
    457454    {
    458455
     
    540537     * @return void
    541538    */
    542     public function dateSelect($name, $label, $initial=false, $required=NULL, $attrs=array())
     539    public function dateSelect($name, $label, $initial=false, $required=null, $attrs=array())
    543540    {
    544541
     
    681678     * @return void
    682679    */
    683     public function datePicker($name, $label, $initial=false, $required=NULL, $attrs=array())
     680    public function datePicker($name, $label, $initial=false, $required=null, $attrs=array())
    684681    {
    685682
     
    823820     * @return void
    824821    */
    825     public function timeSelect($name, $label, $initial=false, $required=NULL, $attrs=array())
     822    public function timeSelect($name, $label, $initial=false, $required=null, $attrs=array())
    826823    {
    827824
     
    962959     * @return void
    963960    */
    964     public function yesno($name, $label, $initial=false, $required=NULL, $attrs=array())
    965     {
    966         $initial = intval($initial);
     961    public function yesno($name, $label, $initial=null, $required=null, $attrs=array())
     962    {
     963        if ($initial !== null) {
     964            $initial = intval($initial);
     965        }
     966
    967967        $options = array(
    968968            1 => 'Yes',
     
    981981     * @return void
    982982    */
    983     public function dob($name, $label, $initial=false, $required=NULL, $attrs=array())
     983    public function dob($name, $label, $initial=false, $required=null, $attrs=array())
    984984    {
    985985
     
    999999     * @return void
    10001000    */
    1001     public function dobPicker($name, $label, $initial=false, $required=NULL, $attrs=array())
     1001    public function dobPicker($name, $label, $initial=false, $required=null, $attrs=array())
    10021002    {
    10031003        $attrs['min'] = mktime(0, 0, 0, 1, 1, 1920);
     
    10161016     * @return void
    10171017    */
    1018     public function gender($name, $label, $initial=false, $required=NULL, $attrs=array())
     1018    public function gender($name, $label, $initial=false, $required=null, $attrs=array())
    10191019    {
    10201020        $options = array(
     
    10381038     * @return void
    10391039    */
    1040     public function salutation($name, $label, $initial=false, $required=NULL, $attrs=array())
     1040    public function salutation($name, $label, $initial=false, $required=null, $attrs=array())
    10411041    {
    10421042
     
    10601060     * @return void
    10611061    */
    1062     public function email($name, $label, $initial=false, $required=NULL, $attrs=array())
     1062    public function email($name, $label, $initial=false, $required=null, $attrs=array())
    10631063    {
    10641064
     
    10901090     * @return void
    10911091    */
    1092     public function emailConfirm($name, $label, $label_2, $initial=false, $required=NULL, $attrs=array())
     1092    public function emailConfirm($name, $label, $label_2, $initial=false, $required=null, $attrs=array())
    10931093    {
    10941094
     
    11191119     * @return void
    11201120    */
    1121     public function url($name, $label, $initial=false, $required=NULL, $attrs=array())
     1121    public function url($name, $label, $initial=false, $required=null, $attrs=array())
    11221122    {
    11231123
     
    11571157     * @return void
    11581158    */
    1159     public function number($name, $label, $initial='', $required=NULL, $attrs=array())
     1159    public function number($name, $label, $initial='', $required=null, $attrs=array())
    11601160    {
    11611161
     
    11961196     * @return void
    11971197    */
    1198     public function phone($name, $label, $initial='', $required=NULL, $attrs=array())
     1198    public function phone($name, $label, $initial='', $required=null, $attrs=array())
    11991199    {
    12001200
     
    12251225     * @return void
    12261226    */
    1227     public function settings($group_name, $group_label, $settings, $initial=array(), $required=NULL, $attrs=array())
     1227    public function settings($group_name, $group_label, $settings, $initial=array(), $required=null, $attrs=array())
    12281228    {
    12291229
     
    18061806        if (!$field) {
    18071807            return;
    1808         } elseif ($field['required'] === NULL) {
     1808        } elseif ($field['required'] === null) {
    18091809            return $this->require_all;
    18101810        } else {
  • wp-platform/trunk/plugin.php

    r1505732 r1507416  
    22/**
    33 * Plugin Name: WP-Platform
    4  * Version: 1.2.2
     4 * Version: 1.2.3
    55 * Description: Provides platform to allow developers to build bespoke functionality in an MVC and OOP fashion
    66 */
Note: See TracChangeset for help on using the changeset viewer.