Changeset 108

Show
Ignore:
Timestamp:
2007-12-19 21:13:37 (1 year ago)
Author:
hannes
Message:

improving quote tag with option id attribute refering to the post it originally came from (ticket #40)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/classes/misc/Format.php

    r61 r108  
    7979    public function post($str, $simple = FALSE) { 
    8080        // language 
    81         global $LANG
     81        global $LANG, $F
    8282        /* debugging messages; 
    8383         * printed out directly on the screen, so incompatible with general board structure; 
     
    8585        $DEBUG = FALSE; 
    8686        // board code 
    87         $tags_open = Array('[b]', '[i]', '[u]', '[s]', '[color=', '[size=', '[font=', '[align=', '[quote]', '[code]', '[img]', '[url]', '[url=', '[email]', '[email='); 
     87        $tags_open = Array('[b]', '[i]', '[u]', '[s]', '[color=', '[size=', '[font=', '[align=', '[quote]', '[quote=', '[code]', '[img]', '[url]', '[url=', '[email]', '[email='); 
    8888        // closing tags in the SAME order 
    89         $tags_close = Array('[/b]', '[/i]', '[/u]', '[/s]', '[/color]', '[/size]', '[/font]', '[/align]', '[/quote]', '[/code]', '[/img]', '[/url]', '[/url]', '[/email]', '[/email]'); 
     89        $tags_close = Array('[/b]', '[/i]', '[/u]', '[/s]', '[/color]', '[/size]', '[/font]', '[/align]', '[/quote]', '[/quote]', '[/code]', '[/img]', '[/url]', '[/url]', '[/email]', '[/email]'); 
    9090        /* HTML code: 
    9191         * In both the opening and closing tag definition, you can use %% as placeholder. Occurences of this string will be replaced with the attribute given in the board tag (e.g. [url=blah] -> attribute is 'blah'; there are some special cases which are handled individually in the switch statement). 
    9292         * The string contained between opening and closing board tag will automatically appear between opening and closing HTML part anyway. Note that I wrote 'HTML part', not 'tag', since in some cases (e.g. images), the latter doesn't apply. If you're planning to add more code tags, just look at the existing ones and you should understand the different ways to use those definitions to the best effect... */ 
    93         $tags_open_html = Array('<b>', '<i>', '<u>', '<s>', '<span style="color:%%">', '<span style="font-size:%%px">', '<span style="font-family:%%">', '<div align="%%">', '<div class="quote1">' . $LANG['Quote'] . ':</div><div class="quote">', '<div class="code1">' . $LANG['Code'] . ':</div><pre class="code">', '<img src="', '<a target="_blank" href="', '<a target="_blank" href="%%">', '<a href="mailto:', '<a href="mailto:%%">'); 
    94         $tags_close_html = Array('</b>', '</i>', '</u>', '</s>', '</span>', '</span>', '</span>', '</div>', '</div>', '</pre>', '" %% alt="' . $LANG['Image'] . '" />', '">%%</a>', '</a>', '">%%</a>', '</a>'); 
     93        $tags_open_html = Array('<b>', '<i>', '<u>', '<s>', '<span style="color:%%">', '<span style="font-size:%%px">', '<span style="font-family:%%">', '<div align="%%">', '<div class="quote1">' . $LANG['Quote'] . ':</div><div class="quote">', '<div class="quote1">%%:</div><div class="quote">', '<div class="code1">' . $LANG['Code'] . ':</div><pre class="code">', '<img src="', '<a target="_blank" href="', '<a target="_blank" href="%%">', '<a href="mailto:', '<a href="mailto:%%">'); 
     94        $tags_close_html = Array('</b>', '</i>', '</u>', '</s>', '</span>', '</span>', '</span>', '</div>', '</div>', '</div>', '</pre>', '" %% alt="' . $LANG['Image'] . '" />', '">%%</a>', '</a>', '">%%</a>', '</a>'); 
    9595        // initialize string for comparison 
    9696        $str_prev = ''; 
     
    183183                            $_attr_close = $_cont; 
    184184                        break; 
     185                        case '[quote=': 
     186                            // get poster and date of post this quote comes from 
     187                            $p = new Post($_attr); 
     188                            $_attr = str_replace(Array('%poster%', '%date%'), Array($p->getPoster(), $F->datetime($p->getPosttime())), $LANG['quote_from']); 
     189                        break; 
    185190                        default: 
    186191                            // nothing to do for the rest of the tags 
  • trunk/classes/misc/Post.php

    r105 r108  
    4747        } 
    4848    } /* constructor */ 
     49 
     50    /* get poster */ 
     51    public function getPoster() { 
     52        return $this->post->poster; 
     53    } 
     54 
     55    /* get post time */ 
     56    public function getPosttime() { 
     57        return $this->post->posttime; 
     58    } 
    4959 
    5060    /* function setPost - only used if constructor called without id (used in post preview) */ 
  • trunk/classes/pages/Reply.php

    r88 r108  
    7373                    $row4 = $q->fetchObject(); 
    7474                    $q = NULL; 
    75                     $_quote_text = '[quote]' . $F->htmlentities($row4->post, TRUE) . '[/quote]'; 
     75                    $_quote_text = '[quote=' . $quote . ']' . $F->htmlentities($row4->post, TRUE) . '[/quote]'; 
    7676                } 
    7777                // default: not previously subscribed 
  • trunk/includes/lang/de.php

    r89 r108  
    310310$LANG['View_All'] = 'Alle ansehen'; 
    311311$LANG['per_day'] = 'pro Tag'; 
     312$LANG['quote_from'] = 'Geschrieben von %poster% %date%'; 
    312313 
    313314/* actual sentences */ 
  • trunk/includes/lang/en.php

    r89 r108  
    311311$LANG['View_All'] = 'View All'; 
    312312$LANG['per_day'] = 'per day'; 
     313$LANG['quote_from'] = 'Originally posted by %poster% %date%'; 
    313314 
    314315/* actual sentences */