<div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Navigatie</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="/">PWS-Community</a> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li><a href="/">Home</a></li> <li><a href="/apps">Apps</a></li> <?php $auth = load_service('authentication'); if ($auth->isAuthenticated()) { ?> <li><a href="/messages">Berichten</a></li> <li><a href="/me">Profiel</a></li> <li><a href="/logout">Uitloggen</a></li> <?php } else { ?> <li><a href="/login">Inloggen</a></li> <li><a href="/register">Account aanmaken</a></li> <?php } ?> </ul> </div>
/** * Load a service. * @param string $name - Name of the service. * @return {Service} * @throws {RuntimeException} if anything goes wrong. */ protected function service($name) { return load_service($name); }
<?php // Copyright (c) 2010 Guanoo, Inc. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public License // as published by the Free Software Foundation; either version 3 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. load_service('REST'); /** * The REST_test_service class is used to test the REST controller. * Basically this class simply returns the data parameters that are * passed to each of its REST methods, so they may be tested easily. * These methods are each called by the REST_test_controller class. * To run the tests, visit an address like http://localhost/REST_test * * @author Kevin Hutchinson <*****@*****.**> */ class REST_test_service extends REST_service { /** * Provide a mock "delete" method for testing * * @param Object $params the HTTP test params to return * @return Array an array of HTTP test data for testing */
/** * Create a new service and return it * * @param String $class an optional class name * @param Integer $version the service version * @return Service the new service */ public function new_service($class = NULL, $version = NULL) { // Require the Web_service base class // ...and the Application web service require_once 'lib/Web_service.php'; load_service('App'); // Require the service's subclass if (!$class) { $class = Text::camelize(Text::singularize($this->file)); } if (!$version) { $version = $this->folder + 0; } try { load_service($class, $version); } catch (Exception $e) { $render = new Object(); $render->data = array('error' => "Cannot load \"{$class}\" service version {$version}"); echo $this->render_type($this->content_type, $render); exit; } // Create and return a new Service object $class .= '_service'; // mandatory suffix $this->service = new $class(); $this->service->setup_for_app($this); return YAWF::prop(Symbol::SERVICE, $this->service); }
/** * Construct an authentication condition. */ public function __construct() { $auth = load_service('authentication'); $this->user = $auth->getUser(); }
return $services; } /** * This function is used to include the services in the application * * @param models_services : array : services names * @return void */ function load_service($service_name) { foreach ($service_name as $items) { require_once "service/{$items}"; } } # Including the file services load_service(finding_services()); /** * Instantiate the services * * @return Array with the services names */ function prepare_service_to_instantiate() { $services = array(); foreach (finding_services() as $items) { $items = explode('.php', $items); $services[] = $items[0]; } $services_names = array(); foreach ($services as $items) { $services_names[$items] = new $items();