modxcms/revolution

View on GitHub
core/model/modx/processors/element/tv/renders/web/output/string.class.php

Summary

Maintainability
A
25 mins
Test Coverage
<?php
/*
 * This file is part of MODX Revolution.
 *
 * Copyright (c) MODX, LLC. All Rights Reserved.
 *
 * For complete copyright and license information, see the COPYRIGHT and LICENSE
 * files found in the top-level directory of this distribution.
 */

/**
 * @package modx
 * @subpackage processors.element.tv.renders.mgr.output
 */
class modTemplateVarOutputRenderString extends modTemplateVarOutputRender {
    public function process($value,array $params = array()) {
        $value= $this->tv->parseInput($value);
        $format= !empty($params['format']) ? strtolower($params['format']) : '';
        switch ($format) {
            case 'upper case':
                $o = strtoupper($value);
                break;
            case 'lower case':
                $o = strtolower($value);
                break;
            case 'sentence case':
                $o = ucfirst($value);
                break;
            case 'capitalize':
                $o = ucwords($value);
                break;
            default:
                $o = $value;
                break;
        }
        return $o;
    }
}
return 'modTemplateVarOutputRenderString';