$of_options, 'options_machine'=>$options_machine, 'smof_data'=>$smof_data )); $options_machine = new Options_Machine($of_options); if (empty($smof_data) || !isset($smof_data['smof_init'])) { // Let's set the values if the theme's already been active of_save_options($options_machine->Defaults); of_save_options(date('r'), 'smof_init'); $smof_data = of_get_options(); $data = $smof_data; } do_action('of_option_setup_after', array( 'of_options'=>$of_options, 'options_machine'=>$options_machine, 'smof_data'=>$smof_data )); } /** * Change activation message * * @since 1.0.0 */ function optionsframework_admin_message() { //Tweaked the message on theme activate ?> $key, 'data'=>$data )); if ($key != null) { // Get one specific value $data = get_theme_mod($key, $data); } else { // Get all values $data = get_theme_mods(); } $data = apply_filters('of_options_after_load', $data); do_action('of_option_setup_before', array( 'key'=>$key, 'data'=>$data )); return $data; } /** * Save options to the database after processing them * * @param $data Options array to save * @author Jonah Dahlquist * @since 1.4.0 * @uses update_option() * @return void */ function of_save_options($data, $key = null) { global $smof_data; if (empty($data)) return; do_action('of_save_options_before', array( 'key'=>$key, 'data'=>$data )); $data = apply_filters('of_options_before_save', $data); if ($key != null) { // Update one specific value if ($key == BACKUPS) { unset($data['smof_init']); // Don't want to change this. } set_theme_mod($key, $data); } else { // Update all values in $data foreach ( $data as $k=>$v ) { if (!isset($smof_data[$k]) || $smof_data[$k] != $v) { // Only write to the DB when we need to set_theme_mod($k, $v); } } } do_action('of_save_options_after', array( 'key'=>$key, 'data'=>$data )); } /** * For use in themes * * @since forever */ $smof_data = of_get_options(); $data = $smof_data;