@@ -20,7 +20,7 @@ |
||
20 | 20 | </script> |
21 | 21 | <!-- End Google Analytics --> |
22 | 22 | |
23 | - <title><?php if(isset($this->titulo)) echo $this->titulo; ?></title> |
|
23 | + <title><?php if (isset($this->titulo)) echo $this->titulo; ?></title> |
|
24 | 24 | |
25 | 25 | |
26 | 26 |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <!-- Site footer --> |
2 | 2 | |
3 | 3 | |
4 | - <div class="footer fixedCf"> <?php echo CF_AP_CREDITOS; ?> --- Theme Inspinia </div> |
|
4 | + <div class="footer fixedCf"> <?php echo CF_AP_CREDITOS; ?> --- Theme Inspinia </div> |
|
5 | 5 | |
6 | 6 | |
7 | 7 |
@@ -3,7 +3,7 @@ |
||
3 | 3 | { |
4 | 4 | protected $resource; |
5 | 5 | public abstract function connect($host, $user, $pass, $dbname); |
6 | - public abstract function disconnect (); |
|
6 | + public abstract function disconnect(); |
|
7 | 7 | public abstract function getErrorNo(); |
8 | 8 | public abstract function getError(); |
9 | 9 | public abstract function query($q); |
@@ -4,49 +4,49 @@ |
||
4 | 4 | |
5 | 5 | class MySqlProvider extends DatabaseProvider |
6 | 6 | { |
7 | - public function connect($host, $user, $pass, $dbname){ |
|
7 | + public function connect($host, $user, $pass, $dbname) { |
|
8 | 8 | $this->resource = new mysqli($host, $user, $pass, $dbname); |
9 | 9 | |
10 | - if ($this->resource->connect_errno){ // Connection fails |
|
10 | + if ($this->resource->connect_errno) { // Connection fails |
|
11 | 11 | error_log($this->resource->connect_error); |
12 | 12 | } |
13 | 13 | |
14 | 14 | return $this->resource; |
15 | 15 | } |
16 | - public function disconnect(){ |
|
16 | + public function disconnect() { |
|
17 | 17 | return $this->resource->close(); |
18 | 18 | } |
19 | - public function getErrorNo(){ |
|
19 | + public function getErrorNo() { |
|
20 | 20 | return $this->resource->errno; |
21 | 21 | } |
22 | - public function getError(){ |
|
22 | + public function getError() { |
|
23 | 23 | return $this->resource->error; |
24 | 24 | } |
25 | - public function query($q){ |
|
25 | + public function query($q) { |
|
26 | 26 | return $this->resource->query($q); |
27 | 27 | } |
28 | - public function numRows($resource){ |
|
28 | + public function numRows($resource) { |
|
29 | 29 | $num_rows = 0; |
30 | 30 | |
31 | - if ($resource){ |
|
31 | + if ($resource) { |
|
32 | 32 | $num_rows = $resource->num_rows; |
33 | 33 | } |
34 | 34 | |
35 | 35 | return $num_rows; |
36 | 36 | } |
37 | - public function fetchArray($result){ |
|
37 | + public function fetchArray($result) { |
|
38 | 38 | return $result->fetch_assoc(); |
39 | 39 | } |
40 | - public function isConnected(){ |
|
40 | + public function isConnected() { |
|
41 | 41 | return !is_null($this->resource); |
42 | 42 | } |
43 | - public function escape($var){ |
|
43 | + public function escape($var) { |
|
44 | 44 | return $this->resource->real_escape_string($var); |
45 | 45 | } |
46 | - public function getInsertedID(){ |
|
46 | + public function getInsertedID() { |
|
47 | 47 | return $this->resource->insert_id; |
48 | 48 | } |
49 | - public function changeDB ($database){ |
|
49 | + public function changeDB($database) { |
|
50 | 50 | return $this->resource->select_db($database); |
51 | 51 | } |
52 | 52 | public function setCharset($charset) { |
@@ -8,23 +8,23 @@ discard block |
||
8 | 8 | self::getConnection(); |
9 | 9 | } |
10 | 10 | |
11 | - private static function getConnection (){ |
|
11 | + private static function getConnection() { |
|
12 | 12 | require_once('Database.php'); |
13 | 13 | self::$database = Database::getConnection(DB_PROVIDER, DB_HOST, DB_USER, DB_PASSWORD, DB_DB); |
14 | 14 | } |
15 | 15 | |
16 | 16 | public static function find($id) { |
17 | - $results = self::where('id',$id); |
|
17 | + $results = self::where('id', $id); |
|
18 | 18 | return $results[0]; |
19 | 19 | } |
20 | 20 | |
21 | 21 | public static function where($field, $value) { |
22 | 22 | $obj = null; |
23 | 23 | self::getConnection(); |
24 | - $query = "SELECT * FROM ".static::$table." WHERE ".$field." = ?"; |
|
25 | - $results = self::$database->execute($query,null,array($value)); |
|
24 | + $query = "SELECT * FROM " . static::$table . " WHERE " . $field . " = ?"; |
|
25 | + $results = self::$database->execute($query, null, array($value)); |
|
26 | 26 | |
27 | - if ($results){ |
|
27 | + if ($results) { |
|
28 | 28 | $class = get_called_class(); |
29 | 29 | for ($i = 0; $i < sizeof($results); $i++) { |
30 | 30 | $obj[] = new $class($results[$i]); |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | $objs = null; |
39 | 39 | self::getConnection(); |
40 | 40 | |
41 | - $query = "SELECT * FROM ".static::$table; |
|
41 | + $query = "SELECT * FROM " . static::$table; |
|
42 | 42 | |
43 | - if ($order){ |
|
43 | + if ($order) { |
|
44 | 44 | $query .= $order; |
45 | 45 | } |
46 | 46 | |
47 | - $results = self::$database->execute($query,null, null); |
|
47 | + $results = self::$database->execute($query, null, null); |
|
48 | 48 | |
49 | - if ($results){ |
|
49 | + if ($results) { |
|
50 | 50 | $class = get_called_class(); |
51 | - foreach ($results as $index => $obj){ |
|
51 | + foreach ($results as $index => $obj) { |
|
52 | 52 | $objs[] = new $class($obj); |
53 | 53 | } |
54 | 54 | } |
@@ -56,33 +56,33 @@ discard block |
||
56 | 56 | return $objs; |
57 | 57 | } |
58 | 58 | |
59 | - public function save(){ |
|
59 | + public function save() { |
|
60 | 60 | $values = get_object_vars($this); |
61 | 61 | $filtered = null; |
62 | 62 | |
63 | - foreach ($values as $key => $value){ |
|
64 | - if ($value !== null && $value !== '' && strpos($key,'obj_') === false |
|
65 | - && $key !== 'id'){ |
|
63 | + foreach ($values as $key => $value) { |
|
64 | + if ($value !== null && $value !== '' && strpos($key, 'obj_') === false |
|
65 | + && $key !== 'id') { |
|
66 | 66 | if ($value === false) { $value = 0; } |
67 | 67 | $filtered[$key] = $value; |
68 | 68 | } |
69 | 69 | } |
70 | 70 | $columns = array_keys($filtered); |
71 | 71 | |
72 | - if ($this->id){ |
|
73 | - $columns = join (" = ?, ", $columns); |
|
72 | + if ($this->id) { |
|
73 | + $columns = join(" = ?, ", $columns); |
|
74 | 74 | $columns .= ' = ?'; |
75 | - $query = "UPDATE ".static::$table." SET $columns WHERE id =".$this->id; |
|
75 | + $query = "UPDATE " . static::$table . " SET $columns WHERE id =" . $this->id; |
|
76 | 76 | } |
77 | 77 | else { |
78 | 78 | $params = join(", ", array_fill(0, count($columns), "?")); |
79 | 79 | $columns = join(", ", $columns); |
80 | - $query = "INSERT INTO ".static::$table." ($columns) VALUES ($params)"; |
|
80 | + $query = "INSERT INTO " . static::$table . " ($columns) VALUES ($params)"; |
|
81 | 81 | } |
82 | 82 | |
83 | - $result = self::$database->execute($query,null,$filtered); |
|
83 | + $result = self::$database->execute($query, null, $filtered); |
|
84 | 84 | |
85 | - if ($result){ |
|
85 | + if ($result) { |
|
86 | 86 | $result = array('error' => false, 'message' => self::$database->getInsertedID()); |
87 | 87 | } |
88 | 88 | else { |
@@ -482,8 +482,8 @@ discard block |
||
482 | 482 | public function findNamespace($namespace) |
483 | 483 | { |
484 | 484 | $allNamespaces = $this->getNamespaces(); |
485 | - $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace); |
|
486 | - $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces); |
|
485 | + $expr = preg_replace_callback('{([^:]+|)}', function($matches) { return preg_quote($matches[1]) . '[^:]*'; }, $namespace); |
|
486 | + $namespaces = preg_grep('{^' . $expr . '}', $allNamespaces); |
|
487 | 487 | |
488 | 488 | if (empty($namespaces)) { |
489 | 489 | $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace); |
@@ -526,10 +526,10 @@ discard block |
||
526 | 526 | public function find($name) |
527 | 527 | { |
528 | 528 | $allCommands = array_keys($this->commands); |
529 | - $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name); |
|
530 | - $commands = preg_grep('{^'.$expr.'}', $allCommands); |
|
529 | + $expr = preg_replace_callback('{([^:]+|)}', function($matches) { return preg_quote($matches[1]) . '[^:]*'; }, $name); |
|
530 | + $commands = preg_grep('{^' . $expr . '}', $allCommands); |
|
531 | 531 | |
532 | - if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) { |
|
532 | + if (empty($commands) || count(preg_grep('{^' . $expr . '$}', $commands)) < 1) { |
|
533 | 533 | if (false !== $pos = strrpos($name, ':')) { |
534 | 534 | // check if a namespace exists and contains commands |
535 | 535 | $this->findNamespace(substr($name, 0, $pos)); |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | // filter out aliases for commands which are already on the list |
553 | 553 | if (count($commands) > 1) { |
554 | 554 | $commandList = $this->commands; |
555 | - $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands) { |
|
555 | + $commands = array_filter($commands, function($nameOrAlias) use ($commandList, $commands) { |
|
556 | 556 | $commandName = $commandList[$nameOrAlias]->getName(); |
557 | 557 | |
558 | 558 | return $commandName === $nameOrAlias || !in_array($commandName, $commands); |
@@ -921,12 +921,12 @@ discard block |
||
921 | 921 | return new InputDefinition(array( |
922 | 922 | new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'), |
923 | 923 | |
924 | - new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'), |
|
925 | - new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'), |
|
926 | - new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'), |
|
927 | - new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'), |
|
928 | - new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'), |
|
929 | - new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'), |
|
924 | + new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'), |
|
925 | + new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'), |
|
926 | + new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'), |
|
927 | + new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'), |
|
928 | + new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'), |
|
929 | + new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'), |
|
930 | 930 | new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'), |
931 | 931 | )); |
932 | 932 | } |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | proc_close($process); |
1003 | 1003 | |
1004 | 1004 | if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) { |
1005 | - return $matches[2].'x'.$matches[1]; |
|
1005 | + return $matches[2] . 'x' . $matches[1]; |
|
1006 | 1006 | } |
1007 | 1007 | } |
1008 | 1008 | } |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | } |
1083 | 1083 | } |
1084 | 1084 | |
1085 | - $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2*$threshold; }); |
|
1085 | + $alternatives = array_filter($alternatives, function($lev) use ($threshold) { return $lev < 2 * $threshold; }); |
|
1086 | 1086 | asort($alternatives); |
1087 | 1087 | |
1088 | 1088 | return array_keys($alternatives); |
@@ -1130,7 +1130,7 @@ discard block |
||
1130 | 1130 | $line = ''; |
1131 | 1131 | foreach (preg_split('//u', $utf8String) as $char) { |
1132 | 1132 | // test if $char could be appended to current line |
1133 | - if (mb_strwidth($line.$char, 'utf8') <= $width) { |
|
1133 | + if (mb_strwidth($line . $char, 'utf8') <= $width) { |
|
1134 | 1134 | $line .= $char; |
1135 | 1135 | continue; |
1136 | 1136 | } |
@@ -1162,7 +1162,7 @@ discard block |
||
1162 | 1162 | |
1163 | 1163 | foreach ($parts as $part) { |
1164 | 1164 | if (count($namespaces)) { |
1165 | - $namespaces[] = end($namespaces).':'.$part; |
|
1165 | + $namespaces[] = end($namespaces) . ':' . $part; |
|
1166 | 1166 | } else { |
1167 | 1167 | $namespaces[] = $part; |
1168 | 1168 | } |
@@ -530,7 +530,7 @@ |
||
530 | 530 | ); |
531 | 531 | $replacements = array( |
532 | 532 | $name, |
533 | - $_SERVER['PHP_SELF'].' '.$name, |
|
533 | + $_SERVER['PHP_SELF'] . ' ' . $name, |
|
534 | 534 | ); |
535 | 535 | |
536 | 536 | return str_replace($placeholders, $replacements, $this->getHelp()); |
@@ -115,8 +115,8 @@ |
||
115 | 115 | private function getInputOptionData(InputOption $option) |
116 | 116 | { |
117 | 117 | return array( |
118 | - 'name' => '--'.$option->getName(), |
|
119 | - 'shortcut' => $option->getShortcut() ? '-'.implode('|-', explode('|', $option->getShortcut())) : '', |
|
118 | + 'name' => '--' . $option->getName(), |
|
119 | + 'shortcut' => $option->getShortcut() ? '-' . implode('|-', explode('|', $option->getShortcut())) : '', |
|
120 | 120 | 'accept_value' => $option->acceptValue(), |
121 | 121 | 'is_value_required' => $option->isValueRequired(), |
122 | 122 | 'is_multiple' => $option->isArray(), |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | protected function describeInputArgument(InputArgument $argument, array $options = array()) |
33 | 33 | { |
34 | 34 | $this->write( |
35 | - '**'.$argument->getName().':**'."\n\n" |
|
36 | - .'* Name: '.($argument->getName() ?: '<none>')."\n" |
|
37 | - .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n" |
|
38 | - .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n" |
|
39 | - .'* Description: '.($argument->getDescription() ?: '<none>')."\n" |
|
40 | - .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`' |
|
35 | + '**' . $argument->getName() . ':**' . "\n\n" |
|
36 | + .'* Name: ' . ($argument->getName() ?: '<none>') . "\n" |
|
37 | + .'* Is required: ' . ($argument->isRequired() ? 'yes' : 'no') . "\n" |
|
38 | + .'* Is array: ' . ($argument->isArray() ? 'yes' : 'no') . "\n" |
|
39 | + .'* Description: ' . ($argument->getDescription() ?: '<none>') . "\n" |
|
40 | + .'* Default: `' . str_replace("\n", '', var_export($argument->getDefault(), true)) . '`' |
|
41 | 41 | ); |
42 | 42 | } |
43 | 43 | |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | protected function describeInputOption(InputOption $option, array $options = array()) |
48 | 48 | { |
49 | 49 | $this->write( |
50 | - '**'.$option->getName().':**'."\n\n" |
|
51 | - .'* Name: `--'.$option->getName().'`'."\n" |
|
52 | - .'* Shortcut: '.($option->getShortcut() ? '`-'.implode('|-', explode('|', $option->getShortcut())).'`' : '<none>')."\n" |
|
53 | - .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n" |
|
54 | - .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n" |
|
55 | - .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n" |
|
56 | - .'* Description: '.($option->getDescription() ?: '<none>')."\n" |
|
57 | - .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`' |
|
50 | + '**' . $option->getName() . ':**' . "\n\n" |
|
51 | + .'* Name: `--' . $option->getName() . '`' . "\n" |
|
52 | + .'* Shortcut: ' . ($option->getShortcut() ? '`-' . implode('|-', explode('|', $option->getShortcut())) . '`' : '<none>') . "\n" |
|
53 | + .'* Accept value: ' . ($option->acceptValue() ? 'yes' : 'no') . "\n" |
|
54 | + .'* Is value required: ' . ($option->isValueRequired() ? 'yes' : 'no') . "\n" |
|
55 | + .'* Is multiple: ' . ($option->isArray() ? 'yes' : 'no') . "\n" |
|
56 | + .'* Description: ' . ($option->getDescription() ?: '<none>') . "\n" |
|
57 | + .'* Default: `' . str_replace("\n", '', var_export($option->getDefault(), true)) . '`' |
|
58 | 58 | ); |
59 | 59 | } |
60 | 60 | |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | $command->mergeApplicationDefinition(false); |
94 | 94 | |
95 | 95 | $this->write( |
96 | - $command->getName()."\n" |
|
97 | - .str_repeat('-', strlen($command->getName()))."\n\n" |
|
98 | - .'* Description: '.($command->getDescription() ?: '<none>')."\n" |
|
99 | - .'* Usage: `'.$command->getSynopsis().'`'."\n" |
|
100 | - .'* Aliases: '.(count($command->getAliases()) ? '`'.implode('`, `', $command->getAliases()).'`' : '<none>') |
|
96 | + $command->getName() . "\n" |
|
97 | + .str_repeat('-', strlen($command->getName())) . "\n\n" |
|
98 | + .'* Description: ' . ($command->getDescription() ?: '<none>') . "\n" |
|
99 | + .'* Usage: `' . $command->getSynopsis() . '`' . "\n" |
|
100 | + .'* Aliases: ' . (count($command->getAliases()) ? '`' . implode('`, `', $command->getAliases()) . '`' : '<none>') |
|
101 | 101 | ); |
102 | 102 | |
103 | 103 | if ($help = $command->getProcessedHelp()) { |
@@ -119,17 +119,17 @@ discard block |
||
119 | 119 | $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null; |
120 | 120 | $description = new ApplicationDescription($application, $describedNamespace); |
121 | 121 | |
122 | - $this->write($application->getName()."\n".str_repeat('=', strlen($application->getName()))); |
|
122 | + $this->write($application->getName() . "\n" . str_repeat('=', strlen($application->getName()))); |
|
123 | 123 | |
124 | 124 | foreach ($description->getNamespaces() as $namespace) { |
125 | 125 | if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) { |
126 | 126 | $this->write("\n\n"); |
127 | - $this->write('**'.$namespace['id'].':**'); |
|
127 | + $this->write('**' . $namespace['id'] . ':**'); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | $this->write("\n\n"); |
131 | - $this->write(implode("\n", array_map(function ($commandName) { |
|
132 | - return '* '.$commandName; |
|
131 | + $this->write(implode("\n", array_map(function($commandName) { |
|
132 | + return '* ' . $commandName; |
|
133 | 133 | }, $namespace['commands']))); |
134 | 134 | } |
135 | 135 |