| @@ -1,61 +1,68 @@ | ||
| 1 | 1 | <?php |
| 2 | +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- View file, its variables are local to the include scope, not true globals. | |
| 3 | +defined('ABSPATH') || die('Restricted Access'); | |
| 4 | + | |
| 5 | +use AcyMailing\Classes\CampaignClass; | |
| 6 | + | |
| 2 | 7 | $isAbTest = $data['abtest']; |
| 3 | 8 | $isSent = !empty($data['campaignInformation']->sent) && !empty($data['campaignInformation']->active); |
| 4 | 9 | $campaignController = acym_isAdmin() ? 'campaigns' : 'frontcampaigns'; |
| 5 | 10 | ?> |
| 6 | 11 | <form id="acym_form" |
| 7 | - action="<?php echo acym_completeLink(acym_getVar('cmd', 'ctrl')); ?>" | |
| 8 | - method="post" | |
| 9 | - name="acyForm" | |
| 10 | - class="acym__form__campaign__edit <?php echo !empty($data['menuClass']) ? acym_escape($data['menuClass']) : ''; ?>" | |
| 11 | - data-abide | |
| 12 | - novalidate> | |
| 12 | + action="<?php echo esc_url(acym_completeLink(acym_getVar('cmd', 'ctrl'))); ?>" | |
| 13 | + method="post" | |
| 14 | + name="acyForm" | |
| 15 | + class="acym__form__campaign__edit <?php echo !empty($data['menuClass']) ? esc_attr($data['menuClass']) : ''; ?>" | |
| 16 | + data-abide | |
| 17 | + novalidate> | |
| 13 | 18 | <div class="grid-x"> |
| 14 | 19 | <div class="cell medium-auto"></div> |
| 15 | - <div class="cell <?php echo $data['containerClass']; ?> acym__content"> | |
| 20 | + <div class="cell <?php echo esc_attr($data['containerClass']); ?> acym__content"> | |
| 16 | 21 | |
| 17 | 22 | <?php |
| 18 | 23 | $this->addSegmentStep($data['displaySegmentTab']); |
| 19 | 24 | $workflow = $data['workflowHelper']; |
| 20 | - echo $workflow->display($this->steps, $this->step, true, false, '', 'campaignId'); | |
| 25 | + $workflow->display($this->steps, $this->step, true, false, '', 'campaignId'); | |
| 21 | 26 | ?> |
| 22 | 27 | |
| 23 | 28 | <div id="acym__campaign__summary" class="grid-x grid-margin-y"> |
| 24 | 29 | <div class="cell grid-x acym__campaign__summary__section margin-right-2"> |
| 25 | - <h5 class="cell shrink margin-right-2 acym__title acym__title__secondary"> | |
| 26 | - <b><?php echo acym_translation('ACYM_EMAIL'); ?></b> | |
| 30 | + <h5 class="cell shrink margin-next-1 acym__title acym__title__secondary"> | |
| 31 | + <b><?php echo esc_html(acym_translation('ACYM_EMAIL')); ?></b> | |
| 27 | 32 | </h5> |
| 28 | 33 | <div class="cell auto acym__campaign__summary__modify"> |
| 29 | - <a href="<?php echo acym_completeLink( | |
| 30 | - $campaignController.'&task=edit&step=editEmail&edition=1&campaignId='.intval($data['campaignInformation']->id) | |
| 31 | - ); ?>"><i class="acymicon-pencil"></i><span> <?php echo acym_translation('ACYM_EDIT'); ?></span></a> | |
| 34 | + <a href="<?php echo esc_url( | |
| 35 | + acym_completeLink( | |
| 36 | + $campaignController.'&task=edit&step=editEmail&edition=1&campaignId='.intval($data['campaignInformation']->id) | |
| 37 | + ) | |
| 38 | + ); ?>"><i class="acymicon-pencil"></i><span> <?php echo esc_html(acym_translation('ACYM_EDIT')); ?></span></a> | |
| 32 | 39 | </div> |
| 33 | 40 | <div class="cell grid-x"> |
| 34 | 41 | <p class="cell medium-6 acym__campaign__summary__email__information"> |
| 35 | - <?php echo acym_translation('ACYM_FROM_NAME'); ?>: <span class="acym__color__blue"> | |
| 36 | - <?php echo acym_escape($data['mailInformation']->from_name); ?> | |
| 42 | + <?php echo esc_html(acym_translation('ACYM_FROM_NAME')); ?>: <span class="acym__color__blue"> | |
| 43 | + <?php echo esc_html($data['mailInformation']->from_name); ?> | |
| 37 | 44 | </span> |
| 38 | 45 | </p> |
| 39 | 46 | <p class="cell medium-6 acym__campaign__summary__email__information"> |
| 40 | - <?php echo acym_translation('ACYM_FROM_EMAIL'); ?>: <span class="acym__color__blue"> | |
| 41 | - <?php echo acym_escape($data['mailInformation']->from_email); ?> | |
| 47 | + <?php echo esc_html(acym_translation('ACYM_FROM_EMAIL')); ?>: <span class="acym__color__blue"> | |
| 48 | + <?php echo esc_html($data['mailInformation']->from_email); ?> | |
| 42 | 49 | </span> |
| 43 | 50 | </p> |
| 44 | 51 | <p class="cell medium-6 acym__campaign__summary__email__information"> |
| 45 | - <?php echo acym_translation('ACYM_REPLYTO_NAME'); ?>: <span class="acym__color__blue"> | |
| 46 | - <?php echo acym_escape($data['mailInformation']->reply_to_name); ?> | |
| 52 | + <?php echo esc_html(acym_translation('ACYM_REPLYTO_NAME')); ?>: <span class="acym__color__blue"> | |
| 53 | + <?php echo esc_html($data['mailInformation']->reply_to_name); ?> | |
| 47 | 54 | </span> |
| 48 | 55 | </p> |
| 49 | 56 | <p class="cell medium-6 acym__campaign__summary__email__information"> |
| 50 | - <?php echo acym_translation('ACYM_REPLYTO_EMAIL'); ?>: <span class="acym__color__blue"> | |
| 51 | - <?php echo acym_escape($data['mailInformation']->reply_to_email); ?> | |
| 57 | + <?php echo esc_html(acym_translation('ACYM_REPLYTO_EMAIL')); ?>: <span class="acym__color__blue"> | |
| 58 | + <?php echo esc_html($data['mailInformation']->reply_to_email); ?> | |
| 52 | 59 | </span> |
| 53 | 60 | </p> |
| 54 | 61 | <p class="cell medium-6 margin-bottom-1 margin-top-1 acym__campaign__summary__email__information"> |
| 55 | - <?php echo acym_translation('ACYM_EMAIL_SUBJECT'); ?>: | |
| 62 | + <?php echo esc_html(acym_translation('ACYM_EMAIL_SUBJECT')); ?>: | |
| 56 | 63 | <span class="acym__color__blue acym__campaign__summary__email__information-subject"> |
| 57 | - <?php echo acym_escape($data['mailInformation']->subject); ?> | |
| 64 | + <?php echo esc_html($data['mailInformation']->subject); ?> | |
| 58 | 65 | </span> |
| 59 | 66 | </p> |
| 60 | 67 | <?php if (!empty($data['isArchiveCached'])) { ?> |
| 61 | 68 | <div class="cell grid-x grid-margin-x" id="acym__campaigns__summary__archive__refresh"> |
| @@ -61,11 +68,11 @@ | ||
| 61 | 68 | <div class="cell grid-x grid-margin-x" id="acym__campaigns__summary__archive__refresh"> |
| 62 | 69 | <button |
| 63 | 70 | id="acym__campaigns__summary__refresh__archive" |
| 64 | 71 | class="button-secondary button margin-top-0 margin-bottom-2 margin-right-0 cell medium-shrink"> |
| 65 | - <?php echo acym_translation('ACYM_REFRESH_ARCHIVE'); ?> | |
| 72 | + <?php echo esc_html(acym_translation('ACYM_REFRESH_ARCHIVE')); ?> | |
| 66 | 73 | </button> |
| 67 | - <?php echo acym_info('ACYM_REFRESH_ARCHIVE_DESC'); ?> | |
| 74 | + <?php acym_info(['textShownInTooltip' => 'ACYM_REFRESH_ARCHIVE_DESC']); ?> | |
| 68 | 75 | <div id="acym__campaigns__summary__refresh__archive__message"></div> |
| 69 | 76 | </div> |
| 70 | 77 | <?php } ?> |
| 71 | 78 | </div> |
| @@ -77,10 +84,10 @@ | ||
| 77 | 84 | if (!empty($data['abtest'])) { |
| 78 | 85 | include acym_getView('campaigns', 'summary_abtest', true); |
| 79 | 86 | } |
| 80 | 87 | ?> |
| 81 | - <input type="hidden" class="acym__hidden__mail__content" value="<?php echo acym_escape(acym_absoluteURL($data['mailInformation']->body)); ?>"> | |
| 82 | - <div style="display: none" class="acym__hidden__mail__stylesheet"><?php echo $data['mailInformation']->stylesheet; ?></div> | |
| 88 | + <input type="hidden" class="acym__hidden__mail__content" value="<?php echo esc_attr(acym_absoluteURL($data['mailInformation']->body)); ?>"> | |
| 89 | + <input type="hidden" class="acym__hidden__mail__stylesheet" value="<?php echo esc_attr($data['mailInformation']->stylesheet); ?>"> | |
| 83 | 90 | <div class="cell grid-x"> |
| 84 | 91 | <div id="acym__wysid__email__preview" class="acym__email__preview grid-x cell"></div> |
| 85 | 92 | </div> |
| 86 | 93 | </div> |
| @@ -85,77 +92,88 @@ | ||
| 85 | 92 | </div> |
| 86 | 93 | </div> |
| 87 | 94 | <?php if (!empty($data['mailInformation']->attachments)) { ?> |
| 88 | 95 | <div class="cell grid-x acym__campaign__summary__section"> |
| 89 | - <h5 class="cell shrink margin-right-2 acym__title acym__title__secondary"> | |
| 90 | - <b><?php echo acym_translation('ACYM_ATTACHMENTS'); ?></b> | |
| 96 | + <h5 class="cell shrink margin-next-1 acym__title acym__title__secondary"> | |
| 97 | + <b><?php echo esc_html(acym_translation('ACYM_ATTACHMENTS')); ?></b> | |
| 91 | 98 | </h5> |
| 92 | 99 | <div class="cell auto acym__campaign__summary__modify"> |
| 93 | - <a href="<?php echo acym_completeLink( | |
| 94 | - $campaignController.'&task=edit&step=editEmail&edition=1&campaignId='.intval($data['campaignInformation']->id) | |
| 100 | + <a href="<?php echo esc_url( | |
| 101 | + acym_completeLink( | |
| 102 | + $campaignController.'&task=edit&step=editEmail&edition=1&campaignId='.intval($data['campaignInformation']->id) | |
| 103 | + ) | |
| 95 | 104 | ); ?>"><i |
| 96 | - class="acymicon-pencil"></i><span> <?php echo acym_translation('ACYM_EDIT'); ?></span></a> | |
| 105 | + class="acymicon-pencil"></i><span> <?php echo esc_html(acym_translation('ACYM_EDIT')); ?></span></a> | |
| 97 | 106 | </div> |
| 98 | - <?php foreach (json_decode($data['mailInformation']->attachments) as $key => $oneAttachment) { | |
| 99 | - $onlyFilename = explode("/", $oneAttachment->filename); | |
| 107 | + <?php | |
| 108 | + $attachments = json_decode($data['mailInformation']->attachments, true); | |
| 109 | + foreach ($attachments as $key => $oneAttachment) { | |
| 110 | + $onlyFilename = explode('/', $oneAttachment['filename']); | |
| 100 | 111 | |
| 101 | 112 | $onlyFilename = end($onlyFilename); |
| 102 | 113 | |
| 103 | - echo acym_tooltip( | |
| 114 | + acym_tooltip( | |
| 104 | 115 | [ |
| 105 | 116 | 'hoveredText' => '<div class="cell" data-toggle="path_attachment_'.$key.'">'.$onlyFilename.'</div>', |
| 106 | - 'textShownInTooltip' => $oneAttachment->filename, | |
| 117 | + 'textShownInTooltip' => $oneAttachment['filename'], | |
| 107 | 118 | 'classContainer' => 'cell', |
| 108 | 119 | ] |
| 109 | 120 | ); |
| 110 | - } ?> | |
| 121 | + } | |
| 122 | + ?> | |
| 111 | 123 | </div> |
| 112 | 124 | <?php } ?> |
| 113 | 125 | <div class="cell grid-x acym__campaign__summary__section"> |
| 114 | - <h5 class="cell shrink margin-right-2 acym__title acym__title__secondary"> | |
| 126 | + <h5 class="cell shrink margin-next-1 acym__title acym__title__secondary"> | |
| 115 | 127 | <b> |
| 116 | 128 | <?php |
| 117 | - echo acym_translation('ACYM_RECIPIENTS'); | |
| 118 | - echo ' ('.$data['nbSubscribers'].' '.acym_translation('ACYM_SUBSCRIBERS').acym_info('ACYM_SUMMARY_NUMBER_RECEIVERS_DESC').')'; | |
| 129 | + echo esc_html(acym_translation('ACYM_RECIPIENTS')); | |
| 130 | + echo ' ('.esc_html($data['nbSubscribers'].' '.acym_translation('ACYM_SUBSCRIBERS')); | |
| 131 | + acym_info(['textShownInTooltip' => 'ACYM_SUMMARY_NUMBER_RECEIVERS_DESC']); | |
| 132 | + echo ')'; | |
| 119 | 133 | ?> |
| 120 | 134 | </b> |
| 121 | 135 | </h5> |
| 122 | 136 | <div class="cell auto acym__campaign__summary__modify"> |
| 123 | - <a href="<?php echo acym_completeLink( | |
| 124 | - $campaignController.'&task=edit&step=recipients&edition=1&campaignId='.intval($data['campaignInformation']->id) | |
| 125 | - ); ?>"><i class="acymicon-pencil"></i><span> <?php echo acym_translation('ACYM_EDIT'); ?></span></a> | |
| 137 | + <a href="<?php echo esc_url( | |
| 138 | + acym_completeLink( | |
| 139 | + $campaignController.'&task=edit&step=recipients&edition=1&campaignId='.intval($data['campaignInformation']->id) | |
| 140 | + ) | |
| 141 | + ); ?>"><i class="acymicon-pencil"></i><span> <?php echo esc_html(acym_translation('ACYM_EDIT')); ?></span></a> | |
| 126 | 142 | </div> |
| 127 | 143 | <div class="cell acym__listing"> |
| 128 | - <?php foreach ($data['listsReceiver'] as $oneList) { | |
| 129 | - $subscribers = acym_modalInclude( | |
| 130 | - '<span class="text-underline cursor-pointer"> | |
| 131 | - <b>'.$oneList->subscribers.' | |
| 132 | - </b> '.acym_strtolower(acym_translation('ACYM_SUBSCRIBERS')).' | |
| 133 | - </span>', | |
| 134 | - acym_getPartial('modal', 'users'), | |
| 135 | - 'acym__campaign__summary__users_summary__'.$oneList->list_id, | |
| 136 | - [ | |
| 137 | - 'ctrl' => acym_isAdmin() ? 'lists' : 'frontlists', | |
| 138 | - 'task' => 'usersSummary', | |
| 139 | - 'list_id' => $oneList->list_id, | |
| 140 | - ], | |
| 141 | - '', | |
| 142 | - 'acym__modal__users__summary__container' | |
| 143 | - ); | |
| 144 | - echo '<div class="cell grid-x acym__listing__row"> | |
| 145 | - <span class="cell small-6"> | |
| 146 | - <i class="acymicon-circle acym__campaign__summary__recipients__list__color margin-right-1" | |
| 147 | - style="color: '.$oneList->color.'"> | |
| 148 | - </i> | |
| 149 | - <b>'.$oneList->name.'</b> | |
| 150 | - </span> | |
| 151 | - <span class="cell small-6">'.$subscribers.'</span> | |
| 152 | - </div>'; | |
| 153 | - } ?> | |
| 144 | + <?php foreach ($data['listsReceiver'] as $oneList) { ?> | |
| 145 | + <div class="cell grid-x acym__listing__row"> | |
| 146 | + <span class="cell small-6"> | |
| 147 | + <i class="acymicon-circle acym__campaign__summary__recipients__list__color margin-right-1" | |
| 148 | + style="color: <?php echo esc_attr($oneList->color ?? '#0079d3'); ?>"> | |
| 149 | + </i> | |
| 150 | + <b><?php echo esc_html($oneList->name); ?></b> | |
| 151 | + </span> | |
| 152 | + <span class="cell small-6"> | |
| 153 | + <?php | |
| 154 | + acym_modalInclude( | |
| 155 | + '<span class="text-underline cursor-pointer"> | |
| 156 | + <b>'.esc_html($oneList->subscribers).' | |
| 157 | + </b> '.esc_html(acym_strtolower(acym_translation('ACYM_SUBSCRIBERS'))).' | |
| 158 | + </span>', | |
| 159 | + acym_getPartial('modal', 'users'), | |
| 160 | + 'acym__campaign__summary__users_summary__'.$oneList->list_id, | |
| 161 | + [ | |
| 162 | + 'ctrl' => acym_isAdmin() ? 'lists' : 'frontlists', | |
| 163 | + 'task' => 'usersSummary', | |
| 164 | + 'list_id' => $oneList->list_id, | |
| 165 | + ], | |
| 166 | + 'acym__modal__users__summary__container' | |
| 167 | + ); | |
| 168 | + ?> | |
| 169 | + </span> | |
| 170 | + </div> | |
| 171 | + <?php } ?> | |
| 154 | 172 | </div> |
| 155 | 173 | <?php if (!empty($data['segment'])) { ?> |
| 156 | 174 | <div class="cell grid-x acym__campaign__summary__section margin-top-1"> |
| 157 | - <h5 class="cell shrink margin-right-2 acym__title acym__title__secondary"><?php | |
| 175 | + <h5 class="cell shrink margin-next-1 acym__title acym__title__secondary"><?php | |
| 158 | 176 | if (!empty($data['campaignInformation']->sending_params['segment']['invert'])) { |
| 159 | 177 | $segmentInformation = $data['campaignInformation']->sending_params['segment']['invert'] === 'exclude' |
| 160 | 178 | ? ' ('.acym_translation('ACYM_EXCLUDE').')' |
| 161 | 179 | : ' ('.acym_translation('ACYM_INCLUDE').')'; |
| @@ -161,18 +179,22 @@ | ||
| 161 | 179 | : ' ('.acym_translation('ACYM_INCLUDE').')'; |
| 162 | 180 | } else { |
| 163 | 181 | $segmentInformation = ' ('.acym_translation('ACYM_INCLUDE').')'; |
| 164 | 182 | } |
| 165 | - echo acym_translation('ACYM_SEGMENT').$segmentInformation; | |
| 183 | + echo esc_html(acym_translation('ACYM_SEGMENT').$segmentInformation); | |
| 166 | 184 | ?></h5> |
| 167 | 185 | <div class="cell auto acym__campaign__summary__modify"> |
| 168 | - <a href="<?php echo acym_completeLink( | |
| 169 | - $campaignController.'&task=edit&step=segment&edition=1&campaignId='.intval($data['campaignInformation']->id) | |
| 170 | - ); ?>"><i class="acymicon-pencil"></i><span> <?php echo acym_translation('ACYM_EDIT'); ?></span></a> | |
| 186 | + <a href="<?php echo esc_url( | |
| 187 | + acym_completeLink( | |
| 188 | + $campaignController.'&task=edit&step=segment&edition=1&campaignId='.intval($data['campaignInformation']->id) | |
| 189 | + ) | |
| 190 | + ); ?>"><i class="acymicon-pencil"></i><span> <?php echo esc_html(acym_translation('ACYM_EDIT')); ?></span></a> | |
| 171 | 191 | </div> |
| 172 | 192 | <div class="cell grid-x acym__campaign__summary__segment"> |
| 173 | - <span class="cell medium-6"><b><?php echo $data['segment']['name']; ?></b></span> | |
| 174 | - <span class="cell medium-6"><b><?php echo $data['segment']['count'].'</b> '.strtolower(acym_translation('ACYM_SUBSCRIBERS')); ?></span> | |
| 193 | + <span class="cell medium-6"><b><?php echo esc_html($data['segment']['name']); ?></b></span> | |
| 194 | + <span class="cell medium-6"><b> | |
| 195 | + <?php echo esc_html($data['segment']['count']).'</b> '.esc_html(strtolower(acym_translation('ACYM_SUBSCRIBERS'))); ?> | |
| 196 | + </span> | |
| 175 | 197 | </div> |
| 176 | 198 | </div> |
| 177 | 199 | <?php } ?> |
| 178 | 200 | </div> |
| @@ -179,36 +201,41 @@ | ||
| 179 | 201 | <?php if (!empty($data['campaignInformation']->sending_params['abtest'])) { |
| 180 | 202 | $numberOfUsersToSend = round($data['campaignInformation']->sending_params['abtest']['repartition'] * $data['nbSubscribersAbTest'] / 100); |
| 181 | 203 | ?> |
| 182 | 204 | <div class="cell grid-x acym__campaign__summary__section"> |
| 183 | - <h5 class="cell shrink margin-right-2 acym__title acym__title__secondary"> | |
| 184 | - <b><?php | |
| 185 | - echo acym_translation('ACYM_AB_TEST'); ?></b> | |
| 205 | + <h5 class="cell shrink margin-next-1 acym__title acym__title__secondary"> | |
| 206 | + <b><?php echo esc_html(acym_translation('ACYM_AB_TEST')); ?></b> | |
| 186 | 207 | </h5> |
| 187 | 208 | <div class="cell auto acym__campaign__summary__modify"> |
| 188 | - <a href="<?php echo acym_completeLink( | |
| 189 | - $campaignController.'&task=edit&step=sendSettings&edition=1&campaignId='.intval($data['campaignInformation']->id) | |
| 190 | - ); ?>"><i class="acymicon-pencil"></i><span> <?php echo acym_translation('ACYM_EDIT'); ?></span></a> | |
| 209 | + <a href="<?php echo esc_url( | |
| 210 | + acym_completeLink( | |
| 211 | + $campaignController.'&task=edit&step=sendSettings&edition=1&campaignId='.intval($data['campaignInformation']->id) | |
| 212 | + ) | |
| 213 | + ); ?>"><i class="acymicon-pencil"></i><span> <?php echo esc_html(acym_translation('ACYM_EDIT')); ?></span></a> | |
| 191 | 214 | </div> |
| 192 | 215 | <div class="cell acym__listing"> |
| 193 | 216 | <div class="cell acym__listing__row"> |
| 194 | - <?php echo acym_translationSprintf( | |
| 195 | - 'ACYM_VERSION_WILL_BE_SENT_TO_X_SUBSCRIBERS', | |
| 196 | - acym_translationSprintf('ACYM_VERSION_NAME', 'A'), | |
| 197 | - round($numberOfUsersToSend / 2) | |
| 217 | + <?php echo esc_html( | |
| 218 | + acym_translationSprintf( | |
| 219 | + 'ACYM_VERSION_WILL_BE_SENT_TO_X_SUBSCRIBERS', | |
| 220 | + acym_translationSprintf('ACYM_VERSION_NAME', 'A'), | |
| 221 | + round($numberOfUsersToSend / 2) | |
| 222 | + ) | |
| 198 | 223 | ); ?> |
| 199 | 224 | </div> |
| 200 | 225 | <div class="cell acym__listing__row"> |
| 201 | - <?php echo acym_translationSprintf( | |
| 202 | - 'ACYM_VERSION_WILL_BE_SENT_TO_X_SUBSCRIBERS', | |
| 203 | - acym_translationSprintf('ACYM_VERSION_NAME', 'B'), | |
| 204 | - $numberOfUsersToSend - round($numberOfUsersToSend / 2) | |
| 226 | + <?php echo esc_html( | |
| 227 | + acym_translationSprintf( | |
| 228 | + 'ACYM_VERSION_WILL_BE_SENT_TO_X_SUBSCRIBERS', | |
| 229 | + acym_translationSprintf('ACYM_VERSION_NAME', 'B'), | |
| 230 | + $numberOfUsersToSend - round($numberOfUsersToSend / 2) | |
| 231 | + ) | |
| 205 | 232 | ); ?> |
| 206 | 233 | </div> |
| 207 | 234 | </div> |
| 208 | 235 | <?php if (!empty($data['segment'])) { ?> |
| 209 | 236 | <div class="cell grid-x acym__campaign__summary__section margin-top-1"> |
| 210 | - <h5 class="cell shrink margin-right-2 acym__title acym__title__secondary"><?php | |
| 237 | + <h5 class="cell shrink margin-next-1 acym__title acym__title__secondary"><?php | |
| 211 | 238 | if (!empty($data['campaignInformation']->sending_params['segment']['invert'])) { |
| 212 | 239 | $segmentInformation = $data['campaignInformation']->sending_params['segment']['invert'] === 'exclude' |
| 213 | 240 | ? ' ('.acym_translation('ACYM_EXCLUDE').')' |
| 214 | 241 | : ' ('.acym_translation('ACYM_INCLUDE').')'; |
| @@ -214,18 +241,22 @@ | ||
| 214 | 241 | : ' ('.acym_translation('ACYM_INCLUDE').')'; |
| 215 | 242 | } else { |
| 216 | 243 | $segmentInformation = ' ('.acym_translation('ACYM_INCLUDE').')'; |
| 217 | 244 | } |
| 218 | - echo acym_translation('ACYM_SEGMENT').$segmentInformation; | |
| 245 | + echo esc_html(acym_translation('ACYM_SEGMENT').$segmentInformation); | |
| 219 | 246 | ?></h5> |
| 220 | 247 | <div class="cell auto acym__campaign__summary__modify"> |
| 221 | - <a href="<?php echo acym_completeLink( | |
| 222 | - $campaignController.'&task=edit&step=segment&edition=1&campaignId='.intval($data['campaignInformation']->id) | |
| 223 | - ); ?>"><i class="acymicon-pencil"></i><span> <?php echo acym_translation('ACYM_EDIT'); ?></span></a> | |
| 248 | + <a href="<?php echo esc_url( | |
| 249 | + acym_completeLink( | |
| 250 | + $campaignController.'&task=edit&step=segment&edition=1&campaignId='.intval($data['campaignInformation']->id) | |
| 251 | + ) | |
| 252 | + ); ?>"><i class="acymicon-pencil"></i><span> <?php echo esc_html(acym_translation('ACYM_EDIT')); ?></span></a> | |
| 224 | 253 | </div> |
| 225 | 254 | <div class="cell grid-x acym__campaign__summary__segment"> |
| 226 | - <span class="cell medium-6"><b><?php echo $data['segment']['name']; ?></b></span> | |
| 227 | - <span class="cell medium-6"><b><?php echo $data['segment']['count'].'</b> '.strtolower(acym_translation('ACYM_SUBSCRIBERS')); ?></span> | |
| 255 | + <span class="cell medium-6"><b><?php echo esc_html($data['segment']['name']); ?></b></span> | |
| 256 | + <span class="cell medium-6"><b><?php echo esc_html($data['segment']['count']).'</b> '.esc_html( | |
| 257 | + strtolower(acym_translation('ACYM_SUBSCRIBERS')) | |
| 258 | + ); ?></span> | |
| 228 | 259 | </div> |
| 229 | 260 | </div> |
| 230 | 261 | <?php } ?> |
| 231 | 262 | </div> |
| @@ -230,56 +261,69 @@ | ||
| 230 | 261 | <?php } ?> |
| 231 | 262 | </div> |
| 232 | 263 | <?php } ?> |
| 233 | 264 | <div class="cell grid-x acym__campaign__summary__section"> |
| 234 | - <h5 class="cell shrink margin-right-2 acym__title acym__title__secondary"> | |
| 235 | - <b><?php echo acym_translation('ACYM_SEND_SETTINGS'); ?></b> | |
| 265 | + <h5 class="cell shrink margin-next-1 acym__title acym__title__secondary"> | |
| 266 | + <b><?php echo esc_html(acym_translation('ACYM_SEND_SETTINGS')); ?></b> | |
| 236 | 267 | </h5> |
| 237 | 268 | <div class="cell auto acym__campaign__summary__modify"> |
| 238 | - <a href="<?php echo acym_completeLink( | |
| 239 | - $campaignController.'&task=edit&step=sendSettings&edition=1&campaignId='.intval($data['campaignInformation']->id) | |
| 240 | - ); ?>"><i | |
| 241 | - class="acymicon-pencil"></i><span> <?php echo acym_translation('ACYM_EDIT'); ?></span></a> | |
| 269 | + <a href="<?php echo esc_url( | |
| 270 | + acym_completeLink( | |
| 271 | + $campaignController.'&task=edit&step=sendSettings&edition=1&campaignId='.intval($data['campaignInformation']->id) | |
| 272 | + ) | |
| 273 | + ); ?>"><i class="acymicon-pencil"></i><span> <?php echo esc_html(acym_translation('ACYM_EDIT')); ?></span></a> | |
| 242 | 274 | </div> |
| 243 | 275 | <div class="cell grid-x grid-margin-x"> |
| 244 | - <p class="cell large-2 medium-3"><b><?php echo acym_translation('ACYM_SENDING_TYPE'); ?>:</b></p> | |
| 276 | + <p class="cell large-2 medium-3"><b><?php echo esc_html(acym_translation('ACYM_SENDING_TYPE')); ?>:</b></p> | |
| 245 | 277 | <p class="cell auto"> |
| 246 | 278 | <?php |
| 247 | - $sendingTimeText = ''; | |
| 248 | - | |
| 249 | 279 | if ($data['automatic']['isAuto']) { |
| 250 | - $sendingTimeText = $data['automatic']['text']; | |
| 251 | - } elseif (!$isSent && $data['campaignClass']::SENDING_TYPE_SCHEDULED !== $data['campaignInformation']->sending_type) { | |
| 252 | - $sendingTimeText .= acym_translation('ACYM_THIS_CAMPAIGN_WILL_BE_SENT').' '.acym_strtolower(acym_translation('ACYM_NOW')); | |
| 253 | - } else { | |
| 254 | - if ($isSent) { | |
| 255 | - $text = 'ACYM_THIS_CAMPAIGN_HAS_BEEN_SENT_ON_AT'; | |
| 280 | + echo esc_html($data['automatic']['text']); | |
| 281 | + } elseif ($data['campaignClass']::SENDING_TYPE_SCHEDULED === $data['campaignInformation']->sending_type) { | |
| 282 | + if (empty($data['campaignInformation']->sending_date)) { | |
| 283 | + echo esc_html(acym_translation('ACYM_PLEASE_SET_SEND_DATE')); | |
| 256 | 284 | } else { |
| 257 | - $text = 'ACYM_THIS_CAMPAIGN_WILL_BE_SENT_ON_AT'; | |
| 285 | + if ($isSent) { | |
| 286 | + $text = 'ACYM_THIS_CAMPAIGN_HAS_BEEN_SENT_ON_AT'; | |
| 287 | + } else { | |
| 288 | + $text = 'ACYM_THIS_CAMPAIGN_WILL_BE_SENT_ON_AT'; | |
| 289 | + } | |
| 290 | + | |
| 291 | + echo esc_html( | |
| 292 | + acym_translationSprintf( | |
| 293 | + $text, | |
| 294 | + acym_date($data['campaignInformation']->sending_date, 'F j, Y'), | |
| 295 | + acym_date($data['campaignInformation']->sending_date, 'H:i') | |
| 296 | + ) | |
| 297 | + ); | |
| 258 | 298 | } |
| 259 | - | |
| 260 | - $sendingTimeText .= acym_translationSprintf( | |
| 261 | - $text, | |
| 262 | - acym_date($data['campaignInformation']->sending_date, 'F j, Y'), | |
| 263 | - acym_date($data['campaignInformation']->sending_date, 'H:i') | |
| 299 | + } elseif (!$isSent) { | |
| 300 | + echo esc_html(acym_translation('ACYM_THIS_CAMPAIGN_WILL_BE_SENT').' '.acym_strtolower(acym_translation('ACYM_NOW'))); | |
| 301 | + } else { | |
| 302 | + echo esc_html( | |
| 303 | + acym_translationSprintf( | |
| 304 | + 'ACYM_THIS_CAMPAIGN_HAS_BEEN_SENT_ON_AT', | |
| 305 | + acym_date($data['campaignInformation']->sending_date, 'F j, Y'), | |
| 306 | + acym_date($data['campaignInformation']->sending_date, 'H:i') | |
| 307 | + ) | |
| 264 | 308 | ); |
| 265 | 309 | } |
| 266 | - | |
| 267 | - echo $sendingTimeText; | |
| 268 | 310 | ?> |
| 269 | 311 | </p> |
| 270 | 312 | </div> |
| 271 | - <?php if ($data['automatic']['isAuto'] && !empty($data['automatic']['startDate'])) { ?> | |
| 313 | + <?php if ($data['automatic']['isAuto'] && !empty($data['automatic']['nextDate'])) { ?> | |
| 272 | 314 | <div class="cell grid-x grid-margin-x"> |
| 273 | - <p class="cell large-2 medium-3"><b><?php echo acym_translation('ACYM_START_DATE'); ?>:</b></p> | |
| 274 | - <p class="cell auto"><?php echo acym_date($data['automatic']['startDate'], acym_getDateTimeFormat()); ?></p> | |
| 315 | + <p class="cell large-2 medium-3"><b><?php echo esc_html(acym_translation('ACYM_NEXT_GENERATION_DATE')); ?>:</b></p> | |
| 316 | + <p class="cell auto"><?php echo esc_html(acym_date($data['automatic']['nextDate'], acym_getDateTimeFormat())); ?></p> | |
| 275 | 317 | </div> |
| 276 | 318 | <?php } ?> |
| 277 | 319 | <div class="cell grid-x grid-margin-x"> |
| 278 | - <p class="cell large-2 medium-3"><b><?php echo acym_translation('ACYM_TRACKING'); ?>:</b></p> | |
| 279 | - <p class="cell auto"><?php echo acym_translation( | |
| 280 | - $data['campaignInformation']->tracking ? 'ACYM_THIS_CAMPAIGN_BEING_TRACKED' : 'ACYM_THIS_CAMPAIGN_NOT_BEING_TRACKED' | |
| 281 | - ); ?></p> | |
| 320 | + <p class="cell large-2 medium-3"><b><?php echo esc_html(acym_translation('ACYM_TRACKING')); ?>:</b></p> | |
| 321 | + <p class="cell auto"> | |
| 322 | + <?php echo esc_html( | |
| 323 | + acym_translation($data['campaignInformation']->tracking ? 'ACYM_THIS_CAMPAIGN_BEING_TRACKED' : 'ACYM_THIS_CAMPAIGN_NOT_BEING_TRACKED') | |
| 324 | + ); ?> | |
| 325 | + </p> | |
| 282 | 326 | </div> |
| 283 | 327 | </div> |
| 284 | 328 | <div class="cell grid-x acym__campaign__summary__bottom-controls acym__campaign__summary__section"> |
| 285 | 329 | <?php |
| @@ -286,10 +330,10 @@ | ||
| 286 | 330 | if (!$isAbTest && !empty($data['campaignInformation']->sent) && !empty($data['campaignInformation']->active)) { |
| 287 | 331 | ?> |
| 288 | 332 | <div id="acym__campaign__summary__resendoptions" class="cell padding-1 margin-bottom-1 acym__zone__warning"> |
| 289 | 333 | <?php |
| 290 | - echo acym_translationSprintf('ACYM_ALREADY_SENT'); | |
| 291 | - echo acym_radio( | |
| 334 | + echo esc_html(acym_translationSprintf('ACYM_ALREADY_SENT')); | |
| 335 | + acym_radio( | |
| 292 | 336 | [ |
| 293 | 337 | 'new' => acym_translation('ACYM_YES'), |
| 294 | 338 | 'all' => acym_translation('ACYM_ALREADY_SENT_ALL'), |
| 295 | 339 | ], |
| @@ -301,12 +345,12 @@ | ||
| 301 | 345 | ); |
| 302 | 346 | ?> |
| 303 | 347 | <div class="cell"> |
| 304 | 348 | <span id="resend_receivers_new" style="display: none;"> |
| 305 | - <?php echo acym_translationSprintf('ACYM_X_RECIPIENTS', $data['receiversNew']); ?> | |
| 349 | + <?php echo esc_html(acym_translationSprintf('ACYM_X_RECIPIENTS', $data['receiversNew'])); ?> | |
| 306 | 350 | </span> |
| 307 | 351 | <span id="resend_receivers_all" style="display: none;"> |
| 308 | - <?php echo acym_translationSprintf('ACYM_X_RECIPIENTS', $data['nbSubscribers']); ?> | |
| 352 | + <?php echo esc_html(acym_translationSprintf('ACYM_X_RECIPIENTS', $data['nbSubscribers'])); ?> | |
| 309 | 353 | </span> |
| 310 | 354 | </div> |
| 311 | 355 | </div> |
| 312 | 356 | <?php |
| @@ -313,9 +357,9 @@ | ||
| 313 | 357 | } |
| 314 | 358 | ?> |
| 315 | 359 | <div class="cell medium-shrink medium-margin-bottom-0 margin-bottom-1 text-left"> |
| 316 | 360 | <?php |
| 317 | - echo acym_backToListing( | |
| 361 | + acym_backToListing( | |
| 318 | 362 | in_array($data['campaignInformation']->sending_type, ['birthday', 'woocommerce_cart']) |
| 319 | 363 | ? $campaignController.'&task=specificListing&type='.$data['campaignInformation']->sending_type : $campaignController |
| 320 | 364 | ); |
| 321 | 365 | ?> |
| @@ -323,13 +367,14 @@ | ||
| 323 | 367 | <div class="cell medium-auto grid-x text-right"> |
| 324 | 368 | <div class="cell auto hide-for-small-only"></div> |
| 325 | 369 | |
| 326 | 370 | <?php |
| 371 | + // The campaign is in the queue and has been paused | |
| 327 | 372 | if (empty($data['campaignInformation']->active) && !$data['campaignInformation']->isAuto && $data['campaignInformation']->sent) { |
| 328 | 373 | ?> |
| 329 | 374 | |
| 330 | 375 | <button type="button" class="cell button primary acy_button_submit medium-shrink" data-task="unpause_campaign"> |
| 331 | - <?php echo acym_translation('ACYM_UNPAUSE_CAMPAIGN'); ?> | |
| 376 | + <?php echo esc_html(acym_translation('ACYM_UNPAUSE_CAMPAIGN')); ?> | |
| 332 | 377 | </button> |
| 333 | 378 | |
| 334 | 379 | <?php |
| 335 | 380 | } elseif ($data['campaignInformation']->active && $data['campaignInformation']->isAuto) { |
| @@ -335,25 +380,26 @@ | ||
| 335 | 380 | } elseif ($data['campaignInformation']->active && $data['campaignInformation']->isAuto) { |
| 336 | 381 | ?> |
| 337 | 382 | |
| 338 | 383 | <button type="button" class="cell button primary acy_button_submit medium-shrink" data-task="toggleActivateColumnCampaign"> |
| 339 | - <?php echo acym_translation('ACYM_DEACTIVATE_CAMPAIGN'); ?> | |
| 384 | + <?php echo esc_html(acym_translation('ACYM_DEACTIVATE_CAMPAIGN')); ?> | |
| 340 | 385 | </button> |
| 341 | 386 | <?php |
| 342 | 387 | } else { |
| 388 | + // The campaign isn't already sent | |
| 343 | 389 | if (empty($data['campaignInformation']->sent) && (empty($data['campaignInformation']->active) && $data['campaignInformation']->draft)) { |
| 344 | 390 | ?> |
| 345 | 391 | |
| 346 | 392 | <button type="submit" |
| 347 | - class="cell button button-secondary margin-bottom-1 margin-right-1 acy_button_submit medium-shrink" | |
| 348 | - data-task="saveAsDraftCampaign"> | |
| 349 | - <?php echo acym_translation('ACYM_SAVE_AS_DRAFT'); ?> | |
| 393 | + class="cell button button-secondary margin-bottom-1 margin-next-1 acy_button_submit medium-shrink" | |
| 394 | + data-task="saveAsDraftCampaign"> | |
| 395 | + <?php echo esc_html(acym_translation('ACYM_SAVE_AS_DRAFT')); ?> | |
| 350 | 396 | </button> |
| 351 | 397 | |
| 352 | 398 | <?php |
| 353 | 399 | } |
| 354 | 400 | |
| 355 | - if ($data['campaignClass']::SENDING_TYPE_NOW == $data['campaignInformation']->sending_type) { | |
| 401 | + if (CampaignClass::SENDING_TYPE_NOW == $data['campaignInformation']->sending_type) { | |
| 356 | 402 | $task = 'addQueue'; |
| 357 | 403 | $buttonText = 'ACYM_SEND_CAMPAIGN'; |
| 358 | 404 | if (!acym_level(ACYM_ESSENTIAL) || $this->config->get('cron_last', 0) < (time() - 43200)) $buttonText = 'ACYM_ADD_TO_QUEUE'; |
| 359 | 405 | } elseif (!$data['campaignInformation']->isAuto) { |
| @@ -382,27 +428,32 @@ | ||
| 382 | 428 | } |
| 383 | 429 | |
| 384 | 430 | $buttonClass = empty($data['notAllowedSendingError']) ? '' : ' disabled'; |
| 385 | 431 | |
| 432 | + if (!empty($data['notAllowedSendingError'])) { | |
| 433 | + ob_start(); | |
| 434 | + } | |
| 435 | + | |
| 386 | 436 | if ($this->config->get('mailer_method') === 'acymailer' && $this->config->get('acymailer_popup', '0') === '0') { |
| 387 | 437 | ob_start(); |
| 388 | 438 | require acym_getView('mails', 'acymailer_popup', true); |
| 389 | 439 | $popupData = ob_get_clean(); |
| 390 | - $button = acym_modal( | |
| 440 | + acym_modal( | |
| 391 | 441 | acym_translation($buttonText), |
| 392 | 442 | $popupData, |
| 393 | 443 | 'acym__acymailer__popup', |
| 394 | - '', | |
| 444 | + [], | |
| 395 | 445 | ['class' => 'cell button medium-shrink'.$buttonClass] |
| 396 | 446 | ); |
| 397 | 447 | } else { |
| 398 | - $button = '<button type="button" class="cell button acy_button_submit medium-shrink'.$buttonClass.'" data-task="'.acym_escape($task).'">'; | |
| 399 | - $button .= acym_translation($buttonText); | |
| 400 | - $button .= '</button>'; | |
| 448 | + echo '<button type="button" class="cell button acy_button_submit medium-shrink'.esc_attr($buttonClass).'" data-task="'.esc_attr($task).'">'; | |
| 449 | + echo esc_html(acym_translation($buttonText)); | |
| 450 | + echo '</button>'; | |
| 401 | 451 | } |
| 402 | 452 | |
| 403 | 453 | if (!empty($data['notAllowedSendingError'])) { |
| 404 | - echo acym_tooltip( | |
| 454 | + $button = ob_get_clean(); | |
| 455 | + acym_tooltip( | |
| 405 | 456 | [ |
| 406 | 457 | 'hoveredText' => $button, |
| 407 | 458 | 'textShownInTooltip' => $data['notAllowedSendingError'], |
| 408 | 459 | 'classContainer' => 'cell medium-shrink', |
| @@ -407,10 +458,8 @@ | ||
| 407 | 458 | 'textShownInTooltip' => $data['notAllowedSendingError'], |
| 408 | 459 | 'classContainer' => 'cell medium-shrink', |
| 409 | 460 | ] |
| 410 | 461 | ); |
| 411 | - } else { | |
| 412 | - echo $button; | |
| 413 | 462 | } |
| 414 | 463 | } |
| 415 | 464 | ?> |
| 416 | 465 | </div> |
| @@ -419,7 +468,7 @@ | ||
| 419 | 468 | </div> |
| 420 | 469 | <div class="cell medium-auto"></div> |
| 421 | 470 | </div> |
| 422 | 471 | <input type="hidden" value="<?php echo intval($data['campaignInformation']->id); ?>" name="campaignId" /> |
| 423 | - <input type="hidden" value="<?php echo acym_escape($data['campaignInformation']->sending_date); ?>" name="sending_date" /> | |
| 472 | + <input type="hidden" value="<?php echo esc_attr((string)$data['campaignInformation']->sending_date); ?>" name="sending_date" /> | |
| 424 | 473 | <?php acym_formOptions(true, 'edit', 'summary'); ?> |
| 425 | 474 | </form> |