Projet

Général

Profil

Révision 74f6bef0

Ajouté par Assos Assos il y a plus de 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/themes/adaptivetheme/at_core/inc/load.inc
1 1
<?php
2

  
2 3
/**
3 4
 * @file
4 5
 * Provides frequently used functions that load something, ususally CSS or JS
......
14 15
 * @param $filepath, path to the missing file.
15 16
 * @param $theme_name, the active theme.
16 17
 */
17
function load_failure($filepath, $theme_name) {
18
  $message = t('<p>One or more CSS files were not found or does not exist: <em>!files_list</em>. Did you delete the public files directory or change a file name? You probably need to save the theme settings to generate the files. Please view the <a href="!docs_link" target="_blank">online documentation</a>.</p>', array('!files_list' => $filepath, '!docs_link' => 'http://adaptivethemes.com/documentation/file-generation-system'));
18
function at_load_failure($filepath, $theme_name) {
19
  $message = t('<p>One or more CSS files were not found or does not exist: <em>!files_list</em>. Did you delete any files or change a file name? You may need to save the theme settings or check all files names are correct in your theme. Please view the <a href="!docs_link" target="_blank">online documentation</a>.</p>', array('!files_list' => $filepath, '!docs_link' => 'http://adaptivethemes.com/documentation/file-generation-system'));
19 20

  
20 21
  if (!empty($filepath)) {
21 22
    watchdog($theme_name, 'CSS file missing or not found @filename', array('@filename' => $filepath), WATCHDOG_ERROR);
......
44 45
 * @param $path
45 46
 * @param $theme_name
46 47
 */
47
function load_layout_css($path, $theme_name) {
48
function at_load_layout_css($path, $theme_name) {
48 49

  
49 50
  // Get the info file data
50 51
  $info = at_get_info($theme_name);
......
53 54
  $load_ie8_css = TRUE;
54 55

  
55 56
  // Load the default layout if Standard layout is default or responsive styles are disabled
56
  if (
57
    at_get_setting('global_default_layout', $theme_name) === 'standard-layout' ||
58
    at_get_setting('disable_responsive_styles', $theme_name) === 1) {
57
  if (at_get_setting('global_default_layout', $theme_name) === 'standard-layout' || at_get_setting('disable_responsive_styles', $theme_name) === 1) {
59 58
    $file = $theme_name . '.default.layout.css';
60 59
    $filepath = $path . '/' . $file;
61 60
    if (file_exists($filepath)) {
......
68 67
      );
69 68
    }
70 69
    else {
71
      load_failure($filepath, $theme_name);
70
      at_load_failure($filepath, $theme_name);
72 71
    }
73 72
  }
74 73

  
......
78 77
    // Responsiveness is not disabled, load the responsive layout
79 78
    $filepath = $path . '/' . $theme_name . '.responsive.layout.css';
80 79
    $media_query = 'only screen'; // keyword "only" hide this from unsupporting user agents
81
    load_subtheme_responsive_styles($filepath, $media_query, $theme_name, $weight = 0);
80
    at_load_subtheme_responsive_styles($filepath, $media_query, $theme_name, $weight = 0);
82 81

  
83 82
    // The lt-ie9.layout.css stylesheet loads under specific conditions:
84 83
    // 1. Responsive capabilities are ON
85 84
    // 2. Mobile first is ON
86 85
    // 3. Respond.js is OFF
87
    // Note this excludes IEMobile 7, screw you IEMobile 7
88 86
    if (at_get_setting('global_default_layout', $theme_name) !== 'standard-layout') {
89 87
      if (at_get_setting('load_respondjs', $theme_name) === 0) {
90 88
        $load_ie8_css = FALSE;
91 89
        $filepath = $path . '/' . $theme_name . '.lt-ie9.layout.css';
92 90
        $ie_style['media'] = 'screen';
93
        $ie_style['condition'] = '(lt IE 9)&(!IEMobile 7)';
94
        load_conditional_styles($filepath, $ie_style, $theme_name);
91
        $ie_style['condition'] = 'lt IE 9';
92
        at_load_conditional_styles($filepath, $ie_style, $theme_name);
95 93
      }
96 94
    }
97 95
  }
......
105 103
      $filepath = $path . '/' . $theme_name . '.lt-ie8.layout.css';
106 104
      $ie_style['media'] = 'screen';
107 105
      $ie_style['condition'] = 'lt IE 8';
108
      load_conditional_styles($filepath, $ie_style, $theme_name);
106
      at_load_conditional_styles($filepath, $ie_style, $theme_name);
109 107
    }
110 108
  }
111 109
}
......
123 121
 * @param $path
124 122
 * @param $theme_name
125 123
 */
126
function load_responsive_css($path, $theme_name) {
124
function at_load_responsive_css($path, $theme_name) {
127 125

  
128 126
  // Set the mode, when CSS is aggregated by Drupal Production mode is TRUE
129 127
  $mode = variable_get('preprocess_css', '') == 1 ? TRUE : FALSE;
......
137 135
  // - 2: Responsiveness is not disabled
138 136
  //
139 137
  // When in production mode these files are aggregated into one file
140
  // and loaded using load_subtheme_responsive_styles().
138
  // and loaded using at_load_subtheme_responsive_styles().
141 139
  //
142 140
  // You can disable responsive capability using the theme settings - look under
143 141
  // the Global settings. Do not delete or alter this - use the theme setting!
......
147 145
    // The file names must match the files in your themes CSS directory, if
148 146
    // you change them you must update to match.
149 147
    $files = array(
150
      'responsive.smartphone.portrait'  => at_get_setting('smartphone_portrait_media_query', $theme_name),
151
      'responsive.smartphone.landscape' => at_get_setting('smartphone_landscape_media_query', $theme_name),
148
      // Maintian backwards compatibility with older themes that use smartphone
149
      'responsive.smartphone.portrait'  => at_get_setting('smalltouch_portrait_media_query', $theme_name) ? at_get_setting('smalltouch_portrait_media_query', $theme_name) : at_get_setting('smartphone_portrait_media_query', $theme_name),
150
      'responsive.smartphone.landscape' => at_get_setting('smalltouch_landscape_media_query', $theme_name) ? at_get_setting('smalltouch_landscape_media_query', $theme_name) : at_get_setting('smartphone_landscape_media_query', $theme_name),
151
      // Standard files for the 7.x-3.2 and beyond
152
      'responsive.smalltouch.portrait'  => at_get_setting('smalltouch_portrait_media_query', $theme_name),
153
      'responsive.smalltouch.landscape' => at_get_setting('smalltouch_landscape_media_query', $theme_name),
152 154
      'responsive.tablet.portrait'      => at_get_setting('tablet_portrait_media_query', $theme_name),
153 155
      'responsive.tablet.landscape'     => at_get_setting('tablet_landscape_media_query', $theme_name),
154 156
      'responsive.desktop'              => at_get_setting('bigscreen_media_query', $theme_name),
......
161 163
    }
162 164

  
163 165
    // Loop over the files array and load each CSS file.
164
    // load_subtheme_responsive_styles() takes three parameters:
166
    // at_load_subtheme_responsive_styles() takes three parameters:
165 167
    // - $css_file - the name of the css file
166 168
    // - $media_query - the media query from theme settings
167 169
    // - $theme_name - to generate the path-to-theme for drupal_add_css()
168 170
    foreach ($files as $key => $value) {
169 171
      $filepath = drupal_get_path('theme', $theme_name) . '/css/' . $key . '.css';
170 172
      $media_query = $value;
171
      load_subtheme_responsive_styles($filepath, $media_query, $theme_name, $weight = 100);
173
      at_load_subtheme_responsive_styles($filepath, $media_query, $theme_name, $weight = 100);
172 174
    }
173 175
  }
174 176

  
......
179 181
  elseif ($mode == TRUE) {
180 182
    $filepath = $path . '/' . $theme_name . '.responsive.styles.css';
181 183
    $media_query = 'only screen'; // keyword "only" should hide this from older user agents
182
    load_subtheme_responsive_styles($filepath, $media_query, $theme_name, $weight = 100);
184
    at_load_subtheme_responsive_styles($filepath, $media_query, $theme_name, $weight = 100);
183 185
  }
184 186
}
185 187

  
......
188 190
 *
189 191
 * @param $theme_name
190 192
 */
191
function load_extensions_css($theme_name) {
193
function at_load_extensions_css($theme_name) {
192 194
  global $path_to_at_core;
193 195
  $settings_css = array();
194 196
  // Heading settings
......
233 235
 * @param $path
234 236
 * @param $theme_name
235 237
 */
236
function load_fonts($path, $theme_name) {
238
function at_load_fonts($path, $theme_name) {
237 239
  // Google fonts
238
  $google_font_string = drupal_static(__FUNCTION__, array());
240
  $google_font_string = &drupal_static(__FUNCTION__, array());
239 241
  if (empty($google_font_string)) {
240
    $google_font_string = load_google_fonts($theme_name);
242
    $google_font_string = at_load_google_fonts($theme_name);
241 243
  }
242 244
  if (!empty($google_font_string)) {
243 245
    drupal_add_css($google_font_string, array(
......
259 261
    );
260 262
  }
261 263
  else {
262
    load_failure($filepath, $theme_name);
264
    at_load_failure($filepath, $theme_name);
263 265
  }
264 266
}
265 267

  
......
269 271
 * @param $path
270 272
 * @param $theme_name
271 273
 */
272
function load_custom_css($path, $theme_name) {
274
function at_load_custom_css($path, $theme_name) {
273 275
  $filepath = $path . '/' . $theme_name . '.custom.css';
274 276
  if (file_exists($filepath)) {
275 277
    drupal_add_css($filepath, array(
......
282 284
    );
283 285
  }
284 286
  else {
285
    load_failure($filepath, $theme_name);
287
    at_load_failure($filepath, $theme_name);
286 288
  }
287 289
}
288 290

  
289 291
/**
290
 * Return an array of file names.
292
 * Load Polyfill Scripts
293
 * Conditional scripts are returned to the preprocess function - in AT Core that
294
 * means adaptivetheme_preprocess_html() and adaptivetheme_preprocess_maintenance_page().
295
 * There are two sources for conditional scripts - the subtheme info file and
296
 * AT Core itself can load html5.js and respond.js.
297
 * Unconditional scripts (those not printed within an IE conditioanl comment)
298
 * load directly via drupal_add_js in this function, while the conditional scripts
299
 * are returned as an array to preprocess, then rendered in process. This is done
300
 * to allow themers to manipulate the data structure in preprocess if they feel
301
 * the need to.
291 302
 *
292 303
 * @param $theme_name
293 304
 */
294
function load_polyfills($theme_name) {
305
function at_load_polyfills($theme_name) {
295 306
  global $path_to_at_core;
296 307

  
297 308
  // Get the info file data
298 309
  $info = at_get_info($theme_name);
299 310

  
300 311
  // Build an array of polyfilling scripts
301
  $polyfills_array = drupal_static('adaptivetheme_preprocess_html_polyfills_array');
302
  if (empty($polyfills_array)) {
303
    // Info file loaded conditional scripts
312
  $polyfills = &drupal_static('adaptivetheme_preprocess_html_polyfills_array');
313
  if (empty($polyfills)) {
314

  
304 315
    $theme_path = drupal_get_path('theme', $theme_name);
316
    $polyfills_array = array();
317

  
318
    // Info file loaded conditional scripts
305 319
    if (array_key_exists('ie_scripts', $info)) {
306 320
      foreach ($info['ie_scripts'] as $condition => $ie_scripts_path) {
307 321
        foreach ($ie_scripts_path as $key => $value) {
308 322
          $filepath = $theme_path . '/' . $value;
309
          $polyfills_array['info'][$condition][] = at_theme_conditional_script($filepath);
323
          $polyfills_array['ie'][$condition][] = at_theme_conditional_script($filepath);
310 324
        }
311 325
      }
312 326
    }
313
    // AT Core Polyfills
314
    $polly = '';
315
    $polly_settings_array = array(
316
      'load_respondjs',
317
      'load_html5js',
318
      'load_scalefixjs', // loaded directly by polly_wants_a_cracker(), its never returned
319
      'load_onmediaqueryjs', // loaded directly by polly_wants_a_cracker(), its never returned
320
    );
321
    foreach ($polly_settings_array as $polly_setting) {
322
      $polly[$polly_setting] = at_get_setting($polly_setting, $theme_name);
327

  
328
    // AT Core Conditional Scripts
329
    if (at_get_setting('load_html5js') === 1) {
330
      $polyfills_array['ie']['lt IE 9'][] = at_theme_conditional_script($path_to_at_core . '/scripts/html5.js');
331
    }
332
    if (at_get_setting('load_respondjs') === 1) {
333
      $polyfills_array['ie']['lt IE 9'][] = at_theme_conditional_script($path_to_at_core . '/scripts/respond.js');
334
    }
335

  
336
    // AT Core Un-conditional Scripts
337
    if (at_get_setting('load_scalefixjs') === 1) {
338
      $polyfills_array['all'][] = 'scripts/scalefix.js';
339
    }
340
    if (at_get_setting('load_onmediaqueryjs') === 1) {
341
      $polyfills_array['all'][] = 'scripts/onmediaquery.js';
323 342
    }
324
    $backed_crackers = polly_wants_a_cracker($polly, $theme_name);
325
    foreach ($backed_crackers as $cupboard => $flavors) {
326
      foreach ($flavors as $key => $value) {
327
        $filepath = $path_to_at_core . '/' . $value;
328
        $polyfills_array['at_core'][$cupboard][] = at_theme_conditional_script($filepath);
343
    if (at_get_setting('load_matchmediajs') === 1) {
344
      $polyfills_array['all'][] = 'scripts/matchMedia.js';
345
      $polyfills_array['all'][] = 'scripts/matchMedia.addListener.js';
346
    }
347

  
348
    // Load Polyfills
349
    if (!empty($polyfills_array)) {
350

  
351
      // Default query string for cache control finger printing
352
      $query_string = variable_get('css_js_query_string', '0');
353

  
354
      // "all" - no conditional comment needed, use drupal_add_js()
355
      if (isset($polyfills_array['all'])) {
356
        foreach ($polyfills_array['all'] as $script) {
357
          drupal_add_js($path_to_at_core . '/' . $script, array(
358
            'type' => 'file',
359
            'scope' => 'header',
360
            'group' => JS_THEME,
361
            'preprocess' => TRUE,
362
            'cache' => TRUE,
363
            )
364
          );
365
        }
366
      }
367

  
368
      // IE conditional scripts, we need some semblance of structered data...
369
      if (isset($polyfills_array['ie'])) {
370
        $polyfills = array();
371
        foreach ($polyfills_array['ie'] as $conditional_comment => $scripts) {
372
          $ie_script = array(
373
            '#type' => 'markup',
374
            '#markup' => implode("\n", $scripts),
375
            '#prefix' => "<!--[if " . $conditional_comment . "]>\n",
376
            '#suffix' => "\n<![endif]-->\n",
377
          );
378
          $polyfills[$conditional_comment] = $ie_script;
379
        }
329 380
      }
330 381
    }
382
    else {
383
      $polyfills = '';
384
    }
331 385
  }
332 386

  
333
  return $polyfills_array;
387
  return $polyfills;
334 388
}
335 389

  
336 390

  
......
339 393
 *
340 394
 * @param $theme_name
341 395
 */
342
function load_debuggers($theme_name) {
396
function at_load_debuggers($theme_name) {
343 397
  global $path_to_at_core;
344 398

  
345 399
  // Do some debugging/development stuff
......
368 422
      'cache' => TRUE,
369 423
      )
370 424
    );
425
    drupal_add_css($path_to_at_core . '/css/debug-windowsize.css', array(
426
      'preprocess' => FALSE,
427
      'group' => CSS_THEME,
428
      'media' => 'screen',
429
      'every_page' => FALSE,
430
      'weight' => 2000,
431
      )
432
    );
371 433
  }
372 434
}
373 435

  
......
386 448
 * @param $theme_name, the active theme.
387 449
 * @param $weight, optional.
388 450
 */
389
function load_subtheme_responsive_styles($filepath, $media_query, $theme_name, $weight = 0) {
451
function at_load_subtheme_responsive_styles($filepath, $media_query, $theme_name, $weight = 0) {
390 452
  if (file_exists($filepath)) {
391 453
    drupal_add_css($filepath, array(
392 454
      'preprocess' => variable_get('preprocess_css', '') == 1 ? TRUE : FALSE,
......
406 468
 *
407 469
 * @param $theme_name, the active theme.
408 470
 */
409
function load_subtheme_conditional_styles($theme_name) {
410
  $info = drupal_static(__FUNCTION__, array());
471
function at_load_subtheme_conditional_styles($theme_name) {
472
  $info = &drupal_static(__FUNCTION__, array());
411 473
  if (empty($info)) {
412 474
    // Get the info file data
413 475
    $info = at_get_info($theme_name);
......
427 489
            $ie_style['condition'] = $condition;
428 490
            $ie_style['path'] = $ie_styles_path;
429 491
            $filepath = drupal_get_path('theme', $theme_name) . '/' . $ie_style['path'];
430
            load_conditional_styles($filepath, $ie_style, $theme_name);
492
            at_load_conditional_styles($filepath, $ie_style, $theme_name);
431 493
          }
432 494
        }
433 495
      }
......
446 508
 * @param $theme_name, the active theme.
447 509
 * @param $weight, optional.
448 510
 */
449
function load_conditional_styles($filepath, $ie_style, $theme_name, $weight = 0) {
511
function at_load_conditional_styles($filepath, $ie_style, $theme_name, $weight = 0) {
450 512
  if (file_exists($filepath)) {
451 513
    drupal_add_css($filepath, array(
452 514
      'group' => CSS_THEME,
......
461 523
    );
462 524
  }
463 525
  else {
464
    load_failure($filepath, $theme_name);
526
    at_load_failure($filepath, $theme_name);
465 527
  }
466 528
}
467 529

  
......
476 538
 * @param $scope, header or footer.
477 539
 * @param $weight, optional.
478 540
 */
479
function load_subtheme_script($filepath, $theme_name, $scope, $weight = NULL) {
541
function at_load_subtheme_script($filepath, $theme_name, $scope, $weight = NULL) {
480 542
  $filepath = drupal_get_path('theme', $theme_name) . '/' . $filepath;
481 543
  if (file_exists($filepath)) {
482 544
    drupal_add_js($filepath, array(
......
513 575
  return $script;
514 576
}
515 577

  
516
/**
517
 * Return themed scripts in Conditional Comments.
518
 * Since Drupal 7 does not (yet) support the 'browser' option in drupal_add_js()
519
 * Adaptivetheme provides a way to load scripts inside conditional comments.
520
 * This function will return a string for printing into a template, its
521
 * akin to a real theme_function but its not.
522
 *
523
 * @param $ie_scripts, an array of themed scripts.
524
 */
525
function at_theme_conditional_scripts($ie_scripts) {
526
  $themed_scripts = drupal_static(__FUNCTION__, array());
527
  if (empty($themed_scripts)) {
528
    $cc_scripts = array();
529

  
530
    foreach ($ie_scripts as $conditional_comment => $conditional_scripts) {
531
      $cc_scripts[] = '<!--[if ' . $conditional_comment . ']>' . "\n" . $conditional_scripts . "\n" . '<![endif]-->' . "\n";
532
    }
533
    $themed_scripts = implode("\n", $cc_scripts);
534
  }
535

  
536
  return $themed_scripts;
537
}
538

  
539
/**
540
 * Polyfills.
541
 * This function does two seperate operations. First it attaches a condition
542
 * to each Polyfill which can be either an IE conditional comment or 'all'.
543
 * Polyfills with 'all' are loaded immediatly via drupal_add_js(), those with
544
 * an IE CC are returned for further processing. This function is hard coded
545
 * to support only those scripts supplied by the core theme, if you need to load
546
 * a script for IE use the info file feature.
547
 *
548
 * @param $polly
549
 * @param $theme_name
550
 */
551
function polly_wants_a_cracker($polly, $theme_name) {
552
  global $path_to_at_core;
553

  
554
  $baked_crackers = drupal_static(__FUNCTION__, array());
555
  if (empty($baked_crackers)) {
556
    if (in_array(1, $polly)) {
557

  
558
      $crackers = array();
559

  
560
      // Respond.js
561
      if ($polly['load_respondjs'] === 1 && at_get_setting('disable_responsive_styles', $theme_name) === 0) {
562
        $crackers['ie']['lt IE 9'][] = 'scripts/respond.js';
563
      }
564
      // HTML5 Shiv
565
      if ($polly['load_html5js'] === 1) {
566
        $crackers['ie']['lt IE 9'][] = 'scripts/html5.js';
567
      }
568
      // Scalefix.js
569
      if ($polly['load_scalefixjs'] === 1) {
570
        $crackers['all'][] = 'scripts/scalefix.js';
571
      }
572
      // OnMediaQuery.js
573
      if ($polly['load_onmediaqueryjs'] === 1) {
574
        $crackers['all'][] = 'scripts/onmediaquery.js';
575
      }
576

  
577
      // Load Polyfills
578
      if (!empty($crackers)) {
579

  
580
        // We need the default query string for cache control finger printing
581
        $query_string = variable_get('css_js_query_string', '0');
582

  
583
        // "all" - no conditional comment needed, use drupal_add_js()
584
        if (isset($crackers['all'])) {
585
          foreach ($crackers['all'] as $script) {
586
            drupal_add_js($path_to_at_core . '/' . $script, array(
587
              'type' => 'file',
588
              'scope' => 'header',
589
              'group' => JS_THEME,
590
              'preprocess' => TRUE,
591
              'cache' => TRUE,
592
              )
593
            );
594
          }
595
        }
596
        if (isset($crackers['ie'])) {
597
          $baked_crackers = $crackers['ie'];
598
        }
599
      }
600
    }
601
  }
602

  
603
  return $baked_crackers;
604
}
605

  
606 578
/**
607 579
 * Google Font loader.
608 580
 * Adaptivetheme can load websafe fonts, Google fonts, custom font stacks and
......
613 585
 *
614 586
 * @param $theme_name
615 587
 */
616
function load_google_fonts($theme_name) {
617
  $google_font_string = drupal_static(__FUNCTION__, array());
588
function at_load_google_fonts($theme_name) {
589
  $google_font_string = &drupal_static(__FUNCTION__, array());
618 590
  if (empty($google_font_string)) {
619 591

  
620 592
    $used_fonts = array();
......
678 650
  return $google_font_string;
679 651
}
680 652

  
653
/**
654
 * Add js settings for the layout type and media query
655
 */
656
function at_load_layout_js_settings($theme_name) {
657
  $breakpoints = array(
658
    'bigscreen',
659
    'tablet_landscape',
660
    'tablet_portrait',
661
    'smalltouch_landscape',
662
    'smalltouch_portrait',
663
  );
664
  $cfg = array();
665
  foreach ($breakpoints as $breakpoint) {
666
    $layout = at_get_setting($breakpoint . '_layout', $theme_name);
667
    $media_query = at_get_setting($breakpoint . '_media_query', $theme_name);
668
    if ($layout) {
669
      $layout = str_replace('_', '-', $layout);
670
      $cfg[$theme_name]['layout_settings'][$breakpoint] = $layout;
671
    }
672
    if ($media_query) {
673
      check_plain($media_query);
674
      $cfg[$theme_name]['media_query_settings'][$breakpoint] = $media_query;
675
    }
676
  }
677
  drupal_add_js(array('adaptivetheme' => $cfg), 'setting');
678
}
679

  
680
/**
681
 * Return JS and CSS for the Menu Toggle for mobile.
682
 */
683
function at_load_menu_toggle($path, $theme_name) {
684
  // Add JS settings for each enabled option (breakpoint)
685
  $menu_toggle_settings = array(
686
    'menu_toggle_tablet_portrait',
687
    'menu_toggle_tablet_landscape',
688
  );
689
  $cfg = array();
690
  foreach ($menu_toggle_settings as $toggle_setting) {
691
    $setting = at_get_setting($toggle_setting, $theme_name);
692
    if ($setting == 1) {
693
      $cfg[$theme_name]['menu_toggle_settings'][$toggle_setting] = 'true';
694
    }
695
    else {
696
      $cfg[$theme_name]['menu_toggle_settings'][$toggle_setting] = 'false';
697
    }
698
  }
699
  drupal_add_js(array('adaptivetheme' => $cfg), 'setting');
700

  
701
  $path_to_at_core = drupal_get_path('theme', 'adaptivetheme');
702

  
703
  // Load additional plugins
704
  drupal_add_js($path_to_at_core . '/scripts/outside-events.js', array(
705
    'type' => 'file',
706
    'scope' => 'header',
707
    'group' => JS_THEME,
708
    'weight'=> 999,
709
    'preprocess' => TRUE,
710
    'cache' => TRUE,
711
    )
712
  );
713

  
714
  // Load the JS file
715
  drupal_add_js($path_to_at_core . '/scripts/menu-toggle.js', array(
716
    'type' => 'file',
717
    'scope' => 'header',
718
    'group' => JS_THEME,
719
    'weight'=> 999,
720
    'preprocess' => TRUE,
721
    'cache' => TRUE,
722
    )
723
  );
724

  
725
  // Load the generated CSS
726
  $filepath = $path . '/' . $theme_name . '.menutoggle.css';
727
  if (file_exists($filepath)) {
728
    drupal_add_css($filepath, array(
729
      'preprocess' => TRUE,
730
      'group' => CSS_THEME,
731
      'media' => 'all',
732
      'every_page' => TRUE,
733
      'weight' => 99,
734
      )
735
    );
736
  }
737
}
738

  
681 739
//
682 740
// Functions to maintain 7.x-2.x backward compatibility,
683 741
// DO NOT use these for 7.x-3.x or greater.
742
// Note to self - do not namespace these, that will certainly break existing sites.
684 743
//
685 744
// Load sub-theme media queries, 7.x-2.x backward compatibility
686 745
function load_subtheme_media_queries($files, $theme_name) {
......
698 757
      );
699 758
    }
700 759
    else {
701
      load_failure($filepath, $theme_name);
760
      at_load_failure($filepath, $theme_name);
702 761
    }
703 762
  }
704 763
}
......
721 780
      );
722 781
    }
723 782
    else {
724
      load_failure($filepath, $theme_name);
783
      at_load_failure($filepath, $theme_name);
725 784
    }
726 785
  }
727 786
}

Formats disponibles : Unified diff