Dotclear

source: inc/public/rs.extension.php @ 2566:9bf417837888

Revision 2566:9bf417837888, 2.3 KB checked in by franck <carnet.franck.paul@…>, 12 years ago (diff)

Add some people in CREDITS, remove trailing spaces and tabs.

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
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 -----------------------------------------
12if (!defined('DC_RC_PATH')) { return; }
13
14$core->addBehavior('coreBlogGetPosts',array('rsExtendPublic','coreBlogGetPosts'));
15$core->addBehavior('coreBlogGetComments',array('rsExtendPublic','coreBlogGetComments'));
16
17class rsExtendPublic
18{
19     public static function coreBlogGetPosts($rs)
20     {
21          $rs->extend('rsExtPostPublic');
22     }
23
24     public static function coreBlogGetComments($rs)
25     {
26          $rs->extend('rsExtCommentPublic');
27     }
28}
29
30class rsExtPostPublic extends rsExtPost
31{
32     public static function getContent($rs,$absolute_urls=false)
33     {
34          # Not very nice hack but it does the job :)
35          if (isset($GLOBALS['_ctx']) && $GLOBALS['_ctx']->short_feed_items === true) {
36               $_ctx =& $GLOBALS['_ctx'];
37               $c = parent::getContent($rs,$absolute_urls);
38               $c = context::remove_html($c);
39               $c = context::cut_string($c,350);
40
41               $c =
42               '<p>'.$c.'... '.
43               '<a href="'.$rs->getURL().'"><em>'.__('Read').'</em> '.
44               html::escapeHTML($rs->post_title).'</a></p>';
45
46               return $c;
47          }
48
49          if ($rs->core->blog->settings->system->use_smilies)
50          {
51               return self::smilies(parent::getContent($rs,$absolute_urls),$rs->core->blog);
52          }
53
54          return parent::getContent($rs,$absolute_urls);
55     }
56
57     public static function getExcerpt($rs,$absolute_urls=false)
58     {
59          if ($rs->core->blog->settings->system->use_smilies)
60          {
61               return self::smilies(parent::getExcerpt($rs,$absolute_urls),$rs->core->blog);
62          }
63
64          return parent::getExcerpt($rs,$absolute_urls);
65     }
66
67     protected static function smilies($c,$blog)
68     {
69          if (!isset($GLOBALS['__smilies'])) {
70               $GLOBALS['__smilies'] = context::getSmilies($blog);
71          }
72          return context::addSmilies($c);
73     }
74}
75
76class rsExtCommentPublic extends rsExtComment
77{
78     public static function getContent($rs,$absolute_urls=false)
79     {
80          if ($rs->core->blog->settings->system->use_smilies)
81          {
82               $c = parent::getContent($rs,$absolute_urls);
83
84               if (!isset($GLOBALS['__smilies'])) {
85                    $GLOBALS['__smilies'] = context::getSmilies($rs->core->blog);
86               }
87               return context::addSmilies($c);
88          }
89
90          return parent::getContent($rs,$absolute_urls);
91     }
92}
Note: See TracBrowser for help on using the repository browser.

Sites map