Copies a resource

@return string HTML output
554027
public function copy()
	{
		$view = $this->getView();

		$view->boughtData = $this->toArray( $view->item, true );
		$view->boughtBody = '';

		foreach( $this->getSubClients() as $client ) {
			$view->boughtBody .= $client->copy();
		}

		return $this->render( $view );
	}
659403
public function copyEmpty()
    {
        $class_name = get_class($this);
        $wrapper = new $class_name();

        $wrapper->row_wrapper_class = $this->row_wrapper_class;
        $wrapper->index_field = $this->index_field;
        $wrapper->options = $this->options;

        return $wrapper;
    }
1003124
public function getContent_copied()
    {
        $attr = '';
        $cntattr = count($this->attribute);
        $count = ($this->separatorCount >= $cntattr) ? ($cntattr - 1) : $this->separatorCount;
        $content = '';

        for ($i = 0; $i <= $count; $i++) {
            if (in_array($this->attribute[$i], $this->ignoreAttribute))
                continue;
            if ($this->attribute[$i] != '$$') {
                $attr .= ' ' . $this->attribute[$i] . '="' . $this->wikiContentArr[$i] . '"';
            } else {
                $content = $this->contents[$i];
            }
        }

        foreach ($this->additionnalAttributes as $name => $value) {
            $attr .= ' ' . $name . '="' . htmlspecialchars($value) . '"';
        }

        return '<' . $this->name . $attr . '>' . $content . '</' . $this->name . '>';
    }
564859
function deep_copy() {
    $frame = new Frame($this->get_node()->cloneNode());
    $frame->set_style(clone $this->_frame->get_original_style());
    $deco = Frame_Factory::decorate_frame($frame, $this->_dompdf);
    $deco->set_root($this->_root);

    foreach ($this->get_children() as $child)
      $deco->append_child($child->deep_copy());

    return $deco;
  }
786066
private function copySourceContent()
    {
        // Move plugin to Plugin's directory
        $this->info("Copying source to plugins directory");
        $this->pluginNamespace = str_replace('\\', '/', $this->configContent->namespace);

        if(file_exists(pluginsPath($this->pluginNamespace))) {
            $this->cleanTmp();
            throw new \Exception('A plugin with the same namespace already exists in plugins directory');
        }

        // Created organisation directory if it doesn't exist
        $explodeNamespace = explode('/', $this->pluginNamespace);
        if(!file_exists(pluginsPath($explodeNamespace[0]))) {
            File::makeDirectory(pluginsPath($explodeNamespace[0]), 0755, true);
        }

        // Delete created directory if rename can not be executed
        if(!File::move($this->tmpDirectory, pluginsPath($this->pluginNamespace))) {
            $this->cleanTmp();
            throw new \Exception('Source could not be moved to plugins directory!');
        }

        return $this;
    }
1272735
public function copy()
	{
		$view = $this->getView();

		$view->variantData = $this->toArray( $view->item, true );
		$view->variantBody = '';

		foreach( $this->getSubClients() as $client ) {
			$view->variantBody .= $client->copy();
		}

		return $this->render( $view );
	}
502573
public function getCopyText()
    {
        $content = $this->getContent();
        $copy = array_shift($content);

        if (!is_array($copy)) {
            return null;
        }

        if ($copy['element'] !== 'copy') {
            return null;
        }

        return $copy['content'];
    }
100308
public function copy()
	{
		$view = $this->getView();

		$view->configData = $this->toArray( $view->item, true );
		$view->configBody = '';

		foreach( $this->getSubClients() as $client ) {
			$view->configBody .= $client->copy();
		}

		return $this->render( $view );
	}
1041394
private function copy()
	{
		$this->setCopied($this->getFilesystem()->get(app_path() . '/database/seeds/DatabaseSeeder.php'));

		$this->getFilesystem()->put(app_path() . '/database/seeds/DatabaseSeeder.old', $this->getCopied());
	}
947436
private function copySourceContent()
    {
        // Move plugin to Plugin's directory
        $this->info("Copying source to plugins directory");
        $this->pluginNamespace = str_replace('\\', '/', $this->configContent->namespace);

        // Delete current plugin directory
        File::deleteDirectory(pluginsPath($this->pluginNamespace));

        // Delete created directory if rename can not be executed
        if(!File::move($this->tmpDirectory, pluginsPath($this->pluginNamespace))) {
            $this->cleanTmp();
            throw new \Exception('Source could not be moved to plugins directory!');
        }

        return $this;
    }
1178999
protected function copy()
    {
        if ($this->isStale) {
            throw new \BadMethodCallException("Unable to modify a stale response object");
        }
        
        $response = clone $this;
        
        if ($this->isStale === false) {
            $this->status = new ResponseStatus($this->status);
            $this->headers = new Headers($this->getHeaders());

            $this->isStale = true;
        }
        
        return $response;
    }
171590
public function copy(){
        $copy = parent::copy();
        $copy->delimiter = $this->delimiter;
        $copy->prefix = $this->prefix;
        $copy->suffix = $this->suffix;
        return $copy;
    }
341361
private function copy()
    {
        $source = Yii::getAlias($this->source);
        if (!file_exists($source) || !is_dir($source)) {
            throw new ErrorException("Source directory {$this->source} not found");
        }
        $destination = Yii::getAlias($this->destination);
        if (!$this->replace && is_dir($destination)) { // if replace is disabled we will skip existing files
            $this->keepFiles = FileHelper::findFiles($destination);
        }
        FileHelper::copyDirectory($source, $destination, [
            'except' => ['.git/'],
            'fileMode' => 0775,
            'beforeCopy' => function ($from, $to) {
                return $this->replace || !file_exists($to) || !is_file($to);
            }
        ]);
        return true;
    }
1241207
public function duplicate()
    {
        $db = Loader::db();
        $em = \ORM::entityManager();

        $versions = $this->versions;
        $thumbs = Type::getVersionList();
        
        // duplicate the core file object
        $nf = clone $this;
        $dh = Loader::helper('date');
        $date = $dh->getOverridableNow();
        $nf->fDateAdded = new Carbon($date);

        $em->persist($nf);
        $em->flush();

        $folder = $this->getFileFolderObject();
        $folderNode = \Concrete\Core\Tree\Node\Type\File::add($nf, $folder);
        $nf->folderTreeNodeID = $folder->getTreeNodeID();

        $em->persist($nf);
        $em->flush();

        // clear out the versions
        $nf->versions = new ArrayCollection();

        $fi = Core::make('helper/file');
        $cf = Core::make('helper/concrete/file');
        $importer = new Importer();
        $filesystem = $this->getFileStorageLocationObject()->getFileSystemObject();
        foreach ($versions as $version) {
            if ($version->isApproved()) {
                $cloneVersion = clone $version;
                $cloneVersion->setFileVersionID(1);
                $cloneVersion->setFile($nf);

                $em->persist($cloneVersion);
                $em->flush();

                $cloneVersion->duplicateUnderlyingFile();

                foreach ($version->getAttributes() as $value) {
                    $value = clone $value;
                    $value->setVersion($cloneVersion);
                    $em->persist($value);
                }

                $em->flush();

                $nf->versions->add($cloneVersion);
                foreach ($thumbs as $type) {
                    $cloneVersion->duplicateUnderlyingThumbnailFiles($type, $version);
                }
            }
        }

        $em->persist($nf);
        $em->flush();

        $v = [$this->fID];
        $q = 'select fID, paID, pkID from FilePermissionAssignments where fID = ?';
        $r = $db->query($q, $v);
        while ($row = $r->fetchRow()) {
            $v = [$nf->getFileID(), $row['paID'], $row['pkID']];
            $q = 'insert into FilePermissionAssignments (fID, paID, pkID) values (?, ?, ?)';
            $db->query($q, $v);
        }

        $fe = new \Concrete\Core\File\Event\DuplicateFile($this);
        $fe->setNewFileObject($nf);
        Events::dispatch('on_file_duplicate', $fe);

        return $nf;
    }
834209
public function copyInstance()
    {
        if (
            $this->hasRequestParameter('destinationClassUri')
            && $this->hasRequestParameter('uri')
            && common_Utils::isUri($this->getRequestParameter('destinationClassUri'))
        ) {
            $this->validateInstanceRoot(
                $this->getRequestParameter('uri')
            );

            $this->signatureValidator->checkSignature(
                $this->getRequestParameter('signature'),
                $this->getRequestParameter('uri')
            );

            $instance  = $this->getCurrentInstance();
            $destinationClass = $this->getClass($this->getRequestParameter('destinationClassUri'));

            if ($this->hasWriteAccess($destinationClass->getUri())) {
                $copy = $this->getClassService()->cloneInstance($instance, $destinationClass);

                if(!is_null($copy)){
                    return $this->returnJson([
                        'success'  => true,
                        'data' => [
                            'label' => $copy->getLabel(),
                            'uri'   => $copy->getUri()
                        ]
                    ]);
                }
                return $this->returnJson([
                    'success'  => false,
                    'errorCode' => 204,
                    'errorMessage' =>  __("Unable to copy the resource")
                ], 204);
            }
            return $this->returnJson([
                'success'  => false,
                'errorCode' => 401,
                'errorMessage' =>  __("Permission denied to write in the selected class")
            ], 401);
        }
        return $this->returnJson([
            'success' => false,
            'errorCode' => 412,
            'errorMessage' => __('Missing Parameters')
        ], 412);
    }
150512
function createResources() {
    if( 0 >= count( $this->resources ))
      return;
    $output = null;
    foreach( $this->resources as $resource ) {
      $attributes = $this->_createParams( $resource['params'], array( 'ALTREP', 'LANGUAGE' ));
      if( is_array( $resource['value'] )) {
        foreach( $resource['value'] as $rix => $resourcePart )
          $resource['value'][$rix] = $this->_strrep( $resourcePart );
        $content  = implode( ',', $resource['value'] );
      }
      else
        $content  = $this->_strrep( $resource['value'] );
      $output    .= $this->_createElement( 'RESOURCES', $attributes, $content );
    }
    return $output;
  }
635879
private function copyAuthFiles()
    {
        // models
        $source =  "{$this->appPath}Models{$this->ds}UserInvite.php";
        $this->copyFilesFromSource($source, app_path("Models"), 'namespace_views');

        // controllers
        $this->copyFilesFromSource($this->appPath . "Controllers{$this->ds}Auth",
            app_path("Http{$this->ds}Controllers{$this->ds}Auth"));

        // views
        $destination = base_path("resources{$this->ds}views{$this->ds}auth");
        $source = "{$this->basePath}resources{$this->ds}views{$this->ds}auth";
        $this->copyFilesFromSource($source, $destination);
    }