Subsequent expressions are on a new line (see developer guide > PSR exceptions)

This commit is contained in:
Sam Georges 2014-11-01 12:00:45 +11:00
parent 665d78e7d6
commit c83797231d
51 changed files with 320 additions and 166 deletions

View File

@ -141,7 +141,8 @@ class FormController extends ControllerBehavior
$model = $this->controller->formCreateModelObject();
$this->initForm($model);
$this->controller->vars['formModel'] = $model;
} catch (Exception $ex) {
}
catch (Exception $ex) {
$this->controller->handleError($ex);
}
}
@ -196,7 +197,8 @@ class FormController extends ControllerBehavior
$this->initForm($model);
$this->controller->vars['formModel'] = $model;
} catch (Exception $ex) {
}
catch (Exception $ex) {
$this->controller->handleError($ex);
}
}
@ -274,7 +276,8 @@ class FormController extends ControllerBehavior
$this->initForm($model);
$this->controller->vars['formModel'] = $model;
} catch (Exception $ex) {
}
catch (Exception $ex) {
$this->controller->handleError($ex);
}
}

View File

@ -346,7 +346,8 @@ class Controller extends Extendable
// ));
// }
// }
} else {
}
else {
$partialList = [];
}
@ -385,7 +386,8 @@ class Controller extends Extendable
/*
* No redirect is used, look for any flash messages
*/
} elseif (Flash::check()) {
}
elseif (Flash::check()) {
$responseContents['#layout-flash-messages'] = $this->makeLayoutPartial('flash_messages');
}
@ -397,7 +399,8 @@ class Controller extends Extendable
}
return Response::make()->setContent($responseContents);
} catch (ValidationException $ex) {
}
catch (ValidationException $ex) {
/*
* Handle validation error gracefully
*/
@ -406,14 +409,17 @@ class Controller extends Extendable
$responseContents['#layout-flash-messages'] = $this->makeLayoutPartial('flash_messages');
$responseContents['X_OCTOBER_ERROR_FIELDS'] = $ex->getFields();
return Response::make($responseContents, 406);
} catch (MassAssignmentException $ex) {
}
catch (MassAssignmentException $ex) {
return Response::make(
Lang::get('backend::lang.model.mass_assignment_failed', ['attribute' => $ex->getMessage()]),
500
);
} catch (ApplicationException $ex) {
}
catch (ApplicationException $ex) {
return Response::make($ex->getMessage(), 500);
} catch (Exception $ex) {
}
catch (Exception $ex) {
return Response::make(
sprintf('"%s" on line %s of %s', $ex->getMessage(), $ex->getLine(), $ex->getFile()),
500
@ -454,7 +460,8 @@ class Controller extends Extendable
$result = call_user_func_array([$widget, $handlerName], $this->params);
return ($result) ?: true;
}
} else {
}
else {
/*
* Process page specific handler (index_onSomething)
*/

View File

@ -52,7 +52,8 @@ class Auth extends Controller
} else {
$this->bodyClass .= ' preload';
}
} catch (Exception $ex) {
}
catch (Exception $ex) {
Flash::error($ex->getMessage());
}
}
@ -103,7 +104,8 @@ class Auth extends Controller
if (post('postback')) {
return $this->restore_onSubmit();
}
} catch (Exception $ex) {
}
catch (Exception $ex) {
Flash::error($ex->getMessage());
}
}
@ -156,7 +158,8 @@ class Auth extends Controller
if (!$userId || !$code) {
throw new ApplicationException(trans('backend::lang.account.reset_error'));
}
} catch (Exception $ex) {
}
catch (Exception $ex) {
Flash::error($ex->getMessage());
}

View File

@ -176,7 +176,8 @@ class FileUpload extends FormWidgetBase
}
throw new SystemException('Unable to find file, it may no longer exist');
} catch (Exception $ex) {
}
catch (Exception $ex) {
return json_encode(['error' => $ex->getMessage()]);
}
}
@ -243,7 +244,8 @@ class FileUpload extends FormWidgetBase
$file->thumb = $file->getThumb($this->imageWidth, $this->imageHeight, ['mode' => 'crop']);
$result = $file;
} catch (Exception $ex) {
}
catch (Exception $ex) {
$result = json_encode(['error' => $ex->getMessage()]);
}

View File

@ -209,7 +209,8 @@ class Lists extends WidgetBase
$this->vars['pageLast'] = $this->records->getLastPage();
$this->vars['pageFrom'] = $this->records->getFrom();
$this->vars['pageTo'] = $this->records->getTo();
} else {
}
else {
$this->vars['recordTotal'] = $this->records->count();
$this->vars['pageCurrent'] = 1;
}
@ -305,10 +306,11 @@ class Lists extends WidgetBase
: $table . '.' . $column->valueFrom;
$relationSearchable[$column->relation][] = $columnName;
}
/*
* Primary
*/
} else {
else {
$columnName = isset($column->sqlSelect)
? DbDongle::raw($this->parseTableName($column->sqlSelect, $primaryTable))
: $primaryTable . '.' . $column->columnName;
@ -391,10 +393,11 @@ class Lists extends WidgetBase
$joinSql = $countQuery->select($joinSql)->toSql();
$selects[] = Db::raw("(".$joinSql.") as ".$alias);
}
/*
* Primary column
*/
} else {
else {
$sqlSelect = $this->parseTableName($column->sqlSelect, $primaryTable);
$selects[] = DbDongle::raw($sqlSelect . ' as '. $alias);
}
@ -449,7 +452,8 @@ class Lists extends WidgetBase
{
if ($this->showTree) {
$records = $this->model->getAllRoot();
} else {
}
else {
$model = $this->prepareModel();
$records = ($this->showPagination)
? $model->paginate($this->recordsPerPage)
@ -544,10 +548,11 @@ class Lists extends WidgetBase
$definitions[$columnName]->invisible = false;
$columns[$columnName] = $definitions[$columnName];
}
}
/*
* Use default column list
*/
} else {
else {
foreach ($definitions as $columnName => $column) {
if ($column->invisible) {
continue;
@ -617,9 +622,11 @@ class Lists extends WidgetBase
{
if (is_string($config)) {
$label = $config;
} elseif (isset($config['label'])) {
}
elseif (isset($config['label'])) {
$label = $config['label'];
} else {
}
else {
$label = studly_case($name);
}
@ -683,11 +690,14 @@ class Lists extends WidgetBase
if ($column->valueFrom) {
if (!array_key_exists($columnName, $record->getRelations())) {
$value = null;
} elseif ($this->isColumnRelated($column, true)) {
}
elseif ($this->isColumnRelated($column, true)) {
$value = implode(', ', $record->{$columnName}->lists($column->valueFrom));
} elseif ($this->isColumnRelated($column)) {
}
elseif ($this->isColumnRelated($column)) {
$value = $record->{$columnName}->{$column->valueFrom};
} else {
}
else {
$value = $record->{$column->valueFrom};
}
/*
@ -695,10 +705,12 @@ class Lists extends WidgetBase
* so prevent the Model from attempting to load the relation
* if the value is NULL.
*/
} else {
}
else {
if ($record->hasRelation($columnName) && array_key_exists($columnName, $record->attributes)) {
$value = $record->attributes[$columnName];
} else {
}
else {
$value = $record->{$columnName};
}
}
@ -881,7 +893,8 @@ class Lists extends WidgetBase
{
if (empty($term)) {
$this->showTree = $this->getConfig('showTree', $this->showTree);
} else {
}
else {
$this->showTree = false;
}
@ -926,7 +939,8 @@ class Lists extends WidgetBase
if ($column != $sortOptions['column'] || $sortOptions['direction'] == 'asc') {
$this->sortDirection = $sortOptions['direction'] = 'desc';
} else {
}
else {
$this->sortDirection = $sortOptions['direction'] = 'asc';
}
@ -962,15 +976,16 @@ class Lists extends WidgetBase
if ($this->showSorting && ($sortOptions = $this->getSession('sort'))) {
$this->sortColumn = $sortOptions['column'];
$this->sortDirection = $sortOptions['direction'];
}
/*
* Supplied default
*/
} else {
else {
if (is_string($this->defaultSort)) {
$this->sortColumn = $this->defaultSort;
$this->sortDirection = 'desc';
} elseif (is_array($this->defaultSort) && isset($this->defaultSort['column'])) {
}
elseif (is_array($this->defaultSort) && isset($this->defaultSort['column'])) {
$this->sortColumn = $this->defaultSort['column'];
$this->sortDirection = (isset($this->defaultSort['direction'])) ?
$this->defaultSort['direction'] :
@ -997,7 +1012,8 @@ class Lists extends WidgetBase
{
if ($column === null) {
return (count($this->getSortableColumns()) > 0);
} else {
}
else {
return array_key_exists($column, $this->getSortableColumns());
}
}

View File

@ -84,7 +84,8 @@ class Search extends WidgetBase
if ($this->customPartial) {
return $this->controller->makePartial($this->customPartial);
} else {
}
else {
return $this->makePartial('search');
}
}
@ -134,7 +135,8 @@ class Search extends WidgetBase
{
if (strlen($term)) {
$this->putSession('term', $term);
} else {
}
else {
$this->resetSession();
}

View File

@ -51,7 +51,8 @@
if (checked) {
$el.closest('tr').addClass('active')
} else {
}
else {
$('.list-checkbox input[type="checkbox"]', head).prop('checked', false)
$el.closest('tr').removeClass('active')
}

View File

@ -202,7 +202,8 @@ class CmsCompoundObject extends CmsObject
foreach ($values as &$value) {
if (!is_array($value)) {
$value = trim($value);
} else {
}
else {
$trim($value);
}
}
@ -229,7 +230,8 @@ class CmsCompoundObject extends CmsObject
$code = preg_replace('/\?>$/', '', $code);
$content[] = '<?php'.PHP_EOL.$this->code.PHP_EOL.'?>';
} else {
}
else {
$content[] = $this->code;
}
}
@ -322,7 +324,8 @@ class CmsCompoundObject extends CmsObject
if (self::$objectComponentPropertyMap !== null) {
$objectComponentMap = self::$objectComponentPropertyMap;
} else {
}
else {
$cached = Cache::get($key, false);
$unserialized = $cached ? @unserialize($cached) : false;
$objectComponentMap = $unserialized ? $unserialized : [];
@ -343,7 +346,8 @@ class CmsCompoundObject extends CmsObject
if (!isset($this->settings['components'])) {
$objectComponentMap[$objectCode] = [];
} else {
}
else {
foreach ($this->settings['components'] as $componentName => $componentSettings) {
$nameParts = explode(' ', $componentName);
if (count($nameParts > 1)) {

View File

@ -165,7 +165,8 @@ class CmsException extends ApplicationException
/*
* Errors occurring the PHP code base class (Cms\Classes\CodeBase)
*/
} else {
}
else {
$trace = $exception->getTrace();
if (isset($trace[1]['class'])) {
$class = $trace[1]['class'];

View File

@ -320,7 +320,8 @@ class CmsObject implements ArrayAccess
$methodName = 'set'.ucfirst($key);
if (method_exists($this, $methodName)) {
$this->$methodName($value);
} else {
}
else {
$this->$key = $value;
}
}

View File

@ -75,7 +75,8 @@ class CmsObjectQuery
if ($this->useCache) {
return forward_static_call([$this->cmsObject, 'loadCached'], $this->theme, $fileName);
} else {
}
else {
return forward_static_call([$this->cmsObject, 'load'], $this->theme, $fileName);
}
}

View File

@ -59,7 +59,8 @@ class ComponentHelpers
array_walk($property[$name], function (&$_value, $key) {
$_value = Lang::get($_value);
});
} else {
}
else {
$property[$name] = Lang::get($value);
}
}

View File

@ -194,7 +194,8 @@ class Controller extends BaseController
*/
if (!$page->layout) {
$layout = Layout::initFallback($this->theme);
} elseif (($layout = Layout::loadCached($this->theme, $page->layout)) === null) {
}
elseif (($layout = Layout::loadCached($this->theme, $page->layout)) === null) {
throw new CmsException(Lang::get('cms::lang.layout.not_found', ['name'=>$page->layout]));
}
@ -280,7 +281,8 @@ class Controller extends BaseController
$template = $this->twig->loadTemplate($this->page->getFullPath());
$this->pageContents = $template->render($this->vars);
CmsException::unmask();
} else {
}
else {
$this->pageContents = $apiResult;
}
@ -406,7 +408,8 @@ class Controller extends BaseController
$componentObj->alias = $alias;
$this->vars[$alias] = $this->layout->components[$alias] = $componentObj;
} else {
}
else {
if (!$componentObj = $manager->makeComponent($name, $this->pageObj, $properties)) {
throw new CmsException(Lang::get('cms::lang.component.not_found', ['name'=>$name]));
}
@ -446,7 +449,8 @@ class Controller extends BaseController
throw new CmsException(Lang::get('cms::lang.partial.invalid_name', ['name'=>$partial]));
}
}
} else {
}
else {
$partialList = [];
}
@ -465,7 +469,8 @@ class Controller extends BaseController
*/
if (is_array($result)) {
$responseContents = array_merge($responseContents, $result);
} elseif (is_string($result)) {
}
elseif (is_string($result)) {
$responseContents['result'] = $result;
}
@ -485,16 +490,19 @@ class Controller extends BaseController
}
return Response::make()->setContent($responseContents);
} catch (ValidationException $ex) {
}
catch (ValidationException $ex) {
/*
* Handle validation errors
*/
$responseContents['X_OCTOBER_ERROR_FIELDS'] = $ex->getFields();
$responseContents['X_OCTOBER_ERROR_MESSAGE'] = $ex->getMessage();
return Response::make($responseContents, 406);
} catch (ApplicationException $ex) {
}
catch (ApplicationException $ex) {
return Response::make($ex->getMessage(), 500);
} catch (Exception $ex) {
}
catch (Exception $ex) {
/*
* Display a "dumbed down" error if custom page is activated
* otherwise display a more detailed error.
@ -535,10 +543,11 @@ class Controller extends BaseController
$result = $componentObj->$handlerName();
return ($result) ?: true;
}
}
/*
* Process code section handler
*/
} else {
else {
if (method_exists($this->pageObj, $handler)) {
$result = $this->pageObj->$handler();
return ($result) ?: true;
@ -694,21 +703,25 @@ class Controller extends BaseController
if (!strlen($componentAlias)) {
if ($this->componentContext !== null) {
$componentObj = $this->componentContext;
} elseif (($componentObj = $this->findComponentByPartial($partialName)) === null) {
}
elseif (($componentObj = $this->findComponentByPartial($partialName)) === null) {
if ($throwException) {
throw new CmsException(Lang::get('cms::lang.partial.not_found', ['name'=>$name]));
} else {
}
else {
return false;
}
}
/*
* Component alias is supplied
*/
} else {
}
else {
if (($componentObj = $this->findComponentByName($componentAlias)) === null) {
if ($throwException) {
throw new CmsException(Lang::get('cms::lang.component.not_found', ['name'=>$componentAlias]));
} else {
}
else {
return false;
}
}
@ -736,7 +749,8 @@ class Controller extends BaseController
if ($partial === null) {
if ($throwException) {
throw new CmsException(Lang::get('cms::lang.partial.not_found', ['name'=>$name]));
} else {
}
else {
return false;
}
}
@ -745,14 +759,16 @@ class Controller extends BaseController
* Set context for self access
*/
$this->vars['__SELF__'] = $componentObj;
} else {
}
else {
/*
* Process theme partial
*/
if (($partial = Partial::loadCached($this->theme, $name)) === null) {
if ($throwException) {
throw new CmsException(Lang::get('cms::lang.partial.not_found', ['name'=>$name]));
} else {
}
else {
return false;
}
}
@ -831,12 +847,14 @@ class Controller extends BaseController
*/
if ($event = $this->fireEvent('page.beforeRenderContent', [$name], true)) {
$content = $event;
} elseif ($event = Event::fire('cms.page.beforeRenderContent', [$this, $name], true)) {
}
elseif ($event = Event::fire('cms.page.beforeRenderContent', [$this, $name], true)) {
$content = $event;
}
/*
* Load content from theme
*/
} elseif (($content = Content::loadCached($this->theme, $name)) === null) {
elseif (($content = Content::loadCached($this->theme, $name)) === null) {
throw new CmsException(Lang::get('cms::lang.content.not_found', ['name'=>$name]));
}
@ -988,7 +1006,8 @@ class Controller extends BaseController
if (is_array($url)) {
$_url = Request::getBaseUrl();
$_url .= CombineAssets::combine($url, $themePath);
} else {
}
else {
$_url = Request::getBasePath().$themePath;
if ($url !== null) {
$_url .= '/'.$url;

View File

@ -78,18 +78,20 @@ class FileHelper
public static function formatIniString($data, $level = 1)
{
$content = null;
$sections = [];
foreach ($data as $key => $value) {
if (is_array($value)) {
if ($level == 1) {
$sections[$key] = self::formatIniString($value, $level+1);
} else {
}
else {
foreach ($value as $val) {
$content .= $key.'[] = "'.self::escapeIniString($val).'"'.PHP_EOL;
}
}
} elseif (strlen($value)) {
}
elseif (strlen($value)) {
$content .= $key.' = "'.self::escapeIniString($value).'"'.PHP_EOL;
}
}

View File

@ -208,7 +208,8 @@ class Router
$cacheable = Config::get('cms.enableRoutesCache');
if ($cacheable) {
$cached = Cache::get($key, false);
} else {
}
else {
$cached = false;
}

View File

@ -52,10 +52,12 @@ class SectionParser
$result['code'] = preg_replace('/\?\>\s*$/', '', $result['code']);
$result['markup'] = $sections[2];
} elseif ($count == 2) {
}
elseif ($count == 2) {
$result['settings'] = parse_ini_string($sections[0], true);
$result['markup'] = $sections[1];
} elseif ($count == 1) {
}
elseif ($count == 1) {
$result['markup'] = $sections[0];
}
@ -83,10 +85,12 @@ class SectionParser
$result['settings'] = self::adjustLinePosition($content);
$result['code'] = self::calculateLinePosition($content);
$result['markup'] = self::calculateLinePosition($content, 2);
} elseif ($count == 2) {
}
elseif ($count == 2) {
$result['settings'] = self::adjustLinePosition($content);
$result['markup'] = self::calculateLinePosition($content);
} elseif ($count == 1) {
}
elseif ($count == 1) {
$result['markup'] = 1;
}

View File

@ -76,7 +76,8 @@ class Index extends Controller
new ComponentList($this, 'componentList');
new AssetList($this, 'assetList');
} catch (Exception $ex) {
}
catch (Exception $ex) {
$this->handleError($ex);
}
}
@ -238,7 +239,8 @@ class Index extends Controller
$deleted[] = $path;
}
}
} catch (Exception $ex) {
}
catch (Exception $ex) {
$error = $ex->getMessage();
}

View File

@ -36,6 +36,7 @@ class Components extends FormWidgetBase
$manager = ComponentManager::instance();
$manager->listComponents();
foreach ($this->model->settings['components'] as $name => $properties) {
list($name, $alias) = strpos($name, ' ') ? explode(' ', $name) : [$name, $name];
@ -55,7 +56,8 @@ class Components extends FormWidgetBase
$componentObj->pluginIcon = $pluginDetails['icon'];
}
}
} catch (Exception $ex) {
}
catch (Exception $ex) {
$componentObj = new UnknownComponent(null, $properties, $ex->getMessage());
$componentObj->alias = $alias;
$componentObj->pluginIcon = 'icon-bug';

View File

@ -99,7 +99,8 @@ class DebugExtension extends Twig_Extension
$result .= $this->dump($vars, static::PAGE_CAPTION);
} else {
}
else {
$this->variablePrefix = false;
for ($i = 2; $i < $count; $i++) {
@ -108,9 +109,11 @@ class DebugExtension extends Twig_Extension
if ($var instanceof ComponentBase) {
$caption = [static::COMPONENT_CAPTION, get_class($var)];
} elseif (is_array($var)) {
}
elseif (is_array($var)) {
$caption = static::ARRAY_CAPTION;
} else {
}
else {
$caption = [static::OBJECT_CAPTION, get_class($var)];
}
@ -148,9 +151,11 @@ class DebugExtension extends Twig_Extension
if (!is_array($variables)) {
if ($variables instanceof Paginator) {
$variables = $this->paginatorToArray($variables);
} elseif (is_object($variables)) {
}
elseif (is_object($variables)) {
$variables = $this->objectToArray($variables);
} else {
}
else {
$variables = [$variables];
}
}
@ -220,12 +225,15 @@ class DebugExtension extends Twig_Extension
{
if ($this->variablePrefix === true) {
$output = '{{ <span>%s</span> }}';
} elseif (is_array($this->variablePrefix)) {
}
elseif (is_array($this->variablePrefix)) {
$prefix = implode('.', $this->variablePrefix);
$output = '{{ <span>'.$prefix.'.%s</span> }}';
} elseif ($this->variablePrefix) {
}
elseif ($this->variablePrefix) {
$output = '{{ <span>'.$this->variablePrefix.'.%s</span> }}';
} else {
}
else {
$output = '%s';
}
@ -279,11 +287,14 @@ class DebugExtension extends Twig_Extension
if ($variable instanceof ComponentBase) {
$label = '<strong>Component</strong>';
} elseif ($variable instanceof Collection) {
}
elseif ($variable instanceof Collection) {
$label = 'Collection('.$variable->count().')';
} elseif ($variable instanceof Paginator) {
}
elseif ($variable instanceof Paginator) {
$label = 'Paged Collection('.$variable->count().')';
} elseif ($variable instanceof Model) {
}
elseif ($variable instanceof Model) {
$label = 'Model';
}

View File

@ -43,7 +43,8 @@ class FlashNode extends Twig_Node
->outdent()
->write('}'.PHP_EOL)
;
} else {
}
else {
$compiler
->addDebugInfo($this)
->write('$context["type"] = ')

View File

@ -27,7 +27,8 @@ class FlashTokenParser extends Twig_TokenParser
if ($token = $stream->nextIf(Twig_Token::NAME_TYPE)) {
$name = $token->getValue();
} else {
}
else {
$name = 'all';
}
$stream->expect(Twig_Token::BLOCK_END_TYPE);

View File

@ -54,7 +54,8 @@ class PlaceholderNode extends Twig_Node
$compiler->addDebugInfo($this);
if (!$isText) {
$compiler->write("echo \$this->env->getExtension('CMS')->displayBlock(");
} else {
}
else {
$compiler->write("echo twig_escape_filter(\$this->env, \$this->env->getExtension('CMS')->displayBlock(");
}
@ -67,7 +68,8 @@ class PlaceholderNode extends Twig_Node
if (!$isText) {
$compiler->raw(";\n");
} else {
}
else {
$compiler->raw(");\n");
}

View File

@ -43,7 +43,8 @@ class PlaceholderTokenParser extends Twig_TokenParser
$body = $this->parser->subparse([$this, 'decidePlaceholderEnd'], true);
$stream->expect(Twig_Token::BLOCK_END_TYPE);
} else {
}
else {
$params = $this->loadParams($stream);
}

View File

@ -175,7 +175,8 @@ class AssetList extends WidgetBase
['name'=>$path]
));
}
} else {
}
else {
$empty = File::isDirectoryEmpty($fullPath);
if ($empty === false) {
throw new ApplicationException(Lang::get(
@ -197,7 +198,8 @@ class AssetList extends WidgetBase
}
}
}
} catch (Exception $ex) {
}
catch (Exception $ex) {
$error = $ex->getMessage();
}
@ -367,7 +369,8 @@ class AssetList extends WidgetBase
['file'=>$basename]
));
}
} elseif (is_dir($originalFullPath)) {
}
elseif (is_dir($originalFullPath)) {
if (!@File::copyDirectory($originalFullPath, $newFullPath)) {
throw new ApplicationException(Lang::get(
'cms::lang.asset.error_moving_directory',
@ -538,7 +541,8 @@ class AssetList extends WidgetBase
'name' => $node->getFilename(),
'editable' => false
];
} elseif ($node->isFile()) {
}
elseif ($node->isFile()) {
$files[] = (object)[
'type' => 'file',
'path' => File::normalizePath($this->getRelativePath($node->getPathname())),
@ -704,7 +708,8 @@ class AssetList extends WidgetBase
$uploadedFile->move($this->getCurrentPath(), $uploadedFile->getClientOriginalName());
die('success');
} catch (Exception $ex) {
}
catch (Exception $ex) {
$message = $fileName !== null
? Lang::get('cms::lang.asset.error_uploading_file', ['name' => $fileName, 'error' => $ex->getMessage()])
: $ex->getMessage();

View File

@ -176,7 +176,8 @@ class TemplateList extends WidgetBase
$filteredItems[] = $item;
}
}
} else {
}
else {
$filteredItems = $normalizedItems;
}
@ -198,7 +199,8 @@ class TemplateList extends WidgetBase
}
$foundGroups[$group]->items[] = $itemData;
} else {
}
else {
$result[] = $itemData;
}
}
@ -283,7 +285,8 @@ class TemplateList extends WidgetBase
if (Str::contains(Str::lower($item->title), $word)) {
return true;
}
} elseif (Str::contains(Str::lower($item->fileName), $word)) {
}
elseif (Str::contains(Str::lower($item->fileName), $word)) {
return true;
}

View File

@ -336,7 +336,8 @@ if (window.jQuery === undefined)
try {
return JSON.parse(JSON.stringify(eval("({" + value + "})")))
} catch (e) {
}
catch (e) {
throw new Error('Error parsing the '+name+' attribute value. '+e)
}
}

View File

@ -178,7 +178,8 @@ class CombineAssets
{
if ($extension === null) {
$this->aliases = [];
} else {
}
else {
$this->aliases[$extension] = [];
}
@ -194,9 +195,11 @@ class CombineAssets
{
if ($extension === null) {
return $this->aliases;
} elseif (isset($this->aliases[$extension])) {
}
elseif (isset($this->aliases[$extension])) {
return $this->aliases[$extension];
} else {
}
else {
return null;
}
}
@ -238,7 +241,8 @@ class CombineAssets
{
if ($extension === null) {
$this->filters = [];
} else {
}
else {
$this->filters[$extension] = [];
}
@ -254,9 +258,11 @@ class CombineAssets
{
if ($extension === null) {
return $this->filters;
} elseif (isset($this->filters[$extension])) {
}
elseif (isset($this->filters[$extension])) {
return $this->filters[$extension];
} else {
}
else {
return null;
}
}
@ -316,7 +322,8 @@ class CombineAssets
if (count($combineCss) > count($combineJs)) {
$extension = 'css';
$assets = $combineCss;
} else {
}
else {
$extension = 'js';
$assets = $combineJs;
}
@ -373,7 +380,8 @@ class CombineAssets
if ($actionExists) {
return URL::action($combineAction, [$outputFilename], false);
} else {
}
else {
return Request::getBasePath().'/combine/'.$outputFilename;
}
}

View File

@ -33,7 +33,8 @@ class Controller extends BaseController
$combiner = new CombineAssets;
return $combiner->getContents($cacheId);
} catch (Exception $ex) {
}
catch (Exception $ex) {
return '/* '.$ex->getMessage().' */';
}
}

View File

@ -63,11 +63,13 @@ class ErrorHandler
if ($proposedException instanceof BaseException) {
$exception = $proposedException;
// If there is an active mask prepared, use that.
} elseif (static::$activeMask !== null) {
}
elseif (static::$activeMask !== null) {
$exception = static::$activeMask;
$exception->setMask($proposedException);
// Otherwise we should mask it with our own default scent.
} else {
}
else {
$exception = new ApplicationException($proposedException->getMessage(), 0);
$exception->setMask($proposedException);
}
@ -100,7 +102,8 @@ class ErrorHandler
{
if (count(static::$maskLayers) > 0) {
static::$activeMask = array_pop(static::$maskLayers);
} else {
}
else {
static::$activeMask = null;
}
}

View File

@ -320,13 +320,17 @@ class ExceptionBase extends Exception
foreach ($argument as $index => $obj) {
if (is_array($obj)) {
$value = 'array('.count($obj).')';
} elseif (is_object($obj)) {
}
elseif (is_object($obj)) {
$value = 'object('.get_class($obj).')';
} elseif (is_integer($obj)) {
}
elseif (is_integer($obj)) {
$value = $obj;
} elseif ($obj === null) {
}
elseif ($obj === null) {
$value = "null";
} else {
}
else {
$value = "'".$obj."'";
}
@ -335,16 +339,21 @@ class ExceptionBase extends Exception
if (count($items)) {
$arg = 'array(' . count($argument) . ') [' . implode(', ', $items) . ']';
} else {
}
else {
$arg = 'array(0)';
}
} elseif (is_object($argument)) {
}
elseif (is_object($argument)) {
$arg = 'object('.get_class($argument).')';
} elseif ($argument === null) {
}
elseif ($argument === null) {
$arg = "null";
} elseif (is_integer($argument)) {
}
elseif (is_integer($argument)) {
$arg = $argument;
} else {
}
else {
$arg = "'".$argument."'";
}

View File

@ -310,7 +310,8 @@ class MarkupManager
if ($replaceWith) {
$isWild = $callable;
$isWild[0] = str_replace('*', $replaceWith, $callable[0]);
} else {
}
else {
$isWild = true;
}
}
@ -319,7 +320,8 @@ class MarkupManager
if ($replaceWith) {
$isWild = $isWild ?: $callable;
$isWild[1] = str_replace('*', $replaceWith, $callable[1]);
} else {
}
else {
$isWild = true;
}
}

View File

@ -390,7 +390,8 @@ class PluginManager
if (File::exists($path)) {
$disabled = json_decode(File::get($path), true);
$this->disabledPlugins = array_merge($this->disabledPlugins, $disabled);
} else {
}
else {
$this->writeDisabled();
}
}
@ -485,14 +486,16 @@ class PluginManager
foreach ($required as $require) {
if (!$this->hasPlugin($require)) {
$disable = true;
} elseif (($pluginObj = $this->findByIdentifier($require)) && $pluginObj->disabled) {
}
elseif (($pluginObj = $this->findByIdentifier($require)) && $pluginObj->disabled) {
$disable = true;
}
}
if ($disable) {
$this->disablePlugin($id);
} else {
}
else {
$this->enablePlugin($id);
}
}

View File

@ -234,7 +234,8 @@ class SettingsManager
list($author, $plugin) = explode('.', $owner);
$uri[] = strtolower($author);
$uri[] = strtolower($plugin);
} else {
}
else {
$uri[] = strtolower($owner);
}

View File

@ -161,7 +161,8 @@ class UpdateManager
try {
$result = $this->requestUpdateList();
$newCount = array_get($result, 'update', 0);
} catch (Exception $ex) {
}
catch (Exception $ex) {
$newCount = 0;
}
@ -594,7 +595,8 @@ class UpdateManager
try {
$resultData = @json_decode($result->body, true);
} catch (Exception $ex) {
}
catch (Exception $ex) {
throw new ApplicationException(Lang::get('system::lang.server.response_invalid'));
}

View File

@ -103,7 +103,8 @@ class VersionManager
if (is_array($details)) {
$comment = array_shift($details);
$scripts = $details;
} else {
}
else {
$comment = $details;
$scripts = [];
}
@ -148,7 +149,8 @@ class VersionManager
foreach ($pluginHistory as $history) {
if ($history->type == self::HISTORY_TYPE_COMMENT) {
$this->removeDatabaseComment($code, $history->version);
} elseif ($history->type == self::HISTORY_TYPE_SCRIPT) {
}
elseif ($history->type == self::HISTORY_TYPE_SCRIPT) {
$this->removeDatabaseScript($code, $history->version, $history->detail);
}
}
@ -296,12 +298,14 @@ class VersionManager
'version' => $version,
'created_at' => new Carbon
]);
} elseif ($version && $currentVersion) {
}
elseif ($version && $currentVersion) {
Db::table('system_plugin_versions')->where('code', $code)->update([
'version' => $version,
'created_at' => new Carbon
]);
} elseif ($currentVersion) {
}
elseif ($currentVersion) {
Db::table('system_plugin_versions')->where('code', $code)->delete();
}

View File

@ -55,8 +55,9 @@ class CacheClear extends ClearCommand
$command = App::make('System\Console\CacheClear');
$command->setLaravel(App::make('app'));
$command->fire();
} catch (\Exception $ex) {
}
catch (\Exception $ex) {
// Do nothing
}
}
}

View File

@ -61,7 +61,8 @@ class OctoberUpdate extends Command
if ($updates == 0) {
$this->output->writeln('<info>No new updates found</info>');
return;
} else {
}
else {
$this->output->writeln(sprintf('<info>Found %s new %s!</info>', $updates, Str::plural('update', $updates)));
}

View File

@ -114,7 +114,8 @@ class OctoberUtil extends Command
if ($totalCount > 0) {
$this->comment(sprintf('Successfully deleted %s thumbs', $totalCount));
} else {
}
else {
$this->comment('No thumbs found to delete');
}
}

View File

@ -77,7 +77,8 @@ class MailTemplates extends Controller
});
Flash::success('The test message has been successfully sent.');
} catch (Exception $ex) {
}
catch (Exception $ex) {
Flash::error($ex->getMessage());
}
}

View File

@ -75,7 +75,8 @@ class Settings extends Controller
$model = $this->createModel($item);
$this->initWidgets($model);
} catch (Exception $ex) {
}
catch (Exception $ex) {
$this->handleError($ex);
}
}

View File

@ -166,7 +166,8 @@ class Updates extends Controller
$this->vars['hasUpdates'] = array_get($result, 'hasUpdates', false);
$this->vars['pluginList'] = array_get($result, 'plugins', []);
$this->vars['themeList'] = array_get($result, 'themes', []);
} catch (Exception $ex) {
}
catch (Exception $ex) {
$this->handleError($ex);
}
@ -212,7 +213,8 @@ class Updates extends Controller
];
$this->vars['updateSteps'] = $updateSteps;
} catch (Exception $ex) {
}
catch (Exception $ex) {
$this->handleError($ex);
}
@ -253,7 +255,8 @@ class Updates extends Controller
];
$this->vars['updateSteps'] = $updateSteps;
} catch (Exception $ex) {
}
catch (Exception $ex) {
$this->handleError($ex);
}
@ -371,7 +374,8 @@ class Updates extends Controller
]);
return $this->onForceUpdate();
} catch (Exception $ex) {
}
catch (Exception $ex) {
$this->handleError($ex);
return $this->makePartial('project_form');
}
@ -430,7 +434,8 @@ class Updates extends Controller
$this->vars['updateSteps'] = $updateSteps;
return $this->makePartial('execute');
} catch (Exception $ex) {
}
catch (Exception $ex) {
$this->handleError($ex);
return $this->makePartial('plugin_form');
}
@ -502,7 +507,8 @@ class Updates extends Controller
{
try {
$this->vars['checked'] = post('checked');
} catch (Exception $ex) {
}
catch (Exception $ex) {
$this->handleError($ex);
}
return $this->makePartial('disable_form');
@ -522,7 +528,8 @@ class Updates extends Controller
if ($disable) {
$manager->disablePlugin($object->code, true);
} else {
}
else {
$manager->enablePlugin($object->code, true);
}
@ -534,7 +541,8 @@ class Updates extends Controller
if ($disable) {
Flash::success(Lang::get('system::lang.plugins.disable_success'));
} else {
}
else {
Flash::success(Lang::get('system::lang.plugins.enable_success'));
}

View File

@ -98,11 +98,10 @@
success: function(data){
setTimeout(function() { deferred.resolve() }, 600)
if (step.code == 'completeUpdate' || step.code == 'completeInstall') {
if (step.code == 'completeUpdate' || step.code == 'completeInstall')
this.success(data)
} else {
else
setLoadingBar(false)
}
},
error: function(data){
setLoadingBar(false)
@ -121,12 +120,10 @@
var loadingBar = $('#executeLoadingBar'),
messageDiv = $('#executeMessage')
if (state) {
if (state)
loadingBar.removeClass('bar-loaded')
}
else {
else
loadingBar.addClass('bar-loaded')
}
if (message)
messageDiv.text(message)

View File

@ -29,7 +29,8 @@ class File extends FileBase
$uploadsDir = Config::get('cms.uploadsDir');
if ($this->isPublic()) {
return base_path() . $uploadsDir . '/public/';
} else {
}
else {
return base_path() . $uploadsDir . '/protected/';
}
}
@ -42,7 +43,8 @@ class File extends FileBase
$uploadsDir = Config::get('cms.uploadsDir');
if ($this->isPublic()) {
return Request::getBasePath() . $uploadsDir . '/public/';
} else {
}
else {
return Request::getBasePath() . $uploadsDir . '/protected/';
}
}

View File

@ -61,7 +61,8 @@ class MailSettings extends Model
if ($settings->smtp_authorization) {
$config->set('mail.username', $settings->smtp_user);
$config->set('mail.password', $settings->smtp_password);
} else {
}
else {
$config->set('mail.username', null);
$config->set('mail.password', null);
}
@ -76,5 +77,6 @@ class MailSettings extends Model
$config->set('services.mailgun.secret', $settings->mailgun_secret);
break;
}
}
}

View File

@ -107,7 +107,8 @@ class MailTemplate extends Model
}
self::$cache[$code] = $template;
} else {
}
else {
$template = self::$cache[$code];
}

View File

@ -58,7 +58,8 @@ class PluginVersion extends Model
if ($this->is_disabled) {
$manager->disablePlugin($this->code, true);
} else {
}
else {
$manager->enablePlugin($this->code, true);
}
@ -67,7 +68,8 @@ class PluginVersion extends Model
if (($configDisabled = Config::get('cms.disablePlugins')) && is_array($configDisabled)) {
$this->disabledByConfig = in_array($this->code, $configDisabled);
}
} else {
}
else {
$this->name = $this->code;
$this->description = Lang::get('system::lang.plugins.unknown_plugin');
$this->orphaned = true;

View File

@ -47,7 +47,8 @@ class RequestLog extends Model
if (!$record->exists) {
$record->count = 1;
$record->save();
} else {
}
else {
$record->increment('count');
}

View File

@ -20,7 +20,8 @@ class Status extends ReportWidgetBase
{
try {
$this->loadData();
} catch (Exception $ex) {
}
catch (Exception $ex) {
$this->vars['error'] = $ex->getMessage();
}

View File

@ -270,7 +270,8 @@ trait AssetMaker
if ($build == 'core') {
$build = 'v' . Parameters::get('system::core.build', 1);
} elseif ($pluginVersion = PluginVersion::getVersion($build)) {
}
elseif ($pluginVersion = PluginVersion::getVersion($build)) {
$build = 'v' . $pluginVersion;
}

View File

@ -33,19 +33,22 @@ trait ConfigMaker
*/
if (is_object($configFile)) {
$config = $configFile;
}
/*
* Embedded config
*/
} elseif (is_array($configFile)) {
elseif (is_array($configFile)) {
$config = $this->makeConfigFromArray($configFile);
}
/*
* Process config from file contents
*/
} else {
else {
if (isset($this->controller) && method_exists($this->controller, 'getConfigPath')) {
$configFile = $this->controller->getConfigPath($configFile);
} else {
}
else {
$configFile = $this->getConfigPath($configFile);
}

View File

@ -74,7 +74,8 @@ class Loader implements Twig_LoaderInterface
try {
$this->findTemplate($name);
return true;
} catch (Exception $exception) {
}
catch (Exception $exception) {
return false;
}
}