Plugin Directory

Changeset 1671330


Ignore:
Timestamp:
06/05/2017 11:03:00 PM (9 years ago)
Author:
Engr.MTH
Message:

Committing version 1.0.2

Location:
backend-custom-fields/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • backend-custom-fields/trunk/backend-custom-fields.php

    r1195126 r1671330  
    77  Plugin URI: http://mostasharoon.org
    88  Description: An easy way to display the custom fields at the backend.
    9   Version: 1.0
     9  Version: 1.0.2
    1010  Author: Mohammed Thaer
    1111  Author URI: http://mostasharoon.org
     
    1313 */
    1414
    15 define( 'BCF_VERSION', '1.0' );
     15define( 'BCF_VERSION', '1.0.2' );
    1616
    1717/* ----------------------------------------------------------------------------------- */
  • backend-custom-fields/trunk/classes/BCF_Fields.php

    r1195126 r1671330  
    112112        return $html;
    113113    }
     114
     115    static function select2( array $args ) {
     116
     117        $default_args = array(
     118            'name'     => '',
     119            'class'    => '',
     120            'multiple' => false,
     121            'options'  => array(),
     122            'selected' => array(),
     123            'id'       => ''
     124        );
     125
     126        $args     = array_merge( $default_args, $args );
     127        $multiple = $args['multiple'] ? 'multiple' : '';
     128
     129        $html = '<select ' . $multiple . ' name="' . $args['name'] . '" id="' . $args['id'] . '" class="' . $args['class'] . '">';
     130
     131        if ( ! empty( $args['options'] ) ) {
     132            foreach ( $args['options'] as $id => $option ) {
     133                $selected = in_array( $id, $args['selected'] ) ? 'selected' : '';
     134                $html .= '<option ' . $selected . ' value="' . $id . '">' . $option . '</option>';
     135            }
     136        }
     137
     138        $html .= '</select>';
     139
     140
     141        return $html;
     142    }
    114143}
  • backend-custom-fields/trunk/classes/BCF_Post.php

    r1195126 r1671330  
    5454                if ( method_exists( $this, $field['template'] ) ) {
    5555                    $html .= '<tr>';
    56                     $html .= $this->$field['template']( $field, $id, 'post' );
     56
     57                    //Incompatible with PHP7
     58//                  $html .= $this->$field['template']( $field, $id, 'post' );
     59                    $html .= call_user_func_array( array( $this, $field['template'] ), array( $field, $id, 'post' ) );
     60
    5761                    $html .= '</tr>';
    5862                }
  • backend-custom-fields/trunk/classes/BCF_User.php

    r1195126 r1671330  
    9797                $html .= '<th>' . BCF_Fields::label( esc_html__( 'Profile Form' ), 'bcf_pb_form' ) . '</th>';
    9898                $html .= '<td>';
    99                 $html .= BCF_Fields::select( $args );
     99                $html .= BCF_Fields::select2( $args );
    100100                $html .= BCF_Fields::p( esc_html__( 'Backend Custom Fields For Forms Management System couldn\'t know the form that this user use when he/she get register, please select the form then update the profile.', 'bcf' ), 'description' );
    101101                $html .= '</td>';
     
    112112                if ( method_exists( $this, $field['template'] ) ) {
    113113                    $html .= '<tr>';
    114                     $html .= $this->$field['template']( $field, $id, 'user' );
     114
     115                    //Incompatible with PHP7
     116//                  $html .= $this->$field['template']( $field, $id, 'user' );
     117                    $html .= call_user_func_array( array( $this, $field['template'] ), array($field, $id, 'user' ) );
     118
    115119                    $html .= '</tr>';
    116120                }
     
    154158                if ( method_exists( $this, $field['template'] ) ) {
    155159                    $html .= '<tr>';
    156                     $html .= $this->$field['template']( $field, $id, 'user' );
     160
     161                    //Incompatible with PHP7
     162//                  $html .= $this->$field['template']( $field, $id, 'user' );
     163                    $html .= call_user_func_array( array( $this, $field['template'] ), array($field, $id, 'user' ) );
     164
    157165                    $html .= '</tr>';
    158166                }
  • backend-custom-fields/trunk/readme.txt

    r1195126 r1671330  
    44Tags: forms management system, visual builder, custom fields, custom post type, form, forms, mostasharoon, views, admin, advanced, custom, custom field, edit, field, file, image, more fields, Post, repeater, simple fields, text, textarea, type
    55Requires at least: 3.5
    6 Tested up to: 4.2.2
    7 Stable tag: 1.0
     6Tested up to: 4.7.5
     7Stable tag: 1.0.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4040== Changelog ==
    4141
     42= 1.0.2 =
     43* Fix can't attach a form to a user that don't have one.
     44
     45= 1.0.1 =
     46* Fix issue with PHP7.
     47
    4248= 1.0 =
    4349* initial release
Note: See TracChangeset for help on using the changeset viewer.