* remove PHP5 warning; PHPTAL no longer needed for MonoBook
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 19 Nov 2004 07:37:46 +0000 (07:37 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 19 Nov 2004 07:37:46 +0000 (07:37 +0000)
* set $wgUsePHPTal to false; not sure if it's really needed anymore. Disabled TAL version of MonoBook
* re-enabled display of PEAR errors from PHPTal skins (if they get used)

config/index.php
includes/DefaultSettings.php
includes/Skin.php
includes/SkinPHPTal.php
includes/SkinTemplate.php
skins/MonoBook.pt [deleted file]
skins/MonoBookTal.php [deleted file]
skins/disabled/MonoBook.pt [new file with mode: 0644]
skins/disabled/MonoBookTal.php [new file with mode: 0644]

index fe0ad95..9a446b8 100644 (file)
@@ -190,15 +190,7 @@ $conf = new ConfigData;
 
 install_version_checks();
 
-print "<li>PHP " . phpversion() . ": ";
-if( version_compare( phpversion(), "5.0", "lt" ) ) {
-       print "ok";
-} else {
-       print " <b>the MonoBook skin will be disabled due to an incompatibility
-               between the PHPTAL template library and PHP 5</b>. The wiki should
-               function normally, but with the older look and feel.";
-}
-print "</li>\n";
+print "<li>PHP " . phpversion() . ": ok</li>\n";
 
 if( ini_get( "register_globals" ) ) {
        ?>
index 58b6a25..11c9cea 100644 (file)
@@ -608,12 +608,16 @@ $wgSVGConverters = array(
 $wgSVGConverter = 'ImageMagick'; # Pick one of the above
 $wgSVGConverterPath = ''; # If not in the executable PATH, specify
 
-# PHPTal is a library for page templates. MediaWiki includes
-# a recent PHPTal distribution. It is required to use the
-# Monobook (default) skin.
+# PHPTAL is a library for page templates. This is optional;
+# MediaWiki's internal skins no longer use it but you might
+# create your own custom skin using it.
 #
-# Currently it does not work on PHP5.
-$wgUsePHPTal = version_compare( phpversion(), "5.0", "lt" );
+# Use PHPTAL 0.7.0 for PHP 4.x or PHPTAL 1.0.0 for PHP 5.0.
+# http://phptal.sourceforge.net/
+#
+# Leave it off to avoid trying to load the template library
+# if you're not going to be using any such skins.
+$wgUsePHPTal = false;
 
 if( !isset( $wgCommandLineMode ) ) {
        $wgCommandLineMode = false;
index 9bb6a52..406e83c 100644 (file)
@@ -14,27 +14,6 @@ if( defined( "MEDIAWIKI" ) ) {
 # See skin.doc
 require_once( 'Image.php' );
 
-# These are the INTERNAL names, which get mapped directly to class names and
-# file names in ./skins/. For display purposes, the Language class has
-# internationalized names
-#
-/*
-$wgValidSkinNames = array(
-       'standard'      => 'Standard',
-       'nostalgia'     => 'Nostalgia',
-       'cologneblue'   => 'CologneBlue'
-);
-if( $wgUsePHPTal ) {
-       #$wgValidSkinNames[] = 'PHPTal';
-       #$wgValidSkinNames['davinci'] = 'DaVinci';
-       #$wgValidSkinNames['mono'] = 'Mono';
-       #$wgValidSkinNames['monobookminimal'] = 'MonoBookMinimal';
-       $wgValidSkinNames['monobook'] = 'MonoBook';
-       $wgValidSkinNames['myskin'] = 'MySkin';
-       $wgValidSkinNames['chick'] = 'Chick';
-}
-*/
-
 # Get a list of all skins available in /skins/
 # Build using the regular expression '^(.*).php$'
 # Array keys are all lower case, array value keep the case used by filename
index 944612e..082e52f 100644 (file)
@@ -77,6 +77,21 @@ class SkinPHPTal extends SkinTemplate {
                        return new PHPTAL( $file . '.pt', $repository, $cache_dir );
                }
        }
+       
+       /**
+        * Output the string, or print error message if it's
+        * an error object of the appropriate type.
+        *
+        * @param mixed $str
+        * @access private
+        */
+       function printOrError( &$str ) {
+               if( PEAR::isError( $str ) ) {
+                       echo $str->toString(), "\n";
+               } else {
+                       echo $str;
+               }
+       }
 }
 
 class PHPTAL_version_bridge {
index ae5c304..855ac93 100644 (file)
@@ -317,13 +317,20 @@ class SkinTemplate extends Skin {
                $res = $tpl->execute();
                
                // result may be an error
-               #if (PEAR::isError($res)) {
-               #       echo $res->toString(), "\n";
-               #} else {
-                       echo $res;
-               #}
+               $this->printOrError( $res );
 
        }
+       
+       /**
+        * Output the string, or print error message if it's
+        * an error object of the appropriate type.
+        *
+        * @param mixed $str
+        * @access private
+        */
+       function printOrError( &$str ) {
+               echo $str;
+       }
 
        /**
         * build array of urls for personal toolbar
diff --git a/skins/MonoBook.pt b/skins/MonoBook.pt
deleted file mode 100644 (file)
index 2614b01..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="${lang}" lang="${lang}" dir="${dir}">
-  <head>
-    <meta http-equiv="Content-Type" content="${mimetype}; charset=${charset}" />
-    <div tal:replace="structure headlinks"></div>
-    <title tal:content="pagetitle">Exciting xhtml slimfast</title>
-    <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "${stylepath}/${stylename}/main.css"; /*]]>*/</style>
-    <link rel="stylesheet" type="text/css" media="print" href="${stylepath}/common/commonPrint.css" />
-    <!--[if IE]><style type="text/css" media="all">@import "${stylepath}/${stylename}/IEFixes.css";</style>
-    <script type="text/javascript" src="${stylepath}/common/IEFixes.js"></script>
-    <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
-    <script tal:condition="jsvarurl" type="text/javascript" tal:attributes="src jsvarurl"></script>
-    <script type="text/javascript" src="${stylepath}/common/wikibits.js"></script>
-    <style tal:condition="usercss" tal:content="structure usercss" type="text/css"></style>
-    <script tal:condition="userjs" type="text/javascript" tal:attributes="src userjs"></script><script 
-      tal:condition="userjsprev" tal:content="structure userjsprev" type="text/javascript"></script>
-  </head>
-  <body tal:attributes="ondblclick body_ondblclick|default; class nsclass|default">
-    <div id="globalWrapper">
-      <div id="column-content">
-       <div id="content">
-         <a name="top" id="contentTop"></a>
-         <div id="siteNotice" tal:condition="sitenotice" tal:content="structure sitenotice"></div>
-         <h1 class="firstHeading" tal:content="title">Leonardo da Vinci</h1>
-         <div id="bodyContent">
-           <h3 id="siteSub" i18n:translate="string:tagline">From Wikipedia, the free encyclopedia.</h3>
-           <div id="contentSub" tal:content="structure subtitle"></div>
-           <div id="contentSub" tal:condition="undelete" tal:content="structure undelete"></div>
-           <div tal:condition="newtalk" class="usermessage" tal:content="structure newtalk"></div>
-           <!-- start content -->
-           <div tal:replace="structure bodytext"></div>
-           <div tal:condition="catlinks" id="catlinks" tal:content="structure catlinks"></div>
-           <!-- end content -->
-           <div class="visualClear"></div>
-         </div>
-       </div>
-      </div>
-      <div id="column-one">
-       <div id="p-cactions" class="portlet">
-         <h5>Views</h5>
-         <ul>
-           <li tal:repeat="action content_actions" 
-           tal:attributes="id string:ca-${repeat/action/key}; class action/class|default"><a
-             tal:attributes="href action/href|default"
-             tal:content="action/text">Linktext</a></li>
-         </ul>
-       </div>
-       <div class="portlet" id="p-personal">
-         <h5 i18n:translate="string:personaltools">Personal Tools</h5>
-         <div class="pBody">
-           <ul>
-             <li tal:repeat="item personal_urls" 
-             tal:attributes="id string:pt-${repeat/item/key};"><a href="myuserpage"
-               tal:attributes="href item/href; class item/class|default"
-               tal:content="item/text">Log in</a></li>
-           </ul>
-         </div>
-       </div>
-       <div class="portlet" id="p-logo">
-         <a style="background-image: url(${logopath});" href="${nav_urls/mainpage/href}" i18n:attributes="title string:mainpage"></a>
-       </div>
-       <div class="portlet" id="p-nav">
-         <h5 i18n:translate="string:navigation">Navigation</h5>
-         <div class="pBody">
-           <ul>
-             <li tal:repeat="navlink navigation_urls" tal:attributes="id navlink/id">
-               <a tal:attributes="href navlink/href" tal:content="structure navlink/text">NavLink</a>
-             </li>
-           </ul>
-         </div>
-       </div>
-       <div id="p-search" class="portlet">
-         <h5 i18n:translate="string:search">Search</h5>
-         <div class="pBody">
-           <form name="searchform" tal:attributes="action searchaction" id="searchform">
-             <input id="searchInput" name="search" type="text"
-             i18n:attributes="accesskey string:accesskey-search | default"/>
-             <input type='submit' name="go" value="Go" class="searchButton" 
-             i18n:attributes="value string:go"/>&nbsp;<input type='submit' name="fulltext"
-             value="Search" class="searchButton"
-             i18n:attributes="value string:search"/>
-           </form>
-         </div>
-       </div>
-       <div class="portlet" id="p-tb">
-         <h5 i18n:translate="string:toolbox">Toolbox</h5>
-         <div class="pBody">
-           <ul>
-             <li id="t-whatlinkshere" tal:condition="notspecialpage"><a tal:attributes="href nav_urls/whatlinkshere/href"
-               i18n:translate="string:whatlinkshere">What links here</a></li>
-             <li id="t-recentchangeslinked" tal:condition="notspecialpage"><a tal:attributes="href nav_urls/recentchangeslinked/href"
-               i18n:translate="string:recentchangeslinked">Related Changes</a></li>
-             <li tal:condition="feeds" id="feedlinks">
-             <span i18n:translate="string:feedlinks">Feeds:</span>
-             <span tal:repeat="feed feeds" 
-               tal:attributes="id string:feed-${repeat/feed/key};"><a 
-                 tal:attributes="href feed/href;"
-                 tal:content="feed/text">rss</a>&nbsp;</span>
-             </li>
-             <li id="t-contributions" tal:condition="nav_urls/contributions"><a tal:attributes="href nav_urls/contributions/href"
-               i18n:translate="string:contributions">Contributions</a></li>
-             <li id="t-emailuser" tal:condition="nav_urls/emailuser"><a tal:attributes="href nav_urls/emailuser/href"
-               i18n:translate="string:emailuser">Email this user</a></li>
-             <li id="t-upload" tal:condition="nav_urls/upload"><a tal:attributes="href nav_urls/upload/href"
-               i18n:translate="string:upload">Upload a file</a></li>
-             <li id="t-specialpages"><a tal:attributes="href nav_urls/specialpages/href"
-               i18n:translate="string:specialpages">Special Pages</a></li>
-           </ul>
-         </div>
-       </div>
-       <div id="p-lang" class="portlet" tal:condition="language_urls">
-         <h5 i18n:translate="string:otherlanguages">Language</h5>
-         <div class="pBody">
-           <ul>
-             <li tal:repeat="langlink language_urls">
-             <a tal:attributes="href langlink/href"
-               tal:content="structure langlink/text">English</a>
-             </li>
-           </ul>
-         </div>
-       </div>
-      </div><!-- end of the left (by default at least) column -->
-      <div class="visualClear"></div>
-      <div id="footer">
-       <div id="f-poweredbyico" tal:condition="poweredbyico" tal:content="structure poweredbyico"></div>
-       <div id="f-copyrightico" tal:condition="copyrightico" tal:content="structure copyrightico"></div>
-       <ul id="f-list">
-         <li id="f-lastmod" tal:condition="lastmod" tal:content="structure lastmod"></li>
-         <li id="f-viewcount" tal:condition="viewcount" tal:content="structure viewcount"></li>
-         <li id="f-credits" tal:condition="credits" tal:content="structure credits"></li>
-         <li id="f-copyright" tal:condition="copyright" tal:content="structure copyright"></li>
-         <li id="f-about" tal:condition="about" tal:content="structure about"></li>
-         <li id="f-disclaimer" tal:condition="disclaimer" tal:content="structure disclaimer"></li>
-       </ul>
-      </div>
-    </div>
-    <div tal:replace="structure reporttime"></div>
-  </body>
-</html>
diff --git a/skins/MonoBookTal.php b/skins/MonoBookTal.php
deleted file mode 100644 (file)
index 7fe1eac..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/**
- * See skin.doc
- *
- * @todo document
- * @package MediaWiki
- * @subpackage Skins
- */
-
-/** */
-if( defined( 'MEDIAWIKI' ) ) {
-
-global $wgUsePHPTal;
-if ($wgUsePHPTal) {
-require_once('includes/SkinPHPTal.php');
-
-/**
- * Inherit everything from SkinPHPTal
- * This is a dummy skin as MonoBook is the default PHPTal skin.
- * @todo document
- * @package MediaWiki
- * @subpackage Skins
- */
-class SkinMonoBookTal extends SkinPHPTal {
-       /** Using monobook. */
-       function initPage( &$out ) {
-               SkinPHPTal::initPage( $out );
-               $this->skinname  = 'monobooktal';
-               $this->stylename = 'monobook';
-               $this->template  = 'MonoBook';
-       }
-}
-
-}
-
-}
-?>
diff --git a/skins/disabled/MonoBook.pt b/skins/disabled/MonoBook.pt
new file mode 100644 (file)
index 0000000..2614b01
--- /dev/null
@@ -0,0 +1,139 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="${lang}" lang="${lang}" dir="${dir}">
+  <head>
+    <meta http-equiv="Content-Type" content="${mimetype}; charset=${charset}" />
+    <div tal:replace="structure headlinks"></div>
+    <title tal:content="pagetitle">Exciting xhtml slimfast</title>
+    <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "${stylepath}/${stylename}/main.css"; /*]]>*/</style>
+    <link rel="stylesheet" type="text/css" media="print" href="${stylepath}/common/commonPrint.css" />
+    <!--[if IE]><style type="text/css" media="all">@import "${stylepath}/${stylename}/IEFixes.css";</style>
+    <script type="text/javascript" src="${stylepath}/common/IEFixes.js"></script>
+    <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
+    <script tal:condition="jsvarurl" type="text/javascript" tal:attributes="src jsvarurl"></script>
+    <script type="text/javascript" src="${stylepath}/common/wikibits.js"></script>
+    <style tal:condition="usercss" tal:content="structure usercss" type="text/css"></style>
+    <script tal:condition="userjs" type="text/javascript" tal:attributes="src userjs"></script><script 
+      tal:condition="userjsprev" tal:content="structure userjsprev" type="text/javascript"></script>
+  </head>
+  <body tal:attributes="ondblclick body_ondblclick|default; class nsclass|default">
+    <div id="globalWrapper">
+      <div id="column-content">
+       <div id="content">
+         <a name="top" id="contentTop"></a>
+         <div id="siteNotice" tal:condition="sitenotice" tal:content="structure sitenotice"></div>
+         <h1 class="firstHeading" tal:content="title">Leonardo da Vinci</h1>
+         <div id="bodyContent">
+           <h3 id="siteSub" i18n:translate="string:tagline">From Wikipedia, the free encyclopedia.</h3>
+           <div id="contentSub" tal:content="structure subtitle"></div>
+           <div id="contentSub" tal:condition="undelete" tal:content="structure undelete"></div>
+           <div tal:condition="newtalk" class="usermessage" tal:content="structure newtalk"></div>
+           <!-- start content -->
+           <div tal:replace="structure bodytext"></div>
+           <div tal:condition="catlinks" id="catlinks" tal:content="structure catlinks"></div>
+           <!-- end content -->
+           <div class="visualClear"></div>
+         </div>
+       </div>
+      </div>
+      <div id="column-one">
+       <div id="p-cactions" class="portlet">
+         <h5>Views</h5>
+         <ul>
+           <li tal:repeat="action content_actions" 
+           tal:attributes="id string:ca-${repeat/action/key}; class action/class|default"><a
+             tal:attributes="href action/href|default"
+             tal:content="action/text">Linktext</a></li>
+         </ul>
+       </div>
+       <div class="portlet" id="p-personal">
+         <h5 i18n:translate="string:personaltools">Personal Tools</h5>
+         <div class="pBody">
+           <ul>
+             <li tal:repeat="item personal_urls" 
+             tal:attributes="id string:pt-${repeat/item/key};"><a href="myuserpage"
+               tal:attributes="href item/href; class item/class|default"
+               tal:content="item/text">Log in</a></li>
+           </ul>
+         </div>
+       </div>
+       <div class="portlet" id="p-logo">
+         <a style="background-image: url(${logopath});" href="${nav_urls/mainpage/href}" i18n:attributes="title string:mainpage"></a>
+       </div>
+       <div class="portlet" id="p-nav">
+         <h5 i18n:translate="string:navigation">Navigation</h5>
+         <div class="pBody">
+           <ul>
+             <li tal:repeat="navlink navigation_urls" tal:attributes="id navlink/id">
+               <a tal:attributes="href navlink/href" tal:content="structure navlink/text">NavLink</a>
+             </li>
+           </ul>
+         </div>
+       </div>
+       <div id="p-search" class="portlet">
+         <h5 i18n:translate="string:search">Search</h5>
+         <div class="pBody">
+           <form name="searchform" tal:attributes="action searchaction" id="searchform">
+             <input id="searchInput" name="search" type="text"
+             i18n:attributes="accesskey string:accesskey-search | default"/>
+             <input type='submit' name="go" value="Go" class="searchButton" 
+             i18n:attributes="value string:go"/>&nbsp;<input type='submit' name="fulltext"
+             value="Search" class="searchButton"
+             i18n:attributes="value string:search"/>
+           </form>
+         </div>
+       </div>
+       <div class="portlet" id="p-tb">
+         <h5 i18n:translate="string:toolbox">Toolbox</h5>
+         <div class="pBody">
+           <ul>
+             <li id="t-whatlinkshere" tal:condition="notspecialpage"><a tal:attributes="href nav_urls/whatlinkshere/href"
+               i18n:translate="string:whatlinkshere">What links here</a></li>
+             <li id="t-recentchangeslinked" tal:condition="notspecialpage"><a tal:attributes="href nav_urls/recentchangeslinked/href"
+               i18n:translate="string:recentchangeslinked">Related Changes</a></li>
+             <li tal:condition="feeds" id="feedlinks">
+             <span i18n:translate="string:feedlinks">Feeds:</span>
+             <span tal:repeat="feed feeds" 
+               tal:attributes="id string:feed-${repeat/feed/key};"><a 
+                 tal:attributes="href feed/href;"
+                 tal:content="feed/text">rss</a>&nbsp;</span>
+             </li>
+             <li id="t-contributions" tal:condition="nav_urls/contributions"><a tal:attributes="href nav_urls/contributions/href"
+               i18n:translate="string:contributions">Contributions</a></li>
+             <li id="t-emailuser" tal:condition="nav_urls/emailuser"><a tal:attributes="href nav_urls/emailuser/href"
+               i18n:translate="string:emailuser">Email this user</a></li>
+             <li id="t-upload" tal:condition="nav_urls/upload"><a tal:attributes="href nav_urls/upload/href"
+               i18n:translate="string:upload">Upload a file</a></li>
+             <li id="t-specialpages"><a tal:attributes="href nav_urls/specialpages/href"
+               i18n:translate="string:specialpages">Special Pages</a></li>
+           </ul>
+         </div>
+       </div>
+       <div id="p-lang" class="portlet" tal:condition="language_urls">
+         <h5 i18n:translate="string:otherlanguages">Language</h5>
+         <div class="pBody">
+           <ul>
+             <li tal:repeat="langlink language_urls">
+             <a tal:attributes="href langlink/href"
+               tal:content="structure langlink/text">English</a>
+             </li>
+           </ul>
+         </div>
+       </div>
+      </div><!-- end of the left (by default at least) column -->
+      <div class="visualClear"></div>
+      <div id="footer">
+       <div id="f-poweredbyico" tal:condition="poweredbyico" tal:content="structure poweredbyico"></div>
+       <div id="f-copyrightico" tal:condition="copyrightico" tal:content="structure copyrightico"></div>
+       <ul id="f-list">
+         <li id="f-lastmod" tal:condition="lastmod" tal:content="structure lastmod"></li>
+         <li id="f-viewcount" tal:condition="viewcount" tal:content="structure viewcount"></li>
+         <li id="f-credits" tal:condition="credits" tal:content="structure credits"></li>
+         <li id="f-copyright" tal:condition="copyright" tal:content="structure copyright"></li>
+         <li id="f-about" tal:condition="about" tal:content="structure about"></li>
+         <li id="f-disclaimer" tal:condition="disclaimer" tal:content="structure disclaimer"></li>
+       </ul>
+      </div>
+    </div>
+    <div tal:replace="structure reporttime"></div>
+  </body>
+</html>
diff --git a/skins/disabled/MonoBookTal.php b/skins/disabled/MonoBookTal.php
new file mode 100644 (file)
index 0000000..d565122
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+/**
+ * This is for the old PHPTAL-based version of MonoBook.
+ * The main MonoBook has been converted to straight PHP
+ * to avoid the dependency on PHPTAL and, hopefully,
+ * reduce the frequent problems users have with compiled
+ * PHPTAL templates failing.
+ *
+ * You can still use MonoBook.pt as a sample, or copy it
+ * to the parent directory to test with.
+ *
+ * @todo document
+ * @package MediaWiki
+ * @subpackage Skins
+ */
+
+/** */
+if( defined( 'MEDIAWIKI' ) ) {
+
+global $wgUsePHPTal;
+if ($wgUsePHPTal) {
+require_once('includes/SkinPHPTal.php');
+
+/**
+ * Inherit everything from SkinPHPTal
+ * This is a dummy skin as MonoBook is the default PHPTal skin.
+ * @todo document
+ * @package MediaWiki
+ * @subpackage Skins
+ */
+class SkinMonoBookTal extends SkinPHPTal {
+       /** Using monobook. */
+       function initPage( &$out ) {
+               SkinPHPTal::initPage( $out );
+               $this->skinname  = 'monobooktal';
+               $this->stylename = 'monobook';
+               $this->template  = 'MonoBook';
+       }
+}
+
+}
+
+}
+?>