@param $base64

@return $this
@throws \yii\base\InvalidConfigException
489242
public static function create($base64)
    {
        if (($pos = strpos($base64, self::STOPPER)) !== false) {
            $base64 = substr($base64, $pos + strlen(self::STOPPER));
        }

        return \Yii::createObject([
            'class'  => self::className(),
            'base64' => $base64
        ]);
    }
109510
public function init()
    {
        if ($this->dataProvider === null) {
            throw new InvalidConfigException('The "dataProvider" property must be set.');
        }
        if ($this->emptyText === null) {
            $this->emptyText = Yii::t('yii', 'No results found.');
        }
        if (!isset($this->options['id'])) {
            $this->options['id'] = $this->getId();
        }

        if ($this->formatter == null) {
            $this->formatter = Yii::$app->getFormatter();
        } elseif (is_array($this->formatter)) {
            $this->formatter = Yii::createObject($this->formatter);
        }
        if (!$this->formatter instanceof Formatter) {
            throw new InvalidConfigException('The "formatter" property must be either a Format object or a configuration array.');
        }

        if (!$this->keyColumnName) {
            throw new InvalidConfigException('The "keyColumnName" property must be specified"');
        }
        if (!$this->parentColumnName) {
            throw new InvalidConfigException('The "parentColumnName" property must be specified"');
        }

        $this->initColumns();
    }
1206126
private function upFile($base64)
    {
        //处理base64上传
        if ('base64' == $base64) {
            $content = $_POST[ $this->fileField ];
            $this->base64ToImage($content);

            return;
        }

        //处理普通上传
        $file = $this->file = $_FILES[ $this->fileField ];
        if (!$file) {
            $this->stateInfo = $this->getStateInfo('POST');

            return;
        }
        if ($this->file[ 'error' ]) {
            $this->stateInfo = $this->getStateInfo($file[ 'error' ]);

            return;
        }
        if (!is_uploaded_file($file[ 'tmp_name' ])) {
            $this->stateInfo = $this->getStateInfo('UNKNOWN');

            return;
        }

        $this->oriName = $file[ 'name' ];
        $this->fileSize = $file[ 'size' ];
        $this->fileType = $this->getFileExt();

        if (!$this->checkSize()) {
            $this->stateInfo = $this->getStateInfo('SIZE');

            return;
        }
        if (!$this->checkType()) {
            $this->stateInfo = $this->getStateInfo('TYPE');

            return;
        }

        $folder = $this->getFolder();

        if ($folder === false) {
            $this->stateInfo = $this->getStateInfo('DIR_ERROR');

            return;
        }

        $this->fullName = $folder.'/'.$this->getName();

        if ($this->stateInfo == $this->stateMap[ 0 ]) {
            if (!move_uploaded_file($file[ 'tmp_name' ], $this->fullName)) {
                $this->stateInfo = $this->getStateInfo('MOVE');
            }
        }
    }
782248
public function downloadSingle($base64)
    {
        try {
            /**
             * Path to File on Disk
             */
            $path = $this->getSearchPath() . '/' . base64_decode($base64);

            clearstatcache();

            if (is_file($path)) {
                header("Content-Type: audio/mpeg");
                header("Content-Disposition: attachment; filename=" . basename($this->cleanPath($path)));
                header("Content-Length: " . filesize($path));

                $handle = fopen(
                    $path,
                    'rb'
                );

                $contents = fread(
                    $handle,
                    filesize($path)
                );

                while ($contents) {
                    echo $contents;
                }

                fclose($handle);
            } else {
                throw new \Exception(
                    $path . ' ' . $this->translate->translate(
                        'was not found',
                        'mp3'
                    )
                );
            }
        } catch (\Exception $e) {
            throw $e;
        }
    }
628441
public function toBase64() {
        ob_start ();
        $this->saveAs();
        $data = ob_get_contents();
        ob_end_clean();
        return 'data:image/'.$this->realType.';base64,'.base64_encode($data);
    }
433542
protected function setBaseUrl($site): self
    {
        $this->baseUrl = sprintf($this->baseUrl, $site, self::VERSION);

        return $this;
    }
33460
public function init()
    {
        if (!isset($this->basePath)) {
            $this->basePath = Yii::getPathOfAlias('webroot');
        }
        $this->basePath = rtrim($this->basePath, '/');
    }
342520
public function initConfig ()
    {
        if (empty(Yii::$app->params['domain'])) {
            throw new InvalidConfigException("param `domain` must set.", 1);
        }
        $this->_config = $this->mergeConfig();
        $config = Json::htmlEncode($this->_config);
        $js = <<<JS
            var {$this->_hashVar} = {$config};
            $('#{$this->_hashVar}').webupload_fileinput({$this->_hashVar});
JS;
        $this->_view->registerJs($js);
    }
395427
public function setViewPath(string $basePath): self
    {
        $this->viewPath = $basePath;

        if (substr($this->viewPath, -1) != '/') {
            $this->viewPath .= '/';
        }

        return $this;
    }
1309239
public function inPool($pool = null)
    {
        if (empty($pool)) {
            return $this;
        }
        $model = Yii::createObject($this->modelClass);

        if (!array_key_exists($pool, $model->ngRestPools())) {
            throw new InvalidConfigException("The requested pool identifier '{$pool}' does not exist in the ngRestPools() definition.");
        }

        return $this->andWhere($model->ngRestPools()[$pool]);
    }
1229507
private function convertBase64ToDec($value)
    {
        $value = unpack('H*', Base64Url::decode($value));

        return $this->convertHexToDec($value[1]);
    }
518451
public function isBase64()
    {
        if (!is_string($this->data)) {
            return false;
        }

        return base64_encode(base64_decode($this->data)) === $this->data;
    }
533302
public function setContextConfig(array $config)
    {
        if ($this->type == InternalBaseBlock::INJECTOR_VAR) {
            return $this->context->addVar($config, $this->append);
        }
         
        if ($this->type == InternalBaseBlock::INJECTOR_CFG) {
            return $this->context->addCfg($config, $this->append);
        }
        
        throw new InvalidConfigException("The type '{$this->type}' is not supported.");
    }
142992
public function decode()
    {
        // Fix plus to space conversion issue
        $this->data = str_replace(' ', '+', $this->data);

        // Do decoding
        $this->data = base64_decode($this->data);

        return $this;
    }
1356385
protected function createModel()
    {
        if ($this->model instanceof \yii\base\Model) {
            Yii::info('Model already configured as instanceof ' . $this->model->className(), __METHOD__);

            return false;
        }

        if (is_array($this->model)) {
            if (!ArrayHelper::isIndexed($this->model) || !$this->model[0] instanceof \yii\base\Model) {
                throw new InvalidConfigException("Property 'model'"
                    . ' must be configured as indexed array of \\yii\\base\\Model');
            }
            Yii::info('Model property configured as array of ' . $this->model[0]->className(), __METHOD__);

            return false;
        }

        if (is_string($this->model)) {
            $this->model = Yii::createObject($configuration = ['class' => $this->model]);
            Yii::info('Model initialized with configuration: ' . VarDumper::dumpAsString($configuration), __METHOD__);
        }

        return true;
    }
1054186
protected function upload($fieldName, $config, $base64 = 'upload')
    {
        $up = new Uploader($fieldName, $config, $base64);

        if ($this->allowIntranet)
            $up->setAllowIntranet(true);

        $info = $up->getFileInfo();
        if (($this->thumbnail or $this->zoom or $this->watermark) && $info['state'] == 'SUCCESS' && in_array($info['type'], ['.png', '.jpg', '.bmp', '.gif'])) {
            $info['thumbnail'] = Yii::$app->request->baseUrl . $this->imageHandle($info['url']);
        }
        $info['url'] = Yii::$app->request->baseUrl . $info['url'];
        $info['original'] = htmlspecialchars($info['original']);
        $info['width'] = $info['height'] = 500;
        return $info;
    }
789851
protected function getAESKey()
    {
        if (empty($this->AESKey)) {
            throw new InvalidConfigException("Configuration mission, 'aes_key' is required.");
        }

        if (strlen($this->AESKey) !== 43) {
            throw new InvalidConfigException("The length of 'aes_key' must be 43.");
        }

        return base64_decode($this->AESKey.'=', true);
    }