Saves the page paramters after the page url is saved
@param PageUrl $pageUrl The page url
430240
private function SaveParams(PageUrl $pageUrl)
    {
        $this->ClearParams($pageUrl);
        $params = $this->serializer->LinesToArray($this->Value('Params'));
        $prev = null;
        foreach ($params as $name => $value) {
            $param = new PageUrlParameter();
            $param->SetPageUrl($pageUrl);
            $param->SetPrevious($prev);
            $param->SetName($name);
            $param->SetValue($value);
            $param->Save();
            $prev = $param;
        }
    }
211227
public function setURL($url, $data = array())
    {
        $this->baseUrl = $url;
        $this->url = $this->buildURL($url, $data);
        $this->setOpt(CURLOPT_URL, $this->url);
    }
1046855
protected function storeIntendedUrl()
    {
        // Do not store the URL if it was the login itself
        $previousUrl = url()->previous();
        $loginUrl    = url()->route($this->core->prefixRoute(NamedRoute::AUTH_LOGIN));

        if ($previousUrl == $loginUrl) return;

        session()->put('url.intended', $previousUrl);
    }
478994
public function setUrl($url)
    {
        $this->reset();

        foreach (parse_url($url) as $part => $value) {
            $this[$part] = $value;
        }
    }
1034643
public function saveSeoAction()
	{
		$idPage = $this->params()->fromRoute('idPage', $this->params()->fromQuery('idPage', ''));
		$translator = $this->serviceLocator->get('translator');
		
		$eventDatas = array('idPage' => $idPage);
		$this->getEventManager()->trigger('meliscms_page_saveseo_start', null, $eventDatas);
		
		// Get the form properly loaded
		$seoForm = $this->getSeoPageForm($idPage);

		$melisTablePageSeo = $this->serviceLocator->get('MelisEngineTablePageSeo');

		// Check if post
		$request = $this->getRequest();
		if ($request->isPost())
		{
            // Get values posted and set them in form
            $postValues = get_object_vars($request->getPost());

            if (!empty($postValues['pseo_url'])) {
                $postValues['pseo_url'] =  $this->cleanURL($postValues['pseo_url']);
            }

            if (!empty($postValues['pseo_canonical'])) {
                $postValues['pseo_canonical'] =  $this->cleanURL($postValues['pseo_canonical']);
            }

            $seoForm->setData($postValues);

            // Validate the form
			if ($seoForm->isValid())
			{
				// Get datas validated
				$datas = $seoForm->getData();
				
				$allEmpty = true;
				foreach ($datas as $data)
				{
					if (!empty($data))
					{
						$allEmpty = false;
						break;
					}
				}
				
				$success = 1;
				$datas['pseo_id'] = $idPage;
				
				if (substr($datas['pseo_url'], 0, 1) == '/')
					$datas['pseo_url'] = substr($datas['pseo_url'], 1, strlen($datas['pseo_url']));
				if (substr($datas['pseo_url_redirect'], 0, 1) == '/')
					$datas['pseo_url_redirect'] = substr($datas['pseo_url_redirect'], 1, strlen($datas['pseo_url_redirect']));
				if (substr($datas['pseo_url_301'], 0, 1) == '/')
					$datas['pseo_url_301'] = substr($datas['pseo_url_301'], 1, strlen($datas['pseo_url_301']));

				if (!$allEmpty)	
				{
					// Check for unicity of the URL declared
					if (!empty($datas['pseo_url']))
					{
						$datasPageSeo = $melisTablePageSeo->getEntryByField('pseo_url', $datas['pseo_url']);
						if (!empty($datasPageSeo))
						{
							$datasPageSeo = $datasPageSeo->current();
							if (!empty($datasPageSeo))
							{
								// Not this page of course
								if ($datasPageSeo->pseo_id != $idPage)
								{
									$pageNameDuplicate = '';
									$melisPage = $this->serviceLocator->get('MelisEnginePage');
									$datasPage = $melisPage->getDatasPage($datasPageSeo->pseo_id, 'saved');
									$pageTree = $datasPage->getMelisPageTree();
									if (!empty($pageTree))
										$pageNameDuplicate = ' ' . $pageTree->page_name . ' (' . $datasPageSeo->pseo_id . ')';
									
									// This URL is already used somewhere else
									return new JsonModel(array(
											'success' => 0,
											'datas' => array(),
											'errors' => array(
															array(
																	'pseo_url' => $translator->translate('tr_meliscms_page_save_error_SEO Url already used on') . $pageNameDuplicate,
																	'label' => $translator->translate('tr_meliscms_page_save_error_label_SEO Url')
																)
															)
									));;
								}
							}
						}
					}
					
					// Cleaning special char and white spaces on SEO Url
					$enginePage = $this->getServiceLocator()->get('MelisEngineTree');
					$datas['pseo_url'] = $enginePage->cleanString(mb_strtolower($datas['pseo_url']));
					// Checking for spaces
					if (preg_match('/\s/', $datas['pseo_url']))
					{
					    $datas['pseo_url'] = str_replace(" ", "", $datas['pseo_url']);
					}
					
				    $res = $melisTablePageSeo->save($datas, $idPage);
				}
				else
				{
					// All field are empty, let's delete the entry
					$melisTablePageSeo->deleteById($idPage);
				}
	
				$result = array(
						'success' => $success,
						'errors' => array(),
				);

			}
			else
			{
				// Add labels of errors
				$errors = $seoForm->getMessages();
				$melisMelisCoreConfig = $this->serviceLocator->get('MelisCoreConfig');
				$appConfigForm = $melisMelisCoreConfig->getItem(PageSeoController::PageSeoAppConfigPath, $idPage . '_');
				$appConfigForm = $appConfigForm['elements'];
				
				foreach ($errors as $keyError => $valueError)
				{
					foreach ($appConfigForm as $keyForm => $valueForm)
					{
						if ($valueForm['spec']['name'] == $keyError &&
								!empty($valueForm['spec']['options']['label']))
									$errors[$keyError]['label'] = $valueForm['spec']['options']['label'];
					}
				}
				
				// Get validation errors
				$result = array(
						'success' => 0,
						'errors' => array($errors),
				);

			}
		}
		else
		{
			$result = array(
					'success' => 0,
					'errors' => array(array('empty' => $translator->translate('tr_meliscms_form_common_errors_Empty datas'))),
			);
		}

		$this->getEventManager()->trigger('meliscms_page_saveseo_end', null, $result);
		
		return new JsonModel($result);
	}
925372
public function setSiteRoot($url)
    {
        $url = strval($url);
        if ('' !== $url)
        {
            $url = rtrim(parse_url($url, PHP_URL_PATH), '/');
            if (substr($url, 0, 1) != '/')
            {
                $url = '/' . $url;
            }
        }
        $this->siteRoot = $url;
    }
322868
public function setImageUrl($imageUrl = '')
	{
		$this->imageUrl = $imageUrl;
		$imageSizes = @getimagesize($this->imageUrl);
		if ($imageSizes)
		{
			list($this->imageWidth, $this->imageHeight) = $imageSizes;
		}
		else
		{
			$this->setError('Unable to get details of image');
		}
	}
931506
protected function set_url($url) {
        if ($url instanceof \moodle_url) {
            $url = $url->out(false);
        }
        $this->raw_set('url', $url);
    }
211259
public function setIconURL($iconURL)
    {
        /*
         * TODO validate the actual URL?
         */
        $this->iconURL = (empty((string) $iconURL) ? false : (string) $iconURL);
    }
663502
public function setUrl($url, $url_title = null) {
		if ($url == '') throw new \InvalidArgumentException('url parameter is empty');
		$this->url = $url;
		$this->url_title = $url_title;
	}
803496
public function getPageUrl($page=NULL) {
	
		// save current order val
		$tmp = $this->page;
	
		// build url with order value in param
		$this->page = (int)$page;
		$url = $this->getUrl();
		$this->page = $tmp;
	
		return $url;
	
	}
1095135
public function after(AfterEvent $event)
    {
        $pagination = $event->getPaginationView();

        if (!$pagination instanceof SlidingPagination) {
            return;
        }

        $page = $pagination->getPage();

        if (null === $page) {
            $page = 1;
        } else {
            $pageNumber = (int)$page;

            if ((string)$pageNumber !== (string)$page || $pageNumber < 0 || $pageNumber > $pagination->getPageCount()) {
                throw new PageNotFoundException();
            }
        }

        $request = $this->requestStack->getCurrentRequest();

        if (!empty($request)) {
            if ($page > 1) {
                $request->attributes->set(self::REQUEST_ATTR_PAGE_PREV, $page - 1);
            }
            if ($page < $pagination->getPageCount()) {
                $request->attributes->set(self::REQUEST_ATTR_PAGE_NEXT, $page + 1);
            }
        }
    }
392345
private function assertValidUrl(string $url): void
    {
        if (!(filter_var($url, FILTER_VALIDATE_URL) || filter_var($url, FILTER_VALIDATE_IP))) {
            throw new RequestContextException("Failed to set invalid URL: $url");
        }
    }
1233442
public function setUrl($url)
    {
        $this->_rawUrl = $url;
        if (strncasecmp($url, 'http://', 7) && strncasecmp($url, 'https://', 8) && isset($_SERVER['HTTP_HOST'])) {
            if (substr($url, 0, 1) != '/') {
                $url = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/') + 1) . $url;
            }
            $url = 'http://' . $_SERVER['HTTP_HOST'] . $url;
        }
        $this->_url = str_replace('&amp;', '&', $url);
        $this->_urlParams = null;
    }
948365
function set_base_url($url = '')
    {
        if (empty($url)) {
            if (!empty($_SERVER['HTTP_HOST'])) {
                $this->url = 'http://' . $_SERVER['HTTP_HOST'];
            }
            else {
                $this->url = '';
            }
        }
        else {
            // Strip any trailing slashes for consistency (relative
            // URLs may already start with a slash like "/file.html")
            if (substr($url, -1) == '/') {
                $url = substr($url, 0, -1);
            }
            $this->url = $url;
        }
    }
256227
public function save($url)
    {
        $stack = new SplStack();
        $stack->push($this->getDocumentComponent());

        // 1st/2nd pass marker.
        $marker = array();
        
        // marshalling context.
        $stream = new MemoryStream();
        $stream->open();
        $streamAccess = new PhpStreamAccess($stream);
        $streamAccess->writeOpeningTag();
        $ctx = new PhpMarshallingContext($streamAccess);
        $ctx->setFormatOutput(true);

        while (count($stack) > 0) {

            $component = $stack->pop();
            $isMarked = in_array($component, $marker, true);

            if ($isMarked === false && ($component instanceof QtiComponent)) {
                // -- QtiComponent node, 1st pass.
                // Mark as explored.
                array_push($marker, $component);
                // Ask for a 2nd pass.
                $stack->push($component);

                // Let's look at the Bean properties and ask for a future exploration.
                $bean = new Bean($component, false, self::getBaseImplementation($component));
                $ctorGetters = $bean->getConstructorGetters();
                $bodyGetters = $bean->getGetters(true);
                $getters = array_reverse(array_merge($bodyGetters->getArrayCopy(), $ctorGetters->getArrayCopy()));

                foreach ($getters as $getter) {
                    $stack->push(call_user_func(array($component, $getter->getName())));
                }
            }
            // Warning!!! Check for Coords Datatype objects. Indeed, it extends AbstractCollection, but must not be considered as it is.
            elseif ($isMarked === false && ($component instanceof AbstractCollection && !$component instanceof QtiCoords)) {
                // AbstractCollection node, 1st pass.
                // Mark as explored.
                array_push($marker, $component);
                // Ask for a 2nd pass.
                $stack->push($component);

                // Explore all values of the collection please!
                $values = array_reverse($component->getArrayCopy());
                foreach ($values as $val) {
                    $stack->push($val);
                }
            } elseif ($isMarked === true && $component instanceof QtiComponent) {
                // QtiComponent, 2nd pass.
                $marshaller = new PhpQtiComponentMarshaller($ctx, $component);
                $marshaller->setAsInstanceOf(self::getBaseImplementation($component));

                if ($component === $this->getDocumentComponent()) {
                    $marshaller->setVariableName('rootcomponent');
                }

                $marshaller->marshall();
            } elseif ($component instanceof QtiDatatype) {
                // Leaf node QtiDataType.
                $marshaller = new PhpQtiDatatypeMarshaller($ctx, $component);
                $marshaller->marshall();
            } elseif ($isMarked === true && $component instanceof AbstractCollection) {
                // AbstractCollection, 2nd pass.
                $marshaller = new PhpCollectionMarshaller($ctx, $component);
                $marshaller->marshall();
            } elseif (PhpUtils::isScalar($component) === true) {
                // Leaf node (QtiDatatype or PHP scalar (including the null value)).
                $marshaller = new PhpScalarMarshaller($ctx, $component);
                $marshaller->marshall();
            } elseif (is_array($component) === true) {
                // Leaf node array.
                $marshaller = new PhpArrayMarshaller($ctx, $component);
                $marshaller->marshall();
            } else {
                $msg = "Datatype '" . gettype($component) . "' cannot be handled by the PhpDocument::save() method.";
                throw new PhpStorageException($msg);
            }
        }

        $exists = file_exists($url);
        $written = @file_put_contents($url, $stream->getBinary());
        
        if ($written === false) {
            throw new PhpStorageException("File located at '${url}' could not be written.");
        }
        
        if ($written !== false && $exists === true && function_exists('opcache_invalidate') === true) {
            opcache_invalidate($url, true);
        }
    }
1079684
function saveState( $pageEnd = 0 )
    {
        if ( $pageEnd )
        {
            // this will be called at a new page to return the state to what it was on the
            // end of the previous page, before the stack was closed down
            // This is to get around not being able to have open 'q' across pages
            $opt = $this->stateStack[$pageEnd]; // ok to use this as stack starts numbering at 1
            $this->setColor($opt['col'],1);
            $this->setStrokeColor($opt['str'],1);
            $this->objects[$this->currentContents]['c'].="\n".$opt['lin'];
            //$this->currentLineStyle = $opt['lin'];
        }
        else
        {
            $this->nStateStack++;
            $this->stateStack[$this->nStateStack]=array( 'col' => $this->currentColour,
                                                         'str' => $this->currentStrokeColour,
                                                         'lin' => $this->currentLineStyle );
        }
        $this->objects[$this->currentContents]['c'] .= "\nq";
    }