Development

Changeset 2817

You must first sign up to be able to contribute.

Changeset 2817

Show
Ignore:
Timestamp:
11/26/06 05:16:36 (2 years ago)
Author:
dwhittle
Message:

moved jpgraph lib to dedicated directory
updated jpgraph to version 2.1.4
added phpdocs + fixed bug (thanks jordi)
updated package file
added module and test action
labeled as stable

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfJpGraphPlugin/LICENSE

    r1002 r2817  
    66 
    77THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
     8 
     9The JPGRAPH library is licensed under THE Q PUBLIC LICENSE version 1.0, please see lib/jpgraph/QPL.txt for more information. 
  • plugins/sfJpGraphPlugin/lib/jpgraph/imgdata_balls.inc

    r1002 r2817  
    44// Description: Base64 encoded images for small round markers 
    55// Created:   2003-03-20 
    6 // Author:  Johan Persson (johanp@aditus.nu) 
    7 // Ver:   $Id: imgdata_balls.inc 20 2005-05-30 20:34:41Z ljp $ 
     6// Ver:   $Id: imgdata_balls.inc 781 2006-10-08 08:07:47Z ljp $ 
    87// 
    98// Copyright (c) Aditus Consulting. All rights reserved. 
  • plugins/sfJpGraphPlugin/lib/jpgraph/imgdata_bevels.inc

    r1002 r2817  
    44// Description: Base64 encoded images for round bevels 
    55// Created:   2003-03-20 
    6 // Author:  Johan Persson (johanp@aditus.nu) 
    7 // Ver:   $Id: imgdata_bevels.inc 20 2005-05-30 20:34:41Z ljp $ 
     6// Ver:   $Id: imgdata_bevels.inc 781 2006-10-08 08:07:47Z ljp $ 
    87// 
    98// Copyright (c) Aditus Consulting. All rights reserved. 
  • plugins/sfJpGraphPlugin/lib/jpgraph/imgdata_diamonds.inc

    r1002 r2817  
    44// Description: Base64 encoded images for diamonds 
    55// Created:   2003-03-20 
    6 // Author:  Johan Persson (johanp@aditus.nu) 
    7 // Ver:   $Id: imgdata_diamonds.inc 20 2005-05-30 20:34:41Z ljp $ 
     6// Ver:   $Id: imgdata_diamonds.inc 781 2006-10-08 08:07:47Z ljp $ 
    87// 
    98// Copyright (c) Aditus Consulting. All rights reserved. 
  • plugins/sfJpGraphPlugin/lib/jpgraph/imgdata_pushpins.inc

    r1002 r2817  
    44// Description: Base64 encoded images for pushpins 
    55// Created:   2003-03-20 
    6 // Author:  Johan Persson (johanp@aditus.nu) 
    7 // Ver:   $Id: imgdata_pushpins.inc 20 2005-05-30 20:34:41Z ljp $ 
     6// Ver:   $Id: imgdata_pushpins.inc 781 2006-10-08 08:07:47Z ljp $ 
    87// 
    98// Copyright (c) Aditus Consulting. All rights reserved. 
  • plugins/sfJpGraphPlugin/lib/jpgraph/imgdata_squares.inc

    r1002 r2817  
    44// Description: Base64 encoded images for squares 
    55// Created:   2003-03-20 
    6 // Author:  Johan Persson (johanp@aditus.nu) 
    7 // Ver:   $Id: imgdata_squares.inc 20 2005-05-30 20:34:41Z ljp $ 
     6// Ver:   $Id: imgdata_squares.inc 781 2006-10-08 08:07:47Z ljp $ 
    87// 
    98// Copyright (c) Aditus Consulting. All rights reserved. 
  • plugins/sfJpGraphPlugin/lib/jpgraph/imgdata_stars.inc

    r1002 r2817  
    44// Description: Base64 encoded images for stars 
    55// Created:   2003-03-20 
    6 // Author:  Johan Persson (johanp@aditus.nu) 
    7 // Ver:   $Id: imgdata_stars.inc 20 2005-05-30 20:34:41Z ljp $ 
     6// Ver:   $Id: imgdata_stars.inc 781 2006-10-08 08:07:47Z ljp $ 
    87// 
    98// Copyright (c) Aditus Consulting. All rights reserved. 
  • plugins/sfJpGraphPlugin/lib/jpgraph/jpg-config.inc.php

    r1517 r2817  
    44// Description: Configuration file for JpGraph library 
    55// Created:   2004-03-27 
    6 // Author:  Johan Persson (johanp@aditus.nu) 
    76// Ver:   $Id$ 
    87// 
     
    1312 
    1413//------------------------------------------------------------------------ 
    15 // Directories for cache and font directory.  
     14// Directories for cache and font directory. 
    1615// 
    1716// CACHE_DIR: 
     
    4645// using the cache. 
    4746// The directory must be the filesysystem name as seen by PHP 
    48 // and the 'http' version must be the same directory but as  
    49 // seen by the HTTP server relative to the 'htdocs' ddirectory.  
     47// and the 'http' version must be the same directory but as 
     48// seen by the HTTP server relative to the 'htdocs' ddirectory. 
    5049// If a relative path is specified it is taken to be relative from where 
    5150// the image script is executed. 
    52 // Note: The default setting is to create a subdirectory in the  
     51// Note: The default setting is to create a subdirectory in the 
    5352// directory from where the image script is executed and store all files 
    5453// there. As ususal this directory must be writeable by the PHP process. 
    55 DEFINE("CSIMCACHE_DIR","csimcache/");  
     54 
     55DEFINE("CSIMCACHE_DIR","csimcache/"); 
    5656DEFINE("CSIMCACHE_HTTP_DIR","csimcache/"); 
    5757 
     
    6969 
    7070// If you are setting this config to true the conversion of greek characters 
    71 // will assume that the input text is windows 1251  
     71// will assume that the input text is windows 1251 
    7272DEFINE("GREEK_FROM_WINDOWS",false); 
    7373 
     
    104104// where $locale_char_set is a GLOBAL (string) variable 
    105105// from the application including JpGraph. 
    106 //  
     106// 
    107107DEFINE('LANGUAGE_CHARSET', null); 
    108108 
     
    114114 
    115115// Assume that Japanese text have been entered in EUC-JP encoding. 
    116 // If this define is true then conversion from EUC-JP to UTF8 is done  
     116// If this define is true then conversion from EUC-JP to UTF8 is done 
    117117// automatically in the library using the mbstring module in PHP. 
    118118DEFINE('ASSUME_EUCJP_ENCODING',false); 
     
    134134 
    135135// Should the cache be used at all? By setting this to false no 
    136 // files will be generated in the cache directory.   
     136// files will be generated in the cache directory. 
    137137// The difference from READ_CACHE being that setting READ_CACHE to 
    138138// false will still create the image in the cache directory 
     
    141141DEFINE("USE_CACHE",false); 
    142142 
    143 // Should we try to find an image in the cache before generating it?  
     143// Should we try to find an image in the cache before generating it? 
    144144// Set this define to false to bypass the reading of the cache and always 
    145 // regenerate the image. Note that even if reading the cache is  
     145// regenerate the image. Note that even if reading the cache is 
    146146// disabled the cached will still be updated with the newly generated 
    147147// image. Set also "USE_CACHE" below. 
     
    169169// the closest match? If you plan on using background images or 
    170170// gradient fills it might be a good idea to enable this. 
    171 // If not you will otherwise get an error saying that the color palette is  
    172 // exhausted. The drawback of using approximations is that the colors  
    173 // might not be exactly what you specified.  
    174 // Note1: This does only apply to paletted images, not truecolor  
     171// If not you will otherwise get an error saying that the color palette is 
     172// exhausted. The drawback of using approximations is that the colors 
     173// might not be exactly what you specified. 
     174// Note1: This does only apply to paletted images, not truecolor 
    175175// images since they don't have the limitations of maximum number 
    176176// of colors. 
     
    198198// specified group since otherwise it is impossible for Apache 
    199199// to set the specified group. 
    200 DEFINE("CACHE_FILE_GROUP","wwwadmin"); 
     200DEFINE("CACHE_FILE_GROUP","www-data"); 
    201201 
    202202// What permissions should the cached file have 
     
    205205 
    206206// Decide if we should use the bresenham circle algorithm or the 
    207 // built in Arc(). Bresenham gives better visual apperance of circles  
     207// built in Arc(). Bresenham gives better visual apperance of circles 
    208208// but is more CPU intensive and slower then the built in Arc() function 
    209209// in GD. Turned off by default for speed 
  • plugins/sfJpGraphPlugin/lib/jpgraph/jpgraph.php

    r1517 r2817  
    44// Description: PHP Graph Plotting library. Base module. 
    55// Created:   2001-01-08 
    6 // Author:  Johan Persson (johanp@aditus.nu) 
    76// Ver:   $Id$ 
    87// 
    9 // Copyright (c) Aditus Consulting. All rights reserved. 
     8// Copyright 2006 (c) Aditus Consulting. All rights reserved. 
    109//======================================================================== 
    1110 
    1211require_once('jpg-config.inc.php'); 
     12require_once 'jpgraph_gradient.php'; 
     13require_once 'jpgraph_errhandler.inc.php'; 
    1314 
    1415// Version info 
    15 DEFINE('JPG_VERSION','2.1'); 
     16DEFINE('JPG_VERSION','2.2.1'); 
    1617 
    1718// Minimum required PHP version 
    1819DEFINE('MIN_PHPVERSION','5.1.0'); 
    19  
    20 // For internal use only 
    21 DEFINE("_JPG_DEBUG",false); 
    22 DEFINE("_FORCE_IMGTOFILE",false); 
    23 DEFINE("_FORCE_IMGDIR",'/tmp/jpgimg/'); 
    24  
    2520 
    2621// Should the image be a truecolor image?  
     
    229224DEFINE('LINESTYLE_SOLID',4); 
    230225 
    231 // 
    232 // Get hold of gradient class (In Version 2.x) 
    233 // 
    234 require_once 'jpgraph_gradient.php'; 
    235  
    236 GLOBAL $__jpg_err_locale ; 
    237 $__jpg_err_locale = DEFAULT_ERR_LOCALE; 
    238  
    239 class ErrMsgText { 
    240     private $lt=NULL; 
    241     function ErrMsgText() { 
    242   GLOBAL $__jpg_err_locale; 
    243   $file = 'lang/'.$__jpg_err_locale.'.inc.php'; 
    244  
    245   // If the chosen locale doesn't exist try english 
    246   if( !file_exists(dirname(__FILE__).'/'.$file) ) { 
    247       $__jpg_err_locale = 'en'; 
    248   } 
    249  
    250   $file = 'lang/'.$__jpg_err_locale.'.inc.php'; 
    251   if( !file_exists(dirname(__FILE__).'/'.$file) ) { 
    252       die('Internal error: Chosen locale file for error messages does not exist.'); 
    253   } 
    254   require_once($file); 
    255   $this->lt = $_jpg_messages; 
    256     } 
    257  
    258     function Get($errnbr,$a1=null,$a2=null,$a3=null,$a4=null,$a5=null) { 
    259   GLOBAL $__jpg_err_locale; 
    260   if( !isset($this->lt[$errnbr]) ) { 
    261       return 'Internal error: The specified error message ('.$errnbr.') does not exist in the chosen locale ('.$__jpg_err_locale.')'; 
    262   } 
    263   $ea = $this->lt[$errnbr]; 
    264   $j=0; 
    265   if( $a1 !== null ) { 
    266       $argv[$j++] = $a1; 
    267       if( $a2 !== null ) { 
    268     $argv[$j++] = $a2; 
    269     if( $a3 !== null ) { 
    270         $argv[$j++] = $a3; 
    271         if( $a4 !== null ) { 
    272       $argv[$j++] = $a4; 
    273       if( $a5 !== null ) { 
    274           $argv[$j++] = $a5; 
    275       } 
    276         } 
    277     } 
    278       } 
    279   } 
    280   $numargs = $j;  
    281   if( $ea[1] != $numargs ) { 
    282       // Error message argument count do not match. 
    283       // Just return the error message without arguments. 
    284       return $ea[0]; 
    285   } 
    286   switch( $numargs ) { 
    287       case 1: 
    288     $msg = sprintf($ea[0],$argv[0]); 
    289     break; 
    290       case 2: 
    291     $msg = sprintf($ea[0],$argv[0],$argv[1]); 
    292     break; 
    293       case 3: 
    294     $msg = sprintf($ea[0],$argv[0],$argv[1],$argv[2]); 
    295     break; 
    296       case 4: 
    297     $msg = sprintf($ea[0],$argv[0],$argv[1],$argv[2],$argv[3]); 
    298     break; 
    299       case 5: 
    300     $msg = sprintf($ea[0],$argv[0],$argv[1],$argv[2],$argv[3],$argv[4]); 
    301     break; 
    302       case 0: 
    303       default: 
    304     $msg = sprintf($ea[0]); 
    305     break; 
    306   } 
    307   return $msg; 
    308     } 
    309 
    310  
    311 // 
    312 // A wrapper class that is used to access the specified error object 
    313 // (to hide the global error parameter and avoid having a GLOBAL directive 
    314 // in all methods. 
    315 // 
    316 class JpGraphError { 
    317     private static $__jpg_err; 
    318     public static function Install($aErrObject) { 
    319   self::$__jpg_err = new $aErrObject; 
    320     } 
    321     public static function Raise($aMsg,$aHalt=true){ 
    322   self::$__jpg_err->Raise($aMsg,$aHalt); 
    323     } 
    324     public static function SetErrLocale($aLoc) { 
    325   GLOBAL $__jpg_err_locale ; 
    326   $__jpg_err_locale = $aLoc; 
    327     } 
    328     public static function RaiseL($errnbr,$a1=null,$a2=null,$a3=null,$a4=null,$a5=null) { 
    329   $t = new ErrMsgText(); 
    330   $msg = $t->Get($errnbr,$a1,$a2,$a3,$a4,$a5); 
    331   self::$__jpg_err->Raise($msg); 
    332     } 
    333 
    334   
    335 // 
    336 // ... and install the default error handler 
    337 // 
    338 if( USE_IMAGE_ERROR_HANDLER ) { 
    339     JpGraphError::Install("JpGraphErrObjectImg"); 
    340 
    341 else { 
    342     JpGraphError::Install("JpGraphErrObject"); 
    343 
     226// For internal use only 
     227DEFINE("_JPG_DEBUG",false); 
     228DEFINE("_FORCE_IMGTOFILE",false); 
     229DEFINE("_FORCE_IMGDIR",'/tmp/jpgimg/'); 
    344230 
    345231function CheckPHPVersion($aMinVersion) 
     
    359245 
    360246// 
     247// Make sure PHP version is high enough 
     248// 
     249if( !CheckPHPVersion(MIN_PHPVERSION) ) { 
     250    JpGraphError::RaiseL(13,PHP_VERSION,MIN_PHPVERSION); 
     251} 
     252 
     253 
     254// 
    361255// Make GD sanity check 
    362256// 
     
    364258    JpGraphError::RaiseL(25001); 
    365259//("This PHP installation is not configured with the GD library. Please recompile PHP with GD support to run JpGraph. (Neither function imagetypes() nor imagecreatefromstring() does exist)"); 
    366 } 
    367  
    368 // 
    369 // Make sure PHP version is high enough 
    370 // 
    371 if( !CheckPHPVersion(MIN_PHPVERSION) ) { 
    372     JpGraphError::RaiseL(13,PHP_VERSION,MIN_PHPVERSION); 
    373 } 
    374  
    375 // 
    376 // First of all set up a default error handler 
    377 // 
    378  
    379 //============================================================= 
    380 // The default trivial text error handler. 
    381 //============================================================= 
    382 class JpGraphErrObject { 
    383  
    384     protected $iTitle = "JpGraph Error"; 
    385     protected $iDest = false; 
    386  
    387  
    388     function JpGraphErrObject() { 
    389   // Empty. Reserved for future use 
    390     } 
    391  
    392     function SetTitle($aTitle) { 
    393   $this->iTitle = $aTitle; 
    394     } 
    395  
    396     function SetStrokeDest($aDest) {  
    397   $this->iDest = $aDest;  
    398     } 
    399  
    400     // If aHalt is true then execution can't continue. Typical used for fatal errors 
    401     function Raise($aMsg,$aHalt=true) { 
    402   $aMsg = $this->iTitle.' '.$aMsg; 
    403   if ($this->iDest) { 
    404       $f = @fopen($this->iDest,'a'); 
    405       if( $f ) { 
    406     @fwrite($f,$aMsg); 
    407     @fclose($f); 
    408       } 
    409   } 
    410   else { 
    411       echo $aMsg; 
    412   } 
    413   if( $aHalt ) 
    414       die(); 
    415     } 
    416 } 
    417  
    418 //============================================================== 
    419 // An image based error handler 
    420 //============================================================== 
    421 class JpGraphErrObjectImg extends JpGraphErrObject { 
    422  
    423     function Raise($aMsg,$aHalt=true) { 
    424   $img_iconerror =  
    425       'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAaV'. 
    426       'BMVEX//////2Xy8mLl5V/Z2VvMzFi/v1WyslKlpU+ZmUyMjEh/'. 
    427       'f0VyckJlZT9YWDxMTDjAwMDy8sLl5bnY2K/MzKW/v5yyspKlpY'. 
    428       'iYmH+MjHY/PzV/f2xycmJlZVlZWU9MTEXY2Ms/PzwyMjLFTjea'. 
    429       'AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACx'. 
    430       'IAAAsSAdLdfvwAAAAHdElNRQfTBgISOCqusfs5AAABLUlEQVR4'. 
    431       '2tWV3XKCMBBGWfkranCIVClKLd/7P2Q3QsgCxjDTq+6FE2cPH+'. 
    432       'xJ0Ogn2lQbsT+Wrs+buAZAV4W5T6Bs0YXBBwpKgEuIu+JERAX6'. 
    433       'wM2rHjmDdEITmsQEEmWADgZm6rAjhXsoMGY9B/NZBwJzBvn+e3'. 
    434       'wHntCAJdGu9SviwIwoZVDxPB9+Rc0TSEbQr0j3SA1gwdSn6Db0'. 
    435       '6Tm1KfV6yzWGQO7zdpvyKLKBDmRFjzeB3LYgK7r6A/noDAfjtS'. 
    436       'IXaIzbJSv6WgUebTMV4EoRB8a2mQiQjgtF91HdKDKZ1gtFtQjk'. 
    437       'YcWaR5OKOhkYt+ZsTFdJRfPAApOpQYJTNHvCRSJR6SJngQadfc'. 
    438       'vd69OLMddVOPCGVnmrFD8bVYd3JXfxXPtLR/+mtv59/ALWiiMx'. 
    439       'qL72fwAAAABJRU5ErkJggg==' ; 
    440  
    441   if( function_exists("imagetypes") ) 
    442       $supported = imagetypes(); 
    443   else 
    444       $supported = 0; 
    445  
    446   if( !function_exists('imagecreatefromstring') ) 
    447       $supported = 0; 
    448  
    449   if( ob_get_length() || headers_sent() || !($supported & IMG_PNG) ) { 
    450       // Special case for headers already sent or that the installation doesn't support 
    451       // the PNG format (which the error icon is encoded in).  
    452       // Dont return an image since it can't be displayed 
    453       die($this->iTitle.' '.$aMsg);    
    454   } 
    455  
    456   $aMsg = wordwrap($aMsg,55); 
    457   $lines = substr_count($aMsg,"\n"); 
    458  
    459   // Create the error icon GD 
    460   $erricon = Image::CreateFromString(base64_decode($img_iconerror));    
    461  
    462   // Create an image that contains the error text. 
    463   $w=400;    
    464   $h=100 + 15*max(0,$lines-3); 
    465  
    466   $img = new Image($w,$h); 
    467  
    468  
    469   // Drop shadow 
    470   $img->SetColor("gray"); 
    471   $img->FilledRectangle(5,5,$w-1,$h-1,10); 
    472   $img->SetColor("gray:0.7"); 
    473   $img->FilledRectangle(5,5,$w-3,$h-3,10); 
    474    
    475   // Window background 
    476   $img->SetColor("lightblue"); 
    477   $img->FilledRectangle(1,1,$w-5,$h-5); 
    478   $img->CopyCanvasH($img->img,$erricon,5,30,0,0,40,40); 
    479  
    480   // Window border 
    481   $img->SetColor("black"); 
    482   $img->Rectangle(1,1,$w-5,$h-5); 
    483   $img->Rectangle(0,0,$w-4,$h-4); 
    484    
    485   // Window top row 
    486   $img->SetColor("darkred"); 
    487   for($y=3; $y < 18; $y += 2 )  
    488       $img->Line(1,$y,$w-6,$y); 
    489  
    490   // "White shadow" 
    491   $img->SetColor("white"); 
    492  
    493   // Left window edge 
    494   $img->Line(2,2,2,$h-5); 
    495   $img->Line(2,2,$w-6,2); 
    496  
    497   // "Gray button shadow" 
    498   $img->SetColor("darkgray"); 
    499  
    500   // Gray window shadow 
    501   $img->Line(2,$h-6,$w-5,$h-6); 
    502   $img->Line(3,$h-7,$w-5,$h-7); 
    503  
    504   // Window title 
    505   $m = floor($w/2-5); 
    506   $l = 100; 
    507   $img->SetColor("lightgray:1.3"); 
    508   $img->FilledRectangle($m-$l,2,$m+$l,16); 
    509  
    510   // Stroke text 
    511   $img->SetColor("darkred"); 
    512   $img->SetFont(FF_FONT2,FS_BOLD); 
    513   $img->StrokeText($m-50,15,$this->iTitle); 
    514   $img->SetColor("black"); 
    515   $img->SetFont(FF_FONT1,FS_NORMAL); 
    516   $txt = new Text($aMsg,52,25); 
    517   $txt->Align("left","top"); 
    518   $txt->Stroke($img); 
    519   if ($this->iDest) { 
    520            $img->Stream($this->iDest); 
    521   } else { 
    522       $img->Headers(); 
    523       $img->Stream(); 
    524   } 
    525   if( $aHalt ) 
    526       die(); 
    527     } 
    528260} 
    529261 
     
    572304    if( !empty($_SERVER['QUERY_STRING']) ) { 
    573305  $q = @$_SERVER['QUERY_STRING']; 
    574   $fname .= '?'.preg_replace("/\W/", "_", $q).'.'.$img_format; 
     306  $fname .= '_'.preg_replace("/\W/", "_", $q).'.'.$img_format; 
    575307    } 
    576308    else { 
     
    734466 
    735467  $pLocale = setlocale(LC_TIME, 0); // get current locale for LC_TIME 
    736   $res = @setlocale(LC_TIME, $aLocale); 
     468 
     469  if (is_array($aLocale)) { 
     470      foreach ($aLocale as $loc) { 
     471    $res = @setlocale(LC_TIME, $loc); 
     472    if ( $res ) { 
     473        $aLocale = $loc; 
     474        break; 
     475    } 
     476      } 
     477  } 
     478  else { 
     479      $res = @setlocale(LC_TIME, $aLocale); 
     480  } 
     481 
    737482  if ( ! $res ){ 
    738483      JpGraphError::RaiseL(25007,$aLocale); 
     
    26382383    $this->FillMarginArea(); 
    26392384    $this->StrokeFrame(); 
    2640     $this->FillPlotArea(); 
    2641     $this->img->CopyMerge($bkgimg, 
    2642          $this->img->left_margin,$this->img->top_margin, 
    2643          0,0,$this->img->plotwidth+1,$this->img->plotheight, 
    2644          $bw,$bh,$this->background_image_mix); 
     2385    // Special case to hande 90 degree rotated graph corectly 
     2386    if( $aa == 90 ) { 
     2387        $this->img->SetAngle(90); 
     2388        $this->FillPlotArea(); 
     2389        $aa = $this->img->SetAngle(0); 
     2390        $adj = ($this->img->height - $this->img->width)/2; 
     2391        $this->img->CopyMerge($bkgimg, 
     2392            $this->img->bottom_margin-$adj,$this->img->left_margin+$adj, 
     2393            0,0, 
     2394            $this->img->plotheight+1,$this->img->plotwidth, 
     2395            $bw,$bh,$this->background_image_mix); 
     2396 
     2397    } 
     2398    else { 
     2399        $this->FillPlotArea(); 
     2400        $this->img->CopyMerge($bkgimg, 
     2401            $this->img->left_margin,$this->img->top_margin, 
     2402            0,0,$this->img->plotwidth+1,$this->img->plotheight, 
     2403            $bw,$bh,$this->background_image_mix); 
     2404    } 
    26452405    break; 
    26462406      case BGIMG_FILLFRAME: // Fill the whole area from upper left corner, resize to just fit 
     
    45264286    private $text_label_start=0; 
    45274287    private $iManualTickPos = NULL, $iManualMinTickPos = NULL, $iManualTickLabels = NULL; 
     4288    private $iAdjustForDST = false; // If a date falls within the DST period add one hour to the diaplyed time 
    45284289 
    45294290//--------------- 
     
    46574418      $label = (float)$aScale->GetMinVal()+$this->text_label_start+$this->label_offset;  
    46584419      $start_abs=$aScale->scale_factor*$this->text_label_start; 
    4659       $nbrmajticks=ceil(($aScale->GetMaxVal()-$aScale->GetMinVal()-$this->text_label_start )/$this->major_step)+1;   
     4420      $nbrmajticks=round(($aScale->GetMaxVal()-$aScale->GetMinVal()-$this->text_label_start )/$this->major_step)+1;  
    46604421 
    46614422      $x = $aScale->scale_abs[0]+$start_abs+$this->xlabel_offset*$min_step_abs;  
     
    46834444    // of the minor ticks. In order to avoid any rounding issues the major ticks are 
    46844445    // defined as every "step" minor ticks and not calculated separately 
    4685     $nbrmajticks=ceil(($aScale->GetMaxVal()-$aScale->GetMinVal()-$this->text_label_start )/$this->major_step)+1;  
     4446    $nbrmajticks=round(($aScale->GetMaxVal()-$aScale->GetMinVal()-$this->text_label_start )/$this->major_step)+1;  
    46864447    while( round($abs_pos) <= $limit ) { 
    46874448        $this->ticks_pos[] = round($abs_pos); 
     
    46994460      } 
    47004461      elseif( $aScale->type == "y" ) { 
    4701     $nbrmajticks=floor(($aScale->GetMaxVal()-$aScale->GetMinVal())/$this->major_step)+1; 
     4462    $nbrmajticks=round(($aScale->GetMaxVal()-$aScale->GetMinVal())/$this->major_step)+1; 
    47024463    while( round($abs_pos) >= $limit ) { 
    47034464        $this->ticks_pos[$i] = round($abs_pos);  
     
    47174478    } 
    47184479 
     4480    function AdjustForDST($aFlg=true) { 
     4481  $this->iAdjustForDST = $aFlg; 
     4482    } 
     4483 
     4484 
    47194485    function _doLabelFormat($aVal,$aIdx,$aNbrTicks) { 
    47204486 
     
    47374503      if( $this->label_usedateformat ) { 
    47384504    // Adjust the value to take daylight savings into account 
    4739     if (date("I",$aVal)==1) // DST 
     4505    if (date("I",$aVal)==1 && $this->iAdjustForDST ) // DST 
    47404506        $aVal+=3600; 
    47414507 
     
    47504516    if( $this->label_dateformatstr !== '' ) { 
    47514517        // Adjust the value to take daylight savings into account 
    4752         if (date("I",$aVal)==1) // DST 
     4518        if (date("I",$aVal)==1 && $this->iAdjustForDST ) // DST 
    47534519      $aVal+=3600; 
    47544520 
     
    48104576  $yu = $aPos - $this->direction*$this->GetMajTickAbsSize(); 
    48114577  $xr = $aPos + $this->direction*$this->GetMajTickAbsSize(); 
    4812   $nbrmajticks=ceil(($aScale->GetMaxVal()-$aScale->GetMinVal()-$this->text_label_start )/$this->major_step)+1; 
     4578  $nbrmajticks=round(($aScale->GetMaxVal()-$aScale->GetMinVal()-$this->text_label_start )/$this->major_step)+1; 
    48134579  $n = count($this->maj_ticks_pos); 
    48144580  for($i=0; $i < $n ; ++$i ) { 
     
    61375903    } 
    61385904 
    6139     function GetWidth($aImg=null) { 
     5905    static function GetWidth($aImg=null) { 
    61405906  if( $aImg === null )  
    61415907      $aImg = $this->img; 
     
    61435909    } 
    61445910 
    6145     function GetHeight($aImg=null) { 
     5911    static function GetHeight($aImg=null) { 
    61465912  if( $aImg === null )  
    61475913      $aImg = $this->img; 
     
    61495915    } 
    61505916     
    6151     function CreateFromString($aStr) { 
     5917    static function CreateFromString($aStr) { 
    61525918  $img = imagecreatefromstring($aStr); 
    61535919  if( $img === false ) { 
     
    74937259  // used 
    74947260  GLOBAL $gJpgBrandTiming; 
    7495    
     7261 
    74967262  if( $gJpgBrandTiming ) { 
    74977263      global $tim; 
     
    81377903      $n = count($aDatax); 
    81387904      for($i=0; $i < $n; ++$i ) { 
    8139     if( is_string($aDatax[$i]) ) { 
     7905    if( !is_numeric($aDatax[$i]) ) { 
    81407906        JpGraphError::RaiseL(25070); 
    81417907    } 
  • plugins/sfJpGraphPlugin/lib/jpgraph/jpgraph_antispam-digits.php

    r1517 r2817  
    44// Description: Genarate anti-spam challenge 
    55// Created:   2004-10-07 
    6 // Author:  Johan Persson (johanp@aditus.nu) 
    76// Ver:   $Id$ 
    87// 
  • plugins/sfJpGraphPlugin/lib/jpgraph/jpgraph_antispam.php

    r1002 r2817  
    44// Description: Genarate anti-spam challenge 
    55// Created:   2004-10-07 
    6 // Author:  Johan Persson (johanp@aditus.nu) 
    76// Ver:   $Id$ 
    87// 
  • plugins/sfJpGraphPlugin/lib/jpgraph/jpgraph_bar.php

    r1517 r2817  
    44// Description: Bar plot extension for JpGraph 
    55// Created:   2001-01-08 
    6 // Author:  Johan Persson (johanp@aditus.nu) 
    76// Ver:   $Id$ 
    87// 
     
    316315 
    317316      // If value is NULL, or 0 then don't draw a bar at all 
    318       if ($this->coords[0][$i] === null || 
    319     $this->coords[0][$i] === '' || 
    320     $this->coords[0][$i] === 0 ) continue;     
     317      if ($this->coords[0][$i] === null || $this->coords[0][$i] === '' ) 
     318    continue;     
    321319 
    322320      if( $exist_x ) $x=$this->coords[1][$i]; 
  • plugins/sfJpGraphPlugin/lib/jpgraph/jpgraph_canvas.php

    r1517 r2817  
    44// Description: Canvas drawing extension for JpGraph 
    55// Created:   2001-01-08 
    6 // Author:  Johan Persson (johanp@aditus.nu) 
    76// Ver:   $Id$ 
    87// 
  • plugins/sfJpGraphPlugin/lib/jpgraph/jpgraph_canvtools.php

    r1002 r2817  
    44// Description: Some utilities for text and shape drawing on a canvas 
    55// Created:   2002-08-23 
    6 // Author:  Johan Persson (johanp@aditus.nu) 
    76// Ver:   $Id$ 
    87// 
  • plugins/sfJpGraphPlugin/lib/jpgraph/jpgraph_date.php

    r1517 r2817  
    44// Description: Classes to handle Date scaling 
    55// Created:   2005-05-02 
    6 // Author:  Johan Persson (johanp@aditus.nu) 
    76// Ver:   $Id$ 
    87// 
     
    381380    } 
    382381 
     382    function AdjustForDST($aFlg=true) { 
     383  $this->ticks->AdjustForDST($aFlg); 
     384    } 
     385 
     386 
    383387    function SetDateAlign($aStartAlign,$aEndAlign=false) { 
    384388  if( $aEndAlign === false ) { 
  • plugins/sfJpGraphPlugin/lib/jpgraph/jpgraph_error.php

    r1002 r2817  
    44// Description: Error plot extension for JpGraph 
    55// Created:   2001-01-08 
    6 // Author:  Johan Persson (johanp@aditus.nu) 
    76// Ver:   $Id$ 
    87// 
  • plugins/sfJpGraphPlugin/lib/jpgraph/jpgraph_flags.php

    r1002 r2817  
    44// Description: Class Jpfile. Handles plotmarks 
    55// Created:   2003-06-28 
    6 // Author:  Johan Persson (johanp@aditus.nu) 
    76// Ver:   $Id$ 
    87// 
  • plugins/sfJpGraphPlugin/lib/jpgraph/jpgraph_gantt.php

    r1517 r2817  
    44// Description: JpGraph Gantt plot extension 
    55// Created:   2001-11-12 
    6 // Author:  Johan Persson (johanp@aditus.nu) 
    76// Ver:   $Id$ 
    87// 
     
    32623261    if( ! empty($this->title->csimalt[$i]) ) { 
    32633262        $tmp = $this->title->csimalt[$i]; 
    3264         $this->csimarea .= " title=\"$tmp\""; 
     3263        $this->csimarea .= " title=\"$tmp\"  alt=\"$tmp\" "; 
    32653264    } 
    3266     $this->csimarea .= " alt=\"$tmp\" />\n"; 
     3265    $this->csimarea .= " />\n"; 
    32673266      } 
    32683267  } 
     
    32993298      if( $this->csimalt != '' ) { 
    33003299    $tmp = $this->csimalt; 
    3301     $this->csimarea .= " title=\"$tmp\""; 
    3302       } 
    3303       $this->csimarea .= " alt=\"$tmp\" />\n"; 
     3300    $this->csimarea .= " title=\"$tmp\"  alt=\"$tmp\" "; 
     3301      } 
     3302      $this->csimarea .= " />\n"; 
    33043303  } 
    33053304 
     
    33173316    // Make sure that the progess bar doesn't extend over the end date 
    33183317    if( $xtp+$len-1 > $xb ) 
    3319         $len = $xb - $xtp + 1
     3318        $len = $xb - $xtp
    33203319     
    33213320    if( $xtp < $xt )  
     
    34223421    if( ! empty($this->title->csimalt[$i]) ) { 
    34233422        $tmp = $this->title->csimalt[$i]; 
    3424         $this->csimarea .= " title=\"$tmp\""; 
     3423        $this->csimarea .= " title=\"$tmp\" alt=\"$tmp\" "; 
    34253424    } 
    3426     $this->csimarea .= " alt=\"$tmp\" />\n"; 
     3425    $this->csimarea .= " />\n"; 
    34273426      } 
    34283427  } 
  • plugins/sfJpGraphPlugin/lib/jpgraph/jpgraph_gb2312.php

    r1002 r2817  
    44// Description: PHP4 Graph Plotting library. Chinese font conversions