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


PHP Sanitize::word方法代碼示例

本文整理匯總了PHP中Sanitize::word方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sanitize::word方法的具體用法?PHP Sanitize::word怎麽用?PHP Sanitize::word使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sanitize的用法示例。


在下文中一共展示了Sanitize::word方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get

 public static function get($password, $passHash)
 {
     // Gather Important Values
     $exp = explode("\$", $passHash, 2);
     $hashAlgo = $exp[0];
     // Prepare Salt
     $salt = SITE_SALT;
     // Prepare the Hash Algorithm to use
     $hashAlgo = "getPassAlgo_" . Sanitize::word($exp[0]);
     // Check if hash algorithm selected is valid
     if (method_exists("Password", $hashAlgo)) {
         return self::$hashAlgo($password, $passHash, $salt);
     }
     return self::getPassAlgo_default($password, $passHash, $salt);
 }
開發者ID:SkysteedDevelopment,項目名稱:Deity,代碼行數:15,代碼來源:Security_HashPassword.php

示例2: createHashColumn

 public static function createHashColumn($table, $columnName)
 {
     // Sanitize
     $table = Sanitize::variable($table);
     $columnName = Sanitize::variable($columnName);
     $prefix = Sanitize::word(substr($table, 0, 4) . ucfirst(substr($columnName, 0, 6)));
     // Make sure table exists
     if (Database::tableExists($table)) {
         $colExists = false;
         // Add the hash column if it doesn't exist
         if (!Database::columnExists($table, $columnName)) {
             $colExists = Database::addColumn($table, $columnName . '_crc', "int(10) unsigned not null", 0);
         }
         if ($colExists) {
             // Create a Trigger
             self::exec('CREATE TRIGGER ' . $prefix . '_ins BEFORE INSERT ON ' . $table . ' FOR EACH ROW BEGIN SET NEW.' . $columnName . '_crc=crc32(NEW.' . $columnName . '); END;');
             return self::exec('CREATE TRIGGER ' . $prefix . '_upd BEFORE UPDATE ON ' . $table . ' FOR EACH ROW BEGIN SET NEW.' . $columnName . '_crc=crc32(NEW.' . $columnName . '); END; ');
         }
     }
     return false;
 }
開發者ID:SkysteedDevelopment,項目名稱:Deity,代碼行數:21,代碼來源:Database_Meta.php


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