OpenSencillo  2015.009
Long live the simplicity of PHP
 All Data Structures Namespaces Files Functions Pages
file.system.flesys.php
1 <?php
12 {
13  public $name;
14 
15  private $rfp;
16  private $wfp;
17  private $contents;
18 
23  public function __construct($name)
24  {
25  $this->name = $name;
26  }
31  final public function write($data)
32  {
33  $this->wfp = fopen($this->name,"wb");
34  fwrite($this->wfp,$data);
35  fclose($this->wfp);
36  }
41  final public function read()
42  {
43  $this->rfp = fopen($this->name,"rb");
44  $this->contents = '';
45  while (!feof($this->rfp))
46  {
47  $this->contents .= fread($this->rfp, 8192);
48  }
49  fclose($this->rfp);
50  return $this->contents;
51  }
52 }
62 class file extends fileSystem
63 {
68  public function __construct($name)
69  {
70  chmod("../fw_core/", 0777);
71  chmod("../fw_cache/", 0777);
72  chmod("../fw_headers/", 0777);
73  chmod("../fw_modules/", 0777);
74  chmod("../fw_libraries/", 0777);
75  chmod("../fw_script/", 0777);
76  chmod("../", 0777);
77  }
82  public function __destruct()
83  {
84  chmod("../fw_core/", 0700);
85  chmod("../fw_cache/", 0700);
86  chmod("../fw_headers/", 0700);
87  chmod("../fw_modules/", 0700);
88  chmod("../fw_libraries/", 0700);
89  chmod("../fw_script/", 0700);
90  chmod("../", 0700);
91  }
92 }
93 
103 class convert
104 {
110  public function stripHtml($html)
111  {
112  $blockTags = '/?p|/?h\\d|li|dt|br|hr|/tr';
113  $text = $html;
114  $text = preg_replace('~<!--.*-->~sU', '', $text);
115  $text = preg_replace('~<(script|style|head).*</\\1>~isU', '', $text);
116  $text = preg_replace('~<(td|th|dd)[ >]~isU', ' \\0', $text);
117  $text = preg_replace('~\\d+~u', ' ', $text);
118  $text = preg_replace('~<($blockTags)[ >/]~i', '\n\\0', $text);
119  $text = strip_tags($text);
120  $text = html_entity_decode($text, ENT_QUOTES, "utf-8");
121 
122  return $text;
123  }
124 }
125 ?>