本文整理汇总了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;
}