@@ -38,20 +38,20 @@ discard block |
||
| 38 | 38 | $dbParser = DB::getParser(); |
| 39 | 39 | $this->name = $dbParser->parseColumnName($this->name); |
| 40 | 40 | |
| 41 | - if($column->attrs->var) |
|
| 41 | + if ($column->attrs->var) |
|
| 42 | 42 | { |
| 43 | 43 | $this->argument = new QueryArgument($column); |
| 44 | 44 | } |
| 45 | 45 | else |
| 46 | 46 | { |
| 47 | - if(strpos($column->attrs->default, '.') !== FALSE) |
|
| 47 | + if (strpos($column->attrs->default, '.') !== FALSE) |
|
| 48 | 48 | { |
| 49 | - $this->default_value = "'" . $dbParser->parseColumnName($column->attrs->default) . "'"; |
|
| 49 | + $this->default_value = "'".$dbParser->parseColumnName($column->attrs->default)."'"; |
|
| 50 | 50 | } |
| 51 | 51 | else |
| 52 | 52 | { |
| 53 | 53 | $default_value = new DefaultValue($this->name, $column->attrs->default); |
| 54 | - if($default_value->isOperation()) |
|
| 54 | + if ($default_value->isOperation()) |
|
| 55 | 55 | { |
| 56 | 56 | $this->argument = new QueryArgument($column, TRUE); |
| 57 | 57 | } |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | else |
| 60 | 60 | { |
| 61 | 61 | $this->default_value = $default_value->toString(); |
| 62 | - if($default_value->isStringFromFunction()) |
|
| 62 | + if ($default_value->isStringFromFunction()) |
|
| 63 | 63 | { |
| 64 | - $this->default_value = '"\'".' . $this->default_value . '."\'"'; |
|
| 64 | + $this->default_value = '"\'".'.$this->default_value.'."\'"'; |
|
| 65 | 65 | } |
| 66 | - if($default_value->isString()) |
|
| 66 | + if ($default_value->isString()) |
|
| 67 | 67 | { |
| 68 | - $this->default_value = '"' . $this->default_value . '"'; |
|
| 68 | + $this->default_value = '"'.$this->default_value.'"'; |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | function getExpressionString() |
| 81 | 81 | { |
| 82 | - if($this->argument) |
|
| 82 | + if ($this->argument) |
|
| 83 | 83 | { |
| 84 | 84 | return sprintf('new UpdateExpression(\'%s\', ${\'%s_argument\'})' |
| 85 | 85 | , $this->name |
@@ -41,14 +41,12 @@ discard block |
||
| 41 | 41 | if($column->attrs->var) |
| 42 | 42 | { |
| 43 | 43 | $this->argument = new QueryArgument($column); |
| 44 | - } |
|
| 45 | - else |
|
| 44 | + } else |
|
| 46 | 45 | { |
| 47 | 46 | if(strpos($column->attrs->default, '.') !== FALSE) |
| 48 | 47 | { |
| 49 | 48 | $this->default_value = "'" . $dbParser->parseColumnName($column->attrs->default) . "'"; |
| 50 | - } |
|
| 51 | - else |
|
| 49 | + } else |
|
| 52 | 50 | { |
| 53 | 51 | $default_value = new DefaultValue($this->name, $column->attrs->default); |
| 54 | 52 | if($default_value->isOperation()) |
@@ -84,8 +82,7 @@ discard block |
||
| 84 | 82 | return sprintf('new UpdateExpression(\'%s\', ${\'%s_argument\'})' |
| 85 | 83 | , $this->name |
| 86 | 84 | , $this->argument->argument_name); |
| 87 | - } |
|
| 88 | - else |
|
| 85 | + } else |
|
| 89 | 86 | { |
| 90 | 87 | return sprintf('new UpdateExpressionWithoutArgument(\'%s\', %s)' |
| 91 | 88 | , $this->name |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | function __construct($xml_columns_tag) |
| 29 | 29 | { |
| 30 | - if(!$xml_columns_tag) |
|
| 30 | + if (!$xml_columns_tag) |
|
| 31 | 31 | { |
| 32 | 32 | $xml_columns_tag = new Xml_Node_(); |
| 33 | 33 | } |
@@ -37,34 +37,34 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | $this->columns = array(); |
| 39 | 39 | |
| 40 | - if(!$xml_columns) |
|
| 40 | + if (!$xml_columns) |
|
| 41 | 41 | { |
| 42 | 42 | $this->columns[] = new SelectColumnTag("*"); |
| 43 | 43 | return; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if(!is_array($xml_columns)) |
|
| 46 | + if (!is_array($xml_columns)) |
|
| 47 | 47 | { |
| 48 | 48 | $xml_columns = array($xml_columns); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - foreach($xml_columns as $column) |
|
| 51 | + foreach ($xml_columns as $column) |
|
| 52 | 52 | { |
| 53 | 53 | $this->columns[] = new SelectColumnTag($column); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
| 57 | - if(!$xml_queries) |
|
| 57 | + if (!$xml_queries) |
|
| 58 | 58 | { |
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if(!is_array($xml_queries)) |
|
| 62 | + if (!is_array($xml_queries)) |
|
| 63 | 63 | { |
| 64 | 64 | $xml_queries = array($xml_queries); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - foreach($xml_queries as $column) |
|
| 67 | + foreach ($xml_queries as $column) |
|
| 68 | 68 | { |
| 69 | 69 | $this->columns[] = new QueryTag($column, TRUE); |
| 70 | 70 | } |
@@ -77,16 +77,16 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | function toString() |
| 79 | 79 | { |
| 80 | - $output_columns = 'array(' . PHP_EOL; |
|
| 81 | - foreach($this->columns as $column) |
|
| 80 | + $output_columns = 'array('.PHP_EOL; |
|
| 81 | + foreach ($this->columns as $column) |
|
| 82 | 82 | { |
| 83 | - if(is_a($column, 'QueryTag')) |
|
| 83 | + if (is_a($column, 'QueryTag')) |
|
| 84 | 84 | { |
| 85 | - $output_columns .= $column->toString() . PHP_EOL . ','; |
|
| 85 | + $output_columns .= $column->toString().PHP_EOL.','; |
|
| 86 | 86 | } |
| 87 | 87 | else |
| 88 | 88 | { |
| 89 | - $output_columns .= $column->getExpressionString() . PHP_EOL . ','; |
|
| 89 | + $output_columns .= $column->getExpressionString().PHP_EOL.','; |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | $output_columns = substr($output_columns, 0, -1); |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | function getArguments() |
| 103 | 103 | { |
| 104 | 104 | $arguments = array(); |
| 105 | - foreach($this->columns as $column) |
|
| 105 | + foreach ($this->columns as $column) |
|
| 106 | 106 | { |
| 107 | - if(is_a($column, 'QueryTag')) |
|
| 107 | + if (is_a($column, 'QueryTag')) |
|
| 108 | 108 | { |
| 109 | 109 | $arguments = array_merge($arguments, $column->getArguments()); |
| 110 | 110 | } |
@@ -83,8 +83,7 @@ |
||
| 83 | 83 | if(is_a($column, 'QueryTag')) |
| 84 | 84 | { |
| 85 | 85 | $output_columns .= $column->toString() . PHP_EOL . ','; |
| 86 | - } |
|
| 87 | - else |
|
| 86 | + } else |
|
| 88 | 87 | { |
| 89 | 88 | $output_columns .= $column->getExpressionString() . PHP_EOL . ','; |
| 90 | 89 | } |
@@ -28,14 +28,14 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $this->columns = array(); |
| 30 | 30 | |
| 31 | - if(!is_array($xml_columns)) |
|
| 31 | + if (!is_array($xml_columns)) |
|
| 32 | 32 | { |
| 33 | 33 | $xml_columns = array($xml_columns); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - foreach($xml_columns as $column) |
|
| 36 | + foreach ($xml_columns as $column) |
|
| 37 | 37 | { |
| 38 | - if($column->name === 'query') |
|
| 38 | + if ($column->name === 'query') |
|
| 39 | 39 | { |
| 40 | 40 | $this->columns[] = new QueryTag($column, true); |
| 41 | 41 | } |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | function toString() |
| 55 | 55 | { |
| 56 | - $output_columns = 'array(' . PHP_EOL; |
|
| 57 | - foreach($this->columns as $column) |
|
| 56 | + $output_columns = 'array('.PHP_EOL; |
|
| 57 | + foreach ($this->columns as $column) |
|
| 58 | 58 | { |
| 59 | - $output_columns .= $column->getExpressionString() . PHP_EOL . ','; |
|
| 59 | + $output_columns .= $column->getExpressionString().PHP_EOL.','; |
|
| 60 | 60 | } |
| 61 | 61 | $output_columns = substr($output_columns, 0, -1); |
| 62 | 62 | $output_columns .= ')'; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | function getArguments() |
| 72 | 72 | { |
| 73 | 73 | $arguments = array(); |
| 74 | - foreach($this->columns as $column) |
|
| 74 | + foreach ($this->columns as $column) |
|
| 75 | 75 | { |
| 76 | 76 | $arguments[] = $column->getArgument(); |
| 77 | 77 | } |
@@ -38,8 +38,7 @@ |
||
| 38 | 38 | if($column->name === 'query') |
| 39 | 39 | { |
| 40 | 40 | $this->columns[] = new QueryTag($column, true); |
| 41 | - } |
|
| 42 | - else |
|
| 41 | + } else |
|
| 43 | 42 | { |
| 44 | 43 | $this->columns[] = new UpdateColumnTag($column); |
| 45 | 44 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | function __construct($column) |
| 35 | 35 | { |
| 36 | - if($column == "*" || $column->attrs->name == '*') |
|
| 36 | + if ($column == "*" || $column->attrs->name == '*') |
|
| 37 | 37 | { |
| 38 | 38 | parent::__construct(NULL); |
| 39 | 39 | $this->name = "*"; |
@@ -63,20 +63,20 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | function getExpressionString() |
| 65 | 65 | { |
| 66 | - if($this->name == '*') |
|
| 66 | + if ($this->name == '*') |
|
| 67 | 67 | { |
| 68 | 68 | return "new StarExpression()"; |
| 69 | 69 | } |
| 70 | - if($this->click_count) |
|
| 70 | + if ($this->click_count) |
|
| 71 | 71 | { |
| 72 | - return sprintf('new ClickCountExpression(\'%s\', %s, $args->%s)', $this->name, $this->alias ? '\'' . $this->alias . '\'' : "''", $this->click_count); |
|
| 72 | + return sprintf('new ClickCountExpression(\'%s\', %s, $args->%s)', $this->name, $this->alias ? '\''.$this->alias.'\'' : "''", $this->click_count); |
|
| 73 | 73 | } |
| 74 | - if(strpos($this->name, '$') === 0) |
|
| 74 | + if (strpos($this->name, '$') === 0) |
|
| 75 | 75 | { |
| 76 | 76 | return sprintf('new SelectExpression($args->%s)', substr($this->name, 1)); |
| 77 | 77 | } |
| 78 | 78 | $dbParser = DB::getParser(); |
| 79 | - return sprintf('new SelectExpression(\'%s\'%s)', $this->name, $this->alias ? ', \'' . $dbParser->escape($this->alias) . '\'' : ''); |
|
| 79 | + return sprintf('new SelectExpression(\'%s\'%s)', $this->name, $this->alias ? ', \''.$dbParser->escape($this->alias).'\'' : ''); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | } |
@@ -37,8 +37,7 @@ |
||
| 37 | 37 | { |
| 38 | 38 | parent::__construct(NULL); |
| 39 | 39 | $this->name = "*"; |
| 40 | - } |
|
| 41 | - else |
|
| 40 | + } else |
|
| 42 | 41 | { |
| 43 | 42 | parent::__construct($column->attrs->name); |
| 44 | 43 | $dbParser = DB::getParser(); |
@@ -38,21 +38,21 @@ discard block |
||
| 38 | 38 | $this->tables = array(); |
| 39 | 39 | |
| 40 | 40 | $xml_tables = $xml_tables_tag->table; |
| 41 | - if(!is_array($xml_tables)) |
|
| 41 | + if (!is_array($xml_tables)) |
|
| 42 | 42 | { |
| 43 | 43 | $xml_tables = array($xml_tables); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if($xml_index_hints_tag) |
|
| 46 | + if ($xml_index_hints_tag) |
|
| 47 | 47 | { |
| 48 | 48 | $index_nodes = $xml_index_hints_tag->index; |
| 49 | - if(!is_array($index_nodes)) |
|
| 49 | + if (!is_array($index_nodes)) |
|
| 50 | 50 | { |
| 51 | 51 | $index_nodes = array($index_nodes); |
| 52 | 52 | } |
| 53 | - foreach($index_nodes as $index_node) |
|
| 53 | + foreach ($index_nodes as $index_node) |
|
| 54 | 54 | { |
| 55 | - if(!isset($indexes[$index_node->attrs->table])) |
|
| 55 | + if (!isset($indexes[$index_node->attrs->table])) |
|
| 56 | 56 | { |
| 57 | 57 | $indexes[$index_node->attrs->table] = array(); |
| 58 | 58 | } |
@@ -63,15 +63,15 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - foreach($xml_tables as $tag) |
|
| 66 | + foreach ($xml_tables as $tag) |
|
| 67 | 67 | { |
| 68 | - if($tag->attrs->query == 'true') |
|
| 68 | + if ($tag->attrs->query == 'true') |
|
| 69 | 69 | { |
| 70 | 70 | $this->tables[] = new QueryTag($tag, true); |
| 71 | 71 | } |
| 72 | 72 | else |
| 73 | 73 | { |
| 74 | - if(isset($indexes[$tag->attrs->name]) && $indexes[$tag->attrs->name]) |
|
| 74 | + if (isset($indexes[$tag->attrs->name]) && $indexes[$tag->attrs->name]) |
|
| 75 | 75 | { |
| 76 | 76 | $this->tables[] = new HintTableTag($tag, $indexes[$tag->attrs->name]); |
| 77 | 77 | } |
@@ -90,16 +90,16 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | function toString() |
| 92 | 92 | { |
| 93 | - $output_tables = 'array(' . PHP_EOL; |
|
| 94 | - foreach($this->tables as $table) |
|
| 93 | + $output_tables = 'array('.PHP_EOL; |
|
| 94 | + foreach ($this->tables as $table) |
|
| 95 | 95 | { |
| 96 | - if(is_a($table, 'QueryTag')) |
|
| 96 | + if (is_a($table, 'QueryTag')) |
|
| 97 | 97 | { |
| 98 | - $output_tables .= $table->toString() . PHP_EOL . ','; |
|
| 98 | + $output_tables .= $table->toString().PHP_EOL.','; |
|
| 99 | 99 | } |
| 100 | 100 | else |
| 101 | 101 | { |
| 102 | - $output_tables .= $table->getTableString() . PHP_EOL . ','; |
|
| 102 | + $output_tables .= $table->getTableString().PHP_EOL.','; |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | $output_tables = substr($output_tables, 0, -1); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | function getArguments() |
| 111 | 111 | { |
| 112 | 112 | $arguments = array(); |
| 113 | - foreach($this->tables as $table) |
|
| 113 | + foreach ($this->tables as $table) |
|
| 114 | 114 | { |
| 115 | 115 | $arguments = array_merge($arguments, $table->getArguments()); |
| 116 | 116 | } |
@@ -68,14 +68,12 @@ discard block |
||
| 68 | 68 | if($tag->attrs->query == 'true') |
| 69 | 69 | { |
| 70 | 70 | $this->tables[] = new QueryTag($tag, true); |
| 71 | - } |
|
| 72 | - else |
|
| 71 | + } else |
|
| 73 | 72 | { |
| 74 | 73 | if(isset($indexes[$tag->attrs->name]) && $indexes[$tag->attrs->name]) |
| 75 | 74 | { |
| 76 | 75 | $this->tables[] = new HintTableTag($tag, $indexes[$tag->attrs->name]); |
| 77 | - } |
|
| 78 | - else |
|
| 76 | + } else |
|
| 79 | 77 | { |
| 80 | 78 | $this->tables[] = new TableTag($tag); |
| 81 | 79 | } |
@@ -96,8 +94,7 @@ discard block |
||
| 96 | 94 | if(is_a($table, 'QueryTag')) |
| 97 | 95 | { |
| 98 | 96 | $output_tables .= $table->toString() . PHP_EOL . ','; |
| 99 | - } |
|
| 100 | - else |
|
| 97 | + } else |
|
| 101 | 98 | { |
| 102 | 99 | $output_tables .= $table->getTableString() . PHP_EOL . ','; |
| 103 | 100 | } |
@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | $result = sprintf('new %sTableWithHint(\'%s\'%s, array(' |
| 40 | 40 | , !strncasecmp($dbType, 'Mysql', 5) ? 'Mysql' : $dbType |
| 41 | 41 | , $dbParser->escape($this->name) |
| 42 | - , $this->alias ? ', \'' . $dbParser->escape($this->alias) . '\'' : ', null' |
|
| 42 | + , $this->alias ? ', \''.$dbParser->escape($this->alias).'\'' : ', null' |
|
| 43 | 43 | //, ', \'' . $dbParser->escape($this->index->name) .'\', \'' . $this->index->type .'\'' |
| 44 | 44 | ); |
| 45 | - foreach($this->index as $indx) |
|
| 45 | + foreach ($this->index as $indx) |
|
| 46 | 46 | { |
| 47 | 47 | $result .= "new IndexHint("; |
| 48 | - $result .= '\'' . $dbParser->escape($indx->name) . '\', \'' . $indx->type . '\'' . ') , '; |
|
| 48 | + $result .= '\''.$dbParser->escape($indx->name).'\', \''.$indx->type.'\''.') , '; |
|
| 49 | 49 | } |
| 50 | 50 | $result = substr($result, 0, -2); |
| 51 | 51 | $result .= '))'; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | function getArguments() |
| 56 | 56 | { |
| 57 | - if(!isset($this->conditionsTag)) |
|
| 57 | + if (!isset($this->conditionsTag)) |
|
| 58 | 58 | { |
| 59 | 59 | return array(); |
| 60 | 60 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $this->name = $dbParser->parseTableName($table->attrs->name); |
| 75 | 75 | |
| 76 | 76 | $this->alias = $table->attrs->alias; |
| 77 | - if(!$this->alias) |
|
| 77 | + if (!$this->alias) |
|
| 78 | 78 | { |
| 79 | 79 | $this->alias = $table->attrs->name; |
| 80 | 80 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | $this->conditions = $table->conditions; |
| 85 | 85 | |
| 86 | - if($this->isJoinTable()) |
|
| 86 | + if ($this->isJoinTable()) |
|
| 87 | 87 | { |
| 88 | 88 | $this->conditionsTag = new JoinConditionsTag($this->conditions); |
| 89 | 89 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | function isJoinTable() |
| 93 | 93 | { |
| 94 | 94 | $joinList = array('left join' => 1, 'left outer join' => 1, 'right join' => 1, 'right outer join' => 1); |
| 95 | - if(isset($joinList[$this->join_type]) && count($this->conditions)) |
|
| 95 | + if (isset($joinList[$this->join_type]) && count($this->conditions)) |
|
| 96 | 96 | { |
| 97 | 97 | return true; |
| 98 | 98 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | $dbParser = DB::getParser(); |
| 121 | 121 | |
| 122 | - if($this->isJoinTable()) |
|
| 122 | + if ($this->isJoinTable()) |
|
| 123 | 123 | { |
| 124 | 124 | return sprintf('new JoinTable(\'%s\', \'%s\', "%s", %s)' |
| 125 | 125 | , $dbParser->escape($this->name) |
@@ -128,12 +128,12 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | return sprintf('new Table(\'%s\'%s)' |
| 130 | 130 | , $dbParser->escape($this->name) |
| 131 | - , $this->alias ? ', \'' . $dbParser->escape($this->alias) . '\'' : ''); |
|
| 131 | + , $this->alias ? ', \''.$dbParser->escape($this->alias).'\'' : ''); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | function getArguments() |
| 135 | 135 | { |
| 136 | - if(!isset($this->conditionsTag)) |
|
| 136 | + if (!isset($this->conditionsTag)) |
|
| 137 | 137 | { |
| 138 | 138 | return array(); |
| 139 | 139 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | function __construct($escape_char_left, $escape_char_right = "", $table_prefix = "xe_") |
| 64 | 64 | { |
| 65 | 65 | $this->escape_char_left = $escape_char_left; |
| 66 | - if($escape_char_right !== "") |
|
| 66 | + if ($escape_char_right !== "") |
|
| 67 | 67 | { |
| 68 | 68 | $this->escape_char_right = $escape_char_right; |
| 69 | 69 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | function getEscapeChar($leftOrRight) |
| 84 | 84 | { |
| 85 | - if($leftOrRight === 'left') |
|
| 85 | + if ($leftOrRight === 'left') |
|
| 86 | 86 | { |
| 87 | 87 | return $this->escape_char_left; |
| 88 | 88 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | function escape($name) |
| 102 | 102 | { |
| 103 | - return $this->escape_char_left . $name . $this->escape_char_right; |
|
| 103 | + return $this->escape_char_left.$name.$this->escape_char_right; |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | function escapeString($name) |
| 113 | 113 | { |
| 114 | - return "'" . $this->escapeStringValue($name) . "'"; |
|
| 114 | + return "'".$this->escapeStringValue($name)."'"; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | function escapeStringValue($value) |
| 124 | 124 | { |
| 125 | - if($value == "*") |
|
| 125 | + if ($value == "*") |
|
| 126 | 126 | { |
| 127 | 127 | return $value; |
| 128 | 128 | } |
| 129 | - if(is_string($value)) |
|
| 129 | + if (is_string($value)) |
|
| 130 | 130 | { |
| 131 | 131 | return $value = str_replace("'", "''", $value); |
| 132 | 132 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | function parseTableName($name) |
| 144 | 144 | { |
| 145 | - return $this->table_prefix . $name; |
|
| 145 | + return $this->table_prefix.$name; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -165,15 +165,15 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | function escapeColumn($column_name) |
| 167 | 167 | { |
| 168 | - if($this->isUnqualifiedColumnName($column_name)) |
|
| 168 | + if ($this->isUnqualifiedColumnName($column_name)) |
|
| 169 | 169 | { |
| 170 | 170 | return $this->escape($column_name); |
| 171 | 171 | } |
| 172 | - if($this->isQualifiedColumnName($column_name)) |
|
| 172 | + if ($this->isQualifiedColumnName($column_name)) |
|
| 173 | 173 | { |
| 174 | 174 | list($table, $column) = explode('.', $column_name); |
| 175 | 175 | // $table can also be an alias, so the prefix should not be added |
| 176 | - return $this->escape($table) . '.' . $this->escape($column); |
|
| 176 | + return $this->escape($table).'.'.$this->escape($column); |
|
| 177 | 177 | //return $this->escape($this->parseTableName($table)).'.'.$this->escape($column); |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | function isUnqualifiedColumnName($column_name) |
| 191 | 191 | { |
| 192 | - if(strpos($column_name, '.') === FALSE && strpos($column_name, '(') === FALSE) |
|
| 192 | + if (strpos($column_name, '.') === FALSE && strpos($column_name, '(') === FALSE) |
|
| 193 | 193 | { |
| 194 | 194 | return TRUE; |
| 195 | 195 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | function isQualifiedColumnName($column_name) |
| 209 | 209 | { |
| 210 | - if(strpos($column_name, '.') !== FALSE && strpos($column_name, '(') === FALSE) |
|
| 210 | + if (strpos($column_name, '.') !== FALSE && strpos($column_name, '(') === FALSE) |
|
| 211 | 211 | { |
| 212 | 212 | return TRUE; |
| 213 | 213 | } |
@@ -235,10 +235,10 @@ discard block |
||
| 235 | 235 | function parseExpression($column_name) |
| 236 | 236 | { |
| 237 | 237 | $functions = preg_split('/([\+\-\*\/\ ])/', $column_name, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
| 238 | - foreach($functions as $k => $v) |
|
| 238 | + foreach ($functions as $k => $v) |
|
| 239 | 239 | { |
| 240 | 240 | $function = &$functions[$k]; |
| 241 | - if(strlen($function) == 1) |
|
| 241 | + if (strlen($function) == 1) |
|
| 242 | 242 | { |
| 243 | 243 | continue; // skip delimiters |
| 244 | 244 | } |
@@ -246,25 +246,25 @@ discard block |
||
| 246 | 246 | $matches = preg_split('/([a-zA-Z0-9_*]+)/', $function, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
| 247 | 247 | $total_brackets = substr_count($function, "("); |
| 248 | 248 | $brackets = 0; |
| 249 | - foreach($matches as $i => $j) |
|
| 249 | + foreach ($matches as $i => $j) |
|
| 250 | 250 | { |
| 251 | 251 | $match = &$matches[$i]; |
| 252 | - if($match == '(') |
|
| 252 | + if ($match == '(') |
|
| 253 | 253 | { |
| 254 | 254 | $brackets++; |
| 255 | 255 | continue; |
| 256 | 256 | } |
| 257 | - if(strpos($match, ')') !== FALSE) |
|
| 257 | + if (strpos($match, ')') !== FALSE) |
|
| 258 | 258 | { |
| 259 | 259 | continue; |
| 260 | 260 | } |
| 261 | - if(in_array($match, array(',', '.'))) |
|
| 261 | + if (in_array($match, array(',', '.'))) |
|
| 262 | 262 | { |
| 263 | 263 | continue; |
| 264 | 264 | } |
| 265 | - if($brackets == $total_brackets) |
|
| 265 | + if ($brackets == $total_brackets) |
|
| 266 | 266 | { |
| 267 | - if(!is_numeric($match) && !in_array(strtoupper($match), array('UNSIGNED', 'INTEGER', 'AS'))) |
|
| 267 | + if (!is_numeric($match) && !in_array(strtoupper($match), array('UNSIGNED', 'INTEGER', 'AS'))) |
|
| 268 | 268 | { |
| 269 | 269 | $match = $this->escapeColumnExpression($match); |
| 270 | 270 | } |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | function isStar($column_name) |
| 285 | 285 | { |
| 286 | - if(substr($column_name, -1) == '*') |
|
| 286 | + if (substr($column_name, -1) == '*') |
|
| 287 | 287 | { |
| 288 | 288 | return TRUE; |
| 289 | 289 | } |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | */ |
| 300 | 300 | function isStarFunction($column_name) |
| 301 | 301 | { |
| 302 | - if(strpos($column_name, "(*)") !== FALSE) |
|
| 302 | + if (strpos($column_name, "(*)") !== FALSE) |
|
| 303 | 303 | { |
| 304 | 304 | return TRUE; |
| 305 | 305 | } |
@@ -313,15 +313,15 @@ discard block |
||
| 313 | 313 | */ |
| 314 | 314 | function escapeColumnExpression($column_name) |
| 315 | 315 | { |
| 316 | - if($this->isStar($column_name)) |
|
| 316 | + if ($this->isStar($column_name)) |
|
| 317 | 317 | { |
| 318 | 318 | return $column_name; |
| 319 | 319 | } |
| 320 | - if($this->isStarFunction($column_name)) |
|
| 320 | + if ($this->isStarFunction($column_name)) |
|
| 321 | 321 | { |
| 322 | 322 | return $column_name; |
| 323 | 323 | } |
| 324 | - if(stripos($column_name, 'distinct') !== FALSE) |
|
| 324 | + if (stripos($column_name, 'distinct') !== FALSE) |
|
| 325 | 325 | { |
| 326 | 326 | return $column_name; |
| 327 | 327 | } |
@@ -66,8 +66,7 @@ discard block |
||
| 66 | 66 | if($escape_char_right !== "") |
| 67 | 67 | { |
| 68 | 68 | $this->escape_char_right = $escape_char_right; |
| 69 | - } |
|
| 70 | - else |
|
| 69 | + } else |
|
| 71 | 70 | { |
| 72 | 71 | $this->escape_char_right = $escape_char_left; |
| 73 | 72 | } |
@@ -85,8 +84,7 @@ discard block |
||
| 85 | 84 | if($leftOrRight === 'left') |
| 86 | 85 | { |
| 87 | 86 | return $this->escape_char_left; |
| 88 | - } |
|
| 89 | - else |
|
| 87 | + } else |
|
| 90 | 88 | { |
| 91 | 89 | return $this->escape_char_right; |
| 92 | 90 | } |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | function &getInstance($target = 'object', $info = null, $always_use_file = false) |
| 32 | 32 | { |
| 33 | - $cache_handler_key = $target . ($always_use_file ? '_file' : ''); |
|
| 34 | - if(!$GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key]) |
|
| 33 | + $cache_handler_key = $target.($always_use_file ? '_file' : ''); |
|
| 34 | + if (!$GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key]) |
|
| 35 | 35 | { |
| 36 | 36 | $GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key] = new CacheHandler($target, $info, $always_use_file); |
| 37 | 37 | } |
@@ -51,61 +51,61 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | function __construct($target, $info = null, $always_use_file = false) |
| 53 | 53 | { |
| 54 | - if(!$info) |
|
| 54 | + if (!$info) |
|
| 55 | 55 | { |
| 56 | 56 | $info = Context::getDBInfo(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if($info) |
|
| 59 | + if ($info) |
|
| 60 | 60 | { |
| 61 | - if($target == 'object') |
|
| 61 | + if ($target == 'object') |
|
| 62 | 62 | { |
| 63 | - if($info->use_object_cache == 'apc') |
|
| 63 | + if ($info->use_object_cache == 'apc') |
|
| 64 | 64 | { |
| 65 | 65 | $type = 'apc'; |
| 66 | 66 | } |
| 67 | - else if(substr($info->use_object_cache, 0, 8) == 'memcache') |
|
| 67 | + else if (substr($info->use_object_cache, 0, 8) == 'memcache') |
|
| 68 | 68 | { |
| 69 | 69 | $type = 'memcache'; |
| 70 | 70 | $url = $info->use_object_cache; |
| 71 | 71 | } |
| 72 | - else if($info->use_object_cache == 'wincache') |
|
| 72 | + else if ($info->use_object_cache == 'wincache') |
|
| 73 | 73 | { |
| 74 | 74 | $type = 'wincache'; |
| 75 | 75 | } |
| 76 | - else if($info->use_object_cache == 'file') |
|
| 76 | + else if ($info->use_object_cache == 'file') |
|
| 77 | 77 | { |
| 78 | 78 | $type = 'file'; |
| 79 | 79 | } |
| 80 | - else if($always_use_file) |
|
| 80 | + else if ($always_use_file) |
|
| 81 | 81 | { |
| 82 | 82 | $type = 'file'; |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | - else if($target == 'template') |
|
| 85 | + else if ($target == 'template') |
|
| 86 | 86 | { |
| 87 | - if($info->use_template_cache == 'apc') |
|
| 87 | + if ($info->use_template_cache == 'apc') |
|
| 88 | 88 | { |
| 89 | 89 | $type = 'apc'; |
| 90 | 90 | } |
| 91 | - else if(substr($info->use_template_cache, 0, 8) == 'memcache') |
|
| 91 | + else if (substr($info->use_template_cache, 0, 8) == 'memcache') |
|
| 92 | 92 | { |
| 93 | 93 | $type = 'memcache'; |
| 94 | 94 | $url = $info->use_template_cache; |
| 95 | 95 | } |
| 96 | - else if($info->use_template_cache == 'wincache') |
|
| 96 | + else if ($info->use_template_cache == 'wincache') |
|
| 97 | 97 | { |
| 98 | 98 | $type = 'wincache'; |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - if($type) |
|
| 102 | + if ($type) |
|
| 103 | 103 | { |
| 104 | - $class = 'Cache' . ucfirst($type); |
|
| 104 | + $class = 'Cache'.ucfirst($type); |
|
| 105 | 105 | include_once sprintf('%sclasses/cache/%s.class.php', _XE_PATH_, $class); |
| 106 | 106 | $this->handler = call_user_func(array($class, 'getInstance'), $url); |
| 107 | 107 | $this->keyGroupVersions = $this->handler->get('key_group_versions', 0); |
| 108 | - if(!$this->keyGroupVersions) |
|
| 108 | + if (!$this->keyGroupVersions) |
|
| 109 | 109 | { |
| 110 | 110 | $this->keyGroupVersions = array(); |
| 111 | 111 | $this->handler->put('key_group_versions', $this->keyGroupVersions, 0); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | function isSupport() |
| 123 | 123 | { |
| 124 | - if($this->handler && $this->handler->isSupport()) |
|
| 124 | + if ($this->handler && $this->handler->isSupport()) |
|
| 125 | 125 | { |
| 126 | 126 | return true; |
| 127 | 127 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | { |
| 140 | 140 | $key = str_replace('/', ':', $key); |
| 141 | 141 | |
| 142 | - return __XE_VERSION__ . ':' . $key; |
|
| 142 | + return __XE_VERSION__.':'.$key; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | function get($key, $modified_time = 0) |
| 154 | 154 | { |
| 155 | - if(!$this->handler) |
|
| 155 | + if (!$this->handler) |
|
| 156 | 156 | { |
| 157 | 157 | return false; |
| 158 | 158 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | function put($key, $obj, $valid_time = 0) |
| 176 | 176 | { |
| 177 | - if(!$this->handler && !$key) |
|
| 177 | + if (!$this->handler && !$key) |
|
| 178 | 178 | { |
| 179 | 179 | return false; |
| 180 | 180 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | function delete($key) |
| 194 | 194 | { |
| 195 | - if(!$this->handler) |
|
| 195 | + if (!$this->handler) |
|
| 196 | 196 | { |
| 197 | 197 | return false; |
| 198 | 198 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | function isValid($key, $modified_time = 0) |
| 214 | 214 | { |
| 215 | - if(!$this->handler) |
|
| 215 | + if (!$this->handler) |
|
| 216 | 216 | { |
| 217 | 217 | return false; |
| 218 | 218 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | function truncate() |
| 231 | 231 | { |
| 232 | - if(!$this->handler) |
|
| 232 | + if (!$this->handler) |
|
| 233 | 233 | { |
| 234 | 234 | return false; |
| 235 | 235 | } |
@@ -255,13 +255,13 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | function getGroupKey($keyGroupName, $key) |
| 257 | 257 | { |
| 258 | - if(!$this->keyGroupVersions[$keyGroupName]) |
|
| 258 | + if (!$this->keyGroupVersions[$keyGroupName]) |
|
| 259 | 259 | { |
| 260 | 260 | $this->keyGroupVersions[$keyGroupName] = 1; |
| 261 | 261 | $this->handler->put('key_group_versions', $this->keyGroupVersions, 0); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - return 'cache_group_' . $this->keyGroupVersions[$keyGroupName] . ':' . $keyGroupName . ':' . $key; |
|
| 264 | + return 'cache_group_'.$this->keyGroupVersions[$keyGroupName].':'.$keyGroupName.':'.$key; |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |