1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-09 08:17:12 +02:00

Minor code updates for various core classes

This commit is contained in:
Ryan Cramer
2023-03-31 11:06:33 -04:00
parent 57a9d224de
commit 4f75a7e81c
13 changed files with 110 additions and 85 deletions

View File

@@ -11,5 +11,6 @@ class Breadcrumb extends WireData {
$this->set('url', $url);
$this->set('title', $title);
$this->set('titleMarkup', '');
parent::__construct();
}
}
}

View File

@@ -8,7 +8,7 @@
* This file is licensed under the MIT license
* https://processwire.com/about/license/mit/
*
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
* ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com
*
* #pw-summary Holds ProcessWire configuration settings as defined in /wire/config.php and /site/config.php.
@@ -192,6 +192,25 @@
* @property int $externalPageID Page ID of page assigned to $page API variable when externally bootstrapped #pw-group-system-IDs
* @property array $preloadPageIDs Page IDs of pages that will always be preloaded at beginning of request #pw-group-system-IDs
* @property int $installed Timestamp of when this PW was installed, set automatically by the installer for future compatibility detection. #pw-group-system
*
* @method array|string wireMail($key = '', $value = null)
* @method array imageSizes($key = '', $value = null)
* @method array|bool|string|int|float imageSizerOptions($key = '', $value = null)
* @method array|int|bool webpOptions($key = '', $value = null)
* @method array|string contentTypes($key = '', $value = null)
* @method array|string fileContentTypes($key = '', $value = null)
* @method array|string|bool fileCompilerOptions($key = '', $value = null)
* @method array|string|string[] dbOptions($key = '', $value = null)
* @method array|string|string[] dbSqlModes($key = '', $value = null)
* @method array|int|bool pageList($key = '', $value = null)
* @method array|bool pageEdit($key = '', $value = null)
* @method array|string pageAdd($key = '', $value = null)
* @method array|string moduleInstall($key = '', $value = null)
* @method array|string substituteModules($key = '', $value = null)
* @method array|string|bool AdminThemeUikit($key = '', $value = null)
* @method array|string modals($key = '', $value = null)
* @method array|bool markupQA($key = '', $value = null)
* @method array|string statusFiles($key = '', $value = null)
*
*/
class Config extends WireData {

View File

@@ -13,7 +13,7 @@
* This file is licensed under the MIT license
* https://processwire.com/about/license/mit/
*
* ProcessWire 3.x, Copyright 2020 by Ryan Cramer
* ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com
*
*/
@@ -48,6 +48,7 @@ class FieldSelectorInfo extends Wire {
*
*/
public function __construct() {
parent::__construct();
$ftNops = array();
$ftOps = Selectors::getOperators(array(

View File

@@ -5,7 +5,7 @@
*
* WireArray of Field instances, as used by Fields class
*
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer
* ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com
*
*/
@@ -27,7 +27,7 @@ class FieldsArray extends WireArray {
* Per WireArray interface, Field keys have to be integers
*
* @param int $key
* @return int
* @return bool
*
*/
public function isValidKey($key) {
@@ -54,4 +54,4 @@ class FieldsArray extends WireArray {
public function makeBlankItem() {
return $this->wire(new Field());
}
}
}

View File

@@ -4,7 +4,7 @@
*
* #pw-summary Methods for managing DB tables and indexes for fields, and related methods. Accessed from `$fields->tableTools()`.
*
* ProcessWire 3.x, Copyright 2020 by Ryan Cramer
* ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com
*
* @since 3.0.150
@@ -39,8 +39,7 @@ class FieldsTableTools extends Wire {
$options = array_merge($defaults, $options);
$result = array();
/** @var WireDatabasePDO $database */
$database = $this->wire('database');
$database = $this->wire()->database;
$table = $database->escapeTable($field->getTable());
$col = $database->escapeCol($options['column']);
$sql = "SELECT $col, COUNT($col) FROM $table ";
@@ -107,8 +106,7 @@ class FieldsTableTools extends Wire {
*/
public function setUniqueIndex(Field $field, $add = true) {
/** @var WireDatabasePDO $database */
$database = $this->wire('database');
$database = $this->wire()->database;
$col = 'data';
$table = $database->escapeTable($field->getTable());
$uniqueIndexName = $this->hasUniqueIndex($field, $col);
@@ -192,8 +190,7 @@ class FieldsTableTools extends Wire {
*
*/
public function hasUniqueIndex(Field $field, $col = 'data') {
/** @var WireDatabasePDO $database */
$database = $this->wire('database');
$database = $this->wire()->database;
$table = $database->escapeTable($field->getTable());
$sql = "SHOW INDEX FROM $table";
$query = $database->prepare($sql);
@@ -222,6 +219,8 @@ class FieldsTableTools extends Wire {
static $checking = false;
if($checking) return;
$database = $this->wire()->database;
$col = 'data';
// is unique index requested?
@@ -232,7 +231,7 @@ class FieldsTableTools extends Wire {
if($useUnique === $hasUnique) return;
if(!$this->database->tableExists($field->getTable())) return;
if(!$database->tableExists($field->getTable())) return;
$checking = true;
@@ -286,8 +285,7 @@ class FieldsTableTools extends Wire {
*/
public function deleteEmptyRows(Field $field, $col = 'data', $strict = true) {
/** @var WireDatabasePDO $database */
$database = $this->wire('database');
$database = $this->wire()->database;
$table = $database->escapeTable($field->getTable());
$fieldtype = $field->type;
$schema = $fieldtype->getDatabaseSchema($field);
@@ -314,7 +312,7 @@ class FieldsTableTools extends Wire {
if(!in_array(trim($type), $types)) return false; // if not in allowed col types, fail
if($col !== 'data') {
$col = $database->escapeCol($this->sanitizer->fieldName($col));
$col = $database->escapeCol($this->wire()->sanitizer->fieldName($col));
if(empty($col)) return false;
}
@@ -354,7 +352,7 @@ class FieldsTableTools extends Wire {
public function getUniqueIndexInputfield(Field $field) {
$col = 'data';
$modules = $this->wire('modules'); /** @var Modules $modules */
$modules = $this->wire()->modules;
if((bool) $field->flagUnique != $field->hasFlag(Field::flagUnique)) {
$this->checkUniqueIndex($field, true);
@@ -386,10 +384,9 @@ class FieldsTableTools extends Wire {
*
*/
public function valueExists(Field $field, $value, $col = 'data') {
/** @var WireDatabasePDO $database */
$database = $this->wire('database');
$database = $this->wire()->database;
$table = $database->escapeTable($field->getTable());
if($col !== 'data') $col = $database->escapeCol($this->sanitizer->fieldName($col));
if($col !== 'data') $col = $database->escapeCol($this->wire()->sanitizer->fieldName($col));
$sql = "SELECT pages_id FROM $table WHERE $col=:val LIMIT 1";
$query = $database->prepare($sql);
$query->bindValue(':val', $value);
@@ -399,4 +396,4 @@ class FieldsTableTools extends Wire {
return $pageId;
}
}
}

View File

@@ -1,7 +1,10 @@
<?php namespace ProcessWire;
/**
* Class FileCompiler
* FileCompiler
*
* ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com
*
* @todo determine whether we should make storage in dedicated table rather than using wire('cache').
* @todo handle race conditions for multiple requests attempting to compile the same file(s).
@@ -127,6 +130,7 @@ class FileCompiler extends Wire {
if(strpos($sourcePath, '..') !== false) $sourcePath = realpath($sourcePath);
if(DIRECTORY_SEPARATOR != '/') $sourcePath = str_replace(DIRECTORY_SEPARATOR, '/', $sourcePath);
$this->sourcePath = rtrim($sourcePath, '/') . '/';
parent::__construct();
}
/**
@@ -135,8 +139,7 @@ class FileCompiler extends Wire {
*/
public function wired() {
/** @var Config $config */
$config = $this->wire('config');
$config = $this->wire()->config;
$globalOptions = $config->fileCompilerOptions;
if(is_array($globalOptions)) {
@@ -172,10 +175,10 @@ class FileCompiler extends Wire {
if(!$this->isWired()) $this->wired();
static $preloaded = false;
$config = $this->wire('config');
$config = $this->wire()->config;
if(!$preloaded) {
$this->wire('cache')->preloadFor($this);
$this->wire()->cache->preloadFor($this);
$preloaded = true;
}
@@ -211,7 +214,7 @@ class FileCompiler extends Wire {
protected function mkdir($path, $recursive = true) {
$chmod = $this->globalOptions['chmodDir'];
if(empty($chmod) || !is_string($chmod) || strlen($chmod) < 2) $chmod = null;
return $this->wire('files')->mkdir($path, $recursive, $chmod);
return $this->wire()->files->mkdir($path, $recursive, $chmod);
}
/**
@@ -224,7 +227,7 @@ class FileCompiler extends Wire {
protected function chmod($filename) {
$chmod = $this->globalOptions['chmodFile'];
if(empty($chmod) || !is_string($chmod) || strlen($chmod) < 2) $chmod = null;
return $this->wire('files')->chmod($filename, false, $chmod);
return $this->wire()->files->chmod($filename, false, $chmod);
}
/**
@@ -256,7 +259,7 @@ class FileCompiler extends Wire {
$phpClose = '?' . '>';
$phpBlocks = explode($phpOpen, $data);
foreach($phpBlocks as $key => $phpBlock) {
foreach($phpBlocks as $phpBlock) {
$pos = strpos($phpBlock, $phpClose);
if($pos !== false) {
$closeBlock = substr($phpBlock, strlen($phpClose) + 2);
@@ -284,7 +287,6 @@ class FileCompiler extends Wire {
// remove single quoted blocks
$this->rawDequotedPHP = preg_replace('/([\s(.=,])\'[^\']*\'/s', '$1\'string\'', $this->rawDequotedPHP);
}
/**
@@ -299,7 +301,7 @@ class FileCompiler extends Wire {
if($this->globalOptions['siteOnly']) {
// only files in /site/ are allowed for compilation
if(strpos($filename, $this->wire('config')->paths->site) !== 0) {
if(strpos($filename, $this->wire()->config->paths->site) !== 0) {
// sourcePath is somewhere outside of the PW /site/, and not allowed
return false;
}
@@ -369,14 +371,14 @@ class FileCompiler extends Wire {
// target file already exists, check if it is up-to-date
// $targetData = file_get_contents($targetPathname);
$targetHash = md5_file($targetPathname);
$cache = $this->wire('cache')->getFor($this, $cacheName);
$cache = $this->wire()->cache->getFor($this, $cacheName);
if($cache && is_array($cache)) {
if($cache['target']['hash'] == $targetHash && $cache['source']['hash'] == $sourceHash) {
// target file is up-to-date
$compileNow = false;
} else {
// target file changed somewhere else, needs to be re-compiled
$this->wire('cache')->deleteFor($this, $cacheName);
$this->wire()->cache->deleteFor($this, $cacheName);
}
if(!$compileNow && isset($cache['source']['ns'])) {
$this->ns = $cache['source']['ns'];
@@ -389,7 +391,7 @@ class FileCompiler extends Wire {
$targetPath = dirname($targetPathname);
$targetData = file_get_contents($sourcePathname);
if(stripos($targetData, 'FileCompiler=0')) return $sourcePathname; // bypass if it contains this string
if(strpos($targetData, 'namespace') !== false) $this->ns = $this->wire('files')->getNamespace($targetData, true);
if(strpos($targetData, 'namespace') !== false) $this->ns = $this->wire()->files->getNamespace($targetData, true);
if(!$this->ns) $this->ns = "\\";
if(!__NAMESPACE__ && !$this->options['modules'] && $this->ns === "\\") return $sourcePathname;
set_time_limit(120);
@@ -416,7 +418,7 @@ class FileCompiler extends Wire {
'time' => filemtime($targetPathname),
)
);
$this->wire('cache')->saveFor($this, $cacheName, $cacheData, WireCache::expireNever);
$this->wire()->cache->saveFor($this, $cacheName, $cacheData, WireCache::expireNever);
}
}
@@ -427,7 +429,7 @@ class FileCompiler extends Wire {
// show notices about compiled files, when applicable
if($compileNow) {
$message = $this->_('Compiled file:') . ' ' . str_replace($this->wire('config')->paths->root, '/', $sourcePathname);
$message = $this->_('Compiled file:') . ' ' . str_replace($this->wire()->config->paths->root, '/', $sourcePathname);
if($this->globalOptions['showNotices']) {
$u = $this->wire('user');
if($u && $u->isSuperuser()) $this->message($message);
@@ -484,7 +486,7 @@ class FileCompiler extends Wire {
if($this->options['modules']) {
// FileCompiler modules
$compilers = array();
foreach($this->wire('modules')->findByPrefix('FileCompiler', true) as $module) {
foreach($this->wire()->modules->findByPrefix('FileCompiler', true) as $module) {
if(!$module instanceof FileCompilerModule) continue;
$runOrder = (int) $module->get('runOrder');
while(isset($compilers[$runOrder])) $runOrder++;
@@ -694,7 +696,7 @@ class FileCompiler extends Wire {
}
// replace absolute root path references with runtime generated versions
$rootPath = $this->wire('config')->paths->root;
$rootPath = $this->wire()->config->paths->root;
if(strpos($data, $rootPath)) {
$ns = __NAMESPACE__ ? "\\ProcessWire" : "";
$data = preg_replace('%([\'"])' . preg_quote($rootPath) . '([^\'"\s\r\n]*[\'"])%',
@@ -823,7 +825,7 @@ class FileCompiler extends Wire {
static $files = null;
if(is_null($files)) {
$files = array();
foreach(new \DirectoryIterator($this->wire('config')->paths->core) as $file) {
foreach(new \DirectoryIterator($this->wire()->config->paths->core) as $file) {
if($file->isDot() || $file->isDir()) continue;
$basename = $file->getBasename('.php');
if(strtoupper($basename[0]) == $basename[0]) {
@@ -834,12 +836,12 @@ class FileCompiler extends Wire {
}
// also add in all modules
foreach($this->wire('modules') as $module) {
foreach($this->wire()->modules as $module) {
$name = __NAMESPACE__ ? $module->className(true) : $module->className();
if(!in_array($name, $classes)) $classes[] = $name;
}
$classes = array_merge($classes, $files);
if(!__NAMESPACE__) $classes = array_merge($classes, array_keys($this->wire('modules')->getInstallable()));
if(!__NAMESPACE__) $classes = array_merge($classes, array_keys($this->wire()->modules->getInstallable()));
$rawPHP = $this->rawPHP;
$rawDequotedPHP = $this->rawDequotedPHP;
@@ -848,7 +850,6 @@ class FileCompiler extends Wire {
foreach($classes as $class) {
if(__NAMESPACE__ && strpos($class, __NAMESPACE__ . '\\') !== 0) continue; // limit only to ProcessWire classes/interfaces
/** @noinspection PhpUnusedLocalVariableInspection */
if(strpos($class, '\\') !== false) {
list($ns, $class) = explode('\\', $class, 2); // reduce to just class without namespace
} else {
@@ -903,7 +904,6 @@ class FileCompiler extends Wire {
$ns = '';
}
if($ns) {}
/** @noinspection PhpUnusedLocalVariableInspection */
if(stripos($rawDequotedPHP, $function) === false) continue; // if function name not mentioned in data, quick exit
$n = 0;
@@ -953,11 +953,12 @@ class FileCompiler extends Wire {
// don't perform full copies of some directories
// @todo convert this to use the user definable exclusions list
if($source === $this->wire('config')->paths->site) return 0;
if($source === $this->wire('config')->paths->siteModules) return 0;
if($source === $this->wire('config')->paths->templates) return 0;
$config = $this->wire()->config;
if($source === $config->paths->site) return 0;
if($source === $config->paths->siteModules) return 0;
if($source === $config->paths->templates) return 0;
if(!is_dir($target)) $this->wire('files')->mkdir($target, true);
if(!is_dir($target)) $this->wire()->files->mkdir($target, true);
$dir = new \DirectoryIterator($source);
$numCopied = 0;
@@ -993,7 +994,7 @@ class FileCompiler extends Wire {
}
if(!$numCopied) {
$this->wire('files')->rmdir($target, true);
$this->wire()->files->rmdir($target, true);
}
return $numCopied;
@@ -1044,13 +1045,13 @@ class FileCompiler extends Wire {
public function clearCache($all = false) {
if($all) {
$targetPath = $this->cachePath;
$this->wire('cache')->deleteFor($this);
$this->wire()->cache->deleteFor($this);
} else {
$this->init();
$targetPath = $this->targetPath;
}
if(!is_dir($targetPath)) return true;
return $this->wire('files')->rmdir($targetPath, true);
return $this->wire()->files->rmdir($targetPath, true);
}
/**
@@ -1089,11 +1090,14 @@ class FileCompiler extends Wire {
*
*/
protected function _maintenance($sourcePath, $targetPath) {
$config = $this->wire()->config;
$files = $this->wire()->files;
$sourcePath = rtrim($sourcePath, '/') . '/';
$targetPath = rtrim($targetPath, '/') . '/';
$sourceURL = str_replace($this->wire('config')->paths->root, '/', $sourcePath);
$targetURL = str_replace($this->wire('config')->paths->root, '/', $targetPath);
$sourceURL = str_replace($config->paths->root, '/', $sourcePath);
$targetURL = str_replace($config->paths->root, '/', $targetPath);
$useLog = $this->globalOptions['logNotices'];
//$this->log("Running maintenance for $targetURL (source: $sourceURL)");
@@ -1111,7 +1115,7 @@ class FileCompiler extends Wire {
if($file->isDir()) {
if(!is_dir($sourceFile)) {
$this->wire('files')->rmdir($targetFile, true);
$files->rmdir($targetFile, true);
if($useLog) $this->log("Maintenance/Remove directory: $targetURL$basename");
} else {
$this->_maintenance($sourceFile, $targetFile);
@@ -1121,7 +1125,7 @@ class FileCompiler extends Wire {
if(!file_exists($sourceFile)) {
// source file has been deleted
$this->wire('files')->unlink($targetFile, true);
$files->unlink($targetFile, true);
if($useLog) $this->log("Maintenance/Remove target file: $targetURL$basename");
} else if(filemtime($sourceFile) > filemtime($targetFile)) {

View File

@@ -43,6 +43,7 @@ abstract class FileCompilerModule extends WireData implements Module, Configurab
public function __construct() {
$this->set('runOrder', 0);
parent::__construct();
}
/**
@@ -60,7 +61,7 @@ abstract class FileCompilerModule extends WireData implements Module, Configurab
* 2. If you only want to compile non-PHP sections of the file, implement the compileMarkup() method instead.
*
* @param string $data
* @return string
* @return string|array
*
*/
public function compile($data) {
@@ -89,7 +90,7 @@ abstract class FileCompilerModule extends WireData implements Module, Configurab
if(!preg_match_all('!\?>(.+?)<\?!s', $data, $matches)) return array();
foreach($matches[1] as $key => $markup) {
foreach($matches[1] as $markup) {
$_markup = $this->compileMarkup($markup);
if($_markup !== $markup) {
$data = str_replace("?>$markup<?", "?>$_markup<?", $data);
@@ -154,7 +155,7 @@ abstract class FileCompilerModule extends WireData implements Module, Configurab
*
*/
public function getModuleConfigInputfields(InputfieldWrapper $inputfields) {
$f = $this->wire('modules')->get('InputfieldInteger');
$f = $inputfields->InputfieldInteger;
$f->attr('name', 'runOrder');
$f->attr('value', (int) $this->get('runOrder'));
$f->label = $this->_('Runtime execution order');

View File

@@ -3,7 +3,7 @@
/**
* ProcessWire HookEvent
*
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer
* ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com
*
* Instances of HookEvent are passed to Hook handlers when their requested method has been called.
@@ -60,6 +60,7 @@ class HookEvent extends WireData {
);
if(!empty($eventData)) $data = array_merge($data, $eventData);
$this->data = $data;
parent::__construct();
}
/**
@@ -130,7 +131,6 @@ class HookEvent extends WireData {
return array_key_exists($key, $arguments) ? $arguments[$key] : null;
}
$value = null;
$argumentsByName = array();
foreach($names as $key => $name) {
@@ -161,8 +161,9 @@ class HookEvent extends WireData {
if(is_string($n) && !ctype_digit($n)) {
// convert argument name to position
$names = $this->getArgumentNames();
$n = array_search($n, $names);
if($n === false) throw new WireException("Unknown argument name: $n");
$name = $n;
$n = array_search($name, $names);
if($n === false) throw new WireException("Unknown argument name: $name");
}
$this->data['arguments'][(int)$n] = $value;

View File

@@ -1,7 +1,7 @@
<?php namespace ProcessWire;
/**
* Class ModuleConfig
* ModuleConfig class
*
* Serves as the base for classes dedicated to configuring modules.
*
@@ -11,6 +11,9 @@
* This file is licensed under the MIT license
* https://processwire.com/about/license/mit/
*
* ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com
*
*/
class ModuleConfig extends WireData {
@@ -46,6 +49,7 @@ class ModuleConfig extends WireData {
*
*/
public function __construct() {
parent::__construct();
}
/**
@@ -95,7 +99,7 @@ class ModuleConfig extends WireData {
* Set an array that defines Inputfields
*
* @param array $a
* @return this
* @return self
*
*/
public function add(array $a) {

View File

@@ -6,7 +6,7 @@
* WireInputData and the WireInput class together form a simple
* front end to PHP's $_GET, $_POST, and $_COOKIE superglobals.
*
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer
* ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com
*
*/
@@ -1683,7 +1683,7 @@ class WireInput extends Wire {
* @param string $method Sanitizer method name or CSV string of sanitizer method names
* @param string|array|null $value
* @param bool $getArray
* @return array|mixed|null
* @return array|int|float|string|null
* @throws WireException If given unknown sanitizer method
*
*/

View File

@@ -16,7 +16,7 @@
*
* Each WireInputData is not instantiated unless specifically asked for.
*
* ProcessWire 3.x, Copyright 2018 by Ryan Cramer
* ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com
*
* @link http://processwire.com/api/ref/input/ Offical $input API variable documentation
@@ -255,15 +255,13 @@ class WireInputData extends Wire implements \ArrayAccess, \IteratorAggregate, \C
if(!strlen($pattern)) return array();
$options = array_merge($defaults, $options);
$sanitizer = $this->wire('sanitizer'); /** @var Sanitizer $sanitizer */
$sanitizer = $this->wire()->sanitizer;
$isRE = in_array($pattern[0], array('/', '!', '%', '#', '@'));
$items = array();
$count = 0;
$type = $options['type'];
$tests = array();
if(!strlen($pattern)) return array();
if(strpos($pattern, '=')) {
// pattern indicates "value=pattern" or "name=pattern"
list($type, $pattern) = explode('=', $pattern, 2);
@@ -514,7 +512,7 @@ class WireInputData extends Wire implements \ArrayAccess, \IteratorAggregate, \C
*
*/
public function ___callUnknown($method, $arguments) {
$sanitizer = $this->wire('sanitizer');
$sanitizer = $this->wire()->sanitizer;
if(!$sanitizer->methodExists($method)) {
try {
return parent::___callUnknown($method, $arguments);

View File

@@ -72,7 +72,7 @@
* ~~~~~
*
*
* ProcessWire 3.x, Copyright 2020 by Ryan Cramer
* ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com
*
*/
@@ -142,8 +142,7 @@ class WireInputDataCookie extends WireInputData {
*/
public function init() {
$this->init = true;
/** @var Session $session */
$session = $this->wire('session');
$session = $this->wire()->session;
$cookies = $session->getFor($this, '');
if(!empty($cookies)) {
$this->setArray($cookies);
@@ -461,7 +460,7 @@ class WireInputDataCookie extends WireInputData {
*
*/
protected function allowSetCookie($name) {
if(empty($this->skipCookies)) $this->skipCookies = $this->wire('session')->getCookieNames();
if(empty($this->skipCookies)) $this->skipCookies = $this->wire()->session->getCookieNames();
return in_array($name, $this->skipCookies) ? false : true;
}
}

View File

@@ -3,7 +3,7 @@
/**
* ProcessWire WireMail Interface
*
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer
* ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com
*
*/
@@ -24,7 +24,7 @@ interface WireMailInterface {
* 5. NULL (default value, to clear out any previously set values)
* @param string $name Optionally provide a FROM name, applicable
* only when specifying #1 (single email) for the first argument.
* @return this
* @return self
* @throws WireException if any provided emails were invalid
*
*/
@@ -35,7 +35,7 @@ interface WireMailInterface {
*
* @param string Must be a single email address or "User Name <user@example.com>" string.
* @param string|null An optional FROM name (same as setting/calling fromName)
* @return this
* @return self
* @throws WireException if provided email was invalid
*
*/
@@ -45,7 +45,7 @@ interface WireMailInterface {
* Set the email subject
*
* @param string $subject
* @return this
* @return self
*
*/
public function subject($subject);
@@ -54,7 +54,7 @@ interface WireMailInterface {
* Set the email message body (text only)
*
* @param string $body in text only
* @return this
* @return self
*
*/
public function body($body);
@@ -63,7 +63,7 @@ interface WireMailInterface {
* Set the email message body (HTML only)
*
* @param string $body in HTML
* @return this
* @return self
*
*/
public function bodyHTML($body);
@@ -73,7 +73,7 @@ interface WireMailInterface {
*
* @param string $key
* @param string $value
* @return this
* @return self
*
*/
public function header($key, $value);
@@ -84,7 +84,7 @@ interface WireMailInterface {
* See $additional_parameters at: http://www.php.net/manual/en/function.mail.php
*
* @param string $value
* @return this
* @return self
*
*/
public function param($value);
@@ -95,7 +95,7 @@ interface WireMailInterface {
*
* @param string $value
* @param string $filename
* @return this
* @return self
*
public function attachment($value, $filename = '');
*/