/home/desid573/public_html/angel/twilio-php-master/Twilio
NameSizeModeActions
Exceptions/-0755rm
Http/-0755rm
Jwt/-0755rm
Rest/-0755rm
Security/-0755rm
TaskRouter/-0755rm
TwiML/-0755rm
autoload.php53280644editdlrm
Deserialize.php5220644editdlrm
Domain.php20760644editdlrm
InstanceContext.php3040644editdlrm
InstanceResource.php4270644editdlrm
ListResource.php2980644editdlrm
Options.php2120644editdlrm
Page.php57400644editdlrm
Serialize.php24200644editdlrm
Stream.php27520644editdlrm
Twiml.php45410644editdlrm
Values.php24320644editdlrm
Version.php65210644editdlrm
VersionInfo.php2340644editdlrm
Edit: /home/desid573/public_html/angel/twilio-php-master/Twilio/Twiml.php (4541B)
element = $arg; break; case $arg === null: $this->element = new \SimpleXMLElement(''); break; case is_array($arg): $this->element = new \SimpleXMLElement(''); foreach ($arg as $name => $value) { $this->element->addAttribute($name, $value); } break; default: throw new TwimlException('Invalid argument'); } } /** * Converts method calls into Twiml verbs. * * A basic example: * * .. code-block:: php * * php> print $this->say('hello'); * hello * * An example with attributes: * * .. code-block:: php * * print $this->say('hello', array('voice' => 'woman')); * hello * * You could even just pass in an attributes array, omitting the noun: * * .. code-block:: php * * print $this->gather(array('timeout' => '20')); * * * @param string $verb The Twiml verb. * @param mixed[] $args * @return self * :param string $verb: The Twiml verb. * :param array $args: * - (noun string) * - (noun string, attributes array) * - (attributes array) * * :return: A SimpleXmlElement * :rtype: SimpleXmlElement */ public function __call($verb, array $args) { list($noun, $attrs) = $args + array('', array()); if (is_array($noun)) { list($attrs, $noun) = array($noun, ''); } /* addChild does not escape XML, while addAttribute does. This means if * you pass unescaped ampersands ("&") to addChild, you will generate * an error. * * Some inexperienced developers will pass in unescaped ampersands, and * we want to make their code work, by escaping the ampersands for them * before passing the string to addChild. (with htmlentities) * * However other people will know what to do, and their code * already escapes ampersands before passing them to addChild. We don't * want to break their existing code by turning their &'s into * & * * We also want to use numeric entities, not named entities so that we * are fully compatible with XML * * The following lines accomplish the desired behavior. */ $decoded = html_entity_decode($noun, ENT_COMPAT, 'UTF-8'); $normalized = htmlspecialchars($decoded, ENT_COMPAT, 'UTF-8', false); $hasNoun = is_scalar($noun) && strlen($noun); $child = $hasNoun ? $this->element->addChild(ucfirst($verb), $normalized) : $this->element->addChild(ucfirst($verb)); if (is_array($attrs)) { foreach ($attrs as $name => $value) { /* Note that addAttribute escapes raw ampersands by default, so we * haven't touched its implementation. So this is the matrix for * addAttribute: * * & turns into & * & turns into & */ if (is_bool($value)) { $value = ($value === true) ? 'true' : 'false'; } $child->addAttribute($name, $value); } } return new static($child); } /** * Returns the object as XML. * * :return: The response as an XML string * :rtype: string */ public function __toString() { $xml = $this->element->asXML(); return (string)str_replace( '', '', $xml); } }