Depois de um tempo sem atualizar vamos a uma diga rápida.
Para remover o “’” (apóstrofo) das datas no Calc.
Use a expressão regular ^. para busca e & para substituição, conforme a imagem abaixo (clique para ampliar).
Depois de um tempo sem atualizar vamos a uma diga rápida.
Para remover o “’” (apóstrofo) das datas no Calc.
Use a expressão regular ^. para busca e & para substituição, conforme a imagem abaixo (clique para ampliar).
Fiz o script seguir há um tempo atrás, pra estudo dos Metacaracteres Modernosos.
Com eles consigo substituir apenas as partes do texto que eu quero, neste caso as tags do PHP.
Fica a dica pra estudos.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | <?php /** * @author: Bruno Nasscimento * @version 0.000a before alpha */ class PHPLongTagFix { private $path_files = './'; const PHPLONGTAG = '<?php'; public function setPathFiles($path){ $this->path_files = basename($path); } private function getFiles() { return glob($this->path_files . "/*.php"); } private function array_flatten($array) { if (!is_array($array)) { return FALSE; } $result = array(); foreach ($array as $key => $value) { if (is_array($value)) { $result = array_merge($result, $this->array_flatten($value)); } else { $result[$key] = $value; } } return $result; } public function fix($verbose = 1) { $files = $this->getFiles(); $logs = ''; foreach ($files as $filename) { $content = file_get_contents($filename); $a = preg_replace("/<?(?![php|xml|=])/", self::PHPLONGTAG, $content); $filename = $filename . "_2"; // file_put_contents($filename, $a); $logs .= $filename . "n"; } if($verbose){ echo "Files: nn"; echo $logs; } } public function checkDeprecated() { $files = $this->getFiles(); echo "n"; foreach ($files as $filename) { $content = file_get_contents($filename); $pattern = "/(call_user_method|call_user_method_array|ereg_replace|ereg|split|define_syslog_variables|eregi|set_magic_quotes_runtime|session_register|session_unregister|session_is_registered|set_socket_blocking|spliti|sql_regcase|mysql_db_query|mysql_escape_string)/"; $total = preg_match_all($pattern, $content, $matchesarray); $localizados = implode(",", array_unique($this->array_flatten($matchesarray))); echo "$filename : $total ( $localizados )n "; } } } header("Content-type: text/plain"); $objPHPFix = new PHPLongTagFix(); $objPHPFix->setPathFiles("./testes"); $objPHPFix->fix(); $objPHPFix->checkDeprecated(); ?> |
Abraços e até o próximo script