-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
56 lines (49 loc) · 1.62 KB
/
test.php
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
<?php
error_reporting (E_ALL);
ini_set ('display_errors', true);
echo "esto ha sido redirigido";
$entrada = "nivel 1 [url] nivel 2 [url] nivel 3 [/url] nivel 2 [/url] nivel 1";
class recursivo {
private $param ;
public function __construct($helper){
$this->param["helper"] = $helper ;
$this->param["etiqueta"] = "" ;
}
public function set_etiqueta($etiqueta){
$this->param["etiqueta"] = $etiqueta ;
}
public function get_etiqueta($etiqueta){
return $this->param["etiqueta"] ;
}
public function analiza($entrada,$etiqueta){
$this->param["etiqueta"] = $etiqueta ;
return $this->analizarEtiquetasRecursivo($entrada);
}
function analizarEtiquetasRecursivo($entrada)
{
$etiqueta = $this->param["etiqueta"];
$h = $this->param["helper"];
// $regex = '#\[url]((?:[^[]|\[(?!/?url])|(?R))+)\[/url]#';
$regex = '#\['.$etiqueta.']((?:[^[]|\[(?!/?'.$etiqueta.'])|(?R))+)\[/'.$etiqueta.']#';
if (is_array($entrada)) {
$entrada = '<div style="margin-left: 10px">'.$entrada[1].'</div>'."\n";
}
return preg_replace_callback($regex, 'self::analizarEtiquetasRecursivo', $entrada);
}
}
$n = new recursivo("test");
// $n->set_etiqueta("url");
$salida = $n->analiza($_GET["a"],"a");
echo $salida;
$salida = $n->analiza($entrada,"url");
echo $salida;
echo "<br>\n";
/* cosas utilies
<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M6B9RZQ>m_auth=TiByp1Z92r_vHHqYjmr5yQ>m_preview=env-6>m_cookies_win=x" height="0" width="0" style="display:none;visibility:hidden"></iframe>
*
*
*/
foreach (glob("/home/leandro/www/contable/admin/default/auxiliar/*.php",GLOB_NOSORT) as $f){
echo "arcivo:$f<br>\n";
}
?>