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

PHP nicecase函数代码示例

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

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



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

示例1: html_callback

/**
 * Used for replace some strings at end of run all html scripts
 *
 * @param string $buffer HTML buffer from ob_start()
 * @return string Changed buffer
 */
function html_callback($buffer)
{
    global $config;
    // Install registered CSS/JS links
    $types = array('css' => '  <link href="STRING?v=' . OBSERVIUM_VERSION . '" rel="stylesheet" type="text/css" />' . PHP_EOL, 'js' => '  <script type="text/javascript" src="STRING?v=' . OBSERVIUM_VERSION . '"></script>' . PHP_EOL, 'script' => '  <script type="text/javascript">' . PHP_EOL . '  <!-- Begin' . PHP_EOL . 'STRING' . PHP_EOL . '  // End -->' . PHP_EOL . '  </script>' . PHP_EOL);
    foreach ($types as $type => $string) {
        if (isset($GLOBALS['cache_html']['resources'][$type])) {
            $uptype = strtoupper($type);
            ${$type} = '<!-- ' . $uptype . ' BEGIN -->' . PHP_EOL;
            foreach (array_unique($GLOBALS['cache_html']['resources'][$type]) as $link) {
                ${$type} .= str_replace('STRING', $link, $string);
            }
            ${$type} .= '  <!-- ' . $uptype . ' END -->' . PHP_EOL;
            $buffer = str_replace('<!-- ##' . $uptype . '_CACHE## -->' . PHP_EOL, ${$type}, $buffer);
        }
    }
    // Replace page title as specified by the page modules
    if (!is_array($GLOBALS['cache_html']['title'])) {
        // Title not set by any page, fall back to nicecase'd page name:
        if ($GLOBALS['vars']['page']) {
            $GLOBALS['cache_html']['title'] = array(nicecase($GLOBALS['vars']['page']));
        } else {
            // HALP. Likely main page, doesn't need anything else...
            $GLOBALS['cache_html']['title'] = array();
        }
    }
    // If suffix is set, put it in the back
    if ($config['page_title_suffix']) {
        $GLOBALS['cache_html']['title'][] = $config['page_title_suffix'];
    }
    // If prefix is set, put it in front
    if ($config['page_title_prefix']) {
        array_unshift($GLOBALS['cache_html']['title'], $config['page_title_prefix']);
    }
    // Build title with separators
    $title = implode($config['page_title_separator'], $GLOBALS['cache_html']['title']);
    // Replace title placeholder by actual title
    $buffer = str_replace('##TITLE##', $title, $buffer);
    // Page panel
    $buffer = str_replace('##PAGE_PANEL##', $GLOBALS['cache_html']['page_panel'], $buffer);
    // Return modified HTML page source
    return $buffer;
}
开发者ID:Natolumin,项目名称:observium,代码行数:49,代码来源:functions.inc.php


示例2: generate_entity_popup_graphs

function generate_entity_popup_graphs($entity, $vars)
{
    global $config;
    $entity_type = $vars['entity_type'];
    if (is_array($config['entities'][$entity_type]['graph'])) {
        if (isset($config['entities'][$entity_type]['graph']['type'])) {
            $graphs[] = $config['entities'][$entity_type]['graph'];
        } else {
            $graphs = $config['entities'][$entity_type]['graph'];
        }
        foreach ($graphs as $graph_array) {
            //$graph_array = $config['entities'][$entity_type]['graph'];
            // We can draw a graph for this type/metric pair!
            foreach ($graph_array as $key => $val) {
                // Check to see if we need to do any substitution
                if (substr($val, 0, 1) == "@") {
                    $nval = substr($val, 1);
                    $graph_array[$key] = $entity[$nval];
                }
            }
            $graph_array['height'] = "100";
            $graph_array['width'] = "323";
            $content = '<div style="white-space: nowrap;">';
            $content .= "<div class=entity-title><h4>" . nicecase(str_replace("_", " ", $graph_array['type'])) . "</h4></div>";
            /*
            $content = generate_box_open(array('title' => nicecase(str_replace("_", " ", $graph_array['type'])),
                                               'body-style' => 'white-space: nowrap;'));
            */
            foreach (array('day', 'month') as $period) {
                $graph_array['from'] = $config['time'][$period];
                $content .= generate_graph_tag($graph_array);
            }
            $content .= "</div>";
            //$content .= generate_box_close();
        }
        //r($content);
        return $content;
    }
}
开发者ID:Natolumin,项目名称:observium,代码行数:39,代码来源:generic.inc.php


示例3: foreach

//                      'poller_perf' => 'Poll Time'
//                      );
foreach (array('graphs') as $type) {
    /// FIXME. Weird graph menu, they too long and not actual for all devices,
    /// but here also not posible use sql query from `device_graphs` because here not stored all graphs
    /*
    $query  = 'SELECT `graph` FROM `device_graphs`
               LEFT JOIN `devices` ON `devices`.`device_id` = `device_graphs`.`device_id`';
    $query .= $where . $query_permitted . ' AND `device_graphs`.`enabled` = 1 GROUP BY `graph`';
    foreach (dbFetchColumn($query) as $option)
    {
      $data = $config['graph_types']['device'][$option];
    */
    foreach ($config['graph_types']['device'] as $option => $data) {
        if (!isset($data['descr'])) {
            $data['descr'] = nicecase($option);
        }
        if ($vars['format'] == $type && $vars['graph'] == $option) {
            $navbar['options'][$type]['suboptions'][$option]['class'] = 'active';
            $navbar['options'][$type]['text'] .= " (" . $data['descr'] . ')';
        }
        $navbar['options'][$type]['suboptions'][$option]['text'] = $data['descr'];
        $navbar['options'][$type]['suboptions'][$option]['url'] = generate_url($vars, array('view' => NULL, 'format' => $type, 'graph' => $option));
    }
}
if ($vars['searchbar'] == "hide") {
    $navbar['options_right']['searchbar'] = array('text' => 'Show Search', 'url' => generate_url($vars, array('searchbar' => NULL)));
} else {
    $navbar['options_right']['searchbar'] = array('text' => 'Hide Search', 'url' => generate_url($vars, array('searchbar' => 'hide')));
}
if ($vars['bare'] == "yes") {
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:devices.inc.php


示例4: testNiceCase

 /**
  * @dataProvider providerNiceCase
  */
 public function testNiceCase($string, $result)
 {
     $this->assertSame($result, nicecase($string));
 }
开发者ID:skive,项目名称:observium,代码行数:7,代码来源:HtmlIncludesFunctionsTest.php


示例5: rewrite_entity_name

 $oid = ".1.3.6.1.2.1.99.1.1.1.4.{$index}";
 $type = $entitysensor[$entry['entPhySensorType']];
 $descr = rewrite_entity_name($entry['entPhysicalDescr']);
 if ($entry['entPhysicalDescr'] && $entry['entPhysicalName']) {
     // Check if entPhysicalDescr equals entPhysicalName,
     // Also compare like this: 'TenGigabitEthernet2/1 Bias Current' and 'Te2/1 Bias Current'
     if (strpos($entry['entPhysicalDescr'], substr($entry['entPhysicalName'], 2)) === FALSE) {
         $descr = rewrite_entity_name($entry['entPhysicalDescr']) . ' - ' . rewrite_entity_name($entry['entPhysicalName']);
     }
 } else {
     if (!$entry['entPhysicalDescr'] && $entry['entPhysicalName']) {
         $descr = rewrite_entity_name($entry['entPhysicalName']);
     } else {
         if (!$entry['entPhysicalDescr'] && !$entry['entPhysicalName']) {
             // This is also trick for some retard devices like NetMan Plus
             $descr = nicecase($type);
         }
     }
 }
 if ($device['os'] == 'asa' && $entry['entPhySensorScale'] == 'yocto' && $entry['entPhySensorPrecision'] == '0') {
     // Hardcoded fix for Cisco ASA 9.1.5 (can be other) bug when all scales equals yocto (OBSERVIUM-1110)
     $scale = 1;
 } else {
     if (isset($entry['entPhySensorScale'])) {
         $scale = si_to_scale($entry['entPhySensorScale'], $entry['entPhySensorPrecision']);
     } else {
         // Some devices not report scales, like NetMan Plus. But this is really HACK
         // Heh, I not know why only ups.. I'm not sure that this for all ups.. just I see this only on NetMan Plus.
         $scale = $device['os_group'] == 'ups' && $type == 'temperature' ? 0.1 : 1;
     }
 }
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:entity-sensor-mib.inc.php


示例6: dbFetchCell

          </ul>
        </li>
<?php 
$app_count = dbFetchCell("SELECT COUNT(`app_id`) FROM `applications`");
if ($_SESSION['userlevel'] >= '5' && $app_count > "0") {
    ?>
        <li class="dropdown">
          <a href="apps/" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><img src="images/icons/apps.png" border="0" align="absmiddle" /> Apps<b class="caret"></b></a>
          <ul class="dropdown-menu">
<?php 
    $app_list = dbFetchRows("SELECT `app_type` FROM `applications` GROUP BY `app_type` ORDER BY `app_type`");
    foreach ($app_list as $app) {
        $image = $config['html_dir'] . "/images/icons/" . $row['app_type'] . ".png";
        $icon = file_exists($image) ? $row['app_type'] : "apps";
        echo '
            <li><a href="apps/app=' . $app['app_type'] . '/"><img src="images/icons/' . $icon . '.png" border="0" align="absmiddle" /> ' . nicecase($app['app_type']) . ' </a></li>';
    }
    ?>
          </ul>
        </li>    
<?php 
}
$routing_count['bgp'] = dbFetchCell("SELECT COUNT(bgpPeer_id) from `bgpPeers` LEFT JOIN devices AS D ON bgpPeers.device_id=D.device_id WHERE D.device_id IS NOT NULL");
$routing_count['ospf'] = dbFetchCell("SELECT COUNT(ospf_instance_id) FROM `ospf_instances` WHERE `ospfAdminStat` = 'enabled'");
$routing_count['cef'] = dbFetchCell("SELECT COUNT(cef_switching_id) from `cef_switching`");
$routing_count['vrf'] = dbFetchCell("SELECT COUNT(vrf_id) from `vrfs`");
if ($_SESSION['userlevel'] >= '5' && $routing_count['bgp'] + $routing_count['ospf'] + $routing_count['cef'] + $routing_count['vrf'] > "0") {
    ?>
        <li class="dropdown">
          <a href="routing/" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><img src="images/16/arrow_branch.png" border="0" align="absmiddle" /> Routing<b class="caret"></b></a>
          <ul class="dropdown-menu">
开发者ID:CumulusNetworks,项目名称:cldemo-archive,代码行数:31,代码来源:print-menubar.php


示例7: foreach

    <tr>
      <th>Name</th>
      <th>Description</th>
      <th>Section</th>
      <th style="width: 80;">Status</th>
      <th style="width: 80;"></th>
    </tr>
  </thead>
  <tbody>

<?php 
foreach ($graphs_sections as $section => $entry) {
    foreach ($entry as $graph => $enabled) {
        echo '<tr><td><strong>' . $graph . '</strong></td><td>';
        echo $config['graph_types']['device'][$graph]['descr'] . '</td><td>';
        echo nicecase($section) . '</td><td>';
        if (!$enabled) {
            $attrib_status = '<span class="text-danger">disabled</span>';
            $toggle = 'Enable';
            $btn_class = 'btn-success';
        } else {
            $attrib_status = '<span class="text-success">enabled</span>';
            $toggle = "Disable";
            $btn_class = "btn-danger";
        }
        echo $attrib_status . '</td><td>';
        if (!in_array($section, array('poller', 'system'))) {
            echo '<form id="toggle_graph" name="toggle_graph" style="margin: 0px;" method="post" action="">
      <input type="hidden" name="toggle_graph" value="' . $graph . '">
      <button type="submit" class="btn btn-mini ' . $btn_class . '" name="Submit">' . $toggle . '</button></form>';
        } else {
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:graphs.inc.php


示例8: array

$graphs['bind'] = array('queries');
$graphs['tinydns'] = array('queries', 'errors', 'dnssec', 'other');
print_optionbar_start();
echo "<span style='font-weight: bold;'>Apps</span> &#187; ";
unset($sep);
$link_array = array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'apps');
foreach ($app_list as $app) {
    echo $sep;
    #  if (!$vars['app']) { $vars['app'] = $app['app_type']; }
    if ($vars['app'] == $app['app_type']) {
        echo "<span class='pagemenu-selected'>";
        #echo('<img src="images/icons/'.$app['app_type'].'.png" class="optionicon" />');
    } else {
        #echo('<img src="images/icons/greyscale/'.$app['app_type'].'.png" class="optionicon" />');
    }
    echo generate_link(nicecase($app['app_type']), array('page' => 'apps', 'app' => $app['app_type']));
    if ($vars['app'] == $app['app_type']) {
        echo "</span>";
    }
    $sep = " | ";
}
print_optionbar_end();
if ($vars['app']) {
    if (is_file("pages/apps/" . mres($vars['app']) . ".inc.php")) {
        include "pages/apps/" . mres($vars['app']) . ".inc.php";
    } else {
        include "pages/apps/default.inc.php";
    }
} else {
    include "pages/apps/overview.inc.php";
}
开发者ID:REAP720801,项目名称:librenms,代码行数:31,代码来源:apps.inc.php


示例9: print_optionbar_start

<?php

global $config;
print_optionbar_start();
echo "<span style='font-weight: bold;'>" . nicecase($app['app_type']) . "</span> &#187; ";
$app_sections = array('system' => "System", 'queries' => "Queries", 'innodb' => "InnoDB");
unset($sep);
foreach ($app_sections as $app_section => $app_section_text) {
    echo $sep;
    if (!$vars['app_section']) {
        $vars['app_section'] = $app_section;
    }
    if ($vars['app_section'] == $app_section) {
        echo "<span class='pagemenu-selected'>";
    }
    echo generate_link($app_section_text, $vars, array('app_section' => $app_section));
    if ($vars['app_section'] == $app_section) {
        echo "</span>";
    }
    $sep = " | ";
}
print_optionbar_end();
$graphs['system'] = array('mysql_connections' => 'Connections', 'mysql_files_tables' => 'Files and Tables', 'mysql_myisam_indexes' => 'MyISAM Indexes', 'mysql_network_traffic' => 'Network Traffic', 'mysql_table_locks' => 'Table Locks', 'mysql_temporary_objects' => 'Temporary Objects');
$graphs['queries'] = array('mysql_command_counters' => 'Command Counters', 'mysql_query_cache' => 'Query Cache', 'mysql_query_cache_memory' => 'Query Cache Memory', 'mysql_select_types' => 'Select Types', 'mysql_slow_queries' => 'Slow Queries', 'mysql_sorts' => 'Sorts');
$graphs['innodb'] = array('mysql_innodb_buffer_pool' => 'InnoDB Buffer Pool', 'mysql_innodb_buffer_pool_activity' => 'InnoDB Buffer Pool Activity', 'mysql_innodb_insert_buffer' => 'InnoDB Insert Buffer', 'mysql_innodb_io' => 'InnoDB IO', 'mysql_innodb_io_pending' => 'InnoDB IO Pending', 'mysql_innodb_log' => 'InnoDB Log', 'mysql_innodb_row_operations' => 'InnoDB Row Operations', 'mysql_innodb_semaphores' => 'InnoDB semaphores', 'mysql_innodb_transactions' => 'InnoDB Transactions');
foreach ($graphs[$vars['app_section']] as $key => $text) {
    $graph_type = $key;
    $graph_array['height'] = "100";
    $graph_array['width'] = "215";
    $graph_array['to'] = $config['time']['now'];
    $graph_array['id'] = $app['app_id'];
开发者ID:REAP720801,项目名称:librenms,代码行数:31,代码来源:mysql.inc.php


示例10: snmpwalk_cache_oid

    } else {
        $data = snmpwalk_cache_oid($device, $type, array(), $netstats['mib']);
        if (!count($data)) {
            continue;
        }
        $data_array = $data[0];
    }
    $rrd_file = 'netstats-' . $type . '.rrd';
    $rrd_create = '';
    $rrd_update = 'N';
    foreach ($oids as $oid) {
        $oid_ds = truncate($oid, 19, '');
        if ($oid == 'tcpCurrEstab') {
            $rrd_create .= ' DS:' . $oid_ds . ':GAUGE:600:U:4294967295';
            // Gauge32 max value 2^32 = 4294967295
        } else {
            $rrd_create .= ' DS:' . $oid_ds . ':COUNTER:600:U:4294967295';
            // Counter32 max value 2^32 = 4294967295
        }
        $value = is_numeric($data_array[$oid]) ? $data_array[$oid] : 'U';
        $rrd_update .= ':' . $value;
    }
    rrdtool_create($device, $rrd_file, $rrd_create);
    rrdtool_update($device, $rrd_file, $rrd_update);
    foreach ($netstats['graphs'] as $graph) {
        $graphs[$graph] = TRUE;
    }
    print_cli_data(nicecase($type) . " Graphs", implode(" ", $netstats['graphs']), 2);
}
unset($netstats_poll, $netstats, $type, $oids, $oid, $oid_ds, $oids_string, $data, $data_array, $rrd_create, $rrd_file, $rrd_update, $value, $mibs_blacklist);
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:netstats.inc.php


示例11: array

<?php

if (!isset($vars['section'])) {
    $vars['section'] = 'eventlog';
}
$sections = array('eventlog', 'syslog');
$navbar['brand'] = "Logging";
$navbar['class'] = "navbar-narrow";
foreach ($sections as $section) {
    $type = strtolower($section);
    if (!isset($vars['section'])) {
        $vars['section'] = $section;
    }
    if ($vars['section'] == $section) {
        $navbar['options'][$section]['class'] = "active";
    }
    $navbar['options'][$section]['url'] = generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'logs', 'section' => $section));
    $navbar['options'][$section]['text'] = nicecase($section);
}
print_navbar($navbar);
switch ($vars['section']) {
    case 'syslog':
    case 'eventlog':
        include 'pages/device/logs/' . $vars['section'] . '.inc.php';
        break;
    default:
        echo '<h2>Error. No section ' . $vars['section'] . '.<br /> Please report this to observium developers.</h2>';
        break;
}
开发者ID:RomanBogachev,项目名称:observium,代码行数:29,代码来源:logs.inc.php


示例12: print_syslogs


//.........这里部分代码省略.........
                case 'timestamp_from':
                    $where .= ' AND `timestamp` > ?';
                    $param[] = $value;
                    break;
                case 'timestamp_to':
                    $where .= ' AND `timestamp` < ?';
                    $param[] = $value;
                    break;
            }
        }
    }
    // Show events only for permitted devices
    $query_permitted = generate_query_permitted();
    $query = 'FROM `syslog` ';
    $query .= $where . $query_permitted;
    $query_count = 'SELECT COUNT(`seq`) ' . $query;
    $query = 'SELECT * ' . $query;
    $query .= ' ORDER BY `seq` DESC ';
    $query .= "LIMIT {$start},{$pagesize}";
    // Query syslog messages
    $entries = dbFetchRows($query, $param);
    // Query syslog count
    if ($pagination && !$short) {
        $count = dbFetchCell($query_count, $param);
    } else {
        $count = count($entries);
    }
    if (!$count) {
        // There have been no entries returned. Print the warning.
        print_warning('<h4>No syslog entries found!</h4>
Check that the syslog daemon and Observium configuration options are set correctly, that your devices are configured to send syslog to Observium and that there are no firewalls blocking the messages.

See <a href="http://www.observium.org/wiki/Category:Documentation" target="_blank">documentation</a> and <a href="http://www.observium.org/wiki/Configuration_Options#Syslog_Settings" target="_blank">configuration options</a> for more information.');
    } else {
        // Entries have been returned. Print the table.
        $list = array('device' => FALSE, 'priority' => TRUE);
        // For now (temporarily) priority always displayed
        if (!isset($vars['device']) || empty($vars['device']) || $vars['page'] == 'syslog') {
            $list['device'] = TRUE;
        }
        if ($short || !isset($vars['priority']) || empty($vars['priority'])) {
            $list['priority'] = TRUE;
        }
        $string = '<table class="table table-bordered table-striped table-hover table-condensed-more">' . PHP_EOL;
        if (!$short) {
            $string .= '  <thead>' . PHP_EOL;
            $string .= '    <tr>' . PHP_EOL;
            $string .= '      <th>Date</th>' . PHP_EOL;
            if ($list['device']) {
                $string .= '      <th>Device</th>' . PHP_EOL;
            }
            if ($list['priority']) {
                $string .= '      <th>Priority</th>' . PHP_EOL;
            }
            $string .= '      <th>Message</th>' . PHP_EOL;
            $string .= '    </tr>' . PHP_EOL;
            $string .= '  </thead>' . PHP_EOL;
        }
        $string .= '  <tbody>' . PHP_EOL;
        foreach ($entries as $entry) {
            $string .= '  <tr>';
            if ($short) {
                $string .= '    <td class="syslog" style="white-space: nowrap">';
                $timediff = $GLOBALS['config']['time']['now'] - strtotime($entry['timestamp']);
                $string .= overlib_link('', formatUptime($timediff, "short-3"), format_timestamp($entry['timestamp']), NULL) . '</td>' . PHP_EOL;
            } else {
                $string .= '    <td width="160">';
                $string .= format_timestamp($entry['timestamp']) . '</td>' . PHP_EOL;
            }
            if ($list['device']) {
                $dev = device_by_id_cache($entry['device_id']);
                $device_vars = array('page' => 'device', 'device' => $entry['device_id'], 'tab' => 'logs', 'section' => 'syslog');
                $string .= '    <td class="entity">' . generate_device_link($dev, short_hostname($dev['hostname']), $device_vars) . '</td>' . PHP_EOL;
            }
            if ($list['priority']) {
                if (!$short) {
                    $string .= '    <td style="color: ' . $priorities[$entry['priority']]['color'] . '; white-space: nowrap;">' . nicecase($priorities[$entry['priority']]['name']) . ' (' . $entry['priority'] . ')</td>' . PHP_EOL;
                }
            }
            $entry['program'] = empty($entry['program']) ? '[[EMPTY]]' : $entry['program'];
            if ($short) {
                $string .= '    <td class="syslog">';
                $string .= '<strong style="color: ' . $priorities[$entry['priority']]['color'] . ';">' . $entry['program'] . '</strong> : ';
            } else {
                $string .= '    <td>';
                $string .= '<strong>' . $entry['program'] . '</strong> : ';
            }
            $string .= htmlspecialchars($entry['msg']) . '</td>' . PHP_EOL;
            $string .= '  </tr>' . PHP_EOL;
        }
        $string .= '  </tbody>' . PHP_EOL;
        $string .= '</table>' . PHP_EOL;
        // Print pagination header
        if ($pagination && !$short) {
            $string = pagination($vars, $count) . $string . pagination($vars, $count);
        }
        // Print syslog
        echo $string;
    }
}
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:101,代码来源:syslogs.inc.php


示例13: nicecase

<table cellpadding="0" cellspacing="0">
  <tr>
    <td>
      <form id="edit" name="edit" method="post" action="">
        <input type="hidden" name="editing" value="yes">
        <table border="0">
<?php 
$numicons = 1;
echo "          <tr>\n";
// Default icon
$icon = $config['os'][$device['os']]['icon'];
echo '            <td width="64" align="center"><img src="images/os/' . $icon . '.png"><br /><i>' . nicecase($icon) . '</i><p />';
echo '<input name="icon" type="radio" value="' . $icon . '"' . ($device['icon'] == '' || $device['icon'] == $icon ? ' checked="1"' : '') . ' /></td>' . "\n";
for ($i = 0; $i < count($config['os'][$device['os']]['icons']); $i++) {
    $icon = $config['os'][$device['os']]['icons'][$i];
    echo '            <td width="64" align="center"><img src="images/os/' . $icon . '.png"><br /><i>' . nicecase($icon) . '</i><p />';
    echo '<input name="icon" type="radio" value="' . $icon . '"' . ($device['icon'] == $icon ? ' checked="1"' : '') . ' /></td>' . "\n";
}
if ($numicons % 10 == 0) {
    echo "          </tr>\n";
    echo "          <tr>\n";
}
?>
          </tr>
          <tr>
            <td colspan="10">
              <br />
              <input type="submit" name="Submit" value="Save" />
            </td>
          </tr>
        </table>
开发者ID:samyscoub,项目名称:librenms,代码行数:31,代码来源:icon.inc.php


示例14: nicecase

} else {
    $title .= " :: " . nicecase($subtype);
}
// Generate navbar with subtypes
$graph_array = $vars;
$graph_array['height'] = "60";
$graph_array['width'] = $thumb_width;
$graph_array['legend'] = "no";
$graph_array['to'] = $config['time']['now'];
$navbar = array('brand' => "Graph", 'class' => "navbar-narrow");
switch ($type) {
    case 'device':
    case 'sensor':
    case 'cefswitching':
    case 'munin':
        $navbar['options']['graph'] = array('text' => nicecase($type) . ' (' . $subtype . ')', 'url' => generate_url($vars, array('type' => $type . "_" . $subtype, 'page' => "graphs")));
        break;
    default:
        # Load our list of available graphtypes for this object
        /// FIXME not all of these are going to be valid
        /// This is terrible. --mike
        /// The future solution is to keep a 'registry' of which graphtypes apply to which entities and devices.
        /// I'm not quite sure if this is going to be too slow. --adama 2013-11-11
        if ($handle = opendir($config['html_dir'] . "/includes/graphs/" . $type . "/")) {
            while (false !== ($file = readdir($handle))) {
                if ($file != "." && $file != ".." && $file != "auth.inc.php" && $file != "graph.inc.php" && strstr($file, ".inc.php")) {
                    $types[] = str_replace(".inc.php", "", $file);
                }
            }
            closedir($handle);
        }
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:graphs.inc.php


示例15: snmpwalk_cache_multi_oid

//Printer-MIB::prtMarkerSpotColorants.1.1 = INTEGER: 0
//Printer-MIB::prtMarkerAddressabilityUnit.1.1 = INTEGER: tenThousandthsOfInches(3)
//Printer-MIB::prtMarkerAddressabilityFeedDir.1.1 = INTEGER: 600
//Printer-MIB::prtMarkerAddressabilityXFeedDir.1.1 = INTEGER: 600
//Printer-MIB::prtMarkerNorthMargin.1.1 = INTEGER: 1968
//Printer-MIB::prtMarkerSouthMargin.1.1 = INTEGER: 1968
//Printer-MIB::prtMarkerWestMargin.1.1 = INTEGER: 1968
//Printer-MIB::prtMarkerEastMargin.1.1 = INTEGER: 1968
//Printer-MIB::prtMarkerStatus.1.1 = INTEGER: 2
$oids = snmpwalk_cache_multi_oid($device, "prtMarkerEntry", array(), $mib);
$prt_supplies = snmpwalk_cache_oid($device, 'prtMarkerSuppliesDescription', array(), $mib);
//print_vars($oids);
$count = count($oids);
foreach ($oids as $index => $entry) {
    $printer_supply = dbFetchRow("SELECT * FROM `printersupplies` WHERE `device_id` = ? AND `supply_mib` = ? AND `supply_index` = ?", array($device['device_id'], 'jetdirect', $index));
    $marker_descr = "Printed " . nicecase($entry['prtMarkerCounterUnit']);
    list($hrDeviceIndex, $prtMarkerIndex) = explode('.', $index);
    $options = array('measured_class' => 'printersupply', 'measured_entity' => $printer_supply['supply_id'], 'sensor_unit' => $entry['prtMarkerCounterUnit']);
    // Lifetime counter (should be always single)
    $descr = "Total {$marker_descr}";
    $oid_name = 'prtMarkerLifeCount';
    $oid = '.1.3.6.1.2.1.43.10.2.1.4.' . $index;
    $value = $entry[$oid_name];
    if (isset($entry[$oid_name])) {
        // CLEANME. Compatibility, remove in r8500, but not before CE 0.16.8
        // Rename olf rrd filename and old ds name
        $new_rrd = 'sensor-counter-Printer-MIB-prtMarkerLifeCount-' . $index;
        $renamed = rename_rrd($device, 'pagecount', $new_rrd);
        if ($renamed) {
            rrdtool_rename_ds($device, $new_rrd, 'pagecount', 'sensor');
        }
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:printer-mib.inc.php


示例16: var_dump

    var_dump($GLOBALS['cache']['discovery-protocols']);
}
$table_rows = array();
$neighbours_db = dbFetchRows('SELECT * FROM `neighbours` LEFT JOIN `ports` USING(`port_id`) WHERE `device_id` = ?', array($device['device_id']));
foreach ($neighbours_db as $neighbour) {
    $local_port_id = $neighbour['port_id'];
    $remote_hostname = $neighbour['remote_hostname'];
    $remote_port = $neighbour['remote_port'];
    print_debug("{$local_port_id} -> {$remote_hostname} -> {$remote_port}");
    if (!$valid['neighbours'][$local_port_id][$remote_hostname][$remote_port]) {
        dbDelete('neighbours', '`neighbour_id` = ?', array($neighbour['neighbour_id']));
        $GLOBALS['module_stats'][$module]['deleted']++;
    } else {
        $port = get_port_by_id_cache($local_port_id);
        if (is_numeric($neighbour['remote_port_id'])) {
            $remote_port_array = get_port_by_id_cache($neighbour['remote_port_id']);
            $remote_port = $remote_port_array['port_label'];
        }
        $table_rows[] = array(nicecase($neighbour['protocol']), $port['port_label'], $remote_hostname, $remote_port, truncate($neighbour['remote_platform'], 20), truncate($neighbour['remote_version'], 40));
    }
}
echo PHP_EOL;
$table_headers = array('%WProtocol%n', '%WifName%n', '%WRemote: hostname%n', '%Wport%n', '%Wplatform%n', '%Wversion%n');
print_cli_table($table_rows, $table_headers);
$GLOBALS['module_stats'][$module]['status'] = count($valid[$module]);
if (OBS_DEBUG && $GLOBALS['module_stats'][$module]['status']) {
    print_vars($valid[$module]);
}
unset($valid['neighbours']);
echo PHP_EOL;
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:neighbours.inc.php


示例17: list

     }
 }
 // Split enum|foo|bar into enum  foo|bar
 list($vartype, $varparams) = explode('|', $config_variable[$sqlname]['type'], 2);
 $params = array();
 // If a callback function is defined, use this to fill params.
 if ($config_variable[$sqlname]['params_call'] && function_exists($config_variable[$sqlname]['params_call'])) {
     $params = call_user_func($config_variable[$sqlname]['params_call']);
     // Else if the params are defined directly, use these.
 } else {
     if (is_array($config_variable[$sqlname]['params'])) {
         $params = $config_variable[$sqlname]['params'];
     } else {
         if (!empty($varparams)) {
             foreach (explode('|', $varparams) as $param) {
                 $params[$param] = array('name' => nicecase($param));
             }
         }
     }
 }
 switch ($vartype) {
     case 'int':
     case 'integer':
     case 'float':
         if (is_numeric($content)) {
             $ok = TRUE;
         } else {
             $errors[] = $config_variable[$sqlname]['name'] . " ({$confname}) should be of <strong>numeric</strong> type. Setting '" . escape_html($content) . "' ignored.";
         }
         break;
     case 'bool':
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:settings.inc.php


示例18: print_cli_data

print_cli_data("Asset", $asset_tag ?: "%b<empty>%n");
echo PHP_EOL;
foreach ($os_additional_info as $header => $entries) {
    print_cli_heading($header, 3);
    foreach ($entries as $field => $entry) {
        print_cli_data($field, $entry, 3);
    }
    echo PHP_EOL;
}
// Fields notified in event log
$update_fields = array('version', 'features', 'hardware', 'serial', 'kernel', 'distro', 'distro_ver', 'arch', 'asset_tag');
// Log changed variables
foreach ($update_fields as $field) {
    if (isset(${$field})) {
        ${$field} = snmp_fix_string(${$field});
    }
    // Fix unprintable chars
    if ((isset(${$field}) || strlen($device[$field])) && ${$field} != $device[$field]) {
        $update_array[$field] = ${$field};
        log_event(nicecase($field) . " -> " . $update_array[$field], $device, 'device', $device['device_id']);
    }
}
// Here additional fields, change only if not set already
foreach (array('type', 'icon') as $field) {
    if (isset(${$field}) && ($device[$field] == "unknown" || $device[$field] == '' || !isset($device[$field]) || !strlen($device[$field]))) {
        $update_array[$field] = ${$field};
        log_event(nicecase($field) . " -> " . $update_array[$field], $device, 'device', $device['device_id']);
    }
}
unset($entPhysical, $oids, $hw, $os_additional_info);
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:os.inc.php


示例19: generate_link

 * Copyright (C) 2006-2014, Adam Armstrong - http://www.observium.org
 *
 * @package    observium
 * @subpackage webui
 * @author     Adam Armstrong <[email protected]>
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
echo generate_link($descr, $link_array, array('view' => 'macaccounting'));
$graphs = array('bits' => 'Bits', 'pkts' => '数据包');
$navbar = array();
$navbar['class'] = "navbar-narrow";
$navbar['brand'] = 'Mac核算';
$subviews = array('details', 'graphs', 'minigraphs', 'top10');
foreach ($subviews as $type) {
    $navbar['options'][$type]['text'] = nicecase($type);
    $navbar['options'][$type]['url'] = generate_url($vars, array('subview' => $type));
    if ($vars['subview'] == $type) {
        $navbar['options'][$type]['class'] = "active";
    }
}
foreach ($graphs as $type => $text) {
    $navbar['options_right'][$type]['text'] = $text;
    $navbar['options_right'][$type]['url'] = generate_url($link_array, array('view' => 'macaccounting', 'subview' => 'graphs', 'graph' => $type));
    if ($vars['graph'] == $type) {
        $navbar['options_right'][$type]['class'] = "active";
    }
}
print_navbar($navbar);
// FIXME - REWRITE!
$hostname = $device['hostname'];
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:macaccounting.inc.php


示例20: rrdtool_escape

 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage graphs
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
$scale_min = "0";
$scale_max = "100";
include_once $config['html_dir'] . "/includes/graphs/common.inc.php";
$rrd_options .= " COMMENT:'                          Min     Last   Max\\n'";
$rrd_options .= " DEF:sensor={$rrd_filename}:sensor:AVERAGE";
$rrd_options .= " DEF:sensor_max={$rrd_filename}:sensor:MAX";
$rrd_options .= " DEF:sensor_min={$rrd_filename}:sensor:MIN";
$rrd_options .= " CDEF:sensor_diff=sensor_max,sensor_min,-";
$rrd_options .= " AREA:sensor_min";
$rrd_options .= " AREA:sensor_diff#c5c5c5::STACK";
$rrd_options .= " LINE1.5:sensor#cc0000:'" . rrdtool_escape($sensor['sensor_descr'], 20) . "'";
$rrd_options .= " GPRINT:sensor_min:MIN:%4.1lf%%";
$rrd_options .= " GPRINT:sensor:LAST:%4.1lf%%";
$rrd_options .= " GPRINT:sensor_max:MAX:%4.1lf%%\\l";
if (is_numeric($sensor['sensor_limit'])) {
    $rrd_options .= " HRULE:" . $sensor['sensor_limit'] . "#999999::dashes";
}
if (is_numeric($sensor['sensor_limit_low'])) {
    $rrd_options .= " HRULE:" . $sensor['sensor_limit_low'] . "#999999::dashes";
}
$graph_return['descr'] = nicecase($sensor['sensor_class']) . ' sensor measured in percent.';
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:percent.inc.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP nicedate函数代码示例发布时间:2022-05-15
下一篇:
PHP nice_time函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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