@@ -9,6 +9,9 @@ |
||
| 9 | 9 | return jBlockEnd($_type, $_parameters); |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | + /** |
|
| 13 | + * @param string $_path |
|
| 14 | + */ |
|
| 12 | 15 | function jBlockFile( $_path, $_parameters = [] ) { |
| 13 | 16 | try { |
| 14 | 17 | $temp = Parser::parseFile($_path, $_parameters); |
@@ -5,11 +5,11 @@ discard block |
||
| 5 | 5 | return ob_start(); |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | - function jBlockClose( $_type = "html", $_parameters = [] ) { |
|
| 8 | + function jBlockClose($_type = "html", $_parameters = []) { |
|
| 9 | 9 | return jBlockEnd($_type, $_parameters); |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | - function jBlockFile( $_path, $_parameters = [] ) { |
|
| 12 | + function jBlockFile($_path, $_parameters = []) { |
|
| 13 | 13 | try { |
| 14 | 14 | $temp = Parser::parseFile($_path, $_parameters); |
| 15 | 15 | } catch (Exception $e) { |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | return $temp; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - function jBlockFileMan( $_path, $_type, $_parameters = [] ) { |
|
| 21 | + function jBlockFileMan($_path, $_type, $_parameters = []) { |
|
| 22 | 22 | try { |
| 23 | 23 | $temp = Parser::parseFileMan($_path, $_parameters, $_type); |
| 24 | 24 | } catch (Exception $e) { |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | return $temp; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - function jBlockEnd( $_type = "html", $_parameters = [] ) { |
|
| 30 | + function jBlockEnd($_type = "html", $_parameters = []) { |
|
| 31 | 31 | $text = ob_get_clean(); |
| 32 | 32 | try { |
| 33 | 33 | $temp = Parser::parseText($text, $_parameters, $_type); |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | function minifyOutput($_buffer) { |
| 41 | - $search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' ); |
|
| 42 | - $replace = array ( '>', '<', '\\1' ); |
|
| 43 | - if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) |
|
| 41 | + $search = array('/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s'); |
|
| 42 | + $replace = array('>', '<', '\\1'); |
|
| 43 | + if (preg_match("/\<html/i", $_buffer) == 1 && preg_match("/\<\/html\>/i", $_buffer) == 1) |
|
| 44 | 44 | $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
| 45 | 45 | return utf8_encode($_buffer); |
| 46 | 46 | } |
@@ -1,4 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | + /** |
|
| 3 | + * @param integer $number |
|
| 4 | + */ |
|
| 2 | 5 | function jateErrorHandler($number, $message, $file, $line) { |
| 3 | 6 | if (!(error_reporting() & $number)) { |
| 4 | 7 | return false; |
@@ -3,6 +3,10 @@ |
||
| 3 | 3 | class Connection { |
| 4 | 4 | public $database; |
| 5 | 5 | public $info; |
| 6 | + |
|
| 7 | + /** |
|
| 8 | + * @param JConfig $_object |
|
| 9 | + */ |
|
| 6 | 10 | public function __construct( $_object ) { |
| 7 | 11 | if(!is_object($_object)) |
| 8 | 12 | throw new InvalidArgumentException("Parameter must be an object."); |
@@ -3,8 +3,8 @@ discard block |
||
| 3 | 3 | class Connection { |
| 4 | 4 | public $database; |
| 5 | 5 | public $info; |
| 6 | - public function __construct( $_object ) { |
|
| 7 | - if(!is_object($_object)) |
|
| 6 | + public function __construct($_object) { |
|
| 7 | + if (!is_object($_object)) |
|
| 8 | 8 | throw new InvalidArgumentException("Parameter must be an object."); |
| 9 | 9 | $this->setConnection( |
| 10 | 10 | $_object->server, |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | $this->getConnectionType($_object->engine) |
| 15 | 15 | ); |
| 16 | 16 | } |
| 17 | - protected function setConnection ( $_srv, $_db, $_usr, $_pass, $_type ) { |
|
| 17 | + protected function setConnection($_srv, $_db, $_usr, $_pass, $_type) { |
|
| 18 | 18 | switch ($_type) { |
| 19 | 19 | case "mysqli": |
| 20 | 20 | $this->database = new MysqliAdapter($_srv, $_db, $_usr, $_pass); |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | break; |
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | - protected function getConnectionType( $_type ) { |
|
| 35 | - $array = (array)$_type; |
|
| 34 | + protected function getConnectionType($_type) { |
|
| 35 | + $array = (array) $_type; |
|
| 36 | 36 | foreach ($array as $key => $value) |
| 37 | - if($value) |
|
| 37 | + if ($value) |
|
| 38 | 38 | return $key; |
| 39 | 39 | return "pdo"; |
| 40 | 40 | } |
@@ -47,6 +47,10 @@ |
||
| 47 | 47 | if(!(file_exists($_file) || $this->isCorrectUrl($_file))) |
| 48 | 48 | throw new JException("File [$_file] not found."); |
| 49 | 49 | } |
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * @param string $_url |
|
| 53 | + */ |
|
| 50 | 54 | protected function isCorrectUrl( $_url ) { |
| 51 | 55 | return strpos(@get_headers($_url)[0],'200') === false ? false : true; |
| 52 | 56 | } |
@@ -7,30 +7,30 @@ discard block |
||
| 7 | 7 | "attached" => [] |
| 8 | 8 | ]; |
| 9 | 9 | } |
| 10 | - public function addFile( $_file ) { |
|
| 10 | + public function addFile($_file) { |
|
| 11 | 11 | try { |
| 12 | 12 | $this->isCorrectPath($_file); |
| 13 | - } catch( Exception $e) { |
|
| 13 | + } catch (Exception $e) { |
|
| 14 | 14 | throw new JException($e->getMessage()); |
| 15 | 15 | } |
| 16 | 16 | $this->files["attached"][] = $_file; |
| 17 | 17 | } |
| 18 | - public function addFileRequired( $_file ) { |
|
| 18 | + public function addFileRequired($_file) { |
|
| 19 | 19 | try { |
| 20 | 20 | $this->isCorrectPath($_file); |
| 21 | - } catch( Exception $e) { |
|
| 21 | + } catch (Exception $e) { |
|
| 22 | 22 | throw new JException($e->getMessage()); |
| 23 | 23 | } |
| 24 | 24 | $this->files["required"][] = $_file; |
| 25 | 25 | } |
| 26 | - public function addFiles( $_files ) { |
|
| 27 | - if(!is_array($_files)) |
|
| 26 | + public function addFiles($_files) { |
|
| 27 | + if (!is_array($_files)) |
|
| 28 | 28 | throw new JException("Parameter must be an array."); |
| 29 | 29 | foreach ($_files as $value) |
| 30 | 30 | $this->addFile($value); |
| 31 | 31 | } |
| 32 | - public function addFilesRequired( $_files ) { |
|
| 33 | - if(!is_array($_files)) |
|
| 32 | + public function addFilesRequired($_files) { |
|
| 33 | + if (!is_array($_files)) |
|
| 34 | 34 | throw new JException("Parameter must be an array."); |
| 35 | 35 | foreach ($_files as $value) |
| 36 | 36 | $this->addFileRequired($value); |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | public function getFilesRequired() { |
| 42 | 42 | return $this->files["required"]; |
| 43 | 43 | } |
| 44 | - protected function isCorrectPath( $_file ) { |
|
| 45 | - if(!is_string($_file)) |
|
| 44 | + protected function isCorrectPath($_file) { |
|
| 45 | + if (!is_string($_file)) |
|
| 46 | 46 | throw new JException("Path must be a string."); |
| 47 | - if(!(file_exists($_file) || $this->isCorrectUrl($_file))) |
|
| 47 | + if (!(file_exists($_file) || $this->isCorrectUrl($_file))) |
|
| 48 | 48 | throw new JException("File [$_file] not found."); |
| 49 | 49 | } |
| 50 | - protected function isCorrectUrl( $_url ) { |
|
| 51 | - return strpos(@get_headers($_url)[0],'200') === false ? false : true; |
|
| 50 | + protected function isCorrectUrl($_url) { |
|
| 51 | + return strpos(@get_headers($_url)[0], '200') === false ? false : true; |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | ?> |
@@ -83,6 +83,11 @@ |
||
| 83 | 83 | $this->tags["js"] = $this->getJs(); |
| 84 | 84 | $this->tags["jsVar"] = $this->getJsVars(); |
| 85 | 85 | } |
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * @param string $_function |
|
| 89 | + * @param string $_extenction |
|
| 90 | + */ |
|
| 86 | 91 | protected function getRequire( $_function, $_extenction) { |
| 87 | 92 | $temp = []; |
| 88 | 93 | $filesRequired = $this->getFilesRequired(); |
@@ -21,13 +21,13 @@ discard block |
||
| 21 | 21 | "base" => "" |
| 22 | 22 | ]; |
| 23 | 23 | } |
| 24 | - public function setParameters( $_parameters = [ "app" => null, "page" => null] ) { |
|
| 24 | + public function setParameters($_parameters = ["app" => null, "page" => null]) { |
|
| 25 | 25 | $this->app = $_parameters["app"]; |
| 26 | 26 | $this->page = $_parameters["page"]; |
| 27 | 27 | } |
| 28 | 28 | abstract public function init(); |
| 29 | 29 | public function draw() { |
| 30 | - if($this->template == "") |
|
| 30 | + if ($this->template == "") |
|
| 31 | 31 | throw new JException("The variable \$this->template must be set in class $this->name function init()."); |
| 32 | 32 | $server = new ServerVars(); |
| 33 | 33 | $this->addDipendences(); |
@@ -38,23 +38,23 @@ discard block |
||
| 38 | 38 | return jBlockFile($this->template, $this->tags); |
| 39 | 39 | } |
| 40 | 40 | public function getCss() { |
| 41 | - return $this->getRequire("getCss",".css"); |
|
| 41 | + return $this->getRequire("getCss", ".css"); |
|
| 42 | 42 | } |
| 43 | 43 | public function getJs() { |
| 44 | - return $this->getRequire("getJs",".js"); |
|
| 44 | + return $this->getRequire("getJs", ".js"); |
|
| 45 | 45 | } |
| 46 | 46 | public function getJsVars() { |
| 47 | 47 | return $this->jsVars; |
| 48 | 48 | } |
| 49 | - public function addJsVar( $_name, $_value ) { |
|
| 50 | - if(!is_string($_name)) |
|
| 49 | + public function addJsVar($_name, $_value) { |
|
| 50 | + if (!is_string($_name)) |
|
| 51 | 51 | throw new InvalidArgumentException("Parameter name must be a string."); |
| 52 | - if(!is_string($_value)) |
|
| 52 | + if (!is_string($_value)) |
|
| 53 | 53 | throw new InvalidArgumentException("Parameter value must be a string."); |
| 54 | 54 | $this->jsVars[] = [$_name, $_value]; |
| 55 | 55 | } |
| 56 | - public function addJsVars( $_array ) { |
|
| 57 | - if(!is_array($_array)) |
|
| 56 | + public function addJsVars($_array) { |
|
| 57 | + if (!is_array($_array)) |
|
| 58 | 58 | throw new InvalidArgumentException("Parameter must be an array."); |
| 59 | 59 | foreach ($_array as $value) |
| 60 | 60 | $this->addJsVar($value[0], $value[1]); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $this->tags["js"] = $this->getJs(); |
| 84 | 84 | $this->tags["jsVar"] = $this->getJsVars(); |
| 85 | 85 | } |
| 86 | - protected function getRequire( $_function, $_extenction) { |
|
| 86 | + protected function getRequire($_function, $_extenction) { |
|
| 87 | 87 | $temp = []; |
| 88 | 88 | $filesRequired = $this->getFilesRequired(); |
| 89 | 89 | $files = $this->getFiles(); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
| 92 | 92 | $temp[] = $i; |
| 93 | 93 | foreach ($this->modules as $i) |
| 94 | - $temp = array_merge( $temp, $i->$_function() ); |
|
| 94 | + $temp = array_merge($temp, $i->$_function()); |
|
| 95 | 95 | foreach ($files as $i) |
| 96 | 96 | if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
| 97 | 97 | $temp[] = $i; |
@@ -1,8 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | abstract class ParserAbstract { |
| 3 | + |
|
| 4 | + /** |
|
| 5 | + * @param string $_text |
|
| 6 | + */ |
|
| 3 | 7 | public function drawText( $_text, $_parameters = [] ) { |
| 4 | 8 | return $this->draw(trim($_text), $_parameters); |
| 5 | 9 | } |
| 10 | + |
|
| 11 | + /** |
|
| 12 | + * @param string $_text |
|
| 13 | + */ |
|
| 6 | 14 | abstract public function draw( $_text, $_parameters = [] ); |
| 7 | 15 | } |
| 8 | 16 | ?> |
@@ -1,8 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | abstract class ParserAbstract { |
| 3 | - public function drawText( $_text, $_parameters = [] ) { |
|
| 3 | + public function drawText($_text, $_parameters = []) { |
|
| 4 | 4 | return $this->draw(trim($_text), $_parameters); |
| 5 | 5 | } |
| 6 | - abstract public function draw( $_text, $_parameters = [] ); |
|
| 6 | + abstract public function draw($_text, $_parameters = []); |
|
| 7 | 7 | } |
| 8 | 8 | ?> |
@@ -2,6 +2,10 @@ discard block |
||
| 2 | 2 | requireComponents("Adapters"); |
| 3 | 3 | jRequire("../JException/JException.php"); |
| 4 | 4 | class Parser { |
| 5 | + |
|
| 6 | + /** |
|
| 7 | + * @param string $_type |
|
| 8 | + */ |
|
| 5 | 9 | private static function setParser ( $_type ) { |
| 6 | 10 | $parser = null; |
| 7 | 11 | $_type = strtolower($_type); |
@@ -27,6 +31,10 @@ discard block |
||
| 27 | 31 | } |
| 28 | 32 | return $parser; |
| 29 | 33 | } |
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * @param string $_text |
|
| 37 | + */ |
|
| 30 | 38 | public static function parseText( $_text, $_parameters = [], $_type = "html" ) { |
| 31 | 39 | if(!is_string($_text) || !is_string($_type)) |
| 32 | 40 | throw new JException("Parameter must be a string."); |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | requireComponents("Adapters"); |
| 3 | 3 | jRequire("../JException/JException.php"); |
| 4 | 4 | class Parser { |
| 5 | - private static function setParser ( $_type ) { |
|
| 5 | + private static function setParser($_type) { |
|
| 6 | 6 | $parser = null; |
| 7 | 7 | $_type = strtolower($_type); |
| 8 | 8 | switch ($_type) { |
@@ -27,20 +27,20 @@ discard block |
||
| 27 | 27 | } |
| 28 | 28 | return $parser; |
| 29 | 29 | } |
| 30 | - public static function parseText( $_text, $_parameters = [], $_type = "html" ) { |
|
| 31 | - if(!is_string($_text) || !is_string($_type)) |
|
| 30 | + public static function parseText($_text, $_parameters = [], $_type = "html") { |
|
| 31 | + if (!is_string($_text) || !is_string($_type)) |
|
| 32 | 32 | throw new JException("Parameter must be a string."); |
| 33 | - if(!is_array($_parameters)) |
|
| 33 | + if (!is_array($_parameters)) |
|
| 34 | 34 | throw new JException("Parameter must be an array."); |
| 35 | 35 | $parser = self::setParser($_type); |
| 36 | - if($parser === -1) |
|
| 36 | + if ($parser === -1) |
|
| 37 | 37 | return $_text; |
| 38 | 38 | return $parser->drawText($_text, $_parameters); |
| 39 | 39 | } |
| 40 | - public static function parseFileMan( $_path, $_parameters = [], $_type = "html" ) { |
|
| 41 | - if(!is_string($_path)) |
|
| 40 | + public static function parseFileMan($_path, $_parameters = [], $_type = "html") { |
|
| 41 | + if (!is_string($_path)) |
|
| 42 | 42 | throw new JException("Parameter must be a string."); |
| 43 | - if(!file_exists($_path)) |
|
| 43 | + if (!file_exists($_path)) |
|
| 44 | 44 | throw new JException("File [$_path] not found."); |
| 45 | 45 | $string = file_get_contents($_path); |
| 46 | 46 | try { |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | return $text; |
| 52 | 52 | } |
| 53 | - public static function parseFile( $_path, $_parameters = [] ) { |
|
| 54 | - if(!is_string($_path)) |
|
| 53 | + public static function parseFile($_path, $_parameters = []) { |
|
| 54 | + if (!is_string($_path)) |
|
| 55 | 55 | throw new JException("Parameter must be a string."); |
| 56 | 56 | $extension = explode(".", $_path); |
| 57 | - $extension = $extension[count($extension)-1]; |
|
| 57 | + $extension = $extension[count($extension) - 1]; |
|
| 58 | 58 | $extension = strtolower($extension); |
| 59 | 59 | try { |
| 60 | 60 | $text = self::parseFileMan($_path, $_parameters, $extension); |
@@ -22,6 +22,10 @@ |
||
| 22 | 22 | throw new JException($e->getMessage(), 1); |
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * @param Connection $_connection |
|
| 28 | + */ |
|
| 25 | 29 | public function addConnectionMan( $_connection, $_name = "default") { |
| 26 | 30 | if(!is_object($_connection) || !is_a($_connection, "Connection")) |
| 27 | 31 | throw new JException("Parameter must be a Connection object.", 1); |
@@ -9,12 +9,12 @@ discard block |
||
| 9 | 9 | $this->connection = []; |
| 10 | 10 | $this->currentConnection = null; |
| 11 | 11 | } |
| 12 | - public function addConnection( $_path, $_name = "default" ) { |
|
| 13 | - if(!is_string($_path)) |
|
| 12 | + public function addConnection($_path, $_name = "default") { |
|
| 13 | + if (!is_string($_path)) |
|
| 14 | 14 | throw new JException("Parameter must be a string.", 1); |
| 15 | 15 | try { |
| 16 | 16 | $jConfig = new JConfig($_path); |
| 17 | - if($jConfig->enable) { |
|
| 17 | + if ($jConfig->enable) { |
|
| 18 | 18 | $connection = new Connection($jConfig); |
| 19 | 19 | $this->addConnectionMan($connection, $_name); |
| 20 | 20 | } |
@@ -22,28 +22,28 @@ discard block |
||
| 22 | 22 | throw new JException($e->getMessage(), 1); |
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | - public function addConnectionMan( $_connection, $_name = "default") { |
|
| 26 | - if(!is_object($_connection) || !is_a($_connection, "Connection")) |
|
| 25 | + public function addConnectionMan($_connection, $_name = "default") { |
|
| 26 | + if (!is_object($_connection) || !is_a($_connection, "Connection")) |
|
| 27 | 27 | throw new JException("Parameter must be a Connection object.", 1); |
| 28 | 28 | try { |
| 29 | 29 | $this->connection["$_name"] = $_connection; |
| 30 | 30 | $this->currentConnection = $_connection; |
| 31 | 31 | foreach ($this->modules as &$module) |
| 32 | - if(isset($this->currentConnection)) |
|
| 32 | + if (isset($this->currentConnection)) |
|
| 33 | 33 | $module->addConnectionMan($this->currentConnection, $_name); |
| 34 | 34 | } catch (Exception $e) { |
| 35 | 35 | throw new JException($e->getMessage(), 1); |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | - public function setConnection( $_name = "default" ) { |
|
| 39 | - if(!is_string($_name)) |
|
| 38 | + public function setConnection($_name = "default") { |
|
| 39 | + if (!is_string($_name)) |
|
| 40 | 40 | throw new JException("Parameter must be a string.", 1); |
| 41 | - if(!isset($this->connection["$_name"])) |
|
| 41 | + if (!isset($this->connection["$_name"])) |
|
| 42 | 42 | throw new JException("This connection name does not exist.", 1); |
| 43 | 43 | $this->currentConnection = $this->connection["$_name"]; |
| 44 | 44 | } |
| 45 | - public function query( $_query ) { |
|
| 46 | - if(!is_string($_query)) |
|
| 45 | + public function query($_query) { |
|
| 46 | + if (!is_string($_query)) |
|
| 47 | 47 | throw new JException("Parameter must be a string.", 1); |
| 48 | 48 | try { |
| 49 | 49 | $temp = $this->currentConnection->database->query($_query); |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | return $temp; |
| 54 | 54 | } |
| 55 | - public function queryInsert( $_query ) { |
|
| 56 | - if(!is_string($_query)) |
|
| 55 | + public function queryInsert($_query) { |
|
| 56 | + if (!is_string($_query)) |
|
| 57 | 57 | throw new JException("Parameter must be a string.", 1); |
| 58 | 58 | try { |
| 59 | 59 | $temp = $this->currentConnection->database->queryInsert($_query); |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | return $temp; |
| 64 | 64 | } |
| 65 | - public function queryFetch( $_query ) { |
|
| 66 | - if(!is_string($_query)) |
|
| 65 | + public function queryFetch($_query) { |
|
| 66 | + if (!is_string($_query)) |
|
| 67 | 67 | throw new JException("Parameter must be a string.", 1); |
| 68 | 68 | try { |
| 69 | 69 | $temp = $this->currentConnection->database->queryFetch($_query); |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | return $temp; |
| 74 | 74 | } |
| 75 | - public function queryArray( $_query ) { |
|
| 76 | - if(!is_string($_query)) |
|
| 75 | + public function queryArray($_query) { |
|
| 76 | + if (!is_string($_query)) |
|
| 77 | 77 | throw new JException("Parameter must be a string.", 1); |
| 78 | 78 | try { |
| 79 | 79 | $temp = $this->currentConnection->database->queryArray($_query); |
@@ -1,27 +1,27 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | function utf8ize($_array) { |
| 3 | - return travelStringArray($_array,"utf8_encode"); |
|
| 3 | + return travelStringArray($_array, "utf8_encode"); |
|
| 4 | 4 | } |
| 5 | 5 | function unutf8ize($_array) { |
| 6 | - return travelStringArray($_array,"utf8_decode"); |
|
| 6 | + return travelStringArray($_array, "utf8_decode"); |
|
| 7 | 7 | } |
| 8 | 8 | function arraySlash($_array) { |
| 9 | - return travelStringArray($_array,"addslashes"); |
|
| 9 | + return travelStringArray($_array, "addslashes"); |
|
| 10 | 10 | } |
| 11 | 11 | function arrayHtmlParser($_array) { |
| 12 | - return travelStringArray($_array,"htmlParser"); |
|
| 12 | + return travelStringArray($_array, "htmlParser"); |
|
| 13 | 13 | } |
| 14 | - function travelStringArray ( $_array, $_function ) { |
|
| 14 | + function travelStringArray($_array, $_function) { |
|
| 15 | 15 | if (is_array($_array)) { |
| 16 | 16 | foreach ($_array as $k => $v) { |
| 17 | 17 | $_array[$k] = travelStringArray($v, $_function); |
| 18 | 18 | } |
| 19 | - } else if (is_string ($_array)) { |
|
| 20 | - return call_user_func($_function,$_array); |
|
| 19 | + } else if (is_string($_array)) { |
|
| 20 | + return call_user_func($_function, $_array); |
|
| 21 | 21 | } |
| 22 | 22 | return $_array; |
| 23 | 23 | } |
| 24 | - function arrayDepth( $_array ) { |
|
| 24 | + function arrayDepth($_array) { |
|
| 25 | 25 | $maxDepth = 1; |
| 26 | 26 | foreach ($_array as $value) { |
| 27 | 27 | if (is_array($value)) { |
@@ -33,19 +33,19 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | return $maxDepth; |
| 35 | 35 | } |
| 36 | - function arrayDump( $_array, $_name = "Array", $_tab = " " ) { |
|
| 36 | + function arrayDump($_array, $_name = "Array", $_tab = " ") { |
|
| 37 | 37 | $position = preg_replace('/ /', '', $_tab, 1); |
| 38 | 38 | echo "$position<span style=\"color:rgb(230,0,0)\">$_name:</span><br>"; |
| 39 | 39 | foreach ($_array as $k => $i) |
| 40 | - if(is_array($i)) |
|
| 41 | - arrayDump( $i, $k, " $_tab" ); |
|
| 42 | - else if(is_object($i)) |
|
| 40 | + if (is_array($i)) |
|
| 41 | + arrayDump($i, $k, " $_tab"); |
|
| 42 | + else if (is_object($i)) |
|
| 43 | 43 | echo "$_tab<b>object:</b> [Object]<br>"; |
| 44 | 44 | else |
| 45 | 45 | echo "$_tab<b>$k:</b> $i<br>"; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - function htmlParser( $_str) { |
|
| 48 | + function htmlParser($_str) { |
|
| 49 | 49 | return htmlentities($_str, ENT_QUOTES | ENT_IGNORE, "UTF-8"); |
| 50 | 50 | } |
| 51 | 51 | ?> |