Completed
Push — master ( 248a3a...c5aa4f )
by Michael
05:44 queued 02:41
created
include/captcha/scripts/img.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     }
190 190
 
191 191
     /**
192
-     * @param         $name
192
+     * @param         string $name
193 193
      * @param  string $extension
194 194
      * @return array
195 195
      */
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
     /**
256 256
      * Return random background
257 257
      *
258
-     * @return array
258
+     * @return string|null
259 259
      */
260 260
     public function loadBackground()
261 261
     {
Please login to merge, or discard this patch.
Indentation   +405 added lines, -405 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 $xoopsLogger->activated = false;
11 11
 
12 12
 if (empty($_SERVER['HTTP_REFERER']) || !preg_match('/^' . preg_quote(XOOPS_URL, '/') . '/', $_SERVER['HTTP_REFERER'])) {
13
-    exit();
13
+	exit();
14 14
 }
15 15
 
16 16
 /**
@@ -18,185 +18,185 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class XoopsCaptchaImageHandler
20 20
 {
21
-    public $config = array();
22
-    //var $mode = "gd"; // GD or bmp
23
-    public $code;
24
-    public $invalid = false;
25
-
26
-    public $font;
27
-    public $spacing;
28
-    public $width;
29
-    public $height;
30
-
31
-    /**
32
-     * XoopsCaptchaImageHandler constructor.
33
-     */
34
-    public function __construct()
35
-    {
36
-        if (empty($_SESSION['XoopsCaptcha_name'])) {
37
-            $this->invalid = true;
38
-        }
39
-
40
-        if (!extension_loaded('gd')) {
41
-            $this->mode = 'bmp';
42
-        } else {
43
-            $required_functions = array('imagecreatetruecolor', 'imagecolorallocate', 'imagefilledrectangle', 'imagejpeg', 'imagedestroy', 'imageftbbox');
44
-            foreach ($required_functions as $func) {
45
-                if (!function_exists($func)) {
46
-                    $this->mode = 'bmp';
47
-                    break;
48
-                }
49
-            }
50
-        }
51
-    }
52
-
53
-    /**
54
-     * Loading configs from CAPTCHA class
55
-     * @param array $config
56
-     */
57
-    public function setConfig($config = array())
58
-    {
59
-        // Loading default preferences
60
-        $this->config = $config;
61
-    }
62
-
63
-    public function loadImage()
64
-    {
65
-        $this->createCode();
66
-        $this->setCode();
67
-        $this->createImage();
68
-    }
69
-
70
-    /**
71
-     * Create Code
72
-     */
73
-    public function createCode()
74
-    {
75
-        if ($this->invalid) {
76
-            return;
77
-        }
78
-
79
-        if ($this->mode === 'bmp') {
80
-            $this->config['num_chars'] = 4;
81
-            $this->code                = mt_rand(pow(10, $this->config['num_chars'] - 1), (int)str_pad('9', $this->config['num_chars'], '9'));
82
-        } else {
83
-            $this->code = substr(md5(uniqid(mt_rand(), 1)), 0, $this->config['num_chars']);
84
-            if (!$this->config['casesensitive']) {
85
-                $this->code = strtoupper($this->code);
86
-            }
87
-        }
88
-    }
89
-
90
-    public function setCode()
91
-    {
92
-        if ($this->invalid) {
93
-            return;
94
-        }
95
-
96
-        $_SESSION['XoopsCaptcha_sessioncode'] = (string)$this->code;
97
-        $maxAttempts                          = (int)(@$_SESSION['XoopsCaptcha_maxattempts']);
98
-
99
-        // Increase the attempt records on refresh
100
-        if (!empty($maxAttempts)) {
101
-            $_SESSION['XoopsCaptcha_attempt_' . $_SESSION['XoopsCaptcha_name']]++;
102
-            if ($_SESSION['XoopsCaptcha_attempt_' . $_SESSION['XoopsCaptcha_name']] > $maxAttempts) {
103
-                $this->invalid = true;
104
-            }
105
-        }
106
-    }
107
-
108
-    /**
109
-     * @param  string      $file
110
-     * @return string|void
111
-     */
112
-    public function createImage($file = '')
113
-    {
114
-        if ($this->invalid) {
115
-            header('Content-type: image/gif');
116
-            readfile(XOOPS_ROOT_PATH . '/images/subject/icon2.gif');
117
-
118
-            return;
119
-        }
120
-
121
-        if ($this->mode === 'bmp') {
122
-            return $this->createImageBmp();
123
-        } else {
124
-            return $this->createImageGd();
125
-        }
126
-    }
127
-
128
-    /**
129
-     *  Create CAPTCHA iamge with GD
130
-     *  Originated from DuGris' SecurityImage
131
-     * @param string $file
132
-     */
133
-    //  --------------------------------------------------------------------------- //
134
-    // Class: SecurityImage 1.5                                                    //
135
-    // Author: DuGris aka L. Jen <http://www.dugris.info>                           //
136
-    // Email: [email protected]                                                    //
137
-    // Licence: GNU                                                                 //
138
-    // Project: XOOPS Project                                                   //
139
-    //  --------------------------------------------------------------------------- //
140
-    public function createImageGd($file = '')
141
-    {
142
-        $this->loadFont();
143
-        $this->setImageSize();
144
-
145
-        $this->oImage = imagecreatetruecolor($this->width, $this->height);
146
-        $background   = imagecolorallocate($this->oImage, 255, 255, 255);
147
-        imagefilledrectangle($this->oImage, 0, 0, $this->width, $this->height, $background);
148
-
149
-        switch ($this->config['background_type']) {
150
-            default:
151
-            case 0:
152
-                $this->drawBars();
153
-                break;
154
-
155
-            case 1:
156
-                $this->drawCircles();
157
-                break;
158
-
159
-            case 2:
160
-                $this->drawLines();
161
-                break;
162
-
163
-            case 3:
164
-                $this->drawRectangles();
165
-                break;
166
-
167
-            case 4:
168
-                $this->drawEllipses();
169
-                break;
170
-
171
-            case 5:
172
-                $this->drawPolygons();
173
-                break;
174
-
175
-            case 100:
176
-                $this->createFromFile();
177
-                break;
178
-        }
179
-        $this->drawBorder();
180
-        $this->drawCode();
181
-
182
-        if (empty($file)) {
183
-            header('Content-type: image/jpeg');
184
-            imagejpeg($this->oImage);
185
-        } else {
186
-            imagejpeg($this->oImage, XOOPS_ROOT_PATH . '/' . $this->config['imagepath'] . '/' . $file . '.jpg');
187
-        }
188
-        imagedestroy($this->oImage);
189
-    }
190
-
191
-    /**
192
-     * @param         $name
193
-     * @param  string $extension
194
-     * @return array
195
-     */
196
-    public function _getList($name, $extension = '')
197
-    {
198
-        $items = array();
199
-        /*
21
+	public $config = array();
22
+	//var $mode = "gd"; // GD or bmp
23
+	public $code;
24
+	public $invalid = false;
25
+
26
+	public $font;
27
+	public $spacing;
28
+	public $width;
29
+	public $height;
30
+
31
+	/**
32
+	 * XoopsCaptchaImageHandler constructor.
33
+	 */
34
+	public function __construct()
35
+	{
36
+		if (empty($_SESSION['XoopsCaptcha_name'])) {
37
+			$this->invalid = true;
38
+		}
39
+
40
+		if (!extension_loaded('gd')) {
41
+			$this->mode = 'bmp';
42
+		} else {
43
+			$required_functions = array('imagecreatetruecolor', 'imagecolorallocate', 'imagefilledrectangle', 'imagejpeg', 'imagedestroy', 'imageftbbox');
44
+			foreach ($required_functions as $func) {
45
+				if (!function_exists($func)) {
46
+					$this->mode = 'bmp';
47
+					break;
48
+				}
49
+			}
50
+		}
51
+	}
52
+
53
+	/**
54
+	 * Loading configs from CAPTCHA class
55
+	 * @param array $config
56
+	 */
57
+	public function setConfig($config = array())
58
+	{
59
+		// Loading default preferences
60
+		$this->config = $config;
61
+	}
62
+
63
+	public function loadImage()
64
+	{
65
+		$this->createCode();
66
+		$this->setCode();
67
+		$this->createImage();
68
+	}
69
+
70
+	/**
71
+	 * Create Code
72
+	 */
73
+	public function createCode()
74
+	{
75
+		if ($this->invalid) {
76
+			return;
77
+		}
78
+
79
+		if ($this->mode === 'bmp') {
80
+			$this->config['num_chars'] = 4;
81
+			$this->code                = mt_rand(pow(10, $this->config['num_chars'] - 1), (int)str_pad('9', $this->config['num_chars'], '9'));
82
+		} else {
83
+			$this->code = substr(md5(uniqid(mt_rand(), 1)), 0, $this->config['num_chars']);
84
+			if (!$this->config['casesensitive']) {
85
+				$this->code = strtoupper($this->code);
86
+			}
87
+		}
88
+	}
89
+
90
+	public function setCode()
91
+	{
92
+		if ($this->invalid) {
93
+			return;
94
+		}
95
+
96
+		$_SESSION['XoopsCaptcha_sessioncode'] = (string)$this->code;
97
+		$maxAttempts                          = (int)(@$_SESSION['XoopsCaptcha_maxattempts']);
98
+
99
+		// Increase the attempt records on refresh
100
+		if (!empty($maxAttempts)) {
101
+			$_SESSION['XoopsCaptcha_attempt_' . $_SESSION['XoopsCaptcha_name']]++;
102
+			if ($_SESSION['XoopsCaptcha_attempt_' . $_SESSION['XoopsCaptcha_name']] > $maxAttempts) {
103
+				$this->invalid = true;
104
+			}
105
+		}
106
+	}
107
+
108
+	/**
109
+	 * @param  string      $file
110
+	 * @return string|void
111
+	 */
112
+	public function createImage($file = '')
113
+	{
114
+		if ($this->invalid) {
115
+			header('Content-type: image/gif');
116
+			readfile(XOOPS_ROOT_PATH . '/images/subject/icon2.gif');
117
+
118
+			return;
119
+		}
120
+
121
+		if ($this->mode === 'bmp') {
122
+			return $this->createImageBmp();
123
+		} else {
124
+			return $this->createImageGd();
125
+		}
126
+	}
127
+
128
+	/**
129
+	 *  Create CAPTCHA iamge with GD
130
+	 *  Originated from DuGris' SecurityImage
131
+	 * @param string $file
132
+	 */
133
+	//  --------------------------------------------------------------------------- //
134
+	// Class: SecurityImage 1.5                                                    //
135
+	// Author: DuGris aka L. Jen <http://www.dugris.info>                           //
136
+	// Email: [email protected]                                                    //
137
+	// Licence: GNU                                                                 //
138
+	// Project: XOOPS Project                                                   //
139
+	//  --------------------------------------------------------------------------- //
140
+	public function createImageGd($file = '')
141
+	{
142
+		$this->loadFont();
143
+		$this->setImageSize();
144
+
145
+		$this->oImage = imagecreatetruecolor($this->width, $this->height);
146
+		$background   = imagecolorallocate($this->oImage, 255, 255, 255);
147
+		imagefilledrectangle($this->oImage, 0, 0, $this->width, $this->height, $background);
148
+
149
+		switch ($this->config['background_type']) {
150
+			default:
151
+			case 0:
152
+				$this->drawBars();
153
+				break;
154
+
155
+			case 1:
156
+				$this->drawCircles();
157
+				break;
158
+
159
+			case 2:
160
+				$this->drawLines();
161
+				break;
162
+
163
+			case 3:
164
+				$this->drawRectangles();
165
+				break;
166
+
167
+			case 4:
168
+				$this->drawEllipses();
169
+				break;
170
+
171
+			case 5:
172
+				$this->drawPolygons();
173
+				break;
174
+
175
+			case 100:
176
+				$this->createFromFile();
177
+				break;
178
+		}
179
+		$this->drawBorder();
180
+		$this->drawCode();
181
+
182
+		if (empty($file)) {
183
+			header('Content-type: image/jpeg');
184
+			imagejpeg($this->oImage);
185
+		} else {
186
+			imagejpeg($this->oImage, XOOPS_ROOT_PATH . '/' . $this->config['imagepath'] . '/' . $file . '.jpg');
187
+		}
188
+		imagedestroy($this->oImage);
189
+	}
190
+
191
+	/**
192
+	 * @param         $name
193
+	 * @param  string $extension
194
+	 * @return array
195
+	 */
196
+	public function _getList($name, $extension = '')
197
+	{
198
+		$items = array();
199
+		/*
200 200
          if (@ include_once XOOPS_ROOT_PATH."/Frameworks/art/functions.ini.php") {
201 201
          load_functions("cache");
202 202
          if ($items = mod_loadCacheFile("captcha_{$name}", "captcha")) {
@@ -204,231 +204,231 @@  discard block
 block discarded – undo
204 204
          }
205 205
          }
206 206
          */
207
-        require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
208
-        $file_path = $this->config['rootpath'] . "/{$name}";
209
-        $files     = XoopsLists::getFileListAsArray($file_path);
210
-        foreach ($files as $item) {
211
-            if (empty($extension) || preg_match("/(\.{$extension})$/i", $item)) {
212
-                $items[] = $item;
213
-            }
214
-        }
215
-        if (function_exists('mod_createCacheFile')) {
216
-            mod_createCacheFile($items, "captcha_{$name}", 'captcha');
217
-        }
218
-
219
-        return $items;
220
-    }
221
-
222
-    public function loadFont()
223
-    {
224
-        $fonts      = $this->_getList('fonts', 'ttf');
225
-        $this->font = $this->config['rootpath'] . '/fonts/' . $fonts[array_rand($fonts)];
226
-    }
227
-
228
-    public function setImageSize()
229
-    {
230
-        $MaxCharWidth  = 0;
231
-        $MaxCharHeight = 0;
232
-        $oImage        = imagecreatetruecolor(100, 100);
233
-        $text_color    = imagecolorallocate($oImage, mt_rand(0, 100), mt_rand(0, 100), mt_rand(0, 100));
234
-        $FontSize      = $this->config['fontsize_max'];
235
-        for ($Angle = -30; $Angle <= 30; ++$Angle) {
236
-            for ($i = 65; $i <= 90; ++$i) {
237
-                $CharDetails   = imageftbbox($FontSize, $Angle, $this->font, chr($i), array());
238
-                $_MaxCharWidth = abs($CharDetails[0] + $CharDetails[2]);
239
-                if ($_MaxCharWidth > $MaxCharWidth) {
240
-                    $MaxCharWidth = $_MaxCharWidth;
241
-                }
242
-                $_MaxCharHeight = abs($CharDetails[1] + $CharDetails[5]);
243
-                if ($_MaxCharHeight > $MaxCharHeight) {
244
-                    $MaxCharHeight = $_MaxCharHeight;
245
-                }
246
-            }
247
-        }
248
-        imagedestroy($oImage);
249
-
250
-        $this->height  = $MaxCharHeight + 2;
251
-        $this->spacing = (int)(($this->config['num_chars'] * $MaxCharWidth) / $this->config['num_chars']);
252
-        $this->width   = ($this->config['num_chars'] * $MaxCharWidth) + ($this->spacing / 2);
253
-    }
254
-
255
-    /**
256
-     * Return random background
257
-     *
258
-     * @return array
259
-     */
260
-    public function loadBackground()
261
-    {
262
-        $RandBackground = null;
263
-        if ($backgrounds = $this->_getList('backgrounds', '(gif|jpg|png)')) {
264
-            $RandBackground = $this->config['rootpath'] . '/backgrounds/' . $backgrounds[array_rand($backgrounds)];
265
-        }
266
-
267
-        return $RandBackground;
268
-    }
269
-
270
-    /**
271
-     * Draw Image background
272
-     */
273
-    public function createFromFile()
274
-    {
275
-        if ($RandImage = $this->loadBackground()) {
276
-            $ImageType = @getimagesize($RandImage);
277
-            switch (@$ImageType[2]) {
278
-                case 1:
279
-                    $BackgroundImage = imagecreatefromgif($RandImage);
280
-                    break;
281
-
282
-                case 2:
283
-                    $BackgroundImage = imagecreatefromjpeg($RandImage);
284
-                    break;
285
-
286
-                case 3:
287
-                    $BackgroundImage = imagecreatefrompng($RandImage);
288
-                    break;
289
-            }
290
-        }
291
-        if (!empty($BackgroundImage)) {
292
-            imagecopyresized($this->oImage, $BackgroundImage, 0, 0, 0, 0, imagesx($this->oImage), imagesy($this->oImage), imagesx($BackgroundImage), imagesy($BackgroundImage));
293
-            imagedestroy($BackgroundImage);
294
-        } else {
295
-            $this->drawBars();
296
-        }
297
-    }
298
-
299
-    /**
300
-     * Draw Code
301
-     */
302
-    public function drawCode()
303
-    {
304
-        for ($i = 0; $i < $this->config['num_chars']; ++$i) {
305
-            // select random greyscale colour
306
-            $text_color = imagecolorallocate($this->oImage, mt_rand(0, 100), mt_rand(0, 100), mt_rand(0, 100));
307
-
308
-            // write text to image
309
-            $Angle = mt_rand(10, 30);
310
-            if ($i % 2) {
311
-                $Angle = mt_rand(-10, -30);
312
-            }
313
-
314
-            // select random font size
315
-            $FontSize = mt_rand($this->config['fontsize_min'], $this->config['fontsize_max']);
316
-
317
-            $CharDetails = imageftbbox($FontSize, $Angle, $this->font, $this->code[$i], array());
318
-            $CharHeight  = abs($CharDetails[1] + $CharDetails[5]);
319
-
320
-            // calculate character starting coordinates
321
-            $posX = ($this->spacing / 2) + ($i * $this->spacing);
322
-            $posY = 2 + ($this->height / 2) + ($CharHeight / 4);
323
-
324
-            imagefttext($this->oImage, $FontSize, $Angle, $posX, $posY, $text_color, $this->font, $this->code[$i], array());
325
-        }
326
-    }
327
-
328
-    /**
329
-     * Draw Border
330
-     */
331
-    public function drawBorder()
332
-    {
333
-        $rgb          = mt_rand(50, 150);
334
-        $border_color = imagecolorallocate($this->oImage, $rgb, $rgb, $rgb);
335
-        imagerectangle($this->oImage, 0, 0, $this->width - 1, $this->height - 1, $border_color);
336
-    }
337
-
338
-    /**
339
-     * Draw Circles background
340
-     */
341
-    public function drawCircles()
342
-    {
343
-        for ($i = 1; $i <= $this->config['background_num']; ++$i) {
344
-            $randomcolor = imagecolorallocate($this->oImage, mt_rand(190, 255), mt_rand(190, 255), mt_rand(190, 255));
345
-            imagefilledellipse($this->oImage, mt_rand(0, $this->width - 10), mt_rand(0, $this->height - 3), mt_rand(10, 20), mt_rand(20, 30), $randomcolor);
346
-        }
347
-    }
348
-
349
-    /**
350
-     * Draw Lines background
351
-     */
352
-    public function drawLines()
353
-    {
354
-        for ($i = 0; $i < $this->config['background_num']; ++$i) {
355
-            $randomcolor = imagecolorallocate($this->oImage, mt_rand(190, 255), mt_rand(190, 255), mt_rand(190, 255));
356
-            imageline($this->oImage, mt_rand(0, $this->width), mt_rand(0, $this->height), mt_rand(0, $this->width), mt_rand(0, $this->height), $randomcolor);
357
-        }
358
-    }
359
-
360
-    /**
361
-     * Draw Rectangles background
362
-     */
363
-    public function drawRectangles()
364
-    {
365
-        for ($i = 1; $i <= $this->config['background_num']; ++$i) {
366
-            $randomcolor = imagecolorallocate($this->oImage, mt_rand(190, 255), mt_rand(190, 255), mt_rand(190, 255));
367
-            imagefilledrectangle($this->oImage, mt_rand(0, $this->width), mt_rand(0, $this->height), mt_rand(0, $this->width), mt_rand(0, $this->height), $randomcolor);
368
-        }
369
-    }
370
-
371
-    /**
372
-     * Draw Bars background
373
-     */
374
-    public function drawBars()
375
-    {
376
-        for ($i = 0; $i <= $this->height;) {
377
-            $randomcolor = imagecolorallocate($this->oImage, mt_rand(190, 255), mt_rand(190, 255), mt_rand(190, 255));
378
-            imageline($this->oImage, 0, $i, $this->width, $i, $randomcolor);
379
-            $i += 2.5;
380
-        }
381
-        for ($i = 0; $i <= $this->width;) {
382
-            $randomcolor = imagecolorallocate($this->oImage, mt_rand(190, 255), mt_rand(190, 255), mt_rand(190, 255));
383
-            imageline($this->oImage, $i, 0, $i, $this->height, $randomcolor);
384
-            $i += 2.5;
385
-        }
386
-    }
387
-
388
-    /**
389
-     * Draw Ellipses background
390
-     */
391
-    public function drawEllipses()
392
-    {
393
-        for ($i = 1; $i <= $this->config['background_num']; ++$i) {
394
-            $randomcolor = imagecolorallocate($this->oImage, mt_rand(190, 255), mt_rand(190, 255), mt_rand(190, 255));
395
-            imageellipse($this->oImage, mt_rand(0, $this->width), mt_rand(0, $this->height), mt_rand(0, $this->width), mt_rand(0, $this->height), $randomcolor);
396
-        }
397
-    }
398
-
399
-    /**
400
-     * Draw polygons background
401
-     */
402
-    public function drawPolygons()
403
-    {
404
-        for ($i = 1; $i <= $this->config['background_num']; ++$i) {
405
-            $randomcolor = imagecolorallocate($this->oImage, mt_rand(190, 255), mt_rand(190, 255), mt_rand(190, 255));
406
-            $coords      = array();
407
-            for ($j = 1; $j <= $this->config['polygon_point']; ++$j) {
408
-                $coords[] = mt_rand(0, $this->width);
409
-                $coords[] = mt_rand(0, $this->height);
410
-            }
411
-            imagefilledpolygon($this->oImage, $coords, $this->config['polygon_point'], $randomcolor);
412
-        }
413
-    }
414
-
415
-    /**
416
-     *  Create CAPTCHA iamge with BMP
417
-     *  TODO
418
-     * @param  string $file
419
-     * @return string
420
-     */
421
-    public function createImageBmp($file = '')
422
-    {
423
-        $image = '';
424
-
425
-        if (empty($file)) {
426
-            header('Content-type: image/bmp');
427
-            echo $image;
428
-        } else {
429
-            return $image;
430
-        }
431
-    }
207
+		require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
208
+		$file_path = $this->config['rootpath'] . "/{$name}";
209
+		$files     = XoopsLists::getFileListAsArray($file_path);
210
+		foreach ($files as $item) {
211
+			if (empty($extension) || preg_match("/(\.{$extension})$/i", $item)) {
212
+				$items[] = $item;
213
+			}
214
+		}
215
+		if (function_exists('mod_createCacheFile')) {
216
+			mod_createCacheFile($items, "captcha_{$name}", 'captcha');
217
+		}
218
+
219
+		return $items;
220
+	}
221
+
222
+	public function loadFont()
223
+	{
224
+		$fonts      = $this->_getList('fonts', 'ttf');
225
+		$this->font = $this->config['rootpath'] . '/fonts/' . $fonts[array_rand($fonts)];
226
+	}
227
+
228
+	public function setImageSize()
229
+	{
230
+		$MaxCharWidth  = 0;
231
+		$MaxCharHeight = 0;
232
+		$oImage        = imagecreatetruecolor(100, 100);
233
+		$text_color    = imagecolorallocate($oImage, mt_rand(0, 100), mt_rand(0, 100), mt_rand(0, 100));
234
+		$FontSize      = $this->config['fontsize_max'];
235
+		for ($Angle = -30; $Angle <= 30; ++$Angle) {
236
+			for ($i = 65; $i <= 90; ++$i) {
237
+				$CharDetails   = imageftbbox($FontSize, $Angle, $this->font, chr($i), array());
238
+				$_MaxCharWidth = abs($CharDetails[0] + $CharDetails[2]);
239
+				if ($_MaxCharWidth > $MaxCharWidth) {
240
+					$MaxCharWidth = $_MaxCharWidth;
241
+				}
242
+				$_MaxCharHeight = abs($CharDetails[1] + $CharDetails[5]);
243
+				if ($_MaxCharHeight > $MaxCharHeight) {
244
+					$MaxCharHeight = $_MaxCharHeight;
245
+				}
246
+			}
247
+		}
248
+		imagedestroy($oImage);
249
+
250
+		$this->height  = $MaxCharHeight + 2;
251
+		$this->spacing = (int)(($this->config['num_chars'] * $MaxCharWidth) / $this->config['num_chars']);
252
+		$this->width   = ($this->config['num_chars'] * $MaxCharWidth) + ($this->spacing / 2);
253
+	}
254
+
255
+	/**
256
+	 * Return random background
257
+	 *
258
+	 * @return array
259
+	 */
260
+	public function loadBackground()
261
+	{
262
+		$RandBackground = null;
263
+		if ($backgrounds = $this->_getList('backgrounds', '(gif|jpg|png)')) {
264
+			$RandBackground = $this->config['rootpath'] . '/backgrounds/' . $backgrounds[array_rand($backgrounds)];
265
+		}
266
+
267
+		return $RandBackground;
268
+	}
269
+
270
+	/**
271
+	 * Draw Image background
272
+	 */
273
+	public function createFromFile()
274
+	{
275
+		if ($RandImage = $this->loadBackground()) {
276
+			$ImageType = @getimagesize($RandImage);
277
+			switch (@$ImageType[2]) {
278
+				case 1:
279
+					$BackgroundImage = imagecreatefromgif($RandImage);
280
+					break;
281
+
282
+				case 2:
283
+					$BackgroundImage = imagecreatefromjpeg($RandImage);
284
+					break;
285
+
286
+				case 3:
287
+					$BackgroundImage = imagecreatefrompng($RandImage);
288
+					break;
289
+			}
290
+		}
291
+		if (!empty($BackgroundImage)) {
292
+			imagecopyresized($this->oImage, $BackgroundImage, 0, 0, 0, 0, imagesx($this->oImage), imagesy($this->oImage), imagesx($BackgroundImage), imagesy($BackgroundImage));
293
+			imagedestroy($BackgroundImage);
294
+		} else {
295
+			$this->drawBars();
296
+		}
297
+	}
298
+
299
+	/**
300
+	 * Draw Code
301
+	 */
302
+	public function drawCode()
303
+	{
304
+		for ($i = 0; $i < $this->config['num_chars']; ++$i) {
305
+			// select random greyscale colour
306
+			$text_color = imagecolorallocate($this->oImage, mt_rand(0, 100), mt_rand(0, 100), mt_rand(0, 100));
307
+
308
+			// write text to image
309
+			$Angle = mt_rand(10, 30);
310
+			if ($i % 2) {
311
+				$Angle = mt_rand(-10, -30);
312
+			}
313
+
314
+			// select random font size
315
+			$FontSize = mt_rand($this->config['fontsize_min'], $this->config['fontsize_max']);
316
+
317
+			$CharDetails = imageftbbox($FontSize, $Angle, $this->font, $this->code[$i], array());
318
+			$CharHeight  = abs($CharDetails[1] + $CharDetails[5]);
319
+
320
+			// calculate character starting coordinates
321
+			$posX = ($this->spacing / 2) + ($i * $this->spacing);
322
+			$posY = 2 + ($this->height / 2) + ($CharHeight / 4);
323
+
324
+			imagefttext($this->oImage, $FontSize, $Angle, $posX, $posY, $text_color, $this->font, $this->code[$i], array());
325
+		}
326
+	}
327
+
328
+	/**
329
+	 * Draw Border
330
+	 */
331
+	public function drawBorder()
332
+	{
333
+		$rgb          = mt_rand(50, 150);
334
+		$border_color = imagecolorallocate($this->oImage, $rgb, $rgb, $rgb);
335
+		imagerectangle($this->oImage, 0, 0, $this->width - 1, $this->height - 1, $border_color);
336
+	}
337
+
338
+	/**
339
+	 * Draw Circles background
340
+	 */
341
+	public function drawCircles()
342
+	{
343
+		for ($i = 1; $i <= $this->config['background_num']; ++$i) {
344
+			$randomcolor = imagecolorallocate($this->oImage, mt_rand(190, 255), mt_rand(190, 255), mt_rand(190, 255));
345
+			imagefilledellipse($this->oImage, mt_rand(0, $this->width - 10), mt_rand(0, $this->height - 3), mt_rand(10, 20), mt_rand(20, 30), $randomcolor);
346
+		}
347
+	}
348
+
349
+	/**
350
+	 * Draw Lines background
351
+	 */
352
+	public function drawLines()
353
+	{
354
+		for ($i = 0; $i < $this->config['background_num']; ++$i) {
355
+			$randomcolor = imagecolorallocate($this->oImage, mt_rand(190, 255), mt_rand(190, 255), mt_rand(190, 255));
356
+			imageline($this->oImage, mt_rand(0, $this->width), mt_rand(0, $this->height), mt_rand(0, $this->width), mt_rand(0, $this->height), $randomcolor);
357
+		}
358
+	}
359
+
360
+	/**
361
+	 * Draw Rectangles background
362
+	 */
363
+	public function drawRectangles()
364
+	{
365
+		for ($i = 1; $i <= $this->config['background_num']; ++$i) {
366
+			$randomcolor = imagecolorallocate($this->oImage, mt_rand(190, 255), mt_rand(190, 255), mt_rand(190, 255));
367
+			imagefilledrectangle($this->oImage, mt_rand(0, $this->width), mt_rand(0, $this->height), mt_rand(0, $this->width), mt_rand(0, $this->height), $randomcolor);
368
+		}
369
+	}
370
+
371
+	/**
372
+	 * Draw Bars background
373
+	 */
374
+	public function drawBars()
375
+	{
376
+		for ($i = 0; $i <= $this->height;) {
377
+			$randomcolor = imagecolorallocate($this->oImage, mt_rand(190, 255), mt_rand(190, 255), mt_rand(190, 255));
378
+			imageline($this->oImage, 0, $i, $this->width, $i, $randomcolor);
379
+			$i += 2.5;
380
+		}
381
+		for ($i = 0; $i <= $this->width;) {
382
+			$randomcolor = imagecolorallocate($this->oImage, mt_rand(190, 255), mt_rand(190, 255), mt_rand(190, 255));
383
+			imageline($this->oImage, $i, 0, $i, $this->height, $randomcolor);
384
+			$i += 2.5;
385
+		}
386
+	}
387
+
388
+	/**
389
+	 * Draw Ellipses background
390
+	 */
391
+	public function drawEllipses()
392
+	{
393
+		for ($i = 1; $i <= $this->config['background_num']; ++$i) {
394
+			$randomcolor = imagecolorallocate($this->oImage, mt_rand(190, 255), mt_rand(190, 255), mt_rand(190, 255));
395
+			imageellipse($this->oImage, mt_rand(0, $this->width), mt_rand(0, $this->height), mt_rand(0, $this->width), mt_rand(0, $this->height), $randomcolor);
396
+		}
397
+	}
398
+
399
+	/**
400
+	 * Draw polygons background
401
+	 */
402
+	public function drawPolygons()
403
+	{
404
+		for ($i = 1; $i <= $this->config['background_num']; ++$i) {
405
+			$randomcolor = imagecolorallocate($this->oImage, mt_rand(190, 255), mt_rand(190, 255), mt_rand(190, 255));
406
+			$coords      = array();
407
+			for ($j = 1; $j <= $this->config['polygon_point']; ++$j) {
408
+				$coords[] = mt_rand(0, $this->width);
409
+				$coords[] = mt_rand(0, $this->height);
410
+			}
411
+			imagefilledpolygon($this->oImage, $coords, $this->config['polygon_point'], $randomcolor);
412
+		}
413
+	}
414
+
415
+	/**
416
+	 *  Create CAPTCHA iamge with BMP
417
+	 *  TODO
418
+	 * @param  string $file
419
+	 * @return string
420
+	 */
421
+	public function createImageBmp($file = '')
422
+	{
423
+		$image = '';
424
+
425
+		if (empty($file)) {
426
+			header('Content-type: image/bmp');
427
+			echo $image;
428
+		} else {
429
+			return $image;
430
+		}
431
+	}
432 432
 }
433 433
 
434 434
 $config       = @include dirname(__DIR__) . '/config.php';
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@  discard block
 block discarded – undo
5 5
  * D.J.
6 6
  */
7 7
 
8
-include dirname(dirname(dirname(dirname(dirname(__DIR__))))) . '/mainfile.php';
8
+include dirname(dirname(dirname(dirname(dirname(__DIR__))))).'/mainfile.php';
9 9
 error_reporting(0);
10 10
 $xoopsLogger->activated = false;
11 11
 
12
-if (empty($_SERVER['HTTP_REFERER']) || !preg_match('/^' . preg_quote(XOOPS_URL, '/') . '/', $_SERVER['HTTP_REFERER'])) {
12
+if (empty($_SERVER['HTTP_REFERER']) || !preg_match('/^'.preg_quote(XOOPS_URL, '/').'/', $_SERVER['HTTP_REFERER'])) {
13 13
     exit();
14 14
 }
15 15
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
         if ($this->mode === 'bmp') {
80 80
             $this->config['num_chars'] = 4;
81
-            $this->code                = mt_rand(pow(10, $this->config['num_chars'] - 1), (int)str_pad('9', $this->config['num_chars'], '9'));
81
+            $this->code                = mt_rand(pow(10, $this->config['num_chars'] - 1), (int) str_pad('9', $this->config['num_chars'], '9'));
82 82
         } else {
83 83
             $this->code = substr(md5(uniqid(mt_rand(), 1)), 0, $this->config['num_chars']);
84 84
             if (!$this->config['casesensitive']) {
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
             return;
94 94
         }
95 95
 
96
-        $_SESSION['XoopsCaptcha_sessioncode'] = (string)$this->code;
97
-        $maxAttempts                          = (int)(@$_SESSION['XoopsCaptcha_maxattempts']);
96
+        $_SESSION['XoopsCaptcha_sessioncode'] = (string) $this->code;
97
+        $maxAttempts                          = (int) (@$_SESSION['XoopsCaptcha_maxattempts']);
98 98
 
99 99
         // Increase the attempt records on refresh
100 100
         if (!empty($maxAttempts)) {
101
-            $_SESSION['XoopsCaptcha_attempt_' . $_SESSION['XoopsCaptcha_name']]++;
102
-            if ($_SESSION['XoopsCaptcha_attempt_' . $_SESSION['XoopsCaptcha_name']] > $maxAttempts) {
101
+            $_SESSION['XoopsCaptcha_attempt_'.$_SESSION['XoopsCaptcha_name']]++;
102
+            if ($_SESSION['XoopsCaptcha_attempt_'.$_SESSION['XoopsCaptcha_name']] > $maxAttempts) {
103 103
                 $this->invalid = true;
104 104
             }
105 105
         }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     {
114 114
         if ($this->invalid) {
115 115
             header('Content-type: image/gif');
116
-            readfile(XOOPS_ROOT_PATH . '/images/subject/icon2.gif');
116
+            readfile(XOOPS_ROOT_PATH.'/images/subject/icon2.gif');
117 117
 
118 118
             return;
119 119
         }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
             header('Content-type: image/jpeg');
184 184
             imagejpeg($this->oImage);
185 185
         } else {
186
-            imagejpeg($this->oImage, XOOPS_ROOT_PATH . '/' . $this->config['imagepath'] . '/' . $file . '.jpg');
186
+            imagejpeg($this->oImage, XOOPS_ROOT_PATH.'/'.$this->config['imagepath'].'/'.$file.'.jpg');
187 187
         }
188 188
         imagedestroy($this->oImage);
189 189
     }
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
          }
205 205
          }
206 206
          */
207
-        require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
208
-        $file_path = $this->config['rootpath'] . "/{$name}";
207
+        require_once XOOPS_ROOT_PATH.'/class/xoopslists.php';
208
+        $file_path = $this->config['rootpath']."/{$name}";
209 209
         $files     = XoopsLists::getFileListAsArray($file_path);
210 210
         foreach ($files as $item) {
211 211
             if (empty($extension) || preg_match("/(\.{$extension})$/i", $item)) {
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
     public function loadFont()
223 223
     {
224 224
         $fonts      = $this->_getList('fonts', 'ttf');
225
-        $this->font = $this->config['rootpath'] . '/fonts/' . $fonts[array_rand($fonts)];
225
+        $this->font = $this->config['rootpath'].'/fonts/'.$fonts[array_rand($fonts)];
226 226
     }
227 227
 
228 228
     public function setImageSize()
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         imagedestroy($oImage);
249 249
 
250 250
         $this->height  = $MaxCharHeight + 2;
251
-        $this->spacing = (int)(($this->config['num_chars'] * $MaxCharWidth) / $this->config['num_chars']);
251
+        $this->spacing = (int) (($this->config['num_chars'] * $MaxCharWidth) / $this->config['num_chars']);
252 252
         $this->width   = ($this->config['num_chars'] * $MaxCharWidth) + ($this->spacing / 2);
253 253
     }
254 254
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     {
262 262
         $RandBackground = null;
263 263
         if ($backgrounds = $this->_getList('backgrounds', '(gif|jpg|png)')) {
264
-            $RandBackground = $this->config['rootpath'] . '/backgrounds/' . $backgrounds[array_rand($backgrounds)];
264
+            $RandBackground = $this->config['rootpath'].'/backgrounds/'.$backgrounds[array_rand($backgrounds)];
265 265
         }
266 266
 
267 267
         return $RandBackground;
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
     }
432 432
 }
433 433
 
434
-$config       = @include dirname(__DIR__) . '/config.php';
434
+$config       = @include dirname(__DIR__).'/config.php';
435 435
 $imageHandler = new XoopsCaptchaImageHandler();
436 436
 $imageHandler->setConfig($config);
437 437
 $imageHandler->loadImage();
Please login to merge, or discard this patch.
include/projax/classes/JavaScript.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     /**
29 29
      * @param $javascript
30
-     * @return mixed|string
30
+     * @return string
31 31
      */
32 32
     public function escape($javascript)
33 33
     {
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
     /**
50 50
      * @param       $name
51
-     * @param       $function
51
+     * @param       string $function
52 52
      * @param  null $html_options
53 53
      * @return string
54 54
      */
Please login to merge, or discard this patch.
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -15,90 +15,90 @@
 block discarded – undo
15 15
  */
16 16
 class JavaScript
17 17
 {
18
-    /**
19
-     * @param       $name
20
-     * @param  null $function
21
-     * @return string
22
-     */
23
-    public function button_to_function($name, $function = null)
24
-    {
25
-        return '<input type="button" value="' . $name . '" onclick="' . $function . '" />';
26
-    }
18
+	/**
19
+	 * @param       $name
20
+	 * @param  null $function
21
+	 * @return string
22
+	 */
23
+	public function button_to_function($name, $function = null)
24
+	{
25
+		return '<input type="button" value="' . $name . '" onclick="' . $function . '" />';
26
+	}
27 27
 
28
-    /**
29
-     * @param $javascript
30
-     * @return mixed|string
31
-     */
32
-    public function escape($javascript)
33
-    {
34
-        $javascript = addslashes($javascript);
35
-        $javascript = str_replace(array("\r\n", "\n", "\r"), array("\n"), $javascript);
28
+	/**
29
+	 * @param $javascript
30
+	 * @return mixed|string
31
+	 */
32
+	public function escape($javascript)
33
+	{
34
+		$javascript = addslashes($javascript);
35
+		$javascript = str_replace(array("\r\n", "\n", "\r"), array("\n"), $javascript);
36 36
 
37
-        return $javascript;
38
-    }
37
+		return $javascript;
38
+	}
39 39
 
40
-    /**
41
-     * @param $content
42
-     * @return string
43
-     */
44
-    public function tag($content)
45
-    {
46
-        return '<script type="text/javascript">' . $content . '</script>';
47
-    }
40
+	/**
41
+	 * @param $content
42
+	 * @return string
43
+	 */
44
+	public function tag($content)
45
+	{
46
+		return '<script type="text/javascript">' . $content . '</script>';
47
+	}
48 48
 
49
-    /**
50
-     * @param       $name
51
-     * @param       $function
52
-     * @param  null $html_options
53
-     * @return string
54
-     */
55
-    public function link_to_function($name, $function, $html_options = null)
56
-    {
57
-        return '<a href="' . (isset($html_options['href']) ? $html_options['href'] : '#') . '" onclick="' . (isset($html_options['onclick']) ? $html_options['onclick'] . ';' : '') . $function . '; return false;" />' . $name . '</a>';
58
-    }
49
+	/**
50
+	 * @param       $name
51
+	 * @param       $function
52
+	 * @param  null $html_options
53
+	 * @return string
54
+	 */
55
+	public function link_to_function($name, $function, $html_options = null)
56
+	{
57
+		return '<a href="' . (isset($html_options['href']) ? $html_options['href'] : '#') . '" onclick="' . (isset($html_options['onclick']) ? $html_options['onclick'] . ';' : '') . $function . '; return false;" />' . $name . '</a>';
58
+	}
59 59
 
60
-    /////////////////////////////////////////////////////////////////////////////////////
61
-    //                             Private functions
62
-    /////////////////////////////////////////////////////////////////////////////////////
60
+	/////////////////////////////////////////////////////////////////////////////////////
61
+	//                             Private functions
62
+	/////////////////////////////////////////////////////////////////////////////////////
63 63
 
64
-    /**
65
-     * @param $option
66
-     * @return string
67
-     */
68
-    public function _array_or_string_for_javascript($option)
69
-    {
70
-        $return_val = '';
71
-        if (is_array($option)) {
72
-            foreach ($option as $value) {
73
-                if (!empty($return_val)) {
74
-                    $ret_val .= ', ';
75
-                }
76
-                $return_val .= $value;
77
-            }
64
+	/**
65
+	 * @param $option
66
+	 * @return string
67
+	 */
68
+	public function _array_or_string_for_javascript($option)
69
+	{
70
+		$return_val = '';
71
+		if (is_array($option)) {
72
+			foreach ($option as $value) {
73
+				if (!empty($return_val)) {
74
+					$ret_val .= ', ';
75
+				}
76
+				$return_val .= $value;
77
+			}
78 78
 
79
-            return '[' . $return_val . ']';
80
-        }
79
+			return '[' . $return_val . ']';
80
+		}
81 81
 
82
-        return "'$option'";
83
-    }
82
+		return "'$option'";
83
+	}
84 84
 
85
-    /**
86
-     * @param $options
87
-     * @return string
88
-     */
89
-    public function _options_for_javascript($options)
90
-    {
91
-        $return_val = '';
85
+	/**
86
+	 * @param $options
87
+	 * @return string
88
+	 */
89
+	public function _options_for_javascript($options)
90
+	{
91
+		$return_val = '';
92 92
 
93
-        if (is_array($options)) {
94
-            foreach ($options as $var => $val) {
95
-                if (!empty($return_val)) {
96
-                    $return_val .= ', ';
97
-                }
98
-                $return_val .= "$var:$val";
99
-            }
100
-        }
93
+		if (is_array($options)) {
94
+			foreach ($options as $var => $val) {
95
+				if (!empty($return_val)) {
96
+					$return_val .= ', ';
97
+				}
98
+				$return_val .= "$var:$val";
99
+			}
100
+		}
101 101
 
102
-        return '{' . $return_val . '}';
103
-    }
102
+		return '{' . $return_val . '}';
103
+	}
104 104
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function button_to_function($name, $function = null)
24 24
     {
25
-        return '<input type="button" value="' . $name . '" onclick="' . $function . '" />';
25
+        return '<input type="button" value="'.$name.'" onclick="'.$function.'" />';
26 26
     }
27 27
 
28 28
     /**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function tag($content)
45 45
     {
46
-        return '<script type="text/javascript">' . $content . '</script>';
46
+        return '<script type="text/javascript">'.$content.'</script>';
47 47
     }
48 48
 
49 49
     /**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function link_to_function($name, $function, $html_options = null)
56 56
     {
57
-        return '<a href="' . (isset($html_options['href']) ? $html_options['href'] : '#') . '" onclick="' . (isset($html_options['onclick']) ? $html_options['onclick'] . ';' : '') . $function . '; return false;" />' . $name . '</a>';
57
+        return '<a href="'.(isset($html_options['href']) ? $html_options['href'] : '#').'" onclick="'.(isset($html_options['onclick']) ? $html_options['onclick'].';' : '').$function.'; return false;" />'.$name.'</a>';
58 58
     }
59 59
 
60 60
     /////////////////////////////////////////////////////////////////////////////////////
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
                 $return_val .= $value;
77 77
             }
78 78
 
79
-            return '[' . $return_val . ']';
79
+            return '['.$return_val.']';
80 80
         }
81 81
 
82 82
         return "'$option'";
@@ -99,6 +99,6 @@  discard block
 block discarded – undo
99 99
             }
100 100
         }
101 101
 
102
-        return '{' . $return_val . '}';
102
+        return '{'.$return_val.'}';
103 103
     }
104 104
 }
Please login to merge, or discard this patch.
include/projax/classes/Prototype.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     }
213 213
 
214 214
     /**
215
-     * @param       $klass
215
+     * @param       string $klass
216 216
      * @param       $name
217 217
      * @param  null $options
218 218
      * @return string
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
     }
312 312
 
313 313
     /**
314
-     * @param $variable
314
+     * @param string $variable
315 315
      * @param $value
316 316
      * @return string
317 317
      */
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
     }
322 322
 
323 323
     /**
324
-     * @param       $function
324
+     * @param       string $function
325 325
      * @param  null $args
326 326
      * @return string
327 327
      */
Please login to merge, or discard this patch.
Indentation   +448 added lines, -448 removed lines patch added patch discarded remove patch
@@ -15,452 +15,452 @@
 block discarded – undo
15 15
  */
16 16
 class Prototype extends JavaScript
17 17
 {
18
-    public $CALLBACKS = array(
19
-        'uninitialized',
20
-        'loading',
21
-        'loaded',
22
-        'interactive',
23
-        'complete',
24
-        'failure',
25
-        'success'
26
-    );
27
-
28
-    public $AJAX_OPTIONS = array(
29
-        'before',
30
-        'after',
31
-        'condition',
32
-        'url',
33
-        'asynchronous',
34
-        'method',
35
-        'insertion',
36
-        'position',
37
-        'form',
38
-        'with',
39
-        'update',
40
-        'script',
41
-        'uninitialized',
42
-        'loading',
43
-        'loaded',
44
-        'interactive',
45
-        'complete',
46
-        'failure',
47
-        'success'
48
-    );
49
-
50
-    /**
51
-     * @return string
52
-     */
53
-    public function evaluate_remote_response()
54
-    {
55
-        return 'eval(request.responseText)';
56
-    }
57
-
58
-    /**
59
-     * @param $options
60
-     * @return string
61
-     */
62
-    public function form_remote_tag($options)
63
-    {
64
-        $options['form'] = true;
65
-
66
-        return '<form action="' . $options['url'] . '" onsubmit="' . $this->remote_function($options) . '; return false;" method="' . (isset($options['method']) ? $options['method'] : 'post') . '"  >';
67
-    }
68
-
69
-    /**
70
-     * @param       $name
71
-     * @param  null $options
72
-     * @param  null $html_options
73
-     * @return string
74
-     */
75
-    public function link_to_remote($name, $options = null, $html_options = null)
76
-    {
77
-        return $this->link_to_function($name, $this->remote_function($options), $html_options);
78
-    }
79
-
80
-    /**
81
-     * @param       $field_id
82
-     * @param  null $options
83
-     * @return string
84
-     */
85
-    public function observe_field($field_id, $options = null)
86
-    {
87
-        if (isset($options['frequency']) && $options['frequency'] > 0) {
88
-            return $this->_build_observer('Form.Element.Observer', $field_id, $options);
89
-        } else {
90
-            return $this->_build_observer('Form.Element.EventObserver', $field_id, $options);
91
-        }
92
-    }
93
-
94
-    /**
95
-     * @param       $form_id
96
-     * @param  null $options
97
-     * @return string
98
-     */
99
-    public function observe_form($form_id, $options = null)
100
-    {
101
-        if (isset($options['frequency'])) {
102
-            return $this->_build_observer('Form.Observer', $form_id, $options);
103
-        } else {
104
-            return $this->_build_observer('Form.EventObserver', $form_id, $options);
105
-        }
106
-    }
107
-
108
-    /**
109
-     * @param  null $options
110
-     * @return string
111
-     */
112
-    public function periodically_call_remote($options = null)
113
-    {
114
-        $frequency = isset($options['frequency']) ? $options['frequency'] : 10;
115
-        $code      = 'new PeriodicalExecuter(function() {' . $this->remote_function($options) . '},' . $frequency . ')';
116
-
117
-        return $code;
118
-    }
119
-
120
-    /**
121
-     * @param $options
122
-     * @return string
123
-     */
124
-    public function remote_function($options)
125
-    {
126
-        $javascript_options = $this->_options_for_ajax($options);
127
-
128
-        $update = '';
129
-
130
-        if (isset($options['update']) && is_array($options['update'])) {
131
-            $update = isset($options['update']['success']) ? 'success: ' . $options['update']['success'] : '';
132
-            $update .= empty($update) ? '' : ',';
133
-            $update .= isset($options['update']['failure']) ? 'failure: ' . $options['update']['failure'] : '';
134
-        } else {
135
-            $update .= isset($options['update']) ? $options['update'] : '';
136
-        }
137
-
138
-        $ajax_function = empty($update) ? 'new Ajax.Request(' : 'new Ajax.Updater(\'' . $update . '\',';
139
-
140
-        $ajax_function .= "'" . $options['url'] . "'";
141
-        $ajax_function .= ',' . $javascript_options . ')';
142
-
143
-        $ajax_function = isset($options['before']) ? $options['before'] . ';' . $ajax_function : $ajax_function;
144
-        $ajax_function = isset($options['after']) ? $ajax_function . ';' . $options['after'] : $ajax_function;
145
-        $ajax_function = isset($options['condition']) ? 'if (' . $options['condition'] . ') {' . $ajax_function . '}' : $ajax_function;
146
-        $ajax_function = isset($options['confirm']) ? 'if ( confirm(\'' . $options['confirm'] . '\' ) ) { ' . $ajax_function . ' } ' : $ajax_function;
147
-
148
-        return $ajax_function;
149
-    }
150
-
151
-    /**
152
-     * @param $name
153
-     * @param $value
154
-     * @param $options
155
-     * @return string
156
-     */
157
-    public function submit_to_remote($name, $value, $options)
158
-    {
159
-        if (isset($options['with'])) {
160
-            $options['with'] = 'Form.serialize(this.form)';
161
-        }
162
-
163
-        return '<input type="button" onclick="' . $this->remote_function($options) . '" name="' . $name . '" value ="' . $value . '" />';
164
-    }
165
-
166
-    /**
167
-     * @param      $element_id
168
-     * @param null $options
169
-     * @param      $block
170
-     */
171
-    public function update_element_function($element_id, $options = null, $block)
172
-    {
173
-        $content = isset($options['content']) ? $options['content'] : '';
174
-        $content = $this->escape($content);
175
-    }
176
-
177
-    /**
178
-     * @param $block
179
-     */
180
-    public function update_page($block)
181
-    {
182
-    }
183
-
184
-    /**
185
-     * @param $block
186
-     * @return string
187
-     */
188
-    public function update_page_tag(& $block)
189
-    {
190
-        return $this->tag($block);
191
-    }
192
-
193
-    /////////////////////////////////////////////////////////////////////////////////////
194
-    //                             Private functions
195
-    /////////////////////////////////////////////////////////////////////////////////////
196
-
197
-    /**
198
-     * @param $options
199
-     * @return array
200
-     */
201
-    public function _build_callbacks($options)
202
-    {
203
-        $callbacks = array();
204
-        foreach ($options as $callback => $code) {
205
-            if (in_array($callback, $this->CALLBACKS)) {
206
-                $name             = 'on' . ucfirst($callback);
207
-                $callbacks[$name] = 'function(request){' . $code . '}';
208
-            }
209
-        }
210
-
211
-        return $callbacks;
212
-    }
213
-
214
-    /**
215
-     * @param       $klass
216
-     * @param       $name
217
-     * @param  null $options
218
-     * @return string
219
-     */
220
-    public function _build_observer($klass, $name, $options = null)
221
-    {
222
-        if (isset($options['with']) && false === strpos($options['with'], '=')) {
223
-            $options['with'] = '\'' . $options['with'] . '=\' + value';
224
-        } elseif (isset($options['with']) && isset($options['update'])) {
225
-            $options['with'] = 'value';
226
-        }
227
-
228
-        $callback = $options['function'] ?: $this->remote_function($options);
229
-
230
-        $javascript = "new $klass('$name', ";
231
-        $javascript .= isset($options['frequency']) ? $options['frequency'] . ', ' : '';
232
-        $javascript .= 'function (element,value) { ';
233
-        $javascript .= $callback;
234
-        $javascript .= isset($options['on']) ? ', ' . $options['on'] : '';
235
-        $javascript .= '})';
236
-
237
-        return $javascript;
238
-    }
239
-
240
-    /**
241
-     * @param $method
242
-     * @return string
243
-     */
244
-    public function _method_option_to_s($method)
245
-    {
246
-        return strstr($method, "'") ? $method : "'$method'";
247
-    }
248
-
249
-    /**
250
-     * @param $options
251
-     * @return string
252
-     */
253
-    public function _options_for_ajax($options)
254
-    {
255
-        $js_options = is_array($options) ? $this->_build_callbacks($options) : array();
256
-
257
-        if (isset($options['type']) && $option['type'] === 'synchronous') {
258
-            $js_options['asynchronous'] = 'false';
259
-        }
260
-
261
-        if (isset($options['method'])) {
262
-            $js_options['method'] = $this->_method_option_to_s($options['method']);
263
-        }
264
-
265
-        if (isset($options['position'])) {
266
-            $js_options['insertion'] = 'Insertion.' . ucfirst($options['position']);
267
-        }
268
-
269
-        $js_options['evalScripts'] = isset($options['script']) ? $options['script'] : 'true';
270
-
271
-        if (isset($options['form'])) {
272
-            $js_options['parameters'] = 'Form.serialize(this)';
273
-        } elseif (isset($options['parameters'])) {
274
-            $js_options['parameters'] = 'Form.serialize(\'' . $options['submit'] . '\')';
275
-        } elseif (isset($options['with'])) {
276
-            $js_options['parameters'] = $options['with'];
277
-        }
278
-
279
-        return $this->_options_for_javascript($js_options);
280
-    }
281
-
282
-    /////////////////////////////////////////////////////////////////////////////////////
283
-    //                            Mergerd Javascript Generator helpers
284
-    /////////////////////////////////////////////////////////////////////////////////////
285
-
286
-    /**
287
-     * @param $javascript
288
-     */
289
-    public function dump($javascript)
290
-    {
291
-        echo $javascript;
292
-    }
293
-
294
-    /**
295
-     * @param       $id
296
-     * @param  null $extend
297
-     * @return string
298
-     */
299
-    public function ID($id, $extend = null)
300
-    {
301
-        return "$('$id')" . (!empty($extend)) ? '.' . $extend . '()' : '';
302
-    }
303
-
304
-    /**
305
-     * @param $message
306
-     * @return string
307
-     */
308
-    public function alert($message)
309
-    {
310
-        return $this->call('alert', $message);
311
-    }
312
-
313
-    /**
314
-     * @param $variable
315
-     * @param $value
316
-     * @return string
317
-     */
318
-    public function assign($variable, $value)
319
-    {
320
-        return "$variable = $value;";
321
-    }
322
-
323
-    /**
324
-     * @param       $function
325
-     * @param  null $args
326
-     * @return string
327
-     */
328
-    public function call($function, $args = null)
329
-    {
330
-        $arg_str = '';
331
-        if (is_array($args)) {
332
-            foreach ($args as $arg) {
333
-                if (!empty($arg_str)) {
334
-                    $arg_str .= ', ';
335
-                }
336
-                if (is_string($arg)) {
337
-                    $arg_str .= "'$arg'";
338
-                } else {
339
-                    $arg_str .= $arg;
340
-                }
341
-            }
342
-        } else {
343
-            if (is_string($args)) {
344
-                $arg_str .= "'$args'";
345
-            } else {
346
-                $arg_str .= $args;
347
-            }
348
-        }
349
-
350
-        return "$function($arg_str)";
351
-    }
352
-
353
-    /**
354
-     * @param  int    $seconds
355
-     * @param  string $script
356
-     * @return string
357
-     */
358
-    public function delay($seconds = 1, $script = '')
359
-    {
360
-        return "setTimeout( function() { $script } , " . ($seconds * 1000) . ' )';
361
-    }
362
-
363
-    /**
364
-     * @param $id
365
-     * @return string
366
-     */
367
-    public function hide($id)
368
-    {
369
-        return $this->call('Element.hide', $id);
370
-    }
371
-
372
-    /**
373
-     * @param       $position
374
-     * @param       $id
375
-     * @param  null $options_for_render
376
-     * @return string
377
-     */
378
-    public function insert_html($position, $id, $options_for_render = null)
379
-    {
380
-        $args = array_merge(array($id), (is_array($options_for_render) ? $options_for_render : array($options_for_render)));
381
-
382
-        return $this->call('new Insertion.' . ucfirst($position), $args);
383
-    }
384
-
385
-    /**
386
-     * @param $location
387
-     * @return string
388
-     */
389
-    public function redirect_to($location)
390
-    {
391
-        return $this->assign('window.location.href', $location);
392
-    }
393
-
394
-    /**
395
-     * @param $id
396
-     * @return string
397
-     */
398
-    public function remove($id)
399
-    {
400
-        if (is_array($id)) {
401
-            $arr_str = '';
402
-            foreach ($id as $obj) {
403
-                if (!empty($arg_str)) {
404
-                    $arg_str .= ', ';
405
-                }
406
-                $arg_str .= "'$arg'";
407
-            }
408
-
409
-            return "$A[$arg_str].each(Element.remove)";
410
-        } else {
411
-            return "Element.remove('$id')";
412
-        }
413
-    }
414
-
415
-    /**
416
-     * @param $id
417
-     * @param $options_for_render
418
-     * @return string
419
-     */
420
-    public function replace($id, $options_for_render)
421
-    {
422
-        $args = array_merge(array($id), (is_array($options_for_render) ? $options_for_render : array($options_for_render)));
423
-
424
-        return $this->call('Element.replace', $args);
425
-    }
426
-
427
-    /**
428
-     * @param $id
429
-     * @param $options_for_render
430
-     * @return string
431
-     */
432
-    public function replace_html($id, $options_for_render)
433
-    {
434
-        $args = array_merge(array($id), (is_array($options_for_render) ? $options_for_render : array($options_for_render)));
435
-
436
-        return $this->call('Element.update', $args);
437
-    }
438
-
439
-    /**
440
-     * @param       $pattern
441
-     * @param  null $extend
442
-     * @return string
443
-     */
444
-    public function select($pattern, $extend = null)
445
-    {
446
-        return "$$('$pattern')" . (!empty($extend)) ? '.' . $extend : '';
447
-    }
448
-
449
-    /**
450
-     * @param $id
451
-     * @return string
452
-     */
453
-    public function show($id)
454
-    {
455
-        return $this->call('Element.show', $id);
456
-    }
457
-
458
-    /**
459
-     * @param $id
460
-     * @return string
461
-     */
462
-    public function toggle($id)
463
-    {
464
-        return $this->call('Element.toggle', $id);
465
-    }
18
+	public $CALLBACKS = array(
19
+		'uninitialized',
20
+		'loading',
21
+		'loaded',
22
+		'interactive',
23
+		'complete',
24
+		'failure',
25
+		'success'
26
+	);
27
+
28
+	public $AJAX_OPTIONS = array(
29
+		'before',
30
+		'after',
31
+		'condition',
32
+		'url',
33
+		'asynchronous',
34
+		'method',
35
+		'insertion',
36
+		'position',
37
+		'form',
38
+		'with',
39
+		'update',
40
+		'script',
41
+		'uninitialized',
42
+		'loading',
43
+		'loaded',
44
+		'interactive',
45
+		'complete',
46
+		'failure',
47
+		'success'
48
+	);
49
+
50
+	/**
51
+	 * @return string
52
+	 */
53
+	public function evaluate_remote_response()
54
+	{
55
+		return 'eval(request.responseText)';
56
+	}
57
+
58
+	/**
59
+	 * @param $options
60
+	 * @return string
61
+	 */
62
+	public function form_remote_tag($options)
63
+	{
64
+		$options['form'] = true;
65
+
66
+		return '<form action="' . $options['url'] . '" onsubmit="' . $this->remote_function($options) . '; return false;" method="' . (isset($options['method']) ? $options['method'] : 'post') . '"  >';
67
+	}
68
+
69
+	/**
70
+	 * @param       $name
71
+	 * @param  null $options
72
+	 * @param  null $html_options
73
+	 * @return string
74
+	 */
75
+	public function link_to_remote($name, $options = null, $html_options = null)
76
+	{
77
+		return $this->link_to_function($name, $this->remote_function($options), $html_options);
78
+	}
79
+
80
+	/**
81
+	 * @param       $field_id
82
+	 * @param  null $options
83
+	 * @return string
84
+	 */
85
+	public function observe_field($field_id, $options = null)
86
+	{
87
+		if (isset($options['frequency']) && $options['frequency'] > 0) {
88
+			return $this->_build_observer('Form.Element.Observer', $field_id, $options);
89
+		} else {
90
+			return $this->_build_observer('Form.Element.EventObserver', $field_id, $options);
91
+		}
92
+	}
93
+
94
+	/**
95
+	 * @param       $form_id
96
+	 * @param  null $options
97
+	 * @return string
98
+	 */
99
+	public function observe_form($form_id, $options = null)
100
+	{
101
+		if (isset($options['frequency'])) {
102
+			return $this->_build_observer('Form.Observer', $form_id, $options);
103
+		} else {
104
+			return $this->_build_observer('Form.EventObserver', $form_id, $options);
105
+		}
106
+	}
107
+
108
+	/**
109
+	 * @param  null $options
110
+	 * @return string
111
+	 */
112
+	public function periodically_call_remote($options = null)
113
+	{
114
+		$frequency = isset($options['frequency']) ? $options['frequency'] : 10;
115
+		$code      = 'new PeriodicalExecuter(function() {' . $this->remote_function($options) . '},' . $frequency . ')';
116
+
117
+		return $code;
118
+	}
119
+
120
+	/**
121
+	 * @param $options
122
+	 * @return string
123
+	 */
124
+	public function remote_function($options)
125
+	{
126
+		$javascript_options = $this->_options_for_ajax($options);
127
+
128
+		$update = '';
129
+
130
+		if (isset($options['update']) && is_array($options['update'])) {
131
+			$update = isset($options['update']['success']) ? 'success: ' . $options['update']['success'] : '';
132
+			$update .= empty($update) ? '' : ',';
133
+			$update .= isset($options['update']['failure']) ? 'failure: ' . $options['update']['failure'] : '';
134
+		} else {
135
+			$update .= isset($options['update']) ? $options['update'] : '';
136
+		}
137
+
138
+		$ajax_function = empty($update) ? 'new Ajax.Request(' : 'new Ajax.Updater(\'' . $update . '\',';
139
+
140
+		$ajax_function .= "'" . $options['url'] . "'";
141
+		$ajax_function .= ',' . $javascript_options . ')';
142
+
143
+		$ajax_function = isset($options['before']) ? $options['before'] . ';' . $ajax_function : $ajax_function;
144
+		$ajax_function = isset($options['after']) ? $ajax_function . ';' . $options['after'] : $ajax_function;
145
+		$ajax_function = isset($options['condition']) ? 'if (' . $options['condition'] . ') {' . $ajax_function . '}' : $ajax_function;
146
+		$ajax_function = isset($options['confirm']) ? 'if ( confirm(\'' . $options['confirm'] . '\' ) ) { ' . $ajax_function . ' } ' : $ajax_function;
147
+
148
+		return $ajax_function;
149
+	}
150
+
151
+	/**
152
+	 * @param $name
153
+	 * @param $value
154
+	 * @param $options
155
+	 * @return string
156
+	 */
157
+	public function submit_to_remote($name, $value, $options)
158
+	{
159
+		if (isset($options['with'])) {
160
+			$options['with'] = 'Form.serialize(this.form)';
161
+		}
162
+
163
+		return '<input type="button" onclick="' . $this->remote_function($options) . '" name="' . $name . '" value ="' . $value . '" />';
164
+	}
165
+
166
+	/**
167
+	 * @param      $element_id
168
+	 * @param null $options
169
+	 * @param      $block
170
+	 */
171
+	public function update_element_function($element_id, $options = null, $block)
172
+	{
173
+		$content = isset($options['content']) ? $options['content'] : '';
174
+		$content = $this->escape($content);
175
+	}
176
+
177
+	/**
178
+	 * @param $block
179
+	 */
180
+	public function update_page($block)
181
+	{
182
+	}
183
+
184
+	/**
185
+	 * @param $block
186
+	 * @return string
187
+	 */
188
+	public function update_page_tag(& $block)
189
+	{
190
+		return $this->tag($block);
191
+	}
192
+
193
+	/////////////////////////////////////////////////////////////////////////////////////
194
+	//                             Private functions
195
+	/////////////////////////////////////////////////////////////////////////////////////
196
+
197
+	/**
198
+	 * @param $options
199
+	 * @return array
200
+	 */
201
+	public function _build_callbacks($options)
202
+	{
203
+		$callbacks = array();
204
+		foreach ($options as $callback => $code) {
205
+			if (in_array($callback, $this->CALLBACKS)) {
206
+				$name             = 'on' . ucfirst($callback);
207
+				$callbacks[$name] = 'function(request){' . $code . '}';
208
+			}
209
+		}
210
+
211
+		return $callbacks;
212
+	}
213
+
214
+	/**
215
+	 * @param       $klass
216
+	 * @param       $name
217
+	 * @param  null $options
218
+	 * @return string
219
+	 */
220
+	public function _build_observer($klass, $name, $options = null)
221
+	{
222
+		if (isset($options['with']) && false === strpos($options['with'], '=')) {
223
+			$options['with'] = '\'' . $options['with'] . '=\' + value';
224
+		} elseif (isset($options['with']) && isset($options['update'])) {
225
+			$options['with'] = 'value';
226
+		}
227
+
228
+		$callback = $options['function'] ?: $this->remote_function($options);
229
+
230
+		$javascript = "new $klass('$name', ";
231
+		$javascript .= isset($options['frequency']) ? $options['frequency'] . ', ' : '';
232
+		$javascript .= 'function (element,value) { ';
233
+		$javascript .= $callback;
234
+		$javascript .= isset($options['on']) ? ', ' . $options['on'] : '';
235
+		$javascript .= '})';
236
+
237
+		return $javascript;
238
+	}
239
+
240
+	/**
241
+	 * @param $method
242
+	 * @return string
243
+	 */
244
+	public function _method_option_to_s($method)
245
+	{
246
+		return strstr($method, "'") ? $method : "'$method'";
247
+	}
248
+
249
+	/**
250
+	 * @param $options
251
+	 * @return string
252
+	 */
253
+	public function _options_for_ajax($options)
254
+	{
255
+		$js_options = is_array($options) ? $this->_build_callbacks($options) : array();
256
+
257
+		if (isset($options['type']) && $option['type'] === 'synchronous') {
258
+			$js_options['asynchronous'] = 'false';
259
+		}
260
+
261
+		if (isset($options['method'])) {
262
+			$js_options['method'] = $this->_method_option_to_s($options['method']);
263
+		}
264
+
265
+		if (isset($options['position'])) {
266
+			$js_options['insertion'] = 'Insertion.' . ucfirst($options['position']);
267
+		}
268
+
269
+		$js_options['evalScripts'] = isset($options['script']) ? $options['script'] : 'true';
270
+
271
+		if (isset($options['form'])) {
272
+			$js_options['parameters'] = 'Form.serialize(this)';
273
+		} elseif (isset($options['parameters'])) {
274
+			$js_options['parameters'] = 'Form.serialize(\'' . $options['submit'] . '\')';
275
+		} elseif (isset($options['with'])) {
276
+			$js_options['parameters'] = $options['with'];
277
+		}
278
+
279
+		return $this->_options_for_javascript($js_options);
280
+	}
281
+
282
+	/////////////////////////////////////////////////////////////////////////////////////
283
+	//                            Mergerd Javascript Generator helpers
284
+	/////////////////////////////////////////////////////////////////////////////////////
285
+
286
+	/**
287
+	 * @param $javascript
288
+	 */
289
+	public function dump($javascript)
290
+	{
291
+		echo $javascript;
292
+	}
293
+
294
+	/**
295
+	 * @param       $id
296
+	 * @param  null $extend
297
+	 * @return string
298
+	 */
299
+	public function ID($id, $extend = null)
300
+	{
301
+		return "$('$id')" . (!empty($extend)) ? '.' . $extend . '()' : '';
302
+	}
303
+
304
+	/**
305
+	 * @param $message
306
+	 * @return string
307
+	 */
308
+	public function alert($message)
309
+	{
310
+		return $this->call('alert', $message);
311
+	}
312
+
313
+	/**
314
+	 * @param $variable
315
+	 * @param $value
316
+	 * @return string
317
+	 */
318
+	public function assign($variable, $value)
319
+	{
320
+		return "$variable = $value;";
321
+	}
322
+
323
+	/**
324
+	 * @param       $function
325
+	 * @param  null $args
326
+	 * @return string
327
+	 */
328
+	public function call($function, $args = null)
329
+	{
330
+		$arg_str = '';
331
+		if (is_array($args)) {
332
+			foreach ($args as $arg) {
333
+				if (!empty($arg_str)) {
334
+					$arg_str .= ', ';
335
+				}
336
+				if (is_string($arg)) {
337
+					$arg_str .= "'$arg'";
338
+				} else {
339
+					$arg_str .= $arg;
340
+				}
341
+			}
342
+		} else {
343
+			if (is_string($args)) {
344
+				$arg_str .= "'$args'";
345
+			} else {
346
+				$arg_str .= $args;
347
+			}
348
+		}
349
+
350
+		return "$function($arg_str)";
351
+	}
352
+
353
+	/**
354
+	 * @param  int    $seconds
355
+	 * @param  string $script
356
+	 * @return string
357
+	 */
358
+	public function delay($seconds = 1, $script = '')
359
+	{
360
+		return "setTimeout( function() { $script } , " . ($seconds * 1000) . ' )';
361
+	}
362
+
363
+	/**
364
+	 * @param $id
365
+	 * @return string
366
+	 */
367
+	public function hide($id)
368
+	{
369
+		return $this->call('Element.hide', $id);
370
+	}
371
+
372
+	/**
373
+	 * @param       $position
374
+	 * @param       $id
375
+	 * @param  null $options_for_render
376
+	 * @return string
377
+	 */
378
+	public function insert_html($position, $id, $options_for_render = null)
379
+	{
380
+		$args = array_merge(array($id), (is_array($options_for_render) ? $options_for_render : array($options_for_render)));
381
+
382
+		return $this->call('new Insertion.' . ucfirst($position), $args);
383
+	}
384
+
385
+	/**
386
+	 * @param $location
387
+	 * @return string
388
+	 */
389
+	public function redirect_to($location)
390
+	{
391
+		return $this->assign('window.location.href', $location);
392
+	}
393
+
394
+	/**
395
+	 * @param $id
396
+	 * @return string
397
+	 */
398
+	public function remove($id)
399
+	{
400
+		if (is_array($id)) {
401
+			$arr_str = '';
402
+			foreach ($id as $obj) {
403
+				if (!empty($arg_str)) {
404
+					$arg_str .= ', ';
405
+				}
406
+				$arg_str .= "'$arg'";
407
+			}
408
+
409
+			return "$A[$arg_str].each(Element.remove)";
410
+		} else {
411
+			return "Element.remove('$id')";
412
+		}
413
+	}
414
+
415
+	/**
416
+	 * @param $id
417
+	 * @param $options_for_render
418
+	 * @return string
419
+	 */
420
+	public function replace($id, $options_for_render)
421
+	{
422
+		$args = array_merge(array($id), (is_array($options_for_render) ? $options_for_render : array($options_for_render)));
423
+
424
+		return $this->call('Element.replace', $args);
425
+	}
426
+
427
+	/**
428
+	 * @param $id
429
+	 * @param $options_for_render
430
+	 * @return string
431
+	 */
432
+	public function replace_html($id, $options_for_render)
433
+	{
434
+		$args = array_merge(array($id), (is_array($options_for_render) ? $options_for_render : array($options_for_render)));
435
+
436
+		return $this->call('Element.update', $args);
437
+	}
438
+
439
+	/**
440
+	 * @param       $pattern
441
+	 * @param  null $extend
442
+	 * @return string
443
+	 */
444
+	public function select($pattern, $extend = null)
445
+	{
446
+		return "$$('$pattern')" . (!empty($extend)) ? '.' . $extend : '';
447
+	}
448
+
449
+	/**
450
+	 * @param $id
451
+	 * @return string
452
+	 */
453
+	public function show($id)
454
+	{
455
+		return $this->call('Element.show', $id);
456
+	}
457
+
458
+	/**
459
+	 * @param $id
460
+	 * @return string
461
+	 */
462
+	public function toggle($id)
463
+	{
464
+		return $this->call('Element.toggle', $id);
465
+	}
466 466
 }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     {
64 64
         $options['form'] = true;
65 65
 
66
-        return '<form action="' . $options['url'] . '" onsubmit="' . $this->remote_function($options) . '; return false;" method="' . (isset($options['method']) ? $options['method'] : 'post') . '"  >';
66
+        return '<form action="'.$options['url'].'" onsubmit="'.$this->remote_function($options).'; return false;" method="'.(isset($options['method']) ? $options['method'] : 'post').'"  >';
67 67
     }
68 68
 
69 69
     /**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     public function periodically_call_remote($options = null)
113 113
     {
114 114
         $frequency = isset($options['frequency']) ? $options['frequency'] : 10;
115
-        $code      = 'new PeriodicalExecuter(function() {' . $this->remote_function($options) . '},' . $frequency . ')';
115
+        $code      = 'new PeriodicalExecuter(function() {'.$this->remote_function($options).'},'.$frequency.')';
116 116
 
117 117
         return $code;
118 118
     }
@@ -128,22 +128,22 @@  discard block
 block discarded – undo
128 128
         $update = '';
129 129
 
130 130
         if (isset($options['update']) && is_array($options['update'])) {
131
-            $update = isset($options['update']['success']) ? 'success: ' . $options['update']['success'] : '';
131
+            $update = isset($options['update']['success']) ? 'success: '.$options['update']['success'] : '';
132 132
             $update .= empty($update) ? '' : ',';
133
-            $update .= isset($options['update']['failure']) ? 'failure: ' . $options['update']['failure'] : '';
133
+            $update .= isset($options['update']['failure']) ? 'failure: '.$options['update']['failure'] : '';
134 134
         } else {
135 135
             $update .= isset($options['update']) ? $options['update'] : '';
136 136
         }
137 137
 
138
-        $ajax_function = empty($update) ? 'new Ajax.Request(' : 'new Ajax.Updater(\'' . $update . '\',';
138
+        $ajax_function = empty($update) ? 'new Ajax.Request(' : 'new Ajax.Updater(\''.$update.'\',';
139 139
 
140
-        $ajax_function .= "'" . $options['url'] . "'";
141
-        $ajax_function .= ',' . $javascript_options . ')';
140
+        $ajax_function .= "'".$options['url']."'";
141
+        $ajax_function .= ','.$javascript_options.')';
142 142
 
143
-        $ajax_function = isset($options['before']) ? $options['before'] . ';' . $ajax_function : $ajax_function;
144
-        $ajax_function = isset($options['after']) ? $ajax_function . ';' . $options['after'] : $ajax_function;
145
-        $ajax_function = isset($options['condition']) ? 'if (' . $options['condition'] . ') {' . $ajax_function . '}' : $ajax_function;
146
-        $ajax_function = isset($options['confirm']) ? 'if ( confirm(\'' . $options['confirm'] . '\' ) ) { ' . $ajax_function . ' } ' : $ajax_function;
143
+        $ajax_function = isset($options['before']) ? $options['before'].';'.$ajax_function : $ajax_function;
144
+        $ajax_function = isset($options['after']) ? $ajax_function.';'.$options['after'] : $ajax_function;
145
+        $ajax_function = isset($options['condition']) ? 'if ('.$options['condition'].') {'.$ajax_function.'}' : $ajax_function;
146
+        $ajax_function = isset($options['confirm']) ? 'if ( confirm(\''.$options['confirm'].'\' ) ) { '.$ajax_function.' } ' : $ajax_function;
147 147
 
148 148
         return $ajax_function;
149 149
     }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
             $options['with'] = 'Form.serialize(this.form)';
161 161
         }
162 162
 
163
-        return '<input type="button" onclick="' . $this->remote_function($options) . '" name="' . $name . '" value ="' . $value . '" />';
163
+        return '<input type="button" onclick="'.$this->remote_function($options).'" name="'.$name.'" value ="'.$value.'" />';
164 164
     }
165 165
 
166 166
     /**
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
         $callbacks = array();
204 204
         foreach ($options as $callback => $code) {
205 205
             if (in_array($callback, $this->CALLBACKS)) {
206
-                $name             = 'on' . ucfirst($callback);
207
-                $callbacks[$name] = 'function(request){' . $code . '}';
206
+                $name             = 'on'.ucfirst($callback);
207
+                $callbacks[$name] = 'function(request){'.$code.'}';
208 208
             }
209 209
         }
210 210
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     public function _build_observer($klass, $name, $options = null)
221 221
     {
222 222
         if (isset($options['with']) && false === strpos($options['with'], '=')) {
223
-            $options['with'] = '\'' . $options['with'] . '=\' + value';
223
+            $options['with'] = '\''.$options['with'].'=\' + value';
224 224
         } elseif (isset($options['with']) && isset($options['update'])) {
225 225
             $options['with'] = 'value';
226 226
         }
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
         $callback = $options['function'] ?: $this->remote_function($options);
229 229
 
230 230
         $javascript = "new $klass('$name', ";
231
-        $javascript .= isset($options['frequency']) ? $options['frequency'] . ', ' : '';
231
+        $javascript .= isset($options['frequency']) ? $options['frequency'].', ' : '';
232 232
         $javascript .= 'function (element,value) { ';
233 233
         $javascript .= $callback;
234
-        $javascript .= isset($options['on']) ? ', ' . $options['on'] : '';
234
+        $javascript .= isset($options['on']) ? ', '.$options['on'] : '';
235 235
         $javascript .= '})';
236 236
 
237 237
         return $javascript;
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
         }
264 264
 
265 265
         if (isset($options['position'])) {
266
-            $js_options['insertion'] = 'Insertion.' . ucfirst($options['position']);
266
+            $js_options['insertion'] = 'Insertion.'.ucfirst($options['position']);
267 267
         }
268 268
 
269 269
         $js_options['evalScripts'] = isset($options['script']) ? $options['script'] : 'true';
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
         if (isset($options['form'])) {
272 272
             $js_options['parameters'] = 'Form.serialize(this)';
273 273
         } elseif (isset($options['parameters'])) {
274
-            $js_options['parameters'] = 'Form.serialize(\'' . $options['submit'] . '\')';
274
+            $js_options['parameters'] = 'Form.serialize(\''.$options['submit'].'\')';
275 275
         } elseif (isset($options['with'])) {
276 276
             $js_options['parameters'] = $options['with'];
277 277
         }
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
      */
299 299
     public function ID($id, $extend = null)
300 300
     {
301
-        return "$('$id')" . (!empty($extend)) ? '.' . $extend . '()' : '';
301
+        return "$('$id')".(!empty($extend)) ? '.'.$extend.'()' : '';
302 302
     }
303 303
 
304 304
     /**
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
      */
358 358
     public function delay($seconds = 1, $script = '')
359 359
     {
360
-        return "setTimeout( function() { $script } , " . ($seconds * 1000) . ' )';
360
+        return "setTimeout( function() { $script } , ".($seconds * 1000).' )';
361 361
     }
362 362
 
363 363
     /**
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
     {
380 380
         $args = array_merge(array($id), (is_array($options_for_render) ? $options_for_render : array($options_for_render)));
381 381
 
382
-        return $this->call('new Insertion.' . ucfirst($position), $args);
382
+        return $this->call('new Insertion.'.ucfirst($position), $args);
383 383
     }
384 384
 
385 385
     /**
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
      */
444 444
     public function select($pattern, $extend = null)
445 445
     {
446
-        return "$$('$pattern')" . (!empty($extend)) ? '.' . $extend : '';
446
+        return "$$('$pattern')".(!empty($extend)) ? '.'.$extend : '';
447 447
     }
448 448
 
449 449
     /**
Please login to merge, or discard this patch.
include/projax/classes/Scriptaculous.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -248,7 +248,7 @@
 block discarded – undo
248 248
     /**
249 249
      * @param $field_id
250 250
      * @param $options
251
-     * @return mixed
251
+     * @return string
252 252
      */
253 253
     public function auto_complete_field($field_id, $options)
254 254
     {
Please login to merge, or discard this patch.
Indentation   +305 added lines, -305 removed lines patch added patch discarded remove patch
@@ -15,310 +15,310 @@  discard block
 block discarded – undo
15 15
  */
16 16
 class Scriptaculous extends Prototype
17 17
 {
18
-    public $TOGGLE_EFFECTS = array('toggle_appear', 'toggle_slide', 'toggle_blind');
19
-
20
-    /**
21
-     * Scriptaculous constructor.
22
-     */
23
-    public function __construct()
24
-    {
25
-    }
26
-
27
-    /**
28
-     * @param      $element_id
29
-     * @param null $options
30
-     * @return string
31
-     */
32
-    public function dragable_element($element_id, $options = null)
33
-    {
34
-        return $this->tag($this->_dragable_element_js($element_id, $options));
35
-    }
36
-
37
-    /**
38
-     * @param      $element_id
39
-     * @param null $options
40
-     * @return string
41
-     */
42
-    public function drop_receiving_element($element_id, $options = null)
43
-    {
44
-        return $this->tag($this->_drop_receiving_element($element_id, $options));
45
-    }
46
-
47
-    /**
48
-     * @param      $name
49
-     * @param bool $element_id
50
-     * @param null $js_options
51
-     * @return string
52
-     */
53
-    public function visual_effect($name, $element_id = false, $js_options = null)
54
-    {
55
-        $element = $element_id ? "'$element_id'" : 'element';
56
-
57
-        $js_queue = '';
58
-        if (isset($js_options) && is_array($js_options['queue'])) {
59
-        } elseif (isset($js_options)) {
60
-            $js_queue = "'$js_options'";
61
-        }
62
-
63
-        if (in_array($name, $this->TOGGLE_EFFECTS)) {
64
-            return "Effect.toggle($element,'" . str_replace('toggle_', '', $name) . "'," . $this->_options_for_javascript($js_options) . ')';
65
-        } else {
66
-            return 'new Effect.' . ucwords($name) . "($element," . $this->_options_for_javascript($js_options) . ')';
67
-        }
68
-    }
69
-
70
-    /**
71
-     * @param      $element_id
72
-     * @param null $options
73
-     * @return string
74
-     */
75
-    public function sortabe_element($element_id, $options = null)
76
-    {
77
-        return $this->tag($this->_sortabe_element($element_id, $options));
78
-    }
79
-
80
-    /////////////////////////////////////////////////////////////////////////////////////
81
-    //                             Private functions
82
-    /////////////////////////////////////////////////////////////////////////////////////
83
-
84
-    /**
85
-     * @param $element_id
86
-     * @param $options
87
-     * @return string
88
-     */
89
-
90
-    public function _sortabe_element($element_id, $options)
91
-    {
92
-        //if (isset($options['with']))
93
-        {
94
-            $options['with'] = "Sortable.serialize('$element_id')";
95
-        }
96
-
97
-        //if (isset($option['onUpdate']))
98
-        {
99
-            $options['onUpdate'] = 'function(){' . $this->remote_function($options) . '}';
100
-        }
101
-
102
-        foreach ($options as $var => $val) {
103
-            if (in_array($var, $this->AJAX_OPTIONS)) {
104
-                unset($options[$var]);
105
-            }
106
-        }
107
-
108
-        $arr = array('tag', 'overlap', 'contraint', 'handle');
109
-
110
-        foreach ($arr as $var) {
111
-            if (isset($options[$var])) {
112
-                $options[$var] = "'" . $options[$var] . "'";
113
-            }
114
-        }
115
-
116
-        if (isset($options['containment'])) {
117
-            $options['containment'] = $this->_array_or_string_for_javascript($options['containment']);
118
-        }
119
-
120
-        if (isset($options['only'])) {
121
-            $options['only'] = $this->_array_or_string_for_javascript($options['only']);
122
-        }
123
-
124
-        return "Sortable.create('$element_id'," . $this->_options_for_javascript($options) . ')';
125
-    }
126
-
127
-    /**
128
-     * @param $element_id
129
-     * @param $options
130
-     * @return string
131
-     */
132
-    public function _dragable_element_js($element_id, $options)
133
-    {
134
-        return 'new Draggable(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')';
135
-    }
136
-
137
-    /**
138
-     * @param $element_id
139
-     * @param $options
140
-     * @return string
141
-     */
142
-    public function _drop_receiving_element($element_id, $options)
143
-    {
144
-
145
-        //if (isset($options['with']))
146
-        {
147
-            $options['with'] = '\'id=\' + encodeURIComponent(element.id)';
148
-        }
149
-
150
-        //if (isset($option['onDrop']))
151
-        {
152
-            $options['onDrop'] = 'function(element){' . $this->remote_function($options) . '}';
153
-        }
154
-
155
-        if (is_array($options)) {
156
-            foreach ($options as $var => $val) {
157
-                if (in_array($var, $this->AJAX_OPTIONS)) {
158
-                    unset($options[$var]);
159
-                }
160
-            }
161
-        }
162
-
163
-        if (isset($options['accept'])) {
164
-            $options['accept'] = $this->_array_or_string_for_javascript($options['accept']);
165
-        }
166
-
167
-        if (isset($options['hoverclass'])) {
168
-            $options['hoverclass'] = "'" . $options['hoverclass'] . "'";
169
-        }
170
-
171
-        return 'Droppables.add(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')';
172
-    }
173
-
174
-    /////////////////////////////////////////////////////////////////////////////////////
175
-    //                            Merged Javascript macro
176
-    /////////////////////////////////////////////////////////////////////////////////////
177
-
178
-    /**
179
-     * @param      $field_id
180
-     * @param      $options
181
-     * @param bool $tag
182
-     * @return string
183
-     */
184
-    public function in_place_editor($field_id, $options, $tag = true)
185
-    {
186
-        $function = 'new Ajax.InPlaceEditor(';
187
-        $function .= "'$field_id', ";
188
-        $function .= "'" . $options['url'] . "'";
189
-
190
-        $js_options = array();
191
-        if (isset($options['cancel_text'])) {
192
-            $js_options['cancelText'] = $options['cancel_text'];
193
-        }
194
-        if (isset($options['save_text'])) {
195
-            $js_options['okText'] = $options['save_text'];
196
-        }
197
-        if (isset($options['loading_text'])) {
198
-            $js_options['loadingText'] = $options['loading_text'];
199
-        }
200
-        if (isset($options['rows'])) {
201
-            $js_options['rows'] = $options['rows'];
202
-        }
203
-        if (isset($options['cols'])) {
204
-            $js_options['cols'] = $options['cols'];
205
-        }
206
-        if (isset($options['size'])) {
207
-            $js_options['size'] = $options['size'];
208
-        }
209
-        if (isset($options['external_control'])) {
210
-            $js_options['externalControl'] = "'" . $options['external_control'] . "'";
211
-        }
212
-        if (isset($options['load_text_url'])) {
213
-            $js_options['loadTextURL'] = "'" . $options['load_text_url'] . "'";
214
-        }
215
-        if (isset($options['options'])) {
216
-            $js_options['ajaxOptions'] = $options['options'];
217
-        }
218
-        if (isset($options['script'])) {
219
-            $js_options['evalScripts'] = $options['script'];
220
-        }
221
-        if (isset($options['with'])) {
222
-            $js_options['callback'] = 'function(form) { return ' . $options['with'] . ' }';
223
-        }
224
-
225
-        $function .= ', ' . $this->_options_for_javascript($js_options) . ' )';
226
-        if ($tag) {
227
-            return $this->tag($function);
228
-        } else {
229
-            return $function;
230
-        }
231
-    }
232
-
233
-    /**
234
-     * @param      $object
235
-     * @param null $tag_options
236
-     * @param null $in_place_editor_options
237
-     * @return string
238
-     */
239
-    public function in_place_editor_field($object, $tag_options = null, $in_place_editor_options = null)
240
-    {
241
-        $ret_val = '';
242
-        $ret_val .= '<span id="' . $object . '" class="in_place_editor_field">' . (isset($tag_options['value']) ? $tag_options['value'] : '') . '</span>';
243
-        $ret_val .= $this->in_place_editor($object, $in_place_editor_options);
244
-
245
-        return $ret_val;
246
-    }
247
-
248
-    /**
249
-     * @param $field_id
250
-     * @param $options
251
-     * @return mixed
252
-     */
253
-    public function auto_complete_field($field_id, $options)
254
-    {
255
-        $function = "var $field_id" . '_auto_completer = new Ajax.Autocompleter(';
256
-        $function .= "'$field_id', ";
257
-        $function .= "'" . (isset($options['update']) ? $options['update'] : $field_id . '_auto_complete') . "', ";
258
-        $function .= "'" . $options['url'] . "'";
259
-
260
-        $js_options = array();
261
-        if (isset($options['tokens'])) {
262
-            $js_options['tokens'] = $this->javascript->_array_or_string_for_javascript($options['tokens']);
263
-        }
264
-        if (isset($options['with'])) {
265
-            $js_options['callback'] = 'function(element, value) { return ' . $options['with'] . ' }';
266
-        }
267
-        if (isset($options['indicator'])) {
268
-            $js_options['indicator'] = "'" . $options['indicator'] . "'";
269
-        }
270
-        if (isset($options['select'])) {
271
-            $js_options['select'] = "'" . $options['select'] . "'";
272
-        }
273
-
274
-        foreach (array('on_show' => 'onShow', 'on_hide' => 'onHide', 'min_chars' => 'min_chars') as $var => $val) {
275
-            if (isset($options[$var])) {
276
-                $js_options['$val'] = $options['var'];
277
-            }
278
-        }
279
-
280
-        $function .= ', ' . $this->_options_for_javascript($js_options) . ' )';
281
-
282
-        return $this->tag($function);
283
-    }
284
-
285
-    /**
286
-     * @param      $entries
287
-     * @param      $field
288
-     * @param null $phrase
289
-     */
290
-    public function auto_complete_results($entries, $field, $phrase = null)
291
-    {
292
-        if (!is_array($entries)) {
293
-            return;
294
-        }
295
-        $ret_val = '<ul>';
296
-        //  Complete this function
297
-    }
298
-
299
-    /**
300
-     * @param      $object
301
-     * @param null $tag_options
302
-     * @param null $completion_options
303
-     * @return string
304
-     */
305
-    public function text_field_with_auto_complete($object, $tag_options = null, $completion_options = null)
306
-    {
307
-        $ret_val = isset($completion_options['skip_style']) ? '' : $this->_auto_complete_stylesheet();
308
-        $ret_val .= '<input autocomplete="off" id="' . $object . '" name="' . $object . '" size="' . (isset($tag_options['size']) ? $tag_options['size'] : 30) . '" type="text" value="' . (isset($tag_options['size']) ? $tag_options['value'] : '') . '" ' . (isset($tag_options['class']) ? 'class = "' . $tag_options['class'] . '" ' : '') . '/>';
309
-
310
-        $ret_val .= '<div id="' . $object . '_auto_complete" class="auto_complete"></div>';
311
-        $ret_val .= $this->auto_complete_field($object, $completion_options);
312
-
313
-        return $ret_val;
314
-    }
315
-
316
-    /**
317
-     * @return string
318
-     */
319
-    public function _auto_complete_stylesheet()
320
-    {
321
-        return '<style> div.auto_complete {
18
+	public $TOGGLE_EFFECTS = array('toggle_appear', 'toggle_slide', 'toggle_blind');
19
+
20
+	/**
21
+	 * Scriptaculous constructor.
22
+	 */
23
+	public function __construct()
24
+	{
25
+	}
26
+
27
+	/**
28
+	 * @param      $element_id
29
+	 * @param null $options
30
+	 * @return string
31
+	 */
32
+	public function dragable_element($element_id, $options = null)
33
+	{
34
+		return $this->tag($this->_dragable_element_js($element_id, $options));
35
+	}
36
+
37
+	/**
38
+	 * @param      $element_id
39
+	 * @param null $options
40
+	 * @return string
41
+	 */
42
+	public function drop_receiving_element($element_id, $options = null)
43
+	{
44
+		return $this->tag($this->_drop_receiving_element($element_id, $options));
45
+	}
46
+
47
+	/**
48
+	 * @param      $name
49
+	 * @param bool $element_id
50
+	 * @param null $js_options
51
+	 * @return string
52
+	 */
53
+	public function visual_effect($name, $element_id = false, $js_options = null)
54
+	{
55
+		$element = $element_id ? "'$element_id'" : 'element';
56
+
57
+		$js_queue = '';
58
+		if (isset($js_options) && is_array($js_options['queue'])) {
59
+		} elseif (isset($js_options)) {
60
+			$js_queue = "'$js_options'";
61
+		}
62
+
63
+		if (in_array($name, $this->TOGGLE_EFFECTS)) {
64
+			return "Effect.toggle($element,'" . str_replace('toggle_', '', $name) . "'," . $this->_options_for_javascript($js_options) . ')';
65
+		} else {
66
+			return 'new Effect.' . ucwords($name) . "($element," . $this->_options_for_javascript($js_options) . ')';
67
+		}
68
+	}
69
+
70
+	/**
71
+	 * @param      $element_id
72
+	 * @param null $options
73
+	 * @return string
74
+	 */
75
+	public function sortabe_element($element_id, $options = null)
76
+	{
77
+		return $this->tag($this->_sortabe_element($element_id, $options));
78
+	}
79
+
80
+	/////////////////////////////////////////////////////////////////////////////////////
81
+	//                             Private functions
82
+	/////////////////////////////////////////////////////////////////////////////////////
83
+
84
+	/**
85
+	 * @param $element_id
86
+	 * @param $options
87
+	 * @return string
88
+	 */
89
+
90
+	public function _sortabe_element($element_id, $options)
91
+	{
92
+		//if (isset($options['with']))
93
+		{
94
+			$options['with'] = "Sortable.serialize('$element_id')";
95
+		}
96
+
97
+		//if (isset($option['onUpdate']))
98
+		{
99
+			$options['onUpdate'] = 'function(){' . $this->remote_function($options) . '}';
100
+		}
101
+
102
+		foreach ($options as $var => $val) {
103
+			if (in_array($var, $this->AJAX_OPTIONS)) {
104
+				unset($options[$var]);
105
+			}
106
+		}
107
+
108
+		$arr = array('tag', 'overlap', 'contraint', 'handle');
109
+
110
+		foreach ($arr as $var) {
111
+			if (isset($options[$var])) {
112
+				$options[$var] = "'" . $options[$var] . "'";
113
+			}
114
+		}
115
+
116
+		if (isset($options['containment'])) {
117
+			$options['containment'] = $this->_array_or_string_for_javascript($options['containment']);
118
+		}
119
+
120
+		if (isset($options['only'])) {
121
+			$options['only'] = $this->_array_or_string_for_javascript($options['only']);
122
+		}
123
+
124
+		return "Sortable.create('$element_id'," . $this->_options_for_javascript($options) . ')';
125
+	}
126
+
127
+	/**
128
+	 * @param $element_id
129
+	 * @param $options
130
+	 * @return string
131
+	 */
132
+	public function _dragable_element_js($element_id, $options)
133
+	{
134
+		return 'new Draggable(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')';
135
+	}
136
+
137
+	/**
138
+	 * @param $element_id
139
+	 * @param $options
140
+	 * @return string
141
+	 */
142
+	public function _drop_receiving_element($element_id, $options)
143
+	{
144
+
145
+		//if (isset($options['with']))
146
+		{
147
+			$options['with'] = '\'id=\' + encodeURIComponent(element.id)';
148
+		}
149
+
150
+		//if (isset($option['onDrop']))
151
+		{
152
+			$options['onDrop'] = 'function(element){' . $this->remote_function($options) . '}';
153
+		}
154
+
155
+		if (is_array($options)) {
156
+			foreach ($options as $var => $val) {
157
+				if (in_array($var, $this->AJAX_OPTIONS)) {
158
+					unset($options[$var]);
159
+				}
160
+			}
161
+		}
162
+
163
+		if (isset($options['accept'])) {
164
+			$options['accept'] = $this->_array_or_string_for_javascript($options['accept']);
165
+		}
166
+
167
+		if (isset($options['hoverclass'])) {
168
+			$options['hoverclass'] = "'" . $options['hoverclass'] . "'";
169
+		}
170
+
171
+		return 'Droppables.add(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')';
172
+	}
173
+
174
+	/////////////////////////////////////////////////////////////////////////////////////
175
+	//                            Merged Javascript macro
176
+	/////////////////////////////////////////////////////////////////////////////////////
177
+
178
+	/**
179
+	 * @param      $field_id
180
+	 * @param      $options
181
+	 * @param bool $tag
182
+	 * @return string
183
+	 */
184
+	public function in_place_editor($field_id, $options, $tag = true)
185
+	{
186
+		$function = 'new Ajax.InPlaceEditor(';
187
+		$function .= "'$field_id', ";
188
+		$function .= "'" . $options['url'] . "'";
189
+
190
+		$js_options = array();
191
+		if (isset($options['cancel_text'])) {
192
+			$js_options['cancelText'] = $options['cancel_text'];
193
+		}
194
+		if (isset($options['save_text'])) {
195
+			$js_options['okText'] = $options['save_text'];
196
+		}
197
+		if (isset($options['loading_text'])) {
198
+			$js_options['loadingText'] = $options['loading_text'];
199
+		}
200
+		if (isset($options['rows'])) {
201
+			$js_options['rows'] = $options['rows'];
202
+		}
203
+		if (isset($options['cols'])) {
204
+			$js_options['cols'] = $options['cols'];
205
+		}
206
+		if (isset($options['size'])) {
207
+			$js_options['size'] = $options['size'];
208
+		}
209
+		if (isset($options['external_control'])) {
210
+			$js_options['externalControl'] = "'" . $options['external_control'] . "'";
211
+		}
212
+		if (isset($options['load_text_url'])) {
213
+			$js_options['loadTextURL'] = "'" . $options['load_text_url'] . "'";
214
+		}
215
+		if (isset($options['options'])) {
216
+			$js_options['ajaxOptions'] = $options['options'];
217
+		}
218
+		if (isset($options['script'])) {
219
+			$js_options['evalScripts'] = $options['script'];
220
+		}
221
+		if (isset($options['with'])) {
222
+			$js_options['callback'] = 'function(form) { return ' . $options['with'] . ' }';
223
+		}
224
+
225
+		$function .= ', ' . $this->_options_for_javascript($js_options) . ' )';
226
+		if ($tag) {
227
+			return $this->tag($function);
228
+		} else {
229
+			return $function;
230
+		}
231
+	}
232
+
233
+	/**
234
+	 * @param      $object
235
+	 * @param null $tag_options
236
+	 * @param null $in_place_editor_options
237
+	 * @return string
238
+	 */
239
+	public function in_place_editor_field($object, $tag_options = null, $in_place_editor_options = null)
240
+	{
241
+		$ret_val = '';
242
+		$ret_val .= '<span id="' . $object . '" class="in_place_editor_field">' . (isset($tag_options['value']) ? $tag_options['value'] : '') . '</span>';
243
+		$ret_val .= $this->in_place_editor($object, $in_place_editor_options);
244
+
245
+		return $ret_val;
246
+	}
247
+
248
+	/**
249
+	 * @param $field_id
250
+	 * @param $options
251
+	 * @return mixed
252
+	 */
253
+	public function auto_complete_field($field_id, $options)
254
+	{
255
+		$function = "var $field_id" . '_auto_completer = new Ajax.Autocompleter(';
256
+		$function .= "'$field_id', ";
257
+		$function .= "'" . (isset($options['update']) ? $options['update'] : $field_id . '_auto_complete') . "', ";
258
+		$function .= "'" . $options['url'] . "'";
259
+
260
+		$js_options = array();
261
+		if (isset($options['tokens'])) {
262
+			$js_options['tokens'] = $this->javascript->_array_or_string_for_javascript($options['tokens']);
263
+		}
264
+		if (isset($options['with'])) {
265
+			$js_options['callback'] = 'function(element, value) { return ' . $options['with'] . ' }';
266
+		}
267
+		if (isset($options['indicator'])) {
268
+			$js_options['indicator'] = "'" . $options['indicator'] . "'";
269
+		}
270
+		if (isset($options['select'])) {
271
+			$js_options['select'] = "'" . $options['select'] . "'";
272
+		}
273
+
274
+		foreach (array('on_show' => 'onShow', 'on_hide' => 'onHide', 'min_chars' => 'min_chars') as $var => $val) {
275
+			if (isset($options[$var])) {
276
+				$js_options['$val'] = $options['var'];
277
+			}
278
+		}
279
+
280
+		$function .= ', ' . $this->_options_for_javascript($js_options) . ' )';
281
+
282
+		return $this->tag($function);
283
+	}
284
+
285
+	/**
286
+	 * @param      $entries
287
+	 * @param      $field
288
+	 * @param null $phrase
289
+	 */
290
+	public function auto_complete_results($entries, $field, $phrase = null)
291
+	{
292
+		if (!is_array($entries)) {
293
+			return;
294
+		}
295
+		$ret_val = '<ul>';
296
+		//  Complete this function
297
+	}
298
+
299
+	/**
300
+	 * @param      $object
301
+	 * @param null $tag_options
302
+	 * @param null $completion_options
303
+	 * @return string
304
+	 */
305
+	public function text_field_with_auto_complete($object, $tag_options = null, $completion_options = null)
306
+	{
307
+		$ret_val = isset($completion_options['skip_style']) ? '' : $this->_auto_complete_stylesheet();
308
+		$ret_val .= '<input autocomplete="off" id="' . $object . '" name="' . $object . '" size="' . (isset($tag_options['size']) ? $tag_options['size'] : 30) . '" type="text" value="' . (isset($tag_options['size']) ? $tag_options['value'] : '') . '" ' . (isset($tag_options['class']) ? 'class = "' . $tag_options['class'] . '" ' : '') . '/>';
309
+
310
+		$ret_val .= '<div id="' . $object . '_auto_complete" class="auto_complete"></div>';
311
+		$ret_val .= $this->auto_complete_field($object, $completion_options);
312
+
313
+		return $ret_val;
314
+	}
315
+
316
+	/**
317
+	 * @return string
318
+	 */
319
+	public function _auto_complete_stylesheet()
320
+	{
321
+		return '<style> div.auto_complete {
322 322
                   width: 350px;
323 323
                   background: #fff;
324 324
                  }
@@ -342,5 +342,5 @@  discard block
 block discarded – undo
342 342
                    padding:0;
343 343
                  }
344 344
                  </style>';
345
-    }
345
+	}
346 346
 }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
         }
62 62
 
63 63
         if (in_array($name, $this->TOGGLE_EFFECTS)) {
64
-            return "Effect.toggle($element,'" . str_replace('toggle_', '', $name) . "'," . $this->_options_for_javascript($js_options) . ')';
64
+            return "Effect.toggle($element,'".str_replace('toggle_', '', $name)."',".$this->_options_for_javascript($js_options).')';
65 65
         } else {
66
-            return 'new Effect.' . ucwords($name) . "($element," . $this->_options_for_javascript($js_options) . ')';
66
+            return 'new Effect.'.ucwords($name)."($element,".$this->_options_for_javascript($js_options).')';
67 67
         }
68 68
     }
69 69
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
         //if (isset($option['onUpdate']))
98 98
         {
99
-            $options['onUpdate'] = 'function(){' . $this->remote_function($options) . '}';
99
+            $options['onUpdate'] = 'function(){'.$this->remote_function($options).'}';
100 100
         }
101 101
 
102 102
         foreach ($options as $var => $val) {
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
         foreach ($arr as $var) {
111 111
             if (isset($options[$var])) {
112
-                $options[$var] = "'" . $options[$var] . "'";
112
+                $options[$var] = "'".$options[$var]."'";
113 113
             }
114 114
         }
115 115
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
             $options['only'] = $this->_array_or_string_for_javascript($options['only']);
122 122
         }
123 123
 
124
-        return "Sortable.create('$element_id'," . $this->_options_for_javascript($options) . ')';
124
+        return "Sortable.create('$element_id',".$this->_options_for_javascript($options).')';
125 125
     }
126 126
 
127 127
     /**
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      */
132 132
     public function _dragable_element_js($element_id, $options)
133 133
     {
134
-        return 'new Draggable(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')';
134
+        return 'new Draggable(\''.$element_id.'\','.$this->_options_for_javascript($options).')';
135 135
     }
136 136
 
137 137
     /**
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
         //if (isset($option['onDrop']))
151 151
         {
152
-            $options['onDrop'] = 'function(element){' . $this->remote_function($options) . '}';
152
+            $options['onDrop'] = 'function(element){'.$this->remote_function($options).'}';
153 153
         }
154 154
 
155 155
         if (is_array($options)) {
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
         }
166 166
 
167 167
         if (isset($options['hoverclass'])) {
168
-            $options['hoverclass'] = "'" . $options['hoverclass'] . "'";
168
+            $options['hoverclass'] = "'".$options['hoverclass']."'";
169 169
         }
170 170
 
171
-        return 'Droppables.add(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')';
171
+        return 'Droppables.add(\''.$element_id.'\','.$this->_options_for_javascript($options).')';
172 172
     }
173 173
 
174 174
     /////////////////////////////////////////////////////////////////////////////////////
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     {
186 186
         $function = 'new Ajax.InPlaceEditor(';
187 187
         $function .= "'$field_id', ";
188
-        $function .= "'" . $options['url'] . "'";
188
+        $function .= "'".$options['url']."'";
189 189
 
190 190
         $js_options = array();
191 191
         if (isset($options['cancel_text'])) {
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
             $js_options['size'] = $options['size'];
208 208
         }
209 209
         if (isset($options['external_control'])) {
210
-            $js_options['externalControl'] = "'" . $options['external_control'] . "'";
210
+            $js_options['externalControl'] = "'".$options['external_control']."'";
211 211
         }
212 212
         if (isset($options['load_text_url'])) {
213
-            $js_options['loadTextURL'] = "'" . $options['load_text_url'] . "'";
213
+            $js_options['loadTextURL'] = "'".$options['load_text_url']."'";
214 214
         }
215 215
         if (isset($options['options'])) {
216 216
             $js_options['ajaxOptions'] = $options['options'];
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
             $js_options['evalScripts'] = $options['script'];
220 220
         }
221 221
         if (isset($options['with'])) {
222
-            $js_options['callback'] = 'function(form) { return ' . $options['with'] . ' }';
222
+            $js_options['callback'] = 'function(form) { return '.$options['with'].' }';
223 223
         }
224 224
 
225
-        $function .= ', ' . $this->_options_for_javascript($js_options) . ' )';
225
+        $function .= ', '.$this->_options_for_javascript($js_options).' )';
226 226
         if ($tag) {
227 227
             return $this->tag($function);
228 228
         } else {
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     public function in_place_editor_field($object, $tag_options = null, $in_place_editor_options = null)
240 240
     {
241 241
         $ret_val = '';
242
-        $ret_val .= '<span id="' . $object . '" class="in_place_editor_field">' . (isset($tag_options['value']) ? $tag_options['value'] : '') . '</span>';
242
+        $ret_val .= '<span id="'.$object.'" class="in_place_editor_field">'.(isset($tag_options['value']) ? $tag_options['value'] : '').'</span>';
243 243
         $ret_val .= $this->in_place_editor($object, $in_place_editor_options);
244 244
 
245 245
         return $ret_val;
@@ -252,23 +252,23 @@  discard block
 block discarded – undo
252 252
      */
253 253
     public function auto_complete_field($field_id, $options)
254 254
     {
255
-        $function = "var $field_id" . '_auto_completer = new Ajax.Autocompleter(';
255
+        $function = "var $field_id".'_auto_completer = new Ajax.Autocompleter(';
256 256
         $function .= "'$field_id', ";
257
-        $function .= "'" . (isset($options['update']) ? $options['update'] : $field_id . '_auto_complete') . "', ";
258
-        $function .= "'" . $options['url'] . "'";
257
+        $function .= "'".(isset($options['update']) ? $options['update'] : $field_id.'_auto_complete')."', ";
258
+        $function .= "'".$options['url']."'";
259 259
 
260 260
         $js_options = array();
261 261
         if (isset($options['tokens'])) {
262 262
             $js_options['tokens'] = $this->javascript->_array_or_string_for_javascript($options['tokens']);
263 263
         }
264 264
         if (isset($options['with'])) {
265
-            $js_options['callback'] = 'function(element, value) { return ' . $options['with'] . ' }';
265
+            $js_options['callback'] = 'function(element, value) { return '.$options['with'].' }';
266 266
         }
267 267
         if (isset($options['indicator'])) {
268
-            $js_options['indicator'] = "'" . $options['indicator'] . "'";
268
+            $js_options['indicator'] = "'".$options['indicator']."'";
269 269
         }
270 270
         if (isset($options['select'])) {
271
-            $js_options['select'] = "'" . $options['select'] . "'";
271
+            $js_options['select'] = "'".$options['select']."'";
272 272
         }
273 273
 
274 274
         foreach (array('on_show' => 'onShow', 'on_hide' => 'onHide', 'min_chars' => 'min_chars') as $var => $val) {
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
             }
278 278
         }
279 279
 
280
-        $function .= ', ' . $this->_options_for_javascript($js_options) . ' )';
280
+        $function .= ', '.$this->_options_for_javascript($js_options).' )';
281 281
 
282 282
         return $this->tag($function);
283 283
     }
@@ -305,9 +305,9 @@  discard block
 block discarded – undo
305 305
     public function text_field_with_auto_complete($object, $tag_options = null, $completion_options = null)
306 306
     {
307 307
         $ret_val = isset($completion_options['skip_style']) ? '' : $this->_auto_complete_stylesheet();
308
-        $ret_val .= '<input autocomplete="off" id="' . $object . '" name="' . $object . '" size="' . (isset($tag_options['size']) ? $tag_options['size'] : 30) . '" type="text" value="' . (isset($tag_options['size']) ? $tag_options['value'] : '') . '" ' . (isset($tag_options['class']) ? 'class = "' . $tag_options['class'] . '" ' : '') . '/>';
308
+        $ret_val .= '<input autocomplete="off" id="'.$object.'" name="'.$object.'" size="'.(isset($tag_options['size']) ? $tag_options['size'] : 30).'" type="text" value="'.(isset($tag_options['size']) ? $tag_options['value'] : '').'" '.(isset($tag_options['class']) ? 'class = "'.$tag_options['class'].'" ' : '').'/>';
309 309
 
310
-        $ret_val .= '<div id="' . $object . '_auto_complete" class="auto_complete"></div>';
310
+        $ret_val .= '<div id="'.$object.'_auto_complete" class="auto_complete"></div>';
311 311
         $ret_val .= $this->auto_complete_field($object, $completion_options);
312 312
 
313 313
         return $ret_val;
Please login to merge, or discard this patch.
plugins/smartpartner.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@
 block discarded – undo
9 9
 
10 10
 function smartobject_plugin_smartpartner()
11 11
 {
12
-    $pluginInfo = array();
12
+	$pluginInfo = array();
13 13
 
14
-    $pluginInfo['items']['partner']['caption'] = 'Partner';
15
-    $pluginInfo['items']['partner']['url']     = 'partner.php?partnerid=%u';
16
-    $pluginInfo['items']['partner']['request'] = 'partnerid';
14
+	$pluginInfo['items']['partner']['caption'] = 'Partner';
15
+	$pluginInfo['items']['partner']['url']     = 'partner.php?partnerid=%u';
16
+	$pluginInfo['items']['partner']['request'] = 'partnerid';
17 17
 
18
-    $pluginInfo['items']['category']['caption'] = 'Category';
19
-    $pluginInfo['items']['category']['url']     = 'index.php?view_category_id=%u';
20
-    $pluginInfo['items']['category']['request'] = 'view_category_id';
18
+	$pluginInfo['items']['category']['caption'] = 'Category';
19
+	$pluginInfo['items']['category']['url']     = 'index.php?view_category_id=%u';
20
+	$pluginInfo['items']['category']['request'] = 'view_category_id';
21 21
 
22
-    return $pluginInfo;
22
+	return $pluginInfo;
23 23
 }
Please login to merge, or discard this patch.
plugins/smartsection.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@
 block discarded – undo
9 9
 
10 10
 function smartobject_plugin_smartsection()
11 11
 {
12
-    $pluginInfo = array();
12
+	$pluginInfo = array();
13 13
 
14
-    $pluginInfo['items']['item']['caption'] = 'Article';
15
-    $pluginInfo['items']['item']['url']     = 'item.php?itemid=%u';
16
-    $pluginInfo['items']['item']['request'] = 'itemid';
14
+	$pluginInfo['items']['item']['caption'] = 'Article';
15
+	$pluginInfo['items']['item']['url']     = 'item.php?itemid=%u';
16
+	$pluginInfo['items']['item']['request'] = 'itemid';
17 17
 
18
-    $pluginInfo['items']['category']['caption'] = 'Category';
19
-    $pluginInfo['items']['category']['url']     = 'category.php?categoryid=%u';
20
-    $pluginInfo['items']['category']['request'] = 'categoryid';
18
+	$pluginInfo['items']['category']['caption'] = 'Category';
19
+	$pluginInfo['items']['category']['url']     = 'category.php?categoryid=%u';
20
+	$pluginInfo['items']['category']['request'] = 'categoryid';
21 21
 
22
-    return $pluginInfo;
22
+	return $pluginInfo;
23 23
 }
Please login to merge, or discard this patch.
plugins/xcgal.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@
 block discarded – undo
9 9
 
10 10
 function smartobject_plugin_xcgal()
11 11
 {
12
-    global $xoopsConfig;
12
+	global $xoopsConfig;
13 13
 
14
-    $pluginInfo                              = array();
15
-    $pluginInfo['items']['album']['caption'] = 'Album';
16
-    $pluginInfo['items']['item']['url']      = 'thumbnails.php?album=%u';
17
-    $pluginInfo['items']['item']['request']  = 'album';
14
+	$pluginInfo                              = array();
15
+	$pluginInfo['items']['album']['caption'] = 'Album';
16
+	$pluginInfo['items']['item']['url']      = 'thumbnails.php?album=%u';
17
+	$pluginInfo['items']['item']['request']  = 'album';
18 18
 
19
-    return $pluginInfo;
19
+	return $pluginInfo;
20 20
 }
Please login to merge, or discard this patch.
plugins/smartshop.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@
 block discarded – undo
9 9
 
10 10
 function smartobject_plugin_smartshop()
11 11
 {
12
-    $pluginInfo = array();
12
+	$pluginInfo = array();
13 13
 
14
-    $pluginInfo['items']['item']['caption'] = 'Item';
15
-    $pluginInfo['items']['item']['url']     = 'item.php?itemid=%u';
16
-    $pluginInfo['items']['item']['request'] = 'itemid';
14
+	$pluginInfo['items']['item']['caption'] = 'Item';
15
+	$pluginInfo['items']['item']['url']     = 'item.php?itemid=%u';
16
+	$pluginInfo['items']['item']['request'] = 'itemid';
17 17
 
18
-    $pluginInfo['items']['category']['caption'] = 'Category';
19
-    $pluginInfo['items']['category']['url']     = 'category.php?categoryid=%u';
20
-    $pluginInfo['items']['category']['request'] = 'categoryid';
18
+	$pluginInfo['items']['category']['caption'] = 'Category';
19
+	$pluginInfo['items']['category']['url']     = 'category.php?categoryid=%u';
20
+	$pluginInfo['items']['category']['request'] = 'categoryid';
21 21
 
22
-    return $pluginInfo;
22
+	return $pluginInfo;
23 23
 }
Please login to merge, or discard this patch.
plugins/smartband.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,17 +9,17 @@
 block discarded – undo
9 9
 
10 10
 function smartobject_plugin_smartband()
11 11
 {
12
-    global $xoopsConfig;
13
-    include_once(XOOPS_ROOT_PATH . '/modules/smartband/language/' . $xoopsConfig['language'] . '/main.php');
12
+	global $xoopsConfig;
13
+	include_once(XOOPS_ROOT_PATH . '/modules/smartband/language/' . $xoopsConfig['language'] . '/main.php');
14 14
 
15
-    $pluginInfo                             = array();
16
-    $pluginInfo['items']['item']['caption'] = _MD_ARTALBUM_ITEM_CAP;
17
-    $pluginInfo['items']['item']['url']     = 'item.php?itemid=%u';
18
-    $pluginInfo['items']['item']['request'] = 'itemid';
15
+	$pluginInfo                             = array();
16
+	$pluginInfo['items']['item']['caption'] = _MD_ARTALBUM_ITEM_CAP;
17
+	$pluginInfo['items']['item']['url']     = 'item.php?itemid=%u';
18
+	$pluginInfo['items']['item']['request'] = 'itemid';
19 19
 
20
-    $pluginInfo['items']['category']['caption'] = _MD_ARTALBUM_CATEGORY;
21
-    $pluginInfo['items']['category']['url']     = 'category.php?categoryid=%u';
22
-    $pluginInfo['items']['category']['request'] = 'categoryid';
20
+	$pluginInfo['items']['category']['caption'] = _MD_ARTALBUM_CATEGORY;
21
+	$pluginInfo['items']['category']['url']     = 'category.php?categoryid=%u';
22
+	$pluginInfo['items']['category']['request'] = 'categoryid';
23 23
 
24
-    return $pluginInfo;
24
+	return $pluginInfo;
25 25
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 function smartobject_plugin_smartband()
11 11
 {
12 12
     global $xoopsConfig;
13
-    include_once(XOOPS_ROOT_PATH . '/modules/smartband/language/' . $xoopsConfig['language'] . '/main.php');
13
+    include_once(XOOPS_ROOT_PATH.'/modules/smartband/language/'.$xoopsConfig['language'].'/main.php');
14 14
 
15 15
     $pluginInfo                             = array();
16 16
     $pluginInfo['items']['item']['caption'] = _MD_ARTALBUM_ITEM_CAP;
Please login to merge, or discard this patch.