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
18 changes: 14 additions & 4 deletions apps/qubit/modules/settings/actions/headerAction.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ protected function addField($name)
break;

case 'favicon':
$this->form->setWidget($name, new sfWidgetFormInputFile([], ['accept' => '.ico']));
$this->form->setValidator($name, new sfValidatorFile(['mime_types' => ['image/x-icon', 'image/vnd.microsoft.icon']]));
$this->form->setWidget($name, new sfWidgetFormInputFile([], ['accept' => '.ico,.svg']));
$this->form->setValidator($name, new sfValidatorFile(['mime_types' => ['image/x-icon', 'image/vnd.microsoft.icon', 'image/svg+xml']]));

break;

Expand Down Expand Up @@ -102,10 +102,14 @@ protected function processField($field)
case 'favicon':
$faviconFile = $this->form->getValue('favicon');

$faviconImgPath = $this->staticDir.DIRECTORY_SEPARATOR.'favicon.ico';

if (null !== $faviconFile) {
$extension = strtolower($faviconFile->getOriginalExtension());
$faviconImgPath = $this->staticDir.DIRECTORY_SEPARATOR.'favicon'.('.svg' === $extension ? '.svg' : '.ico');
$faviconFile->save($faviconImgPath);

if ('.ico' === $extension) {
@unlink($this->staticDir.DIRECTORY_SEPARATOR.'favicon.svg');
}
}

break;
Expand Down Expand Up @@ -147,12 +151,18 @@ protected function restoreDefaultLogo()
protected function restoreDefaultFavicon()
{
$faviconImgPath = $this->staticDir.DIRECTORY_SEPARATOR.'favicon.ico';
$faviconSvgPath = $this->staticDir.DIRECTORY_SEPARATOR.'favicon.svg';
$defaultAtoMFaviconPath = sfConfig::get('sf_web_dir').DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'default_atom_favicon.ico';
$defaultAtoMFaviconSvgPath = sfConfig::get('sf_web_dir').DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'default_atom_favicon.svg';

if (file_exists($defaultAtoMFaviconPath)) {
copy($defaultAtoMFaviconPath, $faviconImgPath);
} else {
$this->updateMessage = $this->i18n->__('Default favicon not found.');
}

if (file_exists($defaultAtoMFaviconSvgPath)) {
copy($defaultAtoMFaviconSvgPath, $faviconSvgPath);
}
}
}
2 changes: 1 addition & 1 deletion apps/qubit/modules/settings/templates/headerSuccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<div id="favicon-collapse" class="accordion-collapse collapse show" aria-labelledby="sending-heading">

<div class="alert alert-info m-3 mb-0">
<p><?php echo __('The favicon file must be in ICO file format.'); ?></p>
<p><?php echo __('The favicon file must be in ICO or SVG file format.'); ?></p>
<p><?php echo __('Note that browser cache may need to be cleared after uploading a new favicon.'); ?></p>
</div>

Expand Down
1 change: 1 addition & 0 deletions config/error/error.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<html>
<head>
<title>Error</title>
<link rel="icon" type="image/svg+xml" href="<?php echo $path; ?>/favicon.svg"/>
<link rel="stylesheet" type="text/css" href="<?php echo $path; ?>/plugins/arDominionPlugin/css/main.css"/>
</head>
<body class="yui-skin-sam admin error">
Expand Down
1 change: 1 addition & 0 deletions config/error/errorB5_webpack.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Error</title>
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<% for (var css in htmlWebpackPlugin.files.css) { %>
<link href="<%= htmlWebpackPlugin.files.css[css] %>" rel="stylesheet">
<% } %>
Expand Down
1 change: 1 addition & 0 deletions config/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ The goal is to provide an easy-to-use, flexible toolkit that complies with open
<file name="js//*" role="data"/>
<file name="ead.dtd" role="data"/>
<file name="favicon.ico" role="data"/>
<file name="favicon.svg" role="data"/>
<file name="robots.txt" role="data"/>
</contents>
<dependencies>
Expand Down
1 change: 1 addition & 0 deletions config/unavailable.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<html>
<head>
<title>AtoM</title>
<link rel="icon" type="image/svg+xml" href="<?php echo $path; ?>/favicon.svg"/>
<link rel="stylesheet" type="text/css" href="<?php echo $path; ?>/plugins/arDominionPlugin/css/main.css"/>
</head>
<body class="yui-skin-sam admin unavailable">
Expand Down
1 change: 1 addition & 0 deletions config/unavailableB5_webpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>AtoM</title>
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<% for (var css in htmlWebpackPlugin.files.css) { %>
<link href="<%= htmlWebpackPlugin.files.css[css] %>" rel="stylesheet">
<% } %>
Expand Down
3 changes: 3 additions & 0 deletions favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions images/default_atom_favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions plugins/arDominionB5Plugin/templates/_favicon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
$staticAlias = rtrim(sfConfig::get('app_static_alias'), '/');
$staticPath = sfConfig::get('app_static_path');

$customSvgPath = $staticPath.DIRECTORY_SEPARATOR.'favicon.svg';
$customIcoPath = $staticPath.DIRECTORY_SEPARATOR.'favicon.ico';

if (file_exists($customSvgPath)) {
$faviconHref = $staticAlias.'/favicon.svg';
$faviconType = 'image/svg+xml';
} elseif (file_exists($customIcoPath)) {
$faviconHref = $staticAlias.'/favicon.ico';
$faviconType = 'image/x-icon';
} else {
$faviconHref = public_path('favicon.svg');
$faviconType = 'image/svg+xml';
}
?>
<link rel="icon" type="<?php echo $faviconType; ?>" href="<?php echo htmlspecialchars($faviconHref, ENT_QUOTES, 'UTF-8'); ?>">
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php include_title(); ?>
<?php echo get_component('default', 'tagManager', ['code' => 'script']); ?>
<?php if (file_exists($staticPath = sfConfig::get('app_static_path').DIRECTORY_SEPARATOR.'favicon.ico')) { ?>
<?php $faviconLoc = sfConfig::get('app_static_alias').'/favicon.ico'; ?>
<?php } else { ?>
<?php $faviconLoc = public_path('favicon.ico'); ?>
<?php } ?>
<link rel="shortcut icon" href="<?php echo $faviconLoc; ?>">
<?php echo get_partial('favicon'); ?>
<%= htmlWebpackPlugin.tags.headTags %>
<?php echo get_component_slot('css'); ?>
</head>
Expand Down
Loading