Example #1
0
 /**
  * Build sitemap index files information - location, last modify time
  */
 public function make()
 {
     if (!Obj::isArray($this->files)) {
         return;
     }
     // build file information data
     foreach ($this->files as $file) {
         $this->info[] = ['loc' => App::$Alias->scriptUrl . $file, 'lastmod' => Date::convertToDatetime(File::mTime($file), 'c')];
     }
 }
Example #2
0
 /**
  * Get user avatar full url for current object
  * @param string $type
  * @return string
  */
 public function getAvatarUrl($type = 'small')
 {
     $default = '/upload/user/avatar/' . $type . '/default.jpg';
     if (!Arr::in($type, ['small', 'big', 'medium'])) {
         return MainApp::$Alias->scriptUrl . $default;
     }
     $route = '/upload/user/avatar/' . $type . '/' . $this->user_id . '.jpg';
     if (File::exist($route)) {
         return MainApp::$Alias->scriptUrl . $route . '?mtime=' . File::mTime($route);
     }
     return MainApp::$Alias->scriptUrl . $default;
 }