@@ -130,7 +130,7 @@ |
||
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | 132 | * Get Compiled Attributes. |
| 133 | - * @return \Webwizo\Shortcodes\Shortcode |
|
| 133 | + * @return Shortcode |
|
| 134 | 134 | */ |
| 135 | 135 | protected function compileShortcode($matches) |
| 136 | 136 | { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public function compile($value) |
| 53 | 53 | { |
| 54 | 54 | // Only continue is laravel-shortcodes have been registered |
| 55 | - if(!$this->enabled || !$this->hasShortcodes()) |
|
| 55 | + if (!$this->enabled || !$this->hasShortcodes()) |
|
| 56 | 56 | return $value; |
| 57 | 57 | |
| 58 | 58 | // Set empty result |
@@ -187,13 +187,13 @@ discard block |
||
| 187 | 187 | $callback = $this->registered[$name]; |
| 188 | 188 | |
| 189 | 189 | // if is a string |
| 190 | - if(is_string($callback)) |
|
| 190 | + if (is_string($callback)) |
|
| 191 | 191 | { |
| 192 | 192 | // Parse the callback |
| 193 | 193 | list($class, $method) = Str::parseCallback($callback, 'register'); |
| 194 | 194 | |
| 195 | 195 | // If the class exist |
| 196 | - if(class_exists($class)) |
|
| 196 | + if (class_exists($class)) |
|
| 197 | 197 | { |
| 198 | 198 | // return class and method |
| 199 | 199 | return array( |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/'; |
| 220 | 220 | |
| 221 | 221 | // Match |
| 222 | - if(preg_match_all($pattern, preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text), $match, PREG_SET_ORDER)) |
|
| 222 | + if (preg_match_all($pattern, preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text), $match, PREG_SET_ORDER)) |
|
| 223 | 223 | { |
| 224 | 224 | foreach ($match as $m) |
| 225 | 225 | { |
@@ -52,8 +52,9 @@ discard block |
||
| 52 | 52 | public function compile($value) |
| 53 | 53 | { |
| 54 | 54 | // Only continue is laravel-shortcodes have been registered |
| 55 | - if(!$this->enabled || !$this->hasShortcodes()) |
|
| 56 | - return $value; |
|
| 55 | + if(!$this->enabled || !$this->hasShortcodes()) { |
|
| 56 | + return $value; |
|
| 57 | + } |
|
| 57 | 58 | |
| 58 | 59 | // Set empty result |
| 59 | 60 | $result = ''; |
@@ -226,26 +227,21 @@ discard block |
||
| 226 | 227 | if (!empty($m[1])) |
| 227 | 228 | { |
| 228 | 229 | $attributes[strtolower($m[1])] = stripcslashes($m[2]); |
| 229 | - } |
|
| 230 | - elseif (!empty($m[3])) |
|
| 230 | + } elseif (!empty($m[3])) |
|
| 231 | 231 | { |
| 232 | 232 | $attributes[strtolower($m[3])] = stripcslashes($m[4]); |
| 233 | - } |
|
| 234 | - elseif (!empty($m[5])) |
|
| 233 | + } elseif (!empty($m[5])) |
|
| 235 | 234 | { |
| 236 | 235 | $attributes[strtolower($m[5])] = stripcslashes($m[6]); |
| 237 | - } |
|
| 238 | - elseif (isset($m[7]) and strlen($m[7])) |
|
| 236 | + } elseif (isset($m[7]) and strlen($m[7])) |
|
| 239 | 237 | { |
| 240 | 238 | $attributes[] = stripcslashes($m[7]); |
| 241 | - } |
|
| 242 | - elseif (isset($m[8])) |
|
| 239 | + } elseif (isset($m[8])) |
|
| 243 | 240 | { |
| 244 | 241 | $attributes[] = stripcslashes($m[8]); |
| 245 | 242 | } |
| 246 | 243 | } |
| 247 | - } |
|
| 248 | - else |
|
| 244 | + } else |
|
| 249 | 245 | { |
| 250 | 246 | $attributes = ltrim($text); |
| 251 | 247 | } |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | /** |
| 93 | 93 | * Get the services provided by the provider. |
| 94 | 94 | * |
| 95 | - * @return array |
|
| 95 | + * @return string[] |
|
| 96 | 96 | */ |
| 97 | 97 | public function provides() |
| 98 | 98 | { |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | $state = $this->app['config']->get('laravel-shortcodes::enabled', false); |
| 26 | 26 | |
| 27 | 27 | // enable when needed |
| 28 | - if($state) |
|
| 28 | + if ($state) |
|
| 29 | 29 | $this->app['shortcode.compiler']->enable(); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -25,8 +25,9 @@ |
||
| 25 | 25 | $state = $this->app['config']->get('laravel-shortcodes::enabled', false); |
| 26 | 26 | |
| 27 | 27 | // enable when needed |
| 28 | - if($state) |
|
| 29 | - $this->app['shortcode.compiler']->enable(); |
|
| 28 | + if($state) { |
|
| 29 | + $this->app['shortcode.compiler']->enable(); |
|
| 30 | + } |
|
| 30 | 31 | } |
| 31 | 32 | |
| 32 | 33 | /** |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | * Create a new view instance. |
| 21 | 21 | * |
| 22 | 22 | * @param \Illuminate\View\Factory|Factory $factory |
| 23 | - * @param \Illuminate\View\Compilers\EngineInterface|EngineInterface $engine |
|
| 23 | + * @param EngineInterface $engine |
|
| 24 | 24 | * @param string $view |
| 25 | 25 | * @param string $path |
| 26 | 26 | * @param array $data |
@@ -1,8 +1,6 @@ |
||
| 1 | 1 | <?php namespace Webwizo\ShortCodes\View; |
| 2 | 2 | |
| 3 | 3 | use ArrayAccess; |
| 4 | -use Closure; |
|
| 5 | -use Illuminate\Support\MessageBag; |
|
| 6 | 4 | use Illuminate\Contracts\Support\Renderable; |
| 7 | 5 | use Illuminate\View\View as IlluminateView; |
| 8 | 6 | use Illuminate\View\Engines\EngineInterface; |
@@ -42,11 +42,11 @@ |
||
| 42 | 42 | { |
| 43 | 43 | $value = $this->{$attribute}; |
| 44 | 44 | |
| 45 | - if(!is_null($value)) |
|
| 45 | + if (!is_null($value)) |
|
| 46 | 46 | { |
| 47 | 47 | return $attribute . '="' . $value . '"'; |
| 48 | 48 | } |
| 49 | - elseif(!is_null($fallback)) |
|
| 49 | + elseif (!is_null($fallback)) |
|
| 50 | 50 | { |
| 51 | 51 | return $attribute . '="' . $fallback . '"'; |
| 52 | 52 | } |
@@ -45,8 +45,7 @@ |
||
| 45 | 45 | if(!is_null($value)) |
| 46 | 46 | { |
| 47 | 47 | return $attribute . '="' . $value . '"'; |
| 48 | - } |
|
| 49 | - elseif(!is_null($fallback)) |
|
| 48 | + } elseif(!is_null($fallback)) |
|
| 50 | 49 | { |
| 51 | 50 | return $attribute . '="' . $fallback . '"'; |
| 52 | 51 | } |
@@ -40,7 +40,9 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | public function make($view, $data = array(), $mergeData = array()) |
| 42 | 42 | { |
| 43 | - if (isset($this->aliases[$view])) $view = $this->aliases[$view]; |
|
| 43 | + if (isset($this->aliases[$view])) { |
|
| 44 | + $view = $this->aliases[$view]; |
|
| 45 | + } |
|
| 44 | 46 | |
| 45 | 47 | $path = $this->finder->find($view); |
| 46 | 48 | |