@@ -84,8 +84,9 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function init() |
| 86 | 86 | { |
| 87 | - if (!$this->request) |
|
| 88 | - $this->request = Yii::$app->request; |
|
| 87 | + if (!$this->request) { |
|
| 88 | + $this->request = Yii::$app->request; |
|
| 89 | + } |
|
| 89 | 90 | parent::init(); |
| 90 | 91 | } |
| 91 | 92 | |
@@ -205,8 +206,9 @@ discard block |
||
| 205 | 206 | */ |
| 206 | 207 | public function getAbsoluteUrl($absoluteUrl = null) |
| 207 | 208 | { |
| 208 | - if (empty($absoluteUrl)) |
|
| 209 | - $absoluteUrl = $this->request->absoluteUrl; |
|
| 209 | + if (empty($absoluteUrl)) { |
|
| 210 | + $absoluteUrl = $this->request->absoluteUrl; |
|
| 211 | + } |
|
| 210 | 212 | return preg_replace('/https|http/', $this->protocol, $absoluteUrl, -1, $count); |
| 211 | 213 | } |
| 212 | 214 | |
@@ -250,8 +252,9 @@ discard block |
||
| 250 | 252 | } |
| 251 | 253 | |
| 252 | 254 | $path = Yii::getAlias($this->imagePath ?: $this->web . $image); |
| 253 | - if ($this->imagePath) |
|
| 254 | - $path = $this->imagePath; |
|
| 255 | + if ($this->imagePath) { |
|
| 256 | + $path = $this->imagePath; |
|
| 257 | + } |
|
| 255 | 258 | if (file_exists($path)) { |
| 256 | 259 | $imageSize = getimagesize($path); |
| 257 | 260 | $this->view->registerMetaTag(['property' => 'og:image:width', 'content' => $imageSize[0]]); |