Import from UDB2.

@param string $actorId
The actor id.
@param string $cdbXml
The cdb xml.
@param string $cdbXmlNamespaceUri
The cdb xml namespace uri.

@return Place
356951
public static function importFromUDB2Actor(
        $actorId,
        $cdbXml,
        $cdbXmlNamespaceUri
    ) {
        $place = new static();
        $place->apply(
            new PlaceImportedFromUDB2(
                $actorId,
                $cdbXml,
                $cdbXmlNamespaceUri
            )
        );

        return $place;
    }
438962
public static function script(
        string $content, 
        array $attributes = ["type" => "text/javascript"],
        bool $addCdataTag = true
    ) : string
    {
        if ($addCdataTag) {
            $content = "\n//<![CDATA[\n" . $content ."\n//]]>\n";
        }
        return self::tag("script", $content, $attributes);
    }
547917
public static Element appendCDATAElement(Element parent, String tagName,
            String value) {
        Element child = appendElement(parent, tagName);
        if (value == null) { // avoid "null" word in the XML payload
            value = "";
        }

        Node cdata = child.getOwnerDocument().createCDATASection(value);
        child.appendChild(cdata);
        return child;
    }
194554
@Override
    public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
        StringBuilder buf = new StringBuilder();

        synchronized (payloads) {
            if (payloads.size() > 0) {
                buf.append('<').append(getElementName());
                buf.append(" xmlns=\"").append(getNamespace()).append("\" >");

                for (PayloadType payloadType : payloads) {
                    if (payloadType != null) {
                        buf.append(payloadType.toXML());
                    }
                }
                buf.append("</").append(getElementName()).append('>');
            }
        }

        return buf.toString();
    }
349673
protected function addCData($cdata_text)
    {
        $node = dom_import_simplexml($this);
        $no = $node->ownerDocument;
        $node->appendChild($no->createCDATASection($cdata_text));
    }
545101
protected function buildXml()
  {
    parent::buildXml();

    $extractDir = ( !empty($_POST['extractDir']) ) ? ltrim($_POST['extractDir'],'/') : '';
    $extractDir = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($extractDir);
    if ( preg_match(CKFINDER_REGEX_INVALID_PATH, $extractDir) ){
      $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
    }
    $extractPath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $extractDir.'/');
    $extractClientPath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getClientPath(),$extractDir);
    // acl for upload dir
    $_aclConfig = $this->_config->getAccessControlConfig();
    $aclMask = $_aclConfig->getComputedMask($this->_currentFolder->getResourceTypeName(),$extractDir);

    if ( !(($aclMask & CKFINDER_CONNECTOR_ACL_FOLDER_CREATE ) == CKFINDER_CONNECTOR_ACL_FOLDER_CREATE ) ){
      $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
    }
    if ( empty( $_POST['force']) && file_exists($extractPath) && is_dir($extractPath) && !CKFinder_Connector_Utils_FileSystem::isEmptyDir($extractPath) )
    {
      $dirExists = new CKFinder_Connector_Utils_XmlNode("FolderExists");
      $oErrorNode = new CKFinder_Connector_Utils_XmlNode("Folder");
      $oErrorNode->addAttribute("name", $extractDir);
      $dirExists->addChild($oErrorNode);
      $this->_connectorNode->addChild($dirExists);
      return;
    }
    elseif ( !empty( $_POST['force']) && $_POST['force'] =='overwrite' )
    {
      if ( !(($aclMask &  CKFINDER_CONNECTOR_ACL_FILE_UPLOAD | CKFINDER_CONNECTOR_ACL_FILE_DELETE ) ==  CKFINDER_CONNECTOR_ACL_FILE_UPLOAD | CKFINDER_CONNECTOR_ACL_FILE_DELETE ) ){
        $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
      }
      if ( $extractDir && file_exists($extractPath) && is_dir($extractPath) )
      {
        if ( !(($aclMask &  CKFINDER_CONNECTOR_ACL_FOLDER_CREATE | CKFINDER_CONNECTOR_ACL_FOLDER_DELETE ) ==  CKFINDER_CONNECTOR_ACL_FOLDER_CREATE | CKFINDER_CONNECTOR_ACL_FOLDER_DELETE ) ){
          $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
        }
        if (!CKFinder_Connector_Utils_FileSystem::unlink($extractPath))
        {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
        }
      }
    }
    else if ( !empty( $_POST['force']) && $_POST['force'] !== 'merge' )
    {
      $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
    }

    for ($i = 0; $i < $this->zip->numFiles; $i++)
    {
      $fileName = $this->zip->getNameIndex($i);
      $filePathInfo = pathinfo($fileName);

      $sFileName = $this->checkOneFile( $filePathInfo, $fileName );
      // security test failed, add to skipped
      if ( $sFileName )
      {
        $this->extractTo($extractPath,$extractClientPath,$filePathInfo,$sFileName,$fileName);
      }
    }
    $this->zip->close();


    $this->_connectorNode->addChild($this->unzippedNodes);

    if ($this->errorCode != CKFINDER_CONNECTOR_ERROR_NONE) {
      $this->_connectorNode->addChild($this->skippedFilesNode);
      $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ZIP_FAILED);
    }
  }
385993
public function writeElement(
            string $elementName,
            array $attributes = [],
            string $cdata     = null
    ): XmlStreamWriter {
        $this->writeStartElement($elementName);
        foreach ($attributes as $attName => $attValue) {
            $this->writeAttribute($attName, $attValue);
        }

        if (null !== $cdata) {
            $this->writeText($cdata);
        }

        $this->writeEndElement();
        return $this;
    }
58003
@Override
    public ExplodedImporter importDirectory(String fileName, Filter<ArchivePath> filter) {
        Validate.notNull(fileName, "FileName must be specified");
        return importDirectory(new File(fileName), filter);
    }
1338280
protected function applyEventCdbXmlFromUDB2(
        $eventId,
        $cdbXmlNamespaceUri,
        $cdbXml
    ) {
        $document = $this->newDocument($eventId);

        $eventLd = $this->projectEventCdbXmlToObject(
            $document->getBody(),
            $eventId,
            $cdbXmlNamespaceUri,
            $cdbXml
        );

        return $document->withBody($eventLd);
    }
475096
def load_plugin_from_addonxml(cls, mode, url):
        '''
        '''
        cwd = os.getcwd()
        sys.path.insert(0, cwd)
        module_name = get_addon_module_name(os.path.join(cwd, 'addon.xml'))
        addon = __import__(module_name)

        # Find the first instance of xbmcswift2.Plugin
        try:
            plugin = (attr_value for attr_value in vars(addon).values()
                      if isinstance(attr_value, Plugin)).next()
        except StopIteration:
            sys.exit('Could\'t find a Plugin instance in %s.py' % module_name)

        return cls(plugin, mode, url)
298626
@Override
    public ExplodedImporter importDirectory(File file, Filter<ArchivePath> filter) {
        Validate.notNull(file, "File must be specified");
        Validate.notNull(filter, "Filter must be specified");
        if (!file.isDirectory()) {
            throw new IllegalArgumentException("Given file is not a directory " + file.getAbsolutePath());
        }

        doImport(file, file.listFiles(), filter);
        return this;
    }
655565
public function insert($component)
    {
        if (is_string($component)) {
            $component = $this->getRepository()->fetch(array('component' => $component));
        }

        if ($component->isAssignable()) {
            $assignment = $component->assignments->findOrAddNew(array('actor' => $this->_actor));
        }

        if ($this->isLoaded()) {
            parent::insert($component);
        }
    }
99615
public function addNamespace (string $namespace, string $directory, bool $failOnMissingDir = self::THROW_ON_MISSING) : void
    {
        if (isset($this->namespaces[$namespace]))
        {
            throw new AssetsException(sprintf(
                "Duplicate registration of namespace '%s'.",
                $namespace
            ));
        }

        if (!is_dir($directory))
        {
            if (self::THROW_ON_MISSING === $failOnMissingDir)
            {
                throw new AssetsException(sprintf(
                    "Can't find assets dir when registering namespace '%s': %s",
                    $namespace,
                    $directory
                ));
            }

            return;
        }

        $this->namespaces[$namespace] = $directory;
    }
573937
@Override
    public final String getNamespaceURI(String prefix)
    {
        /* First the known offenders; invalid args, 2 predefined xml namespace
         * prefixes
         */
        if (prefix == null) {
            throw new IllegalArgumentException(ErrorConsts.ERR_NULL_ARG);
        }
        if (prefix.length() > 0) {
            if (prefix.equals(XMLConstants.XML_NS_PREFIX)) {
                return XMLConstants.XML_NS_URI;
            }
            if (prefix.equals(XMLConstants.XMLNS_ATTRIBUTE)) {
                return XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
            }
        }
        return doGetNamespaceURI(prefix);
    }
536380
public static WebSphereBeanDeploymentArchive createBDA(WebSphereCDIDeployment deployment,
                                                           ExtensionArchive extensionArchive,
                                                           CDIRuntime cdiRuntime) throws CDIException {

        Set<String> additionalClasses = extensionArchive.getExtraClasses();
        Set<String> additionalAnnotations = extensionArchive.getExtraBeanDefiningAnnotations();
        boolean extensionCanSeeApplicationBDAs = extensionArchive.applicationBDAsVisible();

        boolean extClassesOnlyBDA = extensionArchive.isExtClassesOnly();
        String archiveID = deployment.getDeploymentID() + "#" + extensionArchive.getName() + ".additionalClasses";
        //this isn't really part of any EE module so we just use the archiveID which should be unique
        EEModuleDescriptor eeModuleDescriptor = new WebSphereEEModuleDescriptor(archiveID, extensionArchive.getType());

        WebSphereBeanDeploymentArchive bda = createBDA(deployment,
                                                       archiveID,
                                                       extensionArchive,
                                                       cdiRuntime,
                                                       additionalClasses,
                                                       additionalAnnotations,
                                                       extensionCanSeeApplicationBDAs,
                                                       extClassesOnlyBDA,
                                                       eeModuleDescriptor);
        return bda;
    }
442288
@Override
    public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
        StringBuilder buf = new StringBuilder();

        synchronized (payloads) {
            if (payloads.size() > 0) {
                buf.append('<').append(getElementName());
                buf.append(" xmlns=\"").append(getNamespace()).append("\" >");

                Iterator<JinglePayloadType> pt = payloads.listIterator();
                while (pt.hasNext()) {
                    JinglePayloadType pte = pt.next();
                    buf.append(pte.toXML());
                }
                buf.append("</").append(getElementName()).append('>');
            }
        }

        return buf.toString();
    }
544558
private function createNode($nodeName, $nodeValue, $cdata = false)
    {
        $node = $this->createElement($nodeName);
        if($cdata){
            $text = $this->createCDATASection($nodeValue);
        } else {
            $text = $this->createTextNode($nodeValue);
        }

        $node->appendChild($text);
        return $node;

    }