Ignore:
Timestamp:
Jun 10, 2011, 9:03:17 PM (13 years ago)
Author:
mistic100
Message:

use a prefilter, works with theme 'Simple'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/bbcode_bar/bbcode_bar.inc.php

    r10983 r11295  
    55{
    66  global $template, $conf, $pwg_loaded_plugins, $page;
     7 
    78  load_language('plugin.lang', dirname(__FILE__) . '/');
    89  $conf_bbcode_bar = unserialize($conf['bbcode_bar']);
    910
    1011  // buttons
    11   foreach(unserialize(BBcode_codes) as $key) {
     12  foreach(unserialize(BBcode_codes) as $key)
     13  {
    1214    if ($conf_bbcode_bar[$key]) $template->assign('BBC_'.$key, true);
    1315  }
     
    1820    // OR (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage')
    1921  // ) {
    20     // $template->assign('form_name', 'editComment');
     22    // $template->assign('bbcode_texarea', 'contenteditid');
    2123  // } else {
    22     // $template->assign('form_name', 'addComment');
     24    // $template->assign('bbcode_texarea', 'contentid');
    2325  // }
    24   $template->assign('form_name', 'addComment');
    25 
    26   if (isset($pwg_loaded_plugins['SmiliesSupport'])) {
     26  $template->assign('bbcode_texarea', 'contentid');
     27
     28  // smilies
     29  if (isset($pwg_loaded_plugins['SmiliesSupport']))
     30  {
    2731    $template->assign('BBC_smilies', true);
    2832  }
    2933
    3034  $template->assign('BBCODE_PATH', BBcode_PATH);
    31   $template->set_filename('bbcode_bar', dirname(__FILE__).'/template/bbcode_bar.tpl');
    32   $template->parse('bbcode_bar', true);   
    33 
    34   // smilies support >2.2.a ## must be parsed after bbcode_bar, because the javascript must be after bbc's one
    35   if (isset($pwg_loaded_plugins['SmiliesSupport']) AND strcmp($pwg_loaded_plugins['SmiliesSupport']['version'], '2.2.a') != -1) {
     35  $template->set_prefilter('picture', 'set_bbcode_bar_prefilter');   
     36
     37  // smilies support > 2.2.f ## must be parsed after bbcode_bar, because the javascript must be after bbc's one
     38  if (isset($pwg_loaded_plugins['SmiliesSupport']) AND strcmp($pwg_loaded_plugins['SmiliesSupport']['version'], '2.2.f') != -1) {
    3639    set_smiliessupport();
    3740  } 
     41}
     42
     43function set_bbcode_bar_prefilter($content, &$smarty)
     44{
     45  $search = "<label>{'Comment'|@translate}";
     46  $replace = file_get_contents(BBcode_PATH.'/template/bbcode_bar.tpl').$search;
     47  return str_replace($search, $replace, $content);
    3848}
    3949
Note: See TracChangeset for help on using the changeset viewer.