Пример #1
0
 /**
  * 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";
     });
 }
Пример #2
0
            $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();
          });
        }
      });