Plugin Directory

Changeset 1780015


Ignore:
Timestamp:
12/02/2017 09:44:01 PM (8 years ago)
Author:
elgreatly
Message:

if add field does not exist don't return error

Location:
magic-meta-box/trunk/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • magic-meta-box/trunk/includes/fields.php

    r1779994 r1780015  
    11<?php
    2 include( 'fields/'. $type .'.php' );
     2$fieldsArray = array('text', 'password', 'textarea', 'url', 'email', 'date', 'DateTime', 'time', 'num', 'checkbox', 'multicheckbox', 'radio', 'select', 'multiselect', 'color', 'image', 'gallery', 'file', 'embed', 'slider', 'map', 'wp_editor', 'editor');
     3
     4if (in_array($type, $fieldsArray)) {
     5    include( 'fields/'. $type .'.php' );
     6}
    37$fieldattrs = $field;
    48$fieldattrs['id'] = $id;
  • magic-meta-box/trunk/includes/repeater-fields.php

    r1779994 r1780015  
    11<?php
     2$fieldsArray = array('text', 'password', 'textarea', 'url', 'email', 'date', 'DateTime', 'time', 'num', 'checkbox', 'multicheckbox', 'radio', 'select', 'multiselect', 'color', 'image', 'gallery', 'file', 'embed', 'slider', 'editor');
    23$count_repeat = 0;
    34$data = (self::gsmb_get($id) == null)? get_post_meta($post->ID,$id,true) : array();
     
    2021        }
    2122        $value_field = isset($data[$count_repeat][$opt['id']])? $data[$count_repeat][$opt['id']] : $opt['std'];
    22        
    23         include( 'repeated-fields/'. $opt['type'] .'.php' );
     23        if (in_array($opt['type'], $fieldsArray)) {
     24          include( 'repeated-fields/'. $opt['type'] .'.php' );
     25        }
    2426       
    2527        $fieldopt = $opt;
Note: See TracChangeset for help on using the changeset viewer.