Stash contacts.

@param \Cortex\Foundation\Http\Requests\ImportFormRequest $request
@param \Cortex\Foundation\Importers\DefaultImporter       $importer

@return void
977292
public function stash(ImportFormRequest $request, Contact $contact, DefaultImporter $importer)
    {
        // Handle the import
        $importer->config['resource'] = $contact;
        $importer->handleImport();
    }
1164437
public function headers(Import $import)
	{
		// autodetect adapter
		$this->autoDetectAdapter($import);

		// call count on adapter
		return $this->getAdapter()->headers($import);
	}
1156646
protected function _importSuccess(ImportResult $importResult, EntityInterface $entity) : bool
    {
        $table = TableRegistry::get('CsvMigrations.ImportResults');
        Assert::isInstanceOf($table, ImportResultsTable::class);

        $importResult->set('model_id', $entity->get('id'));
        $importResult->set('status', $table::STATUS_SUCCESS);
        $importResult->set('status_message', $table::STATUS_SUCCESS_MESSAGE);

        return (bool)$table->save($importResult);
    }
576724
public function import(Import $import, File $file, Lang $language = null)
    {
        $archiver = $this->matchArchiverByExtension($file->getFilename());

        if ($archiver !== null) {
            $file = $this->extractArchive($file, $archiver);
        }

        $serializer = $this->matchSerializerByExtension($file->getFilename());

        if ($serializer === null) {
            throw new FormValidationException(
                Translator::getInstance()->trans(
                    'The extension "%extension" is not allowed',
                    [
                        '%extension' => pathinfo($file->getFilename(), PATHINFO_EXTENSION)
                    ]
                )
            );
        }

        $importHandleClass = $import->getHandleClass();

        /** @var \Thelia\ImportExport\Import\AbstractImport $instance */
        $instance = new $importHandleClass;
        $instance->setContainer($this->container);

        // Configure handle class
        $instance->setLang($language);
        $instance->setFile($file);

        // Process import
        $event = new ImportEvent($instance, $serializer);

        $this->eventDispatcher->dispatch(TheliaEvents::IMPORT_BEGIN, $event);

        $errors = $this->processImport($event->getImport(), $event->getSerializer());

        $event->setErrors($errors);

        $this->eventDispatcher->dispatch(TheliaEvents::IMPORT_FINISHED, $event);

        $this->eventDispatcher->dispatch(TheliaEvents::IMPORT_SUCCESS, $event);

        return $event;
    }
780953
protected function getCurrentImporter()
    {
        $handlers = $this->getAvailableImportHandlers();

        if ($this->hasRequestParameter('importHandler')) {
            foreach ($handlers as $importHandler) {
                if (get_class($importHandler) == $_POST['importHandler']) {
                    return $importHandler;
                }
            }
        }

        $availableImportHandlers = $this->getAvailableImportHandlers();
        $currentImporter = reset($availableImportHandlers);

        return $currentImporter;
    }
806249
public function importMessage(ImportMessageRequest $request)
    {
        $response = new ImportMessageResponse();
        return $this->client->sendRequest($request, $response);
    }
674617
public function addImportToModelData(\ArrayObject $import)
    {
        // formDefaults are set in the Gems\Task\Tracker\Import tasks
        if (isset($import['formDefaults']) && $import['formDefaults']) {
            foreach ($import['formDefaults'] as $name => $default) {
                if (! (isset($this->formData[$name]) && $this->formData[$name])) {
                    $this->formData[$name] = $default;
                }
            }
        }

        // \MUtil_Echo::track($this->formData);

        // modelSettings are set in the Gems\Task\Tracker\Import tasks
        if (isset($import['modelSettings']) && $import['modelSettings']) {
            $model = $this->getModel();
            foreach ($import['modelSettings'] as $name => $settings) {
                // \MUtil_Echo::track($name, $settings);
                $model->set($name, $settings);
            }
        }
    }
641436
function (path, currentFileInfo, callback) {
            var parserImporter = this;
            this.queue.push(path);

            //
            // Import a file asynchronously
            //
            less.Parser.importer(path, currentFileInfo, function (e, root, fullPath) {
                parserImporter.queue.splice(parserImporter.queue.indexOf(path), 1); // Remove the path from the queue

                var imported = fullPath in parserImporter.files;

                parserImporter.files[fullPath] = root;                        // Store the root

                if (e && !parserImporter.error) { parserImporter.error = e; }
                
                callback(e, root, imported);
            }, env);
        }
219055
public function hasImport(string $importName): bool
    {
        return \array_key_exists(\strtolower(\trim($importName, '\\')), $this->imports);
    }
320831
public void setImportExportManager(CmsImportExportManager manager) {

        m_importExportManager = manager;
        if (CmsLog.INIT.isInfoEnabled()) {
            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_IMPORT_MANAGER_0));
        }
    }
691257
protected function importTranslationFiles($finder)
    {
        if (!$finder instanceof Finder) {
            $this->output->writeln('No file to import');

            return;
        }

        $importer = $this->getContainer()->get('lexik_translation.importer.file');
        $importer->setCaseInsensitiveInsert($this->input->getOption('case-insensitive'));

        foreach ($finder as $file) {
            $this->output->write(sprintf('Importing <comment>"%s"</comment> ... ', $file->getPathname()));
            $number = $importer->import($file, $this->input->getOption('force'), $this->input->getOption('merge'));
            $this->output->writeln(sprintf('%d translations', $number));

            $skipped = $importer->getSkippedKeys();
            if (count($skipped) > 0) {
                $this->output->writeln(sprintf('    <error>[!]</error> The following keys has been skipped: "%s".', implode('", "', $skipped)));
            }
        }
    }
1275507
public function importShoppingLists(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
    {
        return $this->getFactory()
            ->getShoppingListDataImporter()
            ->import($dataImporterConfigurationTransfer);
    }
1138135
public function buildFromRequest(ImportRequest $importRequest)
    {
        $importerId = $importRequest->getImporterId();
        $storageSelection = null;
        $sourceStorage = null;

        if ($importRequest->hasSource()) {
            $storageSelection = $this->storageLocator->selectStorage(
                $importRequest->getSourceProviderId(),
                $importRequest->getSourceId()
            );

            $sourceStorage = $this->storageLocator->getStorage($storageSelection);

            if (!$importRequest->hasImporterId()) {
                $importerId = $this->findImporterForStorage($sourceStorage);
                if (!$importerId) {
                    throw new InvalidConfigurationException('No importerId was given and there is no importer that matches the storage.');
                }

                $importRequest->setImporterId($importerId);
                $this->eventDispatcher->dispatch(
                    ImportRequestEvent::DISCOVERED,
                    new ImportRequestEvent($importRequest));
            }
        }

        $importConfiguration = new ImportConfiguration($storageSelection, $importerId);

        return $this->build($importConfiguration, $sourceStorage, $importRequest->getCreatedBy(), $importRequest->getContext());
    }
974817
public function importAction(Request $request)
    {
        $data = json_decode($request->getContent(), true);
        $file = $data['file'];
        $workspace = $data['workspace'];
        $workspace = $workspace['id'] ? $this->om->getObject($workspace, Workspace::class) : null;
        $fileEntity = $this->om->getObject($file, PublicFile::class) ?? new PublicFile();
        $file = $this->serializer->deserialize($file, $fileEntity);
        $fileData = $this->container->get('claroline.utilities.file')->getContents($file);
        $events = $this->container->get('claroline.manager.agenda_manager')->import($fileData, $workspace);

        return new JsonResponse(array_map(function (Event $event) {
            return $this->serializer->serialize($event);
        }, $events));
    }
818468
public function Dispatch($ImportRequest = NULL, $Permanent = TRUE) {
      
      if ($ImportRequest && is_string($ImportRequest))
         $ImportRequest = Gdn_Request::Create()->FromEnvironment()->WithURI($ImportRequest);
      
      if (is_a($ImportRequest, 'Gdn_Request') && $Permanent) {
         Gdn::Request($ImportRequest);
      }
      
      $Request = is_a($ImportRequest, 'Gdn_Request') ? $ImportRequest : Gdn::Request();
      
      if (Gdn::Session()->NewVisit()) {
         Gdn::UserModel()->FireEvent('Visit');
      }
      
      $this->EventArguments['Request'] = &$Request;
      
      // Move this up to allow pre-routing
      $this->FireEvent('BeforeDispatch');
      
      // By default, all requests can be blocked by UpdateMode/PrivateCommunity
      $CanBlock = self::BLOCK_ANY;
      
      try {
         $BlockExceptions = array(
             '/^utility(\/.*)?$/'                   => self::BLOCK_NEVER,
             '/^plugin(\/.*)?$/'                    => self::BLOCK_NEVER,
             '/^sso(\/.*)?$/'                       => self::BLOCK_NEVER,
             '/^discussions\/getcommentcounts/'     => self::BLOCK_NEVER,
             '/^entry(\/.*)?$/'                     => self::BLOCK_PERMISSION,
             '/^user\/usernameavailable(\/.*)?$/'   => self::BLOCK_PERMISSION,
             '/^user\/emailavailable(\/.*)?$/'      => self::BLOCK_PERMISSION,
             '/^home\/termsofservice(\/.*)?$/'      => self::BLOCK_PERMISSION
         );
         
         $this->EventArguments['BlockExceptions'] = &$BlockExceptions;
         $this->FireEvent('BeforeBlockDetect');
         
         $PathRequest = Gdn::Request()->Path();
         foreach ($BlockExceptions as $BlockException => $BlockLevel) {
            if (preg_match($BlockException, $PathRequest))
               throw new Exception("Block detected - {$BlockException}", $BlockLevel);
         }
         
         // Never block an admin
         if (Gdn::Session()->CheckPermission('Garden.Settings.Manage'))
            throw new Exception("Block detected", self::BLOCK_NEVER);
         
         if (Gdn::Session()->IsValid())
            throw new Exception("Block detected", self::BLOCK_PERMISSION);
         
      } catch (Exception $e) {
         // BlockLevel
         //  TRUE = Block any time
         //  FALSE = Absolutely no blocking
         //  NULL = Block for permissions (e.g. PrivateCommunity)
         $CanBlock = $e->getCode();
      }
      
      // If we're in updatemode and arent explicitly prevented from blocking, block
      if (Gdn::Config('Garden.UpdateMode', FALSE) && $CanBlock > self::BLOCK_NEVER) {
         $Request->WithURI(Gdn::Router()->GetDestination('UpdateMode'));
      }
      
      // Analze the request AFTER checking for update mode.
      $this->AnalyzeRequest($Request);
      $this->FireEvent('AfterAnalyzeRequest');
      
      // If we're in updatemode and can block, redirect to signin
      if (C('Garden.PrivateCommunity') && $CanBlock > self::BLOCK_PERMISSION) {
         Redirect('/entry/signin?Target='.urlencode($this->Request));
         exit();
      }
      
      $ControllerName = $this->ControllerName();
      if ($ControllerName != '' && class_exists($ControllerName)) {
         // Create it and call the appropriate method/action
         $Controller = new $ControllerName();
         Gdn::Controller($Controller);
         
         $this->EventArguments['Controller'] =& $Controller;
         $this->FireEvent('AfterControllerCreate');

         // Pass along any assets
         if (is_array($this->_AssetCollection)) {
            foreach ($this->_AssetCollection as $AssetName => $Assets) {
               foreach ($Assets as $Asset) {
                  $Controller->AddAsset($AssetName, $Asset);
               }
            }
         }

         // Instantiate Imported & Uses classes
         $Controller->GetImports();

         // Pass in the syndication method
         $Controller->SyndicationMethod = $this->_SyndicationMethod;

         // Pass along the request
         $Controller->SelfUrl = $this->Request;

         // Pass along any objects
         foreach ($this->_PropertyCollection as $Name => $Mixed) {
            $Controller->$Name = $Mixed;
         }

         // Pass along any data.
         if (is_array($this->_Data))
            $Controller->Data = $this->_Data;

         // Set up a default controller method in case one isn't defined.
         $ControllerMethod = str_replace('_', '', $this->ControllerMethod);
         $Controller->OriginalRequestMethod = $ControllerMethod;
         
         // Take enabled plugins into account, as well
         $PluginReplacement = Gdn::PluginManager()->HasNewMethod($this->ControllerName(), $this->ControllerMethod);
         if (!$PluginReplacement && ($this->ControllerMethod == '' || !method_exists($Controller, $ControllerMethod))) {
            // Check to see if there is an 'x' version of the method.
            if (method_exists($Controller, 'x' . $ControllerMethod)) {
               // $PluginManagerHasReplacementMethod = TRUE;
               $ControllerMethod = 'x' . $ControllerMethod;
            } else {
               if ($this->ControllerMethod != '')
                  array_unshift($this->_ControllerMethodArgs, $this->ControllerMethod);

               $this->ControllerMethod = 'Index';
               $ControllerMethod = 'Index';

               $PluginReplacement = Gdn::PluginManager()->HasNewMethod($this->ControllerName(), $this->ControllerMethod);
            }
         }

         // Pass in the querystring values
         $Controller->ApplicationFolder = $this->_ApplicationFolder;
         $Controller->Application = $this->EnabledApplication();
         $Controller->ControllerFolder = $this->ControllerFolder;
         $Controller->RequestMethod = $this->ControllerMethod;
         $Controller->RequestArgs = $this->_ControllerMethodArgs;
         $Controller->Request = $Request;
         $Controller->DeliveryType($Request->GetValue('DeliveryType', $this->_DeliveryType));
         $Controller->DeliveryMethod($Request->GetValue('DeliveryMethod', $this->_DeliveryMethod));
         
         // Set special controller method options for REST APIs.
         $Controller->Initialize();
         
         $this->EventArguments['Controller'] = &$Controller;
         $this->FireEvent('AfterControllerInit');
         
         $ReflectionArguments = $Request->Get();
         $this->EventArguments['Arguments'] = &$ReflectionArguments;
         $this->FireEvent('BeforeReflect');
         
         // Call the requested method on the controller - error out if not defined.
         if ($PluginReplacement) {
            // Set the application folder to the plugin's key.
//            $PluginInfo = Gdn::PluginManager()->GetPluginInfo($PluginReplacement, Gdn_PluginManager::ACCESS_CLASSNAME);
//            if ($PluginInfo) {
//               $Controller->ApplicationFolder = 'plugins/'.GetValue('Index', $PluginInfo);
//            }
            
            // Reflect the args for the method.
            $Callback = Gdn::PluginManager()->GetCallback($Controller->ControllerName, $ControllerMethod);
            // Augment the arguments to the plugin with the sender and these arguments.
            $InputArgs = array_merge(array($Controller), $this->_ControllerMethodArgs, array('Sender' => $Controller, 'Args' => $this->_ControllerMethodArgs));
            $Args = ReflectArgs($Callback, $InputArgs, $ReflectionArguments);
            $Controller->ReflectArgs = $Args;
            
            try {
               $this->FireEvent('BeforeControllerMethod');
               Gdn::PluginManager()->CallEventHandlers($Controller, $Controller->ControllerName, $ControllerMethod, 'Before');
               
               call_user_func_array($Callback, $Args);
            } catch (Exception $Ex) {
               $Controller->RenderException($Ex);
            }
         } elseif (method_exists($Controller, $ControllerMethod)) {
            $Args = ReflectArgs(array($Controller, $ControllerMethod), $this->_ControllerMethodArgs, $ReflectionArguments);
            $this->_ControllerMethodArgs = $Args;
            $Controller->ReflectArgs = $Args;
            
            try {
               $this->FireEvent('BeforeControllerMethod');
               Gdn::PluginManager()->CallEventHandlers($Controller, $Controller->ControllerName, $ControllerMethod, 'Before');
               
               call_user_func_array(array($Controller, $ControllerMethod), $Args);
            } catch (Exception $Ex) {
               $Controller->RenderException($Ex);
               exit();
            }
         } else {
            $this->EventArguments['Handled'] = FALSE;
            $Handled =& $this->EventArguments['Handled'];
            $this->FireEvent('NotFound');
            
            if (!$Handled) {
               Gdn::Request()->WithRoute('Default404');
               return $this->Dispatch();
            } else {
               return $Handled;
            }
         }
      }
   }
265011
protected function addJsVendorImport( $directory, $import ) {
		$filepath = $this->path( $directory, 'resources', 'scripts', 'theme', 'vendor.js' );
		$statement = "import '$import';";

		$this->appendUniqueStatement( $filepath, $statement );
	}
614721
protected function addImportFiles(array $importFiles, array $config)
    {
        foreach ($importFiles as $key => $if) {
            if (!in_array($if, $config)) {
                unset($importFiles[$key]);
            }
        }

        return $importFiles;
    }