ExportProfileData
extends BackgroundTask
in package
This class contains code used to incrementally export a member's profile data to one or more downloadable files.
Table of Contents
Constants
- RECEIVE_NOTIFY_ALERT = 0x1
- RECEIVE_NOTIFY_EMAIL = 0x2
- Constants for notification types.
- XML_NAMESPACES = ['smf' => 'htt' . 'p:/' . '/ww' . 'w.simple' . 'machines.o' . 'rg/xml/profile', 'xsl' => 'htt' . 'p:/' . '/ww' . 'w.w3.o' . 'rg/1999/XSL/Transform', 'html' => 'htt' . 'p:/' . '/ww' . 'w.w3.o' . 'rg/1999/xhtml']
- An array of XML namespaces.
Properties
- $_details : array<string|int, mixed>
- $next_task : array<string|int, mixed>
- $real_modSettings : array<string|int, mixed>
- $stylesheet : string
- $time_limit : int
- $xslt_stylesheet : array<string|int, mixed>
Methods
- __construct() : mixed
- The constructor.
- add_dtd() : void
- Adds a custom DOCTYPE definition and an XSLT processing instruction to the main XML file's header. Only used for the XML_XSLT format.
- attach_bbc_validate() : void
- Adjusts the format of the HTML produced by the attach BBCode.
- bbc_codes() : void
- Adjusts certain BBCodes for the special case of exports.
- execute() : bool
- This is the main dispatcher for the class.
- getMinUserInfo() : array<string|int, mixed>
- Loads minimal info for the previously loaded user ids
- parser_cache() : void
- Adds data to the cache key to distinguish parsing for exports from normal parsing.
- post_parseAttachBBC() : void
- Adjusts the attachment download URL for the special case of exports.
- post_parsebbc() : void
- Reverses changes made by pre_parsebbc()
- pre_parsebbc_html() : void
- Adjusts some parse_bbc() parameters for the special case of HTML and XML_XSLT exports.
- pre_parsebbc_xml() : void
- Adjusts some parse_bbc() parameters for the special case of XML exports.
- buildStylesheet() : void
- Finalizes the XSLT stylesheet used to transform an XML-based profile export file into the desired output format.
- exportHtml() : void
- Compiles profile data to HTML.
- exportXml() : void
- The workhorse of this class. Compiles profile data to XML files.
- exportXmlXslt() : void
- Compiles profile data to XML with embedded XSLT.
- loadCssJs() : void
- Loads and prepares CSS and JavaScript for insertion into an XSLT stylesheet.
Constants
RECEIVE_NOTIFY_ALERT
public
mixed
RECEIVE_NOTIFY_ALERT
= 0x1
RECEIVE_NOTIFY_EMAIL
Constants for notification types.
public
mixed
RECEIVE_NOTIFY_EMAIL
= 0x2
XML_NAMESPACES
An array of XML namespaces.
public
mixed
XML_NAMESPACES
= ['smf' => 'htt' . 'p:/' . '/ww' . 'w.simple' . 'machines.o' . 'rg/xml/profile', 'xsl' => 'htt' . 'p:/' . '/ww' . 'w.w3.o' . 'rg/1999/XSL/Transform', 'html' => 'htt' . 'p:/' . '/ww' . 'w.w3.o' . 'rg/1999/xhtml']
Do NOT change any of these to HTTPS addresses! Not even the SMF one.
Why? Because XML namespace names must be both unique and invariant once defined. They look like URLs merely because that's a convenient way to ensure uniqueness, but they are not used as URLs. They are used as case-sensitive identifier strings. If the string changes in any way, XML processing software (including PHP's own XML functions) will interpret the two versions of the string as entirely different namespaces, which could cause it to mangle the XML horrifically during processing.
These strings have been broken up and concatenated to help prevent any automatic search and replace attempts from changing them.
Properties
$_details
protected
array<string|int, mixed>
$_details
Holds the details for the task
$next_task
private
array<string|int, mixed>
$next_task
= []
Info to create a follow-up background task, if necessary.
$real_modSettings
private
static array<string|int, mixed>
$real_modSettings
= []
Temporary backup of the Config::$modSettings array
$stylesheet
private
string
$stylesheet
The XSLT stylesheet as a single string.
$time_limit
private
int
$time_limit
= 30
Used to ensure we exit long running tasks cleanly.
$xslt_stylesheet
private
array<string|int, mixed>
$xslt_stylesheet
= [
// Header for the stylesheet. Default value assumes that the stylesheet
// will be a separate file. This will be changed at runtime if the
// output format is set to XML_XSLT.
'header' => '<?xml version="1.0" encoding="UTF-8"?' . '>' . "\n" . '<xsl:stylesheet version="1.0" xmlns:xsl="' . self::XML_NAMESPACES['xsl'] . '" xmlns:html="' . self::XML_NAMESPACES['html'] . '" xmlns:smf="' . self::XML_NAMESPACES['smf'] . '" exclude-result-prefixes="smf html">',
// Controls output formatting and handline of special characters.
// Do not change this.
'output_control' => <<<'END'
<xsl:output method="html" encoding="utf-8" indent="yes"/>
<xsl:strip-space elements="*"/>
END,
// XSLT variables. This is set at runtime.
'variables' => '',
// The top-level template. Creates the shell of the HTML document.
'html' => <<<'END'
<xsl:template match="/*">
<xsl:text disable-output-escaping="yes"><!DOCTYPE html></xsl:text>
<html>
<head>
<title>
<xsl:value-of select="@title"/>
</title>
<xsl:call-template name="css_js"/>
</head>
<body>
<div id="footerfix">
<div id="header">
<h1 class="forumtitle">
<a id="top">
<xsl:attribute name="href">
<xsl:value-of select="$scripturl"/>
</xsl:attribute>
<xsl:value-of select="@forum-name"/>
</a>
</h1>
</div>
<div id="wrapper">
<div id="upper_section">
<div id="inner_section">
<div id="inner_wrap">
<div class="user">
<time>
<xsl:attribute name="datetime">
<xsl:value-of select="@generated-date-UTC"/>
</xsl:attribute>
<xsl:value-of select="@generated-date-localized"/>
</time>
</div>
<hr class="clear"/>
</div>
</div>
</div>
<xsl:call-template name="content_section"/>
</div>
</div>
<div id="footer">
<div class="inner_wrap">
<ul>
<li class="floatright">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat($scripturl, '?action=help')"/>
</xsl:attribute>
<xsl:value-of select="$txt_help"/>
</a>
<xsl:text> | </xsl:text>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat($scripturl, '?action=help;sa=rules')"/>
</xsl:attribute>
<xsl:value-of select="$txt_terms_rules"/>
</a>
<xsl:text> | </xsl:text>
<a href="#top">
<xsl:value-of select="$txt_go_up"/>
<xsl:text> ▲</xsl:text>
</a>
</li>
<li class="copyright">
<xsl:value-of select="$forum_copyright" disable-output-escaping="yes"/>
</li>
</ul>
</div>
</div>
</body>
</html>
</xsl:template>
END,
// Template to show the content of the export file.
'content_section' => <<<'END'
<xsl:template name="content_section">
<div id="content_section">
<div id="main_content_section">
<div class="cat_bar">
<h3 class="catbg">
<xsl:value-of select="@title"/>
</h3>
</div>
<div class="information">
<h2 class="display_title">
<xsl:value-of select="@description"/>
</h2>
</div>
<xsl:if test="username">
<div class="cat_bar">
<h3 class="catbg">
<xsl:value-of select="$txt_summary_heading"/>
</h3>
</div>
<div id="profileview" class="roundframe flow_auto noup">
<xsl:call-template name="summary"/>
</div>
</xsl:if>
<xsl:call-template name="page_index"/>
<xsl:if test="member_post">
<div class="cat_bar">
<h3 class="catbg">
<xsl:value-of select="$txt_posts_heading"/>
</h3>
</div>
<div id="posts" class="roundframe flow_auto noup">
<xsl:apply-templates select="member_post" mode="posts"/>
</div>
</xsl:if>
<xsl:if test="personal_message">
<div class="cat_bar">
<h3 class="catbg">
<xsl:value-of select="$txt_personal_messages_heading"/>
</h3>
</div>
<div id="personal_messages" class="roundframe flow_auto noup">
<xsl:apply-templates select="personal_message" mode="pms"/>
</div>
</xsl:if>
<xsl:call-template name="page_index"/>
</div>
</div>
</xsl:template>
END,
// Template for user profile summary.
'summary' => <<<'END'
<xsl:template name="summary">
<div id="basicinfo">
<div class="username clear">
<h4>
<a>
<xsl:attribute name="href">
<xsl:value-of select="link"/>
</xsl:attribute>
<xsl:value-of select="name"/>
</a>
<xsl:text> </xsl:text>
<span class="position">
<xsl:choose>
<xsl:when test="position">
<xsl:value-of select="position"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="post_group"/>
</xsl:otherwise>
</xsl:choose>
</span>
</h4>
</div>
<img class="avatar">
<xsl:attribute name="src">
<xsl:value-of select="avatar"/>
</xsl:attribute>
</img>
</div>
<div id="detailedinfo">
<dl class="settings noborder">
<xsl:apply-templates mode="detailedinfo"/>
</dl>
</div>
</xsl:template>
END,
// Some helper templates for details inside the summary.
'detail_default' => <<<'END'
<xsl:template match="*" mode="detailedinfo">
<dt>
<xsl:value-of select="concat(@label, ':')"/>
</dt>
<dd>
<xsl:value-of select="." disable-output-escaping="yes"/>
</dd>
</xsl:template>
END,
'detail_email' => <<<'END'
<xsl:template match="email" mode="detailedinfo">
<dt>
<xsl:value-of select="concat(@label, ':')"/>
</dt>
<dd>
<a>
<xsl:attribute name="href">
<xsl:text>mailto:</xsl:text>
<xsl:value-of select="."/>
</xsl:attribute>
<xsl:value-of select="."/>
</a>
</dd>
</xsl:template>
END,
'detail_website' => <<<'END'
<xsl:template match="website" mode="detailedinfo">
<dt>
<xsl:value-of select="concat(@label, ':')"/>
</dt>
<dd>
<a>
<xsl:attribute name="href">
<xsl:value-of select="link"/>
</xsl:attribute>
<xsl:value-of select="title"/>
</a>
</dd>
</xsl:template>
END,
'detail_ip' => <<<'END'
<xsl:template match="ip_addresses" mode="detailedinfo">
<dt>
<xsl:value-of select="concat(@label, ':')"/>
</dt>
<dd>
<ul class="nolist">
<xsl:apply-templates mode="ip_address"/>
</ul>
</dd>
</xsl:template>
<xsl:template match="*" mode="ip_address">
<li>
<xsl:value-of select="."/>
<xsl:if test="@label and following-sibling">
<xsl:text> </xsl:text>
<span>(<xsl:value-of select="@label"/>)</span>
</xsl:if>
</li>
</xsl:template>
END,
'detail_not_included' => <<<'END'
<xsl:template match="name|link|avatar|online|member_post|personal_message" mode="detailedinfo"/>
END,
// Template for printing a single post.
'member_post' => <<<'END'
<xsl:template match="member_post" mode="posts">
<div>
<xsl:attribute name="id">
<xsl:value-of select="concat('member_post_', id)"/>
</xsl:attribute>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="approval_status = 1">
<xsl:text>windowbg</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>approvebg</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<div class="post_wrapper">
<div class="poster">
<h4>
<a>
<xsl:attribute name="href">
<xsl:value-of select="poster/link"/>
</xsl:attribute>
<xsl:value-of select="poster/name"/>
</a>
</h4>
<ul class="user_info">
<xsl:if test="poster/id = $member_id">
<xsl:call-template name="own_user_info"/>
</xsl:if>
<li>
<xsl:value-of select="poster/email"/>
</li>
<li class="poster_ip">
<xsl:value-of select="concat(poster/ip/@label, ': ')"/>
<xsl:value-of select="poster/ip"/>
</li>
</ul>
</div>
<div class="postarea">
<div class="flow_hidden">
<div class="keyinfo">
<h5>
<strong>
<a>
<xsl:attribute name="href">
<xsl:value-of select="board/link"/>
</xsl:attribute>
<xsl:value-of select="board/name"/>
</a>
<xsl:text> / </xsl:text>
<a>
<xsl:attribute name="href">
<xsl:value-of select="link"/>
</xsl:attribute>
<xsl:value-of select="subject"/>
</a>
</strong>
</h5>
<span class="smalltext"><xsl:value-of select="time"/></span>
<xsl:if test="modified_time">
<span class="smalltext modified floatright mvisible em">
<xsl:attribute name="id">
<xsl:value-of select="concat('modified_', id)"/>
</xsl:attribute>
<span class="lastedit">
<xsl:value-of select="modified_time/@label"/>
</span>
<xsl:text>: </xsl:text>
<xsl:value-of select="modified_time"/>
<xsl:text>. </xsl:text>
<xsl:value-of select="modified_by/@label"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="modified_by"/>
<xsl:text>. </xsl:text>
</span>
</xsl:if>
</div>
<div class="post">
<div class="inner">
<xsl:value-of select="body_html" disable-output-escaping="yes"/>
</div>
<div class="inner monospace" style="display:none;">
<xsl:choose>
<xsl:when test="contains(body/text(), '[html]')">
<xsl:call-template name="bbc_html_splitter">
<xsl:with-param name="bbc_string" select="body/text()"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="body" disable-output-escaping="yes"/>
</xsl:otherwise>
</xsl:choose>
</div>
</div>
<xsl:apply-templates select="attachments">
<xsl:with-param name="post_id" select="id"/>
</xsl:apply-templates>
<div class="under_message">
<ul class="floatleft">
<xsl:if test="likes > 0">
<li class="smflikebutton">
<xsl:attribute name="id">
<xsl:value-of select="concat('msg_', id, '_likes')"/>
</xsl:attribute>
<span><span class="main_icons like"></span> <xsl:value-of select="likes"/></span>
</li>
</xsl:if>
</ul>
<xsl:call-template name="quickbuttons">
<xsl:with-param name="toggle_target" select="concat('member_post_', id)"/>
</xsl:call-template>
</div>
</div>
</div>
<div class="moderatorbar">
<xsl:if test="poster/id = $member_id">
<xsl:call-template name="signature"/>
</xsl:if>
</div>
</div>
</div>
</xsl:template>
END,
// Template for printing a single PM.
'personal_message' => <<<'END'
<xsl:template match="personal_message" mode="pms">
<div class="windowbg">
<xsl:attribute name="id">
<xsl:value-of select="concat('personal_message_', id)"/>
</xsl:attribute>
<div class="post_wrapper">
<div class="poster">
<h4>
<a>
<xsl:attribute name="href">
<xsl:value-of select="sender/link"/>
</xsl:attribute>
<xsl:value-of select="sender/name"/>
</a>
</h4>
<ul class="user_info">
<xsl:if test="sender/id = $member_id">
<xsl:call-template name="own_user_info"/>
</xsl:if>
</ul>
</div>
<div class="postarea">
<div class="flow_hidden">
<div class="keyinfo">
<h5>
<xsl:attribute name="id">
<xsl:value-of select="concat('subject_', id)"/>
</xsl:attribute>
<xsl:value-of select="subject"/>
</h5>
<span class="smalltext">
<strong>
<xsl:value-of select="concat(recipient[1]/@label, ': ')"/>
</strong>
<xsl:apply-templates select="recipient"/>
</span>
<br/>
<span class="smalltext">
<strong>
<xsl:value-of select="concat(sent_date/@label, ': ')"/>
</strong>
<time>
<xsl:attribute name="datetime">
<xsl:value-of select="sent_date/@UTC"/>
</xsl:attribute>
<xsl:value-of select="normalize-space(sent_date)"/>
</time>
</span>
</div>
<div class="post">
<div class="inner">
<xsl:value-of select="body_html" disable-output-escaping="yes"/>
</div>
<div class="inner monospace" style="display:none;">
<xsl:call-template name="bbc_html_splitter">
<xsl:with-param name="bbc_string" select="body/text()"/>
</xsl:call-template>
</div>
</div>
<div class="under_message">
<xsl:call-template name="quickbuttons">
<xsl:with-param name="toggle_target" select="concat('personal_message_', id)"/>
</xsl:call-template>
</div>
</div>
</div>
<div class="moderatorbar">
<xsl:if test="sender/id = $member_id">
<xsl:call-template name="signature"/>
</xsl:if>
</div>
</div>
</div>
</xsl:template>
END,
// A couple of templates to handle attachments.
'attachments' => <<<'END'
<xsl:template match="attachments">
<xsl:param name="post_id"/>
<xsl:if test="attachment">
<div class="attachments">
<xsl:attribute name="id">
<xsl:value-of select="concat('msg_', $post_id, '_footer')"/>
</xsl:attribute>
<xsl:apply-templates/>
</div>
</xsl:if>
</xsl:template>
<xsl:template match="attachment">
<div class="attached">
<div class="attachments_bot">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(id, ' - ', name)"/>
</xsl:attribute>
<img class="centericon" alt="*">
<xsl:attribute name="src">
<xsl:value-of select="concat($themeurl, '/images/icons/clip.png')"/>
</xsl:attribute>
</img>
<xsl:text> </xsl:text>
<xsl:value-of select="name"/>
</a>
<br/>
<xsl:text>(</xsl:text>
<a class="bbc_link">
<xsl:attribute name="href">
<xsl:value-of select="concat($scripturl, '?action=profile;area=dlattach;u=', $member_id, ';attach=', id, ';t=', $dltoken)"/>
</xsl:attribute>
<xsl:value-of select="$txt_download_original"/>
</a>
<xsl:text>)</xsl:text>
<br/>
<xsl:value-of select="size/@label"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="size"/>
<br/>
<xsl:value-of select="downloads/@label"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="downloads"/>
</div>
</div>
</xsl:template>
END,
// Helper template for printing the user's own info next to the post or personal message.
'own_user_info' => <<<'END'
<xsl:template name="own_user_info">
<xsl:if test="/*/avatar">
<li class="avatar">
<a>
<xsl:attribute name="href">
<xsl:value-of select="/*/link"/>
</xsl:attribute>
<img class="avatar">
<xsl:attribute name="src">
<xsl:value-of select="/*/avatar"/>
</xsl:attribute>
</img>
</a>
</li>
</xsl:if>
<li class="membergroup">
<xsl:value-of select="/*/position"/>
</li>
<xsl:if test="/*/title">
<li class="title">
<xsl:value-of select="/*/title"/>
</li>
</xsl:if>
<li class="postgroup">
<xsl:value-of select="/*/post_group"/>
</li>
<li class="postcount">
<xsl:value-of select="concat(/*/posts/@label, ': ')"/>
<xsl:value-of select="/*/posts"/>
</li>
<xsl:if test="/*/blurb">
<li class="blurb">
<xsl:value-of select="/*/blurb"/>
</li>
</xsl:if>
</xsl:template>
END,
// Helper template for printing the quickbuttons.
'quickbuttons' => <<<'END'
<xsl:template name="quickbuttons">
<xsl:param name="toggle_target"/>
<ul class="quickbuttons quickbuttons_post sf-js-enabled sf-arrows" style="touch-action: pan-y;">
<li>
<a>
<xsl:attribute name="onclick">
<xsl:text>$('#</xsl:text>
<xsl:value-of select="$toggle_target"/>
<xsl:text> .inner').toggle();</xsl:text>
</xsl:attribute>
<xsl:value-of select="$txt_view_source_button"/>
</a>
</li>
</ul>
</xsl:template>
END,
// Helper template for printing a signature/
'signature' => <<<'END'
<xsl:template name="signature">
<xsl:if test="/*/signature">
<div class="signature">
<xsl:value-of select="/*/signature" disable-output-escaping="yes"/>
</div>
</xsl:if>
</xsl:template>
END,
// Helper template for printing a list of PM recipients.
'recipient' => <<<'END'
<xsl:template match="recipient">
<a>
<xsl:attribute name="href">
<xsl:value-of select="link"/>
</xsl:attribute>
<xsl:value-of select="name"/>
</a>
<xsl:choose>
<xsl:when test="following-sibling::recipient">
<xsl:text>, </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>. </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
END,
// Helper template for special handling of the contents of the [html] BBCode.
'bbc_html' => <<<'END'
<xsl:template name="bbc_html_splitter">
<xsl:param name="bbc_string"/>
<xsl:param name="inside_outside" select="outside"/>
<xsl:choose>
<xsl:when test="$inside_outside = 'outside'">
<xsl:choose>
<xsl:when test="contains($bbc_string, '[html]')">
<xsl:variable name="following_string">
<xsl:value-of select="substring-after($bbc_string, '[html]')" disable-output-escaping="yes"/>
</xsl:variable>
<xsl:value-of select="substring-before($bbc_string, '[html]')" disable-output-escaping="yes"/>
<xsl:text>[html]</xsl:text>
<xsl:call-template name="bbc_html_splitter">
<xsl:with-param name="bbc_string" select="$following_string"/>
<xsl:with-param name="inside_outside" select="inside"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$bbc_string" disable-output-escaping="yes"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="contains($bbc_string, '[/html]')">
<xsl:variable name="following_string">
<xsl:value-of select="substring-after($bbc_string, '[/html]')" disable-output-escaping="yes"/>
</xsl:variable>
<xsl:value-of select="substring-before($bbc_string, '[/html]')" disable-output-escaping="no"/>
<xsl:text>[/html]</xsl:text>
<xsl:call-template name="bbc_html_splitter">
<xsl:with-param name="bbc_string" select="$following_string"/>
<xsl:with-param name="inside_outside" select="outside"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$bbc_string" disable-output-escaping="no"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
END,
// Helper templates to build a page index.
'page_index' => <<<'END'
<xsl:template name="page_index">
<xsl:variable name="current_page" select="/*/@page"/>
<xsl:variable name="prev_page" select="/*/@page - 1"/>
<xsl:variable name="next_page" select="/*/@page + 1"/>
<div class="pagesection">
<div class="pagelinks floatleft">
<span class="pages">
<xsl:value-of select="$txt_pages"/>
</span>
<xsl:if test="$current_page > 1">
<a class="nav_page">
<xsl:attribute name="href">
<xsl:value-of select="concat($dlfilename, '_', $prev_page, '.', $ext)"/>
</xsl:attribute>
<span class="main_icons previous_page"></span>
</a>
</xsl:if>
<xsl:call-template name="page_links"/>
<xsl:if test="$current_page < $last_page">
<a class="nav_page">
<xsl:attribute name="href">
<xsl:value-of select="concat($dlfilename, '_', $next_page, '.', $ext)"/>
</xsl:attribute>
<span class="main_icons next_page"></span>
</a>
</xsl:if>
</div>
</div>
</xsl:template>
<xsl:template name="page_links">
<xsl:param name="page_num" select="1"/>
<xsl:variable name="current_page" select="/*/@page"/>
<xsl:variable name="prev_page" select="/*/@page - 1"/>
<xsl:variable name="next_page" select="/*/@page + 1"/>
<xsl:choose>
<xsl:when test="$page_num = $current_page">
<span class="current_page">
<xsl:value-of select="$page_num"/>
</span>
</xsl:when>
<xsl:when test="$page_num = 1 or $page_num = ($current_page - 1) or $page_num = ($current_page + 1) or $page_num = $last_page">
<a class="nav_page">
<xsl:attribute name="href">
<xsl:value-of select="concat($dlfilename, '_', $page_num, '.', $ext)"/>
</xsl:attribute>
<xsl:value-of select="$page_num"/>
</a>
</xsl:when>
<xsl:when test="$page_num = 2 or $page_num = ($current_page + 2)">
<span class="expand_pages" onclick="$('.nav_page').removeClass('hidden'); $('.expand_pages').hide();"> ... </span>
<a class="nav_page hidden">
<xsl:attribute name="href">
<xsl:value-of select="concat($dlfilename, '_', $page_num, '.', $ext)"/>
</xsl:attribute>
<xsl:value-of select="$page_num"/>
</a>
</xsl:when>
<xsl:otherwise>
<a class="nav_page hidden">
<xsl:attribute name="href">
<xsl:value-of select="concat($dlfilename, '_', $page_num, '.', $ext)"/>
</xsl:attribute>
<xsl:value-of select="$page_num"/>
</a>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
<xsl:if test="$page_num < $last_page">
<xsl:call-template name="page_links">
<xsl:with-param name="page_num" select="$page_num + 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
END,
// Template to insert CSS and JavaScript. This is set at runtime.
'css_js' => '',
// End of the XSLT stylesheet.
'footer' => '</xsl:stylesheet>',
]
The XSLT stylesheet, broken up into logical parts.
Methods
__construct()
The constructor.
public
__construct(array<string|int, mixed> $details) : mixed
Parameters
- $details : array<string|int, mixed>
-
The details for the task
add_dtd()
Adds a custom DOCTYPE definition and an XSLT processing instruction to the main XML file's header. Only used for the XML_XSLT format.
public
static add_dtd(array<string|int, mixed> &$xml_data, array<string|int, mixed> &$metadata, array<string|int, mixed> &$namespaces, array<string|int, mixed> &$extraFeedTags, array<string|int, mixed> &$forceCdataKeys, array<string|int, mixed> &$nsKeys, string $xml_format, string $subaction, string &$doctype) : void
Parameters
- $xml_data : array<string|int, mixed>
- $metadata : array<string|int, mixed>
- $namespaces : array<string|int, mixed>
- $extraFeedTags : array<string|int, mixed>
- $forceCdataKeys : array<string|int, mixed>
- $nsKeys : array<string|int, mixed>
- $xml_format : string
- $subaction : string
- $doctype : string
attach_bbc_validate()
Adjusts the format of the HTML produced by the attach BBCode.
public
static attach_bbc_validate(string &$returnContext, array<string|int, mixed> $currentAttachment, array<string|int, mixed> $tag, array<string|int, mixed>|string $data, array<string|int, mixed> $disabled, array<string|int, mixed> $params) : void
Parameters
- $returnContext : string
- $currentAttachment : array<string|int, mixed>
- $tag : array<string|int, mixed>
- $data : array<string|int, mixed>|string
- $disabled : array<string|int, mixed>
- $params : array<string|int, mixed>
bbc_codes()
Adjusts certain BBCodes for the special case of exports.
public
static bbc_codes(array<string|int, mixed> &$codes, array<string|int, mixed> &$no_autolink_tags) : void
Parameters
- $codes : array<string|int, mixed>
- $no_autolink_tags : array<string|int, mixed>
execute()
This is the main dispatcher for the class.
public
execute() : bool
It calls the correct private function based on the information stored in the task details.
Tags
Return values
bool —Always returns true.
getMinUserInfo()
Loads minimal info for the previously loaded user ids
public
getMinUserInfo([array<string|int, mixed> $user_ids = [] ]) : array<string|int, mixed>
Parameters
- $user_ids : array<string|int, mixed> = []
Tags
Return values
array<string|int, mixed>parser_cache()
Adds data to the cache key to distinguish parsing for exports from normal parsing.
public
static parser_cache(array<string|int, mixed> &$cache_key_extras) : void
Parameters
- $cache_key_extras : array<string|int, mixed>
post_parseAttachBBC()
Adjusts the attachment download URL for the special case of exports.
public
static post_parseAttachBBC(array<string|int, mixed> &$attachContext) : void
Parameters
- $attachContext : array<string|int, mixed>
post_parsebbc()
Reverses changes made by pre_parsebbc()
public
static post_parsebbc(string &$message, bool &$smileys, string &$cache_id, array<string|int, mixed> &$parse_tags) : void
Parameters
- $message : string
- $smileys : bool
- $cache_id : string
- $parse_tags : array<string|int, mixed>
pre_parsebbc_html()
Adjusts some parse_bbc() parameters for the special case of HTML and XML_XSLT exports.
public
static pre_parsebbc_html(string &$message, bool &$smileys, string &$cache_id, array<string|int, mixed> &$parse_tags) : void
Parameters
- $message : string
- $smileys : bool
- $cache_id : string
- $parse_tags : array<string|int, mixed>
pre_parsebbc_xml()
Adjusts some parse_bbc() parameters for the special case of XML exports.
public
static pre_parsebbc_xml(string &$message, bool &$smileys, string &$cache_id, array<string|int, mixed> &$parse_tags) : void
Parameters
- $message : string
- $smileys : bool
- $cache_id : string
- $parse_tags : array<string|int, mixed>
buildStylesheet()
Finalizes the XSLT stylesheet used to transform an XML-based profile export file into the desired output format.
protected
buildStylesheet() : void
exportHtml()
Compiles profile data to HTML.
protected
exportHtml() : void
Internally calls exportXml() and then uses an XSLT stylesheet to transform the XML files into HTML.
exportXml()
The workhorse of this class. Compiles profile data to XML files.
protected
exportXml() : void
exportXmlXslt()
Compiles profile data to XML with embedded XSLT.
protected
exportXmlXslt() : void
Internally calls exportXml() and then embeds an XSLT stylesheet into the XML so that it can be processed by the client.
loadCssJs()
Loads and prepares CSS and JavaScript for insertion into an XSLT stylesheet.
protected
loadCssJs() : void