⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.1
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
muhasebe
/
modules
/
Core
/
Helpers
/
Edit File: SitemapHelper.php
<?php namespace Modules\Core\Helpers; use Illuminate\Support\Facades\Cache; class SitemapHelper { protected $all_pages = []; protected $active_pages = []; public function add($id,$callable,$priority = 10){ $this->all_pages[] = [$id,$callable,$priority]; } public function all(){ return $all = $this->loadActives(); } public function path($path_id = false){ $all = $this->loadActives(); if(!array_key_exists($path_id,$all)) return []; $item = $all[$path_id]; return Cache::remember('sitemap_'.$path_id, 5 * DAY_IN_SECONDS, function () use ($item) { return call_user_func($item['callable']); }); } public function clear($path_id){ Cache::forget('sitemap_'.$path_id); } protected function loadActives(){ if(!empty($this->active_pages)) return $this->active_pages; foreach ($this->all_pages as $data){ list($id,$callable,$priority) = $data; if(!is_callable($callable)){ continue; }; if(!array_key_exists($id,$this->active_pages)){ $this->active_pages[$id] = [ 'callable'=>$callable, 'priority'=>$priority ]; }else{ if(version_compare($priority,$this->active_pages[$id]['priority'],'>')){ $this->active_pages[$id] = [ 'callable'=>$callable, 'priority'=>$priority ]; } } } return $this->active_pages; } }
Simpan