本文整理汇总了PHP中Globals::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Globals::get方法的具体用法?PHP Globals::get怎么用?PHP Globals::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Globals
的用法示例。
在下文中一共展示了Globals::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doSwitch
/**
* Alterna entre los entornos disonibles
*
* @param string $next_environment Entorno a utilizar, si no se indica se
* se utilizara el siguiente disponible
*/
public static function doSwitch($next_environment = null)
{
$environment = self::info();
if (empty($environment['available'])) {
return false;
}
if ($next_environment === null) {
$index = array_search($environment['current'], $environment['available']) + 1;
if ($index >= count($environment['available'])) {
$index = 0;
}
} else {
$index = array_search($next_environment, $environment['available']);
if (false === $index) {
return false;
}
}
$environment['current'] = $environment['available'][$index];
$info = json_encode($environment, JSON_PRETTY_PRINT);
$path = Globals::get('base_path') . '/config/environment.json';
if (false === @file_put_contents($path, $info)) {
return false;
}
return $environment['current'];
}
示例2: checkModeAdmin
public static function checkModeAdmin()
{
if (session_id() == '') {
@session_start("suite");
}
$_SERVER['HTTP_SOURCE'] = isset($_SERVER['HTTP_SOURCE']) ? $_SERVER['HTTP_SOURCE'] : "";
if ($_SERVER['HTTP_SOURCE'] != "suite") {
$manager = null;
// controla o acesso ao manager, verificando a autenticação
/*if(count(Globals::get('app/options/master/manager')) > 0 ){
$manager = Globals::get('app/options/master/manager');
}*/
if (count(Globals::get('settings/manager')) > 0) {
$manager = Globals::get('settings/manager');
}
//$manager = isset(Globals::get('app/options/master/manager/access/username'))?'1':null;//isset(Globals::get('app/options/master/manager'))?Globals::get('app/options/master/manager'):null;
if ($manager != null) {
$manager_access = count($manager->access) > 0 ? $manager->access : null;
if ($manager_access != null && strpos(Globals::get('http/controllers/destination'), '!/manager/access') === false) {
if (!isset($_SESSION["suite"])) {
return false;
}
$sessionSuite = $_SESSION["suite"];
$sessionSuiteObj = json_decode($sessionSuite);
if (!isset($sessionSuiteObj->manager->access)) {
//$querys = "&querybefore=". Globals::get()->http->destination;
header("location: " . Globals::get('path/manager/link') . "/manager/access");
return false;
}
}
}
//return false;
}
return true;
}
示例3: saveAction
public function saveAction()
{
require Globals::get('current/path/action/path') . "../ModelAssistent.php";
$modelAssistent = new ModelAssistent();
$data = $_POST['data'];
$dataObj = json_decode($data);
$option = "";
foreach ($dataObj as $key => $value) {
foreach ($value as $key2 => $value2) {
if ($option != "") {
$option .= ",";
}
$option .= '"' . $key2 . '" : ' . json_encode($value2) . '';
}
}
$options = "{" . $option . "}";
$filename = Globals::get('path/domain/path') . 'options.json';
$result = file_put_contents($filename, $options);
if ($result) {
$status = "success";
}
$optionsObj = json_decode($options);
$modelAssistent->makeStruct($optionsObj);
echo json_encode(array('status' => $status));
return array('continue' => false);
}
示例4: logoutAction
public function logoutAction()
{
//$path = Globals::get('path/manager/link').'manager/access/out';
//$html = file_get_contents($path);
Session::out();
header("location:" . Globals::get('path/manager/link'));
return array('continue' => false, 'parameters' => array('title' => 'Suite Manager', 'subtitle' => 'Manager Tool', 'content' => ''), 'view' => array(array('html' => '$html')));
}
示例5: checkFirstAccess
/**
* verifica estrutura da aplicação esta correta
* @return [type] [description]
*/
public function checkFirstAccess()
{
$pathApp = Globals::get('path/app/appbase/path');
$dirArray = Functions::scanOnlyDir($pathApp);
if (count($dirArray) < 1) {
return true;
} else {
return false;
}
}
示例6: AboutAction
public function AboutAction()
{
$link = '<a class="link" target="_blank" href="http://' . Globals::get('suite/site') . '">' . Globals::get('suite/site') . '</a>';
$html = '<dl>';
$html .= '<dt>Version</dt><dd>' . Globals::get('suite/version') . '</dd>';
$html .= '<dt>Author</dt><dd>' . Globals::get('suite/author') . '</dd>';
$html .= '<dt>Site</dt><dd>' . $link . '</dd>';
$html .= '</dl>';
return array('continue' => true, 'parameters' => array('title' => 'About Suite', 'subtitle' => 'Framework for developed web', 'content' => $html));
}
示例7: __construct
private function __construct()
{
$this->set_routing_table();
$a_get_request = Globals::get('_GET');
$m_route = array();
if (isset($a_get_request['viewfile']) && !is_null($a_get_request['viewfile'])) {
$m_route = explode('/', $a_get_request['viewfile']);
} else {
$m_route[0] = 'start';
}
$a_route = $this->get_route($m_route[0]);
if ($a_route !== false) {
if ($a_route['type'] === 'class') {
try {
$o_reflect_class = new ReflectionClass($m_route[0] . '\\' . $a_route['file']);
if ($o_reflect_class->hasMethod($m_route[1])) {
if ($m_route[0] === 'ajax') {
$o_reflect_class->newInstance($m_route[1]);
exit(1);
} else {
$o_reflect_method = $o_reflect_class->getMethod($m_route[1]);
if ($o_reflect_method->isStatic()) {
$o_reflect_method->invoke(null);
} else {
$o_reflect_method->invoke($o_reflect_class->newInstance());
}
}
}
} catch (ReflectionException $e) {
try {
$o_reflect_class = new ReflectionClass($m_route[0] . '\\' . $a_route['file']);
if ($o_reflect_class->hasMethod($a_route['default_method'])) {
$o_reflect_method = $o_reflect_class->getMethod($a_route['default_method']);
if ($o_reflect_method->isStatic()) {
$o_reflect_method->invoke(null);
} else {
$o_reflect_method->invoke($o_reflect_class->newInstance());
}
}
} catch (ReflectionException $e) {
echo $e->getMessage();
}
}
}
}
/*
$size = sizeof($m_view_file)-1;
self::$s_current_request_file = $m_view_file[$size];
unset($m_view_file[$size]);
$m_view_file = implode('/',$m_view_file);
self::$s_current_request_path = $m_view_file;
*/
}
示例8: welcomeAction
public function welcomeAction()
{
//$html = Globals::get()->http->destination;
$content = "<br>You can access the manager page to administer your application";
$content .= "<br><br><strong style='min-width:100px;display:inline-table'>Username:</strong> admin";
$content .= "<br><strong style='min-width:100px;display:inline-table'>Password:</strong> admin";
$content .= '<a href="' . Globals::get('path/manager/link') . '">Go to Manager</a>';
$content .= '<br>Use the assistant to create the application structure. ';
$content .= '<a href="' . Globals::get('path/manager/link') . '/manager/assistant">Go to Assistant</a>';
$content .= '<br>for help and instructions to develop, visit the link below.';
$content .= '<a href="' . Globals::get('path/manager/link') . '/manager/help">Go to Help</a>';
return array('continue' => true, 'parameters' => array('title' => 'Wellcome', 'subtitle' => 'You can now develop your application.', 'content' => $content));
}
示例9: append
public static function append($id, $msg)
{
// blockieren
Semphore::p();
$counter = Globals::get('counter', 0);
$counter++;
Globals::put('counter', $counter);
$textToAdd = $counter . ";" . $id . ";" . time() . ";" . $msg . PHP_EOL;
$myfile = fopen(self::FILE, "a") or die("Unable to open file!");
fwrite($myfile, $textToAdd);
fclose($myfile);
// freigeben
Semphore::v();
}
示例10: getCache
/**
* @return bool
*/
private static function getCache()
{
if (!Globals::get('MongularCache')) {
return FALSE;
}
try {
$cache = new self();
if ($cache->connect()) {
return $cache;
}
return FALSE;
} catch (\Exception $e) {
return FALSE;
}
}
示例11: 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);
}
示例12: makeStruct
public function makeStruct($options)
{
$app = $options->app;
//$pathApp = Globals::get('path/app/path');
$pathApp = Globals::get('path/app/appbase/path') . $app . '/';
if (!file_exists($pathApp)) {
mkdir($pathApp);
if (!is_writable($pathApp)) {
if (!chmod($pathApp, 0777)) {
echo "Não é possivel alterar a permissão do arquivo ({$filename})";
exit;
}
}
chmod($pathApp, 0777);
$pathModel = Globals::get('path/manager/modules/path') . 'manager/assistant/_assets/model/default.tar.gz';
$this->extract($pathModel, $pathApp);
}
}
示例13: init
/**
* This method initialize the current language and the current step
*
*/
private function init()
{
//get the current post-request and check if the language was given by POST
$s_post = \Globals::get('_POST');
if (!is_null($s_post['game_language'])) {
\Session::get_session()->set_value('language', $s_post['game_language']);
}
//Initialize the I18N-Class for templates-usage
\I18N::init();
//if we have no language-value in the session, set the default install-language to ENGLISH
if (is_null(\Session::get_session()->get_value('language'))) {
\I18N::set_language('en_EN');
} else {
\I18N::set_language(\Session::get_session()->get_value('language'));
}
\Replacer::set_language(\I18N::get_language());
//set the current step by POST
$this->i_step = $s_post['install_step'];
}
示例14: listAction
public function listAction()
{
/*echo '<pre>';
print_r(Globals::get('path/app/plugins'));
echo '</pre>';*/
//
$html = ' ';
/*Globals::set('parameters')->inner('title','List of plugins');
Globals::set('parameters')->inner('subtitle',' ');
Globals::set('parameters')->inner('content',$html);
*/
$repositoryList = Globals::get('path/app/plugins/repository');
$repository = "";
foreach ($repositoryList as $key => $value) {
$repository .= '<option value="' . $value . '">' . $key . '</option>';
}
//Globals::set('parameters')->inner('repository',$repository);
//$repository = '';
return array('continue' => true, 'parameters' => array('title' => 'List of Plugins', 'subtitle' => '', 'repository' => $repository, 'content' => $html), 'view' => array(array('html' => '')));
}
示例15: __construct
public function __construct()
{
if (isset($_GET['url'])) {
$url = explode('/', Globals::get('url'));
$url = array_filter($url);
$this->_module = strtolower(array_shift($url));
$this->_controller = strtolower(array_shift($url));
$this->_action = strtolower(array_shift($url));
$this->_args = $url;
}
if (!isset($this->_module) || $this->_module == 'index.php') {
$this->_module = 'home';
}
if (!isset($this->_controller) || empty($this->_controller)) {
$this->_controller = 'index';
}
if ($this->_action == '') {
$this->_action = 'show';
}
if (!isset($this->_argumentos)) {
$this->_argumentos = array();
}
}