Ejemplo n.º 1
0
 /**
  * @param CacheInterface $cache
  * @param Config $config
  */
 public function __construct(CacheInterface $cache, Config $config)
 {
     $this->cache = $cache;
     $this->path = $config->get('posts.path');
     $this->extensions = $config->get('posts.extensions');
     $this->blogRoute = $config->get('posts.blog_route');
 }
Ejemplo n.º 2
0
 /**
  * @param string $type
  * @param Config $config
  * @return CacheInterface
  */
 public static function create($type, Config $config)
 {
     $type = strtolower($type);
     $class = 'filesystem';
     if ($config->isEmpty("cache.{$type}.enable") || !in_array($type, ['data', 'page'])) {
         $class = 'dummy';
     }
     $class = 'Herbie\\Cache\\' . ucfirst($class) . 'Cache';
     if (!class_exists($class)) {
         throw new \Exception("Missing cache class {$class}.");
     }
     $options = $config->get("cache.{$type}", []);
     return new $class($options);
 }
Ejemplo n.º 3
0
 /**
  * @param string $shortname
  * @return string
  */
 public static function disqusTwig($shortname)
 {
     $template = self::$config->get('plugins.config.disqus.template', '@plugin/disqus/templates/disqus.twig');
     return DI::get('Twig')->render($template, ['shortname' => $shortname]);
 }
Ejemplo n.º 4
0
 /**
  * @param string $id
  * @param int $width
  * @param int $height
  * @param string $type
  * @param string $class
  * @param int $zoom
  * @param string $address
  * @return string
  */
 public static function googlemapsTwig($id = 'gmap', $width = 600, $height = 450, $type = 'roadmap', $class = 'gmap', $zoom = 15, $address = '')
 {
     self::$instances++;
     $template = self::$config->get('plugins.config.googlemaps.template', '@plugin/googlemaps/templates/googlemaps.twig');
     return DI::get('Twig')->render($template, ['id' => $id . '-' . self::$instances, 'width' => $width, 'height' => $height, 'type' => $type, 'class' => $class, 'zoom' => $zoom, 'address' => $address, 'instances' => self::$instances]);
 }