本文整理汇总了PHP中validater::checkCode方法的典型用法代码示例。如果您正苦于以下问题:PHP validater::checkCode方法的具体用法?PHP validater::checkCode怎么用?PHP validater::checkCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类validater
的用法示例。
在下文中一共展示了validater::checkCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strtoupper
if (validater::checkCode(substr($name, 0, 1)) and validater::checkCode(substr($name, 1, 1))) {
$rightName .= strtoupper(substr($name, 1, 1));
}
?>
<?php
if (validater::checkCode(substr($name, 0, 1)) and !validater::checkCode(substr($name, 1, 1))) {
$rightName .= strtoupper(substr($name, 1, 3));
}
?>
<?php
if (!validater::checkCode(substr($name, 0, 1)) and validater::checkCode(substr($name, 3, 1))) {
$rightName .= strtoupper(substr($name, 3, 1));
}
?>
<?php
if (!validater::checkCode(substr($name, 0, 1)) and !validater::checkCode(substr($name, 3, 1))) {
$rightName .= substr($name, 3, 3);
}
?>
<i class='icon icon-default' style="background-color: hsl(<?php
echo $right['id'] * 47 % 360;
?>
, 100%, 40%)"> <span><?php
echo $rightName;
?>
</span></i>
<?php
}
?>
<?php
echo html::checkbox('apps', array($code => $right['name']), $right['right'] == '1' ? $code : '');
示例2: printBlock
/**
* Print block.
*
* @param int $index
* @access public
* @return void
*/
public function printBlock($index)
{
$block = $this->block->getBlock($index);
if (empty($block)) {
return false;
}
$html = '';
if ($block->block == 'html') {
$html = "<div class='article-content'>" . htmlspecialchars_decode($block->params->html) . '</div>';
} elseif ($block->block == 'rss') {
$html = $this->block->getRss($block);
} elseif ($block->source != '') {
$html = $this->block->getEntry($block);
} elseif ($block->block == 'allEntries') {
$entries = $this->loadModel('entry')->getEntries();
$html = "<div id='allEntriesBlock' class='all-entries'><table class='table'><tr>";
foreach ($entries as $entry) {
$class = !$entry->buildin ? "class='iframe'" : '';
$size = $entry->size != 'max' ? json_decode($entry->size) : '';
$width = isset($size->width) ? "width={$size->width}" : '';
$height = isset($size->height) ? "height={$size->height}" : '';
$image = html::image($entry->logo, "width=18");
if (!$entry->logo) {
$hue = $entry->id * 47 % 360;
$name = $entry->abbr ? $entry->abbr : $entry->name;
$entryName = validater::checkCode(substr($name, 0, 1)) ? strtoupper(substr($name, 0, 1)) : substr($name, 0, 3);
if (validater::checkCode(substr($name, 0, 1)) and validater::checkCode(substr($name, 1, 1))) {
$entryName .= strtoupper(substr($name, 1, 1));
}
if (validater::checkCode(substr($name, 0, 1)) and !validater::checkCode(substr($name, 1, 1))) {
$entryName .= strtoupper(substr($name, 1, 3));
}
if (!validater::checkCode(substr($name, 0, 1)) and validater::checkCode(substr($name, 3, 1))) {
$entryName .= strtoupper(substr($name, 3, 1));
}
if (!validater::checkCode(substr($name, 0, 1)) and !validater::checkCode(substr($name, 3, 1))) {
$entryName .= substr($name, 3, 3);
}
$image = "<i class='icon icon-default' style='background-color: hsl({$hue}, 100%, 40%)'> <span>" . $entryName . "</span></i> ";
}
$html .= "<td class='pull-left' width='33%'>" . html::a($entry->login, $image . $entry->name, "{$class} {$width} {$height}") . "</td>";
}
$html .= "</tr></table></div>";
} elseif ($block->block == 'dynamic') {
$html = $this->fetch('block', 'dynamic');
}
die($html);
}