/** * Get file info * * @param string $includePath Path for check inner files * @param string $component Component name folder * @param string $filePath Checking file path * @param string $type Type file * @param string $indexName Name usage for helper index * * @return stdClass */ private function getOverrideFileInfo($includePath, $component, $filePath, $type = '', $indexName = '') { $filePath = JPath::clean($filePath); $sameFolderPrefix = $component . '/' . $type; if ($type == 'helpers') { $app = JFactory::getApplication(); $baseName = basename($filePath); $prefix = substr($baseName, 0, 5); if ($app->isAdmin() && $prefix == 'admin' || !$app->isAdmin() && $prefix != 'admin' || !(!$app->isAdmin() && $prefix == 'admin')) { $realPath = JPATH_SITE . '/components' . substr($filePath, strlen($includePath)); } else { $realPath = JPATH_ADMINISTRATOR . '/components/' . $sameFolderPrefix . '/' . substr($baseName, 5); } } else { $realPath = JPATH_BASE . '/components/' . substr($filePath, strlen($includePath)); } $realPath = JPath::clean($realPath); if (!JFile::exists($realPath)) { return; } $forOverrideFile = file_get_contents($realPath); $originalClass = MVCOverrideHelperOverride::getOriginalClass($forOverrideFile); unset($forOverrideFile); if ($type == 'helpers') { JLoader::register($indexName, $filePath); } else { // Set path for new file MVCLoader::setOverrideFile($originalClass, $filePath); } // Set path for override file MVCLoader::setOverrideFile($originalClass, $realPath, true, $this->params->get('extendPrefix', ''), $this->params->get('extendSuffix', 'Default')); }