Friday, 06 April 2018
  0 Replies
  2K Visits
0
Votes
Undo
I've made a code personalizzation, with PDFJS and Google viewer, that adds the site url if a relative url is specified.
So articles that uses pdf_embed plugin are more portable.
For example if you must change the site domain, it is not necessary to change all pdf_embed calls into the articles.

file: pdf_embed.php


public function plg_pdfembed_replacer($ploc, $w, $h, $viewer)
...
case "google":
if (strpos($ploc, 'http') !== 0) $ploc = JURI::root(true) . $ploc;
$ploc = urlencode($ploc);
...

case "pdfjs":
if (strpos($ploc, 'http') !== 0) $ploc = JURI::root(true) . $ploc;
$ploc = urlencode($ploc);
...