本文整理匯總了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);
}
示例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;
}