当前位置: 首页>>代码示例>>PHP>>正文


PHP pradoGetApplication函数代码示例

本文整理汇总了PHP中pradoGetApplication函数的典型用法代码示例。如果您正苦于以下问题:PHP pradoGetApplication函数的具体用法?PHP pradoGetApplication怎么用?PHP pradoGetApplication使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pradoGetApplication函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的pradoGetApplication函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。