/** * Assemble individual SMW related settings into one accessible array for * easy instantiation since we don't have unique way of accessing only * SMW related settings ( e.g. $smwgSettings['...']) we need this method * as short cut to invoke only smwg* related settings * * @par Example: * @code * $settings = Settings::newFromGlobals(); * $settings->get( 'smwgDefaultStore' ); * @endcode * * @since 1.9 * * @return Settings */ public static function newFromGlobals() { $settings = array('smwgScriptPath' => $GLOBALS['smwgScriptPath'], 'smwgIP' => $GLOBALS['smwgIP'], 'smwgDefaultStore' => $GLOBALS['smwgDefaultStore'], 'smwgSparqlDatabaseConnector' => $GLOBALS['smwgSparqlDatabaseConnector'], 'smwgSparqlDatabase' => $GLOBALS['smwgSparqlDatabase'], 'smwgSparqlQueryEndpoint' => $GLOBALS['smwgSparqlQueryEndpoint'], 'smwgSparqlUpdateEndpoint' => $GLOBALS['smwgSparqlUpdateEndpoint'], 'smwgSparqlDataEndpoint' => $GLOBALS['smwgSparqlDataEndpoint'], 'smwgSparqlDefaultGraph' => $GLOBALS['smwgSparqlDefaultGraph'], 'smwgHistoricTypeNamespace' => $GLOBALS['smwgHistoricTypeNamespace'], 'smwgNamespaceIndex' => $GLOBALS['smwgNamespaceIndex'], 'smwgShowFactbox' => $GLOBALS['smwgShowFactbox'], 'smwgShowFactboxEdit' => $GLOBALS['smwgShowFactboxEdit'], 'smwgToolboxBrowseLink' => $GLOBALS['smwgToolboxBrowseLink'], 'smwgInlineErrors' => $GLOBALS['smwgInlineErrors'], 'smwgUseCategoryHierarchy' => $GLOBALS['smwgUseCategoryHierarchy'], 'smwgCategoriesAsInstances' => $GLOBALS['smwgCategoriesAsInstances'], 'smwgLinksInValues' => $GLOBALS['smwgLinksInValues'], 'smwgDefaultNumRecurringEvents' => $GLOBALS['smwgDefaultNumRecurringEvents'], 'smwgMaxNumRecurringEvents' => $GLOBALS['smwgMaxNumRecurringEvents'], 'smwgBrowseShowInverse' => $GLOBALS['smwgBrowseShowInverse'], 'smwgBrowseShowAll' => $GLOBALS['smwgBrowseShowAll'], 'smwgSearchByPropertyFuzzy' => $GLOBALS['smwgSearchByPropertyFuzzy'], 'smwgTypePagingLimit' => $GLOBALS['smwgTypePagingLimit'], 'smwgConceptPagingLimit' => $GLOBALS['smwgConceptPagingLimit'], 'smwgPropertyPagingLimit' => $GLOBALS['smwgPropertyPagingLimit'], 'smwgQEnabled' => $GLOBALS['smwgQEnabled'], 'smwgQMaxLimit' => $GLOBALS['smwgQMaxLimit'], 'smwgIgnoreQueryErrors' => $GLOBALS['smwgIgnoreQueryErrors'], 'smwgQSubcategoryDepth' => $GLOBALS['smwgQSubcategoryDepth'], 'smwgQEqualitySupport' => $GLOBALS['smwgQEqualitySupport'], 'smwgQSortingSupport' => $GLOBALS['smwgQSortingSupport'], 'smwgQRandSortingSupport' => $GLOBALS['smwgQRandSortingSupport'], 'smwgQDefaultNamespaces' => $GLOBALS['smwgQDefaultNamespaces'], 'smwgQComparators' => $GLOBALS['smwgQComparators'], 'smwStrictComparators' => $GLOBALS['smwStrictComparators'], 'smwgQMaxSize' => $GLOBALS['smwgQMaxSize'], 'smwgQMaxDepth' => $GLOBALS['smwgQMaxDepth'], 'smwgQFeatures' => $GLOBALS['smwgQFeatures'], 'smwgQDefaultLimit' => $GLOBALS['smwgQDefaultLimit'], 'smwgQUpperbound' => $GLOBALS['smwgQUpperbound'], 'smwgQMaxInlineLimit' => $GLOBALS['smwgQMaxInlineLimit'], 'smwgQPrintoutLimit' => $GLOBALS['smwgQPrintoutLimit'], 'smwgQDefaultLinking' => $GLOBALS['smwgQDefaultLinking'], 'smwgQConceptCaching' => $GLOBALS['smwgQConceptCaching'], 'smwgQConceptMaxSize' => $GLOBALS['smwgQConceptMaxSize'], 'smwgQConceptMaxDepth' => $GLOBALS['smwgQConceptMaxDepth'], 'smwgQConceptFeatures' => $GLOBALS['smwgQConceptFeatures'], 'smwgQConceptCacheLifetime' => $GLOBALS['smwgQConceptCacheLifetime'], 'smwgResultFormats' => $GLOBALS['smwgResultFormats'], 'smwgResultAliases' => $GLOBALS['smwgResultAliases'], 'smwgQuerySources' => $GLOBALS['smwgQuerySources'], 'smwgPDefaultType' => $GLOBALS['smwgPDefaultType'], 'smwgAllowRecursiveExport' => $GLOBALS['smwgAllowRecursiveExport'], 'smwgExportBacklinks' => $GLOBALS['smwgExportBacklinks'], 'smwgMaxNonExpNumber' => $GLOBALS['smwgMaxNonExpNumber'], 'smwgEnableUpdateJobs' => $GLOBALS['smwgEnableUpdateJobs'], 'smwgNamespacesWithSemanticLinks' => $GLOBALS['smwgNamespacesWithSemanticLinks'], 'smwgPageSpecialProperties' => $GLOBALS['smwgPageSpecialProperties'], 'smwgDeclarationProperties' => $GLOBALS['smwgDeclarationProperties'], 'smwgTranslate' => $GLOBALS['smwgTranslate'], 'smwgAdminRefreshStore' => $GLOBALS['smwgAdminRefreshStore'], 'smwgAutocompleteInSpecialAsk' => $GLOBALS['smwgAutocompleteInSpecialAsk'], 'smwgAutoRefreshSubject' => $GLOBALS['smwgAutoRefreshSubject'], 'smwgAutoRefreshOnPurge' => $GLOBALS['smwgAutoRefreshOnPurge'], 'smwgAutoRefreshOnPageMove' => $GLOBALS['smwgAutoRefreshOnPageMove'], 'smwgContLang' => $GLOBALS['smwgContLang'], 'smwgMaxPropertyValues' => $GLOBALS['smwgMaxPropertyValues'], 'smwgQSubpropertyDepth' => $GLOBALS['smwgQSubpropertyDepth'], 'smwgNamespace' => $GLOBALS['smwgNamespace'], 'smwgMasterStore' => $GLOBALS['smwgMasterStore'], 'smwgIQRunningNumber' => $GLOBALS['smwgIQRunningNumber'], 'smwgCacheType' => $GLOBALS['smwgCacheType'], 'smwgCacheUsage' => $GLOBALS['smwgCacheUsage'], 'smwgFixedProperties' => $GLOBALS['smwgFixedProperties'], 'smwgPropertyLowUsageThreshold' => $GLOBALS['smwgPropertyLowUsageThreshold'], 'smwgPropertyZeroCountDisplay' => $GLOBALS['smwgPropertyZeroCountDisplay'], 'smwgShowHiddenCategories' => $GLOBALS['smwgShowHiddenCategories'], 'smwgFactboxUseCache' => $GLOBALS['smwgFactboxUseCache'], 'smwgFactboxCacheRefreshOnPurge' => $GLOBALS['smwgFactboxCacheRefreshOnPurge'], 'smwgQueryProfiler' => $GLOBALS['smwgQueryProfiler'], 'smwgEnabledSpecialPage' => $GLOBALS['smwgEnabledSpecialPage'], 'smwgOnDeleteAction' => $GLOBALS['smwgOnDeleteAction'], 'smwgFallbackSearchType' => $GLOBALS['smwgFallbackSearchType'], 'smwgEnabledEditPageHelp' => $GLOBALS['smwgEnabledEditPageHelp'], 'smwgUFeatures' => $GLOBALS['smwgUFeatures'], 'smwgLogEventTypes' => $GLOBALS['smwgLogEventTypes']); $settings = $settings + array('smwgCanonicalNames' => NamespaceManager::getCanonicalNames()); if (self::$instance === null) { self::$instance = self::newFromArray($settings); } return self::$instance; }
/** * Removes a namespace mapping from the registry. The following restriction * apply: * * Attempting to unregister a built-in namespace (jcr, nt, mix, sv, xml or * the empty namespace) will throw a \PHPCR\NamespaceException. * * An attempt to unregister a namespace that is not currently registered * will throw a \PHPCR\NamespaceException. * * An implementation may prevent the unregistering of any other namespace * for implementation-specific reasons by throwing a * \PHPCR\NamespaceException. * * @param string $prefix The prefix of the mapping to be removed. * @return void * @throws \PHPCR\NamespaceException unregister a built-in namespace or a namespace that is not currently registered or a namespace whose unregsitration is forbidden for implementation-specific reasons. * @throws \PHPCR\UnsupportedRepositoryOperationException if this repository does not support namespace registry changes. * @throws \PHPCR\AccessDeniedException if the current session does not have sufficient access to unregister the namespace. * @throws \PHPCR\RepositoryException if another error occurs. */ public function unregisterNamespace($prefix) { $this->namespaceManager->checkPrefix($prefix); if (!array_key_exists($prefix, $this->userNamespaces)) { //defaultNamespaces would throw an exception in checkPrefix already throw new \PHPCR\NamespaceException("Prefix {$prefix} is not currently registered"); } throw new NotImplementedException('Write'); }
/** * Calculate the data for the NamespaceManager store and put them to the ajax output. * @param string $output the ajax output (have to be JSON) */ public static function getData() { if (BsCore::checkAccessAdmission('wikiadmin') === false) { return true; } global $wgContLang; $aResults = array(); $aNamespaces = $wgContLang->getNamespaces(); foreach ($aNamespaces as $iNs => $sNamespace) { if ($sNamespace === '') { $sNamespace = BsNamespaceHelper::getNamespaceName($iNs); } if ($iNs === -2 || $iNs === -1) { continue; } $aResults[] = array('id' => $iNs, 'name' => $sNamespace); } wfRunHooks('NamespaceManager::getNamespaceData', array(&$aResults)); $oRequest = RequestContext::getMain()->getRequest(); $iLimit = $oRequest->getInt('limit', 25); $iStart = $oRequest->getInt('start', 0); $sSort = $oRequest->getVal('sort', '[{"property":"id","direction":"DESC"}]'); self::$aSortConditions = FormatJson::decode($sSort); self::$aSortConditions = self::$aSortConditions[0]; usort($aResults, 'NamespaceManager::namespaceManagerRemoteSort'); $aLimitedResults = array(); $iResultCount = count($aResults); $iMax = $iStart + $iLimit > $iResultCount ? $iResultCount : $iStart + $iLimit; for ($i = $iStart; $i < $iMax; $i++) { $aLimitedResults[] = $aResults[$i]; } $aReturn = array('totalCount' => $iResultCount, 'success' => true, 'results' => $aLimitedResults); return FormatJson::encode($aReturn); }
} // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // GENERIC HELPER FUNCTIONS // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% static function getRevisionId($svnId = null) { // fixed annoying warning about undefined offset. if ($svnId === null || $svnId == '$' . 'Id' . '$') { return null; } // e.g. $Id$ $data = explode(' ', $svnId); return $data[2]; } static function getFullUrl($filename) { return 'http://www.bizzwiki.org/index.php?title=Filesystem:' . self::getRelativePath($filename); } static function getRelativePath($filename) { global $IP; $relPath = str_replace($IP, '', $filename); return str_replace('\\', '/', $relPath); // at least windows & *nix agree on this! } } // end class declaration NamespaceManagers::setup(); // List up-to-date with MW 1.10 SVN 21828 NamespaceManager::$hookList = array('ArticlePageDataBefore', 'ArticlePageDataAfter', 'ArticleAfterFetchContent', 'ArticleViewRedirect', 'ArticleViewHeader', 'ArticlePurge', 'ArticleSave', 'ArticleInsertComplete', 'ArticleSaveComplete', 'MarkPatrolled', 'MarkPatrolledComplete', 'WatchArticle', 'WatchArticleComplete', 'UnwatchArticle', 'UnwatchArticleComplete', 'ArticleProtect', 'ArticleProtectComplete', 'ArticleDelete', 'ArticleDeleteComplete', 'ArticleEditUpdatesDeleteFromRecentchanges', 'ArticleEditUpdateNewTalk', 'DisplayOldSubtitle', 'IsFileCacheable', 'CategoryPageView', 'FetchChangesList', 'DiffViewHeader', 'AlternateEdit', 'EditFormPreloadText', 'EditPage::attemptSave', 'EditFilter', 'EditPage::showEditForm:initial', 'EditPage::showEditForm:fields', 'SiteNoticeBefore', 'SiteNoticeAfter', 'FileUpload', 'BadImage', 'MagicWordMagicWords', 'MagicWordwgVariableIDs', 'MathAfterTexvc', 'MessagesPreLoad', 'LoadAllMessages', 'OutputPageParserOutput', 'OutputPageBeforeHTML', 'AjaxAddScript', 'PageHistoryBeforeList', 'PageHistoryLineEnding', 'ParserClearState', 'ParserBeforeStrip', 'ParserAfterStrip', 'ParserBeforeTidy', 'ParserAfterTidy', 'ParserBeforeInternalParse', 'InternalParseBeforeLinks', 'ParserGetVariableValueVarCache', 'ParserGetVariableValueTs', 'ParserGetVariableValueSwitch', 'IsTrustedProxy', 'wgQueryPages', 'RawPageViewBeforeOutput', 'RecentChange_save', 'SearchUpdate', 'AuthPluginSetup', 'LogPageValidTypes', 'LogPageLogName', 'LogPageLogHeader', 'LogPageActionText', 'SkinTemplateTabs', 'BeforePageDisplay', 'SkinTemplateOutputPageBeforeExec', 'PersonalUrls', 'SkinTemplatePreventOtherActiveTabs', 'SkinTemplateTabs', 'SkinTemplateBuildContentActionUrlsAfterSpecialPage', 'SkinTemplateContentActions', 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink', 'SkinTemplateSetupPageCss', 'BlockIp', 'BlockIpComplete', 'BookInformation', 'SpecialContributionsBeforeMainOutput', 'EmailUser', 'EmailUserComplete', 'SpecialMovepageAfterMove', 'SpecialPage_initList', 'SpecialPageExecuteBeforeHeader', 'SpecialPageExecuteBeforePage', 'SpecialPageExecuteAfterPage', 'PreferencesUserInformationPanel', 'SpecialSearchNogomatch', 'ArticleUndelete', 'UndeleteShowRevision', 'UploadForm:BeforeProcessing', 'UploadVerification', 'UploadComplete', 'UploadForm:initial', 'AddNewAccount', 'AbortNewAccount', 'UserLoginComplete', 'UserCreateForm', 'UserLoginForm', 'UserLogout', 'UserLogoutComplete', 'UserRights', 'SpecialVersionExtensionTypes', 'AutoAuthenticate', 'GetFullURL', 'GetLocalURL', 'GetInternalURL', 'userCan', 'TitleMoveComplete', 'isValidPassword', 'UserToggles', 'GetBlockedStatus', 'PingLimiter', 'UserRetrieveNewTalks', 'UserClearNewTalkNotification', 'PageRenderingHash', 'EmailConfirmed', 'ArticleFromTitle', 'CustomEditor', 'UnknownAction', 'LanguageGetMagic', 'LangugeGetSpecialPageAliases', 'MonoBookTemplateToolboxEnd', 'SkinTemplateSetupPageCss', 'SkinTemplatePreventOtherActiveTabs'); //</source>