View source
<?php
function rate_uninstall() {
variable_del('rate_widgets');
}
function _rate_update_templates_data() {
$templates = array();
foreach (module_implements('rate_templates') as $module) {
foreach (module_invoke($module, 'rate_templates') as $name => $template) {
$templates[$name] = $template;
}
}
$widgets = variable_get('rate_widgets', array());
foreach ($widgets as $widget_id => $widget) {
$template = isset($widget->template) ? $widget->template : NULL;
if (isset($templates[$template])) {
if (isset($widget->css)) {
unset($widget->css);
}
if (isset($templates[$template]->css)) {
$widget->css = $templates[$template]->css;
}
if (isset($widget->js)) {
unset($widget->js);
}
if (isset($templates[$template]->js)) {
$widget->js = $templates[$template]->js;
}
}
$widgets[$widget_id] = $widget;
}
variable_set('rate_widgets', $widgets);
}
function rate_update_6000() {
$widgets = variable_get('rate_widgets', array());
foreach ($widgets as $widget_id => $widget) {
$template = isset($widget->template) ? $widget->template : NULL;
if ($template == 'helpful') {
$widget->template = 'yesno';
}
$widgets[$widget_id] = $widget;
}
variable_set('rate_widgets', $widgets);
return array();
}
function rate_update_6001() {
_rate_update_templates_data();
return array();
}