public function gen($route, array $params = array(), $options = array()) { list($uri, $parameters, $options, $extras, $is_null_route) = parent::gen($route, $params, $options); $cli_params = ''; foreach ($parameters as $name => $value) { $cli_params .= sprintf(' %s %s', escapeshellarg('-' . $name), escapeshellarg(self::getAsString($value))); } $extra_params = ''; foreach ($extras as $name => $value) { $extra_params .= sprintf(' %s %s', escapeshellarg('-' . $name), escapeshellarg(self::getAsString($value))); } $cmd = AgaviConfig::get('config.cmd.honeybee', 'bin/cli'); if (array_key_exists('APPLICATION_DIR', $_SERVER)) { /* * on ubuntu/nginx the '_' was set to the relative "bin/cli" command that was used in CLI * on opensuse/nginx the '_' was set to the absolute path of the php executable * on windows the '_' is never available afaik */ if (array_key_exists('_', $_SERVER) && StringToolkit::endsWith($_SERVER['_'], 'cli')) { $cmd = $_SERVER['_']; } } // TODO parameters that are part of the route pattern should not be appended here; // anyone with a bit of time may have a look at the parent::gen() to fix this return $cmd . ' ' . $uri . $cli_params . $extra_params; }
protected function getDefaultTemplateIdentifier() { $view_scope = $this->getOption('view_scope', 'missing_view_scope.collection'); if (StringToolkit::endsWith($view_scope, 'collection')) { return $this->output_format->getName() . '/attribute/text-list/as_itemlist_item_cell.twig'; } return $this->output_format->getName() . '/attribute/choice/as_input_roles.twig'; }
protected function getDefaultTemplateIdentifier() { $view_scope = $this->getOption('view_scope', 'missing_view_scope.collection'); $input_suffixes = $this->getInputViewTemplateNameSuffixes($this->output_format->getName()); if (StringToolkit::endsWith($view_scope, $input_suffixes)) { return $this->output_format->getName() . '/attribute/url-list/as_input.twig'; } return $this->output_format->getName() . '/attribute/url-list/as_itemlist_item_cell.twig'; }
protected function getWidgetImplementor() { $default = ''; $view_scope = $this->getOption('view_scope', 'missing_view_scope.collection'); if (StringToolkit::endsWith($view_scope, 'modify') || StringToolkit::endsWith($view_scope, 'create')) { $default = 'jsb_Honeybee_Core/ui/DatePicker'; } return $this->getOption('widget', $default); }
public function endsWith($haystack, $needle) { return StringToolkit::endsWith($haystack, $needle); }
/** * @param string $scheme prefix of the filesystem to return * * @return League\Flysystem\FilesystemInterface */ public function getFilesystem($scheme) { if (empty($scheme) || !is_string($scheme)) { throw new RuntimeError('Scheme (prefix) of filesystem must be a non-empty string.'); } if (!StringToolkit::endsWith($scheme, self::SCHEME_SEPARATOR)) { $scheme .= self::SCHEME_SEPARATOR; } return $this->mount_manager->getAdapter($scheme); }