Dotclear

Changeset 3303


Ignore:
Timestamp:
04/05/14 17:38:53 (9 years ago)
Author:
brol
Message:

0.2.4 ajout combo + content only + class dans le widget + ajout code sécurité + modif locales

Location:
plugins/switchWelcome/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • plugins/switchWelcome/trunk/_define.php

    r1624 r3303  
    1010# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
    1111# -- END LICENSE BLOCK ------------------------------------ 
    12  
     12if (!defined('DC_RC_PATH')) { 
     13  return null; 
     14} 
    1315$this->registerModule( 
    1416          /* Name */               "switchWelcome", 
    1517          /* Description*/         "Welcome your visitors by a personnal message and help them to navigate", 
    1618          /* Author */             "Tomtom (http://blog.zenstyle.fr)", 
    17           /* Version */            '0.2.3', 
    18           /* Permissions */        'usage' 
     19          /* Version */            '0.2.4', 
     20     /* Properties */ 
     21     array( 
     22          'permissions' => 'usage', 
     23          'type' => 'plugin', 
     24          'dc_min' => '2.5', 
     25          'support' => 'http://lab.dotclear.org/wiki/plugin/switchWelcome', 
     26          'details' => 'http://plugins.dotaddict.org/dc2/details/switchWelcome' 
     27          ) 
    1928); 
    20  
    21 ?> 
  • plugins/switchWelcome/trunk/_prepend.php

    r1624 r3303  
    1010# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
    1111# -- END LICENSE BLOCK ------------------------------------ 
     12if (!defined('DC_RC_PATH')) { return; } 
    1213 
    1314$__autoload['switchWelcome'] = dirname(__FILE__).'/inc/class.switch.welcome.php'; 
    1415 
    1516require dirname(__FILE__).'/_widgets.php'; 
    16  
    17 ?> 
  • plugins/switchWelcome/trunk/_widgets.php

    r1810 r3303  
    22# -- BEGIN LICENSE BLOCK ---------------------------------- 
    33# This file is part of switchWelcome, a plugin for Dotclear. 
    4 #  
     4# 
    55# Copyright (c) 2009 Tomtom 
    66# http://blog.zenstyle.fr/ 
    7 #  
     7# 
    88# Licensed under the GPL version 2.0 license. 
    99# A copy of this license is available in LICENSE file or at 
     
    2222          $w->switchWelcome->setting('title',__('Title:'),__('Welcome!'),'text'); 
    2323          $w->switchWelcome->setting('welcometext',__('Welcome text (use %1$s for visitor\'s name and %2$s for where he comes from):'),__('Hi %1$s from %2$s! Welcome on this blog!'),'textarea'); 
    24           $w->switchWelcome->setting('welcomesearchtext',__('Welcome text if search exists (use %1$s for keywords and %2$s for related posts\'s list):'),__('Do you search anything about %1$s? Check those related posts : %2$s'),'textarea'); 
    25           $w->switchWelcome->setting('homeonly',__('Home page only'),true,'check'); 
     24          $w->switchWelcome->setting('welcomesearchtext',__('Welcome text if search exists (use %1$s for keywords and %2$s for related posts\'s list):'),__('Do you search anything about %1$s? Check those related posts: %2$s'),'textarea'); 
     25          $w->switchWelcome->setting('homeonly',__('Display on:'),0,'combo', 
     26               array( 
     27                    __('All pages') => 0, 
     28                    __('Home page only') => 1, 
     29                    __('Except on home page') => 2 
     30                    ) 
     31          ); 
     32          $w->switchWelcome->setting('content_only',__('Content only'),0,'check'); 
     33          $w->switchWelcome->setting('class',__('CSS class:'),''); 
    2634     } 
    27       
     35 
    2836     public static function widget($w) 
    2937     { 
    3038          global $core; 
    3139 
    32           if ($w->homeonly && $core->url->type != 'default') { 
     40          // Si nous sommes pas en page accueil et que c'est coché page accueil uniquement on fait rien 
     41 
     42          if (($w->homeonly == 1 && $core->url->type != 'default') || 
     43               ($w->homeonly == 2 && $core->url->type == 'default')) { 
    3344               return; 
    3445          } 
    35            
     46 
    3647          if (switchWelcome::getHostReferer() === switchWelcome::getHostReferer($core->blog->url)) { 
    3748               return; 
     
    3950 
    4051          $title = strlen($w->title) > 0 ? '<h2>'.html::escapeHTML($w->title).'</h2>' : ''; 
    41            
     52 
    4253          $visitor = isset($_COOKIE['comment_info']) ? preg_split('#\n#',$_COOKIE['comment_info']) : array(__('visitor')); 
    4354 
    44           $res = '<p>'.sprintf($w->welcometext,$visitor[0],switchWelcome::getHostRefererLink()).'</p>'; 
    45            
     55          $res = '<li>'.sprintf($w->welcometext,$visitor[0],switchWelcome::getHostRefererLink()).'</li>'; 
     56 
    4657          if (count(switchWelcome::getSearchWords()) > 0) { 
    47                $res .= '<p>'.sprintf($w->welcomesearchtext,switchWelcome::getSearchWordsList(),switchWelcome::getRelatedPosts()).'</p>'; 
     58               $res .= '<li>'.sprintf($w->welcomesearchtext,switchWelcome::getSearchWordsList(),switchWelcome::getRelatedPosts()).'</li>'; 
    4859          } 
    4960 
    5061          return 
    51                '<div id="switchwelcome">'. 
     62               ($w->content_only ? '' : '<div class="switchwelcome'.($w->class ? ' '.html::escapeHTML($w->class) : '').'">'). 
    5263               $title. 
     64               '<ul>'. 
    5365               $res. 
    54                '</div>'; 
     66               '</ul>'. 
     67               ($w->content_only ? '' : '</div>'); 
    5568     } 
    5669} 
    57  
    58 ?> 
  • plugins/switchWelcome/trunk/inc/class.switch.welcome.php

    r1624 r3303  
    1010# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
    1111# -- END LICENSE BLOCK ------------------------------------ 
    12  
     12if (!defined('DC_RC_PATH')) {return;} 
    1313class switchWelcome 
    1414{ 
     
    8383     } 
    8484} 
    85  
    86 ?> 
  • plugins/switchWelcome/trunk/locales/fr/main.po

    r1810 r3303  
    2424#: _widgets.php:23 
    2525msgid "Welcome text (use %1$s for visitor's name and %2$s for where he comes from):" 
    26 msgstr "Texte d'accueil (utilisez %1$s pour le nom du visiteur et %2$s pour sa provenance) :" 
     26msgstr "Texte d'accueil (utilisez %1$s pour le nom du visiteur et %2$s pour sa provenance)&nbsp;:" 
    2727 
    2828#: _widgets.php:23 
     
    3232#: _widgets.php:24 
    3333msgid "Welcome text if search exists (use %1$s for keywords and %2$s for related posts's list):" 
    34 msgstr "Texte d'accueil si une recherche a été faite (utilisez %1$s pour les mots clés et %2$s pour la liste des billets en relation) :" 
     34msgstr "Texte d'accueil si une recherche a été faite (utilisez %1$s pour les mots clés et %2$s pour la liste des billets en relation)&nbsp;:" 
    3535 
    3636#: _widgets.php:24 
    37 msgid "Do you search anything about %1$s? Check those related posts : %2$s" 
    38 msgstr "Vous recherchez quelque chose en rapport avec %1$s? Regardez parmi les articles en relation : %2$s" 
     37msgid "Do you search anything about %1$s? Check those related posts: %2$s" 
     38msgstr "Vous recherchez quelque chose en rapport avec %1$s ? Regardez parmi les articles en relation : %2$s" 
    3939 
    4040#: _widgets.php:38 
Note: See TracChangeset for help on using the changeset viewer.

Sites map