Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Код приведен к стандарту PSR-12 #574

Merged
merged 1 commit into from
Apr 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions _build/build.transport.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
}
$modx->log(xPDO::LOG_LEVEL_INFO, 'Packaged in ' . count($events) . ' Plugins events.');
}
unset ($events, $event, $attributes);
unset($events, $event, $attributes);

// Package in default access policy
$attributes = array(
Expand Down Expand Up @@ -126,7 +126,7 @@
} else {
$modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in Access Policy Templates.');
}
unset ($templates, $template, $attributes);
unset($templates, $template, $attributes);

// Load menus
$menus = include $sources['data'] . 'transport.menu.php';
Expand Down
20 changes: 14 additions & 6 deletions _build/data/transport.policytemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,31 @@
foreach ($v['permissions'] as $k2 => $v2) {
/** @var modAccessPermission $event */
$permission = $modx->newObject('modAccessPermission');
$permission->fromArray(array_merge(array(
$permission->fromArray(
array_merge(array(
'name' => $k2,
'description' => $k2,
'value' => true,
), $v2)
, '', true, true);
), $v2),
'',
true,
true
);
$permissions[] = $permission;
}
}

/** @var $template modAccessPolicyTemplate */
$template = $modx->newObject('modAccessPolicyTemplate');
$template->fromArray(array_merge(array(
$template->fromArray(
array_merge(array(
'name' => $k,
'lexicon' => PKG_NAME_LOWER . ':permissions',
), $v)
, '', true, true);
), $v),
'',
true,
true
);

if (!empty($permissions)) {
$template->addMany($permissions);
Expand Down
3 changes: 2 additions & 1 deletion _build/data/transport.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@
'key' => $k,
'namespace' => 'minishop2',
'editedon' => date('Y-m-d H:i:s'),
), $v
),
$v
), '', true, true);
$settings[] = $setting;
}
Expand Down
1 change: 1 addition & 0 deletions _build/data/transport.snippets.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/** @var modX $modx */
/** @var array $sources */
$snippets = array();
Expand Down
1 change: 1 addition & 0 deletions _build/resolvers/resolve.chunks.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/** @var xPDOTransport $transport */
if (!$transport->xpdo || !($transport instanceof xPDOTransport)) {
return false;
Expand Down
13 changes: 9 additions & 4 deletions _build/resolvers/resolve.policy.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@
case xPDOTransport::ACTION_UPGRADE:
/** @var modAccessPolicy $policy */
if ($policy = $modx->getObject('modAccessPolicy', array('name' => 'miniShopManagerPolicy'))) {
if ($template = $modx->getObject('modAccessPolicyTemplate',
array('name' => 'miniShopManagerPolicyTemplate'))
if (
$template = $modx->getObject(
'modAccessPolicyTemplate',
array('name' => 'miniShopManagerPolicyTemplate')
)
) {
$policy->set('template', $template->get('id'));
$policy->save();
} else {
$modx->log(xPDO::LOG_LEVEL_ERROR,
'[miniShop2] Could not find miniShopManagerPolicyTemplate Access Policy Template!');
$modx->log(
xPDO::LOG_LEVEL_ERROR,
'[miniShop2] Could not find miniShopManagerPolicyTemplate Access Policy Template!'
);
}

/** @var modUserGroup $adminGroup */
Expand Down
7 changes: 5 additions & 2 deletions _build/resolvers/resolve.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
switch ($options[xPDOTransport::PACKAGE_ACTION]) {
case xPDOTransport::ACTION_INSTALL:
case xPDOTransport::ACTION_UPGRADE:
$modelPath = $modx->getOption('minishop2.core_path', null,
$modx->getOption('core_path') . 'components/minishop2/') . 'model/';
$modelPath = $modx->getOption(
'minishop2.core_path',
null,
$modx->getOption('core_path') . 'components/minishop2/'
) . 'model/';
$modx->addPackage('minishop2', $modelPath);
$lang = $modx->getOption('manager_language') == 'en' ? 1 : 0;

Expand Down
1 change: 1 addition & 0 deletions _build/resolvers/resolve.setup.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/** @var xPDOTransport $transport */
if (!$transport->xpdo || !($transport instanceof xPDOTransport)) {
return false;
Expand Down
7 changes: 5 additions & 2 deletions _build/resolvers/resolve.tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
switch ($options[xPDOTransport::PACKAGE_ACTION]) {
case xPDOTransport::ACTION_INSTALL:
case xPDOTransport::ACTION_UPGRADE:
$modelPath = $modx->getOption('minishop2.core_path', null,
$modx->getOption('core_path') . 'components/minishop2/') . 'model/';
$modelPath = $modx->getOption(
'minishop2.core_path',
null,
$modx->getOption('core_path') . 'components/minishop2/'
) . 'model/';
$modx->addPackage('minishop2', $modelPath);

$manager = $modx->getManager();
Expand Down
2 changes: 1 addition & 1 deletion _build/setup.options.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/** @var modX $modx */
$exists = $chunks = false;
$output = null;
Expand Down Expand Up @@ -38,7 +39,6 @@
default:
$output = 'This component requires <b>pdoTools</b> for fast work of snippets.<br/><br/>It will be automatically downloaded and installed?';
}

}

if ($chunks) {
Expand Down
2 changes: 2 additions & 0 deletions assets/components/minishop2/connector.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

/** @noinspection PhpIncludeInspection */

require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/config.core.php';
/** @noinspection PhpIncludeInspection */
require_once MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php';
Expand Down
15 changes: 5 additions & 10 deletions assets/components/minishop2/js/mgr/category/category.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ Ext.extend(miniShop2.panel.Category, MODx.panel.Resource, {
var item = originals[i];
if (item.id == 'modx-resource-header') {
item.html = '<h2>' + _('ms2_category_new') + '</h2>';
}
else if (item.id == 'modx-resource-tabs') {
} else if (item.id == 'modx-resource-tabs') {
item.stateful = MODx.config['ms2_category_remember_tabs'] == 1;
item.stateId = 'minishop2-category-' + config.mode + '-tabpanel';
item.stateEvents = ['tabchange'];
Expand All @@ -33,13 +32,11 @@ Ext.extend(miniShop2.panel.Category, MODx.panel.Resource, {
if (tab.id == 'modx-resource-settings') {
tab.title = _('ms2_tab_category');
tab.items.push(this.getContent(config));
}
else if (tab.id == 'modx-page-settings') {
} else if (tab.id == 'modx-page-settings') {
tab.items = this.getCategorySettings(config);
pageSettingsTab = tab;
item.items.splice(i2, 1);
}
else if (tab.id == 'modx-resource-access-permissions') {
} else if (tab.id == 'modx-resource-access-permissions') {
accessPermissionsTab = tab;
item.items.splice(i2, 1);
}
Expand Down Expand Up @@ -128,8 +125,7 @@ Ext.extend(miniShop2.panel.Category, MODx.panel.Resource, {
}].concat(field.items[0].items[0].items);
moved.checkboxes = field;
continue;
}
else {
} else {
break;
}
}
Expand Down Expand Up @@ -158,8 +154,7 @@ Ext.extend(miniShop2.panel.Category, MODx.panel.Resource, {
if (typeof(item) == 'object') {
if (item.id == id) {
return callback(item);
}
else {
} else {
this.findField(item, id, callback);
}
}
Expand Down
2 changes: 1 addition & 1 deletion assets/components/minishop2/js/mgr/category/option.grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Ext.extend(miniShop2.grid.CategoryOption, miniShop2.grid.Default, {
id: 'actions',
renderer: miniShop2.utils.renderActions,
sortable: false
}
}
];
},

Expand Down
30 changes: 15 additions & 15 deletions assets/components/minishop2/js/mgr/category/option.windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ Ext.extend(miniShop2.window.AddOption, miniShop2.window.Default, {
anchor: '99%',
name: 'option_id',
hiddenName: 'option_id'
}, {
xtype: 'textfield',
anchor: '99%',
name: 'value',
fieldLabel: _('ms2_default_value')
}, {
xtype: 'checkboxgroup',
fieldLabel: _('ms2_options'),
columns: 1,
items: [
{xtype: 'xcheckbox', boxLabel: _('ms2_active'), name: 'active'},
{xtype: 'xcheckbox', boxLabel: _('ms2_required'), name: 'required'}
]
}
}, {
xtype: 'textfield',
anchor: '99%',
name: 'value',
fieldLabel: _('ms2_default_value')
}, {
xtype: 'checkboxgroup',
fieldLabel: _('ms2_options'),
columns: 1,
items: [
{xtype: 'xcheckbox', boxLabel: _('ms2_active'), name: 'active'},
{xtype: 'xcheckbox', boxLabel: _('ms2_required'), name: 'required'}
]
}
];
},

Expand Down Expand Up @@ -72,7 +72,7 @@ Ext.extend(miniShop2.window.CopyCategory, miniShop2.window.Default, {
anchor: '99%',
name: 'category_from',
hiddenName: 'category_from'
}
}
];
},

Expand Down
10 changes: 5 additions & 5 deletions assets/components/minishop2/js/mgr/category/product.grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ miniShop2.grid.Products = function (config) {
defaultNotify: false
});
miniShop2.grid.Products.superclass.constructor.call(this, config);
if (!this.defaultNotify) { this.ddText = ''; }
if (!this.defaultNotify) {
this.ddText = ''; }
};
Ext.extend(miniShop2.grid.Products, miniShop2.grid.Default, {

Expand Down Expand Up @@ -158,7 +159,7 @@ Ext.extend(miniShop2.grid.Products, miniShop2.grid.Default, {
}
}

var option_columns= [];
var option_columns = [];
if (miniShop2.config['show_options']) {
option_columns = this.getCategoryOptions(miniShop2.config);
}
Expand All @@ -175,7 +176,7 @@ Ext.extend(miniShop2.grid.Products, miniShop2.grid.Default, {
dataIndex: field
});
fields.push(columns[field]);
}else if (option_columns[field]) {
} else if (option_columns[field]) {
fields.push(option_columns[field]);
}
}
Expand Down Expand Up @@ -355,8 +356,7 @@ Ext.extend(miniShop2.grid.Products, miniShop2.grid.Default, {
row['data']['id'],
link
);
}
else {
} else {
var category_link = miniShop2.utils.productLink(row.data['category_name'], row.data['parent']);
return String.format(
'<div class="nested-product">\
Expand Down
28 changes: 12 additions & 16 deletions assets/components/minishop2/js/mgr/misc/default.grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ miniShop2.grid.Default = function (config) {
miniShop2.grid.Default.superclass.constructor.call(this, config);

if (config.enableDragDrop && config.ddAction) {
this.on('render', function(grid) {
this.on('render', function (grid) {
grid._initDD(config);
});
}
Expand Down Expand Up @@ -125,29 +125,25 @@ Ext.extend(miniShop2.grid.Default, MODx.grid.Grid, {
if (action == 'showMenu') {
var ri = this.getStore().find('id', row.id);
return this._showMenu(this, ri, e);
}
else if (typeof this[action] === 'function') {
} else if (typeof this[action] === 'function') {
this.menu.record = row.data;
return this[action](this, e);
}
}
}
else if (elem.nodeName == 'A' && elem.href.match(/(\?|\&)a=resource/)) {
} else if (elem.nodeName == 'A' && elem.href.match(/(\?|\&)a=resource/)) {
if (e.button == 1 || (e.button == 0 && e.ctrlKey == true)) {
// Bypass
}
else if (elem.target && elem.target == '_blank') {
} else if (elem.target && elem.target == '_blank') {
// Bypass
}
else {
} else {
e.preventDefault();
MODx.loadPage('', elem.href);
}
}
return this.processEvent('click', e);
},

refresh: function() {
refresh: function () {
this.getStore().reload();
if (this.config['enableDragDrop'] == true) {
this.getSelectionModel().clearSelections(true);
Expand Down Expand Up @@ -220,7 +216,7 @@ Ext.extend(miniShop2.grid.Default, MODx.grid.Grid, {
var sourceNodes = data.selections;
if (Ext.isArray(sourceNodes) && sourceNodes.length > 0) {
var message = '';
var singleParent = sourceNodes.every(function(node) {
var singleParent = sourceNodes.every(function (node) {
return node.data.parent == sourceNodes[0].data.parent;
});

Expand Down Expand Up @@ -257,15 +253,15 @@ Ext.extend(miniShop2.grid.Default, MODx.grid.Grid, {
}
});
},
notifyOver: function(dd, e, data) {
notifyOver: function (dd, e, data) {
var returnCls = this.dropAllowed;
if (grid.xtype == 'minishop2-grid-products' && !grid.defaultNotify) {
if (dd.getDragData(e)) {
var sourceNodes = data.selections;
var targetNode = dd.getDragData(e).selections[0];

if (Ext.isArray(sourceNodes) && sourceNodes.length > 0) {
var singleParent = sourceNodes.every(function(node) {
var singleParent = sourceNodes.every(function (node) {
return node.data.parent == sourceNodes[0].data.parent;
});

Expand All @@ -288,19 +284,19 @@ Ext.extend(miniShop2.grid.Default, MODx.grid.Grid, {
}
return returnCls;
},
_notifyMove: function(count, targetNode, dd) {
_notifyMove: function (count, targetNode, dd) {
returnCls = 'x-tree-drop-ok-append';
if (targetNode.data.category_name == '') {
dd.ddel.innerHTML = (count > 1) ? _('ms2_drag_move_current_many') : _('ms2_drag_move_current_one');
} else {
dd.ddel.innerHTML = (count > 1) ? String.format(_('ms2_drag_move_many'), targetNode.data.category_name) : String.format(_('ms2_drag_move_one'), targetNode.data.category_name);
}
},
_notifySort: function(count, dd) {
_notifySort: function (count, dd) {
returnCls = 'x-tree-drop-ok-between';
dd.ddel.innerHTML = (count > 1) ? _('ms2_drag_sort_many') : _('ms2_drag_sort_one');
},
_notifySelf: function(count, dd) {
_notifySelf: function (count, dd) {
dd.ddel.innerHTML = (count > 1) ? _('ms2_drag_self_many') : _('ms2_drag_self_one');
}
});
Expand Down
Loading