diff --git a/source/administrator/components/com_jedchecker/controller.php b/source/administrator/components/com_jedchecker/controller.php index 1951ce8..f8dba21 100644 --- a/source/administrator/components/com_jedchecker/controller.php +++ b/source/administrator/components/com_jedchecker/controller.php @@ -1,19 +1,19 @@ - - * @date 26.10.15 - * - * @copyright Copyright (C) 2008 - 2015 compojoom.com . All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE - */ - -defined('_JEXEC') or die ('Restricted access'); - -/** - * Class JedcheckerController - * - * @since 1.0 - */ -class JedcheckerController extends JControllerlegacy -{ -} + + * @date 26.10.15 + * + * @copyright Copyright (C) 2008 - 2015 compojoom.com . All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE + */ + +defined('_JEXEC') or die ('Restricted access'); + +/** + * Class JedcheckerController + * + * @since 1.0 + */ +class JedcheckerController extends JControllerLegacy +{ +} diff --git a/source/administrator/components/com_jedchecker/controllers/police.raw.php b/source/administrator/components/com_jedchecker/controllers/police.raw.php index 0ddbd5a..e927501 100644 --- a/source/administrator/components/com_jedchecker/controllers/police.raw.php +++ b/source/administrator/components/com_jedchecker/controllers/police.raw.php @@ -1,143 +1,143 @@ - - * @date 26.10.15 - * - * @copyright Copyright (C) 2008 - 2015 compojoom.com . All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE - */ - -defined('_JEXEC') or die('Restricted access'); - - -jimport('joomla.filesystem'); -jimport('joomla.filesystem.folder'); -jimport('joomla.filesystem.archive'); - -/** - * Class jedcheckerControllerPolice - * - * @since 1.0 - */ -class JedcheckerControllerPolice extends JControllerlegacy -{ - /** - * Runs all the rules on the given directory - * - * @return bool - */ - public function check() - { - $rule = JRequest::getString('rule'); - - JLoader::discover('jedcheckerRules', JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules/'); - - $path = JFactory::getConfig()->get('tmp_path') . '/jed_checker/unzipped'; - $class = 'jedcheckerRules' . ucfirst($rule); - - // Stop if the class does not exist - if (!class_exists($class)) - { - return false; - } - - // Loop through each folder and police it - $folders = $this->getFolders(); - - foreach ($folders as $folder) - { - $this->police($class, $folder); - } - - return true; - } - - /** - * Run each rule and echo the result - * - * @param string $class - the class anme - * @param string $folder - the folder where the component is located - * - * @return void - */ - protected function police($class, $folder) - { - // Prepare rule properties - $properties = array('basedir' => $folder); - - // Create instance of the rule - $police = new $class($properties); - - // Perform check - $police->check(); - - // Get the report and then print it - $report = $police->get('report'); - - echo '' - . JText::_('COM_JEDCHECKER_RULE') . ' ' . JText::_($police->get('id')) - . ' - ' . JText::_($police->get('title')) - . '
' - . $report->getHTML(); - - flush(); - ob_flush(); - } - - /** - * Get the folders that should be checked - * - * @return array - */ - protected function getFolders() - { - $folders = array(); - - // Add the folders in the "jed_checked/unzipped" folder - $path = JFactory::getConfig()->get('tmp_path') . '/jed_checker/unzipped'; - $tmp_folders = JFolder::folders($path); - - if (!empty($tmp_folders)) - { - foreach ($tmp_folders as $tmp_folder) - { - $folders[] = $path . '/' . $tmp_folder; - } - } - - // Parse the local.txt file and parse it - $local = JFactory::getConfig()->get('tmp_path') . '/jed_checker/local.txt'; - - if (JFile::exists($local)) - { - $content = JFile::read($local); - - if (!empty($content)) - { - $lines = explode("\n", $content); - - if (!empty($lines)) - { - foreach ($lines as $line) - { - $line = trim($line); - - if (!empty($line)) - { - if (JFolder::exists(JPATH_ROOT . '/' . $line)) - { - $folders[] = JPATH_ROOT . '/' . $line; - } - elseif (JFolder::exists($line)) - { - $folders[] = $line; - } - } - } - } - } - } - - return $folders; - } -} + + * @date 26.10.15 + * + * @copyright Copyright (C) 2008 - 2015 compojoom.com . All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE + */ + +defined('_JEXEC') or die('Restricted access'); + + +jimport('joomla.filesystem'); +jimport('joomla.filesystem.folder'); +jimport('joomla.filesystem.archive'); + +/** + * Class jedcheckerControllerPolice + * + * @since 1.0 + */ +class JedcheckerControllerPolice extends JControllerLegacy +{ + /** + * Runs all the rules on the given directory + * + * @return bool + */ + public function check() + { + $rule = JRequest::getString('rule'); + + JLoader::discover('jedcheckerRules', JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules/'); + + $path = JFactory::getConfig()->get('tmp_path') . '/jed_checker/unzipped'; + $class = 'jedcheckerRules' . ucfirst($rule); + + // Stop if the class does not exist + if (!class_exists($class)) + { + return false; + } + + // Loop through each folder and police it + $folders = $this->getFolders(); + + foreach ($folders as $folder) + { + $this->police($class, $folder); + } + + return true; + } + + /** + * Run each rule and echo the result + * + * @param string $class - the class anme + * @param string $folder - the folder where the component is located + * + * @return void + */ + protected function police($class, $folder) + { + // Prepare rule properties + $properties = array('basedir' => $folder); + + // Create instance of the rule + $police = new $class($properties); + + // Perform check + $police->check(); + + // Get the report and then print it + $report = $police->get('report'); + + echo '' + . JText::_('COM_JEDCHECKER_RULE') . ' ' . JText::_($police->get('id')) + . ' - ' . JText::_($police->get('title')) + . '
' + . $report->getHTML(); + + flush(); + ob_flush(); + } + + /** + * Get the folders that should be checked + * + * @return array + */ + protected function getFolders() + { + $folders = array(); + + // Add the folders in the "jed_checked/unzipped" folder + $path = JFactory::getConfig()->get('tmp_path') . '/jed_checker/unzipped'; + $tmp_folders = JFolder::folders($path); + + if (!empty($tmp_folders)) + { + foreach ($tmp_folders as $tmp_folder) + { + $folders[] = $path . '/' . $tmp_folder; + } + } + + // Parse the local.txt file and parse it + $local = JFactory::getConfig()->get('tmp_path') . '/jed_checker/local.txt'; + + if (JFile::exists($local)) + { + $content = JFile::read($local); + + if (!empty($content)) + { + $lines = explode("\n", $content); + + if (!empty($lines)) + { + foreach ($lines as $line) + { + $line = trim($line); + + if (!empty($line)) + { + if (JFolder::exists(JPATH_ROOT . '/' . $line)) + { + $folders[] = JPATH_ROOT . '/' . $line; + } + elseif (JFolder::exists($line)) + { + $folders[] = $line; + } + } + } + } + } + } + + return $folders; + } +} diff --git a/source/administrator/components/com_jedchecker/controllers/uploads.php b/source/administrator/components/com_jedchecker/controllers/uploads.php index 7ccf251..300223b 100644 --- a/source/administrator/components/com_jedchecker/controllers/uploads.php +++ b/source/administrator/components/com_jedchecker/controllers/uploads.php @@ -18,7 +18,7 @@ jimport('joomla.filesystem.archive'); * * @since 1.0 */ -class JedcheckerControllerUploads extends JControllerlegacy +class JedcheckerControllerUploads extends JControllerLegacy { /** * Constructor. diff --git a/source/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php b/source/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php index f3df6d9..69161f0 100644 --- a/source/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php +++ b/source/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php @@ -71,7 +71,7 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule */ protected function find($file) { - $xml = JFactory::getXML($file); + $xml = JFactory::getXml($file); // Failed to parse the xml file. // Assume that this is not a extension manifest diff --git a/source/administrator/components/com_jedchecker/libraries/rules/xmllicense.php b/source/administrator/components/com_jedchecker/libraries/rules/xmllicense.php index 11d1516..8abe7e8 100644 --- a/source/administrator/components/com_jedchecker/libraries/rules/xmllicense.php +++ b/source/administrator/components/com_jedchecker/libraries/rules/xmllicense.php @@ -69,7 +69,7 @@ class JedcheckerRulesXMLlicense extends JEDcheckerRule */ protected function find($file) { - $xml = JFactory::getXML($file); + $xml = JFactory::getXml($file); // Failed to parse the xml file. // Assume that this is not a extension manifest diff --git a/source/administrator/components/com_jedchecker/views/uploads/tmpl/default.php b/source/administrator/components/com_jedchecker/views/uploads/tmpl/default.php index 721679c..91ff984 100644 --- a/source/administrator/components/com_jedchecker/views/uploads/tmpl/default.php +++ b/source/administrator/components/com_jedchecker/views/uploads/tmpl/default.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die('Restricted access'); -JHTML::_('behavior.framework', true); +JHtml::_('behavior.framework', true); JHtml::_('behavior.formvalidation'); JHtml::_('behavior.keepalive'); JHtml::stylesheet('media/com_jedchecker/css/css.css'); @@ -53,7 +53,7 @@ JHtml::script('media/com_jedchecker/js/police.js'); - + 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 e6504be..30df241 100644 --- a/source/administrator/components/com_jedchecker/views/uploads/view.html.php +++ b/source/administrator/components/com_jedchecker/views/uploads/view.html.php @@ -28,7 +28,7 @@ class JedcheckerViewUploads extends JViewLegacy public function display($tpl = null) { $this->setToolbar(); - $this->jsOptions['url'] = JURI::base(); + $this->jsOptions['url'] = JUri::base(); $this->jsOptions['rules'] = $this->getRules(); parent::display($tpl); } @@ -61,19 +61,19 @@ class JedcheckerViewUploads extends JViewLegacy { if ($this->filesExist('archives')) { - JToolBarHelper::custom('uploads.unzip', 'folder', 'folder', 'unzip', false); + JToolbarHelper::custom('uploads.unzip', 'folder', 'folder', 'unzip', false); } if ($this->filesExist('unzipped')) { - JToolBarHelper::custom('police.check', 'search', 'search', 'Check', false); + JToolbarHelper::custom('police.check', 'search', 'search', 'Check', false); } - JToolBarHelper::title('JED checker'); + JToolbarHelper::title('JED checker'); if (JFactory::getUser()->authorise('core.admin', 'com_jedchecker')) { - JToolBarHelper::preferences('com_jedchecker'); + JToolbarHelper::preferences('com_jedchecker'); } }