Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into PR-webdev
Browse files Browse the repository at this point in the history
  • Loading branch information
zanilee committed Mar 22, 2016
2 parents 8408586 + 4858f04 commit 24d27aa
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 6 deletions.
2 changes: 2 additions & 0 deletions app/code/Magento/Authorization/Model/ResourceModel/Rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ public function saveRel(\Magento\Authorization\Model\Rules $rule)

$connection->insert($this->getMainTable(), $insertData);
} else {
/** Give basic admin permissions to any admin */
$postedResources[] = \Magento\Backend\App\AbstractAction::ADMIN_RESOURCE;
$acl = $this->_aclBuilder->getAcl();
/** @var $resource \Magento\Framework\Acl\AclResource */
foreach ($acl->getResources() as $resourceId) {
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Persistent/Model/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public function deleteByCustomerId($customerId, $clearCookie = true)
*/
public function removePersistentCookie()
{
$cookieMetadata = $this->_cookieMetadataFactory->createCookieMetadata()
$cookieMetadata = $this->_cookieMetadataFactory->createSensitiveCookieMetadata()
->setPath($this->sessionConfig->getCookiePath());
$this->_cookieManager->deleteCookie(self::COOKIE_NAME, $cookieMetadata);
return $this;
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Persistent/Test/Unit/Model/SessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ public function testAfterDeleteCommit()
{
$cookiePath = 'some_path';
$this->configMock->expects($this->once())->method('getCookiePath')->will($this->returnValue($cookiePath));
$cookieMetadataMock = $this->getMockBuilder('Magento\Framework\Stdlib\Cookie\CookieMetadata')
$cookieMetadataMock = $this->getMockBuilder('Magento\Framework\Stdlib\Cookie\SensitiveCookieMetadata')
->disableOriginalConstructor()
->getMock();
$cookieMetadataMock->expects($this->once())
->method('setPath')
->with($cookiePath)
->will($this->returnSelf());
$this->cookieMetadataFactoryMock->expects($this->once())
->method('createCookieMetadata')
->method('createSensitiveCookieMetadata')
->will($this->returnValue($cookieMetadataMock));
$this->cookieManagerMock->expects(
$this->once()
Expand Down
41 changes: 41 additions & 0 deletions app/code/Magento/Theme/Setup/InstallData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Theme\Setup;

use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Theme\Model\Theme\Registration;

/**
* Register themes
*/
class InstallData implements InstallDataInterface
{
/**
* @var Registration
*/
private $themeRegistration;

/**
* Initialize dependencies
*
* @param Registration $themeRegistration
*/
public function __construct(Registration $themeRegistration)
{
$this->themeRegistration = $themeRegistration;
}

/**
* {@inheritdoc}
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$this->themeRegistration->register();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"string with placeholder in double quotes ""%1""","string with placeholder in double quotes ""%1"""
"string with 'single quotes'","string with 'single quotes'"
"string with placeholder in single quotes '%1'","string with placeholder in single quotes '%1'"
"string with escaped \"double quotes\"","string with escaped \"double quotes\""
"string with placeholder in escaped double quotes \"%1\"","string with placeholder in escaped double quotes \"%1\""
"string with escaped ""double quotes""","string with escaped ""double quotes"""
"string with placeholder in escaped double quotes ""%1""","string with placeholder in escaped double quotes ""%1"""
"string that\'s got an unclosed single quote in it","string that\'s got an unclosed single quote in it"
2 changes: 2 additions & 0 deletions lib/internal/Magento/Framework/Phrase/Renderer/Translate.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public function __construct(
public function render(array $source, array $arguments)
{
$text = end($source);
/* If phrase contains escaped double quote then use translation for phrase with non-escaped quote */
$text = str_replace('\"', '"', $text);

try {
$data = $this->translator->getData();
Expand Down
5 changes: 4 additions & 1 deletion setup/src/Magento/Setup/Module/I18n/Dictionary/Phrase.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,14 @@ public function getCompiledTranslation()
private function getCompiledString($string)
{
$encloseQuote = $this->getQuote() == Phrase::QUOTE_DOUBLE ? Phrase::QUOTE_DOUBLE : Phrase::QUOTE_SINGLE;
//find all occurrences of ' and ", with no \ before it.
/* Find all occurrences of ' and ", with no \ before it for concatenation */
preg_match_all('/[^\\\\]' . $encloseQuote . '|' . $encloseQuote . '[^\\\\]/', $string, $matches);
if (count($matches[0])) {
$string = preg_replace('/([^\\\\])' . $encloseQuote . ' ?\. ?' . $encloseQuote . '/', '$1', $string);
}
/* Remove all occurrences of escaped double quote because it is not desirable in csv file.
Translation for such phrases will use translation for phrase without escaped quote. */
$string = str_replace('\"', '"', $string);
return $string;
}
}

0 comments on commit 24d27aa

Please sign in to comment.