Ajoute du contenu

@param string $ongletName     Nom de l'onglet
@param string $content        Contenu
@param bool   $isSelected     L'onglet est-il sélectionné ?
@param string $type           Type
@param string $optionsParType ?

@return void
347916
function addContent(
        $ongletName="default", $content="",
        $isSelected=false, $type="default", $optionsParType=""
    ) {
        $this->ongletsArray[$ongletName]=$content;
        $this->typeOngletsArray[$ongletName]=$type;
        $this->optionsOngletParType[$ongletName]=$optionsParType;
        
        $this->listeOngletJSNameArray[]=$this->convertIntituleOnglet($ongletName).
        (count($this->ongletsArray)-1).$this->idOngletBuilder;
        if ($isSelected && count($this->ongletsArray)>0) {
            $this->numOngletSelected=count($this->ongletsArray)-1;
        }
    }
1332753
public function countChangeLogByContentType($contentType, array $options)
    {
        $query = $this->countChangeLogByContentTypeQuery($contentType, $options);

        return $this->getCount($query->execute()->fetch());
    }
378032
private function dispatch(Content $content, $type, $legacyType)
    {
        $event = new StorageEvent($content, ['contenttype' => $content->getContenttype(), 'create' => false]);
        try {
            $this->dispatcher->dispatch("timed.$type", $event);
        } catch (\Exception $e) {
            $this->systemLogger->critical(sprintf('Dispatch handling failed for %s.', $content->getContenttype()), ['event' => 'exception', 'exception' => $e]);
        }
        try {
            /** @deprecated Deprecated since 3.1, to be removed in 4.0. */
            $this->dispatcher->dispatch("timed.$legacyType", $event);
        } catch (\Exception $e) {
            $this->systemLogger->critical(sprintf('Dispatch handling failed for %s.', $content->getContenttype()), ['event' => 'exception', 'exception' => $e]);
        }
    }
763550
public static function renderElement($type, $content, $options = [])
    {
        $tag = ArrayHelper::remove($options, 'tag', 'div');

        $class = ArrayHelper::remove($options, 'class');
        Html::addCssClass($options, 'ui ' . $class . ' ' . $type);

        return Html::tag($tag, $content, $options);
    }
1216537
public function value($options = [], $content = '')
    {
        if (!is_array($options)) {
            $options = ['value' => $options];
        }

        $this->values[] = new Option($this->form->expression('option'), $options, $content);
        return $this;
    }
399192
public function collapse($content, $type)
    {
        $contentType = $this->contentType->findOneBy(array('content' => $content, 'type' => $type));

        $contentType->setCollapse(!$contentType->isCollapse());
        $this->manager->persist($contentType);
        $this->manager->flush();
    }
969678
public function write($content) {
        if (is_string($content) || is_numeric($content)) {
            $this->writeString($content);
        } elseif (is_bool($content)) {
            $this->writeString($content ? "TRUE" : "FALSE");
        } elseif (is_array($content)) {
            $this->writeString("Array(" . count($content) . ")");
        } elseif (is_object($content) && method_exists($content, "__toString")) {
            $this->writeString(strval($content));
        } elseif (is_null($content)) {
            $this->writeString("NULL");
        } elseif (is_resource($content)) {
            $this->writeString("Resource###");
        } else {
            throw new InvalidContentException();
        }
    }
87460
public function mailto($content, $mail, array $options = []) {
        if ($content === $mail) {
            throw new \RuntimeException('El contenido no debe ser una direcci&oacute;n de email, pruebe "Contacteme"');
        }
        $data = explode('@', $mail);
        
        $user = $data[0];
        $server = key_exists(1, $data) ? explode('.', $data[1]) : [];
        
        $config = [
            'onclick' => 'this.href=\'mailto:\' + \'' 
                . $user . '\' + \'@\' + \'' 
                . (key_exists(0, $server) ? $server[0] : '') . '\' + \'.\' + \''
                . (key_exists(1, $server) ? $server[1] : '') . '\'',
            'rel' => 'nofollow'
        ] + $options;
        
        return $this->link($content, '', $config);
    }
593522
public function contentTag($name, $content, array $options = array(), $escape = false)
    {
        if ($content instanceof \Closure) {
            ob_start();
            $ret     = $content();
            $content = ob_get_clean();
            if ($ret !== null) {
                $content = $ret;
            }
        }
        return $this->contentTagString($name, $content, $options, $escape);
    }
136925
public function setContent($text, $type = 'text')
    {
        $this->setType($type);
        $this->getDomElement()->nodeValue = $text;
        $this->setCachedProperty('content', $this->parseContent());
    }
551268
public function contentAlternative($content, $contentType = null, $charset = null)
    {
        $this->getSwiftMessage()->addPart($content, $contentType, $charset);

        return $this;
    }
299228
public function uploadByContent($content, $type = '', $option = [])
    {
        // 临时文件
        $tmp_file = Common::tmpFile('upload');
        file_put_contents($tmp_file, $content);
        
        // 上传完删除文件
        $this->onDone = function ($data) {
            @unlink($data['path']);
        };
        
        return $this->uploadByPath($tmp_file, $type, $option);
    }
905072
public static function well($content, $htmlOptions = array())
    {
        self::addCssClass('well', $htmlOptions);
        $size = TbArray::popValue('size', $htmlOptions);
        if (!empty($size)) {
            self::addCssClass('well-' . $size, $htmlOptions);
        }
        return self::tag('div', $htmlOptions, $content);
    }
736697
private function formatRequest($content, array $options)
    {
        $docOptions = ['type', 'language', 'content', 'gcsContentUri'];
        $options += [
            'encodingType' => 'UTF8',
            'type' => 'PLAIN_TEXT',
            'detectGcsUri' => true
        ];

        if ($content instanceof StorageObject) {
            $options['gcsContentUri'] = $content->gcsUri();
        } elseif ($options['detectGcsUri'] && substr($content, 0, 5) === 'gs://') {
            $options['gcsContentUri'] = $content;
        } else {
            $options['content'] = $content;
        }

        unset($options['detectGcsUri']);

        foreach ($options as $option => $value) {
            if (in_array($option, $docOptions)) {
                $options['document'][$option] = $value;
                unset($options[$option]);
            }
        }

        return $options;
    }
821021
public function updateSelf(array $content, array $options = [])
    {
        $response = $this->query(
            $this->buildQueryArgs('auth', 'updateSelf'),
            [
                'body' => $content
            ],
            $options
        );

        return $response['result'];
    }
591415
public function link($content, $url = [], array $options = []) {
        /* @var $url_helper UrlHelper */
        $url_helper = $this->url;
        
        $cfg = [
            'href' => is_array($url) ? (
                key_exists('push', $url) ? $url_helper->push($url['push']) : (
                key_exists('add', $url) || key_exists('remove', $url) ? 
                    $url_helper->modify(
                        key_exists('add', $url) ? $url['add'] : [],
                        key_exists('remove', $url) ? $url['remove'] : []
                    ) : (
                        key_exists('generate', $url) ? $url_helper->build($url, Arr::trim($url, 'generate')) :
                            (key_exists('mailto', $url) ? 'mailto:' . $url['mailto'] : $url_helper->build($url))
                    )
            )) : ( $url_helper->routeExist($url) ? $url_helper->build([], $url) : $url )
        ] + $options;
        return '<a ' . Str::htmlserialize($cfg) . ' >' . $content . '</a>';
    }
229298
public static function select(
        string $content, 
        array $attributes = [],
        array $options = []
    ) : string
    {
        foreach ($options as $key => $val) {
            $content .= $this->option($key, ["value" => $val]);
        }
        return self::tag("select", $content, $attributes);
    }