本文整理汇总了PHP中Flash::retrieve方法的典型用法代码示例。如果您正苦于以下问题:PHP Flash::retrieve方法的具体用法?PHP Flash::retrieve怎么用?PHP Flash::retrieve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flash
的用法示例。
在下文中一共展示了Flash::retrieve方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_header
/** function get_header
* Generate the HTML header portion of the page
*
* @param array [optional] meta variables
* @option string 'title' the page title
* @option string 'head_data' any HTML to be inserted in the head tag
* @option array 'menu_data' the data for the counts in the menu
* @option array 'game_data' the game data for my game list under the menu
* @option bool 'show_menu' show the menu
* @option string 'file_name' becomes the body id with _page appended
* @return string HTML header for page
*/
function get_header($meta = null)
{
if (!defined('GAME_NAME')) {
define('GAME_NAME', 'Game');
}
$title = !empty($meta['title']) ? GAME_NAME . ' :: ' . $meta['title'] : GAME_NAME;
$show_menu = isset($meta['show_menu']) ? (bool) $meta['show_menu'] : true;
$show_nav_links = isset($meta['show_nav_links']) ? (bool) $meta['show_nav_links'] : true;
$menu_data = isset($meta['menu_data']) ? $meta['menu_data'] : false;
$head_data = isset($meta['head_data']) ? $meta['head_data'] : '';
$file_name = isset($meta['file_name']) ? $meta['file_name'] : basename($_SERVER['SCRIPT_NAME']);
$file_name = substr($file_name, 0, strrpos($file_name, '.'));
// make sure we have these
$GLOBALS['_&_DEBUG_QUERY'] = !empty($GLOBALS['_&_DEBUG_QUERY']) ? $GLOBALS['_&_DEBUG_QUERY'] : '';
$GLOBALS['_?_DEBUG_QUERY'] = !empty($GLOBALS['_?_DEBUG_QUERY']) ? $GLOBALS['_?_DEBUG_QUERY'] : (defined('DEBUG') && DEBUG ? '?' : '');
$flash = '';
if (class_exists('Flash')) {
$flash = Flash::retrieve();
}
if ($show_menu) {
if (!$menu_data) {
$menu_data = array('my_turn' => 0, 'my_games' => 0, 'games' => 0, 'in_vites' => 0, 'out_vites' => 0, 'open_vites' => 0, 'new_msgs' => 0, 'msgs' => 0);
list($menu_data['games'], ) = Game::get_count();
list($menu_data['setups'], $menu_data['my_setups']) = Setup::get_count($_SESSION['player_id']);
list($menu_data['my_games'], $menu_data['my_turn']) = Game::get_my_count($_SESSION['player_id']);
list($menu_data['in_vites'], $menu_data['out_vites'], $menu_data['open_vites']) = Game::get_invite_count($_SESSION['player_id']);
$messages = Message::get_count($_SESSION['player_id']);
$menu_data['msgs'] = (int) @$messages[0];
$menu_data['new_msgs'] = (int) @$messages[1];
$allow_blink = 'index.php' == basename($_SERVER['PHP_SELF']);
}
// highlight the important menu values
foreach ($menu_data as $key => $value) {
switch ($key) {
case 'my_turn':
case 'new_msgs':
case 'in_vites':
if (0 < $value) {
$menu_data[$key] = '<span class="notice">' . $value . '</span>';
}
break;
default:
// do nothing
break;
}
}
$game_data = isset($meta['game_data']) ? $meta['game_data'] : Game::get_list($_SESSION['player_id'], false);
}
// if we are admin logged in as someone else, let us know
$admin_css = $admin_div = '';
if (isset($_SESSION['admin_id']) && isset($_SESSION['player_id']) && $_SESSION['player_id'] != $_SESSION['admin_id']) {
$admin_css = '
<style type="text/css">
html { border: 5px solid red; }
#admin_username {
background: red;
color: black;
position: fixed;
top: 0;
left: 50%;
z-index: 99999;
width: 200px;
margin-left: -100px;
text-align: center;
font-weight: bold;
font-size: larger;
padding: 3px;
}
</style>';
$admin_div = '<div id="admin_username">' . $GLOBALS['Player']->username . ' [ ' . $GLOBALS['Player']->id . ' ]</div>';
}
$query_strings = 'var debug_query_ = "' . $GLOBALS['_&_DEBUG_QUERY'] . '"; var debug_query = "' . $GLOBALS['_?_DEBUG_QUERY'] . '";';
$debug_string = defined('DEBUG') && DEBUG ? 'var debug = true;' : 'var debug = false;';
$nav_links = '';
if ($show_nav_links && class_exists('Settings') && Settings::test()) {
$nav_links = Settings::read('nav_links');
}
$GAME_NAME = GAME_NAME;
$html = <<<EOF
<!DOCTYPE html>
<html lang="en-us">
<head>
\t<title>{$title}</title>
\t<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
\t<script type="text/javascript">
//.........这里部分代码省略.........
示例2: get_header
/** function get_header
* Generate the HTML header portion of the page
*
* @param array [optional] meta variables
* @option string 'title' the page title
* @option string 'head_data' any HTML to be inserted in the head tag
* @option array 'menu_data' the data for the counts in the menu
* @option array 'game_data' the game data for my game list under the menu
* @option bool 'show_menu' show the menu
* @option string 'file_name' becomes the body id with _page appended
* @return string HTML header for page
*/
function get_header($meta = null)
{
if (!defined('GAME_NAME')) {
define('GAME_NAME', 'Game');
}
$title = !empty($meta['title']) ? GAME_NAME . ' :: ' . $meta['title'] : GAME_NAME;
$show_menu = isset($meta['show_menu']) ? (bool) $meta['show_menu'] : true;
$show_nav_links = isset($meta['show_nav_links']) ? (bool) $meta['show_nav_links'] : true;
$menu_data = isset($meta['menu_data']) ? $meta['menu_data'] : false;
$head_data = isset($meta['head_data']) ? $meta['head_data'] : '';
$file_name = isset($meta['file_name']) ? $meta['file_name'] : basename($_SERVER['SCRIPT_NAME']);
$file_name = substr($file_name, 0, strrpos($file_name, '.'));
// make sure we have these
$GLOBALS['_&_DEBUG_QUERY'] = isset($GLOBALS['_&_DEBUG_QUERY']) ? $GLOBALS['_&_DEBUG_QUERY'] : '';
$GLOBALS['_?_DEBUG_QUERY'] = isset($GLOBALS['_?_DEBUG_QUERY']) ? $GLOBALS['_?_DEBUG_QUERY'] : '';
$flash = '';
if (class_exists('Flash')) {
$flash = Flash::retrieve();
}
if ($show_menu) {
if (!$menu_data) {
$menu_data = array('my_turn' => 0, 'my_games' => 0, 'games' => 0, 'new_msgs' => 0, 'msgs' => 0, 'in_vites' => 0, 'out_vites' => 0);
$list = Game::get_list($_SESSION['player_id']);
$invites = Game::get_invites($_SESSION['player_id']);
if (is_array($list)) {
foreach ($list as $game) {
++$menu_data['games'];
if ($game['in_game'] && !in_array($game['state'], array('Finished', 'Draw'))) {
++$menu_data['my_games'];
}
if ($game['my_turn'] && 'Placing' != $game['state']) {
++$menu_data['my_turn'];
}
}
}
if (is_array($invites)) {
foreach ($invites as $game) {
if ($game['invite']) {
++$menu_data['in_vites'];
} else {
++$menu_data['out_vites'];
}
}
}
$messages = Message::get_count($_SESSION['player_id']);
$menu_data['msgs'] = (int) @$messages[0];
$menu_data['new_msgs'] = (int) @$messages[1];
$allow_blink = 'index.php' == basename($_SERVER['PHP_SELF']);
}
// highlight the important menu values
foreach ($menu_data as $key => $value) {
switch ($key) {
case 'my_turn':
case 'new_msgs':
case 'in_vites':
if (0 < $value) {
$menu_data[$key] = '<span class="notice">' . $value . '</span>';
}
break;
default:
// do nothing
break;
}
}
$game_data = isset($meta['game_data']) ? $meta['game_data'] : Game::get_list($_SESSION['player_id'], false);
}
// if we are admin logged in as someone else, let us know
$admin_css = $admin_div = '';
if (isset($_SESSION['admin_id']) && isset($_SESSION['player_id']) && $_SESSION['player_id'] != $_SESSION['admin_id']) {
$admin_css = '
<style type="text/css">
html { border: 5px solid red; }
#admin_username {
background: red;
color: black;
position: fixed;
top: 0;
left: 50%;
width: 200px;
margin-left: -100px;
text-align: center;
font-weight: bold;
font-size: larger;
padding: 3px;
}
</style>';
$admin_div = '<div id="admin_username">' . $GLOBALS['Player']->username . ' [ ' . $GLOBALS['Player']->id . ' ]</div>';
}
//.........这里部分代码省略.........