Пример #1
0
 /**
  * Handles a SMWWikiPageValue subject value.
  * Gets the plain text title and creates the HTML text with headers and the like.
  *
  * @since 1.0
  *
  * @param SMWWikiPageValue $object
  *
  * @return array with title and text
  */
 protected function handleResultSubject(SMWWikiPageValue $object)
 {
     $title = $object->getLongText($this->outputmode, null);
     $text = '';
     if ($this->showSubject) {
         if (!$this->titleLinkSeparate && $this->linkAbsolute) {
             $text = Html::element('a', array('href' => $object->getTitle()->getFullUrl()), $object->getTitle()->getText());
         } else {
             $text = $object->getLongHTMLText(smwfGetLinker());
         }
         if ($this->boldSubject) {
             $text = '<b>' . $text . '</b>';
         }
         if ($this->titleLinkSeparate) {
             $txt = $object->getTitle()->getText();
             if ($this->pageLinkText !== '') {
                 $txt = str_replace('$1', $txt, $this->pageLinkText);
             }
             $text .= Html::element('a', array('href' => $object->getTitle()->getFullUrl()), $txt);
         }
     }
     return array($title, $text);
 }
Пример #2
0
 /**
  * Delete all semantic data stored for the given subject. Used for update
  * purposes.
  */
 protected function deleteSemanticData(SMWWikiPageValue $subject)
 {
     $db = wfGetDB(DB_MASTER);
     $id = $subject->getTitle()->getArticleID();
     if ($id == 0) {
         return;
     }
     // no data can be deleted (and hopefully no data exists)
     foreach (array('smwsimple_data', 'smwsimple_special') as $tablename) {
         $db->delete($tablename, array('pageid' => $id), 'SMW::deleteSemanticData');
     }
     wfRunHooks('smwDeleteSemanticData', array($subject));
 }
Пример #3
0
	/**
	 * Resolves a redirect from a page, if any
	 *
	 * @param SMWWikiPageValue $value page to resolve
	 * @return SMWWikiPageValue resolved page
	 */
	public static function resolveRedirect( SMWWikiPageValue $value ) {
		$entity = smwfGetStore()->getSemanticData( $value->getTitle() );
		return $entity->getSubject();
	}