33
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-11-30 16:53:59 +00:00

sort sidebar menu items according to the $ordering field

This commit is contained in:
Denis Ryabov 2021-05-17 23:21:34 +03:00
parent 0fe6fd5dd5
commit ed89be7422
11 changed files with 79 additions and 19 deletions

View File

@ -45,6 +45,13 @@ class JedcheckerRulesEncoding extends JEDcheckerRule
*/ */
protected $description = 'COM_JEDCHECKER_RULE_ENCODING_DESC'; protected $description = 'COM_JEDCHECKER_RULE_ENCODING_DESC';
/**
* The ordering value to sort rules in the menu.
*
* @var integer
*/
public static $ordering = 900;
/** /**
* Initiates the file search and check * Initiates the file search and check
* *

View File

@ -47,6 +47,13 @@ class JedcheckerRulesErrorreporting extends JEDcheckerRule
protected $description = 'COM_JEDCHECKER_RULE_ERRORREPORTING_DESC'; protected $description = 'COM_JEDCHECKER_RULE_ERRORREPORTING_DESC';
/**
* The ordering value to sort rules in the menu.
*
* @var integer
*/
public static $ordering = 800;
/** /**
* Initiates the file search and check * Initiates the file search and check
* *

View File

@ -43,6 +43,13 @@ class JedcheckerRulesFramework extends JEDcheckerRule
*/ */
protected $description = 'COM_JEDCHECKER_RULE_FRAMEWORK_DESC'; protected $description = 'COM_JEDCHECKER_RULE_FRAMEWORK_DESC';
/**
* The ordering value to sort rules in the menu.
*
* @var integer
*/
public static $ordering = 700;
protected $tests = false; protected $tests = false;
protected $leftover_folders; protected $leftover_folders;

View File

@ -47,6 +47,13 @@ class JedcheckerRulesGpl extends JEDcheckerRule
*/ */
protected $description = 'COM_JEDCHECKER_RULE_PH1_DESC'; protected $description = 'COM_JEDCHECKER_RULE_PH1_DESC';
/**
* The ordering value to sort rules in the menu.
*
* @var integer
*/
public static $ordering = 500;
/** /**
* Initiates the file search and check * Initiates the file search and check
* *

View File

@ -44,6 +44,13 @@ class JedcheckerRulesJamss extends JEDcheckerRule
*/ */
protected $description = 'COM_JEDCHECKER_RULE_JAMSS_DESC'; protected $description = 'COM_JEDCHECKER_RULE_JAMSS_DESC';
/**
* The ordering value to sort rules in the menu.
*
* @var integer
*/
public static $ordering = 1000;
protected $ext; protected $ext;
protected $patterns; protected $patterns;

View File

@ -46,6 +46,13 @@ class JedcheckerRulesJexec extends JEDcheckerRule
*/ */
protected $description = 'COM_JEDCHECKER_RULE_PH2_DESC'; protected $description = 'COM_JEDCHECKER_RULE_PH2_DESC';
/**
* The ordering value to sort rules in the menu.
*
* @var integer
*/
public static $ordering = 600;
/** /**
* Initiates the file search and check * Initiates the file search and check
* *

View File

@ -47,6 +47,13 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule
*/ */
protected $description = 'COM_JEDCHECKER_INFO_XML_DESC'; protected $description = 'COM_JEDCHECKER_INFO_XML_DESC';
/**
* The ordering value to sort rules in the menu.
*
* @var integer
*/
public static $ordering = 0;
/** /**
* Initiates the search and check * Initiates the search and check
* *

View File

@ -45,6 +45,13 @@ class JedcheckerRulesXMLlicense extends JEDcheckerRule
*/ */
protected $description = 'COM_JEDCHECKER_RULE_PH3_DESC'; protected $description = 'COM_JEDCHECKER_RULE_PH3_DESC';
/**
* The ordering value to sort rules in the menu.
*
* @var integer
*/
public static $ordering = 100;
/** /**
* Initiates the search and check * Initiates the search and check
* *

View File

@ -45,6 +45,13 @@ class JedcheckerRulesXMLUpdateServer extends JEDcheckerRule
*/ */
protected $description = 'COM_JEDCHECKER_RULE_US1_DESC'; protected $description = 'COM_JEDCHECKER_RULE_US1_DESC';
/**
* The ordering value to sort rules in the menu.
*
* @var integer
*/
public static $ordering = 400;
/** /**
* Initiates the search and check * Initiates the search and check
* *

View File

@ -45,6 +45,13 @@ class JEDcheckerRule extends JObject
*/ */
protected $description; protected $description;
/**
* The ordering value to sort rules in the menu.
*
* @var integer
*/
public static $ordering = 10000;
/** /**
* The absolute path to the target extension. * The absolute path to the target extension.
* *

View File

@ -50,35 +50,25 @@ class JedcheckerViewUploads extends JViewLegacy
*/ */
public function getRules() public function getRules()
{ {
$existingRules = array( $rules = array();
'xmlinfo', $files = JFolder::files(JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules', '\.php$', false, false);
'xmllicense',
'xmlmanifest',
'xmlfiles',
'xmlupdateserver',
'gpl',
'jexec',
'errorreporting',
'framework',
'encoding',
'jamss',
'language'
);
JLoader::discover('jedcheckerRules', JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules/'); JLoader::discover('jedcheckerRules', JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules/');
$rules = array(); foreach ($files as $file)
foreach ($existingRules as $rule)
{ {
$rule = substr($file, 0, -4);
$class = 'jedcheckerRules' . ucfirst($rule); $class = 'jedcheckerRules' . ucfirst($rule);
if (class_exists($class)) if (class_exists($class) && is_subclass_of($class, 'JEDcheckerRule'))
{ {
$rules[] = $rule; $rules[$rule] = $class::$ordering;
} }
} }
asort($rules, SORT_NUMERIC);
$rules = array_keys($rules);
return $rules; return $rules;
} }