QueryTemplates
[ class tree: QueryTemplates ] [ index: QueryTemplates ] [ all elements ]

Class: QueryTemplates

Source Location: /home/bob/workspace/QueryTemplates/src/QueryTemplates.php

Class Overview


Static methods namespace class.


Author(s):

Variables

Methods



Class Details

[line 29]
Static methods namespace class.



Tags:

author:  Tobiasz Cudnik <tobiasz.cudnik/gmail.com>
link:  http://code.google.com/p/querytemplates/
abstract:  
license:  MIT License


[ Top ]


Class Variables

static $cacheTimeout =  null

[line 71]

Timeout for cached templates in minutes.

Generally uneeded because of checking templates modification time.

False (default) means no timeout. -1 turns off cache.




Tags:

see:  self::$cache
see:  self::$targetsPath
access:  public

Type:   mixed


[ Top ]

static $debug =  false

[line 35]

Turns on/off debug. Includes phpQuery's one.



Tags:

see:  phpQuery::$debug
access:  public

Type:   mixed


[ Top ]

static $fixWebroot =  ''

[line 125]

Fixes paths to CSS, JS and image files.



Tags:

access:  public

Type:   string


[ Top ]

static $htmlTidy =  false

[line 84]

Use HTML Tidy for pretty output (if avaible).

Tidy is included with every PHP5 installation, but it has be manually activated in php.ini. Value == 1 means tidy only partial templates (with no <html> or <body> tags) This is supposed to work quite well. Value == 2 means tidy all, including files with <head>, and this can fail, if You have <?php tags inside <head> with nested <script> tags.




Tags:

todo:  tidy removes empty tags (shouldnt !!!!)
TODO:  create formatter API
todo:  Strip out HTML/BODY if it's soudlnt be in the template (something what show-body-only should do).
access:  public

Type:   int


[ Top ]

static $htmlTidyConfig = array(
      'indent' => true,
      'indent-spaces' => 4,
      'wrap' => false,
      'show-body-only' => 'yes',
      'merge-divs' => false,
      'new-inline-tags' => 'php',
      'tab-size' => 4,
      'output-bom' => false,
      // TODO support other charset
      'input-encoding' => 'utf8',
      'output-encoding' => 'utf8',
      'char-encoding' => 'utf8',
   )

[line 97]

Config fo Tidy.



Tags:

link:  http://tidy.sourceforge.net/docs/quickref.html
TODO:  create formatter API
access:  public

Type:   array


[ Top ]

static $htmlTidyIntendWithTabs =  true

[line 90]

Use tabs insted of spaces for tidy intendation.



Tags:

TODO:  create formatter API
access:  public

Type:   bool


[ Top ]

static $monitorCodeModification =  false

[line 54]

Checks if source code file has been modified.

Use it only on developement enviroment as it runs debug_backtrace() every time.




Tags:

TODO:  
access:  public

Type:   bool


[ Top ]

static $monitorTemplateModification =  true

[line 47]

Checks if source template file exists and if it has been modified.

Can be turned off for performance reasons on production enviroment.




Tags:

access:  public

Type:   bool


[ Top ]

static $sourcesPath =  ''

[line 59]

Path prepended to templates names.



Tags:

access:  public

Type:   string


[ Top ]

static $targetsPath =  null

[line 41]

Path to direcotry where cached templates will be stored.



Tags:

see:  self::$cacheTimeout
access:  public

Type:   string


[ Top ]

static $xmlBeautifier =  false

[line 118]

PEAR XML_Beutifuler

XML only. No full PHP code support.




Tags:

access:  public

Type:   unknown_type


[ Top ]

static $xmlBeautifierInstance =  null

[line 119]



Tags:

access:  protected

Type:   mixed


[ Top ]



Class Methods


static method addslashes [line 474]

static void addslashes( $target, [ $char = "'"])



Tags:

access:  public


Parameters:

   $target  
   $char  

[ Top ]

static method cleanCacheName [line 380]

static void cleanCacheName( $name)



Tags:

access:  protected


Parameters:

   $name  

[ Top ]

static method getCachePaths [line 365]

static unknown getCachePaths( unknown_type $templateName, [unknown_type $targetsPath = null], [ $language = 'php'])

Enter description here...



Tags:

TODO:  refactor to getTargetPaths
access:  protected


Parameters:

unknown_type   $templateName  
unknown_type   $targetsPath  
   $language  

[ Top ]

static method htmlTidy [line 393]

static unknown_type htmlTidy( $markup $markup, $isDocumentFragment $isDocumentFragment)

HTML Tidy



Tags:

return:  FIXME formatting attr with PHP code (input[value]) changes PHP tags to normal
TODO:  use output-html output-xml output-xhtml
access:  public


Parameters:

$markup   $markup  
$isDocumentFragment   $isDocumentFragment  

[ Top ]

static method htmlTidySpacesToTabs [line 426]

static void htmlTidySpacesToTabs( $matches)



Tags:

access:  public


Parameters:

   $matches  

[ Top ]

static method loadTemplate [line 132]

static string|false loadTemplate( $templateName, [ $targetsPath = null], [ $language = 'php'])

Returns cached template's path for inclusion.

Returns false if cache isn't up-to-date.




Tags:

access:  public


Parameters:

   $templateName  
   $targetsPath  
   $language  

[ Top ]

static method mapDepends [line 317]

static unknown_type mapDepends( $file $file)



Tags:

TODO:  refactore it's name
access:  protected


Parameters:

$file   $file  

[ Top ]

static method normalizeVarName [line 328]

static void normalizeVarName( $string)



Tags:

access:  protected


Parameters:

   $string  

[ Top ]

static method parseIncludes [line 253]

static array parseIncludes( phpQuery $_)

Fetches included templates content into parsed one.



Tags:

return:  Array of dependencies.
TODO:  refresh
access:  public


Parameters:

phpQuery   $_  

[ Top ]

static method parseJSON [line 186]

static Array|Object parseJSON( $json, String $data)

Converts JSON string to array or object.



Tags:

access:  public


Parameters:

String   $data  
   $json  

[ Top ]

static method postFilters [line 460]

static string postFilters( $dom, [ $language = 'php'], phpQuery $_)

Enter description here...



Tags:

access:  protected


Parameters:

phpQuery   $_  
   $dom  
   $language  

[ Top ]

static method removeIncludes [line 291]

static phpQuery removeIncludes( phpQuery $_)

Removes included templates from parsed one.



Tags:

TODO:  refresh
access:  public


Parameters:

phpQuery   $_  

[ Top ]

static method saveTemplate [line 209]

static string|false saveTemplate( $pq, [array $dependencies = array()], [string $templateName = null], [ $vars = null], [string $targetsPath = null], [bool $unloadDocument = true], [ $language = 'php'], [ $extraParams = array()], phpQuery $_, string $templatePath)

Creates new template and returns it's path.

If You want to use self::$fixWebRoot You have to pass phpQuery object directly. CAUTION: this method will call unload() on passed phpQuery object, so You cant use it futher. Use $unloadDocument to avoid this.




Tags:

access:  public


Parameters:

phpQuery   $_   HTML from object will be fetched by htmlOuter(), so take care of proper stack.
string   $templatePath  
string   $templateName  
array   $dependencies  
string   $targetsPath  
bool   $unloadDocument  
   $pq  
   $vars  
   $language  
   $extraParams  

[ Top ]

static method srcFilePath [line 320]

static void srcFilePath( )



Tags:

access:  protected


[ Top ]

static method toJSON [line 171]

static String toJSON( Array|Object $data)

Converts $data to JSON format.



Tags:

access:  public


Parameters:

Array|Object   $data  

[ Top ]

static method validateCacheSettings [line 331]

static void validateCacheSettings( )



Tags:

access:  protected


[ Top ]

static method xmlBeautifier [line 441]

static unknown_type xmlBeautifier( $markup $markup)

PEAR XML_Beautifier class.

Does NOT support <?php tags inside attributes.




Tags:

link:  http://pear.php.net/package/XML_Beautifier
access:  public


Parameters:

$markup   $markup  

[ Top ]

method clearCache [line 302]

int clearCache( [string $search = '*'])

Clears cache folder. Can be limited to files containing $search in names.

Returns number of deleted files.




Tags:

access:  public


Parameters:

string   $search   Optional. Search pattern, accepts wildcard. @see http://php.net/glob

[ Top ]


Documentation generated on Sat, 07 Mar 2009 12:08:02 +0100 by phpDocumentor 1.4.2