ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 12567


Ignore:
Timestamp:
Aug 9, 2009, 10:17:42 PM (14 years ago)
Author:
ebihara
Message:

#3943:added ability to identify API frontend action

Location:
OpenPNE3/trunk/lib
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/lib/util/opToolkit.class.php

    r12543 r12567  
    244244    return ($theday_next - $today) / 86400;
    245245  }
     246
     247 public static function retrieveAPIList()
     248 {
     249    $result = array();
     250
     251    $configuration = ProjectConfiguration::getApplicationConfiguration('api', 'prod', false);
     252    $context = sfContext::createInstance($configuration, 'api_for_get_routing');
     253
     254    $config = new sfRoutingConfigHandler();
     255
     256    $routing = new sfPatternRouting($context->getEventDispatcher());
     257    $routing->setRoutes($config->evaluate($configuration->getConfigPaths('config/routing.yml')));
     258
     259    $context->getEventDispatcher()->notify(new sfEvent($routing, 'routing.load_configuration'));
     260
     261    $routes = $routing->getRoutes();
     262
     263    foreach ($routes as $route)
     264    {
     265      if ($route instanceof opAPIRouteInterface)
     266      {
     267        $result[$route->getAPIName()] = $route->getAPICaption();
     268      }
     269    }
     270
     271    return $result;
     272 }
    246273}
Note: See TracChangeset for help on using the changeset viewer.