Skip to content

Commit

Permalink
Merge pull request #31 from demis-palma/fix-4
Browse files Browse the repository at this point in the history
Fixed case in classes and method names
  • Loading branch information
Jaz Parkyn committed May 25, 2016
2 parents 2c5d52e + 3183eda commit 99813ca
Show file tree
Hide file tree
Showing 7 changed files with 172 additions and 172 deletions.
38 changes: 19 additions & 19 deletions source/administrator/components/com_jedchecker/controller.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php
/**
* @author Daniel Dimitrov <daniel@compojoom.com>
* @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
{
}
<?php
/**
* @author Daniel Dimitrov <daniel@compojoom.com>
* @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
{
}
286 changes: 143 additions & 143 deletions source/administrator/components/com_jedchecker/controllers/police.raw.php
Original file line number Diff line number Diff line change
@@ -1,143 +1,143 @@
<?php
/**
* @author Daniel Dimitrov <daniel@compojoom.com>
* @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 '<span class="rule">'
. JText::_('COM_JEDCHECKER_RULE') . ' ' . JText::_($police->get('id'))
. ' - ' . JText::_($police->get('title'))
. '</span><br/>'
. $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;
}
}
<?php
/**
* @author Daniel Dimitrov <daniel@compojoom.com>
* @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 '<span class="rule">'
. JText::_('COM_JEDCHECKER_RULE') . ' ' . JText::_($police->get('id'))
. ' - ' . JText::_($police->get('title'))
. '</span><br/>'
. $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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* @since 1.0
*/
class JedcheckerControllerUploads extends JControllerlegacy
class JedcheckerControllerUploads extends JControllerLegacy
{
/**
* Constructor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function check()
*/
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function check()
*/
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -53,7 +53,7 @@
<span class="icon-upload "></span> <?php echo JText::_('JSUBMIT'); ?>
</button>
<input type="hidden" name="task" value=""/>
<?php echo JHTML::_('form.token'); ?>
<?php echo JHtml::_('form.token'); ?>
</fieldset>
</form>
</div>
Expand Down
Loading

0 comments on commit 99813ca

Please sign in to comment.