| @@ -32,9 +32,9 @@ | ||
| 32 | 32 | ]; |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function getStandardStructure(&$customView) | |
| 36 | + public function getStandardStructure(string &$customView): void | |
| 37 | 37 | { |
| 38 | 38 | $tag = new stdClass(); |
| 39 | 39 | $tag->id = 0; |
| 40 | 40 | |
| @@ -49,9 +49,9 @@ | ||
| 49 | 49 | $format->customFields = []; |
| 50 | 50 | $customView = '<div class="acymailing_content">'.$this->pluginHelper->getStandardDisplay($format).'</div>'; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function initReplaceOptionsCustomView() | |
| 53 | + public function initReplaceOptionsCustomView(): void | |
| 54 | 54 | { |
| 55 | 55 | $this->replaceOptions = [ |
| 56 | 56 | 'link' => ['ACYM_LINK'], |
| 57 | 57 | 'picthtml' => ['ACYM_IMAGE'], |
| @@ -58,9 +58,9 @@ | ||
| 58 | 58 | 'readmore' => ['ACYM_READ_MORE'], |
| 59 | 59 | ]; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function initElementOptionsCustomView() | |
| 62 | + public function initElementOptionsCustomView(): void | |
| 63 | 63 | { |
| 64 | 64 | $query = 'SELECT page.* |
| 65 | 65 | FROM #__posts AS page |
| 66 | 66 | WHERE page.post_type = "page" |
| @@ -71,14 +71,14 @@ | ||
| 71 | 71 | $this->elementOptions[$key] = [$key]; |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function getPossibleIntegrations() | |
| 75 | + public function getPossibleIntegrations(): ?object | |
| 76 | 76 | { |
| 77 | 77 | return $this->pluginDescription; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function insertionOptions($defaultValues = null) | |
| 80 | + public function insertionOptions(?object $defaultValues = null): void | |
| 81 | 81 | { |
| 82 | 82 | $this->defaultValues = $defaultValues; |
| 83 | 83 | |
| 84 | 84 | $displayOptions = [ |
| @@ -121,13 +121,13 @@ | ||
| 121 | 121 | ], |
| 122 | 122 | ]; |
| 123 | 123 | |
| 124 | 124 | $zoneContent = $this->getFilteringZone(false).$this->prepareListing(); |
| 125 | - echo $this->displaySelectionZone($zoneContent); | |
| 126 | - echo $this->pluginHelper->displayOptions($displayOptions, $this->name, 'individual', $this->defaultValues); | |
| 125 | + $this->displaySelectionZone($zoneContent); | |
| 126 | + $this->pluginHelper->displayOptions($displayOptions, $this->name, 'individual', $this->defaultValues); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - public function prepareListing() | |
| 129 | + public function prepareListing(): string | |
| 130 | 130 | { |
| 131 | 131 | $this->querySelect = 'SELECT page.ID, page.post_title, page.post_date, page.post_content '; |
| 132 | 132 | $this->query = 'FROM #__posts AS page '; |
| 133 | 133 | $this->filters = []; |
| @@ -142,14 +142,16 @@ | ||
| 142 | 142 | |
| 143 | 143 | $rows = $this->getElements(); |
| 144 | 144 | foreach ($rows as $i => $row) { |
| 145 | 145 | if (str_replace(['wp:core-embed', 'wp:shortcode'], '', $row->post_content) !== $row->post_content) { |
| 146 | - $rows[$i]->post_title = acym_tooltip( | |
| 147 | - [ | |
| 148 | - 'hoveredText' => '<i class="acymicon-exclamation-triangle"></i>', | |
| 149 | - 'textShownInTooltip' => acym_translation('ACYM_SPECIAL_CONTENT_WARNING'), | |
| 150 | - ] | |
| 151 | - ).$rows[$i]->post_title; | |
| 146 | + ob_start(); | |
| 147 | + acym_tooltip( | |
| 148 | + [ | |
| 149 | + 'hoveredText' => '<i class="acymicon-exclamation-triangle"></i>', | |
| 150 | + 'textShownInTooltip' => acym_translation('ACYM_SPECIAL_CONTENT_WARNING'), | |
| 151 | + ] | |
| 152 | + ); | |
| 153 | + $rows[$i]->post_title = ob_get_clean().$rows[$i]->post_title; | |
| 152 | 154 | } |
| 153 | 155 | } |
| 154 | 156 | |
| 155 | 157 | $listingOptions = [ |
| @@ -175,14 +177,14 @@ | ||
| 175 | 177 | |
| 176 | 178 | return $this->getElementsListing($listingOptions); |
| 177 | 179 | } |
| 178 | 180 | |
| 179 | - public function replaceContent(&$email) | |
| 181 | + public function replaceContent(object &$email): void | |
| 180 | 182 | { |
| 181 | 183 | $this->replaceOne($email); |
| 182 | 184 | } |
| 183 | 185 | |
| 184 | - public function replaceIndividualContent($tag) | |
| 186 | + public function replaceIndividualContent(object $tag): string | |
| 185 | 187 | { |
| 186 | 188 | $query = 'SELECT page.* |
| 187 | 189 | FROM #__posts AS page |
| 188 | 190 | WHERE page.post_type = "page" |
| @@ -227,9 +229,9 @@ | ||
| 227 | 229 | } |
| 228 | 230 | |
| 229 | 231 | $customFields = []; |
| 230 | 232 | |
| 231 | - $varFields['{readmore}'] = '<a class="acymailing_readmore_link" style="text-decoration:none;" target="_blank" href="'.$link.'"><span class="acymailing_readmore">'.acym_escape( | |
| 233 | + $varFields['{readmore}'] = '<a class="acymailing_readmore_link" style="text-decoration:none;" target="_blank" href="'.$link.'"><span class="acymailing_readmore">'.esc_html( | |
| 232 | 234 | acym_translation('ACYM_READ_MORE') |
| 233 | 235 | ).'</span></a>'; |
| 234 | 236 | if (in_array('readmore', $tag->display)) $afterArticle .= $varFields['{readmore}']; |
| 235 | 237 | |
| @@ -246,11 +248,10 @@ | ||
| 246 | 248 | |
| 247 | 249 | return $this->finalizeElementFormat($result, $tag, $varFields); |
| 248 | 250 | } |
| 249 | 251 | |
| 250 | - protected function getTranslationId($elementId, $translationTool, $defaultLanguage = false) | |
| 252 | + protected function getTranslationId(int $elementId, string $translationTool, bool $defaultLanguage = false): int | |
| 251 | 253 | { |
| 252 | - $elementId = intval($elementId); | |
| 253 | 254 | $languageCode = $this->emailLanguage; |
| 254 | 255 | |
| 255 | 256 | if ($defaultLanguage) { |
| 256 | 257 | $languageCode = $this->config->get('multilingual_default', ACYM_DEFAULT_LANGUAGE); |
| @@ -256,8 +257,9 @@ | ||
| 256 | 257 | $languageCode = $this->config->get('multilingual_default', ACYM_DEFAULT_LANGUAGE); |
| 257 | 258 | } else { |
| 258 | 259 | $idDefaultLanguage = $this->getTranslationId($elementId, $translationTool, true); |
| 259 | 260 | |
| 261 | + // We only translate inserted articles of the default language | |
| 260 | 262 | if ($idDefaultLanguage !== $elementId) { |
| 261 | 263 | return $elementId; |
| 262 | 264 | } |
| 263 | 265 | } |
| @@ -270,8 +272,9 @@ | ||
| 270 | 272 | if (!empty($translationId)) $elementId = $translationId; |
| 271 | 273 | } |
| 272 | 274 | } elseif ($translationTool === 'wpml') { |
| 273 | 275 | if (acym_isExtensionActive('sitepress-multilingual-cms/sitepress.php')) { |
| 276 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WPML hook for integration. | |
| 274 | 277 | $elementId = apply_filters('wpml_object_id', $elementId, 'post', true, $languageCode); |
| 275 | 278 | } |
| 276 | 279 | } |
| 277 | 280 | |