Various text helpers such as limiting.
This is the code documentation for the SproutCMS project
Search documentation |
class TextVarious text helpers such as limiting.
Extending this class<?php /** * New class description goes here * * @author Your Name, 2025-04-20 **/ class NewClassName extends Text { /** * Returns current year or original year and current year of copyright **/ public function copyright (string $year) { // Method code goes here } /** * Encode HTML so it's suitable for direct output, but allow some HTML tags to be left as-is * * Only a limited subset of tags are left alone, all other tags are stripped. * Allowed tags: A, B, I, STRONG, EM, BR, IMG, SPAN, ABBR, SUP, SUB * * The algorithm used in this method is quite simple, so this method should not be used * as a defence against XSS attacks; it should only be used on trusted input such as Form helptext. **/ public function limitedSubsetHtml (string $html) { // Method code goes here } /** * Convert a CamelCaps or camelCase name into a lower_case names **/ public function camel2lc (string $name) { // Method code goes here } /** * Convert a lower_case names into camelCase names **/ public function lc2camelcase (string $name) { // Method code goes here } /** * Convert a lower_case names into CamelCaps names **/ public function lc2camelcaps (string $name) { // Method code goes here } /** * Make a chunk of plain text into HTML rich text * The text will be wrapped within a block element (default is a P tag) **/ public function richtext (string $text, string $block_elem) { // Method code goes here } /** * Returns human readable sizes. **/ public function bytes (integer $bytes, string $force_unit, string $format, boolean $si) { // Method code goes here } /** * Returns a number with an english suffix appended (e.g. 1st, 5th, 12th, 123rd) **/ public function ordinalize ($number) { // Method code goes here } /** * Make a chunk of valid HTML into plain text, and (optionally) limit the number of words. **/ public function plain (string $html, int $max_words) { // Method code goes here } /** * Prevents widow words by inserting a non-breaking space between the last two words. **/ public function widont (string $str) { // Method code goes here } /** * Automatically applies and markup to text. Basically nl2br() on steroids. **/ public function autoP (string $str) { // Method code goes here } /** * Converts text email addresses into links. **/ public function autoLinkEmails (string $text) { // Method code goes here } /** * Replaces the given words with a string. **/ public function censor (string $str, array $badwords, string $replacement, boolean $replace_partial_words) { // Method code goes here } /** * Finds the text that is similar between a set of words. **/ public function similar (array $words) { // Method code goes here } /** * Converts text email addresses and anchors into links. **/ public function autoLink (string $text) { // Method code goes here } /** * Converts text anchors into links. **/ public function autoLinkUrls (string $text) { // Method code goes here } /** * Alternates between two or more strings. **/ public function alternate () { // Method code goes here } /** * Reduces multiple slashes in a string to single slashes. **/ public function reduceSlashes (string $str) { // Method code goes here } /** * Limits a plain-text phrase to a given number of characters. **/ public function limitChars (string $str, int $limit, string $end_char, boolean $preserve_words) { // Method code goes here } /** * Limits HTML to a certain number of words. * Is aware of tags etc and will not count them in the word-count, as well as closing them properly. * * This doesn't actually pass all unit tests at the moment - an exact match in num words will still put in ... part. **/ public function limitWordsHtml ($text, $limit) { // Method code goes here } /** * Determines whether given HTML contains a FORM tag, which can cause nested-forms issues * * Not tested with malformed input - should not be used as an XSS filter **/ public function containsFormTag (string $html) { // Method code goes here } /** * Limits a plain-text phrase to a given number of words. **/ public function limitWords (string $str, int $limit, string $end_char) { // Method code goes here } } ?> |
Powered by Pelzini, version 0.9.0 |
Documentation is made available under the
GNU Free Documentation License 1.2. Generated: Monday, 3rd April, 2023 at 02:59 pm |
![]() |