コード例 #1
0
ファイル: keywords.php プロジェクト: notzen/exponent-cms
 public function getTextBySection($section)
 {
     global $db;
     $id = is_object($section) ? $section->id : $section;
     $refs = $db->selectObjects('sectionref', 'section=' . $id);
     ob_start();
     $mods = array();
     foreach ($refs as $ref) {
         $loc = null;
         $loc->mod = $ref->module;
         $loc->src = $ref->source;
         $loc->int = $ref->internal;
         if (!empty($loc->src)) {
             if ($ref->module == 'containermodule') {
                 foreach ($db->selectObjects('container', "external='" . serialize($loc) . "'") as $mod) {
                     $mods[] = $mod;
                     $modloc = unserialize($mod->internal);
                     expTheme::showAction($modloc->mod, 'index', $modloc->src, array('view' => $mod->view, 'title' => $mod->title));
                 }
             } else {
                 foreach ($db->selectObjects('container', "internal='" . serialize($loc) . "'") as $mod) {
                     $mods[] = $mod;
                 }
             }
         }
     }
     $text = search::removeHTML(ob_get_contents());
     ob_end_clean();
     return $text;
 }
コード例 #2
0
ファイル: class.php プロジェクト: notzen/exponent-cms
 function spiderContent($item = null)
 {
     global $db;
     $search = null;
     $search->category = gt('Events');
     $search->ref_module = 'calendarmodule';
     $search->ref_type = 'calendar';
     if ($item) {
         $db->delete('search', "ref_module='calendarmodule' AND ref_type='calendar' AND original_id=" . $item->id);
         $search->original_id = $item->id;
         $search->body = ' ' . search::removeHTML($item->body) . ' ';
         $search->title = ' ' . $item->title . ' ';
         $search->view_link = str_replace(URL_FULL, '', makeLink(array('module' => 'calendarmodule', 'action' => 'view', 'id' => $item->id)));
         $search->location_data = $item->location_data;
         $db->insertObject($search, 'search');
     } else {
         $db->delete('search', "ref_module='calendarmodule' AND ref_type='calendar'");
         foreach ($db->selectObjects('calendar') as $item) {
             $search->original_id = $item->id;
             $search->body = ' ' . search::removeHTML($item->body) . ' ';
             $search->title = ' ' . $item->title . ' ';
             $search->view_link = str_replace(URL_FULL, '', makeLink(array('module' => 'calendarmodule', 'action' => 'view', 'id' => $item->id)));
             $search->location_data = $item->location_data;
             $db->insertObject($search, 'search');
         }
     }
     return true;
 }
コード例 #3
0
ファイル: class.php プロジェクト: notzen/exponent-cms
 static function spiderContent($item = null)
 {
     global $db;
     //global $sections;
     global $router;
     $db->delete('search', "ref_module='navigationmodule' AND ref_type='section'");
     // this now ensures we get internal pages, instead of relying on the global $sections, which does not.
     $sections = $db->selectObjects('section', '1');
     foreach ($sections as $section) {
         $search = null;
         $search->category = 'Webpages';
         $search->ref_module = 'navigationmodule';
         $search->ref_type = 'section';
         $search->original_id = $section->id;
         $search->title = $section->name;
         //$search->view_link = $router->buildUrlByPageId($section->id);
         $link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));
         $search->view_link = $link;
         $search->body = $section->description;
         $search->keywords = $section->keywords;
         // now we're going to grab all the textmodules on this page and build the body for the page based off the content
         // of all the text module added together.
         $modnames = array('text', 'textController');
         foreach ($modnames as $mod) {
             $loc->mod = expModules::getControllerName($mod);
             $controllername = expModules::getControllerClassName($mod);
             foreach ($db->selectObjects('sectionref', "module='" . $controllername . "' AND section=" . $section->id) as $module) {
                 $loc->src = $module->source;
                 $loc->int = '';
                 $controller = new $controllername();
                 $textitems = $db->selectObjects($controller->model_table, "location_data='" . serialize($loc) . "'");
                 foreach ($textitems as $textitem) {
                     if (!empty($textitem)) {
                         $search->body .= ' ' . search::removeHTML($textitem->body) . ' ';
                         $search->keywords .= " " . $textitem->title;
                     }
                 }
             }
         }
         $db->insertObject($search, 'search');
     }
     return true;
 }