public function execute(Batch $batch)
 {
     $links = $batch->getObjectCollection('social_link');
     if (!$links) {
         return;
     }
     foreach ($links->getLinks() as $link) {
         if (!$link->getPublisherValidator()->skipItem()) {
             $l = new Link();
             $l->setServiceHandle($link->getService());
             $l->setURL($link->getURL());
             $l->save();
         }
     }
 }
Example #2
0
 public function getImportData($blockNode, $page)
 {
     $args = array();
     foreach ($blockNode->link as $link) {
         $link = Link::getByServiceHandle((string) $link['service']);
         $args['slID'][] = $link->getID();
     }
     return $args;
 }
 public function import(\SimpleXMLElement $sx)
 {
     if (isset($sx->sociallinks)) {
         foreach ($sx->sociallinks->link as $l) {
             $site = \Core::make('site')->getSite();
             $sociallink = Link::getByServiceHandle((string) $l['service']);
             if (!is_object($sociallink)) {
                 $sociallink = new \Concrete\Core\Entity\Sharing\SocialNetwork\Link();
                 $sociallink->setURL((string) $l['url']);
                 $sociallink->setSite($site);
                 $sociallink->setServiceHandle((string) $l['service']);
                 $sociallink->save();
             }
         }
     }
 }
 public function publish(Batch $batch, BlockType $bt, Page $page, Area $area, BlockValue $value)
 {
     $data = array();
     $data['slID'] = array();
     $records = $value->getRecords();
     foreach ($records as $record) {
         $value = $record->getData();
         $value = $value['service'];
         // because it comes out as an array
         $socialLink = Link::getByServiceHandle($value);
         if (is_object($socialLink)) {
             $data['slID'][] = $socialLink->getID();
         }
     }
     $b = $page->addBlock($bt, $area->getName(), $data);
     return $b;
 }
 public function run()
 {
     $this->x = new SimpleXMLElement("<concrete5-cif></concrete5-cif>");
     $this->x->addAttribute('version', '1.0');
     // First, attribute categories
     AttributeKeyCategory::exportList($this->x);
     // Features
     Feature::exportList($this->x);
     FeatureCategory::exportList($this->x);
     ConversationEditor::exportList($this->x);
     ConversationRatingType::exportList($this->x);
     // composer
     PageTypePublishTargetType::exportList($this->x);
     PageTypeComposerControlType::exportList($this->x);
     PageType::exportList($this->x);
     // attribute types
     AttributeType::exportList($this->x);
     // then block types
     BlockTypeList::exportList($this->x);
     // now block type sets (including user)
     BlockTypeSet::exportList($this->x);
     // gathering
     GatheringDataSource::exportList($this->x);
     GatheringItemTemplate::exportList($this->x);
     // now attribute keys (including user)
     AttributeKey::exportList($this->x);
     // now attribute keys (including user)
     AttributeSet::exportList($this->x);
     PageTemplate::exportList($this->x);
     // now theme
     PageTheme::exportList($this->x);
     // now packages
     PackageList::export($this->x);
     // permission access entity types
     PermissionAccessEntityType::exportList($this->x);
     // now task permissions
     PermissionKey::exportList($this->x);
     // workflow types
     WorkflowType::exportList($this->x);
     // now jobs
     Job::exportList($this->x);
     // now single pages
     $singlepages = $this->x->addChild("singlepages");
     $db = Loader::db();
     $r = $db->Execute('select cID from Pages where cFilename is not null and cFilename <> "" and cID not in (select cID from Stacks) order by cID asc');
     while ($row = $r->FetchRow()) {
         $pc = Page::getByID($row['cID'], 'RECENT');
         $pc->export($singlepages);
     }
     // now stacks/global areas
     StackList::export($this->x);
     // now content pages
     $pages = $this->x->addChild("pages");
     $db = Loader::db();
     $r = $db->Execute('select Pages.cID from Pages where cIsTemplate = 0 and cFilename is null or cFilename = "" order by cID asc');
     while ($row = $r->FetchRow()) {
         $pc = Page::getByID($row['cID'], 'RECENT');
         if ($pc->getPageTypeHandle() == STACKS_PAGE_TYPE) {
             continue;
         }
         $pc->export($pages);
     }
     SystemCaptchaLibrary::exportList($this->x);
     \Concrete\Core\Sharing\SocialNetwork\Link::exportList($this->x);
     \Concrete\Core\Page\Feed::exportList($this->x);
     \Concrete\Core\File\Image\Thumbnail\Type\Type::exportList($this->x);
     Config::exportList($this->x);
     Tree::exportList($this->x);
 }
Example #6
0
 protected function importSocialLinks(\SimpleXMLElement $sx)
 {
     if (isset($sx->sociallinks)) {
         foreach ($sx->sociallinks->link as $l) {
             $sociallink = Link::getByServiceHandle((string) $l['service']);
             if (!is_object($sociallink)) {
                 $sociallink = new Link();
                 $sociallink->setURL((string) $l['url']);
                 $sociallink->setServiceHandle((string) $l['service']);
                 $sociallink->save();
             }
         }
     }
 }
Example #7
0
 public function edit($slID = null)
 {
     if (Core::make("helper/validation/numbers")->integer($slID)) {
         if ($slID > 0) {
             $link = Link::getByID($slID);
         }
     }
     if (!is_object($link)) {
         $this->redirect('/dashboard/system/basics/social');
     }
     $this->socialLink = $link;
     $this->set('link', $link);
     $this->add();
 }
 /**
  * {@inheritDoc}
  */
 public function delete()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'delete', array());
     return parent::delete();
 }
 public function skipItem()
 {
     $link = Link::getByServiceHandle($this->object->getService());
     return is_object($link);
 }