Skip to content

Commit 465606d

Browse files
authored
Merge pull request #407 from phalcon/3.x
3.3.1
2 parents 29b8a36 + 32e345b commit 465606d

File tree

18 files changed

+157
-45
lines changed

18 files changed

+157
-45
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,17 @@
66
# https://help.github.com/articles/ignoring-files/#create-a-global-gitignore
77

88
/vendor
9+
/build
910
/.env
1011
/.env.save
12+
/clover.xml
13+
/phpcs.xml
14+
/phpunit.xml
15+
/humbug.json
16+
/humbuglog.json
17+
/humbuglog.txt
18+
/composer.phar
19+
/composer.lock
1120
/public/robots.txt
1221
/public/sitemap.xml
1322
/public/google*.html

app/library/Exception/Handler/ErrorPageHandler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ public function handle()
6464

6565
private function renderErrorPage()
6666
{
67-
$config = singleton('config')->error;
68-
$dispatcher = singleton('dispatcher');
69-
$view = singleton('view');
70-
$response = singleton('response');
67+
$config = container('config')->error;
68+
$dispatcher = container('dispatcher');
69+
$view = container('view');
70+
$response = container('response');
7171

7272
$dispatcher->setControllerName($config->controller);
7373
$dispatcher->setActionName($config->action);

app/library/Mail/SendSpool.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected function send(Notifications $notification)
9292
$user = $notification->user;
9393

9494
/** @var \Phosphorum\Email\EmailComponent $email */
95-
$email = singleton('email', [$user->email, false]);
95+
$email = container('email', [$user->email, false]);
9696

9797
if (!$email->valid()) {
9898
$notificationService->markAsSkipped($notification);

app/library/Version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Version extends PhVersion
3434
*/
3535
protected static function _getVersion()
3636
{
37-
return [3, 3, 0, 0, 0];
37+
return [3, 3, 1, 0, 0];
3838
}
3939
// @codingStandardsIgnoreEnd
4040
}

app/listener/DispatcherListener.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function beforeException(Event $event, Dispatcher $dispatcher, $exception
5959
]);
6060
}
6161

62-
singleton('logger')->error("Dispatching [$code]: " . $exception->getMessage());
62+
container('logger')->error("Dispatching [$code]: " . $exception->getMessage());
6363

6464
return false;
6565
}
@@ -82,13 +82,13 @@ public function beforeException(Event $event, Dispatcher $dispatcher, $exception
8282
]);
8383
}
8484

85-
singleton('logger')->error("Dispatching [$code]: " . $exception->getMessage());
85+
container('logger')->error("Dispatching [$code]: " . $exception->getMessage());
8686

8787
return false;
8888
}
8989

9090
if (!environment('production') && $exception instanceof \Exception) {
91-
singleton('logger')->error("Dispatching [{$exception->getCode()}]: " . $exception->getMessage());
91+
container('logger')->error("Dispatching [{$exception->getCode()}]: " . $exception->getMessage());
9292

9393
throw $exception;
9494
}

app/provider/Config/Factory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ protected static function load(array $providers)
5050
$merge = self::merge();
5151

5252
/** @var Filesystem $filesystem */
53-
$filesystem = singleton('filesystem', [cache_path('config')]);
53+
$filesystem = container('filesystem', [cache_path('config')]);
5454

5555
if ($filesystem->has('cached.php') && !environment('development')) {
5656
$merge($config, cache_path('config/cached.php'));

app/provider/ErrorHandler/ServiceProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,16 @@ function () use ($service) {
7070
switch ($mode) {
7171
case 'normal':
7272
if (env('APP_DEBUG', false)) {
73-
$run->pushHandler(singleton("{$service}.prettyPageHandler"));
73+
$run->pushHandler(container("{$service}.prettyPageHandler"));
7474
} else {
75-
$run->pushHandler(singleton("{$service}.errorPageHandler"));
75+
$run->pushHandler(container("{$service}.errorPageHandler"));
7676
}
7777
break;
7878
case 'cli':
7979
// @todo
8080
break;
8181
case 'api':
82-
$run->pushHandler(singleton("{$service}.jsonResponseHandler"));
82+
$run->pushHandler(container("{$service}.jsonResponseHandler"));
8383
throw new InvalidArgumentException(
8484
'Not implemented yet.'
8585
);
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
/*
4+
+------------------------------------------------------------------------+
5+
| Phalcon forum |
6+
+------------------------------------------------------------------------+
7+
| Copyright (c) 2011-2017 Phalcon Team (https://www.phalconphp.com) |
8+
+------------------------------------------------------------------------+
9+
| This source file is subject to the New BSD License that is bundled |
10+
| with this package in the file LICENSE.txt. |
11+
| |
12+
| If you did not receive a copy of the license and are unable to |
13+
| obtain it through the world-wide-web, please send an email |
14+
| to [email protected] so we can send you a copy immediately. |
15+
+------------------------------------------------------------------------+
16+
| Authors: Sergii Svyrydenko <[email protected]> |
17+
+------------------------------------------------------------------------+
18+
*/
19+
20+
namespace Phosphorum\Provider\Markdown\Plugins;
21+
22+
use Ciconia\Markdown;
23+
use Ciconia\Common\Text;
24+
use Ciconia\Extension\ExtensionInterface;
25+
26+
class SpecSymbolExtension implements ExtensionInterface
27+
{
28+
public function register(Markdown $markdown)
29+
{
30+
$markdown->on('inline', [$this, 'escapeText']);
31+
}
32+
33+
public function escapeText(Text $text)
34+
{
35+
$replaceArray = [];
36+
37+
$text->replace('{<code>.*?</code>}m', function (Text $w) use (&$replaceArray) {
38+
$count = count($replaceArray) + 1;
39+
$replaceArray[$count] = $w->getString();
40+
$w->replaceString($w->getString(), "%%replaced" . $count . "%%");
41+
42+
return $w;
43+
});
44+
45+
$str = htmlspecialchars($text->getString());
46+
foreach ($replaceArray as $key => $value) {
47+
$str = str_replace("%%replaced" . $key . "%%", $value, $str);
48+
}
49+
50+
$text->setString($str);
51+
}
52+
53+
public function getName()
54+
{
55+
return 'escapeText';
56+
}
57+
}

app/provider/Markdown/ServiceProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ function () {
5252
$ciconia->addExtension(new Plugins\BlockQuoteExtension());
5353
$ciconia->addExtension(new Plugins\UrlAutoLinkExtension());
5454
$ciconia->addExtension(new FencedCodeBlockExtension());
55+
$ciconia->addExtension(new Plugins\SpecSymbolExtension());
5556

5657
return $ciconia;
5758
}

app/provider/Queue/Fake.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct($queue)
4444
*/
4545
public function put(array $job)
4646
{
47-
singleton('logger')->debug('Putting job: ' . json_encode($job));
47+
container('logger')->debug('Putting job: ' . json_encode($job));
4848

4949
return true;
5050
}
@@ -61,6 +61,6 @@ public function peekReady()
6161

6262
public function choose($tube)
6363
{
64-
singleton('logger')->debug("Chosen tube: {$tube}");
64+
container('logger')->debug("Chosen tube: {$tube}");
6565
}
6666
}

0 commit comments

Comments
 (0)