Example #1
0
/**
 * The request router looks at the URI path, tries to load it from /assets,
 * then tries to route the request through the Router if it's a model.
 * If it's not a model, the PageEngine tries to render the template file.
 */
function routeRequest()
{
    $path = getPath();
    if (!$path) {
        return PageEngine::renderPage('index');
    }
    if (File::find("assets/{$path}")) {
        File::render("assets/{$path}");
    }
    try {
        $router = new Router();
        return $router->route($path);
    } catch (ModelExistenceException $e) {
        return PageEngine::renderPage($path);
    }
}
Example #2
0
 /**
  * @covers Xoops\Form\File::__construct
  * @covers Xoops\Form\File::render
  */
 public function test__construct()
 {
     $oldWay = new File('mycaption', 'myname');
     $newWay = new File(['caption' => 'mycaption', 'name' => 'myname']);
     $this->assertEquals($oldWay->render(), $newWay->render());
 }
Example #3
0
 /**
  * @covers Xoops\Form\File::render
  * @todo   Implement testRender().
  */
 public function testRender()
 {
     $value = $this->object->render();
     $this->assertTrue(is_string($value));
 }
 public function testCheckbox()
 {
     $file = new File(['name' => "name"]);
     $this->assertEquals($file->render(), '<div><input name="name" type="file" /></div>');
 }
Example #5
0
<div class="attached-file well shd">
    <?php 
$file = new File($file->path, $file);
?>
    <?php 
echo $file->render();
?>
    <a href="<?php 
echo $file->getLink('delete');
?>
" class="sh" title="<?php 
echo t('Удалить');
?>
"><i class="icon-remove"></i></a>
    <a href="#" class="sh" title="<?php 
echo t('Вставить');
?>
"><i class="icon-upload"></i></a>
</div>
Example #6
0
function routeRequest()
{
    $path = getPath();
    if (File::find("assets/{$path}")) {
        File::render("assets/{$path}");
    }
    //Error handling would go here.
    $router = new Router();
    echo $router->route($path);
}
     }
 }
 if (array_key_exists($this->form_name . '_value', $_FILES)) {
     if (file_exists($_FILES[$this->form_name . '_value']['tmp_name'][$this->name])) {
         $file['name'] = $_FILES[$this->form_name . '_value']['name'][$this->name];
         $file['type'] = $_FILES[$this->form_name . '_value']['type'][$this->name];