function refreshCache($path) { $file = $this->getCacheLocation($path); // Replace existing with blank file if (file_exists($file)) { unlink($file); } touch($file); $content = tiki_get_remote_file($path); $parts = explode("\n", $content); $parts = array_map('trim', $parts); $good = false; foreach ($parts as $line) { // All lines contain 3 entries if (empty($line)) { continue; } if (substr_count($line, "\t") != 2) { return false; } $good = true; } // A valid file has at least one profile if (!$good) { return false; } file_put_contents($file, $content . "\n"); return true; }
private function traverseForExternals(&$data) { if (is_array($data)) { foreach ($data as &$value) { $this->traverseForExternals($value); } } elseif (0 === strpos($data, 'wikicontent:')) { $pageName = substr($data, strlen('wikicontent:')); $exportUrl = dirname($this->profile->url) . '/tiki-export_wiki_pages.php?' . http_build_query(array('page' => $pageName)); $content = tiki_get_remote_file($exportUrl); $content = str_replace("\r", '', $content); $begin = strpos($content, "\n\n"); if ($begin !== false) { $data = substr($content, $begin + 2); } } }