-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fix JS validation errors - Do not use sudo when installing linter because npm is not available to sudo - Update help file validation to expect filenames without .md - Add WebTestCase method to set input values and trigger Vue data sync - Replace use of ->getSetting() method - Use faster method for checking tinyMCE initialization in tests - Restore ValidatorURI class used in metadata test
- Loading branch information
Showing
13 changed files
with
121 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
/** | ||
* @file classes/validation/ValidatorUrI.inc.php | ||
* | ||
* Copyright (c) 2014-2018 Simon Fraser University | ||
* Copyright (c) 2000-2018 John Willinsky | ||
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING. | ||
* | ||
* @class ValidatorUrl | ||
* @ingroup validation | ||
* @see Validator | ||
* | ||
* @brief Validation check for URLs with an additional check for ipv4 syntax and | ||
* the ability to restrict to specific schemes (ftp, etc) | ||
*/ | ||
|
||
import ('lib.pkp.classes.validation.ValidatorUri'); | ||
import('lib.pkp.classes.validation.ValidatorFactory'); | ||
|
||
class ValidatorUrl extends ValidatorUri { | ||
/** @var array */ | ||
public $allowedSchemes = []; | ||
|
||
/** | ||
* Constructor. | ||
* @param $allowedSchemes array | ||
*/ | ||
function __construct($allowedSchemes = null) { | ||
parent::__construct(ValidatorUri::getRegexp($allowedSchemes)); | ||
} | ||
|
||
/** | ||
* @copydoc Validator::isValid() | ||
*/ | ||
function isValid($value) { | ||
if (!parent::isValid($value)) { | ||
return false; | ||
} | ||
|
||
if (!empty($this->allowedSchemes)) { | ||
$isAllowed = false; | ||
foreach ($this->allowedSchemes as $scheme) { | ||
if (substr($value, 0, strlen($scheme)) === $scheme) { | ||
$isAllowed = true; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
return $isAllowed; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters