1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-12 17:54:44 +02:00
This commit is contained in:
Ryan Cramer
2023-08-25 08:37:50 -04:00
parent 8292e7d8f0
commit 92eef72fc1
2 changed files with 7 additions and 5 deletions

View File

@@ -1276,8 +1276,8 @@ class Selectors extends WireArray {
* - `getIndexType` (string): Index type to use in returned array: 'operator', 'className', 'class', or 'none' (default='class') * - `getIndexType` (string): Index type to use in returned array: 'operator', 'className', 'class', or 'none' (default='class')
* - `getValueType` (string): Value type to use in returned array: 'operator', 'class', 'className', 'label', 'description', 'compareType', 'verbose' (default='operator'). * - `getValueType` (string): Value type to use in returned array: 'operator', 'class', 'className', 'label', 'description', 'compareType', 'verbose' (default='operator').
* If 'verbose' option used then assoc array returned for each operator containing 'class', 'className', 'operator', 'compareType', 'label', 'description'. * If 'verbose' option used then assoc array returned for each operator containing 'class', 'className', 'operator', 'compareType', 'label', 'description'.
* @return array|string|int Returned array where both keys and values are operators (or values are requested 'valueType' option) * @return array|string|int Returned array where values are operators and keys are class names (or requested 'getIndexType or 'getValueType' options)
* If 'operator' option specified, return value is string, int or array (requested 'valueType'), and there is no indexType. * If 'operator' option specified, return value is string, int or array (of requested 'getValueType'), and there is no index.
* @since 3.0.154 * @since 3.0.154
* *
*/ */

View File

@@ -1900,9 +1900,11 @@ class ProcessPageLister extends Process implements ConfigurableModule {
* *
*/ */
public function removeBlankSelectors($selector) { public function removeBlankSelectors($selector) {
$selector = preg_replace('/,\s*@?[_a-z0-9]+(=|!=|<=?|>=?|%=|\^=|\$=|\*=|~=)(?=,)/i', '', ",$selector"); // $selector = preg_replace('/,\s*@?[_a-z0-9]+(=|!=|<=?|>=?|%=|\^=|\$=|\*=|~=)(?=,)/i', '', ",$selector");
$selector = trim($selector, ','); $opChars = str_replace('=', '', implode('', Selectors::getOperatorChars()));
return $selector; $regex = '/,\s*@?[_.a-z0-9]+(=|<|>|[' . $opChars . ']+=)(?=,)/i';
$selector = preg_replace($regex, '', ",$selector,");
return trim($selector, ', ');
} }