1<?php
2/**
3 * Date/time Command: Formats a date/time to a pre-configured format.
4 *
5 * For a full description of this Command Plugin command, see:
6 *   http://www.splitbrain.org/plugin:date-time
7 *
8 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
9 * @author     Joe Lapp <http://www.spiderjoe.com>
10 */
11
12class CommandPluginExtension_abstract extends CommandPluginExtension
13{
14    function getCachedData($embedding, $params, $paramHash, $content,
15                             &$errorMessage) // STATIC
16    {
17      $len = 0;
18        if(sizeof($params) == 1 && ($params[0]))
19            $len = $params[0];
20        else if(sizeof($params) != 0)
21        {
22            $errorMessage = "_INVALID_DT_PARAMETERS_";
23            return null; // return value doesn't matter in this case
24        }
25        $content = trim($content);
26
27        if($len && $len < strlen($content)){
28            $content = utf8_substr($content, 0, $len).'…';
29        }
30
31        if($embedding == 'block')
32        {
33                return '<div>'.$content.'</div>';
34        }
35        return $content;
36    }
37}
38?>