internal package Foswiki::Plugins::PubLinkFixupPlugin

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

internal package Foswiki::Plugins::PubLinkFixupPlugin

This plugin performs pub link fixup of the generated HTML page. If Foswiki is configured with a non-utf-8 {Store}{Encoding}, then links to /pub files will be generated with the incorrect encoding.

Even on non-utf-8 sites, Foswiki operates fully with UNICODE and utf-8 encoding in the core and on the web interface. /pub attachment links will be generated assuming the filesnames are utf-8 encoded. This plugin provides a completePageHandler that finds utf-8 encoded links to /pub attachments and re-encodes them to the {Store}{Encoding}.

This is not a complete fix to the issue. It is still strongly recommended that sites convert their Store to utf-8 to avoid these types of encoding issues.

initPlugin($topic, $web, $user) -> $boolean

  • $topic - the name of the topic in the current CGI query
  • $web - the name of the web in the current CGI query
  • $user - the login name of the user
  • $installWeb - the name of the web the plugin topic is in (usually the same as $Foswiki::cfg{SystemWebName})

completePageHandler($html, $httpHeaders)

This handler is called on the ingredients of every page that is output by the standard CGI scripts. It is designed primarily for use by cache and security plugins.
  • $html - the body of the page (normally <html>..$lt;/html>)
  • $httpHeaders - the HTTP headers. Note that the headers do not contain a Content-length. That will be computed and added immediately before the page is actually written. This is a string, which must end in \n\n.

Since: Foswiki::Plugins::VERSION 2.0

This routine is called for each pub link found in the complete page. It takes the href/src location from the link, re-encodes it into the {Store}{Encoding} and then replaces it back into the whole link.

Topic revision: r1 - 21 Nov 2014, ProjectContributor
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding WikiCMC? Send feedback