Changeset 3149
- Timestamp:
- 08/01/13 11:50:05 (10 years ago)
- Location:
- plugins/myfavicon
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/myfavicon/CHANGELOG
r3000 r3149 1 2011-02-25 Alex Pirine <alex pirine.fr>2 3 * Dotclear 2.2.2 compatibility4 * iOS icon support5 6 1 2008-04-21 Oleksandr Syenchuk <sacha@xn--phnix-csa.net> 7 2 -
plugins/myfavicon/_admin.php
r3000 r3149 1 <?php 2 # -- BEGIN LICENSE BLOCK ---------------------------------- 3 # This file is part of My Favicon, a plugin for Dotclear. 4 # 5 # Copyright (c) 2008,2011 Alex Pirine <alex pirine.fr> 6 # 7 # Licensed under the GPL version 2.0 license. 8 # A copy is available in LICENSE file or at 9 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 10 # -- END LICENSE BLOCK ------------------------------------ 11 1 <?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ 2 /***************************************************************\ 3 * This is 'My Favicon', a plugin for Dotclear 2 * 4 * * 5 * Copyright (c) 2008 * 6 * Oleksandr Syenchuk and contributors. * 7 * * 8 * This is an open source software, distributed under the GNU * 9 * General Public License (version 2) terms and conditions. * 10 * * 11 * You should have received a copy of the GNU General Public * 12 * License along with 'My Favicon' (see COPYING.txt); * 13 * if not, write to the Free Software Foundation, Inc., * 14 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 15 \***************************************************************/ 12 16 if (!defined('DC_CONTEXT_ADMIN')) { return; } 13 17 … … 27 31 # Dotclear <=2.0-beta7 compatibility 28 32 if ($settings === false) { 29 $s = &$core->blog->settings->myfavicon; 33 $settings = $core->blog->settings; 34 } 35 36 if (version_compare(DC_VERSION,'2.2-beta1','<')) { 37 $favicon_url = $settings->favicon_url; 38 $favicon_ie_url = $settings->favicon_ie_url; 30 39 } 31 40 else { 32 $s = &$settings->myfavicon; 41 $favicon_url = $settings->myfavicon->favicon_url; 42 $favicon_ie_url = $settings->myfavicon->favicon_ie_url; 33 43 } 34 35 $favicon_url = $s->url;36 $favicon_iOS_url = $s->iOS_url;37 $favicon_ie6 = $s->ie6;38 44 39 45 echo 40 46 '<fieldset><legend>Favicon</legend>'. 41 47 '<p><label class="classic">'. 42 form::checkbox('favicon_enable','1', !empty($favicon_url)).48 form::checkbox('favicon_enable','1',(!empty($favicon_url) || !empty($favicon_ie_url))). 43 49 __('Enable favicon').'</label></p>'. 44 50 '<div id="favicon_config">'. 45 '<p><label class="classic">'. 46 form::checkbox('favicon_ie6','1',$favicon_ie6). 47 __('Enable Internet Explorer 6 compatibility').'</label></p>'. 48 '<p id="favicon_warn" class="form-note warn">' 49 .__('Please note, IE6 compatibility works only with the “.ico” format.').'</p>'. 51 '<p><label>'.__('Favicon URL for IE:').' '. 52 form::field('favicon_ie_url',40,255,html::escapeHTML($favicon_ie_url)).'</label></p>'. 53 '<p class="form-note warn">' 54 .__('Please note, IE compatibility works only with ".ico" format.').'</p>'. 50 55 '<p><label>'.__('Favicon URL:').' '. 51 56 form::field('favicon_url',40,255,html::escapeHTML($favicon_url)).'</label></p>'. 52 '<p><label>'.__('Apple iOS icon URL:').' '.53 form::field('favicon_iOS_url',40,255,html::escapeHTML($favicon_iOS_url)).'</label></p>'.54 57 '</div></fieldset>'; 55 58 } … … 57 60 public static function adminBeforeBlogSettingsUpdate($settings) 58 61 { 59 $favicon_url = empty($_POST['favicon_enable']) ? '' : $_POST['favicon_url']; 60 $favicon_iOS_url = empty($_POST['favicon_enable']) ? '' : $_POST['favicon_iOS_url']; 61 $favicon_ie6 = !empty($_POST['favicon_ie6']); 62 $favicon_url = empty($_POST['favicon_url']) ? '' : $_POST['favicon_url']; 63 $favicon_ie_url = empty($_POST['favicon_ie_url']) ? '' : $_POST['favicon_ie_url']; 62 64 63 $s = &$settings->myfavicon; 64 65 $s->put('url',$favicon_url); 66 $s->put('iOS_url',$favicon_iOS_url); 67 $s->put('ie6',$favicon_ie6); 65 if (version_compare(DC_VERSION,'2.2-beta1','<')) { 66 $settings->setNameSpace('myfavicon'); 67 $settings->put('favicon_url',$favicon_url); 68 $settings->put('favicon_ie_url',$favicon_ie_url); 69 $settings->setNameSpace('system'); 70 } 71 else { 72 $settings->addNameSpace('myfavicon'); 73 $settings->myfavicon->put('favicon_url',$favicon_url); 74 $settings->myfavicon->put('favicon_ie_url',$favicon_ie_url); 75 $settings->addNameSpace('system'); 76 } 68 77 } 69 78 } -
plugins/myfavicon/_define.php
r3000 r3149 1 <?php 2 # -- BEGIN LICENSE BLOCK ---------------------------------- 3 # This file is part of My Favicon, a plugin for Dotclear. 4 # 5 # Copyright (c) 2008,2011 Alex Pirine <alex pirine.fr> 6 # 7 # Licensed under the GPL version 2.0 license. 8 # A copy is available in LICENSE file or at 9 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 10 # -- END LICENSE BLOCK ------------------------------------ 11 1 <?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ 2 /***************************************************************\ 3 * This is 'My Favicon', a plugin for Dotclear 2 * 4 * * 5 * Copyright (c) 2008 * 6 * Oleksandr Syenchuk and contributors. * 7 * * 8 * This is an open source software, distributed under the GNU * 9 * General Public License (version 2) terms and conditions. * 10 * * 11 * You should have received a copy of the GNU General Public * 12 * License along with 'My Favicon' (see COPYING.txt); * 13 * if not, write to the Free Software Foundation, Inc., * 14 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 15 \***************************************************************/ 12 16 if (!defined('DC_RC_PATH')) { return; } 13 17 14 18 $this->registerModule( 15 19 /* Name */ "My Favicon", 16 /* Description*/ " Set up your own favicon!",17 /* Author */ " Alex Pirine",18 /* Version */ ' 2011.02.1',20 /* Description*/ "Add a customized favicon to your blog", 21 /* Author */ "Oleksandr Syenchuk", 22 /* Version */ '0.6.1', 19 23 /* Permissions */ 'contentadmin' 20 24 ); -
plugins/myfavicon/_install.php
r3000 r3149 1 <?php 2 # -- BEGIN LICENSE BLOCK ---------------------------------- 3 # This file is part of My Favicon, a plugin for Dotclear. 4 # 5 # Copyright (c) 2008,2011 Alex Pirine <alex pirine.fr> 6 # 7 # Licensed under the GPL version 2.0 license. 8 # A copy is available in LICENSE file or at 9 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 10 # -- END LICENSE BLOCK ------------------------------------ 11 1 <?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ 2 /***************************************************************\ 3 * This is 'My Favicon', a plugin for Dotclear 2 * 4 * * 5 * Copyright (c) 2008 * 6 * Oleksandr Syenchuk and contributors. * 7 * * 8 * This is an open source software, distributed under the GNU * 9 * General Public License (version 2) terms and conditions. * 10 * * 11 * You should have received a copy of the GNU General Public * 12 * License along with 'My Favicon' (see COPYING.txt); * 13 * if not, write to the Free Software Foundation, Inc., * 14 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 15 \***************************************************************/ 12 16 if (!defined('DC_CONTEXT_ADMIN')) { return; } 13 17 … … 21 25 22 26 # --INSTALL AND UPDATE PROCEDURES-- 23 24 $core->blog->settings->addNamespace('myfavicon'); 25 $s = &$core->blog->settings->myfavicon; 26 27 # New install / update 28 $s->put('url','','string','Favicon URL',false); 29 $s->put('iOS_url','','string','iOS icon URL'); 30 $s->put('ie6',false,'boolean','Internet Explorer 6 compatibility',false); 31 27 if (version_compare(DC_VERSION,'2.2-beta1','<')) { 28 $sets = &$core->blog->settings; 29 $sets->setNamespace(strtolower($label)); 30 31 # New install / update 32 $sets->put('favicon_url','','string','Favicon URL',false); 33 $sets->put('favicon_ie_url','','string','Favicon URL Internet Explorer',false); 34 } 35 else { 36 $core->blog->settings->addNamespace(strtolower($label)); 37 38 # New install / update 39 $core->blog->settings->myfavicon->put('favicon_url','','string','Favicon URL',false); 40 $core->blog->settings->myfavicon->put('favicon_ie_url','','string','Favicon URL Internet Explorer',false); 41 } 32 42 if (version_compare(DC_VERSION,'2.0-rc1','<') 33 43 && file_exists(DC_TPL_CACHE.'/cbtpl') … … 39 49 40 50 $core->setVersion($label,$m_version); 51 unset($label,$i_version,$m_version,$s,$si); 41 52 return true; 42 53 ?> -
plugins/myfavicon/_public.php
r3000 r3149 1 <?php 2 # -- BEGIN LICENSE BLOCK ---------------------------------- 3 # This file is part of My Favicon, a plugin for Dotclear. 4 # 5 # Copyright (c) 2008,2011 Alex Pirine <alex pirine.fr> 6 # 7 # Licensed under the GPL version 2.0 license. 8 # A copy is available in LICENSE file or at 9 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 10 # -- END LICENSE BLOCK ------------------------------------ 11 1 <?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ 2 /***************************************************************\ 3 * This is 'My Favicon', a plugin for Dotclear 2 * 4 * * 5 * Copyright (c) 2008 * 6 * Oleksandr Syenchuk and contributors. * 7 * * 8 * This is an open source software, distributed under the GNU * 9 * General Public License (version 2) terms and conditions. * 10 * * 11 * You should have received a copy of the GNU General Public * 12 * License along with 'My Favicon' (see COPYING.txt); * 13 * if not, write to the Free Software Foundation, Inc., * 14 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 15 \***************************************************************/ 12 16 if (!defined('DC_RC_PATH')) { return; } 13 17 … … 32 36 public static function publicHeadContent($core) 33 37 { 34 $res = self::faviconHTML($core->blog->settings ->myfavicon);38 $res = self::faviconHTML($core->blog->settings); 35 39 if (!empty($res)) { 36 40 echo $res."\n"; … … 47 51 } 48 52 49 private static function faviconHTML( $settings)53 private static function faviconHTML(&$settings) 50 54 { 51 $favicon_url = $settings->url; 52 $favicon_iOS_url = $settings->iOS_url; 53 $favicon_ie6 = $settings->ie6; 54 55 if (empty($favicon_url) && empty($favicon_iOS_url)) { 55 if (version_compare(DC_VERSION,'2.2-beta1','<')) { 56 $favicon_url = $settings->favicon_url; 57 $favicon_ie_url = $settings->favicon_ie_url; 58 } 59 else { 60 $favicon_url = $settings->myfavicon->favicon_url; 61 $favicon_ie_url = $settings->myfavicon->favicon_ie_url; 62 } 63 if (empty($favicon_url) && empty($favicon_ie_url)) { 56 64 return; 57 65 } 66 67 $ie_link = ''; 68 if ($favicon_ie_url != null) { 69 $ie_link = ' 70 <!--[if IE]><link rel="shortcut icon" type="image/x-icon" href="'.html::escapeHTML($favicon_ie_url).'" /><![endif]-->'; 71 72 } 58 73 59 $res = ''; 60 74 $other_link = ''; 61 75 if (!empty($favicon_url)) { 62 76 $extension = files::getExtension($favicon_url); 63 $mimetype = files::getMimeType($favicon_url);64 77 65 if (!isset(self::$allowed_mimetypes[$extension]) && !in_array($mimetype,self::$allowed_mimetypes)) { 66 $res .= '<!-- Bad favicon MIME type: must be an image -->'."\n"; 78 if (!isset(self::$allowed_mimetypes[$extension])) { 79 $mimetype = files::getMimeType($favicon_url); 80 if (!in_array($mimetype,self::$allowed_mimetypes)) { 81 return '<!-- Bad favicon MIME type. -->'."\n"; 82 } 67 83 } 68 84 else { 69 $rel = ($favicon_ie6 ? 'shortcut ' : '').'icon';70 85 $mimetype = self::$allowed_mimetypes[$extension]; 71 $href = html::escapeHTML($favicon_url);72 $res .= '<link rel="'.$rel.'" type="'.$mimetype.'" href="'.$href.'" />';73 86 } 74 $res .= "\n"; 87 88 $other_link = '<link rel="icon" type="'.$mimetype. 89 '" href="'.html::escapeHTML($favicon_url).'" />'; 90 75 91 } 76 77 if (!empty($favicon_iOS_url)) {78 $extension = files::getExtension($favicon_iOS_url);79 $mimetype = files::getMimeType($favicon_iOS_url);80 92 81 if ($extension != 'png' && $mimetype != 'image/png') { 82 $res .= '<!-- Bad iOS MIME type: must be a PNG image -->'."\n"; 83 } 84 else { 85 $rel = 'apple-touch-icon'; 86 $href = html::escapeHTML($favicon_iOS_url); 87 $res .= '<link rel="'.$rel.'" href="'.$href.'" />'; 88 } 89 $res .= "\n"; 90 } 91 92 return $res; 93 return $other_link.$ie_link; 93 94 } 94 95 } -
plugins/myfavicon/blog_pref.js
r2766 r3149 1 1 $(function() { 2 2 var favicon_url = ''; 3 var favicon_ie_url = ''; 3 4 4 5 // favicon_enable checkbox … … 8 9 $("#favicon_config").show(); 9 10 $("#favicon_url").val(favicon_url); 11 $("#favicon_ie_url").val(favicon_ie_url); 10 12 } 11 13 else { 12 14 favicon_url = $("#favicon_url").val(); 15 favicon_ie_url = $("#favicon_url").val(); 13 16 $("#favicon_url").val(''); 17 $("#favicon_ie_url").val(''); 14 18 $("#favicon_config").hide(); 15 19 } … … 19 23 $("#favicon_config").hide(); 20 24 } 21 22 // favicon_ie6 checkbox23 $("#favicon_ie6").change(function()24 {25 if (this.checked) {26 $("#favicon_warn").show();27 }28 else {29 $("#favicon_warn").hide();30 }31 });32 33 if (!document.getElementById('favicon_ie6').checked) {34 $("#favicon_warn").hide();35 }36 25 }); 37 26 -
plugins/myfavicon/locales/fr/main.po
r3000 r3149 1 1 # French translation of My Favicon 2 # Copyright (c) 2008 ,2011.3 # Alex Pirine <alex pirine.fr>, 2011.2 # Copyright (c) 2008. 3 # Oleksandr Syenchuk <sacha@xn--phnix-csa.net>, 2008. 4 4 5 5 msgid "" … … 12 12 msgstr "Activer le favicon" 13 13 14 msgid " Enable Internet Explorer 6 compatibility"15 msgstr " Activer la compatibilité avec Internet Explorer 6"14 msgid "Favicon URL:" 15 msgstr "URL du favicon :" 16 16 17 msgid "Favicon URL :"18 msgstr "URL du favicon 17 msgid "Favicon URL for IE:" 18 msgstr "URL du favicon pour IE :" 19 19 20 msgid "Apple iOS icon URL:" 21 msgstr "URL d'une icône Apple iOS :" 22 23 msgid "Please note, IE6 compatibility works only with the “.ico” format." 24 msgstr "Veuillez noter que la compatibilité IE6 fonctionne uniquement avec le format “.ico”." 20 msgid "Please note, IE compatibility works only with \".ico\" format." 21 msgstr "Veuillez noter que la compatibilité IE fonctionne uniquement avec le format \".ico\"."
Note: See TracChangeset
for help on using the changeset viewer.