Ejemplo n.º 1
0
 public function parse($data, $file, $filters = array(), $content_var = 'the_content')
 {
     $display = new Display((array) $filters);
     $display->meta = $this->meta;
     $display->meta[$content_var] = $data;
     return $display->render('layouts/' . $file);
 }
Ejemplo n.º 2
0
 /**
  * @covers Geissler\CSL\Rendering\Display::render
  */
 public function testRender4()
 {
     $this->initElement('<text variable="note"/>');
     $this->assertEquals('Hello Word', $this->object->render('Hello Word'));
 }
Ejemplo n.º 3
0
<?php

use Color\Component\Color;
use Color\Component\ColorInterface;
class Display
{
    public function render($value)
    {
        return $value;
    }
}
$color = new Color();
$display = new Display();
echo $color->display('cyan', $display->render('Hello World'));
/**
 * Rendering Content
 * 
 * This function will be used for subelements, arrays and skip objects in skip elements.
 *
 * @param mixed $content Content to render
 * @param boolean $hide Hiding content
 * @package Skip
 * @since 1.0
 * @return string The content of the element
 * @ignore
 */
function display($content, $hide = FALSE)
{
    $display = new Display();
    return $display->render($content, $hide);
}
Ejemplo n.º 5
0
 public function render($id = false, $view = false, $display = false)
 {
     global $Display;
     if ($view === false) {
         $view = $this->view;
     }
     if ($display === false) {
         $display = new Display(array('PlainPHP'));
     } elseif (is_array($display)) {
         $filters = $display;
         $display = new Display($filters);
     }
     $display->meta += array('action' => $this->action, 'method' => $this->method, 'id' => $id, 'submit' => $this->submit);
     $display->meta['inputs'] = $this->inputs;
     return $display->render($view);
 }
Ejemplo n.º 6
0
$display = new Display($pages, function ($page, $args, $page_key) use($pages) {
    extract($args, EXTR_SKIP);
    if (file_exists($page->script)) {
        require $page->script;
    } else {
        require $pages["not-found"]->script;
    }
    if (gettype($output) !== 'array') {
        $output = array("message" => $output);
    }
    if (isset($success) && !isset($output['success'])) {
        $output['success'] = $success;
    }
    if (isset($status) && !isset($output['status'])) {
        $output['status'] = $status;
    }
    if (!isset($output['success'])) {
        $output['success'] = TRUE;
    }
    if (!isset($output['status'])) {
        $output['status'] = "200 OK";
        if (!isset($output['success'])) {
            $output['success'] = TRUE;
        }
    }
    // Move status and success to front of output
    $output = array_merge(array("status" => $output['status'], "success" => $output['success']), $output);
    output("json", $output, $output['status']);
});
echo $display->render($route_match['route']['page'], $args);