parent
cc7d595fff
commit
a59d3b83eb
|
|
@ -69,6 +69,8 @@ Please ensure that your Pull Request satisfies the following coding standards:
|
|||
- [PSR 1 Coding Style Guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md)
|
||||
- [PSR 0 Coding Style Guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md)
|
||||
|
||||
To validate your changes against our coding standards, you may run `./vendor/bin/phpcs -nq --extensions="php"` in your development folder.
|
||||
|
||||
#### Team rules
|
||||
|
||||
The October team follows the [developer guidelines](https://octobercms.com/docs/help/developer-guide) as much as possible.
|
||||
|
|
|
|||
|
|
@ -159,7 +159,9 @@ class FormController extends ControllerBehavior
|
|||
|
||||
$this->formWidget->bindEvent('form.beforeRefresh', function ($holder) {
|
||||
$result = $this->controller->formExtendRefreshData($this->formWidget, $holder->data);
|
||||
if (is_array($result)) $holder->data = $result;
|
||||
if (is_array($result)) {
|
||||
$holder->data = $result;
|
||||
}
|
||||
});
|
||||
|
||||
$this->formWidget->bindEvent('form.refreshFields', function ($fields) {
|
||||
|
|
|
|||
|
|
@ -886,7 +886,6 @@ class RelationController extends ControllerBehavior
|
|||
* Form
|
||||
*/
|
||||
elseif ($this->manageMode == 'form') {
|
||||
|
||||
if (!$config = $this->makeConfigForMode('manage', 'form', false)) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1205,7 +1204,6 @@ class RelationController extends ControllerBehavior
|
|||
* Add
|
||||
*/
|
||||
if ($this->viewMode == 'multi') {
|
||||
|
||||
$checkedIds = $recordId ? [$recordId] : post('checked');
|
||||
|
||||
if (is_array($checkedIds)) {
|
||||
|
|
@ -1221,14 +1219,12 @@ class RelationController extends ControllerBehavior
|
|||
$this->relationObject->add($model, $sessionKey);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Link
|
||||
*/
|
||||
elseif ($this->viewMode == 'single') {
|
||||
if ($recordId && ($model = $this->relationModel->find($recordId))) {
|
||||
|
||||
$this->relationObject->add($model, $sessionKey);
|
||||
$this->viewWidget->setFormValues($model->attributes);
|
||||
|
||||
|
|
@ -1242,7 +1238,6 @@ class RelationController extends ControllerBehavior
|
|||
$parentModel->save();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1264,7 +1259,6 @@ class RelationController extends ControllerBehavior
|
|||
* Remove
|
||||
*/
|
||||
if ($this->viewMode == 'multi') {
|
||||
|
||||
$checkedIds = $recordId ? [$recordId] : post('checked');
|
||||
|
||||
if (is_array($checkedIds)) {
|
||||
|
|
@ -1707,7 +1701,8 @@ class RelationController extends ControllerBehavior
|
|||
*
|
||||
* @return \Backend\Classes\WidgetBase
|
||||
*/
|
||||
public function relationGetManageWidget() {
|
||||
public function relationGetManageWidget()
|
||||
{
|
||||
return $this->manageWidget;
|
||||
}
|
||||
|
||||
|
|
@ -1716,7 +1711,8 @@ class RelationController extends ControllerBehavior
|
|||
*
|
||||
* @return \Backend\Classes\WidgetBase
|
||||
*/
|
||||
public function relationGetViewWidget() {
|
||||
public function relationGetViewWidget()
|
||||
{
|
||||
return $this->viewWidget;
|
||||
}
|
||||
}
|
||||
|
|
@ -231,7 +231,6 @@ class Controller extends ControllerBase
|
|||
* Check that user is logged in and has permission to view this page
|
||||
*/
|
||||
if (!$isPublicAction) {
|
||||
|
||||
/*
|
||||
* Not logged in, redirect to login screen or show ajax error.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -688,7 +688,6 @@ class FormField
|
|||
* relation value, all others will look up the relation object as normal.
|
||||
*/
|
||||
foreach ($keyParts as $key) {
|
||||
|
||||
if ($result instanceof Model && $result->hasRelation($key)) {
|
||||
if ($key == $lastField) {
|
||||
$result = $result->getRelationValue($key) ?: $default;
|
||||
|
|
@ -709,7 +708,6 @@ class FormField
|
|||
}
|
||||
$result = $result->{$key};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
|
|
|||
|
|
@ -222,7 +222,8 @@ class FormTabs implements IteratorAggregate, ArrayAccess
|
|||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->suppressTabs
|
||||
return new ArrayIterator(
|
||||
$this->suppressTabs
|
||||
? $this->getAllFields()
|
||||
: $this->getFields()
|
||||
);
|
||||
|
|
|
|||
|
|
@ -149,5 +149,4 @@ abstract class FormWidgetBase extends WidgetBase
|
|||
|
||||
return $this->formField->getValueFromData($this->data ?: $this->model, $defaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,9 @@ class NavigationManager
|
|||
*/
|
||||
$orderCount = 0;
|
||||
foreach ($item->sideMenu as $sideMenuItem) {
|
||||
if ($sideMenuItem->order !== -1) continue;
|
||||
if ($sideMenuItem->order !== -1) {
|
||||
continue;
|
||||
}
|
||||
$sideMenuItem->order = ($orderCount += 100);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ class Files extends Controller
|
|||
try {
|
||||
return $this->findFileObject($code)->output('inline', true);
|
||||
}
|
||||
catch (Exception $ex) {}
|
||||
catch (Exception $ex) {
|
||||
}
|
||||
|
||||
return Response::make(View::make('backend::404'), 404);
|
||||
}
|
||||
|
|
@ -48,7 +49,8 @@ class Files extends Controller
|
|||
true
|
||||
);
|
||||
}
|
||||
catch (Exception $ex) {}
|
||||
catch (Exception $ex) {
|
||||
}
|
||||
|
||||
return Response::make(View::make('backend::404'), 404);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,8 @@ class DbBackendUserRoles extends Migration
|
|||
'permissions' => $group->permissions ?? null
|
||||
]);
|
||||
}
|
||||
catch (Exception $ex) {}
|
||||
catch (Exception $ex) {
|
||||
}
|
||||
|
||||
$permissions[$group->id] = $group->permissions ?? null;
|
||||
}
|
||||
|
|
@ -130,7 +131,8 @@ class DbBackendUserRoles extends Migration
|
|||
$perms = json_decode($permString, true);
|
||||
$userPerms = array_merge($userPerms, $perms);
|
||||
}
|
||||
catch (Exception $ex) {}
|
||||
catch (Exception $ex) {
|
||||
}
|
||||
}
|
||||
|
||||
if (count($userPerms) > 0) {
|
||||
|
|
@ -157,6 +159,7 @@ class DbBackendUserRoles extends Migration
|
|||
'permissions' => json_encode($newPerms)
|
||||
]);
|
||||
}
|
||||
catch (Exception $ex) {}
|
||||
catch (Exception $ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,5 +215,4 @@ class CodeEditor extends FormWidgetBase
|
|||
$this->displayIndentGuides = $preferences->editor_display_indent_guides;
|
||||
$this->showPrintMargin = $preferences->editor_show_print_margin;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,5 +192,4 @@ class DataTable extends FormWidgetBase
|
|||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ class NestedForm extends FormWidgetBase
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function init() {
|
||||
public function init()
|
||||
{
|
||||
$this->fillFromConfig([
|
||||
'form',
|
||||
'usePanelStyles',
|
||||
|
|
@ -62,13 +63,14 @@ class NestedForm extends FormWidgetBase
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
function render()
|
||||
public function render()
|
||||
{
|
||||
$this->prepareVars();
|
||||
return $this->makePartial('nestedform');
|
||||
}
|
||||
|
||||
function prepareVars() {
|
||||
public function prepareVars()
|
||||
{
|
||||
$this->formWidget->previewMode = $this->previewMode;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,8 +217,8 @@ class RichEditor extends FormWidgetBase
|
|||
|
||||
$iterator = function ($links, $level = 0) use (&$iterator) {
|
||||
$result = [];
|
||||
foreach ($links as $linkUrl => $link) {
|
||||
|
||||
foreach ($links as $linkUrl => $link) {
|
||||
/*
|
||||
* Remove scheme and host from URL
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -198,9 +198,10 @@ class TagList extends FormWidgetBase
|
|||
protected function getSeparatorCharacter()
|
||||
{
|
||||
switch (strtolower($this->separator)) {
|
||||
case 'comma': return ',';
|
||||
case 'space': return ' ';
|
||||
case 'comma':
|
||||
return ',';
|
||||
case 'space':
|
||||
return ' ';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,5 +156,4 @@ class Backend
|
|||
|
||||
return '<time'.Html::attributes($attributes).'>'.e($defaultValue).'</time>'.PHP_EOL;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,5 +181,4 @@ class BrandSetting extends Model
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,7 +174,9 @@ abstract class ImportModel extends Model
|
|||
*/
|
||||
protected function decodeArrayValue($value, $delimeter = '|')
|
||||
{
|
||||
if (strpos($value, $delimeter) === false) return [$value];
|
||||
if (strpos($value, $delimeter) === false) {
|
||||
return [$value];
|
||||
}
|
||||
|
||||
$data = preg_split('~(?<!\\\)' . preg_quote($delimeter, '~') . '~', $value);
|
||||
$newData = [];
|
||||
|
|
|
|||
|
|
@ -275,7 +275,6 @@ class Preference extends Model
|
|||
|
||||
// Iterate through the themes
|
||||
foreach ($themeDir as $node) {
|
||||
|
||||
// If this file is a theme (starting by "theme-")
|
||||
if (!$node->isDir() && substr($node->getFileName(), 0, 6) == 'theme-') {
|
||||
// Remove the theme- prefix and the .js suffix, create an user friendly and capitalized name
|
||||
|
|
@ -287,7 +286,6 @@ class Preference extends Model
|
|||
$themes[$themeId] = $themeName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Sort the theme alphabetically, and push the default theme
|
||||
|
|
|
|||
|
|
@ -98,5 +98,4 @@ trait FormModelWidget
|
|||
list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);
|
||||
return $model->getRelationType($attribute);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -408,7 +408,6 @@ class Form extends WidgetBase
|
|||
* If an array of fields is supplied, update specified fields individually.
|
||||
*/
|
||||
if (($updateFields = post('fields')) && is_array($updateFields)) {
|
||||
|
||||
foreach ($updateFields as $field) {
|
||||
if (!isset($this->allFields[$field])) {
|
||||
continue;
|
||||
|
|
@ -686,7 +685,6 @@ class Form extends WidgetBase
|
|||
public function addFields(array $fields, $addToArea = null)
|
||||
{
|
||||
foreach ($fields as $name => $config) {
|
||||
|
||||
$fieldObj = $this->makeFormField($name, $config);
|
||||
$fieldTab = is_array($config) ? array_get($config, 'tab') : null;
|
||||
|
||||
|
|
@ -875,8 +873,8 @@ class Form extends WidgetBase
|
|||
* Get field options from model
|
||||
*/
|
||||
$optionModelTypes = ['dropdown', 'radio', 'checkboxlist', 'balloon-selector'];
|
||||
if (in_array($field->type, $optionModelTypes, false)) {
|
||||
|
||||
if (in_array($field->type, $optionModelTypes, false)) {
|
||||
/*
|
||||
* Defer the execution of option data collection
|
||||
*/
|
||||
|
|
@ -961,7 +959,9 @@ class Form extends WidgetBase
|
|||
if (isset($field->config['options'])) {
|
||||
$field->options(function () use ($field) {
|
||||
$fieldOptions = $field->config['options'];
|
||||
if ($fieldOptions === true) $fieldOptions = null;
|
||||
if ($fieldOptions === true) {
|
||||
$fieldOptions = null;
|
||||
}
|
||||
$fieldOptions = $this->getOptionsFromModel($field, $fieldOptions);
|
||||
return $fieldOptions;
|
||||
});
|
||||
|
|
@ -1092,7 +1092,8 @@ class Form extends WidgetBase
|
|||
* Checks if default values should be taken from data.
|
||||
* This should be done when model exists or when explicitly configured
|
||||
*/
|
||||
protected function shouldFetchDefaultValues() {
|
||||
protected function shouldFetchDefaultValues()
|
||||
{
|
||||
$enableDefaults = object_get($this->config, 'enableDefaults');
|
||||
if ($enableDefaults === false) {
|
||||
return false;
|
||||
|
|
@ -1171,7 +1172,6 @@ class Form extends WidgetBase
|
|||
*/
|
||||
$parts = HtmlHelper::nameToArray($field->fieldName);
|
||||
if (($value = $this->dataArrayGet($data, $parts)) !== null) {
|
||||
|
||||
/*
|
||||
* Number fields should be converted to integers
|
||||
*/
|
||||
|
|
@ -1261,7 +1261,6 @@ class Form extends WidgetBase
|
|||
* Refer to the model method or any of its behaviors
|
||||
*/
|
||||
if (!is_array($fieldOptions) && !$fieldOptions) {
|
||||
|
||||
try {
|
||||
list($model, $attribute) = $field->resolveModelAttribute($this->model, $field->fieldName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1091,10 +1091,14 @@ class MediaManager extends WidgetBase
|
|||
}
|
||||
|
||||
switch ($itemType) {
|
||||
case MediaLibraryItem::FILE_TYPE_IMAGE: return "icon-picture-o";
|
||||
case MediaLibraryItem::FILE_TYPE_VIDEO: return "icon-video-camera";
|
||||
case MediaLibraryItem::FILE_TYPE_AUDIO: return "icon-volume-up";
|
||||
default: return "icon-file";
|
||||
case MediaLibraryItem::FILE_TYPE_IMAGE:
|
||||
return "icon-picture-o";
|
||||
case MediaLibraryItem::FILE_TYPE_VIDEO:
|
||||
return "icon-video-camera";
|
||||
case MediaLibraryItem::FILE_TYPE_AUDIO:
|
||||
return "icon-volume-up";
|
||||
default:
|
||||
return "icon-file";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -423,7 +423,6 @@ class ReportContainer extends WidgetBase
|
|||
|
||||
$result[] = $property;
|
||||
foreach ($properties as $name => $params) {
|
||||
|
||||
$property = [
|
||||
'property' => $name,
|
||||
'title' => isset($params['title']) ? Lang::get($params['title']) : $name,
|
||||
|
|
|
|||
|
|
@ -138,9 +138,8 @@ class Table extends WidgetBase
|
|||
$isClientDataSource = $this->isClientDataSource();
|
||||
|
||||
$this->vars['clientDataSourceClass'] = $isClientDataSource ? 'client' : 'server';
|
||||
$this->vars['data'] = json_encode($isClientDataSource
|
||||
? $this->dataSource->getAllRecords()
|
||||
: []
|
||||
$this->vars['data'] = json_encode(
|
||||
$isClientDataSource ? $this->dataSource->getAllRecords() : []
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -171,13 +170,15 @@ class Table extends WidgetBase
|
|||
foreach ($this->columns as $key => $data) {
|
||||
$data['key'] = $key;
|
||||
|
||||
if (isset($data['title']))
|
||||
if (isset($data['title'])) {
|
||||
$data['title'] = trans($data['title']);
|
||||
}
|
||||
|
||||
if (isset($data['options'])) {
|
||||
foreach ($data['options'] as &$option)
|
||||
foreach ($data['options'] as &$option) {
|
||||
$option = trans($option);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($data['validation'])) {
|
||||
foreach ($data['validation'] as &$validation) {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ class Toolbar extends WidgetBase
|
|||
* Prepare the search widget (optional)
|
||||
*/
|
||||
if (isset($this->search)) {
|
||||
|
||||
if (is_string($this->search)) {
|
||||
$searchConfig = $this->makeConfig(['partial' => $this->search]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,7 +255,9 @@ class AutoDatasource extends Datasource implements DatasourceInterface
|
|||
}
|
||||
|
||||
// Filter out 'deleted' paths:
|
||||
$paths = array_filter($paths, function ($value) { return (bool) $value; });
|
||||
$paths = array_filter($paths, function ($value) {
|
||||
return (bool) $value;
|
||||
});
|
||||
|
||||
// Return just an array of paths
|
||||
return array_keys($paths);
|
||||
|
|
|
|||
|
|
@ -237,7 +237,6 @@ class CmsCompoundObject extends CmsObject
|
|||
$componentName = $componentManager->resolve($componentName);
|
||||
|
||||
foreach ($this->settings['components'] as $sectionName => $values) {
|
||||
|
||||
$result = $sectionName;
|
||||
|
||||
if ($sectionName == $componentName) {
|
||||
|
|
@ -257,7 +256,6 @@ class CmsCompoundObject extends CmsObject
|
|||
if ($sectionName == $componentName) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -19,11 +19,9 @@ class CmsObjectCollection extends CollectionBase
|
|||
public function withComponent($components, $callback = null)
|
||||
{
|
||||
return $this->filter(function ($object) use ($components, $callback) {
|
||||
|
||||
$hasComponent = false;
|
||||
|
||||
foreach ((array) $components as $componentName) {
|
||||
|
||||
if (!$callback && $object->hasComponent($componentName)) {
|
||||
$hasComponent = true;
|
||||
}
|
||||
|
|
@ -73,7 +71,6 @@ class CmsObjectCollection extends CollectionBase
|
|||
$hasComponent = false;
|
||||
|
||||
foreach ((array) $components as $componentName) {
|
||||
|
||||
if (!$componentAlias = $object->hasComponent($componentName)) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -101,5 +98,4 @@ class CmsObjectCollection extends CollectionBase
|
|||
return $hasComponent;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -306,7 +306,8 @@ abstract class ComponentBase extends Extendable
|
|||
try {
|
||||
return parent::__call($method, $parameters);
|
||||
}
|
||||
catch (BadMethodCallException $ex) {}
|
||||
catch (BadMethodCallException $ex) {
|
||||
}
|
||||
|
||||
if (method_exists($this->controller, $method)) {
|
||||
return call_user_func_array([$this->controller, $method], $parameters);
|
||||
|
|
|
|||
|
|
@ -75,8 +75,9 @@ class ComponentHelpers
|
|||
}
|
||||
}
|
||||
|
||||
if ($returnArray)
|
||||
if ($returnArray) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
return json_encode($result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,5 +70,4 @@ class Content extends CmsCompoundObject
|
|||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -841,7 +841,6 @@ class Controller
|
|||
* Process Component handler
|
||||
*/
|
||||
if (strpos($handler, '::')) {
|
||||
|
||||
list($componentName, $handlerName) = explode('::', $handler);
|
||||
$componentObj = $this->findComponentByName($componentName);
|
||||
|
||||
|
|
@ -965,7 +964,6 @@ class Controller
|
|||
* Process Component partial
|
||||
*/
|
||||
elseif (strpos($name, '::') !== false) {
|
||||
|
||||
list($componentAlias, $partialName) = explode('::', $name);
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -102,5 +102,4 @@ class MediaViewHelper
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
interface CmsObject
|
||||
{
|
||||
|
||||
/**
|
||||
* Loads the template.
|
||||
*
|
||||
|
|
@ -59,5 +58,4 @@ interface CmsObject
|
|||
* @return string
|
||||
*/
|
||||
public function getTwigCacheKey();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,9 +64,10 @@ class ThemeLogs extends Controller
|
|||
public function index_onDelete()
|
||||
{
|
||||
if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
|
||||
|
||||
foreach ($checkedIds as $recordId) {
|
||||
if (!$record = ThemeLog::find($recordId)) continue;
|
||||
if (!$record = ThemeLog::find($recordId)) {
|
||||
continue;
|
||||
}
|
||||
$record->delete();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,8 @@ class ThemeData extends Model
|
|||
try {
|
||||
CombineAssets::resetCache();
|
||||
}
|
||||
catch (Exception $ex) {}
|
||||
catch (Exception $ex) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -151,7 +152,6 @@ class ThemeData extends Model
|
|||
*/
|
||||
public function initFormFields()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -110,7 +110,6 @@ class ThemeExport extends Model
|
|||
File::deleteDirectory($tempPath);
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
|
||||
if (strlen($tempPath) && File::isDirectory($tempPath)) {
|
||||
File::deleteDirectory($tempPath);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,8 +88,7 @@ class ThemeImport extends Model
|
|||
$this->theme = $theme;
|
||||
$this->fill($data);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
$file = $this->uploaded_file()->withDeferred($sessionKey)->first();
|
||||
if (!$file) {
|
||||
throw new ApplicationException('There is no file attached to import!');
|
||||
|
|
@ -125,7 +124,6 @@ class ThemeImport extends Model
|
|||
$file->delete();
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
|
||||
if (!empty($tempPath) && File::isDirectory($tempPath)) {
|
||||
File::deleteDirectory($tempPath);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,8 @@ class ThemeLog extends Model
|
|||
try {
|
||||
$record->save();
|
||||
}
|
||||
catch (Exception $ex) {}
|
||||
catch (Exception $ex) {
|
||||
}
|
||||
|
||||
return $record;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,8 +193,9 @@ class Extension extends TwigExtension
|
|||
return $default;
|
||||
}
|
||||
|
||||
if ($event = Event::fire('cms.block.render', [$name, $result], true))
|
||||
if ($event = Event::fire('cms.block.render', [$name, $result], true)) {
|
||||
$result = $event;
|
||||
}
|
||||
|
||||
$result = str_replace('<!-- X_OCTOBER_DEFAULT_BLOCK_CONTENT -->', trim($default), $result);
|
||||
return $result;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class FrameworkNode extends TwigNode
|
|||
.'/modules/system/assets/js/framework.combined-min.js\" importance=\"low\"></script>'.PHP_EOL;" . PHP_EOL)
|
||||
->write("echo '<link rel=\"preload\" href=\"'. Request::getBasePath()
|
||||
.'/modules/system/assets/js/framework.combined-min.js\" as=\"script\" importance=\"low\">'.PHP_EOL;" . PHP_EOL)
|
||||
|
||||
->outdent()
|
||||
->write("}" . PHP_EOL)
|
||||
->write("else {" . PHP_EOL)
|
||||
|
|
@ -51,6 +52,7 @@ class FrameworkNode extends TwigNode
|
|||
.'/modules/system/assets/js/framework.js\" as=\"script\" importance=\"low\"></script>'.PHP_EOL;" . PHP_EOL)
|
||||
->write("echo '<link rel=\"preload\" href=\"'. Request::getBasePath()
|
||||
.'/modules/system/assets/js/framework.extras.js\" as=\"script\" importance=\"low\"></script>'.PHP_EOL;" . PHP_EOL)
|
||||
|
||||
->outdent()
|
||||
->write("}" . PHP_EOL)
|
||||
->write("echo '<link rel=\"stylesheet\" property=\"stylesheet\" href=\"'. Request::getBasePath()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php namespace Cms\Twig;
|
||||
|
||||
use Event;
|
||||
use Twig\Source as TwigSource;;
|
||||
use Twig\Source as TwigSource;
|
||||
use Twig\Loader\LoaderInterface as TwigLoaderInterface;
|
||||
use Cms\Contracts\CmsObject;
|
||||
use System\Twig\Loader as LoaderBase;
|
||||
|
|
|
|||
|
|
@ -205,9 +205,11 @@ class ComponentList extends WidgetBase
|
|||
|
||||
protected function updateList()
|
||||
{
|
||||
return ['#'.$this->getId('component-list') => $this->makePartial('items', [
|
||||
'items' => $this->getData()]
|
||||
)];
|
||||
return [
|
||||
'#' . $this->getId('component-list') => $this->makePartial('items', [
|
||||
'items' => $this->getData()
|
||||
])
|
||||
];
|
||||
}
|
||||
|
||||
protected function itemMatchesSearch(&$words, $item)
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ class CombineAssets
|
|||
* @param string $localPath Prefix all assets with this path (optional)
|
||||
* @return void
|
||||
*/
|
||||
public function combineToFile($assets = [], $destination, $localPath = null)
|
||||
public function combineToFile($assets, $destination, $localPath = null)
|
||||
{
|
||||
// Disable cache always
|
||||
$this->storagePath = null;
|
||||
|
|
@ -213,7 +213,9 @@ class CombineAssets
|
|||
$localPath = $localPath.'/';
|
||||
}
|
||||
$assets = array_map(function ($asset) use ($localPath) {
|
||||
if (substr($asset, 0, 1) === '@') return $asset;
|
||||
if (substr($asset, 0, 1) === '@') {
|
||||
return $asset;
|
||||
}
|
||||
return $localPath.$asset;
|
||||
}, $assets);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,9 @@ class ComposerManager
|
|||
if (file_exists($file = $dir . '/autoload_namespaces.php')) {
|
||||
$map = require $file;
|
||||
foreach ($map as $namespace => $path) {
|
||||
if (isset($this->namespacePool[$namespace])) continue;
|
||||
if (isset($this->namespacePool[$namespace])) {
|
||||
continue;
|
||||
}
|
||||
$this->loader->set($namespace, $path);
|
||||
$this->namespacePool[$namespace] = true;
|
||||
}
|
||||
|
|
@ -79,7 +81,9 @@ class ComposerManager
|
|||
if (file_exists($file = $dir . '/autoload_psr4.php')) {
|
||||
$map = require $file;
|
||||
foreach ($map as $namespace => $path) {
|
||||
if (isset($this->psr4Pool[$namespace])) continue;
|
||||
if (isset($this->psr4Pool[$namespace])) {
|
||||
continue;
|
||||
}
|
||||
$this->loader->setPsr4($namespace, $path);
|
||||
$this->psr4Pool[$namespace] = true;
|
||||
}
|
||||
|
|
@ -98,7 +102,9 @@ class ComposerManager
|
|||
$includeFiles = require $file;
|
||||
foreach ($includeFiles as $includeFile) {
|
||||
$relativeFile = $this->stripVendorDir($includeFile, $vendorPath);
|
||||
if (isset($this->includeFilesPool[$relativeFile])) continue;
|
||||
if (isset($this->includeFilesPool[$relativeFile])) {
|
||||
continue;
|
||||
}
|
||||
require $includeFile;
|
||||
$this->includeFilesPool[$relativeFile] = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,7 +192,6 @@ class MailManager
|
|||
$disableAutoInlineCss = false;
|
||||
|
||||
if ($template->layout) {
|
||||
|
||||
$disableAutoInlineCss = array_get($template->layout->options, 'disable_auto_inline_css', $disableAutoInlineCss);
|
||||
|
||||
$html = $this->renderTwig($template->layout->content_html, [
|
||||
|
|
|
|||
|
|
@ -124,7 +124,6 @@ class MarkupManager
|
|||
}
|
||||
|
||||
foreach ($definitions as $name => $definition) {
|
||||
|
||||
switch ($type) {
|
||||
case self::EXTENSION_TOKEN_PARSER:
|
||||
$this->$items[$type][] = $definition;
|
||||
|
|
@ -227,7 +226,6 @@ class MarkupManager
|
|||
}
|
||||
|
||||
foreach ($this->listFunctions() as $name => $callable) {
|
||||
|
||||
/*
|
||||
* Handle a wildcard function
|
||||
*/
|
||||
|
|
@ -261,7 +259,6 @@ class MarkupManager
|
|||
}
|
||||
|
||||
foreach ($this->listFilters() as $name => $callable) {
|
||||
|
||||
/*
|
||||
* Handle a wildcard function
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -735,8 +735,9 @@ class MediaLibrary
|
|||
*/
|
||||
protected function filterItemList(&$itemList, $filter)
|
||||
{
|
||||
if (!$filter)
|
||||
if (!$filter) {
|
||||
return;
|
||||
}
|
||||
|
||||
$result = [];
|
||||
foreach ($itemList as $item) {
|
||||
|
|
|
|||
|
|
@ -50,8 +50,9 @@ class PluginBase extends ServiceProviderBase
|
|||
|
||||
if (!array_key_exists('plugin', $configuration)) {
|
||||
throw new SystemException(sprintf(
|
||||
'The plugin configuration file plugin.yaml should contain the "plugin" section: %s.', $thisClass)
|
||||
);
|
||||
'The plugin configuration file plugin.yaml should contain the "plugin" section: %s.',
|
||||
$thisClass
|
||||
));
|
||||
}
|
||||
|
||||
return $configuration['plugin'];
|
||||
|
|
|
|||
|
|
@ -171,7 +171,6 @@ class SettingsManager
|
|||
{
|
||||
$filteredItems = [];
|
||||
foreach ($items as $categoryName => $category) {
|
||||
|
||||
$filteredCategory = [];
|
||||
foreach ($category as $item) {
|
||||
$itemContext = is_array($item->context) ? $item->context : [$item->context];
|
||||
|
|
|
|||
|
|
@ -523,7 +523,6 @@ class UpdateManager
|
|||
$this->versionManager->resetNotes()->setNotesOutput($this->notesOutput);
|
||||
|
||||
if ($this->versionManager->updatePlugin($plugin) !== false) {
|
||||
|
||||
foreach ($this->versionManager->getNotes() as $note) {
|
||||
$this->note($note);
|
||||
}
|
||||
|
|
@ -680,7 +679,9 @@ class UpdateManager
|
|||
$requestedDetails = array_intersect_key($this->productCache[$type], array_flip($codes));
|
||||
|
||||
foreach ($requestedDetails as $detail) {
|
||||
if ($detail === -1) continue;
|
||||
if ($detail === -1) {
|
||||
continue;
|
||||
}
|
||||
$result[] = $detail;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,8 @@ class OctoberInstall extends Command
|
|||
$this->writeToConfig('app', ['debug' => $debug]);
|
||||
}
|
||||
|
||||
protected function askToInstallPlugins() {
|
||||
protected function askToInstallPlugins()
|
||||
{
|
||||
$chosenToInstall = [];
|
||||
if ($this->confirm('Install the October.Drivers plugin?', false)) {
|
||||
$chosenToInstall[] = 'October.Drivers';
|
||||
|
|
|
|||
|
|
@ -198,7 +198,6 @@ class OctoberUtil extends Command
|
|||
$stub = base_path() . '/modules/system/assets/js/lang/lang.stub';
|
||||
|
||||
foreach ($locales as $locale) {
|
||||
|
||||
/*
|
||||
* Generate messages
|
||||
*/
|
||||
|
|
@ -314,7 +313,10 @@ class OctoberUtil extends Command
|
|||
{
|
||||
foreach (File::directories(plugins_path()) as $authorDir) {
|
||||
foreach (File::directories($authorDir) as $pluginDir) {
|
||||
if (!File::isDirectory($pluginDir.'/.git')) continue;
|
||||
if (!File::isDirectory($pluginDir.'/.git')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$exec = 'cd ' . $pluginDir . ' && ';
|
||||
$exec .= 'git pull 2>&1';
|
||||
echo 'Updating plugin: '. basename(dirname($pluginDir)) .'.'. basename($pluginDir) . PHP_EOL;
|
||||
|
|
@ -323,7 +325,10 @@ class OctoberUtil extends Command
|
|||
}
|
||||
|
||||
foreach (File::directories(themes_path()) as $themeDir) {
|
||||
if (!File::isDirectory($themeDir.'/.git')) continue;
|
||||
if (!File::isDirectory($themeDir.'/.git')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$exec = 'cd ' . $themeDir . ' && ';
|
||||
$exec .= 'git pull 2>&1';
|
||||
echo 'Updating theme: '. basename($themeDir) . PHP_EOL;
|
||||
|
|
@ -348,7 +353,5 @@ class OctoberUtil extends Command
|
|||
'system::project.name' => $result['name'],
|
||||
'system::project.owner' => $result['owner'],
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ class ThemeList extends Command
|
|||
}
|
||||
|
||||
if ($this->option('include-marketplace')) {
|
||||
|
||||
// @todo List everything in the marketplace - not just popular.
|
||||
|
||||
$popularThemes = $updateManager->requestPopularProducts('theme');
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ class ThemeSync extends Command
|
|||
}
|
||||
|
||||
// Confirm with the user
|
||||
if (!$this->confirmToProceed(sprintf('This will OVERWRITE the %s provided paths in "themes/%s" on the %s with content from the %s', count($validPaths), $themeName, $target, $source), function () { return true; })) {
|
||||
if (!$this->confirmToProceed(sprintf('This will OVERWRITE the %s provided paths in "themes/%s" on the %s with content from the %s', count($validPaths), $themeName, $target, $source), true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,9 +65,10 @@ class EventLogs extends Controller
|
|||
public function index_onDelete()
|
||||
{
|
||||
if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
|
||||
|
||||
foreach ($checkedIds as $recordId) {
|
||||
if (!$record = EventLog::find($recordId)) continue;
|
||||
if (!$record = EventLog::find($recordId)) {
|
||||
continue;
|
||||
}
|
||||
$record->delete();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,9 +63,10 @@ class RequestLogs extends Controller
|
|||
public function index_onDelete()
|
||||
{
|
||||
if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
|
||||
|
||||
foreach ($checkedIds as $recordId) {
|
||||
if (!$record = RequestLog::find($recordId)) continue;
|
||||
if (!$record = RequestLog::find($recordId)) {
|
||||
continue;
|
||||
}
|
||||
$record->delete();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -196,7 +196,8 @@ class Updates extends Controller
|
|||
$contents[$version] = $details;
|
||||
}
|
||||
}
|
||||
catch (Exception $ex) {}
|
||||
catch (Exception $ex) {
|
||||
}
|
||||
|
||||
uksort($contents, function ($a, $b) {
|
||||
return version_compare($b, $a);
|
||||
|
|
@ -209,7 +210,9 @@ class Updates extends Controller
|
|||
{
|
||||
$contents = null;
|
||||
foreach ($filenames as $file) {
|
||||
if (!File::exists($path . '/'.$file)) continue;
|
||||
if (!File::exists($path . '/'.$file)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$contents = File::get($path . '/'.$file);
|
||||
|
||||
|
|
@ -369,7 +372,9 @@ class Updates extends Controller
|
|||
$coreImportant = false;
|
||||
|
||||
foreach (array_get($result, 'core.updates', []) as $build => $description) {
|
||||
if (strpos($description, '!!!') === false) continue;
|
||||
if (strpos($description, '!!!') === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$detailsUrl = '//octobercms.com/support/articles/release-notes';
|
||||
$description = str_replace('!!!', '', $description);
|
||||
|
|
@ -387,7 +392,9 @@ class Updates extends Controller
|
|||
$isImportant = false;
|
||||
|
||||
foreach (array_get($plugin, 'updates', []) as $version => $description) {
|
||||
if (strpos($description, '!!!') === false) continue;
|
||||
if (strpos($description, '!!!') === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$isImportant = $hasImportantUpdates = true;
|
||||
$detailsUrl = Backend::url('system/updates/details/'.PluginVersion::makeSlug($code).'/upgrades').'?fetch=1';
|
||||
|
|
@ -910,7 +917,6 @@ class Updates extends Controller
|
|||
public function onRemoveTheme()
|
||||
{
|
||||
if ($themeCode = post('code')) {
|
||||
|
||||
ThemeManager::instance()->deleteTheme($themeCode);
|
||||
|
||||
Flash::success(trans('cms::lang.theme.delete_theme_success'));
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ class DbSystemMailLayoutRename extends Migration
|
|||
$layout->content_text = preg_replace("/({{\s*message\s*[|]raw\s*}})/i", "{{ content|raw }}", $layout->content_text);
|
||||
$layout->forceSave();
|
||||
}
|
||||
catch (Exception $ex) {}
|
||||
catch (Exception $ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@ class DateTime
|
|||
else {
|
||||
try {
|
||||
$value = Carbon::parse($value);
|
||||
} catch (Exception $ex) {}
|
||||
} catch (Exception $ex) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!$value instanceof Carbon && $throwException) {
|
||||
|
|
@ -131,5 +132,4 @@ class DateTime
|
|||
|
||||
return strtr($format, $replacements);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ class EventLog extends Model
|
|||
try {
|
||||
$record->save();
|
||||
}
|
||||
catch (Exception $ex) {}
|
||||
catch (Exception $ex) {
|
||||
}
|
||||
|
||||
return $record;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,5 +141,4 @@ class MailLayout extends Model
|
|||
{
|
||||
return MailParser::parse(FileHelper::get(View::make($code)->getPath()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,6 @@ class MailSetting extends Model
|
|||
$config->set('mail.from.address', $settings->sender_email);
|
||||
|
||||
switch ($settings->send_mode) {
|
||||
|
||||
case self::MODE_SMTP:
|
||||
$config->set('mail.host', $settings->smtp_address);
|
||||
$config->set('mail.port', $settings->smtp_port);
|
||||
|
|
@ -127,10 +126,8 @@ class MailSetting extends Model
|
|||
$config->set('services.ses.region', $settings->ses_region);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array smtp_encryption options values
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ trait AssetMaker
|
|||
|
||||
if ($type == null || $type == 'css') {
|
||||
foreach ($this->assets['css'] as $asset) {
|
||||
|
||||
/*
|
||||
* Prevent duplicates
|
||||
*/
|
||||
|
|
@ -314,10 +313,8 @@ trait AssetMaker
|
|||
protected function removeDuplicates()
|
||||
{
|
||||
foreach ($this->assets as $type => &$collection) {
|
||||
|
||||
$pathCache = [];
|
||||
foreach ($collection as $key => $asset) {
|
||||
|
||||
if (!$path = array_get($asset, 'path')) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -329,7 +326,6 @@ trait AssetMaker
|
|||
|
||||
$pathCache[$path] = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ trait ConfigMaker
|
|||
* Process config from file contents
|
||||
*/
|
||||
else {
|
||||
|
||||
if (isset($this->controller) && method_exists($this->controller, 'getConfigPath')) {
|
||||
$configFile = $this->controller->getConfigPath($configFile);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use App;
|
||||
use File;
|
||||
use Twig\Source as TwigSource;;
|
||||
use Twig\Source as TwigSource;
|
||||
use Twig\Loader\LoaderInterface as TwigLoaderInterface;
|
||||
use Exception;
|
||||
|
||||
|
|
|
|||
13
phpcs.xml
13
phpcs.xml
|
|
@ -19,11 +19,24 @@
|
|||
<exclude-pattern>*/tests/*</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
|
||||
<!--
|
||||
Test fixtures and cases can have multiple classes defined, only if they are directly related to the test, or are
|
||||
extended classes
|
||||
-->
|
||||
<exclude-pattern>*/tests/*</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<file>bootstrap/</file>
|
||||
<file>config/</file>
|
||||
<file>modules/</file>
|
||||
<file>plugins/october/demo/</file>
|
||||
<file>tests/</file>
|
||||
|
||||
<!-- Ignore vendor files -->
|
||||
<exclude-pattern>*/vendor/*</exclude-pattern>
|
||||
<!-- Ignore this view file as fixing the issues in here will break the template -->
|
||||
<exclude-pattern>modules/system/views/exception.php</exclude-pattern>
|
||||
<!-- Ignore this test case completely as it's testing a parse error -->
|
||||
<exclude-pattern>tests/fixtures/plugins/testvendor/goto/Plugin.php</exclude-pattern>
|
||||
</ruleset>
|
||||
|
|
|
|||
|
|
@ -2,24 +2,31 @@
|
|||
|
||||
class UiTestCase extends PHPUnit_Extensions_SeleniumTestCase
|
||||
{
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
/*
|
||||
* Look for selenium configuration
|
||||
*/
|
||||
if (file_exists($seleniumEnv = __DIR__.'/../selenium.php'))
|
||||
if (file_exists($seleniumEnv = __DIR__.'/../selenium.php')) {
|
||||
require_once $seleniumEnv;
|
||||
}
|
||||
|
||||
/*
|
||||
* Configure selenium
|
||||
*/
|
||||
if (!defined('TEST_SELENIUM_URL'))
|
||||
if (!defined('TEST_SELENIUM_URL')) {
|
||||
return $this->markTestSkipped('Selenium skipped');
|
||||
}
|
||||
|
||||
if (defined('TEST_SELENIUM_HOST')) $this->setHost(TEST_SELENIUM_HOST);
|
||||
if (defined('TEST_SELENIUM_PORT')) $this->setPort(TEST_SELENIUM_PORT);
|
||||
if (defined('TEST_SELENIUM_BROWSER')) $this->setBrowser(TEST_SELENIUM_BROWSER);
|
||||
if (defined('TEST_SELENIUM_HOST')) {
|
||||
$this->setHost(TEST_SELENIUM_HOST);
|
||||
}
|
||||
if (defined('TEST_SELENIUM_PORT')) {
|
||||
$this->setPort(TEST_SELENIUM_PORT);
|
||||
}
|
||||
if (defined('TEST_SELENIUM_BROWSER')) {
|
||||
$this->setBrowser(TEST_SELENIUM_BROWSER);
|
||||
}
|
||||
$this->setBrowserUrl(TEST_SELENIUM_URL);
|
||||
}
|
||||
|
||||
|
|
@ -60,32 +67,45 @@ class UiTestCase extends PHPUnit_Extensions_SeleniumTestCase
|
|||
|
||||
protected function waitForElementPresent($target, $timeout = 60)
|
||||
{
|
||||
for ($second = 0; ; $second++) {
|
||||
if ($second >= $timeout)
|
||||
$second = 0;
|
||||
|
||||
while (true) {
|
||||
if ($second >= $timeout) {
|
||||
$this->fail('timeout');
|
||||
}
|
||||
|
||||
try {
|
||||
if ($this->isElementPresent($target)) break;
|
||||
if ($this->isElementPresent($target)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
}
|
||||
catch (Exception $e) {}
|
||||
|
||||
sleep(1);
|
||||
++$second;
|
||||
}
|
||||
}
|
||||
|
||||
protected function waitForElementNotPresent($target, $timeout = 60)
|
||||
{
|
||||
for ($second = 0; ; $second++) {
|
||||
if ($second >= $timeout)
|
||||
$second = 0;
|
||||
|
||||
while (true) {
|
||||
if ($second >= $timeout) {
|
||||
$this->fail('timeout');
|
||||
}
|
||||
|
||||
try {
|
||||
if (!$this->isElementPresent($target)) break;
|
||||
if (!$this->isElementPresent($target)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
}
|
||||
catch (Exception $e) {}
|
||||
|
||||
sleep(1);
|
||||
++$second;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ use System\Classes\PluginBase;
|
|||
|
||||
class Plugin extends PluginBase
|
||||
{
|
||||
|
||||
public function pluginDetails()
|
||||
{
|
||||
return [
|
||||
|
|
@ -13,5 +12,4 @@ class Plugin extends PluginBase
|
|||
'author' => 'Alexey Bobkov, Samuel Georges'
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,5 +27,4 @@ class EventLog extends Model
|
|||
public $morphTo = [
|
||||
'related' => []
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,5 +26,4 @@ class Phone extends Model
|
|||
public $belongsTo = [
|
||||
'author' => 'Database\Tester\Models\Author',
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ class SluggablePost extends Post
|
|||
'slug' => 'title',
|
||||
'long_slug' => ['title', 'description']
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
class RevisionablePost extends Post
|
||||
|
|
@ -117,7 +116,6 @@ class RevisionablePost extends Post
|
|||
{
|
||||
return 7;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ValidationPost extends Post
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use Model;
|
|||
*/
|
||||
class Role extends Model
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string The database table used by the model.
|
||||
*/
|
||||
|
|
@ -32,5 +31,4 @@ class Role extends Model
|
|||
'table' => 'database_tester_authors_roles'
|
||||
],
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ class User extends Model
|
|||
public $attachMany = [
|
||||
'photos' => 'System\Models\File'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
class SoftDeleteUser extends User
|
||||
|
|
|
|||
|
|
@ -5,11 +5,9 @@ use October\Rain\Database\Updates\Migration;
|
|||
|
||||
class CreateAuthorsTable extends Migration
|
||||
{
|
||||
|
||||
public function up()
|
||||
{
|
||||
Schema::create('database_tester_authors', function ($table)
|
||||
{
|
||||
Schema::create('database_tester_authors', function ($table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->increments('id');
|
||||
$table->integer('user_id')->unsigned()->index()->nullable();
|
||||
|
|
@ -24,5 +22,4 @@ class CreateAuthorsTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('database_tester_authors');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@ class CreateCategoriesTable extends Migration
|
|||
|
||||
public function up()
|
||||
{
|
||||
Schema::create('database_tester_categories', function ($table)
|
||||
{
|
||||
Schema::create('database_tester_categories', function ($table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->increments('id');
|
||||
$table->integer('parent_id')->nullable();
|
||||
|
|
@ -22,8 +21,7 @@ class CreateCategoriesTable extends Migration
|
|||
$table->softDeletes();
|
||||
});
|
||||
|
||||
Schema::create('database_tester_categories_nested', function ($table)
|
||||
{
|
||||
Schema::create('database_tester_categories_nested', function ($table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->increments('id');
|
||||
$table->integer('parent_id')->nullable();
|
||||
|
|
@ -45,5 +43,4 @@ class CreateCategoriesTable extends Migration
|
|||
Schema::dropIfExists('database_tester_categories');
|
||||
Schema::dropIfExists('database_tester_categories_nested');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@ class CreateEventLogTable extends Migration
|
|||
|
||||
public function up()
|
||||
{
|
||||
Schema::create('database_tester_event_log', function ($table)
|
||||
{
|
||||
Schema::create('database_tester_event_log', function ($table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->increments('id');
|
||||
$table->string('action', 30)->nullable();
|
||||
|
|
@ -24,5 +23,4 @@ class CreateEventLogTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('database_tester_event_log');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@ class CreateMetaTable extends Migration
|
|||
|
||||
public function up()
|
||||
{
|
||||
Schema::create('database_tester_meta', function ($table)
|
||||
{
|
||||
Schema::create('database_tester_meta', function ($table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->increments('id')->unsigned();
|
||||
$table->integer('taggable_id')->unsigned()->index()->nullable();
|
||||
|
|
@ -28,5 +27,4 @@ class CreateMetaTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('database_tester_meta');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@ class CreatePhonesTable extends Migration
|
|||
|
||||
public function up()
|
||||
{
|
||||
Schema::create('database_tester_phones', function ($table)
|
||||
{
|
||||
Schema::create('database_tester_phones', function ($table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->increments('id');
|
||||
$table->string('number')->nullable();
|
||||
|
|
@ -22,5 +21,4 @@ class CreatePhonesTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('database_tester_phones');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@ class CreatePostsTable extends Migration
|
|||
|
||||
public function up()
|
||||
{
|
||||
Schema::create('database_tester_posts', function ($table)
|
||||
{
|
||||
Schema::create('database_tester_posts', function ($table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->increments('id');
|
||||
$table->string('title')->nullable();
|
||||
|
|
@ -29,5 +28,4 @@ class CreatePostsTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('database_tester_posts');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@ class CreateRolesTable extends Migration
|
|||
|
||||
public function up()
|
||||
{
|
||||
Schema::create('database_tester_roles', function ($table)
|
||||
{
|
||||
Schema::create('database_tester_roles', function ($table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->increments('id');
|
||||
$table->string('name')->nullable();
|
||||
|
|
@ -17,8 +16,7 @@ class CreateRolesTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('database_tester_authors_roles', function ($table)
|
||||
{
|
||||
Schema::create('database_tester_authors_roles', function ($table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->integer('author_id')->unsigned();
|
||||
$table->integer('role_id')->unsigned();
|
||||
|
|
@ -33,5 +31,4 @@ class CreateRolesTable extends Migration
|
|||
Schema::dropIfExists('database_tester_roles');
|
||||
Schema::dropIfExists('database_tester_authors_roles');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@ class CreateUsersTable extends Migration
|
|||
|
||||
public function up()
|
||||
{
|
||||
Schema::create('database_tester_users', function ($table)
|
||||
{
|
||||
Schema::create('database_tester_users', function ($table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->increments('id');
|
||||
$table->string('name')->nullable();
|
||||
|
|
@ -23,5 +22,4 @@ class CreateUsersTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('database_tester_users');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ use System\Classes\PluginBase;
|
|||
|
||||
class Plugin extends PluginBase
|
||||
{
|
||||
|
||||
public function pluginDetails()
|
||||
{
|
||||
return [
|
||||
|
|
@ -13,5 +12,4 @@ class Plugin extends PluginBase
|
|||
'author' => 'Alexey Bobkov, Samuel Georges'
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ use System\Classes\PluginBase;
|
|||
|
||||
class Plugin extends PluginBase
|
||||
{
|
||||
|
||||
public function pluginDetails()
|
||||
{
|
||||
return [
|
||||
|
|
@ -13,5 +12,4 @@ class Plugin extends PluginBase
|
|||
'author' => 'Alexey Bobkov, Samuel Georges'
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ use System\Classes\PluginBase;
|
|||
|
||||
class Plugin extends PluginBase
|
||||
{
|
||||
|
||||
public function pluginDetails()
|
||||
{
|
||||
return [
|
||||
|
|
@ -62,5 +61,4 @@ class Plugin extends PluginBase
|
|||
]
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ use Cms\Classes\ComponentBase;
|
|||
|
||||
class Archive extends ComponentBase
|
||||
{
|
||||
|
||||
public function componentDetails()
|
||||
{
|
||||
return [
|
||||
|
|
@ -39,5 +38,4 @@ class Archive extends ComponentBase
|
|||
{
|
||||
$this->page['var'] = 'page';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,5 +30,4 @@ class Categories extends ComponentBase
|
|||
{
|
||||
$this->page['var'] = 'page';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class Comments extends ComponentBase
|
|||
{
|
||||
private $users;
|
||||
|
||||
public function __construct(CodeBase $cmsObject = null, $properties = [], Users $users)
|
||||
public function __construct(CodeBase $cmsObject = null, $properties = [], Users $users = null)
|
||||
{
|
||||
parent::__construct($cmsObject, $properties);
|
||||
$this->users = $users;
|
||||
|
|
@ -39,5 +39,4 @@ class Comments extends ComponentBase
|
|||
{
|
||||
return $this->users;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ use Cms\Classes\ComponentBase;
|
|||
|
||||
class ContentBlock extends ComponentBase
|
||||
{
|
||||
|
||||
public function componentDetails()
|
||||
{
|
||||
return [
|
||||
|
|
@ -21,5 +20,4 @@ class ContentBlock extends ComponentBase
|
|||
|
||||
return 'Pass';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ use Cms\Classes\ComponentBase;
|
|||
|
||||
class MainMenu extends ComponentBase
|
||||
{
|
||||
|
||||
public function componentDetails()
|
||||
{
|
||||
return [
|
||||
|
|
@ -17,5 +16,4 @@ class MainMenu extends ComponentBase
|
|||
{
|
||||
return ['Home', 'Blog', 'About', 'Contact'];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ use Cms\Classes\ComponentBase;
|
|||
|
||||
class Post extends ComponentBase
|
||||
{
|
||||
|
||||
public function componentDetails()
|
||||
{
|
||||
return [
|
||||
|
|
@ -22,5 +21,4 @@ class Post extends ComponentBase
|
|||
]
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ use System\Classes\PluginBase;
|
|||
|
||||
class Plugin extends PluginBase
|
||||
{
|
||||
|
||||
public function pluginDetails()
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ use System\Classes\PluginBase;
|
|||
|
||||
class Plugin extends PluginBase
|
||||
{
|
||||
|
||||
public function pluginDetails()
|
||||
{
|
||||
return [
|
||||
|
|
@ -23,5 +22,4 @@ class Plugin extends PluginBase
|
|||
]
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
|
||||
class AuthTest extends UiTestCase
|
||||
{
|
||||
|
||||
public function testSignInAndOut()
|
||||
{
|
||||
$this->open('backend');
|
||||
|
|
@ -88,7 +86,5 @@ class AuthTest extends UiTestCase
|
|||
catch (PHPUnit_Framework_AssertionFailedError $e) {
|
||||
array_push($this->verificationErrors, $e->toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
|
||||
class TemplateTest extends UiTestCase
|
||||
{
|
||||
|
||||
public function testOpenTemplates()
|
||||
{
|
||||
$this->signInToBackend();
|
||||
|
|
@ -141,7 +139,5 @@ class TemplateTest extends UiTestCase
|
|||
$this->click("xpath=(//button[@data-request='onDelete'])[1]");
|
||||
$this->getSweetConfirmation('Do you really want delete this content file?');
|
||||
$this->waitForElementNotPresent("name=fileName");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,5 +44,4 @@ class WidgetManagerTest extends TestCase
|
|||
|
||||
$this->assertCount(1, $widgets);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
use Backend\Models\ExportModel;
|
||||
|
||||
if (!class_exists('Model')) class_alias('October\Rain\Database\Model', 'Model');
|
||||
if (!class_exists('Model')) {
|
||||
class_alias('October\Rain\Database\Model', 'Model');
|
||||
}
|
||||
|
||||
class ExampleExportModel extends ExportModel
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
use Backend\Models\ImportModel;
|
||||
|
||||
if (!class_exists('Model')) class_alias('October\Rain\Database\Model', 'Model');
|
||||
if (!class_exists('Model')) {
|
||||
class_alias('October\Rain\Database\Model', 'Model');
|
||||
}
|
||||
|
||||
class ExampleImportModel extends ImportModel
|
||||
{
|
||||
|
|
@ -36,5 +38,4 @@ class ImportModelTest extends TestCase
|
|||
$result = self::callProtectedMethod($model, 'decodeArrayValue', [$data, '-']);
|
||||
$this->assertEquals(['art direction', 'roman empire', 'sci-fi'], $result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,5 +58,4 @@ class WidgetMakerTest extends TestCase
|
|||
$this->assertInstanceOf('Backend\Widgets\Search', $widget);
|
||||
$this->assertEquals('config', $widget->getConfig('test'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ class TestCmsCompoundObject extends CmsCompoundObject
|
|||
{
|
||||
protected $dirName = 'testobjects';
|
||||
|
||||
protected function parseSettings() {}
|
||||
protected function parseSettings()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
class TestParsedCmsCompoundObject extends CmsCompoundObject
|
||||
|
|
@ -21,7 +23,9 @@ class TestTemporaryCmsCompoundObject extends CmsCompoundObject
|
|||
{
|
||||
protected $dirName = 'temporary';
|
||||
|
||||
protected function parseSettings() {}
|
||||
protected function parseSettings()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
class CmsCompoundObjectTest extends TestCase
|
||||
|
|
@ -128,8 +132,9 @@ class CmsCompoundObjectTest extends TestCase
|
|||
$this->assertNotEmpty($testContent);
|
||||
|
||||
$filePath = $themePath .= '/temporary/testcompound.htm';
|
||||
if (file_exists($filePath))
|
||||
if (file_exists($filePath)) {
|
||||
@unlink($filePath);
|
||||
}
|
||||
|
||||
$this->assertFileNotExists($filePath);
|
||||
file_put_contents($filePath, $testContent);
|
||||
|
|
@ -195,8 +200,9 @@ class CmsCompoundObjectTest extends TestCase
|
|||
$theme = Theme::load('apitest');
|
||||
|
||||
$destFilePath = $theme->getPath().'/testobjects/compound-markup.htm';
|
||||
if (file_exists($destFilePath))
|
||||
if (file_exists($destFilePath)) {
|
||||
unlink($destFilePath);
|
||||
}
|
||||
|
||||
$this->assertFileNotExists($destFilePath);
|
||||
|
||||
|
|
@ -219,8 +225,9 @@ class CmsCompoundObjectTest extends TestCase
|
|||
$theme = Theme::load('apitest');
|
||||
|
||||
$destFilePath = $theme->getPath().'/testobjects/compound-markup-settings.htm';
|
||||
if (file_exists($destFilePath))
|
||||
if (file_exists($destFilePath)) {
|
||||
unlink($destFilePath);
|
||||
}
|
||||
|
||||
$this->assertFileNotExists($destFilePath);
|
||||
|
||||
|
|
@ -320,5 +327,4 @@ class CmsCompoundObjectTest extends TestCase
|
|||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue