Exemple #1
0
 /**
  * Get the cache path of a view
  *
  * @param string			$view
  * @return string
  */
 public static function cache_path($view)
 {
     if (strpos($view, '::') !== false) {
         list($package, $view) = explode('::', $view);
     } else {
         $package = 'app';
     }
     return \CCStorage::path('views/' . $package . '/' . $view . EXT);
 }
Exemple #2
0
 /**
  * write the log down to disk
  *
  * @return void
  */
 public static function write()
 {
     if (empty(static::$_data)) {
         return;
     }
     $buffer = date("H:i:s") . " - " . CCServer::method() . ' ' . CCServer::server('REQUEST_URI') . "\n";
     $buffer .= implode("\n", static::$_data);
     CCFile::append(CCStorage::path('logs/' . date('Y-m') . '/' . date('d') . '.log'), $buffer . "\n");
     // clear
     static::clear();
 }
Exemple #3
0
 /**
  * Get the file path by id
  *
  * @param string			$id
  * @return string
  */
 private function file_path($id)
 {
     return \CCStorage::path('sessions/' . $id . '.json');
 }
Exemple #4
0
 /**
  * Send the mail
  *
  * @param CCMail 		$mail	The mail object.
  * @return void
  *
  * @throws Mail\Exception
  */
 public function send(CCMail $mail)
 {
     $data = $mail->export_data();
     $filename = 'mails/' . date('Y-m') . '/' . date('d') . '/' . date("H-i-s") . '-' . \CCStr::clean_url($data['subject']) . '.log';
     \CCFile::append(\CCStorage::path($filename), \CCJson::encode($data, true));
 }
Exemple #5
0
 /**
  * CCStorage::add tests
  */
 public function test_add()
 {
     CCStorage::add('cdn', CCROOT . 'cdn/', 'http://cdn01.clancats.com/');
     $this->assertTrue(strpos(CCStorage::path('path.txt', 'cdn'), 'cdn/path.txt') !== false);
     $this->assertEquals(CCStorage::url('path.txt', 'cdn'), 'http://cdn01.clancats.com/path.txt');
 }