Ejemplo n.º 1
0
            // backend
        }
    }
    Weapon::fire(array('plugin_after', 'plugin_' . md5($k) . '_after'));
}
Weapon::fire('plugins_after');
/**
 * Check the Plugin(s) Order
 * -------------------------
 */
// var_dump($plugins); exit;
/**
 * Loading Menu(s)
 * ---------------
 */
foreach (Get::state_menu() as $key => $value) {
    Menu::add($key, $value);
}
/**
 * Handle Shortcode(s) in Content
 * ------------------------------
 */
function do_shortcode($content)
{
    if (strpos($content, '{{') === false) {
        return $content;
    }
    foreach (Get::state_shortcode() as $key => $value) {
        $key = preg_quote($key, '#');
        // %[a,b,c]: option(s) ... accept `a`, `b`, or `c`
        if (strpos($key, '%\\[') !== false) {
Ejemplo n.º 2
0
<?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);
});
Ejemplo n.º 3
0
            Notify::success(Config::speak('notify_success_' . (!$key ? 'created' : 'updated'), $speak->menu));
            Weapon::fire(array('on_menu_update', 'on_menu_' . (!$key ? 'construct' : 'repair')), array($G, $P));
            Guardian::kick($key !== $k ? $config->manager->slug . '/menu' : $config->manager->slug . '/menu/repair/key:' . $key);
        }
    }
    Shield::lot(array('segment' => 'menu', 'id' => $key, 'content' => $menu_raw))->attach('manager');
});
/**
 * Menu Killer
 * -----------
 */
Route::accept($config->manager->slug . '/menu/kill/key:(:any)', function ($key = false) use($config, $speak) {
    if (!Guardian::happy(1)) {
        Shield::abort();
    }
    $menus = Get::state_menu(null, array(), false);
    if (!isset($menus[$key])) {
        Shield::abort();
        // Menu not found!
    }
    Config::set(array('page_title' => $speak->deleting . ': ' . $speak->menu . $config->title_separator . $config->manager->title, 'cargo' => 'kill.menu.php'));
    $G = array('data' => $menus);
    $G['data']['key'] = $key;
    if ($request = Request::post()) {
        $request = Filter::apply('request:__menu', $request, $key);
        Guardian::checkToken($request['token']);
        unset($menus[$key]);
        // delete ...
        ksort($menus);
        $P = array('data' => $menus);
        $P['data']['key'] = $key;
Ejemplo n.º 4
0
 if (isset($c->spam_keywords)) {
     $c->keywords_spam = $c->spam_keywords;
 }
 if (isset($c->excerpt_length)) {
     $c->excerpt = (object) array('length' => $c->excerpt_length, 'prefix' => "", 'suffix' => $c->excerpt_tail, 'id' => 'more:%d');
 }
 if (is_bool($c->comments)) {
     $c->comments = (object) array('allow' => $c->comments, 'moderation' => $c->comment_moderation);
 }
 if ($c->html_parser === false) {
     $c->html_parser = 'HTML';
 }
 if (!is_object($c->html_parser)) {
     $c->html_parser = (object) array('type' => array('HTML' => 'HTML'), 'active' => $c->html_parser);
 }
 $menus = Get::state_menu(null, false);
 if (!isset($menus['navigation'])) {
     $menus['navigation'] = $menus;
     File::serialize($menus)->saveTo(STATE . DS . 'menu.txt', 0600);
 }
 if ($tag = Get::state_tag(null, false)) {
     if (isset($tag[0]['id'])) {
         $tags = array();
         foreach ($tag as $t) {
             $tags[$t['id']] = array('name' => $t['name'], 'slug' => $t['slug'], 'description' => $t['description'], 'scope' => 'article');
         }
         File::serialize($tags)->saveTo(STATE . DS . 'tag.txt', 0600);
     }
 }
 if (is_string($c->author)) {
     $c->author = (object) array('name' => $c->author, 'email' => $c->author_email, 'url' => $c->author_profile_url);
Ejemplo n.º 5
0
 public static function get($array = null, $type = 'ul', $depth = "", $FP = "")
 {
     // Use menu file from the cabinet if `$array` is not defined
     if (is_null($array)) {
         $FP = 'navigation:';
         $array = Text::toArray(Get::state_menu(), S, '    ');
     }
     return O_BEGIN . rtrim(self::create($array, $type, $depth, $FP, 0), NL) . O_END;
 }
Ejemplo n.º 6
0
$hooks = array($files, $segment);
?>
<div class="main-action-group">
  <?php 
Weapon::fire('main_action_before', $hooks);
?>
  <?php 
echo Jot::btn('begin:plus-square', Config::speak('manager.title_new_', $speak->menu), $config->manager->slug . '/menu/ignite');
?>
  <?php 
Weapon::fire('main_action_after', $hooks);
?>
</div>
<?php 
echo $messages;
$files_all = Get::state_menu(null, array());
ksort($files_all);
if ($files_all) {
    ?>
<table class="table-bordered table-full-width">
  <thead>
    <tr>
      <th><?php 
    echo $speak->menu;
    ?>
</th>
      <th class="text-center" colspan="2"><?php 
    echo $speak->action;
    ?>
</th>
    </tr>