mirror of
https://github.com/processwire/processwire.git
synced 2025-08-13 10:15:28 +02:00
Minor updates, phpdoc tweaks and such
This commit is contained in:
@@ -130,8 +130,10 @@ abstract class AdminTheme extends WireData implements Module {
|
||||
$config = $this->wire('config');
|
||||
/** @var Session $session */
|
||||
$session = $this->wire('session');
|
||||
/** @var User $user */
|
||||
$user = $this->wire('user');
|
||||
/** @var string $adminTheme */
|
||||
$adminTheme = $this->wire('user')->admin_theme;
|
||||
$adminTheme = $user->admin_theme;
|
||||
|
||||
if($adminTheme) {
|
||||
// there is user specified admin theme
|
||||
@@ -146,14 +148,14 @@ abstract class AdminTheme extends WireData implements Module {
|
||||
// adjust $config adminThumbOptions[scale] for auto detect when requested
|
||||
$o = $config->adminThumbOptions;
|
||||
if($o && isset($o['scale']) && $o['scale'] === 1) {
|
||||
$o['scale'] = $session->hidpi ? 0.5 : 1.0;
|
||||
$o['scale'] = $session->get('hidpi') ? 0.5 : 1.0;
|
||||
$config->adminThumbOptions = $o;
|
||||
}
|
||||
|
||||
$config->js('modals', $config->modals);
|
||||
|
||||
if($session->hidpi) $this->addBodyClass('hidpi-device');
|
||||
if($session->touch) $this->addBodyClass('touch-device');
|
||||
|
||||
if($session->get('hidpi')) $this->addBodyClass('hidpi-device');
|
||||
if($session->get('touch')) $this->addBodyClass('touch-device');
|
||||
|
||||
$this->addBodyClass($this->className());
|
||||
}
|
||||
|
@@ -291,7 +291,7 @@ class User extends Page {
|
||||
*
|
||||
* #pw-hooker
|
||||
*
|
||||
* @param string $name Permission name
|
||||
* @param string|Permission $name Permission name
|
||||
* @param Template|int|string $template Template object, name or ID
|
||||
* @return bool
|
||||
* @throws WireException
|
||||
|
@@ -1442,7 +1442,7 @@ abstract class Wire implements WireTranslatable, WireFuelable, WireTrackable {
|
||||
* @param string|array $options One or more of array elements or space separated string of:
|
||||
* - `first` - only first item will be returned
|
||||
* - `last` - only last item will be returned
|
||||
* - `all` - include all errors, including those beyond the scope of this object
|
||||
* - `all` - include all messages, including those beyond the scope of this object
|
||||
* - `clear` - clear out all items that are returned from this method
|
||||
* - `array` - return an array of strings rather than series of Notice objects.
|
||||
* - `string` - return a newline separated string rather than array/Notice objects.
|
||||
|
@@ -150,6 +150,11 @@ class WireMail extends WireData implements WireMailInterface {
|
||||
protected function sanitizeEmail($email) {
|
||||
if(!strlen($email)) return '';
|
||||
$email = strtolower(trim($email));
|
||||
if(strpos($email, ':') && preg_match('/^(.+):\d+$/', $email, $matches)) {
|
||||
// sending email in particular might sometimes be auto-generated from hostname
|
||||
// so remove trailing port, i.e. ':8888', if present since it will not validate
|
||||
$email = $matches[1];
|
||||
}
|
||||
$clean = $this->wire('sanitizer')->email($email);
|
||||
if($email !== $clean) {
|
||||
throw new WireException("Invalid email address: " . $this->wire('sanitizer')->entities($email));
|
||||
|
Reference in New Issue
Block a user