1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-09 00:06:55 +02:00

Fix issue processwire/processwire-issues#153 where selector fails when there is leading comma in quoted value

This commit is contained in:
Ryan Cramer
2017-02-01 06:36:40 -05:00
parent 81adf00b8f
commit 144bd01619
2 changed files with 20 additions and 2 deletions

View File

@@ -530,7 +530,9 @@ class Selectors extends WireArray {
protected function extractValueQuick(&$str, $openingQuote, $closingQuote) { protected function extractValueQuick(&$str, $openingQuote, $closingQuote) {
// determine where value ends // determine where value ends
$commaPos = strpos("$str,", $closingQuote . ','); // "$str," just in case value is last and no trailing comma $offset = 0;
if($openingQuote) $offset++; // skip over leading quote
$commaPos = strpos("$str,", $closingQuote . ',', $offset); // "$str," just in case value is last and no trailing comma
if($commaPos === false && $closingQuote) { if($commaPos === false && $closingQuote) {
// if closing quote and comma didn't match, try to match just comma in case of "something"<space>, // if closing quote and comma didn't match, try to match just comma in case of "something"<space>,

View File

@@ -1309,7 +1309,23 @@ class ProcessPageLister extends Process implements ConfigurableModule {
$class = ''; $class = '';
$statusIcon = ''; $statusIcon = '';
$isTrash = false; $isTrash = false;
if(!strlen($value)) $value = $this->blankLabel;
if(!strlen($value)) {
// column is blank
$name = $p->name;
$maxNameLen = 20;
if(strlen($name) > $maxNameLen) {
$parts = explode('-', $name);
while(strlen($name) > $maxNameLen) {
array_pop($parts);
$name = implode('-', $parts);
}
if(!$name) $name = substr($p->name, 0, $maxNameLen);
$name .= '&hellip;';
}
$value = "$this->blankLabel <small class='ui-priority-secondary'>($name)</small>";
}
if($p->hasStatus(Page::statusHidden)) $class .= " PageListStatusHidden"; if($p->hasStatus(Page::statusHidden)) $class .= " PageListStatusHidden";
if($p->hasStatus(Page::statusUnpublished)) $class .= " PageListStatusUnpublished"; if($p->hasStatus(Page::statusUnpublished)) $class .= " PageListStatusUnpublished";
if($p->hasStatus(Page::statusLocked)) { if($p->hasStatus(Page::statusLocked)) {