public function __construct($config) { parent::__construct($config); $app = \Bono\App::getInstance(); $d = explode(DIRECTORY_SEPARATOR . 'src', __DIR__); $this->addBaseDirectory($d[0], 5); $this->resolveAssetPath('vendor/img'); $appConfig = $app->config('application'); $app->filter('page.title', function ($key) use($app, $appConfig) { if (isset($app->controller)) { $module = Inflector::humanize($app->controller->getClass()); return $key . ' - ' . $module; } return $key; }); $app->filter('page.header', function ($key) use($appConfig) { if (isset($appConfig['title'])) { return $appConfig['title']; } return $key; }); $app->filter('page.subheader', function ($key) use($app, $appConfig) { if (isset($app->controller)) { return Inflector::humanize($app->controller->getClass()); } if (isset($appConfig['subtitle'])) { return $appConfig['subtitle']; } return $key; }); }
public function __construct($config) { $config['baseDirectories'] = array(dirname(dirname(dirname(dirname(__FILE__))))); // var_dump($config); // exit; parent::__construct($config); // $app->filter('css', function($file) { // if ($this->app->config('bono.debug')) { // $src = $this->getPath(substr($file, 1)); // $dest = dirname($_SERVER['SCRIPT_FILENAME']).$file; // if ($this->overwrite || !is_readable($dest)) { // $dir = dirname($dest); // if (!is_readable($dir)) { // mkdir($dir, 0755, 1); // } // copy($src, $dest); // } // } // return $file; // }, 1); $app = App::getInstance(); $app->filter('table', function ($entries) use($app) { // $t = new PlainTable($app->controller->clazz); // return $t->show($entries); }); $app->filter('form', function ($entry) use($app) { // $f = new PlainForm($app->controller->clazz); // return $f->renderFields($entry); }); $app->filter('form.ro', function ($entry) use($app) { // $f = new PlainForm($app->controller->clazz); // return $f->renderReadonlyFields($entry); }); }
public function __construct($config) { parent::__construct($config); $d = explode(DIRECTORY_SEPARATOR . 'src', __DIR__); $this->addBaseDirectory($d[0], 5); $this->resolveAssetPath('vendor/platform'); $this->resolveAssetPath('vendor/v2-theme'); $this->resolveAssetPath('vendor/x-select'); }
public function __construct($config) { $this->options = @$config['options'] ?: array(); parent::__construct($config); $app = \Bono\App::getInstance(); $d = explode(DIRECTORY_SEPARATOR . 'src', __DIR__); $this->addBaseDirectory($d[0], 5); $this->resolveAssetPath('vendor/bootstrap'); $appConfig = $app->config('application'); }
/** * Constructor * * @param array $options Theme options */ public function __construct(array $options = array()) { // prepare default options $defaultOptions = array('cachePath' => 'cache'); $options = array_merge($defaultOptions, $options); $this->options = $options; // call parent constructor parent::__construct($options); // set blade-theme module dir as one of base directory $directory = explode(DIRECTORY_SEPARATOR . 'src', __DIR__); $directory = reset($directory); $this->addBaseDirectory($directory, 5); $this->app = App::getInstance(); }
/** * Constructor * * @param array $options Options of theme */ public function __construct(array $options = array()) { $app = App::getInstance(); $that = $this; // $appConfig = $app->config('application'); // $app->filter('page.title', function ($key) use ($appConfig) { // if (isset($appConfig['title'])) { // return $appConfig['title']; // } // return $key; // }); // foreach ($options as $key => $value) { // if (isset($this->$key)) { // $this->$key = $value; // unset($options[$key]); // } // } unset($options['class']); $this->options = $options; if ($p = realpath(rtrim($app->config('bono.base.path'), DIRECTORY_SEPARATOR))) { $this->addBaseDirectory($p, 1); } $d = explode(DIRECTORY_SEPARATOR . 'src', __DIR__); $this->addBaseDirectory($d[0]); $app->filter('theme.head.css', function ($data) use($that) { $html = array("\n<!-- head.css -->"); foreach ($that->resources['head.css'] as $res) { $html[] = '<link rel="stylesheet" href="' . Theme::base($res) . '">'; } return implode("\n", $html) . "\n"; }); $app->filter('theme.foot.css', function ($data) use($that) { $html = array("\n<!-- foot.css -->"); foreach ($that->resources['foot.css'] as $res) { $html[] = '<link rel="stylesheet" href="' . Theme::base($res) . '">'; } return implode("\n", $html) . "\n"; }); $app->filter('theme.head.js', function ($data) use($that) { $html = array("\n<!-- head.js -->"); foreach ($that->resources['head.js'] as $res) { $html[] = '<script type"text/javascript" src="' . Theme::base($res) . '"></script>'; } return implode("\n", $html) . "\n"; }); $app->filter('theme.foot.js', function ($data) use($that) { $html = array("\n<!-- foot.js -->"); foreach ($that->resources['foot.js'] as $res) { $html[] = '<script type"text/javascript" src="' . Theme::base($res) . '"></script>'; } return implode("\n", $html) . "\n"; }); }
public function __construct(array $options = array()) { $this->options['auto_reload'] = !empty($this->options['overwrite']) ? $this->options['overwrite'] : false; parent::__construct($options); }
$this.addClass('active'); $codeFrame.addClass('active'); $activeLine = $this; $activeFrame = $codeFrame; highlightCurrentLine(); $container.scrollTop(headerHeight); } }); if (typeof ZeroClipboard !== "undefined") { ZeroClipboard.config({ moviePath: '<?php echo \Bono\Theme\Theme::base('vendor/bono-whoops/ZeroClipboard.swf'); ?> ', }); var clipEl = document.getElementById("copy-button"); var clip = new ZeroClipboard( clipEl ); var $clipEl = $(clipEl); // show the button, when swf could be loaded successfully from CDN clip.on("load", function() { $clipEl.show(); }); } });