@@ -100,6 +100,6 @@ |
||
100 | 100 | */ |
101 | 101 | public function getHelperClass($name) |
102 | 102 | { |
103 | - return 'Nip_Helper_'.ucfirst($name); |
|
103 | + return 'Nip_Helper_' . ucfirst($name); |
|
104 | 104 | } |
105 | 105 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | $this->_mail->CharSet = "UTF-8"; |
12 | 12 | // $this->_mail->SMTPDebug = true; |
13 | 13 | |
14 | - $config = Nip_Config::instance()->parse(CONFIG_PATH.'smtp.ini'); |
|
14 | + $config = Nip_Config::instance()->parse(CONFIG_PATH . 'smtp.ini'); |
|
15 | 15 | if ($config->SMTP->host) { |
16 | 16 | $this->_mail->IsSMTP(); |
17 | 17 | if ($config->SMTP->username) { |
@@ -17,34 +17,34 @@ discard block |
||
17 | 17 | |
18 | 18 | protected $previous = []; |
19 | 19 | protected $next = []; |
20 | - protected $session_var = 'flash-data'; |
|
20 | + protected $session_var = 'flash-data'; |
|
21 | 21 | |
22 | 22 | |
23 | - public function __construct() { |
|
24 | - $this->read(); |
|
25 | - } |
|
23 | + public function __construct() { |
|
24 | + $this->read(); |
|
25 | + } |
|
26 | 26 | |
27 | - public function read() { |
|
28 | - $data = $_SESSION[$this->session_var]; |
|
29 | - if (!is_null($data)) { |
|
30 | - if (is_array($data)) { |
|
31 | - $this->previous = $data; |
|
32 | - } |
|
33 | - unset($_SESSION[$this->session_var]); |
|
34 | - } |
|
35 | - } |
|
27 | + public function read() { |
|
28 | + $data = $_SESSION[$this->session_var]; |
|
29 | + if (!is_null($data)) { |
|
30 | + if (is_array($data)) { |
|
31 | + $this->previous = $data; |
|
32 | + } |
|
33 | + unset($_SESSION[$this->session_var]); |
|
34 | + } |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Returns static instance |
|
39 | - * |
|
40 | - * @return self |
|
41 | - */ |
|
42 | - static public function &instance() { |
|
43 | - static $instance; |
|
44 | - if (!($instance instanceof self)) { |
|
45 | - $instance = new self(); |
|
46 | - } |
|
47 | - return $instance; |
|
37 | + /** |
|
38 | + * Returns static instance |
|
39 | + * |
|
40 | + * @return self |
|
41 | + */ |
|
42 | + static public function &instance() { |
|
43 | + static $instance; |
|
44 | + if (!($instance instanceof self)) { |
|
45 | + $instance = new self(); |
|
46 | + } |
|
47 | + return $instance; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | public function has($var) |
@@ -77,5 +77,5 @@ discard block |
||
77 | 77 | protected function clear() |
78 | 78 | { |
79 | 79 | $this->next = []; |
80 | - } |
|
80 | + } |
|
81 | 81 | } |
82 | 82 | \ No newline at end of file |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $query = $this->getDB()->newSelect(); |
34 | 34 | |
35 | 35 | $query->from($this->getWith()->getFullNameTable()); |
36 | - $query->from($this->getDB()->getDatabase().'.'.$this->getTable()); |
|
36 | + $query->from($this->getDB()->getDatabase() . '.' . $this->getTable()); |
|
37 | 37 | |
38 | 38 | foreach ($this->getWith()->getFields() as $field) { |
39 | 39 | $query->cols(["{$this->getWith()->getTable()}.$field", $field]); |
@@ -233,6 +233,6 @@ discard block |
||
233 | 233 | */ |
234 | 234 | protected function getDictionaryKey() |
235 | 235 | { |
236 | - return '__'.$this->getFK(); |
|
236 | + return '__' . $this->getFK(); |
|
237 | 237 | } |
238 | 238 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | public function populateQuerySpecific(AbstractQuery $query) |
20 | 20 | { |
21 | 21 | $pk = $this->getManager()->getPrimaryKey(); |
22 | - $query->where('`'.$this->getFK().'` = ?', $this->getItem()->{$pk}); |
|
22 | + $query->where('`' . $this->getFK() . '` = ?', $this->getItem()->{$pk}); |
|
23 | 23 | |
24 | 24 | return $query; |
25 | 25 | } |
@@ -3,67 +3,67 @@ |
||
3 | 3 | class Nip_Record_Sorter |
4 | 4 | { |
5 | 5 | |
6 | - protected $_query; |
|
7 | - protected $_field; |
|
8 | - protected $_type = "asc"; |
|
6 | + protected $_query; |
|
7 | + protected $_field; |
|
8 | + protected $_type = "asc"; |
|
9 | 9 | |
10 | - public function __construct($field = false, $type = false) |
|
11 | - { |
|
12 | - $this->_field = $field; |
|
10 | + public function __construct($field = false, $type = false) |
|
11 | + { |
|
12 | + $this->_field = $field; |
|
13 | 13 | |
14 | - if ($type) { |
|
15 | - $this->_type = $type; |
|
16 | - } |
|
17 | - } |
|
14 | + if ($type) { |
|
15 | + $this->_type = $type; |
|
16 | + } |
|
17 | + } |
|
18 | 18 | |
19 | - public function sort($query, $request = array()) |
|
20 | - { |
|
21 | - $this->setQuery($query); |
|
22 | - $this->setParams($request); |
|
19 | + public function sort($query, $request = array()) |
|
20 | + { |
|
21 | + $this->setQuery($query); |
|
22 | + $this->setParams($request); |
|
23 | 23 | |
24 | - if ($this->getField()) { |
|
25 | - $query->order(array($this->getField(), $this->getType())); |
|
26 | - } |
|
27 | - return $query; |
|
28 | - } |
|
24 | + if ($this->getField()) { |
|
25 | + $query->order(array($this->getField(), $this->getType())); |
|
26 | + } |
|
27 | + return $query; |
|
28 | + } |
|
29 | 29 | |
30 | - public function setParams($request = array()) |
|
31 | - { |
|
32 | - if ($request['order'] && preg_match("/[a-z0-9_-]/i", $request['order'])) { |
|
33 | - $this->_field = $request['order']; |
|
34 | - if (in_array($request['order_type'], array("asc", "desc"))) { |
|
35 | - $this->_type = $request['order_type']; |
|
36 | - } |
|
37 | - } |
|
38 | - return $this; |
|
39 | - } |
|
30 | + public function setParams($request = array()) |
|
31 | + { |
|
32 | + if ($request['order'] && preg_match("/[a-z0-9_-]/i", $request['order'])) { |
|
33 | + $this->_field = $request['order']; |
|
34 | + if (in_array($request['order_type'], array("asc", "desc"))) { |
|
35 | + $this->_type = $request['order_type']; |
|
36 | + } |
|
37 | + } |
|
38 | + return $this; |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * @param \Nip\Database\Query\Select $query |
|
43 | - * @return Nip_Record_Sorter |
|
44 | - */ |
|
45 | - public function setQuery($query) |
|
46 | - { |
|
47 | - $this->_query = $query; |
|
48 | - return $this; |
|
49 | - } |
|
41 | + /** |
|
42 | + * @param \Nip\Database\Query\Select $query |
|
43 | + * @return Nip_Record_Sorter |
|
44 | + */ |
|
45 | + public function setQuery($query) |
|
46 | + { |
|
47 | + $this->_query = $query; |
|
48 | + return $this; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * @return \Nip\Database\Query\Select |
|
53 | - */ |
|
54 | - public function getQuery() |
|
55 | - { |
|
56 | - return $this->_query; |
|
57 | - } |
|
51 | + /** |
|
52 | + * @return \Nip\Database\Query\Select |
|
53 | + */ |
|
54 | + public function getQuery() |
|
55 | + { |
|
56 | + return $this->_query; |
|
57 | + } |
|
58 | 58 | |
59 | - public function getField() |
|
60 | - { |
|
61 | - return $this->_field; |
|
62 | - } |
|
59 | + public function getField() |
|
60 | + { |
|
61 | + return $this->_field; |
|
62 | + } |
|
63 | 63 | |
64 | - public function getType() |
|
65 | - { |
|
66 | - return $this->_type; |
|
67 | - } |
|
64 | + public function getType() |
|
65 | + { |
|
66 | + return $this->_type; |
|
67 | + } |
|
68 | 68 | |
69 | 69 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | $cacheId = $this->getCacheId($cacheId); |
34 | 34 | |
35 | - return $this->cachePath().$cacheId.'.php'; |
|
35 | + return $this->cachePath() . $cacheId . '.php'; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function getCacheId($type = false) |
43 | 43 | { |
44 | - $cacheId = $this->getManager()->getController().'-'.$type; |
|
44 | + $cacheId = $this->getManager()->getController() . '-' . $type; |
|
45 | 45 | |
46 | 46 | return $cacheId; |
47 | 47 | } |
@@ -70,6 +70,6 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function cachePath() |
72 | 72 | { |
73 | - return parent::cachePath().'/records/'; |
|
73 | + return parent::cachePath() . '/records/'; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | \ No newline at end of file |
@@ -116,7 +116,7 @@ |
||
116 | 116 | |
117 | 117 | public function getFilterClass($type) |
118 | 118 | { |
119 | - return '\Nip\Records\Filters\\'.$type; |
|
119 | + return '\Nip\Records\Filters\\' . $type; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -49,7 +49,7 @@ |
||
49 | 49 | { |
50 | 50 | $table = $this->getManager()->getRecordManager()->getTable(); |
51 | 51 | |
52 | - return '`'.$table.'`.`'.$this->getField().'`'; |
|
52 | + return '`' . $table . '`.`' . $this->getField() . '`'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | } |
56 | 56 | \ No newline at end of file |