1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 05:07:27 +02:00

{SITELINKS_ALT} fix and test.

This commit is contained in:
Cameron
2021-08-07 12:26:23 -07:00
parent ecf6ab7acc
commit 64e705ced0
2 changed files with 8 additions and 7 deletions

View File

@@ -1260,11 +1260,12 @@ class e_parse_shortcode
{ {
// Code is not registered, let's look for .sc or .php file // Code is not registered, let's look for .sc or .php file
// .php file takes precedence over .sc file // .php file takes precedence over .sc file
if (is_readable(e_CORE.'shortcodes/single/'.strtolower($code).'.php')) $codeLower = strtolower($code);
if (is_readable(e_CORE.'shortcodes/single/'.$codeLower.'.php'))
{ {
$_function = strtolower($code).'_shortcode'; $_function = $codeLower.'_shortcode';
$_class = ($code === 'sitelinks_alt') ? sitelinks_alt : null; // all others are plain functions. $_class = ($codeLower === 'sitelinks_alt') ? 'sitelinks_alt' : null; // all others are plain functions.
$_path = e_CORE.'shortcodes/single/'.strtolower($code).'.php'; $_path = e_CORE.'shortcodes/single/'.$codeLower.'.php';
include_once($_path); include_once($_path);
@@ -1289,7 +1290,7 @@ class e_parse_shortcode
} }
else else
{ {
$scFile = e_CORE.'shortcodes/single/'.strtolower($code).'.sc'; $scFile = e_CORE.'shortcodes/single/'.$codeLower.'.sc';
$_path = $scFile; $_path = $scFile;
} }
} }

View File

@@ -1688,7 +1688,8 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
'url' => 'news/view/item|news_id=1&news_sef=sef-string&category_id=1&category_sef=category-sef&options[full]=1', 'url' => 'news/view/item|news_id=1&news_sef=sef-string&category_id=1&category_sef=category-sef&options[full]=1',
'user_extended' => 'name.text.1', 'user_extended' => 'name.text.1',
'lan' => 'LAN_EDIT', 'lan' => 'LAN_EDIT',
'search' => 'all' 'search' => 'all',
'sitelinks_alt' => '/e107_themes/bootstrap3/images/logo.webp+noclick',
); );
foreach($list as $sc) foreach($list as $sc)
@@ -1701,7 +1702,6 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
continue; continue;
} }
$shortcode = '{'; $shortcode = '{';
$shortcode .= strtoupper($name); $shortcode .= strtoupper($name);
$shortcode .= isset($parms[$name]) ? '='.$parms[$name] : ''; $shortcode .= isset($parms[$name]) ? '='.$parms[$name] : '';