mirror of
https://github.com/processwire/processwire.git
synced 2025-08-12 01:34:31 +02:00
Minor code updates in $modules plus a small documentation update for WireMail
This commit is contained in:
@@ -1056,7 +1056,7 @@ function wireClassParents($className, $autoload = true) {
|
|||||||
if($ns) $className = $ns . $_className;
|
if($ns) $className = $ns . $_className;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$parents = class_parents(ltrim($className, "\\"), $autoload);
|
$parents = @class_parents(ltrim($className, "\\"), $autoload);
|
||||||
}
|
}
|
||||||
$a = array();
|
$a = array();
|
||||||
if(is_array($parents)) foreach($parents as $k => $v) {
|
if(is_array($parents)) foreach($parents as $k => $v) {
|
||||||
|
@@ -416,6 +416,7 @@ class Modules extends WireArray {
|
|||||||
if(empty($info['singular'])) continue;
|
if(empty($info['singular'])) continue;
|
||||||
$file = $this->paths[1] . "$moduleName/$moduleName.module.php";
|
$file = $this->paths[1] . "$moduleName/$moduleName.module.php";
|
||||||
if(!file_exists($file) || !$this->includeModuleFile($file, $moduleName)) continue;
|
if(!file_exists($file) || !$this->includeModuleFile($file, $moduleName)) continue;
|
||||||
|
if(!isset($info['namespace'])) $info['namespace'] = '';
|
||||||
$className = $info['namespace'] . $moduleName;
|
$className = $info['namespace'] . $moduleName;
|
||||||
$module = $this->newModule($className, $moduleName);
|
$module = $this->newModule($className, $moduleName);
|
||||||
if($module) parent::set($moduleName, $module);
|
if($module) parent::set($moduleName, $module);
|
||||||
@@ -1486,7 +1487,7 @@ class Modules extends WireArray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$info = $this->getModuleInfo($module ? $module : $moduleName);
|
$info = $this->getModuleInfo($module ? $module : $moduleName);
|
||||||
if(empty($info['permission']) && empty($info['permissionMethod'])) return $strict ? false : true;
|
if(empty($info['permission']) && empty($info['permissionMethod'])) return ($strict ? false : true);
|
||||||
|
|
||||||
if(is_null($user)) $user = $this->wire('user');
|
if(is_null($user)) $user = $this->wire('user');
|
||||||
if($user && $user->isSuperuser()) return true;
|
if($user && $user->isSuperuser()) return true;
|
||||||
@@ -1506,7 +1507,8 @@ class Modules extends WireArray {
|
|||||||
);
|
);
|
||||||
$method = $info['permissionMethod'];
|
$method = $info['permissionMethod'];
|
||||||
$this->includeModule($moduleName);
|
$this->includeModule($moduleName);
|
||||||
return $className::$method($data);
|
if(method_exists($className, $method)) return $className::$method($data);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -3,19 +3,17 @@
|
|||||||
/**
|
/**
|
||||||
* ProcessWire WireMail
|
* ProcessWire WireMail
|
||||||
*
|
*
|
||||||
* ProcessWire 3.x, Copyright 2019 by Ryan Cramer
|
* ProcessWire 3.x, Copyright 2021 by Ryan Cramer
|
||||||
* https://processwire.com
|
* https://processwire.com
|
||||||
*
|
*
|
||||||
* #pw-summary A module type that handles sending of email in ProcessWire
|
* #pw-summary A module type that handles sending of email in ProcessWire
|
||||||
* #pw-var $m
|
* #pw-var $m
|
||||||
* #pw-body =
|
* #pw-body =
|
||||||
*
|
*
|
||||||
* Below are 3 different ways you can get a new instance of WireMail.
|
* Below are 2 different ways you can get a new instance of WireMail.
|
||||||
* When possible we recommend using option A or B below.
|
|
||||||
* ~~~~~
|
* ~~~~~
|
||||||
* $m = $mail->new(); // option A
|
* $m = $mail->new(); // option A: use $mail API variable
|
||||||
* $m = wireMail(); // option B
|
* $m = wireMail(); // option B: use wireMail() function
|
||||||
* $m = new WireMail(); // option C
|
|
||||||
* ~~~~~
|
* ~~~~~
|
||||||
* Once you have an instance of WireMail (`$m`), you can use it to send email like in these examples below.
|
* Once you have an instance of WireMail (`$m`), you can use it to send email like in these examples below.
|
||||||
* ~~~~~
|
* ~~~~~
|
||||||
@@ -23,7 +21,8 @@
|
|||||||
* $m->to('user@domain.com')
|
* $m->to('user@domain.com')
|
||||||
* ->from('you@company.com')
|
* ->from('you@company.com')
|
||||||
* ->subject('Message Subject')
|
* ->subject('Message Subject')
|
||||||
* ->body('Message Body')
|
* ->body('Optional message body in plain text')
|
||||||
|
* ->bodyHTML('<html><body><p>Optional message body in HTML</p></body></html>')
|
||||||
* ->send();
|
* ->send();
|
||||||
*
|
*
|
||||||
* // separate method call usage
|
* // separate method call usage
|
||||||
@@ -38,10 +37,11 @@
|
|||||||
* $m->from('you@company.com', 'Mary Jane');
|
* $m->from('you@company.com', 'Mary Jane');
|
||||||
*
|
*
|
||||||
* // other methods or properties you might set (or get)
|
* // other methods or properties you might set (or get)
|
||||||
* $m->bodyHTML('<html><body><h1>Message Body</h1></body></html>');
|
|
||||||
* $m->attachment('/path/to/file.ext');
|
|
||||||
* $m->fromName('Mary Jane');
|
* $m->fromName('Mary Jane');
|
||||||
* $m->toName('John Smith');
|
* $m->toName('John Smith');
|
||||||
|
* $m->replyTo('somebody@somewhere.com');
|
||||||
|
* $m->replyToName('Joe Somebody');
|
||||||
|
* $m->attachment('/path/to/file.ext');
|
||||||
* $m->header('X-Mailer', 'ProcessWire');
|
* $m->header('X-Mailer', 'ProcessWire');
|
||||||
* $m->param('-f you@company.com'); // PHP mail() param (envelope from example)
|
* $m->param('-f you@company.com'); // PHP mail() param (envelope from example)
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user