Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F847848
D330.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Apr 19, 7:00 PM
Size
3 KB
Mime Type
text/x-diff
Expires
Sun, Apr 20, 7:00 PM (16 m, 11 s)
Engine
blob
Format
Raw Data
Handle
602635
Attached To
D330: INP-1730 - Add param/skip_param support for "key" parameter of "m_Cache" tag
D330.diff
View Options
Index: core/kernel/nparser/nparser.php
===================================================================
--- core/kernel/nparser/nparser.php
+++ core/kernel/nparser/nparser.php
@@ -1038,15 +1038,17 @@
* skip_prefix_id:<prefix1>[,<prefix2>,<prefix3>] - exclude id-based serial for given prefix(-es)
* var:<aaa>[,<bbb>,<ccc>] - include request variable value(-s)
* skip_var:<varA>[,<varB>,<varC>] - exclude request variable value(-s)
+ * param:<aaa>[,<bbb>,<ccc>] - include template parameter value(-s)
+ * skip_param:<paramA>[,<paramB>,<paramC>] - exclude template parameter value(-s)
* (%variable_name) - include request variable value (only value without variable name ifself, like in "var:variable_name")
* [%SerialName%] - use to retrieve serial value in free form
*/
// 3. get variable names, prefixes and prefix ids, that should be skipped
- $skip_prefixes = $skip_prefix_ids = $skip_variables = Array ();
+ $skip_prefixes = $skip_prefix_ids = $skip_variables = $skip_params = Array ();
foreach ($keys as $index => $key) {
- if (preg_match('/^(skip_var|skip_prefix|skip_prefix_id):(.*?)$/i', $key, $regs)) {
+ if (preg_match('/^(skip_var|skip_param|skip_prefix|skip_prefix_id):(.*?)$/i', $key, $regs)) {
unset($keys[$index]);
$tmp_parts = explode(',', $regs[2]);
@@ -1055,6 +1057,10 @@
$skip_variables = array_merge($skip_variables, $tmp_parts);
break;
+ case 'skip_param':
+ $skip_params = array_merge($skip_params, $tmp_parts);
+ break;
+
case 'skip_prefix':
$skip_prefixes = array_merge($skip_prefixes, $tmp_parts);
break;
@@ -1068,23 +1074,37 @@
$skip_prefixes = array_unique($skip_prefixes);
$skip_variables = array_unique($skip_variables);
+ $skip_params = array_unique($skip_params);
$skip_prefix_ids = array_unique($skip_prefix_ids);
// 4. process keys
foreach ($keys as $key) {
- if (preg_match('/^(var|prefix|prefix_id):(.*?)$/i', $key, $regs)) {
+ if (preg_match('/^(var|param|prefix|prefix_id):(.*?)$/i', $key, $regs)) {
$tmp_parts = explode(',', $regs[2]);
switch ($regs[1]) {
case 'var':
- // format: "var:country_id" will become "country_id=<country_id>"
+ // format: "var:country_id" will become "r:country_id=<country_id>"
$tmp_parts = array_diff($tmp_parts, $skip_variables);
foreach ($tmp_parts as $variable_name) {
$variable_value = $this->Application->GetVar($variable_name);
if ($variable_value !== false) {
- $parts[] = $variable_name . '=' . $variable_value;
+ $parts[] = 'r:' . $variable_name . '=' . $variable_value;
+ }
+ }
+ break;
+
+ case 'param':
+ // format: "param:country_id" will become "p:country_id=<country_id>"
+ $tmp_parts = array_diff($tmp_parts, $skip_params);
+
+ foreach ($tmp_parts as $param_name) {
+ $param_value = $this->GetParam($param_name);
+
+ if ($param_value !== false) {
+ $parts[] = 'p:' . $param_name . '=' . $param_value;
}
}
break;
@@ -1128,11 +1148,11 @@
}
elseif ($key == 'currency') {
// based on current currency
- $parts[] = 'curr_iso=' . $this->Application->RecallVar('curr_iso');
+ $parts[] = 's:curr_iso=' . $this->Application->RecallVar('curr_iso');
}
elseif ($key == 'groups') {
// based on logged-in user groups
- $parts[] = 'groups=' . $this->Application->RecallVar('UserGroups');
+ $parts[] = 's:groups=' . $this->Application->RecallVar('UserGroups');
}
elseif ($key == 'guest_only') {
// we know this key, but process it at method beginning
Event Timeline
Log In to Comment