예제 #1
0
 /**
  * Merge existing Plugin Options with default Plugin Options,
  * remove (no longer) existing options, e.g. after a plugin update.
  *
  * @since 1.0.0
  */
 public function merge_plugin_options_defaults()
 {
     $plugin_options = $this->plugin_options->get();
     // Remove old (i.e. no longer existing) Plugin Options.
     $plugin_options = array_intersect_key($plugin_options, $this->default_plugin_options);
     // Merge current into new Plugin Options.
     $plugin_options = array_merge($this->default_plugin_options, $plugin_options);
     $this->plugin_options->update($plugin_options);
 }
예제 #2
0
 /**
  * Get an unused table ID (e.g. for a new table).
  *
  * @since 1.0.0
  *
  * @return string Unused table ID (e.g. for a new table).
  */
 protected function _get_new_table_id()
 {
     $tables = $this->tables->get();
     // Need to check new ID candidate in a loop, because a higher ID might already be in use, if a table ID was changed manually.
     do {
         $tables['last_id']++;
     } while ($this->table_exists($tables['last_id']));
     $this->tables->update($tables);
     return (string) $tables['last_id'];
 }