Exemplo n.º 1
0
 /**
  * Display the image_icon of a MonitoredObject
  *
  * @param   MonitoredObject|stdClass   $object  The host or service
  * @return  string
  */
 public function service($object)
 {
     if ($object->service_icon_image && !preg_match('/[\'"]/', $object->service_icon_image)) {
         return $this->view->icon(Macro::resolveMacros($object->service_icon_image, $object), null, array('alt' => $object->service_icon_image_alt, 'title' => $object->service_icon_image_alt, 'data-tooltip-delay' => 0));
     }
     return '';
 }
Exemplo n.º 2
0
 public function testFaultyMacros()
 {
     $hostMock = Mockery::mock('host');
     $hostMock->host_name = 'test';
     $hostMock->host = 'te';
     $this->assertEquals('$test $ HOSTNAME$ teNAME$', Macro::resolveMacros('$$HOSTNAME$ $ HOSTNAME$ $host$NAME$', $hostMock));
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function getUrl()
 {
     $url = parent::getUrl();
     if (!$this->resolved && $url !== null) {
         $this->setUrl(Macro::resolveMacros($url->getAbsoluteUrl(), $this->getObject()));
         $this->resolved = true;
     }
     return $url;
 }
Exemplo n.º 4
0
 public function testMacrosWithSpecialCharacters()
 {
     $objectMock = Mockery::mock('object');
     $objectMock->customvars = array('V€RY_SP3C|@L' => 'not too special!');
     $this->assertEquals(Macro::resolveMacros('$V€RY_SP3C|@L$', $objectMock), $objectMock->customvars['V€RY_SP3C|@L']);
 }
Exemplo n.º 5
0
 /**
  * Resolve macros in all given strings in the current object context
  *
  * @param   array   $strs   An array of urls as string
  *
  * @return  array
  */
 protected function resolveAllStrings(array $strs)
 {
     foreach ($strs as $i => $str) {
         $strs[$i] = Macro::resolveMacros($str, $this);
     }
     return $strs;
 }