set() статический публичный Метод

Sets a global by key
static public set ( string $key, mixed $value = null )
$key string The key to define
$value mixed The value for the passed key
Пример #1
0
 function load()
 {
     // initiate the site and make pages and page
     // globally available
     $site = $this;
     $panel = $this;
     $pages = $this->pages;
     $page = $this->pages->active();
     if ($page->isErrorPage() && $this->uri()->path() != c::get('404')) {
         go(url(c::get('404')));
     }
     g::set('site', $this);
     g::set('panel', $this);
     g::set('pages', $pages);
     g::set('page', $page);
     // set the global template vars
     tpl::set('site', $this);
     tpl::set('panel', $this);
     tpl::set('pages', $pages);
     tpl::set('page', $page);
     // initiate the user settings
     $settings = new settings();
     g::set('settings', $settings);
     tpl::set('settings', $settings);
     // add a user
     $panel->user = new user();
     // load the language
     paneload::language();
     // check for a valid array of user accounts and other correct setups
     if (!check::installed() || !check::hasAccounts() || check::stillHasDefaultAccount() || check::wrongKirbyVersion()) {
         require c::get('root.panel') . '/modals/installation.php';
         return;
     }
     // add all panel info
     $panel->isHome = !$panel->uri->path(1) ? true : false;
     $panel->show = $panel->uri->param('show');
     $panel->action = $panel->uri->param('do');
     $panel->nocontent = (string) $page->contents() == '' ? true : false;
     if ($panel->isHome && $panel->show != 'info' && $panel->show != 'logout') {
         $panel->show = 'home';
     }
     switch ($panel->action) {
         case 'edit-pages':
             $panel->sortable = true;
             break;
     }
     if ($panel->isHome) {
         $settings->pages = true;
         $settings->flip = false;
     }
     switch ($panel->show) {
         case 'logout':
             $panel->user->logout();
             exit;
             break;
         case 'files':
             $thumbDir = c::get('root') . '/thumbs';
             $panel->fancybox = true;
             $panel->thumbs = is_dir($thumbDir) && is_writable($thumbDir) ? true : false;
             break;
             // more available views
         // more available views
         case 'info':
         case 'home':
         case 'pages':
         case 'options':
             if (($panel->show == 'home' || $panel->show == 'info') && !$panel->isHome) {
                 go(url() . '/show:' . $panel->show);
             }
             break;
         default:
             $valid = array('options', 'content');
             if (!in_array($panel->show, $valid)) {
                 $panel->show = 'content';
             }
             break;
     }
     // init the form
     if ($panel->show == 'info' || $panel->show == 'content') {
         $panel->form = new form($settings);
     }
     // set the template file;
     $panel->templateFile = $panel->show . '.php';
     $panel->templateRoot = c::get('root.panel') . '/templates';
     content::start();
     if ($panel->user->isLoggedIn()) {
         require $panel->templateRoot . '/' . $panel->templateFile;
     } else {
         require $panel->templateRoot . '/login.php';
     }
     content::end();
 }
Пример #2
0
<?php

///////////////////////////////////////////////////////
// ----------------------------------------------------------
// SNIPPET
// ----------------------------------------------------------
/////////////////////////////////////////////////////////////
// Create instances
$instances = g::get('kmap.instances');
g::set('kmap.instances', $instances + 1);
// Set variables
if (!isset($id)) {
    $id = 'map-' . uniqid();
}
if (!isset($width)) {
    $width = 300;
}
if (!isset($height)) {
    $height = 300;
}
if (!isset($type)) {
    $type = 'roadmap';
}
// roadmap, sattelite, hybrid, terrain
if (!isset($class)) {
    $class = 'map';
}
if (!isset($zoom)) {
    $zoom = 15;
}
if (!isset($address)) {
Пример #3
0
<?php

$instances = g::get('kflattr.instances');
g::set('kflattr.instances', $instances + 1);
// set the defaults
if (!isset($user_id)) {
    die('Please pass the flattr userid');
}
if (!isset($url)) {
    $url = $page->url();
}
if (!isset($title)) {
    $title = $page->title();
}
if (!isset($description)) {
    $description = null;
}
if (!isset($category)) {
    $category = null;
}
if (!isset($language)) {
    $language = null;
}
if (!isset($tags)) {
    $tags = null;
}
if (!isset($button)) {
    $button = null;
}
if (!isset($popout)) {
    $popout = null;