本文整理汇总了PHP中Text::alternate方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::alternate方法的具体用法?PHP Text::alternate怎么用?PHP Text::alternate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text
的用法示例。
在下文中一共展示了Text::alternate方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAlternateResetsWhenCalledWithNoParamsAndReturnsEmptyString
/**
* Tests Text::alternate()
*
* @test
* @covers Text::alternate
* @group testdox
*/
function testAlternateResetsWhenCalledWithNoParamsAndReturnsEmptyString()
{
$values = array('yes', 'no', 'maybe');
$this->assertSame('yes', call_user_func_array(array('Text', 'alternate'), $values));
$this->assertSame('', Text::alternate());
$this->assertSame('yes', call_user_func_array(array('Text', 'alternate'), $values));
}
示例2: render
public function render()
{
$range = array();
Text::alternate();
foreach ($this->_field['range'] as $pair) {
$date = $pair;
$date = Arr::merge($date, $this->_attributes);
$date['id'] = Text::alternate('date_from', 'date_to');
if (!isset($date['name'])) {
$date['name'] = $date['id'];
}
if ($this->_field['name'] !== NULL) {
$date['name'] = $this->_field['name'] . '[' . $date['name'] . ']';
}
$date['inline'] = TRUE;
$range[] = new Sidebar_Fields_Date($date);
}
unset($this->_field['range']);
$this->_view->set('range', $range);
return parent::render();
}
示例3: test_alternate_resets_when_called_with_no_params_and_returns_empty_string
/**
* Tests Text::alternate()
*
* @test
* @covers Text::alternate
*/
function test_alternate_resets_when_called_with_no_params_and_returns_empty_string()
{
list($val_a, $val_b, $val_c) = array('yes', 'no', 'maybe');
$this->assertSame('yes', Text::alternate($val_a, $val_b, $val_c));
$this->assertSame('', Text::alternate());
$this->assertSame('yes', Text::alternate($val_a, $val_b, $val_c));
}
示例4: foreach
<th>memory</th>
</tr>
<?php
foreach (Debugger::get_database_queries() as $db_profile => $stats) {
?>
<tr align="left">
<th colspan="4">DATABASE "<?php
echo strtoupper($db_profile);
?>
"</th>
</tr>
<?php
foreach ($stats as $num => $query) {
?>
<tr class="<?php
echo Text::alternate('odd', 'even');
?>
">
<td><?php
echo $num + 1;
?>
</td>
<td><?php
echo HTML::entities($query['name']);
?>
</td>
<td><?php
echo number_format($query['time'] * 1000, 3);
?>
ms</td>
<td><?php
示例5: ucwords
<tr class="permission-group">
<td class="permission-key" width="30%" colspan="<?php
echo $count + 1;
?>
">
<?php
echo ucwords(Text::plain($key));
?>
</td>
</tr>
<?php
foreach ($access_names as $perm => $name) {
?>
<tr class="<?php
echo Text::alternate("odd", "even");
?>
">
<td class="permission" >
<div class="permission-item" id="permission-<?php
echo str_replace(' ', '-', $perm);
?>
" >
<strong><?php
echo ucwords($name['title']);
?>
</strong>
<div class="description">
<p class="muted"><?php
echo Text::plain($name['description']);
?>
示例6: foreach
* @package Galleries
* @author Antti Qvickström
* @copyright (c) 2010-2011 Antti Qvickström
* @license http://www.opensource.org/licenses/mit-license.php MIT license
*/
/** @var Model_Gallery $gallery */
?>
<ul>
<?php
foreach ($galleries as $gallery) {
$default_image = $gallery->default_image();
?>
<li class="grid2<?php
echo Text::alternate(' first', '', '', '');
?>
">
<article>
<div class="thumb">
<?php
echo HTML::anchor(Route::model($gallery, isset($approval) ? 'pending' : null), $default_image ? HTML::image($default_image->get_url('thumbnail', $gallery->dir)) : __('New gallery'));
?>
</div>
<h4><?php
echo HTML::anchor(Route::model($gallery, isset($approval) ? 'pending' : null), HTML::chars($gallery->name));
?>
</h4>
<div class="info">
<!--
<?php
示例7: __
<h1><?php
echo __('Available Classes');
?>
</h1>
<div class="class-list">
<?php
foreach ($classes as $class => $methods) {
$link = $route->uri(array('class' => $class));
?>
<div class="class <?php
echo Text::alternate('left', 'right');
?>
">
<h2><?php
echo HTML::anchor($link, $class);
?>
</h2>
<ul class="methods">
<?php
foreach ($methods as $method) {
?>
<li><?php
echo HTML::anchor("{$link}#{$method}", "{$class}::{$method}");
?>
</li>
<?php
}
?>
</ul>
示例8:
<br/>
<?php
echo Text::alternate('You are cool', 'You are smart', 'You are funny');
?>
<br/>
<?php
echo Text::alternate('You are nice', 'You are happy', 'You are stinky');
?>
<br/>
<?php
echo Text::alternate('You are ugly', 'You are sleepy', 'You are bored');
?>
<br/>
<?php
echo Text::random('alnum', 8);
?>
<br/>
<?php
echo Text::random('alpha', 10);
?>
<br/>
示例9: __
<th class="log-url hidden-xs"><?php
echo __('Log url');
?>
</th>
<th class="log-user hidden-xs"><?php
echo __('User');
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($logs as $log) {
?>
<?php
$class = Text::alternate('even', 'odd');
?>
<tr class="item <?php
echo $class;
?>
">
<td class="log-date">
<?php
echo Date::format($log->created_on, 'j F y H:i');
?>
</td>
<td class="log-level hidden-xs">
<?php
echo UI::label($log->level());
?>
</td>
示例10:
// Post author
// @todo Fix this idiocracy
if ($author = Model_User::find_user_light($post->author_id)) {
$author_full = Model_User::find_user($author['id']);
}
// Viewer's post
$my = $user && $author && $author['id'] == $user->id;
// Topic author's post
$owners = $author ? $author['id'] == $topic->author_id : $post->author_name == $topic->author_name;
?>
<article id="post-<?php
echo $post->id;
?>
" class="post <?php
echo $owners ? 'owner ' : '', $my ? 'my ' : '', Text::alternate('', 'alt');
?>
">
<section class="author grid2 first">
<?php
if ($author) {
?>
<?php
echo HTML::avatar($author['avatar'], $author['username']);
?>
<?php
echo HTML::user($author, $author['username']);
?>
<br />
示例11: htmlentities
<th><?php
echo htmlentities($fieldData['name']);
?>
</th>
<?php
}
?>
<th>Actions</th>
</tr>
</thead>
<tbody id="itemsBody">
<?php
foreach ($items as $item) {
?>
<tr<?php
echo Text::alternate('', ' class="alt"');
?>
>
<td class="itemId"><?php
echo sprintf("%04d", $item->id);
?>
</td>
<?php
foreach ($fields as $fieldKey => $fieldData) {
$value = $item->{$fieldKey};
if ($fieldData['type'] == 'select') {
$value = @$fieldData['options'][$value];
if (!$value) {
$value = '[unknown]';
}
示例12: function
},
api_filter: function(api_container_selector){
$(this).keyup(function(){
// Run the filter method on this value
$(api_container_selector).filter_content($(this).val());
});
}
})
})(jQuery);
$(document).ready(function(){
$('#api-filter-box').api_filter('#kodoc-main');
});
</script>
<div class="class-list">
<?php foreach ($classes as $class => $methods): $link = $route->uri(array('class' => $class)) ?>
<div class="class <?php echo Text::alternate('left', 'right') ?>">
<h2><?php echo HTML::anchor($link, $class) ?></h2>
<ul class="methods">
<?php foreach ($methods as $method): ?>
<li><?php echo HTML::anchor("{$link}#{$method}", "{$class}::{$method}") ?></li>
<?php endforeach ?>
</ul>
</div>
<?php endforeach ?>
</div>
示例13: foreach
<div id="debug-routes" class="top" style="display: none;">
<h1>Routes</h1>
<table cellspacing="0" cellpadding="0">
<tr align="left">
<th>Name</th>
<th>URI</th>
<th>Route Regex</th>
</tr>
<?php
foreach (Debugger::get_routes() as $route) {
?>
<tr class="<?php
echo Text::alternate('odd', 'even') . ($route['current'] ? ' current' : '');
?>
">
<td><?php
echo $route['name'];
?>
</td>
<td>
<pre><?php
echo HTML::entities($route['uri']);
?>
</pre>
</td>
<td>
<pre><?php
echo HTML::entities($route['route_regex']);
?>
</pre>
</td>
示例14: foreach
<th width="15%">
First Name</th>
<th width="16%">
Middle Name</th>
<th width="14%">
Last Name</th>
<th width="25%">
Email</th>
<th width="11%">Role</th>
<th width="4%"> </th>
</tr>
<?php
foreach ($list as $l) {
?>
<tr <?php
echo Text::alternate('', 'class="odd"');
?>
>
<td><?php
echo $l['firstname'];
?>
</td>
<td><?php
echo $l['middlename'];
?>
</td>
<td><?php
echo $l['lastname'];
?>
</td>
<td><?php