Example #1
0
 /**
  * Returns the rendered table
  * @return string
  */
 public function render()
 {
     if (!$this->table) {
         $this->table = $this->table();
     }
     return $this->table->render();
 }
 /**
  * Invoke this route callback.
  *
  * @param ServerRequestInterface $request   Represents the current HTTP request.
  * @param ResponseInterface      $response  Represents the current HTTP response.
  * @param array                  $arguments Values for the current route’s named placeholders.
  *
  * @return ResponseInterface
  */
 public function __invoke(ServerRequestInterface $request, ResponseInterface $response, array $arguments = [])
 {
     $queryParams = $request->getQueryParams();
     $code = array_key_exists('code', $queryParams) ? $queryParams['code'] : null;
     $this->view->render($response, $this->template, ['code' => $code]);
     return $response->withHeader('Content-Type', 'text/html');
 }
Example #3
0
 /**
  * Render function as is requirement to interfacing class
  *
  * @return string
  * @author Dan Cox
  */
 public function render($name, array $parameters = array())
 {
     /**
      * Some useful additions, so we are not writing out mass amounts of template directory code.
      */
     $name = $name . '.html';
     return $this->twig->render($name, $parameters);
 }
Example #4
0
 /**
  * Render, renders the template through the delegating engine.
  *
  * @param {string} $template the template name
  * @param {array} $assocArr an associative array of variables
  *
  * @return string
  * @author Dan Cox
  */
 public function render($template, $assocArr = [])
 {
     // If the session has errors, load these as variables
     if (Session::has('errors')) {
         $assocArr = array_merge($assocArr, array('errors' => Session::get('errors')));
         Session::remove('errors');
     }
     return $this->template->render($template, $assocArr);
 }
 /**
  * @see JUIComponent::render()
  */
 public function render()
 {
     $autoCompleteElement = $this->_inputElement->render();
     /**
      * Add Javascript support, follow the Jquery Tool Tabs
      */
     $autoCompleteElement = $autoCompleteElement . $this->appendJs($this->_id);
     $this->_elementText = $autoCompleteElement;
     $this->attachJs();
     return $this->_elementText;
 }
        /**
         * Render the control's content.
         */
        public function render_content()
        {
            ?>
			<label>
				<span class="customize-control-title">
					<?php 
            echo esc_html($this->label);
            ?>
				</span>

			</label>
			<?php 
            echo str_replace('id="' . $this->id . '"', 'id="' . $this->id . '" ' . $this->get_link(), $this->iconpicker->render());
        }
Example #7
0
 public function confirmDelete($id, &$model, $options = array())
 {
     if ($id == null) {
         $this->controller->render($this->missingIdView);
     } else {
         $this->controller->data = $model->read(null, $id);
         if (empty($this->controller->data)) {
             $modelName = isset($options['name']) ? $options['name'] : $model->name;
             $this->controller->set(compact('id', 'modelName'));
             $this->controller->render($this->invalidIdView);
         } else {
             // render normal view
         }
     }
 }
Example #8
0
    /**
     * HTML code for the captcha
     *
     * @return string
     */
    function render()
    {
        $access = TikiLib::lib('access');
        if ($access->is_xml_http_request()) {
            if ($this->type == 'recaptcha20') {
                return $this->captcha->renderAjax();
            } else {
                $params = json_encode($this->captcha->getService()->getOptions());
                $id = 1;
                TikiLib::lib('header')->add_js('
Recaptcha.create("' . $this->captcha->getPubKey() . '",
	"captcha' . $id . '",' . $params . '
  );
', 100);
                return '<div id="captcha' . $id . '"></div>';
            }
        } else {
            if ($this->captcha instanceof Captcha_ReCaptcha20) {
                return $this->captcha->render();
            } else {
                if ($this->captcha instanceof Zend\Captcha\ReCaptcha) {
                    return $this->captcha->getService()->getHtml();
                }
            }
            return $this->captcha->render();
        }
    }
 /**
  * Genera un formulari amb totes les dades de pagament i la compra,
  * quan s'executa crida a un servei SOAP.
  *
  * @param  object $req Request Object
  * @param  object $res Response Object
  * @return mixed
  */
 public function hello($req, $res)
 {
     // traduccions
     global $i18n;
     $name = $req->params['GET']['name'];
     $res->render('home.php', array(message => $name . " " . $i18n->_("you can dominate the Internet!")));
 }
Example #10
0
 /**
  * render
  *
  * @return string
  */
 public function render()
 {
     if ($this->editor instanceof \XoopsEditor) {
         return $this->editor->render();
     }
     return '';
 }
Example #11
0
 /**
  * Invoke this route callback.
  *
  * @param ServerRequestInterface $request   Represents the current HTTP request.
  * @param ResponseInterface      $response  Represents the current HTTP response.
  * @param array                  $arguments Values for the current route’s named placeholders.
  *
  * @return ResponseInterface
  */
 public function __invoke(ServerRequestInterface $request, ResponseInterface $response, array $arguments = [])
 {
     $oauth2Request = Http\RequestBridge::toOAuth2($request);
     $oauth2Response = new OAuth2\Response();
     if (!$this->server->validateAuthorizeRequest($oauth2Request, $oauth2Response)) {
         return Http\ResponseBridge::fromOAuth2($oauth2Response);
     }
     $authorized = $oauth2Request->request('authorized');
     if (empty($authorized)) {
         $response = Http\ResponseBridge::fromOAuth2($oauth2Response);
         $this->view->render($response, $this->template, ['client_id' => $oauth2Request->query('client_id')]);
         return $response->withHeader('Content-Type', 'text/html');
     }
     $this->server->handleAuthorizeRequest($oauth2Request, $oauth2Response, $authorized === 'yes');
     return Http\ResponseBridge::fromOAuth2($oauth2Response);
 }
Example #12
0
 /**
  * Render JSON response
  *
  * @param bool $success Success status to send
  * @param unknown_type $parameters Parameters
  * @return mixed What Controller::render() returns
  * @access public
  */
 function render($success, $parameters = array())
 {
     $parameters = array_merge(array('exit' => true), $parameters);
     if (!isset($parameters['profile'])) {
         $parameters['profile'] = true;
     }
     if (!empty($parameters['profile']) && isset($parameters['message']) && !empty($parameters['message'])) {
         $parameters['message'] = '<ul class="messages"><li class="' . ($success ? 'success' : 'error') . '">' . $parameters['message'] . '</li></ul>';
         unset($parameters['profile']);
     }
     if (!$success && isset($parameters['message'])) {
         $parameters['error'] = $parameters['message'];
     }
     if (isset($parameters['message'])) {
         $parameters['responseText'] = $parameters['message'];
     }
     $response = array_merge(compact('success'), array_diff_key($parameters, array('exit' => true)));
     $this->Controller->set(compact('response'));
     $this->Controller->viewPath = 'elements';
     $result = $this->Controller->render('json_response', 'ajax');
     if (!empty($parameters['exit'])) {
         echo $result;
         exit;
     }
     return $result;
 }
 /**
  * Get registered control fields
  *
  * @since  1.0.0
  * @since  1.1.3 Using dirname( __FILE__ ) instead of __DIR__.
  * @since  1.2.0 Use interface builder for HTML rendering.
  *
  * @param  mixed $post Current post object.
  * @return void
  */
 public function get_fields($post)
 {
     if (is_array($this->args['single']) && isset($this->args['single']['key'])) {
         $this->meta_values = get_post_meta($post->ID, $this->args['single']['key'], true);
     }
     $zero_allowed = apply_filters('cherry_zero_allowed_controls', array('stepper', 'slider'));
     foreach ($this->args['fields'] as $key => $field) {
         $default = Cherry_Toolkit::get_arg($field, 'value', '');
         $value = $this->get_meta($post, $key, $default);
         if (isset($field['options_callback'])) {
             $field['options'] = call_user_func($field['options_callback']);
         }
         $element = Cherry_Toolkit::get_arg($field, 'element', 'control');
         $field['id'] = Cherry_Toolkit::get_arg($field, 'id', $key);
         $field['name'] = Cherry_Toolkit::get_arg($field, 'name', $key);
         $field['type'] = Cherry_Toolkit::get_arg($field, 'type', '');
         $field['value'] = $value;
         // Fix zero values for stepper and slider
         if (!$value && in_array($field['type'], $zero_allowed)) {
             $field['value'] = 0;
         }
         $register_callback = 'register_' . $element;
         if (method_exists($this->builder, $register_callback)) {
             call_user_func(array($this->builder, $register_callback), $field);
         }
     }
     $this->builder->render();
 }
Example #14
0
/**
 * show registration or login page
 *
 * @param object $PAGEDATA the page object
 *
 * @return HTML of the page
 */
function UserAuthentication_front($PAGEDATA)
{
    WW_addCSS('/j/jquery.saorfm/jquery.saorfm.css');
    WW_addScript('/j/jquery.saorfm/jquery.saorfm.js');
    require SCRIPTBASE . 'ww.plugins/privacy/frontend/page_type.php';
    return $PAGEDATA->render() . $html;
}
Example #15
0
 /**
  * Render a view from a field or form object
  *
  * @access public
  * @return void
  */
 public function render($view_file = FALSE, $view_prefix = NULL)
 {
     if ($this->_field->get('render', NULL) === FALSE) {
         return;
     }
     // First run and do any pre_render stuff
     $this->pre_render();
     // Prefix acts as a templating system for views
     $prefix = $this->_get_view_prefix($view_prefix);
     // Determine the view file
     $view = $this->_get_view($view_file);
     // Skip the prefix if view prefix is FALSE
     $skip_prefix = $view_prefix === FALSE;
     $this->_view->bind('open', $open)->bind('close', $close)->bind('message', $message)->bind('label', $label);
     $prefix = rtrim($prefix, '/');
     $open = Formo_View::factory("{$prefix}/_open_tag", array('view' => $this->_view));
     $open->_field = $this->_field;
     $close = Formo_View::factory("{$prefix}/_close_tag", array('view' => $this->_view));
     $close->_field = $this->_field;
     $message = Formo_View::factory("{$prefix}/_message", array('view' => $this->_view));
     $message->_field = $this->_field;
     $label = Formo_View::factory("{$prefix}/_label", array('view' => $this->_view));
     $label->_field = $this->_field;
     return $this->_view->render("{$prefix}/{$view}");
 }
Example #16
0
 /**
  * dump everything we have
  */
 public function __destruct()
 {
     if ($this->activated) {
         // include any queued time data from Xmf\Debug
         $queue = \Xmf\Debug::dumpQueuedTimers(true);
         if (!empty($queue)) {
             foreach ($queue as $q) {
                 $this->debugbar['time']->addMeasure($q['label'], $q['start'], $q['start'] + $q['elapsed']);
             }
         }
         $this->addToTheme();
         $this->addExtra(_MD_DEBUGBAR_PHP_VERSION, PHP_VERSION);
         $this->addExtra(_MD_DEBUGBAR_INCLUDED_FILES, (string) count(get_included_files()));
         if (false === $this->quietmode) {
             if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
                 // default for ajax, do not initialize a new toolbar, just add dataset
                 $log = $this->renderer->render(false);
             } else {
                 $log = $this->renderer->render();
             }
             echo $log;
         } else {
             $this->debugbar->sendDataInHeaders();
         }
     }
 }
Example #17
0
 /**
  * Render the error page based on an exception.
  *
  * @param   object  $error  The exception for which to render the error page.
  * @return  void
  */
 public function render(Exception $error)
 {
     try {
         if (!$this->document) {
             // We're probably in an CLI environment
             exit($error->getMessage());
         }
         $this->document->setType('error');
         // Push the error object into the document
         $this->document->setError($error);
         if (ob_get_contents()) {
             ob_end_clean();
         }
         $this->document->setTitle(\Lang::txt('Error') . ': ' . $error->getCode());
         $path = PATH_APP . DS . 'templates';
         if (!is_dir($path . DS . $this->template)) {
             $path = PATH_CORE . DS . 'templates';
         }
         $data = $this->document->render(false, array('template' => $this->template, 'directory' => $path, 'debug' => $this->debug));
         // Failsafe to get the error displayed.
         if (empty($data)) {
             exit($error->getMessage() . ' in ' . $error->getFile() . ':' . $error->getLine());
         } else {
             $status = $error->getCode() ? $error->getCode() : 500;
             $status = $status < 100 || $status >= 600 ? 500 : $status;
             $response = new Response($data, $status);
             $response->send();
             exit;
         }
     } catch (Exception $e) {
         $plain = new Plain($this->debug);
         $plain->render($e);
     }
 }
Example #18
0
 /**
  * Prepares the response to send to the template system
  */
 public function process()
 {
     // This is really quite simple; if ?delete is on the URL, delete the importer...
     if (isset($_GET['delete'])) {
         $this->uninstall();
         $this->response->no_template = true;
     }
     $this->populateResponseDetails();
     if (isset($_GET['xml'])) {
         $this->response->addHeader('Content-Type', 'text/xml');
         $this->response->is_xml = true;
     } else {
         $this->template->header();
     }
     if (isset($_GET['action']) && $_GET['action'] == 'validate') {
         $this->validateFields();
     } elseif (method_exists($this, 'doStep' . $_GET['step'])) {
         call_user_func(array($this, 'doStep' . $_GET['step']));
     } else {
         call_user_func(array($this, 'doStep0'));
     }
     $this->populateResponseDetails();
     $this->template->render();
     if (!isset($_GET['xml'])) {
         $this->template->footer();
     }
 }
Example #19
0
/**
 * display the recommend-this-site page
 *
 * @param object $PAGEDATA the page object
 *
 * @return string the plugin's HTML
 */
function RecommendThisSite_frontend($PAGEDATA)
{
    require SCRIPTBASE . 'ww.plugins/recommend-this-site/frontend/show.php';
    if (!isset($PAGEDATA->vars['footer'])) {
        $PAGEDATA->vars['footer'] = '';
    }
    return $PAGEDATA->render() . RecommendThisSite_show($PAGEDATA->dbVals, $PAGEDATA->vars) . $PAGEDATA->vars['footer'];
}
Example #20
0
 /**
  * Shortcut method used to render elements and other nested templates from inside the templating
  * layer.
  *
  * @see lithium\template\View::$_processes
  * @see lithium\template\View::render()
  * @param string $type The type of template to render, usually either `'element'` or
  *               `'template'`. Indicates the process used to render the content. See
  *               `lithium\template\View::$_processes` for more info.
  * @param string $template The template file name. For example, if `'header'` is passed, and
  *               `$type` is set to `'element'`, then the template rendered will be
  *               `views/elements/header.html.php` (assuming the default configuration).
  * @param array $data An array of any other local variables that should be injected into the
  *              template. By default, only the values used to render the current template will
  *              be sent. If `$data` is non-empty, both sets of variables will be merged.
  * @param array $options Any options accepted by `template\View::render()`.
  * @return string Returns a the rendered template content as a string.
  */
 protected function _render($type, $template, array $data = array(), array $options = array())
 {
     if ($this->_request) {
         $library = $this->_request->library;
         $options += compact('library');
     }
     return $this->_view->render($type, $data + $this->_data, compact('template') + $options);
 }
Example #21
0
 /**
  * Retrieve module objects for a position
  *
  * @param  string $position
  * @return array
  */
 public function load($position)
 {
     if (!isset($this->loaded[$position])) {
         // init vars
         $modules = \JModuleHelper::getModules($position);
         // set params, force no style
         $params = array('style' => 'none');
         // get modules content
         foreach ($modules as $module) {
             $module->parameter = new \JRegistry($module->params);
             $module->menu = $module->module == 'mod_menu';
             $module->content = $this->renderer->render($module, $params);
         }
         $this->loaded[$position] = $modules;
     }
     return $this->loaded[$position];
 }
Example #22
0
 /**
  * Shortcut method used to render elements and other nested templates from inside the templating
  * layer.
  *
  * @see lithium\template\View::$_processes
  * @see lithium\template\View::render()
  * @param string $type The type of template to render, usually either `'element'` or
  *               `'template'`. Indicates the process used to render the content. See
  *               `lithium\template\View::$_processes` for more info.
  * @param string $template The template file name. For example, if `'header'` is passed, and
  *               `$type` is set to `'element'`, then the template rendered will be
  *               `views/elements/header.html.php` (assuming the default configuration).
  * @param array $data An array of any other local variables that should be injected into the
  *              template. By default, only the values used to render the current template will
  *              be sent. If `$data` is non-empty, both sets of variables will be merged.
  * @param array $options Any options accepted by `template\View::render()`.
  * @return string Returns a the rendered template content as a string.
  */
 protected function _render($type, $template, array $data = array(), array $options = array())
 {
     $context = $this->_options;
     $options += $this->_options;
     $result = $this->_view->render($type, $data + $this->_data, compact('template') + $options);
     $this->_options = $context;
     return $result;
 }
 /**
  * Retrieve form xml object
  *
  * @return Mage_XmlConnect_Model_Simplexml_Element
  */
 public function toXmlObject()
 {
     if ($this->_renderer) {
         return $this->_renderer->render($this);
     } else {
         return $this->getDefaultXml();
     }
 }
Example #24
0
 /**
  * {@inheritDoc}
  * @see \Avenue\Interfaces\AppInterface::render()
  */
 public function render()
 {
     // throw page not found exception, if any
     if (!$this->route->isFulfilled()) {
         $this->response->setStatus(404);
         throw new \Exception('Page not found!');
     }
     $this->response->render();
 }
 /**
  * A wrapper function for rendering templates
  *
  * @param   string   $template      The name of the template that is to be rendered
  * @param   array    $vals              An array of variables that are to be rendered with the template
  *
  * @since 1.0.0
  */
 public function render_template($template, $vals)
 {
     /**
      * Allow users to add variables to every template just before rendering. This means that all functions
      * and data the page has access to are available.
      */
     $vals = array('wp' => self::$twig_proxy, 'wp_query' => $this->wp_query());
     return self::$twig_environment->render($template, $vals);
 }
Example #26
0
 /**
  * В зависимости от запроса вернуть ответ или сделать редирект
  *
  * @param object $request  Объект запроса
  * @param object $response Объект ответа
  * @param object $service  Объект сервисов
  *
  * @return array|redirect
  *
  * @version 03.08.2016
  * @author Дмитрий Щербаков <*****@*****.**>
  */
 public static function getResponse($request, $response, $service)
 {
     if ($request->headers()->get('X-Requested-With', '') === 'XMLHttpRequest') {
         $response->json(['error' => true, 'message' => 'Недостаточно прав.']);
     } else {
         $service->title = 'Недостаточно прав';
         $service->render($service->app_root_path . '/Views/access-denied.php');
     }
 }
Example #27
0
 /**
  * Output markup for the meta box content.
  * @access  public
  * @since   6.0.0
  * @return  void
  */
 public function meta_box_content($post, $args)
 {
     $field_data = $this->get_settings_template();
     $field_data = $this->setup_fields($field_data);
     $this->_field_obj->__set('sections', array($args['id'] => ''));
     // Make sure our ID is an array key in the sections array.
     $this->_field_obj->__set('fields', $field_data);
     $this->_field_obj->render();
 }
Example #28
0
 /**
  * Renders the Missing Model class web page.
  *
  * @param unknown_type $params Parameters for controller
  * @access public
  */
 function missingModel($params)
 {
     extract(Router::getPaths());
     extract($params, EXTR_OVERWRITE);
     $this->controller->base = $base;
     $this->controller->viewPath = 'errors';
     $this->controller->webroot = $this->_webroot();
     $this->controller->set(array('model' => $className, 'title' => __('Missing Model', true)));
     $this->controller->render('missingModel');
     exit;
 }
 /**
  * Output markup for the settings screen.
  * @access  public
  * @since   6.0.0
  * @return  void
  */
 public function settings_screen()
 {
     $hidden_fields = array('page' => 'page_builder');
     if (isset($_GET['tab']) && '' != $_GET['tab']) {
         $hidden_fields['tab'] = sanitize_title_with_dashes($_GET['tab']);
     }
     $this->_field_obj->__set('has_tabs', true);
     $this->_field_obj->__set('extra_hidden_fields', $hidden_fields);
     $this->_field_obj->init_tabs();
     $this->_field_obj->render();
 }
Example #30
0
 /**
  * В зависимости от запроса вернуть ответ или показать страницу
  *
  * @param object $request  Объект запроса
  * @param object $response Объект ответа
  * @param object $service  Объект сервисов
  *
  * @return array|redirect
  *
  * @version 30.08.2016
  * @author Дмитрий Щербаков <*****@*****.**>
  */
 public static function getResponse($request, $response, $service)
 {
     if ($request->headers()->get('X-Requested-With', '') === 'XMLHttpRequest') {
         $response->json(['error' => true, 'message' => 'Неверный защитный токен. Пожалуйста, перезагрузите страницу, чтобы получить новый токен.']);
     } else {
         $service->title = 'Неверный защитный токен';
         $service->external_page = true;
         $service->back_url = $request->server()->get('HTTP_REFERER', Settings::PATH_SHORT_ROOT);
         $service->render($service->app_root_path . '/Views/invalid-token.php');
     }
 }