@@ -12,6 +12,7 @@ class QuickChart {
1212 public $ format ;
1313 public $ backgroundColor ;
1414 public $ apiKey ;
15+ public $ version ;
1516
1617 function __construct ($ options = array ()) {
1718 $ this ->protocol = isset ($ options ['protocol ' ]) ? $ options ['protocol ' ] : 'https ' ;
@@ -23,6 +24,7 @@ function __construct($options = array()) {
2324 $ this ->format = isset ($ options ['format ' ]) ? $ options ['format ' ] : 'png ' ;
2425 $ this ->backgroundColor = isset ($ options ['backgroundColor ' ]) ? $ options ['backgroundColor ' ] : 'transparent ' ;
2526 $ this ->apiKey = isset ($ options ['apiKey ' ]) ? $ options ['apiKey ' ] : null ;
27+ $ this ->version = isset ($ options ['version ' ]) ? $ options ['version ' ] : null ;
2628 }
2729
2830 function setConfig ($ chartjsConfig ) {
@@ -53,6 +55,10 @@ function setApiKey($apiKey) {
5355 $ this ->apiKey = $ apiKey ;
5456 }
5557
58+ function setVersion ($ version ) {
59+ $ this ->version = $ version ;
60+ }
61+
5662 function getConfigStr () {
5763 if (is_array ($ this ->config )) {
5864 return json_encode ($ this ->config );
@@ -74,6 +80,10 @@ function getUrl() {
7480 $ url .= '&key= ' . $ this ->apiKey ;
7581 }
7682
83+ if ($ this ->version ) {
84+ $ url .= '&version= ' . $ this ->version ;
85+ }
86+
7787 return $ url ;
7888 }
7989
@@ -92,6 +102,9 @@ function getShortUrl() {
92102 if ($ this ->apiKey ) {
93103 $ postData ['key ' ] = $ this ->apiKey ;
94104 }
105+ if ($ this ->version ) {
106+ $ postData ['version ' ] = $ this ->version ;
107+ }
95108 curl_setopt ($ ch , CURLOPT_POSTFIELDS , json_encode ($ postData ));
96109 curl_setopt ($ ch , CURLOPT_HTTPHEADER , array ('Content-Type:application/json ' ));
97110 curl_setopt ($ ch , CURLOPT_RETURNTRANSFER , true );
@@ -119,6 +132,9 @@ function toBinary() {
119132 if ($ this ->apiKey ) {
120133 $ postData ['key ' ] = $ this ->apiKey ;
121134 }
135+ if ($ this ->version ) {
136+ $ postData ['version ' ] = $ this ->version ;
137+ }
122138 curl_setopt ($ ch , CURLOPT_POSTFIELDS , json_encode ($ postData ));
123139 curl_setopt ($ ch , CURLOPT_HTTPHEADER , array ('Content-Type:application/json ' ));
124140 curl_setopt ($ ch , CURLOPT_RETURNTRANSFER , true );
0 commit comments