Select Git revision
EditableList.vue
Forked from
Stud.IP / Stud.IP
Source project has a limited visibility.
-
Rasmus Fuhse authored
Closes #837 Merge request studip/studip!455
Rasmus Fuhse authoredCloses #837 Merge request studip/studip!455
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
ForumEntry.php 52.65 KiB
<?php
/**
* ForumEntry.php - Allows the retrieval and handling of forum-entrys
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* @author Till Glöggler <tgloeggl@uos.de>
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL version 3
* @category Stud.IP
*/
class ForumEntry implements PrivacyObject
{
const WITH_CHILDS = true;
const WITHOUT_CHILDS = false;
const THREAD_PREVIEW_LENGTH = 100;
const POSTINGS_PER_PAGE = 10;
const FEED_POSTINGS = 100;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* H E L P E R - F U N C T I O N S *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* is used for posting-preview. replaces all newlines with spaces
*
* @param string $text the text to work on
* @returns string
*/
public static function br2space($text)
{
return str_replace("\n", ' ', str_replace("\r", '', $text));
}
/**
* remove the edit-html from a posting
*
* @param string $description the posting-content
* @return string the content stripped by the edit-mark
*/
public static function killEdit($description)
{
// wurde schon mal editiert
if (preg_match('/^(.*)(<admin_msg.*?)$/s', $description, $match)) {
return $match[1];
}
return $description;
}
/**
* add the edit-html to a posting
*
* @param string $description the posting-content
* @return string the content with the edit-mark
*/
public static function appendEdit($description)
{
$edit = "<admin_msg autor=\"" . addslashes(get_fullname()) . "\" chdate=\"" . time() . "\">";
return $description . $edit;
}
/**
* convert the edit-html to raw text
*
* @param string $description the posting-content
* @return string the content with the raw text version of the edit-mark