public function registrar($p) { $f = Arquivo::init($p); $k = $this->scripts->getSize(); $this->scripts->set($f, "getCaminho"); if ($this->scripts->getSize() > $k) { file_put_contents($this->registrados->getCaminho(), $this->get_scripts()); } }
public static function init($arquivo) { $o = Arquivo::init($arquivo); if ($o) { if (e_imagem($arquivo)) { $imagem = new Imagem($arquivo); } } return $imagem; }
public function filtrar_arquivos($filtro) { $xml = new SimpleXMLElement($this->buscar(2, $filtro)); $caminhos = $xml->xpath("/DIRETORIO/ARQUIVO/CAMINHO"); $this->arquivos->limpar(); for ($i = 0; $i < count($caminhos); $i++) { $this->arquivos->addElement(Arquivo::init($caminhos[$i])); } }
<?php require "../classes/Arquivo.php"; ?> <?php if (isset($_POST["arquivo"])) { $arquivo = Arquivo::init($_POST["arquivo"]); if ($arquivo) { // salvar if ($_POST["conteudo"]) { file_put_contents($arquivo->getCaminho(), $_POST["conteudo"]); } $f = file_get_contents($arquivo->getCaminho()); echo "<div style=\"text-align:center;\">"; echo "<h2>" . $arquivo->getNome() . " - " . $arquivo->getDataModificacao("d/m/Y - H:i:s") . "</h2>"; echo "<textarea>" . $f . "</textarea>"; echo "<div style=\"margin-top:5px;\">" . "<button>Limpar</button>" . "<button id=\"btn_salvar\" disabled=\"true\" onclick=\"salvar()\">Salvar</button>" . "</div>"; echo "</div>"; } }