HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/apklausos/application/extensions/admin/TextDisplaySwitch/TextDisplaySwitch.php
<?php
class TextDisplaySwitch extends CWidget {
    
    public $widgetsJsName = "";
    public $textToDisplay = "";
    public $abbreviationSize = 120;
    public $abbreviationSign = '...';
    public $returnHtml = false;

    public function run() {
        //clean up the widgets name to be js friendly
        $this->widgetsJsName = preg_replace('/[^a-zA-Z0-9_-]/','',(string) $this->widgetsJsName);
        
        $this->registerScripts();
        $outView = (strlen((string) $this->textToDisplay) > $this->abbreviationSize) ? 'default' : 'short';
        
        if( $this->returnHtml ){
            return $this->render($outView, null, true);
        }

        $this->render($outView);

    }

    private function registerScripts(){
        App()->getClientScript()->registerScriptFile(App()->getAssetManager()->publish(dirname(__FILE__) . '/assets/textDisplaySwitch.js'), CClientScript::POS_END);
    }
}