Changeset 9765


Ignore:
Timestamp:
Mar 19, 2011, 10:35:08 AM (13 years ago)
Author:
mistic100
Message:

[extentions] BBCode Bar

  • active for admin in the comments page
Location:
extensions/bbcode_bar
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/bbcode_bar/admin.php

    r9682 r9765  
    1111        // nouveau tableau de config
    1212        unset($conf_bbcode_bar);
    13         for ($i=0; $i<=15; $i++)
    14         {
     13        for ($i=0; $i<=15; $i++) {
    1514                $conf_bbcode_bar[] = (isset($_POST['chkb'.sprintf("%02d", $i)])) ? $_POST['chkb'.sprintf("%02d", $i)] : 0;
    1615        }
     
    2423    pwg_query($query);
    2524    array_push($page['infos'], l10n('Information data registered in database'));
    26        
    2725}
    2826
    2927// Parametrage du template
    30 for ($i=0; $i<=15; $i++)
    31 {
     28for ($i=0; $i<=15; $i++) {
    3229        $template->assign('CHKB'.sprintf("%02d", $i).'_STATUS', ($conf_bbcode_bar[$i] == 1) ? 'checked="checked"' : null);
    3330}
  • extensions/bbcode_bar/bbcode.js

    r9682 r9765  
    4949                bbcode[form+field+code] = 1;
    5050        } else {
    51                 ToAdd = "\n[/"+code+"]\n";
     51                ToAdd = "[/li]\n[/"+code+"]\n";
    5252                re = new RegExp(code+"1.(\\w+)$");
    5353                img.src = img.src.replace(re, code+".$1");
  • extensions/bbcode_bar/bbcode_bar.inc.php

    r9682 r9765  
    44function set_bbcode_bar()
    55{
    6         global $template, $conf, $lang, $user, $pwg_loaded_plugins;
     6        global $template, $conf, $lang, $user, $pwg_loaded_plugins, $page;
    77        load_language('plugin.lang', dirname(__FILE__) . '/');
    88        $conf_bbcode_bar = explode("," , $conf['bbcode_bar']);
     
    1010
    1111        // buttons
    12         for ($i=0; $i<=15; $i++)
    13         {
     12        for ($i=0; $i<=15; $i++) {
    1413                if ($conf_bbcode_bar[$i] == 1) $template->assign('BBCode_bar_button_'.sprintf("%02d", $i), true);
    1514        }
    1615        $template->assign('repicon', $conf_bbcode_bar[16]);
    1716       
    18         // edit field has a different id
    19         if (isset($_GET['action']) AND $_GET['action'] == 'edit_comment')
    20         {
     17        // edit field has different id
     18        if (
     19                (isset($_GET['action']) AND $_GET['action'] == 'edit_comment')
     20                OR (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage')
     21        ) {
    2122                $template->assign('form_name', 'editComment');
    22         }
    23         else
    24         {
     23        } else {
    2524                $template->assign('form_name', 'addComment');
    2625        }
    2726
    2827        // smilies support
    29         if (isset($pwg_loaded_plugins['SmiliesSupport']))
    30         {
     28        if (isset($pwg_loaded_plugins['SmiliesSupport'])) {
    3129                $template->assign('BBCode_bar_SmiliesSupport', array('SMILIESSUPPORT_PAGE' => SmiliesTable()));
    3230        }
     
    6664                                        while (($temp = array_pop($tags)))
    6765                                        {
    68                                                 if ($temp != $tag)
    69                                                 {
     66                                                if ($temp != $tag) {
    7067                                                        $before_tag.='[/'.$temp.']';
    71                                                 }
    72                                                 else
    73                                                 {
     68                                                } else {
    7469                                                        $before_tag.='[/'.$tag.']';
    7570                                                        break;
     
    7873                                        $end_pos += strlen($before_tag)+strlen($after_tag)-strlen($str);
    7974                                        $str = $before_tag.$after_tag;
    80                                 }
    81                                 else
    82                                 { // push stack
     75                                } else { // push stack
    8376                                        array_push($tags,$tag);
    8477                                }
     
    233226        return preg_replace($patterns, $replacements, $str);
    234227}
     228
    235229?>
  • extensions/bbcode_bar/bbcode_bar_admin.tpl

    r9682 r9765  
    77<form method="post" action="" class="properties" ENCTYPE="multipart/form-data">
    88        <fieldset>
     9                <legend>{'Parameters'|@translate}</legend>
    910                <ul>
    1011                        <li>
     
    6162                        </li>
    6263                        <li>
    63                                 &nbsp;
    64                         </li>
    65                         <li>
    6664                                <span class="property">{'size_help'|@translate}</span>
    6765                                <input type="checkbox" name="chkb13" {$CHKB13_STATUS} value="1" />
  • extensions/bbcode_bar/main.inc.php

    r9682 r9765  
    22/*
    33Plugin Name: BBCode Bar
    4 Version: 2.2.0
     4Version: 2.2.a
    55Description: Allow use BBCode for comments and descriptions.
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=140
     
    2020        remove_event_handler('render_comment_content', 'render_comment_content');
    2121        add_event_handler('render_comment_content', 'BBCodeParse');
    22         add_event_handler('loc_begin_picture', 'set_bbcode_bar');
     22        add_event_handler('loc_after_page_header', 'add_bbcode_bar');
     23}
     24
     25function add_bbcode_bar() {
     26        global $page;
     27        if ($page['body_id'] == 'theCommentsPage' OR $page['body_id'] == 'thePicturePage') {
     28                set_bbcode_bar();
     29        }
    2330}
    2431
     
    3542        }
    3643}
     44
    3745?>
Note: See TracChangeset for help on using the changeset viewer.