<?php /** * Menu Manager * ------------ */ Route::accept($config->manager->slug . '/menu', function () use($config, $speak) { if (Guardian::get('status') !== 'pilot') { Shield::abort(); } $menus = Get::state_menu(); Config::set(array('page_title' => $speak->menus . $config->title_separator . $config->manager->title, 'cargo' => DECK . DS . 'workers' . DS . 'cargo.menu.php')); $G = array('data' => array('content' => $menus)); if ($request = Request::post()) { Guardian::checkToken($request['token']); // Check for invalid input if (preg_match('#(^|\\n)(\\t| {1,3})(?:[^ ])#', $request['content'])) { Notify::error($speak->notify_invalid_indent_character); Guardian::memorize($request); } $P = array('data' => $request); if (!Notify::errors()) { File::write($request['content'])->saveTo(STATE . DS . 'menu.txt', 0600); Notify::success(Config::speak('notify_success_updated', $speak->menu)); Weapon::fire('on_menu_update', array($G, $P)); Guardian::kick($config->url_current); } } Shield::lot(array('segment' => 'menu', 'the_content' => $menus))->attach('manager', false); });
{ echo Asset::javascript(File::D(__DIR__) . DS . 'assets' . DS . 'sword' . DS . 'do.js'); } function do_response_reply_x($post) { global $config, $speak, $parent; $s = Asset::loaded($config->protocol . ICON_LIBRARY_PATH) ? '<i class="fa fa-times-circle"></i> ' : ""; echo ' <a href="' . $post->url . '" class="btn btn-reject btn-reject-reply"' . ($parent === false ? ' style="display:none;"' : "") . '>' . $s . $speak->cancel . '</a>'; } Weapon::add('comment_footer', 'do_response_reply', 20.1); Weapon::add('comment_form_button_after', 'do_response_reply_x'); Weapon::add('shell_before', 'do_response_reply_css'); Weapon::add('SHIPMENT_REGION_BOTTOM', 'do_response_reply_js'); // No JavaScript if ($parent !== false) { Guardian::memorize('parent', $parent); if ($response = Get::commentAnchor($parent)) { Weapon::add('chunk_before', function ($G) use($speak, $parent, $response) { if (File::N($G['data']['path']) === 'comment.form') { $prefix = File::B(File::D($response->path)); $to = Config::speak($prefix . '_reply_to_', Cell::a('#' . $prefix . '-' . $parent, $response->name)); echo Cell::h4($to); } }); } } // Error if ($s = Request::post('parent', false)) { Filter::add('guardian:kick', function ($url) use($config, $s) { if (!Notify::errors()) { return $url;
public static function error($text = "", $icon = null, $tag = 'p') { self::add('error', $text, $icon, $tag); Guardian::memorize(); self::$errors++; }
/** * ============================================================ * URL REDIRECTION * ============================================================ * * -- CODE: --------------------------------------------------- * * Guardian::kick('manager/login'); * * ------------------------------------------------------------ * */ public static function kick($path = "") { $path = Converter::url(File::url($path)); $path = Filter::apply('guardian:kick', $path); $G = array('data' => array('url' => $path)); Guardian::memorize(array('url_origin' => Config::get('url_current'))); Weapon::fire('before_kick', array($G, $G)); header('Location: ' . $path); exit; }
<?php // default Notify::plug('bare', function ($text, $icon = 'bell', $kind = 'default') { Notify::add($kind, ($icon ? '<i class="fa fa-fw fa-' . $icon . '"></i> ' : "") . $text); }); // success Notify::plug('success', function ($text, $icon = 'check') { Notify::bare($text, $icon, 'success'); Guardian::forget(); }); // info Notify::plug('info', function ($text, $icon = 'info-circle') { Notify::bare($text, $icon, 'info'); }); // warning Notify::plug('warning', function ($text, $icon = 'exclamation-triangle') { Notify::bare($text, $icon, 'warning'); Guardian::memorize(); Notify::$errors++; }); // error Notify::plug('error', function ($text, $icon = 'times') { Notify::bare($text, $icon, 'error'); Guardian::memorize(); Notify::$errors++; });