/home/desid573/public_html/family/pdd/app/Vendor/Services/Twilio
NameSizeModeActions
Auth/-0755rm
Rest/-0755rm
TaskRouter/-0755rm
AccessToken.php29970644editdlrm
AutoPagingIterator.php28340644editdlrm
Capability.php54090644editdlrm
HttpException.php680644editdlrm
HttpStream.php30150644editdlrm
InstanceResource.php27960644editdlrm
IPMessagingInstanceResource.php4870644editdlrm
IPMessagingListResource.php6390644editdlrm
JWT.php52750644editdlrm
ListResource.php62270644editdlrm
LookupsInstanceResource.php4790644editdlrm
LookupsListResource.php12750644editdlrm
MonitorInstanceResource.php4790644editdlrm
MonitorListResource.php6310644editdlrm
NextGenInstanceResource.php6900644editdlrm
NextGenListResource.php18100644editdlrm
NumberType.php10760644editdlrm
Page.php14140644editdlrm
PartialApplicationHelper.php10670644editdlrm
PricingInstanceResource.php4770644editdlrm
PricingListResource.php3950644editdlrm
RequestValidator.php17140644editdlrm
Resource.php36970644editdlrm
RestException.php10920644editdlrm
SIPListResource.php3860644editdlrm
TaskRouterInstanceResource.php7250644editdlrm
TaskRouterListResource.php8780644editdlrm
TimeRangeResource.php11460644editdlrm
TinyHttp.php45820644editdlrm
TrunkingInstanceResource.php4810644editdlrm
TrunkingListResource.php11600644editdlrm
Twiml.php43730644editdlrm
UsageResource.php6610644editdlrm
WorkflowConfiguration.php25390644editdlrm
Edit: /home/desid573/public_html/family/pdd/app/Vendor/Services/Twilio/Twiml.php (4373B)
* License: http://creativecommons.org/licenses/MIT/ MIT */ class Services_Twilio_Twiml { protected $element; /** * Constructs a Twiml response. * * :param SimpleXmlElement|array $arg: Can be any of * * - the element to wrap * - attributes to add to the element * - if null, initialize an empty element named 'Response' */ public function __construct($arg = null) { switch (true) { case $arg instanceof SimpleXmlElement: $this->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 Services_Twilio_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 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); $child = empty($noun) ? $this->element->addChild(ucfirst($verb)) : $this->element->addChild(ucfirst($verb), $normalized); 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 str_replace( '', '', $xml); } }