コード例 #1
0
 function get_icons($iconset = false)
 {
     if (!$iconset) {
         $iconset = $this->set;
     }
     $sets = $this->get_iconsets();
     if (!$sets[$iconset]) {
         $iconset = $this->set;
     }
     $url = $sets[$iconset]['url'];
     $pattern = $sets[$iconset]['pattern'];
     $filename = basename($url);
     $file = cache_path($filename);
     if (!is_writable(dirname($file))) {
         $file = sys_get_temp_dir() . '/' . $filename;
     }
     if (!file_exists($file)) {
         copy($url, $file);
     }
     $content = file_get_contents($file);
     $match = array();
     preg_match_all($pattern, $content, $match);
     if (!empty($match)) {
         array_shift($match);
         $list = array_shift($match);
         sort($list);
         return array_combine($list, $list);
     }
 }
コード例 #2
0
 public function html()
 {
     // Get settings
     $settings = $this->config;
     // Define Simplepie
     $feed = new \SimplePie();
     $feed->set_feed_url($settings['feed']);
     $feed->enable_cache($settings['enable_cache']);
     $feed->set_cache_location(cache_path());
     $feed->set_cache_duration(60 * 60 * 12);
     $feed->set_output_encoding($settings['charset']);
     $feed->init();
     $title = $settings['title'];
     $data = [];
     foreach ($feed->get_items($settings['offset'], $settings['limit']) as $key => $item) {
         $data[$key]['title'] = $item->get_title();
         $data[$key]['permalink'] = $item->get_permalink();
         $data[$key]['date'] = $item->get_date();
         $data[$key]['updated_date'] = $item->get_updated_date();
         $data[$key]['author'] = $item->get_author();
         $data[$key]['category'] = $item->get_category();
         $data[$key]['description'] = $item->get_description();
         $data[$key]['content'] = $item->get_content();
     }
     return $this->view('rssfeed', compact('title', 'data'));
 }
コード例 #3
0
 /**
  * Execute the command.
  *
  * @param  \Symfony\Component\Console\Input\InputInterface   $input
  * @param  \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @throws \Exception
  * @return void
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     if (is_dir(config_path())) {
         throw new Exception("Packager has already been initialized.");
     }
     $this->writeComment('Initializing packager config...');
     mkdir(config_path());
     mkdir(cache_path());
     copy(__DIR__ . '/stubs/Packager.json', config_path() . '/Packager.json');
     $this->writeInfo('Packager config stub created at: ' . config_path());
     $this->call('author');
 }
コード例 #4
0
 protected function getTemplatePath()
 {
     $name = $this->input->getArgument('name') . '.json';
     return cache_path() . DIRECTORY_SEPARATOR . $name;
 }
コード例 #5
0
ファイル: Blade.php プロジェクト: krzysztofair/blog-core
 public function __construct()
 {
     $views = views_path();
     $cache = cache_path('');
     $this->blade = new BladeEngine($views, $cache);
 }
コード例 #6
0
ファイル: Session.php プロジェクト: leon723/chestnut
 public function __construct()
 {
     $handle = new NativeFileSessionHandler(cache_path('session/'));
     $storage = new NativeSessionStorage(['use_cookies' => 0], $handle);
     parent::__construct($storage);
 }
コード例 #7
0
ファイル: helpers.php プロジェクト: Antoine07/pmcv
 /**
  * @param $name
  * @param $hash
  * @param array $data
  */
 function cache_put($name, $hash, $data = [])
 {
     $fileCache = cache_path($hash);
     ob_start();
     view($name, $data);
     $content = ob_get_contents();
     ob_end_clean();
     file_put_contents($fileCache, $content);
     echo $content;
     @chmod($fileCache, 0775);
 }