You are here

function printfriendly_upgrade_db in PrintFriendly & PDF 7.5

Same name and namespace in other branches
  1. 8.3 printfriendly.module \printfriendly_upgrade_db()
  2. 7.4 printfriendly.module \printfriendly_upgrade_db()
1 call to printfriendly_upgrade_db()
printfriendly_create_button in ./printfriendly.module
Shared function generate code for printfriendly button for nodes and block.

File

./printfriendly.module, line 28
Adds PrintFriendly button to chosen node types and provides a block.

Code

function printfriendly_upgrade_db() {
  $db_version = variable_get('db_version');
  if ($db_version == NULL) {
    $db_version = 0;
  }
  if ($db_version < 1) {
    switch (variable_get('printfriendly_image')) {
      case 'button-print-blu20.png':
      case 'button-print-whgn20.png':
        variable_set('printfriendly_image', 'print-button-nobg.png');
        break;
      case 'button-print-grnw20.png':
        variable_set('printfriendly_image', 'print-button.png');
        break;
      case 'button-print-gry20.png':
        variable_set('printfriendly_image', 'print-button-gray.png');
        break;
      case 'button-print-blu20.png':
        variable_set('printfriendly_image', 'print-button-nobg.png');
        break;
      case 'pf-button-big.gif':
        variable_set('printfriendly_image', 'printfriendly-button-lg.png');
        break;
      case 'pf-button-big.gif':
        variable_set('printfriendly_image', 'printfriendly-button-lg.png');
        break;
      case 'pf-button-both.gif':
        variable_set('printfriendly_image', 'printfriendly-pdf-button.png');
        break;
      case 'pf-button.gif':
        variable_set('printfriendly_image', 'printfriendly-button.png');
        break;
      case 'pf-icon-small.gif':
        variable_set('printfriendly_image', 'printfriendly-icon-sm.png');
        break;
      case 'pf-icon.gif':
        variable_set('printfriendly_image', 'printfriendly-icon-md.png');
        break;
      case 'pf-pdf-icon.gif':
        variable_set('printfriendly_image', 'pdf-icon-md.png');
        break;
      case 'pf_button_sq_grn_m.png':
      case 'pf_button_sq_gry_m.png':
        variable_set('printfriendly_image', 'printfriendly-icon-lg.png');
        break;
      default:
        variable_set('printfriendly_image', 'printfriendly-button.png');
    }
  }
  variable_set('db_version', 1);
}