Skip to content

Commit

Permalink
Merge branch 'hotfix' into hotfix-39372
Browse files Browse the repository at this point in the history
  • Loading branch information
jimyhuang committed Apr 18, 2024
2 parents 09dcf1a + eb3dce4 commit f75c438
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CRM/Contribute/Page/ContributionPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ function run() {
if ($shorten) {
$this->assign('shorten', $shorten);
}
$shorten_pcp = CRM_Core_OptionGroup::getValue('shorten_url', 'civicrm_pcp.'.$id, 'name', 'String', 'value');
if ($shorten_pcp) {
$this->assign('shorten_pcp', $shorten_pcp);
}

// statistics
CRM_Utils_System::setTitle(ts('Dashlets')." - ".$page['title']);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/Page/AJAX/SaveShortenURL.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ static function run() {
$pageId = CRM_Utils_Request::retrieve('page_id', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, 'REQUEST');
$pageType = CRM_Utils_Request::retrieve('page_type', 'String', CRM_Core_DAO::$_nullObject, TRUE, NULL, 'REQUEST');
$shorten = CRM_Utils_Request::retrieve('shorten', 'String', CRM_Core_DAO::$_nullObject, TRUE, NULL, 'REQUEST');
if (in_array($pageType, array('civicrm_contribution_page', 'civicrm_event.info', 'civicrm_event.register', 'civicrm_uf_group'))) {
if (in_array($pageType, array('civicrm_contribution_page', 'civicrm_pcp', 'civicrm_event.info', 'civicrm_event.register', 'civicrm_uf_group'))) {
$exists = CRM_Core_OptionGroup::getValue('shorten_url', $pageType.'.'.$pageId, 'name', 'String', 'id');
$groupParams = array(
'name' => 'shorten_url',
Expand Down
7 changes: 4 additions & 3 deletions CRM/Utils/String.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,10 @@ static function htmlToText($html) {
return $converter->get_text();
}

static function htmlPurifier($html, $allowed_tags = array()) {
static function htmlPurifier($html, $allowedTags = array()) {
require_once 'packages/IDS/vendors/htmlpurifier/HTMLPurifier.auto.php';
static $_purifier;
$hash = md5(CRM_Utils_Array::implode('', $allowed_tags));
$hash = md5(CRM_Utils_Array::implode(',', $allowedTags));

if (!$_purifier[$hash]) {
$config = CRM_Core_Config::singleton();
Expand All @@ -467,7 +467,8 @@ static function htmlPurifier($html, $allowed_tags = array()) {
$purifierConfig->set('URI.SafeIframeRegexp', '%^(https?:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/)%'); //allow YouTube and Vimeo

// allowed tags put at the end
$purifierConfig->set('HTML.Allowed', $allowed_tags);
$allowed = implode(', ', $allowedTags);
$purifierConfig->set('HTML.Allowed', $allowed);

// def needs after configure
// fullscreen
Expand Down
4 changes: 2 additions & 2 deletions templates/CRM/Contribute/Page/ContributionPageEdit.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@
<a href="{crmURL a=true p='civicrm/contribute/campaign' q="action=add&reset=1&cid=0&pageId=`$id`"}" target="_blank"><i class="zmdi zmdi-plus-square"></i> {ts}New personal campaign page{/ts}</a>
<div class="description">{ts}You can provide this URL to supporters for creating new Personal Campaign Pages.{/ts}</div>
</div>
<textarea name="url_to_copy_new_personal_campaign" class="url_to_copy" cols="45" rows="1" onclick="this.select(); document.execCommand('copy');" data-url-original="{$newPersonalCampaignURL}">{if $shorten}{$shorten}{else}{$newPersonalCampaignURL}{/if}</textarea>
<textarea name="url_to_copy_new_personal_campaign" class="url_to_copy" cols="45" rows="1" onclick="this.select(); document.execCommand('copy');" data-url-original="{$newPersonalCampaignURL}">{if $shorten_pcp}{$shorten_pcp}{else}{$newPersonalCampaignURL}{/if}</textarea>
<span>
<a href="#" class="button url-copy" onclick="document.querySelector('textarea[name=url_to_copy_new_personal_campaign]').select(); document.execCommand('copy'); return false;"><i class="zmdi zmdi-link"></i> {ts}Copy{/ts}</a>
</span>
<span>
<a href="#" class="button url-shorten" data-url-shorten="url_to_copy_new_personal_campaign"><i class="zmdi zmdi-share"></i> {ts}Shorten URL{/ts}</a>
<a href="#" class="button url-shorten" data-url-shorten="url_to_copy_new_personal_campaign" data-page-id="{$id}" data-page-type="civicrm_pcp"><i class="zmdi zmdi-share"></i> {ts}Shorten URL{/ts}</a>
</span>
</div>
</td>
Expand Down

0 comments on commit f75c438

Please sign in to comment.