Dotclear

Changeset 3147


Ignore:
Timestamp:
08/01/13 01:30:24 (10 years ago)
Author:
brol
Message:

version 1.4.2

Location:
plugins/templateWidget/trunk
Files:
4 added
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • plugins/templateWidget/trunk/_admin.php

    r931 r3147  
    2424if (!defined('DC_CONTEXT_ADMIN')) { return; } 
    2525 
    26 require_once(dirname(__FILE__).'/inc/class.WidgetAdmin.php'); 
     26require_once(dirname(__FILE__).'/WidgetAdmin.php'); 
    2727$core->addBehavior('initWidgets',array('templateWidgetAdmin','InitWidgets')); 
    2828 
  • plugins/templateWidget/trunk/_define.php

    r931 r3147  
    2828     /* Description*/         "Define widgets using template file only", 
    2929     /* Author */             "Olivier Azeau", 
    30      /* Version */            '1.4a', 
     30     /* Version */            '1.4.2', 
    3131     /* Permissions */        null 
    3232); 
  • plugins/templateWidget/trunk/_public.php

    r2097 r3147  
    2424if (!defined('DC_RC_PATH')) { return; } 
    2525 
     26require_once(dirname(__FILE__).'/WidgetAdmin.php'); 
     27$core->addBehavior('initWidgets',array('templateWidgetAdmin','InitWidgets')); 
     28 
    2629$core->tpl->addBlock('WidgetName',array('templateWidgetBlocksAndValues','Name')); 
    2730$core->tpl->addBlock('WidgetDescription',array('templateWidgetBlocksAndValues','Description')); 
     
    3336 
    3437$core->tpl->addValue('WidgetText',array('templateWidgetBlocksAndValues','Text')); 
    35 $core->tpl->addBlock('WidgetTextIf',array('templateWidgetBlocksAndValues','TextIf')); 
    36 $core->tpl->addBlock('WidgetTextLike',array('templateWidgetBlocksAndValues','TextLike')); 
    37 $core->tpl->addValue('WidgetTextMatch',array('templateWidgetBlocksAndValues','TextMatch')); 
    38 $core->tpl->addBlock('WidgetTextNotLike',array('templateWidgetBlocksAndValues','TextNotLike')); 
    3938$core->tpl->addBlock('WidgetCheckboxIf',array('templateWidgetBlocksAndValues','CheckboxIf')); 
    4039$core->tpl->addBlock('WidgetComboIf',array('templateWidgetBlocksAndValues','ComboIf')); 
     
    5251{ 
    5352  // widget display only consists in displaying the corresponding template file 
    54   public static function WidgetCore(&$widget) 
     53  public static function WidgetCore($widget) 
    5554  { 
    5655    global $core, $_ctx; 
    5756    $_ctx->widget = $widget; 
    58     $core->tpl->setPath( 
    59       $core->tpl->getPath(), 
    60       path::real(dirname(__FILE__).'/default-templates') 
    61     ); 
    62           $core->callBehavior('publicTemplateWidgetBeforeLoad',$core->tpl,$widget); 
     57    $core->tpl->setPath(array_merge($core->tpl->getPath(),array(dirname(__FILE__).'/default-templates'))); 
    6358    $code = $core->tpl->getData($widget->id().'.widget.html'); 
    6459    $_ctx->widget = null; 
     
    115110    return '<?php print html::escapeHTML($_ctx->widget->'.$attr['name'].'); ?>'.CRLF; 
    116111  } 
    117     
    118   // Widget text field : testing text value 
    119   public static function TextIf($attr,$content) { 
    120           return 
    121           '<?php if ($_ctx->widget->'.$attr['name'].' == "'.addslashes($attr['value']).'") : ?>'.CRLF. 
    122                $content. 
    123           '<?php endif; ?>'.CRLF; 
    124   } 
    125     
    126   // Widget text field : matching text value against pattern 
    127   public static function TextLike($attr,$content) { 
    128           return 
    129           '<?php if( preg_match( "'.addslashes($attr['pattern']).'", $_ctx->widget->'.$attr['name'].', $widgetTextMatches ) ) : ?>'.CRLF. 
    130           '<?php $_ctx->widgetTextMatches=$widgetTextMatches; ?>'.CRLF. 
    131                $content. 
    132           '<?php endif; ?>'.CRLF; 
    133   } 
    134112   
    135   // Widget text field : displaying part of matched pattern 
    136   public static function TextMatch($attr) { 
    137     return '<?php print html::escapeHTML($_ctx->widgetTextMatches['.$attr['index'].']); ?>'.CRLF; 
    138   } 
    139     
    140   // Widget text field : matching text value against pattern 
    141   public static function TextNotLike($attr,$content) { 
    142           return 
    143           '<?php if( !preg_match( "'.addslashes($attr['pattern']).'", $_ctx->widget->'.$attr['name'].' ) ) : ?>'.CRLF. 
    144                $content. 
    145           '<?php endif; ?>'.CRLF; 
    146   } 
    147   
    148113  // Widget checkbox field 
    149114  public static function CheckboxIf($attr,$content) { 
     
    181146class templateWidgetBehaviors 
    182147{ 
    183   public static function loadVisitorCookie(&$core) 
     148  public static function loadVisitorCookie($core) 
    184149  { 
    185150    global $_ctx; 
     
    188153    if (empty($_COOKIE['comment_info'])) 
    189154      return; 
    190     $visitorInfos = split("\n",$_COOKIE['comment_info']); 
     155    $visitorInfos = explode("\n",$_COOKIE['comment_info']); 
    191156          $_ctx->comment_preview = new ArrayObject(); 
    192157    $_ctx->comment_preview['name'] = @$_ctx->comment_preview['name'] ? $_ctx->comment_preview['name'] : $visitorInfos[0]; 
     
    200165} 
    201166 
    202  
    203167?> 
  • plugins/templateWidget/trunk/default-templates/demo.widget.html

    r2097 r3147  
    44<div> 
    55<h2>{{tpl:WidgetText name="title" title="Title:" default="Default Title" order="1"}}</h2> 
    6 <tpl:WidgetTextLike name="subtitle" title="Subtitle:" order="2" pattern="/---+/"> 
    7 <hr/> 
    8 </tpl:WidgetTextLike> 
    9 <tpl:WidgetTextLike name="subtitle" pattern="/bold:(.+)/"> 
    10 <b>{{tpl:WidgetTextMatch index="1"}}</b> 
    11 </tpl:WidgetTextLike> 
    12 <tpl:WidgetTextNotLike name="subtitle" pattern="/(---+|bold:(.+))/"> 
    13 {{tpl:WidgetText name="subtitle"}} 
    14 </tpl:WidgetTextNotLike> 
    156 
    167<tpl:WidgetDefineBlock name="DemoBlock"> 
    178{{tpl:WidgetText name="desc" title="Description:" default="Blah blah..." type="textarea" order="5"}} 
    18 {{tpl:WidgetCombo name="choice" title="Choose:" default="blue" options="red:green:blue" order="6"}} 
     9{{tpl:WidgetCombo name="choice" title="Choose:" default="blue" options="red:green:blue" order="4"}} 
    1910<tpl:WidgetComboIf name="choice" value="green"> 
    2011--This is green 
     
    2213</tpl:WidgetDefineBlock> 
    2314 
    24 <tpl:WidgetCheckboxIf name="checkme" value="1" title="Check me" default="0" order="3"> 
     15<tpl:WidgetCheckboxIf name="checkme" value="1" title="Check me" default="0" order="2"> 
    2516<h3>CheckMe is checked !</h3> 
    2617{{tpl:WidgetUseBlock name="DemoBlock"}} 
    2718</tpl:WidgetCheckboxIf> 
    2819<tpl:WidgetCheckboxIf name="checkme" value="0"> 
    29 <h3>CheckMe is not checked! Please Check it!</h3> 
     20<h3>CheckMe is not checked ! Please Check it !</h3> 
    3021</tpl:WidgetCheckboxIf> 
    3122 
    32 <tpl:WidgetCheckboxIf name="uncheckme" value="0" title="Uncheck me" default="1" order="4"> 
    33 <h3>UncheckMe is not checked!</h3> 
     23<tpl:WidgetCheckboxIf name="uncheckme" value="0" title="Uncheck me" default="1" order="3"> 
     24<h3>UncheckMe is not checked !</h3> 
    3425{{tpl:WidgetUseBlock name="DemoBlock"}} 
    3526</tpl:WidgetCheckboxIf> 
    3627<tpl:WidgetCheckboxIf name="uncheckme" value="1"> 
    37 <h3>UncheckMe is checked! Please Uncheck it!</h3> 
     28<h3>UncheckMe is checked ! Please Uncheck it !</h3> 
    3829</tpl:WidgetCheckboxIf> 
    3930 
  • plugins/templateWidget/trunk/index.php

    r931 r3147  
    2626dcPage::check('usage,contentadmin'); 
    2727 
    28 require_once(dirname(__FILE__).'/inc/class.Settings.php'); 
     28require_once(dirname(__FILE__).'/Settings.php'); 
    2929 
    3030try 
Note: See TracChangeset for help on using the changeset viewer.

Sites map