change emoji removal to optional
This commit is contained in:
@@ -9,7 +9,12 @@ function booking_node_presave($node) {
|
||||
'!event' => $event->booking_eventname,
|
||||
'!name' => $node->booking_firstname . ' ' . $node->booking_lastname,
|
||||
));
|
||||
|
||||
//strip any emojis from user input if that feature is enabled
|
||||
if (variable_get('booking_enable_emoji_removal', 1) == 1) {
|
||||
$title = _booking_remove_emoji($title);
|
||||
}
|
||||
|
||||
$node->title = $title;
|
||||
}
|
||||
}
|
||||
@@ -416,23 +421,32 @@ function booking_update($node) {
|
||||
//check if the key is a field that belongs in the database
|
||||
if ((strpos($key, "booking_") === 0) || $key === "nid") {
|
||||
//what special handling does this field need?
|
||||
|
||||
//handle dates properly
|
||||
if ((strpos($key, "booking_dob") === 0) || (strpos($key, "booking_passport_issue_date") === 0)) {
|
||||
$data[$key] = _date_to_ts($value);
|
||||
}
|
||||
elseif (in_array($key, $excluded_keys, FALSE)) {
|
||||
//skip these fields from the update of booking_person
|
||||
elseif (in_array($key, $excluded_keys, FALSE)) {
|
||||
//do nothing
|
||||
}
|
||||
//this field needs 0/1 translated to N/Y
|
||||
elseif (in_array($key, $boolean_keys, FALSE)) {
|
||||
$data[$key] = $value == 1 ? 'Y' : 'N';
|
||||
}
|
||||
//this field has a default value of zero rather than null
|
||||
elseif (in_array($key, $default_zero_keys, FALSE)) {
|
||||
$data[$key] = $value == '' ? 0 : $value;
|
||||
}
|
||||
//just handle this field normally
|
||||
else {
|
||||
if (variable_get('booking_enable_emoji_removal', 1) == 1) {
|
||||
$data[$key] = _booking_remove_emoji($value);
|
||||
}
|
||||
|
||||
else {
|
||||
$data[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
watchdog('booking', 'Updating node: @info', array('@info' => var_export($data, TRUE)));
|
||||
|
Reference in New Issue
Block a user