Dotclear

source: inc/public/rs.extension.php @ 3731:3770620079d4

Revision 3731:3770620079d4, 2.5 KB checked in by franck <carnet.franck.paul@…>, 8 years ago (diff)

Simplify licence block at the beginning of each file

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

Sites map