@@ -77,8 +77,9 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function init() |
| 79 | 79 | { |
| 80 | - if (!$this->request) |
|
| 81 | - $this->request = Yii::$app->request; |
|
| 80 | + if (!$this->request) { |
|
| 81 | + $this->request = Yii::$app->request; |
|
| 82 | + } |
|
| 82 | 83 | parent::init(); |
| 83 | 84 | } |
| 84 | 85 | |
@@ -198,10 +199,11 @@ discard block |
||
| 198 | 199 | */ |
| 199 | 200 | public function getAbsoluteUrl($absoluteUrl = null) |
| 200 | 201 | { |
| 201 | - if ($absoluteUrl !== null) |
|
| 202 | - $absoluteUrl = $this->request->getHostInfo() . $absoluteUrl; |
|
| 203 | - else |
|
| 204 | - $absoluteUrl = $this->request->absoluteUrl; |
|
| 202 | + if ($absoluteUrl !== null) { |
|
| 203 | + $absoluteUrl = $this->request->getHostInfo() . $absoluteUrl; |
|
| 204 | + } else { |
|
| 205 | + $absoluteUrl = $this->request->absoluteUrl; |
|
| 206 | + } |
|
| 205 | 207 | return preg_replace('/https|http/', $this->protocol, $absoluteUrl, -1, $count); |
| 206 | 208 | } |
| 207 | 209 | |
@@ -245,8 +247,9 @@ discard block |
||
| 245 | 247 | } |
| 246 | 248 | |
| 247 | 249 | $path = Yii::getAlias($this->imagePath ?: $this->web . $image); |
| 248 | - if ($this->imagePath) |
|
| 249 | - $path = $this->imagePath; |
|
| 250 | + if ($this->imagePath) { |
|
| 251 | + $path = $this->imagePath; |
|
| 252 | + } |
|
| 250 | 253 | if (file_exists($path)) { |
| 251 | 254 | $imageSize = getimagesize($path); |
| 252 | 255 | $this->view->registerMetaTag(['property' => 'og:image:width', 'content' => $imageSize[0]]); |