mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-21 22:19:27 +00:00
Fixes to be compliant with PHPMD & PHPCS
This commit is contained in:
@@ -16,7 +16,7 @@ class CLI_Manager extends CLI_Controller
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function installFrom($phrasesDirectoryPath)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ class Manager extends Auth_Controller
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function installFromCore()
|
||||
{
|
||||
|
||||
@@ -5,16 +5,8 @@
|
||||
*
|
||||
* @package FHC-Helper
|
||||
* @author FHC-Team
|
||||
* @copyright Copyright (c) 2016 fhcomplete.org
|
||||
* @copyright Copyright (c) 2022 fhcomplete.org
|
||||
* @license GPLv3
|
||||
* @since Version 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* FHC Helper
|
||||
*
|
||||
* @subpackage Helpers
|
||||
* @category Helpers
|
||||
*/
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
@@ -69,8 +61,6 @@ function generateCSSsInclude($CSSs)
|
||||
*/
|
||||
function generateJSDataStorageObject($indexPage, $calledPath, $calledMethod)
|
||||
{
|
||||
$user_language = getUserLanguage();
|
||||
|
||||
$toPrint = "\n";
|
||||
$toPrint .= '<script type="text/javascript">';
|
||||
$toPrint .= '
|
||||
@@ -143,8 +133,11 @@ function generateAddonsJSsInclude($calledFrom)
|
||||
$hookfile = DOC_ROOT.'addons/'.$addon.'/hooks.config.inc.php';
|
||||
if (file_exists($hookfile))
|
||||
{
|
||||
include($hookfile);
|
||||
if (key_exists($calledFrom, $js_hooks))
|
||||
$js_hooks = null; // declare variable
|
||||
|
||||
include($hookfile); // include the hook file
|
||||
|
||||
if (array_key_exists($calledFrom, $js_hooks))
|
||||
{
|
||||
foreach ($js_hooks[$calledFrom] as $js_file)
|
||||
generateJSsInclude('addons/'.$addon.'/'.$js_file);
|
||||
@@ -162,3 +155,4 @@ function generateBackwardCompatibleJSMsIe($js)
|
||||
echo ' <script type="text/javascript" src="'.$js.'"></script>'."\n";
|
||||
echo "<![endif]-->\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
use \stdClass as stdClass;
|
||||
use \PharData as PharData;
|
||||
|
||||
/**
|
||||
* Library to manage core extensions
|
||||
*/
|
||||
@@ -194,8 +197,7 @@ class ExtensionsLib
|
||||
$result = $this->_ci->ExtensionsModel->loadWhere(array('name' => $extensionName));
|
||||
if (hasData($result)) // if something was found
|
||||
{
|
||||
$extsArray = array();
|
||||
foreach ($result->retval as $key => $extension) // loops on them
|
||||
foreach ($result->retval as $extension) // loops on them
|
||||
{
|
||||
// Remove them all
|
||||
$result = $this->_ci->ExtensionsModel->delete($extension->extension_id);
|
||||
@@ -397,6 +399,7 @@ class ExtensionsLib
|
||||
*/
|
||||
private function _chkExtensionJson($extensionName, $extensionDB)
|
||||
{
|
||||
$fhcomplete_version = 0;
|
||||
$this->_printStart('Parsing and checking extension.json');
|
||||
|
||||
// Decodes extension.json
|
||||
@@ -597,19 +600,23 @@ class ExtensionsLib
|
||||
// Loops through the versions
|
||||
for ($sqlDir = $startVersion; $sqlDir <= $extensionJson->version; $sqlDir++)
|
||||
{
|
||||
// If a directory with the same value of the version is present in the sql scripts directory
|
||||
if (($files = glob($pkgSQLsPath.'/'.$sqlDir.'/*'.ExtensionsLib::SQL_FILE_EXTENSION)) != false)
|
||||
{
|
||||
// Search for a directory with the same value of the version in the sql scripts directory
|
||||
$files = glob($pkgSQLsPath.'/'.$sqlDir.'/*'.ExtensionsLib::SQL_FILE_EXTENSION);
|
||||
|
||||
// If found
|
||||
if ($files != false)
|
||||
{
|
||||
// Loads every sql files
|
||||
foreach ($files as $file)
|
||||
{
|
||||
$sql = file_get_contents($file); // gets the entire content of the file
|
||||
foreach ($files as $file)
|
||||
{
|
||||
$sql = file_get_contents($file); // gets the entire content of the file
|
||||
|
||||
$this->_printMessage('Executing query:');
|
||||
$this->_printMessage($sql);
|
||||
|
||||
// Try to execute that
|
||||
if (!isSuccess($result = @$this->_ci->ExtensionsModel->executeQuery($sql)))
|
||||
$result = @$this->_ci->ExtensionsModel->executeQuery($sql);
|
||||
if (!isSuccess($result))
|
||||
{
|
||||
$this->_errorOccurred = true;
|
||||
$this->_printFailure(' error occurred while executing the query');
|
||||
@@ -622,8 +629,8 @@ class ExtensionsLib
|
||||
var_dump($result->retval); // KEEP IT!!!
|
||||
$this->_ci->eprintflib->printEOL();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->_printSuccess(!$this->_errorOccurred);
|
||||
@@ -684,7 +691,7 @@ class ExtensionsLib
|
||||
|
||||
foreach ($this->SOFTLINK_TARGET_DIRECTORIES as $rootPath => $targetDirectories)
|
||||
{
|
||||
foreach ($targetDirectories as $key => $targetDirectory)
|
||||
foreach ($targetDirectories as $targetDirectory)
|
||||
{
|
||||
if (file_exists($rootPath.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName))
|
||||
{
|
||||
@@ -738,7 +745,7 @@ class ExtensionsLib
|
||||
// For every target directory
|
||||
foreach ($this->SOFTLINK_TARGET_DIRECTORIES as $rootPath => $targetDirectories)
|
||||
{
|
||||
foreach ($targetDirectories as $key => $targetDirectory)
|
||||
foreach ($targetDirectories as $targetDirectory)
|
||||
{
|
||||
// If destination of the symlink does not exist
|
||||
if (!file_exists($rootPath.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName))
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
use \Netcarver\Textile\Parser as NTParser;
|
||||
|
||||
class PhrasesLib
|
||||
{
|
||||
// Directory name where all the category files are
|
||||
@@ -41,7 +43,7 @@ class PhrasesLib
|
||||
$this->_ci->load->model('system/Phrasentext_model', 'PhrasentextModel');
|
||||
|
||||
// Workaround to use more parameters in the construct since PHP doesn't support many constructors
|
||||
$this->_extend_construct(func_get_args());
|
||||
$this->_extendConstruct(func_get_args());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
@@ -78,7 +80,7 @@ class PhrasesLib
|
||||
if (hasData($result))
|
||||
{
|
||||
// Textile parser
|
||||
$textileParser = new \Netcarver\Textile\Parser();
|
||||
$textileParser = new NTParser();
|
||||
|
||||
for ($i = 0; $i < count($result->retval); $i++)
|
||||
{
|
||||
@@ -182,13 +184,12 @@ class PhrasesLib
|
||||
* - could be an array of categories, and for each category there is an array of phrases
|
||||
* language: optional parameter must be a string. It's used to load phrases
|
||||
*/
|
||||
private function _extend_construct($params)
|
||||
private function _extendConstruct($params)
|
||||
{
|
||||
// Checks if the $params is an array with at least one element
|
||||
if (!isEmptyArray($params))
|
||||
{
|
||||
$parameters = $params[0]; // temporary variable
|
||||
$isIndexArray = false; //flag for indexed array
|
||||
|
||||
// If there are parameters
|
||||
if (!isEmptyArray($parameters))
|
||||
@@ -325,6 +326,8 @@ class PhrasesLib
|
||||
&& $phrasesCategoryFile != '..'
|
||||
&& $pathInfo['extension'] == 'php')
|
||||
{
|
||||
$phrases = null; // define the variable
|
||||
|
||||
// Include the php file that contains phrases for that category
|
||||
require_once($phrasesDirectory.$phrasesCategoryFile);
|
||||
|
||||
@@ -415,7 +418,6 @@ class PhrasesLib
|
||||
$phrase[self::PHRASE]
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
else // otherwise if the phrase already exists in the database
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
'Organisation unit',
|
||||
'Organizational form'
|
||||
),
|
||||
'formatRow' => function($datasetRaw) {
|
||||
'formatRow' => function ($datasetRaw) {
|
||||
|
||||
if (isEmptyString($datasetRaw->Description)) $datasetRaw->Description = 'NA';
|
||||
if (isEmptyString($datasetRaw->OrganisationUnit)) $datasetRaw->OrganisationUnit = 'NA';
|
||||
@@ -43,5 +43,4 @@
|
||||
$filterWidgetArray['filter_id'] = $this->input->get('filter_id');
|
||||
|
||||
echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray);
|
||||
?>
|
||||
|
||||
|
||||
@@ -493,7 +493,8 @@ class FilterWidget extends Widget
|
||||
FilterWidgetLib::DATASET_NAME => $this->_datasetName, // the carrent dataset name
|
||||
FilterWidgetLib::SESSION_FILTER_NAME => $filterName, // the current filter name
|
||||
FilterWidgetLib::SESSION_FIELDS => $this->FiltersModel->getExecutedQueryListFields(), // all the fields of the dataset
|
||||
FilterWidgetLib::SESSION_SELECTED_FIELDS => $this->_getColumnsNames($parsedFilterJson->columns), // all the selected fields
|
||||
// All the selected fields
|
||||
FilterWidgetLib::SESSION_SELECTED_FIELDS => $this->_getColumnsNames($parsedFilterJson->columns),
|
||||
FilterWidgetLib::SESSION_COLUMNS_ALIASES => $this->_columnsAliases, // all the fields aliases
|
||||
FilterWidgetLib::SESSION_ADDITIONAL_COLUMNS => $this->_additionalColumns, // additional columns
|
||||
FilterWidgetLib::SESSION_CHECKBOXES => $this->_checkboxes, // the name of the field used to build the checkboxes column
|
||||
@@ -502,9 +503,12 @@ class FilterWidget extends Widget
|
||||
FilterWidgetLib::SESSION_ROW_NUMBER => count($dataset->retval), // the number of loaded rows by this filter
|
||||
FilterWidgetLib::SESSION_DATASET => $dataset->retval, // the entire dataset
|
||||
FilterWidgetLib::SESSION_DATASET_RELOAD => false, // if the dataset must be reloaded, not needed the first time
|
||||
FilterWidgetLib::SESSION_DATASET_REPRESENTATION => $this->_datasetRepresentation, // the choosen dataset representation
|
||||
FilterWidgetLib::SESSION_DATASET_REP_OPTIONS => $this->_datasetRepresentationOptions, // the choosen dataset representation options
|
||||
FilterWidgetLib::SESSION_DATASET_REP_FIELDS_DEFS => $this->_datasetRepFieldsDefs // the choosen dataset representation record fields definition
|
||||
// The choosen dataset representation
|
||||
FilterWidgetLib::SESSION_DATASET_REPRESENTATION => $this->_datasetRepresentation,
|
||||
// The choosen dataset representation options
|
||||
FilterWidgetLib::SESSION_DATASET_REP_OPTIONS => $this->_datasetRepresentationOptions,
|
||||
// The choosen dataset representation record fields definition
|
||||
FilterWidgetLib::SESSION_DATASET_REP_FIELDS_DEFS => $this->_datasetRepFieldsDefs
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -528,7 +532,7 @@ class FilterWidget extends Widget
|
||||
private function _setFilterMenu()
|
||||
{
|
||||
// Generates the filters structure array
|
||||
$filterMenu = $this->filterwidgetlib->generateFilterMenu(
|
||||
$this->filterwidgetlib->generateFilterMenu(
|
||||
$this->router->directory.$this->router->class.'/'.$this->router->method
|
||||
);
|
||||
}
|
||||
@@ -607,7 +611,7 @@ class FilterWidget extends Widget
|
||||
{
|
||||
$columnsNames = array();
|
||||
|
||||
foreach ($columns as $key => $obj)
|
||||
foreach ($columns as $obj)
|
||||
{
|
||||
if (isset($obj->name))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user