Skip to content

Commit

Permalink
Форматирование кода под PSR-2
Browse files Browse the repository at this point in the history
  • Loading branch information
mzhelskiy committed Oct 8, 2014
1 parent 3dc0465 commit 039de43
Show file tree
Hide file tree
Showing 180 changed files with 44,188 additions and 39,875 deletions.
261 changes: 138 additions & 123 deletions application/classes/actions/ActionAdmin.class.php
Expand Up @@ -25,132 +25,147 @@
* @package application.actions
* @since 1.0
*/
class ActionAdmin extends Action {
/**
* Текущий пользователь
*
* @var ModuleUser_EntityUser|null
*/
protected $oUserCurrent=null;
/**
* Главное меню
*
* @var string
*/
protected $sMenuHeadItemSelect='admin';
class ActionAdmin extends Action
{

This comment has been minimized.

Copy link
@psnet

psnet Oct 8, 2014

Contributor

только не это

/**
* Текущий пользователь
*
* @var ModuleUser_EntityUser|null
*/
protected $oUserCurrent = null;
/**
* Главное меню
*
* @var string
*/
protected $sMenuHeadItemSelect = 'admin';

/**
* Инициализация
*
* @return string
*/
public function Init() {
/**
* Если нет прав доступа - перекидываем на 404 страницу
*/
if(!$this->User_IsAuthorization() or !$oUserCurrent=$this->User_GetUserCurrent() or !$oUserCurrent->isAdministrator()) {
return parent::EventNotFound();
}
$this->SetDefaultEvent('index');
/**
* Инициализация
*
* @return string
*/
public function Init()
{
/**
* Если нет прав доступа - перекидываем на 404 страницу
*/
if (!$this->User_IsAuthorization() or !$oUserCurrent = $this->User_GetUserCurrent() or !$oUserCurrent->isAdministrator()) {
return parent::EventNotFound();
}
$this->SetDefaultEvent('index');

$this->oUserCurrent=$oUserCurrent;
}
/**
* Регистрация евентов
*/
protected function RegisterEvent() {
$this->AddEvent('index','EventIndex');
$this->AddEvent('plugins','EventPlugins');
}
$this->oUserCurrent = $oUserCurrent;
}

/**
* Регистрация евентов
*/
protected function RegisterEvent()
{
$this->AddEvent('index', 'EventIndex');
$this->AddEvent('plugins', 'EventPlugins');
}

/**********************************************************************************
************************ РЕАЛИЗАЦИЯ ЭКШЕНА ***************************************
**********************************************************************************
*/

/**
* Отображение главной страницы админки
*/
protected function EventIndex() {
/**
* Определяем доступность установки расширенной админ-панели
*/
$aPluginsAll=func_list_plugins(true);
if (in_array('admin',$aPluginsAll)) {
$this->Viewer_Assign('bAvailableAdminPlugin',true);
}
}
/**
* Страница со списком плагинов
*
*/
protected function EventPlugins() {
$this->sMenuHeadItemSelect='plugins';
/**
* Получаем название плагина и действие
*/
if($sPlugin=getRequestStr('plugin',null,'get') and $sAction=getRequestStr('action',null,'get')) {
return $this->SubmitManagePlugin($sPlugin,$sAction);
}
/**
* Получаем список блогов
*/
$aPlugins=$this->PluginManager_GetPluginsItems(array('order'=>'name'));
/**
* Загружаем переменные в шаблон
*/
$this->Viewer_Assign("aPlugins",$aPlugins);
$this->Viewer_AddHtmlTitle($this->Lang_Get('admin.plugins.title'));
/**
* Устанавливаем шаблон вывода
*/
$this->SetTemplateAction('plugins');
}
/**
* Активация\деактивация плагина
*
* @param string $sPlugin Имя плагина
* @param string $sAction Действие
*/
protected function SubmitManagePlugin($sPlugin,$sAction) {
$this->Security_ValidateSendForm();
if(!in_array($sAction,array('activate','deactivate','remove','apply_update'))) {
$this->Message_AddError($this->Lang_Get('admin.plugins.notices.unknown_action'),$this->Lang_Get('error'),true);
Router::Location(Router::GetPath('admin/plugins'));
}
$bResult=false;
/**
* Активируем\деактивируем плагин
*/
if ($sAction=='activate') {
$bResult=$this->PluginManager_ActivatePlugin($sPlugin);
} elseif ($sAction=='deactivate') {
$bResult=$this->PluginManager_DeactivatePlugin($sPlugin);
} elseif ($sAction=='remove') {
$bResult=$this->PluginManager_RemovePlugin($sPlugin);
} elseif ($sAction=='apply_update') {
$this->PluginManager_ApplyPluginUpdate($sPlugin);
$bResult=true;
}
if($bResult) {
$this->Message_AddNotice($this->Lang_Get('admin.plugins.notices.action_ok'),$this->Lang_Get('attention'),true);
} else {
if(!($aMessages=$this->Message_GetErrorSession()) or !count($aMessages)) $this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'),true);
}
/**
* Возвращаем на страницу управления плагинами
*/
Router::Location(Router::GetPath('admin').'plugins/');
}
/**
* Выполняется при завершении работы экшена
*
*/
public function EventShutdown() {
/**
* Загружаем в шаблон необходимые переменные
*/
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
}
/**********************************************************************************
************************ РЕАЛИЗАЦИЯ ЭКШЕНА ***************************************
**********************************************************************************
*/

/**
* Отображение главной страницы админки
*/
protected function EventIndex()
{
/**
* Определяем доступность установки расширенной админ-панели
*/
$aPluginsAll = func_list_plugins(true);
if (in_array('admin', $aPluginsAll)) {
$this->Viewer_Assign('bAvailableAdminPlugin', true);
}
}

/**
* Страница со списком плагинов
*
*/
protected function EventPlugins()
{
$this->sMenuHeadItemSelect = 'plugins';
/**
* Получаем название плагина и действие
*/
if ($sPlugin = getRequestStr('plugin', null, 'get') and $sAction = getRequestStr('action', null, 'get')) {
return $this->SubmitManagePlugin($sPlugin, $sAction);
}
/**
* Получаем список блогов
*/
$aPlugins = $this->PluginManager_GetPluginsItems(array('order' => 'name'));
/**
* Загружаем переменные в шаблон
*/
$this->Viewer_Assign("aPlugins", $aPlugins);
$this->Viewer_AddHtmlTitle($this->Lang_Get('admin.plugins.title'));
/**
* Устанавливаем шаблон вывода
*/
$this->SetTemplateAction('plugins');
}

/**
* Активация\деактивация плагина
*
* @param string $sPlugin Имя плагина
* @param string $sAction Действие
*/
protected function SubmitManagePlugin($sPlugin, $sAction)
{
$this->Security_ValidateSendForm();
if (!in_array($sAction, array('activate', 'deactivate', 'remove', 'apply_update'))) {
$this->Message_AddError($this->Lang_Get('admin.plugins.notices.unknown_action'), $this->Lang_Get('error'),
true);
Router::Location(Router::GetPath('admin/plugins'));
}
$bResult = false;
/**
* Активируем\деактивируем плагин
*/
if ($sAction == 'activate') {
$bResult = $this->PluginManager_ActivatePlugin($sPlugin);
} elseif ($sAction == 'deactivate') {
$bResult = $this->PluginManager_DeactivatePlugin($sPlugin);
} elseif ($sAction == 'remove') {
$bResult = $this->PluginManager_RemovePlugin($sPlugin);
} elseif ($sAction == 'apply_update') {
$this->PluginManager_ApplyPluginUpdate($sPlugin);
$bResult = true;
}
if ($bResult) {
$this->Message_AddNotice($this->Lang_Get('admin.plugins.notices.action_ok'), $this->Lang_Get('attention'),
true);
} else {
if (!($aMessages = $this->Message_GetErrorSession()) or !count($aMessages)) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'), $this->Lang_Get('error'), true);
}
}
/**
* Возвращаем на страницу управления плагинами
*/
Router::Location(Router::GetPath('admin') . 'plugins/');
}

/**
* Выполняется при завершении работы экшена
*
*/
public function EventShutdown()
{
/**
* Загружаем в шаблон необходимые переменные
*/
$this->Viewer_Assign('sMenuHeadItemSelect', $this->sMenuHeadItemSelect);
}
}

4 comments on commit 039de43

@psnet
Copy link
Contributor

@psnet psnet commented on 039de43 Oct 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это что, переезд с табов на пробелы?

@kerbylav
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да ничего страшного, все равно, по-хорошему, IDE за тебя все делает.

Кстати, Максим, надо куда-нить code style settings экспортировать для PHPStorm'a чтобы их можно было бы легко применить.

@mzhelskiy
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да по сути используется стандартная штормовская разметка psr1/psr2 + галка на выравнивание массивов
Возможно залью на docs.livestreetcms.com

@psnet
Copy link
Contributor

@psnet psnet commented on 039de43 Oct 9, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mzhelskiy Так табы заменены на пробелы?

Please sign in to comment.