Set up media site version string into current context and into session and return it.
@param string $targetMediaSiteVersion
@return array
559138
protected function setUpMediaSiteVersionToContextAndSession ($targetMediaSiteVersion) {
		$this->session->{static::URL_PARAM_MEDIA_VERSION} = $targetMediaSiteVersion;
		$this->mediaSiteVersion = $targetMediaSiteVersion;
		return [\MvcCore\Ext\Routers\IMedia::URL_PARAM_MEDIA_VERSION => $targetMediaSiteVersion];
	}
979545
public function getAccessToken($targetUri)
    {
        Validate::isString($targetUri, '$targetUri');

        $this->_sweepExpiredTokens();
        $scopeUri = $this->_createScopeUri($targetUri);

        if (array_key_exists($scopeUri, $this->_activeTokens)) {
            $activeToken = $this->_activeTokens[$scopeUri];

            return $activeToken->getWrapAccessTokenResult()->getAccessToken();
        }

        $wrapAccessTokenResult = $this->_wrapRestProxy->wrapAccessToken(
            $this->_wrapUri,
            $this->_wrapName,
            $this->_wrapPassword,
            $scopeUri
        );

        $expirationDateTime = new \DateTime('now');
        $expiresIn = intval($wrapAccessTokenResult->getExpiresIn() / 2);
        $expirationDateTime = $expirationDateTime->add(
            new \DateInterval('PT'.$expiresIn.'S')
        );

        $acquiredActiveToken = new ActiveToken($wrapAccessTokenResult);
        $acquiredActiveToken->setExpirationDateTime($expirationDateTime);
        $this->_activeTokens[$scopeUri] = $acquiredActiveToken;

        return $wrapAccessTokenResult->getAccessToken();
    }
1037281
public function createComposerInMemoryPackage($targetDir, $version)
    {
        $url = $this->getURL($version);

        $versionParser = new VersionParser();
        $normVersion = $versionParser->normalize($version);

        $package = new Package(static::PHANTOMJS_NAME, $normVersion, $version);
        $package->setTargetDir($targetDir);
        $package->setInstallationSource('dist');
        $package->setDistType(pathinfo($url, PATHINFO_EXTENSION) === 'zip' ? 'zip' : 'tar'); // set zip, tarball
        $package->setDistUrl($url);

        return $package;
    }
1305180
private static function getMediaRootRelative() {
    $config = ObjectFactory::getInstance('configuration');
    $mediaRootAbs = $config->getDirectoryValue('uploadDir', 'Media');
    return self::makeRelative($mediaRootAbs);
  }
1322824
public function rollback($environment, $target = null, $force = false, $targetMustMatchVersion = true)
    {
        // note that the migrations are indexed by name (aka creation time) in ascending order
        $migrations = $this->getMigrations();

        // note that the version log are also indexed by name with the proper ascending order according to the version order
        $executedVersions = $this->getEnvironment($environment)->getVersionLog();

        // get a list of migrations sorted in the opposite way of the executed versions
        $sortedMigrations = [];

        foreach ($executedVersions as $versionCreationTime => &$executedVersion) {
            // if we have a date (ie. the target must not match a version) and we are sorting by execution time, we
            // convert the version start time so we can compare directly with the target date
            if (!$this->getConfig()->isVersionOrderCreationTime() && !$targetMustMatchVersion) {
                $dateTime = \DateTime::createFromFormat('Y-m-d H:i:s', $executedVersion['start_time']);
                $executedVersion['start_time'] = $dateTime->format('YmdHis');
            }

            if (isset($migrations[$versionCreationTime])) {
                array_unshift($sortedMigrations, $migrations[$versionCreationTime]);
            } else {
                // this means the version is missing so we unset it so that we don't consider it when rolling back 
                // migrations (or choosing the last up version as target)
                unset($executedVersions[$versionCreationTime]);
            }
        }

        if ($target === 'all' || $target === '0') {
            $target = 0;
        } elseif (!is_numeric($target) && null !== $target) { // try to find a target version based on name
            // search through the migrations using the name
            $migrationNames = array_column($executedVersions, 'migration_name');
            $found = array_search($target, $migrationNames);

            // check on was found
            if ($found !== false) {
                $target = (string) $found;
            } else {
                $this->getOutput()->writeln("<error>No migration found with name ($target)</error>");

                return;
            }
        }

        // Check we have at least 1 migration to revert
        $executedVersionCreationTimes = array_keys($executedVersions);
        if (empty($executedVersionCreationTimes) || $target == end($executedVersionCreationTimes)) {
            $this->getOutput()->writeln('<error>No migrations to rollback</error>');

            return;
        }

        // If no target was supplied, revert the last migration
        if (null === $target) {
            // Get the migration before the last run migration
            $prev = count($executedVersionCreationTimes) - 2;
            $target = $prev >= 0 ? $executedVersionCreationTimes[$prev] : 0;
        }

        // If the target must match a version, check the target version exists
        if ($targetMustMatchVersion && 0 !== $target && !isset($migrations[$target])) {
            $this->getOutput()->writeln("<error>Target version ($target) not found</error>");

            return;
        }

        // Rollback all versions until we find the wanted rollback target
        $rollbacked = false;

        foreach ($sortedMigrations as $migration) {
            if ($targetMustMatchVersion && $migration->getVersion() == $target) {
                break;
            }

            if (in_array($migration->getVersion(), $executedVersionCreationTimes)) {
                $executedVersion = $executedVersions[$migration->getVersion()];

                if (!$targetMustMatchVersion) {
                    if (($this->getConfig()->isVersionOrderCreationTime() && $executedVersion['version'] <= $target) ||
                        (!$this->getConfig()->isVersionOrderCreationTime() && $executedVersion['start_time'] <= $target)) {
                        break;
                    }
                }

                if (0 != $executedVersion['breakpoint'] && !$force) {
                    $this->getOutput()->writeln('<error>Breakpoint reached. Further rollbacks inhibited.</error>');
                    break;
                }
                $this->executeMigration($environment, $migration, MigrationInterface::DOWN);
                $rollbacked = true;
            }
        }

        if (!$rollbacked) {
            $this->getOutput()->writeln('<error>No migrations to rollback</error>');
        }
    }
600962
public function getMediasAction(Request $request)
    {
        if (!$request->query->has('filters')) {
            return $this->createResponse(array());
        }

        $mediaManager = $this->getMediaManager();

        $filtersKeys = explode(',', $request->query->get('filters'));
        $medias = $mediaManager->findAllByFiltersKeys($filtersKeys);

        return $this->createResponse($medias);
    }
363186
protected function _getStrings(&$position, $target)
    {
        $strings = [];
        $count = count($strings);
        while ($count < $target && ($this->_tokens[$position] === ',' || $this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING || $this->_tokens[$position][0] == T_LNUMBER)) {
            $count = count($strings);
            if ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING && $this->_tokens[$position + 1] === '.') {
                $string = '';
                while ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING || $this->_tokens[$position] === '.') {
                    if ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING) {
                        $string .= $this->_formatString($this->_tokens[$position][1]);
                    }
                    $position++;
                }
                $strings[] = $string;
            } elseif ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING) {
                $strings[] = $this->_formatString($this->_tokens[$position][1]);
            } elseif ($this->_tokens[$position][0] == T_LNUMBER) {
                $strings[] = $this->_tokens[$position][1];
            }
            $position++;
        }

        return $strings;
    }
310113
public function getMediaUrls()
    {
        if ($this->_aMediaUrls === null) {
            $this->_aMediaUrls = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
            $this->_aMediaUrls->init("oxmediaurl");
            $this->_aMediaUrls->getBaseObject()->setLanguage($this->getLanguage());

            $sViewName = getViewName("oxmediaurls", $this->getLanguage());
            $sQ = "select * from {$sViewName} where oxobjectid = '" . $this->getId() . "'";
            $this->_aMediaUrls->selectString($sQ);
        }

        return $this->_aMediaUrls;
    }
691194
public function getMediaUrl(Media $media, $dispositionType = null)
    {
        $url = $media->getUrl();

        if (ResponseHeaderBag::DISPOSITION_INLINE === $dispositionType) {
            $url .= (false === strpos($url, '?') ? '?inline=1' : '&inline=1');
        } elseif (ResponseHeaderBag::DISPOSITION_ATTACHMENT === $dispositionType) {
            $url .= (false === strpos($url, '?') ? '?inline=0' : '&inline=0');
        }

        return $url;
    }
1192716
private function getTargetResult($target, $context=null)
    {
        if ($context===null && \is_string($target) && strpos($target, '<') === false) {
            $context = $this->document;
        }

        return $context === null ? self::create($target) : self::create($target, $context);
    }
803291
public function getSiteFilterQuery($targetTableAlias)
    {
        $parent = $this->getParent();
        if ($parent and $parentId = $parent->getId()) {
            return $targetTableAlias . '.site_id = ' . $parentId;
        } elseif ($id = $this->getId()) {
            return $targetTableAlias . '.site_id = ' . $id;
        }

        return '';
    }
26318
public function Target($Target = FALSE) {
      if ($Target === FALSE) {
         $Target = $this->Form->GetFormValue('Target', FALSE);
         if (!$Target)
            $Target = $this->Request->Get('Target', '/');
      }
      
      // Make sure that the target is a valid url.
      if (!preg_match('`(^https?://)`', $Target)) {
         $Target = '/'.ltrim($Target, '/');
         
         // Never redirect back to signin.
         if (preg_match('`^/entry/signin`i', $Target))
            $Target = '/';
      } else {
         $MyHostname = parse_url(Gdn::Request()->Domain(),PHP_URL_HOST);
         $TargetHostname = parse_url($Target, PHP_URL_HOST);
         
         // Only allow external redirects to trusted domains.
         $TrustedDomains = C('Garden.TrustedDomains', TRUE);
         
         if (is_array($TrustedDomains)) {
            // Add this domain to the trusted hosts.
            $TrustedDomains[] = $MyHostname;
            $Sender->EventArguments['TrustedDomains'] = &$TrustedDomains;
            $this->FireEvent('BeforeTargetReturn');
         }
			
         if ($TrustedDomains === TRUE) {
            return $Target;
			} elseif (count($TrustedDomains) == 0) {
				// Only allow http redirects if they are to the same host name.
				if ($MyHostname != $TargetHostname)
					$Target = '';
			} else {
				// Loop the trusted domains looking for a match
				$Match = FALSE;
				foreach ($TrustedDomains as $TrustedDomain) {
					if (StringEndsWith($TargetHostname, $TrustedDomain, TRUE))
						$Match = TRUE;
				}
				if (!$Match)
					$Target = '';
			}
      }
      return $Target;
   }
575120
public function getCTATarget()
    {
        if (!($this->nb_site_target_destination instanceof CNabuSiteTarget) &&
            $this->getTargetUseURI() === CNabuSiteTargetLink::USE_URI_TRANSLATED &&
            is_numeric($this->getTargetId())
        ) {
            $this->nb_site_target_destination = $this->nb_site_target->getSite()->getTarget($this->getTargetId());
        }

        return $this->nb_site_target_destination;
    }
215391
public function apply(TranscodeInterface $media, FormatInterface $format)
	{
		return [
			'filter:a' => [
				'volume' => http_build_query([
					'volume'            => $this->getVolume(),
					'precision'         => $this->getPrecision(),
					'replaygain'        => $this->getReplayGain(),
					'replaygain_preamp' => $this->getReplayGainPreamp(),
					'eval'              => $this->getEval()
				], null, ':')
			]
		];
	}
1170600
public function getMedia()
    {
        // if media was set by setMedia() use this->media
        if ($this->media) {
            return $this->media;
        }
        $mediaCollection = [];
        $media = $this->entity->getMedia();
        if (!$media) {
            return $mediaCollection;
        }
        foreach ($media as $medium) {
            $mediaCollection[] = new Media($medium, $this->locale);
        }

        return $mediaCollection;
    }
1301446
private function getResourceUrlArray()
    {
        if (is_a($this->target->urls, Collection::class)) {
            return $this->target->urls->toArray();
        }

        return (array) $this->target->urls;
    }
804252
public function getMedias()
    {
        $entities = [];
        if ($this->entity->getMedias()) {
            foreach ($this->entity->getMedias() as $media) {
                $entities[] = new Media($media, $this->locale, null);
            }
        }

        return $entities;
    }