@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param string $commandToken |
| 23 | 23 | */ |
| 24 | - public function __construct($commandToken){ |
|
| 24 | + public function __construct($commandToken) { |
|
| 25 | 25 | $this->commandToken = $commandToken; |
| 26 | 26 | } |
| 27 | 27 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param string $commandToken |
| 31 | 31 | * @return boolean |
| 32 | 32 | */ |
| 33 | - public function isCommand($commandToken){ |
|
| 33 | + public function isCommand($commandToken) { |
|
| 34 | 34 | return ($this->commandToken == $commandToken); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return string |
| 40 | 40 | */ |
| 41 | - public function getCommand(){ |
|
| 41 | + public function getCommand() { |
|
| 42 | 42 | return $this->commandToken; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @param string[] $values |
| 48 | 48 | * @return string[] |
| 49 | 49 | */ |
| 50 | - protected function parseArray($values){ |
|
| 50 | + protected function parseArray($values) { |
|
| 51 | 51 | $r = array(); |
| 52 | 52 | foreach ($values as $key => $value) { |
| 53 | 53 | $r[$key] = $this->parseString($value); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @param string $value |
| 61 | 61 | * @return string |
| 62 | 62 | */ |
| 63 | - protected function parseString($value){ |
|
| 63 | + protected function parseString($value) { |
|
| 64 | 64 | return htmlspecialchars($value, ENT_QUOTES, 'UTF-8'); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param string $value |
| 70 | 70 | * @return number |
| 71 | 71 | */ |
| 72 | - protected function parseInt($value){ |
|
| 72 | + protected function parseInt($value) { |
|
| 73 | 73 | return intval($this->parseString($value)); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | * @author Zilvinas Vaira |
| 8 | 8 | * |
| 9 | 9 | */ |
| 10 | -class PageElementNull implements PageElementInterface{ |
|
| 10 | +class PageElementNull implements PageElementInterface { |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @author Zilvinas Vaira |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -abstract class AbstractTextDialogBox extends AbstractDialogBox{ |
|
| 9 | +abstract class AbstractTextDialogBox extends AbstractDialogBox { |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * {@inheritDoc} |
| 33 | 33 | * @see \web\lib\admin\view\AbstractDialogBox::renderContent() |
| 34 | 34 | */ |
| 35 | - protected function renderContent(){ |
|
| 35 | + protected function renderContent() { |
|
| 36 | 36 | ?><p><?php echo $this->text; ?></p><?php |
| 37 | 37 | } |
| 38 | 38 | |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | * @author Zilvinas Vaira |
| 8 | 8 | * |
| 9 | 9 | */ |
| 10 | -class PageElementGroup implements PageElementInterface{ |
|
| 10 | +class PageElementGroup implements PageElementInterface { |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * List of contained elements. Default value is empty array. |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @author Zilvinas Vaira |
| 10 | 10 | * |
| 11 | 11 | */ |
| 12 | -class FileUploadForm extends AbstractForm{ |
|
| 12 | +class FileUploadForm extends AbstractForm { |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * |
@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | * {@inheritDoc} |
| 28 | 28 | * @see \web\lib\admin\view\PageElementInterface::render() |
| 29 | 29 | */ |
| 30 | - public function render(){ |
|
| 30 | + public function render() { |
|
| 31 | 31 | ?> |
| 32 | 32 | <div> |
| 33 | - <form enctype="multipart/form-data" method="post" action="<?php echo $this->action;?>" accept-charset="utf-8"> |
|
| 33 | + <form enctype="multipart/form-data" method="post" action="<?php echo $this->action; ?>" accept-charset="utf-8"> |
|
| 34 | 34 | <div class="<?php echo AddNewUserForm::ADDNEWUSER_CLASS; ?>"> |
| 35 | 35 | <?php $this->messageBox->render(); ?> |
| 36 | 36 | <p><?php echo $this->description; ?></p> |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @author Zilvinas Vaira |
| 10 | 10 | * |
| 11 | 11 | */ |
| 12 | -abstract class AbstractPage implements PageElementInterface{ |
|
| 12 | +abstract class AbstractPage implements PageElementInterface { |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * Stores reusable null page element. |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | /** |
| 36 | 36 | * Instantiates common null element. |
| 37 | 37 | */ |
| 38 | - public function __construct(){ |
|
| 38 | + public function __construct() { |
|
| 39 | 39 | $this->nullElement = new PageElementNull(); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -45,16 +45,16 @@ discard block |
||
| 45 | 45 | * @param string $name Section name. |
| 46 | 46 | * @param PageElementInterface $element Page element object. |
| 47 | 47 | */ |
| 48 | - public function append($name, $element){ |
|
| 49 | - if(isset($this->groups [$name])){ |
|
| 48 | + public function append($name, $element) { |
|
| 49 | + if (isset($this->groups [$name])) { |
|
| 50 | 50 | $group = $this->groups [$name]; |
| 51 | 51 | $group->addElement($element); |
| 52 | - }else if(isset($this->blocks[$name])){ |
|
| 52 | + } else if (isset($this->blocks[$name])) { |
|
| 53 | 53 | $group = new PageElementGroup(); |
| 54 | 54 | $group->addElement($this->blocks[$name]); |
| 55 | 55 | $this->blocks[$name] = $this->groups[$name] = $group; |
| 56 | 56 | $group->addElement($element); |
| 57 | - }else{ |
|
| 57 | + } else { |
|
| 58 | 58 | $this->assign($name, $element); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param string $name |
| 66 | 66 | * @param HtmlElementInterface $element |
| 67 | 67 | */ |
| 68 | - public function appendHtmlElement($name, $element){ |
|
| 68 | + public function appendHtmlElement($name, $element) { |
|
| 69 | 69 | $this->append($name, new PageElementAdapter($element)); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | * @param string $name Section name. |
| 76 | 76 | * @param PageElementInterface $element Page element object. |
| 77 | 77 | */ |
| 78 | - public function assign($name, $element){ |
|
| 78 | + public function assign($name, $element) { |
|
| 79 | 79 | $this->blocks [$name] = $element; |
| 80 | - if(isset($this->groups [$name])){ |
|
| 80 | + if (isset($this->groups [$name])) { |
|
| 81 | 81 | unset($this->groups[$name]); |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @param string $name |
| 89 | 89 | * @param HtmlElementInterface $element |
| 90 | 90 | */ |
| 91 | - public function assignHtmlElement($name, $element){ |
|
| 91 | + public function assignHtmlElement($name, $element) { |
|
| 92 | 92 | $this->assign($name, new PageElementAdapter($element)); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | * @param string $name Section name. |
| 99 | 99 | * @return PageElementInterface Page element or group of page elements. |
| 100 | 100 | */ |
| 101 | - public function fetch($name){ |
|
| 102 | - if(isset($this->blocks[$name])){ |
|
| 101 | + public function fetch($name) { |
|
| 102 | + if (isset($this->blocks[$name])) { |
|
| 103 | 103 | return $this->blocks[$name]; |
| 104 | - }else{ |
|
| 104 | + } else { |
|
| 105 | 105 | return $this->nullElement; |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | if(isset($this->groups [$name])){ |
| 50 | 50 | $group = $this->groups [$name]; |
| 51 | 51 | $group->addElement($element); |
| 52 | - }else if(isset($this->blocks[$name])){ |
|
| 52 | + } else if(isset($this->blocks[$name])){ |
|
| 53 | 53 | $group = new PageElementGroup(); |
| 54 | 54 | $group->addElement($this->blocks[$name]); |
| 55 | 55 | $this->blocks[$name] = $this->groups[$name] = $group; |
| 56 | 56 | $group->addElement($element); |
| 57 | - }else{ |
|
| 57 | + } else{ |
|
| 58 | 58 | $this->assign($name, $element); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | public function fetch($name){ |
| 102 | 102 | if(isset($this->blocks[$name])){ |
| 103 | 103 | return $this->blocks[$name]; |
| 104 | - }else{ |
|
| 104 | + } else{ |
|
| 105 | 105 | return $this->nullElement; |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @author Zilvinas Vaira |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -class Tag extends UnaryTag{ |
|
| 9 | +class Tag extends UnaryTag { |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | protected $text = ""; |
| 16 | 16 | |
| 17 | - public function addText($text){ |
|
| 17 | + public function addText($text) { |
|
| 18 | 18 | $this->text .= $text; |
| 19 | 19 | } |
| 20 | 20 | |
@@ -22,9 +22,9 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | * @return string |
| 24 | 24 | */ |
| 25 | - protected function composeInnerString(){ |
|
| 25 | + protected function composeInnerString() { |
|
| 26 | 26 | $innerString = ""; |
| 27 | - if(!empty($this->text)){ |
|
| 27 | + if (!empty($this->text)) { |
|
| 28 | 28 | $innerString = $this->text; |
| 29 | 29 | } |
| 30 | 30 | return $innerString; |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | * {@inheritDoc} |
| 36 | 36 | * @see UnaryTag::composeTagString() |
| 37 | 37 | */ |
| 38 | - protected function composeTagString($attributeString){ |
|
| 38 | + protected function composeTagString($attributeString) { |
|
| 39 | 39 | $tagString = ""; |
| 40 | 40 | $innerString = $this->composeInnerString(); |
| 41 | - if(!empty($innerString)){ |
|
| 42 | - $tagString = "\n".$this->tab."<" . $this->name . $attributeString . ">" . $innerString . "</" . $this->name . ">"; |
|
| 43 | - }else{ |
|
| 44 | - $tagString = "\n".$this->tab."<" . $this->name . $attributeString . "></" . $this->name . ">"; |
|
| 41 | + if (!empty($innerString)) { |
|
| 42 | + $tagString = "\n" . $this->tab . "<" . $this->name . $attributeString . ">" . $innerString . "</" . $this->name . ">"; |
|
| 43 | + } else { |
|
| 44 | + $tagString = "\n" . $this->tab . "<" . $this->name . $attributeString . "></" . $this->name . ">"; |
|
| 45 | 45 | } |
| 46 | 46 | return $tagString; |
| 47 | 47 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | $innerString = $this->composeInnerString(); |
| 41 | 41 | if(!empty($innerString)){ |
| 42 | 42 | $tagString = "\n".$this->tab."<" . $this->name . $attributeString . ">" . $innerString . "</" . $this->name . ">"; |
| 43 | - }else{ |
|
| 43 | + } else{ |
|
| 44 | 44 | $tagString = "\n".$this->tab."<" . $this->name . $attributeString . "></" . $this->name . ">"; |
| 45 | 45 | } |
| 46 | 46 | return $tagString; |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @author Zilvinas Vaira |
| 10 | 10 | * |
| 11 | 11 | */ |
| 12 | -class DefaultAjaxPage extends AbstractPage{ |
|
| 12 | +class DefaultAjaxPage extends AbstractPage { |
|
| 13 | 13 | |
| 14 | 14 | const SECTION_RESPONSE = 'response'; |
| 15 | 15 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * {@inheritDoc} |
| 27 | 27 | * @see \web\lib\admin\view\PageElementInterface::render() |
| 28 | 28 | */ |
| 29 | - public function render(){ |
|
| 29 | + public function render() { |
|
| 30 | 30 | $response = $this->fetch(self::SECTION_RESPONSE); |
| 31 | 31 | ?><response><?php $response->render(); ?></response><?php |
| 32 | 32 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @author Zilvinas Vaira |
| 11 | 11 | * |
| 12 | 12 | */ |
| 13 | -class DefaultHtmlPage extends AbstractPage{ |
|
| 13 | +class DefaultHtmlPage extends AbstractPage { |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Manage users base page type. |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | * @param string $url File source url (must be clean url without query parameters). |
| 66 | 66 | * @return string File source url with version query. |
| 67 | 67 | */ |
| 68 | - private function decorateVersion($url){ |
|
| 69 | - return $url.'?v='.$this->version; |
|
| 68 | + private function decorateVersion($url) { |
|
| 69 | + return $url . '?v=' . $this->version; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @param string $type |
| 76 | 76 | */ |
| 77 | - public function setType($type){ |
|
| 77 | + public function setType($type) { |
|
| 78 | 78 | $this->type = $type; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * |
| 84 | 84 | * @return string |
| 85 | 85 | */ |
| 86 | - public function getType(){ |
|
| 86 | + public function getType() { |
|
| 87 | 87 | return $this->type; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @param string $title Page title. |
| 94 | 94 | */ |
| 95 | - public function setTitle($title){ |
|
| 95 | + public function setTitle($title) { |
|
| 96 | 96 | $this->title = $title; |
| 97 | 97 | } |
| 98 | 98 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @return string |
| 103 | 103 | */ |
| 104 | - public function getTitle(){ |
|
| 104 | + public function getTitle() { |
|
| 105 | 105 | return $this->title; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * |
| 111 | 111 | * @param PageElementInterface $element Any page element. |
| 112 | 112 | */ |
| 113 | - public function appendPrelude($element){ |
|
| 113 | + public function appendPrelude($element) { |
|
| 114 | 114 | $this->append(self::SECTION_PRELUDE, $element); |
| 115 | 115 | } |
| 116 | 116 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | * |
| 120 | 120 | * @return PageElementInterface |
| 121 | 121 | */ |
| 122 | - public function fetchPrelude(){ |
|
| 122 | + public function fetchPrelude() { |
|
| 123 | 123 | return $this->fetch(self::SECTION_PRELUDE); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * |
| 129 | 129 | * @param PageElementInterface $element Any page element. |
| 130 | 130 | */ |
| 131 | - public function appendContent($element){ |
|
| 131 | + public function appendContent($element) { |
|
| 132 | 132 | $this->append(self::SECTION_CONTENT, $element); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * |
| 138 | 138 | * @return PageElementInterface |
| 139 | 139 | */ |
| 140 | - public function fetchContent(){ |
|
| 140 | + public function fetchContent() { |
|
| 141 | 141 | return $this->fetch(self::SECTION_CONTENT); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * |
| 147 | 147 | * @param string $url Path to a JavaScript file. |
| 148 | 148 | */ |
| 149 | - public function appendScript($url){ |
|
| 149 | + public function appendScript($url) { |
|
| 150 | 150 | $script = new Tag('script'); |
| 151 | 151 | $script->addAttribute('type', 'text/javascript'); |
| 152 | 152 | $script->addAttribute('src', $this->decorateVersion($url)); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * |
| 159 | 159 | * @return PageElementInterface |
| 160 | 160 | */ |
| 161 | - public function fetchScript(){ |
|
| 161 | + public function fetchScript() { |
|
| 162 | 162 | return $this->fetch(self::SECTION_SCRIPT); |
| 163 | 163 | } |
| 164 | 164 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * |
| 168 | 168 | * @param string $url Path to a CSS file. |
| 169 | 169 | */ |
| 170 | - public function appendCss($url){ |
|
| 170 | + public function appendCss($url) { |
|
| 171 | 171 | $css = new UnaryTag('link'); |
| 172 | 172 | $css->addAttribute('rel', 'stylesheet'); |
| 173 | 173 | $css->addAttribute('type', 'text/css'); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @return PageElementInterface |
| 182 | 182 | */ |
| 183 | - public function fetchCss(){ |
|
| 183 | + public function fetchCss() { |
|
| 184 | 184 | return $this->fetch(self::SECTION_CSS); |
| 185 | 185 | } |
| 186 | 186 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | * |
| 190 | 190 | * @param string[] $attributes Associative list of attributes for meta element. |
| 191 | 191 | */ |
| 192 | - public function appendMeta($attributes = array()){ |
|
| 192 | + public function appendMeta($attributes = array()) { |
|
| 193 | 193 | $meta = new Tag('meta'); |
| 194 | 194 | foreach ($attributes as $name => $value) { |
| 195 | 195 | $meta->addAttribute($name, $value); |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * |
| 203 | 203 | * @return PageElementInterface |
| 204 | 204 | */ |
| 205 | - public function fetchMeta(){ |
|
| 205 | + public function fetchMeta() { |
|
| 206 | 206 | return $this->fetch(self::SECTION_META); |
| 207 | 207 | } |
| 208 | 208 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * {@inheritDoc} |
| 212 | 212 | * @see \web\lib\admin\view\PageElementInterface::render() |
| 213 | 213 | */ |
| 214 | - public function render(){ |
|
| 214 | + public function render() { |
|
| 215 | 215 | $content = $this->fetch(self::SECTION_CONTENT); |
| 216 | 216 | $content->render(); |
| 217 | 217 | } |