protected function makeBookmarks($field)
 {
     $finalBookmarks = array();
     $bookmarks = ShareThisOptions::get_page_specific_data($this->owner->Title, $this->owner->Link(), $this->owner->MetaDescription);
     $objects = ShareThisDataObject::get()->filter($field, 1)->sort(array('Sort' => 'ASC', 'Title' => 'ASC'));
     if ($objects->count()) {
         foreach ($objects as $obj) {
             if (isset($bookmarks[$obj->Title])) {
                 $finalBookmarks[$obj->Title] = $bookmarks[$obj->Title];
                 if ($obj->AlternativeIconID && $obj->AlternativeIcon()->exists()) {
                     $finalBookmarks[$obj->Title]['icon'] = $obj->AlternativeIcon()->Link();
                 }
             }
         }
     } else {
         $finalBookmarks = $bookmarks;
     }
     return $finalBookmarks;
 }
 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');
         }
     }
 }
 private static function set_variables($title, $link, $description)
 {
     self::$icon = urlencode(Director::absoluteBaseURL() . 'favicon.ico');
     self::$non_encoded_page_url = Director::absoluteURL($link);
     self::$encoded_page_url = urlencode(self::$non_encoded_page_url);
     self::$encoded_page_title = urlencode($title);
     self::$encoded_page_title_space_encoded = str_replace('+', '%20', urlencode($title));
     if ($description) {
         self::$encoded_description = urlencode($description);
     } else {
         self::$encoded_description = self::$encoded_page_title;
     }
 }