Example #1
0
 /**
  * sort function
  *
  * @param \Cx\Core\ContentManager\Model\Entity\Page $pageA
  * @param \Cx\Core\ContentManager\Model\Entity\Page $pageB
  * @return int
  */
 private function sortPages($pageA, $pageB)
 {
     $pageATermOnlyInContent = preg_match('#(' . $this->term . ')#i', $pageA->getContent()) && !preg_match('#(' . $this->term . ')#i', $pageA->getTitle()) && !preg_match('#(' . $this->term . ')#i', $pageA->getContentTitle()) && !preg_match('#(' . $this->term . ')#i', $pageA->getSlug()) && !preg_match('#(' . $this->term . ')#i', $pageA->getModule()) && !preg_match('#(' . $this->term . ')#i', $pageA->getCmd());
     $pageBTermOnlyInContent = preg_match('#(' . $this->term . ')#i', $pageB->getContent()) && !preg_match('#(' . $this->term . ')#i', $pageB->getTitle()) && !preg_match('#(' . $this->term . ')#i', $pageB->getContentTitle()) && !preg_match('#(' . $this->term . ')#i', $pageB->getSlug()) && !preg_match('#(' . $this->term . ')#i', $pageB->getModule()) && !preg_match('#(' . $this->term . ')#i', $pageB->getCmd());
     if ($pageATermOnlyInContent == $pageBTermOnlyInContent) {
         return 0;
     }
     if ($pageATermOnlyInContent && !$pageBTermOnlyInContent) {
         return 1;
     }
     return -1;
 }
 public function getSlug()
 {
     $this->_load();
     return parent::getSlug();
 }