Lista obrazów json (na potrzeby tinymce)
@return string
337576
public function listAction()
    {
        \Mmi\App\FrontController::getInstance()->getResponse()->setHeader('Content-type', 'application/json');
        if (!$this->object || !$this->objectId || !$this->hash || !$this->t) {
            return '';
        }
        if ($this->hash != md5(\Mmi\Session\Session::getId() . '+' . $this->t . '+' . $this->objectId)) {
            return '';
        }
        $files = [];
        foreach (\Cms\Orm\CmsFileQuery::imagesByObject($this->object, $this->objectId)->find() as $file) {
            $files[] = ['title' => $file->original, 'value' => $file->getUrl('default', '')];
        }
        return json_encode($files);
    }
33697
public function indexAction()
    {
        if (!$this->name) {
            return '';
        }
        //lista dozwolonych znaków
        $characters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'U', 'W', 'Z'];
        $word = '';
        $charsCount = count($characters) - 1;

        //generuje 5 literowy string
        for ($i = 0; $i < 5; $i++) {
            $word .= $characters[rand(0, $charsCount)];
        }

        //tworzenie obrazu
        $img = imagecreatetruecolor(130, 50);

        //konfiguracja kolorów
        $green = imagecolorallocate($img, 0x00, 0x77, 0x00);
        $gray = imagecolorallocate($img, 0xF5, 0xF5, 0xF5);
        $darkGray = imagecolorallocate($img, 0x99, 0x99, 0x99);

        //czcionka
        $font = BASE_PATH . '/web/resource/cmsAdmin/ttf/dejavu.ttf';

        //ramka
        imagefilledrectangle($img, 0, 0, 129, 49, $darkGray);
        imagefilledrectangle($img, 1, 1, 128, 48, $gray);

        $prevSpace = -5;
        $prevAngle = 0;

        //przesunięcia i obroty
        for ($i = 0; $i < strlen($word); $i++) {
            if ($i % 2 != 0) {
                $size = rand(32, 36);
                $height = rand(42, 46);
                $angle = rand(5, 15);
                $space = 25 + $prevSpace;
            } else {
                $size = rand(28, 32);
                $height = rand(39, 43);
                $angle = rand(-15, 5);
                $space = 13 + $prevSpace;
            }
            $prevSpace = $space;
            $prevAngle = $angle;
            imagefttext($img, $size, $angle, $space, $height, $green, $font, $word[$i]);
        }

        //zapis do sesji
        $formSession = new \Mmi\Session\SessionSpace('captcha');
        //filtracja nazwy pola z nazwy formularza + pola
        $name = strpos($this->name, '[') === false ? $this->name : substr($this->name, strpos($this->name, '[') + 1, -1);
        $formSession->$name = $word;

        //ustalenie nagłówka na niebuforowany
        $this->getResponse()
            ->setHeader('Expires', 'Mon, 15 Dec ' . (date('Y') - 1) . ' 01:00:00 GMT+0100')
            ->setHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT')
            ->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate')
            ->setHeader('Cache-Control', 'post-check=0, pre-check=0', false)
            ->setHeader('Pragma', 'no-cache')
            ->setTypeJpeg();

        //zwrot obrazu
        imagejpeg($img, NULL, 25);
        return '';
    }
1167663
public function ldJson()
    {
        $attributes = [
            '@context' => 'http://schema.org',
            '@type' => 'WebSite',
            'url' => $this->Url->build('/', true),
            'potentialAction' => [
                '@type' => 'SearchAction',
                'query-input' => 'required name=search_term_string',
                'target' => $this->Url->build([
                    'plugin' => 'Wasabi/Cms',
                    'controller' => 'Frontend/Search',
                    'action' => 'search',
                    'language_id' => Wasabi::contentLanguage()->id
                ], true) . '?q={search_term_string}'
            ]
        ];

        if (!empty(WasabiCms::$instanceName)) {
            $attributes['name'] = WasabiCms::$instanceName;
        }

        $sameAsKeys = [
            'Settings.Cms.SEO.Social.facebook_url',
            'Settings.Cms.SEO.Social.instagram_url',
            'Settings.Cms.SEO.Social.linkedin_url',
            'Settings.Cms.SEO.Social.myspace_url',
            'Settings.Cms.SEO.Social.pinterest_url',
            'Settings.Cms.SEO.Social.youtube_url',
            'Settings.Cms.SEO.Social.googleplus_url'
        ];
        $sameAs = [];

        foreach ($sameAsKeys as $key) {
            $setting = Configure::read($key);
            if (!empty($setting)) {
                $sameAs[] = $setting;
            }
        }

        $twitterName = Configure::read('Settings.Cms.SEO.Social.twitter_username');
        if (!empty($twitterName)) {
            $sameAs[] = 'https://twitter.com/' . $twitterName;
        }

        if (!empty($sameAs)) {
            $attributes['sameAs'] = $sameAs;
        }

        return '<script type="application/ld+json">' . json_encode($attributes) . '</script>';
    }
257356
public function renderDataTableJson()
    {
        $res = array();
        $render = $this->getTable()->getRow()->renderRows('array');
        $res['sEcho'] = $render;
        $res['iTotalDisplayRecords'] = $this->getTable()->getSource()->getPaginator()->getTotalItemCount();
        $res['aaData'] = $render;

        return json_encode($res);
    }
716365
public function toJSON()
    {
        $result = [
            'Status' => $this->Status(),
            'ShouldPass' => $this->ShouldPass(),
            'Checks' => []
        ];
        foreach ($this->details as $detail) {
            $result['Checks'][] = $detail->toMap();
        }
        return json_encode($result);
    }
35079
public function toJson()
    {
        $json = array();
        $json['id'] = $this->id;
        $json['from'] = $this->from;
        $json['color'] = $this->color;
        $json['message'] = $this->message;
        $json['notify'] = $this->notify;
        $json['message_format'] = $this->messageFormat;
        $json['date'] = $this->date;

        return $json;

    }
1178434
public function toJSON()
    {   
        $allvals = Array();
        $reflection = new \ReflectionObject($this);
        $properties = $reflection->getProperties(\ReflectionProperty::IS_PUBLIC);
        foreach($properties as $prop){
            $propkey = $prop->getName();
            $allvals[$propkey] = $this->$propkey;
        }
        $json = json_encode($allvals, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
        return $json;
    }
240631
public function toJson()
    {
        $json = array();

        $json['name'] = $this->getName();
        $json['privacy'] = $this->getPrivacy();
        //Parameters for PUT call (Room already exists)
        if ($this->getId()) {
            $json['is_archived'] = $this->isArchived();
            $json['is_guest_accessible'] = $this->isGuestAccessible();
            $json['topic'] = $this->getTopic();
            $json['owner'] = array('id' => $this->getOwner()->getId());
        } else { //Paramters for POST call
            $json['guest_access'] = $this->isGuestAccessible();
            if ($this->getOwner()) {
                $json['owner_user_id'] = $this->getOwner()->getId();
            }
        }
        return $json;
    }
52492
public function getList()
    {
        $list = Internal\Data::getList('bearcms/comments/thread/');
        $result = new \IvoPetkov\DataList();
        foreach ($list as $value) {
            $rawData = json_decode($value, true);
            $tempCollection = Internal\Data\Comments::createCommentsCollection($rawData['comments'], $rawData['id']);
            foreach ($tempCollection as $dataObject) {
                $result[] = $dataObject;
            }
        }
        return $result;
    }
391670
protected function getJsonDocumentList()
    {
        if (!isset($this->config['library'])) {
            return json_encode(static::$apiResponseBody, JSON_PRETTY_PRINT);
        }

        if (!count($this->config['library'])) {
            return json_encode(static::$apiResponseBody, JSON_PRETTY_PRINT);
        }

        foreach (array_keys($this->config['library']) as $document) {
            static::$apiResponseBody['data'][] = [
                'document' => $document,
                'link' => Router::url([
                    'plugin' => 'Alt3/Swagger',
                    'controller' => 'Docs',
                    'action' => 'index',
                    $document
                ], true)
            ];
        }

        return json_encode(static::$apiResponseBody, JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES);
    }
1227621
public function toJson()
    {
        $json = [];

        if (! empty($this->registrationIds)) {
            $json['registration_ids'] = $this->registrationIds;
        }

        if ($this->collapseKey) {
            $json['collapse_key'] = $this->collapseKey;
        }

        if (! empty($this->data)) {
            $json['data'] = $this->data;
        }

        if (! empty($this->notification)) {
            $json['notification'] = $this->notification;
        }

        if ($this->delayWhileIdle) {
            $json['delay_while_idle'] = $this->delayWhileIdle;
        }

        if ($this->timeToLive != 2419200) {
            $json['time_to_live'] = $this->timeToLive;
        }

        if ($this->restrictedPackageName) {
            $json['restricted_package_name'] = $this->restrictedPackageName;
        }

        if ($this->dryRun) {
            $json['dry_run'] = $this->dryRun;
        }

        return Json::encode($json);
    }
1357669
public function jsonSerialize()
    {
        $json = [];

        foreach (['code', 'message', 'description', 'uri'] as $field) {
            if ($this->$field !== null) {
                $json[$field] = $this->$field;
            }
        }

        return $json;
    }
125061
public function getList()
    {
        $list = $this->doc->getList();
        $list = $this->setIcon($list);
        return response(['firstId'=>'', 'list'=>$list], 200, [], 'json');
    }
271782
public function createAction()
    {
        $this->getResponse()->setTypeJson();
        $cat = new \Cms\Orm\CmsCategoryRecord();
        $cat->name = $this->getPost()->name;
        $cat->parentId = ($this->getPost()->parentId > 0) ? $this->getPost()->parentId : null;
        $cat->order = $this->getPost()->order;
        $cat->active = false;
        $cat->status = \Cms\Orm\CmsCategoryRecord::STATUS_ACTIVE;
        if ($cat->save()) {
            $icon = '';
            $disabled = false;
            //ikona nieaktywnego wezla gdy nieaktywny
            if (!$cat->active) {
                $icon = $this->view->baseUrl . '/resource/cmsAdmin/images/folder-inactive.png';
            }
            //sprawdzenie uprawnień do węzła
            $acl = (new \CmsAdmin\Model\CategoryAclModel)->getAcl();
            if (!$acl->isAllowed(\App\Registry::$auth->getRoles(), $cat->id)) {
                $disabled = true;
                //ikona zablokowanego wezla gdy brak uprawnien
                $icon = $this->view->baseUrl . '/resource/cmsAdmin/images/folder-disabled.png';
            }
            return json_encode([
                'status' => true,
                'id' => $cat->id,
                'icon' => $icon,
                'disabled' => $disabled,
                'message' => $this->view->_('controller.category.create.message')
            ]);
        }
        return json_encode(['status' => false, 'error' => $this->view->_('controller.category.create.error')]);
    }
1297751
public function toJson()
    {
        $packageDetails = new \stdClass;
        $packageDetails->name = $this->getName();
        $packageDetails->description = $this->getDescription();
        $packageDetails->license = $this->getLicense();
        $packageDetails->authors = $this->getAuthors();

        return json_encode($packageDetails, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
    }
1052091
public function getBlockJson()
    {
        return json_encode(array(
            'container' => $this->getWrapperId(),
            'block' => $this->getBlockName(),
            'cookie' =>  $this->getCookie(),
            'additionalCookies' => (object)$this->getAdditionalCookies(),
            'callback' =>  ($this->getCallback() ? $this->getCallback() : false)
        ));
    }
1156079
public function fetchField()
    {
        $view = \Mmi\App\FrontController::getInstance()->getView();
        $view->headScript()->appendFile('/resource/cmsAdmin/js/tiny/tinymce.min.js');

        //bazowa wspólna konfiguracja
        $this->_baseConfig($view);
        //tryb edytora
        $mode = $this->getMode() ? $this->getMode() : 'default';
        //metoda konfiguracji edytora
        $modeConfigurator = '_mode' . ucfirst($mode);
        if (method_exists($this, $modeConfigurator)) {
            $this->$modeConfigurator();
        }

        $class = $this->getOption('id');
        $this->setOption('class', trim($this->getOption('class') . ' ' . $class));
        $object = 'tmp-' . $this->getUploaderObject();
        $objectId = $this->getUploaderId();
        $t = round(microtime(true));
        $hash = md5(\Mmi\Session\Session::getId() . '+' . $t . '+' . $objectId);
        //tworzenie kopii plików załadowanych do TinyMce
        $this->_createTempFiles();
        //aktualizacja wartości pola - poprawka ścieżek do plików
        $this->_updateValue();
        //dołączanie skryptu
        $view->headScript()->appendScript("
			tinyMCE.init({
				selector: '." . $class . "',
				language: request.locale,
				" . $this->_renderConfig('theme', 'theme', 'modern') . "
				" . $this->_renderConfig('skin', 'skin', 'lightgray') . "
				" . $this->_renderConfig('plugins', 'plugins') . "
				" . $this->_renderConfig('contextmenu', 'contextMenu') . "
				" . $this->_renderConfig('width', 'width', '') . "
				" . $this->_renderConfig('height', 'height', 320) . "
				" . $this->_renderConfig('resize', 'resize', true) . "
				" . $this->_renderConfig('menubar', 'menubar', true) . "
				" . $this->_renderConfig('image_advtab', 'imageAdvanceTab', true) . "
				" . $this->_renderConfig('font_formats', 'fontFormats') . "
				" . $this->_renderConfig('fontsize_formats', 'fontSizeFormats') . "
				" . $this->_renderConfig('content_css', 'css') . "
				" . $this->_renderConfigN('toolbar', 'toolbars') . "
				" . $this->_renderConfig('image_caption', 'imageCaption', false) . "
				" . ($this->getCustomConfig() ? trim($this->getCustomConfig(), ",") . "," : "") . "
				" . $this->_other . "
				" . $this->_common . "
				hash: '$hash',
				object: '$object',
				objectId: '$objectId',
				time: '$t',
				baseUrl: '" . $view->baseUrl . "',
                image_list: '" . $view->baseUrl . "' + '/?module=cms&controller=file&action=list&object=$object&objectId=$objectId&t=$t&hash=$hash',
                branding: false
			});
		");

        //unsety zbędnych opcji
        $this->unsetMode()->unsetCustomConfig()->unsetCss()->unsetTheme()->unsetSkin()
            ->unsetPlugins()->unsetContextMenu()->unsetResize()->unsetMenubar()
            ->unsetImageAdvanceTab()->unsetFontFormats()->unsetFontSizeFormats()
            ->unsetToolbars()->unsetImageCaption();

        return parent::fetchField();
    }