PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | back/Classes/TagClass.php +8 -0 10.1.4 → 11.1.0 View file →
@@ -16,15 +16,23 @@
16 16 $this->table = 'tag';
17 17 $this->pkey = 'id';
18 18 }
19 19
20 + /**
21 + * Attaches the tags passed in parameter to the specified element
22 + */
20 23 public function setTags(string $type, int $elementId, array $newTags): void
21 24 {
25 + // Remove the old tags from the element
22 26 acym_query('DELETE FROM #__acym_tag WHERE `type` = '.acym_escapeDB($type).' AND `id_element` = '.intval($elementId));
23 27
24 28 $tagsToInsertQuery = [];
25 29
26 30 foreach ($newTags as $oneTag) {
31 + if (empty($oneTag)) {
32 + continue;
33 + }
34 +
27 35 $newTag = new \stdClass();
28 36 $newTag->type = $type;
29 37
30 38 if (strpos($oneTag, 'acy_new_tag_') !== false) {