Drop support for XHTML 1.0
[lhc/web/wiklou.git] / includes / Setup.php
index 08ab143..acbc3b6 100644 (file)
@@ -44,8 +44,12 @@ if ( !isset( $wgVersion ) ) {
 }
 
 // Set various default paths sensibly...
-if ( $wgScript === false ) $wgScript = "$wgScriptPath/index$wgScriptExtension";
-if ( $wgLoadScript === false ) $wgLoadScript = "$wgScriptPath/load$wgScriptExtension";
+if ( $wgScript === false ) {
+       $wgScript = "$wgScriptPath/index$wgScriptExtension";
+}
+if ( $wgLoadScript === false ) {
+       $wgLoadScript = "$wgScriptPath/load$wgScriptExtension";
+}
 
 if ( $wgArticlePath === false ) {
        if ( $wgUsePathInfo ) {
@@ -61,24 +65,38 @@ if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) {
        $wgActionPaths['view'] = $wgArticlePath;
 }
 
-if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) {
-       # 'view' is assumed the default action path everywhere in the code
-       # but is rarely filled in $wgActionPaths
-       $wgActionPaths['view'] = $wgArticlePath;
+if ( $wgStylePath === false ) {
+       $wgStylePath = "$wgScriptPath/skins";
+}
+if ( $wgLocalStylePath === false ) {
+       $wgLocalStylePath = "$wgScriptPath/skins";
+}
+if ( $wgStyleDirectory === false ) {
+       $wgStyleDirectory = "$IP/skins";
+}
+if ( $wgExtensionAssetsPath === false ) {
+       $wgExtensionAssetsPath = "$wgScriptPath/extensions";
 }
 
-if ( $wgStylePath === false ) $wgStylePath = "$wgScriptPath/skins";
-if ( $wgLocalStylePath === false ) $wgLocalStylePath = "$wgScriptPath/skins";
-if ( $wgStyleDirectory === false ) $wgStyleDirectory = "$IP/skins";
-if ( $wgExtensionAssetsPath === false ) $wgExtensionAssetsPath = "$wgScriptPath/extensions";
-
-if ( $wgLogo === false ) $wgLogo = "$wgStylePath/common/images/wiki.png";
+if ( $wgLogo === false ) {
+       $wgLogo = "$wgStylePath/common/images/wiki.png";
+}
 
-if ( $wgUploadPath === false ) $wgUploadPath = "$wgScriptPath/images";
-if ( $wgUploadDirectory === false ) $wgUploadDirectory = "$IP/images";
-if ( $wgReadOnlyFile === false ) $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
-if ( $wgFileCacheDirectory === false ) $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
-if ( $wgDeletedDirectory === false ) $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
+if ( $wgUploadPath === false ) {
+       $wgUploadPath = "$wgScriptPath/images";
+}
+if ( $wgUploadDirectory === false ) {
+       $wgUploadDirectory = "$IP/images";
+}
+if ( $wgReadOnlyFile === false ) {
+       $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
+}
+if ( $wgFileCacheDirectory === false ) {
+       $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
+}
+if ( $wgDeletedDirectory === false ) {
+       $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
+}
 
 if ( isset( $wgFileStore['deleted']['directory'] ) ) {
        $wgDeletedDirectory = $wgFileStore['deleted']['directory'];
@@ -129,13 +147,13 @@ $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
  * Initialise $wgLockManagers to include basic FS version
  */
 $wgLockManagers[] = array(
-       'name'          => 'fsLockManager',
-       'class'         => 'FSLockManager',
+       'name' => 'fsLockManager',
+       'class' => 'FSLockManager',
        'lockDirectory' => "{$wgUploadDirectory}/lockdir",
 );
 $wgLockManagers[] = array(
-       'name'          => 'nullLockManager',
-       'class'         => 'NullLockManager',
+       'name' => 'nullLockManager',
+       'class' => 'NullLockManager',
 );
 
 /**
@@ -201,15 +219,15 @@ if ( $wgUseSharedUploads ) {
 }
 if ( $wgUseInstantCommons ) {
        $wgForeignFileRepos[] = array(
-               'class'                  => 'ForeignAPIRepo',
-               'name'                   => 'wikimediacommons',
-               'apibase'                => WebRequest::detectProtocol() === 'https' ?
+               'class' => 'ForeignAPIRepo',
+               'name' => 'wikimediacommons',
+               'apibase' => WebRequest::detectProtocol() === 'https' ?
                        'https://commons.wikimedia.org/w/api.php' :
                        'http://commons.wikimedia.org/w/api.php',
-               'hashLevels'             => 2,
-               'fetchDescription'       => true,
+               'hashLevels' => 2,
+               'fetchDescription' => true,
                'descriptionCacheExpiry' => 43200,
-               'apiThumbCacheExpiry'    => 86400,
+               'apiThumbCacheExpiry' => 86400,
        );
 }
 /*
@@ -300,7 +318,7 @@ $wgCanonicalNamespaceNames = array(
 );
 
 /// @todo UGLY UGLY
-if( is_array( $wgExtraNamespaces ) ) {
+if ( is_array( $wgExtraNamespaces ) ) {
        $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces;
 }
 
@@ -322,11 +340,18 @@ if ( !$wgEnotifMinorEdits ) {
 }
 
 # $wgDisabledActions is deprecated as of 1.18
-foreach( $wgDisabledActions as $action ) {
+foreach ( $wgDisabledActions as $action ) {
        $wgActions[$action] = false;
 }
 
-if ( !$wgHtml5Version && $wgHtml5 && $wgAllowRdfaAttributes ) {
+# We always output html5 since 1.22, override any change made by local settings
+$wgHtml5 = true;
+
+# Setting wgXhtmlDefaultNamespace is not supported since 1.22.
+# However we define it here for extensions that depend on its value.
+$wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
+
+if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
        # see http://www.w3.org/TR/rdfa-in-html/#document-conformance
        if ( $wgMimeType == 'application/xhtml+xml' ) {
                $wgHtml5Version = 'XHTML+RDFa 1.0';
@@ -373,22 +398,20 @@ if ( $wgDebugToolbar && !$wgCommandLineMode ) {
        MWDebug::init();
 }
 
-if ( !defined( 'MW_COMPILED' ) ) {
-       if ( !MWInit::classExists( 'AutoLoader' ) ) {
-               require_once( "$IP/includes/AutoLoader.php" );
-       }
+if ( !class_exists( 'AutoLoader' ) ) {
+       require_once( "$IP/includes/AutoLoader.php" );
+}
 
-       wfProfileIn( $fname . '-exception' );
-       MWExceptionHandler::installHandler();
-       wfProfileOut( $fname . '-exception' );
+wfProfileIn( $fname . '-exception' );
+MWExceptionHandler::installHandler();
+wfProfileOut( $fname . '-exception' );
 
-       wfProfileIn( $fname . '-includes' );
-       require_once( "$IP/includes/normal/UtfNormalUtil.php" );
-       require_once( "$IP/includes/GlobalFunctions.php" );
-       require_once( "$IP/includes/ProxyTools.php" );
-       require_once( "$IP/includes/normal/UtfNormalDefines.php" );
-       wfProfileOut( $fname . '-includes' );
-}
+wfProfileIn( $fname . '-includes' );
+require_once( "$IP/includes/normal/UtfNormalUtil.php" );
+require_once( "$IP/includes/GlobalFunctions.php" );
+require_once( "$IP/includes/ProxyTools.php" );
+require_once( "$IP/includes/normal/UtfNormalDefines.php" );
+wfProfileOut( $fname . '-includes' );
 
 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
        $wgSecureLogin = false;
@@ -432,7 +455,7 @@ if ( is_null( $wgLocaltimezone ) ) {
 }
 
 date_default_timezone_set( $wgLocaltimezone );
-if( is_null( $wgLocalTZoffset ) ) {
+if ( is_null( $wgLocalTZoffset ) ) {
        $wgLocalTZoffset = date( 'Z' ) / 60;
 }
 
@@ -538,10 +561,11 @@ foreach ( $wgExtensionFunctions as $func ) {
        if ( is_object( $func ) && $func instanceof Closure ) {
                $profName = $fname . '-extensions-closure';
        } elseif ( is_array( $func ) ) {
-               if ( is_object( $func[0] ) )
+               if ( is_object( $func[0] ) ) {
                        $profName = $fname . '-extensions-' . get_class( $func[0] ) . '::' . $func[1];
-               else
+               } else {
                        $profName = $fname . '-extensions-' . implode( '::', $func );
+               }
        } else {
                $profName = $fname . '-extensions-' . strval( $func );
        }