Exemplo n.º 1
0
 function perform($unconsumed_path)
 {
     $trails_root = $this->getPluginPath() . "/app";
     $dispatcher = new Trails_Dispatcher($trails_root, rtrim(PluginEngine::getURL($this, null, ''), '/'), self::DEFAULT_CONTROLLER);
     $dispatcher->plugin = $this;
     $dispatcher->dispatch($unconsumed_path);
 }
Exemplo n.º 2
0
 public function perform($unconsumed_path)
 {
     //$this->setupAutoload();
     $dispatcher = new Trails_Dispatcher($this->getPluginPath(), rtrim(PluginEngine::getLink($this, array(), null), '/'), 'show');
     $dispatcher->plugin = $this;
     $dispatcher->dispatch($unconsumed_path);
 }
Exemplo n.º 3
0
 /**
  * This method dispatches and displays all actions. It uses the template
  * method design pattern, so you may want to implement the methods #route
  * and/or #display to adapt to your needs.
  *
  * @param  string  the part of the dispatch path, that were not consumed yet
  *
  * @return void
  */
 function perform($unconsumed_path)
 {
     if (!$unconsumed_path) {
         header("Location: " . PluginEngine::getUrl($this), 302);
         return false;
     }
     $trails_root = $this->getPluginPath();
     $dispatcher = new Trails_Dispatcher($trails_root, null, 'show');
     $dispatcher->current_plugin = $this;
     $dispatcher->dispatch($unconsumed_path);
 }
Exemplo n.º 4
0
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
error_reporting(E_ALL);
# define root
$trails_root = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'app';
$trails_uri = sprintf('http%s://%s%s%s', isset($_SERVER['HTTPS']) ? 's' : '', $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'] == 80 ? '' : ':' . $_SERVER['SERVER_PORT'], $_SERVER['SCRIPT_NAME']);
# load trails
# require_once $trails_root . '/../vendor/trails/trails-unabridged.php';
require_once $trails_root . '/../vendor/trails/src/dispatcher.php';
require_once $trails_root . '/../vendor/trails/src/response.php';
require_once $trails_root . '/../vendor/trails/src/controller.php';
require_once $trails_root . '/../vendor/trails/src/inflector.php';
require_once $trails_root . '/../vendor/trails/src/flash.php';
require_once $trails_root . '/../vendor/trails/src/exception.php';
# load flexi
require_once $trails_root . '/../vendor/flexi/lib/flexi.php';
# dispatch
$request_uri = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '/';
$default_controller = 'example';
$dispatcher = new Trails_Dispatcher($trails_root, $trails_uri, $default_controller);
$dispatcher->dispatch($request_uri);
 function perform($unconsumed_path)
 {
     $dispatcher = new Trails_Dispatcher($this->getPluginPath() . '/app', rtrim(PluginEngine::getLink($this, array(), null), '/'), 'generator');
     $dispatcher->plugin = $this;
     $dispatcher->dispatch($unconsumed_path);
 }
Exemplo n.º 6
0
 /**
  * This method dispatches all actions.
  *
  * @param string   part of the dispatch path that was not consumed
  *
  * @return void
  */
 public function perform($unconsumed_path)
 {
     $args = explode('/', $unconsumed_path);
     $action = $args[0] !== '' ? array_shift($args) . '_action' : 'show_action';
     if (!method_exists($this, $action)) {
         $trails_root = $this->getPluginPath();
         $trails_uri = rtrim(PluginEngine::getLink($this, array(), null, true), '/');
         $dispatcher = new Trails_Dispatcher($trails_root, $trails_uri, 'index');
         $dispatcher->current_plugin = $this;
         try {
             $dispatcher->dispatch($unconsumed_path);
         } catch (Trails_UnknownAction $exception) {
             if (count($args) > 0) {
                 throw $exception;
             } else {
                 throw new Exception(_('unbekannte Plugin-Aktion: ') . $unconsumed_path);
             }
         }
     } else {
         call_user_func_array(array($this, $action), $args);
     }
 }
 /**
  *
  **/
 public function perform($unconsumed_path)
 {
     $dispatcher = new Trails_Dispatcher($this->getPluginPath() . DIRECTORY_SEPARATOR . 'app', rtrim(PluginEngine::getLink($this, array(), null), '/'), 'admin');
     $dispatcher->plugin = $this;
     $dispatcher->dispatch($unconsumed_path);
 }