Dotclear

Changeset 2352


Ignore:
Timestamp:
06/11/10 19:29:40 (13 years ago)
Author:
Aeness
Message:

we can have favicon for IE and the others navigators at the same time.
DC2.2beta1 compatibility

Location:
plugins/myfavicon
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • plugins/myfavicon/_admin.php

    r459 r2352  
    2727     } 
    2828      
    29      public static function adminBlogPreferencesForm(&$core,&$settings=false) 
     29     public static function adminBlogPreferencesForm($core,$settings=false) 
    3030     { 
    3131          # Dotclear <=2.0-beta7 compatibility 
     
    3434          } 
    3535           
    36           $favicon_url = $settings->favicon_url; 
    37           $favicon_ie6 = $settings->favicon_ie6; 
     36          if (version_compare(DC_VERSION,'2.2-beta1','<')) { 
     37               $favicon_url = $settings->favicon_url; 
     38               $favicon_ie_url = $settings->favicon_ie_url; 
     39          } 
     40          else { 
     41               $favicon_url = $settings->myfavicon->favicon_url; 
     42               $favicon_ie_url = $settings->myfavicon->favicon_ie_url; 
     43          } 
    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>'. 
     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>'. 
    4855          '<p><label>'.__('Favicon URL:').' '. 
    4956               form::field('favicon_url',40,255,html::escapeHTML($favicon_url)).'</label></p>'. 
    50           '<p id="favicon_warn" class="form-note warn">' 
    51                .__('Please note, IE6 compatibility works only with ".ico" format.').'</p>'. 
    5257          '</div></fieldset>'; 
    5358     } 
    5459      
    55      public static function adminBeforeBlogSettingsUpdate(&$settings) 
     60     public static function adminBeforeBlogSettingsUpdate($settings) 
    5661     { 
    57           $favicon_url = empty($_POST['favicon_enable']) ? '' : $_POST['favicon_url']; 
    58           $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']; 
    5964           
    60           $settings->setNameSpace('myfavicon'); 
    61           $settings->put('favicon_url',$favicon_url); 
    62           $settings->put('favicon_ie6',$favicon_ie6); 
    63           $settings->setNameSpace('system'); 
     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          } 
    6477     } 
    6578} 
  • plugins/myfavicon/_define.php

    r459 r2352  
    2020     /* Description*/    "Add a customized favicon to your blog", 
    2121     /* Author */        "Oleksandr Syenchuk", 
    22      /* Version */       '0.5.1a', 
     22     /* Version */       '0.6.1', 
    2323     /* Permissions */   'contentadmin' 
    2424); 
  • plugins/myfavicon/_install.php

    r459 r2352  
    2525 
    2626# --INSTALL AND UPDATE PROCEDURES-- 
    27  
    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_ie6',false,'boolean','Internet Explorer 6 compatibility',false); 
    34  
     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} 
    3542if (version_compare(DC_VERSION,'2.0-rc1','<') 
    3643&& file_exists(DC_TPL_CACHE.'/cbtpl') 
  • plugins/myfavicon/_public.php

    r459 r2352  
    3434     ); 
    3535      
    36      public static function publicHeadContent(&$core) 
     36     public static function publicHeadContent($core) 
    3737     { 
    3838          $res = self::faviconHTML($core->blog->settings); 
     
    4242     } 
    4343      
    44      public static function templateBeforeValue(&$core,$id,$attr) 
     44     public static function templateBeforeValue($core,$id,$attr) 
    4545     { 
    4646          if ($id == 'include' && isset($attr['src']) && $attr['src'] == '_head.html') { 
     
    5353     private static function faviconHTML(&$settings) 
    5454     { 
    55           $favicon_url = $settings->favicon_url; 
    56           $favicon_ie6 = $settings->favicon_ie6; 
    57            
    58           if (empty($favicon_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)) { 
    5964               return; 
    6065          } 
    61            
    62           $extension = files::getExtension($favicon_url); 
    63            
    64           if (!isset(self::$allowed_mimetypes[$extension])) { 
    65                $mimetype = files::getMimeType($favicon_url); 
    66                if (!in_array($mimetype,self::$allowed_mimetypes)) { 
    67                     return '<!-- Bad favicon MIME type. -->'."\n"; 
    68                } 
    69           } 
    70           else { 
    71                $mimetype = self::$allowed_mimetypes[$extension]; 
     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                
    7272          } 
    7373           
    74           $rel = ($favicon_ie6 ? 'shortcut ' : '').'icon'; 
    75           return '<link rel="'.$rel.'" type="'.$mimetype. 
     74          $other_link = ''; 
     75          if (!empty($favicon_url)) { 
     76               $extension = files::getExtension($favicon_url); 
     77                
     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                    } 
     83               } 
     84               else { 
     85                    $mimetype = self::$allowed_mimetypes[$extension]; 
     86               } 
     87                
     88               $other_link = '<link rel="icon" type="'.$mimetype. 
    7689               '" href="'.html::escapeHTML($favicon_url).'" />'; 
     90                
     91          } 
     92                
     93          return $other_link.$ie_link; 
    7794     } 
    7895} 
  • plugins/myfavicon/blog_pref.js

    r398 r2352  
    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

    r421 r2352  
    1212msgstr "Activer le favicon" 
    1313 
    14 msgid "Enable Internet Explorer 6 compatibility" 
    15 msgstr "Activer la compatibilité avec Internet Explorer 6" 
    16  
    1714msgid "Favicon URL:" 
    1815msgstr "URL du favicon :" 
    1916 
    20 msgid "Please note, IE6 compatibility works only with \".ico\" format." 
    21 msgstr "Veuillez noter que la compatibilité IE6 fonctionne uniquement avec le format \".ico\"." 
     17msgid "Favicon URL for IE:" 
     18msgstr "URL du favicon pour IE :" 
     19 
     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