本文整理汇总了PHP中toggle函数的典型用法代码示例。如果您正苦于以下问题:PHP toggle函数的具体用法?PHP toggle怎么用?PHP toggle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了toggle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testStorage
public function testStorage()
{
toggleConfig(new Storage());
$this->assertTrue(toggle('foo'));
$this->assertFalse(toggle('bar'));
$this->assertFalse(toggle('baz'));
}
示例2: topRight
function topRight($e = "index_e.php", $d = "index.php", $c = "index_ch.php")
{
$ret = '<div class="row">
<div class="col-sm-2">' . langs($e, $d, $c) . '</div>';
$ret .= '<div class="col-sm-8 col-8 col-lg-8 col-md-8"><h1>William Cuthbertson</h1></div>';
$ret .= '<div class="col-sm-2 col-2 col-md-2 col-lg-2 tog" >' . toggle() . '</div>
</div>';
$ret .= "<a id='top'></a>";
print $ret;
}
示例3: testToggleCallback
public function testToggleCallback()
{
$features = ['foo' => function (array $data) {
return $data['value'] === 123;
}, 'bar' => function ($a, $b) {
return $a + $b === 10;
}];
toggleConfig($features);
// Call all these function twice to check that it is memoized correctly
$this->assertTrue(toggle('foo', [['value' => 123]]));
$this->assertTrue(toggle('foo', [['value' => 123]]));
$this->assertFalse(toggle('foo', [['value' => 456]]));
$this->assertFalse(toggle('foo', [['value' => 456]]));
$this->assertTrue(toggle('bar', [5, 5]));
$this->assertTrue(toggle('bar', [5, 5]));
$this->assertFalse(toggle('bar', [1, 2]));
$this->assertFalse(toggle('bar', [1, 2]));
}
示例4: elseif
} elseif ($homescr < $oppscr) {
$results_1 = '<font color="' . $loosecolor . '">' . $homescr . '</font>';
$results_2 = '<font color="' . $wincolor . '">' . $oppscr . '</font>';
} else {
$results_1 = '<font color="' . $drawcolor . '">' . $homescr . '</font>';
$results_2 = '<font color="' . $drawcolor . '">' . $oppscr . '</font>';
}
if (isclanwaradmin($userID)) {
$adminaction = '<input type="button" style="margin-top:50px;" onclick="MM_openBrWindow(\'upload.php?cwID=' . $cwID . '\',\'Clanwars\',\'toolbar=no,status=no,scrollbars=yes,width=800,height=600\')" value="' . $_language->module['upload_screenshot'] . '" />
<input type="button" onclick="MM_openBrWindow(\'clanwars.php?action=edit&cwID=' . $ds['cwID'] . '\',\'Clanwars\',\'toolbar=no,status=no,scrollbars=yes,width=800,height=600\')" value="' . $_language->module['edit'] . '" />
<input type="button" onclick="MM_confirm(\'' . $_language->module['really_delete_clanwar'] . '?\',\'clanwars.php?action=delete&cwID=' . $ds['cwID'] . '\')" value="' . $_language->module['delete'] . '" />';
} else {
$adminaction = '';
}
$report = cleartext($ds['report']);
$report = toggle($report, $ds['cwID']);
if ($report == "") {
$report = "No Details Available.";
}
$squad = '' . getsquadname($ds['squad']) . '';
$opptag = getinput($ds['opptag']);
$oppteam = getinput($ds['oppteam']);
$server = getinput($ds['server']);
$hltv = getinput($ds['hltv']);
if (!empty($ds['hometeam'])) {
$array = unserialize($ds['hometeam']);
$n = 1;
foreach ($array as $id) {
if (!empty($id)) {
if ($n > 1) {
$hometeam .= ', <a href="index.php?site=profile&id=' . $id . '">' . getnickname($id) . '</a>';
示例5: toggle
<?php
echo toggle('has_menu');
?>
<p class="desc">Allow users to add/remove pages to your theme with ease.</p>
</li>
<li id="widget">
<span class="title">Widget Area</span>
<?php
echo toggle('has_widget');
?>
<p class="desc">A blank canvas</p>
</li>
<li id="custom_post_type">
<span class="title">Custom Post Type</span>
<?php
echo toggle('has_custom_post_type');
?>
<p class="desc">When posts and pages just won't cut it.</p>
</li>
</ul>
<?php
} else {
?>
<ul class="grid">
<li class="first" id="menu">
<p>Custom Menu</p>
<label class="icon">
<input type="checkbox" name="has_menu">
示例6: eval
$n++;
}
} else {
echo '<tr bgcolor="' . BG_1 . '"><td colspan="4">' . $_language->module['no_outgoing'] . '</td></tr>';
}
eval("\$pm_outgoing_foot = \"" . gettemplate("pm_outgoing_foot") . "\";");
echo $pm_outgoing_foot;
} elseif ($action == "show") {
$id = (int) $_GET['id'];
$ds = mysql_fetch_array(safe_query("SELECT * FROM " . PREFIX . "messenger WHERE messageID='" . $id . "' AND userID='" . $userID . "'"));
if ($ds['touser'] == $userID or $ds['fromuser'] == $userID) {
safe_query("UPDATE " . PREFIX . "messenger SET viewed='1' WHERE messageID='{$id}'");
$date = date("d.m.Y - H:i", $ds['date']);
$sender = '<a href="index.php?site=profile&id=' . $ds['fromuser'] . '"><b>' . getnickname($ds['fromuser']) . '</b></a>';
$message = cleartext($ds['message']);
$message = toggle($message, $ds['messageID']);
$title = clearfromtags($ds['title']);
$bg1 = BG_1;
eval("\$pm_show = \"" . gettemplate("pm_show") . "\";");
echo $pm_show;
} else {
redirect('index.php?site=messenger', '', 0);
}
} elseif ($action == "touser") {
$touser = $_GET['touser'];
$_language->read_module('bbcode', true);
$tousernick = getnickname($touser);
$touser = getforminput($touser);
$bg1 = BG_1;
eval("\$addbbcode = \"" . gettemplate("addbbcode") . "\";");
eval("\$pm_new_touser = \"" . gettemplate("pm_new_touser") . "\";");
示例7: getlanguage
$headline = $ds [headline1];
if ($ds [content2])
$content = $ds [content2];
else
$content = '[b]no version in selected language available![/b].[br][br]' . $ds [content1];
if ($ds [headline1]) {
$langs = '<a href="index.php?site=news_comments&newsID=' . $ds [newsID] . '&lang=' . $ds [lang1] . '">' . $language1 . '</a>';
$language = getlanguage ( $ds [lang1] );
$langs = eregi_replace ( '(alt=")(.*)(")', "\\1 News in $language\\3", $langs );
} else
$langs = '';
}
$content = cleartext ( $content );
$content = toggle ( $content, $ds [newsID] );
$poster = '' . getnickname ( $ds [poster] ) . '';
if ($ds [link1] && $ds [url1] != "http://" && $ds [window1])
$related .= '• <a href="' . $ds [url1] . '" target="_blank">' . $ds [link1] . '</a><br> ';
if ($ds [link1] && $ds [url1] != "http://" && ! $ds [window1])
$related .= '• <a href="' . $ds [url1] . '">' . $ds [link1] . '</a><br> ';
if ($ds [link2] && $ds [url2] != "http://" && $ds [window2])
$related .= '• <a href="' . $ds [url2] . '" target="_blank">' . $ds [link2] . '</a><br> ';
if ($ds [link2] && $ds [url2] != "http://" && ! $ds [window2])
$related .= '• <a href="' . $ds [url2] . '">' . $ds [link2] . '</a><br> ';
if ($ds [link3] && $ds [url3] != "http://" && $ds [window3])
$related .= '• <a href="' . $ds [url3] . '" target="_blank">' . $ds [link3] . '</a><br> ';
if ($ds [link3] && $ds [url3] != "http://" && ! $ds [window3])
$related .= '• <a href="' . $ds [url3] . '">' . $ds [link3] . '</a><br> ';
示例8: print_termine
function print_termine($tag, $month, $year)
{
global $wincolor;
global $loosecolor;
global $drawcolor;
global $userID;
global $_language;
$_language->read_module('calendar');
$pagebg = PAGEBG;
$border = BORDER;
$bghead = BGHEAD;
$bgcat = BGCAT;
$start_date = mktime(0, 0, 0, $month, $tag, $year);
$end_date = mktime(23, 59, 59, $month, $tag, $year);
unset($termin);
$ergebnis = safe_query("SELECT * FROM " . PREFIX . "upcoming");
$anz = mysql_num_rows($ergebnis);
if ($anz) {
while ($ds = mysql_fetch_array($ergebnis)) {
if ($ds['type'] == "c") {
if ($ds['date'] >= $start_date && $ds['date'] <= $end_date) {
$date = date("d.m.Y", $ds['date']);
$time = date("H:i", $ds['date']);
$squad = getsquadname($ds['squad']);
$oppcountry = "[flag]" . $ds['oppcountry'] . "[/flag]";
$oppcountry = flags($oppcountry);
$opponent = $oppcountry . ' <a href="' . $ds['opphp'] . '" target="_blank">' . clearfromtags($ds['opptag']) . ' / ' . clearfromtags($ds['opponent']) . '</a>';
$maps = clearfromtags($ds['maps']);
$server = clearfromtags($ds['server']);
$league = '<a href="' . $ds['leaguehp'] . '" target="_blank">' . clearfromtags($ds['league']) . '</a>';
if (isclanmember($userID)) {
$warinfo = cleartext($ds['warinfo']);
} else {
$warinfo = $_language->module['you_have_to_be_clanmember'];
}
$players = "";
$announce = "";
$adminaction = '';
if (isclanmember($userID) or isanyadmin($userID)) {
$anmeldung = safe_query("SELECT * FROM " . PREFIX . "upcoming_announce WHERE upID='" . $ds['upID'] . "'");
if (mysql_num_rows($anmeldung)) {
$i = 1;
while ($da = mysql_fetch_array($anmeldung)) {
if ($da['status'] == "y") {
$fontcolor = $wincolor;
} elseif ($da['status'] == "n") {
$fontcolor = $loosecolor;
} else {
$fontcolor = $drawcolor;
}
if ($i > 1) {
$players .= ', <a href="index.php?site=profile&id=' . $da['userID'] . '"><font color="' . $fontcolor . '">' . getnickname($da['userID']) . '</font></a>';
} else {
$players .= '<a href="index.php?site=profile&id=' . $da['userID'] . '"><font color="' . $fontcolor . '">' . getnickname($da['userID']) . '</font></a>';
}
$i++;
}
} else {
$players = $_language->module['no_announced'];
}
if (issquadmember($userID, $ds['squad']) and $ds['date'] > time()) {
$announce = '• <a href="index.php?site=calendar&action=announce&upID=' . $ds['upID'] . '">' . $_language->module['announce_here'] . '</a>';
} else {
$announce = "";
}
if (isclanwaradmin($userID)) {
$adminaction = '<div align="right">
<input type="button" onclick="MM_openBrWindow(\'clanwars.php?action=new&upID=' . $ds['upID'] . '\',\'Clanwars\',\'toolbar=no,status=no,scrollbars=yes,width=800,height=490\')" value="' . $_language->module['add_clanwars'] . '" />
<input type="button" onclick="MM_goToURL(\'parent\',\'index.php?site=calendar&action=editwar&upID=' . $ds['upID'] . '\');return document.MM_returnValue" value="' . $_language->module['edit'] . '" />
<input type="button" onclick="MM_confirm(\'' . $_language->module['really_delete'] . '\', \'calendar.php?action=delete&upID=' . $ds['upID'] . '\')" value="' . $_language->module['delete'] . '" /></div>';
} else {
$adminaction = '';
}
} else {
$players = $_language->module['access_member'];
}
$bg1 = BG_1;
$bg2 = BG_2;
$bg3 = BG_3;
$bg4 = BG_4;
eval("\$upcoming_war_details = \"" . gettemplate("upcoming_war_details") . "\";");
echo $upcoming_war_details;
}
} else {
if ($start_date <= $ds['date'] && $end_date >= $ds['date'] || $start_date >= $ds['date'] && $end_date <= $ds['enddate'] || $start_date <= $ds['enddate'] && $end_date >= $ds['enddate']) {
$date = date("d.m.Y", $ds['date']);
$time = date("H:i", $ds['date']);
$enddate = date("d.m.Y", $ds['enddate']);
$endtime = date("H:i", $ds['enddate']);
$title = clearfromtags($ds['title']);
$location = '<a href="' . $ds['locationhp'] . '" target="_blank">' . clearfromtags($ds['location']) . '</a>';
$dateinfo = cleartext($ds['dateinfo']);
$dateinfo = toggle($dateinfo, $ds['upID']);
$country = "[flag]" . $ds['country'] . "[/flag]";
$country = flags($country);
$players = "";
if (isclanmember($userID)) {
$anmeldung = safe_query("SELECT * FROM " . PREFIX . "upcoming_announce WHERE upID='" . $ds['upID'] . "'");
if (mysql_num_rows($anmeldung)) {
$i = 1;
//.........这里部分代码省略.........
示例9: facil_images
function facil_images($k, $url, $val)
{
$ret .= btn('txtx', toggle('', 'bkg' . $k . '_dsnav_bkg_' . $k, 'backgrounds')) . ' ';
if (strpos($val, ':url(/') !== false) {
$ret .= lkc("txtred", $url . '&save_img=' . $k . '&erase_img==', 'delete_background');
}
$ret .= btd('bkg' . $k, '');
$mnu_bkg = array('', "no-repeat", "repeat-x", "repeat-y", "repeat");
$mnu_im_align = array('', "left", "right", "center");
$mnu_im_valign = array('', "top", "bottom", "center");
if (strpos($val, "background:url") !== false) {
$t_ims = embed_detect($val, "background:url", ";", '');
}
list($urb, $reap, $fixd, $alg, $vlg) = explode(" ", $t_ims);
if ($fixd) {
$chk = ' checked';
}
if ($urb) {
$urb = substr($urb, 1, -1);
$ret .= lkt('txtx', $urb, 'open') . br();
}
$mnu .= select(atn('repeat'), $mnu_bkg, 'vv', $reap) . ' ';
$mnu .= select(atn('align'), $mnu_im_align, 'vv', $alg) . ' ';
$mnu .= select(atn('valign'), $mnu_im_valign, 'vv', $vlg) . ' ';
$mnu .= checkbox('fixed', 'fixed', 'fixed', $chk);
//$upl=upload_btn('upl',$url.'&save_img='.$k,'upload').br();
return $ret . imgform($url . '&save_img=' . $k, $mnu, '');
}
示例10: getcategoryname
}
$moderators = '';
$cat = $db['category'];
$kathname = getcategoryname($cat);
eval("\$forum_head = \"" . gettemplate("forum_head") . "\";");
echo $forum_head;
$bg1 = BG_1;
$message = '';
if ($loggedin) {
if (isset($_POST['preview'])) {
$bg1 = BG_1;
$bg2 = BG_2;
$time = date("H:i", time());
$date = "today";
$message = cleartext(stripslashes(str_replace(array('\\r\\n', '\\n'), array("\n", "\n"), $_POST['message'])));
$message = toggle($message, 'xx');
$username = '<a href="index.php?site=profile&id=' . $userID . '"><b>' . getnickname($userID) . '</b></a>';
$board = (int) $_POST['board'];
$topicname = stripslashes($_POST['topicname']);
if (!isset($postID)) {
$postID = '';
}
if (isclanmember($userID)) {
$member = ' <img src="images/icons/member.gif" alt="' . $_language->module['clanmember'] . '" />';
} else {
$member = '';
}
if (getavatar($userID)) {
$avatar = '<img src="images/avatars/' . getavatar($userID) . '" alt="" />';
} else {
$avatar = '';
示例11: _open
<?php
echo _open('div.dm_box.big.seo_validation');
echo _tag('h1.title', __('Seo improvements'));
echo _open('div.dm_box_inner');
foreach ($duplicated as $meta => $values) {
echo _tag('h2', ucfirst(__('Duplicated %1%', array('%1%' => dmString::pluralize($meta)))));
echo _open('div.dm_table_wrap') . _open('table.dm_table');
echo _tag('thead', _tag('tr', _tag('th', $meta) . _tag('th', __('Pages'))));
toggle_init();
foreach ($values as $value => $pages) {
echo _open('tr' . toggle('.even'));
echo _tag('td', $value);
echo _open('td');
echo _open('ul');
foreach ($pages as $page) {
echo _tag('li', _tag('a.s16.s16_next.dm_toggler', $page->get('name')) . _tag('div.actions.none.dm_toggled', get_partial('pageActions', array('page' => $page, 'meta' => $meta))));
}
echo _close('ul');
echo _close('td');
echo _close('tr');
}
echo _close('table') . _close('div');
}
echo _close('div');
echo _close('div');
示例12: safe_query
safe_query("UPDATE " . PREFIX . "articles SET viewed=viewed+1 WHERE articlesID='" . $articlesID . "'");
}
$result = safe_query("SELECT * FROM " . PREFIX . "articles WHERE articlesID='" . $articlesID . "'");
if (mysql_num_rows($result)) {
$ds = mysql_fetch_array($result);
$date = date("d.m.Y", $ds['date']);
$time = date("H:i", $ds['date']);
$title = clearfromtags($ds['title']);
$content = array();
$query = safe_query("SELECT * FROM " . PREFIX . "articles_contents WHERE articlesID = '" . $articlesID . "' ORDER BY page ASC");
while ($qs = mysql_fetch_array($query)) {
$content[] = $qs['content'];
}
$pages = count($content);
$content = htmloutput($content[$page - 1]);
$content = toggle($content, $ds['articlesID']);
if ($pages > 1) {
$page_link = makepagelink("index.php?site=articles&action=show&articlesID={$articlesID}", $page, $pages);
} else {
$page_link = '';
}
$poster = '<a href="index.php?site=profile&id=' . $ds['poster'] . '"><b>' . getnickname($ds['poster']) . '</b></a>';
$related = "";
if ($ds['link1'] && $ds['url1'] != "http://" && $ds['window1']) {
$related .= '• <a href="' . $ds['url1'] . '" target="_blank">' . $ds['link1'] . '</a> ';
}
if ($ds['link1'] && $ds['url1'] != "http://" && !$ds['window1']) {
$related .= '• <a href="' . $ds['url1'] . '">' . $ds['link1'] . '</a> ';
}
if ($ds['link2'] && $ds['url2'] != "http://" && $ds['window2']) {
$related .= '• <a href="' . $ds['url2'] . '" target="_blank">' . $ds['link2'] . '</a> ';
示例13: htmloutput
$content = $message_array[$showlang]['message'];
$newsID = $ds['newsID'];
if ($ds['intern'] == 1) {
$isintern = '(' . $_language->module['intern'] . ')';
} else {
$isintern = '';
}
if ($ds['live'] == 1) {
$islive = '(' . $_language->module['live'] . ')';
} else {
$islive = '';
}
$content = htmloutput($content);
$content = toggle($content, $ds['newsID']);
$intro = htmloutput($intro);
$intro = toggle($intro, $ds['newsID']);
$headline = clearfromtags($headline);
$poster = '<a href="user/' . $ds['poster'] . '/">' . getnickname($ds['poster']) . '</a>';
$related = "";
if ($ds['link1'] && $ds['url1'] != "http://" && $ds['window1']) {
$related .= '• <a href="' . $ds['url1'] . '" target="_blank">' . $ds['link1'] . '</a> ';
}
if ($ds['link1'] && $ds['url1'] != "http://" && !$ds['window1']) {
$related .= '• <a href="' . $ds['url1'] . '">' . $ds['link1'] . '</a> ';
}
if ($ds['link2'] && $ds['url2'] != "http://" && $ds['window2']) {
$related .= '• <a href="' . $ds['url2'] . '" target="_blank">' . $ds['link2'] . '</a> ';
}
if ($ds['link2'] && $ds['url2'] != "http://" && !$ds['window2']) {
$related .= '• <a href="' . $ds['url2'] . '">' . $ds['link2'] . '</a> ';
}
示例14: while
} else {
$color = "";
}
$output_crew_fund .= "<tr><td class=\"" . $row_style_crew_fund . "\">" . $row['item_description'] . "</td>\n" . "<td class=\"" . $row_style_crew_fund . "\">" . $artwork . "</td>\n" . "<td class=\"" . $row_style_crew_fund . "\">" . $color . "</td>\n" . "<td class=\"" . $row_style_crew_fund . "\">" . $row['item_type'] . "</td>\n" . "<td class=\"" . $row_style_crew_fund . "\">" . $row['item_size'] . "</td>\n" . "<td class=\"" . $row_style_crew_fund . "\">" . $row['qty'] . "</td></tr>\n";
$last_item_name_crew_fund = $row['item_name'];
}
while ($row = $result_purchase_card->fetch_assoc()) {
//This item is paid for with a PURCHASE CARD
$rows_purchase_card++;
if (strripos($row['item_name'], 'screen-printed') === false && strripos($row['item_name'], 'screen printed') === false) {
$artwork = "Embroidered";
} else {
$artwork = "Screen-print";
}
if ($row['item_name'] != $last_item_name_purchase_card) {
$row_style_purchase_card = toggle($row_style_purchase_card);
}
if (strpos(strtolower($row['item_name']), "orange") !== false) {
$color = "Orange";
} elseif (strpos(strtolower($row['item_name']), "black") !== false) {
$color = "Black";
} else {
$color = "";
}
$output_purchase_card .= "<tr><td class=\"" . $row_style_purchase_card . "\">" . $row['item_description'] . "</td>\n" . "<td class=\"" . $row_style_purchase_card . "\">" . $artwork . "</td>\n" . "<td class=\"" . $row_style_purchase_card . "\">" . $color . "</td>\n" . "<td class=\"" . $row_style_purchase_card . "\">" . $row['item_type'] . "</td>\n" . "<td class=\"" . $row_style_purchase_card . "\">" . $row['item_size'] . "</td>\n" . "<td class=\"" . $row_style_purchase_card . "\">" . $row['qty'] . "</td></tr>\n";
$last_item_name_purchase_card = $row['item_name'];
}
$output_crew_fund .= "</table>\n";
$output_purchase_card .= "</table>\n";
print $output_crew_fund . "<br />\n" . $output_purchase_card . "<br />\n";
break;
示例15: extract
<?php
extract($_REQUEST);
echo $title_download;
$ergebnis=safe_query("SELECT * FROM ".PREFIX."download");
if(mysql_num_rows($ergebnis)) {
$ds=mysql_fetch_array($ergebnis);
$download=htmloutput($ds[download]);
$download=toggle($download, 1);
$bg1=BG_1;
eval ("\$download = \"".gettemplate("download")."\";");
echo $download;
}
else echo'No Downloads available!';
?>