hoochicken / plg_content_qlwiki

Joomla! extensions; Add tag {'qlwiki'} into article text. Via url parameter you can connect to a wiki; e. g.: {'qlwiki url=http://de.wikipedia.org/wiki/Joomla'}.
0 stars 0 forks source link

Wrong readmore link from getReadAll() when no query string #6

Closed ReLater closed 1 year ago

ReLater commented 1 year ago

Plugin settings

grafik

Tag in Article

{qlwiki url="https://de.wikipedia.org/wiki/Joomla"}

Result

The readmore href is empty instead of https://de.wikipedia.org/wiki/Joomla.

Reason

$url = substr($this->states['url'], 0, strpos($this->states['url'], '?'));

returns an empty string because strpos($this->states['url'], '?') returns false when there is no ? in url.

Temporary solution in method getReadAll()

// get basic url without parameters
if (($strpos = strpos($this->states['url'], '?')) === false)
{
    $strpos = strlen($this->states['url']);
}
$url = substr($this->states['url'], 0, $strpos);
hoochicken commented 1 year ago

Check for Release https://github.com/hoochicken/plg_content_qlwiki/releases/tag/v1.10.2 Changed some stuff, hope I dodn't add more bugs :-)