• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP AppletInstance类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中AppletInstance的典型用法代码示例。如果您正苦于以下问题:PHP AppletInstance类的具体用法?PHP AppletInstance怎么用?PHP AppletInstance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了AppletInstance类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($settings = array())
 {
     $this->response = new TwimlResponse();
     $this->cookie_name = 'state-' . AppletInstance::getInstanceId();
     $this->version = AppletInstance::getValue('version', null);
     $this->callerId = AppletInstance::getValue('callerId', null);
     if (empty($this->callerId) && !empty($_REQUEST['From'])) {
         $this->callerId = $_REQUEST['From'];
     }
     /* Get current instance	 */
     $this->dial_whom_selector = AppletInstance::getValue('dial-whom-selector');
     $this->dial_whom_user_or_group = AppletInstance::getUserGroupPickerValue('dial-whom-user-or-group');
     $this->dial_whom_number = AppletInstance::getValue('dial-whom-number');
     $this->no_answer_action = AppletInstance::getValue('no-answer-action', 'hangup');
     $this->no_answer_group_voicemail = AppletInstance::getAudioSpeechPickerValue('no-answer-group-voicemail');
     $this->no_answer_redirect = AppletInstance::getDropZoneUrl('no-answer-redirect');
     $this->no_answer_redirect_number = AppletInstance::getDropZoneUrl('no-answer-redirect-number');
     $this->dial_whom_instance = get_class($this->dial_whom_user_or_group);
     if (count($settings)) {
         foreach ($settings as $setting => $value) {
             if (isset($this->{$setting})) {
                 $this->{$setting} = $value;
             }
         }
     }
 }
开发者ID:ryanlarrabure,项目名称:OpenVBX,代码行数:26,代码来源:TwimlDial.php


示例2: dropZone

 public static function dropZone($name = 'dropZone', $label = 'Drop applet here')
 {
     $link = AppletInstance::getDropZoneValue($name);
     $applet_id = null;
     $type = '';
     $icon_url = '';
     if (!empty($link) && is_string($link)) {
         $applet_id = explode('/', $link);
         $applet_id = $applet_id[count($applet_id) - 1];
     }
     if (!empty($applet_id) && isset(Applet::$flow_data[$applet_id])) {
         $applet = Applet::$flow_data[$applet_id];
         $type = $applet->type;
         $icon_url = '';
         $label = $applet->name;
         $type_parts = explode("---", $type);
         $plugin_name = $type_parts[0];
         $applet_name = $type_parts[1];
         $icon_url = real_site_url('plugins/' . $plugin_name . '/applets/' . $applet_name . '/icon.png');
     } else {
         if (!isset(Applet::$flow_data[$applet_id]) && !empty($applet_id)) {
             /* handling this gracefully in case of bad programmer */
             $applet_id = null;
             $link = null;
         }
     }
     $widget = new DropZoneWidget($name, $label, $type, $icon_url, $link);
     return $widget->render();
 }
开发者ID:howethomas,项目名称:OpenVBX,代码行数:29,代码来源:AppletUI.php


示例3: verify_day

function verify_day($key, $today)
{
    $sunday = AppletInstance::getValue('sunday[]');
    $monday = AppletInstance::getValue('monday[]');
    $tuesday = AppletInstance::getValue('tuesday[]');
    $wednesday = AppletInstance::getValue('wednesday[]');
    $thursday = AppletInstance::getValue('thursday[]');
    $friday = AppletInstance::getValue('friday[]');
    $saturday = AppletInstance::getValue('saturday[]');
    $days = array(0 => is_array($sunday) && array_key_exists($key, $sunday) ? $sunday[$key] : $sunday, 1 => is_array($monday) && array_key_exists($key, $monday) ? $monday[$key] : $monday, 2 => is_array($tuesday) && array_key_exists($key, $tuesday) ? $tuesday[$key] : $tuesday, 3 => is_array($wednesday) && array_key_exists($key, $wednesday) ? $wednesday[$key] : $wednesday, 4 => is_array($thursday) && array_key_exists($key, $thursday) ? $thursday[$key] : $thursday, 5 => is_array($friday) && array_key_exists($key, $friday) ? $friday[$key] : $friday, 6 => is_array($saturday) && array_key_exists($key, $saturday) ? $saturday[$key] : $saturday);
    return $days[$today];
}
开发者ID:e6,项目名称:OpenVBX-Plugin-Scheduling,代码行数:12,代码来源:twiml.php


示例4: day_check

function day_check($day, $key)
{
    $value = AppletInstance::getValue($day);
    if (count($value) > 1) {
        if ($value[$key] == "true") {
            return "selected";
        }
    } elseif (count($value) == "true") {
        if ($value == 1) {
            return "selected";
        }
    } else {
        return "failed";
    }
}
开发者ID:digvijay88,项目名称:OpenVBX-Plugin-Scheduling,代码行数:15,代码来源:ui.php


示例5: __construct

 public function __construct()
 {
     $this->response = new Response();
     $this->cookie_name = 'state-' . AppletInstance::getInstanceId();
     $this->version = AppletInstance::getValue('version', null);
     $this->callerId = AppletInstance::getValue('callerId', null);
     if (empty($this->callerId)) {
         $this->callerId = $_REQUEST['From'];
     }
     /* Get current instance	 */
     $this->dial_whom_selector = AppletInstance::getValue('dial-whom-selector');
     $this->dial_whom_user_or_group = AppletInstance::getUserGroupPickerValue('dial-whom-user-or-group');
     $this->dial_whom_number = AppletInstance::getValue('dial-whom-number');
     $this->no_answer_action = AppletInstance::getValue('no-answer-action', 'hangup');
     $this->no_answer_group_voicemail = AppletInstance::getAudioSpeechPickerValue('no-answer-group-voicemail');
     $this->no_answer_redirect = AppletInstance::getDropZoneUrl('no-answer-redirect');
     $this->no_answer_redirect_number = AppletInstance::getDropZoneUrl('no-answer-redirect-number');
 }
开发者ID:JeffaCubed,项目名称:OpenVBX,代码行数:18,代码来源:TwimlDial.php


示例6: get_instance

<?php

$user = OpenVBX::getCurrentUser();
$tenant_id = $user->values['tenant_id'];
$ci =& get_instance();
$queries = explode(';', file_get_contents(dirname(dirname(dirname(__FILE__))) . '/db.sql'));
foreach ($queries as $query) {
    if (trim($query)) {
        $ci->db->query($query);
    }
}
$polls = $ci->db->query(sprintf('SELECT id, name FROM polls WHERE tenant=%d', $tenant_id))->result();
$poll = AppletInstance::getValue('poll');
$poll = $poll ? $poll : count($polls) ? $polls[0]->id : null;
$options = json_decode($ci->db->query(sprintf('SELECT data FROM polls WHERE tenant=%d AND id=%d', $tenant_id, $poll))->row()->data);
$option = AppletInstance::getValue('option');
?>
<div class="vbx-applet vbx-polls">
<?php 
if (count($polls)) {
    ?>
	<div class="vbx-full-pane">
		<h3>Poll</h3>
		<fieldset class="vbx-input-container">
				<select class="medium" name="poll">
<?php 
    foreach ($polls as $p) {
        ?>
					<option value="<?php 
        echo $p->id;
        ?>
开发者ID:jsoncorwin,项目名称:OpenVBX-Plugin-Polls,代码行数:31,代码来源:ui.php


示例7: TwimlResponse

<?php

$response = new TwimlResponse();
$now = date_create('now');
$today = date_format($now, 'N') - 1;
/**
 * The names of the applet instance variables for "from" and "to" times
 * are of the form: "range_n_from" and "range_n_to" where "n"
 * is a value between 0 and 6 (inclusive). 0 represents Monday
 * and 6 represents Sunday. In PHP, the value of date_format($now, 'w')
 * for Sunday is 0 - for Monday the value is 1 - and so on.
 * Here, we need to compensate for this by checking to see if the value
 * of date_format($now, 'w') - 1 is -1, and, if so, bring Sunday
 * back into the valid range of values by setting $today to 6.
 */
if ($today == -1) {
    $today = 6;
}
$response->redirect(AppletInstance::getDropZoneUrl(($from = AppletInstance::getValue("range_{$today}_from")) && ($to = AppletInstance::getValue("range_{$today}_to")) && date_create($from) <= $now && $now < date_create($to) ? 'open' : 'closed'));
$response->respond();
开发者ID:hharrysidhu,项目名称:OpenVBX,代码行数:20,代码来源:twiml.php


示例8: array

        $zendesk_user = $CI->db->get_where('plugin_store', array('key' => 'zendesk_user'))->row();
        $zendesk_user = json_decode($zendesk_user->value);
        define('ZENDESK_URL', $zendesk_user->url);
        define('ZENDESK_EMAIL', $zendesk_user->email);
        define('ZENDESK_PASSWORD', $zendesk_user->password);
        define('ZENDESK_TIMEZONE', (int) $zendesk_user->timezone);
        // create a ticket to zendesk
        $xml = '<ticket>' . '<subject>Phone Call from ' . format_phone($_REQUEST['Caller']) . ' on ' . gmdate('M d g:i a', gmmktime() + ZENDESK_TIMEZONE * 60 * 60) . '</subject>' . '<description>' . $_REQUEST['TranscriptionText'] . "\n" . 'Recording: ' . $_REQUEST['RecordingUrl'] . '</description>' . '</ticket>';
        $new_ticket = zendesk_client('/tickets.xml', 'POST', $xml);
        $params = http_build_query($_REQUEST);
        $redirect_url = site_url('twiml/transcribe') . '?' . $params;
        header("Location: {$redirect_url}");
    } else {
        $permissions = AppletInstance::getUserGroupPickerValue('permissions');
        // get the prompt that the user configured
        $isUser = $permissions instanceof VBX_User ? TRUE : FALSE;
        if ($isUser) {
            $prompt = $permissions->voicemail;
        } else {
            $prompt = AppletInstance::getAudioSpeechPickerValue('prompt');
        }
        $verb = AudioSpeechPickerWidget::getVerbForValue($prompt, new Say("Please leave a message."));
        $response->append($verb);
        // add a <Record>, and use VBX's default transcription handle$response->addRecord(array('transcribe'=>'TRUE', 'transcribeCallback' => site_url('/twiml/transcribe') ));
        $action_url = base_url() . "twiml/applet/voice/{$flow_id}/{$instance_id}?status=save-call";
        $transcribe_url = base_url() . "twiml/applet/voice/{$flow_id}/{$instance_id}?status=transcribe-call";
        $response->addRecord(array('transcribe' => 'TRUE', 'action' => $action_url, 'transcribeCallback' => $transcribe_url));
    }
}
$response->Respond();
// send response
开发者ID:stevenyan,项目名称:Zendesk-VBX,代码行数:31,代码来源:twiml.php


示例9:

<div class="vbx-applet">

		<h2>Build your own TwiML</h2>
		<p><a href="http://www.twilio.com/docs/api/2010-04-01/twiml/" target="_blank">Learn more about TwiML</a></p>
		<fieldset class="vbx-input-container">
			<textarea name="twiml" class="large" placeholder="&lt;Say&gt;:)&lt;/Say&gt;"><?php 
echo AppletInstance::getValue('twiml');
?>
</textarea>
		</fieldset>


		<h2 class="settings-title">Next</h2>
		<p>After the message is sent, continue to the next applet</p>
		<div class="vbx-full-pane">
			<?php 
echo AppletUI::DropZone('next');
?>
		</div>

</div><!-- .vbx-applet -->
开发者ID:hharrysidhu,项目名称:OpenVBX,代码行数:21,代码来源:ui.php


示例10: define

<?php

include_once 'TwimlDial.php';
define('DIAL_COOKIE', 'state-' . AppletInstance::getInstanceId());
$CI =& get_instance();
$CI->load->library('DialList');
$dialer = new TwimlDial();
$dialer->set_state();
// Respond based on state
switch ($dialer->state) {
    case 'hangup':
        $dialer->hangup();
        break;
    case 'new':
        if ($dialer->dial_whom_selector === 'user-or-group') {
            // create a dial list from the input state
            $dial_list = DialList::get($dialer->dial_whom_user_or_group);
            $dialed = false;
            do {
                $to_dial = $dial_list->next();
                if ($to_dial instanceof VBX_User || $to_dial instanceof VBX_Device) {
                    $dialed = $dialer->dial($to_dial);
                    if ($dialed) {
                        $dialer->state = $dial_list->get_state();
                    }
                }
            } while (!$dialed && ($to_dial instanceof VBX_User || $to_dial instanceof VBX_Device));
            if (!$dialed) {
                // nobody to call, push directly to voicemail
                $dialer->noanswer();
            }
开发者ID:JeffaCubed,项目名称:OpenVBX,代码行数:31,代码来源:twiml.php


示例11: header

<?php

header("Content-type: text/xml\n");
error_reporting(E_NONE);
include "chirbit.php";
$user = AppletInstance::getUserGroupPickerValue('chirbit-controller');
$user_id = $user->values["id"];
$chirbit_username = PluginStore::get("chirbit_username_{$user_id}", "");
$chirbit_password = PluginStore::get("chirbit_password_{$user_id}", "");
$prompt = AppletInstance::getAudioSpeechPickerValue('prompt');
$after = AppletInstance::getAudioSpeechPickerValue('after');
$title = AppletInstance::getValue("title", "");
$response = new Response();
if (isset($_REQUEST['RecordingUrl'])) {
    chirbit_post($chirbit_username, $chirbit_password, $_REQUEST['RecordingUrl'], $title);
    $verb = AudioSpeechPickerWidget::getVerbForValue($after, null);
    $response->append($verb);
    $response->addHangup();
} else {
    $verb = AudioSpeechPickerWidget::getVerbForValue($prompt, null);
    $response->append($verb);
    $response->addRecord();
}
$response->Respond();
开发者ID:andrewwatson,项目名称:Chirbit-VBX-Plugin,代码行数:24,代码来源:twiml.php


示例12: define

define('DIAL_STATE_RECORDING', 'dialStateRecording');
define('DIAL_STATE_HANGUP', 'dialStateHangup');
$response = new Response();
// Default State
$state = array();
$state[DIAL_ACTION] = DIAL_STATE_DIAL;
$state[DIAL_NUMBER_INDEX] = 0;
$version = AppletInstance::getValue('version', null);
/* Get current instance	 */
$dial_whom_selector = AppletInstance::getValue('dial-whom-selector');
$dial_whom_user_or_group = AppletInstance::getUserGroupPickerValue('dial-whom-user-or-group');
$dial_whom_number = AppletInstance::getValue('dial-whom-number');
$no_answer_action = AppletInstance::getValue('no-answer-action', 'hangup');
$no_answer_group_voicemail = AppletInstance::getAudioSpeechPickerValue('no-answer-group-voicemail');
$no_answer_redirect = AppletInstance::getDropZoneUrl('no-answer-redirect');
$no_answer_redirect_number = AppletInstance::getDropZoneUrl('no-answer-redirect-number');
$numbers = array();
$voicemail = null;
if ($dial_whom_selector === 'user-or-group') {
    $dial_whom_instance = null;
    if (is_object($dial_whom_user_or_group)) {
        $dial_whom_instance = get_class($dial_whom_user_or_group);
    }
    switch ($dial_whom_instance) {
        case 'VBX_User':
            foreach ($dial_whom_user_or_group->devices as $device) {
                if ($device->is_active == 1) {
                    $numbers[] = $device->value;
                }
            }
            $voicemail = $dial_whom_user_or_group->voicemail;
开发者ID:benrasmusen,项目名称:OpenVBX,代码行数:31,代码来源:twiml.php


示例13: get_instance

<?php

$user = OpenVBX::getCurrentUser();
$tenant_id = $user->values['tenant_id'];
$ci =& get_instance();
$selected = AppletInstance::getValue('list');
$queries = explode(';', file_get_contents(dirname(dirname(dirname(__FILE__))) . '/db.sql'));
foreach ($queries as $query) {
    if (trim($query)) {
        $ci->db->query($query);
    }
}
$lists = $ci->db->query(sprintf('SELECT id, name FROM subscribers_lists WHERE tenant=%d', $tenant_id))->result();
?>
<div class="vbx-applet">
<?php 
if (count($lists)) {
    ?>
	<div class="vbx-full-pane">
		<h3>List</h3>
		<fieldset class="vbx-input-container">
				<select class="medium" name="list">
<?php 
    foreach ($lists as $list) {
        ?>
					<option value="<?php 
        echo $list->id;
        ?>
"<?php 
        echo $list->id == $selected ? ' selected="selected" ' : '';
        ?>
开发者ID:KillerDesigner,项目名称:OpenVBX-Plugin-Subscriptions,代码行数:31,代码来源:ui.php


示例14: addMessage

 public function addMessage($response, $name, $fallback)
 {
     $message = AppletInstance::getAudioSpeechPickerValue($name);
     $response->append(AudioSpeechPickerWidget::getVerbForValue($message, new Say($fallback)));
     return $response;
 }
开发者ID:HighTechTorres,项目名称:TwilioCookbook,代码行数:6,代码来源:directory.class.php


示例15: dirname

<?php

require_once dirname(__FILE__) . '/../../lib/dopplr.php';
$user = OpenVBX::getCurrentUser();
$dopplr_token = PluginData::get("dopplr_token_{$user->id}", "");
$dopplr = new Dopplr($dopplr_token);
$response = new Response();
if ($dopplr->travel_today()) {
    $response->addRedirect(AppletInstance::GetDropZoneUrl('in_transit'));
} else {
    if ($dopplr->at_home) {
        $response->addRedirect(AppletInstance::GetDropZoneUrl('at_home'));
    } else {
        $response->addRedirect(AppletInstance::GetDropZoneUrl('on_the_road'));
    }
}
$response->Respond();
开发者ID:johndbritton,项目名称:DopplrVBX,代码行数:17,代码来源:twiml.php


示例16: get_instance

<?php

$ci =& get_instance();
$moderator = AppletInstance::getUserGroupPickerValue('moderator');
$confId = AppletInstance::getValue('conf-id');
$confName = AppletInstance::getInstanceId() . $confId;
$caller = normalize_phone_to_E164(isset($_REQUEST['From']) ? $ci->input->get_post('From') : '');
$isModerator = false;
$defaultWaitUrl = 'http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient';
$waitUrl = AppletInstance::getValue('wait-url', $defaultWaitUrl);
$record = AppletInstance::getValue('record', 'do-not-record');
$hasModerator = false;
if (!is_null($moderator)) {
    $hasModerator = true;
    switch (get_class($moderator)) {
        case 'VBX_User':
            foreach ($moderator->devices as $device) {
                if ($device->value == $caller) {
                    $isModerator = true;
                }
            }
            break;
        case 'VBX_Group':
            foreach ($moderator->users as $user) {
                $user = VBX_User::get($user->user_id);
                foreach ($user->devices as $device) {
                    if ($device->value == $caller) {
                        $isModerator = true;
                    }
                }
            }
开发者ID:wiserweb,项目名称:OpenVBX,代码行数:31,代码来源:twiml.php


示例17:

<?php

$flow_type = AppletInstance::getFlowType();
$vp = AppletInstance::getValue('prompt-text');
?>
<div class="vbx-applet monkey-applet">
    <h2>Order Tracking</h2>
    <p>Enter  a custom message that your callers will be greeted by.</p>
    <textarea class="medium" name="prompt-text"><?php 
echo !empty($vp) ? AppletInstance::getValue('prompt-text') : 'Please enter your order id';
?>
</textarea>
<?php 
if ($flow_type == 'voice') {
    ?>
	<br/>
	<h2>Next</h2>
	<p>After retrieving the order id, continue to the next applet</p>
	<div class="vbx-full-pane">
		<?php 
    echo AppletUI::DropZone('next');
    ?>
	</div>
<?php 
}
?>
</div>
开发者ID:HighTechTorres,项目名称:TwilioCookbook,代码行数:27,代码来源:ui.php


示例18: get_instance

<?php

$ci =& get_instance();
/* Get the body of the SMS message */
$body = isset($_REQUEST['Body']) ? trim($ci->input->get_post('Body')) : null;
$body = strtolower($body);
$prompt = AppletInstance::getValue('prompt');
$keys = AppletInstance::getValue('keys[]');
$responses = AppletInstance::getValue('responses[]');
$menu_items = AppletInstance::assocKeyValueCombine($keys, $responses, 'strtolower');
$response = new TwimlResponse();
/* Display the menu item if we found a match - case insensitive */
if (array_key_exists($body, $menu_items) && !empty($menu_items[$body])) {
    $response_text = $menu_items[$body];
} else {
    /* Display the prompt if incorrect */
    $response_text = $prompt;
}
$response->sms($response_text);
$response->Respond();
开发者ID:hharrysidhu,项目名称:OpenVBX,代码行数:20,代码来源:twiml.php


示例19: twiml

 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;
 }
开发者ID:wiserweb,项目名称:OpenVBX,代码行数:29,代码来源:Applet.php


示例20: array

<?php

$defaultNumberOfChoices = 4;
$keys = AppletInstance::getValue('keys[]', array('1' => '', '2' => '', '3' => '', '4' => ''));
$responses = AppletInstance::getValue('responses[]');
?>

<div class="vbx-applet query-applet">

		<h2>Menu Prompt</h2>
		<fieldset class="vbx-input-container">
			<p>When the texter reaches this menu, they will read:</p>
			<textarea class="medium" name="prompt" placeholder="Tell the users your options"><?php 
echo AppletInstance::getValue('prompt');
?>
</textarea>
		</fieldset>

		<h2>Menu Options</h2>
		<table class="vbx-menu-grid options-table">
			<thead>
				<tr>
					<td>Keyword</td>
					<td>&nbsp;</td>
					<td>Reply</td>
					<td>Add &amp; Remove</td>
				</tr>
			</thead>
			<tfoot>
				<tr class="hide">
					<td>
开发者ID:hharrysidhu,项目名称:OpenVBX,代码行数:31,代码来源:ui.php



注:本文中的AppletInstance类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Application类代码示例发布时间:2022-05-23
下一篇:
PHP Apple类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap