function __do_response_reply_count($response) { global $config, $speak, $segment; $e = File::E($response->path); $replies = count(glob(COMMENT . DS . '*_*_' . Date::slug($response->id) . '.{txt,hold}', GLOB_NOSORT | GLOB_BRACE)); $t = Jot::icon('reply-all') . ' ' . $replies; $tt = array('title' => $replies . ' ' . ($replies === 1 ? $speak->{$segment[0] . '_reply'} : $speak->{$segment[0] . '_replies'})); echo ($e === 'hold' || $replies === 0 ? Cell::span($t, $tt) : Cell::a($config->manager->slug . '/' . $segment[0] . '?filter=parent%3A' . $response->id, $t, null, $tt)) . ' · '; }
/** * Widget Manager * -------------- * * [1]. Widget::manager('MENU'); * [2]. Widget::manager('BAR'); * */ public static function manager($type = 'MENU') { if (!Guardian::happy()) { return ""; } $T1 = TAB; if ($type === 'MENU') { $menus = array(); if ($_menus = Mecha::A(Config::get('manager_menu'))) { $_menus = Mecha::eat($_menus)->order('ASC', 'stack', true, 10)->vomit(); foreach ($_menus as $k => $v) { // < 1.1.3 if (is_string($v)) { $menus[$k] = $v; } else { $stack = isset($v['stack']) ? $v['stack'] : 10; $_k = (strpos($v['icon'], '<') === false ? '<i class="fa fa-fw fa-' . $v['icon'] . '"></i>' : $v['icon']) . ' <span class="label">' . $k . '</span>' . (isset($v['count']) && ($v['count'] === '∞' || (double) $v['count'] > 0) ? ' <span class="counter">' . $v['count'] . '</span>' : ""); $menus[$_k] = isset($v['url']) ? $v['url'] : null; } } } $html = O_BEGIN . '<div class="widget widget-manager widget-manager-menu" id="widget-manager-menu-' . self::$id['manager_menu'] . '">' . NL; self::$id['manager_menu']++; $html .= Menu::get($menus, 'ul', $T1, 'manager:'); $html .= '</div>' . O_END; $html = Filter::apply('widget', $html); return Filter::apply('widget:manager.menu', Filter::apply('widget:manager', $html)); } if ($type === 'BAR') { $html = O_BEGIN . '<div class="widget widget-manager widget-manager-bar" id="widget-manager-bar-' . self::$id['manager_bar'] . '">' . NL; self::$id['manager_bar']++; $bars = array(); if ($_bars = Mecha::A(Config::get('manager_bar'))) { $_bars = Mecha::eat($_bars)->order('ASC', 'stack', true, 10)->vomit(); foreach ($_bars as $k => $v) { if (is_string($v)) { $bar = $v; } else { $t = ' data-tooltip="' . Text::parse(isset($v['description']) ? $v['description'] : $k, '->encoded_html') . '"'; $bar = isset($v['url']) ? '<a class="item" href="' . Converter::url($v['url']) . '"' . $t . '>' : '<span class="item a"' . $t . '>'; $bar .= isset($v['icon']) ? strpos($v['icon'], '<') === false ? Jot::icon($v['icon']) : $v['icon'] : $k; $bar .= ' <span class="label">' . $k . '</span>'; if (isset($v['count']) && ($v['count'] === '∞' || (double) $v['count'] > 0)) { $bar .= ' <span class="counter">' . $v['count'] . '</span>'; } $bar .= isset($v['url']) ? '</a>' : '</span>'; } $bars[] = Filter::apply('manager:bar.item', $bar); } } $html .= $T1 . Filter::apply('manager:bar', implode(' ', $bars)) . NL; $html .= '</div>'; return Filter::apply('widget:manager.bar', Filter::apply('widget:manager', $html)); } }
<?php $c_editor = $config->states->{'plugin_' . md5(File::B(__DIR__))}; ?> <div class="p"> <?php foreach ($speak->MTE->buttons as $k => $v) { ?> <?php if (Text::check($k)->in(array('yes', 'no', 'ok', 'cancel', 'open', 'close'))) { continue; } ?> <div><?php echo Form::checkbox('buttons[' . $k . ']', 1, isset($c_editor->buttons->{$k}), sprintf($speak->manager->title_show__button, $v)); ?> </div> <?php } ?> </div> <p><?php echo Jot::button('action', $speak->update); ?> </p>
// include once ... } }, 20); Weapon::add('SHIPMENT_REGION_BOTTOM', function () use($config) { Session::kill('recent_item_update'); $path = __DIR__ . DS . 'assets' . DS . 'sword' . DS; echo Asset::javascript(array($path . 'ajax.js', $path . 'row.js', $path . 'slug.js', $path . 'upload.js', $path . 'tab.js', $path . 'toggle.js', $path . 'modal.js', $path . 'tooltip.js', $path . 'sortable.js', $path . 'accordion.js', SHIELD . DS . $config->shield . DS . 'assets' . DS . 'sword' . DS . 'manager.js'), "", 'sword/manager.min.js'); }, 1); /** * Footer Link(s) * -------------- */ if ($config->page_type === 'manager' || $config->is->post) { // Add default comment footer link(s) Weapon::add('comment_footer', function ($comment, $article) use($config, $speak) { $status = Mecha::alter(File::E($comment->path), array('hold' => Jot::span('info', Jot::icon('clock-o') . ' ' . $speak->pending) . ' · '), ""); echo $status . Cell::a($config->manager->slug . '/comment/repair/id:' . $comment->id, $speak->edit) . ' / ' . Cell::a($config->manager->slug . '/comment/kill/id:' . $comment->id, $speak->delete); }, 20); } /** * Widget Manager Menu(s) and Bar(s) * --------------------------------- * * [1]. Config::merge('manager_menu', array()); * [2]. Config::merge('manager_bar', array()); * */ Weapon::add('shield_before', function () { $config = Config::get(); $speak = Config::speak(); $total = $config->__total_comments;
$path = File::url($path); ?> <?php if ($is_text && $content !== false) { ?> <p> <?php echo Form::textarea('content', Request::get('content', Guardian::wayback('content', $content)), $speak->manager->placeholder_content, array('class' => array('textarea-block', 'textarea-expand', 'code'))); ?> </p> <?php } ?> <p> <?php echo Form::hidden('name', $path); ?> <?php Weapon::fire('action_before', $hooks); ?> <?php echo Jot::button('action', $is_text ? $speak->update : $speak->rename); ?> <?php echo Jot::btn('destruct', $speak->delete, $config->manager->slug . '/cache/kill/file:' . $path); ?> <?php Weapon::fire('action_after', $hooks); ?> </p> </form>
if (trim($request['name']) === "") { $request['name'] = $id . '.txt'; // empty file name } $_path = Text::parse(sprintf($request['name'], $id), '->safe_path_name'); $e = File::E($_path, false); if ($e !== 'txt' && $e !== 'php') { $e = 'txt'; $_path .= '.txt'; } $_path_ = File::path($_path); $file = ASSET . DS . '__snippet' . DS . $e . DS . $_path; if (File::exist($file)) { // file already exists Notify::error(Config::speak('notify_file_exist', '<code>' . $_path_ . '</code>')); } if (trim($request['content']) === "") { // empty file content Notify::error($speak->notify_error_content_empty); } if (!Notify::errors()) { $recent = array_slice(File::open(CACHE . DS . 'plugin.snippet.cache')->unserialize(), 0, $config->per_page); File::serialize(array_merge(array($_path), $recent))->saveTo(CACHE . DS . 'plugin.snippet.cache', 0600); $url = $config->manager->slug . '/asset/repair/file:__snippet/' . $e . '/' . File::url($_path) . '?path=' . urlencode(rtrim('__snippet/' . $e . '/' . File::D(File::url($_path)), '/')); File::write($request['content'])->saveTo($file, 0600); Notify::success(Config::speak('notify_file_created', '<code>' . $_path_ . '</code>' . (!isset($request['redirect']) ? ' <a class="pull-right" href="' . $config->url . '/' . $url . '" target="_blank">' . Jot::icon('pencil') . ' ' . $speak->edit . '</a>' : ""))); Notify::info('<strong>' . $speak->shortcode . ':</strong> <code>{{' . ($e === 'php' ? 'include' : 'print') . ':' . str_replace('.' . $e . X, "", File::url($_path) . X) . '}}</code>'); Guardian::kick(isset($request['redirect']) ? $url : File::D($config->url_current)); } Guardian::kick(File::D($config->url_current)); });
$hooks = array($page, $segment); echo $messages; ?> <h3><?php echo $page->title; ?> </h3> <?php echo $page->content; ?> <form class="form-kill form-plugin" id="form-kill" action="<?php echo $config->url_current . $config->url_query; ?> " method="post"> <?php Weapon::fire('action_before', $hooks); ?> <?php echo Jot::button('action', $speak->yes); ?> <?php echo Jot::btn('reject', $speak->no, $config->manager->slug . '/plugin'); ?> <?php Weapon::fire('action_after', $hooks); ?> <?php echo Form::hidden('token', $token); ?> </form>
<fieldset> <legend>Disqus</legend> <label class="grid-group"> <span class="grid span-1 form-label"><?php echo $speak->id . ' ' . Jot::info($speak->plugin_comment_service->description->disqus_id); ?> </span> <span class="grid span-5"><?php echo Form::text('services[disqus][id]', $comment_service_config['services']['disqus']['id'], File::N($config->host)); ?> </span> </label> </fieldset>
$hooks = array($page, $segment); echo $messages; if ($content) { ?> <p> <?php echo Form::textarea('content', Request::get('content', Guardian::wayback('content', $content)), $speak->manager->placeholder_content, array('class' => array('textarea-block', 'textarea-expand', 'code'))); ?> </p> <p> <?php Weapon::fire('action_before', $hooks); ?> <?php echo Jot::btn('destruct', $speak->delete, $config->manager->slug . '/error/kill'); ?> <?php Weapon::fire('action_after', $hooks); ?> </p> <?php } else { ?> <p><?php echo Config::speak('notify_empty', strtolower($speak->errors)); ?> </p> <p> <?php Weapon::fire('action_before', $hooks);
if (strlen($article->css) > $config->excerpt_length) { echo ' …'; } ?> </code></pre> <?php } if (!empty($article->js)) { ?> <pre><code><?php echo substr(Text::parse($article->js, '->encoded_html'), 0, $config->excerpt_length); if (strlen($article->js) > $config->excerpt_length) { echo ' …'; } ?> </code></pre> <?php } ?> <form class="form-kill form-article" id="form-kill" action="<?php echo $config->url_current . $config->url_query; ?> " method="post"> <?php echo Jot::button('action', $speak->yes); ?> <?php echo Jot::btn('reject', $speak->no, $config->manager->slug . '/article/repair/id:' . $article->id); echo Form::hidden('token', $token); ?> </form>
<span class="grid span-1"></span> <span class="grid span-5"> <?php if ($id !== false) { ?> <?php echo Jot::button('action', $speak->update); ?> <?php echo Jot::btn('destruct', $speak->delete, $config->manager->slug . '/field/kill/key:' . $id); ?> <?php } else { ?> <?php echo Jot::button('construct', $speak->create); ?> <?php } ?> </span> </div> </form> <script> (function(w, d) { var form = d.getElementById('form-<?php echo $id !== false ? 'repair' : 'ignite'; ?> '), type = form.type, value = form.value,
$bars = array(); if ($_bars = Mecha::A(Config::get('manager_bar'))) { $_bars = Mecha::eat($_bars)->order('ASC', 'stack', true, 10)->vomit(); foreach ($_bars as $k => $v) { if (is_string($v)) { $bar = $v; } else { $t = ' data-tooltip="' . Text::parse(isset($v['description']) ? $v['description'] : $k, '->encoded_html') . '"'; if (isset($v['url'])) { $url = Filter::colon('manager:url', Converter::url($v['url'])); $c = $config->url_current === $url ? ' ' . Widget::$config['classes']['current'] : ""; $bar = '<a class="item' . $c . '" href="' . $url . '"' . $t . '>'; } else { $bar = '<span class="item a"' . $t . '>'; } $bar .= isset($v['icon']) ? strpos($v['icon'], '<') === false ? Jot::icon($v['icon']) : $v['icon'] : $k; $bar .= ' <span class="label">' . $k . '</span>'; if (isset($v['count']) && ($v['count'] === '∞' || (double) $v['count'] > 0)) { $bar .= ' <span class="counter">' . $v['count'] . '</span>'; } $bar .= isset($v['url']) ? '</a>' : '</span>'; } $bars[] = $bar; } } $html .= $T1 . implode(' ', $bars) . NL; } $html .= '</div>' . O_END; $html = Filter::apply('widget', $html); Config::set('widget_manager_' . $kin . '_id', $id); return Filter::apply('widget:manager.' . $kin, Filter::apply('widget:manager', $html));
<?php echo isset($c_url_repair) && $c_url_repair !== false ? Jot::a('construct', $c_url_repair . $url, Jot::icon('pencil'), array('title' => $speak->edit)) : Jot::icon('pencil'); ?> </td> <td class="td-icon"> <?php echo isset($c_url_kill) && $c_url_kill !== false ? Jot::a('destruct', $c_url_kill . $url, Jot::icon('times'), array('title' => $speak->delete)) : Jot::icon('times'); ?> </td> </tr> <?php } ?> <?php } else { ?> <tr> <td class="td-icon"><?php echo $config->offset === 1 ? Jot::icon('home') : Jot::a('action', $c_url, Jot::icon('home')); ?> </td> <td><?php echo Config::speak('notify_' . ($config->offset === 1 ? 'empty' : 'error_not_found'), strtolower($speak->files)); ?> </td> </tr> <?php } ?> </tbody> </table>
<a class="tab-button" href="<?php echo $config->url . '/' . $config->manager->slug . '/' . $segment; ?> /ignite" data-confirm-text="<?php echo $speak->notify_confirm_page_leave; ?> "><?php echo Jot::icon('plus-square', 'fw') . ' ' . $speak->new; ?> </a>
<?php } ?> </tbody> <?php } else { ?> <tbody> <tr> <td class="td-icon"><?php echo $config->offset === 1 ? Jot::icon('home') : Jot::a('action', $cache_url, Jot::icon('home')); ?> </td> <td><?php echo Config::speak('notify_' . ($config->offset === 1 ? 'empty' : 'error_not_found'), strtolower($speak->files)); ?> </td> </tr> </tbody> <?php } ?> </table> </form> <?php if (!empty($pager->step->url) || Request::get('q')) { ?> <hr> <?php echo Jot::finder($cache_url, 'q'); }
</h3> <?php $destinations = array(Jot::icon('file-text') . ' ' . $speak->article => ARTICLE, Jot::icon('file') . ' ' . $speak->page => PAGE, Jot::icon('magnet') . ' ' . $speak->extend => EXTEND, Jot::icon('comments') . ' ' . $speak->comment => COMMENT, Jot::icon('cogs') . ' ' . $speak->config => STATE, Jot::icon('briefcase') . ' ' . $speak->asset => ASSET, Jot::icon('shield') . ' ' . $speak->shield => SHIELD, Jot::icon('plug') . ' ' . $speak->plugin => PLUGIN); ?> <?php foreach ($destinations as $title => $destination) { ?> <div class="media no-capture"> <h4 class="media-title"><?php echo $title; ?> </h4> <div class="media-content"> <p><code><?php echo $destination; ?> </code></p> <?php echo Jot::uploader($config->manager->slug . '/backup', 'zip', array('destination' => $destination, 'title' => trim(strip_tags($title)))); ?> </div> </div> <?php } ?> </div> <?php Weapon::fire('tab_content_after', $hooks); ?> </div> </div>
<?php if ($responses = call_user_func('Get::' . $segment[0] . 's', 'DESC', 'post:' . Date::slug(Request::get('post', $page->post)))) { ?> <div class="grid-group"> <span class="grid span-1 form-label"><?php echo $speak->parent; ?> </span> <span class="grid span-5"> <?php if (count($responses) > 600) { // 600+ response(s), fallback to text input for performance reason $_parent = call_user_func('Get::' . $segment[0], $page->parent, array('message', 'message_raw')); echo Form::text('parent', Request::get('parent', Guardian::wayback('parent', $page->parent)), time()); echo $_parent ? ' ' . Jot::btn('action:external-link', "", $_parent->permalink, array('title' => $_parent->name, 'target' => '_blank')) : ""; } else { $results = array(); $s = Date::slug($page->id); foreach ($responses as $v) { list($_post, $_time, $_parent) = explode('_', File::N($v), 3); $results[($s === $_time ? '.' : "") . Date::format($_time, 'U')] = Date::extract($_time, 'FORMAT_3'); } krsort($results); echo Form::select('parent', array("" => '— ' . $speak->none . ' —') + $results, Request::get('parent', Guardian::wayback('parent', $page->parent))); } ?> </span> </div> <?php }
?> </p> <p> <?php Weapon::fire('action_before', array($page, $segment)); ?> <?php echo Jot::btn('construct.small:cog', $speak->manage, $config->manager->slug . '/shield/' . $folder); ?> <?php if (File::exist($r . 'manager.php')) { echo Jot::btn('action.small:shield', $speak->attach, $config->manager->slug . '/shield/attach/id:' . $folder); ?> <?php } echo Jot::btn('destruct.small:times-circle', $speak->delete, $config->manager->slug . '/shield/kill/id:' . $folder); ?> <?php Weapon::fire('action_after', array($page, $segment)); ?> </p> </div> </div> <?php } ?> <?php } ?> </div> <?php
<?php echo Jot::button('construct', $speak->publish, 'extension:.txt'); ?> <?php echo Jot::button('action:clock-o', $speak->save, 'extension:.draft'); ?> <?php } ?> <?php if ($page->state === 'archived') { ?> <?php echo Jot::button('action:history', $speak->archive, 'extension:.archive'); ?> <?php } ?> <?php echo Jot::btn('destruct', $speak->delete, $config->manager->slug . '/' . $segment . '/kill/id:' . $page->id); ?> <?php } ?> <?php Weapon::fire('action_after', $hooks); ?> </p> </form> </div> </div>
echo $file->path; ?> </li> <?php } ?> </ul> <?php } } ?> <form class="form-kill form-shield" id="form-kill" action="<?php echo $config->url_current . $config->url_query; ?> " method="post"> <?php Weapon::fire('action_before', $hooks); ?> <?php echo Jot::button('action', $speak->yes); ?> <?php echo Jot::btn('reject', $speak->no, $config->manager->slug . '/shield/' . $folder); ?> <?php Weapon::fire('action_after', $hooks); ?> <?php echo Form::hidden('token', $token); ?> </form>
if (strlen($page->js) > $config->excerpt->length) { echo $config->excerpt->suffix; } ?> </code></pre> <?php } ?> <form class="form-kill form-<?php echo $segment; ?> " id="form-kill" action="<?php echo $config->url_current . $config->url_query; ?> " method="post"> <?php Weapon::fire('action_before', $hooks); ?> <?php echo Jot::button('action', $speak->yes); ?> <?php echo Jot::btn('reject', $speak->no, $config->manager->slug . '/' . $segment . '/repair/id:' . $page->id); ?> <?php Weapon::fire('action_after', $hooks); ?> <?php echo Form::hidden('token', $token); ?> </form>
</span> <span class="grid span-5"> <?php if (Guardian::get('status') === 'pilot') { ?> <?php echo Form::text('author', Guardian::wayback('author', $default->author)); ?> <?php } else { ?> <?php echo Form::hidden('author', $default->author); ?> <span class="form-static"><?php echo Jot::icon('lock') . ' ' . $default->author; ?> </span> <?php } ?> </span> </label> <?php Weapon::fire('unit_composer_1_after', array($segment)); ?> </div> <div class="tab-content hidden" id="tab-content-2"> <?php Weapon::fire('unit_composer_2_before', array($segment)); ?>
<?php } ?> <?php if (isset($action_create) && $action_create !== false) { ?> <?php echo Jot::button('construct', $speak->create); ?> <?php } ?> <?php if (isset($path_destruct) && $path_destruct !== false) { ?> <?php echo Jot::btn('destruct', $speak->delete, $path_destruct); ?> <?php } ?> <?php if (isset($path_reject) && $path_reject !== false) { ?> <?php echo Jot::btn('reject', $speak->cancel, $path_reject); ?> <?php } ?> </p>
<td><code><?php echo $file->slug; ?> </code></td> <td><?php echo isset($file->scope) ? str_replace(',', '/', $file->scope) : '<em>' . $speak->all . '</em>'; ?> </td> </tr> </tbody> </table> <form class="form-kill form-tag" id="form-kill" action="<?php echo $config->url_current; ?> " method="post"> <?php Weapon::fire('action_before', $hooks); ?> <?php echo Jot::button('action', $speak->yes); ?> <?php echo Jot::btn('reject', $speak->no, $config->manager->slug . '/tag/repair/id:' . $id); ?> <?php Weapon::fire('action_after', $hooks); ?> <?php echo Form::hidden('token', $token); ?> </form>
<div class="main-action-group"> <?php echo Jot::btn('begin:plus-square', Config::speak('manager.title_new_', $speak->page), $config->manager->slug . '/page/ignite'); ?> </div> <?php echo $messages; if ($pages) { ?> <ol class="page-list"> <?php foreach ($pages as $page) { ?> <li class="page" id="page-<?php echo $page->id; ?> "> <div class="page-header"> <?php if ($page->state === 'draft') { ?> <span class="page-title"><?php echo $page->title; ?> </span> <?php } else { ?> <a class="page-title" href="<?php echo $page->url; ?>
</td> <td class="td-icon"><?php echo Jot::a('destruct', $config->manager->slug . '/asset/kill/file:__snippet/' . $e . '/' . $_file, Jot::icon('times'), array('title' => $speak->delete)); ?> </td> </tr> <?php } ?> </tbody> </table> <?php } ?> <p><?php echo Jot::btn('action:database', $speak->snippets, $config->manager->slug . '/asset?path=__snippet'); ?> </p> </div> <?php Weapon::fire('tab_content_after', $hooks); ?> </div> </div> <script> function do_snippet(id, method) { var text = '<?php echo $speak->shortcode; ?> ', code = '{{' + method + ':' + id + '}}';
<div class="grid span-2"> <h4>Recently Updated</h4> <p>Nothing.</p> </div> <div class="grid span-2"> <h4>Quick Draft</h4> <p><?php echo Form::text('title', "", $speak->manager->placeholder_title, array('class' => 'input-block')); ?> </p> <div class="p"><?php echo Form::textarea('content', "", $speak->manager->placeholder_content, array('class' => array('textarea-block', 'code'))); ?> </div> <p><?php echo Jot::button('action', $speak->save); ?> </p> </div> <div class="grid span-2"> <h4>Quick Tags</h4> <p><?php echo Form::text('tags', "", null, array('class' => 'input-block')); ?> </p> <p><?php echo Jot::button('action', $speak->add); ?> </p> </div> </div>
<label class="grid-group"> <span class="grid span-1 form-label"><?php echo $speak->author; ?> </span> <span class="grid span-5"> <?php if (Guardian::happy(1)) { ?> <?php echo Form::text('author', Request::get('author', Guardian::wayback('author', $page->author_raw))); ?> <?php } else { ?> <?php echo Form::hidden('author', $page->author_raw); ?> <span class="form-static"><?php echo Jot::icon('lock') . ' ' . $page->author_raw; ?> </span> <?php } ?> </span> </label>
<td><?php echo Jot::em('info', $s); ?> </td> <td><?php echo isset($file->scope) ? str_replace(',', '/', $file->scope) : '<em>' . $speak->all . '</em>'; ?> </td> </tr> </tbody> </table> <form class="form-kill form-field" id="form-kill" action="<?php echo $config->url_current; ?> " method="post"> <?php Weapon::fire('action_before', $hooks); ?> <?php echo Jot::button('action', $speak->yes); ?> <?php echo Jot::btn('reject', $speak->no, $config->manager->slug . '/field/repair/key:' . $id); ?> <?php Weapon::fire('action_after', $hooks); ?> <?php echo Form::hidden('token', $token); ?> </form>
<p><?php echo Config::speak('notify_not_available', $speak->config); ?> </p> <?php } ?> </div> <div class="tab-content hidden" id="tab-content-2"> <p class="about-author"> <?php echo Cell::strong($speak->author . ':') . ' ' . Text::parse($file->author, '->encoded_html'); if (isset($file->url) && $file->url !== '#') { ?> <?php echo Cell::a($file->url, Jot::icon('external-link-square'), '_blank', array('class' => array('about-url', 'help'), 'title' => $speak->link, 'rel' => 'nofollow')); ?> <?php } ?> </p> <h3 class="about-title"><?php echo $file->title; if (isset($file->version)) { ?> <code class="about-version"><?php echo $file->version; ?> </code><?php } ?>