本文整理汇总了PHP中pradoGetApplication函数的典型用法代码示例。如果您正苦于以下问题:PHP pradoGetApplication函数的具体用法?PHP pradoGetApplication怎么用?PHP pradoGetApplication使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pradoGetApplication函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
* Reads the configuration given in the app spec.
* In particular, the attribute 'enabled' and 'path' are read.
* @param mixed the configuration.
*/
function __construct($config)
{
if (isset($config['enabled']) && (string) $config['enabled'] == 'true') {
$this->enabled = true;
} else {
$this->enabled = false;
}
if (empty($config['path'])) {
$this->rootPath = null;
} else {
$this->rootPath = realpath(pradoGetContextPath((string) $config['path'], dirname(pradoGetApplication()->getSpecificationFile())));
if ($this->rootPath === false || !is_dir($this->rootPath)) {
throw new Exception("Unable to locate the cache path '{$this->rootPath}'.");
}
}
$this->savePath = $this->rootPath;
}
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:23,代码来源:TCacheManager.php
示例2: assess
function assess($parameters, $pageDefinition)
{
if (isset($parameters['Master'])) {
$pageDefinition->setMasterPageName($parameters['Master']);
}
$app = pradoGetApplication()->getGlobalization();
if (empty($app)) {
return;
}
if (isset($parameters['Culture'])) {
$app->Culture = $parameters['Culture'];
}
if (isset($parameters['Charset'])) {
$app->Charset = $parameters['Charset'];
}
if (isset($parameters['ContentType'])) {
$app->ContentType = $parameters['ContentType'];
}
if (isset($parameters['Catalogue'])) {
$app->Translation['catalogue'] = $parameters['Catalogue'];
}
}
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:22,代码来源:TPageDirective.php
示例3: saveMessages
/**
* Save untranslated messages to the catalogue.
*/
public static function saveMessages()
{
static $onceonly = true;
if (!is_null(self::$formatter)) {
if ($onceonly) {
$app = pradoGetApplication()->getGlobalization();
if (isset($app->Translation['autosave'])) {
$catalogue = null;
if (isset($app->Translation['catalogue'])) {
$catalogue = $app->Translation['catalogue'];
}
$auto = $app->Translation['autosave'];
if ($auto == 'true') {
self::$formatter->getSource()->save($catalogue);
} else {
self::$formatter->getSource()->setCulture($app->getDefaultCulture());
self::$formatter->getSource()->save($auto);
}
}
}
$onceonly = false;
}
}
开发者ID:joybinchen,项目名称:svnmanager-1.09,代码行数:26,代码来源:Translation.php
示例4: dirname
<?php
require_once dirname(__FILE__) . '/../framework/prado.php';
pradoGetApplication('multiform/application.spec')->run();
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:4,代码来源:multiform.php
示例5: using
/**
* 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;
if (isset($pradoNamespaces[$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)) {
$pradoNamespaces[$namespace] = $path . PRADO_EXT_CLASS;
require_once $path . PRADO_EXT_CLASS;
} else {
throw new TNamespaceInvalidException($namespace);
}
}
}
}
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:41,代码来源:prado.php
示例6: onAuthenticationRequired
public function onAuthenticationRequired($pageName)
{
$this->setRedirectUrl($_SERVER['REQUEST_URI']);
pradoGetApplication()->transfer('User:LoginPage');
}
开发者ID:joybinchen,项目名称:svnmanager-1.09,代码行数:5,代码来源:SVNManagerUser.php
示例7: die
<?php
if (!extension_loaded('sqlite')) {
die('Sorry, the php sqlite module is required for this example to work.');
}
require_once dirname(__FILE__) . '/../framework/prado.php';
pradoGetApplication('mytest/application.spec')->run();
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:7,代码来源:mytest.php
示例8: onPreInit
protected function onPreInit($param)
{
if (!strlen($this->masterPageName)) {
$this->masterPageName = $this->getDefinition(get_class($this))->getMasterPageName();
}
if (strlen($this->masterPageName)) {
$this->masterPage = pradoGetApplication()->loadPage($this->masterPageName);
$this->masterPage->onPreInit($param);
}
}
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:10,代码来源:TPage.php
示例9: preprocessTemplate
/**
* Preprocesses a template string by inserting external templates (recursively).
* @param string the template string to be preprocessed
* @return string the processed result
*/
protected function preprocessTemplate($str)
{
if ($n = preg_match_all('/<%include(.*?)%>/', $str, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
$base = 0;
for ($i = 0; $i < $n; ++$i) {
$pathAlias = trim($matches[$i][1][0]);
$ext = $this->preprocessTemplate(pradoGetApplication()->getResourceLocator()->getExternalTemplate($pathAlias));
$length = strlen($matches[$i][0][0]);
$offset = $base + $matches[$i][0][1];
$str = substr_replace($str, $ext, $offset, $length);
$base += strlen($ext) - $length;
}
}
return $str;
}
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:20,代码来源:TResourceParser.php
示例10: getKey
protected function getKey()
{
$key = '';
if (strlen($this->key)) {
$key = $this->key;
} else {
$key = pradoGetApplication()->getApplicationID();
}
return $key;
}
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:10,代码来源:TViewStateManager.php
示例11: getExternalTemplate
/**
* Gets the content of an external template.
* @param string the path alias to the external template.
* @return string the external template content
* @throw TTemplateNotExistsException
*/
public function getExternalTemplate($pathAlias)
{
$fname = pradoGetApplication()->translatePathAlias($pathAlias, self::EXT_TEMPLATE);
if (is_null($fname) || !is_file($fname)) {
throw new TTemplateNotExistsException($pathAlias);
} else {
return file_get_contents($fname);
}
}
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:15,代码来源:TResourceLocator.php
示例12: instantiateTemplate
/**
* Instantiates a template for a component.
* Components declared in the template will be instantiated
* and added as children of the component. The container-containee
* relationship will also be established.
* @param TComponent the owner of the template
* @param array the parsing result returned by TResourceParser.
*/
public function instantiateTemplate($component, $template)
{
$application = pradoGetApplication();
if (is_string($template)) {
$template = $application->getResourceParser()->parseTemplate($template);
}
$components = array();
foreach ($template as $key => $object) {
//special directives
if ((string) $object[0] === 'directive') {
$directiveClass = 'T' . $object[1] . 'Directive';
$directive = new $directiveClass();
$directive->assess($object[2], $this);
} else {
if (count($object) > 2) {
// component
list($cid, $type, $id, $attributes) = $object;
$child = $application->createComponent($type, $id);
$childSpec = TComponent::getDefinition($type);
foreach ($attributes as $name => $value) {
if ($childSpec->canSetProperty($name)) {
if (strlen($value) > 1 && $value[0] === '#') {
if ($value[1] !== '#') {
$child->bindProperty($name, substr($value, 1));
} else {
$child->setPropertyInitValue($name, substr($value, 1));
}
} else {
$child->setPropertyInitValue($name, $value);
}
} else {
if ($childSpec->hasEvent($name)) {
$child->attachEventHandler($name, $value);
} else {
$child->setAttribute($name, $value);
}
}
}
if ($child instanceof TControl) {
$child->initSkin($child->getPropertyInitValue("Skin"));
}
$child->initProperties();
$components[$key] = $child;
$container = isset($components[$cid]) ? $components[$cid] : $component;
$container->addParsedObject($child, $component);
} else {
// static text
$cid = (string) $object[0];
$container = isset($components[$cid]) ? $components[$cid] : $component;
$container->addParsedObject($object[1], $component);
}
}
}
}
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:62,代码来源:TComponentDefinition.php
示例13: onDataBinding
/**
* Parses and intantiates templates.
* This method is invoked when <b>OnDataBinding</b> event is raised.
* It parses and instantiates all assoicated templates for the
* repeater control and raises related events.
* This method should only used by control developers.
* @param TEventParameter event parameter
*/
protected function onDataBinding($param)
{
parent::onDataBinding($param);
$this->setViewState('Items', null, null);
$this->removeChildren();
$this->removeBodies();
$this->items = array();
$this->itemCount = 0;
$this->header = null;
$this->footer = null;
$showEmpty = count($this->dataSource) <= 0 && strlen($this->emptyTemplate);
if (is_null($this->dataSource)) {
return;
}
if (strlen($this->headerTemplate) && !$showEmpty) {
$header = pradoGetApplication()->createComponent('TRepeaterItem', self::ID_HEADER);
$header->setType(TRepeaterItem::TYPE_HEADER);
$header->instantiateTemplate($this->headerTemplate);
$this->header = $header;
$this->addChild($header);
$this->addBody($header);
$p = new TRepeaterItemEventParameter();
$p->item = $header;
$this->onItemCreated($p);
}
$count = 0;
//when the datasource is empty
if ($showEmpty) {
$empty = pradoGetApplication()->createComponent('TRepeaterItem', self::ID_EMPTY);
$empty->setType(TRepeaterItem::TYPE_EMPTY);
$empty->instantiateTemplate($this->emptyTemplate);
$this->addChild($empty);
$this->addBody($empty);
$p = new TRepeaterItemEventParameter();
$p->item = $empty;
$this->onItemCreated($p);
}
foreach ($this->dataSource as $key => $value) {
if ($this->itemCount > 0 && strlen($this->separatorTemplate)) {
$separator = pradoGetApplication()->createComponent('TRepeaterItem');
$separator->setType(TRepeaterItem::TYPE_SEPARATOR);
$separator->instantiateTemplate($this->separatorTemplate);
$separator->setID(self::ID_SEPARATOR . "{$count}");
$this->addChild($separator);
$this->addBody($separator);
$p = new TRepeaterItemEventParameter();
$p->item = $separator;
$this->onItemCreated($p);
}
$item = null;
if ($count % 2 == 1 && strlen($this->alternatingItemTemplate)) {
$item = pradoGetApplication()->createComponent('TRepeaterItem');
$item->instantiateTemplate($this->alternatingItemTemplate);
} else {
if (strlen($this->itemTemplate)) {
$item = pradoGetApplication()->createComponent('TRepeaterItem');
$item->instantiateTemplate($this->itemTemplate);
}
}
if (!is_null($item)) {
$item->setID(self::ID_ITEM . "{$count}");
$item->setIndex($key);
$item->setItemIndex($count);
$item->setData($value);
$this->addChild($item);
$this->addBody($item);
$this->items[$this->itemCount] = $item;
$this->itemCount++;
$p = new TRepeaterItemEventParameter();
$p->item = $item;
$this->onItemCreated($p);
}
$count++;
}
if (strlen($this->footerTemplate) && !$showEmpty) {
$footer = pradoGetApplication()->createComponent('TRepeaterItem', self::ID_FOOTER);
$footer->setType(TRepeaterItem::TYPE_FOOTER);
$footer->instantiateTemplate($this->footerTemplate);
$this->footer = $footer;
$this->addChild($footer);
$this->addBody($footer);
$p = new TRepeaterItemEventParameter();
$p->item = $footer;
$this->onItemCreated($p);
}
}
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:94,代码来源:TRepeater.php
示例14: logout
/**
* Sets authentication false for the user.
* Default implementation will destroy all session data related to the user visit.
* Derived classes may override this method to provide special treatment.
*/
public function logout()
{
$this->setAuthenticated(false);
$this->setUsername('');
$session = pradoGetApplication()->getSession();
$session->destroy();
}
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:12,代码来源:TUser.php
示例15: pradoGetApplication
<?php
require_once '../framework/prado.php';
pradoGetApplication('web/application.spec')->run();
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:4,代码来源:index.php
示例16: onDataBinding
/**
* Generates the content in the data grid.
* This method is invoked when <b>OnDataBinding</b> event is raised.
* It builds up the data grid according to column definitions
* data source.
* This method should only used by control developers.
* @param TEventParameter event parameter
*/
protected function onDataBinding($param)
{
parent::onDataBinding($param);
$this->setViewState('Items', null, null);
$this->removeBodies();
foreach ($this->items as $item) {
$this->removeChild($item);
}
if (!is_null($this->header)) {
$this->removeChild($this->header);
$this->header = null;
}
if (!is_null($this->footer)) {
$this->removeChild($this->footer);
$this->footer = null;
}
if (!is_null($this->pager)) {
$this->removeChild($this->pager);
$this->pager = null;
}
$this->items->clear();
foreach ($this->columns as $column) {
$column->dataBind();
}
if (is_null($this->dataSource)) {
return;
}
if ($this->isAllowPaging()) {
$pageSize = $this->getPageSize();
$offset = $this->isAllowCustomPaging() ? 0 : $pageSize * $this->getCurrentPageIndex();
} else {
$offset = 0;
$pageSize = self::MAX_PAGE_SIZE;
}
$index = 0;
$editIndex = $this->getEditItemIndex();
$selectedIndex = $this->getSelectedItemIndex();
$this->dataItemCount = 0;
$dataSource = array();
foreach ($this->dataSource as $data) {
$this->dataItemCount++;
$dataSource[] = $data;
if ($this->isAllowCustomPaging() && $this->dataItemCount > $offset + $pageSize) {
break;
}
if ($this->dataItemCount <= $offset || $this->dataItemCount > $offset + $pageSize) {
continue;
}
if ($index == 0 && $this->isAutoGenerateColumns()) {
//foreach($this->autoColumns as $column)
// $this->removeChild($column);
$this->autoColumns->clear();
$columnIndex = 0;
foreach ($data as $key => $value) {
$column = pradoGetApplication()->createComponent('TBoundColumn', 'AutoColumn' . $columnIndex);
$column->setHeaderText($key);
$column->setDataField($key);
$column->setSortExpression($key);
$column->dataBind();
$this->autoColumns->add($column);
$columnIndex++;
}
}
$item = $this->createComponent('TDataGridItem', self::ID_ITEM . $index);
if ($index == $editIndex) {
$type = TDataGridItem::TYPE_EDIT_ITEM;
} else {
if ($index == $selectedIndex) {
$type = TDataGridItem::TYPE_SELECTED_ITEM;
} else {
if ($index % 2) {
$type = TDataGridItem::TYPE_ALTERNATING_ITEM;
} else {
$type = TDataGridItem::TYPE_ITEM;
}
}
}
$item->setType($type);
$item->setData($data);
$item->setItemIndex($index);
$this->items->add($item);
$this->initializeItem($item);
$p = new TDataGridItemEventParameter();
$p->item = $item;
$this->onItemCreated($p);
$index++;
}
$this->setViewState('Items', $dataSource, array());
$this->header = $this->createComponent('TDataGridItem', self::ID_HEADER);
$this->header->setType(TDataGridItem::TYPE_HEADER);
$this->addBody($this->header);
$this->initializeItem($this->header);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:101,代码来源:TDataGrid.php
示例17: initSkin
/**
* Initializes a skin for the control. If a skin name is provided then that skin will be loaded.
* If not then the skin as defined by the SkinName property of the control will be loaded.
* If this property has no value then the default skin for the control will be loaded. If no
* default skin exists for this control then no skin will be loaded at all.
*/
public function initSkin($skinName = null)
{
$type = get_class($this);
$theme = pradoGetApplication()->getTheme();
if (is_null($skinName)) {
$skinName = "_default";
}
if (isset($theme[$type][$skinName])) {
if (isset($theme[$type][$skinName]['parent'])) {
$this->initSkin($theme[$type][$skinName]['parent']);
}
$definition = $this->getDefinition($type);
foreach ($theme[$type][$skinName]['properties'] as $name => $value) {
$definition->configureProperty($this, $name, $value);
}
} else {
if ($skinName != 0) {
throw new TSkinNotFoundException($skinName, get_class($this));
}
}
}
开发者ID:joybinchen,项目名称:svnmanager-1.09,代码行数:27,代码来源:TControl.php
示例18: createComponent
/**
* Creates a child component.
* This is a convenient function for creating a component
* and adding it as a child component.
* @param string the component type
* @param string the component ID, empty for implicit ID
* @return TComponent the created component.
*/
public function createComponent($type, $id = '')
{
$component = pradoGetApplication()->createComponent($type, $id);
$this->addChild($component);
return $component;
}
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:14,代码来源:TComponent.php
示例19: handleError
/**
* Dispatches the error handling to a page.
* The error page will be executed and the rendering result be displayed.
* If the error is not handled by a page, the method will display the error
* directly based on the application state (debug or not).
* This method always terminates the execution of the current application.
* @param string error code
* @param string|Exception error message or exception
*/
public function handleError($code, $e = '')
{
static $count = 0;
$debug = pradoGetApplication()->getApplicationState() === TApplication::STATE_DEBUG;
if ($e instanceof Exception) {
if ($debug) {
$msg = get_class($e) . ': ' . $e->getMessage() . "\n" . $e->getTraceAsString();
} else {
$msg = $e->getMessage();
}
} else {
$msg = $e;
}
if ($count > 0) {
if ($debug) {
echo "<h1>Recursive Error</h1>\n";
echo "<h2>{$code}</h2>\n";
echo "<pre>{$msg}</pre>\n";
echo "<h2>{$this->errorCode}</h2>\n";
echo "<pre>{$this->errorMessage}</pre>";
} else {
echo "<h1>{$code}</h1>\n";
echo "<pre>{$msg}</pre>";
}
} else {
$this->errorCode = $code;
$this->errorMessage = $msg;
$count++;
if (isset($this->errorPages[$code])) {
echo pradoGetApplication()->execute($this->errorPages[$code]);
} else {
if (!empty($this->defaultPage)) {
echo pradoGetApplication()->execute($this->defaultPage);
} else {
echo "<h1>{$code}</h1>\n";
echo "<pre>{$msg}</pre>";
}
}
}
exit;
}
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:50,代码来源:TErrorHandler.php
示例20: pradoGetApplication
<?php
require_once "./prado-2.0.3/framework/prado.php";
$app = pradoGetApplication('svnmanager/application.spec');
$app->run();
开发者ID:joybinchen,项目名称:svnmanager-1.09,代码行数:5,代码来源:index.php
注:本文中的pradoGetApplication函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论