function __construct() { //! common check for all action handlers if (!Core::$user->has("install")) { Http::redirect("login", true); } //! if bootstrap extension not installed, use cdn version if (!Core::isInst("bootstrap")) { View::css("http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"); } View::css("extensions.css"); View::jslib("sha256.js"); View::jslib("extensions.js"); }
public function testLib() { $libs = Core::lib(); $this->assertNotEmpty($libs["Developer"], "Autoloading"); $this->assertEquals($libs["Developer"], Core::lib("Developer"), "Instance"); Core::lib("TestLib1", new Extension()); $libs2 = Core::lib(); $this->assertGreaterThan(count($libs), count($libs2), "Loaded manually"); $this->assertTrue(Core::isInst("TestLib1"), "isInst"); Core::lib("TestLib2", new Client(), "TestLib1"); $this->assertNotNull(Core::lib("TestLib2"), "Dependency"); $this->assertNull(Core::lib("TestLib3"), "No extension"); $this->assertInstanceOf("\\PHPPE\\Extension", Core::lib("TestLib1"), "Classof 1"); $this->assertInstanceOf("\\PHPPE\\Client", Core::lib("TestLib2"), "Classof 2"); $this->assertEquals("PHPPE\\Extension", Core::lib("TestLib1"), "Extension toString"); }
if (isset($_REQUEST['impform'])) { $err = $choose = ""; if (!empty($_FILES['upload'])) { if ($_FILES['upload']['type'] == "text/plain") { $choose = @file_get_contents($_FILES['upload']['tmp_name']); } elseif ($_FILES['upload']['type'] == "text/html") { $d = @file_get_contents($_FILES['upload']['tmp_name']); preg_match_all("|<body[^>]*>(.*?)<\\/body|ims", $d, $b, PREG_SET_ORDER); $choose = !empty($b[0][1]) ? $b[0][1] : $d; } else { $err = L("wyswyg_htmlonly"); } } die("<html><head><meta charset='utf-8'/></head><body>" . ($choose ? "<div>" . $choose . "</div><script type='text/javascript'>parent.pe.wyswyg.importdone(\"" . $_REQUEST['impform'] . "\");</script>" : View::_t("<!form>") . "<input type='hidden' name='impform' value='" . $_REQUEST['impform'] . "'>" . "<input type='file' name='upload' onchange='this.form.submit();' id='" . $_REQUEST['impform'] . ":import'>" . ($err ? "alert('" . $err . "');" : "") . "</form>") . "</body></html>"); } $bs = Core::isInst("bootstrap"); //! get toolbars $toolbar = []; $libs = Core::lib(); foreach ($libs as $l) { if (!empty($l->wyswyg_toolbar)) { $toolbar = array_merge($toolbar, $l->wyswyg_toolbar); } } ?> pe.wyswyg = { <?php if ($bs) { ?> classes: { "toggle": "glyphicon glyphicon-eye",