当前位置: 首页>>代码示例>>PHP>>正文


PHP S::toLength方法代码示例

本文整理汇总了PHP中S::toLength方法的典型用法代码示例。如果您正苦于以下问题:PHP S::toLength方法的具体用法?PHP S::toLength怎么用?PHP S::toLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在S的用法示例。


在下文中一共展示了S::toLength方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderBackendPage


//.........这里部分代码省略.........
                         case 'AscByGroup':
                         case 'DescByGroup':
                             // Set some requirements;
                             $objGetCondition->appendString(_SP)->appendString('AS t1 LEFT JOIN %objAuthGroupTable
                             AS t2 ON t1.%objAuthZoneMTableFUGId = t2.%objAuthGroupTableFId
                             ORDER BY t2.%objAuthGroupTableFName');
                             switch ($_GET[ADMIN_ACTION_SORT]) {
                                 case 'AscByGroup':
                                     $objGetCondition->appendString(_SP)->appendString('ASC');
                                     break;
                                 case 'DescByGroup':
                                     $objGetCondition->appendString(_SP)->appendString('DESC');
                                     break;
                             }
                             break;
                         case 'AscByZoneForGroup':
                         case 'DescByZoneForGroup':
                             // Set some requirements;
                             $objGetCondition = new S('AS t1 LEFT JOIN %objAuthZonesTable
                             AS t2 ON t1.%objAuthZoneMTableFZId = t2.%objAuthGroupTableFId
                             ORDER BY t2.%objAuthZonesTableFName');
                             switch ($_GET[ADMIN_ACTION_SORT]) {
                                 case 'AscByZoneForGroup':
                                     $objGetCondition->appendString(_SP)->appendString('ASC');
                                     break;
                                 case 'DescByZoneForGroup':
                                     $objGetCondition->appendString(_SP)->appendString('DESC');
                                     break;
                             }
                             break;
                     }
                 }
                 // LIMIT only TO GROUP;
                 if ($objGetCondition->toLength()->toInt() != 0) {
                     $objGetCondition->doToken('ORDER', new S('WHERE %objAuthZoneMTableFIUG = "Y" ORDER'));
                 } else {
                     $objGetCondition = new S('WHERE %objAuthZoneMTableFIUG = "Y"');
                 }
                 // Add SOME LIMITs;
                 $objGetCondition->appendString(_SP)->appendString('LIMIT %LowerLimit, %UpperLimit')->doToken('%LowerLimit', $objLowerLimit)->doToken('%UpperLimit', $objUpperLimit);
                 // Set some requirements;
                 $objZoneMappings = $this->getZoneMappings($objGetCondition);
                 $objMappingsTableCount = $this->getMappingCount(new S('WHERE %objAuthZoneMTableFIUG = "Y"'));
                 // Set the template file ...
                 $tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'manageMappings.tp');
                 TPL::tpSet($objZoneMappings, new S('zonesMappingsTableForGroup'), $tpF);
                 TPL::tpExe($tpF);
                 // Do pagination;
                 if ($objMappingsTableCount->toInt() > 10) {
                     self::$objAdministration->setPagination($objMappingsTableCount);
                 }
                 // Do the form, make it happen;
                 $this->renderForm(new S('zoneMappingCreateForGroups'));
             }
             break;
         case 'manageMappingsForUsers':
             // Do specific actions, based on _GET parameters;
             if (isset($_GET[ADMIN_ACTION])) {
                 switch ($_GET[ADMIN_ACTION]) {
                     case ADMIN_ACTION_EDIT:
                         $this->renderForm(new S('zoneMappingEdit'));
                         break;
                     case ADMIN_ACTION_ERASE:
                         $this->renderForm(new S('zoneMappingErase'));
                         break;
                 }
开发者ID:ajbm6,项目名称:raphpframework,代码行数:67,代码来源:00_Authentication.php

示例2: getUniqueCode

 /**
  * Will return an unique code, based on a combination of sha1 and uniqid. First of ALL: do not relly on this method to return
  * the same hash code again and again, as for a combination of sha1 (2^64) it will never return the same code twice upon a large
  * field of possible situations. This method is rarelly used but has been promoted as a CORE method to generate a hased unique code
  * for different purposes (weak encryption, random things, etc.);
  * <code>
  * <?php
  *		// Get an unique code
  *		echo EXE::getUniqueCode (); # Will return a sha1 (uniqid ());
  * ?>
  * </code>
  *
  * @param I $objLength The length of the string to get
  * @return S The code, stripped down to the desired length
  * @author Catalin Z. Alexandru <catalin.zamfir@raphpframework.ro>
  * @copyright Under the terms of the GNU General Public License v3
  * @version $Id: 02_EXE.php 313 2009-10-09 13:27:52Z catalin.zamfir $
  * @since Version 2.0
  * @access public
  * @static
  * @final
  */
 public static final function getUniqueCode(I $objLength = NULL)
 {
     // Get the code, from an md5, of uniqid;
     $objCode = new S(sha1(uniqid(rand(), TRUE)));
     // Either get it FULL, or just first N chars;
     if ($objLength == NULL) {
         // Return the code;
         return $objCode;
     } else {
         // Check something ...
         if ($objLength->toInt() > $objCode->toLength()->toInt()) {
             // Return the code;
             return $objCode;
         } else {
             // Trim it down to size ...
             return $objCode->doSubStr(0, $objLength->toInt());
         }
     }
 }
开发者ID:ajbm6,项目名称:raphpframework,代码行数:41,代码来源:02_EXE.php


注:本文中的S::toLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。