本文整理汇总了PHP中PerchUtil::html方法的典型用法代码示例。如果您正苦于以下问题:PHP PerchUtil::html方法的具体用法?PHP PerchUtil::html怎么用?PHP PerchUtil::html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PerchUtil
的用法示例。
在下文中一共展示了PerchUtil::html方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_tree
function render_tree($Pages, $groupID, $parentID = 0, $class = false)
{
$pages = $Pages->get_by_parent($parentID, $groupID);
$s = '';
$s = '<ol class="' . $class . '">';
if (PerchUtil::count($pages)) {
foreach ($pages as $Page) {
$s .= '<li><div class="page icon">' . PerchUtil::html($Page->pageNavText()) . '</div>';
$s .= render_tree($Pages, $groupID, $Page->id(), $class);
$s .= '</li>';
}
}
$s .= '</ol>';
return $s;
}
示例2: render_tree
function render_tree($Categories, $Set, $parentID = 0, $class = false)
{
$categories = $Categories->get_by_parent($parentID, $Set->id());
$s = '';
$s = '<ol class="' . $class . '">';
if (PerchUtil::count($categories)) {
foreach ($categories as $Category) {
$s .= '<li id="category_' . $Category->id() . '" data-parent="' . $parentID . '"><div class="category icon">';
$s .= '<input type="text" name="c-' . $Category->id() . '" value="' . $Category->catOrder() . '" />';
$s .= '' . PerchUtil::html($Category->catTitle()) . '</div>';
$s .= render_tree($Categories, $Set, $Category->id());
$s .= '</li>';
}
}
$s .= '</ol>';
return $s;
}
示例3: _register_new_key
/**
* Add a new key to the regions table
*
* @param string $key
* @param array $opts
* @return void
* @author Drew McLellan
*/
private function _register_new_key($key, $opts = array())
{
if (!isset($this->registered[$key])) {
$Perch = Perch::fetch();
$page = $Perch->get_page();
$data = array();
$data['regionKey'] = $key;
$data['regionPage'] = $page;
$data['regionHTML'] = '<!-- Undefined content: ' . PerchUtil::html($key) . ' -->';
$data['regionOptions'] = '';
if (is_array($opts) && count($opts)) {
if ($opts['page']) {
$data['regionPage'] = $opts['page'];
// Creating for a different page, so make sure old pageID cache is cleared.
$this->pageID = false;
}
if ($opts['shared']) {
$data['regionPage'] = '*';
}
if ($opts['template']) {
$data['regionTemplate'] = $opts['template'];
$data['regionNew'] = 0;
}
if ($opts['multiple']) {
$data['regionMultiple'] = 1;
} else {
$data['regionMultiple'] = 0;
}
if ($opts['searchable']) {
$data['regionSearchable'] = 1;
} else {
$data['regionSearchable'] = 0;
}
if ($opts['roles']) {
$data['regionEditRoles'] = $opts['roles'];
}
$regionOptions = array();
if ($opts['sort']) {
$regionOptions['sortField'] = $opts['sort'];
}
if ($opts['sort-order']) {
$regionOptions['sortOrder'] = $opts['sort-order'];
}
if ($opts['edit-mode']) {
$regionOptions['edit_mode'] = $opts['edit-mode'];
}
if ($opts['search-url']) {
$regionOptions['searchURL'] = $opts['search-url'];
}
if ($opts['add-to-top']) {
$regionOptions['addToTop'] = $opts['add-to-top'];
}
if ($opts['limit']) {
$regionOptions['limit'] = $opts['limit'];
}
if ($opts['title-delimiter']) {
$regionOptions['title_delimit'] = $opts['title-delimiter'];
}
if ($opts['columns']) {
$regionOptions['column_ids'] = $opts['columns'];
}
$data['regionOptions'] = PerchUtil::json_safe_encode($regionOptions);
}
$data['pageID'] = $this->_find_or_create_page($data['regionPage']);
if ($data['pageID']) {
$db = PerchDB::fetch();
$cols = array();
$vals = array();
foreach ($data as $key => $value) {
$cols[] = $key;
$vals[] = $db->pdb($value) . ' AS ' . $key;
}
$sql = 'INSERT INTO ' . $this->table . '(' . implode(',', $cols) . ')
SELECT ' . implode(',', $vals) . '
FROM (SELECT 1) AS dtable
WHERE (
SELECT COUNT(*)
FROM ' . $this->table . '
WHERE regionKey=' . $db->pdb($data['regionKey']) . '
AND (regionPage=' . $db->pdb($data['regionPage']) . ' OR regionPage=' . $db->pdb('*') . ')
)=0
LIMIT 1';
$db->execute($sql);
$this->registered[$key] = true;
$this->new_keys_registered = true;
}
}
}
示例4: array
<ul class="smartbar">
<li class="<?php
echo $filter == 'all' ? 'selected' : '';
?>
"><a href="<?php
echo PerchUtil::html($API->app_path());
?>
"><?php
echo $Lang->get('All');
?>
</a></li>
<li class="new <?php
echo $filter == 'status' && $status == 'draft' ? 'selected' : '';
?>
"><a href="<?php
echo PerchUtil::html($API->app_path() . '?status=draft');
?>
"><?php
echo $Lang->get('Drafts');
?>
</a></li>
<?php
if ($filter == 'status' && $status == 'draft') {
$Alert->set('filter', PerchLang::get('You are viewing all draft posts.') . ' <a href="' . $API->app_path() . '" class="action">' . $Lang->get('Clear Filter') . '</a>');
}
if (PerchUtil::count($categories)) {
$items = array();
foreach ($categories as $Category) {
$items[] = array('arg' => 'category', 'val' => $Category->catPath(), 'label' => $Category->catTitle(), 'path' => $API->app_path());
}
echo PerchUtil::smartbar_filter('cf', 'By Category', 'Filtered by ‘%s’', $items, 'folder', $Alert, "You are viewing posts in ‘%s’", $API->app_path());
示例5: reset
<?php
if (PerchUtil::count($app_settings)) {
$prev_app_id = 'perch_content';
$settings_copy = $app_settings;
reset($settings_copy);
foreach ($app_settings as $id => $setting) {
if ($setting['app_id'] != $prev_app_id) {
$app = $Perch->get_app($setting['app_id']);
if (PerchUtil::count($app)) {
echo '<h2 id="' . PerchUtil::html($app['id'] == 'content' ? 'perch_content' : $app['id']) . '">' . PerchUtil::html($app['label']) . '</h2>';
}
$API = new PerchAPI(1, $app['id']);
$Lang = $API->get('Lang');
}
$c = '';
$next_item = next($settings_copy);
if ($next_item) {
if ($next_item['app_id'] != $setting['app_id']) {
$c = ' last';
}
}
?>
<div class="field <?php
echo $Form->error($id, false);
echo $c;
?>
">
<?php
echo $Form->label($id, $app['id'] == 'content' ? PerchLang::get($setting['label']) : $Lang->get($setting['label']), false, false, false);
?>
示例6: array
$opts[] = array('label' => $lang, 'value' => $lang);
}
}
echo $Form->select('lang', $opts, $Form->get($settings, 'lang', 'en-gb'));
?>
</div>
</fieldset>
<h2><?php
echo PerchUtil::html(PerchLang::get('Change password'));
?>
</h2>
<fieldset>
<legend class="redundant"><?php
echo PerchUtil::html(PerchLang::get('Change password'));
?>
</legend>
<?php
if (PERCH_PARANOID) {
?>
<div class="field <?php
echo $Form->error('currentPassword', false);
?>
">
<?php
echo $Form->label('currentPassword', 'Current password');
?>
<?php
echo $Form->password('currentPassword', '');
示例7:
?>
"><a href="<?php
echo PerchUtil::html($API->app_path() . '/responses/' . '?id=' . $Form->id() . '&spam=1');
?>
"><?php
echo $Lang->get('Spam');
?>
</a></li>
<?php
if ($CurrentUser->has_priv('perch_forms.configure')) {
?>
<li class="<?php
echo $filter == 'options' ? 'selected' : '';
?>
"><a href="<?php
echo PerchUtil::html($API->app_path() . '/settings/?id=' . $Form->id());
?>
"><?php
echo $Lang->get('Form Options');
?>
</a></li>
<?php
}
?>
<li class="fin"><a class="download icon" href="<?php
echo $HTML->encode($API->app_path() . '/responses/export/?id=' . $Form->id());
?>
"><?php
echo $Lang->get('Download CSV');
?>
</a></li>
示例8: foreach
<?php
echo PerchLang::get('Pages');
if ($CurrentUser->has_priv('content.pages.create')) {
echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH . '/core/apps/content/page/add/') . '" class="add button">' . PerchLang::get('Add Page') . '</a>';
}
?>
</h2>
<div class="bd">
<?php
if (PerchUtil::count($pages)) {
echo '<ul>';
if (PerchUtil::count($shared)) {
echo '<li>';
echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH) . '/core/apps/content/page/?id=-1">';
echo PerchUtil::html(PerchLang::get('Shared'));
echo '</a>';
echo '</li>';
}
foreach ($pages as $Page) {
echo '<li>';
echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH . '/core/apps/content/page/?id=' . $Page->id()) . '">';
echo PerchUtil::html($Page->pageNavText());
echo '</a>';
echo '</li>';
}
echo '</ul>';
}
?>
</div>
</div>
示例9: get_tweet_html
public function get_tweet_html($tweet)
{
$text = trim($tweet->text);
if ($tweet->entities) {
// URLs
if ($tweet->entities->urls) {
foreach ($tweet->entities->urls as $URL) {
$replacement = '<a href="' . PerchUtil::html($URL->expanded_url, true) . '">' . PerchUtil::html($URL->display_url) . '</a>';
$text = str_replace($URL->url, $replacement, $text);
}
}
// Media
if (isset($tweet->entities->media)) {
foreach ($tweet->entities->media as $URL) {
$replacement = '<a href="' . PerchUtil::html($URL->expanded_url, true) . '">' . PerchUtil::html($URL->display_url) . '</a>';
$text = str_replace($URL->url, $replacement, $text);
}
}
// mentions
if ($tweet->entities->user_mentions) {
foreach ($tweet->entities->user_mentions as $Mention) {
$replacement = ' <a href="http://twitter.com/' . PerchUtil::html($Mention->screen_name, true) . '">@' . PerchUtil::html($Mention->screen_name) . '</a> ';
$text = str_replace('@' . $Mention->screen_name, $replacement, $text);
}
}
// hashtags
if ($tweet->entities->hashtags) {
foreach ($tweet->entities->hashtags as $Hashtag) {
$replacement = '<a href="http://twitter.com/search?q=' . PerchUtil::html(urlencode('#' . $Hashtag->text), true) . '">#' . PerchUtil::html($Hashtag->text) . '</a>';
$text = str_replace('#' . $Hashtag->text, $replacement, $text);
}
}
}
return $text;
}
示例10: TINYINT
<?php
$sql = "\n\n\tALTER TABLE `__PREFIX__resources` ADD `resourceCreated` DATETIME NOT NULL DEFAULT '2000-01-01 00:00:00' AFTER `resourceType`;\n\n\tALTER TABLE `__PREFIX__resources` ADD `resourceUpdated` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `resourceCreated`;\n\n ALTER TABLE `__PREFIX__resources` ADD `resourceAWOL` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `resourceUpdated`;\n\n ALTER TABLE `__PREFIX__resources` ADD INDEX `idx_awol` (`resourceAWOL`);\n\n ALTER TABLE `__PREFIX__resources` ADD `resourceTitle` CHAR(255) NULL DEFAULT NULL AFTER `resourceAWOL`;\n\n ALTER TABLE `__PREFIX__resources` ADD `resourceFileSize` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `resourceTitle`;\n\n ALTER TABLE `__PREFIX__resources` ADD `resourceWidth` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `resourceFileSize`;\n\n ALTER TABLE `__PREFIX__resources` ADD `resourceHeight` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `resourceWidth`;\n\n ALTER TABLE `__PREFIX__resources` ADD `resourceCrop` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `resourceHeight`;\n\n ALTER TABLE `__PREFIX__resources` ADD `resourceDensity` FLOAT NOT NULL DEFAULT '1' AFTER `resourceCrop`;\n\n ALTER TABLE `__PREFIX__resources` ADD `resourceTargetWidth` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `resourceDensity`;\n\n ALTER TABLE `__PREFIX__resources` ADD `resourceTargetHeight` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `resourceTargetWidth`;\n \n ALTER TABLE `__PREFIX__resources` ADD `resourceMimeType` CHAR(64) NULL DEFAULT NULL AFTER `resourceTargetHeight`;\n\n ALTER TABLE `__PREFIX__resources` ADD FULLTEXT INDEX `idx_search` (`resourceTitle`);\n\n ALTER TABLE `__PREFIX__resources` ADD `resourceInLibrary` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `resourceMimeType`;\n\n ALTER TABLE `__PREFIX__resources` ADD INDEX `idx_library` (`resourceInLibrary`);\n\n CREATE TABLE IF NOT EXISTS `__PREFIX__resource_tags` (\n `tagID` INT(10) NOT NULL AUTO_INCREMENT,\n `tagTitle` VARCHAR(255) NOT NULL DEFAULT '',\n `tagSlug` VARCHAR(255) NOT NULL DEFAULT '',\n `tagCount` int(10) unsigned NOT NULL DEFAULT '0',\n PRIMARY KEY (`tagID`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\n\n CREATE TABLE IF NOT EXISTS `__PREFIX__resources_to_tags` (\n `resourceID` int(10) NOT NULL DEFAULT '0',\n `tagID` int(10) NOT NULL DEFAULT '0',\n PRIMARY KEY (`resourceID`,`tagID`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED;\n\n ";
if (PerchUtil::count($DB->get_rows('SHOW TABLES LIKE \'' . PERCH_DB_PREFIX . 'resource_log\'')) == 0) {
if (PerchUtil::count($DB->get_rows('SHOW TABLES LIKE \'' . PERCH_DB_PREFIX . 'content_resources\'')) == 1) {
$sql .= "\n\n RENAME TABLE `__PREFIX__content_resources` TO `__PREFIX__resource_log`;\n\n ALTER TABLE `__PREFIX__resource_log` DROP PRIMARY KEY;\n\n ALTER TABLE `__PREFIX__resource_log` ADD `logID` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;\n\n ALTER TABLE `__PREFIX__resource_log` ADD `appID` CHAR(32) NOT NULL DEFAULT 'content' AFTER `logID`;\n\n ALTER TABLE `__PREFIX__resource_log` ADD `itemFK` CHAR(32) NOT NULL DEFAULT 'itemRowID' AFTER `appID`;\n\n ALTER TABLE `__PREFIX__resource_log` ADD INDEX `idx_fk` (`itemFK`, `itemRowID`);\n\n ALTER TABLE `__PREFIX__resource_log` ADD UNIQUE INDEX `idx_uni` (`appID`, `itemFK`, `itemRowID`, `resourceID`);\n\n ";
}
}
$sql .= "\n\n CREATE TABLE IF NOT EXISTS `__PREFIX__resource_log` (\n `logID` int(10) unsigned NOT NULL AUTO_INCREMENT,\n `appID` char(32) NOT NULL DEFAULT 'content',\n `itemFK` char(32) NOT NULL DEFAULT 'itemRowID',\n `itemRowID` int(10) unsigned NOT NULL DEFAULT '0',\n `resourceID` int(10) unsigned NOT NULL DEFAULT '0',\n PRIMARY KEY (`logID`),\n KEY `idx_resource` (`resourceID`),\n KEY `idx_fk` (`itemFK`,`itemRowID`),\n UNIQUE KEY `idx_uni` (`appID`,`itemFK`,`itemRowID`,`resourceID`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\n INSERT INTO `__PREFIX__user_privileges` (`privKey`, `privTitle`, `privOrder`)\n VALUES ('assets.create','Upload assets',1);\n\n INSERT INTO `__PREFIX__user_privileges` (`privKey`, `privTitle`, `privOrder`)\n VALUES ('assets.manage','Manage assets',2);\n\n\n CREATE TABLE IF NOT EXISTS `__PREFIX__categories` (\n `catID` int(10) NOT NULL AUTO_INCREMENT,\n `setID` int(10) unsigned NOT NULL,\n `catParentID` int(10) unsigned NOT NULL DEFAULT '0',\n `catTitle` char(64) NOT NULL DEFAULT '',\n `catSlug` char(64) NOT NULL DEFAULT '',\n `catPath` char(255) NOT NULL DEFAULT '',\n `catDisplayPath` char(255) NOT NULL DEFAULT '',\n `catOrder` int(10) unsigned NOT NULL DEFAULT '0',\n `catTreePosition` char(255) NOT NULL DEFAULT '000',\n `catDynamicFields` text NOT NULL,\n PRIMARY KEY (`catID`),\n KEY `idx_set` (`setID`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\n CREATE TABLE IF NOT EXISTS `__PREFIX__category_sets` (\n `setID` int(10) NOT NULL AUTO_INCREMENT,\n `setTitle` char(64) NOT NULL DEFAULT '',\n `setSlug` char(64) NOT NULL DEFAULT '',\n `setTemplate` char(255) NOT NULL DEFAULT 'set.html',\n `setCatTemplate` char(255) NOT NULL DEFAULT 'category.html',\n `setDynamicFields` text,\n PRIMARY KEY (`setID`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\n INSERT INTO `__PREFIX__user_privileges` (`privKey`, `privTitle`, `privOrder`)\n VALUES ('categories.create','Create new categories',1);\n\n INSERT INTO `__PREFIX__user_privileges` (`privKey`, `privTitle`, `privOrder`)\n VALUES ('categories.delete','Delete categories',2);\n \n INSERT INTO `__PREFIX__user_privileges` (`privKey`, `privTitle`, `privOrder`)\n VALUES ('categories.manage','Manage categories',3);\n \n INSERT INTO `__PREFIX__user_privileges` (`privKey`, `privTitle`, `privOrder`)\n VALUES ('categories.sets.create','Create category sets',4);\n \n INSERT INTO `__PREFIX__user_privileges` (`privKey`, `privTitle`, `privOrder`)\n VALUES ('categories.sets.delete','Delete category sets',5);\n\n ";
$sql = str_replace('__PREFIX__', PERCH_DB_PREFIX, $sql);
$queries = explode(';', $sql);
if (PerchUtil::count($queries) > 0) {
foreach ($queries as $query) {
$query = trim($query);
if ($query != '') {
$DB->execute($query);
if ($DB->errored && strpos($DB->error_msg, 'Duplicate') === false) {
echo '<li class="icon failure error">' . PerchUtil::html(PerchLang::get('The following error occurred:')) . '</li>';
echo '<li class="failure"><code class="sql">' . PerchUtil::html($query) . '</code></li>';
echo '<li class="failure"><code>' . PerchUtil::html($DB->error_msg) . '</code></p></li>';
$errors = true;
}
}
}
}
# include(PERCH_CORE.'/apps/assets/PerchAssets_Assets.class.php');
# include(PERCH_CORE.'/apps/assets/PerchAssets_Asset.class.php');
# $Assets = new PerchAssets_Assets();
# $Assets->import_from_perch_gallery();
# $Assets->reindex();
示例11: foreach
<div class="widget">
<h2><?php
echo $Lang->get('MailChimp');
?>
</h2>
<div class="">
<?php
if ($msg) {
echo $msg;
} else {
if (PerchUtil::count($lists)) {
echo '<div class="bd">';
foreach ($lists as $List) {
echo '<h3>' . PerchUtil::html($List->listTitle()) . '<span class="note">' . PerchUtil::html($List->listMemberCount()) . '</span>' . '</h3>' . "\n";
$subs = $Subscribers->get_latest_for_list($List);
if (is_array($subs) && PerchUtil::count($subs) > 0) {
echo '<table class="fig">' . "\n";
foreach ($subs as $Subscriber) {
echo '<tr><td>' . PerchUtil::html($Subscriber->subscriberEmail()) . '</td><td class="note">' . PerchUtil::html(strftime('%d %b %Y', strtotime($Subscriber->subCreated()))) . '</td></tr>' . "\n";
}
echo '</table>' . "\n";
}
}
echo '</div>';
}
}
?>
</div>
</div>
<?php
}
示例12: array
<ul class="smartbar">
<li class="<?php
echo $status == 'all' ? 'selected' : '';
?>
"><a href="<?php
echo PerchUtil::html($API->app_path() . '/?status=all');
?>
"><?php
echo $Lang->get('All');
?>
</a></li>
<li class="new <?php
echo $status == 'pending' ? 'selected' : '';
?>
"><a href="<?php
echo PerchUtil::html($API->app_path() . '/' . '?status=pending');
?>
"><?php
echo $Lang->get('Pending (%s)', $pending_comment_count);
?>
</a></li>
<?php
if ($status == 'pending') {
$Alert->set('filter', $Lang->get('You are viewing all comments pending moderation.') . ' <a href="' . $API->app_path() . '/?status=all' . '" class="action">' . $Lang->get('Clear Filter') . '</a>');
}
$items = array();
$items[] = array('arg' => 'status', 'val' => 'live', 'label' => 'Live', 'path' => $API->app_path() . '/');
$items[] = array('arg' => 'status', 'val' => 'rejected', 'label' => 'Rejected', 'path' => $API->app_path() . '/');
$items[] = array('arg' => 'status', 'val' => 'spam', 'label' => 'Spam', 'path' => $API->app_path() . '/');
echo PerchUtil::smartbar_filter('cf', 'By Status', 'Filtered by ‘%s’', $items, 'folder', $Alert, "You are viewing ‘%s’ comments", $API->app_path() . '/?status=all');
?>
示例13:
$FieldType = PerchFieldTypes::get($col['Tag']->type(), false, $col['Tag']);
$title = $FieldType->render_admin_listing($title);
if ($col['Tag']->format()) {
$title = $Template->format_value($col['Tag'], $title);
}
}
if ($first && trim($title) == '') {
$title = '#' . $item['_id'];
}
echo $title;
if ($first) {
echo '</a>';
}
echo '</td>';
$first = false;
}
echo '<td>';
echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH) . '/core/apps/content/delete/item/?id=' . PerchUtil::html($Region->id()) . '&itm=' . PerchUtil::html($item['itemID']) . '" class="delete inline-delete">' . PerchLang::get('Delete') . '</a>';
echo '</td>';
echo '</tr>';
$i++;
}
echo '</tbody>';
echo '</table>';
}
?>
<?php
include PERCH_PATH . '/core/inc/main_end.php';
示例14:
/* ----------------------------------------- SMART BAR ----------------------------------------- */
?>
<ul class="smartbar">
<li><span class="set"><?php
echo $Lang->get('Filter');
?>
</span></li>
<li class="selected"><a href="<?php
echo PerchUtil::html($API->app_path() . '/');
?>
"><?php
echo $Lang->get('All');
?>
</a></li>
<li class="fin"><a class="icon reorder" href="<?php
echo PerchUtil::html($API->app_path() . '/reorder/');
?>
"><?php
echo $Lang->get('Reorder Albums');
?>
</a></li>
</ul>
<?php
echo $Alert->output();
?>
<?php
/* ----------------------------------------- /SMART BAR ----------------------------------------- */
if (PerchUtil::count($albums)) {
?>
<table class="d">
<thead>
示例15: table_dump
public static function table_dump($vars, $class = '')
{
$out = '';
if (PerchUtil::count($vars)) {
$out .= '<table class="' . PerchUtil::html($class, true) . '"><tr><th>ID</th><th>Value</th></tr>';
foreach ($vars as $key => $val) {
$out .= '<tr><td><b>' . PerchUtil::html($key) . '</b></td><td>';
switch (gettype($val)) {
case 'array':
if (isset($val['processed'])) {
$out .= $val['processed'];
} else {
if (isset($val['_default'])) {
$out .= $val['_default'];
} else {
$out .= '<pre>' . print_r($val, true) . '</pre>';
}
}
break;
case 'object':
$out .= '<pre>' . print_r($val, true) . '</pre>';
break;
case 'boolean':
$out .= $val ? 'true' : 'false';
break;
default:
if (strlen($val) > 100) {
$val = PerchUtil::excerpt_char($val, 100) . '{...}';
}
$out .= $val;
}
$out .= '</td></tr>';
}
$out .= '</table>';
}
return $out;
}