Peer review of #679

This commit is contained in:
Sam Georges 2014-10-19 10:58:18 +11:00
parent b30d85df2d
commit 23f6d75416
9 changed files with 41 additions and 29 deletions

View File

@ -456,7 +456,7 @@ class Controller extends Extendable
}
} else {
/*
* Process page specific handler (index_onSomething) {
* Process page specific handler (index_onSomething)
*/
$pageHandler = $this->action . '_' . $handler;
@ -466,7 +466,7 @@ class Controller extends Extendable
}
/*
* Process page global handler (onSomething) {
* Process page global handler (onSomething)
*/
if ($this->methodExists($handler)) {
$result = call_user_func_array([$this, $handler], $this->params);

View File

@ -76,7 +76,7 @@ abstract class FormWidgetBase extends WidgetBase
* This step should be removed if year >= 2015.
*/
if (isset($configuration->options)) {
$configuration = array_merge($configuration->options, (array)$configuration);
$configuration = array_merge($configuration->options, (array) $configuration);
}
parent::__construct($controller, $configuration);

View File

@ -85,8 +85,10 @@ class BrandSettings extends Model
]);
$parser->parse(
File::get(PATH_BASE.'/modules/backend/models/brandsettings/custom.less').self::get('custom_css')
File::get(PATH_BASE.'/modules/backend/models/brandsettings/custom.less')
. self::get('custom_css')
);
$css = $parser->getCss();
return $css;

View File

@ -502,15 +502,18 @@ class Form extends WidgetBase
* Simple field type
*/
if (is_string($config)) {
if ($this->isFormWidget($config) !== false) {
$field->displayAs('widget', ['widget' => $config]);
} else {
$field->displayAs($config);
}
/*
* Defined field type
*/
} else {
$fieldType = isset($config['type']) ? $config['type'] : null;
if (!is_string($fieldType) && !is_null($fieldType)) {
throw new ApplicationException(Lang::get(
@ -528,6 +531,7 @@ class Form extends WidgetBase
}
$field->displayAs($fieldType, $config);
}
/*

View File

@ -495,10 +495,12 @@ class Controller extends BaseController
return Response::make($ex->getMessage(), 500);
}
return Response::make(
sprintf('"%s" on line %s of %s', $ex->getMessage(), $ex->getLine(), $ex->getFile()),
500
);
return Response::make(sprintf(
'"%s" on line %s of %s',
$ex->getMessage(),
$ex->getLine(),
$ex->getFile()
), 500);
}
}

View File

@ -92,15 +92,19 @@ class ComponentList extends WidgetBase
}
$pluginDetails = $plugin->pluginDetails();
$pluginName = isset($pluginDetails['name']) ?
$pluginDetails['name'] :
Lang::get('system::lang.plugin.unnamed');
$pluginIcon = isset($pluginDetails['icon']) ?
$pluginDetails['icon'] :
'icon-puzzle-piece';
$pluginDescription = isset($pluginDetails['description']) ?
$pluginDetails['description'] :
null;
$pluginName = isset($pluginDetails['name'])
? $pluginDetails['name']
: Lang::get('system::lang.plugin.unnamed');
$pluginIcon = isset($pluginDetails['icon'])
? $pluginDetails['icon']
: 'icon-puzzle-piece';
$pluginDescription = isset($pluginDetails['description'])
? $pluginDetails['description']
: null;
$pluginClass = get_class($plugin);
$pluginItems = [];
@ -120,9 +124,9 @@ class ComponentList extends WidgetBase
'className' => get_class($component),
'pluginIcon' => $pluginIcon,
'alias' => $alias,
'name' => $componentInfo->duplicateAlias ?
$componentInfo->className :
$componentInfo->alias
'name' => $componentInfo->duplicateAlias
? $componentInfo->className
: $componentInfo->alias
];
if ($searchWords && !$this->itemMatchesSearch($searchWords, $item)) {

View File

@ -283,10 +283,8 @@ class TemplateList extends WidgetBase
if (Str::contains(Str::lower($item->title), $word)) {
return true;
}
} else {
if (Str::contains(Str::lower($item->fileName), $word)) {
return true;
}
} elseif (Str::contains(Str::lower($item->fileName), $word)) {
return true;
}
if (Str::contains(Str::lower($item->description), $word) && strlen($item->description)) {

View File

@ -202,15 +202,15 @@ class ServiceProvider extends ModuleServiceProvider
*/
BackendAuth::registerCallback(function ($manager) {
$manager->registerPermissions('October.System', [
'system.manage_settings' => [
'system.manage_settings' => [
'label' => 'system::lang.permissions.manage_system_settings',
'tab' => 'System'
],
'system.manage_updates' => [
'system.manage_updates' => [
'label' => 'system::lang.permissions.manage_software_updates',
'tab' => 'System'
],
'system.manage_mail_templates' => [
'system.manage_mail_templates' => [
'label' => 'system::lang.permissions.manage_mail_templates',
'tab' => 'System'
],

View File

@ -22,15 +22,17 @@ class Controller extends BaseController
public function combine($name)
{
try {
if (!strpos($name, '-')) {
throw new ApplicationException(Lang::get('system::lang.combiner.not_found', ['name' => $name]));
}
$parts = explode('-', $name);
$cacheId = $parts[0];
$combiner = new CombineAssets;
return $combiner->getContents($cacheId);
} catch (Exception $ex) {
return '/* '.$ex->getMessage().' */';
}