You are here

function tb_megamenu_replace_css in The Better Mega Menu 7

File

./tb_megamenu.functions.inc, line 613

Code

function tb_megamenu_replace_css() {
  $files = array(
    drupal_get_path('module', 'tb_megamenu') . '/css/admin.css',
    drupal_get_path('module', 'tb_megamenu') . '/css/backend.css',
    drupal_get_path('module', 'tb_megamenu') . '/css/base.css',
    drupal_get_path('module', 'tb_megamenu') . '/css/bootstrap.css',
    drupal_get_path('module', 'tb_megamenu') . '/css/bootstrap-responsive.css',
    drupal_get_path('module', 'tb_megamenu') . '/css/default.css',
    drupal_get_path('module', 'tb_megamenu') . '/css/styles/black.css',
    drupal_get_path('module', 'tb_megamenu') . '/css/styles/blue.css',
    drupal_get_path('module', 'tb_megamenu') . '/css/styles/green.css',
    drupal_get_path('module', 'tb_megamenu') . '/css/styles/orange.css',
  );
  foreach ($files as $css_file) {
    $output = array();
    $f = fopen($css_file, "r");
    $lines = array();
    $ls = array();
    while ($line = fgets($f)) {
      $lines[] = $line;
      $line = str_replace("\r\n", "", $line);
      if (tb_megamenu_is_a_key($line)) {
        $line = trim($line);
        if (strpos($line, '.tb-megamenu') !== 0) {
          $ls[] = '.tb-megamenu ' . $line;
        }
        else {
          $ls[] = $line;
        }
      }
      else {
        $ls[] = $line;
      }
    }
    file_put_contents($css_file, implode("\r\n", $ls));
    fclose($f);
  }
}