本文整理汇总了PHP中alter函数的典型用法代码示例。如果您正苦于以下问题:PHP alter函数的具体用法?PHP alter怎么用?PHP alter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了alter函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayEchLog
function displayEchLog($array, $style = 'client')
{
global $tformat;
// import the time format varible for use in this function
foreach ($array as $ech_log) {
## get vars
$id = $ech_log['id'];
$type = $ech_log['type'];
$msg = tableClean($ech_log['msg']);
$time_add = $ech_log['time_add'];
$time_add_read = date($tformat, $time_add);
$game_id = $ech_log['game_id'];
## Page row color alternate
$alter = alter();
if ($style == 'admin') {
$cid = $ech_log['client_id'];
$client_link = clientLink($cid, $cid, $game_id);
$table = <<<EOD
\t\t\t<tr class="{$alter}">
\t\t\t\t<td>{$id}</td>
\t\t\t\t<td>{$type}</td>
\t\t\t\t<td>{$msg}</td>
\t\t\t\t<td><em>{$time_add_read}</em></td>
\t\t\t\t<td>{$client_link}</td>
\t\t\t</tr>
EOD;
} else {
// if client
$user_name = tableClean($ech_log['user_name']);
$user_link = echUserLink($ech_log['user_id'], $user_name);
$table = <<<EOD
\t\t\t<tr class="{$alter}">
\t\t\t\t<td>{$id}</td>
\t\t\t\t<td>{$type}</td>
\t\t\t\t<td>{$msg}</td>
\t\t\t\t<td><em>{$time_add_read}</em></td>
\t\t\t\t<td>{$user_link}</td>
\t\t\t</tr>
EOD;
}
echo $table;
// echo out the formated data
}
}
示例2: setUp
/**
* {@inheritdoc}
*/
public function setUp()
{
parent::setUp();
$container = new ContainerBuilder();
// Register plugin managers used by Rules, but mock some unwanted
// dependencies requiring more stuff to loaded.
$this->moduleHandler = $this->prophesize(ModuleHandlerInterface::class);
// Set all the modules as being existent.
$this->enabledModules = new \ArrayObject();
$this->enabledModules['rules'] = TRUE;
$this->enabledModules['rules_test'] = TRUE;
$enabledModules = $this->enabledModules;
$this->moduleHandler->moduleExists(Argument::type('string'))->will(function ($arguments) use($enabledModules) {
return [$arguments[0], $enabledModules[$arguments[0]]];
});
// Wed don't care about alter() calls on the module handler.
$this->moduleHandler->alter(Argument::any(), Argument::any(), Argument::any(), Argument::any())->willReturn(NULL);
$this->cacheBackend = new NullBackend('rules');
$rules_directory = __DIR__ . '/../../..';
$this->namespaces = new \ArrayObject(['Drupal\\rules' => $rules_directory . '/src', 'Drupal\\rules_test' => $rules_directory . '/tests/modules/rules_test/src', 'Drupal\\Core\\TypedData' => $this->root . '/core/lib/Drupal/Core/TypedData', 'Drupal\\Core\\Validation' => $this->root . '/core/lib/Drupal/Core/Validation']);
$this->actionManager = new RulesActionManager($this->namespaces, $this->cacheBackend, $this->moduleHandler->reveal());
$this->conditionManager = new ConditionManager($this->namespaces, $this->cacheBackend, $this->moduleHandler->reveal());
$this->rulesExpressionManager = new ExpressionManager($this->namespaces, $this->moduleHandler->reveal());
$this->classResolver = $this->prophesize(ClassResolverInterface::class);
$this->typedDataManager = new TypedDataManager($this->namespaces, $this->cacheBackend, $this->moduleHandler->reveal(), $this->classResolver->reveal());
$this->rulesDataProcessorManager = new DataProcessorManager($this->namespaces, $this->moduleHandler->reveal());
$this->aliasManager = $this->prophesize(AliasManagerInterface::class);
$this->entityManager = $this->prophesize(EntityManagerInterface::class);
$this->entityManager->getDefinitions()->willReturn([]);
$container->set('entity.manager', $this->entityManager->reveal());
$container->set('path.alias_manager', $this->aliasManager->reveal());
$container->set('plugin.manager.rules_action', $this->actionManager);
$container->set('plugin.manager.condition', $this->conditionManager);
$container->set('plugin.manager.rules_expression', $this->rulesExpressionManager);
$container->set('plugin.manager.rules_data_processor', $this->rulesDataProcessorManager);
$container->set('typed_data_manager', $this->typedDataManager);
$container->set('string_translation', $this->getStringTranslationStub());
\Drupal::setContainer($container);
$this->container = $container;
}
示例3: foreach
<tbody>
<?php
$bl_data = $dbl->getBL();
$num_rows = $bl_data['num_rows'];
if ($num_rows > 0) {
foreach ($bl_data['data'] as $bl) {
// get data from query and loop
$id = $bl['id'];
$ip = $bl['ip'];
$active = $bl['active'];
$reason = $bl['reason'];
$time_add = $bl['time_add'];
$admin = $bl['admin'];
$time_add = date($tformat, $time_add);
$ip = ipLink($ip);
$alter = alter();
$token = genFormToken('act' . $id);
if ($active == 1) {
$active = 'Yes';
$actions = '<form action="actions/blacklist.php" method="post">
<input type="hidden" name="id" value="' . $id . '" />
<input type="hidden" name="token" value="' . $token . '" />
<input type="submit" name="deact" value="De-active" class="action del" title="De-active this ban" />
</form>';
} else {
$active = 'No';
$alter .= " inact";
$actions = '<form action="actions/blacklist.php" method="post">
<input type="hidden" name="id" value="' . $id . '" />
<input type="hidden" name="token" value="' . $token . '" />
<input type="submit" name="react" value="Re-active" class="action plus" title="Re-active this ban" />
示例4: json_decode
// $params["amt"] = 10;
$result = "";
$string = "";
$i = 0;
$mitglieder_gesamt = 0;
$mitglieder_leben = 0;
$mitglieder = json_decode(send_request('mitglieder.php/', 'get', $params));
$result["iTotalRecords"] = $mitglieder->count_all;
$result["iTotalDisplayRecords"] = $mitglieder->count_query;
$string .= $mitglieder->query;
if ($mitglieder->mitglieder) {
foreach ($mitglieder->mitglieder as $value) {
$id = $value->id;
$mitglied = json_decode(send_request('/mitglieder.php/' . $id, 'get'));
$geb = preg_split("/-/", $mitglied->Alter);
$alter = alter($geb[2], $geb[1], $geb[0]);
$result["aaData"][$i]["ID"] = $mitglied->ID;
$result["aaData"][$i]["Nachname"] = $mitglied->Nachname;
$result["aaData"][$i]["Vorname"] = $mitglied->Vorname;
$result["aaData"][$i]["Strasse"] = $mitglied->Strasse;
$result["aaData"][$i]["Hausnummer"] = $mitglied->Hausnummer;
$result["aaData"][$i]["PLZ"] = $mitglied->PLZ;
$result["aaData"][$i]["Ort"] = $mitglied->Ort;
$result["aaData"][$i]["Ortsteil"] = $mitglied->Ortsteil;
$result["aaData"][$i]["Geburtsdatum"] = format_date($mitglied->Geburtsdatum);
$result["aaData"][$i]["Alter"] = $mitglied->Alter;
$result["aaData"][$i]["Status"] = $mitglied->Status;
$mitglieder_gesamt++;
$i++;
}
}
示例5: buildLines
private function buildLines($data_set, $ani = false)
{
global $tformat;
// get the standardised time format
if ($ani == 'tb') {
$ani = 'tb-row';
} elseif ($ani == 'yes') {
$ani = 'animate';
} else {
$ani = '';
}
if (count($data_set) > 0) {
foreach ($data_set as $data) {
$id = $data['id'];
$msg_type = $data['msg_type'];
$msg = cleanvar(removeColorCode($data['msg']));
$client_link = clientLink($data['client_name'], $data['client_id']);
$time_read = date($tformat, $data['msg_time']);
## Highlight Commands ##
if (substr($msg, 0, 1) == '!' or substr($msg, 0, 1) == '@') {
$msg = '<span class="chat-cmd">' . $msg . "</span>";
}
$alter = alter();
// setup heredoc (table data)
$data = <<<EOD
\t\t\t<tr class="{$alter} {$ani}" id="{$id}">
\t\t\t\t<td>{$id}</td>
\t\t\t\t<td><strong>{$client_link}</strong></td>
\t\t\t\t<td>{$msg_type}</td>
\t\t\t\t<td>{$msg}</td>
\t\t\t\t<td><em>{$time_read}</em></td>
\t\t\t</tr>
EOD;
$content .= $data;
}
}
return $content;
}
示例6: ON
$_GET['order'] = '';
}
}
$db->query('SELECT geburtstag, xfire, sex, icq, registerdate, clanname, homepage, lastlogin, wohnort, user_pic, `ID`, username, country, uID as online, rankname, iconname FROM ' . DB_PRE . 'ecp_user LEFT JOIN ' . DB_PRE . 'ecp_ranks ON (rID = rankID) LEFT JOIN ' . DB_PRE . 'ecp_online ON (uID = ID AND lastklick > ' . (time() - SHOW_USER_ONLINE) . ') GROUP BY ID ORDER BY ' . strsave($_GET['orderby']) . ' ' . strsave($_GET['order']) . ' LIMIT ' . $limits[1] . ',' . LIMIT_MEMBERS);
$user = array();
while ($row = $db->fetch_assoc()) {
$row['lastlogin'] ? $row['lastlogin'] = date(LONG_DATE, $row['lastlogin']) : ($row['lastlogin'] = NEVER_LOGGED_IN);
$row['registerdate2'] = date('d.m.Y', $row['registerdate']);
$row['registerdate'] = date(LONG_DATE, $row['registerdate']);
if ($row['geburtstag'] == '0000-00-00') {
$row['geburtstag'] = '';
}
if ($row['geburtstag']) {
$birthday = explode('-', $row['geburtstag']);
$row['geburtstag'] = $birthday[2] . '.' . $birthday[1] . '.' . $birthday[0];
$alter = alter($birthday[2], $birthday[1], $birthday[0]);
if (date('m') == $birthday[1] and date('d') < $birthday[2]) {
$alter -= 1;
}
$next = @mktime(0, 0, 0, $birthday[1], $birthday[2], $birthday[0] + $alter + 1) - time();
$row['alter'] = $alter;
}
$row['countryname'] = $countries[$row['country']];
$row['icqtrim'] = str_replace('-', '', $row['icq']);
$user[] = $row;
}
$tpl->assign('anzahl', $anzahl);
if ($limits[0] > 1) {
$tpl->assign('seiten', makepagelink_ajax('?section=user&action=list&orderby=' . $_GET['orderby'] . '&order=' . $_GET['order'], 'return load_user(\'orderby=' . $_GET['orderby'] . '&order=' . $_GET['order'] . '&page={nr}\');', @$_GET['page'], $limits[0]));
}
$tpl->assign('user', $user);
示例7: start_db
<?php
require_once "system-db.php";
start_db();
function alter($sql)
{
$result = mysql_query($sql);
if (!$result) {
logError($sql . " - " . mysql_error());
}
echo "<div>{$sql}</div>";
}
$sql = "SELECT C.id,\n\t\t\t(\n\t\t\t\tselect B.agegroupid \n\t\t\t\tFROM fa_matchplayerdetails A \n\t\t\t\tINNER JOIN fa_player B \n\t\t\t\tON B.id = A.playerid\n\t\t\t\tWHERE A.matchid = C.id\n\t\t\t\tLIMIT 1\n\t\t\t) AS teamid\n\t\t\t FROM fa_matchdetails C";
$result = mysql_query($sql);
if ($result) {
while ($member = mysql_fetch_assoc($result)) {
$teamid = $member['teamid'];
$id = $member['id'];
if ($teamid != null) {
alter("UPDATE fa_matchdetails SET teamid = {$teamid} WHERE id = {$id}");
}
}
}
mysql_query("COMMIT");
示例8: user_liste
function user_liste()
{
global $db, $countries;
$tpl = new smarty();
$anzahl = $db->result(DB_PRE . 'ecp_user', 'COUNT(ID)', '1');
$limits = get_sql_limit($anzahl, LIMIT_MEMBERS);
$erlaubt = array('username', 'registerdate', 'lastlogin', 'geburtstag', 'online', 'sex', 'rangname');
if (isset($_GET['orderby'])) {
if (!in_array($_GET['orderby'], $erlaubt)) {
$_GET['orderby'] = 'username';
}
$_GET['order'] == 'DESC' ? '' : ($_GET['order'] = 'ASC');
if ($_GET['orderby'] == 'geburtstag') {
$_GET['order'] == 'DESC' ? $_GET['order'] = 'ASC' : ($_GET['order'] = 'DESC');
}
if ($_GET['orderby'] == 'rangname') {
$_GET['order'] == 'ASC' ? $_GET['orderby'] = 'fest ASC, abposts ASC' : ($_GET['orderby'] = 'fest DESC, abposts DESC');
$_GET['order'] = '';
}
} else {
$_GET['orderby'] = 'username';
$_GET['order'] = 'ASC';
}
$db->query('SELECT geburtstag, xfire, icq, sex, registerdate, clanname, homepage, lastlogin, wohnort, user_pic, `ID`, username, country, uID as online, rankname, iconname FROM ' . DB_PRE . 'ecp_user LEFT JOIN ' . DB_PRE . 'ecp_ranks ON (rID = rankID) LEFT JOIN ' . DB_PRE . 'ecp_online ON (uID = ID AND lastklick > ' . (time() - SHOW_USER_ONLINE) . ') GROUP BY ID ORDER BY ' . strsave($_GET['orderby']) . ' ' . strsave($_GET['order']) . ' LIMIT ' . $limits[1] . ',' . LIMIT_MEMBERS);
$user = array();
while ($row = $db->fetch_assoc()) {
$row['lastlogin'] ? $row['lastlogin'] = date(LONG_DATE, $row['lastlogin']) : ($row['lastlogin'] = NEVER_LOGGED_IN);
$row['registerdate2'] = date('d.m.Y', $row['registerdate']);
$row['registerdate'] = date(LONG_DATE, $row['registerdate']);
if ($row['geburtstag'] == '0000-00-00') {
$row['geburtstag'] = '';
}
if ($row['geburtstag']) {
$birthday = explode('-', $row['geburtstag']);
$row['geburtstag'] = $birthday[2] . '.' . $birthday[1] . '.' . $birthday[0];
$alter = alter($birthday[2], $birthday[1], $birthday[0]);
if (date('m') == $birthday[1] and date('d') < $birthday[2]) {
$alter -= 1;
}
$next = @mktime(0, 0, 0, $birthday[1], $birthday[2], $birthday[0] + $alter + 1) - time();
$row['alter'] = $alter;
}
$row['countryname'] = $countries[$row['country']];
$row['icqtrim'] = str_replace('-', '', $row['icq']);
$user[] = $row;
}
$tpl->assign('anzahl', $anzahl);
if ($limits[0] > 1) {
$tpl->assign('seiten', makepagelink_ajax('?section=user&action=list&orderby=' . $_GET['orderby'] . '&order=' . $_GET['order'], 'return load_user(\'orderby=' . $_GET['orderby'] . '&order=' . $_GET['order'] . '&page={nr}\');', @$_GET['page'], $limits[0]));
}
$tpl->assign('user', $user);
ob_start();
$tpl->display(DESIGN . '/tpl/user/user_list.html');
$content = ob_get_contents();
ob_end_clean();
main_content(USER_LIST, $content, '', 1);
}
示例9: setUp
/**
* {@inheritdoc}
*/
public function setUp()
{
parent::setUp();
$container = new ContainerBuilder();
// Register plugin managers used by Rules, but mock some unwanted
// dependencies requiring more stuff to loaded.
$this->moduleHandler = $this->prophesize(ModuleHandlerInterface::class);
// Set all the modules as being existent.
$this->enabledModules = new \ArrayObject();
$this->enabledModules['rules'] = TRUE;
$this->enabledModules['rules_test'] = TRUE;
$enabled_modules = $this->enabledModules;
$this->moduleHandler->moduleExists(Argument::type('string'))->will(function ($arguments) use($enabled_modules) {
return [$arguments[0], $enabled_modules[$arguments[0]]];
});
// Wed don't care about alter() calls on the module handler.
$this->moduleHandler->alter(Argument::any(), Argument::any(), Argument::any(), Argument::any())->willReturn(NULL);
$this->cacheBackend = new NullBackend('rules');
$rules_directory = __DIR__ . '/../../..';
$this->namespaces = new \ArrayObject(['Drupal\\rules' => $rules_directory . '/src', 'Drupal\\rules_test' => $rules_directory . '/tests/modules/rules_test/src', 'Drupal\\Core\\TypedData' => $this->root . '/core/lib/Drupal/Core/TypedData', 'Drupal\\Core\\Validation' => $this->root . '/core/lib/Drupal/Core/Validation']);
$this->actionManager = new RulesActionManager($this->namespaces, $this->cacheBackend, $this->moduleHandler->reveal());
$this->conditionManager = new ConditionManager($this->namespaces, $this->cacheBackend, $this->moduleHandler->reveal());
$uuid_service = new Php();
$this->rulesExpressionManager = new ExpressionManager($this->namespaces, $this->moduleHandler->reveal(), $uuid_service);
$this->classResolver = $this->prophesize(ClassResolverInterface::class);
$this->typedDataManager = new TypedDataManager($this->namespaces, $this->cacheBackend, $this->moduleHandler->reveal(), $this->classResolver->reveal());
$this->rulesDataProcessorManager = new DataProcessorManager($this->namespaces, $this->moduleHandler->reveal());
$this->aliasManager = $this->prophesize(AliasManagerInterface::class);
// Keep the deprecated entity manager around because it is still used in a
// few places.
$this->entityManager = $this->prophesize(EntityManagerInterface::class);
$this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class);
$this->entityTypeManager->getDefinitions()->willReturn([]);
// Setup a rules_component storage mock which returns nothing by default.
$storage = $this->prophesize(ConfigEntityStorageInterface::class);
$storage->loadMultiple(NULL)->willReturn([]);
$this->entityTypeManager->getStorage('rules_component')->willReturn($storage->reveal());
$this->entityFieldManager = $this->prophesize(EntityFieldManagerInterface::class);
$this->entityFieldManager->getBaseFieldDefinitions()->willReturn([]);
$this->entityTypeBundleInfo = $this->prophesize(EntityTypeBundleInfoInterface::class);
$this->entityTypeBundleInfo->getBundleInfo()->willReturn([]);
$this->dataFetcher = new DataFetcher();
$this->dataFilterManager = new DataFilterManager($this->namespaces, $this->moduleHandler->reveal());
$this->placeholderResolver = new PlaceholderResolver($this->dataFetcher, $this->dataFilterManager);
$container->set('entity.manager', $this->entityManager->reveal());
$container->set('entity_type.manager', $this->entityTypeManager->reveal());
$container->set('entity_field.manager', $this->entityFieldManager->reveal());
$container->set('entity_type.bundle.info', $this->entityTypeBundleInfo->reveal());
$container->set('context.repository', new LazyContextRepository($container, []));
$container->set('path.alias_manager', $this->aliasManager->reveal());
$container->set('plugin.manager.rules_action', $this->actionManager);
$container->set('plugin.manager.condition', $this->conditionManager);
$container->set('plugin.manager.rules_expression', $this->rulesExpressionManager);
$container->set('plugin.manager.rules_data_processor', $this->rulesDataProcessorManager);
$container->set('typed_data_manager', $this->typedDataManager);
$container->set('string_translation', $this->getStringTranslationStub());
$container->set('uuid', $uuid_service);
$container->set('typed_data.data_fetcher', $this->dataFetcher);
$container->set('typed_data.placeholder_resolver', $this->placeholderResolver);
\Drupal::setContainer($container);
$this->container = $container;
}
示例10: function
<html>
<head>
<title>Hello</title>
</head>
<body>
<?php
$d = function () {
echo 'test<br/>';
};
$d2 = function () {
echo 'test2<br/>';
};
$d();
$d2();
$mul = 10;
$q = function ($p) use(&$mul) {
echo 'Multiply by 10: ' . $p * $mul . '<br/>';
};
$q(7);
echo '<br/><br/><br/>';
function alter(&$param)
{
$param = 100;
}
$val = 8;
alter($val);
echo 'Val::: ' . $val . '<br/>';
?>
</body>
</html>
示例11: date
</td></tr>
<tr><th>Zuletzt gesehen:</th><td><?php
echo date("d.m.Y H:i:s", $info["last_action"]);
?>
Uhr</td></tr>
<tr><th>Website:</th><td><a class="url" href="<?php
echo html($info["website"]);
?>
" target="_blank" rel="nofollow"><?php
echo html($info["website"]);
?>
</a></td></tr>
<tr><th>Wohnort:</th><td class="adr"><span class="locality location"><?php
echo html($info["location"]);
?>
</span>
<?php
if ($info["country"] != "" and $info["show_country"] == "1") {
echo '<img class="flag" src="' . get_path("/skins/default/images/flags/16x11/" . strtolower($info["country"]) . ".png") . '"/>';
}
?>
<span class="country-name hidden">Deutschland</span></td></tr>
<tr><th>Skype:</th><td class="skype status status0"><?php
echo isset($info["SkypeID"]) && $info["SkypeID"] . "" != "" ? '<a href="skype:' . html($info["SkypeID"]) . '?call"><img src="http://mystatus.skype.com/smallclassic/' . html($info["SkypeID"]) . '" style="border: none;" width="114" height="20" alt="Mein Status" /></a>' : '';
?>
</td></tr>
<tr><th>Google+:</th><td><?php
if (isset($info["GooglePlus"]) && $info["GooglePlus"] . "" != "") {
echo '<div class="g-plus" data-height="69" data-href="' . html($info["GooglePlus"]) . '" data-rel="author"></div><a href="' . html($info["GooglePlus"]) . '?rel=author"></a>';
}
?>