Dotclear

Changeset 3149


Ignore:
Timestamp:
08/01/13 11:50:05 (10 years ago)
Author:
brol
Message:

version 0.6.1

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 compatibility 
    4  * iOS icon support 
    5  
    612008-04-21  Oleksandr Syenchuk  <sacha@xn--phnix-csa.net> 
    72 
  • 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\***************************************************************/ 
    1216if (!defined('DC_CONTEXT_ADMIN')) { return; } 
    1317 
     
    2731          # Dotclear <=2.0-beta7 compatibility 
    2832          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; 
    3039          } 
    3140          else { 
    32                $s = &$settings->myfavicon; 
     41               $favicon_url = $settings->myfavicon->favicon_url; 
     42               $favicon_ie_url = $settings->myfavicon->favicon_ie_url; 
    3343          } 
    34            
    35           $favicon_url = $s->url; 
    36           $favicon_iOS_url = $s->iOS_url; 
    37           $favicon_ie6 = $s->ie6; 
    3844           
    3945          echo 
    4046          '<fieldset><legend>Favicon</legend>'. 
    4147          '<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))). 
    4349               __('Enable favicon').'</label></p>'. 
    4450          '<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>'. 
    5055          '<p><label>'.__('Favicon URL:').' '. 
    5156               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>'. 
    5457          '</div></fieldset>'; 
    5558     } 
     
    5760     public static function adminBeforeBlogSettingsUpdate($settings) 
    5861     { 
    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']; 
    6264           
    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          } 
    6877     } 
    6978} 
  • 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\***************************************************************/ 
    1216if (!defined('DC_RC_PATH')) { return; } 
    1317 
    1418$this->registerModule( 
    1519     /* 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', 
    1923     /* Permissions */   'contentadmin' 
    2024); 
  • 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\***************************************************************/ 
    1216if (!defined('DC_CONTEXT_ADMIN')) { return; } 
    1317 
     
    2125 
    2226# --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  
     27if (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} 
     35else { 
     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} 
    3242if (version_compare(DC_VERSION,'2.0-rc1','<') 
    3343&& file_exists(DC_TPL_CACHE.'/cbtpl') 
     
    3949 
    4050$core->setVersion($label,$m_version); 
     51unset($label,$i_version,$m_version,$s,$si); 
    4152return true; 
    4253?> 
  • 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\***************************************************************/ 
    1216if (!defined('DC_RC_PATH')) { return; } 
    1317 
     
    3236     public static function publicHeadContent($core) 
    3337     { 
    34           $res = self::faviconHTML($core->blog->settings->myfavicon); 
     38          $res = self::faviconHTML($core->blog->settings); 
    3539          if (!empty($res)) { 
    3640               echo $res."\n"; 
     
    4751     } 
    4852 
    49      private static function faviconHTML($settings) 
     53     private static function faviconHTML(&$settings) 
    5054     { 
    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)) { 
    5664               return; 
    5765          } 
     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          } 
    5873           
    59           $res = ''; 
    60            
     74          $other_link = ''; 
    6175          if (!empty($favicon_url)) { 
    6276               $extension = files::getExtension($favicon_url); 
    63                $mimetype = files::getMimeType($favicon_url); 
    6477                
    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                    } 
    6783               } 
    6884               else { 
    69                     $rel = ($favicon_ie6 ? 'shortcut ' : '').'icon'; 
    7085                    $mimetype = self::$allowed_mimetypes[$extension]; 
    71                     $href = html::escapeHTML($favicon_url); 
    72                     $res .= '<link rel="'.$rel.'" type="'.$mimetype.'" href="'.$href.'" />'; 
    7386               } 
    74                $res .= "\n"; 
     87                
     88               $other_link = '<link rel="icon" type="'.$mimetype. 
     89               '" href="'.html::escapeHTML($favicon_url).'" />'; 
     90                
    7591          } 
    76            
    77           if (!empty($favicon_iOS_url)) { 
    78                $extension = files::getExtension($favicon_iOS_url); 
    79                $mimetype = files::getMimeType($favicon_iOS_url); 
    8092                
    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; 
    9394     } 
    9495} 
  • plugins/myfavicon/blog_pref.js

    r2766 r3149  
    11$(function() { 
    22     var favicon_url = ''; 
     3     var favicon_ie_url = ''; 
    34      
    45     // favicon_enable checkbox 
     
    89               $("#favicon_config").show(); 
    910               $("#favicon_url").val(favicon_url); 
     11               $("#favicon_ie_url").val(favicon_ie_url); 
    1012          } 
    1113          else { 
    1214               favicon_url = $("#favicon_url").val(); 
     15               favicon_ie_url = $("#favicon_url").val(); 
    1316               $("#favicon_url").val(''); 
     17               $("#favicon_ie_url").val(''); 
    1418               $("#favicon_config").hide(); 
    1519          } 
     
    1923          $("#favicon_config").hide(); 
    2024     } 
    21       
    22      // favicon_ie6 checkbox 
    23      $("#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      } 
    3625}); 
    3726 
  • plugins/myfavicon/locales/fr/main.po

    r3000 r3149  
    11# 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. 
    44 
    55msgid "" 
     
    1212msgstr "Activer le favicon" 
    1313 
    14 msgid "Enable Internet Explorer 6 compatibility" 
    15 msgstr "Activer la compatibilité avec Internet Explorer 6" 
     14msgid "Favicon URL:" 
     15msgstr "URL du favicon :" 
    1616 
    17 msgid "Favicon URL:" 
    18 msgstr "URL du favicon :" 
     17msgid "Favicon URL for IE:" 
     18msgstr "URL du favicon pour IE :" 
    1919 
    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”." 
     20msgid "Please note, IE compatibility works only with \".ico\" format." 
     21msgstr "Veuillez noter que la compatibilité IE fonctionne uniquement avec le format \".ico\"." 
Note: See TracChangeset for help on using the changeset viewer.

Sites map