Skip to content

Commit cdb88f7

Browse files
committed
Add size parameter
1 parent 1f538a6 commit cdb88f7

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"source": "https://github.com/shevabam/recaptcha/tree/master"
1414
},
1515
"license": "GNU GPL 2.0",
16-
"version": "1.0.2",
16+
"version": "1.0.3",
1717
"require": {
1818
"php": ">=5.3.0"
1919
},

src/reCAPTCHA.php

+24
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ class reCAPTCHA
7979
*/
8080
protected $language = null;
8181

82+
/**
83+
* Captcha size. Default : normal
84+
*
85+
* @var string
86+
* @see https://developers.google.com/recaptcha/docs/display#render_param
87+
*/
88+
protected $size = null;
89+
8290

8391

8492
/**
@@ -179,6 +187,19 @@ public function setLanguage($language)
179187
return $this;
180188
}
181189

190+
/**
191+
* Set size
192+
*
193+
* @param string $size (see https://developers.google.com/recaptcha/docs/display#render_param)
194+
* @return object
195+
*/
196+
public function setSize($size)
197+
{
198+
$this->size = $size;
199+
200+
return $this;
201+
}
202+
182203
/**
183204
* Generate the JS code of the captcha
184205
*
@@ -210,6 +231,9 @@ public function getHtml()
210231
if (!is_null($this->type))
211232
$data .= ' data-type="'.$this->type.'"';
212233

234+
if (!is_null($this->size))
235+
$data .= ' data-size="'.$this->size.'"';
236+
213237
return '<div class="g-recaptcha" '.$data.'></div>';
214238
}
215239
}

0 commit comments

Comments
 (0)