Changeset 2352
- Timestamp:
- 06/11/10 19:29:40 (13 years ago)
- Location:
- plugins/myfavicon
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/myfavicon/_admin.php
r459 r2352 27 27 } 28 28 29 public static function adminBlogPreferencesForm( &$core,&$settings=false)29 public static function adminBlogPreferencesForm($core,$settings=false) 30 30 { 31 31 # Dotclear <=2.0-beta7 compatibility … … 34 34 } 35 35 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 } 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>'. 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>'. 48 55 '<p><label>'.__('Favicon URL:').' '. 49 56 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>'.52 57 '</div></fieldset>'; 53 58 } 54 59 55 public static function adminBeforeBlogSettingsUpdate( &$settings)60 public static function adminBeforeBlogSettingsUpdate($settings) 56 61 { 57 $favicon_url = empty($_POST['favicon_ enable']) ? '' : $_POST['favicon_url'];58 $favicon_ie 6 = !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']; 59 64 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 } 64 77 } 65 78 } -
plugins/myfavicon/_define.php
r459 r2352 20 20 /* Description*/ "Add a customized favicon to your blog", 21 21 /* Author */ "Oleksandr Syenchuk", 22 /* Version */ '0. 5.1a',22 /* Version */ '0.6.1', 23 23 /* Permissions */ 'contentadmin' 24 24 ); -
plugins/myfavicon/_install.php
r459 r2352 25 25 26 26 # --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 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 } 35 42 if (version_compare(DC_VERSION,'2.0-rc1','<') 36 43 && file_exists(DC_TPL_CACHE.'/cbtpl') -
plugins/myfavicon/_public.php
r459 r2352 34 34 ); 35 35 36 public static function publicHeadContent( &$core)36 public static function publicHeadContent($core) 37 37 { 38 38 $res = self::faviconHTML($core->blog->settings); … … 42 42 } 43 43 44 public static function templateBeforeValue( &$core,$id,$attr)44 public static function templateBeforeValue($core,$id,$attr) 45 45 { 46 46 if ($id == 'include' && isset($attr['src']) && $attr['src'] == '_head.html') { … … 53 53 private static function faviconHTML(&$settings) 54 54 { 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)) { 59 64 return; 60 65 } 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 72 72 } 73 73 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. 76 89 '" href="'.html::escapeHTML($favicon_url).'" />'; 90 91 } 92 93 return $other_link.$ie_link; 77 94 } 78 95 } -
plugins/myfavicon/blog_pref.js
r398 r2352 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
r421 r2352 12 12 msgstr "Activer le favicon" 13 13 14 msgid "Enable Internet Explorer 6 compatibility"15 msgstr "Activer la compatibilité avec Internet Explorer 6"16 17 14 msgid "Favicon URL:" 18 15 msgstr "URL du favicon :" 19 16 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\"." 17 msgid "Favicon URL for IE:" 18 msgstr "URL du favicon pour IE :" 19 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.