You are here

function smiley_import_add_plist in Smiley 6

1 call to smiley_import_add_plist()
smiley_import_add in ./smiley_import.module
Menu callback; Add a Smiley pack.

File

./smiley_import.module, line 192

Code

function smiley_import_add_plist($plist_pack, $extension = '') {
  smiley_import_delete($plist_pack, 1);
  if (!($packd = smiley_import_packs($plist_pack))) {
    drupal_set_message(t('Cannot find smiley package %pack.', array(
      '%pack' => $plist_pack,
    )));
    drupal_goto('admin/settings/smiley/import');
  }
  $parse_data = smiley_import_parse_plist($plist_pack);
  foreach ($parse_data['Emoticons'] as $file => $smiley) {
    $acronyms = implode(' ', $smiley['Equivalents']);
    $acronyms = str_replace("<", "&lt;", $acronyms);
    $acronyms = str_replace(">", "&gt;", $acronyms);
    db_query("INSERT INTO {smiley} (acronyms, image, description, standalone, promote_to_box, package) VALUES ('%s', '%s', '%s', %d, 0, '%s')", $acronyms, drupal_get_path('module', 'smiley') . '/packs/' . $plist_pack . $extension . '/' . $file, $smiley['Name'], 1, $plist_pack);
  }
}