Changeset 11295


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

use a prefilter, works with theme 'Simple'

Location:
extensions/bbcode_bar
Files:
4 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
  • extensions/bbcode_bar/main.inc.php

    r10983 r11295  
    2424}
    2525
    26 function add_bbcode_bar() {
     26function add_bbcode_bar()
     27{
    2728  global $page;
    2829 
    29   if (isset($page['body_id']) AND $page['body_id'] == 'thePicturePage') {
     30  if (isset($page['body_id']) AND $page['body_id'] == 'thePicturePage')
     31  {
    3032    set_bbcode_bar();
    3133  }
     
    4648  // version 2.2.a or greater of SmiliesSupport is required
    4749  add_event_handler('loc_end_admin', 'bbcode_bar_check_smilies');
    48   function bbcode_bar_check_smilies() {
     50  function bbcode_bar_check_smilies()
     51  {
    4952    global $page, $template, $pwg_loaded_plugins;
    5053
    5154    if (
    52       ((isset($_GET['page']) AND $_GET['page'] == 'plugins_list') OR (isset($_GET['section']) AND $_GET['section'] == 'bbcode_bar/admin.php'))
    53       AND isset($pwg_loaded_plugins['SmiliesSupport'])
    54       AND strcmp($pwg_loaded_plugins['SmiliesSupport']['version'], '2.2.a') == -1
     55      ( (isset($_GET['page']) AND $_GET['page'] == 'plugins_list') OR (isset($_GET['section']) AND $_GET['section'] == 'bbcode_bar/admin.php') )
     56      AND isset($pwg_loaded_plugins['SmiliesSupport']) AND strcmp($pwg_loaded_plugins['SmiliesSupport']['version'], '2.2.f') == -1
    5557    ) {
    56       $page['warnings'][] = "BBCode Bar : SmiliesSupport has been detected, but is not up to date. Version 2.2.a or greater is required. Please update.";
     58      array_push($page['warnings'], "BBCode Bar : SmiliesSupport has been detected, but is not up to date. Version 2.2.a or greater is required. Please update.");
    5759      $template->assign('warnings', $page['warnings']);
    5860    }
  • extensions/bbcode_bar/template/bbcode_bar.tpl

    r10983 r11295  
    6363
    6464jQuery(document).ready(function() {ldelim}
    65   jQuery('#{$form_name} textarea').markItUp(BBCodeBar);
     65  jQuery('#{$bbcode_texarea}').markItUp(BBCodeBar);
    6666});
    6767{/footer_script}
  • extensions/bbcode_bar/template/markitup/style.markitup.css

    r10024 r11295  
    11/* common */
    22.markItUp {
    3         display:inline-block;
     3  display:inline-block;
    44}
    55.markItUp * {
    6         margin:0px; padding:0px;
    7         outline:none;
     6  margin:0px; padding:0px;
     7  outline:none;
    88}
    99.markItUp a:link,
    1010.markItUp a:visited {
    11         color:#000;
    12         text-decoration:none;
     11  color:#000;
     12  text-decoration:none;
    1313}
    1414.markItUp textarea {
    15         display:block;
     15  display:block;
    1616}
    1717.markItUpContainer  {
    18         font:11px Verdana, Arial, Helvetica, sans-serif;
     18  font:11px Verdana, Arial, Helvetica, sans-serif;
    1919}
    2020.markItUpEditor {
    21         font:12px 'Courier New', Courier, monospace;
    22         padding:5px;
    23         clear:both;
    24         overflow:auto;
     21  font:12px 'Courier New', Courier, monospace;
     22  padding:5px;
     23  clear:both;
     24  overflow:auto;
    2525}
    2626.markItUpHeader ul:first-child {
    27   padding:2px;
     27  padding:2px 5px;
     28  min-height:22px;
    2829  margin-bottom:2px;
    2930  border-radius:2px;
    30         background:url('images/bg-header.png') repeat-x;
     31  background:url('images/bg-header.png') repeat-x;
    3132}
    3233.markItUpFooter {
    33         display:none;
     34  display:none;
    3435}
    3536
    3637/* first row of buttons */
    37 .markItUpHeader ul li   {
    38         list-style:none;
    39         float:left;
    40         position:relative;
    41   margin:0;
     38.markItUpHeader ul li  {
     39  list-style:none;
     40  float:left;
     41  position:relative;
     42  margin:0 !important;
    4243}
    4344.markItUpHeader ul li:hover > ul{
    44         display:block;
     45  display:block;
    4546}
    4647.markItUpHeader ul .markItUpDropMenu {
    47         background:transparent url(images/menu.png) no-repeat 120% 100%;
    48         margin-right:5px;
     48  background:transparent url(images/menu.png) no-repeat 120% 100%;
     49  margin-right:5px;
    4950}
    5051/* next rows of buttons */
    5152.markItUpHeader ul ul {
    52         display:none;
    53         position:absolute;
    54         top:22px; left:0px;     
    55         background:#FFF;
    56         border:1px solid #444;
    57         border-radius:5px;
     53  display:none;
     54  position:absolute;
     55  top:22px; left:0px; 
     56  background:#FFF;
     57  border:1px solid #444;
     58  border-radius:5px;
    5859}
    5960.markItUpHeader ul ul li {
    60         float:none;
    61         margin:0px;
     61  float:none;
     62  margin:0px;
    6263}
    6364.markItUpHeader ul .markItUpSize li {
    64         border-bottom:1px solid #444;
    65         border-radius:2px;
     65  border-bottom:1px solid #444;
     66  border-radius:2px;
    6667}
    6768.markItUpHeader ul .markItUpSeparator {
    68         margin:2px 10px;
    69         width:1px;
    70         height:16px;
    71         overflow:hidden;
    72         background-color:#CCC;
    73         color:#ccc;
     69  margin:2px 10px !important;
     70  width:1px;
     71  height:16px;
     72  overflow:hidden;
     73  background-color:#CCC;
     74  color:#ccc;
    7475}
    7576/* links */
    7677.markItUpHeader ul a {
    77         display:block;
    78         width:16px; height:16px;
    79         text-indent:-10000px;
    80         background-position:center center;
    81         background-repeat:no-repeat;
    82         padding:2px;
    83         border:1px solid transparent;
     78  display:block;
     79  width:16px; height:16px;
     80  text-indent:-10000px;
     81  background-position:center center;
     82  background-repeat:no-repeat;
     83  padding:2px;
     84  border:1px solid transparent;
    8485}
    8586.markItUpHeader ul a:hover {
    86         border-color:#08e;
     87  border-color:#08e;
    8788}
    8889.markItUpHeader ul ul a {
    89         display:block;
    90         text-indent:0;
    91         border:0;
     90  display:block;
     91  text-indent:0;
     92  border:0;
    9293}
    9394.markItUpHeader ul .markItUpSize li a {
    94         width:90px;
    95         padding:2px 5px 2px 25px;
    96         background-position:2px 50%;
     95  width:90px;
     96  padding:2px 5px 2px 25px;
     97  background-position:2px 50%;
    9798}
    9899.markItUpHeader ul ul a:hover  {
    99100}
    100101.markItUpHeader ul .markItUpSize li a:hover  {
    101         color:#FFF;
    102         background-color:#000;
     102  color:#FFF;
     103  background-color:#000;
    103104}
    104105
    105106/* icons definitions */
    106107.markItUp .markItUpBold a {
    107         background-image:url(images/bold.png);
     108  background-image:url(images/bold.png);
    108109}
    109110.markItUp .markItUpItalic a {
    110         background-image:url(images/italic.png);
     111  background-image:url(images/italic.png);
    111112}
    112113.markItUp .markItUpUnderline a {
    113         background-image:url(images/underline.png);
     114  background-image:url(images/underline.png);
    114115}
    115116.markItUp .markItUpStroke a {
    116         background-image:url(images/stroke.png);
     117  background-image:url(images/stroke.png);
    117118}
    118119
    119120.markItUp .markItUpParagraph a {
    120         background-image:url(images/p.png);
     121  background-image:url(images/p.png);
    121122}
    122123.markItUp .markItUpCenter a {
    123         background-image:url(images/center.png);
     124  background-image:url(images/center.png);
    124125}
    125126.markItUp .markItUpRight a {
    126         background-image:url(images/right.png);
     127  background-image:url(images/right.png);
    127128}
    128129
    129130.markItUp .markItUpListUL a {
    130         background-image:url(images/list-bullet.png);
     131  background-image:url(images/list-bullet.png);
    131132}
    132133.markItUp .markItUpListOL a {
    133         background-image:url(images/list-numeric.png);
     134  background-image:url(images/list-numeric.png);
    134135}
    135136.markItUp .markItUpListLI a {
    136         background-image:url(images/list-item.png);
     137  background-image:url(images/list-item.png);
    137138}
    138139
    139 .markItUp .markItUpPicture a    {
    140         background-image:url(images/picture.png);
     140.markItUp .markItUpPicture a  {
     141  background-image:url(images/picture.png);
    141142}
    142143.markItUp .markItUpLink a {
    143         background-image:url(images/link.png);
     144  background-image:url(images/link.png);
    144145}
    145146.markItUp .markItUpMail a {
    146         background-image:url(images/mail.png);
     147  background-image:url(images/mail.png);
    147148}
    148149.markItUp .markItUpQuote a {
    149         background-image:url(images/quote.png);
     150  background-image:url(images/quote.png);
    150151}
    151152
    152153.markItUp .markItUpSize a {
    153         background-image:url(images/fonts.png);
     154  background-image:url(images/fonts.png);
    154155}
    155156.markItUp .preview a {
    156         background-image:url(images/preview.png);
     157  background-image:url(images/preview.png);
    157158}
    158159
    159160/* colors */
    160161.markItUp .markItUpColors a {
    161         background-image:url(images/colors.png);
     162  background-image:url(images/colors.png);
    162163}
    163         .markItUp .markItUpColors ul {
    164                 width:81px;
    165                 padding:1px;   
    166         }
    167         .markItUp .markItUpColors  li {
    168                 border:1px solid white;
    169                 width:25px;     height:25px;
    170                 overflow:hidden;
    171                 padding:0px; margin:0px;
    172                 float:left;
    173                 border-radius:2px;
    174         }
    175         .markItUp .markItUpColors ul a {
    176                 width:25px;     height:25px;
    177                 color:transparent;
    178         }
    179         .markItUp .markItUpColors li:hover {
    180                 background-color:none;
    181                 border:1px solid #08e;
    182         }
    183        
    184         .markItUp .markItUpColors .col1-1 a { background:yellow; }
    185         .markItUp .markItUpColors .col1-2 a { background:orange; }
    186         .markItUp .markItUpColors .col1-3 a { background:red; }
    187        
    188         .markItUp .markItUpColors .col2-1 a { background:blue; }
    189         .markItUp .markItUpColors .col2-2 a { background:purple; }
    190         .markItUp .markItUpColors .col2-3 a { background:green; }
    191        
    192         .markItUp .markItUpColors .col3-1 a { background:white; }
    193         .markItUp .markItUpColors .col3-2 a { background:gray; }
    194         .markItUp .markItUpColors .col3-3 a { background:black; }
     164  .markItUp .markItUpColors ul {
     165    width:81px;
     166    padding:1px; 
     167  }
     168  .markItUp .markItUpColors  li {
     169    border:1px solid white;
     170    width:25px;  height:25px;
     171    overflow:hidden;
     172    padding:0px; margin:0px;
     173    float:left;
     174    border-radius:2px;
     175  }
     176  .markItUp .markItUpColors ul a {
     177    width:25px;  height:25px;
     178    color:transparent;
     179  }
     180  .markItUp .markItUpColors li:hover {
     181    background-color:none;
     182    border:1px solid #08e;
     183  }
     184 
     185  .markItUp .markItUpColors .col1-1 a { background:yellow; }
     186  .markItUp .markItUpColors .col1-2 a { background:orange; }
     187  .markItUp .markItUpColors .col1-3 a { background:red; }
     188 
     189  .markItUp .markItUpColors .col2-1 a { background:blue; }
     190  .markItUp .markItUpColors .col2-2 a { background:purple; }
     191  .markItUp .markItUpColors .col2-3 a { background:green; }
     192 
     193  .markItUp .markItUpColors .col3-1 a { background:white; }
     194  .markItUp .markItUpColors .col3-2 a { background:gray; }
     195  .markItUp .markItUpColors .col3-3 a { background:black; }
Note: See TracChangeset for help on using the changeset viewer.