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


PHP SessionManager::singleton方法代码示例

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


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

示例1: App

 function App($rootdir, $args)
 {
     Profiler::StartTimer("WebApp", 1);
     Profiler::StartTimer("WebApp::Init", 1);
     Profiler::StartTimer("WebApp::TimeToDisplay", 1);
     $GLOBALS["webapp"] = $this;
     register_shutdown_function(array('Logger', 'processShutdown'));
     ob_start();
     $this->rootdir = $rootdir;
     $this->debug = !empty($args["debug"]);
     $this->getAppVersion();
     Logger::Info("WebApp Initializing (" . $this->appversion . ")");
     Logger::Info("Path: " . get_include_path());
     $this->initAutoLoaders();
     Logger::Info("Turning Pandora flag on");
     if (class_exists("PandoraLog")) {
         $pandora = PandoraLog::singleton();
         $pandora->setFlag(true);
     }
     $this->locations = array("scripts" => "htdocs/scripts", "css" => "htdocs/css", "tmp" => "tmp", "config" => "config");
     $this->request = $this->ParseRequest(NULL, $args);
     $this->locations["basedir"] = $this->request["basedir"];
     $this->locations["scriptswww"] = $this->request["basedir"] . "/scripts";
     $this->locations["csswww"] = $this->request["basedir"] . "/css";
     $this->locations["imageswww"] = $this->request["basedir"] . "/images";
     $this->InitProfiler();
     $this->cfg = ConfigManager::singleton($rootdir);
     $this->InitProfiler();
     // reinitialize after loading the config
     $this->locations = array_merge($this->locations, $this->cfg->locations);
     $this->data = DataManager::singleton($this->cfg);
     set_error_handler(array($this, "HandleError"), error_reporting());
     DependencyManager::init($this->locations);
     if ($this->initialized()) {
         try {
             $this->session = SessionManager::singleton();
             // Set sticky debug flag
             if (isset($this->request["args"]["debug"])) {
                 $this->debug = $_SESSION["debug"] = $this->request["args"]["debug"] == 1;
             } else {
                 if (!empty($_SESSION["debug"])) {
                     $this->debug = $_SESSION["debug"];
                 }
             }
             $this->cobrand = $this->GetRequestedConfigName($this->request);
             $this->cfg->GetConfig($this->cobrand, true, $this->cfg->role);
             $this->ApplyConfigOverrides();
             $this->locations = DependencyManager::$locations = $this->cfg->locations;
             // And the google analytics flag
             if (isset($this->request["args"]["GAalerts"])) {
                 $this->GAalerts = $this->session->temporary["GAalerts"] = $this->request["args"]["GAalerts"] == 1 ? 1 : 0;
             } else {
                 if (!empty($this->session->temporary["GAalerts"])) {
                     $this->GAalerts = $this->session->temporary["GAalerts"];
                 } else {
                     $this->GAalerts = 0;
                 }
             }
             $this->apiversion = any($this->request["args"]["apiversion"], ConfigManager::get("api.version.default"), 0);
             $this->tplmgr = TemplateManager::singleton($this->rootdir);
             $this->tplmgr->assign_by_ref("webapp", $this);
             $this->components = ComponentManager::singleton($this);
             $this->orm = OrmManager::singleton();
             //$this->tplmgr->SetComponents($this->components);
         } catch (Exception $e) {
             print $this->HandleException($e);
         }
     } else {
         $fname = "./templates/uninitialized.tpl";
         if (($path = file_exists_in_path($fname, true)) !== false) {
             print file_get_contents($path . "/" . $fname);
         }
     }
     $this->user = User::singleton();
     $this->user->InitActiveUser($this->request);
     // Merge permanent user settings from the URL
     if (!empty($this->request["args"]["settings"])) {
         foreach ($this->request["args"]["settings"] as $k => $v) {
             $this->user->SetPreference($k, $v, "user");
         }
     }
     // ...and then do the same for session settings
     if (!empty($this->request["args"]["sess"])) {
         foreach ($this->request["args"]["sess"] as $k => $v) {
             $this->user->SetPreference($k, $v, "temporary");
         }
     }
     // And finally, initialize abtests
     if (class_exists(ABTestManager)) {
         Profiler::StartTimer("WebApp::Init - abtests", 2);
         $this->abtests = ABTestmanager::singleton(array("cobrand" => $this->cobrand, "v" => $this->request["args"]["v"]));
         Profiler::StopTimer("WebApp::Init - abtests");
     }
     Profiler::StopTimer("WebApp::Init");
 }
开发者ID:ameyer430,项目名称:elation,代码行数:95,代码来源:app_class.php

示例2: App

 function App($rootdir, $args)
 {
     Profiler::StartTimer("WebApp", 1);
     Profiler::StartTimer("WebApp::Init", 1);
     Profiler::StartTimer("WebApp::TimeToDisplay", 1);
     // disable notices by default.  This should probably be a config option...
     error_reporting(error_reporting() ^ E_NOTICE);
     // FIXME - xdebug recursion limit causes problems in some components...
     ini_set('xdebug.max_nesting_level', 250);
     $GLOBALS["webapp"] = $this;
     register_shutdown_function(array($this, 'shutdown'));
     ob_start();
     $this->rootdir = $rootdir;
     $this->debug = !empty($args["debug"]);
     $this->getAppVersion();
     Logger::Info("WebApp Initializing (" . $this->appversion . ")");
     Logger::Info("Path: " . get_include_path());
     $this->initAutoLoaders();
     if (class_exists("PandoraLog")) {
         Logger::Info("Turning Pandora flag on");
         $pandora = PandoraLog::singleton();
         $pandora->setFlag(true);
     }
     $this->InitProfiler();
     $this->request = $this->ParseRequest(NULL, $args);
     $this->cfg = ConfigManager::singleton(array("rootdir" => $rootdir, "basedir" => $this->request["basedir"]));
     $this->locations = ConfigManager::getLocations();
     $this->InitProfiler();
     // reinitialize after loading the config
     Profiler::StartTimer("WebApp::Init - handleredirects", 1);
     $this->request = $this->ApplyRedirects($this->request);
     Profiler::StopTimer("WebApp::Init - handleredirects");
     $this->data = DataManager::singleton($this->cfg);
     set_error_handler(array($this, "HandleError"), error_reporting());
     DependencyManager::init($this->locations);
     if ($this->initialized()) {
         try {
             $this->session = SessionManager::singleton();
             // Set sticky debug flag
             if (isset($this->request["args"]["debug"])) {
                 $this->debug = $_SESSION["debug"] = $this->request["args"]["debug"] == 1;
             } else {
                 if (!empty($_SESSION["debug"])) {
                     $this->debug = $_SESSION["debug"];
                 }
             }
             $this->cobrand = $this->GetRequestedConfigName($this->request);
             if (isset($this->request["args"]["_role"])) {
                 $this->role = $this->request["args"]["_role"];
             } else {
                 if (isset($this->cfg->servers["role"])) {
                     $this->role = $this->cfg->servers["role"];
                 } else {
                     $this->role = "dev";
                 }
             }
             $this->cfg->GetConfig($this->cobrand, true, $this->role);
             $this->ApplyConfigOverrides();
             $this->locations = DependencyManager::$locations = $this->cfg->locations;
             // And the google analytics flag
             if (isset($this->request["args"]["GAalerts"])) {
                 $this->GAalerts = $this->session->temporary["GAalerts"] = $this->request["args"]["GAalerts"] == 1 ? 1 : 0;
             } else {
                 if (!empty($this->session->temporary["GAalerts"])) {
                     $this->GAalerts = $this->session->temporary["GAalerts"];
                 } else {
                     $this->GAalerts = 0;
                 }
             }
             $this->apiversion = isset($this->request["args"]["apiversion"]) ? $this->request["args"]["apiversion"] : ConfigManager::get("api.version.default", 0);
             $this->tplmgr = TemplateManager::singleton($this->locations);
             $this->tplmgr->assign_by_ref("webapp", $this);
             $this->components = ComponentManager::singleton($this);
             if (class_exists("OrmManager")) {
                 $this->orm = OrmManager::singleton($this->locations);
             }
             //$this->tplmgr->SetComponents($this->components);
         } catch (Exception $e) {
             print $this->HandleException($e);
         }
     } else {
         $fname = "components/elation/templates/uninitialized.html";
         if (($path = file_exists_in_path($fname, true)) !== false) {
             print file_get_contents($path . "/" . $fname);
         }
     }
     $this->user = User::singleton();
     $this->user->InitActiveUser($this->request);
     // Merge permanent user settings from the URL
     if (!empty($this->request["args"]["settings"])) {
         foreach ($this->request["args"]["settings"] as $k => $v) {
             $this->user->SetPreference($k, $v, "user");
         }
     }
     // ...and then do the same for session settings
     if (!empty($this->request["args"]["sess"])) {
         foreach ($this->request["args"]["sess"] as $k => $v) {
             $this->user->SetPreference($k, $v, "temporary");
         }
     }
//.........这里部分代码省略.........
开发者ID:jbaicoianu,项目名称:elation,代码行数:101,代码来源:app_class.php

示例3: __construct

 function __construct($template = NULL, $data = NULL)
 {
     if ($template instanceof ComponentResponse) {
         $this->template = $template->getTemplate();
         $this->data = $template->data;
     } else {
         $this->template = $template;
         $this->data = $data;
     }
     $this->flsid = SessionManager::singleton()->flsid;
 }
开发者ID:jbaicoianu,项目名称:elation,代码行数:11,代码来源:componentmanager_class.php

示例4: controller_footer

 public function controller_footer($args)
 {
     // Assemble page-level args for Google Analytics --
     global $webapp;
     $analytics = Analytics::singleton();
     $componentmgr = ComponentManager::singleton();
     $args['cobrand'] = $webapp->cobrand;
     $args['store_name'] = $this->sanitizeStrForGA($analytics->store_name);
     if ($webapp->request['referer']['host'] && !stristr($webapp->request['referer']['host'], $webapp->request['host'])) {
         $args['query'] = $this->getQueryFromURL($webapp->request['referrer'], $args['store_name']);
     } else {
         $args['query'] = $this->sanitizeStrForGA(any($analytics->search["input"]["query"], $analytics->qpmreq->query, 'none'));
     }
     $args['bs'] = $componentmgr->pagecfg;
     //testing
     $args['pagegroup'] = $componentmgr->pagecfg['pagegroup'];
     $args['pagetype'] = $componentmgr->pagecfg['pagename'];
     $args['status'] = any($analytics->status, $webapp->response['http_status']);
     $args['total'] = $analytics->total;
     $args['GAenabled'] = $args['pagegroup'] ? any(ConfigManager::get("tracking.googleanalytics.enabled"), $webapp->cfg->servers['tracking']['googleanalytics']['enabled']) : 0;
     $args['GAalerts'] = $webapp->GAalerts;
     $args['trackingcode'] = any(ConfigManager::get("tracking.googleanalytics.trackingcode"), $webapp->cfg->servers['tracking']['googleanalytics']['trackingcode']);
     $args['enable_native_tracking'] = ConfigManager::get("tracking.enable_native_tracking", NULL);
     $args['category'] = any($analytics->category, $analytics->pandora_result['top_category'], $analytics->item->category, $analytics->qpmquery['protocolheaders']['category'], 'none');
     $args['subcategory'] = preg_replace("#\\s#", "_", any($analytics->subcategory, $analytics->pandora_result['top_subcategory'], 'none'));
     $args['city'] = "Mountain View";
     $args['state'] = "CA";
     $args['country'] = "USA";
     if ($analytics->city && $analytics->state) {
         $args['city'] = ucWords($analytics->city);
         $args['state'] = $analytics->state;
         $args['country'] = "USA";
     }
     if (in_array($args['cobrand'], array('paypaluk', 'thefinduk', 'paypalcanada'))) {
         $args['city'] = 'unknown';
         $args['state'] = 'unknown';
         $args['country'] = $args['cobrand'] == 'paypalcanada' ? "Canada" : "UK";
     }
     $args['pagenum'] = any($analytics->pandora_result['page_num'], 1);
     $args['version'] = any(ABTestManager::getVersion(), "unknown");
     $args['filters'] = $analytics->qpmreq->filter['brand'] ? '1' : '0';
     $args['filters'] .= $analytics->qpmreq->filter['color'] ? '1' : '0';
     $args['filters'] .= $analytics->qpmreq->filter['storeswithdeals'] ? '1' : '0';
     //(coupons)
     $args['filters'] .= $analytics->qpmquery['headers']['localshopping'] ? '1' : '0';
     //(local)
     $args['filters'] .= $analytics->qpmquery['headers']['market'] == 'green' ? '1' : '0';
     //(green)
     $args['filters'] .= $analytics->qpmreq->filter['minimall'] ? '1' : '0';
     //(marketplaces)
     $args['filters'] .= $analytics->qpmreq->filter['filter']['price'] ? '1' : '0';
     $args['filters'] .= $analytics->qpmreq->filter['sale'] ? '1' : '0';
     $args['filters'] .= $analytics->qpmreq->filter['store'] ? '1' : '0';
     $args['filters'] .= $analytics->qpmreq->filter['freeshipping'] ? '1' : '0';
     $args['alpha'] = $analytics->alpha;
     $args['browse'] = $analytics->browse;
     $session = SessionManager::singleton();
     $args['is_new_user'] = $session->is_new_user;
     $args['is_new_session'] = $session->is_new_session;
     $user = User::singleton();
     $args['is_logged_in'] = $user->isLoggedIn();
     $args['usertype'] = $user->usertype;
     $args['userid'] = $user->userid;
     $args['useremail'] = $user->email;
     $estimated_birth_year = $user->getUserSetting('estimated_birth_year');
     $gender = $user->gender;
     $user_gender = $gender == 'F' ? 'female' : 'male';
     //if($user->getUserSetting("tracking.user.demographics_dimension") != 1) {
     $args['birth_year'] = $estimated_birth_year;
     $args['user_gender'] = $user_gender;
     $location = $user->GetLocation();
     if ($location['city'] && $location['state']) {
         $args['demo_location'] = $location['city'] . ',' . $location['state'];
     }
     //$user->setUserSetting("tracking.user.demographics_dimension", "1");
     //}
     $args['cfg_cobrand'] = $webapp->cfg->servers["cobrand"];
     $args['request_cobrand'] = $webapp->request["args"]["cobrand"];
     //$args['GAenabled'] = 1; //testing only
     if (empty($this->shown["footer"])) {
         // Only allow footer once per page
         $this->shown["footer"] = true;
         return $this->GetComponentResponse("./footer.tpl", $args);
     }
     return "";
 }
开发者ID:ameyer430,项目名称:elation,代码行数:86,代码来源:html.php


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