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


PHP Limb类代码示例

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


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

示例1: run

  function run(&$filter_chain, &$request, &$response)
  {
    $toolkit =& Limb :: toolkit();

    $action_resolver =& $toolkit->getRequestResolver('action');
    $service_resolver =& $toolkit->getRequestResolver('service');

    if(!is_object($service_resolver) || !is_object($action_resolver))
      return throw_error(new LimbException('request resolvers not set'));

    $service =& $service_resolver->resolve($request);
    if(!$action =& $action_resolver->resolve($request))
    {
      $toolkit->setService($service);
    }
    elseif($service->actionExists($action))
    {
      $service->setCurrentAction($action);
      $toolkit->setService($service);
    }
    else
    {
      $service404 = new Service('404');
      $toolkit->setService($service404);
    }

    $filter_chain->next();
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:28,代码来源:ServiceActionMappingFilter.class.php

示例2: run

  function run()
  {
    $this->_registerFileResolvers();

    $this->_registerToolkit();

    $this->_loadPackages();

    $toolkit =& Limb :: toolkit();
    $request =& $toolkit->getRequest();
    $response =& $toolkit->getResponse();

    $filter_chain = new FilterChain($request, $response);

    $this->_registerFilters($filter_chain);

    $filter_chain->process();

    if(catch_error('LimbException', $e))
    {
      Debug :: writeException($e);
    }
    elseif(catch_error('LimbException', $e))
    {
      echo  'Unexpected PHP exception in ' . $e->getFile() . ' in line ' . $e->getLine();
      echo  '<br>';
      echo  '<pre>';
      echo    $e->getTraceAsString();
      echo  '</pre>';
      echo  'Report this error to the LIMB developers, please.';
      exit();
    }
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:33,代码来源:LimbApplication.class.php

示例3: getValue

  function getValue()
  {
    $value = $this->base->getValue();

    $locale_value = $this->_getLocale();

    $toolkit =& Limb :: toolkit();
    $locale =& $toolkit->getLocale($locale_value);

    if(isset($this->parameters[2]) && $this->parameters[2]->getValue())
      $fract_digits = $this->parameters[2]->getValue();
    else
      $fract_digits = $locale->fract_digits;

    if(isset($this->parameters[3]) && $this->parameters[3]->getValue())
      $decimal_symbol = $this->parameters[3]->getValue();
    else
      $decimal_symbol = $locale->decimal_symbol;

    if(isset($this->parameters[4]) && $this->parameters[4]->getValue())
      $thousand_separator = $this->parameters[4]->getValue();
    else
      $thousand_separator = $locale->thousand_separator;

    if ($this->isConstant())
      return number_format($value, $fract_digits, $decimal_symbol, $thousand_separator);
    else
      RaiseError('compiler', 'UNRESOLVED_BINDING');
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:29,代码来源:Number.filter.php

示例4: testFetch

 function testFetch()
 {
     $time = mktime(6, 0, 0, 3, 6, 2005);
     $day = 24 * 60 * 60;
     $toolkit =& Limb::toolkit();
     $db_table =& $toolkit->createDBTable('StatsUri');
     $db_table->insert(array('id' => $uri_id1 = 1, 'uri' => $uri1 = '/news'));
     $db_table->insert(array('id' => $uri_id2 = 2, 'uri' => $uri2 = '/articles'));
     $db_table =& $toolkit->createDBTable('StatsHit');
     $db_table->insert(array('stats_referer_id' => 1, 'session_id' => 'any', 'stats_uri_id' => $uri_id1, 'action' => 'any', 'time' => $time1 = $time, 'ip' => $ip = Ip::encode('192.168.0.1')));
     $db_table->insert(array('stats_referer_id' => 1, 'session_id' => 'any', 'stats_uri_id' => $uri_id1, 'action' => 'any', 'time' => $time2 = $time + $day, 'ip' => $ip));
     $db_table->insert(array('stats_referer_id' => 1, 'session_id' => 'any', 'stats_uri_id' => $uri_id1, 'action' => 'any', 'time' => $time3 = $time + $day, 'ip' => $ip));
     $db_table->insert(array('stats_referer_id' => 1, 'session_id' => 'any', 'stats_uri_id' => $uri_id2, 'action' => 'any', 'time' => $time4 = $time + 2 * $day, 'ip' => $ip));
     $db_table->insert(array('stats_referer_id' => 1, 'session_id' => 'any', 'stats_uri_id' => $uri_id1, 'action' => 'any', 'time' => $time5 = $time + 3 * $day, 'ip' => $ip));
     $request =& $toolkit->getRequest();
     $request->set('start_date', date('Y-m-d', $time2));
     $request->set('finish_date', date('Y-m-d', $time5));
     // Must find three records only
     $dao = new StatsPagesReportDAO();
     $rs =& $dao->fetch();
     $this->assertTrue(is_a($rs, 'StatsPercentageRecordSet'));
     $this->assertEqual($rs->getRowCount(), 2);
     $rs->rewind();
     $record =& $rs->current();
     $this->assertEqual($record->get('uri'), $uri1);
     $rs->next();
     $record =& $rs->current();
     $this->assertEqual($record->get('uri'), $uri2);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:29,代码来源:StatsPagesReportDAOTest.class.php

示例5: getDataset

 public function getDataset(&$counter, $params = array())
 {
     $request = Limb::toolkit()->getRequest();
     $datasource = Limb::toolkit()->getDatasource('RequestedObjectDatasource');
     $datasource->setRequest($request);
     if (!($arr = $datasource->fetch())) {
         return new ArrayDataset();
     }
     $db_table = Limb::toolkit()->createDBTable('SysClass');
     $classes = $db_table->getList('', 'class_name');
     $result = array();
     $params = array();
     foreach ($classes as $class_id => $class_data) {
         $result[$class_id] = $class_data;
         $result[$class_id]['path'] = $arr['path'];
         $params['class_id'] = $class_id;
         $result[$class_id]['node_id'] = $arr['node_id'];
         foreach ($arr['actions'] as $action_name => $action_params) {
             $arr['actions'][$action_name]['extra'] = $params;
         }
         $result[$class_id]['actions'] = $arr['actions'];
     }
     $counter = sizeof($result);
     return new ArrayDataset($result);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:25,代码来源:ClassListDatasource.class.php

示例6: perform

 public function perform()
 {
     $request = Limb::toolkit()->getRequest();
     $response = Limb::toolkit()->getResponse();
     $datasource = Limb::toolkit()->getDatasource('RequestedObjectDatasource');
     $datasource->setRequest($request);
     if (!($object_data = $datasource->fetch())) {
         return Limb::STATUS_ERROR;
     }
     if (!file_exists(MEDIA_DIR . $object_data['media_id'] . '.media')) {
         $response->header("HTTP/1.1 404 Not found");
         if (!$request->hasAttribute('icon')) {
             return Limb::STATUS_ERROR;
         }
         $response->commit();
         //for speed
         return;
         //for tests, fix!!!
     }
     if ($request->hasAttribute('icon')) {
         $this->_fillIconResponse($response, $request, $object_data);
         $response->commit();
         //for speed
         return;
         //for tests, fix!!!
     }
     $response->header("Content-type: {$object_data['mime_type']}");
     $response->header('Content-Disposition: attachment; filename="' . $object_data['file_name'] . '"');
     $response->readfile(MEDIA_DIR . $object_data['media_id'] . '.media');
     return Limb::STATUS_OK;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:31,代码来源:DisplayRequestedFileCommand.class.php

示例7: perform

 function perform(&$request, &$response)
 {
     if ($request->hasAttribute('popup')) {
         $response->write(closePopupNoParentReloadResponse());
     }
     $request->setStatus(Request::STATUS_FAILURE);
     if (!($version = $request->get('version'))) {
         return;
     }
     if (!($node_id = $request->get('version_node_id'))) {
         return;
     }
     $toolkit =& Limb::toolkit();
     $datasource =& $toolkit->getDatasource('SingleObjectDatasource');
     $datasource->setNodeId($node_id);
     if (!($site_object = wrapWithSiteObject($datasource->fetch()))) {
         return;
     }
     if (!is_subclass_of($site_object, 'ContentObject')) {
         return;
     }
     if (!$site_object->recoverVersion((int) $version)) {
         return;
     }
     if ($request->hasAttribute('popup')) {
         $response->write(closePopupResponse($request));
     }
     $request->setStatus(Request::STATUS_SUCCESS);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:29,代码来源:RecoverVersionAction.class.php

示例8: tearDown

  function tearDown()
  {
    $this->toolkit->tally();
    $this->tree->tally();

    Limb :: popToolkit();
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:TreeDecoratorTest.class.php

示例9: tearDown

 function tearDown()
 {
     $this->toolkit->tally();
     $this->authorizer->tally();
     ClearTestingTemplates();
     Limb::restoreToolkit('SimpleACL');
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:ActionsDatasourceProcessorTagsTest.class.php

示例10: getDataset

 public function getDataset(&$counter, $params = array())
 {
     $request = Limb::toolkit()->getRequest();
     if (!($class_id = $request->get('class_id'))) {
         return new ArrayDataset();
     }
     $db_table = Limb::toolkit()->createDBTable('SysClass');
     $class_data = $db_table->getRowById($class_id);
     if (!$class_data) {
         return new ArrayDataset();
     }
     $site_object = Limb::toolkit()->createSiteObject($class_data['ClassName']);
     $site_object_controller = $site_object->getController();
     $actions = $site_object_controller->getActionsDefinitions();
     $result = array();
     foreach ($actions as $action => $action_params) {
         if (!isset($action_params['can_have_access_template']) || !$action_params['can_have_access_template']) {
             continue;
         }
         if (isset($action_params['action_name'])) {
             $result[$action]['action_name'] = $action_params['action_name'];
         } else {
             $result[$action]['action_name'] = str_replace('_', ' ', strtoupper($action[0]) . substr($action, 1));
         }
     }
     $counter = sizeof($result);
     return new ArrayDataset($result);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:28,代码来源:ClassTemplateActionsListDatasource.class.php

示例11: tearDown

  function tearDown()
  {
    $this->toolkit->tally();
    $this->uow->tally();

    Limb :: restoreToolkit();
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:AbstractDataMapperTest.class.php

示例12: perform

 public function perform()
 {
     $toolkit = Limb::toolkit();
     $toolkit->getUser()->logout();
     $toolkit->getResponse()->redirect('/');
     return LIMB::STATUS_OK;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:LogoutCommand.class.php

示例13: run

 public function run($filter_chain, $request, $response)
 {
     Debug::addTimingPoint('authentication filter started');
     $this->initializeUser();
     $toolkit = Limb::toolkit();
     $datasource = $toolkit->getDatasource('RequestedObjectDatasource');
     if (!($node = $datasource->mapRequestToNode($request))) {
         $this->process404Error($request, $response);
         $filter_chain->next();
         return;
     }
     $behaviour = $this->getBehaviourByObjectId($node['object_id']);
     $controller = $this->_getController($behaviour);
     if (!($action = $controller->getRequestedAction())) {
         $this->process404Error($request, $response);
         $filter_chain->next();
         return;
     }
     $datasource->setRequest($request);
     if (!($object_data = $datasource->fetch())) {
         $response->redirect('/root/login?redirect=' . urlencode($_SERVER['REQUEST_URI']));
         return;
     }
     $authoriser = Limb::toolkit()->getAuthorizer();
     $authoriser->assignActionsToObjects($object_data);
     if (!isset($object_data['actions']) || !isset($object_data['actions'][$action])) {
         $response->redirect('/root/login?redirect=' . urlencode($_SERVER['REQUEST_URI']));
         return;
     }
     $filter_chain->next();
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:31,代码来源:SimplePermissionsAuthenticationFilter.class.php

示例14: validate

  public function validate($dataspace)
  {
    if(!$value = $dataspace->get($this->field_name))
      return;

    $tree = Limb :: toolkit()->getTree();

    if(!$tree->isNode($this->parent_node_id))
      return;

    if(!$nodes = $tree->getChildren($this->parent_node_id))
      return;

    foreach($nodes as $id => $node)
    {
      if($node['identifier'] != $value)
        continue;

      if($this->node_id == self :: UNKNOWN_NODE_ID)
      {
        $this->error(Strings :: get('error_duplicate_tree_identifier', 'error'));
        break;
      }
      elseif($id != $this->node_id)
      {
        $this->error(Strings :: get('error_duplicate_tree_identifier', 'error'));
        break;
      }
    }
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:30,代码来源:TreeIdentifierRule.class.php

示例15: getCounterRecord

function getCounterRecord()
{
  $toolkit =& Limb :: toolkit();
  $db =& new SimpleDb($toolkit->getDbConnection());
  $db->select('sys_stat_counter', '*');
  return $db->getRow();
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:counter.php


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