@@ -3,113 +3,113 @@ |
||
3 | 3 | class Nip_Helper_View_Paginator extends Nip_Helper_View_Abstract |
4 | 4 | { |
5 | 5 | |
6 | - protected $_url; |
|
7 | - protected $_interval = array(); |
|
8 | - protected $_paginator; |
|
9 | - protected $_viewPath = "/pagination"; |
|
10 | - |
|
11 | - public function __call($name, $arguments) |
|
12 | - { |
|
13 | - return call_user_func_array(array($this->getPaginator(), $name), $arguments); |
|
14 | - } |
|
15 | - |
|
16 | - public function url($page) |
|
17 | - { |
|
18 | - $return = $this->_url; |
|
6 | + protected $_url; |
|
7 | + protected $_interval = array(); |
|
8 | + protected $_paginator; |
|
9 | + protected $_viewPath = "/pagination"; |
|
10 | + |
|
11 | + public function __call($name, $arguments) |
|
12 | + { |
|
13 | + return call_user_func_array(array($this->getPaginator(), $name), $arguments); |
|
14 | + } |
|
15 | + |
|
16 | + public function url($page) |
|
17 | + { |
|
18 | + $return = $this->_url; |
|
19 | 19 | $return = str_replace('&page=' . $this->getPaginator()->getPage(), '', $return); |
20 | 20 | $return = str_replace('&page=' . $this->getPaginator()->getPage(), '', $return); |
21 | 21 | $return = str_replace('page=' . $this->getPaginator()->getPage(), '', $return); |
22 | 22 | |
23 | - if ($page > 1) { |
|
24 | - $return = rtrim($return, "/"); |
|
23 | + if ($page > 1) { |
|
24 | + $return = rtrim($return, "/"); |
|
25 | 25 | |
26 | - if (strpos($return, '?') === false) { |
|
27 | - $return .= '?page=' . $page; |
|
28 | - } else { |
|
29 | - $return .= '&page=' . $page; |
|
30 | - } |
|
31 | - } |
|
32 | - return $return; |
|
33 | - } |
|
34 | - |
|
35 | - public function render() |
|
36 | - { |
|
37 | - $return = ''; |
|
38 | - |
|
39 | - if ($this->getPaginator() && $this->getPaginator()->getPages() > 1) { |
|
40 | - $this->getView()->paginator = $this; |
|
41 | - $this->getView()->pages = $this->getPaginator()->getPages(); |
|
42 | - $this->getView()->page = $this->getPaginator()->getPage(); |
|
43 | - $this->getView()->interval = $this->getInterval(); |
|
44 | - |
|
45 | - $return = $this->getView()->load($this->_viewPath, array(), true); |
|
46 | - } |
|
47 | - |
|
48 | - return $return; |
|
49 | - } |
|
50 | - |
|
51 | - public function getInterval() |
|
52 | - { |
|
53 | - $this->interval['min'] = 1; |
|
54 | - $this->interval['max'] = $this->getPaginator()->getPages(); |
|
55 | - |
|
56 | - $pages = $this->interval['max']; |
|
57 | - $page = $this->getPaginator()->getPage(); |
|
58 | - |
|
59 | - if ($pages > 7) { |
|
60 | - if ($page <= 6) { |
|
61 | - $this->interval['min'] = 1; |
|
62 | - $this->interval['max'] = 7; |
|
63 | - } elseif ($pages - $page <= 5) { |
|
64 | - $this->interval['min'] = $pages - 6; |
|
65 | - $this->interval['max'] = $pages; |
|
66 | - } else { |
|
67 | - $this->interval['min'] = $page - 3; |
|
68 | - $this->interval['max'] = $page + 3; |
|
69 | - } |
|
70 | - } |
|
71 | - |
|
72 | - return $this->interval; |
|
73 | - } |
|
74 | - |
|
75 | - /** |
|
76 | - * @return Nip_Record_Paginator |
|
77 | - */ |
|
78 | - public function getPaginator() |
|
79 | - { |
|
80 | - return $this->_paginator; |
|
81 | - } |
|
82 | - |
|
83 | - public function setPaginator($paginator) |
|
84 | - { |
|
85 | - $this->_paginator = $paginator; |
|
86 | - return $this; |
|
87 | - } |
|
88 | - |
|
89 | - public function setViewPath($view) |
|
90 | - { |
|
91 | - $this->_viewPath = $view; |
|
92 | - return $this; |
|
93 | - } |
|
94 | - |
|
95 | - public function setURL($url) |
|
96 | - { |
|
97 | - $this->_url = $url; |
|
98 | - return $this; |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * Singleton |
|
103 | - * |
|
104 | - * @return Nip_Helper_View_Paginator |
|
105 | - */ |
|
106 | - static public function instance() |
|
107 | - { |
|
108 | - static $instance; |
|
109 | - if (!($instance instanceof self)) { |
|
110 | - $instance = new self(); |
|
111 | - } |
|
112 | - return $instance; |
|
113 | - } |
|
26 | + if (strpos($return, '?') === false) { |
|
27 | + $return .= '?page=' . $page; |
|
28 | + } else { |
|
29 | + $return .= '&page=' . $page; |
|
30 | + } |
|
31 | + } |
|
32 | + return $return; |
|
33 | + } |
|
34 | + |
|
35 | + public function render() |
|
36 | + { |
|
37 | + $return = ''; |
|
38 | + |
|
39 | + if ($this->getPaginator() && $this->getPaginator()->getPages() > 1) { |
|
40 | + $this->getView()->paginator = $this; |
|
41 | + $this->getView()->pages = $this->getPaginator()->getPages(); |
|
42 | + $this->getView()->page = $this->getPaginator()->getPage(); |
|
43 | + $this->getView()->interval = $this->getInterval(); |
|
44 | + |
|
45 | + $return = $this->getView()->load($this->_viewPath, array(), true); |
|
46 | + } |
|
47 | + |
|
48 | + return $return; |
|
49 | + } |
|
50 | + |
|
51 | + public function getInterval() |
|
52 | + { |
|
53 | + $this->interval['min'] = 1; |
|
54 | + $this->interval['max'] = $this->getPaginator()->getPages(); |
|
55 | + |
|
56 | + $pages = $this->interval['max']; |
|
57 | + $page = $this->getPaginator()->getPage(); |
|
58 | + |
|
59 | + if ($pages > 7) { |
|
60 | + if ($page <= 6) { |
|
61 | + $this->interval['min'] = 1; |
|
62 | + $this->interval['max'] = 7; |
|
63 | + } elseif ($pages - $page <= 5) { |
|
64 | + $this->interval['min'] = $pages - 6; |
|
65 | + $this->interval['max'] = $pages; |
|
66 | + } else { |
|
67 | + $this->interval['min'] = $page - 3; |
|
68 | + $this->interval['max'] = $page + 3; |
|
69 | + } |
|
70 | + } |
|
71 | + |
|
72 | + return $this->interval; |
|
73 | + } |
|
74 | + |
|
75 | + /** |
|
76 | + * @return Nip_Record_Paginator |
|
77 | + */ |
|
78 | + public function getPaginator() |
|
79 | + { |
|
80 | + return $this->_paginator; |
|
81 | + } |
|
82 | + |
|
83 | + public function setPaginator($paginator) |
|
84 | + { |
|
85 | + $this->_paginator = $paginator; |
|
86 | + return $this; |
|
87 | + } |
|
88 | + |
|
89 | + public function setViewPath($view) |
|
90 | + { |
|
91 | + $this->_viewPath = $view; |
|
92 | + return $this; |
|
93 | + } |
|
94 | + |
|
95 | + public function setURL($url) |
|
96 | + { |
|
97 | + $this->_url = $url; |
|
98 | + return $this; |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * Singleton |
|
103 | + * |
|
104 | + * @return Nip_Helper_View_Paginator |
|
105 | + */ |
|
106 | + static public function instance() |
|
107 | + { |
|
108 | + static $instance; |
|
109 | + if (!($instance instanceof self)) { |
|
110 | + $instance = new self(); |
|
111 | + } |
|
112 | + return $instance; |
|
113 | + } |
|
114 | 114 | |
115 | 115 | } |
@@ -3,152 +3,152 @@ |
||
3 | 3 | class Nip_Helper_View_Scripts extends Nip_Helper_View_Abstract |
4 | 4 | { |
5 | 5 | |
6 | - protected $_files = array(); |
|
7 | - protected $_defaultPlaceholder = "head"; |
|
8 | - protected $_pack = false; |
|
9 | - |
|
10 | - public function add($file, $placeholder = false) |
|
11 | - { |
|
12 | - return $this->addFile($file, 'add', $placeholder); |
|
13 | - } |
|
14 | - |
|
15 | - public function prepend($file, $placeholder = false) |
|
16 | - { |
|
17 | - return $this->addFile($file, 'prepend', $placeholder); |
|
18 | - } |
|
19 | - |
|
20 | - public function addFile($file, $direction = 'add', $placeholder = false) |
|
21 | - { |
|
22 | - if (!$placeholder) { |
|
23 | - $placeholder = $this->_defaultPlaceholder; |
|
24 | - } |
|
25 | - |
|
26 | - if (!is_array($this->_files[$placeholder])) { |
|
27 | - $this->_files[$placeholder] = array(); |
|
28 | - } |
|
29 | - |
|
30 | - if ($direction == 'prepend') { |
|
31 | - array_unshift($this->_files[$placeholder], $file); |
|
32 | - } else { |
|
33 | - $this->_files[$placeholder][] = $file; |
|
34 | - } |
|
35 | - |
|
36 | - return $this; |
|
37 | - } |
|
38 | - |
|
39 | - public function __toString() |
|
40 | - { |
|
41 | - return $this->render($this->_defaultPlaceholder); |
|
42 | - } |
|
43 | - |
|
44 | - public function render($placeholder = false) |
|
45 | - { |
|
46 | - if (!$placeholder) { |
|
47 | - $placeholder = $this->_defaultPlaceholder; |
|
48 | - } |
|
49 | - |
|
50 | - return $this->renderHMTL($this->_files[$placeholder]); |
|
51 | - } |
|
52 | - |
|
53 | - public function renderHMTL($files) |
|
54 | - { |
|
55 | - if (is_array($files)) { |
|
56 | - $internal = array(); |
|
57 | - $external = array(); |
|
58 | - |
|
59 | - foreach ($files as $file) { |
|
60 | - if (preg_match('/https?:\/\//', $file)) { |
|
61 | - $external[] = $file; |
|
62 | - } else { |
|
63 | - $internal[] = $file; |
|
64 | - } |
|
65 | - } |
|
66 | - |
|
67 | - $return .= $this->pack($internal); |
|
68 | - |
|
69 | - if ($external) { |
|
70 | - foreach ($external as $file) { |
|
71 | - $return .= $this->buildTag($file); |
|
72 | - } |
|
73 | - } |
|
74 | - } |
|
75 | - return $return; |
|
76 | - } |
|
77 | - |
|
78 | - public function buildURL($source) |
|
79 | - { |
|
80 | - return SCRIPTS_URL . $source . (in_array(Nip_File_System::instance()->getExtension($source), array("js", "php")) ? '' : '.js'); |
|
81 | - } |
|
82 | - |
|
83 | - public function buildTag($path) |
|
84 | - { |
|
85 | - return "<script type=\"text/javascript\" src=\"$path\"></script>\r\n"; |
|
86 | - } |
|
87 | - |
|
88 | - public function pack($files) |
|
89 | - { |
|
90 | - if ($files) { |
|
91 | - if ($this->_pack === false) { |
|
92 | - $return = ''; |
|
93 | - |
|
94 | - foreach ($files as $file) { |
|
95 | - $return .= $this->buildTag($this->buildURL($file)); |
|
96 | - } |
|
97 | - |
|
98 | - return $return; |
|
99 | - } else { |
|
100 | - $lastUpdated = 0; |
|
101 | - foreach ($files as $file) { |
|
102 | - $path = SCRIPTS_PATH . $file . ".js"; |
|
103 | - if (file_exists($path)) { |
|
104 | - $lastUpdated = max($lastUpdated, filemtime($path)); |
|
105 | - } |
|
106 | - } |
|
107 | - |
|
108 | - $hash = md5(implode("", $files)) . "." . $lastUpdated; |
|
109 | - |
|
110 | - $path = CACHE_PATH . "scripts/" . $hash; |
|
111 | - if (!file_exists($path . ".js")) { |
|
112 | - $content = ""; |
|
113 | - foreach ($files as $file) { |
|
114 | - $content .= file_get_contents(SCRIPTS_PATH . $file . ".js") . "\r\n"; |
|
115 | - } |
|
116 | - $packer = new JavaScriptPacker($content, "Normal", true, false); |
|
117 | - $content = $packer->pack(); |
|
118 | - |
|
119 | - $file = new Nip_File_Handler(array("path" => $path . ".js")); |
|
120 | - $file->write($content); |
|
121 | - |
|
122 | - if ($file->gzip()) { |
|
123 | - $file->setPath($path . ".gz")->write(); |
|
124 | - } |
|
125 | - } |
|
126 | - |
|
127 | - return '<script type="text/javascript" src="' . $this->buildURL($hash) . '"></script>' . "\r\n"; |
|
128 | - } |
|
129 | - } |
|
130 | - |
|
131 | - return false; |
|
132 | - } |
|
133 | - |
|
134 | - public function setPack($pack = true) |
|
135 | - { |
|
136 | - $this->_pack = $pack; |
|
137 | - return $this; |
|
138 | - } |
|
139 | - |
|
140 | - /** |
|
141 | - * Singleton |
|
142 | - * |
|
143 | - * @return Nip_Helper_View_Scripts |
|
144 | - */ |
|
145 | - static public function instance() |
|
146 | - { |
|
147 | - static $instance; |
|
148 | - if (!($instance instanceof self)) { |
|
149 | - $instance = new self(); |
|
150 | - } |
|
151 | - return $instance; |
|
152 | - } |
|
6 | + protected $_files = array(); |
|
7 | + protected $_defaultPlaceholder = "head"; |
|
8 | + protected $_pack = false; |
|
9 | + |
|
10 | + public function add($file, $placeholder = false) |
|
11 | + { |
|
12 | + return $this->addFile($file, 'add', $placeholder); |
|
13 | + } |
|
14 | + |
|
15 | + public function prepend($file, $placeholder = false) |
|
16 | + { |
|
17 | + return $this->addFile($file, 'prepend', $placeholder); |
|
18 | + } |
|
19 | + |
|
20 | + public function addFile($file, $direction = 'add', $placeholder = false) |
|
21 | + { |
|
22 | + if (!$placeholder) { |
|
23 | + $placeholder = $this->_defaultPlaceholder; |
|
24 | + } |
|
25 | + |
|
26 | + if (!is_array($this->_files[$placeholder])) { |
|
27 | + $this->_files[$placeholder] = array(); |
|
28 | + } |
|
29 | + |
|
30 | + if ($direction == 'prepend') { |
|
31 | + array_unshift($this->_files[$placeholder], $file); |
|
32 | + } else { |
|
33 | + $this->_files[$placeholder][] = $file; |
|
34 | + } |
|
35 | + |
|
36 | + return $this; |
|
37 | + } |
|
38 | + |
|
39 | + public function __toString() |
|
40 | + { |
|
41 | + return $this->render($this->_defaultPlaceholder); |
|
42 | + } |
|
43 | + |
|
44 | + public function render($placeholder = false) |
|
45 | + { |
|
46 | + if (!$placeholder) { |
|
47 | + $placeholder = $this->_defaultPlaceholder; |
|
48 | + } |
|
49 | + |
|
50 | + return $this->renderHMTL($this->_files[$placeholder]); |
|
51 | + } |
|
52 | + |
|
53 | + public function renderHMTL($files) |
|
54 | + { |
|
55 | + if (is_array($files)) { |
|
56 | + $internal = array(); |
|
57 | + $external = array(); |
|
58 | + |
|
59 | + foreach ($files as $file) { |
|
60 | + if (preg_match('/https?:\/\//', $file)) { |
|
61 | + $external[] = $file; |
|
62 | + } else { |
|
63 | + $internal[] = $file; |
|
64 | + } |
|
65 | + } |
|
66 | + |
|
67 | + $return .= $this->pack($internal); |
|
68 | + |
|
69 | + if ($external) { |
|
70 | + foreach ($external as $file) { |
|
71 | + $return .= $this->buildTag($file); |
|
72 | + } |
|
73 | + } |
|
74 | + } |
|
75 | + return $return; |
|
76 | + } |
|
77 | + |
|
78 | + public function buildURL($source) |
|
79 | + { |
|
80 | + return SCRIPTS_URL . $source . (in_array(Nip_File_System::instance()->getExtension($source), array("js", "php")) ? '' : '.js'); |
|
81 | + } |
|
82 | + |
|
83 | + public function buildTag($path) |
|
84 | + { |
|
85 | + return "<script type=\"text/javascript\" src=\"$path\"></script>\r\n"; |
|
86 | + } |
|
87 | + |
|
88 | + public function pack($files) |
|
89 | + { |
|
90 | + if ($files) { |
|
91 | + if ($this->_pack === false) { |
|
92 | + $return = ''; |
|
93 | + |
|
94 | + foreach ($files as $file) { |
|
95 | + $return .= $this->buildTag($this->buildURL($file)); |
|
96 | + } |
|
97 | + |
|
98 | + return $return; |
|
99 | + } else { |
|
100 | + $lastUpdated = 0; |
|
101 | + foreach ($files as $file) { |
|
102 | + $path = SCRIPTS_PATH . $file . ".js"; |
|
103 | + if (file_exists($path)) { |
|
104 | + $lastUpdated = max($lastUpdated, filemtime($path)); |
|
105 | + } |
|
106 | + } |
|
107 | + |
|
108 | + $hash = md5(implode("", $files)) . "." . $lastUpdated; |
|
109 | + |
|
110 | + $path = CACHE_PATH . "scripts/" . $hash; |
|
111 | + if (!file_exists($path . ".js")) { |
|
112 | + $content = ""; |
|
113 | + foreach ($files as $file) { |
|
114 | + $content .= file_get_contents(SCRIPTS_PATH . $file . ".js") . "\r\n"; |
|
115 | + } |
|
116 | + $packer = new JavaScriptPacker($content, "Normal", true, false); |
|
117 | + $content = $packer->pack(); |
|
118 | + |
|
119 | + $file = new Nip_File_Handler(array("path" => $path . ".js")); |
|
120 | + $file->write($content); |
|
121 | + |
|
122 | + if ($file->gzip()) { |
|
123 | + $file->setPath($path . ".gz")->write(); |
|
124 | + } |
|
125 | + } |
|
126 | + |
|
127 | + return '<script type="text/javascript" src="' . $this->buildURL($hash) . '"></script>' . "\r\n"; |
|
128 | + } |
|
129 | + } |
|
130 | + |
|
131 | + return false; |
|
132 | + } |
|
133 | + |
|
134 | + public function setPack($pack = true) |
|
135 | + { |
|
136 | + $this->_pack = $pack; |
|
137 | + return $this; |
|
138 | + } |
|
139 | + |
|
140 | + /** |
|
141 | + * Singleton |
|
142 | + * |
|
143 | + * @return Nip_Helper_View_Scripts |
|
144 | + */ |
|
145 | + static public function instance() |
|
146 | + { |
|
147 | + static $instance; |
|
148 | + if (!($instance instanceof self)) { |
|
149 | + $instance = new self(); |
|
150 | + } |
|
151 | + return $instance; |
|
152 | + } |
|
153 | 153 | |
154 | 154 | } |
155 | 155 | \ No newline at end of file |
@@ -3,74 +3,74 @@ |
||
3 | 3 | class Nip_Helper_View_Sorter extends Nip_Helper_View_Abstract |
4 | 4 | { |
5 | 5 | |
6 | - protected $_sorter; |
|
7 | - protected $_url; |
|
6 | + protected $_sorter; |
|
7 | + protected $_url; |
|
8 | 8 | |
9 | - public function render($field, $label) |
|
10 | - { |
|
11 | - $url = $this->getURL($field, "asc"); |
|
12 | - if ($field == $this->getSorter()->getField()) { |
|
13 | - switch ($this->getSorter()->getType()) { |
|
14 | - case "desc": |
|
15 | - $url = $this->getURL($field, "asc"); |
|
16 | - $image = "arrow_up"; |
|
17 | - break; |
|
18 | - case "asc": |
|
19 | - default: |
|
20 | - $url = $this->getURL($field, "desc"); |
|
21 | - $image = "arrow_down"; |
|
22 | - break; |
|
23 | - } |
|
24 | - } |
|
25 | - $return = "<a href=\"$url\">"; |
|
26 | - if ($image) { |
|
27 | - $return .= "<img src=\"".Nip_Helper_URL::instance()->image("$image.gif")."\" alt=\"\">"; |
|
28 | - } |
|
29 | - $return .= $label; |
|
30 | - $return .= "</a>"; |
|
9 | + public function render($field, $label) |
|
10 | + { |
|
11 | + $url = $this->getURL($field, "asc"); |
|
12 | + if ($field == $this->getSorter()->getField()) { |
|
13 | + switch ($this->getSorter()->getType()) { |
|
14 | + case "desc": |
|
15 | + $url = $this->getURL($field, "asc"); |
|
16 | + $image = "arrow_up"; |
|
17 | + break; |
|
18 | + case "asc": |
|
19 | + default: |
|
20 | + $url = $this->getURL($field, "desc"); |
|
21 | + $image = "arrow_down"; |
|
22 | + break; |
|
23 | + } |
|
24 | + } |
|
25 | + $return = "<a href=\"$url\">"; |
|
26 | + if ($image) { |
|
27 | + $return .= "<img src=\"".Nip_Helper_URL::instance()->image("$image.gif")."\" alt=\"\">"; |
|
28 | + } |
|
29 | + $return .= $label; |
|
30 | + $return .= "</a>"; |
|
31 | 31 | |
32 | - return $return; |
|
33 | - } |
|
32 | + return $return; |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param Nip_Record_Sorter $sorter |
|
37 | - * @return Nip_Helper_View_Sorter |
|
38 | - */ |
|
39 | - public function setSorter($sorter) |
|
40 | - { |
|
41 | - $this->_sorter = $sorter; |
|
42 | - return $this; |
|
43 | - } |
|
35 | + /** |
|
36 | + * @param Nip_Record_Sorter $sorter |
|
37 | + * @return Nip_Helper_View_Sorter |
|
38 | + */ |
|
39 | + public function setSorter($sorter) |
|
40 | + { |
|
41 | + $this->_sorter = $sorter; |
|
42 | + return $this; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * @return Nip_Record_Sorter |
|
47 | - */ |
|
48 | - public function getSorter() |
|
49 | - { |
|
50 | - return $this->_sorter; |
|
51 | - } |
|
45 | + /** |
|
46 | + * @return Nip_Record_Sorter |
|
47 | + */ |
|
48 | + public function getSorter() |
|
49 | + { |
|
50 | + return $this->_sorter; |
|
51 | + } |
|
52 | 52 | |
53 | - public function setURL($url) |
|
54 | - { |
|
55 | - $this->_url = html_entity_decode($url); |
|
56 | - return $this; |
|
57 | - } |
|
53 | + public function setURL($url) |
|
54 | + { |
|
55 | + $this->_url = html_entity_decode($url); |
|
56 | + return $this; |
|
57 | + } |
|
58 | 58 | |
59 | - public function getURL($field = false, $type = false) |
|
60 | - { |
|
61 | - $url = $this->_url; |
|
62 | - $url = parse_url($url); |
|
59 | + public function getURL($field = false, $type = false) |
|
60 | + { |
|
61 | + $url = $this->_url; |
|
62 | + $url = parse_url($url); |
|
63 | 63 | |
64 | - $query = $url['query']; |
|
65 | - parse_str($query, $params); |
|
64 | + $query = $url['query']; |
|
65 | + parse_str($query, $params); |
|
66 | 66 | |
67 | - $params['order'] = $field; |
|
68 | - if ($type) { |
|
69 | - $params['order_type'] = $type; |
|
70 | - } |
|
67 | + $params['order'] = $field; |
|
68 | + if ($type) { |
|
69 | + $params['order_type'] = $type; |
|
70 | + } |
|
71 | 71 | |
72 | - $url['query'] = http_build_query($params); |
|
72 | + $url['query'] = http_build_query($params); |
|
73 | 73 | |
74 | - return htmlentities(Nip_Helper_URL::instance()->build($url)); |
|
75 | - } |
|
74 | + return htmlentities(Nip_Helper_URL::instance()->build($url)); |
|
75 | + } |
|
76 | 76 | } |
77 | 77 | \ No newline at end of file |
@@ -24,7 +24,7 @@ |
||
24 | 24 | } |
25 | 25 | $return = "<a href=\"$url\">"; |
26 | 26 | if ($image) { |
27 | - $return .= "<img src=\"".Nip_Helper_URL::instance()->image("$image.gif")."\" alt=\"\">"; |
|
27 | + $return .= "<img src=\"" . Nip_Helper_URL::instance()->image("$image.gif") . "\" alt=\"\">"; |
|
28 | 28 | } |
29 | 29 | $return .= $label; |
30 | 30 | $return .= "</a>"; |
@@ -11,28 +11,28 @@ |
||
11 | 11 | |
12 | 12 | class Nip_Helper_View_Tooltips_Item { |
13 | 13 | |
14 | - protected $_id; |
|
15 | - protected $_content; |
|
14 | + protected $_id; |
|
15 | + protected $_content; |
|
16 | 16 | protected $_title; |
17 | 17 | |
18 | 18 | |
19 | - public function __construct($id, $content, $title = false) { |
|
20 | - $this->_id = $id; |
|
21 | - $this->_content = $content; |
|
22 | - $this->_title = $title; |
|
23 | - } |
|
19 | + public function __construct($id, $content, $title = false) { |
|
20 | + $this->_id = $id; |
|
21 | + $this->_content = $content; |
|
22 | + $this->_title = $title; |
|
23 | + } |
|
24 | 24 | |
25 | 25 | |
26 | - public function render() { |
|
27 | - $return = ''; |
|
26 | + public function render() { |
|
27 | + $return = ''; |
|
28 | 28 | |
29 | - $return .= '<div class="tooltip" id="' . $this->_id . '" style="display: none;">'; |
|
30 | - if ($this->_title !== false) { |
|
31 | - $return .= '<div class="tooltip-heading">' . $this->_title . '</div>'; |
|
32 | - } |
|
33 | - $return .= $this->_content; |
|
34 | - $return .= '</div>'; |
|
29 | + $return .= '<div class="tooltip" id="' . $this->_id . '" style="display: none;">'; |
|
30 | + if ($this->_title !== false) { |
|
31 | + $return .= '<div class="tooltip-heading">' . $this->_title . '</div>'; |
|
32 | + } |
|
33 | + $return .= $this->_content; |
|
34 | + $return .= '</div>'; |
|
35 | 35 | |
36 | - return $return; |
|
37 | - } |
|
36 | + return $return; |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -17,9 +17,9 @@ |
||
17 | 17 | |
18 | 18 | |
19 | 19 | public function __construct($id, $content, $title = false) { |
20 | - $this->_id = $id; |
|
21 | - $this->_content = $content; |
|
22 | - $this->_title = $title; |
|
20 | + $this->_id = $id; |
|
21 | + $this->_content = $content; |
|
22 | + $this->_title = $title; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 |
@@ -125,35 +125,35 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | public function __toString() { |
128 | - if ($this->title) { |
|
128 | + if ($this->title) { |
|
129 | 129 | $return[] = '<title>'. $this->title .'</title>'; |
130 | - } |
|
130 | + } |
|
131 | 131 | |
132 | - $return[] = '<meta http-equiv="Content-Type" content="text/html;" />'; |
|
133 | - $return[] = '<meta charset="' . $this->charset . '">'; |
|
134 | - $return[] = '<meta http-equiv="content-language" content="' . $this->language . '" />'; |
|
132 | + $return[] = '<meta http-equiv="Content-Type" content="text/html;" />'; |
|
133 | + $return[] = '<meta charset="' . $this->charset . '">'; |
|
134 | + $return[] = '<meta http-equiv="content-language" content="' . $this->language . '" />'; |
|
135 | 135 | |
136 | - $return[] = '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>'; |
|
136 | + $return[] = '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>'; |
|
137 | 137 | |
138 | - if ($this->authors) { |
|
138 | + if ($this->authors) { |
|
139 | 139 | $return[] = '<meta name="author" content="' . implode(", ", $this->authors) . '" />'; |
140 | - } |
|
141 | - if ($this->publisher) { |
|
140 | + } |
|
141 | + if ($this->publisher) { |
|
142 | 142 | $return[] = '<meta name="publisher" content="' . $this->publisher . '" />'; |
143 | - } |
|
144 | - if ($this->copyright) { |
|
143 | + } |
|
144 | + if ($this->copyright) { |
|
145 | 145 | $return[] = '<meta name="copyright" content="' . $this->copyright . '" />'; |
146 | - } |
|
146 | + } |
|
147 | 147 | |
148 | - $return[] = '<meta name="robots" content="' . $this->robots . '" />'; |
|
148 | + $return[] = '<meta name="robots" content="' . $this->robots . '" />'; |
|
149 | 149 | |
150 | - if ($this->keywords) { |
|
150 | + if ($this->keywords) { |
|
151 | 151 | $return[] = '<meta name="keywords" content="' . implode(",", $this->keywords) . '" />'; |
152 | - } |
|
152 | + } |
|
153 | 153 | |
154 | - if (!empty($this->description)) { |
|
155 | - $return[] = '<meta name="description" content="' . $this->description . '" />'; |
|
156 | - } |
|
154 | + if (!empty($this->description)) { |
|
155 | + $return[] = '<meta name="description" content="' . $this->description . '" />'; |
|
156 | + } |
|
157 | 157 | |
158 | 158 | if (!empty($this->verify_v1)) { |
159 | 159 | $return[] = '<meta name="verify-v1" content="'. $this->verify_v1 .'" />'; |
@@ -165,19 +165,19 @@ discard block |
||
165 | 165 | |
166 | 166 | // $return[] = '<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />'; |
167 | 167 | |
168 | - return implode("\n", $return); |
|
168 | + return implode("\n", $return); |
|
169 | 169 | } |
170 | 170 | |
171 | - /** |
|
172 | - * Singleton |
|
173 | - * |
|
174 | - * @return Nip_Helper_View_Meta |
|
175 | - */ |
|
176 | - static public function instance() { |
|
177 | - static $instance; |
|
178 | - if (!($instance instanceof self)) { |
|
179 | - $instance = new self(); |
|
180 | - } |
|
181 | - return $instance; |
|
182 | - } |
|
171 | + /** |
|
172 | + * Singleton |
|
173 | + * |
|
174 | + * @return Nip_Helper_View_Meta |
|
175 | + */ |
|
176 | + static public function instance() { |
|
177 | + static $instance; |
|
178 | + if (!($instance instanceof self)) { |
|
179 | + $instance = new self(); |
|
180 | + } |
|
181 | + return $instance; |
|
182 | + } |
|
183 | 183 | } |
184 | 184 | \ No newline at end of file |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public $description = false; |
33 | 33 | public $descriptionComponents = array(); |
34 | 34 | public $verify_v1 = false; |
35 | - public $feeds = array(); |
|
35 | + public $feeds = array(); |
|
36 | 36 | |
37 | 37 | |
38 | 38 | public function setTitleBase($base) |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | public function __toString() { |
128 | 128 | if ($this->title) { |
129 | - $return[] = '<title>'. $this->title .'</title>'; |
|
129 | + $return[] = '<title>' . $this->title . '</title>'; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | $return[] = '<meta http-equiv="Content-Type" content="text/html;" />'; |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | } |
157 | 157 | |
158 | 158 | if (!empty($this->verify_v1)) { |
159 | - $return[] = '<meta name="verify-v1" content="'. $this->verify_v1 .'" />'; |
|
159 | + $return[] = '<meta name="verify-v1" content="' . $this->verify_v1 . '" />'; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | foreach ($this->feeds as $feed) { |
163 | - $return[] = '<link rel="alternate" type="application/rss+xml" title="'.$feed->title.'" href="'.$feed->url.'" />'; |
|
163 | + $return[] = '<link rel="alternate" type="application/rss+xml" title="' . $feed->title . '" href="' . $feed->url . '" />'; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | // $return[] = '<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />'; |
@@ -11,7 +11,7 @@ |
||
11 | 11 | if ($wrap) { |
12 | 12 | $return .= '<div class="alert alert-danger">'; |
13 | 13 | if (count($items) > 1) { |
14 | - $return .= '<strong>'.__('general.form.errors.explanation').':</strong>'; |
|
14 | + $return .= '<strong>' . __('general.form.errors.explanation') . ':</strong>'; |
|
15 | 15 | $return .= "<ul>"; |
16 | 16 | } |
17 | 17 | } |
@@ -11,45 +11,45 @@ |
||
11 | 11 | |
12 | 12 | class Nip_Helper_View_Tooltips extends Nip_Helper_View_Abstract { |
13 | 13 | |
14 | - private $tooltips = array(); |
|
15 | - |
|
16 | - /** |
|
17 | - * Adds a tooltip item to the queue |
|
18 | - * |
|
19 | - * @param string $id |
|
20 | - * @param string $content |
|
21 | - */ |
|
22 | - public function addItem($id, $content, $title = false) { |
|
23 | - $this->tooltips[$id] = new Nip_Helper_View_Tooltips_Item($id, $content, $title); |
|
24 | - } |
|
25 | - |
|
26 | - |
|
27 | - /** |
|
28 | - * Returns xHTML-formatted tooltips |
|
29 | - * |
|
30 | - * @return string |
|
31 | - */ |
|
32 | - public function render() { |
|
33 | - $return = ''; |
|
34 | - if ($this->tooltips) { |
|
35 | - foreach ($this->tooltips as $tooltip) { |
|
36 | - $return .= $tooltip->render(); |
|
37 | - } |
|
38 | - } |
|
39 | - return $return; |
|
40 | - } |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * Singleton |
|
45 | - * |
|
46 | - * @return Nip_Helper_View_Tooltips |
|
47 | - */ |
|
48 | - static public function instance() { |
|
49 | - static $instance; |
|
50 | - if (!($instance instanceof self)) { |
|
51 | - $instance = new self(); |
|
52 | - } |
|
53 | - return $instance; |
|
54 | - } |
|
14 | + private $tooltips = array(); |
|
15 | + |
|
16 | + /** |
|
17 | + * Adds a tooltip item to the queue |
|
18 | + * |
|
19 | + * @param string $id |
|
20 | + * @param string $content |
|
21 | + */ |
|
22 | + public function addItem($id, $content, $title = false) { |
|
23 | + $this->tooltips[$id] = new Nip_Helper_View_Tooltips_Item($id, $content, $title); |
|
24 | + } |
|
25 | + |
|
26 | + |
|
27 | + /** |
|
28 | + * Returns xHTML-formatted tooltips |
|
29 | + * |
|
30 | + * @return string |
|
31 | + */ |
|
32 | + public function render() { |
|
33 | + $return = ''; |
|
34 | + if ($this->tooltips) { |
|
35 | + foreach ($this->tooltips as $tooltip) { |
|
36 | + $return .= $tooltip->render(); |
|
37 | + } |
|
38 | + } |
|
39 | + return $return; |
|
40 | + } |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * Singleton |
|
45 | + * |
|
46 | + * @return Nip_Helper_View_Tooltips |
|
47 | + */ |
|
48 | + static public function instance() { |
|
49 | + static $instance; |
|
50 | + if (!($instance instanceof self)) { |
|
51 | + $instance = new self(); |
|
52 | + } |
|
53 | + return $instance; |
|
54 | + } |
|
55 | 55 | } |
56 | 56 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | class Nip_Helper_View_Breadcrumbs extends Nip_Helper_View_Abstract { |
13 | 13 | |
14 | - protected $_items; |
|
14 | + protected $_items; |
|
15 | 15 | protected $_viewPath = "/breadcrumbs"; |
16 | 16 | |
17 | 17 | |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | |
23 | 23 | |
24 | 24 | |
25 | - public function reset() { |
|
26 | - $this->_items = array(); |
|
25 | + public function reset() { |
|
26 | + $this->_items = array(); |
|
27 | 27 | return $this; |
28 | - } |
|
28 | + } |
|
29 | 29 | |
30 | - public function addItem($title, $url = false, $checkUnique = true) { |
|
31 | - $data = array( |
|
30 | + public function addItem($title, $url = false, $checkUnique = true) { |
|
31 | + $data = array( |
|
32 | 32 | 'title' => $title, |
33 | 33 | 'url' => $url |
34 | - ); |
|
34 | + ); |
|
35 | 35 | |
36 | 36 | if ($checkUnique) { |
37 | 37 | $key = sha1(serialize($data)); |
@@ -44,32 +44,32 @@ discard block |
||
44 | 44 | $this->_items[] = $data; |
45 | 45 | } |
46 | 46 | return $this; |
47 | - } |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * Loads view |
|
52 | - * @return string |
|
53 | - */ |
|
50 | + /** |
|
51 | + * Loads view |
|
52 | + * @return string |
|
53 | + */ |
|
54 | 54 | public function __toString() { |
55 | 55 | $view = $this->getView(); |
56 | 56 | |
57 | 57 | $view->breadcrumbs = $this->_items; |
58 | 58 | |
59 | 59 | return $view->load($this->_viewPath, array(), true); |
60 | - } |
|
60 | + } |
|
61 | 61 | |
62 | 62 | |
63 | - /** |
|
64 | - * Singleton |
|
65 | - * |
|
66 | - * @return Nip_Helper_View_Breadcrumbs |
|
67 | - */ |
|
68 | - static public function instance() { |
|
69 | - static $instance; |
|
70 | - if (!($instance instanceof self)) { |
|
71 | - $instance = new self(); |
|
72 | - } |
|
73 | - return $instance; |
|
74 | - } |
|
63 | + /** |
|
64 | + * Singleton |
|
65 | + * |
|
66 | + * @return Nip_Helper_View_Breadcrumbs |
|
67 | + */ |
|
68 | + static public function instance() { |
|
69 | + static $instance; |
|
70 | + if (!($instance instanceof self)) { |
|
71 | + $instance = new self(); |
|
72 | + } |
|
73 | + return $instance; |
|
74 | + } |
|
75 | 75 | } |
76 | 76 | \ No newline at end of file |
@@ -3,14 +3,14 @@ discard block |
||
3 | 3 | class Nip_Helper_View_Flash extends Nip_Helper_View_Abstract |
4 | 4 | { |
5 | 5 | |
6 | - public function hasKey($key) |
|
7 | - { |
|
8 | - return Nip_Flash_Messages::instance()->has($key); |
|
9 | - } |
|
6 | + public function hasKey($key) |
|
7 | + { |
|
8 | + return Nip_Flash_Messages::instance()->has($key); |
|
9 | + } |
|
10 | 10 | |
11 | - public function render($key) |
|
12 | - { |
|
13 | - $return = ''; |
|
11 | + public function render($key) |
|
12 | + { |
|
13 | + $return = ''; |
|
14 | 14 | |
15 | 15 | $data = $this->getData($key); |
16 | 16 | |
@@ -20,26 +20,26 @@ discard block |
||
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | - return $return; |
|
24 | - } |
|
23 | + return $return; |
|
24 | + } |
|
25 | 25 | |
26 | 26 | public function getData($key) { |
27 | - $this->data = Nip_Flash_Messages::instance()->get($key); |
|
27 | + $this->data = Nip_Flash_Messages::instance()->get($key); |
|
28 | 28 | return $this->data; |
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | - * Singleton |
|
33 | - * |
|
34 | - * @return Nip_Helper_View_Flash |
|
35 | - */ |
|
36 | - static public function instance() |
|
37 | - { |
|
38 | - static $instance; |
|
39 | - if (!($instance instanceof self)) { |
|
40 | - $instance = new self(); |
|
41 | - } |
|
42 | - return $instance; |
|
43 | - } |
|
32 | + * Singleton |
|
33 | + * |
|
34 | + * @return Nip_Helper_View_Flash |
|
35 | + */ |
|
36 | + static public function instance() |
|
37 | + { |
|
38 | + static $instance; |
|
39 | + if (!($instance instanceof self)) { |
|
40 | + $instance = new self(); |
|
41 | + } |
|
42 | + return $instance; |
|
43 | + } |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | \ No newline at end of file |