ecl.php ➔ Ecl()   A
last analyzed

Complexity

Conditions 6
Paths 24

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
nc 24
nop 3
dl 0
loc 17
rs 9.0777
c 0
b 0
f 0
1
<?php
2
/**
3
 * Smarty echo line, end with \n or <br /> according running mod
4
 * @package     fwolflib
5
 * @copyright   Copyright 2006-2010, Fwolf
6
 * @author      Fwolf <[email protected]>
7
 * @since		2006-10-27
8
 */
9
10
11
require_once(dirname(__FILE__) . '/../fwolflib.php');
12
require_once(FWOLFLIB . 'func/env.php');
13
14
15
/*
16
 * Smarty echo line, end with \n or <br /> according running mod
17
 *
18
 * @deprecated      Use Fwlib\Util\Env::ecl()
19
 * @param	string	$str	Content to echo.
20
 * @param	int		$mode	Running mod, 0 for auto detect, 1 for web browser
21
 							2 for cli mode.
22
 * @param	int		$noecho	Return output string(1) instead of echo out(0).
23
 * @return	string
24
 */
25
function Ecl($str, $mode = 0, $noecho = 1) {
26
	if (0 == $mode)
27
		$mode = IsCli() ?  2 : 1;
0 ignored issues
show
Deprecated Code introduced by
The function IsCli() has been deprecated with message: Use Fwlib\Util\Env::isCli()

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
28
	if (1 == $mode)
29
		// Add <br />
30
		$str = str_replace("\n", "<br />\n", $str) . "<br />\n";
31
	if (2 == $mode)
32
		// Only need to add a tail \n
33
		$str .= "\n";
34
	//$s_br = (2 == $mode) ? "\n" : "\n<br />";
35
	//$str .= $s_br;
36
	if (0 == $noecho)
37
		return($str);
38
	else
39
		echo($str);
40
	return($str);
41
} // end of function Ecl
42
43
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
44