Last active
August 29, 2015 14:23
-
-
Save ramiy/0b9c9405e7711be0ac0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Current | |
public function get_values() { | |
foreach ( $this->tabs as $tab => $settings ) { | |
foreach ( $settings['fields'] as $fields ) { | |
foreach ( (array)$fields as $f ) { | |
if ( isset( $f['name'] ) ) | |
$this->parameters[$f['name']] = $this->get_value($f); | |
elseif($f['type'] == 'selects' && isset($f['selects'])) { | |
foreach ($f['selects'] as $select) { | |
$this->parameters[$select['name']] = $this->get_value($select); | |
} | |
}elseif($f['type'] == 'checkboxes' && isset($f['options'])) { | |
foreach ((array)$f['options'] as $key => $value) { | |
$this->parameters[$key] = $this->get_value(array('name' => $key)); | |
} | |
}elseif($f['type'] == 'texts' && isset($f['texts'])) { //texts field type | |
foreach ((array)$f['texts'] as $key => $f) { | |
$this->parameters[$f['name']] = $this->get_value($f); | |
} | |
} | |
} | |
} | |
} | |
} | |
// New | |
public function get_values() { | |
foreach ( $this->tabs as $tab => $settings ) { | |
foreach ( $settings['fields'] as $fields ) { | |
foreach ( (array)$fields as $f ) { | |
if ( isset( $settings['multiple'] ) ) // Changing the inner $f['name'] with parent $settings['multiple'] | |
$this->parameters[$f['name']] = $this->get_value($f); | |
elseif($f['type'] == 'selects' && isset($f['selects'])) { | |
foreach ($f['selects'] as $select) { | |
$this->parameters[$select['name']] = $this->get_value($select); | |
} | |
}elseif($f['type'] == 'checkboxes' && isset($f['options'])) { | |
foreach ((array)$f['options'] as $key => $value) { | |
$this->parameters[$key] = $this->get_value(array('name' => $key)); | |
} | |
}elseif($f['type'] == 'texts' && isset($f['texts'])) { //texts field type | |
foreach ((array)$f['texts'] as $key => $f) { | |
$this->parameters[$f['name']] = $this->get_value($f); | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment