@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $this->languages = array(); |
59 | 59 | |
60 | 60 | if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) |
61 | - return $this->languages; |
|
61 | + return $this->languages; |
|
62 | 62 | |
63 | 63 | //$basedir = CultureInfo::dataDir(); |
64 | 64 | //$ext = CultureInfo::fileExt(); |
@@ -66,18 +66,18 @@ discard block |
||
66 | 66 | |
67 | 67 | foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang) |
68 | 68 | { |
69 | - // Cut off any q-value that might come after a semi-colon |
|
70 | - if ($pos = strpos($lang, ';')) |
|
71 | - $lang = trim(substr($lang, 0, $pos)); |
|
69 | + // Cut off any q-value that might come after a semi-colon |
|
70 | + if ($pos = strpos($lang, ';')) |
|
71 | + $lang = trim(substr($lang, 0, $pos)); |
|
72 | 72 | |
73 | 73 | if (strstr($lang, '-')) |
74 | 74 | { |
75 | 75 | $codes = explode('-',$lang); |
76 | 76 | if($codes[0] == 'i') |
77 | 77 | { |
78 | - // Language not listed in ISO 639 that are not variants |
|
79 | - // of any listed language, which can be registerd with the |
|
80 | - // i-prefix, such as i-cherokee |
|
78 | + // Language not listed in ISO 639 that are not variants |
|
79 | + // of any listed language, which can be registerd with the |
|
80 | + // i-prefix, such as i-cherokee |
|
81 | 81 | if(count($codes)>1) |
82 | 82 | $lang = $codes[1]; |
83 | 83 | } |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | $lang .= '_'.strtoupper($codes[$i]); |
92 | 92 | } |
93 | 93 | } |
94 | - } |
|
94 | + } |
|
95 | 95 | |
96 | 96 | |
97 | 97 | |
98 | 98 | if($info->validCulture($lang)) |
99 | 99 | $this->languages[] = $lang; |
100 | - } |
|
100 | + } |
|
101 | 101 | |
102 | 102 | return $this->languages; |
103 | 103 | } |
@@ -108,20 +108,20 @@ discard block |
||
108 | 108 | */ |
109 | 109 | function getCharsets() |
110 | 110 | { |
111 | - if($this->charsets !== null) { |
|
111 | + if($this->charsets !== null) { |
|
112 | 112 | return $this->charsets; |
113 | 113 | } |
114 | 114 | |
115 | 115 | $this->charsets = array(); |
116 | 116 | |
117 | 117 | if (!isset($_SERVER['HTTP_ACCEPT_CHARSET'])) |
118 | - return $this->charsets; |
|
118 | + return $this->charsets; |
|
119 | 119 | |
120 | 120 | foreach (explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset) |
121 | 121 | { |
122 | - if (!empty($charset)) |
|
123 | - $this->charsets[] = preg_replace('/;.*/', '', $charset); |
|
124 | - } |
|
122 | + if (!empty($charset)) |
|
123 | + $this->charsets[] = preg_replace('/;.*/', '', $charset); |
|
124 | + } |
|
125 | 125 | |
126 | 126 | return $this->charsets; |
127 | 127 | } |
@@ -80,8 +80,7 @@ |
||
80 | 80 | // i-prefix, such as i-cherokee |
81 | 81 | if(count($codes)>1) |
82 | 82 | $lang = $codes[1]; |
83 | - } |
|
84 | - else |
|
83 | + } else |
|
85 | 84 | { |
86 | 85 | for($i = 0, $k = count($codes); $i<$k; ++$i) |
87 | 86 | { |
@@ -51,44 +51,44 @@ discard block |
||
51 | 51 | */ |
52 | 52 | function getLanguages() |
53 | 53 | { |
54 | - if($this->languages !== null) { |
|
54 | + if($this->languages!==null) { |
|
55 | 55 | return $this->languages; |
56 | 56 | } |
57 | 57 | |
58 | - $this->languages = array(); |
|
58 | + $this->languages=array(); |
|
59 | 59 | |
60 | - if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) |
|
60 | + if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) |
|
61 | 61 | return $this->languages; |
62 | 62 | |
63 | 63 | //$basedir = CultureInfo::dataDir(); |
64 | 64 | //$ext = CultureInfo::fileExt(); |
65 | - $info = new CultureInfo(); |
|
65 | + $info=new CultureInfo(); |
|
66 | 66 | |
67 | 67 | foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang) |
68 | 68 | { |
69 | 69 | // Cut off any q-value that might come after a semi-colon |
70 | - if ($pos = strpos($lang, ';')) |
|
71 | - $lang = trim(substr($lang, 0, $pos)); |
|
70 | + if($pos=strpos($lang, ';')) |
|
71 | + $lang=trim(substr($lang, 0, $pos)); |
|
72 | 72 | |
73 | - if (strstr($lang, '-')) |
|
73 | + if(strstr($lang, '-')) |
|
74 | 74 | { |
75 | - $codes = explode('-',$lang); |
|
76 | - if($codes[0] == 'i') |
|
75 | + $codes=explode('-', $lang); |
|
76 | + if($codes[0]=='i') |
|
77 | 77 | { |
78 | 78 | // Language not listed in ISO 639 that are not variants |
79 | 79 | // of any listed language, which can be registerd with the |
80 | 80 | // i-prefix, such as i-cherokee |
81 | - if(count($codes)>1) |
|
82 | - $lang = $codes[1]; |
|
81 | + if(count($codes) > 1) |
|
82 | + $lang=$codes[1]; |
|
83 | 83 | } |
84 | 84 | else |
85 | 85 | { |
86 | - for($i = 0, $k = count($codes); $i<$k; ++$i) |
|
86 | + for($i=0, $k=count($codes); $i < $k; ++$i) |
|
87 | 87 | { |
88 | - if($i == 0) |
|
89 | - $lang = strtolower($codes[0]); |
|
88 | + if($i==0) |
|
89 | + $lang=strtolower($codes[0]); |
|
90 | 90 | else |
91 | - $lang .= '_'.strtoupper($codes[$i]); |
|
91 | + $lang.='_'.strtoupper($codes[$i]); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | |
98 | 98 | if($info->validCulture($lang)) |
99 | - $this->languages[] = $lang; |
|
99 | + $this->languages[]=$lang; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | return $this->languages; |
@@ -108,19 +108,19 @@ discard block |
||
108 | 108 | */ |
109 | 109 | function getCharsets() |
110 | 110 | { |
111 | - if($this->charsets !== null) { |
|
111 | + if($this->charsets!==null) { |
|
112 | 112 | return $this->charsets; |
113 | 113 | } |
114 | 114 | |
115 | - $this->charsets = array(); |
|
115 | + $this->charsets=array(); |
|
116 | 116 | |
117 | - if (!isset($_SERVER['HTTP_ACCEPT_CHARSET'])) |
|
117 | + if(!isset($_SERVER['HTTP_ACCEPT_CHARSET'])) |
|
118 | 118 | return $this->charsets; |
119 | 119 | |
120 | - foreach (explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset) |
|
120 | + foreach(explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset) |
|
121 | 121 | { |
122 | - if (!empty($charset)) |
|
123 | - $this->charsets[] = preg_replace('/;.*/', '', $charset); |
|
122 | + if(!empty($charset)) |
|
123 | + $this->charsets[]=preg_replace('/;.*/', '', $charset); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | return $this->charsets; |
@@ -59,7 +59,7 @@ |
||
59 | 59 | |
60 | 60 | $tmp = $data; |
61 | 61 | foreach (explode(".", $field) as $f) |
62 | - $tmp = $tmp[$f]; |
|
62 | + $tmp = $tmp[$f]; |
|
63 | 63 | return $tmp; |
64 | 64 | } |
65 | 65 | else if(is_object($data)) |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @return mixed value at the specified field |
49 | 49 | * @throws TInvalidDataValueException if field or data is invalid |
50 | 50 | */ |
51 | - public static function getDataFieldValue($data,$field) |
|
51 | + public static function getDataFieldValue($data, $field) |
|
52 | 52 | { |
53 | 53 | try |
54 | 54 | { |
@@ -57,33 +57,33 @@ discard block |
||
57 | 57 | if(isset($data[$field])) |
58 | 58 | return $data[$field]; |
59 | 59 | |
60 | - $tmp = $data; |
|
61 | - foreach (explode(".", $field) as $f) |
|
62 | - $tmp = $tmp[$f]; |
|
60 | + $tmp=$data; |
|
61 | + foreach(explode(".", $field) as $f) |
|
62 | + $tmp=$tmp[$f]; |
|
63 | 63 | return $tmp; |
64 | 64 | } |
65 | 65 | else if(is_object($data)) |
66 | 66 | { |
67 | - if(strpos($field,'.')===false) // simple field |
|
67 | + if(strpos($field, '.')===false) // simple field |
|
68 | 68 | { |
69 | 69 | if(method_exists($data, 'get'.$field)) |
70 | - return call_user_func(array($data,'get'.$field)); |
|
70 | + return call_user_func(array($data, 'get'.$field)); |
|
71 | 71 | else |
72 | 72 | return $data->{$field}; |
73 | 73 | } |
74 | 74 | else // field in the format of xxx.yyy.zzz |
75 | 75 | { |
76 | 76 | $object=$data; |
77 | - foreach(explode('.',$field) as $f) |
|
78 | - $object = TDataFieldAccessor::getDataFieldValue($object, $f); |
|
77 | + foreach(explode('.', $field) as $f) |
|
78 | + $object=TDataFieldAccessor::getDataFieldValue($object, $f); |
|
79 | 79 | return $object; |
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
83 | 83 | catch(Exception $e) |
84 | 84 | { |
85 | - throw new TInvalidDataValueException('datafieldaccessor_datafield_invalid',$field,$e->getMessage()); |
|
85 | + throw new TInvalidDataValueException('datafieldaccessor_datafield_invalid', $field, $e->getMessage()); |
|
86 | 86 | } |
87 | - throw new TInvalidDataValueException('datafieldaccessor_data_invalid',$field); |
|
87 | + throw new TInvalidDataValueException('datafieldaccessor_data_invalid', $field); |
|
88 | 88 | } |
89 | 89 | } |
@@ -61,8 +61,7 @@ discard block |
||
61 | 61 | foreach (explode(".", $field) as $f) |
62 | 62 | $tmp = $tmp[$f]; |
63 | 63 | return $tmp; |
64 | - } |
|
65 | - else if(is_object($data)) |
|
64 | + } else if(is_object($data)) |
|
66 | 65 | { |
67 | 66 | if(strpos($field,'.')===false) // simple field |
68 | 67 | { |
@@ -70,8 +69,7 @@ discard block |
||
70 | 69 | return call_user_func(array($data,'get'.$field)); |
71 | 70 | else |
72 | 71 | return $data->{$field}; |
73 | - } |
|
74 | - else // field in the format of xxx.yyy.zzz |
|
72 | + } else // field in the format of xxx.yyy.zzz |
|
75 | 73 | { |
76 | 74 | $object=$data; |
77 | 75 | foreach(explode('.',$field) as $f) |
@@ -79,8 +77,7 @@ discard block |
||
79 | 77 | return $object; |
80 | 78 | } |
81 | 79 | } |
82 | - } |
|
83 | - catch(Exception $e) |
|
80 | + } catch(Exception $e) |
|
84 | 81 | { |
85 | 82 | throw new TInvalidDataValueException('datafieldaccessor_datafield_invalid',$field,$e->getMessage()); |
86 | 83 | } |
@@ -139,9 +139,9 @@ |
||
139 | 139 | $feed->init($feedConfig); |
140 | 140 | |
141 | 141 | $content=$feed->getFeedContent(); |
142 | - //$this->getResponse()->setContentType('application/rss+xml'); |
|
143 | - $this->getResponse()->setContentType($feed->getContentType()); |
|
144 | - $this->getResponse()->write($content); |
|
142 | + //$this->getResponse()->setContentType('application/rss+xml'); |
|
143 | + $this->getResponse()->setContentType($feed->getContentType()); |
|
144 | + $this->getResponse()->write($content); |
|
145 | 145 | } |
146 | 146 | else |
147 | 147 | throw new THttpException(404,'feedservice_feed_unknown',$id); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | if(is_array($config)) |
78 | 78 | { |
79 | 79 | foreach($config as $id => $feed) |
80 | - $this->_feeds[$id] = $feed; |
|
80 | + $this->_feeds[$id]=$feed; |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | else |
@@ -110,20 +110,20 @@ discard block |
||
110 | 110 | if(isset($this->_feeds[$id])) |
111 | 111 | { |
112 | 112 | $feedConfig=$this->_feeds[$id]; |
113 | - $properties = array(); |
|
114 | - $feed = null; |
|
113 | + $properties=array(); |
|
114 | + $feed=null; |
|
115 | 115 | if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP) |
116 | 116 | { |
117 | 117 | if(isset($feedConfig['class'])) |
118 | 118 | { |
119 | 119 | $feed=Prado::createComponent($feedConfig['class']); |
120 | 120 | if($service instanceof IFeedContentProvider) |
121 | - $properties=isset($feedConfig['properties'])?$feedConfig['properties']:array(); |
|
121 | + $properties=isset($feedConfig['properties']) ? $feedConfig['properties'] : array(); |
|
122 | 122 | else |
123 | - throw new TConfigurationException('jsonservice_response_type_invalid',$id); |
|
123 | + throw new TConfigurationException('jsonservice_response_type_invalid', $id); |
|
124 | 124 | } |
125 | 125 | else |
126 | - throw new TConfigurationException('jsonservice_class_required',$id); |
|
126 | + throw new TConfigurationException('jsonservice_class_required', $id); |
|
127 | 127 | } |
128 | 128 | else |
129 | 129 | { |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | { |
133 | 133 | $feed=Prado::createComponent($class); |
134 | 134 | if(!($feed instanceof IFeedContentProvider)) |
135 | - throw new TConfigurationException('feedservice_feedtype_invalid',$id); |
|
135 | + throw new TConfigurationException('feedservice_feedtype_invalid', $id); |
|
136 | 136 | } |
137 | 137 | else |
138 | - throw new TConfigurationException('feedservice_class_required',$id); |
|
138 | + throw new TConfigurationException('feedservice_class_required', $id); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | // init feed properties |
142 | 142 | foreach($properties as $name=>$value) |
143 | - $feed->setSubproperty($name,$value); |
|
143 | + $feed->setSubproperty($name, $value); |
|
144 | 144 | $feed->init($feedConfig); |
145 | 145 | |
146 | 146 | $content=$feed->getFeedContent(); |
@@ -149,6 +149,6 @@ discard block |
||
149 | 149 | $this->getResponse()->write($content); |
150 | 150 | } |
151 | 151 | else |
152 | - throw new THttpException(404,'feedservice_feed_unknown',$id); |
|
152 | + throw new THttpException(404, 'feedservice_feed_unknown', $id); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | \ No newline at end of file |
@@ -79,8 +79,7 @@ discard block |
||
79 | 79 | foreach($config as $id => $feed) |
80 | 80 | $this->_feeds[$id] = $feed; |
81 | 81 | } |
82 | - } |
|
83 | - else |
|
82 | + } else |
|
84 | 83 | { |
85 | 84 | foreach($config->getElementsByTagName('feed') as $feed) |
86 | 85 | { |
@@ -121,11 +120,9 @@ discard block |
||
121 | 120 | $properties=isset($feedConfig['properties'])?$feedConfig['properties']:array(); |
122 | 121 | else |
123 | 122 | throw new TConfigurationException('jsonservice_response_type_invalid',$id); |
124 | - } |
|
125 | - else |
|
123 | + } else |
|
126 | 124 | throw new TConfigurationException('jsonservice_class_required',$id); |
127 | - } |
|
128 | - else |
|
125 | + } else |
|
129 | 126 | { |
130 | 127 | $properties=$feedConfig->getAttributes(); |
131 | 128 | if(($class=$properties->remove('class'))!==null) |
@@ -133,8 +130,7 @@ discard block |
||
133 | 130 | $feed=Prado::createComponent($class); |
134 | 131 | if(!($feed instanceof IFeedContentProvider)) |
135 | 132 | throw new TConfigurationException('feedservice_feedtype_invalid',$id); |
136 | - } |
|
137 | - else |
|
133 | + } else |
|
138 | 134 | throw new TConfigurationException('feedservice_class_required',$id); |
139 | 135 | } |
140 | 136 | |
@@ -147,8 +143,7 @@ discard block |
||
147 | 143 | //$this->getResponse()->setContentType('application/rss+xml'); |
148 | 144 | $this->getResponse()->setContentType($feed->getContentType()); |
149 | 145 | $this->getResponse()->write($content); |
150 | - } |
|
151 | - else |
|
146 | + } else |
|
152 | 147 | throw new THttpException(404,'feedservice_feed_unknown',$id); |
153 | 148 | } |
154 | 149 | } |
155 | 150 | \ No newline at end of file |
@@ -144,15 +144,15 @@ |
||
144 | 144 | */ |
145 | 145 | public function getKeyPrefix() |
146 | 146 | { |
147 | - return $this->_prefix; |
|
147 | + return $this->_prefix; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
151 | - * @param string prefix of cache variable name to avoid conflict with other cache data |
|
152 | - */ |
|
151 | + * @param string prefix of cache variable name to avoid conflict with other cache data |
|
152 | + */ |
|
153 | 153 | public function setKeyPrefix($value) |
154 | 154 | { |
155 | - $this->_prefix=$value; |
|
155 | + $this->_prefix=$value; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | if($cache===null || !($cache instanceof ICache)) |
111 | 111 | { |
112 | 112 | if($this->_cacheModuleID!=='') |
113 | - throw new TConfigurationException('cachepagestatepersister_cachemoduleid_invalid',$this->_cacheModuleID); |
|
113 | + throw new TConfigurationException('cachepagestatepersister_cachemoduleid_invalid', $this->_cacheModuleID); |
|
114 | 114 | else |
115 | 115 | throw new TConfigurationException('cachepagestatepersister_cache_required'); |
116 | 116 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function setCacheTimeout($value) |
135 | 135 | { |
136 | - if(($value=TPropertyValue::ensureInteger($value))>=0) |
|
136 | + if(($value=TPropertyValue::ensureInteger($value)) >= 0) |
|
137 | 137 | $this->_timeout=$value; |
138 | 138 | else |
139 | 139 | throw new TInvalidDataValueException('cachepagestatepersister_timeout_invalid'); |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function save($data) |
175 | 175 | { |
176 | - $timestamp=(string)microtime(true); |
|
176 | + $timestamp=(string) microtime(true); |
|
177 | 177 | $key=$this->calculateKey($timestamp); |
178 | - $this->getCache()->add($key,$data,$this->_timeout); |
|
179 | - $this->_page->setClientState(TPageStateFormatter::serialize($this->_page,$timestamp)); |
|
178 | + $this->getCache()->add($key, $data, $this->_timeout); |
|
179 | + $this->_page->setClientState(TPageStateFormatter::serialize($this->_page, $timestamp)); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function load() |
188 | 188 | { |
189 | - if(($timestamp=TPageStateFormatter::unserialize($this->_page,$this->_page->getRequestClientState()))!==null) |
|
189 | + if(($timestamp=TPageStateFormatter::unserialize($this->_page, $this->_page->getRequestClientState()))!==null) |
|
190 | 190 | { |
191 | 191 | $key=$this->calculateKey($timestamp); |
192 | 192 | if(($data=$this->getCache()->get($key))!==false) |
193 | 193 | return $data; |
194 | 194 | } |
195 | - throw new THttpException(400,'cachepagestatepersister_pagestate_corrupted'); |
|
195 | + throw new THttpException(400, 'cachepagestatepersister_pagestate_corrupted'); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | /** |
65 | 65 | * Sets the horizontal alignment of the contents within the table item. |
66 | - * Valid values include 'NotSet', 'Justify', 'Left', 'Right', 'Center' |
|
66 | + * Valid values include 'NotSet', 'Justify', 'Left', 'Right', 'Center' |
|
67 | 67 | * @param string the horizontal alignment |
68 | 68 | */ |
69 | 69 | public function setHorizontalAlign($value) |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Sets the vertical alignment of the contents within the table item. |
87 | - * Valid values include 'NotSet','Top','Bottom','Middle' |
|
87 | + * Valid values include 'NotSet','Top','Bottom','Middle' |
|
88 | 88 | * @param string the horizontal alignment |
89 | 89 | */ |
90 | 90 | public function setVerticalAlign($value) |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function getText() |
153 | 153 | { |
154 | - return $this->getViewState('Text',''); |
|
154 | + return $this->getViewState('Text', ''); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function setText($value) |
163 | 163 | { |
164 | - $this->setViewState('Text',$value,''); |
|
164 | + $this->setViewState('Text', $value, ''); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | protected function addAttributesToRender($writer) |
198 | 198 | { |
199 | 199 | parent::addAttributesToRender($writer); |
200 | - if(($colspan=$this->getColumnSpan())>0) |
|
201 | - $writer->addAttribute('colspan',"$colspan"); |
|
202 | - if(($rowspan=$this->getRowSpan())>0) |
|
203 | - $writer->addAttribute('rowspan',"$rowspan"); |
|
200 | + if(($colspan=$this->getColumnSpan()) > 0) |
|
201 | + $writer->addAttribute('colspan', "$colspan"); |
|
202 | + if(($rowspan=$this->getRowSpan()) > 0) |
|
203 | + $writer->addAttribute('rowspan', "$rowspan"); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -180,24 +180,24 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
183 | - * @return string URL for the CSS file including all relevant CSS class definitions. Defaults to ''. |
|
184 | - */ |
|
183 | + * @return string URL for the CSS file including all relevant CSS class definitions. Defaults to ''. |
|
184 | + */ |
|
185 | 185 | public function getCssUrl() |
186 | 186 | { |
187 | 187 | return $this->getViewState('CssUrl','default'); |
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
191 | - * @param string URL for the CSS file including all relevant CSS class definitions. |
|
192 | - */ |
|
191 | + * @param string URL for the CSS file including all relevant CSS class definitions. |
|
192 | + */ |
|
193 | 193 | public function setCssUrl($value) |
194 | 194 | { |
195 | 195 | $this->setViewState('CssUrl',TPropertyValue::ensureString($value),''); |
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
199 | - * @return string CSS class for the whole accordion control div. |
|
200 | - */ |
|
199 | + * @return string CSS class for the whole accordion control div. |
|
200 | + */ |
|
201 | 201 | public function getCssClass() |
202 | 202 | { |
203 | 203 | $cssClass=parent::getCssClass(); |
@@ -205,32 +205,32 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
208 | - * @return string CSS class for the currently displayed view div. Defaults to 'accordion-view'. |
|
209 | - */ |
|
208 | + * @return string CSS class for the currently displayed view div. Defaults to 'accordion-view'. |
|
209 | + */ |
|
210 | 210 | public function getViewCssClass() |
211 | 211 | { |
212 | 212 | return $this->getViewStyle()->getCssClass(); |
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
216 | - * @param string CSS class for the currently displayed view div. |
|
217 | - */ |
|
216 | + * @param string CSS class for the currently displayed view div. |
|
217 | + */ |
|
218 | 218 | public function setViewCssClass($value) |
219 | 219 | { |
220 | 220 | $this->getViewStyle()->setCssClass($value); |
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
224 | - * @return string CSS class for the currently displayed view div. Defaults to 'accordion-view'. |
|
225 | - */ |
|
224 | + * @return string CSS class for the currently displayed view div. Defaults to 'accordion-view'. |
|
225 | + */ |
|
226 | 226 | public function getAnimationDuration() |
227 | 227 | { |
228 | 228 | return $this->getViewState('AnimationDuration','1'); |
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
232 | - * @param string CSS class for the currently displayed view div. |
|
233 | - */ |
|
232 | + * @param string CSS class for the currently displayed view div. |
|
233 | + */ |
|
234 | 234 | public function setAnimationDuration($value) |
235 | 235 | { |
236 | 236 | $this->setViewState('AnimationDuration',$value); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function getActiveViewIndex() |
102 | 102 | { |
103 | - return $this->getViewState('ActiveViewIndex',0); |
|
103 | + return $this->getViewState('ActiveViewIndex', 0); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function setActiveViewIndex($value) |
111 | 111 | { |
112 | - $this->setViewState('ActiveViewIndex',TPropertyValue::ensureInteger($value),0); |
|
112 | + $this->setViewState('ActiveViewIndex', TPropertyValue::ensureInteger($value), 0); |
|
113 | 113 | $this->setActiveViewID(''); |
114 | 114 | } |
115 | 115 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function getActiveViewID() |
123 | 123 | { |
124 | - return $this->getViewState('ActiveViewID',''); |
|
124 | + return $this->getViewState('ActiveViewID', ''); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function setActiveViewID($value) |
131 | 131 | { |
132 | - $this->setViewState('ActiveViewID',$value,''); |
|
132 | + $this->setViewState('ActiveViewID', $value, ''); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -145,17 +145,17 @@ discard block |
||
145 | 145 | $views=$this->getViews(); |
146 | 146 | if(($id=$this->getActiveViewID())!=='') |
147 | 147 | { |
148 | - if(($index=$views->findIndexByID($id))>=0) |
|
148 | + if(($index=$views->findIndexByID($id)) >= 0) |
|
149 | 149 | $activeView=$views->itemAt($index); |
150 | 150 | else |
151 | - throw new TInvalidDataValueException('accordion_activeviewid_invalid',$id); |
|
151 | + throw new TInvalidDataValueException('accordion_activeviewid_invalid', $id); |
|
152 | 152 | } |
153 | - else if(($index=$this->getActiveViewIndex())>=0) |
|
153 | + else if(($index=$this->getActiveViewIndex()) >= 0) |
|
154 | 154 | { |
155 | - if($index<$views->getCount()) |
|
155 | + if($index < $views->getCount()) |
|
156 | 156 | $activeView=$views->itemAt($index); |
157 | 157 | else |
158 | - throw new TInvalidDataValueException('accordion_activeviewindex_invalid',$index); |
|
158 | + throw new TInvalidDataValueException('accordion_activeviewindex_invalid', $index); |
|
159 | 159 | } |
160 | 160 | else |
161 | 161 | { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function setActiveView($view) |
181 | 181 | { |
182 | - if($this->getViews()->indexOf($view)>=0) |
|
182 | + if($this->getViews()->indexOf($view) >= 0) |
|
183 | 183 | $this->activateView($view); |
184 | 184 | else |
185 | 185 | throw new TInvalidOperationException('accordion_view_inexistent'); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function getCssUrl() |
192 | 192 | { |
193 | - return $this->getViewState('CssUrl','default'); |
|
193 | + return $this->getViewState('CssUrl', 'default'); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function setCssUrl($value) |
200 | 200 | { |
201 | - $this->setViewState('CssUrl',TPropertyValue::ensureString($value),''); |
|
201 | + $this->setViewState('CssUrl', TPropertyValue::ensureString($value), ''); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | public function getCssClass() |
208 | 208 | { |
209 | 209 | $cssClass=parent::getCssClass(); |
210 | - return $cssClass===''?'accordion':$cssClass; |
|
210 | + return $cssClass==='' ? 'accordion' : $cssClass; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public function getAnimationDuration() |
233 | 233 | { |
234 | - return $this->getViewState('AnimationDuration','1'); |
|
234 | + return $this->getViewState('AnimationDuration', '1'); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function setAnimationDuration($value) |
241 | 241 | { |
242 | - $this->setViewState('AnimationDuration',$value); |
|
242 | + $this->setViewState('AnimationDuration', $value); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function getViewStyle() |
249 | 249 | { |
250 | - if(($style=$this->getViewState('ViewStyle',null))===null) |
|
250 | + if(($style=$this->getViewState('ViewStyle', null))===null) |
|
251 | 251 | { |
252 | 252 | $style=new TStyle; |
253 | 253 | $style->setCssClass('accordion-view'); |
254 | - $this->setViewState('ViewStyle',$style,null); |
|
254 | + $this->setViewState('ViewStyle', $style, null); |
|
255 | 255 | } |
256 | 256 | return $style; |
257 | 257 | } |
@@ -277,11 +277,11 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public function getHeaderStyle() |
279 | 279 | { |
280 | - if(($style=$this->getViewState('HeaderStyle',null))===null) |
|
280 | + if(($style=$this->getViewState('HeaderStyle', null))===null) |
|
281 | 281 | { |
282 | 282 | $style=new TStyle; |
283 | 283 | $style->setCssClass('accordion-header'); |
284 | - $this->setViewState('HeaderStyle',$style,null); |
|
284 | + $this->setViewState('HeaderStyle', $style, null); |
|
285 | 285 | } |
286 | 286 | return $style; |
287 | 287 | } |
@@ -307,11 +307,11 @@ discard block |
||
307 | 307 | */ |
308 | 308 | public function getActiveHeaderStyle() |
309 | 309 | { |
310 | - if(($style=$this->getViewState('ActiveHeaderStyle',null))===null) |
|
310 | + if(($style=$this->getViewState('ActiveHeaderStyle', null))===null) |
|
311 | 311 | { |
312 | 312 | $style=new TStyle; |
313 | 313 | $style->setCssClass('accordion-header-active'); |
314 | - $this->setViewState('ActiveHeaderStyle',$style,null); |
|
314 | + $this->setViewState('ActiveHeaderStyle', $style, null); |
|
315 | 315 | } |
316 | 316 | return $style; |
317 | 317 | } |
@@ -361,11 +361,11 @@ discard block |
||
361 | 361 | * @param array the input data collection |
362 | 362 | * @return boolean whether the data of the control has been changed |
363 | 363 | */ |
364 | - public function loadPostData($key,$values) |
|
364 | + public function loadPostData($key, $values) |
|
365 | 365 | { |
366 | 366 | if(($index=$values[$this->getClientID().'_1'])!==null) |
367 | 367 | { |
368 | - $index=(int)$index; |
|
368 | + $index=(int) $index; |
|
369 | 369 | $currentIndex=$this->getActiveViewIndex(); |
370 | 370 | if($currentIndex!==$index) |
371 | 371 | { |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | */ |
406 | 406 | protected function addAttributesToRender($writer) |
407 | 407 | { |
408 | - $writer->addAttribute('id',$this->getClientID()); |
|
408 | + $writer->addAttribute('id', $this->getClientID()); |
|
409 | 409 | $this->setCssClass($this->getCssClass()); |
410 | 410 | parent::addAttributesToRender($writer); |
411 | 411 | } |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | public function onPreRender($param) |
419 | 419 | { |
420 | 420 | parent::onPreRender($param); |
421 | - $this->getActiveView(); // determine the active view |
|
421 | + $this->getActiveView(); // determine the active view |
|
422 | 422 | $this->registerStyleSheet(); |
423 | 423 | } |
424 | 424 | |
@@ -429,17 +429,17 @@ discard block |
||
429 | 429 | */ |
430 | 430 | protected function registerStyleSheet() |
431 | 431 | { |
432 | - $url = $this->getCssUrl(); |
|
432 | + $url=$this->getCssUrl(); |
|
433 | 433 | |
434 | - if($url === '') { |
|
434 | + if($url==='') { |
|
435 | 435 | return; |
436 | 436 | } |
437 | 437 | |
438 | - if($url === 'default') { |
|
439 | - $url = $this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'accordion.css'); |
|
438 | + if($url==='default') { |
|
439 | + $url=$this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'accordion.css'); |
|
440 | 440 | } |
441 | 441 | |
442 | - if($url !== '') { |
|
442 | + if($url!=='') { |
|
443 | 443 | $this->getPage()->getClientScript()->registerStyleSheetFile($url, $url); |
444 | 444 | } |
445 | 445 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $code="new $className($options);"; |
459 | 459 | $cs->registerEndScript("prado:$id", $code); |
460 | 460 | // ensure an item is always active and visible |
461 | - $index = $this->getActiveViewIndex(); |
|
461 | + $index=$this->getActiveViewIndex(); |
|
462 | 462 | if(!$this->getViews()->itemAt($index)->Visible) |
463 | 463 | $index=0; |
464 | 464 | $cs->registerHiddenField($id.'_1', $index); |
@@ -481,17 +481,17 @@ discard block |
||
481 | 481 | */ |
482 | 482 | protected function getClientOptions() |
483 | 483 | { |
484 | - $options['ID'] = $this->getClientID(); |
|
485 | - $options['ActiveHeaderCssClass'] = $this->getActiveHeaderCssClass(); |
|
486 | - $options['HeaderCssClass'] = $this->getHeaderCssClass(); |
|
487 | - $options['Duration'] = $this->getAnimationDuration(); |
|
484 | + $options['ID']=$this->getClientID(); |
|
485 | + $options['ActiveHeaderCssClass']=$this->getActiveHeaderCssClass(); |
|
486 | + $options['HeaderCssClass']=$this->getHeaderCssClass(); |
|
487 | + $options['Duration']=$this->getAnimationDuration(); |
|
488 | 488 | |
489 | - if (($viewheight = $this->getViewHeight())>0) |
|
490 | - $options['maxHeight'] = $viewheight; |
|
491 | - $views = array(); |
|
489 | + if(($viewheight=$this->getViewHeight()) > 0) |
|
490 | + $options['maxHeight']=$viewheight; |
|
491 | + $views=array(); |
|
492 | 492 | foreach($this->getViews() as $view) |
493 | - $views[$view->getClientID()] = $view->getVisible() ? '1': '0'; |
|
494 | - $options['Views'] = $views; |
|
493 | + $views[$view->getClientID()]=$view->getVisible() ? '1' : '0'; |
|
494 | + $options['Views']=$views; |
|
495 | 495 | |
496 | 496 | return $options; |
497 | 497 | } |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | public function renderContents($writer) |
527 | 527 | { |
528 | 528 | $views=$this->getViews(); |
529 | - if($views->getCount()>0) |
|
529 | + if($views->getCount() > 0) |
|
530 | 530 | { |
531 | 531 | $writer->writeLine(); |
532 | 532 | foreach($views as $view) |
@@ -149,15 +149,13 @@ discard block |
||
149 | 149 | $activeView=$views->itemAt($index); |
150 | 150 | else |
151 | 151 | throw new TInvalidDataValueException('accordion_activeviewid_invalid',$id); |
152 | - } |
|
153 | - else if(($index=$this->getActiveViewIndex())>=0) |
|
152 | + } else if(($index=$this->getActiveViewIndex())>=0) |
|
154 | 153 | { |
155 | 154 | if($index<$views->getCount()) |
156 | 155 | $activeView=$views->itemAt($index); |
157 | 156 | else |
158 | 157 | throw new TInvalidDataValueException('accordion_activeviewindex_invalid',$index); |
159 | - } |
|
160 | - else |
|
158 | + } else |
|
161 | 159 | { |
162 | 160 | foreach($views as $index=>$view) |
163 | 161 | { |
@@ -348,8 +346,7 @@ discard block |
||
348 | 346 | $this->setActiveViewIndex($index); |
349 | 347 | $this->setActiveViewID($view->getID(false)); |
350 | 348 | $view->setActive(true); |
351 | - } |
|
352 | - else |
|
349 | + } else |
|
353 | 350 | $v->setActive(false); |
354 | 351 | } |
355 | 352 | } |
@@ -140,13 +140,13 @@ |
||
140 | 140 | */ |
141 | 141 | public function getIsValid() |
142 | 142 | { |
143 | - return $this->_isValid; |
|
143 | + return $this->_isValid; |
|
144 | 144 | } |
145 | 145 | /** |
146 | 146 | * @param bool wether this control is valid. |
147 | 147 | */ |
148 | 148 | public function setIsValid($value) |
149 | 149 | { |
150 | - $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
150 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
151 | 151 | } |
152 | 152 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | protected function addAttributesToRender($writer) |
54 | 54 | { |
55 | - $writer->addAttribute('name',$this->getUniqueID()); |
|
55 | + $writer->addAttribute('name', $this->getUniqueID()); |
|
56 | 56 | parent::addAttributesToRender($writer); |
57 | 57 | } |
58 | 58 | |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | * @param array the input data collection |
74 | 74 | * @return boolean whether the data of the component has been changed |
75 | 75 | */ |
76 | - public function loadPostData($key,$values) |
|
76 | + public function loadPostData($key, $values) |
|
77 | 77 | { |
78 | 78 | if(!$this->getEnabled(true)) |
79 | 79 | return false; |
80 | 80 | $this->ensureDataBound(); |
81 | - $selection=isset($values[$key])?$values[$key]:null; |
|
81 | + $selection=isset($values[$key]) ? $values[$key] : null; |
|
82 | 82 | if($selection!==null) |
83 | 83 | { |
84 | - $index=$this->getItems()->findIndexByValue($selection,false); |
|
84 | + $index=$this->getItems()->findIndexByValue($selection, false); |
|
85 | 85 | if($this->getSelectedIndex()!==$index) |
86 | 86 | { |
87 | 87 | $this->setSelectedIndex($index); |
@@ -125,7 +125,7 @@ |
||
125 | 125 | /** |
126 | 126 | * Returns the value to be validated. |
127 | 127 | * This methid is required by \Prado\Web\UI\IValidatable interface. |
128 | - * @return mixed the value of the property to be validated. |
|
128 | + * @return string the value of the property to be validated. |
|
129 | 129 | */ |
130 | 130 | public function getValidationPropertyValue() |
131 | 131 | { |
@@ -46,50 +46,50 @@ discard block |
||
46 | 46 | * @throws TConfigurationException If XSL extension is not available |
47 | 47 | */ |
48 | 48 | public function __construct() { |
49 | - if(!class_exists('XSLTProcessor', false)) { |
|
50 | - throw new TConfigurationException('xmltransform_xslextension_required'); |
|
51 | - } |
|
49 | + if(!class_exists('XSLTProcessor', false)) { |
|
50 | + throw new TConfigurationException('xmltransform_xslextension_required'); |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
55 | 55 | * @return string The path to the XML style sheet. |
56 | 56 | */ |
57 | 57 | public function getTransformPath() { |
58 | - return $this->getViewState('TransformPath', ''); |
|
58 | + return $this->getViewState('TransformPath', ''); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @param string The path to the XML style sheet. It must be in namespace format. |
63 | 63 | */ |
64 | 64 | public function setTransformPath($value) { |
65 | - if(!is_file($value)) { |
|
66 | - $value = Prado::getPathOfNamespace($value, self::EXT_XSL_FILE); |
|
67 | - if($value === null) { |
|
65 | + if(!is_file($value)) { |
|
66 | + $value = Prado::getPathOfNamespace($value, self::EXT_XSL_FILE); |
|
67 | + if($value === null) { |
|
68 | 68 | throw new TInvalidDataValueException('xmltransform_transformpath_invalid', $value); |
69 | - } |
|
70 | - } |
|
71 | - $this->setViewState('TransformPath', $value, ''); |
|
69 | + } |
|
70 | + } |
|
71 | + $this->setViewState('TransformPath', $value, ''); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
75 | 75 | * @return string XML style sheet as string |
76 | 76 | */ |
77 | 77 | public function getTransformContent() { |
78 | - return $this->getViewState('TransformContent', ''); |
|
78 | + return $this->getViewState('TransformContent', ''); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
82 | 82 | * @param string $value XML style sheet as string |
83 | 83 | */ |
84 | 84 | public function setTransformContent($value) { |
85 | - $this->setViewState('TransformContent', $value, ''); |
|
85 | + $this->setViewState('TransformContent', $value, ''); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | 89 | * @return string The path to the XML document. It must be in namespace format. |
90 | 90 | */ |
91 | 91 | public function getDocumentPath() { |
92 | - return $this->getViewState('DocumentPath', ''); |
|
92 | + return $this->getViewState('DocumentPath', ''); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -97,27 +97,27 @@ discard block |
||
97 | 97 | * @throws TInvalidDataValueException |
98 | 98 | */ |
99 | 99 | public function setDocumentPath($value) { |
100 | - if(!is_file($value)) { |
|
101 | - $value = Prado::getPathOfNamespace($value, self::EXT_XML_FILE); |
|
102 | - if($value === null) { |
|
100 | + if(!is_file($value)) { |
|
101 | + $value = Prado::getPathOfNamespace($value, self::EXT_XML_FILE); |
|
102 | + if($value === null) { |
|
103 | 103 | throw new TInvalidDataValueException('xmltransform_documentpath_invalid', $value); |
104 | - } |
|
105 | - } |
|
106 | - $this->setViewState('DocumentPath', $value, ''); |
|
104 | + } |
|
105 | + } |
|
106 | + $this->setViewState('DocumentPath', $value, ''); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
110 | 110 | * @return string XML data |
111 | 111 | */ |
112 | 112 | public function getDocumentContent() { |
113 | - return $this->getViewState('DocumentContent', ''); |
|
113 | + return $this->getViewState('DocumentContent', ''); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
117 | 117 | * @param string $value XML data. If not empty, it takes precedence over {@link setDocumentPath DocumentPath}. |
118 | 118 | */ |
119 | 119 | public function setDocumentContent($value) { |
120 | - $this->setViewState('DocumentContent', $value, ''); |
|
120 | + $this->setViewState('DocumentContent', $value, ''); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -125,41 +125,41 @@ discard block |
||
125 | 125 | * @return TAttributeCollection the list of custom parameters |
126 | 126 | */ |
127 | 127 | public function getParameters() { |
128 | - if($params = $this->getViewState('Parameters',null)) { |
|
129 | - return $params; |
|
130 | - } else { |
|
131 | - $params = new TAttributeCollection(); |
|
132 | - $this->setViewState('Parameters', $params, null); |
|
133 | - return $params; |
|
134 | - } |
|
128 | + if($params = $this->getViewState('Parameters',null)) { |
|
129 | + return $params; |
|
130 | + } else { |
|
131 | + $params = new TAttributeCollection(); |
|
132 | + $this->setViewState('Parameters', $params, null); |
|
133 | + return $params; |
|
134 | + } |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | private function getTransformXmlDocument() { |
138 | - if(($content = $this->getTransformContent()) !== '') { |
|
139 | - $document = new DOMDocument(); |
|
140 | - $document->loadXML($content); |
|
141 | - return $document; |
|
142 | - } else if(($path = $this->getTransformPath()) !== '') { |
|
143 | - $document = new DOMDocument(); |
|
144 | - $document->load($path); |
|
145 | - return $document; |
|
146 | - } else { |
|
147 | - throw new TConfigurationException('xmltransform_transform_required'); |
|
148 | - } |
|
138 | + if(($content = $this->getTransformContent()) !== '') { |
|
139 | + $document = new DOMDocument(); |
|
140 | + $document->loadXML($content); |
|
141 | + return $document; |
|
142 | + } else if(($path = $this->getTransformPath()) !== '') { |
|
143 | + $document = new DOMDocument(); |
|
144 | + $document->load($path); |
|
145 | + return $document; |
|
146 | + } else { |
|
147 | + throw new TConfigurationException('xmltransform_transform_required'); |
|
148 | + } |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | private function getSourceXmlDocument() { |
152 | - if(($content = $this->getDocumentContent()) !== '') { |
|
153 | - $document = new DOMDocument(); |
|
154 | - $document->loadXML($content); |
|
155 | - return $document; |
|
156 | - } else if(($path = $this->getDocumentPath()) !== '') { |
|
157 | - $document = new DOMDocument(); |
|
158 | - $document->load($path); |
|
159 | - return $document; |
|
160 | - } else { |
|
161 | - return null; |
|
162 | - } |
|
152 | + if(($content = $this->getDocumentContent()) !== '') { |
|
153 | + $document = new DOMDocument(); |
|
154 | + $document->loadXML($content); |
|
155 | + return $document; |
|
156 | + } else if(($path = $this->getDocumentPath()) !== '') { |
|
157 | + $document = new DOMDocument(); |
|
158 | + $document->load($path); |
|
159 | + return $document; |
|
160 | + } else { |
|
161 | + return null; |
|
162 | + } |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -167,27 +167,27 @@ discard block |
||
167 | 167 | * @param THtmlWriter The writer used for the rendering purpose |
168 | 168 | */ |
169 | 169 | public function render($writer) { |
170 | - if(($document=$this->getSourceXmlDocument()) === null) { |
|
170 | + if(($document=$this->getSourceXmlDocument()) === null) { |
|
171 | 171 | $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
172 | 172 | parent::render($htmlWriter); |
173 | - $document = new DOMDocument(); |
|
174 | - $document->loadXML($htmlWriter->flush()); |
|
175 | - } |
|
176 | - $stylesheet = $this->getTransformXmlDocument(); |
|
177 | - |
|
178 | - // Perform XSL transformation |
|
179 | - $xslt = new XSLTProcessor(); |
|
180 | - $xslt->importStyleSheet($stylesheet); |
|
181 | - |
|
182 | - // Check for parameters |
|
183 | - $parameters = $this->getParameters(); |
|
184 | - foreach($parameters as $name => $value) { |
|
185 | - $xslt->setParameter('', $name, $value); |
|
186 | - } |
|
187 | - $output = $xslt->transformToXML($document); |
|
188 | - |
|
189 | - // Write output |
|
190 | - $writer->write($output); |
|
173 | + $document = new DOMDocument(); |
|
174 | + $document->loadXML($htmlWriter->flush()); |
|
175 | + } |
|
176 | + $stylesheet = $this->getTransformXmlDocument(); |
|
177 | + |
|
178 | + // Perform XSL transformation |
|
179 | + $xslt = new XSLTProcessor(); |
|
180 | + $xslt->importStyleSheet($stylesheet); |
|
181 | + |
|
182 | + // Check for parameters |
|
183 | + $parameters = $this->getParameters(); |
|
184 | + foreach($parameters as $name => $value) { |
|
185 | + $xslt->setParameter('', $name, $value); |
|
186 | + } |
|
187 | + $output = $xslt->transformToXML($document); |
|
188 | + |
|
189 | + // Write output |
|
190 | + $writer->write($output); |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | */ |
46 | 46 | class TXmlTransform extends \Prado\Web\UI\TControl { |
47 | 47 | |
48 | - const EXT_XML_FILE = '.xml'; |
|
49 | - const EXT_XSL_FILE = '.xsl'; |
|
48 | + const EXT_XML_FILE='.xml'; |
|
49 | + const EXT_XSL_FILE='.xsl'; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Constructor |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function setTransformPath($value) { |
74 | 74 | if(!is_file($value)) { |
75 | - $value = Prado::getPathOfNamespace($value, self::EXT_XSL_FILE); |
|
76 | - if($value === null) { |
|
75 | + $value=Prado::getPathOfNamespace($value, self::EXT_XSL_FILE); |
|
76 | + if($value===null) { |
|
77 | 77 | throw new TInvalidDataValueException('xmltransform_transformpath_invalid', $value); |
78 | 78 | } |
79 | 79 | } |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function setDocumentPath($value) { |
109 | 109 | if(!is_file($value)) { |
110 | - $value = Prado::getPathOfNamespace($value, self::EXT_XML_FILE); |
|
111 | - if($value === null) { |
|
110 | + $value=Prado::getPathOfNamespace($value, self::EXT_XML_FILE); |
|
111 | + if($value===null) { |
|
112 | 112 | throw new TInvalidDataValueException('xmltransform_documentpath_invalid', $value); |
113 | 113 | } |
114 | 114 | } |
@@ -134,22 +134,22 @@ discard block |
||
134 | 134 | * @return TAttributeCollection the list of custom parameters |
135 | 135 | */ |
136 | 136 | public function getParameters() { |
137 | - if($params = $this->getViewState('Parameters',null)) { |
|
137 | + if($params=$this->getViewState('Parameters', null)) { |
|
138 | 138 | return $params; |
139 | 139 | } else { |
140 | - $params = new TAttributeCollection(); |
|
140 | + $params=new TAttributeCollection(); |
|
141 | 141 | $this->setViewState('Parameters', $params, null); |
142 | 142 | return $params; |
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | 146 | private function getTransformXmlDocument() { |
147 | - if(($content = $this->getTransformContent()) !== '') { |
|
148 | - $document = new DOMDocument(); |
|
147 | + if(($content=$this->getTransformContent())!=='') { |
|
148 | + $document=new DOMDocument(); |
|
149 | 149 | $document->loadXML($content); |
150 | 150 | return $document; |
151 | - } else if(($path = $this->getTransformPath()) !== '') { |
|
152 | - $document = new DOMDocument(); |
|
151 | + } else if(($path=$this->getTransformPath())!=='') { |
|
152 | + $document=new DOMDocument(); |
|
153 | 153 | $document->load($path); |
154 | 154 | return $document; |
155 | 155 | } else { |
@@ -158,12 +158,12 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | private function getSourceXmlDocument() { |
161 | - if(($content = $this->getDocumentContent()) !== '') { |
|
162 | - $document = new DOMDocument(); |
|
161 | + if(($content=$this->getDocumentContent())!=='') { |
|
162 | + $document=new DOMDocument(); |
|
163 | 163 | $document->loadXML($content); |
164 | 164 | return $document; |
165 | - } else if(($path = $this->getDocumentPath()) !== '') { |
|
166 | - $document = new DOMDocument(); |
|
165 | + } else if(($path=$this->getDocumentPath())!=='') { |
|
166 | + $document=new DOMDocument(); |
|
167 | 167 | $document->load($path); |
168 | 168 | return $document; |
169 | 169 | } else { |
@@ -176,24 +176,24 @@ discard block |
||
176 | 176 | * @param THtmlWriter The writer used for the rendering purpose |
177 | 177 | */ |
178 | 178 | public function render($writer) { |
179 | - if(($document=$this->getSourceXmlDocument()) === null) { |
|
180 | - $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
179 | + if(($document=$this->getSourceXmlDocument())===null) { |
|
180 | + $htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
181 | 181 | parent::render($htmlWriter); |
182 | - $document = new DOMDocument(); |
|
182 | + $document=new DOMDocument(); |
|
183 | 183 | $document->loadXML($htmlWriter->flush()); |
184 | 184 | } |
185 | - $stylesheet = $this->getTransformXmlDocument(); |
|
185 | + $stylesheet=$this->getTransformXmlDocument(); |
|
186 | 186 | |
187 | 187 | // Perform XSL transformation |
188 | - $xslt = new XSLTProcessor(); |
|
188 | + $xslt=new XSLTProcessor(); |
|
189 | 189 | $xslt->importStyleSheet($stylesheet); |
190 | 190 | |
191 | 191 | // Check for parameters |
192 | - $parameters = $this->getParameters(); |
|
192 | + $parameters=$this->getParameters(); |
|
193 | 193 | foreach($parameters as $name => $value) { |
194 | 194 | $xslt->setParameter('', $name, $value); |
195 | 195 | } |
196 | - $output = $xslt->transformToXML($document); |
|
196 | + $output=$xslt->transformToXML($document); |
|
197 | 197 | |
198 | 198 | // Write output |
199 | 199 | $writer->write($output); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | public function setWidth($value) |
160 | 160 | { |
161 | 161 | if(($value=TPropertyValue::ensureInteger($value))<0) |
162 | - $value=-1; |
|
162 | + $value=-1; |
|
163 | 163 | $this->setViewState('Width',$value,-1); |
164 | 164 | } |
165 | 165 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | public function setHeight($value) |
178 | 178 | { |
179 | 179 | if(($value=TPropertyValue::ensureInteger($value))<0) |
180 | - $value=-1; |
|
180 | + $value=-1; |
|
181 | 181 | $this->setViewState('Height',$value,-1); |
182 | 182 | } |
183 | 183 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function getAlign() |
49 | 49 | { |
50 | - return $this->getViewState('Align',TInlineFrameAlign::NotSet); |
|
50 | + return $this->getViewState('Align', TInlineFrameAlign::NotSet); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function setAlign($value) |
57 | 57 | { |
58 | - $this->setViewState('Align',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TInlineFrameAlign'),TInlineFrameAlign::NotSet); |
|
58 | + $this->setViewState('Align', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TInlineFrameAlign'), TInlineFrameAlign::NotSet); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function getDescriptionUrl() |
65 | 65 | { |
66 | - return $this->getViewState('DescriptionUrl',''); |
|
66 | + return $this->getViewState('DescriptionUrl', ''); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function setDescriptionUrl($value) |
73 | 73 | { |
74 | - $this->setViewState('DescriptionUrl',$value,''); |
|
74 | + $this->setViewState('DescriptionUrl', $value, ''); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function getShowBorder() |
81 | 81 | { |
82 | - return $this->getViewState('ShowBorder',true); |
|
82 | + return $this->getViewState('ShowBorder', true); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function setShowBorder($value) |
89 | 89 | { |
90 | - $this->setViewState('ShowBorder',TPropertyValue::ensureBoolean($value),true); |
|
90 | + $this->setViewState('ShowBorder', TPropertyValue::ensureBoolean($value), true); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function getFrameUrl() |
97 | 97 | { |
98 | - return $this->getViewState('FrameUrl',''); |
|
98 | + return $this->getViewState('FrameUrl', ''); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function setFrameUrl($value) |
105 | 105 | { |
106 | - $this->setViewState('FrameUrl',$value,''); |
|
106 | + $this->setViewState('FrameUrl', $value, ''); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function getScrollBars() |
139 | 139 | { |
140 | - return $this->getViewState('ScrollBars',TInlineFrameScrollBars::Auto); |
|
140 | + return $this->getViewState('ScrollBars', TInlineFrameScrollBars::Auto); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function setScrollBars($value) |
147 | 147 | { |
148 | - $this->setViewState('ScrollBars',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TInlineFrameScrollBars'),TInlineFrameScrollBars::Auto); |
|
148 | + $this->setViewState('ScrollBars', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TInlineFrameScrollBars'), TInlineFrameScrollBars::Auto); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function getWidth() |
155 | 155 | { |
156 | - return $this->getViewState('Width',-1); |
|
156 | + return $this->getViewState('Width', -1); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function setWidth($value) |
163 | 163 | { |
164 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
164 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
165 | 165 | $value=-1; |
166 | - $this->setViewState('Width',$value,-1); |
|
166 | + $this->setViewState('Width', $value, -1); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function getHeight() |
173 | 173 | { |
174 | - return $this->getViewState('Height',-1); |
|
174 | + return $this->getViewState('Height', -1); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function setHeight($value) |
181 | 181 | { |
182 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
182 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
183 | 183 | $value=-1; |
184 | - $this->setViewState('Height',$value,-1); |
|
184 | + $this->setViewState('Height', $value, -1); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function getMarginWidth() |
192 | 192 | { |
193 | - return $this->getViewState('MarginWidth',-1); |
|
193 | + return $this->getViewState('MarginWidth', -1); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | */ |
200 | 200 | public function setMarginWidth($value) |
201 | 201 | { |
202 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
202 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
203 | 203 | $value=-1; |
204 | - $this->setViewState('MarginWidth',$value,-1); |
|
204 | + $this->setViewState('MarginWidth', $value, -1); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | public function getMarginHeight() |
212 | 212 | { |
213 | - return $this->getViewState('MarginHeight',-1); |
|
213 | + return $this->getViewState('MarginHeight', -1); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -219,9 +219,9 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public function setMarginHeight($value) |
221 | 221 | { |
222 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
222 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
223 | 223 | $value=-1; |
224 | - $this->setViewState('MarginHeight',$value,-1); |
|
224 | + $this->setViewState('MarginHeight', $value, -1); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -232,37 +232,37 @@ discard block |
||
232 | 232 | protected function addAttributesToRender($writer) |
233 | 233 | { |
234 | 234 | if($this->getID()!=='') |
235 | - $writer->addAttribute('name',$this->getUniqueID()); |
|
235 | + $writer->addAttribute('name', $this->getUniqueID()); |
|
236 | 236 | |
237 | 237 | if(($src=$this->getFrameUrl())!=='') |
238 | - $writer->addAttribute('src',$src); |
|
238 | + $writer->addAttribute('src', $src); |
|
239 | 239 | |
240 | 240 | if(($align=strtolower($this->getAlign()))!=='notset') |
241 | - $writer->addAttribute('align',$align); |
|
241 | + $writer->addAttribute('align', $align); |
|
242 | 242 | |
243 | 243 | $scrollBars=$this->getScrollBars(); |
244 | 244 | if($scrollBars===TInlineFrameScrollBars::None) |
245 | - $writer->addAttribute('scrolling','no'); |
|
245 | + $writer->addAttribute('scrolling', 'no'); |
|
246 | 246 | else if($scrollBars===TInlineFrameScrollBars::Both) |
247 | - $writer->addAttribute('scrolling','yes'); |
|
247 | + $writer->addAttribute('scrolling', 'yes'); |
|
248 | 248 | |
249 | - if (!$this->getShowBorder()) |
|
250 | - $writer->addAttribute('frameborder','0'); |
|
249 | + if(!$this->getShowBorder()) |
|
250 | + $writer->addAttribute('frameborder', '0'); |
|
251 | 251 | |
252 | 252 | if(($longdesc=$this->getDescriptionUrl())!=='') |
253 | - $writer->addAttribute('longdesc',$longdesc); |
|
253 | + $writer->addAttribute('longdesc', $longdesc); |
|
254 | 254 | |
255 | - if (($width=$this->getWidth())!==-1) |
|
256 | - $writer->addAttribute('width',$width); |
|
255 | + if(($width=$this->getWidth())!==-1) |
|
256 | + $writer->addAttribute('width', $width); |
|
257 | 257 | |
258 | - if (($height=$this->getHeight())!==-1) |
|
259 | - $writer->addAttribute('height',$height); |
|
258 | + if(($height=$this->getHeight())!==-1) |
|
259 | + $writer->addAttribute('height', $height); |
|
260 | 260 | |
261 | 261 | if(($marginheight=$this->getMarginHeight())!==-1) |
262 | - $writer->addAttribute('marginheight',$marginheight); |
|
262 | + $writer->addAttribute('marginheight', $marginheight); |
|
263 | 263 | |
264 | 264 | if(($marginwidth=$this->getMarginWidth())!==-1) |
265 | - $writer->addAttribute('marginwidth',$marginwidth); |
|
265 | + $writer->addAttribute('marginwidth', $marginwidth); |
|
266 | 266 | |
267 | 267 | parent::addAttributesToRender($writer); |
268 | 268 | } |
@@ -84,6 +84,7 @@ |
||
84 | 84 | |
85 | 85 | /** |
86 | 86 | * @param boolean whether there should be a visual separator between the frames. |
87 | + * @param boolean $value |
|
87 | 88 | */ |
88 | 89 | public function setShowBorder($value) |
89 | 90 | { |