whitespaces killing
authorAntoine Musso <hashar@users.mediawiki.org>
Tue, 9 Jan 2007 20:25:28 +0000 (20:25 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Tue, 9 Jan 2007 20:25:28 +0000 (20:25 +0000)
includes/AjaxDispatcher.php
includes/AjaxFunctions.php
includes/AjaxResponse.php

index 1f41a83..a14ebdd 100644 (file)
@@ -47,7 +47,7 @@ class AjaxDispatcher {
 
        function performAction() {
                global $wgAjaxExportList, $wgOut;
-               
+
                if ( empty( $this->mode ) ) {
                        return;
                }
@@ -59,7 +59,7 @@ class AjaxDispatcher {
                } else {
                        try {
                                $result = call_user_func_array($this->func_name, $this->args);
-                               
+
                                if ( $result === false || $result === NULL ) {
                                        header( 'Status: 500 Internal Error', true, 500 );
                                        echo "{$this->func_name} returned no data";
@@ -68,7 +68,7 @@ class AjaxDispatcher {
                                        if ( is_string( $result ) ) {
                                                $result= new AjaxResponse( $result );
                                        }
-                                       
+
                                        $result->sendHeaders();
                                        $result->printText();
                                }
@@ -82,7 +82,7 @@ class AjaxDispatcher {
                                }
                        }
                }
-               
+
                wfProfileOut( __METHOD__ );
                $wgOut = null;
        }
index eee2a1a..248cbec 100644 (file)
@@ -45,7 +45,7 @@ function js_unescape($source, $iconv_to = 'UTF-8') {
    if ($iconv_to != "UTF-8") {
        $decodedStr = iconv("UTF-8", $iconv_to, $decodedStr);
    }
-  
    return $decodedStr;
 }
 
@@ -71,7 +71,7 @@ function code2utf($num){
 function wfSajaxSearch( $term ) {
        global $wgContLang, $wgOut;
        $limit = 16;
-       
+
        $l = new Linker;
 
        $term = str_replace( ' ', '_', $wgContLang->ucfirst( 
@@ -109,7 +109,7 @@ function wfSajaxSearch( $term ) {
        $subtitle = $wgOut->parse( wfMsg( $subtitlemsg, wfEscapeWikiText($term) ) ); #FIXME: parser is missing mTitle !
 
        $term = htmlspecialchars( $term );
-       $html = '<div style="float:right; border:solid 1px black;background:gainsboro;padding:2px;"><a onclick="Searching_Hide_Results();">' 
+       $html = '<div style="float:right; border:solid 1px black;background:gainsboro;padding:2px;"><a onclick="Searching_Hide_Results();">'
                . wfMsg( 'hideresults' ) . '</a></div>'
                . '<h1 class="firstHeading">'.wfMsg('search')
                . '</h1><div id="contentSub">'. $subtitle . '</div><ul><li>'
@@ -121,11 +121,11 @@ function wfSajaxSearch( $term ) {
                                        "search=$term&go=Go" )
                . "</li></ul><h2>" . wfMsg( 'articletitles', $term ) . "</h2>"
                . '<ul>' .$r .'</ul>'.$more;
-               
+
        $response = new AjaxResponse( $html );
-       
+
        $response->setCacheDuration( 30*60 );
-               
+
        return $response;
 }
 
index a59c73b..456ee1f 100644 (file)
@@ -6,7 +6,7 @@ if( !defined( 'MEDIAWIKI' ) )
 class AjaxResponse {
        var $mCacheDuration;
        var $mVary;
-       
+
        var $mDisabled;
        var $mText;
        var $mResponseCode;
@@ -16,13 +16,13 @@ class AjaxResponse {
        function AjaxResponse( $text = NULL ) {
                $this->mCacheDuration = NULL;
                $this->mVary = NULL;
-               
+
                $this->mDisabled = false;
                $this->mText = '';
                $this->mResponseCode = '200 OK';
                $this->mLastModified = false;
                $this->mContentType= 'text/html; charset=utf-8';
-               
+
                if ( $text ) {
                        $this->addText( $text );
                }
@@ -39,15 +39,15 @@ class AjaxResponse {
        function setResponseCode( $code ) {
                $this->mResponseCode = $code;
        }
-       
+
        function setContentType( $type ) {
                $this->mContentType = $type;
        }
-       
+
        function disable() {
                $this->mDisabled = true;
        }
-       
+
        function addText( $text ) {
                if ( ! $this->mDisabled && $text ) {
                        $this->mText .= $text;
@@ -59,62 +59,62 @@ class AjaxResponse {
                        print $this->mText;
                }
        }
-       
+
        function sendHeaders() {
                global $wgUseSquid, $wgUseESI;
-               
+
                if ( $this->mResponseCode ) {
                        $n = preg_replace( '/^ *(\d+)/', '\1', $this->mResponseCode );
                        header( "Status: " . $this->mResponseCode, true, (int)$n );
                }
-               
+
                header ("Content-Type: " . $this->mContentType );
-               
+
                if ( $this->mLastModified ) {
                        header ("Last-Modified: " . $this->mLastModified );
                }
                else {
                        header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
                }
-               
+
                if ( $this->mCacheDuration ) {
-                       
+
                        # If squid caches are configured, tell them to cache the response, 
                        # and tell the client to always check with the squid. Otherwise,
                        # tell the client to use a cached copy, without a way to purge it.
-                       
+
                        if( $wgUseSquid ) {
-                               
+
                                # Expect explicite purge of the proxy cache, but require end user agents
                                # to revalidate against the proxy on each visit.
                                # Surrogate-Control controls our Squid, Cache-Control downstream caches
-                               
+
                                if ( $wgUseESI ) {
                                        header( 'Surrogate-Control: max-age='.$this->mCacheDuration.', content="ESI/1.0"');
                                        header( 'Cache-Control: s-maxage=0, must-revalidate, max-age=0' );
                                } else {
                                        header( 'Cache-Control: s-maxage='.$this->mCacheDuration.', must-revalidate, max-age=0' );
                                }
-                               
+
                        } else {
-                       
+
                                # Let the client do the caching. Cache is not purged.
                                header ("Expires: " . gmdate( "D, d M Y H:i:s", time() + $this->mCacheDuration ) . " GMT");
                                header ("Cache-Control: s-max-age={$this->mCacheDuration},public,max-age={$this->mCacheDuration}");
                        }
-                       
+
                } else {
                        # always expired, always modified
                        header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the past
                        header ("Cache-Control: no-cache, must-revalidate");  // HTTP/1.1
                        header ("Pragma: no-cache");                          // HTTP/1.0
                }
-               
+
                if ( $this->mVary ) {
                        header ( "Vary: " . $this->mVary );
                }
        }
-       
+
        /**
         * checkLastModified tells the client to use the client-cached response if
         * possible. If sucessful, the AjaxResponse is disabled so that
@@ -154,9 +154,9 @@ class AjaxResponse {
                                $this->setResponseCode( "304 Not Modified" );
                                $this->disable();
                                $this->mLastModified = $lastmod;
-                               
+
                                wfDebug( "$fname: CACHED client: $ismodsince ; user: $wgUser->mTouched ; page: $timestamp ; site $wgCacheEpoch\n", false );
-                               
+
                                return true;
                        } else {
                                wfDebug( "$fname: READY  client: $ismodsince ; user: $wgUser->mTouched ; page: $timestamp ; site $wgCacheEpoch\n", false );
@@ -167,11 +167,11 @@ class AjaxResponse {
                        $this->mLastModified = $lastmod;
                }
        }
-       
+
        function loadFromMemcached( $mckey, $touched ) {
                global $wgMemc;
                if ( !$touched ) return false;
-               
+
                $mcvalue = $wgMemc->get( $mckey );
                if ( $mcvalue ) {
                        # Check to see if the value has been invalidated
@@ -183,20 +183,20 @@ class AjaxResponse {
                                wfDebug( "$mckey has expired\n" );
                        }
                }
-               
+
                return false;
        }
-       
+
        function storeInMemcached( $mckey, $expiry = 86400 ) {
                global $wgMemc;
-               
-               $wgMemc->set( $mckey, 
+
+               $wgMemc->set( $mckey,
                        array(
                                'timestamp' => wfTimestampNow(),
                                'value' => $this->mText
                        ), $expiry
                );
-               
+
                return true;
        }
 }