Пример #1
0
 function edit()
 {
     if (!Core::isTry()) {
         $page = new Page();
         $page->template = "simple";
         View::assign("page", $page);
     }
     $quickhelp = !Core::lib("CMS")->expert;
     View::assign("quickhelp", $quickhelp);
     return View::template("cms_pageinfo");
 }
Пример #2
0
 function edit()
 {
     $quickhelp = !Core::lib("CMS")->expert;
     View::assign("quickhelp", $quickhelp);
     return View::template("cms_layoutadd");
 }
Пример #3
0
 public function testCache()
 {
     \PHPPE\Core::$core->nocache = false;
     $dir = "vendor/phppe/Developer";
     \PHPPE\View::setPath($dir);
     \PHPPE\Core::$user->id = "";
     //test if there's no cache
     $mc = \PHPPE\Cache::$mc;
     $cache = new \PHPPE\Cache("files");
     $cache->set('aaa', 1);
     $cache->get('aaa');
     \PHPPE\Cache::$mc = null;
     $cache->set('aaa', 1);
     $cache->get('aaa');
     \PHPPE\Cache::$mc = $mc;
     //use memcached cache if otherwise not configured
     if (empty($mc) || empty(\PHPPE\Core::$core->cache)) {
         $mem = new \PHPPE\Cache("127.0.0.1:11211");
     }
     \PHPPE\Core::$core->nocache = false;
     if (empty(\PHPPE\Cache::$mc)) {
         $mem = new \PHPPE\Cache("files");
     }
     if (empty(\PHPPE\Cache::$mc)) {
         $this->markTestSkipped();
     }
     $this->assertNotEmpty(\PHPPE\Cache::$mc, "Cache initialized");
     $var = "t_00" . time();
     \PHPPE\Core::$core->nocache = true;
     $this->assertFalse(\PHPPE\Cache::set($var, "aaa"), "Set with nocache");
     $this->assertNull(\PHPPE\Cache::get($var), "Get with nocache");
     \PHPPE\Core::$core->nocache = false;
     $this->assertNotFalse(\PHPPE\Cache::set($var, "aaa"), "Set");
     $this->assertEquals("aaa", \PHPPE\Cache::get($var), "Get");
     $tn = 't_' . sha1(\PHPPE\Core::$core->base . "_cachetest");
     \PHPPE\Cache::set($tn, "", 1);
     $txt = \PHPPE\View::template("cachetest", ["var" => "value"]);
     $this->assertNotEmpty(\PHPPE\Cache::get($tn), "Template caching {$tn}");
     $sha = \PHPPE\Core::$core->base . "tests/http/cachetest/" . \PHPPE\Core::$user->id . "/" . \PHPPE\Core::$client->lang;
     $N = 'p_' . sha1($sha);
     \PHPPE\Cache::set($N, "", 1);
     $this->assertEmpty(\PHPPE\View::fromCache($N), "Page cache #1 " . $N);
     $url = url("tests", "http") . "cachetest";
     if (trim(@file_get_contents($url)) == '') {
         $url = str_replace("public/", "", $url);
     }
     file_get_contents($url);
     //make sure the output gets to the cache
     $d1 = file_get_contents($url);
     //this must be served from cache
     $this->assertNotEmpty(\PHPPE\View::fromCache($N), "Page cache #2 (Configure cache '127.0.0.1:11211' in config.php if fails)");
     $d2 = file_get_contents($url . "?skipcache=1");
     //trigger nocache flag set in constructor
     $this->assertNotFalse(strpos($d1, ", mc -->"), "Output cache #1");
     $this->assertFalse(strpos($d1, "NOCACHE"), "Output cache #2");
     $this->assertFalse(strpos($d2, ", mc -->"), "Output cache #3");
     $this->assertNotFalse(strpos($d2, "NOCACHE"), "Output cache #4");
     if (method_exists(\PHPPE\Cache::$mc, "cronMinute")) {
         \PHPPE\Cache::$mc->cronMinute("");
     }
 }
Пример #4
0
 function edit()
 {
     return View::template("cms_pagehist");
 }
Пример #5
0
 public function testTemplater()
 {
     $this->assertNotFalse(strpos(\PHPPE\View::template("test1"), "TOOMNY"), "Template #1");
     $this->assertNotEmpty(\PHPPE\View::template("404"), "Template #2");
     $this->assertEmpty(\PHPPE\View::template("nosuchtemplate"), "Template #3");
     $obj = new \stdClass();
     $obj->dynamicname = "dyntest";
     $obj->arr = ["a", "b", "c"];
     $obj->arr2 = [["A" => "a"], ["A" => "b"], ["A" => "c"]];
     $obj->now = time();
     $obj->singlearr = ["a"];
     $obj->arrs = unserialize('a:2:{i:0;a:2:{s:2:"id";s:5:"frame";s:4:"name";s:7:"Default";}i:1;a:2:{s:2:"id";s:6:"simple";s:4:"name";s:6:"Simple";}}');
     $obj->objs = unserialize('a:2:{i:0;O:8:"stdClass":2:{s:2:"id";s:5:"frame";s:4:"name";s:5:"Frame";}i:1;O:8:"stdClass":2:{s:2:"id";s:6:"simple";s:4:"name";s:6:"Simple";}}');
     $obj->spec[0] = new \stdClass();
     $obj->spec[0]->id = 1;
     $obj->spec[0]->name = [1, 2, 3];
     $obj->emptyStr = "";
     \PHPPE\View::assign("obj", $obj);
     \PHPPE\View::assign("app", $obj);
     \PHPPE\View::assign("core", \PHPPE\Core::$core);
     $this->assertEquals("dynamic name", \PHPPE\View::_t("<!include dynamicname>"), "Dynamic name");
     $this->assertEquals("<!-- not removed -->test", \PHPPE\View::_t("<!-- not removed -->test"), "Comment");
     $this->assertEquals("<!app>", \PHPPE\View::_t("<!app>"), "App tag");
     $this->assertEquals(\PHPPE\Core::$core->now . "", \PHPPE\View::_t("<!=core.now>"), "Expression #1");
     $this->assertNotFalse(strpos(\PHPPE\View::_t("<!=core.now=1>"), "INP"), "Expression #2");
     $this->assertEquals("aa\"bb", \PHPPE\View::_t('<!="aa\\"bb">'), "Expression #3");
     $this->assertFalse(strpos(\PHPPE\View::_t("<!=sprintf('aaabbb')>"), "BADFNC"), "Expression #4");
     \PHPPE\View::$C = [];
     \PHPPE\Core::$core->allowed = ["number_format"];
     $this->assertNotFalse(strpos(\PHPPE\View::_t("<!=sprintf('aaabbb')>"), "BADFNC"), "Expression #5");
     \PHPPE\Core::$core->allowed = [];
     unset(\PHPPE\Core::$l['aaa_bbb']);
     $this->assertEquals("aaa bbb", \PHPPE\View::_t('<!L aaa_bbb>'), "Language");
     $this->assertNotFalse(strpos(\PHPPE\View::_t("<!notag>"), "UNKTAG"), "Unknown tag");
     $this->assertNotFalse(strpos(\PHPPE\View::_t('<!var noSuchAddon>'), "UNKADDON"), "Unknown AddOn");
     \PHPPE\Core::$l['min'] = "m";
     \PHPPE\Core::$l['mins'] = "ms";
     \PHPPE\Core::$l['hour'] = "h";
     \PHPPE\Core::$l['hours'] = "hs";
     \PHPPE\Core::$l['day'] = "d";
     \PHPPE\Core::$l['days'] = "ds";
     $this->assertEquals("0 m", \PHPPE\View::_t('<!difftime 1>'), "Difftime #1");
     $this->assertEquals("1 m", \PHPPE\View::_t('<!difftime 60>'), "Difftime #2");
     $this->assertEquals("2 ms", \PHPPE\View::_t('<!difftime 120>'), "Difftime #3");
     $this->assertEquals("1 h", \PHPPE\View::_t('<!difftime 3600>'), "Difftime #4");
     $this->assertEquals("1 h, 1 m", \PHPPE\View::_t('<!difftime 3660>'), "Difftime #5");
     $this->assertEquals("2 hs, 2 ms", \PHPPE\View::_t('<!difftime 3660*2>'), "Difftime #6");
     $this->assertEquals("1 d", \PHPPE\View::_t('<!difftime 3600*24>'), "Difftime #7");
     $this->assertEquals("2 ds", \PHPPE\View::_t('<!difftime 3600*48>'), "Difftime #8");
     $this->assertEquals("2 ds", \PHPPE\View::_t('<!difftime 3600*50>'), "Difftime #9");
     $this->assertEquals("- 2 ms", \PHPPE\View::_t('<!difftime -120>'), "Difftime #10");
     $this->assertEquals("1 m", \PHPPE\View::_t('<!difftime 3660 3600>'), "Difftime #11");
     $this->assertEquals("-", \PHPPE\View::_t('<!difftime obj.emptyStr 10>'), "Difftime #12");
     $this->assertEquals("aaa", \PHPPE\View::_t("<!template>aaa<!/template>"), "Reentrant #1");
     $this->assertEquals(\PHPPE\Core::$core->now, \PHPPE\View::_t("<!template><%=core.now><!/template>"), "Reentrant #2");
     $this->assertEquals("011a120b231c", \PHPPE\View::_t("<!foreach arr><!=KEY><!=IDX><!=ODD><!=VALUE><!/foreach>"), "Foreach #1");
     $this->assertEquals("abc", \PHPPE\View::_t("<!foreach obj.arr2><!=A><!/foreach>"), "Foreach #2");
     $this->assertNotFalse(strpos(\PHPPE\View::_t("!foreach obj.arr2><!=A><!/foreach>"), "UNCLS"), "Foreach #3");
     $this->assertEquals("0a0b0c1a1b1c2a2b2c", \PHPPE\View::_t("<!foreach arr><!foreach obj.arr2><!=parent.KEY><!=A><!/foreach><!/foreach>"), "Foreach #4");
     $this->assertEquals("01101a00102b01103c11001a10002b11003c21101a20102b21103c01111a00112b01113c11011a10012b11013c21111a20112b21113c01121a00122b01123c11021a10022b11023c21121a20122b21123c", \PHPPE\View::_t("<!foreach arr><!foreach obj.arr><!foreach obj.arr2><!=parent.KEY><!=ODD><!=parent.ODD><!=parent.parent.KEY><!=IDX><!=A><!/foreach><!/foreach><!/foreach>"), "Foreach #5");
     $this->assertEquals("a0framea0framea1simplea1simple", \PHPPE\View::_t("<!foreach obj.arrs><!foreach VALUE>a<!=parent.KEY><!=parent.id><!/foreach><!/foreach>"), "Foreach #6");
     $this->assertEquals("frameFramesimpleSimple", \PHPPE\View::_t("<!foreach obj.objs><!=id><!=name><!=none><!/foreach>"), "Foreach #7");
     $this->assertEquals("A", \PHPPE\View::_t("<!if true>A<!else>B<!/if>"), "If true");
     $this->assertEquals("B", \PHPPE\View::_t("<!if false>A<!else>B<!/if>"), "If false");
     $this->assertEquals(1, preg_match("|<form name='a' action='[^']+' class='form-vertical' method='post' enctype='multipart/form-data'><input type='hidden' name='MAX_FILE_SIZE' value='[0-9]+'><input type='hidden' name='pe_s' value='[a-fA-F0-9]*'><input type='hidden' name='pe_f' value='a'>|ims", \PHPPE\View::_t("<!form a>")), "Form #1");
     $this->assertEquals(1, preg_match("|<form name='a' action='([^']+)' class='form-vertical' method='post' enctype='multipart/form-data'><input type='hidden' name='MAX_FILE_SIZE' value='[0-9]+'><input type='hidden' name='pe_s' value='[a-fA-F0-9]*'><input type='hidden' name='pe_f' value='a'>|ims", \PHPPE\View::_t("<!form a form-vertical b/c>"), $m), "Form #2");
     $this->assertEquals("b/c/", substr($m[1], -4), "Form #2 url");
     $this->assertEquals(1, preg_match("|<form role='form' name='a' action='([^']+)' class='form-vertical' method='post' enctype='multipart/form-data' onsubmit=\"d\\(\\)\"><input type='hidden' name='MAX_FILE_SIZE' value='[0-9]+'><input type='hidden' name='pe_s' value='[a-fA-F0-9]*'><input type='hidden' name='pe_f' value='a'>|ims", \PHPPE\View::_t("<!form a - b/c d() role>"), $m), "Form #3");
     $this->assertEquals("b/c/", substr($m[1], -4), "Form #3 url");
     $this->assertEquals(1, preg_match("|<form name='a' action='([^']+)' class='form-vertical' method='post' enctype='multipart/form-data' onsubmit=\"d\\(\\)\"><input type='hidden' name='MAX_FILE_SIZE' value='[0-9]+'><input type='hidden' name='pe_s' value='[a-fA-F0-9]*'><input type='hidden' name='pe_f' value='a'>|ims", \PHPPE\View::_t("<!form a - - d()>")), "Form #4");
     $_SESSION['pe_c'] = $_SESSION['pe_e'] = false;
     $this->assertEquals("show1", \PHPPE\View::_t('<!var test1 test>'), "var tag (pe_c=0,pe_e=0,show)");
     $this->assertEquals("show1", \PHPPE\View::_t('<!widget test1 test>'), "widget tag (pe_c=0,pe_e=0,show)");
     $this->assertEquals("edit1", \PHPPE\View::_t('<!field test1 test>'), "field tag (pe_c=0,pe_e=0,edit)");
     $_SESSION['pe_c'] = true;
     $this->assertEquals("show1", \PHPPE\View::_t('<!var test1 test>'), "var tag (pe_c=1,pe_e=0,show)");
     $this->assertEquals("edit1", \PHPPE\View::_t('<!widget test1 test>'), "widget tag (pe_c=1,pe_e=0,edit)");
     $this->assertEquals("edit1", \PHPPE\View::_t('<!field test1 test>'), "field tag (pe_c=1,pe_e=0,edit)");
     $_SESSION['pe_c'] = false;
     $_SESSION['pe_e'] = true;
     $this->assertEquals("edit1", \PHPPE\View::_t('<!var test1 test>'), "var tag (pe_c=0,pe_e=1,edit)");
     $this->assertEquals("show1", \PHPPE\View::_t('<!widget test1 test>'), "widget tag (pe_c=0,pe_e=1,show)");
     $this->assertEquals("edit1", \PHPPE\View::_t('<!field test1 test>'), "field tag (pe_c=0,pe_e=1,edit)");
     $_SESSION['pe_c'] = $_SESSION['pe_e'] = false;
     $this->assertNotFalse(strpos(\PHPPE\View::_t('<!field *text test>'), "required"), "field tag (required)");
     \PHPPE\Core::$user->id = 1;
     $this->assertEmpty(\PHPPE\View::_t('<!var @noacl test1 test>'), "var tag (noacl)");
     $this->assertEmpty(\PHPPE\View::_t('<!field @noacl test1 test>'), "field tag (noacl)");
     \PHPPE\Core::$user->id = -1;
     $this->assertEquals("show1", \PHPPE\View::_t('<!var @noacl test1 test>'), "var tag (noacl admin)");
     $this->assertEquals("edit1", \PHPPE\View::_t('<!field @noacl test1 test>'), "field tag (noacl admin)");
     $u = \PHPPE\Core::$user->id;
     \PHPPE\Core::$user->id = 0;
     $this->assertEquals("", \PHPPE\View::_t('<!cms test1 test>'), "cms tag #1");
     $this->assertEquals("show1", \PHPPE\View::_t('<!cms *test1 test>'), "cms tag #2");
     \PHPPE\Core::$user->id = -1;
     $app = new \PHPPE\Content();
     \PHPPE\View::assign("app", $app);
     $this->assertNotFalse(strpos(\PHPPE\View::_t('<!cms test1 test>'), "cms.edit"), "cms tag #3");
     \PHPPE\Core::$user->id = $u;
     $this->assertEquals("show3", \PHPPE\View::_t('<!var test3 test>'), "Addon init");
     \PHPPE\Core::$l['dateformat'] = "Y-m-d";
     \PHPPE\Core::$l['testdate'] = "2001-02-03 04:05:06";
     date_default_timezone_set("UTC");
     $this->assertEquals("2001-02-03", \PHPPE\View::_t('<!date L("testdate")>'), "Date #1");
     $this->assertEquals("2001-02-03 04:05:06", \PHPPE\View::_t('<!time L("testdate")>'), "Time #1");
     $this->assertEquals("1970-01-01", \PHPPE\View::_t('<!date 1>'), "Date #2");
     $this->assertEquals(1, preg_match("/1970-01-01 [0-9]+:00:01/", \PHPPE\View::_t("<!time 1>")), "Time #2");
     \PHPPE\Core::$core->runlevel = 0;
     $this->assertEmpty(\PHPPE\View::_t('<!dump obj>'), "Dump #1");
     \PHPPE\Core::$core->runlevel = 1;
     $this->assertEquals(1, preg_match("/stdClass Object/", \PHPPE\View::_t("<!dump obj>")), "Dump #2");
     \PHPPE\Core::$core->runlevel = 2;
     $d = \PHPPE\View::_t("<!dump obj>");
     $this->assertEquals(1, preg_match("/string\\(7\\) \"dyntest\"/", $d) || preg_match("/var\\-dump/", $d), "Dump #3");
     $this->assertEquals(0, preg_match("/pe_u/", \PHPPE\View::_t("<!dump _SESSION>")), "Dump #4");
     \PHPPE\Core::$core->noframe = false;
     \PHPPE\Core::$core->output = "html";
     \PHPPE\Core::$user->id = -1;
     $this->assertEquals(1, preg_match("/bbb/", \PHPPE\View::generate("test1", "t_" . sha1(\PHPPE\Core::$core->base . "_test1"))), "Generate");
     \PHPPE\Cache::$mc = null;
     ob_start();
     $txt = "TEST";
     @\PHPPE\View::output($txt);
     $this->assertEquals(1, preg_match("/TEST/", ob_get_clean()), "Output #1");
     \PHPPE\Cache::$mc = new \PHPPE\Cache\Files("files");
     \PHPPE\Core::$core->nocache = false;
     \PHPPE\Core::$core->noaggr = false;
     $obj->favicon = "favicon.png";
     $_SESSION['pe_ls'] = ["en" => "en"];
     \PHPPE\View::menu("aaa", "aaa/bbb");
     \PHPPE\View::menu("ccc", ["ccc" => "ccc/ddd"]);
     //save it to cache
     $sha = \PHPPE\Core::$core->base . \PHPPE\Core::$core->url . "/" . \PHPPE\Core::$user->id . "/" . \PHPPE\Core::$client->lang;
     \PHPPE\Cache::set("c_" . sha1($sha . "_css"), "");
     \PHPPE\Cache::set("c_" . sha1($sha . "_js"), "");
     ob_start();
     @\PHPPE\View::output($txt);
     $this->assertEquals(1, preg_match("/div class='menu'/", ob_get_clean()), "Output #2");
     //read from cache
     ob_start();
     @\PHPPE\View::output($txt);
     $this->assertEquals(1, preg_match("/div class='menu'/", ob_get_clean()), "Output #3");
     ob_start();
     @\PHPPE\View::output($txt, "aaa");
     $this->assertEquals(1, preg_match("/<\\/span><span class='menu_a'>/", ob_get_clean()), "Active menu #1");
     ob_start();
     @\PHPPE\View::output($txt, "ccc");
     $this->assertEquals(1, preg_match("/class='menu_a' onclick/", ob_get_clean()), "Active menu #2");
 }
Пример #6
0
 /**
  * default action
  */
 function action($item)
 {
     //! check access rights
     if (!Core::$user->has("siteadm|webadm")) {
         Http::redirect("403");
     }
     //! if we have to delete a page version
     if (isset($_REQUEST['pagedel'])) {
         if (!empty($_REQUEST['created'])) {
             Page::delete($item, $_REQUEST['created']);
         }
         Http::redirect($item);
     }
     //! revert to an old version of the page
     if (isset($_REQUEST['revert'])) {
         if (!empty($_REQUEST['created'])) {
             Core::log('A', sprintf("Page %s reverted to %s by %s", $item, $_REQUEST['created'], Core::$user->name), "cmsaudit");
             DS::exec("UPDATE pages set created=CURRENT_TIMESTAMP,modifyd=CURRENT_TIMESTAMP,modifyid=? WHERE id=? AND (lang='' OR lang=?) AND created=?", [Core::$user->id, $item, Core::$client->lang, $_REQUEST['created']]);
         }
         Http::redirect($item);
     }
     //! get the latest public version's date
     if (empty($_REQUEST['created'])) {
         $_REQUEST['created'] = DS::field("created", "pages", "(id=? OR ? LIKE id||'/%') AND (lang='' OR lang=?) AND publishid!=0", "", "id DESC,created DESC", [$item, $item, Core::$client->lang]);
         if (empty($_REQUEST['created'])) {
             $_REQUEST['created'] = DS::field("created", "pages", "(id=? OR ? LIKE id||'/%') AND (lang='' OR lang=?)", "", "id DESC,created ASC", [$item, $item, Core::$client->lang]);
         }
     }
     //! load frame page for page parameters and dds
     $frame = DS::fetch("data,dds", "pages", "id='frame' AND (lang='' OR lang=?) AND created<=?", "", "", [Core::$client->lang, $_REQUEST['created']]);
     $frame['dss'] = @json_decode($frame['dds'], true);
     $frame['data'] = @json_decode($frame['data'], true);
     View::assign("frame", $frame['data']);
     //! load archive version
     //! normally you would use Model, but that would only return the latest version
     $page = DS::fetch("*", "pages", "(id=? OR ? LIKE id||'/%') AND (lang='' OR lang=?) AND created=?", "", "id DESC,created DESC", [$item, $item, Core::$client->lang, $_REQUEST['created']]);
     $this->title = $page['name'];
     $title = L("ARCHIVE") . " " . $page['name'];
     if (is_string($page['data'])) {
         $page['data'] = @json_decode($page['data'], true);
     }
     if (is_array($page['data'])) {
         foreach ($page['data'] as $k => $v) {
             $this->{$k} = $v;
         }
     }
     foreach (["id", "name", "lang", "filter", "template", "pubd", "expd", "dds", "ownerid", "created"] as $k) {
         $this->{$k} = $page[$k];
     }
     $p = @array_merge($frame['dds'], @json_decode($page['dds'], true));
     if (is_array($p)) {
         foreach ($p as $k => $c) {
             if ($k != "dds") {
                 try {
                     $this->{$k} = DS::query($c[0], $c[1], @$c[2], @$c[3], @$c[4], @$c[5], View::getval(@$c[6]));
                 } catch (\Exception $e) {
                     Core::log("E", $item . " " . $e->getMessage() . " " . implode(" ", $c), "dds");
                 }
             }
         }
     }
     $old = View::template($this->template);
     //! if we have to compare to an older (or the latest) version
     if (isset($_REQUEST['diff'])) {
         include_once "vendor/phppe/CMS/libs/simplediff.php";
         //! load current version
         $frame = DS::fetch("data,dds", "pages", "id='frame' AND (lang='' OR lang=?) AND publishid!=0", "", "created DESC", [Core::$client->lang]);
         $frame['dss'] = @json_decode($frame['dds'], true);
         $frame['data'] = @json_decode($frame['data'], true);
         View::assign("frame", $frame['data']);
         $page = DS::fetch("*", "pages", "id=? OR ? LIKE id||'/%'", "", "id DESC,created DESC", [$item, $item]);
         if (is_string($page['data'])) {
             $page['data'] = @json_decode($page['data'], true);
         }
         if (is_array($page['data'])) {
             foreach ($page['data'] as $k => $v) {
                 $this->{$k} = $v;
             }
         }
         foreach (["id", "name", "lang", "filter", "template", "pubd", "expd", "dds", "ownerid", "created"] as $k) {
             $this->{$k} = $page[$k];
         }
         $p = @array_merge($frame['dds'], @json_decode($page['dds'], true));
         if (is_array($p)) {
             foreach ($p as $k => $c) {
                 if ($k != "dds") {
                     try {
                         $this->{$k} = DS::query($c[0], $c[1], @$c[2], @$c[3], @$c[4], @$c[5], View::getval(@$c[6]));
                     } catch (\Exception $e) {
                         Core::log("E", $item . " " . $e->getMessage() . " " . implode(" ", $c), "dds");
                     }
                 }
             }
         }
         $this->title = $page['name'];
         $curr = View::template($this->template);
         //! make sure diff splits on tag end
         $this->result = htmlDiff(preg_replace("/>([^\\ \t\n])/m", "> \\1", $old), preg_replace("/>([^\\ \t\n])/m", "> \\1", $curr));
         //! remove diff inside tags
         $this->result = preg_replace("/(<[^<>]+)<ins>.*?<\\/ins>([^<>]*>)/ims", "\\1\\2", $this->result);
         $this->result = preg_replace("/(<[^<>]+)<del>(.*?)<\\/del>([^<>]*>)/ims", "\\1\\2\\3", $this->result);
     } else {
         $this->result = $old;
     }
     $this->title = $title;
 }