本文整理汇总了PHP中text::alternate方法的典型用法代码示例。如果您正苦于以下问题:PHP text::alternate方法的具体用法?PHP text::alternate怎么用?PHP text::alternate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类text
的用法示例。
在下文中一共展示了text::alternate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cache
/**
* Cache data.
*
* @return void
*/
public static function cache()
{
if (!Profiler::show('cache')) {
return;
}
$queries = Cache::$queries;
$table = new Profiler_Table();
$table->add_column();
$table->add_column('kp-column kp-data');
$table->add_column('kp-column kp-data');
$table->add_column('kp-column kp-data');
$table->add_row(array('Cache', 'Gets', 'Sets', 'Deletes'), 'kp-title', 'background-color: #E0FFE0');
text::alternate();
$total_gets = $total_sets = $total_deletes = 0;
$total_requests = array();
foreach ($queries as $type => $requests) {
foreach ($requests as $query) {
if (!isset($total_requests[$query])) {
$total_requests[$query] = array('gets' => 0, 'sets' => 0, 'deletes' => 0);
}
$total_requests[$query][$type]++;
}
}
foreach ($total_requests as $query => $types) {
$data = array($query, $types['gets'], $types['sets'], $types['deletes']);
$class = text::alternate('', 'kp-altrow');
$table->add_row($data, $class);
$total_gets += $types['gets'];
$total_sets += $types['sets'];
$total_deletes += $types['deletes'];
}
$data = array('Total: ' . count($total_requests), $total_gets, $total_sets, $total_deletes);
$table->add_row($data, 'kp-totalrow');
Profiler::add($table);
}
示例2: alternate
/**
* Tests the text::alternate() function.
* @dataProvider alternate_provider
* @group core.helpers.text.alternate
* @test
*/
public function alternate()
{
$args = func_get_args();
$expected_result = array_pop($args);
$alternate_num = array_pop($args);
$result = '';
for ($i = 0; $i < $alternate_num; $i++) {
$result .= call_user_func_array('text::alternate', $args);
}
$this->assertEquals($expected_result, $result);
//We have to reset alternate manually!!!
text::alternate();
}
示例3: doctrine
public function doctrine()
{
if (!($table = $this->table('doctrine'))) {
return;
}
$table->add_column();
$table->add_column('kp-column kp-data');
$table->add_column('kp-column kp-data');
$table->add_row(array('Doctrine Details', 'Type', 'Time'), 'kp-title', 'background-color: #E0FFE0');
text::alternate();
$c = 0;
$time = 0;
foreach ($this->profiler as $event) {
$time += $event->getElapsedSecs();
$data = array($event->getQuery(), $event->getName(), number_format($event->getElapsedSecs(), 3));
$class = text::alternate('', 'kp-altrow');
$table->add_row($data, $class);
$c++;
}
$data = array('', 'Total: ' . $c, number_format($time, 3));
$table->add_row($data, 'kp-totalrow');
}
示例4: doctrine_render_queries
function doctrine_render_queries()
{
global $doctrine_profiler;
// Surely a neater way to do this!
$obj = Event::$data;
$table = $obj->table('doctrine');
$table->add_column();
$table->add_column('kp-column kp-data');
$table->add_column('kp-column kp-data');
$table->add_row(array('Doctrine Queries', 'Action', 'Time'), 'kp-title', 'background-color: #E0FFE0');
$time = 0;
foreach ($doctrine_profiler as $event) {
$time += $event->getElapsedSecs();
if (in_array($event->getName(), array('query', 'execute'))) {
$data = array($event->getQuery() . ' - (' . implode(', ', $event->getParams()) . ')', $event->getName(), sprintf("%f", $event->getElapsedSecs()));
$class = text::alternate('', 'kp-altrow');
$table->add_row($data, $class);
}
}
$data = array('Total: ', number_format($time, 8));
$table->add_row($data, 'kp-totalrow');
}
示例5: sprintf
echo sprintf('%.2f', $total * 1000);
?>
ms</td>
<td align="right"><?php
echo byte_format($benchmark['memory']);
?>
</td>
</tr>
<?php
}
?>
<?php
} else {
?>
<tr class="<?php
echo text::alternate('odd', 'even');
?>
">
<td colspan="4">no benchmarks to display</td>
</tr>
<?php
}
?>
</table>
</div>
<?php
}
?>
<!-- database -->
<?php
示例6: foreach
if (Kohana::$config->load('debug_toolbar.panels.routes')) {
$r_counter = 0;
?>
<div id="debug-routes" class="top" style="display: none;">
<h1>Routes</h1>
<table cellspacing="0" cellpadding="0">
<tr align="left">
<th>#</th>
<th>name</th>
</tr>
<?php
foreach ($routes as $name => $route) {
$class = $route == Request::initial()->route() ? ' current' : '';
?>
<tr class="<?php
echo text::alternate('odd', 'even') . $class;
?>
">
<td><?php
echo ++$r_counter;
?>
</td>
<td><?php
echo $name;
?>
</td>
</tr>
<?php
}
?>
</table>
示例7: foreach
echo Kohana::lang('unit_test.no_tests_found');
?>
</td>
</tr>
<?php
} else {
foreach ($methods as $method => $result) {
// Hide passed tests from report
if ($result === TRUE and $hide_passed === TRUE) {
continue;
}
?>
<tr class="<?php
echo text::alternate('', 'k-altrow');
?>
">
<td class="k-name"><?php
echo $method;
?>
</td>
<?php
if ($result === TRUE) {
?>
<td class="k-passed"><strong><?php
echo Kohana::lang('unit_test.passed');
?>
</strong></td>
示例8: t
echo t("Email");
?>
</th>
<th><?php
echo t("Last login");
?>
</th>
<th>Actions</th>
</tr>
<? foreach ($users as $i => $user): ?>
<tr id="gUser-<?php
echo $user->id;
?>
" class="<?php
echo text::alternate("gOddRow", "gEvenRow");
?>
user <?php
echo $user->admin ? "admin" : "";
?>
">
<td id="user-<?php
echo $user->id;
?>
" class="core-info gDraggable">
<img src="<?php
echo $user->avatar_url(20, $theme->url("images/avatar.jpg", true));
?>
"
title="<?php
echo t("Drag user onto group below to add as a new member");
示例9: foreach
<th></th>
<?php
echo $table_filter;
?>
<th><input type="submit" value="Filter" name="btnFilter" />
<br/>
<input type="submit" value="Clear Filter" name="btnClearFilter" />
</th>
</tr>
</thead>
<tbody id="first">
<?php
foreach ($result as $cell) {
$id = $cell[$fields['0']];
echo "<tr" . text::alternate('', ' class="odd"') . ">";
echo "<td><input type='checkbox' value={$id} name='chk[{$id}]' /></td>";
for ($i = 0; $i < count($fields); $i++) {
$value = $fields[$i];
//if no alignment is specified, align the contents of the <td> in the center
$alignment = array_key_exists($value, $align) ? $align[$value] : 'center';
echo "<td align='" . $alignment . "'>{$cell[$value]}</td>";
}
/*
if($category){
echo '<td>';
$cat = getProductCategories($cell->$fields['0']);
echo $cat;
echo '</td>';
}
*/
示例10: foreach
<ul>
<?php
foreach ($passes as $pass) {
$class_row = text::alternate('row_odd', 'row_even');
echo '<li class="' . $class_row . '">';
echo html::chars($pass->name);
echo '</li>';
}
?>
</ul>
示例11: foreach
<?php
foreach ($packages as $name => $package) {
?>
<div class="module <?php
echo text::alternate('', 'alternate');
?>
">
<?php
echo $package['displayName'];
?>
<div class="fields module_permissions">
<?php
$fieldName = $name . '[module_permissions]';
?>
<?php
echo form::radio(array('name' => $fieldName, 'id' => $fieldName . 'custom', 'class' => 'custom_radio'), 'custom');
?>
<?php
echo form::label($fieldName . 'custom', 'Custom');
?>
<?php
echo form::radio(array('name' => $fieldName, 'id' => $fieldName . 'disabled', 'class' => 'std_permissions'), 'disabled');
?>
<?php
echo form::label($fieldName . 'disabled', 'Disabled');
?>
示例12: foreach
} else {
?>
<ul class="envroResults" style="padding: 5px 10px;">
<?php
foreach ($results as $result) {
?>
<?php
$fail = $result['required'] ? 'fail ' : 'optional ';
$class = $result['result'] ? ' pass' : 'result ' . $fail;
?>
<li class="test_group <?php
echo text::alternate($class . ' alternate', $class);
?>
" style="padding: 5px;">
<div class="test">
<?php
echo $result['name'];
?>
</div>
<div class="result">
<?php
echo $result['result'] ? $result['pass_msg'] : $result['fail_msg'];
?>
</div>
</li>
<?php
示例13: __
<div class="box">
<h1><?php
echo __('Redirects');
?>
</h1>
<ul class="standardlist">
<?php
$zebra = false;
if (count($redirects) > 0) {
foreach ($redirects as $item) {
?>
<li <?php
echo text::alternate('class="z"', '');
?>
title="<?php
echo __('Click to edit');
?>
" >
<div class='actions'>
<?php
echo html::anchor($item->url, '<div class="fam-link-go"></div><span>' . __('test') . '</span>', array('title' => __('Click to test')));
echo html::anchor(Route::get('kohanut-admin')->uri(array('controller' => 'redirects', 'action' => 'edit', 'params' => $item->id)), '<div class="fam-link-edit"></div><span>' . __('edit') . '</span>', array('title' => __('Click to edit')));
echo html::anchor(Route::get('kohanut-admin')->uri(array('controller' => 'redirects', 'action' => 'delete', 'params' => $item->id)), '<div class="fam-link-delete"></div><span>' . __('delete') . '</span>', array('title' => __('Click to delete')));
?>
</div>
<?php
echo html::anchor(Route::get('kohanut-admin')->uri(array('controller' => 'redirects', 'action' => 'edit', 'params' => $item->id)), "<p>" . $item->url . html::image(Route::get('kohanut-media')->uri(array('file' => 'img/bullet_go.png')), array('alt' => 'redirects to')) . $item->newurl . "<small>" . ($item->type == "301" ? __('permanent') . ' (301)' : '') . ($item->type == "302" ? __('temporary') . ' (302)' : '') . "</small>" . "</p>");
?>
示例14: foreach
<table>
<tr>
<th>Title</th>
<th>Created</th>
<th>Modified</th>
<th>Uniques</th>
<th>Views</th>
<th>Visit</th>
<th>QR Code</th>
</tr>
<?php
foreach ($islands as $island) {
?>
<tr<?php
echo text::alternate('', ' class="odd"');
?>
>
<td><?php
echo html::specialchars($island->title);
?>
</td>
<td><?php
echo $island->created;
?>
</td>
<td><?php
echo $island->modified;
?>
</td>
<td style="text-align: right;"><?php
示例15: foreach
}
?>
<th><input type="submit" value="Filter" name="btnFilter" />
<br/>
<input type="button" value="Clear Filter" name="btnClearFilter" onclick="location.href='<?php
echo url::site(url::current());
?>
'" /></th>
</tr>
</thead>
<tbody id="first">
<?php
foreach ($result as $cell) {
echo "<tr" . text::alternate('', ' class="odd"') . "><td><input type='checkbox' value={$cell->id} name='chk[{$cell->id}]' /></td>";
for ($i = 0; $i < count($fields); $i++) {
$value = $fields[$i];
echo "<td>{$cell->{$value}}</td>";
}
echo "<td><a href=" . url::base() . $this->uri->segment(1) . '/' . $this->uri->segment(2) . "/edit/" . $cell->id . ">Edit</a></td></tr>";
}
?>
</tbody>
</table>
<?php
echo $pagination;
?>
</form>
<!--