protected function renderCustomExtensions()
 {
     $endpoints = $this->listEndpoints();
     if (empty($endpoints)) {
         return '';
     }
     return c::renderKeyValue('endpoints', c::renderArray($endpoints));
 }
Esempio n. 2
0
 protected function renderCommand()
 {
     $command = $this->command;
     $prefix = '';
     if (preg_match('~^([A-Z][A-Za-z0-9]+\\s\\+\\s)(.+?)$~', $command, $m)) {
         $prefix = $m[1];
         $command = $m[2];
     } elseif ($command[0] !== '/') {
         $prefix = 'PluginDir + ';
         $command = '/' . $command;
     }
     $parts = preg_split('/\\s+/', $command, -1, PREG_SPLIT_NO_EMPTY);
     array_unshift($parts, c::alreadyRendered($prefix . c::renderString(array_shift($parts))));
     return c::renderKeyValue('command', c::renderArray($parts));
 }
 public function toConfigString()
 {
     $data = array();
     if ($this->argument_value) {
         switch ($this->argument_format) {
             case 'string':
                 $data['value'] = c::renderString($this->argument_value);
                 break;
             case 'json':
                 if (is_object($this->argument_value)) {
                     $data['value'] = c::renderDictionary($this->argument_value);
                 } elseif (is_array($this->argument_value)) {
                     $data['value'] = c::renderArray($this->argument_value);
                 } elseif (is_null($this->argument_value)) {
                     // TODO: recheck all this. I bet we never reach this:
                     $data['value'] = 'null';
                 } elseif (is_bool($this->argument_value)) {
                     $data['value'] = c::renderBoolean($this->argument_value);
                 } else {
                     $data['value'] = $this->argument_value;
                 }
                 break;
             case 'expression':
                 $data['value'] = c::renderExpression($this->argument_value);
                 break;
         }
     }
     if ($this->sort_order) {
         $data['order'] = $this->sort_order;
     }
     if ($this->set_if) {
         $data['set_if'] = c::renderString($this->set_if);
     }
     if ((int) $this->sort_order !== 0) {
         $data['order'] = $this->sort_order;
     }
     if ($this->description) {
         $data['description'] = c::renderString($this->description);
     }
     if (array_keys($data) === array('value')) {
         return $data['value'];
     } else {
         return c::renderDictionary($data);
     }
 }
 public function toConfigString()
 {
     $data = array();
     if ($this->argument_value) {
         switch ($this->argument_format) {
             case 'string':
                 $data['value'] = c::renderString($this->argument_value);
                 break;
             case 'json':
                 if (is_object($this->argument_value)) {
                     $data['value'] = c::renderDictionary($this->argument_value);
                 } elseif (is_array($this->argument_value)) {
                     $data['value'] = c::renderArray($this->argument_value);
                 } else {
                     die('Unhandled');
                 }
                 break;
             case 'expression':
                 $data['value'] = c::renderExpression($this->argument_value);
                 break;
         }
     }
     if ($this->sort_order) {
         $data['order'] = $this->sort_order;
     }
     if ($this->set_if) {
         $data['set_if'] = c::renderString($this->set_if);
     }
     if ((int) $this->sort_order !== 0) {
         $data['order'] = $this->sort_order;
     }
     if ($this->description) {
         $data['description'] = c::renderString($this->description);
     }
     return c::renderDictionary($data);
 }
 protected function renderObjectHeader()
 {
     return sprintf("%s %s %s {\n", $this->getObjectTypeName(), $this->getType(), c::renderString($this->getObjectName()));
 }
 public function toConfigString()
 {
     return c::renderArray($this->value);
 }
Esempio n. 7
0
 public function toConfigString()
 {
     $out = '';
     foreach ($this->vars as $key => $var) {
         $out .= c::renderKeyValue('vars.' . c::escapeIfReserved($key), $var->toConfigString());
     }
     return $out;
 }
 protected function renderPassword()
 {
     return c::renderKeyValue('password', c::renderString('***'));
 }
 public function toConfigString()
 {
     $ret = '';
     foreach ($this->imports as $name => &$o) {
         $ret .= '    import ' . c::renderString($o->object_name) . "\n";
     }
     if ($ret !== '') {
         $ret .= "\n";
     }
     return $ret;
 }
Esempio n. 10
0
 public function toConfigString()
 {
     if (empty($this->arguments)) {
         return '';
     }
     $args = array();
     foreach ($this->arguments as $arg) {
         $args[$arg->argument_name] = $arg->toConfigString();
     }
     return c::renderKeyValue('arguments', c::renderDictionary($args));
 }
 public function toConfigString()
 {
     if (empty($this->ranges) && $this->object->object_type == 'template') {
         return '';
     }
     $string = "    ranges = {\n";
     foreach ($this->ranges as $range) {
         $string .= sprintf("        %s\t= %s\n", c::renderString($range->timeperiod_key), c::renderString($range->timeperiod_value));
     }
     return $string . "    }\n";
 }
 public function toConfigString()
 {
     return c::renderString($this->getValue());
 }