Ejemplo n.º 1
0
 /**
  * Post execute hook.
  *
  * @param mixed $result The return value of this component.
  *
  * @return  mixed  The return value of this component.
  */
 protected function postExecute($result)
 {
     // Debug profiler
     if (JDEBUG) {
         $result .= "<hr />" . ProfilerHelper::render('Windwalker', true);
     }
     return parent::postExecute($result);
 }
Ejemplo n.º 2
0
 /**
  * Method to get a JDatabaseQuery object for retrieving the data set from a database.
  *
  * @return  JDatabaseQuery   A JDatabaseQuery object to retrieve the data set.
  */
 protected function getListQuery()
 {
     $query = $this->db->getQuery(true);
     $queryHelper = $this->getQueryHelper();
     // Prepare
     $this->prepareGetQuery($query);
     // Build filter query
     $this->processFilters($query, ArrayHelper::flatten((array) $this->get('filter')));
     // Build search query
     $this->processSearches($query, ArrayHelper::flatten((array) $this->get('search')));
     // Ordering
     $this->processOrdering($query);
     // Custom Where
     foreach ((array) $this->state->get('query.where', array()) as $k => $v) {
         $query->where($v);
     }
     // Custom Having
     foreach ((array) $this->state->get('query.having', array()) as $k => $v) {
         $query->having($v);
     }
     // Build query
     // ========================================================================
     // Get select columns
     $select = $this->state->get('query.select');
     if (!$select) {
         $select = $queryHelper->getSelectFields();
     }
     $query->select($select);
     // Build Selected tables query
     $queryHelper->registerQueryTables($query);
     $this->postGetQuery($query);
     // Debug
     if (JDEBUG) {
         ProfilerHelper::mark(QueryHelper::highlightQuery($this->db->replacePrefix((string) $query)));
     }
     return $query;
 }
Ejemplo n.º 3
0
 /**
  * Method to get a JDatabaseQuery object for retrieving the data set from a database.
  *
  * @return  JDatabaseQuery   A JDatabaseQuery object to retrieve the data set.
  */
 protected function getListQuery()
 {
     $query = $this->db->getQuery(true);
     $queryHelper = $this->container->get('model.' . $this->getName() . '.helper.query');
     // Prepare
     $this->prepareGetQuery($query);
     // Build filter query
     $this->processFilters($query, $this->state->get('filter', array()));
     // Build search query
     $this->processSearches($query, $this->state->get('search', array()));
     // Ordering
     $this->processOrdering($query);
     // Custom Where
     foreach ((array) $this->state->get('query.where', array()) as $k => $v) {
         $query->where($v);
     }
     // Custom Having
     foreach ((array) $this->state->get('query.having', array()) as $k => $v) {
         $query->having($v);
     }
     // Build query
     // ========================================================================
     // Get select columns
     $select = $this->state->get('query.select');
     if (!$select) {
         $selectType = $this->selectType ?: QueryHelper::COLS_WITH_FIRST | QueryHelper::COLS_PREFIX_WITH_FIRST;
         $select = $queryHelper->getSelectFields($selectType);
     }
     $query->select($select);
     // Build Selected tables query
     $queryHelper->registerQueryTables($query);
     $this->postGetQuery($query);
     // Debug
     if (JDEBUG) {
         ProfilerHelper::mark(QueryHelper::highlightQuery($this->db->replacePrefix((string) $query)));
     }
     return $query;
 }
Ejemplo n.º 4
0
<?php

/**
 * Part of ihealth project. 
 *
 * @copyright  Copyright (C) 2011 - 2014 SMS Taiwan, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 */
$tpl = \TplLyrasoft\LyrasoftTemplate::getInstance();
$tmpl = $displayData['tmpl'];
$layout = $tpl::isHome() ? 'landing' : $tpl->getTemplate()->params->get('layout', 'default');
\Windwalker\Helper\ProfilerHelper::mark('Template Layout: ' . $layout, 'Application');
$menuParams = \Astra\Helper\DocumentHelper::getMenuParams();
?>
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
echo $this->tpl->language;
?>
" lang="<?php 
echo $this->tpl->language;
?>
" dir="<?php 
echo $this->tpl->direction;
?>
">
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <link rel="shortcut icon" href="<?php 
echo $this->tpl->baseurl;
?>
/templates/<?php 
 /**
  * Method to test render().
  *
  * @return void
  *
  * @covers \Windwalker\Helper\ProfilerHelper::render
  */
 public function testRender()
 {
     $namespace = 'unit-test';
     $buffer = array('foo', 'bar', 'foobar');
     $expected = "<pre><h3>WindWalker Debug [namespace: unit-test]: </h3>foo\n<br />\nbar\n<br />\nfoobar</pre>";
     $mockProfiler = $this->getMockBuilder('JProfiler')->setConstructorArgs(array($namespace))->getMock();
     /** @var \JProfiler $mockProfiler */
     $mockProfiler->method('getBuffer')->willReturn($buffer);
     // Set mocked profiler instance
     ProfilerHelper::setProfiler($namespace, $mockProfiler);
     $this->assertSame($expected, ProfilerHelper::render($namespace, true));
     ob_start();
     $return = ProfilerHelper::render($namespace);
     $actual = ob_get_contents();
     ob_end_clean();
     $this->assertSame($expected, $actual);
     $this->assertSame('', $return);
 }