当前位置: 首页>>代码示例>>PHP>>正文


PHP AppletInstance类代码示例

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


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


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