• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Limb类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: loadPackages

  function loadPackages()
  {
    include_once(LIMB_DIR . '/core/util/ini_support.inc.php');

    $toolkit =& Limb :: toolkit();
    $ini =& $toolkit->getINI('packages.ini');
    $this->_packages = array();

    $groups = $ini->getAll();

    $packages = $ini->getOption('packages');

    if (!count($packages))
      return throw_error(new LimbException('no packages in package.ini!'));

    foreach($packages as $package_path)
    {
      $package_data = array();

      include($package_path . '/setup.php');

      $this->_definePackageConstant($PACKAGE_NAME, $package_path);

      $package_data['path'] = $package_path;
      $package_data['name'] = $PACKAGE_NAME;

      $this->_packages[] = $package_data;
    }
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:29,代码来源:PackagesInfo.class.php


示例17: testFetch

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


示例18: check

 protected function check($value)
 {
   if(empty($value))
     $this->error(Strings :: get('error_invalid_tree_node_id', 'error'));
   elseif(!Limb :: toolkit()->getTree()->getNode((int)$value))
     $this->error(Strings :: get('error_invalid_tree_node_id', 'error'));
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:TreeNodeIdRule.class.php


示例19: fetchRequested

 public function fetchRequested()
 {
   $datasource = Limb :: toolkit()->getDatasource('RequestedObjectDatasource');
   $request = Limb :: toolkit()->getRequest();
   $datasource->setRequest($request);
   $this->import($datasource->fetch());
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:SiteObjectComponent.class.php


示例20: perform

 function perform(&$request, &$response)
 {
     $request->setStatus(Request::STATUS_SUCCESS);
     if ($request->hasAttribute('popup')) {
         $response->write(closePopupResponse($request));
     }
     $toolkit =& Limb::toolkit();
     $datasource =& $toolkit->getDatasource('RequestedObjectDatasource');
     $datasource->setRequest($request);
     if (!($object = wrapWithSiteObject($datasource->fetch()))) {
         return;
     }
     $site_object_controller =& $object->getController();
     $action = $site_object_controller->getAction($request);
     switch ($action) {
         case 'publish':
             $status = $this->getPublishStatus($object);
             break;
         case 'unpublish':
             $status = $this->getUnpublishStatus($object);
             break;
         default:
             return;
             break;
     }
     $object->set('status', $status);
     $object->update(false);
     $this->_applyAccessPolicy($object, $action);
     $datasource->flushCache();
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:30,代码来源:SetPublishStatusAction.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP LimbTestCase类代码示例发布时间:2022-05-23
下一篇:
PHP LightOpenID类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap