Exemple #1
0
 public function action_api()
 {
     // Get the class from the request
     $class = $this->request->param('class');
     if ($class) {
         $this->template->title = $class;
         $this->template->content = View::factory('userguide/api/class')->set('doc', Kodoc::factory($class))->set('route', $this->request->route);
     } else {
         $this->template->title = __('Table of Contents');
         $this->template->content = View::factory('userguide/api/toc')->set('classes', Kodoc::class_methods())->set('route', $this->request->route);
     }
     // Attach the menu to the template
     $this->template->menu = Kodoc::menu();
     // Bind the breadcrumb
     $this->template->bind('breadcrumb', $breadcrumb);
     // Get the docs URI
     $guide = Route::get('docs/guide');
     // Add the breadcrumb
     $breadcrumb = array();
     $breadcrumb[$this->guide->uri(array('page' => NULL))] = __('User Guide');
     $breadcrumb[$this->request->route->uri()] = $this->title('api');
     $breadcrumb[] = $this->template->title;
 }
Exemple #2
0
 public function action_api()
 {
     // Enable the missing class autoloader.  If a class cannot be found a
     // fake class will be created that extends Kodoc_Missing
     spl_autoload_register(array('Kodoc_Missing', 'create_class'));
     // Get the class from the request
     $class = $this->request->param('class');
     // If no class was passed to the url, display the API index page
     if (!$class) {
         $this->template->title = 'Table of Contents';
         $this->template->content = View::factory('userguide/api/toc')->set('classes', Kodoc::class_methods())->set('route', $this->request->route());
     } else {
         // Create the Kodoc_Class version of this class.
         $_class = Kodoc_Class::factory($class);
         // If the class requested and the actual class name are different
         // (different case, orm vs ORM, auth vs Auth) redirect
         if ($_class->class->name != $class) {
             $this->redirect($this->request->route()->uri(array('class' => $_class->class->name)));
         }
         // If this classes immediate parent is Kodoc_Missing, then it should 404
         if ($_class->class->getParentClass() and $_class->class->getParentClass()->name == 'Kodoc_Missing') {
             return $this->error('That class was not found. Check your url and make sure that the module with that class is enabled.');
         }
         // If this classes package has been disabled via the config, 404
         if (!Kodoc::show_class($_class)) {
             return $this->error('That class is in package that is hidden.  Check the <code>api_packages</code> config setting.');
         }
         // Everything is fine, display the class.
         $this->template->title = $class;
         $this->template->content = View::factory('userguide/api/class')->set('doc', $_class)->set('route', $this->request->route());
     }
     // Attach the menu to the template
     $this->template->menu = Kodoc::menu();
     // Bind the breadcrumb
     $this->template->bind('breadcrumb', $breadcrumb);
     // Add the breadcrumb
     $breadcrumb = array();
     $breadcrumb[$this->guide->uri(array('page' => NULL))] = 'User Guide';
     $breadcrumb[$this->request->route()->uri()] = 'API Browser';
     $breadcrumb[] = $this->template->title;
 }
 public function action_api()
 {
     // Enable the missing class autoloader
     spl_autoload_register(array('Kodoc_Missing', 'create_class'));
     // Get the class from the request
     $class = $this->request->param('class');
     if ($class) {
         try {
             $_class = Kodoc_Class::factory($class);
             if (!Kodoc::show_class($_class)) {
                 throw new Exception(__('That class is hidden'));
             }
         } catch (Exception $e) {
             return $this->error(__('API Reference: Class not found.'));
         }
         $this->template->title = $class;
         $this->template->content = View::factory('userguide/api/class')->set('doc', Kodoc::factory($class))->set('route', $this->request->route);
     } else {
         $this->template->title = __('Table of Contents');
         $this->template->content = View::factory('userguide/api/toc')->set('classes', Kodoc::class_methods())->set('route', $this->request->route);
     }
     // Attach the menu to the template
     $this->template->menu = Kodoc::menu();
     // Bind the breadcrumb
     $this->template->bind('breadcrumb', $breadcrumb);
     // Get the docs URI
     $guide = Route::get('docs/guide');
     // Add the breadcrumb
     $breadcrumb = array();
     $breadcrumb[$this->guide->uri(array('page' => NULL))] = __('User Guide');
     $breadcrumb[$this->request->route->uri()] = $this->title('api');
     $breadcrumb[] = $this->template->title;
 }