{@inheritdoc}

Импорт из файла.
683
public function startImport(array &$form, FormStateInterface $form_state) {
        // Выполняет стандартную валидацию полей формы и добавляет примечания об ошибках.
        ConfigFormBase::validateForm($form, $form_state);

        if (!$form_state->getValue('validate_error')) {
            $config = $this->config('site_commerce.drupal7import');

            $fid = $config->get('fid');
            $skip_first_line = $config->get('skip_first_line');            
            $chunk_size = $config->get('chunk_size');            

            if ($fid) {
                $import = new SiteCommerceDrupal7BatchImport($fid, $skip_first_line, $chunk_size);
                $import->setBatch();
            }
        }
    }
915452
public function init()
    {
        //klucz
        $this->addElement((new Element\Text('key'))
                ->setLabel('form.text.key.label')
                ->setRequired()
                ->addValidator(new \Mmi\Validator\NotEmpty));

        //zawartość
        $this->addElement((new Element\Textarea('content'))
                ->setLabel('form.text.content.label'));

        //submit
        $this->addElement((new Element\Submit('submit'))
                ->setLabel('form.text.submit.label'));
    }
1046508
public function init() {
		$htmlId = $this->fileUploadControl->getHtmlId();
		
		foreach($this->elements as $type => $value) {
			if($type == "input") {
				$element = Html::el("input type='file' multiple='multiple'")->addAttributes([
					"id" => $htmlId,
					"name" => $this->fileUploadControl->getHtmlName(),
					"data-upload-component" => $htmlId
				]);
			} else if($type == "delete") {
				$element = Html::el("button type='button'")->addAttributes([
					"data-upload-component" => sprintf($this->idTemplate, $htmlId, $type)
				]);
			} else if($type == "imagePreview") {
				$element = Html::el("img")->addAttributes([
					"data-upload-component" => sprintf($this->idTemplate, $htmlId, $type)
				]);
			} else {
				$element = Html::el("div")->addAttributes([
					"data-upload-component" => sprintf($this->idTemplate, $htmlId, $type)
				]);
			}
			
			$this->elements[ $type ] = $element;
		}
	}
862148
public function execute(InputInterface $input, OutputInterface $output)
    {
        if (($name = $input->getArgument('name'))) {
            if ('php' === pathinfo($name, PATHINFO_EXTENSION)) {
                $file = app()->getPath().'/config/'.$name;
                $config = load($file);
                $config = json_encode($config, JSON_PRETTY_PRINT);
            } else {
                $config = config()->get($name, null);
                if (null === $config) {
                    throw new \LogicException(sprintf('Config "%s" is not configure.', $name));
                }

                $config = [$name => $config];
                $config = json_encode($config, JSON_PRETTY_PRINT);
            }

            $output->write('<comment>'.$config.'</comment>');

            return 0;
        }
        $table = new Table($output);
        $rows = [];
        $table->setHeaders(array('File', 'Config', 'Owner', 'Modify At'));

        foreach (glob(app()->getPath().'/config/*') as $file) {
            $file = new FileObject($file);
            $config = load($file->getPathname());
            $count = 0;
            if (is_array($config)) {
                $count = count(array_keys($config));
            }
            $rows[] = [
                $file->getFilename(),
                $count.' Keys',
                posix_getpwuid($file->getOwner())['name'],
                date('Y-m-d H:i:s', $file->getMTime()),
            ];
        }

        $table->setRows($rows);
        $table->render();
    }
1034463
public function import(): void
    {
        $filename = basename($this->request->get('filename'));
        $commerce = new CommerceML();
        $commerce->loadImportXml($this->config->getFullPath($filename));
        $classifierFile = $this->config->getFullPath('classifier.xml');
        if ($commerce->classifier->xml) {
            $commerce->classifier->xml->saveXML($classifierFile);
        } else {
            $commerce->classifier->xml = simplexml_load_string(file_get_contents($classifierFile));
        }
        $this->beforeProductsSync();

        if ($groupClass = $this->getGroupClass()) {
            $groupClass::createTree1c($commerce->classifier->getGroups());
        }

        $productClass = $this->getProductClass();
        $productClass::createProperties1c($commerce->classifier->getProperties());
        foreach ($commerce->catalog->getProducts() as $product) {
            if (!$model = $productClass::createModel1c($product)) {
                throw new Exchange1CException("Модель продукта не найдена, проверьте реализацию $productClass::createModel1c");
            }
            $this->parseProduct($model, $product);
            $this->_ids[] = $model->getPrimaryKey();
            $model = null;
            unset($model, $product);
            gc_collect_cycles();
        }
        $this->afterProductsSync();
    }
828493
public function definition() {
        global $COURSE, $USER;

        $mform = $this->_form;
        $params = $this->_customdata;

        $mform->addElement('header', 'batchuploadfilesforusers', get_string('batchuploadfilesforusers', 'assignfeedback_file',
            count($params['users'])));
        $mform->addElement('static', 'userslist', get_string('selectedusers', 'assignfeedback_file'), $params['usershtml']);

        $data = new stdClass();
        $fileoptions = array('subdirs'=>1,
                                'maxbytes'=>$COURSE->maxbytes,
                                'accepted_types'=>'*',
                                'return_types'=>FILE_INTERNAL);

        $data = file_prepare_standard_filemanager($data,
                                                  'files',
                                                  $fileoptions,
                                                  $params['context'],
                                                  'assignfeedback_file',
                                                  ASSIGNFEEDBACK_FILE_BATCH_FILEAREA, $USER->id);

        $mform->addElement('filemanager', 'files_filemanager', '', null, $fileoptions);

        $this->set_data($data);

        $mform->addElement('hidden', 'id', $params['cm']);
        $mform->setType('id', PARAM_INT);
        $mform->addElement('hidden', 'operation', 'plugingradingbatchoperation_file_uploadfiles');
        $mform->setType('operation', PARAM_ALPHAEXT);
        $mform->addElement('hidden', 'action', 'viewpluginpage');
        $mform->setType('action', PARAM_ALPHA);
        $mform->addElement('hidden', 'pluginaction', 'uploadfiles');
        $mform->setType('pluginaction', PARAM_ALPHA);
        $mform->addElement('hidden', 'plugin', 'file');
        $mform->setType('plugin', PARAM_PLUGIN);
        $mform->addElement('hidden', 'pluginsubtype', 'assignfeedback');
        $mform->setType('pluginsubtype', PARAM_PLUGIN);
        $mform->addElement('hidden', 'selectedusers', implode(',', $params['users']));
        $mform->setType('selectedusers', PARAM_SEQUENCE);
        $this->add_action_buttons(true, get_string('uploadfiles', 'assignfeedback_file'));

    }
1141968
public function fileInput($options = [])
    {
        $options = array_merge([
            'class' => 'filestyle',
            'data' => [
                'buttonText' => Yii::t('app', 'Choose file'),
                //'size' => 'lg'
            ]
        ], $options);
        BootstrapFileStyleAsset::register($this->form->view);
        return parent::fileInput($options);
    }
1242260
public function initFileActiveRecord()
    {
        if (count(static::primaryKey()) === 1) {
            $this->on(self::EVENT_BEFORE_INSERT, function ($event) {
                if (empty($event->sender->{$event->data['pkName']})) {
                    /** @var ActiveRecord $className */
                    $className = $event->data['className'];
                    $lastModel = $className::find()->orderBy([$event->data['pkName'] => SORT_DESC])->one();
                    $event->sender->{$event->data['pkName']} = $lastModel !== null ? $lastModel->{$event->data['pkName']} + 1 : 1;
                }
            }, ['pkName' => static::primaryKey()[0], 'className' => static::class]);
        }
    }
273618
static function activate()
    {
        if (get_magic_quotes_gpc()){
            $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
            while (list($key, $val) = each($process)){
                foreach ($val as $k => $v){
                    unset($process[$key][$k]);
                    if (is_array($v)){
                        $process[$key][stripslashes($k)] = $v;
                        $process[] = &$process[$key][stripslashes($k)];
                    }else{
                        $process[$key][stripslashes($k)] = stripslashes($v);
                    }
                }
            }
            unset($process);
        }
        // Нормализация массива $_FILES в соответствии с именованием полей формы
        if (isset($_FILES)){
            // Перегруппировка элементов массива $_FILES
            $rec_to_array = function ($array, $name) use (&$rec_to_array){
                $result = [];
                foreach ($array as $key => $value){
                    if (is_array($value)){
                        $result[$key] = $rec_to_array($value, $name);
                    }else{
                        $result[$key][$name] = $value;
                    }
                }
                return $result;
            };
            $files = [];
            foreach ($_FILES as $field => $data){
                $files[$field] = [];
                foreach ($data as $name => $value){
                    if (is_array($value)){
                        $files[$field] = F::arrayMergeRecursive($files[$field], $rec_to_array($value, $name));
                    }else{
                        $files[$field][$name] = $value;
                    }
                }
            }
        }else{
            $files = [];
        }

        self::$source = array(
            'REQUEST' => [],
            'FILES' => $files,
            'COOKIE' => isset($_COOKIE)? $_COOKIE : [],
            'RAW' => file_get_contents("php://input"), // Неформатированные данные
            'SERVER' => $_SERVER
        );
        if (isset($_SERVER['REQUEST_URI'])){
            $_SERVER['REQUEST_URI'] = preg_replace('#\?{1}#u', '&', $_SERVER['REQUEST_URI'], 1);
//            $request_uri = preg_replace('#^'.preg_quote(DIR_WEB).'#u', '/', $_SERVER['REQUEST_URI'], 1);
            parse_str('path='.$_SERVER['REQUEST_URI'], self::$source['REQUEST']);
            self::$source['SERVER']['argv'] = self::$source['REQUEST'];
            self::$source['SERVER']['argc'] = sizeof(self::$source['REQUEST']);
        }
        // Элементы пути URI
        if (isset(self::$source['REQUEST']['path']) && (self::$source['REQUEST']['path'] = rtrim(self::$source['REQUEST']['path'],'/ '))){
            self::$source['PATH'] = explode('/', trim(self::$source['REQUEST']['path'],' /'));
        }else{
            self::$source['PATH'] = [];
        }
        if (isset($_POST)){
            self::$source['REQUEST'] = array_replace_recursive(self::$source['REQUEST'], $_POST);
        }
        // Аргументы из консоли (режим CLI)
        if (php_sapi_name() == 'cli' && isset($_SERVER['argv'])){
            self::$source['REQUEST']['method'] = 'CLI';
            self::$source['SERVER']['argv'] = $_SERVER['argv'];
            self::$source['SERVER']['argc'] = $_SERVER['argc'];
        }
        self::$source['ARG'] = self::$source['SERVER']['argv'];
        // Метод запроса
        if (isset(self::$source['SERVER']['REQUEST_METHOD']) && !isset(self::$source['REQUEST']['method'])){
            self::$source['REQUEST']['method'] = self::$source['SERVER']['REQUEST_METHOD'];
        }
    }
289063
public function init()
    {

        if ( empty( $this->action_save ) ){
            throw new HttpException(200, 'Ошибка контроллера. Не передано имя метода для сохранения файла (action).');
        }
        if ( empty( $this->action_read ) ){
            throw new HttpException(200, 'Ошибка виджета. Не передано имя метода для чтения данных (action).');
        }
        if ( empty( $this->action_write ) ){
            throw new HttpException(200, 'Ошибка виджета. Не передано имя метода записи данных (action).');
        }

        parent::init();
    }
1154558
function init()
    {
        // overiddable variables
        $this->file_new_name_body   = null;     // replace the name body
        $this->file_name_body_add   = null;     // append to the name body
        $this->file_name_body_pre   = null;     // prepend to the name body
        $this->file_new_name_ext    = null;     // replace the file extension
        $this->file_safe_name       = true;     // format safely the filename
        $this->file_force_extension = true;     // forces extension if there isn't one
        $this->file_overwrite       = false;    // allows overwritting if the file already exists
        $this->file_auto_rename     = true;     // auto-rename if the file already exists
        $this->dir_auto_create      = true;     // auto-creates directory if missing
        $this->dir_auto_chmod       = true;     // auto-chmod directory if not writeable
        $this->dir_chmod            = 0777;     // default chmod to use

        $this->no_script  = true;     // turns scripts into test files
        $this->mime_check = true;     // checks the mime type against the allowed list

        // these are the different MIME detection methods. if one of these method doesn't work on your
        // system, you can deactivate it here; just set it to false
        $this->mime_fileinfo     = true;     // MIME detection with Fileinfo PECL extension
        $this->mime_file         = true;     // MIME detection with UNIX file() command
        $this->mime_magic        = true;     // MIME detection with mime_magic (mime_content_type())
        $this->mime_getimagesize = true;     // MIME detection with getimagesize()

        // get the default max size from php.ini
        $this->file_max_size_raw = trim(ini_get('upload_max_filesize'));
        $this->file_max_size     = $this->getsize($this->file_max_size_raw);

        $this->image_resize  = false;    // resize the image
        $this->image_convert = '';       // convert. values :''; 'png'; 'jpeg'; 'gif'; 'bmp'

        $this->image_x                 = 150;
        $this->image_y                 = 150;
        $this->image_ratio             = false;    // keeps aspect ratio with x and y dimensions
        $this->image_ratio_crop        = false;    // keeps aspect ratio with x and y dimensions, filling the space
        $this->image_ratio_fill        = false;    // keeps aspect ratio with x and y dimensions, fitting the image in the space, and coloring the rest
        $this->image_ratio_pixels      = false;    // keeps aspect ratio, calculating x and y so that the image is approx the set number of pixels
        $this->image_ratio_no_zoom_in  = false;
        $this->image_ratio_no_zoom_out = false;
        $this->image_ratio_x           = false;    // calculate the $image_x if true
        $this->image_ratio_y           = false;    // calculate the $image_y if true
        $this->png_compression         = null;
        $this->jpeg_quality            = 85;
        $this->jpeg_size               = null;
        $this->image_interlace         = false;
        $this->preserve_transparency   = false;
        $this->image_is_transparent    = false;
        $this->image_transparent_color = null;
        $this->image_background_color  = null;
        $this->image_default_color     = '#ffffff';
        $this->image_is_palette        = false;

        $this->image_max_width  = null;
        $this->image_max_height = null;
        $this->image_max_pixels = null;
        $this->image_max_ratio  = null;
        $this->image_min_width  = null;
        $this->image_min_height = null;
        $this->image_min_pixels = null;
        $this->image_min_ratio  = null;

        $this->image_brightness        = null;
        $this->image_contrast          = null;
        $this->image_opacity           = null;
        $this->image_threshold         = null;
        $this->image_tint_color        = null;
        $this->image_overlay_color     = null;
        $this->image_overlay_opacity   = null;
        $this->image_overlay_percent   = null;
        $this->image_negative          = false;
        $this->image_greyscale         = false;
        $this->image_pixelate          = null;
        $this->image_unsharp           = false;
        $this->image_unsharp_amount    = 80;
        $this->image_unsharp_radius    = 0.5;
        $this->image_unsharp_threshold = 1;

        $this->image_text                    = null;
        $this->image_text_direction          = null;
        $this->image_text_color              = '#FFFFFF';
        $this->image_text_opacity            = 100;
        $this->image_text_percent            = 100;
        $this->image_text_background         = null;
        $this->image_text_background_opacity = 100;
        $this->image_text_background_percent = 100;
        $this->image_text_font               = 5;
        $this->image_text_x                  = null;
        $this->image_text_y                  = null;
        $this->image_text_position           = null;
        $this->image_text_padding            = 0;
        $this->image_text_padding_x          = null;
        $this->image_text_padding_y          = null;
        $this->image_text_alignment          = 'C';
        $this->image_text_line_spacing       = 0;

        $this->image_reflection_height  = null;
        $this->image_reflection_space   = 2;
        $this->image_reflection_color   = '#ffffff';
        $this->image_reflection_opacity = 60;

        $this->image_watermark             = null;
        $this->image_watermark_x           = null;
        $this->image_watermark_y           = null;
        $this->image_watermark_position    = null;
        $this->image_watermark_no_zoom_in  = true;
        $this->image_watermark_no_zoom_out = false;

        $this->image_flip        = null;
        $this->image_auto_rotate = true;
        $this->image_rotate      = null;
        $this->image_crop        = null;
        $this->image_precrop     = null;

        $this->image_bevel              = null;
        $this->image_bevel_color1       = '#FFFFFF';
        $this->image_bevel_color2       = '#000000';
        $this->image_border             = null;
        $this->image_border_color       = '#FFFFFF';
        $this->image_border_opacity     = 100;
        $this->image_border_transparent = null;
        $this->image_frame              = null;
        $this->image_frame_colors       = '#FFFFFF #999999 #666666 #000000';
        $this->image_frame_opacity      = 100;

        $this->forbidden = [];
        $this->allowed   = [
            'application/arj',
            'application/excel',
            'application/gnutar',
            'application/mspowerpoint',
            'application/msword',
            'application/octet-stream',
            'application/onenote',
            'application/pdf',
            'application/plain',
            'application/postscript',
            'application/powerpoint',
            'application/rar',
            'application/rtf',
            'application/vnd.ms-excel',
            'application/vnd.ms-excel.addin.macroEnabled.12',
            'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
            'application/vnd.ms-excel.sheet.macroEnabled.12',
            'application/vnd.ms-excel.template.macroEnabled.12',
            'application/vnd.ms-office',
            'application/vnd.ms-officetheme',
            'application/vnd.ms-powerpoint',
            'application/vnd.ms-powerpoint.addin.macroEnabled.12',
            'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
            'application/vnd.ms-powerpoint.slide.macroEnabled.12',
            'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',
            'application/vnd.ms-powerpoint.template.macroEnabled.12',
            'application/vnd.ms-word',
            'application/vnd.ms-word.document.macroEnabled.12',
            'application/vnd.ms-word.template.macroEnabled.12',
            'application/vnd.oasis.opendocument.chart',
            'application/vnd.oasis.opendocument.database',
            'application/vnd.oasis.opendocument.formula',
            'application/vnd.oasis.opendocument.graphics',
            'application/vnd.oasis.opendocument.graphics-template',
            'application/vnd.oasis.opendocument.image',
            'application/vnd.oasis.opendocument.presentation',
            'application/vnd.oasis.opendocument.presentation-template',
            'application/vnd.oasis.opendocument.spreadsheet',
            'application/vnd.oasis.opendocument.spreadsheet-template',
            'application/vnd.oasis.opendocument.text',
            'application/vnd.oasis.opendocument.text-master',
            'application/vnd.oasis.opendocument.text-template',
            'application/vnd.oasis.opendocument.text-web',
            'application/vnd.openofficeorg.extension',
            'application/vnd.openxmlformats-officedocument.presentationml.presentation',
            'application/vnd.openxmlformats-officedocument.presentationml.slide',
            'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
            'application/vnd.openxmlformats-officedocument.presentationml.template',
            'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
            'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
            'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
            'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
            'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
            'application/vocaltec-media-file',
            'application/wordperfect',
            'application/x-bittorrent',
            'application/x-bzip',
            'application/x-bzip2',
            'application/x-compressed',
            'application/x-excel',
            'application/x-gzip',
            'application/x-latex',
            'application/x-midi',
            'application/xml',
            'application/x-msexcel',
            'application/x-rar',
            'application/x-rar-compressed',
            'application/x-rtf',
            'application/x-shockwave-flash',
            'application/x-sit',
            'application/x-stuffit',
            'application/x-troff-msvideo',
            'application/x-zip',
            'application/x-zip-compressed',
            'application/zip',
            'audio/*',
            'image/*',
            'multipart/x-gzip',
            'multipart/x-zip',
            'text/plain',
            'text/rtf',
            'text/richtext',
            'text/xml',
            'video/*',
            'text/csv',
        ];

        $this->mime_types = [
            'jpg'     => 'image/jpeg',
            'jpeg'    => 'image/jpeg',
            'jpe'     => 'image/jpeg',
            'gif'     => 'image/gif',
            'png'     => 'image/png',
            'bmp'     => 'image/bmp',
            'flv'     => 'video/x-flv',
            'js'      => 'application/x-javascript',
            'json'    => 'application/json',
            'tiff'    => 'image/tiff',
            'css'     => 'text/css',
            'xml'     => 'application/xml',
            'doc'     => 'application/msword',
            'docx'    => 'application/msword',
            'xls'     => 'application/vnd.ms-excel',
            'xlt'     => 'application/vnd.ms-excel',
            'xlm'     => 'application/vnd.ms-excel',
            'xld'     => 'application/vnd.ms-excel',
            'xla'     => 'application/vnd.ms-excel',
            'xlc'     => 'application/vnd.ms-excel',
            'xlw'     => 'application/vnd.ms-excel',
            'xll'     => 'application/vnd.ms-excel',
            'ppt'     => 'application/vnd.ms-powerpoint',
            'pps'     => 'application/vnd.ms-powerpoint',
            'rtf'     => 'application/rtf',
            'pdf'     => 'application/pdf',
            'html'    => 'text/html',
            'htm'     => 'text/html',
            'php'     => 'text/html',
            'txt'     => 'text/plain',
            'mpeg'    => 'video/mpeg',
            'mpg'     => 'video/mpeg',
            'mpe'     => 'video/mpeg',
            'mp3'     => 'audio/mpeg3',
            'wav'     => 'audio/wav',
            'aiff'    => 'audio/aiff',
            'aif'     => 'audio/aiff',
            'avi'     => 'video/msvideo',
            'wmv'     => 'video/x-ms-wmv',
            'mov'     => 'video/quicktime',
            'zip'     => 'application/zip',
            'tar'     => 'application/x-tar',
            'swf'     => 'application/x-shockwave-flash',
            'odt'     => 'application/vnd.oasis.opendocument.text',
            'ott'     => 'application/vnd.oasis.opendocument.text-template',
            'oth'     => 'application/vnd.oasis.opendocument.text-web',
            'odm'     => 'application/vnd.oasis.opendocument.text-master',
            'odg'     => 'application/vnd.oasis.opendocument.graphics',
            'otg'     => 'application/vnd.oasis.opendocument.graphics-template',
            'odp'     => 'application/vnd.oasis.opendocument.presentation',
            'otp'     => 'application/vnd.oasis.opendocument.presentation-template',
            'ods'     => 'application/vnd.oasis.opendocument.spreadsheet',
            'ots'     => 'application/vnd.oasis.opendocument.spreadsheet-template',
            'odc'     => 'application/vnd.oasis.opendocument.chart',
            'odf'     => 'application/vnd.oasis.opendocument.formula',
            'odb'     => 'application/vnd.oasis.opendocument.database',
            'odi'     => 'application/vnd.oasis.opendocument.image',
            'oxt'     => 'application/vnd.openofficeorg.extension',
            'docx'    => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
            'docm'    => 'application/vnd.ms-word.document.macroEnabled.12',
            'dotx'    => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
            'dotm'    => 'application/vnd.ms-word.template.macroEnabled.12',
            'xlsx'    => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
            'xlsm'    => 'application/vnd.ms-excel.sheet.macroEnabled.12',
            'xltx'    => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
            'xltm'    => 'application/vnd.ms-excel.template.macroEnabled.12',
            'xlsb'    => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
            'xlam'    => 'application/vnd.ms-excel.addin.macroEnabled.12',
            'pptx'    => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
            'pptm'    => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
            'ppsx'    => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
            'ppsm'    => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',
            'potx'    => 'application/vnd.openxmlformats-officedocument.presentationml.template',
            'potm'    => 'application/vnd.ms-powerpoint.template.macroEnabled.12',
            'ppam'    => 'application/vnd.ms-powerpoint.addin.macroEnabled.12',
            'sldx'    => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
            'sldm'    => 'application/vnd.ms-powerpoint.slide.macroEnabled.12',
            'thmx'    => 'application/vnd.ms-officetheme',
            'onetoc'  => 'application/onenote',
            'onetoc2' => 'application/onenote',
            'onetmp'  => 'application/onenote',
            'onepkg'  => 'application/onenote',
            'csv'     => 'text/csv',
        ];
    }
987146
public function currentAction()
    {
        $objectId = !empty($this->getPost()->objectId) ? $this->getPost()->objectId : null;
        switch ($this->getPost()->fileTypes) {
            case 'images' :
                //zapytanie o obrazki
                $query = CmsFileQuery::imagesByObject($this->getPost()->object, $objectId);
                break;
            case 'notImages' :
                //wszystkie pliki bez obrazków
                $query = CmsFileQuery::notImagesByObject($this->getPost()->object, $objectId);
                break;
            default :
                //domyślne zapytanie o wszystkie pliki
                $query = CmsFileQuery::byObject($this->getPost()->object, $objectId);
        }

        $records = $query->find();
        foreach ($records as $record) {
            $record->data = $record->data->toArray();
        }

        //zwrot json'a z plikami
        return json_encode([
            'result' => 'OK',
            'files' => $records->toArray()
        ]);
    }
508701
public function execute()
    {
        if (empty($this->_filecontent)) {
            return;
        }
        foreach ($this->_filecontent as $printer=>$result) {
            $result = preg_replace('/End of MIB\r?\n/', '', $result);
            $result = preg_replace('/\s\r?\n([^\.])/', ' $1', $result);
            $lines = preg_split('/\r?\n/', $result);
            foreach ($lines as $line) {
                if (preg_match('/^(.+) = Hex-STRING:\s(.+)/', $line, $linetmp)) {
                    $hexchars = explode(" ", trim($linetmp[2]));
                    $newstring = "";
                    foreach ($hexchars as $hexchar) {
                        $hexint = hexdec($hexchar);
                        if (($hexint<32) || ($hexint>126)) {
                            $newstring .= ".";
                        } else {
                            $newstring .= chr($hexint);
                        }
                    }
                    if ($newstring!=="") {
                        $line = $linetmp[1]." = STRING: ".$newstring;
                    }
                }
                if (preg_match('/^\.1\.3\.6\.1\.2\.1\.43\.11\.1\.1\.6\.1\.(.*) = STRING:\s(.*)/', $line, $data)) {
                    $this->_result[$printer][$data[1]]['prtMarkerSuppliesDescription']=trim($data[2], "\"");
                } elseif (preg_match('/^\.1\.3\.6\.1\.2\.1\.43\.11\.1\.1\.7\.1\.(.*) = INTEGER:\s(.*)/', $line, $data)) {
                    $this->_result[$printer][$data[1]]['prtMarkerSuppliesSupplyUnit']=$data[2];
                } elseif (preg_match('/^\.1\.3\.6\.1\.2\.1\.43\.11\.1\.1\.8\.1\.(.*) = INTEGER:\s(.*)/', $line, $data)) {
                    $this->_result[$printer][$data[1]]['prtMarkerSuppliesMaxCapacity']=$data[2];
                } elseif (preg_match('/^\.1\.3\.6\.1\.2\.1\.43\.11\.1\.1\.9\.1\.(.*) = INTEGER:\s(.*)/', $line, $data)) {
                    $this->_result[$printer][$data[1]]['prtMarkerSuppliesLevel']=$data[2];
                } elseif (preg_match('/^\.1\.3\.6\.1\.2\.1\.1\.5\.0 = STRING:\s(.*)/', $line, $data)) {
                    $this->_result[$printer][0]['prtMarkerSuppliesDescription']=trim($data[1], "\"");
                } elseif (preg_match('/^\.1\.3\.6\.1\.2\.1\.43\.18\.1\.1\.8\.1\.(.*) = STRING:\s(.*)/', $line, $data)) {
                    $this->_result[$printer][99][$data[1]]["message"]=trim($data[2], "\"");
                } elseif (preg_match('/^\.1\.3\.6\.1\.2\.1\.43\.18\.1\.1\.2\.1\.(.*) = INTEGER:\s(.*)/', $line, $data)) {
                    $this->_result[$printer][99][$data[1]]["severity"]=$data[2];

                } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.367\.3\.2\.1\.2\.24\.1\.1\.2\.(.*) = STRING:\s(.*)/', $line, $data)) {
                    $this->_result[$printer][$data[1]]['prtMarkerSuppliesDescriptionRicoh']=trim($data[2], "\"");
                } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.367\.3\.2\.1\.2\.24\.1\.1\.5\.(.*) = INTEGER:\s(.*)/', $line, $data)) {
                    $this->_result[$printer][$data[1]]['prtMarkerSuppliesLevelRicoh']=$data[2];
                }
            }
        }
    }
1152673
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->nyrodev->increasePhpLimits();
        $file = $input->getArgument('file');
        $dir = $input->getArgument('dir');

        $output->writeln('Open XLS file');
        $fileType = \PHPExcel_IOFactory::identify($file);
        $objReader = \PHPExcel_IOFactory::createReader($fileType);

        $phpExcel = $objReader->load($file);
        $sheet = $phpExcel->getActiveSheet();
        $maxCol = \PhpExcel_Cell::columnIndexFromString($sheet->getHighestDataColumn(1));
        $maxRow = $sheet->getHighestDataRow();

        $localesCols = array();
        for ($i = 3; $i < $maxCol; ++$i) {
            $locale = $sheet->getCellByColumnAndRow($i, 1)->getValue();
            $localesCols[$i] = $locale;
            $this->locales[$locale] = array();
        }

        $output->writeln('Parse XLS file');
        for ($i = 2; $i <= $maxRow; ++$i) {
            $domain = $sheet->getCellByColumnAndRow(0, $i)->getValue();
            $ident = $sheet->getCellByColumnAndRow(1, $i)->getValue();
            $idents = explode('.', $ident);
            for ($j = 3; $j < $maxCol; ++$j) {
                $this->addTrans($localesCols[$j], $domain, $idents, $sheet->getCellByColumnAndRow($j, $i)->getValue());
            }
        }

        $output->writeln('Dump YML files');
        $dumper = new Dumper();
        $fs = new Filesystem();

        foreach ($this->locales as $locale => $translations) {
            foreach ($translations as $domain => $trans) {
                $output->writeln($dir.'/'.$domain.'.'.$locale.'.yaml');
                $fs->dumpFile($dir.'/'.$domain.'.'.$locale.'.yaml', $dumper->dump($trans, 99));
            }
        }
    }
38061
protected function RenderImpl()
    {

        //   $this->beforeRender();
        //$keys =   array_keys($this->components);
        foreach ($this->components as $component) {


            if ($component->isVisible()) {
                $component->Render();
            } else {
                $component->getTag()->remove();
                $label = $component->getLabelTag();
                if ($label->size() == 1) {  //прячем  связаный  тег label
                    $label->remove();
                }
                if ($label->size() > 1) {  //прячем  связаный  тег label
                    foreach ($label as $l) {
                        pq($l)->remove();
                    }
                }
            }
        }
        //   $this->afterRender();
    }
1188387
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->input = $input;
        $this->output = $output;
        $io = new SymfonyStyle($input, $output);

        $config = $this->getConfigHelper()->load($input);
        $typeMap = TypeMap::fromMetadata(
            $config->getTypeNamespace(),
            $config->getEngine()->getMetadata()->getTypes()
        );

        $generator = new ClassMapGenerator(
            $config->getRuleSet(),
            $config->getClassMapName(),
            $config->getClassMapNamespace()
        );
        $path = $config->getClassMapDestination().DIRECTORY_SEPARATOR.$config->getClassMapName().'.php';
        $this->handleClassmap($generator, $typeMap, $path);

        $io->success('Generated classmap at ' . $path);
    }
306374
private function initializeForPrefix(): void
    {
        $keys = AdapterUtil::getPropertyValue($this, 'keys');
        $values = AdapterUtil::getPropertyValue($this, 'values');

        if (null === $values) {
            $file = AdapterUtil::getPropertyValue($this, 'file');
            $values = @(include $file) ?: [];

            AdapterUtil::setPropertyValue($this, 'keys', $keys);
            AdapterUtil::setPropertyValue($this, 'values', $values);
        }
    }