function requireDefaultRecords() { parent::requireDefaultRecords(); $actualArray = ShareThisOptions::get_general_data(); Config::inst()->update("ShareThisSTE", "included_icons", array()); Config::inst()->update("ShareThisSTE", "excluded_icons", array()); ShareThisOptions::set_general_data(null); $fullArray = ShareThisOptions::get_general_data(); foreach ($fullArray as $key) { $object = ShareThisDataObject::get()->filter('Title', $key); if (!$object->exists()) { $object = new ShareThisDataObject(); $object->Title = $key; $style = 'excluded'; $object->IncludeThisIcon = false; if (in_array($key, $actualArray)) { $object->IncludeThisIcon = true; $style = 'included'; } $object->write(); DB::alteration_message("Added Bookmark Icon for {$key} ({$style})", 'created'); } } $inc = Config::inst()->get("ShareThisSTE", "included_icons"); foreach ($inc as $key) { $object = ShareThisDataObject::get()->filter(array('Title' => $key, 'IncludeThisIcon' => 0)); if ($object->exists()) { $object = $object->first(); $object->IncludeThisIcon = true; $object->write(); DB::alteration_message("Updated inclusion for {$key}", 'created'); } } $exc = Config::inst()->get("ShareThisSTE", "excluded_icons"); foreach ($exc as $key) { $object = ShareThisDataObject::get()->filter(array('Title' => $key, 'IncludeThisIcon' => 1)); if ($object->exists()) { $object = $object->first(); $object->IncludeThisIcon = false; $object->write(); DB::alteration_message("Updated inclusion for {$key}", 'created'); } } }