Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/units/helpers/themes_helper.php
Show First 20 Lines • Show All 157 Lines • ▼ Show 20 Line(s) | |||||
{ | { | ||||
if ( $module_name === false ) { | if ( $module_name === false ) { | ||||
$modules = $this->Application->ModuleInfo; | $modules = $this->Application->ModuleInfo; | ||||
} | } | ||||
else { | else { | ||||
$modules = Array ($module_name => $this->Application->ModuleInfo[$module_name]); | $modules = Array ($module_name => $this->Application->ModuleInfo[$module_name]); | ||||
} | } | ||||
/** @var LanguageImportHelper $language_import_helper */ | |||||
$language_import_helper = $this->Application->recallObject('LanguageImportHelper'); | $language_import_helper = $this->Application->recallObject('LanguageImportHelper'); | ||||
/* @var $language_import_helper LanguageImportHelper */ | |||||
foreach ($modules as $module_name => $module_info) { | foreach ($modules as $module_name => $module_info) { | ||||
if ( $module_name == 'In-Portal' ) { | if ( $module_name == 'In-Portal' ) { | ||||
continue; | continue; | ||||
} | } | ||||
$lang_file = $theme_path . '/' . $module_info['TemplatePath'] . '_install/english.lang'; | $lang_file = $theme_path . '/' . $module_info['TemplatePath'] . '_install/english.lang'; | ||||
Show All 25 Lines | |||||
$theme = simplexml_load_file($xml_file); | $theme = simplexml_load_file($xml_file); | ||||
if ( $theme === false ) { | if ( $theme === false ) { | ||||
// broken xml OR no aliases defined | // broken xml OR no aliases defined | ||||
continue; | continue; | ||||
} | } | ||||
foreach ($theme as $design) { | foreach ($theme as $design) { | ||||
/* @var $design SimpleXMLElement */ | /** @var SimpleXMLElement $design */ | ||||
$template_path = trim($design); | $template_path = trim($design); | ||||
$module_override = (string)$design['module']; | $module_override = (string)$design['module']; | ||||
if ( $module_override ) { | if ( $module_override ) { | ||||
// allow to put template mappings form all modules into single theme.xml file | // allow to put template mappings form all modules into single theme.xml file | ||||
$module_folder = $this->Application->findModule('Name', $module_override, 'TemplatePath'); | $module_folder = $this->Application->findModule('Name', $module_override, 'TemplatePath'); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 140 Lines • ▼ Show 20 Line(s) | |||||
* @param int $theme_id id of theme we are scanning | * @param int $theme_id id of theme we are scanning | ||||
* @param int $auto_structure_mode | * @param int $auto_structure_mode | ||||
*/ | */ | ||||
function FindThemeFiles($folder_path, $theme_path, $theme_id, $auto_structure_mode = 1) | function FindThemeFiles($folder_path, $theme_path, $theme_id, $auto_structure_mode = 1) | ||||
{ | { | ||||
$ignore_regexp = $this->getIgnoreRegexp($theme_path . $folder_path); | $ignore_regexp = $this->getIgnoreRegexp($theme_path . $folder_path); | ||||
$iterator = new DirectoryIterator($theme_path . $folder_path . '/'); | $iterator = new DirectoryIterator($theme_path . $folder_path . '/'); | ||||
/* @var $file_info DirectoryIterator */ | /** @var DirectoryIterator $file_info */ | ||||
foreach ($iterator as $file_info) { | foreach ($iterator as $file_info) { | ||||
$filename = $file_info->getFilename(); | $filename = $file_info->getFilename(); | ||||
$auto_structure = preg_match($ignore_regexp, $filename) ? 2 : $auto_structure_mode; | $auto_structure = preg_match($ignore_regexp, $filename) ? 2 : $auto_structure_mode; | ||||
$file_path = $folder_path . '/' . $filename; // don't pass path to theme top folder! | $file_path = $folder_path . '/' . $filename; // don't pass path to theme top folder! | ||||
if ( $file_info->isDir() && !$file_info->isDot() && $filename != 'CVS' && $filename != '.svn' ) { | if ( $file_info->isDir() && !$file_info->isDot() && $filename != 'CVS' && $filename != '.svn' ) { | ||||
$this->FindThemeFiles($file_path, $theme_path, $theme_id, $auto_structure); | $this->FindThemeFiles($file_path, $theme_path, $theme_id, $auto_structure); | ||||
▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Line(s) | |||||
* | * | ||||
*/ | */ | ||||
function refreshThemes() | function refreshThemes() | ||||
{ | { | ||||
$themes_found = Array (); | $themes_found = Array (); | ||||
try { | try { | ||||
$iterator = new DirectoryIterator($this->themesFolder . '/'); | $iterator = new DirectoryIterator($this->themesFolder . '/'); | ||||
/* @var $file_info DirectoryIterator */ | /** @var DirectoryIterator $file_info */ | ||||
foreach ($iterator as $file_info) { | foreach ($iterator as $file_info) { | ||||
$filename = $file_info->getFilename(); | $filename = $file_info->getFilename(); | ||||
if ( $file_info->isDir() && !$file_info->isDot() && $filename != '.svn' && $filename != 'CVS' ) { | if ( $file_info->isDir() && !$file_info->isDot() && $filename != '.svn' && $filename != 'CVS' ) { | ||||
$theme_id = $this->refreshTheme($filename); | $theme_id = $this->refreshTheme($filename); | ||||
if ( $theme_id ) { | if ( $theme_id ) { | ||||
Show All 30 Lines | |||||
foreach ($theme_ids as $theme_id) { | foreach ($theme_ids as $theme_id) { | ||||
// increment serial of deleted themes | // increment serial of deleted themes | ||||
$this->Application->incrementCacheSerial('theme', $theme_id); | $this->Application->incrementCacheSerial('theme', $theme_id); | ||||
} | } | ||||
$this->Application->incrementCacheSerial('theme'); | $this->Application->incrementCacheSerial('theme'); | ||||
$this->Application->incrementCacheSerial('theme-file'); | $this->Application->incrementCacheSerial('theme-file'); | ||||
/** @var MinifyHelper $minify_helper */ | |||||
$minify_helper = $this->Application->recallObject('MinifyHelper'); | $minify_helper = $this->Application->recallObject('MinifyHelper'); | ||||
/* @var $minify_helper MinifyHelper */ | |||||
$minify_helper->delete(); | $minify_helper->delete(); | ||||
} | } | ||||
/** | /** | ||||
* Deletes themes with ids passed from db | * Deletes themes with ids passed from db | ||||
* | * | ||||
* @param Array $theme_ids | * @param Array $theme_ids | ||||
▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines |