Ejemplo n.º 1
0
 /**
  * Hook to allow further theme option defaults to be defined via other framework locations or a Plugin.
  *
  * @since 0.1.0
  */
 public function add_theme_option_defaults()
 {
     global $wpgo_default_options, $wpgo_default_off_checkboxes;
     /* Add theme specific default settings via this hook. */
     WPGo_Hooks::wpgo_theme_option_defaults();
     $options = get_option(WPGO_OPTIONS_DB_NAME);
     /* Added this here rather inside the same 'if' statement above so we can add extra $wpgo_default_off_checkboxes via a hook. */
     if (is_array($options)) {
         /* Manually set the checkboxes that have been unchecked, by the user, to zero. */
         $options = array_merge($wpgo_default_off_checkboxes, $options);
     }
     /* If there are no existing options just use defaults (no merge). */
     if (!$options || empty($options)) {
         // Update options in db
         update_option(WPGO_OPTIONS_DB_NAME, $wpgo_default_options);
     } else {
         /* Merge current options with the defaults, i.e. add any new options but don't overwrite existing ones. */
         $result = array_merge($wpgo_default_options, $options);
         /* Update options in db. */
         update_option(WPGO_OPTIONS_DB_NAME, $result);
     }
 }