| Conditions | 30 |
| Paths | 4100 |
| Total Lines | 992 |
| Code Lines | 147 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 775 | function get_xslt_stylesheet($format, $uid) |
||
| 776 | { |
||
| 777 | global $context, $txt, $settings, $modSettings, $sourcedir, $forum_copyright, $scripturl, $smcFunc; |
||
| 778 | |||
| 779 | static $xslts = array(); |
||
| 780 | |||
| 781 | $doctype = ''; |
||
| 782 | $stylesheet = array(); |
||
| 783 | $xslt_variables = array(); |
||
| 784 | |||
| 785 | // Do not change any of these to HTTPS URLs. For explanation, see comments in the buildXmlFeed() function. |
||
| 786 | $smf_ns = 'htt'.'p:/'.'/ww'.'w.simple'.'machines.o'.'rg/xml/profile'; |
||
| 787 | $xslt_ns = 'htt'.'p:/'.'/ww'.'w.w3.o'.'rg/1999/XSL/Transform'; |
||
| 788 | $html_ns = 'htt'.'p:/'.'/ww'.'w.w3.o'.'rg/1999/xhtml'; |
||
| 789 | |||
| 790 | require_once($sourcedir . DIRECTORY_SEPARATOR . 'News.php'); |
||
| 791 | |||
| 792 | if (in_array($format, array('HTML', 'XML_XSLT'))) |
||
| 793 | { |
||
| 794 | if (!class_exists('DOMDocument') || !class_exists('XSLTProcessor')) |
||
| 795 | $format = 'XML_XSLT'; |
||
| 796 | |||
| 797 | $export_formats = get_export_formats(); |
||
| 798 | |||
| 799 | /* Notes: |
||
| 800 | * 1. The 'value' can be one of the following: |
||
| 801 | * - an integer or string |
||
| 802 | * - an XPath expression |
||
| 803 | * - raw XML, which may or not not include other XSLT statements. |
||
| 804 | * |
||
| 805 | * 2. Always set 'no_cdata_parse' to true when the value is raw XML. |
||
| 806 | * |
||
| 807 | * 3. Set 'xpath' to true if the value is an XPath expression. When this |
||
| 808 | * is true, the value will be placed in the 'select' attribute of the |
||
| 809 | * <xsl:variable> element rather than in a child node. |
||
| 810 | * |
||
| 811 | * 4. Set 'param' to true in order to create an <xsl:param> instead |
||
| 812 | * of an <xsl:variable>. |
||
| 813 | * |
||
| 814 | * A word to PHP coders: Do not let the term "variable" mislead you. |
||
| 815 | * XSLT variables are roughly equivalent to PHP constants rather |
||
| 816 | * than PHP variables; once the value has been set, it is immutable. |
||
| 817 | * Keeping this in mind may spare you from some confusion and |
||
| 818 | * frustration while working with XSLT. |
||
| 819 | */ |
||
| 820 | $xslt_variables = array( |
||
| 821 | 'scripturl' => array( |
||
| 822 | 'value' => $scripturl, |
||
| 823 | ), |
||
| 824 | 'themeurl' => array( |
||
| 825 | 'value' => $settings['default_theme_url'], |
||
| 826 | ), |
||
| 827 | 'member_id' => array( |
||
| 828 | 'value' => $uid, |
||
| 829 | ), |
||
| 830 | 'last_page' => array( |
||
| 831 | 'param' => true, |
||
| 832 | 'value' => !empty($context['export_last_page']) ? $context['export_last_page'] : 1, |
||
| 833 | 'xpath' => true, |
||
| 834 | ), |
||
| 835 | 'dlfilename' => array( |
||
| 836 | 'param' => true, |
||
| 837 | 'value' => !empty($context['export_dlfilename']) ? $context['export_dlfilename'] : '', |
||
| 838 | ), |
||
| 839 | 'ext' => array( |
||
| 840 | 'value' => $export_formats[$format]['extension'], |
||
| 841 | ), |
||
| 842 | 'forum_copyright' => array( |
||
| 843 | 'value' => sprintf($forum_copyright, SMF_FULL_VERSION, SMF_SOFTWARE_YEAR, $scripturl), |
||
| 844 | ), |
||
| 845 | 'txt_summary_heading' => array( |
||
| 846 | 'value' => $txt['summary'], |
||
| 847 | ), |
||
| 848 | 'txt_posts_heading' => array( |
||
| 849 | 'value' => $txt['posts'], |
||
| 850 | ), |
||
| 851 | 'txt_personal_messages_heading' => array( |
||
| 852 | 'value' => $txt['personal_messages'], |
||
| 853 | ), |
||
| 854 | 'txt_view_source_button' => array( |
||
| 855 | 'value' => $txt['export_view_source_button'], |
||
| 856 | ), |
||
| 857 | 'txt_download_original' => array( |
||
| 858 | 'value' => $txt['export_download_original'], |
||
| 859 | ), |
||
| 860 | 'txt_help' => array( |
||
| 861 | 'value' => $txt['help'], |
||
| 862 | ), |
||
| 863 | 'txt_terms_rules' => array( |
||
| 864 | 'value' => $txt['terms_and_rules'], |
||
| 865 | ), |
||
| 866 | 'txt_go_up' => array( |
||
| 867 | 'value' => $txt['go_up'], |
||
| 868 | ), |
||
| 869 | 'txt_pages' => array( |
||
| 870 | 'value' => $txt['pages'], |
||
| 871 | ), |
||
| 872 | ); |
||
| 873 | |||
| 874 | // Let mods adjust the XSLT variables. |
||
| 875 | call_integration_hook('integrate_export_xslt_variables', array(&$xslt_variables, $format)); |
||
| 876 | |||
| 877 | $idhash = hash_hmac('sha1', $uid, get_auth_secret()); |
||
| 878 | $xslt_variables['dltoken'] = array( |
||
| 879 | 'value' => hash_hmac('sha1', $idhash, get_auth_secret()) |
||
| 880 | ); |
||
| 881 | |||
| 882 | // Efficiency = good. |
||
| 883 | $xslt_key = $smcFunc['json_encode'](array($format, $uid, $xslt_variables)); |
||
| 884 | if (isset($xslts[$xslt_key])) |
||
| 885 | return $xslts[$xslt_key]; |
||
| 886 | |||
| 887 | if ($format == 'XML_XSLT') |
||
| 888 | { |
||
| 889 | $doctype = implode("\n", array( |
||
| 890 | '<!--', |
||
| 891 | "\t" . $txt['export_open_in_browser'], |
||
| 892 | '-->', |
||
| 893 | '<?xml-stylesheet type="text/xsl" href="#stylesheet"?>', |
||
| 894 | '<!DOCTYPE smf:xml-feed [', |
||
| 895 | '<!ATTLIST xsl:stylesheet', |
||
| 896 | 'id ID #REQUIRED>', |
||
| 897 | ']>', |
||
| 898 | )); |
||
| 899 | |||
| 900 | $stylesheet['header'] = "\n" . implode("\n", array( |
||
| 901 | '', |
||
| 902 | "\t" . '<xsl:stylesheet version="1.0" xmlns:xsl="' . $xslt_ns . '" xmlns:html="' . $html_ns . '" xmlns:smf="' . $smf_ns . '" exclude-result-prefixes="smf html" id="stylesheet">', |
||
| 903 | '', |
||
| 904 | "\t\t" . '<xsl:template match="xsl:stylesheet"/>', |
||
| 905 | "\t\t" . '<xsl:template match="xsl:stylesheet" mode="detailedinfo"/>', |
||
| 906 | )); |
||
| 907 | } |
||
| 908 | else |
||
| 909 | { |
||
| 910 | $doctype = ''; |
||
| 911 | $stylesheet['header'] = implode("\n", array( |
||
| 912 | '<?xml version="1.0" encoding="' . $context['character_set'] . '"?' . '>', |
||
| 913 | '<xsl:stylesheet version="1.0" xmlns:xsl="' . $xslt_ns . '" xmlns:html="' . $html_ns . '" xmlns:smf="' . $smf_ns . '" exclude-result-prefixes="smf html">', |
||
| 914 | )); |
||
| 915 | } |
||
| 916 | |||
| 917 | // Output control settings. |
||
| 918 | $stylesheet['output_control'] = ' |
||
| 919 | <xsl:output method="html" encoding="utf-8" indent="yes"/> |
||
| 920 | <xsl:strip-space elements="*"/>'; |
||
| 921 | |||
| 922 | // Insert the XSLT variables. |
||
| 923 | $stylesheet['variables'] = ''; |
||
| 924 | |||
| 925 | foreach ($xslt_variables as $name => $var) |
||
| 926 | { |
||
| 927 | $element = !empty($var['param']) ? 'param' : 'variable'; |
||
| 928 | |||
| 929 | $stylesheet['variables'] .= "\n\t\t" . '<xsl:' . $element . ' name="' . $name . '"'; |
||
| 930 | |||
| 931 | if (isset($var['xpath'])) |
||
| 932 | $stylesheet['variables'] .= ' select="' . $var['value'] . '"/>'; |
||
| 933 | else |
||
| 934 | $stylesheet['variables'] .= '>' . (!empty($var['no_cdata_parse']) ? $var['value'] : cdata_parse($var['value'])) . '</xsl:' . $element . '>'; |
||
| 935 | } |
||
| 936 | |||
| 937 | // The top-level template. Creates the shell of the HTML document. |
||
| 938 | $stylesheet['html'] = ' |
||
| 939 | <xsl:template match="/*"> |
||
| 940 | <xsl:text disable-output-escaping="yes"><!DOCTYPE html></xsl:text> |
||
| 941 | <html> |
||
| 942 | <head> |
||
| 943 | <title> |
||
| 944 | <xsl:value-of select="@title"/> |
||
| 945 | </title> |
||
| 946 | <xsl:call-template name="css_js"/> |
||
| 947 | </head> |
||
| 948 | <body> |
||
| 949 | <div id="footerfix"> |
||
| 950 | <div id="header"> |
||
| 951 | <h1 class="forumtitle"> |
||
| 952 | <a id="top"> |
||
| 953 | <xsl:attribute name="href"> |
||
| 954 | <xsl:value-of select="$scripturl"/> |
||
| 955 | </xsl:attribute> |
||
| 956 | <xsl:value-of select="@forum-name"/> |
||
| 957 | </a> |
||
| 958 | </h1> |
||
| 959 | </div> |
||
| 960 | <div id="wrapper"> |
||
| 961 | <div id="upper_section"> |
||
| 962 | <div id="inner_section"> |
||
| 963 | <div id="inner_wrap"> |
||
| 964 | <div class="user"> |
||
| 965 | <time> |
||
| 966 | <xsl:attribute name="datetime"> |
||
| 967 | <xsl:value-of select="@generated-date-UTC"/> |
||
| 968 | </xsl:attribute> |
||
| 969 | <xsl:value-of select="@generated-date-localized"/> |
||
| 970 | </time> |
||
| 971 | </div> |
||
| 972 | <hr class="clear"/> |
||
| 973 | </div> |
||
| 974 | </div> |
||
| 975 | </div> |
||
| 976 | |||
| 977 | <xsl:call-template name="content_section"/> |
||
| 978 | |||
| 979 | </div> |
||
| 980 | </div> |
||
| 981 | <div id="footer"> |
||
| 982 | <div class="inner_wrap"> |
||
| 983 | <ul> |
||
| 984 | <li class="floatright"> |
||
| 985 | <a> |
||
| 986 | <xsl:attribute name="href"> |
||
| 987 | <xsl:value-of select="concat($scripturl, \'?action=help\')"/> |
||
| 988 | </xsl:attribute> |
||
| 989 | <xsl:value-of select="$txt_help"/> |
||
| 990 | </a> |
||
| 991 | <xsl:text> | </xsl:text> |
||
| 992 | <a> |
||
| 993 | <xsl:attribute name="href"> |
||
| 994 | <xsl:value-of select="concat($scripturl, \'?action=help;sa=rules\')"/> |
||
| 995 | </xsl:attribute> |
||
| 996 | <xsl:value-of select="$txt_terms_rules"/> |
||
| 997 | </a> |
||
| 998 | <xsl:text> | </xsl:text> |
||
| 999 | <a href="#top"> |
||
| 1000 | <xsl:value-of select="$txt_go_up"/> |
||
| 1001 | <xsl:text> ▲</xsl:text> |
||
| 1002 | </a> |
||
| 1003 | </li> |
||
| 1004 | <li class="copyright"> |
||
| 1005 | <xsl:value-of select="$forum_copyright" disable-output-escaping="yes"/> |
||
| 1006 | </li> |
||
| 1007 | </ul> |
||
| 1008 | </div> |
||
| 1009 | </div> |
||
| 1010 | </body> |
||
| 1011 | </html> |
||
| 1012 | </xsl:template>'; |
||
| 1013 | |||
| 1014 | // Template to show the content of the export file. |
||
| 1015 | $stylesheet['content_section'] = ' |
||
| 1016 | <xsl:template name="content_section"> |
||
| 1017 | <div id="content_section"> |
||
| 1018 | <div id="main_content_section"> |
||
| 1019 | |||
| 1020 | <div class="cat_bar"> |
||
| 1021 | <h3 class="catbg"> |
||
| 1022 | <xsl:value-of select="@title"/> |
||
| 1023 | </h3> |
||
| 1024 | </div> |
||
| 1025 | <div class="information"> |
||
| 1026 | <h2 class="display_title"> |
||
| 1027 | <xsl:value-of select="@description"/> |
||
| 1028 | </h2> |
||
| 1029 | </div> |
||
| 1030 | |||
| 1031 | <xsl:if test="username"> |
||
| 1032 | <div class="cat_bar"> |
||
| 1033 | <h3 class="catbg"> |
||
| 1034 | <xsl:value-of select="$txt_summary_heading"/> |
||
| 1035 | </h3> |
||
| 1036 | </div> |
||
| 1037 | <div id="profileview" class="roundframe flow_auto noup"> |
||
| 1038 | <xsl:call-template name="summary"/> |
||
| 1039 | </div> |
||
| 1040 | </xsl:if> |
||
| 1041 | |||
| 1042 | <xsl:call-template name="page_index"/> |
||
| 1043 | |||
| 1044 | <xsl:if test="member_post"> |
||
| 1045 | <div class="cat_bar"> |
||
| 1046 | <h3 class="catbg"> |
||
| 1047 | <xsl:value-of select="$txt_posts_heading"/> |
||
| 1048 | </h3> |
||
| 1049 | </div> |
||
| 1050 | <div id="posts" class="roundframe flow_auto noup"> |
||
| 1051 | <xsl:apply-templates select="member_post" mode="posts"/> |
||
| 1052 | </div> |
||
| 1053 | </xsl:if> |
||
| 1054 | |||
| 1055 | <xsl:if test="personal_message"> |
||
| 1056 | <div class="cat_bar"> |
||
| 1057 | <h3 class="catbg"> |
||
| 1058 | <xsl:value-of select="$txt_personal_messages_heading"/> |
||
| 1059 | </h3> |
||
| 1060 | </div> |
||
| 1061 | <div id="personal_messages" class="roundframe flow_auto noup"> |
||
| 1062 | <xsl:apply-templates select="personal_message" mode="pms"/> |
||
| 1063 | </div> |
||
| 1064 | </xsl:if> |
||
| 1065 | |||
| 1066 | <xsl:call-template name="page_index"/> |
||
| 1067 | |||
| 1068 | </div> |
||
| 1069 | </div> |
||
| 1070 | </xsl:template>'; |
||
| 1071 | |||
| 1072 | // Template for user profile summary |
||
| 1073 | $stylesheet['summary'] = ' |
||
| 1074 | <xsl:template name="summary"> |
||
| 1075 | <div id="basicinfo"> |
||
| 1076 | <div class="username clear"> |
||
| 1077 | <h4> |
||
| 1078 | <a> |
||
| 1079 | <xsl:attribute name="href"> |
||
| 1080 | <xsl:value-of select="link"/> |
||
| 1081 | </xsl:attribute> |
||
| 1082 | <xsl:value-of select="name"/> |
||
| 1083 | </a> |
||
| 1084 | <xsl:text> </xsl:text> |
||
| 1085 | <span class="position"> |
||
| 1086 | <xsl:choose> |
||
| 1087 | <xsl:when test="position"> |
||
| 1088 | <xsl:value-of select="position"/> |
||
| 1089 | </xsl:when> |
||
| 1090 | <xsl:otherwise> |
||
| 1091 | <xsl:value-of select="post_group"/> |
||
| 1092 | </xsl:otherwise> |
||
| 1093 | </xsl:choose> |
||
| 1094 | </span> |
||
| 1095 | </h4> |
||
| 1096 | </div> |
||
| 1097 | <img class="avatar"> |
||
| 1098 | <xsl:attribute name="src"> |
||
| 1099 | <xsl:value-of select="avatar"/> |
||
| 1100 | </xsl:attribute> |
||
| 1101 | </img> |
||
| 1102 | </div> |
||
| 1103 | |||
| 1104 | <div id="detailedinfo"> |
||
| 1105 | <dl class="settings noborder"> |
||
| 1106 | <xsl:apply-templates mode="detailedinfo"/> |
||
| 1107 | </dl> |
||
| 1108 | </div> |
||
| 1109 | </xsl:template>'; |
||
| 1110 | |||
| 1111 | // Some helper templates for details inside the summary. |
||
| 1112 | $stylesheet['detail_default'] = ' |
||
| 1113 | <xsl:template match="*" mode="detailedinfo"> |
||
| 1114 | <dt> |
||
| 1115 | <xsl:value-of select="concat(@label, \':\')"/> |
||
| 1116 | </dt> |
||
| 1117 | <dd> |
||
| 1118 | <xsl:value-of select="." disable-output-escaping="yes"/> |
||
| 1119 | </dd> |
||
| 1120 | </xsl:template>'; |
||
| 1121 | |||
| 1122 | $stylesheet['detail_email'] = ' |
||
| 1123 | <xsl:template match="email" mode="detailedinfo"> |
||
| 1124 | <dt> |
||
| 1125 | <xsl:value-of select="concat(@label, \':\')"/> |
||
| 1126 | </dt> |
||
| 1127 | <dd> |
||
| 1128 | <a> |
||
| 1129 | <xsl:attribute name="href"> |
||
| 1130 | <xsl:text>mailto:</xsl:text> |
||
| 1131 | <xsl:value-of select="."/> |
||
| 1132 | </xsl:attribute> |
||
| 1133 | <xsl:value-of select="."/> |
||
| 1134 | </a> |
||
| 1135 | </dd> |
||
| 1136 | </xsl:template>'; |
||
| 1137 | |||
| 1138 | $stylesheet['detail_website'] = ' |
||
| 1139 | <xsl:template match="website" mode="detailedinfo"> |
||
| 1140 | <dt> |
||
| 1141 | <xsl:value-of select="concat(@label, \':\')"/> |
||
| 1142 | </dt> |
||
| 1143 | <dd> |
||
| 1144 | <a> |
||
| 1145 | <xsl:attribute name="href"> |
||
| 1146 | <xsl:value-of select="link"/> |
||
| 1147 | </xsl:attribute> |
||
| 1148 | <xsl:value-of select="title"/> |
||
| 1149 | </a> |
||
| 1150 | </dd> |
||
| 1151 | </xsl:template>'; |
||
| 1152 | |||
| 1153 | $stylesheet['detail_ip'] = ' |
||
| 1154 | <xsl:template match="ip_addresses" mode="detailedinfo"> |
||
| 1155 | <dt> |
||
| 1156 | <xsl:value-of select="concat(@label, \':\')"/> |
||
| 1157 | </dt> |
||
| 1158 | <dd> |
||
| 1159 | <ul class="nolist"> |
||
| 1160 | <xsl:apply-templates mode="ip_address"/> |
||
| 1161 | </ul> |
||
| 1162 | </dd> |
||
| 1163 | </xsl:template> |
||
| 1164 | <xsl:template match="*" mode="ip_address"> |
||
| 1165 | <li> |
||
| 1166 | <xsl:value-of select="."/> |
||
| 1167 | <xsl:if test="@label and following-sibling"> |
||
| 1168 | <xsl:text> </xsl:text> |
||
| 1169 | <span>(<xsl:value-of select="@label"/>)</span> |
||
| 1170 | </xsl:if> |
||
| 1171 | </li> |
||
| 1172 | </xsl:template>'; |
||
| 1173 | |||
| 1174 | $stylesheet['detail_not_included'] = ' |
||
| 1175 | <xsl:template match="name|link|avatar|online|member_post|personal_message" mode="detailedinfo"/>'; |
||
| 1176 | |||
| 1177 | // Template for printing a single post |
||
| 1178 | $stylesheet['member_post'] = ' |
||
| 1179 | <xsl:template match="member_post" mode="posts"> |
||
| 1180 | <div> |
||
| 1181 | <xsl:attribute name="id"> |
||
| 1182 | <xsl:value-of select="concat(\'member_post_\', id)"/> |
||
| 1183 | </xsl:attribute> |
||
| 1184 | <xsl:attribute name="class"> |
||
| 1185 | <xsl:choose> |
||
| 1186 | <xsl:when test="approval_status = 1"> |
||
| 1187 | <xsl:text>windowbg</xsl:text> |
||
| 1188 | </xsl:when> |
||
| 1189 | <xsl:otherwise> |
||
| 1190 | <xsl:text>approvebg</xsl:text> |
||
| 1191 | </xsl:otherwise> |
||
| 1192 | </xsl:choose> |
||
| 1193 | </xsl:attribute> |
||
| 1194 | |||
| 1195 | <div class="post_wrapper"> |
||
| 1196 | <div class="poster"> |
||
| 1197 | <h4> |
||
| 1198 | <a> |
||
| 1199 | <xsl:attribute name="href"> |
||
| 1200 | <xsl:value-of select="poster/link"/> |
||
| 1201 | </xsl:attribute> |
||
| 1202 | <xsl:value-of select="poster/name"/> |
||
| 1203 | </a> |
||
| 1204 | </h4> |
||
| 1205 | <ul class="user_info"> |
||
| 1206 | <xsl:if test="poster/id = $member_id"> |
||
| 1207 | <xsl:call-template name="own_user_info"/> |
||
| 1208 | </xsl:if> |
||
| 1209 | <li> |
||
| 1210 | <xsl:value-of select="poster/email"/> |
||
| 1211 | </li> |
||
| 1212 | <li class="poster_ip"> |
||
| 1213 | <xsl:value-of select="concat(poster/ip/@label, \': \')"/> |
||
| 1214 | <xsl:value-of select="poster/ip"/> |
||
| 1215 | </li> |
||
| 1216 | </ul> |
||
| 1217 | </div> |
||
| 1218 | |||
| 1219 | <div class="postarea"> |
||
| 1220 | <div class="flow_hidden"> |
||
| 1221 | |||
| 1222 | <div class="keyinfo"> |
||
| 1223 | <h5> |
||
| 1224 | <strong> |
||
| 1225 | <a> |
||
| 1226 | <xsl:attribute name="href"> |
||
| 1227 | <xsl:value-of select="board/link"/> |
||
| 1228 | </xsl:attribute> |
||
| 1229 | <xsl:value-of select="board/name"/> |
||
| 1230 | </a> |
||
| 1231 | <xsl:text> / </xsl:text> |
||
| 1232 | <a> |
||
| 1233 | <xsl:attribute name="href"> |
||
| 1234 | <xsl:value-of select="link"/> |
||
| 1235 | </xsl:attribute> |
||
| 1236 | <xsl:value-of select="subject"/> |
||
| 1237 | </a> |
||
| 1238 | </strong> |
||
| 1239 | </h5> |
||
| 1240 | <span class="smalltext"><xsl:value-of select="time"/></span> |
||
| 1241 | <xsl:if test="modified_time"> |
||
| 1242 | <span class="smalltext modified floatright mvisible em"> |
||
| 1243 | <xsl:attribute name="id"> |
||
| 1244 | <xsl:value-of select="concat(\'modified_\', id)"/> |
||
| 1245 | </xsl:attribute> |
||
| 1246 | <span class="lastedit"> |
||
| 1247 | <xsl:value-of select="modified_time/@label"/> |
||
| 1248 | </span> |
||
| 1249 | <xsl:text>: </xsl:text> |
||
| 1250 | <xsl:value-of select="modified_time"/> |
||
| 1251 | <xsl:text>. </xsl:text> |
||
| 1252 | <xsl:value-of select="modified_by/@label"/> |
||
| 1253 | <xsl:text>: </xsl:text> |
||
| 1254 | <xsl:value-of select="modified_by"/> |
||
| 1255 | <xsl:text>. </xsl:text> |
||
| 1256 | </span> |
||
| 1257 | </xsl:if> |
||
| 1258 | </div> |
||
| 1259 | |||
| 1260 | <div class="post"> |
||
| 1261 | <div class="inner"> |
||
| 1262 | <xsl:value-of select="body_html" disable-output-escaping="yes"/> |
||
| 1263 | </div> |
||
| 1264 | <div class="inner monospace" style="display:none;"> |
||
| 1265 | <xsl:choose> |
||
| 1266 | <xsl:when test="contains(body/text(), \'[html]\')"> |
||
| 1267 | <xsl:call-template name="bbc_html_splitter"> |
||
| 1268 | <xsl:with-param name="bbc_string" select="body/text()"/> |
||
| 1269 | </xsl:call-template> |
||
| 1270 | </xsl:when> |
||
| 1271 | <xsl:otherwise> |
||
| 1272 | <xsl:value-of select="body" disable-output-escaping="yes"/> |
||
| 1273 | </xsl:otherwise> |
||
| 1274 | </xsl:choose> |
||
| 1275 | </div> |
||
| 1276 | </div> |
||
| 1277 | |||
| 1278 | <xsl:apply-templates select="attachments"> |
||
| 1279 | <xsl:with-param name="post_id" select="id"/> |
||
| 1280 | </xsl:apply-templates> |
||
| 1281 | |||
| 1282 | <div class="under_message"> |
||
| 1283 | <ul class="floatleft"> |
||
| 1284 | <xsl:if test="likes > 0"> |
||
| 1285 | <li class="smflikebutton"> |
||
| 1286 | <xsl:attribute name="id"> |
||
| 1287 | <xsl:value-of select="concat(\'msg_\', id, \'_likes\')"/> |
||
| 1288 | </xsl:attribute> |
||
| 1289 | <span><span class="main_icons like"></span> <xsl:value-of select="likes"/></span> |
||
| 1290 | </li> |
||
| 1291 | </xsl:if> |
||
| 1292 | </ul> |
||
| 1293 | <xsl:call-template name="quickbuttons"> |
||
| 1294 | <xsl:with-param name="toggle_target" select="concat(\'member_post_\', id)"/> |
||
| 1295 | </xsl:call-template> |
||
| 1296 | </div> |
||
| 1297 | |||
| 1298 | </div> |
||
| 1299 | </div> |
||
| 1300 | |||
| 1301 | <div class="moderatorbar"> |
||
| 1302 | <xsl:if test="poster/id = $member_id"> |
||
| 1303 | <xsl:call-template name="signature"/> |
||
| 1304 | </xsl:if> |
||
| 1305 | </div> |
||
| 1306 | |||
| 1307 | </div> |
||
| 1308 | </div> |
||
| 1309 | </xsl:template>'; |
||
| 1310 | |||
| 1311 | // Template for printing a single PM |
||
| 1312 | $stylesheet['personal_message'] = ' |
||
| 1313 | <xsl:template match="personal_message" mode="pms"> |
||
| 1314 | <div class="windowbg"> |
||
| 1315 | <xsl:attribute name="id"> |
||
| 1316 | <xsl:value-of select="concat(\'personal_message_\', id)"/> |
||
| 1317 | </xsl:attribute> |
||
| 1318 | |||
| 1319 | <div class="post_wrapper"> |
||
| 1320 | <div class="poster"> |
||
| 1321 | <h4> |
||
| 1322 | <a> |
||
| 1323 | <xsl:attribute name="href"> |
||
| 1324 | <xsl:value-of select="sender/link"/> |
||
| 1325 | </xsl:attribute> |
||
| 1326 | <xsl:value-of select="sender/name"/> |
||
| 1327 | </a> |
||
| 1328 | </h4> |
||
| 1329 | <ul class="user_info"> |
||
| 1330 | <xsl:if test="sender/id = $member_id"> |
||
| 1331 | <xsl:call-template name="own_user_info"/> |
||
| 1332 | </xsl:if> |
||
| 1333 | </ul> |
||
| 1334 | </div> |
||
| 1335 | |||
| 1336 | <div class="postarea"> |
||
| 1337 | <div class="flow_hidden"> |
||
| 1338 | |||
| 1339 | <div class="keyinfo"> |
||
| 1340 | <h5> |
||
| 1341 | <xsl:attribute name="id"> |
||
| 1342 | <xsl:value-of select="concat(\'subject_\', id)"/> |
||
| 1343 | </xsl:attribute> |
||
| 1344 | <xsl:value-of select="subject"/> |
||
| 1345 | </h5> |
||
| 1346 | <span class="smalltext"> |
||
| 1347 | <strong> |
||
| 1348 | <xsl:value-of select="concat(recipient[1]/@label, \': \')"/> |
||
| 1349 | </strong> |
||
| 1350 | <xsl:apply-templates select="recipient"/> |
||
| 1351 | </span> |
||
| 1352 | <br/> |
||
| 1353 | <span class="smalltext"> |
||
| 1354 | <strong> |
||
| 1355 | <xsl:value-of select="concat(sent_date/@label, \': \')"/> |
||
| 1356 | </strong> |
||
| 1357 | <time> |
||
| 1358 | <xsl:attribute name="datetime"> |
||
| 1359 | <xsl:value-of select="sent_date/@UTC"/> |
||
| 1360 | </xsl:attribute> |
||
| 1361 | <xsl:value-of select="normalize-space(sent_date)"/> |
||
| 1362 | </time> |
||
| 1363 | </span> |
||
| 1364 | </div> |
||
| 1365 | |||
| 1366 | <div class="post"> |
||
| 1367 | <div class="inner"> |
||
| 1368 | <xsl:value-of select="body_html" disable-output-escaping="yes"/> |
||
| 1369 | </div> |
||
| 1370 | <div class="inner monospace" style="display:none;"> |
||
| 1371 | <xsl:call-template name="bbc_html_splitter"> |
||
| 1372 | <xsl:with-param name="bbc_string" select="body/text()"/> |
||
| 1373 | </xsl:call-template> |
||
| 1374 | </div> |
||
| 1375 | </div> |
||
| 1376 | |||
| 1377 | <div class="under_message"> |
||
| 1378 | <xsl:call-template name="quickbuttons"> |
||
| 1379 | <xsl:with-param name="toggle_target" select="concat(\'personal_message_\', id)"/> |
||
| 1380 | </xsl:call-template> |
||
| 1381 | </div> |
||
| 1382 | |||
| 1383 | </div> |
||
| 1384 | </div> |
||
| 1385 | |||
| 1386 | <div class="moderatorbar"> |
||
| 1387 | <xsl:if test="sender/id = $member_id"> |
||
| 1388 | <xsl:call-template name="signature"/> |
||
| 1389 | </xsl:if> |
||
| 1390 | </div> |
||
| 1391 | |||
| 1392 | </div> |
||
| 1393 | </div> |
||
| 1394 | </xsl:template>'; |
||
| 1395 | |||
| 1396 | // A couple of templates to handle attachments |
||
| 1397 | $stylesheet['attachments'] = ' |
||
| 1398 | <xsl:template match="attachments"> |
||
| 1399 | <xsl:param name="post_id"/> |
||
| 1400 | <xsl:if test="attachment"> |
||
| 1401 | <div class="attachments"> |
||
| 1402 | <xsl:attribute name="id"> |
||
| 1403 | <xsl:value-of select="concat(\'msg_\', $post_id, \'_footer\')"/> |
||
| 1404 | </xsl:attribute> |
||
| 1405 | <xsl:apply-templates/> |
||
| 1406 | </div> |
||
| 1407 | </xsl:if> |
||
| 1408 | </xsl:template> |
||
| 1409 | <xsl:template match="attachment"> |
||
| 1410 | <div class="attached"> |
||
| 1411 | <div class="attachments_bot"> |
||
| 1412 | <a> |
||
| 1413 | <xsl:attribute name="href"> |
||
| 1414 | <xsl:value-of select="concat(id, \' - \', name)"/> |
||
| 1415 | </xsl:attribute> |
||
| 1416 | <img class="centericon" alt="*"> |
||
| 1417 | <xsl:attribute name="src"> |
||
| 1418 | <xsl:value-of select="concat($themeurl, \'/images/icons/clip.png\')"/> |
||
| 1419 | </xsl:attribute> |
||
| 1420 | </img> |
||
| 1421 | <xsl:text> </xsl:text> |
||
| 1422 | <xsl:value-of select="name"/> |
||
| 1423 | </a> |
||
| 1424 | <br/> |
||
| 1425 | <xsl:text>(</xsl:text> |
||
| 1426 | <a class="bbc_link"> |
||
| 1427 | <xsl:attribute name="href"> |
||
| 1428 | <xsl:value-of select="concat($scripturl, \'?action=profile;area=dlattach;u=\', $member_id, \';attach=\', id, \';t=\', $dltoken)"/> |
||
| 1429 | </xsl:attribute> |
||
| 1430 | <xsl:value-of select="$txt_download_original"/> |
||
| 1431 | </a> |
||
| 1432 | <xsl:text>)</xsl:text> |
||
| 1433 | <br/> |
||
| 1434 | <xsl:value-of select="size/@label"/> |
||
| 1435 | <xsl:text>: </xsl:text> |
||
| 1436 | <xsl:value-of select="size"/> |
||
| 1437 | <br/> |
||
| 1438 | <xsl:value-of select="downloads/@label"/> |
||
| 1439 | <xsl:text>: </xsl:text> |
||
| 1440 | <xsl:value-of select="downloads"/> |
||
| 1441 | </div> |
||
| 1442 | </div> |
||
| 1443 | </xsl:template>'; |
||
| 1444 | |||
| 1445 | // Helper template for printing the user's own info next to the post or personal message. |
||
| 1446 | $stylesheet['own_user_info'] = ' |
||
| 1447 | <xsl:template name="own_user_info"> |
||
| 1448 | <xsl:if test="/*/avatar"> |
||
| 1449 | <li class="avatar"> |
||
| 1450 | <a> |
||
| 1451 | <xsl:attribute name="href"> |
||
| 1452 | <xsl:value-of select="/*/link"/> |
||
| 1453 | </xsl:attribute> |
||
| 1454 | <img class="avatar"> |
||
| 1455 | <xsl:attribute name="src"> |
||
| 1456 | <xsl:value-of select="/*/avatar"/> |
||
| 1457 | </xsl:attribute> |
||
| 1458 | </img> |
||
| 1459 | </a> |
||
| 1460 | </li> |
||
| 1461 | </xsl:if> |
||
| 1462 | <li class="membergroup"> |
||
| 1463 | <xsl:value-of select="/*/position"/> |
||
| 1464 | </li> |
||
| 1465 | <xsl:if test="/*/title"> |
||
| 1466 | <li class="title"> |
||
| 1467 | <xsl:value-of select="/*/title"/> |
||
| 1468 | </li> |
||
| 1469 | </xsl:if> |
||
| 1470 | <li class="postgroup"> |
||
| 1471 | <xsl:value-of select="/*/post_group"/> |
||
| 1472 | </li> |
||
| 1473 | <li class="postcount"> |
||
| 1474 | <xsl:value-of select="concat(/*/posts/@label, \': \')"/> |
||
| 1475 | <xsl:value-of select="/*/posts"/> |
||
| 1476 | </li> |
||
| 1477 | <xsl:if test="/*/blurb"> |
||
| 1478 | <li class="blurb"> |
||
| 1479 | <xsl:value-of select="/*/blurb"/> |
||
| 1480 | </li> |
||
| 1481 | </xsl:if> |
||
| 1482 | </xsl:template>'; |
||
| 1483 | |||
| 1484 | // Helper template for printing the quickbuttons |
||
| 1485 | $stylesheet['quickbuttons'] = ' |
||
| 1486 | <xsl:template name="quickbuttons"> |
||
| 1487 | <xsl:param name="toggle_target"/> |
||
| 1488 | <ul class="quickbuttons quickbuttons_post sf-js-enabled sf-arrows" style="touch-action: pan-y;"> |
||
| 1489 | <li> |
||
| 1490 | <a> |
||
| 1491 | <xsl:attribute name="onclick"> |
||
| 1492 | <xsl:text>$(\'#</xsl:text> |
||
| 1493 | <xsl:value-of select="$toggle_target"/> |
||
| 1494 | <xsl:text> .inner\').toggle();</xsl:text> |
||
| 1495 | </xsl:attribute> |
||
| 1496 | <xsl:value-of select="$txt_view_source_button"/> |
||
| 1497 | </a> |
||
| 1498 | </li> |
||
| 1499 | </ul> |
||
| 1500 | </xsl:template>'; |
||
| 1501 | |||
| 1502 | // Helper template for printing a signature |
||
| 1503 | $stylesheet['signature'] = ' |
||
| 1504 | <xsl:template name="signature"> |
||
| 1505 | <xsl:if test="/*/signature"> |
||
| 1506 | <div class="signature"> |
||
| 1507 | <xsl:value-of select="/*/signature" disable-output-escaping="yes"/> |
||
| 1508 | </div> |
||
| 1509 | </xsl:if> |
||
| 1510 | </xsl:template>'; |
||
| 1511 | |||
| 1512 | // Helper template for printing a list of PM recipients |
||
| 1513 | $stylesheet['recipient'] = ' |
||
| 1514 | <xsl:template match="recipient"> |
||
| 1515 | <a> |
||
| 1516 | <xsl:attribute name="href"> |
||
| 1517 | <xsl:value-of select="link"/> |
||
| 1518 | </xsl:attribute> |
||
| 1519 | <xsl:value-of select="name"/> |
||
| 1520 | </a> |
||
| 1521 | <xsl:choose> |
||
| 1522 | <xsl:when test="following-sibling::recipient"> |
||
| 1523 | <xsl:text>, </xsl:text> |
||
| 1524 | </xsl:when> |
||
| 1525 | <xsl:otherwise> |
||
| 1526 | <xsl:text>. </xsl:text> |
||
| 1527 | </xsl:otherwise> |
||
| 1528 | </xsl:choose> |
||
| 1529 | </xsl:template>'; |
||
| 1530 | |||
| 1531 | // Helper template for special handling of the contents of the [html] BBCode |
||
| 1532 | $stylesheet['bbc_html'] = ' |
||
| 1533 | <xsl:template name="bbc_html_splitter"> |
||
| 1534 | <xsl:param name="bbc_string"/> |
||
| 1535 | <xsl:param name="inside_outside" select="outside"/> |
||
| 1536 | <xsl:choose> |
||
| 1537 | <xsl:when test="$inside_outside = \'outside\'"> |
||
| 1538 | <xsl:choose> |
||
| 1539 | <xsl:when test="contains($bbc_string, \'[html]\')"> |
||
| 1540 | <xsl:variable name="following_string"> |
||
| 1541 | <xsl:value-of select="substring-after($bbc_string, \'[html]\')" disable-output-escaping="yes"/> |
||
| 1542 | </xsl:variable> |
||
| 1543 | <xsl:value-of select="substring-before($bbc_string, \'[html]\')" disable-output-escaping="yes"/> |
||
| 1544 | <xsl:text>[html]</xsl:text> |
||
| 1545 | <xsl:call-template name="bbc_html_splitter"> |
||
| 1546 | <xsl:with-param name="bbc_string" select="$following_string"/> |
||
| 1547 | <xsl:with-param name="inside_outside" select="inside"/> |
||
| 1548 | </xsl:call-template> |
||
| 1549 | </xsl:when> |
||
| 1550 | <xsl:otherwise> |
||
| 1551 | <xsl:value-of select="$bbc_string" disable-output-escaping="yes"/> |
||
| 1552 | </xsl:otherwise> |
||
| 1553 | </xsl:choose> |
||
| 1554 | </xsl:when> |
||
| 1555 | <xsl:otherwise> |
||
| 1556 | <xsl:choose> |
||
| 1557 | <xsl:when test="contains($bbc_string, \'[/html]\')"> |
||
| 1558 | <xsl:variable name="following_string"> |
||
| 1559 | <xsl:value-of select="substring-after($bbc_string, \'[/html]\')" disable-output-escaping="yes"/> |
||
| 1560 | </xsl:variable> |
||
| 1561 | <xsl:value-of select="substring-before($bbc_string, \'[/html]\')" disable-output-escaping="no"/> |
||
| 1562 | <xsl:text>[/html]</xsl:text> |
||
| 1563 | <xsl:call-template name="bbc_html_splitter"> |
||
| 1564 | <xsl:with-param name="bbc_string" select="$following_string"/> |
||
| 1565 | <xsl:with-param name="inside_outside" select="outside"/> |
||
| 1566 | </xsl:call-template> |
||
| 1567 | </xsl:when> |
||
| 1568 | <xsl:otherwise> |
||
| 1569 | <xsl:value-of select="$bbc_string" disable-output-escaping="no"/> |
||
| 1570 | </xsl:otherwise> |
||
| 1571 | </xsl:choose> |
||
| 1572 | </xsl:otherwise> |
||
| 1573 | </xsl:choose> |
||
| 1574 | </xsl:template>'; |
||
| 1575 | |||
| 1576 | // Helper templates to build a page index |
||
| 1577 | $stylesheet['page_index'] = ' |
||
| 1578 | <xsl:template name="page_index"> |
||
| 1579 | <xsl:variable name="current_page" select="/*/@page"/> |
||
| 1580 | <xsl:variable name="prev_page" select="/*/@page - 1"/> |
||
| 1581 | <xsl:variable name="next_page" select="/*/@page + 1"/> |
||
| 1582 | |||
| 1583 | <div class="pagesection"> |
||
| 1584 | <div class="pagelinks floatleft"> |
||
| 1585 | |||
| 1586 | <span class="pages"> |
||
| 1587 | <xsl:value-of select="$txt_pages"/> |
||
| 1588 | </span> |
||
| 1589 | |||
| 1590 | <xsl:if test="$current_page > 1"> |
||
| 1591 | <a class="nav_page"> |
||
| 1592 | <xsl:attribute name="href"> |
||
| 1593 | <xsl:value-of select="concat($dlfilename, \'_\', $prev_page, \'.\', $ext)"/> |
||
| 1594 | </xsl:attribute> |
||
| 1595 | <span class="main_icons previous_page"></span> |
||
| 1596 | </a> |
||
| 1597 | </xsl:if> |
||
| 1598 | |||
| 1599 | <xsl:call-template name="page_links"/> |
||
| 1600 | |||
| 1601 | <xsl:if test="$current_page < $last_page"> |
||
| 1602 | <a class="nav_page"> |
||
| 1603 | <xsl:attribute name="href"> |
||
| 1604 | <xsl:value-of select="concat($dlfilename, \'_\', $next_page, \'.\', $ext)"/> |
||
| 1605 | </xsl:attribute> |
||
| 1606 | <span class="main_icons next_page"></span> |
||
| 1607 | </a> |
||
| 1608 | </xsl:if> |
||
| 1609 | </div> |
||
| 1610 | </div> |
||
| 1611 | </xsl:template> |
||
| 1612 | |||
| 1613 | <xsl:template name="page_links"> |
||
| 1614 | <xsl:param name="page_num" select="1"/> |
||
| 1615 | <xsl:variable name="current_page" select="/*/@page"/> |
||
| 1616 | <xsl:variable name="prev_page" select="/*/@page - 1"/> |
||
| 1617 | <xsl:variable name="next_page" select="/*/@page + 1"/> |
||
| 1618 | |||
| 1619 | <xsl:choose> |
||
| 1620 | <xsl:when test="$page_num = $current_page"> |
||
| 1621 | <span class="current_page"> |
||
| 1622 | <xsl:value-of select="$page_num"/> |
||
| 1623 | </span> |
||
| 1624 | </xsl:when> |
||
| 1625 | <xsl:when test="$page_num = 1 or $page_num = ($current_page - 1) or $page_num = ($current_page + 1) or $page_num = $last_page"> |
||
| 1626 | <a class="nav_page"> |
||
| 1627 | <xsl:attribute name="href"> |
||
| 1628 | <xsl:value-of select="concat($dlfilename, \'_\', $page_num, \'.\', $ext)"/> |
||
| 1629 | </xsl:attribute> |
||
| 1630 | <xsl:value-of select="$page_num"/> |
||
| 1631 | </a> |
||
| 1632 | </xsl:when> |
||
| 1633 | <xsl:when test="$page_num = 2 or $page_num = ($current_page + 2)"> |
||
| 1634 | <span class="expand_pages" onclick="$(\'.nav_page\').removeClass(\'hidden\'); $(\'.expand_pages\').hide();"> ... </span> |
||
| 1635 | <a class="nav_page hidden"> |
||
| 1636 | <xsl:attribute name="href"> |
||
| 1637 | <xsl:value-of select="concat($dlfilename, \'_\', $page_num, \'.\', $ext)"/> |
||
| 1638 | </xsl:attribute> |
||
| 1639 | <xsl:value-of select="$page_num"/> |
||
| 1640 | </a> |
||
| 1641 | </xsl:when> |
||
| 1642 | <xsl:otherwise> |
||
| 1643 | <a class="nav_page hidden"> |
||
| 1644 | <xsl:attribute name="href"> |
||
| 1645 | <xsl:value-of select="concat($dlfilename, \'_\', $page_num, \'.\', $ext)"/> |
||
| 1646 | </xsl:attribute> |
||
| 1647 | <xsl:value-of select="$page_num"/> |
||
| 1648 | </a> |
||
| 1649 | </xsl:otherwise> |
||
| 1650 | </xsl:choose> |
||
| 1651 | |||
| 1652 | <xsl:text> </xsl:text> |
||
| 1653 | |||
| 1654 | <xsl:if test="$page_num < $last_page"> |
||
| 1655 | <xsl:call-template name="page_links"> |
||
| 1656 | <xsl:with-param name="page_num" select="$page_num + 1"/> |
||
| 1657 | </xsl:call-template> |
||
| 1658 | </xsl:if> |
||
| 1659 | </xsl:template>'; |
||
| 1660 | |||
| 1661 | // Template to insert CSS and JavaScript |
||
| 1662 | $stylesheet['css_js'] = ' |
||
| 1663 | <xsl:template name="css_js">'; |
||
| 1664 | |||
| 1665 | export_load_css_js(); |
||
| 1666 | |||
| 1667 | if (!empty($context['export_css_files'])) |
||
| 1668 | { |
||
| 1669 | foreach ($context['export_css_files'] as $css_file) |
||
| 1670 | { |
||
| 1671 | $stylesheet['css_js'] .= ' |
||
| 1672 | <link rel="stylesheet"> |
||
| 1673 | <xsl:attribute name="href"> |
||
| 1674 | <xsl:text>' . $css_file['fileUrl'] . '</xsl:text> |
||
| 1675 | </xsl:attribute>'; |
||
| 1676 | |||
| 1677 | if (!empty($css_file['options']['attributes'])) |
||
| 1678 | { |
||
| 1679 | foreach ($css_file['options']['attributes'] as $key => $value) |
||
| 1680 | $stylesheet['css_js'] .= ' |
||
| 1681 | <xsl:attribute name="' . $key . '"> |
||
| 1682 | <xsl:text>' . (is_bool($value) ? $key : $value) . '</xsl:text> |
||
| 1683 | </xsl:attribute>'; |
||
| 1684 | } |
||
| 1685 | |||
| 1686 | $stylesheet['css_js'] .= ' |
||
| 1687 | </link>'; |
||
| 1688 | } |
||
| 1689 | } |
||
| 1690 | |||
| 1691 | if (!empty($context['export_css_header'])) |
||
| 1692 | { |
||
| 1693 | $stylesheet['css_js'] .= ' |
||
| 1694 | <style><![CDATA[' . "\n" . implode("\n", $context['export_css_header']) . "\n" . ']]> |
||
| 1695 | </style>'; |
||
| 1696 | } |
||
| 1697 | |||
| 1698 | if (!empty($context['export_javascript_vars'])) |
||
| 1699 | { |
||
| 1700 | $stylesheet['css_js'] .= ' |
||
| 1701 | <script><![CDATA['; |
||
| 1702 | |||
| 1703 | foreach ($context['export_javascript_vars'] as $var => $val) |
||
| 1704 | $stylesheet['css_js'] .= "\nvar " . $var . (!empty($val) ? ' = ' . $val : '') . ';'; |
||
| 1705 | |||
| 1706 | $stylesheet['css_js'] .= "\n" . ']]> |
||
| 1707 | </script>'; |
||
| 1708 | } |
||
| 1709 | |||
| 1710 | if (!empty($context['export_javascript_files'])) |
||
| 1711 | { |
||
| 1712 | foreach ($context['export_javascript_files'] as $js_file) |
||
| 1713 | { |
||
| 1714 | $stylesheet['css_js'] .= ' |
||
| 1715 | <script> |
||
| 1716 | <xsl:attribute name="src"> |
||
| 1717 | <xsl:text>' . $js_file['fileUrl'] . '</xsl:text> |
||
| 1718 | </xsl:attribute>'; |
||
| 1719 | |||
| 1720 | if (!empty($js_file['options']['attributes'])) |
||
| 1721 | { |
||
| 1722 | foreach ($js_file['options']['attributes'] as $key => $value) |
||
| 1723 | $stylesheet['css_js'] .= ' |
||
| 1724 | <xsl:attribute name="' . $key . '"> |
||
| 1725 | <xsl:text>' . (is_bool($value) ? $key : $value) . '</xsl:text> |
||
| 1726 | </xsl:attribute>'; |
||
| 1727 | } |
||
| 1728 | |||
| 1729 | $stylesheet['css_js'] .= ' |
||
| 1730 | </script>'; |
||
| 1731 | } |
||
| 1732 | } |
||
| 1733 | |||
| 1734 | if (!empty($context['export_javascript_inline']['standard'])) |
||
| 1735 | { |
||
| 1736 | $stylesheet['css_js'] .= ' |
||
| 1737 | <script><![CDATA[' . "\n" . implode("\n", $context['export_javascript_inline']['standard']) . "\n" . ']]> |
||
| 1738 | </script>'; |
||
| 1739 | } |
||
| 1740 | |||
| 1741 | if (!empty($context['export_javascript_inline']['defer'])) |
||
| 1742 | { |
||
| 1743 | $stylesheet['css_js'] .= ' |
||
| 1744 | <script><![CDATA[' . "\n" . 'window.addEventListener("DOMContentLoaded", function() {'; |
||
| 1745 | |||
| 1746 | $stylesheet['css_js'] .= "\n\t" . str_replace("\n", "\n\t", implode("\n", $context['export_javascript_inline']['defer'])); |
||
| 1747 | |||
| 1748 | $stylesheet['css_js'] .= "\n" . '});'. "\n" . ']]> |
||
| 1749 | </script>'; |
||
| 1750 | } |
||
| 1751 | |||
| 1752 | $stylesheet['css_js'] .= ' |
||
| 1753 | </xsl:template>'; |
||
| 1754 | |||
| 1755 | // End of the XSLT stylesheet |
||
| 1756 | $stylesheet['footer'] = ($format == 'XML_XSLT' ? "\t" : '') . '</xsl:stylesheet>'; |
||
| 1757 | } |
||
| 1758 | |||
| 1759 | // Let mods adjust the XSLT stylesheet. |
||
| 1760 | call_integration_hook('integrate_export_xslt_stylesheet', array(&$stylesheet, $format)); |
||
| 1761 | |||
| 1762 | // Remember for later. |
||
| 1763 | $xslt_key = isset($xslt_key) ? $xslt_key : $smcFunc['json_encode'](array($format, $uid, $xslt_variables)); |
||
| 1764 | $xslts[$xslt_key] = array('stylesheet' => implode("\n", (array) $stylesheet), 'doctype' => $doctype); |
||
| 1765 | |||
| 1766 | return $xslts[$xslt_key]; |
||
| 1767 | } |
||
| 1956 | ?> |