Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions _build/test/MODxControllerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
*/
namespace MODX\Revolution;

use MODX\Revolution\Smarty\modSmarty;

/**
* Abstract class extending MODxTestCase for controller-specific testing
Expand Down Expand Up @@ -43,9 +42,7 @@ public function setUpFixtures() {

/* load smarty template engine */
$templatePath = $this->modx->getOption('manager_path') . 'templates/default/';
$this->modx->getService('smarty', modSmarty::class, '', [
'template_dir' => $templatePath,
]);
$this->modx->getSmarty($templatePath);
$this->modx->smarty->setCachePath('mgr/smarty/default/');
$this->modx->smarty->assign('_config',$this->modx->config);
$this->modx->smarty->assignByRef('modx',$this->modx);
Expand Down
5 changes: 1 addition & 4 deletions _build/test/Tests/Controllers/LoadControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use MODX\Revolution\modX;
use MODX\Revolution\MODxTestCase;
use MODX\Revolution\Processors\Resource\Create;
use MODX\Revolution\Smarty\modSmarty;

/**
* Tests related to the modManagerResponse and modManagerController classes for loading controllers
Expand All @@ -27,9 +26,7 @@ public function setUpFixtures()

/* load smarty template engine */
$templatePath = $this->modx->getOption('manager_path') . 'templates/default/';
$this->modx->getService('smarty', modSmarty::class, '', [
'template_dir' => $templatePath,
]);
$this->modx->getSmarty($templatePath);
$this->modx->smarty->setCachePath('mgr/smarty/default/');
$this->modx->smarty->assign('_config', $this->modx->config);
$this->modx->smarty->assignByRef('modx', $this->modx);
Expand Down
6 changes: 0 additions & 6 deletions core/src/Revolution/Filters/modOutputFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,9 +469,6 @@ public function filter(&$element)
break;
case 'fuzzydate':
/* displays a "fuzzy" date reference */
if (empty($this->modx->lexicon)) {
$this->modx->getService('lexicon', 'modLexicon');
}
$this->modx->lexicon->load('filters');
if (empty($m_val)) {
$m_val = '%b %e';
Expand All @@ -495,9 +492,6 @@ public function filter(&$element)
if (empty($output)) {
break;
}
if (empty($this->modx->lexicon)) {
$this->modx->getService('lexicon', 'modLexicon');
}
$this->modx->lexicon->load('filters');

$agoTS = [];
Expand Down
4 changes: 2 additions & 2 deletions core/src/Revolution/Mail/modPHPMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@
case modMail::MAIL_SMTP_SECURE :
$this->mailer->SMTPSecure = $this->attributes[$key];
break;
case modMail::MAIL_SMTP_AUTOTLS :

Check failure on line 116 in core/src/Revolution/Mail/modPHPMailer.php

View workflow job for this annotation

GitHub Actions / phpcs

There must be no space before the colon in a CASE statement
$this->mailer->SMTPAutoTLS= $this->attributes[$key];

Check failure on line 117 in core/src/Revolution/Mail/modPHPMailer.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected at least 1 space before "="; 0 found
break;
case modMail::MAIL_SMTP_SINGLE_TO :
$this->mailer->SingleTo = $this->attributes[$key];
Expand Down Expand Up @@ -241,7 +241,7 @@
}
$sent = $this->mailer->send();
} catch (Exception $e) {
$this->error = $this->modx->getService('error.modError');
$this->error = $this->modx->services->get('error');
$this->error->addError($e->getMessage());
}

Expand Down Expand Up @@ -302,7 +302,7 @@
try {
$this->mailer->addAttachment($file, $name, $encoding, $type);
} catch (Exception $e) {
$this->error = $this->modx->getService('error.modError');
$this->error = $this->modx->services->get('error');
$this->error->addError($e->getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private function setExampleData()
public function initialize()
{
/* simulate controller to allow controller methods in TV Input Properties controllers */
$this->modx->getService('smarty', 'MODX\Revolution\Smarty\modSmarty', '');
$this->modx->getSmarty($this->modx->getManagerTemplatePath());

$context = $this->getProperty('context');
if (empty($context)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getLanguageTopics()
public function initialize()
{
/* simulate controller to allow controller methods in TV Input Properties controllers */
$this->modx->getService('smarty', 'MODX\Revolution\Smarty\modSmarty', '');
$this->modx->getSmarty($this->modx->getManagerTemplatePath());

$context = $this->getProperty('context');
if (empty($context)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function getLanguageTopics()
public function initialize()
{
/* simulate controller to allow controller methods in TV Input Properties controllers */
$this->modx->getService('smarty', 'MODX\Revolution\Smarty\modSmarty', '');
$this->modx->getSmarty($this->modx->getManagerTemplatePath());
return true;
}

Expand Down
5 changes: 0 additions & 5 deletions core/src/Revolution/Processors/Resource/Reload.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ public function initialize()
{
$return = true;
$modx =& $this->modx;
if (!isset($modx->registry)) {
if (!$modx->getService('registry', 'registry.modRegistry')) {
$return = 'Could not instantiate registry service.';
}
}
$modx->registry->addRegister('resource_reload', 'registry.modDbRegister', ['directory' => 'resource_reload']);
$this->reg = $modx->registry->resource_reload;
if (!$this->reg->connect()) {
Expand Down
10 changes: 3 additions & 7 deletions core/src/Revolution/Processors/Security/User/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


use Exception;
use MODX\Revolution\Hashing\modHashing;
use MODX\Revolution\Processors\Model\CreateProcessor;
use MODX\Revolution\Processors\Processor;
use MODX\Revolution\modUser;
Expand All @@ -22,7 +21,6 @@
use MODX\Revolution\modX;
use MODX\Revolution\Registry\modRegister;
use MODX\Revolution\Registry\modRegistry;
use MODX\Revolution\Smarty\modSmarty;

/**
* Create a user
Expand Down Expand Up @@ -224,9 +222,7 @@ public function sendNotificationEmail() {
// Then restore previous placeholders to prevent any breakage
$this->modx->placeholders = $ph;

$this->modx->getService('smarty', modSmarty::class, '', [
'template_dir' => $this->modx->getOption('manager_path') . 'templates/' . $this->modx->getOption('manager_theme', null, 'default') . '/',
]);
$this->modx->getSmarty($this->modx->getManagerTemplatePath());
$this->modx->smarty->assign('_config', $this->modx->config);
$this->modx->smarty->assign('content', $message);
$message = $this->modx->smarty->fetch('email/default.tpl');
Expand All @@ -242,7 +238,7 @@ public function sendNotificationEmail() {
$activationHash = bin2hex(random_bytes(32));

/** @var modRegistry $registry */
$registry = $this->modx->getService('registry', 'registry.modRegistry');
$registry = $this->modx->registry;
/** @var modRegister $register */
$register = $registry->getRegister('user', 'registry.modDbRegister');
$register->connect();
Expand All @@ -263,7 +259,7 @@ public function sendNotificationEmail() {
// Then restore previous placeholders to prevent any breakage
$this->modx->placeholders = $ph;

$this->modx->getService('smarty', 'smarty.modSmarty', '', ['template_dir' => $this->modx->getOption('manager_path') . 'templates/default/']);
$this->modx->getSmarty($this->modx->getManagerTemplatePath());

$this->modx->smarty->assign('_config', $this->modx->config);
$this->modx->smarty->assign('content', $message, true);
Expand Down
4 changes: 2 additions & 2 deletions core/src/Revolution/Processors/Security/User/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ public function sendNotificationEmail() {
$activationHash = bin2hex(random_bytes(32));

/** @var modRegistry $registry */
$registry = $this->modx->getService('registry', 'registry.modRegistry');
$registry = $this->modx->registry;
/** @var modRegister $register */
$register = $registry->getRegister('user', 'registry.modDbRegister');
$register->connect();
Expand All @@ -342,7 +342,7 @@ public function sendNotificationEmail() {
// Then restore previous placeholders to prevent any breakage
$this->modx->placeholders = $ph;

$this->modx->getService('smarty', 'smarty.modSmarty', '', ['template_dir' => $this->modx->getOption('manager_path') . 'templates/default/']);
$this->modx->getSmarty($this->modx->getManagerTemplatePath());

$this->modx->smarty->assign('_config', $this->modx->config);
$this->modx->smarty->assign('content', $message, true);
Expand Down
1 change: 0 additions & 1 deletion core/src/Revolution/Processors/System/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public function process()
'remove_read' => true,
];

$this->modx->getService('registry', modRegistry::class);
$this->modx->registry->addRegister($register, $registerClass, ['directory' => $register]);
if (!$this->modx->registry->$register->connect()) {
return $this->failure($this->modx->lexicon('error'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public function initialize()
public function connectRegister($register)
{
$register_class = trim($this->getProperty('register_class', modFileRegister::class));
$this->modx->getService('registry', modRegistry::class);
$this->modx->registry->addRegister($register, $register_class, ['directory' => $register]);

$this->register = $this->modx->registry->$register;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public function initialize()
public function connectRegister($register)
{
$register_class = trim($this->getProperty('register_class', modFileRegister::class));
$this->modx->getService('registry', modRegistry::class);
$this->modx->registry->addRegister($register, $register_class, ['directory' => $register]);

$this->register = $this->modx->registry->$register;
Expand Down
2 changes: 1 addition & 1 deletion core/src/Revolution/Processors/System/RemoveLocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function checkPermissions()
public function process()
{
/** @var modRegistry $registry */
$registry = $this->modx->getService('registry', modRegistry::class);
$registry = $this->modx->registry;
if ($registry) {
$registry->addRegister('locks', modDbRegister::class, ['directory' => 'locks']);
$registry->locks->connect();
Expand Down
1 change: 0 additions & 1 deletion core/src/Revolution/Rest/modRest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public function __construct(modX &$modx, array $config = [])
'userAgent' => 'MODX RestClient/1.0.0',
'username' => null,
], $config);
$this->modx->getService('lexicon', 'modLexicon');
if ($this->modx->lexicon) {
$this->modx->lexicon->load('rest');
}
Expand Down
1 change: 0 additions & 1 deletion core/src/Revolution/Rest/modRestService.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public function __construct(modX &$modx, array $config = [])
'xmlRootNode' => 'response',
'sanitize' => false,
], $config);
$this->modx->getService('lexicon', 'modLexicon');
if ($this->modx->lexicon) {
$this->modx->lexicon->load('rest');
}
Expand Down
3 changes: 0 additions & 3 deletions core/src/Revolution/modLexiconTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ public function getContent(array $options = [])
if (isset($options['content'])) {
$this->_content = $options['content'];
} else {
if (!is_object($this->modx->lexicon)) {
$this->modx->getService('lexicon', 'modLexicon');
}
$topic = !empty($this->_properties['topic']) ? $this->_properties['topic'] : 'default';
$namespace = !empty($this->_properties['namespace']) ? $this->_properties['namespace'] : 'core';
$language = !empty($this->_properties['language']) ? $this->_properties['language'] : $this->modx->getOption('cultureKey',
Expand Down
9 changes: 1 addition & 8 deletions core/src/Revolution/modManagerRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

use MODX\Revolution\Error\modError;
use MODX\Revolution\Registry\modFileRegister;
use MODX\Revolution\Smarty\modSmarty;
use xPDO\Cache\xPDOCacheManager;
use xPDO\xPDO;

Expand Down Expand Up @@ -73,13 +72,7 @@ public function initialize()

/* load smarty template engine */
$theme = $this->modx->getOption('manager_theme', null, 'default');
$templatePath = $this->modx->getOption('manager_path') . 'templates/' . $theme . '/';
if (!file_exists($templatePath)) { /* fallback to default */
$templatePath = $this->modx->getOption('manager_path') . 'templates/default/';
}
$this->modx->getService('smarty', modSmarty::class, '', [
'template_dir' => $templatePath,
]);
$this->modx->getSmarty($this->modx->getManagerTemplatePath(), true);
/* load context-specific cache dir */
$this->modx->smarty->setCachePath($this->modx->context->get('key') . '/smarty/' . $theme . '/');

Expand Down
4 changes: 0 additions & 4 deletions core/src/Revolution/modMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ protected function getLanguageMenu()
*/
public function getSubMenus($start = '')
{
if (!$this->xpdo->lexicon) {
$this->xpdo->getService('lexicon', modLexicon::class);
}

$this->xpdo->lexicon->load('menu', 'en:menu', 'topmenu', 'en:topmenu');

$c = $this->xpdo->newQuery(modMenu::class);
Expand Down
2 changes: 1 addition & 1 deletion core/src/Revolution/modRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ public function loadErrorHandler($class = modError::class)
public function registerLogging(array $options = [])
{
if (isset($options['register']) && isset($options['topic'])) {
if ($this->modx->getService('registry', modRegistry::class)) {
if ($this->modx->registry) {
$register_class = isset($options['register_class']) ? $options['register_class'] : modFileRegister::class;
$register = $this->modx->registry->getRegister($options['register'], $register_class);
if ($register) {
Expand Down
7 changes: 3 additions & 4 deletions core/src/Revolution/modResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace MODX\Revolution;

use MODX\Revolution\Registry\modDbRegister;
use MODX\Revolution\Registry\modRegistry;
use MODX\Revolution\modX;
use PDO;
use ReflectionClass;
Expand Down Expand Up @@ -208,7 +207,7 @@ public static function filterPathSegment(&$xpdo, $segment, array $options = [])
$segment = html_entity_decode($segment, ENT_QUOTES, $charset);

/* prepare '&' replacement */
if ($xpdo instanceof modX && $xpdo->getService('lexicon', modLexicon::class) && $xpdo->lexicon('and')) {
if ($xpdo instanceof modX && $xpdo->lexicon && $xpdo->lexicon('and')) {
$ampersand = ' ' . $xpdo->lexicon('and') . ' ';
} else {
$ampersand = ' and ';
Expand Down Expand Up @@ -797,7 +796,7 @@ public function getLock()
{
$lock = 0;
if ($this->xpdo instanceof modX) {
if ($this->xpdo->getService('registry', modRegistry::class)) {
if ($this->xpdo->registry) {
$this->xpdo->registry->addRegister('locks', modDbRegister::class, ['directory' => 'locks']);
$this->xpdo->registry->locks->connect();
$this->xpdo->registry->locks->subscribe('/resource/' . md5($this->get('id')));
Expand Down Expand Up @@ -829,7 +828,7 @@ public function removeLock($user = 0)
}
$lockedBy = $this->getLock();
if (empty($lockedBy) || $lockedBy == $user) {
if ($this->xpdo->getService('registry', modRegistry::class)) {
if ($this->xpdo->registry) {
$this->xpdo->registry->addRegister('locks', modDbRegister::class, ['directory' => 'locks']);
$this->xpdo->registry->locks->connect();
$this->xpdo->registry->locks->subscribe('/resource/' . md5($this->get('id')));
Expand Down
7 changes: 2 additions & 5 deletions core/src/Revolution/modTemplateVar.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace MODX\Revolution;

use DirectoryIterator;
use MODX\Revolution\Smarty\modSmarty;
use MODX\Revolution\Sources\modFileMediaSource;
use MODX\Revolution\Sources\modFTPMediaSource;
use MODX\Revolution\Sources\modMediaSource;
Expand Down Expand Up @@ -384,10 +383,8 @@ public function renderInput($resource = null, $options = [])
$style = is_array($options) && isset($options['style']) ? strval($options['style']) : '';
$value = is_array($options) && isset($options['value']) ? strval($options['value']) : '';
}
if (!isset($this->xpdo->smarty)) {
$this->xpdo->getService('smarty', modSmarty::class, '', [
'template_dir' => $this->xpdo->getOption('manager_path') . 'templates/' . $this->xpdo->getOption('manager_theme', null, 'default') . '/'
]);
if ($this->xpdo instanceof modX) {
$this->xpdo->getSmarty($this->xpdo->getManagerTemplatePath());
}
$this->xpdo->smarty->assign('style', $style);
if (!isset($value) || empty($value)) {
Expand Down
Loading
Loading