public static function custom($anonFunction) { Plugin_Hook::createTemp('script_load', function () { self::publishScripts(); }); Plugin_Hook::createTemp('content_load', function () use($anonFunction) { $anonFunction(); }); self::requireTemplate(); }
/** * Begins a MYSQL transaction. * Make sure to call <code>endTransaction</code> when you are * finished with your queries. * @return Self Class instance for chaining. */ public function beginTransaction() { $this->usingTransaction = true; $this->db->query('set autocommit = 0;'); $this->db->query('begin;'); Plugin_Hook::createTemp('sql_error', function () { $this->handleTransactionError(); }); return $this; }
$paste = PasteHandler_PasteAPI::forId($pasteId); if ($paste === true) { /* paste threw its one error when fetching id */ return true; } else { if ($paste === false) { Lunor::$base->router->throwError(404); return true; } } /* need to call this to check for expires pastes */ //PasteHandler_ExpirePastes::go(); Plugin_Hook::createTemp('page_title', function ($current) use($paste, $pasteId) { if (empty($paste->title)) { return 'pasted.at - ' . $pasteId; } else { return 'pasted.at - ' . $paste->title; } }); $paste->incrementViewCount(); $GLOBALS['viewingpaste'] = $paste; if ($paste->type === 'TEXT') { /* we create a hook that'll modify the pages title */ redirect('text'); Lunor::$base->router->forPage('text'); return true; } else { if ($paste->type === 'IMAGE') { redirect('image'); Lunor::$base->router->forPage('image'); return true;