/*
// Code to generate the following list:
$pradoFolderList[]='Data';
$pradoFolderList[]='Exception';
$pradoFolderList[]='I18N';
$pradoFolderList[]='Security';
$pradoFolderList[]='Web';
$pradoFolderList[]='Web/Services';
$pradoFolderList[]='Web/UI';
$pradoFolderList[]='Web/UI/WebControls';
foreach ($pradoFolderList as $folder) {
$files = new DirectoryIterator( dirname(__FILE__) .
'/' . $folder );
foreach( $files as $file )
{
if ($file->isFile()) {
$filename = explode('.', $file->getFilename());
$ext = $filename[count($filename)-1];
if ($ext==PRADO_EXT_CLASS){
$class = $filename[count($filename)-2];
echo
"\$pradoClassLocations['$class']='$folder/$file';\n";
}
}
}
}
*/
// array used to speed up component searching:
$pradoClassLocations['TAdodb']='Data/TAdodb.php';
$pradoClassLocations['TApplicationInheritanceException']='Exception/TApplicationInheritanceException.php';
$pradoClassLocations['TComponentIdInvalidException']='Exception/TComponentIdInvalidException.php';
$pradoClassLocations['TComponentIdNameClashException']='Exception/TComponentIdNameClashException.php';
$pradoClassLocations['TComponentIdNotUniqueException']='Exception/TComponentIdNotUniqueException.php';
$pradoClassLocations['TComponentNotDefinedException']='Exception/TComponentNotDefinedException.php';
$pradoClassLocations['TComponentTemplateRedefinedException']='Exception/TComponentTemplateRedefinedException.php';
$pradoClassLocations['TDuplicateListValueException']='Exception/TDuplicateListValueException.php';
$pradoClassLocations['TErrorRecursiveException']='Exception/TErrorRecursiveException.php';
$pradoClassLocations['TErrorUnhandledException']='Exception/TErrorUnhandledException.php';
$pradoClassLocations['TEventHandlerInvalidException']='Exception/TEventHandlerInvalidException.php';
$pradoClassLocations['TEventNameInvalidException']='Exception/TEventNameInvalidException.php';
$pradoClassLocations['TEventNotDefinedException']='Exception/TEventNotDefinedException.php';
$pradoClassLocations['TEventRedefinedException']='Exception/TEventRedefinedException.php';
$pradoClassLocations['TException']='Exception/TException.php';
$pradoClassLocations['TExpressionInvalidException']='Exception/TExpressionInvalidException.php';
$pradoClassLocations['TModuleNotDefinedException']='Exception/TModuleNotDefinedException.php';
$pradoClassLocations['TNamespaceInvalidException']='Exception/TNamespaceInvalidException.php';
$pradoClassLocations['TObjectTypeException']='Exception/TObjectTypeException.php';
$pradoClassLocations['TPageNotDefinedException']='Exception/TPageNotDefinedException.php';
$pradoClassLocations['TPageUnauthorizedException']='Exception/TPageUnauthorizedException.php';
$pradoClassLocations['TPathAliasNotDefinedException']='Exception/TPathAliasNotDefinedException.php';
$pradoClassLocations['TPropertyGetterInvalidException']='Exception/TPropertyGetterInvalidException.php';
$pradoClassLocations['TPropertyNameClashException']='Exception/TPropertyNameClashException.php';
$pradoClassLocations['TPropertyNameInvalidException']='Exception/TPropertyNameInvalidException.php';
$pradoClassLocations['TPropertyNotDefinedException']='Exception/TPropertyNotDefinedException.php';
$pradoClassLocations['TPropertyReadOnlyException']='Exception/TPropertyReadOnlyException.php';
$pradoClassLocations['TPropertyRedefinedException']='Exception/TPropertyRedefinedException.php';
$pradoClassLocations['TPropertySetterInvalidException']='Exception/TPropertySetterInvalidException.php';
$pradoClassLocations['TPropertyTypeInvalidException']='Exception/TPropertyTypeInvalidException.php';
$pradoClassLocations['TPropertyValueInvalidException']='Exception/TPropertyValueInvalidException.php';
$pradoClassLocations['TSessionRequiredException']='Exception/TSessionRequiredException.php';
$pradoClassLocations['TSkinNotLoadedException']='Exception/TSkinNotLoadedException.php';
$pradoClassLocations['TSpecificationParsingFailedException']='Exception/TSpecificationParsingFailedException.php';
$pradoClassLocations['TStatementsInvalidException']='Exception/TStatementsInvalidException.php';
$pradoClassLocations['TTagUnbalancedException']='Exception/TTagUnbalancedException.php';
$pradoClassLocations['TTemplateNotExistsException']='Exception/TTemplateNotExistsException.php';
$pradoClassLocations['TTemplateParsingFailedException']='Exception/TTemplateParsingFailedException.php';
$pradoClassLocations['TThemeParsingFailedException']='Exception/TThemeParsingFailedException.php';
$pradoClassLocations['TUnexpectedException']='Exception/TUnexpectedException.php';
$pradoClassLocations['HTTPGlobalization']='I18N/HTTPGlobalization.php';
$pradoClassLocations['TChoices']='I18N/TChoices.php';
$pradoClassLocations['TDateFormat']='I18N/TDateFormat.php';
$pradoClassLocations['TNumberFormat']='I18N/TNumberFormat.php';
$pradoClassLocations['TParam']='I18N/TParam.php';
$pradoClassLocations['Translation']='I18N/Translation.php';
$pradoClassLocations['TTranslate']='I18N/TTranslate.php';
$pradoClassLocations['TDESCrypto']='Security/TDESCrypto.php';
$pradoClassLocations['TUser']='Security/TUser.php';
$pradoClassLocations['TAJAXScript']='Web/Services/TAJAXScript.php';
$pradoClassLocations['TJSTemplate']='Web/Services/TJSTemplate.php';
$pradoClassLocations['TPageWithCallback']='Web/Services/TPageWithCallback.php';
$pradoClassLocations['TService']='Web/Services/TService.php';
$pradoClassLocations['TService_AJAX']='Web/Services/TService_AJAX.php';
$pradoClassLocations['TService_Callback']='Web/Services/TService_Callback.php';
$pradoClassLocations['TService_PhpBeans']='Web/Services/TService_PhpBeans.php';
$pradoClassLocations['TService_RSS']='Web/Services/TService_RSS.php';
$pradoClassLocations['TService_SOAP']='Web/Services/TService_SOAP.php';
$pradoClassLocations['TService_XMLRPC']='Web/Services/TService_XMLRPC.php';
$pradoClassLocations['TContent']='Web/UI/TContent.php';
$pradoClassLocations['TContentPlaceHolder']='Web/UI/TContentPlaceHolder.php';
$pradoClassLocations['TControl']='Web/UI/TControl.php';
$pradoClassLocations['TForm']='Web/UI/TForm.php';
$pradoClassLocations['TPage']='Web/UI/TPage.php';
$pradoClassLocations['IListItemSource']='Web/UI/WebControls/IListItemSource.php';
$pradoClassLocations['TBaseDataList']='Web/UI/WebControls/TBaseDataList.php';
$pradoClassLocations['TBoundColumn']='Web/UI/WebControls/TBoundColumn.php';
$pradoClassLocations['TButton']='Web/UI/WebControls/TButton.php';
$pradoClassLocations['TButtonColumn']='Web/UI/WebControls/TButtonColumn.php';
$pradoClassLocations['TCheckBox']='Web/UI/WebControls/TCheckBox.php';
$pradoClassLocations['TCheckBoxList']='Web/UI/WebControls/TCheckBoxList.php';
$pradoClassLocations['TCompareValidator']='Web/UI/WebControls/TCompareValidator.php';
$pradoClassLocations['TCustomValidator']='Web/UI/WebControls/TCustomValidator.php';
$pradoClassLocations['TDataGrid']='Web/UI/WebControls/TDataGrid.php';
$pradoClassLocations['TDataGridColumn']='Web/UI/WebControls/TDataGridColumn.php';
$pradoClassLocations['TDataGridItem']='Web/UI/WebControls/TDataGridItem.php';
$pradoClassLocations['TDataList']='Web/UI/WebControls/TDataList.php';
$pradoClassLocations['TDataListItem']='Web/UI/WebControls/TDataListItem.php';
$pradoClassLocations['TDatePicker']='Web/UI/WebControls/TDatePicker.php';
$pradoClassLocations['TDropDownList']='Web/UI/WebControls/TDropDownList.php';
$pradoClassLocations['TEditCommandColumn']='Web/UI/WebControls/TEditCommandColumn.php';
$pradoClassLocations['TEmailAddressValidator']='Web/UI/WebControls/TEmailAddressValidator.php';
$pradoClassLocations['TExpression']='Web/UI/WebControls/TExpression.php';
$pradoClassLocations['TFileUpload']='Web/UI/WebControls/TFileUpload.php';
$pradoClassLocations['TFormLabel']='Web/UI/WebControls/TFormLabel.php';
$pradoClassLocations['THead']='Web/UI/WebControls/THead.php';
$pradoClassLocations['THiddenField']='Web/UI/WebControls/THiddenField.php';
$pradoClassLocations['THtmlArea']='Web/UI/WebControls/THtmlArea.php';
$pradoClassLocations['THyperLink']='Web/UI/WebControls/THyperLink.php';
$pradoClassLocations['THyperLinkColumn']='Web/UI/WebControls/THyperLinkColumn.php';
$pradoClassLocations['TImage']='Web/UI/WebControls/TImage.php';
$pradoClassLocations['TImageButton']='Web/UI/WebControls/TImageButton.php';
$pradoClassLocations['TLabel']='Web/UI/WebControls/TLabel.php';
$pradoClassLocations['TLinkButton']='Web/UI/WebControls/TLinkButton.php';
$pradoClassLocations['TListBox']='Web/UI/WebControls/TListBox.php';
$pradoClassLocations['TListControl']='Web/UI/WebControls/TListControl.php';
$pradoClassLocations['TListItem']='Web/UI/WebControls/TListItem.php';
$pradoClassLocations['TLiteral']='Web/UI/WebControls/TLiteral.php';
$pradoClassLocations['TPanel']='Web/UI/WebControls/TPanel.php';
$pradoClassLocations['TPlaceHolder']='Web/UI/WebControls/TPlaceHolder.php';
$pradoClassLocations['TRadioButton']='Web/UI/WebControls/TRadioButton.php';
$pradoClassLocations['TRadioButtonList']='Web/UI/WebControls/TRadioButtonList.php';
$pradoClassLocations['TRangeValidator']='Web/UI/WebControls/TRangeValidator.php';
$pradoClassLocations['TRegularExpressionValidator']='Web/UI/WebControls/TRegularExpressionValidator.php';
$pradoClassLocations['TRepeater']='Web/UI/WebControls/TRepeater.php';
$pradoClassLocations['TRepeaterItem']='Web/UI/WebControls/TRepeaterItem.php';
$pradoClassLocations['TRequiredFieldValidator']='Web/UI/WebControls/TRequiredFieldValidator.php';
$pradoClassLocations['TRequiredListValidator']='Web/UI/WebControls/TRequiredListValidator.php';
$pradoClassLocations['TStatements']='Web/UI/WebControls/TStatements.php';
$pradoClassLocations['TTable']='Web/UI/WebControls/TTable.php';
$pradoClassLocations['TTableCell']='Web/UI/WebControls/TTableCell.php';
$pradoClassLocations['TTableHeaderCell']='Web/UI/WebControls/TTableHeaderCell.php';
$pradoClassLocations['TTableRow']='Web/UI/WebControls/TTableRow.php';
$pradoClassLocations['TTemplateColumn']='Web/UI/WebControls/TTemplateColumn.php';
$pradoClassLocations['TTextBox']='Web/UI/WebControls/TTextBox.php';
$pradoClassLocations['TValidationSummary']='Web/UI/WebControls/TValidationSummary.php';
$pradoClassLocations['TValidator']='Web/UI/WebControls/TValidator.php';
$pradoClassLocations['TValidatorGroup']='Web/UI/WebControls/TValidatorGroup.php';
$pradoClassLocations['TWebControl']='Web/UI/WebControls/TWebControl.php';
$pradoClassLocations['TWizard']='Web/UI/WebControls/TWizard.php';
$pradoClassLocations['TWizardStep']='Web/UI/WebControls/TWizardStep.php';
$pradoClassLocations['TWizardTemplate']='Web/UI/WebControls/TWizardTemplate.php';
/**
* Includes a class definition file.
* The class definition file is located by searching
the used namespaces.
* If the class definition exists or is imported
successfully,
* the function returns true, otherwise false.
* @param string class name
* @return boolean whether the class definition is imported
*/
function pradoImportClass($className)
{
global $pradoNamespaces,$pradoClassLocations;
if(class_exists($className,false))
return true;
if ($s=$pradoClassLocations[$className]){
require_once(dirname(__FILE__) . '/' . $s);
return class_exists($className,false);
}
foreach($pradoNamespaces as $path)
{
if(is_file($path.'/'.$className.PRADO_EXT_CLASS))
{
require_once($path.'/'.$className.PRADO_EXT_CLASS);
$result = class_exists($className,false);
//if ($result == true)
// $pradoClassLocations
return class_exists($className,false);
}
}
return false;
}
/**
* Adds an include search path.
*
* A namespace is a dot-connected paths. The first
segment of the string
* refers to a path alias that is defined in the
application specification.
* The rest segments represent the subdirectories in order.
* For example, 'System.Web.UI' refers to the 'Web/UI'
directory under the
* framework directory.
*
* If the namespace represents a path, it will be inserted
* at the front of the current include search path.
*
* If the namespace represents a file (without the
extension),
* it will be included (require_once) at the position
of calling this function.
*
* Do not call this function before the application
singleton is created.
*
* @param string the namespace string
*/
function using($namespace)
{
global $pradoNamespaces,$pradoNamespacesFiles;
if(isset($pradoNamespaces[$namespace]) ||
isset($pradoNamespacesFiles[$namespace]))
return;
$path=pradoGetApplication()->translatePathAlias($namespace);
if(is_null($path))
throw new
TPathAliasNotDefinedException($namespace);
else
{
if(is_dir($path))
$pradoNamespaces[$namespace]=$path;
else if(is_file($path.PRADO_EXT_CLASS))
{
$pradoNamespacesFiles[$namespace]=$path.PRADO_EXT_CLASS;
require_once($path.PRADO_EXT_CLASS);
}
else
throw new
TNamespaceInvalidException($namespace);
}
}