public function publish(Destination $destination = NULL)
 {
     if (isset($destination)) {
         $destination_std = new \stdClass();
         $destination_std->id = $destination->getId();
         $destination_std->type = $destination->getType();
     }
     if ($this->getProperty()->shouldBePublished) {
         $service = $this->getService();
         if (isset($destination)) {
             $service->publish($service->createId($this->getType(), $this->getId()), $destination_std);
         } else {
             $service->publish($service->createId($this->getType(), $this->getId()));
         }
     }
     return $this;
 }
 public function createTwitterConnector(ConnectorContainer $parent, $name, Destination $d, $ht_value, $px_value, ContentType $ct, $page_config)
 {
     if (self::DEBUG) {
         u\DebugUtility::out("Hash tag: {$ht_value} Prefix: {$px_value}");
     }
     if (trim($name) == "") {
         throw new e\CreationErrorException(S_SPAN . c\M::EMPTY_CONNECTOR_NAME . E_SPAN);
     }
     if (trim($ht_value) == "") {
         throw new e\CreationErrorException(S_SPAN . c\M::EMPTY_PAGE_NAME . E_SPAN);
     }
     if (trim($px_value) == "") {
         throw new e\CreationErrorException(S_SPAN . c\M::EMPTY_PREFIX . E_SPAN);
     }
     if (trim($page_config) == "") {
         throw new e\CreationErrorException(S_SPAN . c\M::EMPTY_CONFIGURATION_NAME . E_SPAN);
     }
     $asset = AssetTemplate::getTwitterConnector();
     $asset->twitterConnector->name = $name;
     $asset->twitterConnector->parentContainerPath = $parent->getPath();
     $asset->twitterConnector->siteName = $parent->getSiteName();
     $asset->twitterConnector->destinationId = $d->getId();
     $ht_name = new \stdClass();
     $ht_name->name = "Hash Tag";
     $ht_name->value = $pg_value;
     $prefix = new \stdClass();
     $prefix->name = "Prefix";
     $prefix->value = $px_value;
     $asset->twitterConnector->connectorParameters->connectorParameter = array();
     $asset->twitterConnector->connectorParameters->connectorParameter[] = $ht_name;
     $asset->twitterConnector->connectorParameters->connectorParameter[] = $prefix;
     $asset->twitterConnector->connectorContentTypeLinks->connectorContentTypeLink->contentTypeId = $ct->getId();
     $asset->twitterConnector->connectorContentTypeLinks->connectorContentTypeLink->pageConfigurationName = $page_config;
     if (self::DEBUG && self::DUMP) {
         u\DebugUtility::dump($asset);
     }
     return $this->createAsset($asset, TwitterConnector::TYPE, $this->getPath($parent, $name), $parent->getSiteName());
 }
 public function setDestination(Destination $d)
 {
     if ($this->getPropertyName() != c\P::TWITTERCONNECTOR && $this->getPropertyName() != c\P::FACEBOOKCONNECTOR) {
         throw new \Exception(S_SPAN . "The setDestination method cannot be called by a " . $this->getPropertyName() . " object." . E_SPAN);
     }
     $this->getProperty()->destinationId = $d->getId();
     $this->getProperty()->destinationPath = $d->getName();
     return $this;
 }
Пример #4
0
 public function publishSubscribers(Destination $destination = NULL)
 {
     $subscriber_ids = $this->getSubscribers();
     if (isset($destination)) {
         $destination_std = new \stdClass();
         $destination_std->id = $destination->getId();
         $destination_std->type = $destination->getType();
     }
     if (isset($subscriber_ids)) {
         foreach ($subscriber_ids as $subscriber_id) {
             if (self::DEBUG) {
                 u\DebugUtility::out("Publishing " . $subscriber_id->getId());
             }
             $this->getService()->publish($subscriber_id->toStdClass(), $destination_std);
         }
     }
     return $this;
 }
 public function publish(Destination $destination = NULL)
 {
     if (isset($destination)) {
         $destination_std = new \stdClass();
         $destination_std->id = $destination->getId();
         $destination_std->type = $destination->getType();
     }
     $service = $this->getService();
     if (isset($destination)) {
         $service->publish($service->createId(self::TYPE, $this->getProperty()->id), $destination_std);
     } else {
         $service->publish($service->createId(self::TYPE, $this->getProperty()->id));
     }
     return $this;
 }