@@ -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 | |
@@ -199,10 +200,11 @@ discard block |
||
| 199 | 200 | public function getAbsoluteUrl($absoluteUrl = null) |
| 200 | 201 | { |
| 201 | 202 | |
| 202 | - if ($absoluteUrl !== null) |
|
| 203 | - $absoluteUrl = $this->request->getHostInfo() . $absoluteUrl; |
|
| 204 | - else |
|
| 205 | - $absoluteUrl = $this->request->absoluteUrl; |
|
| 203 | + if ($absoluteUrl !== null) { |
|
| 204 | + $absoluteUrl = $this->request->getHostInfo() . $absoluteUrl; |
|
| 205 | + } else { |
|
| 206 | + $absoluteUrl = $this->request->absoluteUrl; |
|
| 207 | + } |
|
| 206 | 208 | return preg_replace('/https|http/', $this->protocol, $absoluteUrl, -1, $count); |
| 207 | 209 | } |
| 208 | 210 | |
@@ -246,8 +248,9 @@ discard block |
||
| 246 | 248 | } |
| 247 | 249 | |
| 248 | 250 | $path = Yii::getAlias($this->imagePath ?: $this->web . $image); |
| 249 | - if ($this->imagePath) |
|
| 250 | - $path = $this->imagePath; |
|
| 251 | + if ($this->imagePath) { |
|
| 252 | + $path = $this->imagePath; |
|
| 253 | + } |
|
| 251 | 254 | if (file_exists($path)) { |
| 252 | 255 | $imageSize = getimagesize($path); |
| 253 | 256 | $this->view->registerMetaTag(['property' => 'og:image:width', 'content' => $imageSize[0]]); |