当前位置: 首页>>代码示例>>PHP>>正文


PHP Globals::set方法代码示例

本文整理汇总了PHP中Globals::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Globals::set方法的具体用法?PHP Globals::set怎么用?PHP Globals::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Globals的用法示例。


在下文中一共展示了Globals::set方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: make

 public static function make($file, $primary = 'primary/main')
 {
     if (is_null($primary)) {
         $primary = $file;
     }
     if (!file_exists(LOCALROOT . "views/{$primary}.php")) {
         return false;
     }
     //        if(!file_exists(LOCALROOT . "views/$file.php")){
     //            return false;
     //        }
     Globals::set('view_aux', $file);
     include LOCALROOT . "views/{$primary}.php";
     return true;
 }
开发者ID:AndreAntunesVieira,项目名称:EstacaoGamer,代码行数:15,代码来源:View.php

示例2: getRoute

 public static function getRoute()
 {
     $route = $_SERVER['REQUEST_METHOD'] !== 'GET' ? strtolower($_SERVER['REQUEST_METHOD']) . ':' : '';
     $url = explode('/', Globals::get('r'));
     Globals::set('url', $url);
     foreach ($url as $i => $session) {
         if (is_numeric($session)) {
             $route .= "-num";
         } else {
             $route .= $i ? '-' : '';
             $route .= is_numeric($session) ? 'num' : $session;
         }
     }
     Globals::set('route', $route);
 }
开发者ID:AndreAntunesVieira,项目名称:EstacaoGamer,代码行数:15,代码来源:App.php

示例3: versionAction

 public function versionAction()
 {
     Globals::set('manager')->inner('parameters', array('title' => 'About Suite', 'subtitle' => 'Version', 'content' => Globals::get()->suite->version));
     return array('continue' => true, 'view' => array(array('main' => array('path' => __DIR__ . '/Index_view.php'))));
 }
开发者ID:wallrio,项目名称:suite,代码行数:5,代码来源:Access_control.php

示例4: getHtml

 public function getHtml($valueAction)
 {
     $html_view = null;
     $html_view_meta = null;
     $html_view_metaind = null;
     $html_view_header = null;
     $html_view_main = null;
     $html_view_footer = null;
     $resultView = isset($valueAction['view']) ? $valueAction['view'] : null;
     $resultContinue = isset($valueAction['continue']) ? $valueAction['continue'] : null;
     $resultParameters = isset($valueAction['parameters']) ? $valueAction['parameters'] : null;
     // define parametros da action
     if ($resultParameters != null) {
         Globals::set('current')->action = array('parameters' => $resultParameters);
     }
     $controller_link = Globals::get('http/domain/url') . Globals::get('http/controllers/destination') . '/';
     Globals::set('current')->controller = array('link' => $controller_link);
     if (is_array($resultView)) {
         // inclui na página conteúdo baseado no view do return
         foreach ($resultView as $key2 => $value2) {
             foreach ($value2 as $key3 => $value3) {
                 if ($key3 === 'html') {
                     $html_view_main .= $value3;
                 } elseif ($key3 === 'meta') {
                     if (key($value3) == 'path') {
                         $html_view_meta .= Functions::requireToVar($value3[key($value3)]);
                     } else {
                         if (key($value3) == 'html') {
                             $html_view_meta .= $value3[key($value3)];
                         }
                     }
                 } elseif ($key3 === 'header') {
                     if (key($value3) == 'path') {
                         $html_view_header .= Functions::requireToVar($value3[key($value3)]);
                     } else {
                         if (key($value3) == 'html') {
                             $html_view_header .= $value3[key($value3)];
                         }
                     }
                 } elseif ($key3 === 'main') {
                     if (key($value3) == 'path') {
                         $html_view_main .= Functions::requireToVar($value3[key($value3)]);
                     } else {
                         if (key($value3) == 'html') {
                             $html_view_main .= $value3[key($value3)];
                         }
                     }
                 } elseif ($key3 === 'footer') {
                     if (key($value3) == 'path') {
                         $html_view_footer .= Functions::requireToVar($value3[key($value3)]);
                     } else {
                         if (key($value3) == 'html') {
                             $html_view_footer .= $value3[key($value3)];
                         }
                     }
                 } else {
                     if (file_exists($value3)) {
                         $html_view_main .= Functions::requireToVar($value3);
                     }
                 }
             }
         }
     }
     return array('continue' => $resultContinue, 'view' => array('meta' => $html_view_meta, 'header' => $html_view_header, 'main' => $html_view_main, 'footer' => $html_view_footer));
 }
开发者ID:wallrio,项目名称:suite,代码行数:65,代码来源:View.php

示例5: setCurrent

 public function setCurrent()
 {
     $path = Globals::get()->path;
     $http = Globals::get()->http;
     $appPath = $path->controller->path;
     $modulesPath = $appPath . '/_modules/';
     // captura conteúdo do controller baseado em seu retorno
     //$resultAction = $this->getHtml($valueAction);
     $nameControl = $http->controllers->destination;
     $nameControl = str_replace('!', '', $nameControl);
     // verifica _assets no controller -----------------------------
     $metaInd = $modulesPath . $nameControl . '/_assets/' . 'meta.php';
     if (file_exists($metaInd)) {
         Globals::set('path')->inner('module')->add(array('current' => array('meta' => array('url' => Globals::get('path/controller/action/url') . '_assets/', 'path' => Globals::get('path/controller/action/path') . '_assets/'))));
         $currentActionPath = Globals::get('path/controller/action/path');
         $currentActionUrl = Globals::get('path/controller/action/url');
         $currentMetaPath = Globals::get('path/module/current/meta/path');
         $currentMetaUrl = Globals::get('path/module/current/meta/url');
         $currentModulePath = explode('/', Globals::get('path/controller/action/path'));
         unset($currentModulePath[count($currentModulePath) - 1]);
         $currentModulePath = implode('/', $currentModulePath) . '/';
         $currentModuleUrl = explode('/', Globals::get('path/controller/action/url'));
         unset($currentModuleUrl[count($currentModuleUrl) - 1]);
         $currentModuleUrl = implode('/', $currentModuleUrl) . '/';
         //$currentModuleUrl = Globals::get('path/controller/module/url');
         Globals::set('current')->path = array('module' => array('path' => $currentModulePath, 'url' => $currentModuleUrl), 'action' => array('path' => $currentActionPath, 'url' => $currentActionUrl), 'meta' => array('path' => $currentMetaPath, 'url' => $currentMetaUrl));
         /*echo '<pre>';
         		print_r(Globals::get('current'));
         		echo '</pre>';*/
         $html_view_metaind = Functions::requireToVar($metaInd);
     } else {
         // se no controller atual não existir o aquivo assets/meta.php, verifica nos controllers anteriores
         $controller = Globals::get('http/controllers/listjoinrev');
         foreach ($controller as $key => $value) {
             $controllerNames = str_replace('!', '', $value);
             $controllerPath = Globals::get('path/controller/modules/path') . $controllerNames . '/';
             $controllerPathAsset = $controllerPath . '_assets/';
             $controllerPathMeta = $controllerPath . '_assets/meta.php';
             $controllerUrl = Globals::get('path/controller/modules/url') . $controllerNames . '/';
             $controllerUrlAsset = $controllerUrl . '_assets/';
             $controllerUrlMeta = $controllerUrl . '_assets/meta.php';
             if (file_exists($controllerPathMeta)) {
                 Globals::set('path')->inner('module')->add(array('current' => array('meta' => array('url' => $controllerUrlAsset, 'path' => $controllerPathAsset))));
                 $currentActionPath = Globals::get('path/controller/action/path');
                 $currentActionUrl = Globals::get('path/controller/action/url');
                 $currentModulePath = Globals::get('path/controller/module/path');
                 $currentModuleUrl = Globals::get('path/controller/module/url');
                 $currentMetaPath = Globals::get('path/module/current/meta/path');
                 $currentMetaUrl = Globals::get('path/module/current/meta/url');
                 Globals::set('current')->path = array('module' => array('path' => $currentModulePath, 'url' => $currentModuleUrl), 'action' => array('path' => $currentActionPath, 'url' => $currentActionUrl), 'meta' => array('path' => $currentMetaPath, 'url' => $currentMetaUrl));
                 $html_view_metaind = Functions::requireToVar($controllerPathMeta);
             }
         }
     }
 }
开发者ID:wallrio,项目名称:suite,代码行数:55,代码来源:Controller.php

示例6: load

 public function load($options = null)
 {
     $suite = Globals::set()->suite = $this->optionsGlobals;
     Globals::$visibleall = true;
     // cria o container com as classes
     Globals::setPrivate('app')->container = array('settings' => function () {
         require_once 'Settings.php';
         return new Settings();
     }, 'http' => function () {
         require_once 'Http.php';
         return new Http();
     }, 'controller' => function () {
         require_once 'Controller.php';
         return new Controller();
     }, 'view' => function () {
         require_once 'View.php';
         return new View();
     }, 'path' => function () {
         require_once 'Path.php';
         return new Path();
     }, 'plugins' => function () {
         require_once 'Plugins.php';
         return new Plugins();
     });
     $settings = Globals::getPrivate("app")->container->settings;
     $this->settings = $settings = $settings();
     // inicializa a classe Http
     $http = Globals::getPrivate("app")->container->http;
     $this->http = $http = $http();
     // inicializa a classe controller
     $controller = Globals::getPrivate("app")->container->controller;
     $this->controller = $controller = $controller();
     // inicializa a classe controller
     $path = Globals::getPrivate("app")->container->path;
     $this->path = $path = $path();
     // inicializa a classe controller
     $controller = Globals::getPrivate("app")->container->controller;
     $this->controller = $controller = $controller();
     // inicializa a classe controller
     $plugins = Globals::getPrivate("app")->container->plugins;
     $this->plugins = $plugins = $plugins();
     // registra as definições iniciais
     $settings->registerSettings($options);
     // ajusta as definições iniciais
     $settings->define();
     // define requisição/Resposta HTTP
     $http->setAdapterSettings($settings);
     $getResponse = $http->getResponse();
     Globals::set()->http = $getResponse;
     // define settings definido no load
     $getSettings = $settings->getSettings();
     Globals::set()->settings = $getSettings;
     // define os caminhos atuais
     $path->setPath($settings);
     $getPath = $path->getPath();
     Globals::set()->path = $getPath;
     //define e carrega o diretório dos arquivos observadores
     Events::setPaths(array(Globals::get('path/manager/path'), Globals::get('path/app/path')));
     Events::loadObserver();
     // define application base
     $getControllers = Globals::get('http/controllers');
     if ($getControllers->list[0] == '!') {
         Globals::set('app')->run = "!";
     } else {
         Globals::set('app')->run = "#" . Globals::get('path/app/name');
         //$getPath->name;
     }
     if (Globals::get('app/run') == '!') {
         $HTTP_SUITE_PAR = isset($_SERVER['HTTP_SUITE_PAR']) ? $_SERVER['HTTP_SUITE_PAR'] : null;
     } else {
         $resultCheckFirstAccess = $settings->checkFirstAccess();
         if ($resultCheckFirstAccess == true) {
             $resultEvents = Events::Attach('info[welcome]', array('value' => '', 'action' => ''));
             if (!$resultEvents) {
                 $html = '<h1>Suite</h1>';
                 $html .= '<h3>First Access</h3>';
                 $html .= '<p>';
                 $html .= '</p>';
                 echo $html;
                 exit;
             }
         }
         // verifica se a requisião atual é de origem do próprio Suite
         //$result = Functions::checkRequestBySuite();
         //if($result == false){
         // verifica as informações iniciais, como estrutura de diretórios e outros
         $resultCheckStruct = $settings->checkStruct();
         if ($resultCheckStruct == false) {
             // anexa evento
             $resultEvents = Events::Attach('error[app_not_found]', array('value' => '', 'action' => ''));
             if (!$resultEvents) {
                 $html = '<h1>Suite</h1>';
                 $html .= '<h3>Application not found</h3>';
                 $html .= '<p>';
                 $html .= '<strong>Name:</strong> ' . Globals::get('path/app/name');
                 $html .= '<br><strong>Path:</strong> ' . Globals::get('path/app/path');
                 $html .= '</p>';
                 echo $html;
                 exit;
             }
//.........这里部分代码省略.........
开发者ID:wallrio,项目名称:suite,代码行数:101,代码来源:App.php

示例7: session_start

<?php

session_start();
header('Content-Type: text/html; charset=utf-8');
header('Content-Language: pt-br');
$path = __DIR__ . '/src/';
$dir = scandir($path);
foreach ($dir as $k => $d) {
    if (!substr_count($d, '.php')) {
        continue;
    }
    $class = explode('.php', $d);
    $class = reset($class);
    if (class_exists($class)) {
        continue;
    }
    include $path . $d;
}
$r = isset($_GET['r']) ? $_GET['r'] : '';
$r = explode('?', $r);
$r = reset($r);
Globals::set('r', $r);
App::setupLibrary();
App::setupModels();
App::setupControllers();
App::getRoute();
App::close();
开发者ID:AndreAntunesVieira,项目名称:EstacaoGamer,代码行数:27,代码来源:EGframework.php

示例8: setUp

 public function setUp()
 {
     Globals::set('getIds', [7, 6]);
     $argv = [__FILE__, '-d', dirname(__DIR__) . DIRECTORY_SEPARATOR . 'tests'];
     $this->binary = new Binary($argv);
 }
开发者ID:phramework,项目名称:testphase,代码行数:6,代码来源:BinaryTest.php

示例9: testGetVariableAsIndex

 /**
  * @depends testSetArray
  * @covers Phramework\Testphase\Globals::get
  */
 public function testGetVariableAsIndex($array)
 {
     $variableIndex = '1';
     Globals::set('variableIndex', $variableIndex);
     $return = Globals::get(sprintf('array[%s]', 'variableIndex'));
     $this->assertSame($array[$variableIndex], $return);
     //literal integer
     $return = Globals::get(sprintf('array[%s]', 2));
     $this->assertSame($array[2], $return);
 }
开发者ID:phramework,项目名称:testphase,代码行数:14,代码来源:GlobalsTest.php

示例10: addCache

 /**
  *
  */
 public function addCache()
 {
     Globals::set('MongularCache', TRUE);
 }
开发者ID:mongular,项目名称:mongular,代码行数:7,代码来源:Mongular.php

示例11: TestAction

 public function TestAction()
 {
     Globals::set('manager')->inner('parameters', array('title' => 'Plugins', 'subtitle' => '', 'content' => '<div id="novis"></div>'));
     return array('continue' => true, 'view' => array(array('html' => '')));
 }
开发者ID:wallrio,项目名称:suite,代码行数:5,代码来源:Plugins_control.php

示例12: clear_session

 /**
  * Method to destroy all data in the session and end it.
  */
 public function clear_session()
 {
     \Globals::set('_SESSION', array());
     session_destroy();
 }
开发者ID:nedron92,项目名称:logd-oop,代码行数:8,代码来源:sessionclass.php


注:本文中的Globals::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。