當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FreePBX::Dashboard方法代碼示例

本文整理匯總了PHP中FreePBX::Dashboard方法的典型用法代碼示例。如果您正苦於以下問題:PHP FreePBX::Dashboard方法的具體用法?PHP FreePBX::Dashboard怎麽用?PHP FreePBX::Dashboard使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FreePBX的用法示例。


在下文中一共展示了FreePBX::Dashboard方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct()
 {
     $db = FreePBX::Database();
     $dash = FreePBX::Dashboard();
     if (!is_object($db)) {
         throw new Exception("DB isn't a Database?");
     }
     if (!is_object($dash)) {
         throw new Exception("Dash isn't an Object?");
     }
     $this->db = $db;
     $this->dash = $dash;
     // Generate a temporary 'what's next' array for lookups.
     foreach ($this->periods as $p => $i) {
         if ($this->last) {
             $this->pnext[$this->last] = $p;
             $this->last = $p;
         } else {
             $this->last = $p;
         }
     }
 }
開發者ID:lidl,項目名稱:dashboard,代碼行數:22,代碼來源:PruneHistory.class.php

示例2: getFeed

 /**
  * Get the feed from cache or retrieve it
  * @param  string $feed The feed URL
  * @return object       Reader object
  */
 private function getFeed($feed)
 {
     $reader = new Reader();
     $d = \FreePBX::Dashboard();
     $etag = $d->getConfig($feed, "etag");
     $last_modified = $d->getConfig($feed, "last_modified");
     try {
         $resource = $reader->download($feed, $last_modified, $etag);
         if ($resource->isModified()) {
             $parser = $reader->getParser($resource->getUrl(), $resource->getContent(), $resource->getEncoding());
             $content = $parser->execute();
             $etag = $resource->getEtag();
             $last_modified = $resource->getLastModified();
             $d->setConfig($feed, $content, "content");
             $d->setConfig($feed, $etag, "etag");
             $d->setConfig($feed, $last_modified, "last_modified");
         } else {
             $content = $d->getConfig($feed, "content");
         }
     } catch (\PicoFeed\PicoFeedException $e) {
         $content = $d->getConfig($feed, "content");
     }
     return $content;
 }
開發者ID:lidl,項目名稱:dashboard,代碼行數:29,代碼來源:Blogs.class.php

示例3: getURL

 private function getURL($url)
 {
     // Check to see if we've already grabbed this recently
     $d = \FreePBX::Dashboard();
     $res = $d->getConfig($url, "Blogs");
     // 3 Hours.
     $expired = time() - 10800;
     // Has this expired, or is it new?
     if (!$res || $res['timestamp'] < $expired) {
         $contents = file_get_contents($url);
         $res['timestamp'] = time();
         $res['contents'] = $contents;
         $d->setConfig($url, $res, "Blogs");
     }
     return $res['contents'];
 }
開發者ID:umjinsun12,項目名稱:dngshin,代碼行數:16,代碼來源:Blogs.class.php

示例4: genAlertGlyphicon

 private function genAlertGlyphicon($res, $tt = null)
 {
     return \FreePBX::Dashboard()->genStatusIcon($res, $tt);
 }
開發者ID:ringfreejohn,項目名稱:pbxframework,代碼行數:4,代碼來源:Overview.class.php

示例5: array

<?php

// vim: set ai ts=4 sw=4 ft=phtml:
// New Dashboard
//	License for all code of this FreePBX module can be found in the license file inside the module directory
//	Copyright 2013 Schmooze Com Inc.
//
if (!class_exists('DashboardHooks')) {
    include 'classes/DashboardHooks.class.php';
}
$allhooks = DashboardHooks::genHooks(FreePBX::Dashboard()->getConfig('visualorder'));
FreePBX::Dashboard()->setConfig('allhooks', $allhooks);
show_view(__DIR__ . '/views/main.php', array("brand" => FREEPBX::Config()->get('DASHBOARD_FREEPBX_BRAND')));
開發者ID:ringfreejohn,項目名稱:pbxframework,代碼行數:13,代碼來源:page.index.php

示例6: get_connections

 public function get_connections()
 {
     // Grab our list of extensions.
     $sql = "SELECT `id` FROM `devices` WHERE `tech` <> 'custom'";
     $alldevices = FreePBX::create()->Database->query($sql)->fetchAll(PDO::FETCH_COLUMN, 0);
     $devices = array_flip($alldevices);
     $protocols = array("sip", "iax2", "pjsip");
     $vars = array("users_online", "users_offline", "users_total", "trunks_online", "trunks_offline", "trunks_total", "registrations_online", "registrations_offline", "registrations_total");
     // Build array to return
     foreach ($protocols as $p) {
         foreach ($vars as $v) {
             $retarr[$p . "_" . $v] = 0;
         }
     }
     // Add Totals
     foreach ($vars as $v) {
         $retarr[$v] = 0;
     }
     if (!$this->astman) {
         return $retarr;
     }
     $response = $this->astman->send_request('Command', array('Command' => "sip show peers"));
     $astout = explode("\n", $response['data']);
     $blacklist = \FreePBX::Dashboard()->extIgnoreList();
     foreach ($astout as $line) {
         // Previous bug IRT trunks starting or ending with /'s here. Investigate.
         $exploded = preg_split('/\\s+/', $line);
         if (strpos($exploded[0], '/') === false) {
             $name = $exploded[0];
         } else {
             list($name, $null) = explode('/', $exploded[0]);
         }
         //prefix blacklist
         foreach ($blacklist as $num) {
             if (substr($name, 0, $num['length']) == $num['value'] && $name !== $num['value']) {
                 continue;
             }
         }
         // How to we see if a trunk is down?
         if ($exploded[1] == "(Unspecified)" || $exploded[5] == "UNREACHABLE" || $exploded[6] == "UNREACHABLE") {
             // This is a device that's down
             if (!isset($devices[$name])) {
                 // It is, actually a TRUNK that's down.
                 $retarr['sip_trunks_offline']++;
             } else {
                 $retarr['sip_users_offline']++;
             }
         } elseif (filter_var($exploded[1], FILTER_VALIDATE_IP)) {
             // This is a device that's up.
             if (!isset($devices[$name])) {
                 $retarr['sip_trunks_online']++;
             } else {
                 $retarr['sip_users_online']++;
             }
         }
         // else it's not a device.
     }
     $response = $this->astman->send_request('Command', array('Command' => "sip show registry"));
     $astout = explode("\n", $response['data']);
     $pos = false;
     foreach ($astout as $line) {
         if (trim($line) != '') {
             if ($pos === false) {
                 // find the position of "State" in the first line
                 $pos = strpos($line, "State");
             } else {
                 // subsequent lines, check if it says "Registered" at that position
                 if (substr($line, $pos, 10) == "Registered") {
                     $retarr['sip_registrations_online']++;
                 } elseif (strlen($line) > $pos) {
                     $retarr['sip_registrations_offline']++;
                 }
             }
         }
     }
     $response = $this->astman->send_request('Command', array('Command' => "iax2 show peers"));
     $astout = explode("\n", $response['data']);
     foreach ($astout as $line) {
         if (preg_match('/^(([a-z0-9\\-_]+)(\\/([a-z0-9\\-_]+))?)\\s+(\\([a-z]+\\)|\\d{1,3}(\\.\\d{1,3}){3})/i', $line, $matches)) {
             //matches: [2] = name, [4] = username, [5] = host, [6] = part of ip (if IP)
             // have an IP address listed, so its online
             $online = !empty($matches[6]);
             if (!isset($devices[$matches[2]])) {
                 // this is a trunk
                 //TODO match trunk tech as well?
                 $retarr['iax2_trunks_' . ($online ? 'online' : 'offline')]++;
             } else {
                 $retarr['iax2_users_' . ($online ? 'online' : 'offline')]++;
             }
         }
     }
     $response = $this->astman->send_request('Command', array('Command' => "iax2 show registry"));
     $astout = explode("\n", $response['data']);
     $pos = false;
     foreach ($astout as $line) {
         if (trim($line) != '') {
             if ($pos === false) {
                 // find the position of "State" in the first line
                 $pos = strpos($line, "State");
             } else {
//.........這裏部分代碼省略.........
開發者ID:lidl,項目名稱:dashboard,代碼行數:101,代碼來源:AsteriskInfo.class.php

示例7: exit

// Copyright 2013 Schmooze Com Inc.
//
// Dashboard Scheduler.
// Runs every minute.
//
// Start quickly.
$bootstrap_settings['freepbx_auth'] = false;
// Just in case.
$restrict_mods = true;
// Takes startup from 0.2 seconds to 0.07 seconds.
include '/etc/freepbx.conf';
$astrundir = \FreePBX::Config()->get('ASTRUNDIR');
if (!is_dir($astrundir) || !is_writable($astrundir)) {
    echo "Asterisk Run Dir [" . $astrundir . "] is missing or not writable! Is Asterisk running?\n";
    exit(1);
}
$lockfile = $astrundir . "/scheduler.lock";
// Sleep to fix crazy issues with large VM hosting providers
sleep(mt_rand(1, 30));
// Create a lock to make sure no more than one instance of this
// program can be running on a machine at a time
$fh = fopen($lockfile, "a");
if (!$fh || !flock($fh, LOCK_EX | LOCK_NB)) {
    // Unable to lock, we're already running.
    exit;
}
// Run the trigger
\FreePBX::Dashboard()->runTrigger();
// remove lockfile, and then close handle to release kernel lock
unlink($lockfile);
fclose($fh);
開發者ID:ringfreejohn,項目名稱:pbxframework,代碼行數:31,代碼來源:scheduler.php


注:本文中的FreePBX::Dashboard方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。