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; }
protected function validatePageRequest($token) { if (!$this->token->validate($token)) { $this->error->add($this->token->getErrorMessage()); } $ssHandle = $this->request->request->get('ssHandle'); $existingLink = false; if ($ssHandle) { $service = Service::getByHandle($ssHandle); $existingLink = Link::getByServiceHandle($ssHandle); } $sec = Core::make('helper/security'); $url = $sec->sanitizeURL($this->request->request->get('url')); if (!$url) { $this->error->add(t('You must specify a valid URL.')); } if (!is_object($service)) { $this->error->add(t('You must choose a service.')); } return array($ssHandle, $url, $existingLink); }
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(); } } } }
public function skipItem() { $link = Link::getByServiceHandle($this->object->getService()); return is_object($link); }