Dotclear

Changeset 2779


Ignore:
Timestamp:
11/28/10 15:27:41 (13 years ago)
Author:
nikrou
Message:

Sanitize code
Upgrade tagcloud.swf
Use colorpicker to define colors for animation
Add help
Option to add code for search engine
Remove swfobject dependency

Location:
plugins/tagflash
Files:
26 added
3 deleted
8 edited
3 copied

Legend:

Unmodified
Added
Removed
  • plugins/tagflash/CHANGELOG

    r2778 r2779  
     1Tag Flash 1.1.0 - 2010-11-28 
     2================================= 
     3* Sanitize code 
     4* Upgrade tagcloud.swf 
     5* Use colorpicker to define colors for animation 
     6* Add help 
     7* Option to add code for search engine 
     8* Remove swfobject dependency  
     9 
    110Tag Flash 1.0.3 - 2010-11-24 
    211================================= 
  • plugins/tagflash/MANIFEST

    r2778 r2779  
    11tagflash/CREDITS 
    22tagflash/_public.php 
    3 tagflash/locales/fr/main.lang.php 
     3tagflash/locales/en/help.html 
     4tagflash/locales/fr/main.po 
     5tagflash/locales/fr/help.html 
    46tagflash/_widgets.php 
    57tagflash/_prepend.php 
    6 tagflash/default-templates/tagFlash-widget.html 
    78tagflash/MANIFEST 
     9tagflash/index.php 
     10tagflash/img/colorpicker_hex.png 
     11tagflash/img/colorpicker_hsb_b.png 
     12tagflash/img/colorpicker_rgb_g.png 
     13tagflash/img/colorpicker_overlay.png 
     14tagflash/img/colorpicker_rgb_b.png 
     15tagflash/img/colorpicker_submit.png 
     16tagflash/img/colorpicker_select.gif 
     17tagflash/img/colorpicker_hsb_h.png 
     18tagflash/img/icon.png 
     19tagflash/img/colorpicker_indic.gif 
     20tagflash/img/colorpicker_rgb_r.png 
     21tagflash/img/colorpicker_hsb_s.png 
     22tagflash/img/colorpicker_background.png 
    823tagflash/tagcloud.swf 
    924tagflash/swfobject.js 
     25tagflash/tpl/index.tpl 
     26tagflash/js/jquery.colorpicker.js 
    1027tagflash/CHANGELOG 
    1128tagflash/_admin.php 
     29tagflash/inc/class.tpl.tag.flash.php 
     30tagflash/colorpicker.css 
     31tagflash/_install.php 
    1232tagflash/_define.php 
    1333tagflash/COPYING 
    14 tagflash/class.dc.publicWidget.php 
    1534tagflash/TODO 
  • plugins/tagflash/_admin.php

    r2778 r2779  
    2323if (!defined('DC_CONTEXT_ADMIN')) { return; } 
    2424 
     25$_menu['Plugins']->addItem(__('Tag Flash'),  
     26                  'plugin.php?p=tagflash', 
     27                  'index.php?pf=tagflash/img/icon.png', 
     28                  preg_match('/plugin.php\?p=tagflash(&.*)?$/', $_SERVER['REQUEST_URI']), 
     29                  $core->auth->check('usage,contentadmin', $core->blog->id) 
     30                  ); 
     31 
     32 
    2533require dirname(__FILE__).'/_widgets.php'; 
    2634?> 
  • plugins/tagflash/_define.php

    r2778 r2779  
    2727    /* Description*/    "Flash based Tag Cloud for Dotclear", 
    2828    /* Author */        "Gwénaël Després (based on WordPress plugin by Roy Tanck)", 
    29     /* Version */       '1.0.3', 
     29    /* Version */       '1.1.0', 
    3030    /* Permissions */   'usage,contentadmin' 
    3131); 
  • plugins/tagflash/_install.php

    r2778 r2779  
    11<?php 
    22// +-----------------------------------------------------------------------+ 
    3 // | Tag Flash  - a plugin for Dotclear                                    | 
     3// | tagFlash  - a plugin for Dotclear                                     | 
    44// +-----------------------------------------------------------------------+ 
    55// | Copyright(C) 2010 Nicolas Roudaire             http://www.nikrou.net  | 
    6 // | Copyright(C) 2010 Guenaël Després                                     | 
     6// | Copyright(C) 2010 Guenaël                                 | 
    77// +-----------------------------------------------------------------------+ 
    88// | This program is free software; you can redistribute it and/or modify  | 
     
    2121// +-----------------------------------------------------------------------+ 
    2222 
    23 if (!defined('DC_RC_PATH')) { return; } 
     23if (!defined('DC_CONTEXT_ADMIN')) { exit; } 
    2424 
    25 $__autoload['dcPublicWidget'] = dirname(__FILE__).'/class.dc.publicWidget.php'; 
    26 ?> 
     25$version = $core->plugins->moduleInfo('tagflash','version'); 
     26if (version_compare($core->getVersion('tagflash'),$version,'>=')) {  
     27  return; 
     28} 
     29 
     30$settings = $core->blog->settings; 
     31$settings->addNamespace('tagflash'); 
     32 
     33$settings->tagflash->put('active', false, 'boolean', 'Tag Flash plugin activated', false); 
     34$settings->tagflash->put('bgcolor', '', 'string', 'Animation background color', false); 
     35$settings->tagflash->put('color1', '', 'string', 'Color 1 for animation', false); 
     36$settings->tagflash->put('color2', '', 'string', 'Color 2 for animation', false); 
     37$settings->tagflash->put('hicolor', '', 'string', 'Highlight color for animation', false); 
     38$settings->tagflash->put('width', '', 'string', 'Animation width', false); 
     39$settings->tagflash->put('height', '', 'string', 'Animation height', false); 
     40$settings->tagflash->put('speed', '', 'string', 'Animation roation speed', false); 
     41 
     42$core->setVersion('tagflash', $version); 
     43 
     44return true; 
  • plugins/tagflash/_prepend.php

    r2778 r2779  
    11<?php 
    22// +-----------------------------------------------------------------------+ 
    3 // | Tag Flash  - a plugin for Dotclear                                    | 
     3// | tagFlash  - a plugin for Dotclear                                     | 
    44// +-----------------------------------------------------------------------+ 
    55// | Copyright(C) 2010 Nicolas Roudaire             http://www.nikrou.net  | 
    6 // | Copyright(C) 2010 Guenaël Després                                     | 
     6// | Copyright(C) 2010 Guenaël                                 | 
    77// +-----------------------------------------------------------------------+ 
    88// | This program is free software; you can redistribute it and/or modify  | 
     
    2323if (!defined('DC_RC_PATH')) { return; } 
    2424 
    25 $__autoload['dcPublicWidget'] = dirname(__FILE__).'/class.dc.publicWidget.php'; 
     25$__autoload['tplTagFlash'] = dirname(__FILE__).'/inc/class.tpl.tag.flash.php'; 
    2626?> 
  • plugins/tagflash/_public.php

    r2778 r2779  
    11<?php 
    2 // +-----------------------------------------------------------------------+ 
    3 // | Tag Flash  - a plugin for Dotclear                                    | 
    4 // +-----------------------------------------------------------------------+ 
    5 // | Copyright(C) 2010 Nicolas Roudaire             http://www.nikrou.net  | 
    6 // | Copyright(C) 2010 Guenaël Després                                     | 
    7 // +-----------------------------------------------------------------------+ 
    8 // | This program is free software; you can redistribute it and/or modify  | 
    9 // | it under the terms of the GNU General Public License as published by  | 
    10 // | the Free Software Foundation                                          | 
    11 // |                                                                       | 
    12 // | This program is distributed in the hope that it will be useful, but   | 
    13 // | WITHOUT ANY WARRANTY; without even the implied warranty of            | 
    14 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      | 
    15 // | General Public License for more details.                              | 
    16 // |                                                                       | 
    17 // | You should have received a copy of the GNU General Public License     | 
    18 // | along with this program; if not, write to the Free Software           | 
    19 // | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,            | 
    20 // | MA 02110-1301 USA.                                                    | 
    21 // +-----------------------------------------------------------------------+ 
    22  
    232if (!defined('DC_RC_PATH')) { return; } 
    243 
    254require(dirname(__FILE__).'/_widgets.php'); 
    26  
    27 class publicTagFlashWidget extends dcPublicWidget  
    28 { 
    29   public static function tagFlashWidget($w) { 
    30     global $core, $_ctx; 
    31      
    32     $_ctx->widget = $w; 
    33     $core->tpl->setPath($core->tpl->getPath(), dirname(__FILE__).'/default-templates'); 
    34      
    35     return self::serveWidget('tagFlash-widget.html'); 
    36   } 
    37 } 
    38  
    39 $core->tpl->addValue('WidgetParam', 
    40     array('tplWidget', 'widgetParam')); 
    41  
    42 class tplWidget { 
    43  
    44     public static function widgetParam($attr) { 
    45  
    46         $param = null; 
    47         if (!empty($attr['param'])) { 
    48             $param = addslashes($attr['param']); 
    49         } 
    50  
    51         $f = $GLOBALS['core']->tpl->getFilters($attr); 
    52         if ($param != null) { 
    53             return '<?php echo '.sprintf($f,'$GLOBALS[\'_ctx\']->widget->'.$param.'').'; ?>'; 
    54         } 
    55         return; 
    56     } 
    57 } 
    58  
    59 $core->tpl->addValue('tagFlashWidth', array('tplTagFlash', 'tagFlashWidth')); 
    60 $core->tpl->addValue('tagFlashHeight', array('tplTagFlash', 'tagFlashHeight')); 
    61 $core->tpl->addValue('tagFlashTagColor', array('tplTagFlash', 'tagFlashTagColor')); 
    62 $core->tpl->addValue('tagFlashBackgroundColor', array('tplTagFlash', 'tagFlashBackgroundColor')); 
    63 $core->tpl->addBlock('tagFlashIfTransparent', array('tplTagFlash', 'tagFlashIfTransparent')); 
    64 $core->tpl->addValue('tagFlashSpeed', array('tplTagFlash', 'tagFlashSpeed')); 
    65 $core->tpl->addValue('tagFlashTags', array('tplTagFlash', 'tagFlashTags')); 
    66  
    67 class tplTagFlash { 
    68  
    69     private static $SIZE_TRANSLATOR = array( 
    70         '0' => '0', 
    71         '10' => '8', 
    72         '20' => '10', 
    73         '30' => '12', 
    74         '40' => '14', 
    75         '50' => '16', 
    76         '60' => '18', 
    77         '70' => '20', 
    78         '80' => '22', 
    79         '90' => '24', 
    80         '100' => '26' 
    81     ); 
    82  
    83     public static function tagFlashWidth($attr) { 
    84  
    85         return '<?php echo tplTagFlash::getWidth(); ?>'; 
    86     } 
    87     public static function getWidth() { 
    88  
    89         return $GLOBALS['_ctx']->widget->width; 
    90     } 
    91  
    92     public static function tagFlashHeight($attr) { 
    93         return '<?php echo tplTagFlash::getHeight(); ?>'; 
    94     } 
    95     public static function getHeight() { 
    96         return $GLOBALS['_ctx']->widget->height; 
    97     } 
    98  
    99     public static function tagFlashTagColor($attr) { 
    100         return '<?php echo tplTagFlash::getTagColor(); ?>'; 
    101     } 
    102     public static function getTagColor() { 
    103         $w = $GLOBALS['_ctx']->widget; 
    104         $color = ''; 
    105         if ($w->color != '') { 
    106             $color = '0x'.$w->color; 
    107         } 
    108         return $color; 
    109     } 
    110  
    111     public static function tagFlashBackgroundColor($attr) { 
    112         return '<?php echo tplTagFlash::getBackgroundColor(); ?>'; 
    113     } 
    114     public static function getBackgroundColor() { 
    115  
    116         $w = $GLOBALS['_ctx']->widget; 
    117  
    118         $color = ''; 
    119         if ($w->bgcolor != '') { 
    120             $color = '#'.$w->bgcolor; 
    121         } 
    122         return $color; 
    123     } 
    124  
    125     public static function tagFlashIfTransparent($attr, $content) { 
    126  
    127         return '<?php if (tplTagFlash::isTransparent()) { echo \''.$content.'\'; } ?>'; 
    128     } 
    129     public static function isTransparent() { 
    130  
    131         return ($GLOBALS['_ctx']->widget->transparent == "1"); 
    132     } 
    133  
    134     public static function tagFlashSpeed($attr) { 
    135         return '<?php echo tplTagFlash::getSpeed(); ?>'; 
    136     } 
    137     public static function getSpeed() { 
    138  
    139         $w = $GLOBALS['_ctx']->widget; 
    140  
    141         $speed = '150'; 
    142         if ((integer) $w->speed > 0) { 
    143             $speed = $w->speed; 
    144         } 
    145  
    146         return $speed; 
    147     } 
    148  
    149     public static function tagFlashTags($attr) { 
    150         return '<?php echo tplTagFlash::getTags(); ?>'; 
    151     } 
    152     public static function getTags() { 
    153  
    154         $core = $GLOBALS['core']; 
    155         $w = $GLOBALS['_ctx']->widget; 
    156  
    157         $limit = null; 
    158         if ($w->limit != "" && is_numeric($w->limit)) { 
    159             $limit = $w->limit; 
    160         } 
    161  
    162         $objMeta = new dcMeta($core); 
    163         $rs = $objMeta->getMeta('tag', $limit); 
    164  
    165         $buff = '<tags>'; 
    166  
    167         if (!$rs->isEmpty()) { 
    168             while ($rs->fetch()) { 
    169  
    170                 $buff .= 
    171                 '<a href=\''.$core->blog->url.$core->url->getBase('tag').'/'.rawurlencode($rs->meta_id).'\' '. 
    172                 'style=\''.self::$SIZE_TRANSLATOR[$rs->roundpercent].'\'>'. 
    173                 $rs->meta_id.'<\\/a>'; 
    174             } 
    175         } 
    176  
    177         $buff .= '<\\/tags>'; 
    178  
    179         return $buff; 
    180     } 
    181 } 
    1825?> 
  • plugins/tagflash/_widgets.php

    r2778 r2779  
    2323if (!defined('DC_RC_PATH')) { return; } 
    2424 
    25 $core->addBehavior('initWidgets',  
    26              array('tagFlashWidgetBehaviors','initWidgets') 
    27              ); 
    28 $core->addBehavior('initDefaultWidgets',  
    29              array('tagFlashWidgetBehaviors','initDefaultWidgets') 
    30 ); 
     25$core->addBehavior('initWidgets',array('tagFlashWidgetBehaviors','initWidgets')); 
     26$core->addBehavior('initDefaultWidgets',array('tagFlashWidgetBehaviors','initDefaultWidgets')); 
    3127 
    3228class tagFlashWidgetBehaviors  
     
    3834  public static function initWidgets($w) { 
    3935    $w->create('tagFlash',__('Tags Flash'), 
    40             array('publicTagFlashWidget','tagFlashWidget') 
     36            array('tplTagFlash','widget') 
    4137            ); 
    4238 
    43     $w->tagFlash->setting('title',__('Title:'), 
    44                  'Tags','text'); 
    45     $w->tagFlash->setting('width',__('Width of the Flash tag cloud:'), 
    46                  '100%','text'); 
    47     $w->tagFlash->setting('height',__('Height of the Flash tag cloud:'), 
    48                  '200px','text'); 
    49     $w->tagFlash->setting('color',__('Color of the tags (6 character hex color value without the # prefix):'), 
    50                  '000000','text'); 
    51     $w->tagFlash->setting('bgcolor',__('Backgound color (6 character hex color value without the # prefix):'), 
    52                  'ffffff','text'); 
    53     $w->tagFlash->setting('transparent',__('Use transparent mode'), 
    54             'true','check'); 
    55     $w->tagFlash->setting('speed',__('Rotation speed (default=150):'), 
    56                  '150','text'); 
    57     $w->tagFlash->setting('limit',__('Maximun displayed tags (empty=no limit):'), 
    58                  '','text'); 
     39    $w->tagFlash->setting('title',__('Title:'),'Tags','text'); 
     40    $w->tagFlash->setting('seo_content',__('Add tags for SEO'),1,'check'); 
     41    $w->tagFlash->setting('transparent_mode',__('Transparent mode'),1,'check'); 
     42    $w->tagFlash->setting('limit',__('Maximun displayed tags (empty=no limit):'),0,'text'); 
    5943  } 
    6044} 
  • plugins/tagflash/locales/en/resources.php

    r2778 r2779  
    11<?php 
    22// +-----------------------------------------------------------------------+ 
    3 // | Tag Flash  - a plugin for Dotclear                                    | 
     3// | tagFlash  - a plugin for Dotclear                                     | 
    44// +-----------------------------------------------------------------------+ 
    55// | Copyright(C) 2010 Nicolas Roudaire             http://www.nikrou.net  | 
    6 // | Copyright(C) 2010 Guenaël Després                                     | 
     6// | Copyright(C) 2010 Guenaël                                 | 
    77// +-----------------------------------------------------------------------+ 
    88// | This program is free software; you can redistribute it and/or modify  | 
     
    2121// +-----------------------------------------------------------------------+ 
    2222 
    23 if (!defined('DC_CONTEXT_ADMIN')) { return; } 
    24  
    25 require dirname(__FILE__).'/_widgets.php'; 
     23$__resources['help']['tagflash'] = dirname(__FILE__).'/help.html'; 
    2624?> 
  • plugins/tagflash/locales/fr/resources.php

    r2778 r2779  
    11<?php 
    22// +-----------------------------------------------------------------------+ 
    3 // | Tag Flash  - a plugin for Dotclear                                    | 
     3// | tagFlash  - a plugin for Dotclear                                     | 
    44// +-----------------------------------------------------------------------+ 
    55// | Copyright(C) 2010 Nicolas Roudaire             http://www.nikrou.net  | 
    6 // | Copyright(C) 2010 Guenaël Després                                     | 
     6// | Copyright(C) 2010 Guenaël                                 | 
    77// +-----------------------------------------------------------------------+ 
    88// | This program is free software; you can redistribute it and/or modify  | 
     
    2121// +-----------------------------------------------------------------------+ 
    2222 
    23 if (!defined('DC_CONTEXT_ADMIN')) { return; } 
    24  
    25 require dirname(__FILE__).'/_widgets.php'; 
     23$__resources['help']['tagflash'] = dirname(__FILE__).'/help.html'; 
    2624?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map