mirror of
https://github.com/flextype/flextype.git
synced 2025-08-12 08:04:05 +02:00
Merge pull request #85 from flextype/scrutinizer-patch-2
Scrutinizer Auto-Fixes
This commit is contained in:
@@ -164,8 +164,8 @@ class Shortcodes {
|
||||
($s->getParameter('width')) and $attributes['width'] = $s->getParameter('width');
|
||||
($s->getParameter('height')) and $attributes['height'] = $s->getParameter('height');
|
||||
($s->getParameter('class')) and $attributes['class'] = $s->getParameter('class');
|
||||
($s->getParameter('id')) and $attributes['id'] = $s->getParameter('id');
|
||||
($s->getParameter('alt')) and $attributes['alt'] = $s->getParameter('alt');
|
||||
($s->getParameter('id')) and $attributes['id'] = $s->getParameter('id');
|
||||
($s->getParameter('alt')) and $attributes['alt'] = $s->getParameter('alt');
|
||||
|
||||
return Images::getImage($s->getParameter('path'), $params, $attributes);
|
||||
});
|
||||
|
@@ -26,10 +26,12 @@ class FrontmatterParser {
|
||||
*/
|
||||
public static function parse(string $content) : array
|
||||
{
|
||||
$parts = preg_split('/^[\s\r\n]?---[\s\r\n]?$/sm', PHP_EOL.ltrim($content));
|
||||
$parts = preg_split('/^[\s\r\n]?---[\s\r\n]?$/sm', PHP_EOL . ltrim($content));
|
||||
|
||||
if (count($parts) < 3) return ['matter' => [], 'body' => $content];
|
||||
if (count($parts) < 3) {
|
||||
return ['matter' => [], 'body' => $content];
|
||||
}
|
||||
|
||||
return ['matter' => trim($parts[1]), 'body' => implode(PHP_EOL.'---'.PHP_EOL, array_slice($parts, 2))];
|
||||
return ['matter' => trim($parts[1]), 'body' => implode(PHP_EOL . '---' . PHP_EOL, array_slice($parts, 2))];
|
||||
}
|
||||
}
|
||||
|
@@ -83,12 +83,12 @@ class EntriesManager
|
||||
// Create a entry!
|
||||
if (Filesystem::write(
|
||||
$file,
|
||||
'---'."\n".
|
||||
YamlParser::encode(array_replace_recursive($frontmatter, $_frontmatter)).
|
||||
'---'."\n"
|
||||
'---' . "\n" .
|
||||
YamlParser::encode(array_replace_recursive($frontmatter, $_frontmatter)) .
|
||||
'---' . "\n"
|
||||
)) {
|
||||
Notification::set('success', __('admin_message_entry_created'));
|
||||
Http::redirect(Http::getBaseUrl().'/admin/entries/?entry='.Http::post('parent_entry'));
|
||||
Http::redirect(Http::getBaseUrl() . '/admin/entries/?entry=' . Http::post('parent_entry'));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -176,13 +176,13 @@ class EntriesManager
|
||||
|
||||
if (Filesystem::write(
|
||||
PATH['entries'] . '/' . Http::post('entry') . '/entry.html',
|
||||
'---'."\n".
|
||||
$frontmatter."\n".
|
||||
'---'."\n".
|
||||
'---' . "\n" .
|
||||
$frontmatter . "\n" .
|
||||
'---' . "\n" .
|
||||
$content
|
||||
)) {
|
||||
Notification::set('success', __('admin_message_entry_changes_saved'));
|
||||
Http::redirect(Http::getBaseUrl() . '/admin/entries?entry='.implode('/', array_slice(explode("/", Http::get('entry')), 0, -1)));
|
||||
Http::redirect(Http::getBaseUrl() . '/admin/entries?entry=' . implode('/', array_slice(explode("/", Http::get('entry')), 0, -1)));
|
||||
}
|
||||
} else {
|
||||
die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
|
||||
@@ -294,13 +294,13 @@ class EntriesManager
|
||||
|
||||
Filesystem::write(
|
||||
PATH['entries'] . '/' . Http::get('entry') . '/entry.html',
|
||||
'---'."\n".
|
||||
$frontmatter."\n".
|
||||
'---'."\n".
|
||||
'---' . "\n" .
|
||||
$frontmatter . "\n" .
|
||||
'---' . "\n" .
|
||||
$content
|
||||
);
|
||||
Notification::set('success', __('admin_message_entry_changes_saved'));
|
||||
Http::redirect(Http::getBaseUrl().'/admin/entries/edit?entry='.Http::get('entry'));
|
||||
Http::redirect(Http::getBaseUrl() . '/admin/entries/edit?entry=' . Http::get('entry'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -5,12 +5,18 @@ use Flextype\Component\{Http\Http, Event\Event, Registry\Registry, Assets\Assets
|
||||
|
||||
<?php if (Registry::get("settings.locale") == 'en_US'): ?>
|
||||
<?php $locale_lower = 'en' ?>
|
||||
<?php else: ?>
|
||||
<?php else {
|
||||
: ?>
|
||||
<?php $locale_lower = strtolower(Registry::get("settings.locale")) ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php Assets::add('js', Http::getBaseUrl() . '/site/plugins/admin/assets/dist/js/admin-build.min.js', 'admin', 1); ?>
|
||||
<?php if ($locale_lower != 'en') Assets::add('js', Http::getBaseUrl() . '/site/plugins/admin/assets/dist/langs/trumbowyg/langs/' . $locale_lower . '.min.js', 'admin', 10); ?>
|
||||
<?php Assets::add('js', Http::getBaseUrl() . '/site/plugins/admin/assets/dist/js/admin-build.min.js', 'admin', 1);
|
||||
}
|
||||
?>
|
||||
<?php if ($locale_lower != 'en') {
|
||||
Assets::add('js', Http::getBaseUrl() . '/site/plugins/admin/assets/dist/langs/trumbowyg/langs/' . $locale_lower . '.min.js', 'admin', 10);
|
||||
}
|
||||
?>
|
||||
<?php foreach (Assets::get('js', 'admin') as $assets_by_priorities) { foreach ($assets_by_priorities as $assets) { ?>
|
||||
<script type="text/javascript" src="<?php echo $assets['asset']; ?>"></script>
|
||||
<?php } } ?>
|
||||
@@ -147,7 +153,8 @@ use Flextype\Component\{Http\Http, Event\Event, Registry\Registry, Assets\Assets
|
||||
<?php endif ?>
|
||||
<?php if (Http::get('fieldset') || Http::get('menu')): ?>
|
||||
mode: "yaml",
|
||||
<?php else: ?>
|
||||
<?php else {
|
||||
: ?>
|
||||
mode: "application/x-httpd-php",
|
||||
<?php endif ?>
|
||||
indentWithTabs: false,
|
||||
@@ -185,4 +192,5 @@ use Flextype\Component\{Http\Http, Event\Event, Registry\Registry, Assets\Assets
|
||||
|
||||
<?php Event::dispatch('onAdminThemeFooter');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -17,7 +17,7 @@ Themes::view('admin/views/partials/navbar')
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'entries_add' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/entries/add?entry='.Http::get('entry'),
|
||||
'link' => Http::getBaseUrl() . '/admin/entries/add?entry=' . Http::get('entry'),
|
||||
'title' => __('admin_create_new_entry'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
|
@@ -12,7 +12,7 @@ Themes::view('admin/views/partials/head')->display();
|
||||
Themes::view('admin/views/partials/navbar')
|
||||
->assign('links', [
|
||||
'template' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/templates/edit?template=' . Http::get('template') . '&type='.$type,
|
||||
'link' => Http::getBaseUrl() . '/admin/templates/edit?template=' . Http::get('template') . '&type=' . $type,
|
||||
'title' => __('admin_template'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
|
@@ -19,7 +19,7 @@ Themes::view('admin/views/partials/navbar')
|
||||
'attributes' => ['class' => 'js-save-form-submit float-right btn']
|
||||
],
|
||||
'settings_clear_cache' => [
|
||||
'link' => Http::getBaseUrl() . '/admin/settings?clear_cache=1&token='.Token::generate(),
|
||||
'link' => Http::getBaseUrl() . '/admin/settings?clear_cache=1&token=' . Token::generate(),
|
||||
'title' => __('admin_clear_cache'),
|
||||
'attributes' => ['class' => 'float-right btn']
|
||||
]
|
||||
|
Reference in New Issue
Block a user