Example #1
0
 /**
  * Informacje o prawie autorskim dotyczącym treści całego kanału lub jego wpisów.
  *
  * @param string $set
  *
  * @return string
  */
 public function rights($set = null)
 {
     if (is_string($set)) {
         $this->filterText($this->rights, $set);
         if (!$this->rights->isEmpty()) {
             $this->rights->insertTo($this->root);
         } else {
             $this->rights->detach();
         }
     }
     return $this->rights->text();
 }
Example #2
0
 /**
  * Ilustracja kanału
  *
  * @param array $set
  *
  * @return array
  */
 public function image(array $set = null)
 {
     if (is_array($set)) {
         $options = $this->imageResolver->resolve($set);
         $this->filterLink($this->imageUrl, $options['url']);
         $this->filterText($this->imageTitle, $options['title']);
         $this->filterLink($this->imageLink, $options['link']);
         if (!empty($options['description'])) {
             $this->filterText($this->imageDescription, $options['description']);
             $this->imageDescription->insertTo($this->image);
         } else {
             $this->imageDescription->detach();
         }
         if (!empty($options['width'])) {
             $this->imageWidth->text((string) intval($options['width']))->insertTo($this->image);
         } else {
             $this->imageWidth->detach();
         }
         if (!empty($options['height'])) {
             $this->imageHeight->text((string) intval($options['height']))->insertTo($this->image);
         } else {
             $this->imageHeight->detach();
         }
     }
     return array('url' => $this->imageUrl->text(), 'title' => $this->imageTitle->text(), 'link' => $this->imageLink->text(), 'description' => $this->imageDescription->text(), 'width' => $this->imageWidth->text(), 'height' => $this->imageHeight->text());
 }
Example #3
0
 /**
  * Insert specific element into header only if it's not empty.
  *
  * @param HtmlElement $el
  * @param string $set
  * @param \Closure $update
  */
 private function insertToHead(HtmlElement $el, $set, \Closure $update)
 {
     if (is_string($set)) {
         if (!empty($set)) {
             $el->insertTo($this->head);
         } else {
             $el->detach();
         }
         $update($el);
     }
 }