vendor/webbamboo/spinners-common/src/Entity/Article.php line 14
<?phpnamespace Webbamboo\SpinnersCommon\Entity;use Doctrine\ORM\Mapping as ORM;/*** Article** @ORM\Table("Article")* @ORM\Entity*/#[ORM\Entity(repositoryClass: ArticleRepository::class)]class Article{public const STATUS_DRAFT = 'draft';public const STATUS_PUBLISHED = 'published';/*** @var integer** @ORM\Column(name="id", type="integer")* @ORM\Id* @ORM\GeneratedValue(strategy="AUTO")*/private $id;/*** @var string** @ORM\Column(name="title", type="string", length=255)*/private $title;/*** @var string** @ORM\Column(name="metatitle", type="string", length=255)*/private $metatitle;/*** @var string** @ORM\Column(name="metadescription", type="string", length=255)*/private $metadescription;/*** @var string** @ORM\Column(name="permalink", type="string", length=255)*/private $permalink;/*** @var string** @ORM\Column(name="content", type="text")*/private $content;/*** @var string** @ORM\Column(name="interestingarticle1", type="string", length=255, nullable=true)*/private $interestingtitle1;/*** @var string** @ORM\Column(name="interestingarticle2", type="string", length=255, nullable=true)*/private $interestingtitle2;/*** @var string** @ORM\Column(name="interestingarticle3", type="string", length=255, nullable=true)*/private $interestingtitle3;/*** @var string** @ORM\Column(name="interestingarticle4", type="string", length=255, nullable=true)*/private $interestingtitle4;/*** @var string** @ORM\Column(name="interestingarticle5", type="string", length=255, nullable=true)*/private $interestingtitle5;/*** @var \DateTime** @ORM\Column(name="published", type="datetime")*/private $published;/*** @var string** @ORM\Column(name="status", type="string", length=255, nullable=true)*/private $status = self::STATUS_PUBLISHED;/*** Get id** @return integer*/public function getId(){return $this->id;}/*** Set title** @param string $title* @return Article*/public function setTitle($title){$this->title = $title;return $this;}/*** Get title** @return string*/public function getTitle(){return $this->title;}/*** Set metatitle** @param string $metatitle* @return Article*/public function setMetatitle($metatitle){$this->metatitle = $metatitle;return $this;}/*** Get metatitle** @return string*/public function getMetatitle(){return $this->metatitle;}/*** Set metadescription** @param string $metadescription* @return Article*/public function setMetadescription($metadescription){$this->metadescription = $metadescription;return $this;}/*** Get metadescription** @return string*/public function getMetadescription(){return $this->metadescription;}/*** Set permalink** @param string $permalink* @return Article*/public function setPermalink($permalink){$this->permalink = $permalink;return $this;}/*** Get permalink** @return string*/public function getPermalink(){return $this->permalink;}public function getPermalinkP(){$url=array("%C3%85","%C3%A5","%C3%84","%C3%A4","%C3%96","%C3%B6",);$char=array("Å","å","Ä","ä","Ö","ö",);return str_replace($url, $char, $this->permalink);}/*** Set content** @param string $content* @return Article*/public function setContent($content){$this->content = $content;return $this;}/*** Get content** @return string*/public function getContent($stripped=false){if (!$stripped) {return $this->content;} else {return str_replace(array('[part]', '[/part]'), '', $this->content);}}private function first_n_words($text, $number_of_words){$text = strip_tags($text);$text = preg_replace("/^\W*((\w[\w'-]*\b\W*){1,$number_of_words}).*/ms", '\\1', $text);return str_replace("\n", "", $text);}// excerpt plus link if shortenedpublic function getExcerpt2($number_of_words=50){$text=str_replace(array('[part]', '[/part]'), '', $this->content);$text = strip_tags(html_entity_decode($text));$excerpt = $this->first_n_words($text, $number_of_words);return htmlentities($excerpt).'... <a href="[ReadMoreURL]">[ReadMoreText]</a></p>';}public function getRandomexcerpt(){$delimiter = '#';$startTag = '[part]';$endTag = '[/part]';$regex = $delimiter . preg_quote($startTag, $delimiter). '(.*?)'. preg_quote($endTag, $delimiter). $delimiter. 's';preg_match_all($regex, $this->content, $matches);//var_dump($matches[1]);shuffle($matches[1]);$text = $matches[1][0];$text = strip_tags(html_entity_decode($text));$excerpt = $this->first_n_words($text, 50);return htmlentities($excerpt).'... <a href="[ReadMoreURL]">[ReadMoreText]</a></p>';}/*** Set published** @param \DateTime $published* @return Article*/public function setPublished($published){$this->published = $published;return $this;}/*** Get published** @return \DateTime*/public function getPublished(){return $this->published;}/*** Set interestingtitle1** @param string $interestingtitle1* @return Article*/public function setInterestingtitle1($interestingtitle1){$this->interestingtitle1 = $interestingtitle1;return $this;}/*** Get interestingtitle1** @return string*/public function getInterestingtitle1(){return $this->interestingtitle1;}/*** Set interestingtitle2** @param string $interestingtitle2* @return Article*/public function setInterestingtitle2($interestingtitle2){$this->interestingtitle2 = $interestingtitle2;return $this;}/*** Get interestingtitle2** @return string*/public function getInterestingtitle2(){return $this->interestingtitle2;}/*** Set interestingtitle3** @param string $interestingtitle3* @return Article*/public function setInterestingtitle3($interestingtitle3){$this->interestingtitle3 = $interestingtitle3;return $this;}/*** Get interestingtitle3** @return string*/public function getInterestingtitle3(){return $this->interestingtitle3;}/*** Set interestingtitle4** @param string $interestingtitle4* @return Article*/public function setInterestingtitle4($interestingtitle4){$this->interestingtitle4 = $interestingtitle4;return $this;}/*** Get interestingtitle4** @return string*/public function getInterestingtitle4(){return $this->interestingtitle4;}/*** Set interestingtitle5** @param string $interestingtitle5* @return Article*/public function setInterestingtitle5($interestingtitle5){$this->interestingtitle5 = $interestingtitle5;return $this;}/*** Get interestingtitle5** @return string*/public function getInterestingtitle5(){return $this->interestingtitle5;}/*** Set status** @param string $status* @return Article*/public function setStatus($status){$this->status = $status;return $this;}/*** Get status** @return string*/public function getStatus(){return $this->status;}}