@@ -194,11 +194,11 @@ |
||
| 194 | 194 | * Call each filter and return array with details of the formatted content. |
| 195 | 195 | * |
| 196 | 196 | * @param string $text the text to filter. |
| 197 | - * @param array $filter array of filters to use. |
|
| 197 | + * @param string[] $filter array of filters to use. |
|
| 198 | 198 | * |
| 199 | 199 | * @throws mos/TextFilter/Exception when filterd does not exists. |
| 200 | 200 | * |
| 201 | - * @return array with the formatted text and additional details. |
|
| 201 | + * @return \stdClass with the formatted text and additional details. |
|
| 202 | 202 | */ |
| 203 | 203 | public function parse($text, $filter) |
| 204 | 204 | { |
@@ -21,13 +21,13 @@ |
||
| 21 | 21 | "nl2br", |
| 22 | 22 | "purify", |
| 23 | 23 | "titlefromh1", |
| 24 | - ]; |
|
| 24 | + ]; |
|
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Current document parsed. |
|
| 30 | - */ |
|
| 28 | + /** |
|
| 29 | + * Current document parsed. |
|
| 30 | + */ |
|
| 31 | 31 | private $current; |
| 32 | 32 | |
| 33 | 33 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | $frontmatter = substr($text, $start + $tokenLength, $length); |
| 241 | 241 | $textStart = substr($text, 0, $start); |
| 242 | - $text = $textStart . substr($text, $stop + $tokenLength); |
|
| 242 | + $text = $textStart.substr($text, $stop + $tokenLength); |
|
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | list($text, $frontmatter) = $this->extractFrontMatter($text, $needle, $needle); |
| 289 | 289 | |
| 290 | 290 | if (function_exists("yaml_parse") && !empty($frontmatter)) { |
| 291 | - $frontmatter = yaml_parse($needle . $frontmatter); |
|
| 291 | + $frontmatter = yaml_parse($needle.$frontmatter); |
|
| 292 | 292 | |
| 293 | 293 | if ($frontmatter === false) { |
| 294 | 294 | throw new Exception("Failed parsing YAML frontmatter."); |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | { |
| 372 | 372 | return preg_replace_callback( |
| 373 | 373 | '#\b(?<![href|src]=[\'"])https?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#', |
| 374 | - function ($matches) { |
|
| 374 | + function($matches) { |
|
| 375 | 375 | return "<a href='{$matches[0]}'>{$matches[0]}</a>"; |
| 376 | 376 | }, |
| 377 | 377 | $text |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | */ |
| 390 | 390 | public function purify($text) |
| 391 | 391 | { |
| 392 | - $config = \HTMLPurifier_Config::createDefault(); |
|
| 392 | + $config = \HTMLPurifier_Config::createDefault(); |
|
| 393 | 393 | $config->set("Cache.DefinitionImpl", null); |
| 394 | 394 | //$config->set('Cache.SerializerPath', '/home/user/absolute/path'); |
| 395 | 395 | |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | |
| 444 | 444 | return preg_replace_callback( |
| 445 | 445 | $patterns, |
| 446 | - function ($matches) { |
|
| 446 | + function($matches) { |
|
| 447 | 447 | switch ($matches[1]) { |
| 448 | 448 | |
| 449 | 449 | case 'FIGURE': |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | $res[$match] = true; |
| 479 | 479 | } else { |
| 480 | 480 | $key = substr($match, 0, $pos); |
| 481 | - $val = trim(substr($match, $pos+1), '"'); |
|
| 481 | + $val = trim(substr($match, $pos + 1), '"'); |
|
| 482 | 482 | $res[$key] = $val; |
| 483 | 483 | } |
| 484 | 484 | } |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | public static function shortCodeFigure($options) |
| 501 | 501 | { |
| 502 | 502 | // Merge incoming options with default and expose as variables |
| 503 | - $options= array_merge( |
|
| 503 | + $options = array_merge( |
|
| 504 | 504 | [ |
| 505 | 505 | 'id' => null, |
| 506 | 506 | 'class' => null, |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <div> |
| 2 | 2 | <div class="btn-group"> |
| 3 | - <a href='<?=$this->url->create('event/delete/' . $event->id)?>' class="btn btn-default">Delete event</a>
|
|
| 3 | + <a href='<?=$this->url->create('event/delete/'.$event->id)?>' class="btn btn-default">Delete event</a>
|
|
| 4 | 4 | <a href='<?=$this->url->create('calendar')?>' class="btn btn-info">Back</a>
|
| 5 | 5 | </div> |
| 6 | 6 | <div class="jumbotron"> |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | <div class="col-md-4"> |
| 7 | 7 | |
| 8 | 8 | <div class="clearfix"></div> |
| 9 | - <?php if(isset($events)) : ?> |
|
| 9 | + <?php if (isset($events)) : ?> |
|
| 10 | 10 | <ul class="list-group"> |
| 11 | 11 | <?php foreach ($events as $event) : ?> |
| 12 | 12 | <li class="list-group-item"> |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | <h4 class="card-title"><?=$event->title?></h4> |
| 16 | 16 | <p class="card-text"><?=$event->content?></p> |
| 17 | 17 | <p class="card-text"><?=$event->id?></p> |
| 18 | - <a href='<?=$this->di->get('url')->create('event/id/' . $event->id) ?>' class="btn btn-primary btn-xs">Show event</a>
|
|
| 18 | + <a href='<?=$this->di->get('url')->create('event/id/'.$event->id) ?>' class="btn btn-primary btn-xs">Show event</a>
|
|
| 19 | 19 | </div> |
| 20 | 20 | </div> |
| 21 | 21 | <?php endforeach; ?> |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | public static function loadClassLoader($class) |
| 10 | 10 | { |
| 11 | 11 | if ('Composer\Autoload\ClassLoader' === $class) { |
| 12 | - require __DIR__ . '/ClassLoader.php'; |
|
| 12 | + require __DIR__.'/ClassLoader.php'; |
|
| 13 | 13 | } |
| 14 | 14 | } |
| 15 | 15 | |
@@ -25,21 +25,21 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION'); |
| 27 | 27 | if ($useStaticLoader) { |
| 28 | - require_once __DIR__ . '/autoload_static.php'; |
|
| 28 | + require_once __DIR__.'/autoload_static.php'; |
|
| 29 | 29 | |
| 30 | 30 | call_user_func(\Composer\Autoload\ComposerStaticInit7b593c329d00694ef3fa74c9b77a3c76::getInitializer($loader)); |
| 31 | 31 | } else { |
| 32 | - $map = require __DIR__ . '/autoload_namespaces.php'; |
|
| 32 | + $map = require __DIR__.'/autoload_namespaces.php'; |
|
| 33 | 33 | foreach ($map as $namespace => $path) { |
| 34 | 34 | $loader->set($namespace, $path); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $map = require __DIR__ . '/autoload_psr4.php'; |
|
| 37 | + $map = require __DIR__.'/autoload_psr4.php'; |
|
| 38 | 38 | foreach ($map as $namespace => $path) { |
| 39 | 39 | $loader->setPsr4($namespace, $path); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $classMap = require __DIR__ . '/autoload_classmap.php'; |
|
| 42 | + $classMap = require __DIR__.'/autoload_classmap.php'; |
|
| 43 | 43 | if ($classMap) { |
| 44 | 44 | $loader->addClassMap($classMap); |
| 45 | 45 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | if ($useStaticLoader) { |
| 51 | 51 | $includeFiles = Composer\Autoload\ComposerStaticInit7b593c329d00694ef3fa74c9b77a3c76::$files; |
| 52 | 52 | } else { |
| 53 | - $includeFiles = require __DIR__ . '/autoload_files.php'; |
|
| 53 | + $includeFiles = require __DIR__.'/autoload_files.php'; |
|
| 54 | 54 | } |
| 55 | 55 | foreach ($includeFiles as $fileIdentifier => $file) { |
| 56 | 56 | composerRequire7b593c329d00694ef3fa74c9b77a3c76($fileIdentifier, $file); |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | $baseDir = dirname($vendorDir); |
| 7 | 7 | |
| 8 | 8 | return array( |
| 9 | - 'Mos\\TextFilter\\' => array($vendorDir . '/mos/ctextfilter/src/TextFilter'), |
|
| 10 | - 'Mos\\' => array($vendorDir . '/mos/cdatabase/src', $vendorDir . '/mos/cform/src'), |
|
| 11 | - 'Anax\\' => array($vendorDir . '/anax/mvc/src'), |
|
| 9 | + 'Mos\\TextFilter\\' => array($vendorDir.'/mos/ctextfilter/src/TextFilter'), |
|
| 10 | + 'Mos\\' => array($vendorDir.'/mos/cdatabase/src', $vendorDir.'/mos/cform/src'), |
|
| 11 | + 'Anax\\' => array($vendorDir.'/anax/mvc/src'), |
|
| 12 | 12 | ); |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | $baseDir = dirname($vendorDir); |
| 7 | 7 | |
| 8 | 8 | return array( |
| 9 | - 'Monolog' => array($baseDir . '/src'), |
|
| 10 | - 'Michelf' => array($vendorDir . '/michelf/php-markdown'), |
|
| 11 | - 'HTMLPurifier' => array($vendorDir . '/ezyang/htmlpurifier/library'), |
|
| 9 | + 'Monolog' => array($baseDir.'/src'), |
|
| 10 | + 'Michelf' => array($vendorDir.'/michelf/php-markdown'), |
|
| 11 | + 'HTMLPurifier' => array($vendorDir.'/ezyang/htmlpurifier/library'), |
|
| 12 | 12 | ); |
@@ -6,5 +6,5 @@ |
||
| 6 | 6 | $baseDir = dirname($vendorDir); |
| 7 | 7 | |
| 8 | 8 | return array( |
| 9 | - '2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php', |
|
| 9 | + '2cffec82183ee1cea088009cef9a6fc3' => $vendorDir.'/ezyang/htmlpurifier/library/HTMLPurifier.composer.php', |
|
| 10 | 10 | ); |
@@ -1,3 +1,3 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include __DIR__ . "/../vendor/autoload.php"; |
|
| 3 | +include __DIR__."/../vendor/autoload.php"; |
|
@@ -12,23 +12,23 @@ discard block |
||
| 12 | 12 | * Supported filters. |
| 13 | 13 | */ |
| 14 | 14 | private $standardFilters = [ |
| 15 | - 'yamlfrontmatter', |
|
| 16 | - 'bbcode', |
|
| 17 | - 'clickable', |
|
| 18 | - 'markdown', |
|
| 19 | - 'nl2br', |
|
| 20 | - 'shortcode', |
|
| 21 | - 'purify', |
|
| 22 | - 'titlefromh1', |
|
| 23 | - ]; |
|
| 24 | - |
|
| 25 | - |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * Test. |
|
| 29 | - * |
|
| 30 | - * @return void |
|
| 31 | - */ |
|
| 15 | + 'yamlfrontmatter', |
|
| 16 | + 'bbcode', |
|
| 17 | + 'clickable', |
|
| 18 | + 'markdown', |
|
| 19 | + 'nl2br', |
|
| 20 | + 'shortcode', |
|
| 21 | + 'purify', |
|
| 22 | + 'titlefromh1', |
|
| 23 | + ]; |
|
| 24 | + |
|
| 25 | + |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * Test. |
|
| 29 | + * |
|
| 30 | + * @return void |
|
| 31 | + */ |
|
| 32 | 32 | public function testTitleFromFirstH1() |
| 33 | 33 | { |
| 34 | 34 | $filter = new CTextFilter(); |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Test. |
|
| 64 | - * |
|
| 65 | - * @expectedException /Mos/TextFilter/Exception |
|
| 66 | - * |
|
| 67 | - * @return void |
|
| 68 | - */ |
|
| 62 | + /** |
|
| 63 | + * Test. |
|
| 64 | + * |
|
| 65 | + * @expectedException /Mos/TextFilter/Exception |
|
| 66 | + * |
|
| 67 | + * @return void |
|
| 68 | + */ |
|
| 69 | 69 | public function testJsonFrontMatterException() |
| 70 | 70 | { |
| 71 | 71 | $filter = new CTextFilter(); |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Test. |
|
| 85 | - * |
|
| 86 | - * @return void |
|
| 87 | - */ |
|
| 83 | + /** |
|
| 84 | + * Test. |
|
| 85 | + * |
|
| 86 | + * @return void |
|
| 87 | + */ |
|
| 88 | 88 | public function testJsonFrontMatter() |
| 89 | 89 | { |
| 90 | 90 | $filter = new CTextFilter(); |
@@ -439,7 +439,7 @@ |
||
| 439 | 439 | [FIGURE src=$src caption="$caption"] |
| 440 | 440 | EOD; |
| 441 | 441 | |
| 442 | - $exp = <<<EOD |
|
| 442 | + $exp = <<<EOD |
|
| 443 | 443 | <figure class='figure'> |
| 444 | 444 | <a href='$src'><img src='$src' alt='$caption'/></a> |
| 445 | 445 | <figcaption markdown=1>$caption</figcaption> |