Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1630 from christopheschwyzer/issue-1630
Browse files Browse the repository at this point in the history
Breaking: Update favicons
  • Loading branch information
Christophe Schwyzer committed Feb 11, 2015
2 parents 4051801 + 8eeb8a0 commit 20a07ec
Show file tree
Hide file tree
Showing 41 changed files with 124 additions and 33 deletions.
54 changes: 27 additions & 27 deletions layout/default/Layout/Abstract/default.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,38 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="{$render->getSite()->getName()|escape}">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="msapplication-TileColor" content="{block name='tileColor'}#3FB4FF{/block}">
<meta name="msapplication-TileImage" content="{resourceUrl path='img/mstile-144x144.png' type='layout'}">
<meta name="msapplication-TileColor" content="{block name='tileColor'}{lessVariable name='colorBrand'}{/block}">
<meta name="msapplication-TileImage" content="{resourceUrl path='img/meta/mstile-144x144.png' type='layout'}">
<meta name="msapplication-config" content="{resourceUrl path='browserconfig.xml' type='layout'}">
<meta name="theme-color" content="{block name='themeColor'}{lessVariable name='colorBrand'}{/block}">

<link rel="apple-touch-icon" sizes="57x57" href="{resourceUrl path='img/apple-touch-icon-57x57.png' type='layout'}">
<link rel="apple-touch-icon" sizes="60x60" href="{resourceUrl path='img/apple-touch-icon-60x60.png' type='layout'}">
<link rel="apple-touch-icon" sizes="72x72" href="{resourceUrl path='img/apple-touch-icon-72x72.png' type='layout'}">
<link rel="apple-touch-icon" sizes="76x76" href="{resourceUrl path='img/apple-touch-icon-76x76.png' type='layout'}">
<link rel="apple-touch-icon" sizes="114x114" href="{resourceUrl path='img/apple-touch-icon-114x114.png' type='layout'}">
<link rel="apple-touch-icon" sizes="120x120" href="{resourceUrl path='img/apple-touch-icon-120x120.png' type='layout'}">
<link rel="apple-touch-icon" sizes="144x144" href="{resourceUrl path='img/apple-touch-icon-144x144.png' type='layout'}">
<link rel="apple-touch-icon" sizes="152x152" href="{resourceUrl path='img/apple-touch-icon-152x152.png' type='layout'}">
<link rel="apple-touch-icon" sizes="180x180" href="{resourceUrl path='img/apple-touch-icon-180x180.png' type='layout'}">
<link rel="apple-touch-icon" sizes="57x57" href="{resourceUrl path='img/meta/apple-touch-icon-57x57.png' type='layout'}">
<link rel="apple-touch-icon" sizes="60x60" href="{resourceUrl path='img/meta/apple-touch-icon-60x60.png' type='layout'}">
<link rel="apple-touch-icon" sizes="72x72" href="{resourceUrl path='img/meta/apple-touch-icon-72x72.png' type='layout'}">
<link rel="apple-touch-icon" sizes="76x76" href="{resourceUrl path='img/meta/apple-touch-icon-76x76.png' type='layout'}">
<link rel="apple-touch-icon" sizes="114x114" href="{resourceUrl path='img/meta/apple-touch-icon-114x114.png' type='layout'}">
<link rel="apple-touch-icon" sizes="120x120" href="{resourceUrl path='img/meta/apple-touch-icon-120x120.png' type='layout'}">
<link rel="apple-touch-icon" sizes="144x144" href="{resourceUrl path='img/meta/apple-touch-icon-144x144.png' type='layout'}">
<link rel="apple-touch-icon" sizes="152x152" href="{resourceUrl path='img/meta/apple-touch-icon-152x152.png' type='layout'}">
<link rel="apple-touch-icon" sizes="180x180" href="{resourceUrl path='img/meta/apple-touch-icon-180x180.png' type='layout'}">

<link rel="apple-touch-startup-image" href="{resourceUrl path='img/apple-touch-startup-image-1242x2208.png' type='layout'}" media="(device-width: 414px) and (device-height: 736px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 3)">
<link rel="apple-touch-startup-image" href="{resourceUrl path='img/apple-touch-startup-image-750x1334.png' type='layout'}" media="(device-width: 375px) and (device-height: 667px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" href="{resourceUrl path='img/apple-touch-startup-image-1536x2008.png' type='layout'}" media="(device-width: 768px) and (device-height: 1024px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" href="{resourceUrl path='img/apple-touch-startup-image-1496x2048.png' type='layout'}" media="(device-width: 768px) and (device-height: 1024px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" href="{resourceUrl path='img/apple-touch-startup-image-768x1004.png' type='layout'}" media="(device-width: 768px) and (device-height: 1024px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 1)">
<link rel="apple-touch-startup-image" href="{resourceUrl path='img/apple-touch-startup-image-748x1024.png' type='layout'}" media="(device-width: 768px) and (device-height: 1024px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 1)">
<link rel="apple-touch-startup-image" href="{resourceUrl path='img/apple-touch-startup-image-640x1096.png' type='layout'}" media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" href="{resourceUrl path='img/apple-touch-startup-image-640x920.png' type='layout'}" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" href="{resourceUrl path='img/apple-touch-startup-image-320x460.png' type='layout'}" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 1)">
<link rel="apple-touch-startup-image" href="{resourceUrl path='img/meta/apple-touch-startup-image-1242x2208.png' type='layout'}" media="(device-width: 414px) and (device-height: 736px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 3)">
<link rel="apple-touch-startup-image" href="{resourceUrl path='img/meta/apple-touch-startup-image-750x1334.png' type='layout'}" media="(device-width: 375px) and (device-height: 667px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" href="{resourceUrl path='img/meta/apple-touch-startup-image-1536x2008.png' type='layout'}" media="(device-width: 768px) and (device-height: 1024px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" href="{resourceUrl path='img/meta/apple-touch-startup-image-1496x2048.png' type='layout'}" media="(device-width: 768px) and (device-height: 1024px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" href="{resourceUrl path='img/meta/apple-touch-startup-image-768x1004.png' type='layout'}" media="(device-width: 768px) and (device-height: 1024px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 1)">
<link rel="apple-touch-startup-image" href="{resourceUrl path='img/meta/apple-touch-startup-image-748x1024.png' type='layout'}" media="(device-width: 768px) and (device-height: 1024px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 1)">
<link rel="apple-touch-startup-image" href="{resourceUrl path='img/meta/apple-touch-startup-image-640x1096.png' type='layout'}" media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" href="{resourceUrl path='img/meta/apple-touch-startup-image-640x920.png' type='layout'}" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" href="{resourceUrl path='img/meta/apple-touch-startup-image-320x460.png' type='layout'}" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 1)">

<link rel="icon" type="image/png" href="{resourceUrl path='img/favicon-16x16.png' type='layout'}" sizes="16x16">
<link rel="icon" type="image/png" href="{resourceUrl path='img/favicon-32x32.png' type='layout'}" sizes="32x32">
<link rel="icon" type="image/png" href="{resourceUrl path='img/favicon-96x96.png' type='layout'}" sizes="96x96">
<link rel="icon" type="image/png" href="{resourceUrl path='img/favicon-160x160.png' type='layout'}" sizes="160x160">
<link rel="icon" type="image/png" href="{resourceUrl path='img/favicon-192x192.png' type='layout'}" sizes="192x192">
<link rel="icon" type="image/png" href="{resourceUrl path='img/meta/favicon-32x32.png' type='layout'}" sizes="32x32">
<link rel="icon" type="image/png" href="{resourceUrl path='img/meta/android-chrome-192x192.png' type='layout'}" sizes="192x192">
<link rel="icon" type="image/png" href="{resourceUrl path='img/meta/favicon-96x96.png' type='layout'}" sizes="96x96">
<link rel="icon" type="image/png" href="{resourceUrl path='img/meta/favicon-16x16.png' type='layout'}" sizes="16x16">

<!-- favicon.ico used for IE9: -->
<!--[if IE]><link rel="shortcut icon" href="{resourceUrl path='img/favicon.ico' type='layout'}"><![endif]-->
<link rel="manifest" href="{resourceUrl path='manifest.json' type='layout'}">
<link rel="shortcut icon" href="/img/meta/favicon.ico">

<link rel="alternate" href="{$renderDefault->getUrlPage($page, $page->getParams()->getParamsEncoded())|escape}" hreflang="x-default">
{foreach $languageList as $language}
Expand Down
10 changes: 5 additions & 5 deletions layout/default/resource/browserconfig.xml.smarty
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="{resourceUrl path='img/mstile-70x70.png' type='layout'}"/>
<square150x150logo src="{resourceUrl path='img/mstile-150x150.png' type='layout'}"/>
<square310x310logo src="{resourceUrl path='img/mstile-310x310.png' type='layout'}"/>
<wide310x150logo src="{resourceUrl path='img/mstile-310x150.png' type='layout'}"/>
<TileColor>{block name='tileColor'}#3FB4FF{/block}</TileColor>
<square70x70logo src="{resourceUrl path='img/meta/mstile-70x70.png' type='layout'}"/>
<square150x150logo src="{resourceUrl path='img/meta/mstile-150x150.png' type='layout'}"/>
<square310x310logo src="{resourceUrl path='img/meta/mstile-310x310.png' type='layout'}"/>
<wide310x150logo src="{resourceUrl path='img/meta/mstile-310x150.png' type='layout'}"/>
<TileColor>{block name='tileColor'}{lessVariable name='colorBrand'}{/block}</TileColor>
</tile>
</msapplication>
</browserconfig>
Binary file removed layout/default/resource/img/favicon-160x160.png
Binary file not shown.
Binary file removed layout/default/resource/img/favicon-192x192.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions layout/default/resource/manifest.json.smarty
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "{$render->getSite()->getName()}",
"icons": [
{
"src": "{resourceUrl path='img/meta/android-chrome-36x36.png' type='layout'}",
"sizes": "36x36",
"type": "image/png",
"density": "0.75"
},
{
"src": "{resourceUrl path='img/meta/android-chrome-48x48.png' type='layout'}",
"sizes": "48x48",
"type": "image/png",
"density": "1.0"
},
{
"src": "{resourceUrl path='img/meta/android-chrome-72x72.png' type='layout'}",
"sizes": "72x72",
"type": "image/png",
"density": "1.5"
},
{
"src": "{resourceUrl path='img/meta/android-chrome-96x96.png' type='layout'}",
"sizes": "96x96",
"type": "image/png",
"density": "2.0"
},
{
"src": "{resourceUrl path='img/meta/android-chrome-144x144.png' type='layout'}",
"sizes": "144x144",
"type": "image/png",
"density": "3.0"
},
{
"src": "{resourceUrl path='img/meta/android-chrome-192x192.png' type='layout'}",
"sizes": "192x192",
"type": "image/png",
"density": "4.0"
}
]
}
18 changes: 18 additions & 0 deletions library/CM/SmartyPlugins/function.lessVariable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

function smarty_function_lessVariable(array $params, Smarty_Internal_Template $template) {
/** @var CM_Frontend_Render $render */
$render = $template->smarty->getTemplateVars('render');
$variableName = (string) $params['name'];

$assetCss = new CM_Asset_Css($render);
$assetCss->addVariables();
$assetCss->add('foo:@' . $variableName);

$css = $assetCss->get(true);

if (!preg_match('/^foo:(.+);$/', $css, $matches)) {
throw new CM_Exception_Invalid('Cannot detect variable `' . $variableName . '` from CSS `' . $css . '`.');
}
return $matches[1];
}
2 changes: 1 addition & 1 deletion tests/library/CM/Http/Response/Resource/LayoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testRendering() {
/** @var CM_Http_Response_Resource_Layout $response */
$response = $this->getResponseResourceLayout($filePath);
$this->assertContains('Content-Type: application/xml', $response->getHeaders());
$this->assertTrue((boolean) preg_match('!src="http://cdn\.default\.dev/layout/.+?/img/mstile-70x70\.png"!', $response->getContent()));
$this->assertTrue((boolean) preg_match('!src="http://cdn\.default\.dev/layout/.+?/img/meta/mstile-70x70\.png"!', $response->getContent()));
$response->getRender()->getLayoutFile('resource/' . $filePath);
}

Expand Down
32 changes: 32 additions & 0 deletions tests/library/CM/SmartyPlugins/function.lessVariableTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

require_once CM_Util::getModulePath('CM') . 'library/CM/SmartyPlugins/function.lessVariable.php';

class smarty_function_lessVariableTest extends CMTest_TestCase {

/** @var Smarty_Internal_Template */
private $_template;

public function setUp() {
$smarty = new Smarty();
$render = new CM_Frontend_Render();
$this->_template = $smarty->createTemplate('string:');
$this->_template->assignGlobal('render', $render);
}

public function testColor() {
$this->assertSame('#2d78e2', smarty_function_lessVariable(['name' => 'colorBrand'], $this->_template));
}

public function testSize() {
$this->assertSame('14px', smarty_function_lessVariable(['name' => 'fontSize'], $this->_template));
}

/**
* @expectedException CM_Exception_Invalid
* @expectedExceptionMessage Cannot detect variable
*/
public function testInvalidName() {
smarty_function_lessVariable(['name' => 'helloworld'], $this->_template);
}
}

0 comments on commit 20a07ec

Please sign in to comment.