Completed
Push — develop ( 75b835...a38a21 )
by Maxim
09:33 queued 04:23
created
manager/includes/veriword.php 1 patch
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,7 +41,8 @@  discard block
 block discarded – undo
41 41
 ## see sample.php for test and usage
42 42
 ## sample URL: http://www.program-ruti.org/veriword/
43 43
 ####
44
-class VeriWord {
44
+class VeriWord
45
+{
45 46
 
46 47
     /* path to font directory*/
47 48
     public $dir_font   = "ttf/";
@@ -51,7 +52,8 @@  discard block
 block discarded – undo
51 52
     public $im_width   = 0;
52 53
     public $im_height  = 0;
53 54
 
54
-    public function __construct($w=200, $h=80) {
55
+    public function __construct($w=200, $h=80)
56
+    {
55 57
         /* create session to set word for verification */
56 58
         $this->set_veriword();
57 59
         $this->dir_font = dirname(__FILE__) . '/' . $this->dir_font;
@@ -59,21 +61,24 @@  discard block
 block discarded – undo
59 61
         $this->im_height        = $h;
60 62
     }
61 63
 
62
-    public function set_veriword() {
64
+    public function set_veriword()
65
+    {
63 66
         /* create session variable for verification,
64 67
            you may change the session variable name */
65 68
         $this->word             = $this->pick_word();
66 69
         $_SESSION['veriword']   = $this->word;
67 70
     }
68 71
 
69
-    public function output_image() {
72
+    public function output_image()
73
+    {
70 74
         /* output the image as jpeg */
71 75
         $this->draw_image();
72 76
         header("Content-type: image/jpeg");
73 77
         imagejpeg($this->im);
74 78
     }
75 79
 
76
-    public function pick_word() {
80
+    public function pick_word()
81
+    {
77 82
         global $modx;
78 83
         // set default words
79 84
         $words="MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote";
@@ -84,7 +89,8 @@  discard block
 block discarded – undo
84 89
         return (string) $arr_words[array_rand($arr_words)].rand(10,999);
85 90
     }
86 91
 
87
-    public function draw_text() {
92
+    public function draw_text()
93
+    {
88 94
         $dir = dir($this->dir_font);
89 95
         $fontstmp = array();
90 96
         while (false !== ($file = $dir->read())) {
@@ -139,7 +145,8 @@  discard block
 block discarded – undo
139 145
     }
140 146
 
141 147
 
142
-    public function draw_image() {
148
+    public function draw_image()
149
+    {
143 150
 
144 151
         /* pick one background image randomly from image directory */
145 152
         $img_file       = $this->dir_noise."noise".rand(1,4).".jpg";
@@ -170,7 +177,8 @@  discard block
 block discarded – undo
170 177
         return $this->im;
171 178
     }
172 179
 
173
-    public function destroy_image() {
180
+    public function destroy_image()
181
+    {
174 182
 
175 183
         imagedestroy($this->im);
176 184
 
Please login to merge, or discard this patch.