Пример #1
0
 /**
  * Returns if the given component requests https
  *
  * Return value is cached.
  */
 public static function doesComponentRequestHttps(Kwf_Component_Data $data)
 {
     $showInvisible = Kwf_Component_Data_Root::getShowInvisible();
     $foundRequestHttps = false;
     if (!$showInvisible) {
         //don't cache in preview
         $cacheId = 'reqHttps-' . $data->componentId;
         $foundRequestHttps = Kwf_Cache_Simple::fetch($cacheId);
     }
     if ($foundRequestHttps === false) {
         $foundRequestHttps = 0;
         //don't use false, false means not-cached
         if (Kwf_Component_Abstract::getFlag($data->componentClass, 'requestHttps')) {
             $foundRequestHttps = true;
         }
         if (!$foundRequestHttps && $data->getRecursiveChildComponents(array('page' => false, 'flags' => array('requestHttps' => true)))) {
             $foundRequestHttps = true;
         }
         if (!$showInvisible) {
             //don't cache in preview
             Kwf_Cache_Simple::add($cacheId, $foundRequestHttps);
         }
     }
     return $foundRequestHttps;
 }
Пример #2
0
 public function getFulltextComponents(Kwf_Component_Data $component)
 {
     $fulltextComponents = $component->getRecursiveChildComponents(array('flag' => 'hasFulltext', 'inherit' => false, 'page' => false));
     if (Kwc_Abstract::getFlag($component->componentClass, 'hasFulltext')) {
         $fulltextComponents[] = $component;
     }
     foreach ($fulltextComponents as $c) {
         if (!method_exists($c->getComponent(), 'getFulltextComponents')) {
             continue;
         }
         //components can return other components that should be included in fulltext content
         foreach ($c->getComponent()->getFulltextComponents() as $c) {
             $fulltextComponents = array_merge($fulltextComponents, $this->getFulltextComponents($component));
         }
     }
     return $fulltextComponents;
 }
Пример #3
0
 public function getFulltextComponents(Kwf_Component_Data $component)
 {
     if (isset($component->generator->unique) && $component->generator->unique && isset($component->generator->inherit) && $component->generator->inherit) {
         return array();
     }
     $ret = array();
     if (Kwc_Abstract::getFlag($component->componentClass, 'hasFulltext')) {
         $ret[] = $component;
     }
     $components = $component->getRecursiveChildComponents(array('flag' => 'hasFulltext', 'page' => false));
     foreach ($components as $cmp) {
         $checkCmp = $cmp;
         $needsToBeIndexed = true;
         while ($checkCmp->inherits == false) {
             if (isset($checkCmp->generator)) {
                 $generator = $checkCmp->generator;
                 if (isset($generator->inherit) && $generator->inherit && isset($generator->unique) && $generator->unique) {
                     $needsToBeIndexed = false;
                     break;
                 }
             }
             if (Kwc_Abstract::getFlag($checkCmp->componentClass, 'skipFulltextRecursive')) {
                 $needsToBeIndexed = false;
                 break;
             }
             $checkCmp = $checkCmp->parent;
         }
         if ($needsToBeIndexed) {
             $ret[] = $cmp;
         }
     }
     foreach ($ret as $c) {
         if (!method_exists($c->getComponent(), 'getFulltextComponents')) {
             continue;
         }
         //components can return other components that should be included in fulltext content
         foreach ($c->getComponent()->getFulltextComponents() as $c) {
             $ret = array_merge($ret, $this->getFulltextComponents($c));
         }
     }
     return $ret;
 }
 public function updateFromPage(Kwf_Component_Data $page)
 {
     $this->deleted = !$page->isVisible();
     $this->page_id = $page->componentId;
     $this->expanded_component_id = $page->getExpandedComponentId();
     $domainCmp = $page->getDomainComponent();
     $this->domain_component_id = $domainCmp ? $domainCmp->componentId : null;
     $this->subroot_component_id = $page->getSubroot()->componentId;
     $this->url = $page->getAbsoluteUrl();
     if (!$this->url) {
         $this->url = '';
     }
     $this->sitemap_priority = '0.5';
     $this->sitemap_changefreq = 'weekly';
     $noindex = false;
     foreach ($page->getRecursiveChildComponents(array('flag' => 'hasPageMeta')) as $c) {
         $pageMeta = $c->getComponent()->getPageMeta();
         $this->sitemap_priority = $pageMeta['sitemap_priority'];
         $this->sitemap_changefreq = $pageMeta['sitemap_changefreq'];
         $noindex = $pageMeta['noindex'];
     }
     $this->meta_noindex = $noindex || $this->_getMetaNoIndex($page);
     $this->fulltext_skip = $this->_getFulltextSkip($page);
 }