From c49de3eeed6d16fcc9e2fca9311cdd8cd78c612b Mon Sep 17 00:00:00 2001 From: Daniel Dimitrov Date: Tue, 5 Nov 2013 20:23:12 +0100 Subject: [PATCH] phpcs --- .../views/uploads/view.html.php | 136 +++++++++++------- 1 file changed, 83 insertions(+), 53 deletions(-) diff --git a/source/administrator/components/com_jedchecker/views/uploads/view.html.php b/source/administrator/components/com_jedchecker/views/uploads/view.html.php index d8e4f21..3e47905 100644 --- a/source/administrator/components/com_jedchecker/views/uploads/view.html.php +++ b/source/administrator/components/com_jedchecker/views/uploads/view.html.php @@ -1,7 +1,7 @@ + * @date 02.06.12 * * @copyright Copyright (C) 2008 - 2012 compojoom.com . All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE @@ -11,65 +11,95 @@ defined('_JEXEC') or die('Restricted access'); jimport('joomla.application.component.viewlegacy'); -class jedcheckerViewUploads extends JViewLegacy +/** + * Class JedcheckerViewUploads + * + * @since 1.0 + */ +class JedcheckerViewUploads extends JViewLegacy { + /** + * Display method + * + * @param string $tpl - the template + * + * @return mixed|void + */ + public function display($tpl = null) + { + $this->setToolbar(); + $this->jsOptions['url'] = JURI::base(); + $this->jsOptions['rules'] = $this->getRules(); + parent::display($tpl); + } - public function display($tpl = null) - { - $this->setToolbar(); - $this->jsOptions['url'] = JURI::base(); - $this->jsOptions['rules'] = $this->getRules(); - parent::display($tpl); - } + /** + * Get the component rules + * + * @return array + */ + public function getRules() + { + $rules = array(); + $files = JFolder::files(JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules', '.php$', false, false); + JLoader::discover('jedcheckerRules', JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules/'); - public function getRules() - { - $rules = array(); - $files = JFolder::files(JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules', '.php$', false, false); - JLoader::discover('jedcheckerRules',JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules/'); + foreach ($files as $file) + { + $rules[] = substr($file, 0, -4); + } - foreach ($files as $file) - { - $rules[] = substr($file, 0, -4); - } + return $rules; + } - return $rules; - } + /** + * Creates the toolbar options + * + * @return void + */ + public function setToolbar() + { + if ($this->filesExist('archives')) + { + JToolBarHelper::custom('uploads.unzip', 'unzip', 'unzip', 'unzip', false); + } - public function setToolbar() - { - if($this->filesExist('archives')) { - JToolBarHelper::custom('uploads.unzip', 'unzip', 'unzip', 'unzip', false); - } - if($this->filesExist('unzipped')) { - JToolBarHelper::custom('police.check', 'police-check', 'police-check', 'Check', false); - } + if ($this->filesExist('unzipped')) + { + JToolBarHelper::custom('police.check', 'police-check', 'police-check', 'Check', false); + } - JToolBarHelper::title('JED checker'); - } + JToolBarHelper::title('JED checker'); + } - /** - * Checks if folder + files exist in the jed_checker tmp path - * @param $type - * @return bool - */ - private function filesExist($type) - { - $path = JFactory::getConfig()->get('tmp_path') . '/jed_checker/'.$type; + /** + * Checks if folder + files exist in the jed_checker tmp path + * + * @param string $type - action + * + * @return bool + */ + private function filesExist($type) + { + $path = JFactory::getConfig()->get('tmp_path') . '/jed_checker/' . $type; - // Check for the existence of files - jimport('joomla.filesystem.folder'); - if(JFolder::exists($path)) { - if(JFolder::folders($path, '.', false) || JFolder::files($path, '.', false)) { - return true; - } + if (JFolder::exists($path)) + { + if (JFolder::folders($path, '.', false) || JFolder::files($path, '.', false)) + { + return true; + } + } + else + { + $local = JFactory::getConfig()->get('tmp_path') . '/jed_checker/local.txt'; - } else { - $local = JFactory::getConfig()->get('tmp_path') . '/jed_checker/local.txt'; - if ($type == 'unzipped' && JFile::exists($local)) { - return true; - } - } - return false; - } + if ($type == 'unzipped' && JFile::exists($local)) + { + return true; + } + } + + return false; + } }