wp-customize-utils.php 370 B

123456789101112131415
  1. <?php
  2. function set_settings_array( $target, $array, $value ) {
  3. $key = array_shift( $array );
  4. $current =& $target;
  5. while ( 0 < sizeof( $array ) ) {
  6. if ( ! property_exists( $current, $key ) ) {
  7. $current->{ $key } = (object) array();
  8. }
  9. $current =& $current->{ $key };
  10. $key = array_shift( $array );
  11. }
  12. $current->{ $key } = $value;
  13. return $target;
  14. }