Added feature: Two new TS constants: textHorizontalPosition and textVerticalPosition...
authorstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Fri, 28 Aug 2009 15:38:30 +0000 (15:38 +0000)
committerstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Fri, 28 Aug 2009 15:38:30 +0000 (15:38 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/sr_freecap/trunk@23752 735d13b6-9817-0410-8766-e36946ffe9aa

ChangeLog
doc/manual.sxw
ext_typoscript_constants.txt
ext_typoscript_setup.txt
pi1/class.tx_srfreecap_pi1.php

index 0df8360..ed0ca62 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2009-08-29  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Follow-up to #3056: Audio Captcha is not rendered in IE8
+       * Added feature: Two new TS constants: textHorizontalPosition and textVerticalPosition. Thanks to Julia Pardanaud.
 
 2009-06-03  Stanislas Rolland  <typo3@sjbr.ca>
 
index 1d552eb..106fa68 100644 (file)
Binary files a/doc/manual.sxw and b/doc/manual.sxw differ
index 313e365..1643638 100644 (file)
@@ -6,6 +6,12 @@ plugin.tx_srfreecap {
     # cat=plugin.tx_srfreecap/dims/03; type=int+; label= CAPTCHA image additional width: The width, in pixels, of the generated image is based on the maximum possible length of the word plus the value of this property.
        imageAdditionalWidth = 75
 
+    # cat=plugin.tx_srfreecap/dims/04; type=int+; label= The horizontal (X) starting position of the word relative to the left of the image, in pixels.
+       textHorizontalPosition = 32
+
+    # cat=plugin.tx_srfreecap/dims/05; type=int+; label= The vertical (Y) starting position of the word relative to the top of the image, in pixels.
+       textVerticalPosition = 15
+
     # cat=plugin.tx_srfreecap/dims/01; type=int+; label= Maximun word length: Maximun length of the randomly generated CAPTCHA string.
        maxWordLength = 5
 
index 248b0f1..4cf0f0d 100644 (file)
@@ -4,6 +4,9 @@ plugin.tx_srfreecap_pi1 {
        imageAdditionalWidth = {$plugin.tx_srfreecap.imageAdditionalWidth}
        imageFormat = {$plugin.tx_srfreecap.imageFormat}
 
+       textHorizontalPosition = {$plugin.tx_srfreecap.textHorizontalPosition}
+       textVerticalPosition = {$plugin.tx_srfreecap.textVerticalPosition}
+
        backgroundType = {$plugin.tx_srfreecap.backgroundType}
        backgroundBlur = {$plugin.tx_srfreecap.backgroundBlur}
        backgroundMorph = {$plugin.tx_srfreecap.backgroundMorph}
index 772a9f2..2643328 100644 (file)
@@ -53,7 +53,7 @@
 *
 *
 \************************************************************/
-
+error_reporting (E_ALL ^ E_NOTICE);
 require_once(PATH_tslib.'class.tslib_pibase.php');
 
 class tx_srfreecap_pi1 extends tslib_pibase {
@@ -203,7 +203,13 @@ class tx_srfreecap_pi1 extends tslib_pibase {
                                $this->bg_type = 2;
                                break;
                }
-               
+
+               // text position X
+               $this->textHorizontalPosition = $this->conf['textHorizontalPosition'] ? intval($this->conf['textHorizontalPosition']) : 32;
+
+               // text position Y
+               $this->textVerticalPosition = $this->conf['textVerticalPosition'] ? intval($this->conf['textVerticalPosition']) : 15;
+
                // text morh factor
                $this->morphFactor = $this->conf['morphFactor'] ? $this->conf['morphFactor'] : 1;
                
@@ -672,9 +678,9 @@ class tx_srfreecap_pi1 extends tslib_pibase {
                //////////////////////////////////////////////////////
                
                // write word in random starting X position
-               $word_start_x = $this->rand_func(5,32);
+               $word_start_x = $this->rand_func(5, $this->textHorizontalPosition);
                // y positions jiggled about later
-               $word_start_y = 15;
+               $word_start_y = $this->textVerticalPosition;
                
                if($this->col_type==0) {
                        $text_r = $this->rand_color();