Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- removing the build files and using the buildtools one (https://gith…

  • Loading branch information...
commit 45c766f0a062306e68edb029f83261ca4508b160 1 parent b02eb9d
@compojoom authored
View
4 CHANGELOG
@@ -1,3 +1,7 @@
Changelog:
+~ code cleaup and joomla's phpcs compatibility (at least for the rules)
+# Fixed unnecessary GPL checks in php files with no code - thanks to Peter van Westen
+# Fixed unnecessary JEXEC checks in php files with no code - thanks to Peter van Westen
++ added rule to check for error_reporting(0) - thanks to Denis Delici
# JFile not found
View
46 README.md
@@ -5,19 +5,35 @@ This extension is able to check your components, modules or plugins for common e
from publishing your extension on the JED (Joomla! Extensions Directory).
Installing this extension
--------------------------
-ZIP packages for installation in joomla can be found here:
+ZIP packages with the latest stable version of the extension can be found here:
https://compojoom.com/downloads/official-releases-stable/jedchecker
-Alternatively, download the sources of this repository and use Phing to build the packages.
+If you are developer and want to contribute to this extension you can fork this repo.
-Uploading your package
-----------------------
+## Building the zip package from this repository
+In order to build the installation packages of this library you need to have
+the following tools:
+
+- A command line environment. Bash under Linux / Mac OS X . On Windows
+ you will need to run most tools using an elevated privileges (administrator)
+ command prompt.
+- The PHP CLI binary in your path
+
+- Command line Subversion and Git binaries(*)
+
+- PEAR and Phing installed, with the Net_FTP and VersionControl_SVN PEAR
+ packages installed
+
+You will also need the following path structure on your system
+
+- com_jedchecker - This repository
+- buildtools - Compojoom build tools (https://github.com/compojoom/buildtools)
+
+## Uploading your package
After installing this extension in your Joomla! backend, you can use it by uploading a Joomla! extension-package using
the upload-button. Once uploaded, the contents of the package (your files) will be checked against JED-rules.
-Adding rules
-------------
+## Adding rules
If you want to write a rule have a look a the `administrator/components/com_jedchecker/library/rules` folder.
You just need to add a new file with your rule, for example `yourrule.php`.
@@ -26,8 +42,10 @@ The file `yourrule.php` needs to have a class `jedcheckerRulesYourrule` and that
function that accepts the basedir as parameter. This is all - the component will automatically call
your rule check function.
-Checking on existing files and folders
---------------------------------------
+If you are going to contribute your rule to the project, then make sure that it follows the joomla coding conventions
+and that it passes the code sniffer: http://docs.joomla.org/Joomla_CodeSniffer
+
+## Checking on existing files and folders
The extension also supports a scan of a pre-defined set of existing files and folders.
For this to work, add a list of folders to a textfile `tmp/jed_checker/local.txt`.
There should be a folder on each line.
@@ -40,3 +58,13 @@ Example `tmp/jed_checker/local.txt` file:
plugins/system
+## COPYRIGHT AND DISCLAIMER
+CMandrill - Copyright (c) 2008-2013 Compojoom.com
+
+This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the
+Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
View
22 builds/component.xml → builds/build.xml
@@ -10,12 +10,11 @@
<project name="com_jedchecker" default="buildZip">
<property file="./build.properties"/>
- <taskdef name="extfile" classname="phingext.listJPackageFilesTask"/>
- <taskdef name="gitversion" classname="phingext.GitVersionTask"/>
- <taskdef name="explode" classname="phingext.explodeTask"/>
+ <taskdef name="extfile" classname="phingext.listJPackageFilesTask" classpath="../../buildtools"/>
+ <taskdef name="gitversion" classname="phingext.GitVersionTask" classpath="../../buildtools"/>
+ <taskdef name="explode" classname="phingext.explodeTask" classpath="../../buildtools"/>
- <import file="plugin.xml" optional="true"/>
- <import file="module.xml" optional="true"/>
+ <import file="../../buildtools/helper.xml" optional="true"/>
<target name="setup-properties">
<!-- Initialize the version if it's not set -->
@@ -142,19 +141,6 @@
component="com_${component.name}"
/>
- <if>
- <isset property="plugins"/>
- <then>
- <foreach list="${plugins}" param="plugin" target="buildPlugin"/>
- </then>
- </if>
-
- <if>
- <isset property="modules_admin"/>
- <then>
- <foreach list="${modules_admin}" param="module_admin" target="buildModule"/>
- </then>
- </if>
</target>
<target name="dev-release" description="Makes everything except the documentation"
View
83 builds/module.xml
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Generic build module
- ${module} should be mod_something...
--->
-
-<project name="mod" default="buildModule">
-
- <property name="admin_folder" value=""/>
- <if>
- <isset property="module_admin"/>
- <then>
- <property name="admin_folder" value="/administrator" override="true"/>
- <property name="module" value="${module_admin}" override="true" />
- </then>
- </if>
-
- <target name="buildModule">
- <!--do we have a media folder?-->
- <available file="${dirs.source}\media\${module}"
- type="dir" property="mod.media.exist" value="yes"/>
-
- <if>
- <equals arg1="${adminLang.exist}" arg2="1"/>
- <then>
- <copy todir="${destination.dir}/administrator/modules/${module}/administrator/language/">
- <fileset dir="${dirs.source}/administrator/language/">
- <include name="**/*.${module}.**"/>
- </fileset>
- </copy>
- </then>
- </if>
-
- <if>
- <equals arg1="${frontendLang.exist}" arg2="1"/>
- <then>
-
- <copy todir="${destination.dir}/modules/${module}/language/">
- <fileset dir="${dirs.source}/language/">
- <include name="**/*.${module}.**"/>
- </fileset>
- </copy>
- </then>
- </if>
-
- <copy todir="${destination.dir}${admin_folder}/modules/${module}">
- <fileset dir="${dirs.source}${admin_folder}/modules/${module}" includes="**/*.*"/>
- </copy>
-
- <if>
- <equals arg1="${mod.media.exist}" arg2="1"/>
- <then>
- <copy todir="${destination.dir}${admin_folder}/modules/${module}/media/${module}">
- <fileset dir="${dirs.source}/media/${module}">
- <include name="**/*.*"/>
- <exclude name="kml/*.*"/>
- </fileset>
- </copy>
- </then>
- </if>
-
- <copy file="${dirs.source}${admin_folder}/modules/${module}/${module}.xml"
- tofile="${destination.dir}${admin_folder}/modules/${module}/${module}.xml" overwrite="true">
-
- <filterchain>
-
- <replacetokens begintoken="@@" endtoken="@@">
- <token key="DATE" value="${build.date}"/>
- <token key="VERSION" value="${build.version}"/>
- <token key="MODULENAME" value="${module}"/>
- </replacetokens>
- </filterchain>
- </copy>
-
- <extfile file="${destination.dir}${admin_folder}/modules/${module}/${module}.xml"
- sourceDir="${dirs.source}${admin_folder}/modules/${module}/"
- component="${module}"
- type="module"
- />
-
- </target>
-
-</project>
View
55 builds/phingext/GitVersionTask.php
@@ -1,55 +0,0 @@
-<?php
-require_once 'phing/Task.php';
-require_once 'phing/tasks/ext/svn/SvnBaseTask.php';
-
-/**
- * Git latest tree version to Phing property
- * @package akeebabuilder
- * @copyright Copyright (c)2009-2010 Nicholas K. Dionysopoulos
- * @license GNU GPL version 3 or, at your option, any later version
- * @author nicholas
- */
-class GitVersionTask extends SvnBaseTask
-{
- private $propertyName = "git.version";
-
- /**
- * Sets the name of the property to use
- */
- function setPropertyName($propertyName)
- {
- $this->propertyName = $propertyName;
- }
-
- /**
- * Returns the name of the property to use
- */
- function getPropertyName()
- {
- return $this->propertyName;
- }
-
- /**
- * Sets the path to the working copy
- */
- function setWorkingCopy($wc)
- {
- $this->workingCopy = $wc;
- }
-
- /**
- * The main entry point
- *
- * @throws BuildException
- */
- function main()
- {
- $this->setup('info');
-
-
- exec('git log -n 1 --no-decorate --pretty=format:"%h" '.escapeshellarg(realpath($this->workingCopy)), $out);
- $version = $out[0];
-
- $this->project->setProperty($this->getPropertyName(), $version);
- }
-}
View
56 builds/phingext/explodetask.php
@@ -1,56 +0,0 @@
-<?php
-
-require_once "phing/Task.php";
-
-class explodeTask extends Task
-{
-
-
- public function setString($string)
- {
- $this->string = $string;
- }
-
- public function setDelimiter($delimiter) {
- $this->delimiter = $delimiter;
- }
-
- public function setKey($key) {
- $this->key = $key;
- }
-
- /**
- * Defines the name of a property to be set .
- *
- * @param string $name Name for the property to be set from input
- */
- public function setPropertyName($name) {
- $this->propertyName = $name;
- }
-
- /**
- * The init method: Do init steps.
- */
- public function init()
- {
- // nothing to do here
- }
-
- /**
- * The main entry point method.
- */
- public function main()
- {
- if ($this->propertyName === null) {
- throw new BuildException("You must specify a value for propertyName attribute.");
- }
-
-
- $value = explode($this->delimiter, $this->string);
-
- if ($value !== null) {
- $this->project->setUserProperty($this->propertyName, $value[$this->key]);
- }
- }
-
-}
View
310 builds/phingext/listjpackagefilestask.php
@@ -1,310 +0,0 @@
-<?php
-
-require_once "phing/Task.php";
-
-class listJPackageFilesTask extends Task
-{
-
- public $file;
- public $type = 'component';
-
- public function setType($type) {
- $this->type = $type;
- }
-
- public function setFile($str)
- {
- $this->file = $str;
- }
-
- public function setSourceDir($dir)
- {
- $this->sourceDir = $dir;
- }
-
- public function setComponent($name)
- {
- $this->component = $name;
- }
-
- /**
- * The init method: Do init steps.
- */
- public function init()
- {
- // nothing to do here
- }
-
- /**
- * The main entry point method.
- */
- public function main()
- {
- $content = file_get_contents($this->file);
-
- $content = preg_replace_callback('/##PACKAGEFILESPLUGIN##/', 'self::findPluginPackageFiles', $content);
-
- if (preg_match('/##PACKAGEFILESMODULE##/', $content)) {
- $content = preg_replace('/##PACKAGEFILESMODULE##/',
- call_user_func('self::findModulePackageFiles'), $content);
- }
-
- if (preg_match('/##ADMINLANGUAGEFILES##/', $content)) {
- $content = preg_replace('/##ADMINLANGUAGEFILES##/',
- call_user_func('self::languageFiles', true), $content);
- }
-
- if (preg_match('/##FRONTENDLANGUAGEFILES##/', $content)) {
- $content = preg_replace('/##FRONTENDLANGUAGEFILES##/',
- call_user_func('self::languageFiles', false), $content);
- }
-
- if (preg_match('/##ADMINCOMPONENTPACKAGEFILES##/', $content)) {
- $content = preg_replace('/##ADMINCOMPONENTPACKAGEFILES##/',
- call_user_func('self::findComponentPackagefiles', true), $content);
- }
-
-
- if (preg_match('/##FRONTENDCOMPONENTPACKAGEFILES##/', $content)) {
- $content = preg_replace('/##FRONTENDCOMPONENTPACKAGEFILES##/',
- call_user_func('self::findComponentPackagefiles', false), $content);
- }
-
- if (preg_match('/##MEDIAPACKAGEFILES##/', $content)) {
- $content = preg_replace('/##MEDIAPACKAGEFILES##/',
- call_user_func('self::findMediaPackagefiles', false), $content);
- }
-
- file_put_contents($this->file, $content);
- }
-
- public function languageFiles($admin = false)
- {
-
- if($this->type == 'module') {
- $this->sourceDir = $this->sourceDir . '/../../';
- }
- if($this->type == 'plugin') {
- $this->sourceDir = $this->sourceDir . '/../../../';
- }
- $languageFolder = $this->sourceDir . '/language';
- if ($admin) {
- $languageFolder = $this->sourceDir . '/administrator/language';
- }
- $list = array();
- if (file_exists($languageFolder)) {
- $dir = new DirectoryIterator($languageFolder);
-
- foreach ($dir as $element) {
- if (!$element->isDot()) {
- if ($element->isDir()) {
- $langDir = new DirectoryIterator($element->getPath() . '/' . $element->getFileName());
-
- foreach ($langDir as $langElement) {
- if (!$langElement->isDot()) {
- if ($langElement->isFile()) {
- if ($this->component) {
-// if(strstr($this->component,'sys'))
- $name = explode('.', $langElement->getFileName());
- $name = $name[1];
- if ($name == $this->component) {
- $list[] = '<language tag="' . $element->getFileName() . '">'
- . $element->getFileName() . '/' . $langElement->getFileName() . '</language>';
- }
- }
-// else {
-// $list[] = '<language tag="' . $element->getFileName() . '">'
-// . $element->getFileName() . '/' . $langElement->getFileName() . '</language>';
-// }
- // $packageMainFile = basename($this->file, '.xml');
- // if ($element->getFileName() == $packageMainFile . '.php') {
- // . $element->getFileName() . '/' . $langElement->getFileName() . '</language>';
- }
- }
- }
- }
- }
- }
- } else {
- echo 'Folder ' . $languageFolder . ' doesn\'t exist';
- }
-
- return implode("\n", $list);
- }
-
- public function findComponentPackagefiles($admin = false)
- {
- $list = array();
- $componentFolder = $this->sourceDir . '/components/' . $this->component;
- if ($admin) {
- $componentFolder = $this->sourceDir . '/administrator/components/' . $this->component;
- }
-
- if (file_exists($componentFolder)) {
- $dir = new DirectoryIterator($componentFolder);
- foreach ($dir as $element) {
- if (!$element->isDot()) {
- if ($element->isDir()) {
- $list[] = '<folder>' . $element->getFileName() . '</folder>';
- }
- if ($element->isFile()) {
- $list[] = '<file>' . $element->getFileName() . '</file>';
- }
- }
-
- }
- } else {
- echo 'Folder ' . $componentFolder . ' doesn\'t exist';
- }
-
- return implode("\n", $list);
- }
-
- public function findMediaPackagefiles()
- {
- $list = array();
- $source = $this->sourceDir;
- if(strstr($source, '/administrator/')) {
- if($this->type == 'module') {
- $source = $source . '..';
- }
- }
- $mediaFolder = $source . '/media/' . $this->component;
- if (file_exists($mediaFolder)) {
- $dir = new DirectoryIterator($mediaFolder);
- foreach ($dir as $element) {
- if (!$element->isDot() && substr($element, 0, 1) != ".") {
- if ($element->isDir()) {
- $list[] = '<folder>' . $element->getFileName() . '</folder>';
- }
- if ($element->isFile()) {
- $list[] = '<file>' . $element->getFileName() . '</file>';
- }
- }
-
- }
-
- } else {
- echo 'Folder ' . $mediaFolder . ' doesn\'t exist';
- }
- return implode("\n", $list);
- }
-
- public function findPluginPackageFiles()
- {
- $list = array();
- if (file_exists($this->sourceDir)) {
- $dir = new DirectoryIterator($this->sourceDir);
- foreach ($dir as $element) {
- if (!$element->isDot()) {
- if ($element->isDir()) {
- $skip = false;
- if ($element->getFileName() == 'administrator') {
- /**
- * we need to handle the language folder in the plugin
- * differently. If the administrator folder contains
- * just the language folder we don't need to list it.
- * Otherwise when the user installs the plugin he will have
- * administrator/language in his plugi folder which is lame...
- */
- $adminDir = new DirectoryIterator($this->sourceDir . '/administrator');
- $i = 0;
- $language = false;
- foreach ($adminDir as $adminElement) {
- if ($adminElement->isDir() && !$adminElement->isDot()) {
- if ($adminElement->getFileName() == 'language') {
- $language = true;
- }
- $i++;
- }
- }
- /**
- * so we have just one folder and it is
- * the language one???
- */
- if ($i == 1 && $language == true) {
- $skip = true;
- }
- }
-
- if (!$skip) {
- $list[] = '<folder>' . $element->getFileName() . '</folder>';
- }
- }
- if ($element->isFile()) {
- $packageMainFile = basename($this->file, '.xml');
- if ($element->getFileName() == $packageMainFile . '.php') {
- $list[] = '<file plugin="' . $packageMainFile . '">' . $element->getFilename() . '</file>';
- } elseif ($element->getFileName() != basename($this->file)) {
- $list[] = '<file>' . $element->getFileName() . '</file>';
- }
- }
- }
- }
- } else {
- echo 'Folder ' . $this->sourceDir . ' doesn\'t exist';
- }
-
- return implode("\n", $list);
- }
-
-
- public function findModulePackageFiles()
- {
- $list = array();
- if (file_exists($this->sourceDir)) {
- $dir = new DirectoryIterator($this->sourceDir);
- foreach ($dir as $element) {
- if (!$element->isDot()) {
- if ($element->isDir()) {
- $skip = false;
- if ($element->getFileName() == 'administrator') {
- /**
- * we need to handle the language folder in the plugin
- * differently. If the administrator folder contains
- * just the language folder we don't need to list it.
- * Otherwise when the user installs the plugin he will have
- * administrator/language in his plugi folder which is lame...
- */
- $adminDir = new DirectoryIterator($this->sourceDir . '/administrator');
- $i = 0;
- $language = false;
- foreach ($adminDir as $adminElement) {
- if ($adminElement->isDir() && !$adminElement->isDot()) {
- if ($adminElement->getFileName() == 'language') {
- $language = true;
- }
- $i++;
- }
- }
- /**
- * so we have just one folder and it is
- * the language one???
- */
- if ($i == 1 && $language == true) {
- $skip = true;
- }
- }
-
- if (!$skip) {
- $list[] = '<folder>' . $element->getFileName() . '</folder>';
- }
- }
- if ($element->isFile()) {
- $packageMainFile = basename($this->file, '.xml');
- if ($element->getFileName() == $packageMainFile . '.php') {
- $list[] = '<file module="' . $packageMainFile . '">' . $element->getFilename() . '</file>';
- } elseif ($element->getFileName() != basename($this->file)) {
- $list[] = '<file>' . $element->getFileName() . '</file>';
- }
- }
- }
- }
- } else {
- echo 'Folder ' . $this->sourceDir . ' doesn\'t exist';
- }
-
- return implode("\n", $list);
- }
-
-}
View
65 builds/plugin.xml
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Generic build plugin
- ${plugin} should be mod_something...
--->
-
-<project name="plugin" default="buildPlugin">
-
- <target name="buildPlugin">
- <explode propertyName="pluginType" string="${plugin}" delimiter="_" key="1" />
- <explode propertyName="pluginName" string="${plugin}" delimiter="_" key="2" />
-
- <!--do we have a media folder?-->
- <available file="${dirs.source}\media\${plugin}"
- type="dir" property="mod.media.exist" value="yes"/>
-
- <if>
- <equals arg1="${adminLang.exist}" arg2="1"/>
- <then>
- <copy todir="${destination.dir}/plugins/${pluginType}/${pluginName}/administrator/language/">
- <fileset dir="${dirs.source}/administrator/language/">
- <include name="**/*.${plugin}.**"/>
- </fileset>
- </copy>
- </then>
- </if>
-
- <copy todir="${destination.dir}/plugins/${pluginType}/${pluginName}">
- <fileset dir="${dirs.source}/plugins/${pluginType}/${pluginName}" includes="**/*.*"/>
- </copy>
-
- <if>
- <equals arg1="${mod.media.exist}" arg2="1"/>
- <then>
- <copy todir="${destination.dir}/modules/${pluginType}/${pluginName}/media/${plugin}">
- <fileset dir="${dirs.source}/media/${plugin}">
- <include name="**/*.*"/>
- <exclude name="kml/*.*"/>
- </fileset>
- </copy>
- </then>
- </if>
-
- <copy file="${dirs.source}/plugins/${pluginType}/${pluginName}/${pluginName}.xml"
- tofile="${destination.dir}/plugins/${pluginType}/${pluginName}/${pluginName}.xml" overwrite="true">
-
- <filterchain>
-
- <replacetokens begintoken="@@" endtoken="@@">
- <token key="DATE" value="${build.date}"/>
- <token key="VERSION" value="${build.version}"/>
- <token key="PLUGINNAME" value="${plugin}"/>
- </replacetokens>
- </filterchain>
- </copy>
-
- <extfile file="${destination.dir}/plugins/${pluginType}/${pluginName}/${pluginName}.xml"
- sourceDir="${dirs.source}/plugins/${pluginType}/${pluginName}"
- component="${plugin}"
- type="plugin"
- />
-
- </target>
-
-</project>
View
2  source/administrator/components/com_jedchecker/views/uploads/tmpl/default.php
@@ -64,6 +64,8 @@
<p><?php echo JText::_('COM_JEDCHECKER_PEOPLE_THAT_HAVE_HELPED_WITH_THE_DEVELOPMENT'); ?></p>
<ul>
<li>Tobias Kuhn (<a href="http://projectfork.net" target="_blank">projectfork</a>)</li>
+ <li>Jisse Reitsma (<a href="http://www.yireo.com/" target="_blank">yireo</a>)</li>
+ <li>Denis Dulici (<a href="http://mijosoft.com/" target="_blank">mijosoft</a>)</li>
<li>Peter van Westen (<a href="http://www.nonumber.nl" target="_blank">NoNumber</a>)</li>
<li>Alain Rivest (<a href="http://aldra.ca" target="_blank">Aldra.ca</a>)</li>
<li>OpenTranslators (<a href="http://opentranslators.org" target="_blank">opentranslators.org</a>)</li>
View
2  source/administrator/language/en-GB/en-GB.com_jedchecker.ini
@@ -9,7 +9,7 @@ COM_JEDCHECKER_STEP1="Upload your component/plugin/module zip file by using the
COM_JEDCHECKER_STEP2="Click on unzip"
COM_JEDCHECKER_STEP3="Click on check and review the results"
COM_JEDCHECKER_WALL_OF_HONOR="Wall of honor"
-COM_JEDCHECKER_PEOPLE_THAT_HAVE_HELPED_WITH_THE_DEVELOPMENT="People that have helped with the development of this component"
+COM_JEDCHECKER_PEOPLE_THAT_HAVE_HELPED_WITH_THE_DEVELOPMENT="People that have helped with the development of this component. (in no particular order!)"
COM_JEDCHECKER_HOW_TO_INTERPRET_RESULTS="How to interpret the results?"
COM_JEDCHECKER_RULE_PH2="PHP Files missing JEXEC security"
COM_JEDCHECKER_RULE_PH2_DESC="All the PHP files in your extension needs to have a defined('_JEXEC') or die(); statement in the beginning of each file. This ensures that the file cannot be opened outside of the joomla installation and this way increases the security of your site."
Please sign in to comment.
Something went wrong with that request. Please try again.