Skip to content

Commit

Permalink
Ticket #4695 - Embeds improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLV committed Apr 23, 2024
1 parent b61b0c3 commit f65c025
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
9 changes: 9 additions & 0 deletions inc/classes/BxDolEmbed.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ public function getLinkHTML ($sLink, $sTitle = '', $sMaxWidth = '')
// override this function in particular embed provider class
}

/**
* Execute an initialization JS code
*/
public function addProcessLinkMethod ()
{
// override this function in particular embed provider class
return '';
}

/**
* Add css/js files which are needed for embed display and functionality.
*/
Expand Down
21 changes: 17 additions & 4 deletions inc/utils.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2172,11 +2172,13 @@ function bx_linkify_embeded($sText)
// Reverse the matches to mimic JavaScript's reverse order processing
$aMatches = array_reverse($aMatches);

$sUrlRoot = BX_DOL_URL_ROOT;
$sUrlRootApi = bx_api_get_base_url();

$sLink = '';
foreach ($aMatches as $match) {
// Assuming APP_URL and UNA_URL are defined constants
if (!strstr($match[0], 'https://ci.una.io/') && !strstr($match[0], 'https://ci.una.io/')) {
$sLink = $match[0]; // Returns the first URL that doesn't include the restricted domains
foreach($aMatches as $aMatch) {
if(!strstr($aMatch[0], $sUrlRoot) && ($sUrlRootApi === false || !strstr($aMatch[0], $sUrlRootApi))) {
$sLink = $aMatch[0]; // Returns the first URL that doesn't include the restricted domains
}
}

Expand Down Expand Up @@ -2552,6 +2554,17 @@ function bx_api_check_access()
// check_logged();
}

function bx_api_get_base_url()
{
if(($sResult = getParam('sys_api_url_root_email')) != '')
return $sResult;

if(($sResult = getParam('sys_api_url_root_push')) != '')
return $sResult;

return false;
}

function bx_api_get_relative_url($sUrl, $sPrefix = BX_DOL_URL_ROOT)
{
return '/' . bx_ltrim_str($sUrl, $sPrefix);
Expand Down

0 comments on commit f65c025

Please sign in to comment.