You are here

function l10n_update_remove_disabled_projects in Localization update 7.2

Removes disabled projects from the project list.

Parameters

array $projects: Array of projects keyed by the project machine name.

1 call to l10n_update_remove_disabled_projects()
l10n_update_project_list in ./l10n_update.compare.inc
Get update module's project list.

File

./l10n_update.compare.inc, line 116
The API for comparing project translation status with available translation.

Code

function l10n_update_remove_disabled_projects(&$projects) {
  $disabled_projects = variable_get('l10n_update_disabled_projects', array());
  foreach ($disabled_projects as $disabled_name) {

    // Remove projects with matching name either by full string of by wild card.
    if (strpos($disabled_name, '*') !== FALSE) {
      $pattern = str_replace('*', '.*?', $disabled_name);
      $matches = preg_grep('/^' . $pattern . '$/i', array_keys($projects));
      foreach ($matches as $match) {
        unset($projects[$match]);
      }
    }
    elseif (isset($projects[$disabled_name])) {
      unset($projects[$disabled_name]);
    }
  }
}