Completed
Pull Request — v3.0 (#136)
by
unknown
25:07
created
web_interface/astpp/system/helpers/cookie_helper.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = FALSE)
48 48
 	{
49 49
 		// Set the config file options
50
-		$CI =& get_instance();
50
+		$CI = & get_instance();
51 51
 		$CI->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure);
52 52
 	}
53 53
 }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 {
67 67
 	function get_cookie($index = '', $xss_clean = FALSE)
68 68
 	{
69
-		$CI =& get_instance();
69
+		$CI = & get_instance();
70 70
 
71 71
 		$prefix = '';
72 72
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if ( ! defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /*
3 5
 | -------------------------------------------------------------------
4 6
 | AUTO-LOADER
Please login to merge, or discard this patch.
web_interface/astpp/system/helpers/inflector_helper.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -105,24 +105,24 @@
 block discarded – undo
105 105
 		$result = strval($str);
106 106
 	
107 107
 		$plural_rules = array(
108
-			'/^(ox)$/'                 => '\1\2en',     // ox
109
-			'/([m|l])ouse$/'           => '\1ice',      // mouse, louse
110
-			'/(matr|vert|ind)ix|ex$/'  => '\1ices',     // matrix, vertex, index
111
-			'/(x|ch|ss|sh)$/'          => '\1es',       // search, switch, fix, box, process, address
112
-			'/([^aeiouy]|qu)y$/'       => '\1ies',      // query, ability, agency
113
-			'/(hive)$/'                => '\1s',        // archive, hive
114
-			'/(?:([^f])fe|([lr])f)$/'  => '\1\2ves',    // half, safe, wife
115
-			'/sis$/'                   => 'ses',        // basis, diagnosis
116
-			'/([ti])um$/'              => '\1a',        // datum, medium
117
-			'/(p)erson$/'              => '\1eople',    // person, salesperson
118
-			'/(m)an$/'                 => '\1en',       // man, woman, spokesman
119
-			'/(c)hild$/'               => '\1hildren',  // child
120
-			'/(buffal|tomat)o$/'       => '\1\2oes',    // buffalo, tomato
121
-			'/(bu|campu)s$/'           => '\1\2ses',    // bus, campus
122
-			'/(alias|status|virus)/'   => '\1es',       // alias
123
-			'/(octop)us$/'             => '\1i',        // octopus
124
-			'/(ax|cris|test)is$/'      => '\1es',       // axis, crisis
125
-			'/s$/'                     => 's',          // no change (compatibility)
108
+			'/^(ox)$/'                 => '\1\2en', // ox
109
+			'/([m|l])ouse$/'           => '\1ice', // mouse, louse
110
+			'/(matr|vert|ind)ix|ex$/'  => '\1ices', // matrix, vertex, index
111
+			'/(x|ch|ss|sh)$/'          => '\1es', // search, switch, fix, box, process, address
112
+			'/([^aeiouy]|qu)y$/'       => '\1ies', // query, ability, agency
113
+			'/(hive)$/'                => '\1s', // archive, hive
114
+			'/(?:([^f])fe|([lr])f)$/'  => '\1\2ves', // half, safe, wife
115
+			'/sis$/'                   => 'ses', // basis, diagnosis
116
+			'/([ti])um$/'              => '\1a', // datum, medium
117
+			'/(p)erson$/'              => '\1eople', // person, salesperson
118
+			'/(m)an$/'                 => '\1en', // man, woman, spokesman
119
+			'/(c)hild$/'               => '\1hildren', // child
120
+			'/(buffal|tomat)o$/'       => '\1\2oes', // buffalo, tomato
121
+			'/(bu|campu)s$/'           => '\1\2ses', // bus, campus
122
+			'/(alias|status|virus)/'   => '\1es', // alias
123
+			'/(octop)us$/'             => '\1i', // octopus
124
+			'/(ax|cris|test)is$/'      => '\1es', // axis, crisis
125
+			'/s$/'                     => 's', // no change (compatibility)
126 126
 			'/$/'                      => 's',
127 127
 		);
128 128
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if ( ! defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /*
3 5
 | -------------------------------------------------------------------
4 6
 | AUTO-LOADER
Please login to merge, or discard this patch.
web_interface/astpp/system/helpers/captcha_helper.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 			$str = '';
114 114
 			for ($i = 0; $i < 8; $i++)
115 115
 			{
116
-				$str .= substr($pool, mt_rand(0, strlen($pool) -1), 1);
116
+				$str .= substr($pool, mt_rand(0, strlen($pool) - 1), 1);
117 117
 			}
118 118
 
119 119
 			$word = $str;
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 		// -----------------------------------
125 125
 
126 126
 		$length	= strlen($word);
127
-		$angle	= ($length >= 6) ? rand(-($length-6), ($length-6)) : 0;
128
-		$x_axis	= rand(6, (360/$length)-16);
129
-		$y_axis = ($angle >= 0 ) ? rand($img_height, $img_width) : rand(6, $img_height);
127
+		$angle = ($length >= 6) ? rand(-($length - 6), ($length - 6)) : 0;
128
+		$x_axis	= rand(6, (360 / $length) - 16);
129
+		$y_axis = ($angle >= 0) ? rand($img_height, $img_width) : rand(6, $img_height);
130 130
 
131 131
 		// -----------------------------------
132 132
 		// Create image
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 		//  Assign colors
147 147
 		// -----------------------------------
148 148
 
149
-		$bg_color		= imagecolorallocate ($im, 255, 255, 255);
150
-		$border_color	= imagecolorallocate ($im, 153, 102, 102);
151
-		$text_color		= imagecolorallocate ($im, 204, 153, 153);
149
+		$bg_color = imagecolorallocate($im, 255, 255, 255);
150
+		$border_color	= imagecolorallocate($im, 153, 102, 102);
151
+		$text_color		= imagecolorallocate($im, 204, 153, 153);
152 152
 		$grid_color		= imagecolorallocate($im, 255, 182, 182);
153 153
 		$shadow_color	= imagecolorallocate($im, 255, 240, 240);
154 154
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 		//  Create the spiral pattern
163 163
 		// -----------------------------------
164 164
 
165
-		$theta		= 1;
165
+		$theta = 1;
166 166
 		$thetac		= 7;
167 167
 		$radius		= 16;
168 168
 		$circles	= 20;
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
 		for ($i = 0; $i < ($circles * $points) - 1; $i++)
172 172
 		{
173 173
 			$theta = $theta + $thetac;
174
-			$rad = $radius * ($i / $points );
174
+			$rad = $radius * ($i / $points);
175 175
 			$x = ($rad * cos($theta)) + $x_axis;
176 176
 			$y = ($rad * sin($theta)) + $y_axis;
177 177
 			$theta = $theta + $thetac;
178 178
 			$rad1 = $radius * (($i + 1) / $points);
179 179
 			$x1 = ($rad1 * cos($theta)) + $x_axis;
180
-			$y1 = ($rad1 * sin($theta )) + $y_axis;
180
+			$y1 = ($rad1 * sin($theta)) + $y_axis;
181 181
 			imageline($im, $x, $y, $x1, $y1, $grid_color);
182 182
 			$theta = $theta - $thetac;
183 183
 		}
@@ -191,27 +191,27 @@  discard block
 block discarded – undo
191 191
 		if ($use_font == FALSE)
192 192
 		{
193 193
 			$font_size = 5;
194
-			$x = rand(0, $img_width/($length/3));
194
+			$x = rand(0, $img_width / ($length / 3));
195 195
 			$y = 0;
196 196
 		}
197 197
 		else
198 198
 		{
199
-			$font_size	= 16;
200
-			$x = rand(0, $img_width/($length/1.5));
201
-			$y = $font_size+2;
199
+			$font_size = 16;
200
+			$x = rand(0, $img_width / ($length / 1.5));
201
+			$y = $font_size + 2;
202 202
 		}
203 203
 
204 204
 		for ($i = 0; $i < strlen($word); $i++)
205 205
 		{
206 206
 			if ($use_font == FALSE)
207 207
 			{
208
-				$y = rand(0 , $img_height/2);
208
+				$y = rand(0, $img_height / 2);
209 209
 				imagestring($im, $font_size, $x, $y, substr($word, $i, 1), $text_color);
210
-				$x += ($font_size*2);
210
+				$x += ($font_size * 2);
211 211
 			}
212 212
 			else
213 213
 			{
214
-				$y = rand($img_height/2, $img_height-3);
214
+				$y = rand($img_height / 2, $img_height - 3);
215 215
 				imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, substr($word, $i, 1));
216 216
 				$x += $font_size;
217 217
 			}
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 		//  Create the border
223 223
 		// -----------------------------------
224 224
 
225
-		imagerectangle($im, 0, 0, $img_width-1, $img_height-1, $border_color);
225
+		imagerectangle($im, 0, 0, $img_width - 1, $img_height - 1, $border_color);
226 226
 
227 227
 		// -----------------------------------
228 228
 		//  Generate the image
Please login to merge, or discard this patch.
Braces   +7 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if ( ! defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * CodeIgniter
4 6
  *
@@ -51,8 +53,7 @@  discard block
 block discarded – undo
51 53
 				{
52 54
 					$$key = $val;
53 55
 				}
54
-			}
55
-			else
56
+			} else
56 57
 			{
57 58
 				$$key = ( ! isset($data[$key])) ? $val : $data[$key];
58 59
 			}
@@ -136,8 +137,7 @@  discard block
 block discarded – undo
136 137
 		if (function_exists('imagecreatetruecolor'))
137 138
 		{
138 139
 			$im = imagecreatetruecolor($img_width, $img_height);
139
-		}
140
-		else
140
+		} else
141 141
 		{
142 142
 			$im = imagecreate($img_width, $img_height);
143 143
 		}
@@ -193,8 +193,7 @@  discard block
 block discarded – undo
193 193
 			$font_size = 5;
194 194
 			$x = rand(0, $img_width/($length/3));
195 195
 			$y = 0;
196
-		}
197
-		else
196
+		} else
198 197
 		{
199 198
 			$font_size	= 16;
200 199
 			$x = rand(0, $img_width/($length/1.5));
@@ -208,8 +207,7 @@  discard block
 block discarded – undo
208 207
 				$y = rand(0 , $img_height/2);
209 208
 				imagestring($im, $font_size, $x, $y, substr($word, $i, 1), $text_color);
210 209
 				$x += ($font_size*2);
211
-			}
212
-			else
210
+			} else
213 211
 			{
214 212
 				$y = rand($img_height/2, $img_height-3);
215 213
 				imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, substr($word, $i, 1));
Please login to merge, or discard this patch.
web_interface/astpp/system/helpers/template_inheritance_helper.php 3 patches
Indentation   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -1,40 +1,40 @@  discard block
 block discarded – undo
1 1
 <?php
2
-    /**
3
-     * Django - like template inheritance emulation for PHP
4
-     *
5
-     * @author Daniel Dornhardt <daniel AT dornhardt.com>
6
-     *
7
-     * I liked djangos template inheritance - system, so I decided to create
8
-     * something similar for PHP.
9
-     *
10
-     * It's not pretty, it's not well tested (yet), but from my intuition it should be
11
-     * simple to use and pretty fast.
12
-     *
13
-     * @copyright Copyright (c) 2008 by Daniel Dornhardt
14
-     * @license http://www.opensource.org/licenses/mit-license.php The MIT License
15
-     *
16
-     * Permission is hereby granted, free of charge, to any person
17
-     * obtaining a copy of this software and associated documentation
18
-     * files (the "Software"), to deal in the Software without
19
-     * restriction, including without limitation the rights to use,
20
-     * copy, modify, merge, publish, distribute, sublicense, and/or sell
21
-     * copies of the Software, and to permit persons to whom the
22
-     * Software is furnished to do so, subject to the following
23
-     * conditions:
24
-     *
25
-     * The above copyright notice and this permission notice shall be
26
-     * included in all copies or substantial portions of the Software.
27
-     *
28
-     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29
-     * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
30
-     * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31
-     * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
32
-     * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
33
-     * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
34
-     * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
35
-     * OTHER DEALINGS IN THE SOFTWARE.
36
-     *
37
-     */
2
+	/**
3
+	 * Django - like template inheritance emulation for PHP
4
+	 *
5
+	 * @author Daniel Dornhardt <daniel AT dornhardt.com>
6
+	 *
7
+	 * I liked djangos template inheritance - system, so I decided to create
8
+	 * something similar for PHP.
9
+	 *
10
+	 * It's not pretty, it's not well tested (yet), but from my intuition it should be
11
+	 * simple to use and pretty fast.
12
+	 *
13
+	 * @copyright Copyright (c) 2008 by Daniel Dornhardt
14
+	 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
15
+	 *
16
+	 * Permission is hereby granted, free of charge, to any person
17
+	 * obtaining a copy of this software and associated documentation
18
+	 * files (the "Software"), to deal in the Software without
19
+	 * restriction, including without limitation the rights to use,
20
+	 * copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+	 * copies of the Software, and to permit persons to whom the
22
+	 * Software is furnished to do so, subject to the following
23
+	 * conditions:
24
+	 *
25
+	 * The above copyright notice and this permission notice shall be
26
+	 * included in all copies or substantial portions of the Software.
27
+	 *
28
+	 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29
+	 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
30
+	 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31
+	 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
32
+	 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
33
+	 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
34
+	 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
35
+	 * OTHER DEALINGS IN THE SOFTWARE.
36
+	 *
37
+	 */
38 38
 
39 39
 /*
40 40
 
@@ -236,150 +236,150 @@  discard block
 block discarded – undo
236 236
 
237 237
 That's it for now. If you have questions, ideas or problems, please write me at daniel AT dornhardt.com.
238 238
 */
239
-    if (! defined('TI_VIEWS_DIR') ) {
240
-        if (defined('APPPATH')) {
241
-            define('TI_VIEWS_DIR', APPPATH.'views/');
242
-        } else {
243
-            define('TI_VIEWS_DIR', '');
244
-        }
245
-    }
239
+	if (! defined('TI_VIEWS_DIR') ) {
240
+		if (defined('APPPATH')) {
241
+			define('TI_VIEWS_DIR', APPPATH.'views/');
242
+		} else {
243
+			define('TI_VIEWS_DIR', '');
244
+		}
245
+	}
246 246
 //    echo TI_VIEWS_DIR;
247
-    define('TI_MARKER_EXTEND_BLOCK_HERE', '{{{[[[{[{[{[INSERT_BASE_DATA_HERE]}]}]}]]]}}}');
248
-
249
-    /**
250
-     * Gather output from extended templates
251
-     *
252
-     * array('blockname' => 'blockContent', ...)
253
-     */
254
-    $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'] = array();
255
-
256
-    /**
257
-     * keep the name of the last marker
258
-     */
259
-    $GLOBALS['TI_CURRENT_BLOCKNAME'] = '';
260
-
261
-    /**
262
-     * keep the name of the file we are extending right now
263
-     */
264
-    $GLOBALS['TI_CURRENT_BASE_TEMPLATE'] = '';
265
-
266
-    /**
267
-     * Called to extend some parts of the base template $filename with content from this file
268
-     *
269
-     * @param string $filename - filename of the base template
270
-     */
271
-    function extend($filename) {
247
+	define('TI_MARKER_EXTEND_BLOCK_HERE', '{{{[[[{[{[{[INSERT_BASE_DATA_HERE]}]}]}]]]}}}');
248
+
249
+	/**
250
+	 * Gather output from extended templates
251
+	 *
252
+	 * array('blockname' => 'blockContent', ...)
253
+	 */
254
+	$GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'] = array();
255
+
256
+	/**
257
+	 * keep the name of the last marker
258
+	 */
259
+	$GLOBALS['TI_CURRENT_BLOCKNAME'] = '';
260
+
261
+	/**
262
+	 * keep the name of the file we are extending right now
263
+	 */
264
+	$GLOBALS['TI_CURRENT_BASE_TEMPLATE'] = '';
265
+
266
+	/**
267
+	 * Called to extend some parts of the base template $filename with content from this file
268
+	 *
269
+	 * @param string $filename - filename of the base template
270
+	 */
271
+	function extend($filename) {
272 272
 //    	echo "externd";
273
-        $GLOBALS['TI_CURRENT_BASE_TEMPLATE'] = $filename;
273
+		$GLOBALS['TI_CURRENT_BASE_TEMPLATE'] = $filename;
274 274
 //        exit();
275
-    }
276
-
277
-    /**
278
-     * End the extension process for this file. Needs to be called after all blocks
279
-     * have been set.
280
-     *
281
-     */
282
-    function end_extend() {
283
-    	//echo 'tttttttttttt';
284
-        if (isset($GLOBALS['CI'])) {
285
-            $GLOBALS['CI']->load->view($GLOBALS['TI_CURRENT_BASE_TEMPLATE']);
286
-        }
287
-        else {
288
-            include realpath( TI_VIEWS_DIR . $GLOBALS['TI_CURRENT_BASE_TEMPLATE']);
289
-        }
290
-    }
291
-
292
-    /**
293
-     * Start a top-level block. Its contents can be replaced from within child templates.
294
-     *
295
-     * @param string $blockname
296
-     */
297
-    function start_block_marker($blockname) {
298
-        // remember block name for end_block_marker()
299
-        $GLOBALS['TI_CURRENT_BLOCKNAME'] = $blockname;
300
-        // start caching this blocks output
301
-        ob_start();
302
-    }
303
-
304
-    /**
305
-     * End a top-level block. Its contents can be replaced from within child templates.
306
-     *
307
-     */
308
-    function end_block_marker() {
309
-        // get block content
310
-        $thisBlocksContent = ob_get_clean();
311
-        // check if we got data for this block from child templates
312
-        if (array_key_exists($GLOBALS['TI_CURRENT_BLOCKNAME'], $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'])) {
313
-            // if yes, use that data instead of what's in this block
314
-            // - except we got a marker that the child wants us to include this blocks content
315
-            // in some places. If so, place our data into those spots.
316
-            $thisBlocksContent = str_replace(
317
-                TI_MARKER_EXTEND_BLOCK_HERE,
318
-                $thisBlocksContent,
319
-                $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'][$GLOBALS['TI_CURRENT_BLOCKNAME']]
320
-            );
321
-        }
322
-        // output result
323
-        echo $thisBlocksContent;
324
-    }
325
-
326
-
327
-    /**
328
-     * Mark the start of a block as content to be embedded into the base template.
329
-     *
330
-     * @param string $blockname
331
-     */
332
-    function startblock($blockname) {
333
-        // remember block name for endblock()
334
-        $GLOBALS['TI_CURRENT_BLOCKNAME'] = $blockname;
335
-        // start caching this blocks output
336
-        ob_start();
337
-    }
338
-
339
-    /**
340
-     * Mark the end of a block as content to be embedded into the base template.
341
-     */
342
-    function endblock() {
343
-        // get block content
344
-        $thisBlocksContent = ob_get_clean();
345
-        // check if we got data for this block from child templates
346
-        if (array_key_exists($GLOBALS['TI_CURRENT_BLOCKNAME'], $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'])) {
347
-            // check if we got a marker that the child wants us to include this blocks content
348
-            // in some places. If so, place our data into those spots.
349
-            $thisBlocksContent = str_replace(
350
-                TI_MARKER_EXTEND_BLOCK_HERE,
351
-                $thisBlocksContent,
352
-                $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'][$GLOBALS['TI_CURRENT_BLOCKNAME']]
353
-            );
354
-        }
355
-        // save this blocks content for use in templates higher up in the hierarchy
356
-        $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'][$GLOBALS['TI_CURRENT_BLOCKNAME']] = $thisBlocksContent;
357
-    }
358
-
359
-    /**
360
-     * Insert a marker at this position to add the content from the base templates to this block.
361
-     */
362
-    function get_extended_block() {
363
-        echo TI_MARKER_EXTEND_BLOCK_HERE;
364
-    }
365
-
366
-    /**
367
-     * Check if this block's contents will be needed.
368
-     * True if no child did override this block or a child needs this block's content
369
-     *
370
-     * @return bool
371
-     */
372
-    function block_rendering_neccessary() {
373
-        // check if no child did override this block
374
-        if (!array_key_exists($GLOBALS['TI_CURRENT_BLOCKNAME'], $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'] )) {
375
-            return true;
376
-        }
377
-        // check if there is an extension marker in the child blocks data. If so, the
378
-        // rendering of this block is required
379
-        if (false === strpos($GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'][$GLOBALS['TI_CURRENT_BLOCKNAME']], TI_MARKER_EXTEND_BLOCK_HERE)) {
380
-            return false;
381
-        } else {
382
-            return true;
383
-        }
384
-    }
275
+	}
276
+
277
+	/**
278
+	 * End the extension process for this file. Needs to be called after all blocks
279
+	 * have been set.
280
+	 *
281
+	 */
282
+	function end_extend() {
283
+		//echo 'tttttttttttt';
284
+		if (isset($GLOBALS['CI'])) {
285
+			$GLOBALS['CI']->load->view($GLOBALS['TI_CURRENT_BASE_TEMPLATE']);
286
+		}
287
+		else {
288
+			include realpath( TI_VIEWS_DIR . $GLOBALS['TI_CURRENT_BASE_TEMPLATE']);
289
+		}
290
+	}
291
+
292
+	/**
293
+	 * Start a top-level block. Its contents can be replaced from within child templates.
294
+	 *
295
+	 * @param string $blockname
296
+	 */
297
+	function start_block_marker($blockname) {
298
+		// remember block name for end_block_marker()
299
+		$GLOBALS['TI_CURRENT_BLOCKNAME'] = $blockname;
300
+		// start caching this blocks output
301
+		ob_start();
302
+	}
303
+
304
+	/**
305
+	 * End a top-level block. Its contents can be replaced from within child templates.
306
+	 *
307
+	 */
308
+	function end_block_marker() {
309
+		// get block content
310
+		$thisBlocksContent = ob_get_clean();
311
+		// check if we got data for this block from child templates
312
+		if (array_key_exists($GLOBALS['TI_CURRENT_BLOCKNAME'], $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'])) {
313
+			// if yes, use that data instead of what's in this block
314
+			// - except we got a marker that the child wants us to include this blocks content
315
+			// in some places. If so, place our data into those spots.
316
+			$thisBlocksContent = str_replace(
317
+				TI_MARKER_EXTEND_BLOCK_HERE,
318
+				$thisBlocksContent,
319
+				$GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'][$GLOBALS['TI_CURRENT_BLOCKNAME']]
320
+			);
321
+		}
322
+		// output result
323
+		echo $thisBlocksContent;
324
+	}
325
+
326
+
327
+	/**
328
+	 * Mark the start of a block as content to be embedded into the base template.
329
+	 *
330
+	 * @param string $blockname
331
+	 */
332
+	function startblock($blockname) {
333
+		// remember block name for endblock()
334
+		$GLOBALS['TI_CURRENT_BLOCKNAME'] = $blockname;
335
+		// start caching this blocks output
336
+		ob_start();
337
+	}
338
+
339
+	/**
340
+	 * Mark the end of a block as content to be embedded into the base template.
341
+	 */
342
+	function endblock() {
343
+		// get block content
344
+		$thisBlocksContent = ob_get_clean();
345
+		// check if we got data for this block from child templates
346
+		if (array_key_exists($GLOBALS['TI_CURRENT_BLOCKNAME'], $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'])) {
347
+			// check if we got a marker that the child wants us to include this blocks content
348
+			// in some places. If so, place our data into those spots.
349
+			$thisBlocksContent = str_replace(
350
+				TI_MARKER_EXTEND_BLOCK_HERE,
351
+				$thisBlocksContent,
352
+				$GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'][$GLOBALS['TI_CURRENT_BLOCKNAME']]
353
+			);
354
+		}
355
+		// save this blocks content for use in templates higher up in the hierarchy
356
+		$GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'][$GLOBALS['TI_CURRENT_BLOCKNAME']] = $thisBlocksContent;
357
+	}
358
+
359
+	/**
360
+	 * Insert a marker at this position to add the content from the base templates to this block.
361
+	 */
362
+	function get_extended_block() {
363
+		echo TI_MARKER_EXTEND_BLOCK_HERE;
364
+	}
365
+
366
+	/**
367
+	 * Check if this block's contents will be needed.
368
+	 * True if no child did override this block or a child needs this block's content
369
+	 *
370
+	 * @return bool
371
+	 */
372
+	function block_rendering_neccessary() {
373
+		// check if no child did override this block
374
+		if (!array_key_exists($GLOBALS['TI_CURRENT_BLOCKNAME'], $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'] )) {
375
+			return true;
376
+		}
377
+		// check if there is an extension marker in the child blocks data. If so, the
378
+		// rendering of this block is required
379
+		if (false === strpos($GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'][$GLOBALS['TI_CURRENT_BLOCKNAME']], TI_MARKER_EXTEND_BLOCK_HERE)) {
380
+			return false;
381
+		} else {
382
+			return true;
383
+		}
384
+	}
385 385
 ?>  
386 386
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 That's it for now. If you have questions, ideas or problems, please write me at daniel AT dornhardt.com.
238 238
 */
239
-    if (! defined('TI_VIEWS_DIR') ) {
239
+    if ( ! defined('TI_VIEWS_DIR')) {
240 240
         if (defined('APPPATH')) {
241 241
             define('TI_VIEWS_DIR', APPPATH.'views/');
242 242
         } else {
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             $GLOBALS['CI']->load->view($GLOBALS['TI_CURRENT_BASE_TEMPLATE']);
286 286
         }
287 287
         else {
288
-            include realpath( TI_VIEWS_DIR . $GLOBALS['TI_CURRENT_BASE_TEMPLATE']);
288
+            include realpath(TI_VIEWS_DIR.$GLOBALS['TI_CURRENT_BASE_TEMPLATE']);
289 289
         }
290 290
     }
291 291
 
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
      */
372 372
     function block_rendering_neccessary() {
373 373
         // check if no child did override this block
374
-        if (!array_key_exists($GLOBALS['TI_CURRENT_BLOCKNAME'], $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'] )) {
374
+        if ( ! array_key_exists($GLOBALS['TI_CURRENT_BLOCKNAME'], $GLOBALS['TI_EXTENDED_BASE_TEMPLATE_DATA'])) {
375 375
             return true;
376 376
         }
377 377
         // check if there is an extension marker in the child blocks data. If so, the
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -283,8 +283,7 @@
 block discarded – undo
283 283
     	//echo 'tttttttttttt';
284 284
         if (isset($GLOBALS['CI'])) {
285 285
             $GLOBALS['CI']->load->view($GLOBALS['TI_CURRENT_BASE_TEMPLATE']);
286
-        }
287
-        else {
286
+        } else {
288 287
             include realpath( TI_VIEWS_DIR . $GLOBALS['TI_CURRENT_BASE_TEMPLATE']);
289 288
         }
290 289
     }
Please login to merge, or discard this patch.
web_interface/astpp/system/helpers/text_helper.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 			return $str;
48 48
 		}
49 49
 
50
-		preg_match('/^\s*+(?:\S++\s*+){1,'.(int) $limit.'}/', $str, $matches);
50
+		preg_match('/^\s*+(?:\S++\s*+){1,'.(int)$limit.'}/', $str, $matches);
51 51
 
52 52
 		if (strlen($str) == strlen($matches[0]))
53 53
 		{
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 {
118 118
 	function ascii_to_entities($str)
119 119
 	{
120
-		$count	= 1;
121
-		$out	= '';
122
-		$temp	= array();
120
+		$count = 1;
121
+		$out = '';
122
+		$temp = array();
123 123
 
124 124
 		for ($i = 0, $s = strlen($str); $i < $s; $i++)
125 125
 		{
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 		if ($all)
212 212
 		{
213 213
 			$str = str_replace(array("&amp;", "&lt;", "&gt;", "&quot;", "&apos;", "&#45;"),
214
-								array("&","<",">","\"", "'", "-"),
214
+								array("&", "<", ">", "\"", "'", "-"),
215 215
 								$str);
216 216
 		}
217 217
 
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 				}
455 455
 
456 456
 				// Trim the word down
457
-				$temp .= substr($line, 0, $charlim-1);
458
-				$line = substr($line, $charlim-1);
457
+				$temp .= substr($line, 0, $charlim - 1);
458
+				$line = substr($line, $charlim - 1);
459 459
 			}
460 460
 
461 461
 			// If $temp contains data it means we had to split up an over-length
Please login to merge, or discard this patch.
Braces   +13 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if ( ! defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * CodeIgniter
4 6
  *
@@ -138,8 +140,7 @@  discard block
 block discarded – undo
138 140
 				}
139 141
 
140 142
 				$out .= $str[$i];
141
-			}
142
-			else
143
+			} else
143 144
 			{
144 145
 				if (count($temp) == 0)
145 146
 				{
@@ -191,13 +192,11 @@  discard block
 block discarded – undo
191 192
 				{
192 193
 					$out .= chr($digits);
193 194
 
194
-				}
195
-				elseif ($digits < 2048)
195
+				} elseif ($digits < 2048)
196 196
 				{
197 197
 					$out .= chr(192 + (($digits - ($digits % 64)) / 64));
198 198
 					$out .= chr(128 + ($digits % 64));
199
-				}
200
-				else
199
+				} else
201 200
 				{
202 201
 					$out .= chr(224 + (($digits - ($digits % 4096)) / 4096));
203 202
 					$out .= chr(128 + ((($digits % 4096) - ($digits % 64)) / 64));
@@ -256,8 +255,7 @@  discard block
 block discarded – undo
256 255
 			if ($replacement != '')
257 256
 			{
258 257
 				$str = preg_replace("/({$delim})(".str_replace('\*', '\w*?', preg_quote($badword, '/')).")({$delim})/i", "\\1{$replacement}\\3", $str);
259
-			}
260
-			else
258
+			} else
261 259
 			{
262 260
 				$str = preg_replace("/({$delim})(".str_replace('\*', '\w*?', preg_quote($badword, '/')).")({$delim})/ie", "'\\1'.str_repeat('#', strlen('\\2')).'\\3'", $str);
263 261
 			}
@@ -369,8 +367,7 @@  discard block
 block discarded – undo
369 367
 		if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'))
370 368
 		{
371 369
 			include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php');
372
-		}
373
-		elseif (is_file(APPPATH.'config/foreign_chars.php'))
370
+		} elseif (is_file(APPPATH.'config/foreign_chars.php'))
374 371
 		{
375 372
 			include(APPPATH.'config/foreign_chars.php');
376 373
 		}
@@ -403,8 +400,9 @@  discard block
 block discarded – undo
403 400
 	function word_wrap($str, $charlim = '76')
404 401
 	{
405 402
 		// Se the character limit
406
-		if ( ! is_numeric($charlim))
407
-			$charlim = 76;
403
+		if ( ! is_numeric($charlim)) {
404
+					$charlim = 76;
405
+		}
408 406
 
409 407
 		// Reduce multiple spaces
410 408
 		$str = preg_replace("| +|", " ", $str);
@@ -463,8 +461,7 @@  discard block
 block discarded – undo
463 461
 			if ($temp != '')
464 462
 			{
465 463
 				$output .= $temp."\n".$line;
466
-			}
467
-			else
464
+			} else
468 465
 			{
469 466
 				$output .= $line;
470 467
 			}
@@ -521,8 +518,7 @@  discard block
 block discarded – undo
521 518
 		if ($position === 1)
522 519
 		{
523 520
 			$end = substr($str, 0, -($max_length - strlen($beg)));
524
-		}
525
-		else
521
+		} else
526 522
 		{
527 523
 			$end = substr($str, -($max_length - strlen($beg)));
528 524
 		}
Please login to merge, or discard this patch.
web_interface/astpp/system/helpers/number_helper.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 {
39 39
 	function byte_format($num, $precision = 1)
40 40
 	{
41
-		$CI =& get_instance();
41
+		$CI = & get_instance();
42 42
 		$CI->lang->load('number');
43 43
 
44 44
 		if ($num >= 1000000000000)
Please login to merge, or discard this patch.
Braces   +7 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if ( ! defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * CodeIgniter
4 6
  *
@@ -45,23 +47,19 @@  discard block
 block discarded – undo
45 47
 		{
46 48
 			$num = round($num / 1099511627776, $precision);
47 49
 			$unit = $CI->lang->line('terabyte_abbr');
48
-		}
49
-		elseif ($num >= 1000000000)
50
+		} elseif ($num >= 1000000000)
50 51
 		{
51 52
 			$num = round($num / 1073741824, $precision);
52 53
 			$unit = $CI->lang->line('gigabyte_abbr');
53
-		}
54
-		elseif ($num >= 1000000)
54
+		} elseif ($num >= 1000000)
55 55
 		{
56 56
 			$num = round($num / 1048576, $precision);
57 57
 			$unit = $CI->lang->line('megabyte_abbr');
58
-		}
59
-		elseif ($num >= 1000)
58
+		} elseif ($num >= 1000)
60 59
 		{
61 60
 			$num = round($num / 1024, $precision);
62 61
 			$unit = $CI->lang->line('kilobyte_abbr');
63
-		}
64
-		else
62
+		} else
65 63
 		{
66 64
 			$unit = $CI->lang->line('bytes');
67 65
 			return number_format($num).' '.$unit;
Please login to merge, or discard this patch.
web_interface/astpp/system/language/english/ftp_lang.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$lang['ftp_no_connection']			= "Unable to locate a valid connection ID. Please make sure you are connected before peforming any file routines.";
4
-$lang['ftp_unable_to_connect']		= "Unable to connect to your FTP server using the supplied hostname.";
3
+$lang['ftp_no_connection'] = "Unable to locate a valid connection ID. Please make sure you are connected before peforming any file routines.";
4
+$lang['ftp_unable_to_connect'] = "Unable to connect to your FTP server using the supplied hostname.";
5 5
 $lang['ftp_unable_to_login']		= "Unable to login to your FTP server. Please check your username and password.";
6 6
 $lang['ftp_unable_to_makdir']		= "Unable to create the directory you have specified.";
7 7
 $lang['ftp_unable_to_changedir']	= "Unable to change directories.";
Please login to merge, or discard this patch.
web_interface/astpp/system/language/english/unit_test_lang.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-$lang['ut_test_name']		= 'Test Name';
4
-$lang['ut_test_datatype']	= 'Test Datatype';
5
-$lang['ut_res_datatype']	= 'Expected Datatype';
6
-$lang['ut_result']			= 'Result';
7
-$lang['ut_undefined']		= 'Undefined Test Name';
3
+$lang['ut_test_name'] = 'Test Name';
4
+$lang['ut_test_datatype'] = 'Test Datatype';
5
+$lang['ut_res_datatype'] = 'Expected Datatype';
6
+$lang['ut_result'] = 'Result';
7
+$lang['ut_undefined'] = 'Undefined Test Name';
8 8
 $lang['ut_file']			= 'File Name';
9 9
 $lang['ut_line']			= 'Line Number';
10 10
 $lang['ut_passed']			= 'Passed';
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 $lang['ut_string']			= 'String';
17 17
 $lang['ut_array']			= 'Array';
18 18
 $lang['ut_object']			= 'Object';
19
-$lang['ut_resource']		= 'Resource';
20
-$lang['ut_null']			= 'Null';
21
-$lang['ut_notes']			= 'Notes';
19
+$lang['ut_resource'] = 'Resource';
20
+$lang['ut_null'] = 'Null';
21
+$lang['ut_notes'] = 'Notes';
22 22
 
23 23
 
24 24
 /* End of file unit_test_lang.php */
Please login to merge, or discard this patch.
web_interface/astpp/system/language/english/profiler_lang.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-$lang['profiler_database']		= 'DATABASE';
3
+$lang['profiler_database'] = 'DATABASE';
4 4
 $lang['profiler_controller_info'] = 'CLASS/METHOD';
5 5
 $lang['profiler_benchmarks']	= 'BENCHMARKS';
6
-$lang['profiler_queries']		= 'QUERIES';
7
-$lang['profiler_get_data']		= 'GET DATA';
6
+$lang['profiler_queries'] = 'QUERIES';
7
+$lang['profiler_get_data'] = 'GET DATA';
8 8
 $lang['profiler_post_data']		= 'POST DATA';
9 9
 $lang['profiler_uri_string']	= 'URI STRING';
10 10
 $lang['profiler_memory_usage']	= 'MEMORY USAGE';
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
 $lang['profiler_session_data']	= 'SESSION DATA';
13 13
 $lang['profiler_headers']		= 'HTTP HEADERS';
14 14
 $lang['profiler_no_db']			= 'Database driver is not currently loaded';
15
-$lang['profiler_no_queries']	= 'No queries were run';
15
+$lang['profiler_no_queries'] = 'No queries were run';
16 16
 $lang['profiler_no_post']		= 'No POST data exists';
17 17
 $lang['profiler_no_get']		= 'No GET data exists';
18 18
 $lang['profiler_no_uri']		= 'No URI data exists';
19
-$lang['profiler_no_memory']		= 'Memory Usage Unavailable';
20
-$lang['profiler_no_profiles']	= 'No Profile data - all Profiler sections have been disabled.';
19
+$lang['profiler_no_memory'] = 'Memory Usage Unavailable';
20
+$lang['profiler_no_profiles'] = 'No Profile data - all Profiler sections have been disabled.';
21 21
 $lang['profiler_section_hide']	= 'Hide';
22 22
 $lang['profiler_section_show']	= 'Show';
23 23
 
Please login to merge, or discard this patch.