/** * @return string */ public function JS() { $code = $this->getCode(); if (is_string($code)) { $code = array($code); // blöde interfaces vom js helper } elseif ($code instanceof \Psc\JS\Expression) { $code = array($code->JS()); } // load-wrappers (von innen nach außen) if ($this->onPscReady === 'main') { // non blocking mode (is save to use in html inline scripts directly) $this->unshiftRequirement('app/main'); $this->unshiftRequirementAlias('main'); $this->unshiftRequirement('jquery'); $this->unshiftRequirementAlias('jQuery'); $code = Helper::bootLoad($this->getRequirements(), $this->requirementsAliases, $code); } elseif ($this->onPscReady) { // is only save to use in ajax requests / inline scripts where window.requireLoad is already defined $this->unshiftRequirement('jquery'); $this->unshiftRequirementAlias('jQuery'); $code = Helper::requireLoad($this->getRequirements(), $this->requirementsAliases, $code); } elseif (count($req = $this->getRequirements()) > 0) { $code = Helper::requirejs($req, array(), $code); } else { $code = count($code) > 1 ? \Webforge\Common\ArrayUtil::join($code, "%s\n") : current($code); } return TPL::miniTemplate((string) $code, (array) $this->vars); }
/** * @param string $command nur der befehl oder mehrere (z. B. lb für list simple) * @param array $options alle optionen ohne - davor */ protected function exec($command, array $options = array(), $append = NULL) { $cmd = sprintf('%s %s%s %s%s', SystemUtil::escapeShellArg($this->bin), $command, count($options) > 0 ? \Webforge\Common\ArrayUtil::join($options, ' -%s') : NULL, (string) escapeshellarg($this->rar), mb_strlen($append) > 0 ? ' ' . $append : NULL); $out = array(); $ret = NULL; $out = System::execute($cmd, NULL, NULL, $stdout, $stderr, NULL, $ret); if ($ret !== 0) { throw new Exception(sprintf("Fehler '%s' beim Ausführen des Befehls '%s'. Rückgabe: %d", $out, $cmd, $ret)); } /* sonderfall für listfiles denn das gibt immer $ret = 0 zurück, toll, was? */ if (!empty($stderr)) { throw new Exception(sprintf("Fehler '%s' beim Ausführen des Befehls '%s'.", $stderr, $cmd)); } return $out; }
/** * @return list($phpCode, $methodNames) */ public function compile(GClass $gClass) { $this->methods = array(); $gClass->elevateClass(); $closures = array(); $methodNames = array(); foreach ($gClass->getAllMethods() as $method) { $closureName = $method->getName(); if ($method->hasDocBlock()) { $docBlock = $method->getDocBlock(); if (($ccAlias = \Psc\Preg::qmatch($docBlock->toString(), '/@cc-alias\\s+(.*?)([\\s]|$)/im', 1)) !== NULL) { $closureName = $ccAlias; } if (\Psc\Preg::match($docBlock->toString(), '/@cc-ignore/i')) { continue; } } $closures[$closureName] = $this->compileClosure($method, $closureName); $this->methods[$closureName] = $method; $methodNames[] = $closureName; } return array(\Webforge\Common\ArrayUtil::join($closures, "%s;\n\n"), $methodNames); }
public static function fromCode(array $codeLines) { return new static(\Webforge\Common\ArrayUtil::join($codeLines, "%s\n")); }
/** * Gibt das HTML zum Laden von allen CSS Dateien aus */ public function load($glue = "%s \n") { print A::join($this->getHTML(), "%s \n"); }
public function debug() { print \Webforge\Common\ArrayUtil::join($this->log, " [phar] %s\n"); }
/** * @param string|array $name ist dies ein array wird der Name in PHP-Post-Array Syntax zurückgegeben $name = "var[key1][key2]" */ public static function getName($name) { if (is_array($name)) { $root = array_shift($name); $name = $root . A::join($name, '[%s]'); return $name; } return $name; }
/** * @return string */ public function html() { return \Webforge\Common\ArrayUtil::join($this->getHTML(), "%s \n"); }