當前位置: 首頁>>代碼示例>>PHP>>正文


PHP validater::checkCode方法代碼示例

本文整理匯總了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 : '');
開發者ID:leowh,項目名稱:colla,代碼行數:31,代碼來源:manageapppriv.html.php

示例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);
 }
開發者ID:leowh,項目名稱:colla,代碼行數:55,代碼來源:control.php


注:本文中的validater::checkCode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。