protected function EasyRdf_Serialiser_GraphViz::escape in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/GraphViz.php \EasyRdf_Serialiser_GraphViz::escape()
Internal function to escape a string into DOT safe syntax
@ignore
3 calls to EasyRdf_Serialiser_GraphViz::escape()
- EasyRdf_Serialiser_GraphViz::escapeAttributes in vendor/easyrdf/ easyrdf/ lib/ EasyRdf/ Serialiser/ GraphViz.php 
- Internal function to escape an associate array of attributes and turns it into a DOT notation string
- EasyRdf_Serialiser_GraphViz::serialiseDot in vendor/easyrdf/ easyrdf/ lib/ EasyRdf/ Serialiser/ GraphViz.php 
- Internal function to serialise an EasyRdf_Graph into a DOT formatted string
- EasyRdf_Serialiser_GraphViz::serialiseRow in vendor/easyrdf/ easyrdf/ lib/ EasyRdf/ Serialiser/ GraphViz.php 
- Internal function to create dot syntax line for either a node or an edge
File
- vendor/easyrdf/ easyrdf/ lib/ EasyRdf/ Serialiser/ GraphViz.php, line 202 
Class
- EasyRdf_Serialiser_GraphViz
- Class to serialise an EasyRdf_Graph to GraphViz
Code
protected function escape($input) {
  if (preg_match('/^([a-z_][a-z_0-9]*|-?(\\.[0-9]+|[0-9]+(\\.[0-9]*)?))$/i', $input)) {
    return $input;
  }
  else {
    return '"' . str_replace(array(
      "\r\n",
      "\n",
      "\r",
      '"',
    ), array(
      '\\n',
      '\\n',
      '\\n',
      '\\"',
    ), $input) . '"';
  }
}