Changeset 407 for plugins/dcom
- Timestamp:
- 04/13/08 10:46:42 (15 years ago)
- Location:
- plugins/dcom
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/dcom/_admin.php
r271 r407 1 <?php 1 <?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ 2 2 /***************************************************************\ 3 3 * This is 'Dcom', a plugin for Dotclear 2 * 4 4 * * 5 * Copyright (c) 2007 5 * Copyright (c) 2007-2008 * 6 6 * Oleksandr Syenchuk, Jean-François Michaud and contributors.* 7 7 * * … … 30 30 __('Title:'),$p['title']); 31 31 $w->lastcomments->setting('c_limit', 32 __('Comments limit (leave empty to disable limit):'),$p['c_limit']);32 __('Comments limit:'),$p['c_limit']); 33 33 $w->lastcomments->setting('t_limit', 34 34 __('Title lenght limit:'),$p['t_limit']); -
plugins/dcom/_define.php
r271 r407 3 3 * This is 'Dcom', a plugin for Dotclear 2 * 4 4 * * 5 * Copyright (c) 2007 5 * Copyright (c) 2007-2008 * 6 6 * Oleksandr Syenchuk, Jean-François Michaud and contributors.* 7 7 * * … … 16 16 17 17 $this->registerModule( 18 /* Name */ "Dcom", 19 /* Description*/ "Last comments with more options", 20 /* Author */ "Oleksandr Syenchuk", 21 /* Version */ '0.7.3', 22 /* Permissions */ 'usage,contentadmin', 23 /* Priority */ 50 18 /* Name */ 'Dcom', 19 /* Description*/ 'Last comments with more options', 20 /* Author */ 'Oleksandr Syenchuk', 21 /* Version */ '0.8', 22 /* Permissions */ 'admin' 24 23 ); 25 24 ?> -
plugins/dcom/_prepend.php
r271 r407 1 <?php 1 <?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ 2 2 /***************************************************************\ 3 3 * This is 'Dcom', a plugin for Dotclear 2 * 4 4 * * 5 * Copyright (c) 2007 5 * Copyright (c) 2007-2008 * 6 6 * Oleksandr Syenchuk, Jean-François Michaud and contributors.* 7 7 * * … … 22 22 23 23 if (!is_array($p)) { 24 $p = array(); 24 $r = array(); 25 } else { 26 $r = $p; 25 27 } 26 28 27 if (!isset($p['homeonly'])) { 28 $p['homeonly'] = false; 29 } 30 else { 31 $p['homeonly'] = (bool) $p['homeonly']; 32 } 33 34 if (!isset($p['c_limit'])) { 35 $p['c_limit'] = 10; 36 } 37 else { 38 $p['c_limit'] = abs((integer) $p['c_limit']); 39 } 40 41 if (!isset($p['t_limit'])) { 42 $p['t_limit'] = 20; 43 } 44 else { 45 $p['t_limit'] = abs((integer) $p['t_limit']); 46 } 47 48 if (!isset($p['co_limit'])) { 49 $p['co_limit'] = 80; 50 } 51 else { 52 $p['co_limit'] = abs((integer) $p['co_limit']); 53 } 54 55 if (!isset($p['title'])) { 56 $p['title'] = __('Last comments'); 57 } 58 59 if (empty($p['stringformat'])) { 60 $p['stringformat'] = 61 '<a href="%5$s" title="%4$s">%2$s - %3$s<br/>%1$s</a>'; 62 } 63 64 if (empty($p['dateformat'])) { 65 $p['dateformat'] = 66 $core->blog->settings->date_format.','. 67 $core->blog->settings->time_format; 68 } 29 $p = array(); 30 $p['homeonly'] = empty($r['homeonly']) 31 ? false 32 : true; 33 $p['c_limit'] = isset($r['c_limit']) 34 ? abs((integer) $r['c_limit']) 35 : 10; 36 $p['t_limit'] = isset($r['t_limit']) 37 ? abs((integer) $r['t_limit']) 38 : 20; 39 $p['co_limit'] = !empty($r['co_limit']) 40 ? abs((integer) $r['co_limit']) 41 : 80; 42 $p['title'] = isset($r['title']) 43 ? (string) $r['title'] 44 : __('Last comments'); 45 $p['stringformat'] = !empty($r['stringformat']) 46 ? (string) $r['stringformat'] 47 : '<a href="%5$s" title="%4$s">%2$s - %3$s<br/>%1$s</a>'; 48 $p['dateformat'] = !empty($r['dateformat']) 49 ? (string) $r['dateformat'] 50 : $core->blog->settings->date_format.','. 51 $core->blog->settings->time_format; 69 52 } 70 53 } -
plugins/dcom/_public.php
r333 r407 1 <?php 1 <?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ 2 2 /***************************************************************\ 3 3 * This is 'Dcom', a plugin for Dotclear 2 * 4 4 * * 5 * Copyright (c) 2007 5 * Copyright (c) 2007-2008 * 6 6 * Oleksandr Syenchuk, Jean-François Michaud and contributors.* 7 7 * * … … 49 49 commonDcom::adjustDefaults($attr); 50 50 51 $res ='<?php echo publicDcom::show(unserialize(\''.51 return '<?php echo publicDcom::show(unserialize(\''. 52 52 addcslashes(serialize($attr),'\'\\').'\')); ?>'; 53 return $res;54 53 } 55 54 … … 87 86 } 88 87 if ($s_title) { 89 $title = html::escapeHTML(self::cutString($rs->post_title,$p['t_limit']));88 $title = self::truncate($rs->post_title,$p['t_limit'],false); 90 89 } 91 90 if ($s_author) { … … 93 92 } 94 93 if ($s_comment) { 95 $comment = html::escapeHTML(self::cutString(html::decodeEntities(html::clean($rs->comment_content)),$p['co_limit']));94 $comment = self::truncate($rs->comment_content,$p['co_limit']); 96 95 } 97 96 … … 104 103 } 105 104 106 public static function cutString($str,$maxlength=false)105 public static function truncate($str,$maxlength,$html=true) 107 106 { 108 if (mb_strlen($str) > $maxlength && $maxlength) 109 return self::myCutString($str,$maxlength).'...'; 110 return $str; 111 } 112 113 // Fonction cutString() de Dotclear écrite par Olivier Meunier 114 // Corrigée pour supporter le UTF-8 115 // https://clearbricks.org/svn/trunk/common/lib.text.php [72] 116 public static function myCutString($str,$l) 117 { 118 $s = preg_split('/([\s]+)/u',$str,-1,PREG_SPLIT_DELIM_CAPTURE); 119 120 $res = ''; 121 $L = 0; 122 123 if (mb_strlen($s[0]) >= $l) { 124 return mb_substr($s[0],0,$l); 107 # On rend la chaîne lisible 108 if ($html) { 109 $str = html::decodeEntities(html::clean($str)); 125 110 } 126 111 127 foreach ($s as $v) 128 { 129 $L = $L+strlen($v); 130 131 if ($L > $l) { 132 break; 133 } else { 134 $res .= $v; 135 } 112 # On coupe la chaîne si elle est trop longue 113 if (mb_strlen($str) > $maxlength) { 114 $str = text::cutString($str,$maxlength).'…'; 136 115 } 137 116 138 return trim($res); 117 # On encode la chaîne pour pouvoir l'insérer dans un document HTML 118 return html::escapeHTML($str); 139 119 } 140 120 } -
plugins/dcom/locales/fr/main.po
r271 r407 1 1 # French translation of Dcom 2 # Copyright (c) 2007 .3 # Oleksandr Syenchuk <sacha@xn--phnix-csa.net>, 200 7.2 # Copyright (c) 2007-2008. 3 # Oleksandr Syenchuk <sacha@xn--phnix-csa.net>, 2008. 4 4 5 5 msgid "" 6 6 msgstr "Content-Type: text/plain; charset=UTF-8\n" 7 7 8 msgid "Comments limit (leave empty to disable limit):"9 msgstr "Nombre de commentaires maximum (laissez vide pour désactiver la limite):"8 msgid "Comments limit:" 9 msgstr "Nombre de commentaires maximum :" 10 10 11 11 msgid "Title lenght limit:"
Note: See TracChangeset
for help on using the changeset viewer.