You are here

function smileys_import_add_plist in Smileys 6

1 call to smileys_import_add_plist()
smileys_import_add in ./smileys_import.module
Menu callback; Add a Smiley pack.

File

./smileys_import.module, line 192

Code

function smileys_import_add_plist($plist_pack, $extension = '') {
  smileys_import_delete($plist_pack, 1);
  if (!($packd = smileys_import_packs($plist_pack))) {
    drupal_set_message(t('Cannot find smiley package %pack.', array(
      '%pack' => $plist_pack,
    )));
    drupal_goto('admin/settings/smileys/import');
  }
  $parse_data = smileys_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 {smileys} (acronyms, image, description, standalone, promote_to_box, package) VALUES ('%s', '%s', '%s', %d, 0, '%s')", $acronyms, drupal_get_path('module', 'smileys') . '/packs/' . $plist_pack . $extension . '/' . $file, $smiley['Name'], 1, $plist_pack);
  }
}