Esempio n. 1
0
 public function fetch()
 {
     $selector = new Selector($this->data);
     if ($this->limit > 1) {
         return $selector->getList($this->path, $this->default);
     }
     return $selector->getOne($this->path, $this->default);
 }
Esempio n. 2
0
 public function testConstruct()
 {
     $s1 = new Selector();
     $s2 = new Selector();
     $this->assertNotEquals($s1->getInstanceId(), $s2->getInstanceId());
     $this->assertGreaterThan(0, $s1->getInstanceId());
     $this->assertGreaterThan(0, $s2->getInstanceId());
 }
Esempio n. 3
0
 /**
  * Find all information that match the path.
  *
  * @param string $contextPath Context to return
  * @param string $fieldPath   Field to be matched
  * @param string $value       Value to be matched
  *
  * @return array|null Array of contexts if found, null otherwise
  */
 public function findAll($contextPath, $fieldPath, $value)
 {
     $contextObjects = $this->getAll($contextPath);
     $foundObjects = array_filter($contextObjects, function ($item) use($fieldPath, $value) {
         $contextParser = new Selector($item);
         $foundValues = $contextParser->getAll($fieldPath);
         return in_array($value, $foundValues);
     });
     return $foundObjects;
 }
 /**
  * Given a selector string, extract it into one or more corresponding Selector objects, iterable in this object.
  *
  */
 public function __construct($selectorStr)
 {
     if (empty(self::$selectorTypes)) {
         Selector::loadSelectorTypes();
     }
     $this->extractString($selectorStr);
 }
 /**
  * @param string $name
  *
  * @throws \LogicException
  */
 private function addProperty($name = null)
 {
     if ($name === null) {
         $name = $this->currentSelector instanceof NamedSelectorInterface ? $this->currentSelector->name() : 'field' . $this->nonameCount++;
     }
     $this->projector->add(new Property($this->currentSelector, $name));
     $this->currentSelector = null;
 }
Esempio n. 6
0
 public static function makeReadable($str)
 {
     $str = Selector::normalizeWhiteSpace($str);
     // Quick test for string tokens.
     if (strpos($str, '?s') !== false) {
         $str = Crush::$process->tokens->restore($str, 's');
     }
     return $str;
 }
Esempio n. 7
0
 /**
  * Returns an array with styles that apply to the node
  * based on the $this->rules
  * 
  * @todo prioritize the rules according to w3c specifications
  * 
  * @param \DOMNode $node
  * @return array
  */
 public function getStylesFromCssRules($node)
 {
     $css_selector = new Selector($node->ownerDocument);
     $css = array();
     foreach ($this->rules as $rule) {
         $selector = $rule['selector'];
         if ($css_selector->nodeMatch($node, $selector)) {
             foreach ($rule['style'] as $style) {
                 list($k, $v) = explode(':', $style);
                 $v = trim($v, "\r\n\t ");
                 $k = trim($k, "\r\n\t ");
                 if ($k && $v !== '') {
                     $css[$k] = trim($v, "\r\n\t ");
                 }
             }
         }
     }
     return $css;
 }
Esempio n. 8
0
 public function __construct($name)
 {
     $this->name = $name;
     if (!preg_match(Regex::$patt->rooted_ident, $this->name)) {
         // Not a regular name: Some kind of selector so normalize it for later comparison.
         $this->name = Selector::makeReadable($this->name);
         // If applying the pseudo on output store.
         if (substr($this->name, -1) === '!') {
             $this->name = rtrim($this->name, ' !');
             if (preg_match('~\\:\\:?[\\w-]+$~', $this->name, $m)) {
                 $this->pseudo = $m[0];
             }
         }
     }
 }
Esempio n. 9
0
 public function GET($args)
 {
     global $database;
     $sel = new \Selector('Team');
     $sort = false;
     $sortColumn = '';
     $sortOrder = '';
     foreach ($_GET as $column => $value) {
         switch ($column) {
             case 'id':
                 $sel->filter([['Team.id', '=', $value]]);
                 break;
             case 'name':
                 if (strlen($value) < 3) {
                     $this->result = [];
                     return;
                 }
                 $value = str_replace('%', '\\%', $value);
                 $value = str_replace('[', '\\[', $value);
                 $value = str_replace(']', '\\]', $value);
                 $value = str_replace('_', '\\_', $value);
                 $value = '%' . $value . '%';
                 $sel->filter([['Team.' . $column, 'LIKE', $value]]);
                 break;
             case 'sort':
                 if ($value == 'name') {
                     $sort = true;
                     $sortColumn = 'name';
                 } elseif ($value == 'id') {
                     $sort = true;
                     $sortColumn = 'id';
                 }
                 break;
             case 'order':
                 $sortOrder = $value;
                 break;
         }
     }
     if ($sort) {
         if ($sortOrder === '') {
             $sel->order($sortColumn, 'DESC');
         } else {
             $sel->order($sortColumn, $sortOrder);
         }
     }
     $sel->limit(0, 10);
     $result = $database->select($sel);
     $this->result = $database->resultToTeams($result);
 }
Esempio n. 10
0
 public static function call($message, $context = null)
 {
     $process = Crush::$process;
     $mixable = null;
     $message = trim($message);
     // Test for mixin or abstract rule. e.g:
     //   named-mixin( 50px, rgba(0,0,0,0), left 100% )
     //   abstract-rule
     if (preg_match(Regex::make('~^(?<name>{{ident}}) {{parens}}?~xS'), $message, $message_match)) {
         $name = $message_match['name'];
         if (isset($process->mixins[$name])) {
             $mixable = $process->mixins[$name];
         } elseif (isset($process->references[$name])) {
             $mixable = $process->references[$name];
         }
     }
     // If no mixin or abstract rule matched, look for matching selector
     if (!$mixable) {
         $selector_test = Selector::makeReadable($message);
         if (isset($process->references[$selector_test])) {
             $mixable = $process->references[$selector_test];
         }
     }
     // Avoid infinite recursion.
     if (!$mixable || $mixable === $context) {
         return false;
     } elseif ($mixable instanceof Mixin) {
         $args = array();
         $raw_args = isset($message_match['parens_content']) ? trim($message_match['parens_content']) : null;
         if ($raw_args) {
             $args = Util::splitDelimList($raw_args);
         }
         return DeclarationList::parse($mixable->template->__invoke($args), array('flatten' => true, 'context' => $mixable));
     } elseif ($mixable instanceof Rule) {
         return $mixable->declarations->store;
     }
 }
Esempio n. 11
0
        $allowed = array('session', 'page', 'user');
        // @todo make the whitelist configurable
        if (!in_array($value, $allowed)) {
            return null;
        }
        $value = $this->wire($value);
        if (is_null($value)) {
            return null;
        }
        // does not resolve to API var
        if (empty($property)) {
            return (string) $value;
        }
        // no property requested, just return string value
        if (!is_object($value)) {
            return null;
        }
        // property requested, but value is not an object
        return (string) $value->{$property};
    }
    public function __toString()
    {
        $str = '';
        foreach ($this as $selector) {
            $str .= $selector->str . ", ";
        }
        return rtrim($str, ", ");
    }
}
Selector::loadSelectorTypes();
 /**
  * Special case when field is native to the pages table
  *
  * TODO not all operators will work here, so may want to add some translation or filtering
  * 
  * @param DatabaseQuerySelect $query
  * @param Selector $selector
  * @param array $fields
  * @throws PageFinderSyntaxException
  *
  */
 protected function getQueryNativeField(DatabaseQuerySelect $query, $selector, $fields)
 {
     $value = $selector->value;
     $values = is_array($value) ? $value : array($value);
     $SQL = '';
     $database = $this->wire('database');
     foreach ($fields as $field) {
         // the following fields are defined in each iteration here because they may be modified in the loop
         $table = "pages";
         $operator = $selector->operator;
         $subfield = '';
         $IDs = array();
         // populated in special cases where we can just match parent IDs
         $sql = '';
         if (strpos($field, '.')) {
             list($field, $subfield) = explode('.', $field);
         }
         if (!$this->wire('fields')->isNative($field)) {
             $subfield = $field;
             $field = 'children';
         }
         if ($field == 'child') {
             $field = 'children';
         }
         if (in_array($field, array('parent', 'parent_id', 'children'))) {
             if (strpos($field, 'parent') === 0 && (!$subfield || in_array($subfield, array('id', 'path', 'url')))) {
                 // match by location (id or path)
                 // convert parent fields like '/about/company/history' to the equivalent ID
                 foreach ($values as $k => $v) {
                     if (ctype_digit("{$v}")) {
                         continue;
                     }
                     $v = $this->wire('sanitizer')->pagePathName($v);
                     if (strpos($v, '/') === false) {
                         $v = "/{$v}";
                     }
                     // prevent a plain string with no slashes
                     // convert path to id
                     $parent = $this->wire('pages')->get($v);
                     if (!$parent instanceof NullPage) {
                         $values[$k] = $parent->id;
                     } else {
                         $values[$k] = null;
                     }
                 }
                 $field = 'parent_id';
                 if (count($values) == 1 && $selector->getOperator() === '=') {
                     $this->parent_id = reset($values);
                 }
             } else {
                 // matching by a parent's native or custom field (subfield)
                 if (!$this->wire('fields')->isNative($subfield)) {
                     $finder = new PageFinder();
                     $s = $field == 'children' ? '' : 'children.count>0, ';
                     $IDs = $finder->findIDs(new Selectors("include=all, {$s}{$subfield}{$operator}" . implode('|', $values)));
                     if (!count($IDs)) {
                         $IDs[] = -1;
                     }
                     // forced non match
                 } else {
                     // native
                     static $n = 0;
                     if ($field == 'children') {
                         $table = "_children_native" . ++$n;
                         $query->join("pages AS {$table} ON {$table}.parent_id=pages.id");
                     } else {
                         $table = "_parent_native" . ++$n;
                         $query->join("pages AS {$table} ON pages.parent_id={$table}.id");
                     }
                     $field = $subfield;
                 }
             }
         }
         if (count($IDs)) {
             // parentIDs are IDs found via another query, and we don't need to match anything other than the parent ID
             $in = $selector->not ? "NOT IN" : "IN";
             $sql .= in_array($field, array('parent', 'parent_id')) ? "{$table}.parent_id " : "{$table}.id ";
             $sql .= "{$in}(" . implode(',', $IDs) . ")";
         } else {
             foreach ($values as $value) {
                 if (is_null($value)) {
                     // an invalid/unknown walue was specified, so make sure it fails
                     $sql .= "1>2";
                     continue;
                 }
                 if (in_array($field, array('templates_id', 'template'))) {
                     // convert templates specified as a name to the numeric template ID
                     // allows selectors like 'template=my_template_name'
                     $field = 'templates_id';
                     if (count($values) == 1 && $selector->getOperator() === '=') {
                         $this->templates_id = reset($values);
                     }
                     if (!ctype_digit("{$value}")) {
                         $value = ($template = $this->fuel('templates')->get($value)) ? $template->id : 0;
                     }
                 }
                 if (in_array($field, array('created', 'modified'))) {
                     // prepare value for created or modified date fields
                     if (!ctype_digit($value)) {
                         $value = strtotime($value);
                     }
                     $value = date('Y-m-d H:i:s', $value);
                 }
                 if (in_array($field, array('id', 'parent_id', 'templates_id'))) {
                     $value = (int) $value;
                 }
                 $isName = $field === 'name' || strpos($field, 'name') === 0;
                 if ($isName && $operator == '~=') {
                     // handle one or more space-separated full words match to 'name' field in any order
                     $s = '';
                     foreach (explode(' ', $value) as $word) {
                         $word = $database->escapeStr($this->wire('sanitizer')->pageName($word));
                         $s .= ($s ? ' AND ' : '') . "{$table}.{$field} RLIKE '" . '[[:<:]]' . $word . '[[:>:]]' . "'";
                     }
                 } else {
                     if ($isName && in_array($operator, array('%=', '^=', '$=', '%^=', '%$=', '*='))) {
                         // handle partial match to 'name' field
                         $value = $database->escapeStr($this->wire('sanitizer')->pageName($value));
                         if ($operator == '^=' || $operator == '%^=') {
                             $value = "{$value}%";
                         } else {
                             if ($operator == '$=' || $operator == '%$=') {
                                 $value = "%{$value}";
                             } else {
                                 $value = "%{$value}%";
                             }
                         }
                         $s = "{$table}.{$field} LIKE '{$value}'";
                     } else {
                         if (!$database->isOperator($operator)) {
                             throw new PageFinderSyntaxException("Operator '{$operator}' is not supported for '{$field}'.");
                         } else {
                             if ($isName) {
                                 $value = $this->wire('sanitizer')->pageName($value);
                             }
                             $value = $database->escapeStr($value);
                             $s = "{$table}." . $field . $operator . (ctype_digit("{$value}") && $field != 'name' ? (int) $value : "'{$value}'");
                         }
                     }
                 }
                 if ($selector->not) {
                     $s = "NOT ({$s})";
                 }
                 if ($operator == '!=' || $selector->not) {
                     $sql .= $sql ? " AND {$s}" : "{$s}";
                 } else {
                     $sql .= $sql ? " OR {$s}" : "{$s}";
                 }
             }
         }
         if ($sql) {
             if ($SQL) {
                 $SQL .= " OR ({$sql})";
             } else {
                 $SQL .= "({$sql})";
             }
         }
     }
     if (count($fields) > 1) {
         $SQL = "({$SQL})";
     }
     $query->where($SQL);
     //$this->nativeWheres[] = $SQL;
 }
 protected function getCssAttributesToRender()
 {
     //ORDER OF THE SELECTORS IS IMPORTANT!!!!!
     //main menu selector and first un-ordered list
     $selector = new Selector($this->getID(), 'id');
     $selector->addId($this->getID() . ' ul');
     $selector->addStyle('list-style', 'none');
     //list style
     $selector->addStyle('line-height', '1');
     //this makes sure lines are 1em and not 1+.
     $borderWidth = $this->getBorderWidth();
     if (strlen($borderWidth)) {
         $borderWidth = $this->formatTRBL($borderWidth);
     }
     $borderColor = $this->getBorderColor();
     $borderStyle = $this->getBorderStyle();
     $selector->addStyle('border', $borderWidth . ' ' . $borderStyle . ' ' . '#' . $borderColor);
     $padding = $this->getPadding();
     if (strlen($padding)) {
         $selector->addStyle('padding', $this->formatTRBL($padding));
     }
     $width = $this->getWidth();
     if (strlen($width)) {
         if (is_numeric($width)) {
             $selector->addStyle('width', $width . 'em');
         } else {
             $selector->addStyle('width', $width);
         }
     }
     $selector->addStyle('margin', '0');
     //eliminate the margin
     $selector->addStyle('float', 'left');
     $background = $this->getBackColor();
     if (strlen($background)) {
         $selector->addStyle('background', '#' . $background);
     }
     $this->cssFile->addSelector($selector);
     //get the main navigation items width
     $headingWidth = $this->getHeadingWidth();
     //main menu anchor
     $selector = new Selector($this->getID() . ' a', 'id');
     $selector->addStyle('display', 'block');
     if (strlen($headingWidth)) {
         $selector->addStyle('width', $headingWidth);
     }
     $textDecoration = $this->getTextDecoration();
     if (strlen($textDecoration)) {
         $selector->addStyle('text-decoration', $textDecoration);
     }
     $color = $this->getForeColor();
     if (strlen($color)) {
         $selector->addStyle('color', '#' . $color);
     }
     $fontWeight = $this->getFontWeight();
     if (strlen($fontWeight)) {
         $selector->addStyle('font-weight', $fontWeight);
     }
     $this->cssFile->addSelector($selector);
     //main menu li
     //width is for opera
     $selector = new Selector($this->getID() . ' li', 'id');
     $selector->addStyle('float', 'left');
     if (strlen($headingWidth)) {
         $selector->addStyle('width', $headingWidth);
     }
     //$selector->addStyle('float','left');
     $this->cssFile->addSelector($selector);
     //hide the third list
     $selector = new Selector($this->getID() . ' li:hover ul ul', 'id');
     $selector->addId($this->getID() . ' li:hover ul ul ul');
     $selector->addId($this->getID() . ' li.sfhover ul ul');
     $selector->addId($this->getID() . ' li.sfhover ul ul ul');
     $selector->addStyle('left', '-999' . 'em');
     $this->cssFile->addSelector($selector);
     //unhide the second list
     $selector = new Selector($this->getID() . ' li:hover ul', 'id');
     $selector->addId($this->getID() . ' li li:hover ul', 'id');
     $selector->addId($this->getID() . ' li li li:hover ul');
     $selector->addId($this->getID() . ' li.sfhover ul');
     $selector->addId($this->getID() . ' li li.sfhover ul');
     $selector->addId($this->getID() . ' li li li.sfhover ul');
     $selector->addStyle('left', 'auto');
     $this->cssFile->addSelector($selector);
 }
Esempio n. 14
0
 /**
  * Parses the css code converting to a Css object with all selectors, properties and values.
  *
  * @param string $string_code The css code to parse
  *
  * @return Stylecow\Css The parsed css code
  */
 private static function parse($string_code)
 {
     $Css = new Css();
     while ($string_code) {
         $pos = strpos($string_code, '{');
         $pos2 = strpos($string_code, ';');
         if ($pos2 !== false && $pos2 < $pos) {
             $Css->addChild(new Css(Selector::createFromString(substr($string_code, 0, $pos2))));
             $string_code = trim(substr($string_code, $pos2 + 1));
             continue;
         }
         if ($pos === false) {
             break;
         }
         $selector = substr($string_code, 0, $pos);
         $string_code = trim(substr($string_code, $pos + 1));
         $length = strlen($string_code);
         $in = 1;
         for ($n = 0; $n <= $length; $n++) {
             $letter = $string_code[$n];
             if ($letter === '{') {
                 $in++;
                 continue;
             }
             if ($letter !== '}' || --$in) {
                 continue;
             }
             $Child = $Css->addChild(new Css(Selector::createFromString($selector)));
             $string_piece = $n === 0 ? '' : trim(substr($string_code, 0, $n - 1));
             $string_code = trim(substr($string_code, $n + 1));
             $pos = strpos($string_piece, '{');
             if ($pos === false) {
                 $properties_string = $string_piece;
                 $content_string = '';
             } else {
                 $pos = strrpos(substr($string_piece, 0, $pos), ';');
                 if ($pos !== false) {
                     $properties_string = trim(substr($string_piece, 0, $pos + 1));
                     $content_string = trim(substr($string_piece, $pos + 1));
                 } else {
                     $properties_string = '';
                     $content_string = $string_piece;
                 }
             }
             if ($properties_string) {
                 foreach (self::explodeTrim(';', $properties_string) as $property) {
                     $Child->addProperty(Property::createFromString($property));
                 }
             }
             if ($content_string) {
                 foreach (self::parse($content_string) as $child) {
                     $Child->addChild($child);
                 }
             }
             break;
         }
     }
     return $Css;
 }
Esempio n. 15
0
function fn__query($input, $context)
{
    $args = Functions::parseArgs($input);
    // Context property is required.
    if (!count($args) || !isset($context->property)) {
        return '';
    }
    list($target, $property, $fallback) = $args + array(null, $context->property, null);
    if (strtolower($property) === 'default') {
        $property = $context->property;
    }
    if (!preg_match(Regex::$patt->rooted_ident, $target)) {
        $target = Selector::makeReadable($target);
    }
    $targetRule = null;
    $references =& Crush::$process->references;
    switch (strtolower($target)) {
        case 'parent':
            $targetRule = $context->rule->parent;
            break;
        case 'previous':
            $targetRule = $context->rule->previous;
            break;
        case 'next':
            $targetRule = $context->rule->next;
            break;
        case 'top':
            $targetRule = $context->rule->parent;
            while ($targetRule && $targetRule->parent && ($targetRule = $targetRule->parent)) {
            }
            break;
        default:
            if (isset($references[$target])) {
                $targetRule = $references[$target];
            }
            break;
    }
    $result = '';
    if ($targetRule) {
        $targetRule->declarations->process();
        $targetRule->declarations->expandData('queryData', $property);
        if (isset($targetRule->declarations->queryData[$property])) {
            $result = $targetRule->declarations->queryData[$property];
        }
    }
    if ($result === '' && isset($fallback)) {
        $result = $fallback;
    }
    return $result;
}
Esempio n. 16
0
 public function testSelector()
 {
     $this->assertEquals(1, Selector::selectElements("div", $this->dom)->length, "could not select 1 div element");
     $this->assertEquals(2, Selector::selectElements(".class1,.class2", $this->dom)->length, "could not select 2 elements with class1 and class2");
 }
Esempio n. 17
0
 public function testIsXpath()
 {
     $this->assertTrue(Selector::isXPath('//div[@id="main_image"]'));
     $this->assertFalse(Selector::isXPath('.img'));
 }
Esempio n. 18
0
 public function GET($args)
 {
     global $database;
     $sel = new \Selector('Player');
     $sort = false;
     $sortColumn = '';
     $sortOrder = '';
     $limit = 10;
     foreach ($_GET as $column => $value) {
         switch ($column) {
             case 'id':
                 $sel->filter([['Player.id', '=', $value]]);
                 break;
             case 'firstname':
             case 'lastname':
                 if (strlen($value) < 3) {
                     $this->players = [];
                     return;
                 }
                 $value = str_replace('%', '\\%', $value);
                 $value = str_replace('[', '\\[', $value);
                 $value = str_replace(']', '\\]', $value);
                 $value = str_replace('_', '\\_', $value);
                 $value = '%' . $value . '%';
                 $sel->filter([['Player.' . $column, 'LIKE', $value]]);
                 break;
             case 'sort':
                 if ($value == 'match') {
                     $sort = true;
                     $sortColumn = 'playedMatches';
                     $sel->join('PlaysMatchInTeam', 'id', 'playerId');
                     $sel->group('Player.id');
                     $sel->select(['Player.*', 'COUNT(*) as playedMatches']);
                 } elseif ($value == 'goal') {
                     $sort = true;
                     $sortColumn = 'goals';
                     $sel->join('Goal', 'id', 'playerId');
                     $sel->group('Player.id');
                     $sel->select(['Player.*', 'COUNT(*) as goals']);
                 } elseif ($value == 'firstname') {
                     $sort = true;
                     $sortColumn = 'firstName';
                 }
                 break;
             case 'order':
                 $sortOrder = $value;
                 break;
             case 'search':
                 $value = str_replace('%', '\\%', $value);
                 $value = str_replace('[', '\\[', $value);
                 $value = str_replace(']', '\\]', $value);
                 $value = str_replace('_', '\\_', $value);
                 $value = explode(' ', $value);
                 $filters = [];
                 foreach ($value as $term) {
                     $filters[] = ['Player.firstname', 'LIKE ', $term];
                     $filters[] = ['Player.lastname', 'LIKE ', $term];
                 }
                 $sel->filter($filters);
                 break;
             case 'limit':
                 $limit = $value;
                 break;
         }
     }
     if ($sort) {
         if ($sortOrder === '') {
             $sel->order($sortColumn, 'DESC');
         } else {
             $sel->order($sortColumn, $sortOrder);
         }
     }
     $sel->limit(0, $limit);
     $result = $database->select($sel);
     $this->result = $database->resultToPlayers($result);
 }
Esempio n. 19
0
 /**
  * [getOne description]
  * @param  string $path    [description]
  * @param  [type] $default [description]
  * @return [type]          [description]
  */
 private function getOne($path, $default)
 {
     $selector = new Selector($this->data);
     return $selector->getOne($path, $default);
 }
 protected function getCssAttributesToRender()
 {
     $subMenuWidth = $this->getSubMenuWidth();
     $selector = new Selector($this->getID() . ' ul', 'id');
     $selector->addStyle('position', 'absolute');
     $selector->addStyle('left', '-999' . 'em');
     if (strlen($subMenuWidth)) {
         if (is_numeric($subMenuWidth)) {
             $selector->addStyle('width', $subMenuWidth . 'em');
         } else {
             $selector->addStyle('width', $subMenuWidth);
         }
     }
     $borderWidth = $this->getBorderWidth();
     $topBorder = -1;
     if (strlen($borderWidth)) {
         if (!stripos($borderWidth, 'px')) {
             if (is_numeric($borderWidth)) {
                 $topBorder -= $borderWidth;
             } else {
                 $topBorder -= rtrim($borderWidth, 'em');
             }
         }
     }
     $borderWidth = $this->getBorderWidth();
     if (!strlen($borderWidth)) {
         $borderWidth = '0px';
     }
     $borderColor = $this->getBorderColor();
     if (strlen($borderColor)) {
         $borderColor = '#' . $borderColor;
     }
     $borderStyle = $this->getBorderStyle();
     $selector->addStyle('border', $borderWidth . ' ' . $borderStyle . ' ' . $borderColor);
     $selector->addStyle('height', 'auto');
     $selector->setLevel($this->getLevel());
     $background = $this->getSubMenuBackColor();
     if (strlen($background)) {
         $selector->addStyle('background', '#' . $background);
     }
     $this->cssFile->addSelector($selector);
     //position the third lists on down
     $selector = new Selector($this->getID() . ' li ul', 'id');
     if (strlen($subMenuWidth)) {
         $selector->addStyle('margin', $topBorder . 'em 0 0 ' . $subMenuWidth);
     }
     $selector->setLevel($this->getLevel());
     $this->cssFile->addSelector($selector);
     $selector = new Selector($this->getID() . ' ul a', 'id');
     if (strlen($subMenuWidth)) {
         if (is_numeric($subMenuWidth)) {
             $selector->addStyle('width', $subMenuWidth . 'em');
         } else {
             $selector->addStyle('width', $subMenuWidth);
         }
     }
     $selector->setLevel($this->getLevel());
     $this->cssFile->addSelector($selector);
     $selector = new Selector($this->getID() . 'A', 'id');
     $background = $this->getBackColor();
     if (strlen($background)) {
         $selector->addStyle('background', '#' . $background . ' !important');
     }
     $color = $this->getForeColor();
     if (strlen($color)) {
         $selector->addStyle('color', '#' . $color);
     }
     $enabled = $this->isEnabled();
     if (!$enabled) {
         $selector->addStyle('font-weight', 'lighter !important');
     }
     $padding = $this->getPadding();
     if (strlen($padding)) {
         $selector->addStyle('padding', $padding);
     }
     $fontWeight = $this->getFontWeight();
     if (strlen($fontWeight) && $this->isEnabled()) {
         $selector->addStyle('font-weight', $fontWeight);
     }
     $selector->setLevel($this->getLevel());
     $this->cssFile->addSelector($selector);
     $selector = new Selector($this->getID() . ' :hover', 'id');
     $color = $this->getHoverColor();
     if (strlen($color)) {
         $selector->addStyle('color', '#' . $color . ' !important');
     }
     $background = $this->getHoverBack();
     if (strlen($background)) {
         $selector->addStyle('background', '#' . $background . ' !important');
     }
     $selector->setLevel($this->getLevel());
     $this->cssFile->addSelector($selector);
     $selector = new Selector($this->getID(), 'id');
     $selector->setLevel($this->getLevel());
     $this->cssFile->addSelector($selector);
 }
Esempio n. 21
0
    $csvout = $_REQUEST['csvout'];
    $csvout_checked = $csvout == 'Y' ? 'checked' : '';
}
$sql1 = "select snummer," . "achternaam||rtrim(coalesce(', '||voorvoegsel,'')) as achternaam ,roepnaam," . " sclass,sort1,sort2\n " . "  from activity_participant join activity using(act_id) join student using(snummer)" . "  join student_class using(class_id)\n" . "  where act_id={$act_id} order by sort1,sort2,sclass,achternaam,roepnaam";
$sql2 = "select snummer," . "achternaam||rtrim(coalesce(', '||voorvoegsel,'')) as achternaam ,roepnaam," . " sclass,sort1,sort2\n " . "  from activity_participant join activity using(act_id) join student using(snummer)" . "  join student_class using(class_id)\n" . "  where act_id={$act_id} order by sort1,sort2,sclass,achternaam,roepnaam";
$rainbow = new RainBow(STARTCOLOR, COLORINCREMENT_RED, COLORINCREMENT_GREEN, COLORINCREMENT_BLUE);
if ($csvout == 'Y') {
    $dbConn->queryToCSV($sql2, $filename);
    exit(0);
}
pagehead('Get activity participation');
$page_opening = "List of students attending activities";
$nav = new Navigation($tutor_navtable, basename($PHP_SELF), $page_opening);
$nav->setInterestMap($tabInterestCount);
$sql3 = "select datum||', '||' ('||act_id||', #'||coalesce(apc.count,0)||') '||rtrim(short)||'*'||part||': '||rtrim(description) as name, act_id as value," . "substr(datum::text,1,4) as namegrp\n" . " from activity left join act_part_count apc using(act_id) order by namegrp desc,datum,part";
$prjSel = new Selector($dbConn, 'act_id', $sql3, $act_id);
$act_id_selector = $prjSel->getSelector();
echo $nav->show();
?>
<div id='navmain' style='padding:1em;'>
<fieldset><legend>Select project</legend>
<form method="get" name="activity" action="<?php 
echo $PHP_SELF;
?>
">
<?php 
echo $act_id_selector;
?>
csv:
<input type='checkbox' name='csvout' <?php 
echo $csvout_checked;
Esempio n. 22
0
 public function countYellowTwoCards()
 {
     $sel = new \Selector('Cards');
     $sel->filter([['color', '=', 3]]);
     $sel->count();
     $result = $this->select($sel);
     if (count($result) != 1) {
         throw new exception('Error while counting cards');
     }
     return $result[0]['COUNT(*)'];
 }
Esempio n. 23
0
 public function GET($args)
 {
     global $database;
     $sel = new \Selector('Referee');
     $sort = false;
     $sortColumn = '';
     $sortOrder = '';
     foreach ($_GET as $column => $value) {
         switch ($column) {
             case 'id':
                 $sel->filter([['Referee.id', '=', $value]]);
                 break;
             case 'firstname':
             case 'lastname':
                 if (strlen($value) < 3) {
                     $this->players = [];
                     return;
                 }
                 $value = str_replace('%', '\\%', $value);
                 $value = str_replace('[', '\\[', $value);
                 $value = str_replace(']', '\\]', $value);
                 $value = str_replace('_', '\\_', $value);
                 $value = '%' . $value . '%';
                 $sel->filter([['Referee.' . $column, 'LIKE', $value]]);
                 break;
             case 'sort':
                 if ($value == 'firstname') {
                     $sort = true;
                     $sortColumn = 'firstname';
                 } else {
                     if ($value == 'lastName') {
                         $sort = true;
                         $sortColumn = 'lastName';
                     } else {
                         if ($value == 'id') {
                             $sort = true;
                             $sortColumn = 'id';
                         }
                     }
                 }
                 break;
             case 'order':
                 $sortOrder = $value;
                 break;
             case 'search':
                 $value = str_replace('%', '\\%', $value);
                 $value = str_replace('[', '\\[', $value);
                 $value = str_replace(']', '\\]', $value);
                 $value = str_replace('_', '\\_', $value);
                 $value = explode(' ', $value);
                 $filters = [];
                 foreach ($value as $term) {
                     $filters[] = ['Referee.firstname', 'LIKE ', '%' . $term . '%'];
                     $filters[] = ['Referee.lastname', 'LIKE ', '%' . $term . '%'];
                 }
                 $sel->filter($filters);
                 break;
         }
     }
     if ($sort) {
         if ($sortOrder === '') {
             $sel->order($sortColumn, 'DESC');
         } else {
             $sel->order($sortColumn, $sortOrder);
         }
     }
     $sel->limit(0, 10);
     $result = $database->select($sel);
     $this->result = $database->resultToReferees($result);
 }
Esempio n. 24
0
 /**
  * Parses the css code converting to a Css object with all selectors, properties and values.
  *
  * @param string $string_code The css code to parse
  * @param string $filename The original filename (used to import relative files)
  *
  * @return Stylecow\Css The parsed css code
  */
 private static function parse($string_code, $filename = null, $contextFile = null)
 {
     if ($filename) {
         $relativePath = $contextFile ? substr($filename, strlen($contextFile)) : pathinfo($filename, PATHINFO_BASENAME);
     } else {
         $relativePath = '';
     }
     $Css = $Child = new Css();
     $status = array('selector');
     $buffer = '';
     $code = explode("\n", str_replace("\n\r", "\n", $string_code));
     array_unshift($code, '');
     foreach ($code as $line => $string_line) {
         if (empty($string_line)) {
             continue;
         }
         $col = 0;
         $length = strlen($string_line);
         $char = $previousChar = null;
         $nextChar = $string_line[$col];
         while ($col < $length) {
             $previousChar = $char;
             $char = $nextChar;
             $col++;
             $nextChar = $col === $length ? null : $string_line[$col];
             switch ($char) {
                 case '"':
                     switch ($status[0]) {
                         case 'doubleQuote':
                             $buffer .= $char;
                             if ($previousChar !== '\\') {
                                 array_shift($status);
                             }
                             break;
                         case 'simpleQuote':
                             $buffer .= $char;
                             break;
                         case 'selector':
                         case 'properties':
                             $buffer .= $char;
                             array_unshift($status, 'doubleQuote');
                     }
                     break;
                 case "'":
                     switch ($status[0]) {
                         case 'simpleQuote':
                             $buffer .= $char;
                             if ($previousChar !== '\\') {
                                 array_shift($status);
                             }
                             break;
                         case 'doubleQuote':
                             $buffer .= $char;
                             break;
                         case 'selector':
                         case 'properties':
                             $buffer .= $char;
                             array_unshift($status, 'simpleQuote');
                     }
                     break;
                 case '{':
                     switch ($status[0]) {
                         case 'selector':
                         case 'properties':
                             $Child = $Child->addChild(new Css(Selector::createFromString($buffer)))->setSourceMap($line, $col, $relativePath);
                             array_unshift($status, 'properties');
                             $buffer = '';
                             break;
                     }
                     break;
                 case '}':
                     switch ($status[0]) {
                         case 'properties':
                             if (trim($buffer)) {
                                 $Child->addProperty(Property::createFromString($buffer))->setSourceMap($line, $col, $relativePath);
                             }
                             $buffer = '';
                             array_shift($status);
                             $Child = $Child->parent;
                             break;
                     }
                     break;
                 case ';':
                     switch ($status[0]) {
                         case 'selector':
                             if (strpos($buffer, '@import') === false || !is_object($Children = self::parseImport($buffer, $filename, $contextFile))) {
                                 $Child->addChild(new Css(Selector::createFromString($buffer)))->setSourceMap($line, $col, $relativePath);
                             } else {
                                 foreach ($Children->getChildren() as $Each) {
                                     $Child->addChild($Each);
                                 }
                             }
                             $buffer = '';
                             break;
                         case 'properties':
                             if (!empty($buffer)) {
                                 $Child->addProperty(Property::createFromString($buffer))->setSourceMap($line, $col, $relativePath);
                             }
                             $buffer = '';
                             break;
                     }
                     break;
                 case '/':
                     if ($status[0] !== 'comment') {
                         if ($nextChar === '*') {
                             array_unshift($status, 'comment');
                             $col++;
                             $nextNextChar = $col === $length ? null : $string_line[$col];
                             if ($nextNextChar === '/') {
                                 $col++;
                             }
                         } else {
                             $buffer .= $char;
                         }
                     } else {
                         if ($previousChar === '*') {
                             array_shift($status);
                         }
                     }
                     break;
                 default:
                     if (!isset($status[0])) {
                         $status = array('selector');
                     }
                     if ($status[0] !== 'comment') {
                         $buffer .= $char;
                     }
             }
         }
     }
     return $Css;
 }
Esempio n. 25
0
 /**
  * Converts the loaded HTML into an HTML-string with inline styles based on the loaded CSS
  *
  * @return string
  * @param  bool [optional] $outputXHTML Should we output valid XHTML?
  */
 public function convert($outputXHTML = false)
 {
     // redefine
     $outputXHTML = (bool) $outputXHTML;
     // validate
     if ($this->html == null) {
         throw new Exception('No HTML provided.');
     }
     // should we use inline style-block
     if ($this->useInlineStylesBlock) {
         // init var
         $matches = array();
         // match the style blocks
         preg_match_all('|<style(.*)>(.*)</style>|isU', $this->html, $matches);
         // any style-blocks found?
         if (!empty($matches[2])) {
             // add
             foreach ($matches[2] as $match) {
                 $this->css .= trim($match) . "\n";
             }
         }
     }
     // process css
     $cssRules = $this->processCSS();
     // create new DOMDocument
     $document = new \DOMDocument('1.0', $this->getEncoding());
     // set error level
     $internalErrors = libxml_use_internal_errors(true);
     // load HTML
     $document->loadHTML($this->html);
     // Restore error level
     libxml_use_internal_errors($internalErrors);
     // create new XPath
     $xPath = new \DOMXPath($document);
     // any rules?
     if (!empty($cssRules)) {
         // loop rules
         foreach ($cssRules as $rule) {
             $selector = new Selector($rule['selector']);
             $query = $selector->toXPath();
             if (is_null($query)) {
                 continue;
             }
             // search elements
             $elements = $xPath->query($query);
             // validate elements
             if ($elements === false) {
                 continue;
             }
             // loop found elements
             foreach ($elements as $element) {
                 // no styles stored?
                 if ($element->attributes->getNamedItem('data-css-to-inline-styles-original-styles') == null) {
                     // init var
                     $originalStyle = '';
                     if ($element->attributes->getNamedItem('style') !== null) {
                         $originalStyle = $element->attributes->getNamedItem('style')->value;
                     }
                     // store original styles
                     $element->setAttribute('data-css-to-inline-styles-original-styles', $originalStyle);
                     // clear the styles
                     $element->setAttribute('style', '');
                 }
                 // init var
                 $properties = array();
                 // get current styles
                 $stylesAttribute = $element->attributes->getNamedItem('style');
                 // any styles defined before?
                 if ($stylesAttribute !== null) {
                     // get value for the styles attribute
                     $definedStyles = (string) $stylesAttribute->value;
                     // split into properties
                     $definedProperties = $this->splitIntoProperties($definedStyles);
                     // loop properties
                     foreach ($definedProperties as $property) {
                         // validate property
                         if ($property == '') {
                             continue;
                         }
                         // split into chunks
                         $chunks = (array) explode(':', trim($property), 2);
                         // validate
                         if (!isset($chunks[1])) {
                             continue;
                         }
                         // loop chunks
                         $properties[$chunks[0]] = trim($chunks[1]);
                     }
                 }
                 // add new properties into the list
                 foreach ($rule['properties'] as $key => $value) {
                     // If one of the rules is already set and is !important, don't apply it,
                     // except if the new rule is also important.
                     if (!isset($properties[$key]) || stristr($properties[$key], '!important') === false || stristr(implode('', $value), '!important') !== false) {
                         $properties[$key] = $value;
                     }
                 }
                 // build string
                 $propertyChunks = array();
                 // build chunks
                 foreach ($properties as $key => $values) {
                     foreach ((array) $values as $value) {
                         $propertyChunks[] = $key . ': ' . $value . ';';
                     }
                 }
                 // build properties string
                 $propertiesString = implode(' ', $propertyChunks);
                 // set attribute
                 if ($propertiesString != '') {
                     $element->setAttribute('style', $propertiesString);
                 }
             }
         }
         // reapply original styles
         // search elements
         $elements = $xPath->query('//*[@data-css-to-inline-styles-original-styles]');
         // loop found elements
         foreach ($elements as $element) {
             // get the original styles
             $originalStyle = $element->attributes->getNamedItem('data-css-to-inline-styles-original-styles')->value;
             if ($originalStyle != '') {
                 $originalProperties = array();
                 $originalStyles = $this->splitIntoProperties($originalStyle);
                 foreach ($originalStyles as $property) {
                     // validate property
                     if ($property == '') {
                         continue;
                     }
                     // split into chunks
                     $chunks = (array) explode(':', trim($property), 2);
                     // validate
                     if (!isset($chunks[1])) {
                         continue;
                     }
                     // loop chunks
                     $originalProperties[$chunks[0]] = trim($chunks[1]);
                 }
                 // get current styles
                 $stylesAttribute = $element->attributes->getNamedItem('style');
                 $properties = array();
                 // any styles defined before?
                 if ($stylesAttribute !== null) {
                     // get value for the styles attribute
                     $definedStyles = (string) $stylesAttribute->value;
                     // split into properties
                     $definedProperties = $this->splitIntoProperties($definedStyles);
                     // loop properties
                     foreach ($definedProperties as $property) {
                         // validate property
                         if ($property == '') {
                             continue;
                         }
                         // split into chunks
                         $chunks = (array) explode(':', trim($property), 2);
                         // validate
                         if (!isset($chunks[1])) {
                             continue;
                         }
                         // loop chunks
                         $properties[$chunks[0]] = trim($chunks[1]);
                     }
                 }
                 // add new properties into the list
                 foreach ($originalProperties as $key => $value) {
                     $properties[$key] = $value;
                 }
                 // build string
                 $propertyChunks = array();
                 // build chunks
                 foreach ($properties as $key => $values) {
                     foreach ((array) $values as $value) {
                         $propertyChunks[] = $key . ': ' . $value . ';';
                     }
                 }
                 // build properties string
                 $propertiesString = implode(' ', $propertyChunks);
                 // set attribute
                 if ($propertiesString != '') {
                     $element->setAttribute('style', $propertiesString);
                 }
             }
             // remove placeholder
             $element->removeAttribute('data-css-to-inline-styles-original-styles');
         }
     }
     // strip original style tags if we need to
     if ($this->stripOriginalStyleTags) {
         $this->stripOriginalStyleTags($xPath);
     }
     // cleanup the HTML if we need to
     if ($this->cleanup) {
         $this->cleanupHTML($xPath);
     }
     // should we output XHTML?
     if ($outputXHTML) {
         // set formating
         $document->formatOutput = true;
         // get the HTML as XML
         $html = $document->saveXML(null, LIBXML_NOEMPTYTAG);
         // remove the XML-header
         $html = ltrim(preg_replace('/<\\?xml (.*)\\?>/', '', $html));
     } else {
         // get the HTML
         $html = $document->saveHTML();
     }
     // return
     return $html;
 }
Esempio n. 26
0
 $refreshUrl = htmlspecialchars("{$PHP_SELF}?doc_id={$doc_id}&sortorder={$sortorder}");
 $pp['downloadUrl'] = $root_url . "/downloader/{$doc_id}/" . $pp['filename'];
 $pp['file_size'] = $filesize;
 //@filesize($filepath);
 $pp['page_opening'] = "Hello {$jroepnaam} {$jvoorvoegsel} {$jachternaam} " . "<span style='font-size:6pt;'>({$snummer})</span>, " . "this the critique page. ";
 $pp['mime_type_sel'] = $mime_type;
 $pp['grp_name'] = $grp_name;
 $pp['doc_type_sel'] = $documenttype;
 if ($author == $peer_id || $hasCapSystem) {
     $pp['formstart'] = "<form method='post' action='" . $PHP_SELF . "?doc_id=" . $doc_id . "'>";
     $pp['formend'] = "</form>";
     $pp['titleinput'] = "<input type='text' size='80' name='doc_title' value='{$title}' />";
     $pp['docbutton'] = "<tr><td>To modify</td>" . "<td><input type='submit' name='doc_update' value='update'/><input type='reset'/></td></tr>";
     $mime_type_selector = new Selector($dbConn, 'mime_type', "select mime_type as name, mime_type as value from upload_mime_types order by name", $mime_type, false);
     // no auto submit.
     $doc_type_selector = new Selector($dbConn, 'doctype', "select doctype as value, description as name\n" . " from uploaddocumenttypes where prj_id={$prj_id}", $doctype, false);
     $pp['grp_sel'] = new Selector($dbConn, 'new_prjtg_id', "select prjtg_id as value, coalesce('g'||grp_num||' '''||alias||'''','g'||grp_num)||' tutor '||tutor as name \n" . "from all_prj_tutor where prjm_id={$prjm_id} order by grp_num", $prjtg_id, false);
     $pp['mime_type_sel'] = $mime_type_selector->getSelector();
     $pp['doc_type_sel'] = $doc_type_selector->getSelector();
     $checkenable = '';
 } else {
     $pp['formstart'] = '';
     $pp['formend'] = '';
     $pp['titleinput'] = $title;
     $pp['docbutton'] = '';
     $pp['mime_type_sel'] = $mime_type;
     $pp['doc_type_sel'] = $doctype;
     $checkenable = 'disabled';
 }
 $pp['groupRights'] = "Group <input type='checkbox' name='groupread' value='t' " . ($rights[0] == 't' ? 'checked' : '') . " {$checkenable} />";
 $pp['projectRights'] = "Module participants<input type='checkbox' name='projectread' value='t' " . ($rights[1] == 't' ? 'checked' : '') . " {$checkenable}  />";
Esempio n. 27
0
            $dbConn->Execute("rollback;");
        } else {
            $dbConn->transactionEnd();
        }
    } else {
        $dbConn->transactionEnd();
    }
}
// get group tables for a project
pagehead('Record task completed');
$page_opening = "Record completion of tasks for project";
$nav = new Navigation($tutor_navtable, basename($PHP_SELF), $page_opening);
$nav->setInterestMap($tabInterestCount);
$nav->show();
$sql3 = "select task_id as value,name||': '||description as name from project_task order by task_number";
$taskSel = new Selector($dbConn, 'task_id', $sql3, $task_id);
$task_id_selector = $taskSel->getSelector();
$participant = array();
$sql = "select snummer as participant from project_task_completed where task_id={$task_id}";
$resultSet = $dbConn->Execute($sql);
if ($resultSet === false) {
    print "error fetching participant data with {$sql} : " . $dbConn->ErrorMsg() . "<br/>\n";
} else {
    while (!$resultSet->EOF) {
        array_push($participant, $resultSet->fields['participant']);
        $resultSet->moveNext();
    }
}
$sql = "select st.snummer," . "achternaam||', '||roepnaam||coalesce(' '||voorvoegsel,'') as name,\n" . "'<img src=\"'||p.photo||'\" width=\\'32\\' height=\\'48\\'/>' as face,ptc.snummer as participant,ptc.mark,ptc.comment,grp_num\n" . ",trans_id,operator,date_trunc('second',ts),from_ip \n" . " from (select snummer,grp_num from prj_grp \n" . " join prj_milestone using(prjm_id) where prjm_id={$prjm_id}) pg \n" . " natural join student st \n" . " natural join portrait p \n" . " natural left join project_task pt \n" . " natural left join project_task_completed_latest ptc\n" . " natural left join transaction \n" . " where task_id={$task_id}\n" . " order by grp_num,achternaam,roepnaam";
$myRowFactory = new MyRowFactory();
$tableBuilder = new TableBuilder($dbConn, $myRowFactory);
Esempio n. 28
0
 public static function fromSelector($selector, Node $parent = null, array $children = null)
 {
     $selector = $selector instanceof Selector ? $selector : Selector::fromString($selector);
     $tag = $selector->getTag();
     $el = new static($tag ? $tag : 'div', $selector->getAttributes(), $parent, $children);
     if ($id = $selector->getId()) {
         $el->setId($id);
     }
     if ($classes = $selector->getClasses()) {
         foreach ($classes as $class) {
             $el->appendClass($class);
         }
     }
     return $el;
 }
Esempio n. 29
0
       }
    }
}
</script>
<style type="text/css">
 th, *.rs{ background:rgba(255,255,255,0.4); }
</style>
';
// get group tables for a project
pagehead2('Get presence list', $script);
$page_opening = "Presence list for students attending activities xyz";
$nav = new Navigation($tutor_navtable, basename($PHP_SELF), $page_opening);
$nav->setInterestMap($tabInterestCount);
$nav->show();
$sql3 = "select datum||', '||' ('||act_id||', #'||coalesce(apc.count,0)||') '||act_type_descr||' '||rtrim(short)" . "||'*'||part||': '||rtrim(description) as name, act_id as value," . "to_char(datum,'IYYY')||':'||milestone as namegrp\n" . " from activity join activity_type using(act_type) join prj_milestone using(prjm_id) " . "left join act_part_count apc using(act_id) \n\t" . " where prjm_id={$prjm_id}\n" . "order by namegrp desc,datum desc,part asc";
$actSel = new Selector($dbConn, 'act_id', $sql3, $act_id);
$act_id_selector = $actSel->getSelector();
$participant = array();
$sql = "select snummer as participant from activity_participant where act_id={$act_id}";
$resultSet = $dbConn->Execute($sql);
if ($resultSet === false) {
    print "error fetching participant data with {$sql} : " . $dbConn->ErrorMsg() . "<br/>\n";
} else {
    while (!$resultSet->EOF) {
        array_push($participant, $resultSet->fields['participant']);
        $resultSet->moveNext();
    }
}
$sql = "select count(*) as present from prj_grp join prj_tutor using(prjtg_id) join activity_participant using(snummer) where act_id={$act_id}\n" . " and prjm_id={$prjm_id} ";
$resultSet = $dbConn->Execute($sql);
if ($resultSet === false) {
Esempio n. 30
0
 /**
  * @covers adamblake\SimpleDb\Selector\Selector::unQuote
  */
 public function testUnQuote()
 {
     $test = array("'single'", "''double''", "'\"mixed double\"'", "'multiple' words 'outer'", "multiple 'words' \"quoted\" inner");
     $this->assertEquals('single', Selector::unQuote($test[0]));
     $this->assertEquals('double', Selector::unQuote($test[1]));
     $this->assertEquals('mixed double', Selector::unQuote($test[2]));
     $this->assertEquals("multiple' words 'outer", Selector::unQuote($test[3]));
     $this->assertEquals("multiple 'words' \"quoted\" inner", Selector::unQuote($test[4]));
 }