$cloudID = \OC::$server->getUserSession()->getUser()->getCloudId();
$url = 'https://nextcloud.com/federation#' . $cloudID;
$logoPath = \OC::$server->getURLGenerator()->imagePath('core', 'logo-icon.svg');
-$theme = \OC::$server->getThemingDefaults();
+/** @var \OCP\Defaults $theme */
+$theme = \OC::$server->query(\OCP\Defaults::class);
$color = $theme->getColorPrimary();
$textColor = "#ffffff";
if(\OC::$server->getAppManager()->isEnabledForUser("theming")) {
use OCA\Files_Sharing\Controller\ExternalSharesController;
use OCA\Files_Sharing\Controller\ShareController;
use OCA\Files_Sharing\Middleware\SharingCheckMiddleware;
+use OCP\Defaults;
use OCP\Federation\ICloudIdManager;
use \OCP\IContainer;
use OCP\IServerContainer;
$federatedSharingApp->getFederatedShareProvider(),
$server->getEventDispatcher(),
$server->getL10N($c->query('AppName')),
- $server->getThemingDefaults()
+ $server->query(Defaults::class)
);
});
$container->registerService('ExternalSharesController', function (SimpleContainer $c) {
* @param FederatedShareProvider $federatedShareProvider
* @param EventDispatcherInterface $eventDispatcher
* @param IL10N $l10n
- * @param \OC_Defaults $defaults
+ * @param Defaults $defaults
*/
public function __construct($appName,
IRequest $request,
FederatedShareProvider $federatedShareProvider,
EventDispatcherInterface $eventDispatcher,
IL10N $l10n,
- \OC_Defaults $defaults) {
+ Defaults $defaults) {
parent::__construct($appName, $request);
$this->config = $config;
$this->federatedShareProvider,
$this->eventDispatcher,
$this->getMockBuilder('\OCP\IL10N')->getMock(),
- $this->getMockBuilder('\OC_Defaults')->getMock()
+ $this->getMockBuilder('\OCP\Defaults')->getMock()
);
use OC\Settings\Mailer\NewUserMailHelper;
use OCA\Provisioning_API\Middleware\ProvisioningApiMiddleware;
use OCP\AppFramework\App;
+use OCP\Defaults;
use OCP\Util;
class Application extends App {
$container->registerService(NewUserMailHelper::class, function(SimpleContainer $c) use ($server) {
return new NewUserMailHelper(
- $server->getThemingDefaults(),
+ $server->query(Defaults::class),
$server->getURLGenerator(),
$server->getL10N('settings'),
$server->getMailer(),
use OC\Settings\Mailer\NewUserMailHelper;
use \OC_Helper;
use OCP\AppFramework\Http\DataResponse;
-use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\OCS\OCSException;
use OCP\AppFramework\OCS\OCSForbiddenException;
use OCP\AppFramework\OCSController;
+use OCP\Defaults;
use OCP\Files\NotFoundException;
use OCP\IConfig;
use OCP\IGroup;
private $urlGenerator;
/** @var IMailer */
private $mailer;
- /** @var \OC_Defaults */
+ /** @var Defaults */
private $defaults;
/** @var IFactory */
private $l10nFactory;
* @param string $fromMailAddress
* @param IURLGenerator $urlGenerator
* @param IMailer $mailer
- * @param \OC_Defaults $defaults
+ * @param Defaults $defaults
* @param IFactory $l10nFactory
* @param NewUserMailHelper $newUserMailHelper
*/
$fromMailAddress,
IURLGenerator $urlGenerator,
IMailer $mailer,
- \OC_Defaults $defaults,
+ Defaults $defaults,
IFactory $l10nFactory,
NewUserMailHelper $newUserMailHelper) {
parent::__construct($appName, $request);
use OC\SubAdmin;
use OCA\Provisioning_API\Controller\UsersController;
use OCP\AppFramework\Http\DataResponse;
+use OCP\Defaults;
use OCP\IConfig;
use OCP\IGroup;
use OCP\ILogger;
-use OCP\AppFramework\Http\TemplateResponse;
use OCP\IL10N;
use OCP\IRequest;
use OCP\IURLGenerator;
private $urlGenerator;
/** @var IMailer|PHPUnit_Framework_MockObject_MockObject */
private $mailer;
- /** @var \OC_Defaults|PHPUnit_Framework_MockObject_MockObject */
+ /** @var Defaults|PHPUnit_Framework_MockObject_MockObject */
private $defaults;
/** @var IFactory|PHPUnit_Framework_MockObject_MockObject */
private $l10nFactory;
$this->accountManager = $this->createMock(AccountManager::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->mailer = $this->createMock(IMailer::class);
- $this->defaults = $this->createMock(\OC_Defaults::class);
+ $this->defaults = $this->createMock(Defaults::class);
$this->l10nFactory = $this->createMock(IFactory::class);
$this->newUserMailHelper = $this->createMock(NewUserMailHelper::class);
use OCA\Theming\IconBuilder;
use OCA\Theming\ImageManager;
-use OCA\Theming\ThemingDefaults;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\NotFoundResponse;
use OCP\AppFramework\Http\FileDisplayResponse;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\Defaults;
use OCP\Files\NotFoundException;
use OCP\IRequest;
use OCA\Theming\Util;
use OCP\IConfig;
class IconController extends Controller {
- /** @var ThemingDefaults */
+ /** @var Defaults */
private $themingDefaults;
/** @var Util */
private $util;
*
* @param string $appName
* @param IRequest $request
- * @param ThemingDefaults $themingDefaults
+ * @param Defaults $themingDefaults
* @param Util $util
* @param ITimeFactory $timeFactory
* @param IConfig $config
public function __construct(
$appName,
IRequest $request,
- ThemingDefaults $themingDefaults,
+ Defaults $themingDefaults,
Util $util,
ITimeFactory $timeFactory,
IConfig $config,
use OC\Files\SimpleFS\SimpleFile;
use OCA\Theming\ImageManager;
use OCP\AppFramework\Http;
-use OCP\AppFramework\Http\DataDisplayResponse;
use OCP\AppFramework\Http\NotFoundResponse;
+use OCP\Defaults;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\IConfig;
class IconControllerTest extends TestCase {
/** @var IRequest|\PHPUnit_Framework_MockObject_MockObject */
private $request;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Defaults|\PHPUnit_Framework_MockObject_MockObject */
private $themingDefaults;
/** @var Util */
private $util;
public function setUp() {
$this->request = $this->getMockBuilder('OCP\IRequest')->getMock();
- $this->themingDefaults = $this->getMockBuilder('OCA\Theming\ThemingDefaults')
+ $this->themingDefaults = $this->getMockBuilder('OCP\Defaults')
->disableOriginalConstructor()->getMock();
$this->util = $this->getMockBuilder('\OCA\Theming\Util')->disableOriginalConstructor()
->setMethods(['getAppImage', 'getAppIcon', 'elementColor'])->getMock();
namespace OC\Core;
-use OC\AppFramework\Utility\SimpleContainer;
use OC\Core\Controller\JsController;
-use OC\Core\Controller\OCJSController;
use OC\Security\IdentityProof\Manager;
-use OC\Server;
use OCP\AppFramework\App;
use OC\Core\Controller\CssController;
use OCP\AppFramework\Utility\ITimeFactory;
$container->query(ITimeFactory::class)
);
});
- $container->registerService(OCJSController::class, function () use ($container) {
- /** @var Server $server */
- $server = $container->getServer();
- return new OCJSController(
- $container->query('appName'),
- $server->getRequest(),
- $server->getL10N('core'),
- // This is required for the theming to overwrite the `OC_Defaults`, see
- // https://github.com/nextcloud/server/issues/3148
- $server->getThemingDefaults(),
- $server->getAppManager(),
- $server->getSession(),
- $server->getUserSession(),
- $server->getConfig(),
- $server->getGroupManager(),
- $server->getIniWrapper(),
- $server->getURLGenerator()
- );
- });
$container->registerService(JsController::class, function () use ($container) {
return new JsController(
$container->query('AppName'),
use InvalidArgumentException;
use OC\Setup;
use OC\SystemConfig;
+use OCP\Defaults;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
// validate the environment
$server = \OC::$server;
$setupHelper = new Setup($this->config, $server->getIniWrapper(),
- $server->getL10N('lib'), $server->getThemingDefaults(), $server->getLogger(),
+ $server->getL10N('lib'), $server->query(Defaults::class), $server->getLogger(),
$server->getSecureRandom());
$sysInfo = $setupHelper->getSystemInfo(true);
$errors = $sysInfo['errors'];
use \OCP\AppFramework\Controller;
use \OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\Defaults;
use OCP\Encryption\IManager;
use \OCP\IURLGenerator;
use \OCP\IRequest;
protected $urlGenerator;
/** @var IUserManager */
protected $userManager;
- /** @var \OC_Defaults */
+ /** @var Defaults */
protected $defaults;
/** @var IL10N */
protected $l10n;
* @param IRequest $request
* @param IURLGenerator $urlGenerator
* @param IUserManager $userManager
- * @param \OC_Defaults $defaults
+ * @param Defaults $defaults
* @param IL10N $l10n
* @param IConfig $config
* @param ISecureRandom $secureRandom
IRequest $request,
IURLGenerator $urlGenerator,
IUserManager $userManager,
- \OC_Defaults $defaults,
+ Defaults $defaults,
IL10N $l10n,
IConfig $config,
ISecureRandom $secureRandom,
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataDisplayResponse;
+use OCP\Defaults;
use OCP\IConfig;
use OCP\IGroupManager;
use OCP\IL10N;
* @param string $appName
* @param IRequest $request
* @param IL10N $l
- * @param \OC_Defaults $defaults
+ * @param Defaults $defaults
* @param IAppManager $appManager
* @param ISession $session
* @param IUserSession $userSession
public function __construct($appName,
IRequest $request,
IL10N $l,
- \OC_Defaults $defaults,
+ Defaults $defaults,
IAppManager $appManager,
ISession $session,
IUserSession $userSession,
<?php
/** @var $_ array */
/** @var $l \OCP\IL10N */
-/** @var $theme OC_Theme */
+/** @var $theme OCP\Defaults */
// @codeCoverageIgnoreStart
if(!isset($_)) {//also provide standalone error page
require_once '../../lib/base.php';
if (!$systemConfig->getValue('installed', false)) {
\OC::$server->getSession()->clear();
$setupHelper = new OC\Setup(\OC::$server->getSystemConfig(), \OC::$server->getIniWrapper(),
- \OC::$server->getL10N('lib'), \OC::$server->getThemingDefaults(), \OC::$server->getLogger(),
+ \OC::$server->getL10N('lib'), \OC::$server->query(\OCP\Defaults::class), \OC::$server->getLogger(),
\OC::$server->getSecureRandom());
$controller = new OC\Core\Controller\SetupController($setupHelper);
$controller->run($_POST);
namespace OC\Mail;
-use OCA\Theming\ThemingDefaults;
+use OCP\Defaults;
use OCP\IL10N;
use OCP\IURLGenerator;
* @package OC\Mail
*/
class EMailTemplate implements IEMailTemplate {
- /** @var ThemingDefaults */
+ /** @var Defaults */
protected $themingDefaults;
/** @var IURLGenerator */
protected $urlGenerator;
EOF;
/**
- * @param ThemingDefaults $themingDefaults
+ * @param Defaults $themingDefaults
* @param IURLGenerator $urlGenerator
* @param IL10N $l10n
*/
- public function __construct(ThemingDefaults $themingDefaults,
+ public function __construct(Defaults $themingDefaults,
IURLGenerator $urlGenerator,
IL10N $l10n) {
$this->themingDefaults = $themingDefaults;
}
$this->headerAdded = true;
- $logoUrl = $this->urlGenerator->getAbsoluteURL($this->themingDefaults->getLogo()) . '?v='. $this->themingDefaults->getCacheBusterCounter();
+ $logoUrl = $this->urlGenerator->getAbsoluteURL($this->themingDefaults->getLogo());
$this->htmlBody .= vsprintf($this->header, [$this->themingDefaults->getColorPrimary(), $logoUrl]);
}
namespace OC\Mail;
+use OCP\Defaults;
+
/**
* Interface IEMailTemplate
*
*
* <?php
*
- * $emailTemplate = new EMailTemplate($this->defaults);
+ * $emailTemplate = new EMailTemplate($this->defaults, $this->urlGenerator, $this->l10n);
*
* $emailTemplate->addHeader();
* $emailTemplate->addHeading('Welcome aboard');
*/
interface IEMailTemplate {
/**
- * @param \OCA\Theming\ThemingDefaults $themingDefaults
+ * @param Defaults $themingDefaults
* @param \OCP\IURLGenerator $urlGenerator
* @param \OCP\IL10N $l10n
*/
- public function __construct(\OCA\Theming\ThemingDefaults $themingDefaults,
+ public function __construct(Defaults $themingDefaults,
\OCP\IURLGenerator $urlGenerator,
\OCP\IL10N $l10n);
namespace OC\Mail;
+use OCP\Defaults;
use OCP\IConfig;
use OCP\Mail\IMailer;
use OCP\ILogger;
private $config;
/** @var ILogger */
private $logger;
- /** @var \OC_Defaults */
+ /** @var Defaults */
private $defaults;
/**
* @param IConfig $config
* @param ILogger $logger
- * @param \OC_Defaults $defaults
+ * @param Defaults $defaults
*/
function __construct(IConfig $config,
ILogger $logger,
- \OC_Defaults $defaults) {
+ Defaults $defaults) {
$this->config = $config;
$this->logger = $logger;
$this->defaults = $defaults;
use OC\Tagging\TagMapper;
use OCA\Theming\ThemingDefaults;
use OCP\App\IAppManager;
+use OCP\Defaults;
use OCP\Federation\ICloudIdManager;
use OCP\Authentication\LoginCredentials\IStore;
use OCP\ICacheFactory;
return new Mailer(
$c->getConfig(),
$c->getLogger(),
- $c->getThemingDefaults()
+ $c->query(Defaults::class)
);
});
$this->registerAlias('Mailer', \OCP\Mail\IMailer::class);
$this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class);
$this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class);
+ $this->registerService(Defaults::class, function (Server $c) {
+ return new Defaults(
+ $c->getThemingDefaults()
+ );
+ });
+ $this->registerAlias('Defaults', \OCP\Defaults::class);
+
$this->registerService(\OCP\ISession::class, function(SimpleContainer $c) {
return $c->query(\OCP\IUserSession::class)->getSession();
});
use bantu\IniGetWrapper\IniGetWrapper;
use Exception;
-use OCP\IConfig;
+use OCP\Defaults;
use OCP\IL10N;
use OCP\ILogger;
use OCP\Security\ISecureRandom;
protected $iniWrapper;
/** @var IL10N */
protected $l10n;
- /** @var \OC_Defaults */
+ /** @var Defaults */
protected $defaults;
/** @var ILogger */
protected $logger;
/**
* @param SystemConfig $config
* @param IniGetWrapper $iniWrapper
- * @param \OC_Defaults $defaults
+ * @param Defaults $defaults
+ * @param ILogger $logger
+ * @param ISecureRandom $random
*/
function __construct(SystemConfig $config,
IniGetWrapper $iniWrapper,
IL10N $l10n,
- \OC_Defaults $defaults,
+ Defaults $defaults,
ILogger $logger,
ISecureRandom $random
) {
}
$setupHelper = new \OC\Setup($config, \OC::$server->getIniWrapper(),
- \OC::$server->getL10N('lib'), \OC::$server->getThemingDefaults(), \OC::$server->getLogger(),
+ \OC::$server->getL10N('lib'), \OC::$server->query(Defaults::class), \OC::$server->getLogger(),
\OC::$server->getSecureRandom());
$htaccessContent = file_get_contents($setupHelper->pathToHtaccess());
namespace OC\Share;
-use DateTime;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUser;
namespace OC\Template;
+use OCP\Defaults;
+
class Base {
private $template; // The template
private $vars; // Vars
/** @var \OCP\IL10N */
private $l10n;
- /** @var \OC_Defaults */
+ /** @var Defaults */
private $theme;
/**
* @param string $template
* @param string $requestToken
* @param \OCP\IL10N $l10n
- * @param \OC_Defaults $theme
+ * @param Defaults $theme
*/
public function __construct($template, $requestToken, $l10n, $theme ) {
$this->vars = array();
use bantu\IniGetWrapper\IniGetWrapper;
use OCP\App\IAppManager;
+use OCP\Defaults;
use OCP\IConfig;
use OCP\IGroupManager;
use OCP\IL10N;
/** @var IL10N */
private $l;
- /** @var \OC_Defaults */
+ /** @var Defaults */
private $defaults;
/** @var IAppManager */
/**
* @param IL10N $l
- * @param \OC_Defaults $defaults
+ * @param Defaults $defaults
* @param IAppManager $appManager
* @param ISession $session
* @param IUser|null $currentUser
* @param IURLGenerator $urlGenerator
*/
public function __construct(IL10N $l,
- \OC_Defaults $defaults,
+ Defaults $defaults,
IAppManager $appManager,
ISession $session,
$currentUser,
use OC\Template\JSCombiner;
use OC\Template\JSConfigHelper;
use OC\Template\SCSSCacher;
+use OCP\Defaults;
class TemplateLayout extends \OC_Template {
if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) {
$jsConfigHelper = new JSConfigHelper(
\OC::$server->getL10N('core'),
- \OC::$server->getThemingDefaults(),
+ \OC::$server->query(Defaults::class),
\OC::$server->getAppManager(),
\OC::$server->getSession(),
\OC::$server->getUserSession()->getUser(),
private $defaultSlogan;
private $defaultLogoClaim;
private $defaultColorPrimary;
+ private $defaultLogoUrl;
+ private $defaultCacheBuster;
function __construct() {
$this->l = \OC::$server->getL10N('lib');
$this->defaultSlogan = $this->l->t('a safe home for all your data');
$this->defaultLogoClaim = '';
$this->defaultColorPrimary = '#0082c9';
+ $this->defaultLogoUrl = \OC::$server->getURLGenerator()->imagePath('core','logo.svg');
+ $this->defaultLogoUrl .= '?v=' . hash('sha1', implode('.', \OCP\Util::getVersion()));
$themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php';
if (file_exists($themePath)) {
/**
* @param string $key
+ * @return string URL to doc with key
*/
public function buildDocLinkToKey($key) {
if ($this->themeExist('buildDocLinkToKey')) {
public function shouldReplaceIcons() {
return false;
}
+
+ /**
+ * Themed logo url
+ *
+ * @return string
+ */
+ public function getLogo() {
+ if ($this->themeExist('getLogo')) {
+ return $this->theme->getLogo();
+ }
+
+ return $this->defaultLogoUrl;
+ }
}
$parts = explode('/', $app); // fix translation when app is something like core/lostpassword
$l10n = \OC::$server->getL10N($parts[0]);
- $themeDefaults = \OC::$server->getThemingDefaults();
+ /** @var \OCP\Defaults $themeDefaults */
+ $themeDefaults = \OC::$server->query(\OCP\Defaults::class);
list($path, $template) = $this->findTemplate($theme, $app, $name);
$webServerRestart = false;
$setup = new \OC\Setup($config, \OC::$server->getIniWrapper(), \OC::$server->getL10N('lib'),
- \OC::$server->getThemingDefaults(), \OC::$server->getLogger(), \OC::$server->getSecureRandom());
+ \OC::$server->query(\OCP\Defaults::class), \OC::$server->getLogger(), \OC::$server->getSecureRandom());
$urlGenerator = \OC::$server->getURLGenerator();
/**
* \OC_Defaults instance to retrieve the defaults
- * @return string
* @since 6.0.0
*/
private $defaults;
* actual defaults
* @since 6.0.0
*/
- function __construct() {
- $this->defaults = \OC::$server->getThemingDefaults();
+ function __construct(\OC_Defaults $defaults = null) {
+ if ($defaults === null) {
+ $defaults = \OC::$server->getThemingDefaults();
+ }
+ $this->defaults = $defaults;
}
/**
public function getiTunesAppId() {
return $this->defaults->getiTunesAppId();
}
+
+ /**
+ * Themed logo url
+ *
+ * @return string
+ * @since 12.0.0
+ */
+ public function getLogo() {
+ return $this->defaults->getLogo();
+ }
+
+ /**
+ * Returns primary color
+ * @return string
+ * @since 12.0.0
+ */
+ public function getColorPrimary() {
+ return $this->defaults->getColorPrimary();
+ }
+
+ /**
+ * @param string $key
+ * @return string URL to doc with key
+ * @since 12.0.0
+ */
+ public function buildDocLinkToKey($key) {
+ return $this->defaults->buildDocLinkToKey($key);
+ }
+
+ /**
+ * Returns the title
+ * @return string title
+ * @since 12.0.0
+ */
+ public function getTitle() {
+ return $this->defaults->getTitle();
+ }
}
use OC\AppFramework\Utility\TimeFactory;
use OC\Authentication\Token\IProvider;
use OC\Server;
-use OC\ServerContainer;
use OC\Settings\Mailer\NewUserMailHelper;
use OC\Settings\Middleware\SubadminMiddleware;
-use OCA\Theming\ThemingDefaults;
use OCP\AppFramework\App;
+use OCP\Defaults;
use OCP\IContainer;
use OCP\Settings\IManager;
use OCP\Util;
$container->registerService(NewUserMailHelper::class, function (IContainer $c) {
/** @var Server $server */
$server = $c->query('ServerContainer');
+ /** @var Defaults $defaults */
+ $defaults = $server->query(Defaults::class);
return new NewUserMailHelper(
- $server->getThemingDefaults(),
+ $defaults,
$server->getURLGenerator(),
$server->getL10N('settings'),
$server->getMailer(),
use OC\Mail\EMailTemplate;
use OC\Mail\IEMailTemplate;
-use OCA\Theming\ThemingDefaults;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\Defaults;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Security\ISecureRandom;
class NewUserMailHelper {
- /** @var ThemingDefaults */
+ /** @var Defaults */
private $themingDefaults;
/** @var IURLGenerator */
private $urlGenerator;
private $fromAddress;
/**
- * @param ThemingDefaults $themingDefaults
+ * @param Defaults $themingDefaults
* @param IURLGenerator $urlGenerator
* @param IL10N $l10n
* @param IMailer $mailer
* @param ICrypto $crypto
* @param string $fromAddress
*/
- public function __construct(ThemingDefaults $themingDefaults,
+ public function __construct(Defaults $themingDefaults,
IURLGenerator $urlGenerator,
IL10N $l10n,
IMailer $mailer,
*/
/** @var $_ mixed[]|\OCP\IURLGenerator[] */
-/** @var \OC_Defaults $theme */
+/** @var \OCP\Defaults $theme */
?>
<div id="app-navigation">
use OC\Core\Controller\LostController;
use OC\Mail\Message;
-use OCA\Encryption\Exceptions\PrivateKeyMissingException;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\Defaults;
use OCP\Encryption\IManager;
use OCP\IConfig;
use OCP\IL10N;
private $l10n;
/** @var IUserManager | PHPUnit_Framework_MockObject_MockObject */
private $userManager;
- /** @var \OC_Defaults */
+ /** @var Defaults */
private $defaults;
/** @var IConfig | PHPUnit_Framework_MockObject_MockObject */
private $config;
->will($this->returnCallback(function($text, $parameters = array()) {
return vsprintf($text, $parameters);
}));
- $this->defaults = $this->getMockBuilder('\OC_Defaults')
+ $this->defaults = $this->getMockBuilder('\OCP\Defaults')
->disableOriginalConstructor()->getMock();
$this->userManager = $this->getMockBuilder('\OCP\IUserManager')
->disableOriginalConstructor()->getMock();
private $config;
/** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
private $logger;
- /** @var \OC_Defaults|\PHPUnit_Framework_MockObject_MockObject */
- private $defaults;
/** @var IMailer|\PHPUnit_Framework_MockObject_MockObject */
private $mailer;
/** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
namespace Tests\Settings\Mailer;
-use OC\Mail\EMailTemplate;
use OC\Mail\IEMailTemplate;
use OC\Mail\Message;
use OC\Settings\Mailer\NewUserMailHelper;
-use OCA\Theming\ThemingDefaults;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\Defaults;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
use Test\TestCase;
class NewUserMailHelperTest extends TestCase {
- /** @var ThemingDefaults|\PHPUnit_Framework_MockObject_MockObject */
- private $themingDefaults;
+ /** @var Defaults|\PHPUnit_Framework_MockObject_MockObject */
+ private $defaults;
/** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
private $urlGenerator;
/** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
public function setUp() {
parent::setUp();
- $this->themingDefaults = $this->createMock(ThemingDefaults::class);
+ $this->defaults = $this->createMock(Defaults::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->l10n = $this->createMock(IL10N::class);
$this->mailer = $this->createMock(IMailer::class);
}));
$this->newUserMailHelper = new NewUserMailHelper(
- $this->themingDefaults,
+ $this->defaults,
$this->urlGenerator,
$this->l10n,
$this->mailer,
->expects($this->at(5))
->method('getUID')
->willReturn('john');
- $this->themingDefaults
+ $this->defaults
->expects($this->at(0))
->method('getName')
->willReturn('TestCloud');
<tbody>
<tr style="padding:0;text-align:left;vertical-align:top">
<center data-parsed="" style="min-width:580px;width:100%">
- <img class="logo float-center" src="?v=" alt="logo" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
+ <img class="logo float-center" src="" alt="logo" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
</center>
</tr>
</tbody>
->expects($this->at(1))
->method('getUID')
->willReturn('john');
- $this->themingDefaults
+ $this->defaults
->expects($this->any())
->method('getName')
->willReturn('TestCloud');
<tbody>
<tr style="padding:0;text-align:left;vertical-align:top">
<center data-parsed="" style="min-width:580px;width:100%">
- <img class="logo float-center" src="?v=" alt="logo" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
+ <img class="logo float-center" src="" alt="logo" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
</center>
</tr>
</tbody>
->expects($this->at(0))
->method('setTo')
->with(['recipient@example.com' => 'John Doe']);
- $this->themingDefaults
+ $this->defaults
->expects($this->exactly(2))
->method('getName')
->willReturn('TestCloud');
<tbody>
<tr style="padding:0;text-align:left;vertical-align:top">
<center data-parsed="" style="min-width:580px;width:100%">
- <img class="logo float-center" src="https://example.org/img/logo-mail-header.png?v=48" alt="logo" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
+ <img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="logo" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
</center>
</tr>
</tbody>
<tbody>
<tr style="padding:0;text-align:left;vertical-align:top">
<center data-parsed="" style="min-width:580px;width:100%">
- <img class="logo float-center" src="https://example.org/img/logo-mail-header.png?v=48" alt="logo" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
+ <img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="logo" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto">
</center>
</tr>
</tbody>
use OC\Accounts\AccountManager;
-use OC\Mail\Mailer;
use OCP\IUser;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\TestCase;
namespace Test\Mail;
use OC\Mail\EMailTemplate;
-use OCA\Theming\ThemingDefaults;
+use OCP\Defaults;
use OCP\IL10N;
use OCP\IURLGenerator;
use Test\TestCase;
class EMailTemplateTest extends TestCase {
- /** @var ThemingDefaults|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Defaults|\PHPUnit_Framework_MockObject_MockObject */
private $defaults;
/** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
private $urlGenerator;
public function setUp() {
parent::setUp();
- $this->defaults = $this->createMock(ThemingDefaults::class);
+ $this->defaults = $this->createMock(Defaults::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->l10n = $this->createMock(IL10N::class);
->expects($this->any())
->method('getLogo')
->willReturn('/img/logo-mail-header.png');
- $this->defaults
- ->expects($this->any())
- ->method('getCacheBusterCounter')
- ->willReturn('48');
$this->urlGenerator
->expects($this->once())
->method('getAbsoluteURL')
->expects($this->any())
->method('getLogo')
->willReturn('/img/logo-mail-header.png');
- $this->defaults
- ->expects($this->any())
- ->method('getCacheBusterCounter')
- ->willReturn('48');
$this->urlGenerator
->expects($this->once())
->method('getAbsoluteURL')
namespace Test\Mail;
use OC\Mail\Mailer;
+use OCP\Defaults;
use OCP\IConfig;
-use OC_Defaults;
use OCP\ILogger;
use Test\TestCase;
class MailerTest extends TestCase {
/** @var IConfig */
private $config;
- /** @var OC_Defaults */
+ /** @var Defaults */
private $defaults;
/** @var ILogger */
private $logger;
$this->config = $this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()->getMock();
- $this->defaults = $this->getMockBuilder('\OC_Defaults')
+ $this->defaults = $this->getMockBuilder('\OCP\Defaults')
->disableOriginalConstructor()->getMock();
$this->logger = $this->getMockBuilder('\OCP\ILogger')
->disableOriginalConstructor()->getMock();
use bantu\IniGetWrapper\IniGetWrapper;
use OC\SystemConfig;
+use OCP\Defaults;
use OCP\IL10N;
use OCP\ILogger;
use OCP\Security\ISecureRandom;
class SetupTest extends \Test\TestCase {
- /** @var SystemConfig | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var SystemConfig|\PHPUnit_Framework_MockObject_MockObject */
protected $config;
- /** @var \bantu\IniGetWrapper\IniGetWrapper | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \bantu\IniGetWrapper\IniGetWrapper|\PHPUnit_Framework_MockObject_MockObject */
private $iniWrapper;
- /** @var \OCP\IL10N | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\IL10N|\PHPUnit_Framework_MockObject_MockObject */
private $l10n;
- /** @var \OC_Defaults | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var Defaults|\PHPUnit_Framework_MockObject_MockObject */
private $defaults;
- /** @var \OC\Setup | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OC\Setup|\PHPUnit_Framework_MockObject_MockObject */
protected $setupClass;
- /** @var \OCP\ILogger | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\ILogger|\PHPUnit_Framework_MockObject_MockObject */
protected $logger;
- /** @var \OCP\Security\ISecureRandom | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\Security\ISecureRandom|\PHPUnit_Framework_MockObject_MockObject */
protected $random;
protected function setUp() {
$this->config = $this->createMock(SystemConfig::class);
$this->iniWrapper = $this->createMock(IniGetWrapper::class);
$this->l10n = $this->createMock(IL10N::class);
- $this->defaults = $this->createMock(\OC_Defaults::class);
+ $this->defaults = $this->createMock(Defaults::class);
$this->logger = $this->createMock(ILogger::class);
$this->random = $this->createMock(ISecureRandom::class);
$this->setupClass = $this->getMockBuilder('\OC\Setup')
protected $urlGenerator;
/** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
protected $config;
- /** @var \OC_Defaults|\PHPUnit_Framework_MockObject_MockObject */
- protected $defaults;
/** @var SCSSCacher */
protected $scssCacher;
/** @var ICache|\PHPUnit_Framework_MockObject_MockObject */
use DOMDocument;
use DOMNode;
-use OC\Cache\CappedMemoryCache;
use OC\Command\QueueBus;
use OC\Files\Filesystem;
use OC\Template\Base;
-use OC_Defaults;
use OCP\DB\QueryBuilder\IQueryBuilder;
+use OCP\Defaults;
use OCP\IDBConnection;
use OCP\IL10N;
use OCP\Security\ISecureRandom;
require_once __DIR__.'/../../lib/private/legacy/template/functions.php';
$requestToken = 12345;
- $theme = new OC_Defaults();
- /** @var IL10N | \PHPUnit_Framework_MockObject_MockObject $l10n */
+ /** @var Defaults|\PHPUnit_Framework_MockObject_MockObject $l10n */
+ $theme = $this->getMockBuilder('\OCP\Defaults')
+ ->disableOriginalConstructor()->getMock();
+ $theme->expects($this->any())
+ ->method('getName')
+ ->willReturn('Nextcloud');
+ /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject $l10n */
$l10n = $this->getMockBuilder('\OCP\IL10N')
->disableOriginalConstructor()->getMock();
$l10n