Dotclear

source: inc/public/rs.extension.php @ 848:ad18a33a3cef

Revision 848:ad18a33a3cef, 1.8 KB checked in by Dsls <dsls@…>, 13 years ago (diff)

sexy step 1 : no more comments ...

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

Sites map