コード例 #1
0
ファイル: route.php プロジェクト: nibble-arts/oliv
 public function __construct()
 {
     $this->scan(status::lang());
     // set referer
     // complete url to get back
     if (array_key_exists('HTTP_REFERER', $_SERVER)) {
         status::set("OLIV_REFERER", $_SERVER['HTTP_REFERER']);
     } else {
         status::set("OLIV_REFERER", OLIVRoute::url(system::lang(), system::oliv_index_page(), status::val()));
     }
     $this->route();
 }
コード例 #2
0
ファイル: routePlugin.php プロジェクト: nibble-arts/oliv
 public static function __callStatic($method, $options)
 {
     $content = $options[0];
     $tag = $options[1];
     //------------------------------------------------------------------------------
     // look for href expressions
     $nodes = $content->XPath("//*[@href]");
     // loop through all nodes
     for ($i = 0; $i < count($nodes); $i++) {
         // if not extern link
         // route
         if (!link_is_extern($href = (string) $nodes[$i]['href'])) {
             // set lang for link call
             if (!($lang = (string) $nodes[$i]['lang'])) {
                 $lang = status::lang();
             }
             $href = str_replace(array(";"), array("&"), $href);
             $hrefArray = explode(":", $href);
             // parse special route functions:
             // referer() ... insert referer address
             // current() ... insert current url and val
             // javascript(): ... convert to javascript call
             // urlName:valName ... convert to correct friendly_url/val
             switch ($hrefArray[0]) {
                 case 'href()':
                     $nodes[$i]['href'] = OLIVRoute::url($lang, $hrefArray[1], (string) $nodes[$i]["val"]);
                     break;
                 case 'referer()':
                     $nodes[$i]['href'] = status::oliv_referer();
                     break;
                 case 'current()':
                     $nodes[$i]['href'] = OLIVRoute::url($lang, status::url(), status::val());
                     // insert additional parameters
                     if (count($hrefArray) > 1) {
                         $nodes[$i]['href'] = substr($nodes[$i]['href'], 0, -1) . "?" . $hrefArray[1];
                     }
                     break;
                 case 'javascript()':
                     $nodes[$i]['href'] = "javascript:toolbox('" . (string) $hrefArray[1] . "')";
                     break;
                 default:
                     $nodes[$i]['href'] = OLIVRoute::url($lang, $hrefArray[0], status::val());
                     // add value
                     if (count($hrefArray) > 1) {
                         $nodes[$i]['href'] .= $hrefArray[1] . "/";
                     }
                     break;
             }
         }
     }
     return $content;
 }
コード例 #3
0
ファイル: core.php プロジェクト: nibble-arts/oliv
 public function init($session)
 {
     // ------------------------------------------------------------------------------
     // set session
     if ($session) {
         system::set('OLIV_SESSION', $session . "/");
     } else {
         die("***FATAL ERROR: init.php - no session defined");
     }
     // core path for multisession defined
     if (!system::OLIV_CORE_PATH()) {
         die("Core path not defined");
     }
     // ------------------------------------------------------------------------------
     // ------------------------------------------------------------------------------
     // load basic system methods
     OLIVCore::loadScript("library/init.php");
     if (!system::OLIVENV()) {
         die("Environment not set");
     }
     // ------------------------------------------------------------------------------
     // ------------------------------------------------------------------------------
     // ------------------------------------------------------------------------------
     // load system language
     if (!system::OLIVTEXT()) {
         die("INIT: OLIVTEXT not found");
     }
     OLIVText::load(system::OLIV_LANGUAGE_PATH(), system::OLIV_CORE_TEXT());
     // ------------------------------------------------------------------------------
     // initialice main components
     // ------------------------------------------------------------------------------
     // connect to database
     // $this->daba = new OLIVDatabase($this->coreXml->_("core.database"));
     // initialise router
     $this->route = new OLIVRoute();
     // initialise html
     $this->html = new OLIVHtml();
     // load module metadata
     $this->module = new OLIVModule();
     // load plugin metadata
     $this->plugin = new OLIVPlugin();
     // load site template
     $this->template = new OLIVTemplate(system::OLIV_TEMPLATE_PATH() . system::OLIV_TEMPLATE() . "/", system::OLIV_TEMPLATE());
     // initialise page
     $this->page = new OLIVPage();
     // initialise preprocessor
     $this->processor = new OLIVProcessor();
     // initialise renderer
     $this->render = new OLIVRender();
     // ------------------------------------------------------------------------------
     // set core status
     // ------------------------------------------------------------------------------
     // extract command and value
     if (status::val()) {
         // extract cmd and param
         $cmdArray = explode("/", cut_slash(status::val()));
         // TODO define commands in system section ???
         // search for command and retranslate
         if (count($cmdArray)) {
             $cmd = OLIVText::getId($cmdArray[0]);
             status::set('command', $cmd);
             // save command
         }
         // if command found, extract command from val
         if (count($cmdArray) > 1 and $cmd) {
             array_shift($cmdArray);
             // remove command from val
             status::set('val', implode("/", $cmdArray));
             // save val
         }
     }
     // ------------------------------------------------------------------------------
     // initialize clipboard
     // get content from clipboard parameter
     if ($clipboard = argv::clipboard()) {
         OLIVClipboard::_($clipboard);
     }
     // get clipboard from cut/copy command
     $command = status::command();
     if ($command) {
         OLIVClipboard::$command(status::val());
     }
 }