SemanticMediaWiki/includes/SMW_GlobalFunctions.php File Reference

Global functions and constants for Semantic MediaWiki. More...

Go to the source code of this file.

Enumerations

enum  SMW_FACTBOX_HIDDEN
enum  SMW_FACTBOX_SPECIAL
enum  SMW_FACTBOX_NONEMPTY
enum  SMW_FACTBOX_SHOWN
enum  SMW_EQ_NONE
enum  SMW_EQ_SOME
enum  SMW_EQ_FULL
enum  SMW_PROPERTY_QUERY
enum  SMW_CATEGORY_QUERY
enum  SMW_CONCEPT_QUERY
enum  SMW_NAMESPACE_QUERY
enum  SMW_CONJUNCTION_QUERY
enum  SMW_DISJUNCTION_QUERY
enum  SMW_ANY_QUERY
enum  CONCEPT_CACHE_ALL
enum  CONCEPT_CACHE_HARD
enum  CONCEPT_CACHE_NONE
enum  SMW_HEADER_TOOLTIP
enum  SMW_HEADER_SORTTABLE
enum  SMW_HEADER_STYLE
enum  SMW_OUTPUT_HTML
enum  SMW_OUTPUT_WIKI
enum  SMW_OUTPUT_FILE
enum  SMW_CMP_EQ
enum  SMW_CMP_LEQ
enum  SMW_CMP_GEQ
enum  SMW_CMP_NEQ
enum  SMW_CMP_LIKE
enum  SMW_CMP_NLKE
enum  SMW_CMP_LESS
enum  SMW_CMP_GRTR
enum  SMW_MDY
enum  SMW_DMY
enum  SMW_YMD
enum  SMW_YDM
enum  SMW_MY
enum  SMW_YM
enum  SMW_Y
enum  SMW_YEAR
enum  SMW_DAY
enum  SMW_MONTH
enum  SMW_DAY_MONTH_YEAR
enum  SMW_DAY_YEAR

Functions

 smwfIsSemanticsProcessed ($namespace)
 Return true if semantic data should be processed and displayed for a page in the given namespace.
 smwfNormalTitleDBKey ($text)
 Takes a title text and turns it safely into its DBKey.
 smwfNormalTitleText ($text)
 Takes a text and turns it into a normalised version.
 smwfXMLContentEncode ($text)
 Escapes text in a way that allows it to be used as XML content (e.g.
 smwfHTMLtoUTF8 ($text)
 Decodes character references and inserts Unicode characters instead, using the MediaWiki Sanitizer.
 smwfNumberFormat ($value, $decplaces=3)
 This method formats a float number value according to the given language and precision settings, with some intelligence to produce readable output.
 smwfEncodeMessages (array $messages, $icon= 'warning', $seperator= '<!--br-->', $escape=true)
 Formats an array of message strings so that it appears as a tooltip.
 smwfLoadExtensionMessages ($extensionName)
smwfGetStore ()
 Get a handle for the storage backend that is used to manage the data.
smwfGetSparqlDatabase ()
 Get the SMWSparqlDatabase object to use for connecting to a SPARQL store, or null if no SPARQL backend has been set up.
 smwfGetLinker ()
 Compatibility helper for using Linker methods.


Detailed Description

Global functions and constants for Semantic MediaWiki.

In general, it is tried to fit functions in suitable classes as static methods if they clearly belong to some particular sub-function of SMW. Most functions here are used in diverse contexts so that they do not have fonud a place in any such class yet.

Definition in file SMW_GlobalFunctions.php.


Enumeration Type Documentation

Definition at line 33 of file SMW_GlobalFunctions.php.

Definition at line 34 of file SMW_GlobalFunctions.php.

Definition at line 35 of file SMW_GlobalFunctions.php.

Definition at line 30 of file SMW_GlobalFunctions.php.

Definition at line 25 of file SMW_GlobalFunctions.php.

enum SMW_CMP_EQ

Definition at line 54 of file SMW_GlobalFunctions.php.

Definition at line 56 of file SMW_GlobalFunctions.php.

Definition at line 61 of file SMW_GlobalFunctions.php.

Definition at line 55 of file SMW_GlobalFunctions.php.

Definition at line 60 of file SMW_GlobalFunctions.php.

Definition at line 58 of file SMW_GlobalFunctions.php.

Definition at line 57 of file SMW_GlobalFunctions.php.

Definition at line 59 of file SMW_GlobalFunctions.php.

Definition at line 26 of file SMW_GlobalFunctions.php.

Definition at line 28 of file SMW_GlobalFunctions.php.

enum SMW_DAY

Definition at line 72 of file SMW_GlobalFunctions.php.

Definition at line 74 of file SMW_GlobalFunctions.php.

Definition at line 75 of file SMW_GlobalFunctions.php.

Definition at line 29 of file SMW_GlobalFunctions.php.

enum SMW_DMY

Definition at line 65 of file SMW_GlobalFunctions.php.

Definition at line 21 of file SMW_GlobalFunctions.php.

Definition at line 19 of file SMW_GlobalFunctions.php.

Definition at line 20 of file SMW_GlobalFunctions.php.

Definition at line 13 of file SMW_GlobalFunctions.php.

Definition at line 15 of file SMW_GlobalFunctions.php.

Definition at line 16 of file SMW_GlobalFunctions.php.

Definition at line 14 of file SMW_GlobalFunctions.php.

Deprecated:
Module removed. Vanishes in SMW 1.7 at the latest.

Definition at line 41 of file SMW_GlobalFunctions.php.

Deprecated:
Use module 'ext.smw.style', see SMW_Ouptuts.php. Vanishes in SMW 1.7 at the latest.

Definition at line 43 of file SMW_GlobalFunctions.php.

Deprecated:
Use module 'ext.smw.tooltips', see SMW_Ouptuts.php. Vanishes in SMW 1.7 at the latest.

Definition at line 39 of file SMW_GlobalFunctions.php.

enum SMW_MDY

Definition at line 64 of file SMW_GlobalFunctions.php.

enum SMW_MONTH

Definition at line 73 of file SMW_GlobalFunctions.php.

enum SMW_MY

Definition at line 68 of file SMW_GlobalFunctions.php.

Definition at line 27 of file SMW_GlobalFunctions.php.

Definition at line 51 of file SMW_GlobalFunctions.php.

Definition at line 49 of file SMW_GlobalFunctions.php.

Definition at line 50 of file SMW_GlobalFunctions.php.

Definition at line 24 of file SMW_GlobalFunctions.php.

enum SMW_Y

Definition at line 70 of file SMW_GlobalFunctions.php.

enum SMW_YDM

Definition at line 67 of file SMW_GlobalFunctions.php.

enum SMW_YEAR

Definition at line 71 of file SMW_GlobalFunctions.php.

enum SMW_YM

Definition at line 69 of file SMW_GlobalFunctions.php.

enum SMW_YMD

Definition at line 66 of file SMW_GlobalFunctions.php.


Function Documentation

smwfEncodeMessages ( array $  messages,
icon = 'warning',
seperator = ' <!--br-->',
escape = true 
)

Formats an array of message strings so that it appears as a tooltip.

$icon should be one of: 'warning' (default), 'info'.

Parameters:
array $messages
string $icon Acts like an enum. Callers must ensure safety, since this value is used directly in the output.
string $seperator
boolean $escape Should the messages be escaped or not (ie when they already are)
Returns:
string

Definition at line 233 of file SMW_GlobalFunctions.php.

References SMWOutputs::requireResource().

Referenced by SMWUnusedPropertiesPage::formatResult(), SMWPropertiesPage::formatResult(), SMWQueryParser::getErrorString(), SMWResultPrinter::getErrorString(), SMWDataValue::getErrorText(), SMWConceptPage::getHtml(), SMWDataValue::getInfolinkText(), SMWQueryProcessor::getResultFromQuery(), SMWSubobject::render(), SMWShow::render(), SMWInfo::render(), SMWConcept::render(), and SMWAsk::render().

smwfGetLinker (  ) 

& smwfGetSparqlDatabase (  ) 

Get the SMWSparqlDatabase object to use for connecting to a SPARQL store, or null if no SPARQL backend has been set up.

Currently, it just returns one globally defined object, but the infrastructure allows to set up load balancing and task-dependent use of stores (e.g. using other stores for fast querying than for storing new facts), somewhat similar to MediaWiki's DB implementation.

Since:
1.6
Returns:
SMWSparqlDatabase or null

Definition at line 298 of file SMW_GlobalFunctions.php.

References $smwgSparqlDatabase, $smwgSparqlDataEndpoint, $smwgSparqlDefaultGraph, $smwgSparqlQueryEndpoint, and $smwgSparqlUpdateEndpoint.

Referenced by SMWSparqlStore::changeTitle(), SMWSparqlDatabase::deleteContentByValue(), SMWSparqlStore::deleteSparqlData(), SMWSparqlStore::doDataUpdate(), SMWSparqlStore::drop(), SMWSparqlStoreQueryEngine::getCountQueryResult(), SMWSparqlStoreQueryEngine::getDebugQueryResult(), SMWSparqlStoreQueryEngine::getInstanceQueryResult(), and SMWSparqlStore::getSparqlRedirectTarget().

& smwfGetStore (  ) 

Get a handle for the storage backend that is used to manage the data.

Currently, it just returns one globally defined object, but the infrastructure allows to set up load balancing and task-dependent use of stores (e.g. using other stores for fast querying than for storing new facts), somewhat similar to MediaWiki's DB implementation.

Returns:
SMWStore

Definition at line 275 of file SMW_GlobalFunctions.php.

References $smwgDefaultStore.

Referenced by SDBrowseDataPage::addSemanticResultWrapper(), SMWDataValue::addServiceLinks(), SMWDataValue::checkAllowedValues(), SMWSpecialBrowse::displayBrowse(), SMWSpecialSemanticStatistics::execute(), SMWAdmin::execute(), SMWPageProperty::execute(), SMWQueryUIHelper::execute(), SMWSetupScript::execute(), ApiSMWInfo::execute(), SMWRecordValue::findPropertyDataItems(), SMWDIProperty::findPropertyTypeID(), SMWUnusedPropertiesPage::formatResult(), SMWPropertiesPage::formatResult(), SFUtils::getAllPagesForConcept(), SFCreateTemplate::getAllPropertyNames(), SFUtils::getAllValuesForProperty(), SMWPageLister::getColumnList(), SMWSearchByProperty::getExactResults(), SMWFactbox::getFactboxTextFromOutput(), SFFormLinker::getFormsThatPagePointsTo(), SMWConceptPage::getHtml(), SFFormLinker::getIncomingProperties(), SMWSpecialBrowse::getInData(), SMWPageLister::getNavigationLinks(), SMWSearchByProperty::getNearbyResults(), SFFormLinker::getPagePropertiesOfPage(), SMWSpecialBrowse::getPropertyLabel(), SMWPropertyPage::getPropertyValueList(), SMWSqlStubSemanticData::getPropertyValues(), ApiSMWQuery::getQueryResult(), SMWExporter::getResourceElementForWikiPage(), SMWQueryProcessor::getResultFromQuery(), SMWWantedPropertiesPage::getResults(), SMWUnusedPropertiesPage::getResults(), SMWPropertiesPage::getResults(), SMWJSONResultPrinter::getResultText(), SMWExportController::getSemanticData(), SDUtils::getSemanticProperties(), SMWPageLister::getShortList(), SMWWikiPageValue::getSortKey(), SMWPropertyPage::getSubpropertyList(), SMWSpecialTypes::getTypeProperties(), SDUtils::getValuesForProperty(), SMWQuantityValue::initConversionData(), SMWQuantityValue::initDisplayData(), SDFilter::load(), SMWExporter::makeExportDataForSubject(), SMWParseData::onArticleDelete(), SMWParseData::onTitleMoveComplete(), SMWUpdateJob::run(), SMWRefreshJob::run(), SMWExportController::serializePage(), SFTemplateField::setTypeAndPossibleValues(), SMWParseData::storeData(), and SMWPropertyPage::subjectObjectList().

smwfHTMLtoUTF8 ( text  ) 

Decodes character references and inserts Unicode characters instead, using the MediaWiki Sanitizer.

Parameters:
string $text

Definition at line 143 of file SMW_GlobalFunctions.php.

Referenced by SMWExporter::getDataItemExpElement().

smwfIsSemanticsProcessed ( namespace  ) 

Return true if semantic data should be processed and displayed for a page in the given namespace.

Returns:
boolean

Definition at line 82 of file SMW_GlobalFunctions.php.

References $smwgNamespacesWithSemanticLinks.

Referenced by SMWParserExtensions::onInternalParseBeforeLinks(), SMWExportController::printAll(), and SMWParseData::storeData().

smwfLoadExtensionMessages ( extensionName  ) 

Deprecated:
since 1.7, will be removed in 1.9.

Definition at line 264 of file SMW_GlobalFunctions.php.

smwfNormalTitleDBKey ( text  ) 

Takes a title text and turns it safely into its DBKey.

This function reimplements most of the title normalization as done in Title.php in order to achieve conversion with less overhead. The official code could be called here if more advanced normalization is needed.

Parameters:
string $text

Definition at line 95 of file SMW_GlobalFunctions.php.

Referenced by SMWSemanticData::addPropertyValue(), and SRFTimeline::handleParameters().

smwfNormalTitleText ( text  ) 

Takes a text and turns it into a normalised version.

This function reimplements the title normalization as done in Title.php in order to achieve conversion with less overhead. The official code could be called here if more advanced normalization is needed.

Parameters:
string $text

Definition at line 115 of file SMW_GlobalFunctions.php.

Referenced by SMWQueryParser::getLinkDescription(), SMWTypesValue::parseUserValue(), SMWPropertyListValue::parseUserValue(), and SMWPropertyValue::parseUserValue().

smwfNumberFormat ( value,
decplaces = 3 
)

This method formats a float number value according to the given language and precision settings, with some intelligence to produce readable output.

Used to format a number that was not hand-formatted by a user.

Parameters:
mixed $value input number
integer $decplaces optional positive integer, controls how many digits after the decimal point are shown

Definition at line 156 of file SMW_GlobalFunctions.php.

References $smwgMaxNonExpNumber.

Referenced by SMWNumberValue::getLongWikiText(), SMWNumberValue::getShortWikiText(), SMWNumberValue::getWikiValue(), SMWTemperatureValue::makeUserValue(), SMWQuantityValue::makeUserValue(), and SMWNumberValue::makeUserValue().

smwfXMLContentEncode ( text  ) 

Escapes text in a way that allows it to be used as XML content (e.g.

as a string value for some property).

Parameters:
string $text

Definition at line 133 of file SMW_GlobalFunctions.php.

Referenced by SMWCompatibilityHelpers::dataItemFromDBKeys(), SMWStringValue::getLongHTMLText(), SMWRSSResultPrinter::getResultText(), SMWStringValue::getShortHTMLText(), SMWNumberValue::normalizeUnit(), and SMWRSSItem::text().


Generated on Sun Mar 18 07:15:41 2012 for Semantic MediaWiki by  doxygen 1.5.6