コード例 #1
0
ファイル: Applet.php プロジェクト: wiserweb/OpenVBX
 public function twiml($flow, $baseURI, $instance = null)
 {
     $path = $this->applet_dir . '/twiml.php';
     if (!is_null($instance)) {
         AppletInstance::setInstance($instance);
         AppletInstance::setFlow($flow);
         AppletInstance::setBaseURI($baseURI);
         FlowStore::setFlowId($flow->id);
         // Plugin directory name is the natural key until a proper guid system is developed
         $plugin = new Plugin($this->plugin_dir_name);
         PluginData::setPluginId($plugin->getPluginId());
         OpenVBX::$currentPlugin = $plugin;
         $instance = isset($instance->data) && is_array($instance->data) ? $instance->data : array();
     } else {
         $instance = isset($this->data) && is_array($this->data) ? $this->data : array();
     }
     AppletInstance::setFlowType($this->flow_type);
     if (!file_exists($path)) {
         return '';
     }
     $output = '<?xml version="1.0" ?><Response />';
     ob_start();
     require_once APPPATH . 'libraries/twilio.php';
     // require once was hampering our ability to run an applet multiple times (ie: in integration tests)
     require $path;
     $output = ob_get_contents();
     ob_end_clean();
     return $output;
 }