Skip to content

Commit

Permalink
Upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
denisovdenis committed Nov 12, 2013

Verified

This commit was signed with the committer’s verified signature.
crazy-max CrazyMax
1 parent f168181 commit 7c3d0d2
Showing 33 changed files with 8,147 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
57 changes: 57 additions & 0 deletions 0-CHANGES.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
;**************************************************************************************
; This file is the change history of pChart4mw
;
; url: http://code.google.com/p/pchart4mw/
;**************************************************************************************

v1.4.0 - 12 May 2012
* Added new features: parameter threshold with thcolor
* Fixed: deprecated php function split() removed

v1.3.3 - 21 July 2011
* Changed: Main module pChart4mw.php uses $parser object instead of global

v1.3.2 - 15 July 2011
* Changed: Removed trailing ?> from all the php code files

v1.3.1 - 13 July 2011
* Fixed: Parameter 'filled' now also working with non-cubic line charts

v1.3.0 - 24 December 2010
* Added new features: textfont, textsize, titlefont and titlesize parameters
* Removed globals $wgPChart4mwFont and $wgPChart4mwFontSize
* Added global $wgPChart4mwFontPath absolute path to the fonts folder
* Included pChart (version 1.27d) library files in the distribution for ease of
installation and configuration
* Moved the fonts folder under pChart4mw extensions root: ..\pChart4mw\fonts
* When upgrading from a previous version of pChart4mw:
- Take note of the changed folder structure of pChart4mw
- Take note of needed localsettings.php changes (remove old globals)
Best apporach is to completely remove the old version of pChart4mw and install this
new version. (make sure to save your custom colorschemes and fonts if you have them)
* The default font for pChart4mw is tahoma.ttf. Set your preffered font in
localsettings.php using $wgPChart4mwDefaults for example:
$wgPChart4mwDefaults = Array ( "textfont" => "myfont.ttf", "textsize" => "5" );

v1.2.1 - 16 December 2010
* Added new colorscheme: excel.txt

v1.2.0 - 7 July 2010
* Added new feature: parameter skiplabels to skip some labels on the x-axis.
* Added new feature: parameter decimals to show decimals on the axes.

v1.1.0 - 7 June 2010
* Implemented parser functions to show the charts in order to improve integration
with other extensions.

v1.0.6 - 28 April 2010
* Improved HTML output to be XHTML compliant

v1.0.5 - 20 November 2009
* a minor adjustment

v1.0.4 - 18 November 2009
* Added boxcolor parameter to determine the color of the box drawn around the chart

v1.0.3 - 13 July 2009
* Improved data parsing so lines with leading or trailing spaces are correctly handled
693 changes: 693 additions & 0 deletions 0-LICENCE.TXT

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions colorschemes/accent.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
127,201,127
190,174,212
253,192,134
255,255,153
56,108,176
240,2,127
191,91,23
8 changes: 8 additions & 0 deletions colorschemes/blue.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
222,235,247
198,219,239
158,202,225
107,174,214
66,146,198
33,113,181
8,81,156
8,48,107
8 changes: 8 additions & 0 deletions colorschemes/excel.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
69,114,167
170,70,67
137,165,78
113,88,143
65,152,175
219,132,61
147,169,207
209,147,146
8 changes: 8 additions & 0 deletions colorschemes/greenblue.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
8,64,129
8,104,172
43,140,190
78,179,211
123,204,196
168,221,181
204,235,197
224,243,219
8 changes: 8 additions & 0 deletions colorschemes/original.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
188,224,46
224,100,46
224,214,46
46,151,224
176,46,224
224,46,117
92,224,46
224,176,46
12 changes: 12 additions & 0 deletions colorschemes/paired.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
166,206,227
21,120,180
178,223,138
51,160,44
251,154,153
227,26,28
253,191,111
255,127,0
202,178,214
106,61,154
255,255,153
177,89,40
8 changes: 8 additions & 0 deletions colorschemes/purpleblue.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
2,56,88
4,90,141
5,112,176
54,144,192
116,169,207
166,189,219
208,209,230
236,231,242
8 changes: 8 additions & 0 deletions colorschemes/softblue.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
8,48,107
8,81,156
33,113,181
66,146,198
107,174,214
158,202,225
198,219,239
222,235,247
8 changes: 8 additions & 0 deletions colorschemes/wave.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
204,230,254
153,204,254
128,179,230
102,153,204
51,102,153
254,254,204
230,230,179
217,217,139
Binary file added fonts/Forgotte.ttf
Binary file not shown.
Binary file added fonts/GeosansLight.ttf
Binary file not shown.
Binary file added fonts/MankSans.ttf
Binary file not shown.
Binary file added fonts/Silkscreen.ttf
Binary file not shown.
Binary file added fonts/pf_arma_five.ttf
Binary file not shown.
Binary file added fonts/tahoma.ttf
Binary file not shown.
50 changes: 50 additions & 0 deletions library.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
// Helper functions
/**
* Converts HTML RGB colors to arrays with red, green and blue values
*
* @param $color String HTML-coded string with RGB color. May contain a # as first character. Examples: #00FF00, #CCC, AB82EE
* @return Array Array with three elements, for red green and blue. The elements are numbers between 0 and 255. If an
* error occurs (no correct RGB color), false is returned.
*/
function wfPChart4mwhtml2rgb( $color ) {
if( $color[ 0 ] == '#' )
$color = substr( $color, 1 );

if( strlen( $color) == 6 ) {
list( $r, $g, $b ) = array( $color[ 0 ] . $color[ 1 ],
$color[ 2 ] . $color[ 3 ],
$color[ 4 ] . $color[ 5 ] );
} elseif( strlen( $color ) == 3 ) {
list( $r, $g, $b ) = array( $color[ 0 ] . $color[ 0 ],
$color[ 1 ] . $color[ 1 ],
$color[ 2 ] . $color[ 2 ] );
} else {
return false;
}

return array( hexdec( $r ), hexdec( $g ), hexdec( $b ) );
}

/**
* Determines the height and width of a specified string on screen
*
* @param $font String Name of font (with file extension) used
* @param $text String Text of which the size should be determined
* @param $angle String Angle for showing the text
* @param $size Int Text size for printing the text
* @return Array Array with two elements: first element is the width of the textbox, second is the height
*/
function wfPChart4mwtextboxSize( $font, $text, $angle = 0, $size = 0 ) {
global $wgPChart4mwFontPath;

// Determine the bounding box using the GD library
$bbox = imageftbbox( $size, $angle, $wgPChart4mwFontPath . "/" . $font, $text );

// Compute the size
return array(
max( $bbox[ 0 ], $bbox[ 2 ], $bbox[ 4 ], $bbox[ 6 ] ) - min( $bbox[ 0 ], $bbox[ 2 ], $bbox[ 4 ], $bbox[ 6 ] ),
max( $bbox[ 1 ], $bbox[ 3 ], $bbox[ 5 ], $bbox[ 7 ] ) - min( $bbox[ 1 ], $bbox[ 3 ], $bbox[ 5 ], $bbox[ 7 ] )
);
}

18 changes: 18 additions & 0 deletions pChart/README.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
;**************************************************************************************
; This folder contains the original pChart (version 1.27d) files necessary for
; the working of the extension pChart4mw. The pChart files are:
;
; - pCache.class
; - PChart.class
; - pData.class
;
; The pChart files remain ownership of its original author and are included in
; pChart4mw's distribution for ease of installation purposes only. The pChart files
; are not maintained (or changed) by the pChart4mw authors.
;
; pChart and pChart4mw are both distributed under the GNU GPL license (see LICENSE.TXT).
;
; pChart's original url: <http://pchart.sourceforge.net>.
;
;**************************************************************************************

118 changes: 118 additions & 0 deletions pChart/pCache.class
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?php
/*
pCache - Faster renderding using data cache
Copyright (C) 2008 Jean-Damien POGOLOTTI
Version 1.1.2 last updated on 06/17/08

http://pchart.sourceforge.net

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 1,2,3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

Class initialisation :
pCache($CacheFolder="Cache/")
Cache management :
IsInCache($Data)
GetFromCache($ID,$Data)
WriteToCache($ID,$Data,$Picture)
DeleteFromCache($ID,$Data)
ClearCache()
Inner functions :
GetHash($ID,$Data)
*/

/* pCache class definition */
class pCache
{
var $HashKey = "";
var $CacheFolder = "Cache/";

/* Create the pCache object */
function pCache($CacheFolder="Cache/")
{
$this->CacheFolder = $CacheFolder;
}

/* This function is clearing the cache folder */
function ClearCache()
{
if ($handle = opendir($this->CacheFolder))
{
while (false !== ($file = readdir($handle)))
{
if ( $file != "." && $file != ".." )
unlink($this->CacheFolder.$file);
}
closedir($handle);
}
}

/* This function is checking if we have an offline version of this chart */
function IsInCache($ID,$Data,$Hash="")
{
if ( $Hash == "" )
$Hash = $this->GetHash($ID,$Data);

if ( file_exists($this->CacheFolder.$Hash) )
return(TRUE);
else
return(FALSE);
}

/* This function is making a copy of drawn chart in the cache folder */
function WriteToCache($ID,$Data,$Picture)
{
$Hash = $this->GetHash($ID,$Data);
$FileName = $this->CacheFolder.$Hash;

imagepng($Picture->Picture,$FileName);
}

/* This function is removing any cached copy of this chart */
function DeleteFromCache($ID,$Data)
{
$Hash = $this->GetHash($ID,$Data);
$FileName = $this->CacheFolder.$Hash;

if ( file_exists($FileName ) )
unlink($FileName);
}

/* This function is retrieving the cached picture if applicable */
function GetFromCache($ID,$Data)
{
$Hash = $this->GetHash($ID,$Data);
if ( $this->IsInCache("","",$Hash ) )
{
$FileName = $this->CacheFolder.$Hash;

header('Content-type: image/png');
@readfile($FileName);
exit();
}
}

/* This function is building the graph unique hash key */
function GetHash($ID,$Data)
{
$mKey = "$ID";
foreach($Data as $key => $Values)
{
$tKey = "";
foreach($Values as $Serie => $Value)
$tKey = $tKey.$Serie.$Value;
$mKey = $mKey.md5($tKey);
}
return(md5($mKey));
}
}
Loading

0 comments on commit 7c3d0d2

Please sign in to comment.