public function EvaluationCode::themesEvaluation in Drupal 8 upgrade evaluation 7
Same name and namespace in other branches
- 6 includes/EvaluationCode.php \Upgrade_check\EvaluationCode::themesEvaluation()
Implements _upgrade_check_themes_evaluation().
File
- includes/
EvaluationCode.php, line 64
Class
Namespace
Upgrade_checkCode
public function themesEvaluation($theme) {
$themes = $themes['files'] = array();
$themes['lines'] = 0;
$themes['type'] = !empty($theme['status']) ? 'Enabled' : 'Disabled';
$themes['name'] = !empty($theme['name']) ? $theme['name'] : '';
$theme_path = drupal_get_path('theme', variable_get('theme_default', NULL));
$themes['isset_status'] = TRUE;
$default_theme = substr($theme_path, strrpos($theme_path, '/') + 1);
if ($themes['name'] === $default_theme) {
$themes['type'] = 'Default';
}
if (!empty($theme['info']['package']) && $theme['info']['package'] === 'Core') {
$themes['type_status'] = $this->core;
}
else {
$param = array(
$this->custom,
$this->contribNoUpgrade,
);
$data = $this
->updateProcessFetchTask($theme);
$themes['type_status'] = !empty($data['type']) ? $data['type'] : $this->custom;
if (!empty($data) && !empty($data['type']) && in_array($data['type'], $param, TRUE)) {
$filePath = substr($theme['filename'], 0, strripos($theme['filename'], '/'));
if (file_exists($filePath)) {
$recursiveDirectory = new \RecursivedirectoryIterator($filePath);
$recursiveIterator = new \RecursiveIteratorIterator($recursiveDirectory);
foreach ($recursiveIterator as $name => $object) {
$status = FALSE;
foreach ($this->excludedFiles as $val) {
if (strpos($name, $val) !== FALSE) {
$status = TRUE;
}
}
if (!empty($status)) {
continue;
}
else {
$checkCode = $this
->checkCode($name, $themes['name']);
$themes['lines'] += $checkCode['all_strings'];
$checkCode['file_name'] = $name;
$themes['files'][] = $checkCode;
}
}
}
else {
$themes['isset_status'] = FALSE;
}
}
}
$themes['package'] = !empty($theme['info']['package']) ? $theme['info']['package'] : $this->other;
$themes['project'] = !empty($theme['info']['project']) ? $theme['info']['project'] : '';
$themes['version'] = !empty($theme['info']['version']) ? $theme['info']['version'] : '';
return $themes;
}