function coder_upgrade_upgrade_call_drupal_set_html_head_alter in Coder 7.2
Same name and namespace in other branches
- 7 coder_upgrade/conversions/call.inc \coder_upgrade_upgrade_call_drupal_set_html_head_alter()
Implements hook_upgrade_call_drupal_set_html_head_alter().
File
- coder_upgrade/
conversions/ call.inc, line 1271 - Provides conversion routines applied to function calls.
Code
function coder_upgrade_upgrade_call_drupal_set_html_head_alter(&$node, &$reader) {
// DONE (UPDATED)
// Create helper objects.
$editor = PGPEditor::getInstance();
// Get the function call object.
$item =& $node->data;
// Process function call.
$name =& $item->name;
$name['value'] = 'drupal_add_html_head';
$count = $item->parameters
->count();
if ($count == 1) {
// http://drupal.org/node/224333#drupal_add_css_inline
// Inline css can be now added via drupal_add_css
$p0 = $item
->printParameter();
if (preg_match('#^([\'"])\\s*<style type=[\'"]text/css[\'"]>(.*)</style>#si', $p0, $matches)) {
$name['value'] = 'drupal_add_css';
$editor
->setParameters($item, array(
$matches[1] . $matches[2] . $matches[1],
"array('type' => 'inline')",
));
return;
}
// http://drupal.org/node/224333#drupal_add_js_external
// External JavaScript files can be now added via drupal_add_js
if (preg_match('#^[\'"]<script.*src=[\'"](.*?)[\'"]#i', $p0, $matches)) {
$name['value'] = 'drupal_add_js';
$editor
->setParameter($item, 0, "'" . $matches[1] . "'");
$editor
->setParameter($item, 1, "array('type' => 'external')");
return;
}
$key = '$key = NULL /* TODO Set this variable. */';
// Insert new required parameter when first parameter is set.
$editor
->insertParameter($item, 1, $key);
}
}