本文整理汇总了PHP中SC::set方法的典型用法代码示例。如果您正苦于以下问题:PHP SC::set方法的具体用法?PHP SC::set怎么用?PHP SC::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SC
的用法示例。
在下文中一共展示了SC::set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: outputHeaders
public function outputHeaders($ext, $full_path)
{
SC::set('header_suppress_cache_control', 1);
$cache_duration = 86400 * 7;
// 7 days
$last_mod_duration = 86400 * 2;
// 2 days
$last_mod_date = date('r', SC::get('board_config.time_now') - $last_mod_duration);
$to_cache_date = date('r', SC::get('board_config.time_now') + $cache_duration);
header("Expires: {$to_cache_date}");
header("Last-Modified: {$last_mod_date}");
header("Cache-Control: max-age={$cache_duration}");
// make an etag based on the full path
// header('Etag: ' .'"'. crc32($full_path) . '"');
if ($ext == ".js") {
header("Content-type: text/javascript");
}
if ($ext == ".css") {
header("Content-type: text/css");
}
}
示例2: data
/**
* Data function returns a container object, where all internal
* data is stored.
* @return Container
* @access private
*/
private function data()
{
static $data;
if (isset($data)) {
return $data;
}
$data = new Container();
$params = array("cache" => SC::get('board_config.always_cache_bust') ? SC::get('board_config.time_now') . '_' . mt_rand(1, 999999) : SC::get('board_config.cache_bust'), 'yui_version' => '2.6.0');
$data->set("settings", $params);
// Until all content is in grids, we need this var
// REMOVE ONCE EVERY SINGLE PAGE ON THE SITE IS IN GRIDS
$data->set('enable_nongrid', TRUE);
if (isset($_GET['login_success']) && SC::get('userdata.user_id') < 1 && empty($_COOKIE)) {
SC::set('board_config.sys_message', 'Gaia Online requires browser cookies. Please enable cookies in your browser and try again. Mmmm cookies.');
}
$data->set('ext_script_js', array());
$data->set('script_js', array());
$data->set('script_css', array());
$data->set('script_css_ie', array());
return $data;
}
示例3: dispatch
/**
* Perform the desired action.
* @param string The name of the action.
* @return void
* @access public
*/
public function dispatch($request_name = NULL)
{
while (true) {
try {
$request = $this->instantiate($request_name, 'request', 'request');
SC::set('CIRCUIT_REQUEST_NAME', $request_name);
} catch (Exception $e) {
$request = $this->instantiate(CIRCUIT_APP_404, 'request');
}
try {
if (method_exists($request, 'load')) {
$request->load($this->observer);
}
if (method_exists($request, 'forward') && ($request_name = $request->forward($this->observer))) {
continue;
}
$action_name = method_exists($request, 'selectAction') ? $request->selectAction($this->observer) : $request_name;
} catch (Exception $e) {
$this->handleException($e);
return $this->instantiate('Default.MessageDie', 'view')->execute($this);
}
break;
}
$action_result = null;
if ($action_name) {
try {
$action = $this->instantiate($action_name, 'action');
$action_result = $action->execute($this);
} catch (Exception $e) {
$action_result = $this->handleException($e);
}
}
$this->clearExceptionListeners();
$selectView = 'selectView_' . str_replace('.', '_', $action_name);
$view_name = method_exists($request, $selectView) ? $request->{$selectView}($action_result) : (method_exists($request, 'selectView') ? $request->selectView($action_result) : $request_name);
try {
$view = $this->instantiate($view_name, 'view');
} catch (Exception $e) {
$view = $this->instantiate(CIRCUIT_APP_404, 'view');
}
$view->execute($this);
}