Created
August 19, 2011 03:34
-
-
Save iaindooley/1155973 to your computer and use it in GitHub Desktop.
Revisions
-
iaindooley revised this gist
Aug 21, 2011 . No changes.There are no files selected for viewing
-
iaindooley renamed this gist
Aug 21, 2011 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
iaindooley revised this gist
Aug 19, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,7 +28,7 @@ function xpathEscape($query,$default_delim = '"') } if($current_part) $parts[] = '\''.$current_part.'\''; $ret = 'concat('.implode(',',$parts).')'; } -
iaindooley revised this gist
Aug 19, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ <?php function xpathEscape($query,$default_delim = '"') { if((strpos($query,'\'') !== FALSE) || -
iaindooley created this gist
Aug 19, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ <?php function genericXpathQuoteConcatenation($query,$default_delim = '"') { if((strpos($query,'\'') !== FALSE) || (strpos($query,'"') !== FALSE)) { $quotechars = array('\'','"'); $parts = array(); $current_part = ''; foreach(str_split($query) as $character) { if(in_array($character,$quotechars)) { $parts[] = '\''.$current_part.'\''; if($character == '\'') $parts[] = '"'.$character.'"'; else $parts[] = '\''.$character.'\''; $current_part = ''; } else $current_part .= $character; } if($current_part) $parts[] = $current_part; $ret = 'concat('.implode(',',$parts).')'; } else $ret = $default_delim.$query.$default_delim; return $ret; }