本文整理汇总了PHP中derr函数的典型用法代码示例。如果您正苦于以下问题:PHP derr函数的具体用法?PHP derr怎么用?PHP derr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了derr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load_from_domxml
public function load_from_domxml(DOMElement $xml)
{
$this->xmlroot = $xml;
$this->name = DH::findAttribute('name', $xml);
if ($this->name === FALSE) {
derr("zone name not found\n", $xml);
}
$tmp = DH::findFirstElementOrDie('config', $xml);
$this->deviceConfiguration->load_from_domxml($tmp);
}
示例2: load_from_domxml
public function load_from_domxml(DOMNode $xml)
{
$this->xmlroot = $xml;
$this->name = DH::findAttribute('name', $xml);
if ($this->name === FALSE) {
derr("tag name not found\n", $xml);
}
if (strlen($this->name) < 1) {
derr("Tag name '" . $this->name . "' is not valid.", $xml);
}
}
示例3: setRefName
/**
* @param string $newName
* @param bool $skip_name_unicity_check
* @throws Exception
* @return bool
*/
protected function setRefName($newName, $skip_name_unicity_check = false)
{
if (!is_string($newName)) {
derr('$newName must be a string');
}
if ($this->name == $newName) {
return false;
}
$oldName = $this->name;
$this->name = $newName;
$this->broadcastMyNameChange($oldName);
return true;
}
示例4: load_from_domxml
public function load_from_domxml($xml)
{
$this->xmlroot = $xml;
$this->name = DH::findAttribute('name', $xml);
if ($this->name === FALSE) {
derr("name not found\n");
}
$this->extract_disabled_from_domxml();
$this->extract_description_from_domxml();
$this->load_from();
$this->load_to();
$this->load_source();
$this->load_destination();
$this->load_tags();
}
示例5: load_from_domxml
public function load_from_domxml(DOMElement $xml)
{
$this->xmlroot = $xml;
$this->name = DH::findAttribute('name', $xml);
if ($this->name === FALSE) {
derr("loopback name name not found\n");
}
$ipNode = DH::findFirstElement('ip', $xml);
if ($ipNode !== false) {
foreach ($ipNode->childNodes as $l3ipNode) {
if ($ipNode->nodeType != XML_ELEMENT_NODE) {
continue;
}
$this->_ipv4Addresses[] = $ipNode->getAttribute('name');
}
}
}
示例6: load_from_domxml
/**
* @param DOMElement $xml
*/
public function load_from_domxml($xml)
{
$this->xmlroot = $xml;
$this->name = DH::findAttribute('name', $xml);
if ($this->name === FALSE) {
derr("virtual-router name not found\n");
}
$node = DH::findFirstElementOrCreate('interface', $xml);
$this->attachedInterfaces->load_from_domxml($node);
$node = DH::findXPath('/routing-table/ip/static-route/entry', $xml);
if ($node !== false) {
for ($i = 0; $i < $node->length; $i++) {
$newRoute = new StaticRoute('***tmp**', $this);
$newRoute->load_from_xml($node->item($i));
$this->_staticRoutes[] = $newRoute;
}
}
}
示例7: load_from_xml
/**
* @param $xml DOMElement
*/
function load_from_xml($xml)
{
$this->xmlroot = $xml;
$this->name = DH::findAttribute('name', $xml);
if ($this->name === FALSE) {
derr("static-route name not found\n");
}
$dstNode = DH::findFirstElementOrDie('destination', $xml);
$this->_destination = $dstNode->textContent;
$ifNode = DH::findFirstElement('interface', $xml);
if ($ifNode !== false) {
$this->_interface = $this->owner->owner->owner->network->findInterfaceOrCreateTmp($ifNode->textContent);
}
$fhNode = DH::findFirstElement('nexthop', $xml);
if ($fhNode !== false) {
$fhTypeNode = DH::findFirstElement('ip-address', $fhNode);
if ($fhTypeNode !== false) {
$this->_nexthopType = 'ip-address';
$this->_nexthopIP = $fhTypeNode->textContent;
}
}
}
示例8: getIP4Mapping
/**
* Return an array['start']= startip and ['end']= endip
* @return IP4Map
*/
public function getIP4Mapping()
{
if (isset($this->_ip4Map)) {
return $this->_ip4Map;
}
if ($this->isTmpAddr()) {
if (filter_var($this->name, FILTER_VALIDATE_IP) === false) {
derr('cannot resolve a Temporary object !');
}
$this->_ip4Map = IP4Map::mapFromText($this->name);
} elseif ($this->type != self::TypeIpRange && $this->type != self::TypeIpNetmask) {
derr('cannot resolve an object of type ' . $this->type());
} elseif ($this->type == self::TypeIpNetmask || $this->type == self::TypeIpRange) {
$this->_ip4Map = IP4Map::mapFromText($this->value);
} else {
derr("unexpected type");
}
return $this->_ip4Map;
}
示例9: mappingFromText
/**
* @param $text
* @return ServiceDstPortMapping
*/
public static function mappingFromText($text, $tcp = true)
{
$newMapping = new ServiceDstPortMapping();
$commaExplode = explode(',', $text);
foreach ($commaExplode as &$comma) {
$dashExplode = explode('-', $comma);
if (count($dashExplode) == 1) {
$port =& $dashExplode[0];
if (!is_string($port) || strlen($port) == 0) {
derr("unsupported port number: '{$port}'");
}
if (!is_numeric($port)) {
derr("port is not an integer: '{$port}'");
}
$port = (int) $port;
if ($port < 0 || $port > 65535) {
derr('port value is not within 0-65535');
}
if ($tcp) {
$newMapping->tcpPortMap[] = array('start' => $port, 'end' => $port);
} else {
$newMapping->udpPortMap[] = array('start' => $port, 'end' => $port);
}
} else {
if (count($dashExplode) > 2) {
derr("invalid port range syntax: '{$comma}'");
}
$port = $dashExplode[0];
if (!is_string($port) || strlen($port) == 0) {
derr("unsupported port number: '{$port}'");
}
if (!is_numeric($port)) {
derr("port is not an integer: '{$port}'");
}
$port = (int) $port;
if ($port < 0 || $port > 65535) {
derr('port value is not within 0-65535');
}
$portStart = $port;
$port = $dashExplode[1];
if (!is_string($port) || strlen($port) == 0) {
derr("unsupported port number: '{$port}'");
}
if (!is_numeric($port)) {
derr("port is not an integer: '{$port}'");
}
$port = (int) $port;
if ($port < 0 || $port > 65535) {
derr('port value is not within 0-65535');
}
$portEnd = $port;
if ($tcp) {
$newMapping->tcpPortMap[] = array('start' => $portStart, 'end' => $portEnd);
} else {
$newMapping->udpPortMap[] = array('start' => $portStart, 'end' => $portEnd);
}
}
}
$newMapping->mergeOverlappingMappings();
return $newMapping;
}
示例10: getIP4Mapping
/**
* @return IP4Map
*/
public function getIP4Mapping()
{
$result = array('unresolved' => array());
$mapObject = new IP4Map();
foreach ($this->members as $member) {
if ($member->isTmpAddr()) {
$result['unresolved'][] = $member;
continue;
} elseif ($member->isAddress()) {
$localMap = $member->getIP4Mapping();
$mapObject->addMap($localMap, true);
} elseif ($member->isGroup()) {
$localMap = $member->getIP4Mapping();
$mapObject->addMap($localMap, true);
} else {
derr('unsupported type of objects ' . $member->toString());
}
}
$mapObject->sortAndRecalculate();
return $mapObject;
}
示例11: PanoramaConf
*
*
*****************************************************************************/
// load PAN-Configurator library
require_once "../lib/panconfigurator.php";
// input and output files
$origfile = "sample-configs/panorama-example.xml";
$outputfile = "output.xml";
$targetDG = 'Perimeter-FWs';
$targetProfile = 'Shared Production Profile';
// We're going to load a PANConf object (PANConf is for PANOS Firewall,
// PanoramaConf is obviously for Panorama which is covered in another example)
$panc = new PanoramaConf();
$panc->load_from_file($origfile);
// Did we find VSYS1 ?
$dg = $panc->findDeviceGroup($targetDG);
if (is_null($dg)) {
derr("DeviceGroup {$targetDV} was not found ? Exit\n");
}
print "\n***********************************************\n\n";
// Going after each pre-Security rules to add a profile
foreach ($dg->securityRules->rules() as $rule) {
print "Rule '" . $rule->name() . "' modified\n";
$rule->setSecurityProfileGroup($targetProfile);
}
print "\n***********************************************\n";
$panc->save_to_file($outputfile);
//display some statistics
$panc->display_statistics();
//more debugging infos
memory_and_gc('end');
开发者ID:shpapy,项目名称:pan-configurator,代码行数:31,代码来源:example-add-security-profile-to-all-rules-panorama.php
示例12: findRootObjectOrDie
/**
* @param $panConfObject
* @return PANConf|PanoramaConf
* @throws Exception
*/
public static function findRootObjectOrDie($panConfObject)
{
while (true) {
$class = get_class($panConfObject);
if ($class == 'PANConf' || $class == 'PanoramaConf') {
return $panConfObject;
}
if (isset($panConfObject->owner) && is_object($panConfObject->owner)) {
$panConfObject = $panConfObject->owner;
} else {
break;
}
}
derr("cannot find PanoramaConf or PANConf object");
}
示例13: moveChildElementsToNewParentNode
/**
* @param DOMElement $source
* @param DOMElement $target
* @return int
* @throws Exception
*/
public static function moveChildElementsToNewParentNode(DOMElement $source, DOMElement $target)
{
$sourceOwner = $source->ownerDocument;
$targetOwner = $target->ownerDocument;
if (!$sourceOwner->isSameNode($targetOwner)) {
derr('source and target must be part of same XML Document');
}
if ($source->nodeType != XML_ELEMENT_NODE) {
derr('source is not an Element type node');
}
if ($target->nodeType != XML_ELEMENT_NODE) {
derr('target is not an Element type node');
}
$toMove = array();
foreach ($source->childNodes as $child) {
if ($child->nodeType != XML_ELEMENT_NODE) {
continue;
}
$toMove[] = $child;
}
foreach ($toMove as $child) {
$target->appendChild($child);
}
return count($toMove);
}
示例14: get_class
public function &getXPath()
{
$str = '';
$ownerClass = get_class($this->owner);
if ($ownerClass == 'VirtualSystem' || $ownerClass == 'DeviceGroup') {
$str = $this->owner->getXPath();
} elseif ($ownerClass == 'PanoramaConf') {
$str = '/config/shared';
} else {
derr('unsupported');
}
$str = $str . '/tag';
return $str;
}
示例15: inStore
/**
* returns true if $object is in this store. False if not
*
*/
public function inStore($object)
{
if (is_null($object)) {
derr('a NULL object, really ?');
}
if (isset($this->fastMemToIndex[spl_object_hash($object)])) {
return true;
}
return false;
}