private function get_greeting() { $user = OpenVBX::getCurrentUser(); $voicemail_value = $user->voicemail; $json['mode'] = ''; $json['play'] = ''; $json['say'] = ''; if (!empty($voicemail_value)) { if (preg_match('/^http/i', $voicemail_value) || preg_match('/^vbx-audio-upload/i', $voicemail_value)) { $json['mode'] = 'play'; $json['play'] = $voicemail_value; if (preg_match('/^vbx-audio-upload:\\/\\/(.*)/i', $voicemail_value, $matches)) { // This is a locally hosted file, and we need to return the correct // absolute URL for the file. $json['play'] = real_site_url("audio-uploads/" . $matches[1]); } } else { $json['mode'] = 'say'; $json['say'] = $voicemail_value; } } $data['json'] = $json; if ($this->response_type != 'json') { return redirect('voicemail'); } $this->respond('', 'voicemail/greeting', $data); }
public static function getVerbForValue($value, $defaultVerb) { $matches = array(); if (empty($value)) { return $defaultVerb; } else { if (preg_match('/^vbx-audio-upload:\\/\\/(.*)/i', $value, $matches)) { // This is a locally hosted file, and we need to return the correct // absolute URL for the file. return new Play(real_site_url("audio-uploads/" . $matches[1])); } else { if (preg_match('/^http(s)?:\\/\\/(.*)/i', $value)) { // it's already an absolute URL return new Play($value); } else { return new Say($value); } } } }
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(); }
<div id="hd"> <h1 id="openvbx-logo"><a href="<?php echo real_site_url(''); echo $this->tenant->id > 1 ? $this->tenant->name . '/' : ''; ?> " class="navigate-away"><span class="replace">OpenVBX</span></a></h1> <span id="openvbx-assets" class="hide"><a href="<?php echo real_site_url(''); ?> " class="navigate-away"><span class="replace">OpenVBX</span></a></span> </div><!-- #hd -->
<div id="hd"> <h1 id="openvbx-logo"><a href="<?php echo real_site_url($this->tenant->id > 1 ? '/' . $this->tenant->name . '/' : '') . '/'; ?> " class="navigate-away"><span class="replace">OpenVBX</span></a></h1> <span id="openvbx-assets" class="hide"><a href="<?php echo asset_url(''); ?> " class="navigate-away"><span class="replace">OpenVBX</span></a></span> </div><!-- #hd -->
<?php } ?> <?php if ($resource->descriptor) { ?> <p class="row-fluid subjects"> <strong><?php _e('SUBJECTS', 'lildbi'); ?> </strong> <?php $subjects = array(); foreach ($resource->descriptor as $index => $subject) { echo "<a href='" . real_site_url($lildbi_plugin_slug) . "?filter=descriptor:\"" . $subject . "\"'>" . $subject . "</a>"; echo $index != count($resource->descriptor) - 1 ? ', ' : ''; } ?> </p> <?php } ?> </li> </ol> </div> </section> <aside id="sidebar"> <?php if ($resource->descriptor) { ?>
public static function get($plugin_dir_name, $applet_dir_name, $applet_config = null, $data = null) { $rel_plugin_path = '/plugins/' . $plugin_dir_name; $rel_applet_path = $rel_plugin_path . '/applets/' . $applet_dir_name; $plugin_path = PLUGIN_PATH . '/' . $plugin_dir_name; $applet_path = PLUGIN_PATH . '/' . $plugin_dir_name . '/applets/' . $applet_dir_name; if (!is_dir($applet_path)) { throw new AppletException("Applet_path is inaccessible: {$applet_path}"); } if (!is_object($applet_config)) { $applet_config = file_get_contents($applet_path . '/applet.json'); $applet_config = json_decode($applet_config); if (!is_object($applet_config)) { throw new AppletException("Configuration is not an object"); } } if (strpos($plugin_dir_name, "---")) { throw new AppletException("Illegel character sequence --- for plugin directory name: {$plugin_dir_name}"); } if (strpos($applet_dir_name, "---")) { throw new AppletException("Illegel character sequence --- for applet directory name: {$applet_dir_name}"); } $dir_name_regex = "[^a-zA-Z0-9-_]"; if (preg_match($dir_name_regex, $plugin_dir_name) > 0) { throw new AppletException("Illegel character sequence {$dir_name_regex} for plugin directory name: {$plugin_dir_name}"); } if (preg_match($dir_name_regex, $applet_dir_name) > 0) { throw new AppletException("Illegel character sequence {$dir_name_regex} for applet directory name: {$applet_dir_name}"); } $object = new self($applet_config); $object->id = $plugin_dir_name . '---' . $applet_dir_name; $object->plugin_dir_name = $plugin_dir_name; $object->applet_dir_name = $applet_dir_name; $object->css_class_name = empty($applet_config->css_class_name) ? $applet_dir_name : $applet_config->css_class_name; $object->plugin_path = PLUGIN_PATH . '/' . $plugin_dir_name; $object->icon_url = real_site_url($rel_applet_path . '/icon.png'); $object->icon_file = $object->plugin_path . '/applets/' . $applet_dir_name . '/icon.png'; if (!is_file($object->icon_file)) { $object->icon_file = null; $object->icon_url = real_site_url('assets/i/icon.png'); } $object->style_url = ""; if (is_file($applet_path . '/style.css')) { // We'll use add_css to add the css to the page, and add_css expects relative URLs $object->style_url = $rel_applet_path . '/style.css'; } $object->style_file = $applet_path . '/style.css'; $object->script_url = ""; if (is_file($applet_path . '/script.js')) { // We'll use add_js later to add this to the page, and add_js expects absolute URLs $object->script_url = real_site_url($rel_applet_path . '/script.js'); } $object->script_file = $applet_path . '/script.js'; $object->applet_dir = $applet_path; $object->data = $data; $object->description; return $object; }
function asset_url($uri) { return real_site_url($uri); }