Dotclear

source: plugins/typo/_public.php @ 655

Revision 655, 1.4 KB checked in by franck, 15 years ago (diff)

Hyphenation feature removed
Draft code for action on selected entries in admin

Line 
1<?php 
2# -- BEGIN LICENSE BLOCK ----------------------------------
3#
4# This file is part of Typo plugin for Dotclear 2.
5#
6# Copyright (c) 2008 Franck Paul and contributors
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK ------------------------------------
12
13require_once dirname(__FILE__).'/inc/smartypants.php';
14
15/* Add behavior callback for typo replacement in comments */
16$core->addBehavior('coreBeforeCommentCreate',array('dcTypo','updateTypoComments'));
17$core->addBehavior('publicBeforeCommentPreview',array('dcTypo','previewTypoComments'));
18
19class dcTypo
20{
21     public static function updateTypoComments(&$blog,&$cur)
22     {
23          global $core;
24
25          if ($core->blog->settings->typo_active && $core->blog->settings->typo_comments)
26          {
27               /* Transform typo for comment content (XHTML) */
28               if (!(boolean)$cur->comment_trackback) {
29                    if ($cur->comment_content != null) {
30                         if ($core->blog->settings->typo_comments)
31                              $cur->comment_content = SmartyPants($cur->comment_content);
32                    }
33               }
34          }
35     }
36     public static function previewTypoComments(&$prv)
37     {
38          global $core;
39
40          if ($core->blog->settings->typo_active && $core->blog->settings->typo_comments)
41          {
42               /* Transform typo for comment content (XHTML) */
43               if ($prv['content'] != null) {
44                    if ($core->blog->settings->typo_comments)
45                         $prv['content'] = SmartyPants($prv['content']);
46               }
47          }
48     }
49}
50?>
Note: See TracBrowser for help on using the repository browser.

Sites map