示例#1
0
 /**
  * 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);
 }
 /**
  * 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();
 }
 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');
 }
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
0
文件: toolbar.php 项目: Moro3/duc
            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
0
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>
        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
0
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");
				<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
0
<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
0
<?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
0
文件: welcome.php 项目: swk/bluebox
} 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
0
	<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
0
<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 
}
?>
		<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>

<!--
示例#16
0
文件: post.php 项目: anqqa/Anqh
 * @package    Forum
 * @author     Antti Qvickström
 * @copyright  (c) 2010 Antti Qvickström
 * @license    http://www.opensource.org/licenses/mit-license.php MIT license
 */
// Viewer's post
$my = $user && $post->author_id == $user->id;
// Topic author's post
$owners = $topic->author_id && $post->author_id == $topic->author_id;
?>

	<article id="post-<?php 
echo $post->id;
?>
" class="post <?php 
echo ($owners ? 'owner ' : '') . ($my ? 'my ' : '') . text::alternate('', 'alt');
?>
">
		<header<?php 
echo $post->id == $topic->last_post_id ? ' id="last"' : '';
?>
>

			<?php 
echo html::avatar($post->author->avatar, $post->author->username);
?>

			<span class="actions">
			<?php 
if ($my) {
    ?>
示例#17
0
<table>
<thead>
<tr>
<th class="leftjust">Company</th>
<th>2009 Rating</th>
<th>2008 Rating</th>
<th>2007 Rating</th>
<th>2006 Rating</th>
</tr>
</thead>
<tbody class="body2">
<?php 
foreach ($result as $item) {
    ?>
<tr <?php 
    echo text::alternate('', ' class="even"');
    ?>
>
<td><?php 
    echo html::image(array('src' => 'media/images/w-handle.gif', 'class' => 'square'));
    echo $item->Company;
    ?>
</td>
<td ><?php 
    echo $item->Rating1;
    ?>
</td>
<td><?php 
    echo $item->Rating2;
    ?>
</td>
?>
 </th>
        <th> <?php 
echo t("Remote Version");
?>
 </th>
        <th> <?php 
echo t("Description");
?>
 </th>
      </tr>
      <?php 
foreach ($vars as $module_name) {
    ?>
      <tr class="<?php 
    echo text::alternate("g-odd", "g-even");
    ?>
">
        <td> <?php 
    echo "<font color=" . $module_name['font_color'] . ">";
    ?>
 <?php 
    echo $module_name['name'];
    ?>
 </font> </td>
        <td> <?php 
    echo "<font color=" . $module_name['font_color'] . ">";
    ?>
 <?php 
    echo $module_name['code_version'];
    ?>
}
for ($i = 0; $i < 100; $i += 10) {
    $transparencies["{$i}"] = "{$i}%";
}
?>
  <tr class="<?php 
echo text::alternate('g-odd', 'g-even');
?>
">
    <td style="width:15; text-align:right">Desired Size:</td>
      <td style="width:85%"><?php 
echo form::dropdown('size', $sizes, module::get_var('emboss', 'size', 85));
?>
</td></tr>
  <tr class="<?php 
echo text::alternate('g-odd', 'g-even');
?>
">
    <td style="width:15; text-align:right">Transparency:</td>
      <td style="width:85%"><?php 
echo form::dropdown('transparency', $transparencies, module::get_var('emboss', 'transparency', 50));
?>
</td></tr>
</table>
</div>
<?php 
echo form::submit(array('name' => 'Update', 'style' => 'display:block; float:none'), 'Update');
?>
 </form>
</div>
<hr>
示例#20
0
 /**
  * Cookie data.
  *
  * @return  void
  */
 public function cookies()
 {
     if (empty($_COOKIE)) {
         return;
     }
     if (!($table = $this->table('cookies'))) {
         return;
     }
     $table->add_column('kp-name');
     $table->add_column();
     $table->add_row(array('Cookies', 'Value'), 'kp-title', 'background-color: #FFF4D7');
     text::alternate();
     foreach ($_COOKIE as $name => $value) {
         $data = array($name, $value);
         $class = text::alternate('', 'kp-altrow');
         $table->add_row($data, $class);
     }
 }
示例#21
0
 /**
  * Cookie data.
  *
  * @return  void
  */
 public static function cookies()
 {
     if (empty($_COOKIE)) {
         return;
     }
     if (!Profiler::show('cookies')) {
         return;
     }
     $table = new Profiler_Table();
     $table->add_column('kp-name');
     $table->add_column();
     $table->add_row(array(__('Cookies'), __('Value')), 'kp-title', 'background-color: #FFF4D7');
     text::alternate();
     foreach ($_COOKIE as $name => $value) {
         $data = array($name, $value);
         $class = text::alternate('', 'kp-altrow');
         $table->add_row($data, $class);
     }
     Profiler::add($table);
 }
示例#22
0
foreach ($registrations as $r) {
    //Print convention header if it's different than previous.
    if ($cid != $r->convention_id) {
        print '<tr><th colspan=5 class="header">' . $r->convention->name . '</th></tr>';
        ?>
			<tr>
				<th width='25%'>Name</th>
				<th width='25%'>Ticket</th>
				<th width='25%'>Ticket ID</th>	
				<th width='10%'>Price</th>				
				<th width='15%'>Status</th>				
			</tr>
			<?php 
        $cid = $r->convention_id;
    }
    $class_row = text::alternate('odd', 'even');
    echo '<tr class="' . $class_row . '">';
    echo '<td>' . HTML::chars($r->gname . ' ' . $r->sname) . '</td>';
    echo '<td>' . HTML::chars($r->pass->name) . '</td>';
    /* Display the reg_id only when the registration is fully paid for. */
    if ($r->status == Model_Registration::STATUS_PAID) {
        echo '<td>' . HTML::chars($r->reg_id) . '</td>';
    } else {
        echo '<td></td>';
    }
    echo '<td>' . HTML::chars(sprintf('$%01.2F', $r->pass->price)) . '</td>';
    echo '<td>' . $r->statusToString() . '</td>';
    echo '</tr>';
}
?>
</table>
示例#23
0
  <h2>
    <?= t("User Admin") ?>
  </h2>

  <div class="gBlockContent">
    <table id="gUserAdminList">
      <tr>
        <th><?= t("Username") ?></th>
        <th><?= t("Full name") ?></th>
        <th><?= t("Email") ?></th>
        <th><?= t("Last login") ?></th>
        <th><?= t("Actions") ?></th>
      </tr>

      <? foreach ($users as $i => $user): ?>
      <tr id="gUser-<?= $user->id ?>" class="<?= text::alternate("gOddRow", "gEvenRow") ?> user <?= $user->admin ? "admin" : "" ?>">
        <td id="user-<?= $user->id ?>" class="core-info gDraggable">
          <img src="<?= $user->avatar_url(20, $theme->url("images/avatar.jpg", true)) ?>"
               title="<?= t("Drag user onto group below to add as a new member") ?>"
               alt="<?= p::clean($user->name) ?>"
               width="20"
               height="20" />
          <?= p::clean($user->name) ?>
        </td>
        <td>
          <?= p::clean($user->full_name) ?>
        </td>
        <td>
          <?= p::clean($user->email) ?>
        </td>
        <td>