1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package com.xpn.xwiki.plugin.skinx; |
22 |
|
|
23 |
|
import java.util.Collections; |
24 |
|
import java.util.Set; |
25 |
|
|
26 |
|
import org.apache.commons.lang3.BooleanUtils; |
27 |
|
import org.apache.commons.lang3.StringUtils; |
28 |
|
|
29 |
|
import com.xpn.xwiki.XWikiContext; |
30 |
|
import com.xpn.xwiki.api.Api; |
31 |
|
import com.xpn.xwiki.plugin.XWikiPluginInterface; |
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
|
|
| 97.1% |
Uncovered Elements: 1 (34) |
Complexity: 11 |
Complexity Density: 0.58 |
|
39 |
|
public class JsSkinFileExtensionPlugin extends AbstractSkinExtensionPlugin |
40 |
|
{ |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
public static final String PLUGIN_NAME = "jsfx"; |
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
public static final String DEFER_DEFAULT_PARAM = "xwiki.plugins.skinx.deferred.default"; |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
@param |
57 |
|
@param |
58 |
|
@param |
59 |
|
@see |
60 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
61 |
32 |
public JsSkinFileExtensionPlugin(String name, String className, XWikiContext context)... |
62 |
|
{ |
63 |
32 |
super(name, className, context); |
64 |
|
} |
65 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
66 |
10589 |
@Override... |
67 |
|
public String getName() |
68 |
|
{ |
69 |
10588 |
return PLUGIN_NAME; |
70 |
|
} |
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
72 |
10525 |
@Override... |
73 |
|
public Api getPluginApi(XWikiPluginInterface plugin, XWikiContext context) |
74 |
|
{ |
75 |
10525 |
return new SkinFileExtensionPluginApi((AbstractSkinExtensionPlugin) plugin, context); |
76 |
|
} |
77 |
|
|
|
|
| 95.2% |
Uncovered Elements: 1 (21) |
Complexity: 5 |
Complexity Density: 0.38 |
|
78 |
9444 |
@Override... |
79 |
|
public String getLink(String filename, XWikiContext context) |
80 |
|
{ |
81 |
9443 |
boolean forceSkinAction = BooleanUtils.toBoolean((Boolean) getParameter("forceSkinAction", filename, context)); |
82 |
9443 |
StringBuilder result = new StringBuilder("<script type='text/javascript' src='"); |
83 |
9446 |
result.append(context.getWiki().getSkinFile(filename, forceSkinAction, context)); |
84 |
9440 |
if (forceSkinAction) { |
85 |
7263 |
String parameters = StringUtils.removeStart(parametersAsQueryString(filename, context), "&"); |
86 |
7258 |
if (!StringUtils.isEmpty(parameters)) { |
87 |
3426 |
result.append("?").append(parameters); |
88 |
|
} |
89 |
|
} |
90 |
|
|
91 |
9440 |
String defaultDeferString = context.getWiki().Param(DEFER_DEFAULT_PARAM); |
92 |
9445 |
Boolean defaultDefer = (!StringUtils.isEmpty(defaultDeferString)) ? Boolean.valueOf(defaultDeferString) : true; |
93 |
9446 |
if (BooleanUtils.toBooleanDefaultIfNull((Boolean) getParameter("defer", filename, context), defaultDefer)) { |
94 |
7321 |
result.append("' defer='defer"); |
95 |
|
} |
96 |
9444 |
result.append("'></script>\n"); |
97 |
9445 |
return result.toString(); |
98 |
|
} |
99 |
|
|
100 |
|
|
101 |
|
@inheritDoc |
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
@see |
108 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
109 |
6891 |
@Override... |
110 |
|
public String endParsing(String content, XWikiContext context) |
111 |
|
{ |
112 |
6893 |
return super.endParsing(content, context); |
113 |
|
} |
114 |
|
|
115 |
|
|
116 |
|
@inheritDoc |
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
@see |
122 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
123 |
6893 |
@Override... |
124 |
|
public Set<String> getAlwaysUsedExtensions(XWikiContext context) |
125 |
|
{ |
126 |
6891 |
return Collections.emptySet(); |
127 |
|
} |
128 |
|
|
129 |
|
|
130 |
|
@inheritDoc |
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
@see |
136 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
137 |
6892 |
@Override... |
138 |
|
public boolean hasPageExtensions(XWikiContext context) |
139 |
|
{ |
140 |
6893 |
return false; |
141 |
|
} |
142 |
|
} |