protected function doInit() { // Added the clips object to JavaScript $router = \Clips\context('router'); if ($router) { \Clips\add_init_js(\Clips\clips_out('clips_js', array('base' => $router->staticUrl('/'), 'site' => $router->baseUrl('/')), false)); } }
public function execute($args) { $meta = $this->frameworkmeta; if ($meta->branch == 'master') { $meta->branch = 'dev-master'; } $meta->lastCommitterDate = $meta->lastCommitterDate->format(\DateTime::ISO8601); \Clips\clips_out("string://Framework Version: {{branch}} ({{commit}})\nLast Update Date: {{lastCommitterDate}}", $meta); }
public function execute($args) { $tool =& \Clips\get_clips_tool(); $arr = array(); foreach ($tool->listLoadDirs() as $dir) { if ($dir) { foreach ($this->fetchCommands($dir) as $d) { $command = str_replace('clips_', '', substr($d, strlen($dir) + 1, strlen($d) - strlen($dir) - 12)); $arr[] = array('command' => $command, 'desc' => $tool->descCommand($command)); } } } $script = basename(array_shift($args)); \Clips\clips_out('list', array('app' => $script, 'commands' => $arr)); }
protected function appendVariables($resolutions, $compiler) { if (is_array($resolutions)) { $ret = $this->analyzeResolutions($resolutions); $result = $ret[0]; $min = $ret[1]; $max = $ret[2]; $str = 'string://$min-screen-width: {{min}}; $max-screen-width: {{max}}; $init-min-screen-width: {{min}}; $init-max-screen-width: {{max}}; $pinet-resolutions: ( {{#resolutions}} {{#if alias}} ( {{alias}} : {{value}} ) {{else}} {{value}} {{/if}}, {{/resolutions}} ); $pinet-alias: ( {{#resolutions}} {{alias}}, {{/resolutions}} ); $pinet-no-alias-resolutions: ( {{#resolutions}} {{value}}, {{/resolutions}} ); '; $compiler->prefix .= \Clips\clips_out($str, array('min' => $min, 'max' => $max, 'resolutions' => $result), false); } }
protected function doRender($controller, $method, $args, $request, $template, $data, $controller_ret) { \Clips\clips_out($template, $data); }
/** * Generate the temp file name using template. * Only support mustache template now, and only support {{timestamp}} tag. * * usage: * * <code> * genFileName('demo-log-{{timestamp}}.log'); * </code> * * @return The filename */ public function genFileName($nt) { return \Clips\clips_out('string://' . $nt, array('timestamp' => strftime('%Y%m%d%H%M%S')), false); }
public function execute($args) { \Clips\clips_out('usage', array('script' => basename($args[0]))); }
public function widget() { $config = \Clips\interactive('interactive/widget', $this); $config->date = strftime("%a %b %e %H:%M:%S %Y"); $config->widget = ucfirst($config->widget); $namespace = \Clips\config('namespace'); if ($namespace) { $config->namespace = $namespace[0]; } else { $config->namespace = 'Clips\\'; } $widget_dir = \Clips\clips_config('widget_dir'); foreach ($widget_dir as $p) { $path = \Clips\try_path($p); if ($path) { break; } } if (!$path) { $this->output('Can\'t find any widget directory, generation failed!'); return -1; } $dir = \Clips\path_join($path, $config->widget); if (\file_exists($dir)) { $this->output('Widget %s exists!', $config->widget); return -1; } // Make the widget dir first mkdir($dir, 0755, true); // Write the widget configuration \file_put_contents(\Clips\path_join($dir, 'widget.yml'), \Clips\clips_out('widget', $config, false)); // Write the widget class \file_put_contents(\Clips\path_join($dir, 'Widget.php'), \Clips\clips_out('widget_class', $config, false)); $this->output('Done!'); }