31
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-06-25 23:52:34 +00:00

Merge pull request #41 from joomla-extensions/develop

Merging Develop Branch
This commit is contained in:
Jaz Parkyn 2017-04-02 22:58:29 +01:00 committed by GitHub
commit 0cffa5b818
49 changed files with 205 additions and 262 deletions

View File

@ -1,16 +0,0 @@
[main]
host = compojoom
lang_map = af_ZA: af-ZA, am_ET: am-ET, ar_AE: ar-AE, ar_BH: ar-BH, ar_DZ: ar-DZ, ar_EG: ar-EG, ar_IQ: ar-IQ, ar_JO: ar-JO, ar_KW: ar-KW, ar_LB: ar-LB, ar_LY: ar-LY, ar_MA: ar-MA, ar_OM: ar-OM, ar_QA: ar-QA, ar_SA: ar-SA, ar_SY: ar-SY, ar_TN: ar-TN, ar_YE: ar-YE, arn_CL: arn-CL, as_IN: as-IN, az_AZ: az-AZ, ba_RU: ba-RU, be_BY: be-BY, bg_BG: bg-BG, bn_BD: bn-BD, bn_IN: bn-IN, bo_CN: bo-CN, br_FR: br-FR, bs_BA: bs-BA, ca_ES: ca-ES, co_FR: co-FR, cs_CZ: cs-CZ, cy_GB: cy-GB, da_DK: da-DK, de_AT: de-AT, de_CH: de-CH, de_DE: de-DE, de_LI: de-LI, de_LU: de-LU, dsb_DE: dsb-DE, dv_MV: dv-MV, el_GR: el-GR, en_AU: en-AU, en_BZ: en-BZ, en_CA: en-CA, en_GB: en-GB, en_IE: en-IE, en_IN: en-IN, en_JM: en-JM, en_MY: en-MY, en_NZ: en-NZ, en_PH: en-PH, en_SG: en-SG, en_TT: en-TT, en_US: en-US, en_ZA: en-ZA, en_ZW: en-ZW, es_AR: es-AR, es_BO: es-BO, es_CL: es-CL, es_CO: es-CO, es_CR: es-CR, es_DO: es-DO, es_EC: es-EC, es_ES: es-ES, es_GT: es-GT, es_HN: es-HN, es_MX: es-MX, es_NI: es-NI, es_PA: es-PA, es_PE: es-PE, es_PR: es-PR, es_PY: es-PY, es_SV: es-SV, es_US: es-US, es_UY: es-UY, es_VE: es-VE, et_EE: et-EE, eu_ES: eu-ES, fa_IR: fa-IR, fi_FI: fi-FI, fil_PH: fil-PH, fo_FO: fo-FO, fr_BE: fr-BE, fr_CA: fr-CA, fr_CH: fr-CH, fr_FR: fr-FR, fr_LU: fr-LU, fr_MC: fr-MC, fy_NL: fy-NL, ga_IE: ga-IE, gd_GB: gd-GB, gl_ES: gl-ES, gsw_FR: gsw-FR, gu_IN: gu-IN, ha_NG: ha-NG, he_IL: he-IL, hi_IN: hi-IN, hr_BA: hr-BA, hr_HR: hr-HR, hsb_DE: hsb-DE, hu_HU: hu-HU, hy_AM: hy-AM, id_ID: id-ID, ig_NG: ig-NG, ii_CN: ii-CN, is_IS: is-IS, it_CH: it-CH, it_IT: it-IT, iu_CA: iu-CA, ja_JP: ja-JP, ka_GE: ka-GE, kk_KZ: kk-KZ, kl_GL: kl-GL, km_KH: km-KH, kn_IN: kn-IN, ko_KR: ko-KR, kok_IN: kok-IN, ky_KG: ky-KG, lb_LU: lb-LU, lo_LA: lo-LA, lt_LT: lt-LT, lv_LV: lv-LV, mi_NZ: mi-NZ, mk_MK: mk-MK, ml_IN: ml-IN, mn_CN: mn-CN, mn_MN: mn-MN, moh_CA: moh-CA, mr_IN: mr-IN, ms_BN: ms-BN, ms_MY: ms-MY, mt_MT: mt-MT, nb_NO: nb-NO, ne_NP: ne-NP, nl_BE: nl-BE, nl_NL: nl-NL, nn_NO: nn-NO, nso_ZA: nso-ZA, oc_FR: oc-FR, or_IN: or-IN, pa_IN: pa-IN, pl_PL: pl-PL, prs_AF: prs-AF, ps_AF: ps-AF, pt_BR: pt-BR, pt_PT: pt-PT, qut_GT: qut-GT, quz_BO: quz-BO, quz_EC: quz-EC, quz_PE: quz-PE, rm_CH: rm-CH, ro_RO: ro-RO, ru_RU: ru-RU, rw_RW: rw-RW, sa_IN: sa-IN, sah_RU: sah-RU, se_FI: se-FI, se_NO: se-NO, se_SE: se-SE, si_LK: si-LK, sk_SK: sk-SK, sl_SI: sl-SI, sma_NO: sma-NO, sma_SE: sma-SE, smj_NO: smj-NO, smj_SE: smj-SE, smn_FI: smn-FI, sms_FI: sms-FI, sq_AL: sq-AL, sr_BA: sr-BA, sr_CS: sr-CS, sr_ME: sr-ME, sr_RS: sr-RS, sv_FI: sv-FI, sv_SE: sv-SE, sw_KE: sw-KE, syr_SY: syr-SY, ta_IN: ta-IN, te_IN: te-IN, tg_TJ: tg-TJ, th_TH: th-TH, tk_TM: tk-TM, tn_ZA: tn-ZA, tr_TR: tr-TR, tt_RU: tt-RU, tzm_DZ: tzm-DZ, ug_CN: ug-CN, uk_UA: uk-UA, ur_PK: ur-PK, uz_UZ: uz-UZ, vi_VN: vi-VN, wo_SN: wo-SN, xh_ZA: xh-ZA, yo_NG: yo-NG, zh_CN: zh-CN, zh_HK: zh-HK, zh_MO: zh-MO, zh_SG: zh-SG, zh_TW: zh-TW, zu_ZA: zu-ZA
type = INI
[compojoom-jedchecker.admin_com_jedchecker]
file_filter = source\administrator\language\<lang>\<lang>.com_jedchecker.ini
source_file = source\administrator\language\en-GB\en-GB.com_jedchecker.ini
source_lang = en_GB
minimum_perc = 100
[compojoom-jedchecker.admin_com_jedchecker_sys]
file_filter = source\administrator\language\<lang>\<lang>.com_jedchecker.sys.ini
source_file = source\administrator\language\en-GB\en-GB.com_jedchecker.sys.ini
source_lang = en_GB
minimum_perc = 100

View File

@ -1,41 +1,11 @@
JEDchecker
JED Checker
==========
This extension is able to check your components, modules or plugins for common errors that will prevent you
from publishing your extension on the JED (Joomla! Extensions Directory).
Installing this extension
ZIP packages with the latest stable version of the extension can be found here:
https://compojoom.com/downloads/official-releases-stable/jedchecker
If you are developer and want to contribute to this extension you can fork this repo.
## 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)
To execute the build, copy `com_jedchecker/builds/build.properties.txt` renaming it without the `.txt` suffix.
Then in your command line navigate to the `builds` directory and run `phing`
cd com_jedchecker/builds/
phing
## 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.

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<access component="com_jedchecker">
<section name="component">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
</section>
</access>

View File

@ -1,32 +1,32 @@
<?php
/**
* @author Daniel Dimitrov - compojoom.com
* @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
*/
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.controllerlegacy');
if (!JFactory::getUser()->authorise('core.manage', 'com_jedchecker'))
{
throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'));
}
// We'll need jfile and JFolder all through the compoenent so let us load them here
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
$input = JFactory::getApplication()->input;
$view = $input->getCmd('view', '');
if ($view == '' && $input->getCmd('task', '') == '')
{
$input->set('view', 'uploads');
}
$controller = JControllerLegacy::getInstance('jedchecker');
$controller->execute($input->getCmd('task', ''));
$controller->redirect();
<?php
/**
* @author Daniel Dimitrov - compojoom.com
* @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
*/
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.controllerlegacy');
if (!JFactory::getUser()->authorise('core.manage', 'com_jedchecker'))
{
throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'));
}
// We'll need jfile and JFolder all through the compoenent so let us load them here
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
$input = JFactory::getApplication()->input;
$view = $input->getCmd('view', '');
if ($view == '' && $input->getCmd('task', '') == '')
{
$input->set('view', 'uploads');
}
$controller = JControllerLegacy::getInstance('jedchecker');
$controller->execute($input->getCmd('task', ''));
$controller->redirect();

View File

@ -1,11 +0,0 @@
build.version=dev
component.name=jedchecker
component.upperName=JEDCHECKER
; FTP Options
ftp.host=ftp.example.com
ftp.port=21
ftp.username=username
ftp.password=password
ftp.dir=/path/to/directory
ftp.mode=binary

View File

@ -1,172 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
JED Checker build file for Phing
written by Daniel Dimitrov - https://compojoom.com
Run "phing -f component.xml"
from the build directory to build the component
-->
<project name="com_jedchecker" default="buildZip">
<property file="./build.properties"/>
<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="../../buildtools/helper.xml" optional="true"/>
<target name="setup-properties">
<!-- Initialize the version if it's not set -->
<tstamp>
<format property="build.date" pattern="%Y-%m-%d"/>
</tstamp>
<property name="dirs.root" value="${project.basedir}/../"/>
<property name="dirs.source" value="${dirs.root}source"/>
<if>
<equals arg1="${build.version}" arg2="dev"/>
<then>
<gitversion workingCopy="${dirs.root}" propertyName="git.lastrevision"/>
<property name="build.version" value="git_${git.lastrevision}" override="true"/>
</then>
</if>
<property name="destination.dir"
value="${dirs.root}/packages/components/com_${component.name}/com_${component.name}-${build.version}"/>
<mkdir dir="${destination.dir}"/>
<available file="${dirs.source}\administrator\components\com_${component.name}"
type="dir" property="admin.exist" value="yes"/>
<!--available file="${dirs.source}\administrator\language"
type="dir" property="adminLang.exist" value="yes"/-->
<available file="${dirs.source}\components\com_${component.name}"
type="dir" property="frontend.exist" value="yes"/>
<available file="${dirs.source}\language"
type="dir" property="frontendLang.exist" value="yes"/>
<available file="${dirs.source}\media\com_${component.name}"
type="dir" property="media.exist" value="yes"/>
</target>
<target name="buildZip" depends="setup-properties, buildComponent">
<echo msg="buildZip"/>
<zip destfile="${destination.dir}/../com_${component.name}-${build.version}.zip"
basedir="${destination.dir}/../com_${component.name}-${build.version}"/>
</target>
<target name="buildComponent">
<copy todir="${destination.dir}/administrator/components/com_${component.name}">
<fileset dir="${dirs.source}/administrator/components/com_${component.name}">
<include name="**/*.*"/>
<!--<exclude name="${component.name}.xml"/>-->
</fileset>
</copy>
<copy todir="${destination.dir}/">
<fileset dir="${dirs.source}/administrator/components/com_${component.name}">
<include name="${component.name}.xml"/>
<include name="access.xml"/>
<include name="config.xml"/>
<include name="script.php"/>
</fileset>
</copy>
<!--copy todir="${destination.dir}/administrator/language/">
<fileset dir="${dirs.source}/administrator/language/">
<include name="**/*.com_${component.name}.**"/>
</fileset>
</copy-->
<if>
<equals arg1="${frontend.exist}" arg2="yes"/>
<then>
<copy todir="${destination.dir}/components/com_${component.name}">
<fileset dir="${dirs.source}/components/com_${component.name}" includes="**/*.*"/>
</copy>
</then>
</if>
<if>
<equals arg1="${frontendLang.exist}" arg2="yes"/>
<then>
<copy todir="${destination.dir}/language/">
<fileset dir="${dirs.source}/language/">
<include name="**/*.com_${component.name}.ini"/>
</fileset>
</copy>
</then>
</if>
<if>
<equals arg1="${media.exist}" arg2="1"/>
<then>
<copy todir="${destination.dir}/media/com_${component.name}">
<fileset dir="${dirs.source}/media/com_${component.name}">
<include name="**/*.*"/>
<exclude name="kml/*.*"/>
<include name="kml/index.html"/>
</fileset>
</copy>
</then>
</if>
<copy file="${dirs.source}/administrator/components/com_${component.name}/${component.name}.xml"
tofile="${destination.dir}/${component.name}.xml" overwrite="true">
<filterchain>
<replacetokens begintoken="@@" endtoken="@@">
<token key="DATE" value="${build.date}"/>
<token key="VERSION" value="${build.version}"/>
<token key="COMPONENTNAMEUPPERCASE" value="${component.upperName}"/>
<token key="COMPONENTNAME" value="${component.name}"/>
</replacetokens>
</filterchain>
</copy>
<copy file="${dirs.source}/administrator/components/com_${component.name}/script.php"
tofile="${destination.dir}/script.php" overwrite="true">
<filterchain>
<replacetokens begintoken="##" endtoken="##">
<token key="JEDCHECKER_VERSION" value="${build.version}"/>
</replacetokens>
</filterchain>
</copy>
<extfile file="${destination.dir}/${component.name}.xml"
sourceDir="${dirs.source}"
component="com_${component.name}"
/>
</target>
<target name="dev-release" description="Makes everything except the documentation"
depends="buildZip, ftpdeploy">
</target>
<target name="ftpdeploy" depends="setup-properties">
<gitversion workingCopy="${dirs.root}" propertyName="git.lastrevision"/>
<!-- Core release -->
<echo>Uploading ${component.name} nightly build</echo>
<ftpdeploy
host="${ftp.host}"
port="${ftp.port}"
username="${ftp.username}"
password="${ftp.password}"
dir="${ftp.dir}/${component.name}/git${git.lastrevision}"
mode="${ftp.mode}"
level="debug">
<fileset dir="${dirs.root}">
<include name="CHANGELOG"/>
</fileset>
<fileset dir="${destination.dir}/../">
<include name="com_${component.name}-git_${git.lastrevision}.zip"/>
</fileset>
</ftpdeploy>
</target>
</project>

19
config.xml Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset
name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC"
>
<field
name="rules"
type="rules"
label="JCONFIG_PERMISSIONS_LABEL"
class="inputbox"
validate="rules"
filter="rules"
component="com_jedchecker"
section="component"
/>
</fieldset>
</config>

37
jedchecker.xml Normal file
View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<extension method="upgrade" type="component" version="2.5.0">
<name>COM_JEDCHECKER</name>
<author>Joomla! Extensions Directory</author>
<creationDate>2017-02-14</creationDate>
<copyright>Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.</copyright>
<authorEmail>extensions@extensions.joomla.org</authorEmail>
<authorUrl>https://github.com/joomla-extensions/jedchecker</authorUrl>
<version>1.7</version>
<license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license>
<description><![CDATA[JED Checker will check your extension files and will let you know in advance if there are any possible problems with your extension for submitting to the JED]]>
</description>
<scriptfile>script.php</scriptfile>
<administration>
<menu>COM_JEDCHECKER</menu>
<files folder="administrator/components/com_jedchecker">
<file>access.xml</file>
<file>config.xml</file>
<file>controller.php</file>
<folder>controllers</folder>
<file>jedchecker.php</file>
<file>jedchecker.xml</file>
<folder>language</folder>
<folder>libraries</folder>
<folder>models</folder>
<file>script.php</file>
<folder>views</folder>
</files>
</administration>
<media destination="com_jedchecker" folder="media/com_jedchecker">
<folder>css</folder>
<folder>js</folder>
</media>
<updateservers>
<server type="extension" priority="1" name="JEDChecker Updates"><![CDATA[https://compojoom.com/index.php?option=com_ars&view=update&task=stream&format=xml&id=12&dummy=extension.xml]]></server>
</updateservers>
</extension>

109
script.php Normal file
View File

@ -0,0 +1,109 @@
<?php
/**
* @author Daniel Dimitrov <daniel@compojoom.com>
* @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
*/
defined('_JEXEC') or die('Restricted access');
/**
* Class Com_JedcheckerInstallerScript
*
* @since 1.5
*/
class Com_JedcheckerInstallerScript
{
protected $extension = 'com_jedchecker';
/**
* Function executed before the the installation
*
* @param string $type - the installation type
* @param JInstallerComponent $parent - the parent class
*/
public function preflight($type, $parent)
{
$this->parent = $parent;
if (version_compare(PHP_VERSION, '5.3.10', '<'))
{
$this->loadLanguage();
Jerror::raiseWarning(null, JText::sprintf('COM_JEDCHECKER_PHP_VERSION_INCOMPATIBLE', PHP_VERSION, '5.3.10'));
return false;
}
}
/**
* Update cleans out any old rules.
*
* @param JInstallerComponent $parent Is the class calling this method.
*
* @return bool|null If this returns false, Joomla will abort the update and undo everything already done.
*/
public function update($parent)
{
$this->loadLanguage();
// Doing it this way in case there are other old rules to be deleted
$oldRules = array('htmlindexes');
foreach ($oldRules as $rule)
{
$rulePhpFile = JPATH_ADMINISTRATOR . '/components/' . $this->extension . '/libraries/rules/' . $rule . '.php';
$ruleIniFile = JPATH_ADMINISTRATOR . '/components/' . $this->extension . '/libraries/rules/' . $rule . '.ini';
// Remove the rule's php file
if (file_exists($rulePhpFile))
{
if (JFile::delete($rulePhpFile))
{
$msg = JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_PHP_FILE_REMOVED', $rule);
}
else
{
$msg = JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_PHP_FILE_NOT_REMOVED', $rule);
}
echo "<p>$msg</p>";
}
// Remove the rule's ini file
if (file_exists($ruleIniFile))
{
if (JFile::delete($ruleIniFile))
{
$msg = JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_INI_FILE_REMOVED', $rule);
}
else
{
$msg = JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_INI_FILE_NOT_REMOVED', $rule);
}
echo "<p>$msg</p>";
}
}
}
/**
* Load language necessary during the installation
*
* @return void
*/
public function loadLanguage()
{
$extension = $this->extension;
$jlang = JFactory::getLanguage();
$path = $this->parent->getParent()->getPath('source') . '/administrator';
$jlang->load($extension, $path, 'en-GB', true);
$jlang->load($extension, $path, $jlang->getDefault(), true);
$jlang->load($extension, $path, null, true);
$jlang->load($extension . '.sys', $path, 'en-GB', true);
$jlang->load($extension . '.sys', $path, $jlang->getDefault(), true);
$jlang->load($extension . '.sys', $path, null, true);
}
}