コード例 #1
0
ファイル: textPlugin.php プロジェクト: nibble-arts/oliv
 public static function __callStatic($method, $options)
 {
     $content = $options[0];
     $tag = $options[1];
     $type = $options[2];
     switch ($type) {
         // call text search
         case 'search':
             // merge result with status::set()
             $searchString = argv::search();
             $result = textPlugin::search();
             if ($result) {
                 // get translation of pages
                 $pages = $result->XPath("./result");
                 // insert text snippets with highlighted searchString
                 foreach ($pages as $page) {
                     $moduleName = (string) $page->type;
                     $name = (string) $page->name;
                     $value = (string) $page->value;
                     $article = OLIVModule::load_xml("", $moduleName . "/" . "content/", $name . ".xml");
                     if ($article) {
                         $texts = $article->XPath("//text");
                         foreach ($texts as $text) {
                             // highlight seachstring
                             if ($highlighted = OLIVText::highlight((string) $text, $searchString, "highlight", 25)) {
                                 $page->summary = $highlighted;
                                 // add language
                                 $page->lang = (string) $text['lang'];
                             }
                         }
                         // insert page name
                         olivxml_insert($page->pagename, OLIVRoute::getName((string) $page->page));
                     }
                 }
                 olivxml_insert($content, $result);
             }
             break;
             // call renderer
         // call renderer
         case 'render':
             textPlugin::render($content);
             break;
     }
 }