Exemplo n.º 1
0
 /**
  * This array builds the complete array with the right key => value pairs
  *
  * @param array $data
  * @return array
  *
  * @author Gijs Jorissen
  * @since 1.1
  *
  */
 function _build_arrays($data)
 {
     $return = array();
     if (!is_array($data[0]) && ($data[0] == 'tabs' || $data[0] == 'accordion')) {
         $return[0] = $data[0];
         foreach ($data[1] as $tab) {
             $title = $tab[0];
             $return[$title] = array();
             foreach ($tab[1] as $field) {
                 $field = Cuztom_Field::_build_array($field);
                 $field_id_name = Cuztom_Field::_build_id_name($field, $this->box_title);
                 $return[$title][$field_id_name] = $field;
             }
         }
     } else {
         if (is_array($data)) {
             foreach ($data as $field) {
                 $field = Cuztom_Field::_build_array($field);
                 $field_id_name = Cuztom_Field::_build_id_name($field, $this->box_title);
                 $return[$field_id_name] = $field;
             }
         }
     }
     return $return;
 }
 /**
  * This array builds the complete array with the right key => value pairs
  *
  * @param array $data
  * @return array
  *
  * @author Gijs Jorissen
  * @since 1.1
  *
  */
 function _build_arrays($data)
 {
     $return = array();
     if (is_array($data)) {
         if (!is_array($data[0]) && ($data[0] == 'tabs' || $data[0] == 'accordion')) {
             $return[0] = $data[0];
             foreach ($data[1] as $title => $fields) {
                 $return[$title] = array();
                 foreach ($fields as $field) {
                     $field = Cuztom_Field::_build_array($field);
                     $field_id_name = Cuztom_Field::_build_id_name($field, $this->box_title);
                     $this->meta_fields[$field_id_name] = $field;
                     $return[$title][$field_id_name] = $field;
                 }
             }
         } elseif (!is_array($data[0]) && $data[0] == 'bundle') {
             $return[0] = $data[0];
             $return[$this->box_id] = array();
             foreach ($data[1] as $field) {
                 $field = Cuztom_Field::_build_array($field);
                 $field['repeatable'] = false;
                 $field_id_name = Cuztom_Field::_build_id_name($field, $this->box_title);
                 $this->meta_fields[$field_id_name] = $field;
                 $return[$this->box_id][$field_id_name] = $field;
             }
         } else {
             foreach ($data as $field) {
                 $field = Cuztom_Field::_build_array($field);
                 $field_id_name = Cuztom_Field::_build_id_name($field, $this->box_title);
                 $this->meta_fields[$field_id_name] = $field;
                 $return[$field_id_name] = $field;
             }
         }
     }
     return $return;
 }