Permalink
Browse files

merged 2.0

  • Loading branch information...
2 parents 69b8579 + 2758673 commit 69a1bfc00cfdaab29ea67ef423a98789fddf3a23 @fabpot fabpot committed Apr 25, 2012
Showing with 29 additions and 7 deletions.
  1. +27 −5 Crawler.php
  2. +2 −2 Form.php
View
@@ -543,7 +543,7 @@ public function filter($selector)
/**
* Selects links by name or alt value for clickable images.
*
- * @param string $value The link text
+ * @param string $value The link text
*
* @return Crawler A new instance of Crawler with the filtered list of nodes
*
@@ -560,7 +560,7 @@ public function selectLink($value)
/**
* Selects a button by name or alt value for images.
*
- * @param string $value The button text
+ * @param string $value The button text
*
* @return Crawler A new instance of Crawler with the filtered list of nodes
*
@@ -578,7 +578,7 @@ public function selectButton($value)
/**
* Returns a Link object for the first node in the list.
*
- * @param string $method The method for the link (get by default)
+ * @param string $method The method for the link (get by default)
*
* @return Link A Link instance
*
@@ -617,8 +617,8 @@ public function links()
/**
* Returns a Form object for the first node in the list.
*
- * @param array $values An array of values for the form fields
- * @param string $method The method for the form
+ * @param array $values An array of values for the form fields
+ * @param string $method The method for the form
*
* @return Form A Form instance
*
@@ -641,6 +641,28 @@ public function form(array $values = null, $method = null)
return $form;
}
+ /**
+ * Converts string for XPath expressions.
+ *
+ * Escaped characters are: quotes (") and apostrophe (').
+ *
+ * Examples:
+ * <code>
+ * echo Crawler::xpathLiteral('foo " bar');
+ * //prints 'foo " bar'
+ *
+ * echo Crawler::xpathLiteral("foo ' bar");
+ * //prints "foo ' bar"
+ *
+ * echo Crawler::xpathLiteral('a\'b"c');
+ * //prints concat('a', "'", 'b"c')
+ * </code>
+ *
+ * @param string $s String to be escaped
+ *
+ * @return string Converted string
+ *
+ */
static public function xpathLiteral($s)
{
if (false === strpos($s, "'")) {
View
@@ -142,7 +142,7 @@ public function getFiles()
*/
public function getPhpValues()
{
- $qs = http_build_query($this->getValues());
+ $qs = http_build_query($this->getValues(), '', '&');
parse_str($qs, $values);
return $values;
@@ -160,7 +160,7 @@ public function getPhpValues()
*/
public function getPhpFiles()
{
- $qs = http_build_query($this->getFiles());
+ $qs = http_build_query($this->getFiles(), '', '&');
parse_str($qs, $values);
return $values;

0 comments on commit 69a1bfc

Please sign in to comment.