quip.class.php

Classes 
package
quip
Classes
Quip

Description

Quip

Copyright 2010-11 by Shaun McCormick shaun@modx.com

This file is part of Quip, a simple commenting component for MODx Revolution.

Quip is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Quip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Quip; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

\Quip

author
Shaun McCormick <shaun@modx.com>
copyright
Copyright (C) 2010, Shaun McCormick <shaun@modx.com>
license
http://opensource.org/licenses/gpl-2.0.php GNU Public License v2
package
quip
Properties
$chunks
$config
$modx
Methods
__construct
_getTplChunk
buildPagination
checkNonce
cleanse
createNonce
getChunk
getNonce
getTimeAgo
initialize
loadHooks
parseLinks
timesince

Description

This file is the main class file for Quip.

Properties

$chunks

array $chunks = 'array'

Details

array
A collection of preprocessed chunk values.
visibility
protected
default
array
final
false
static
false
access
protected

$config

array $config = 'array'

Details

array
A collection of properties to adjust Quip behaviour.
visibility
public
default
array
final
false
static
false
access
public

$modx

\modX $modx = 'null'

Details

\modX
A reference to the modX object.
visibility
public
default
null
final
false
static
false
access
public

Methods

__construct

__construct( \modX $modx, array $config = array ) : \Quip

The Quip Constructor.

This method is used to create a new Quip object.

Arguments
$modx
\modX
&amp;$modx A reference to the modX object.
$config
array
A collection of properties that modify Quip behaviour.
Output
\Quip
A unique Quip instance.
Details
visibility
public
final
false
static
false

_getTplChunk

_getTplChunk( string $name, string $suffix = .chunk.tpl ) : \modChunk/boolean

Returns a modChunk object from a template file.

Arguments
$name
string
The name of the Chunk. Will parse to name.chunk.tpl
$suffix
string
The suffix to postfix the chunk with
Output
\modChunk/boolean
Returns the modChunk object if found, otherwise false.
Details
visibility
private
final
false
static
false
access
private

buildPagination

buildPagination( array $options = array ) : string

Builds simple pagination markup. Not yet used.

Arguments
$options
array
An array of options: - count The total number of records - limit The number to limit to - start The record to start on - url The URL to prefix pagination urls with
Output
string
The rendered template.
Details
visibility
public
final
false
static
false
access
public

checkNonce

checkNonce( string $nonce, string $prefix = quip- ) : bool

Verify that a passed nonce matches the cached nonce

Arguments
$nonce
string
The nonce to check against
$prefix
string
The prefix for the nonce
Output
bool
True if passes
Details
visibility
public
final
false
static
false

cleanse

cleanse( string $body, array $scriptProperties = array ) : string

Clean a string of tags and XSS attempts

Arguments
$body
string
The string to clean
$scriptProperties
array
An array of options
Output
string
The cleansed text
Details
visibility
public
final
false
static
false

createNonce

createNonce( string $prefix = quip- ) : string

Create a nonce to be used for verification and store in cache

Arguments
$prefix
string
The prefix for the nonce
Output
string
The created nonce
Details
visibility
public
final
false
static
false

getChunk

getChunk( string $name, array $properties = array ) : string

Gets a Chunk and caches it; also falls back to file-based templates for easier debugging.

Will always use the file-based chunk if $debug is set to true.

Arguments
$name
string
The name of the Chunk
$properties
array
The properties for the Chunk
Output
string
The processed content of the Chunk
Details
visibility
public
final
false
static
false
access
public

getNonce

getNonce( string $prefix = quip- ) : string

Get a unique nonce value

Arguments
$prefix
string
A prefix to append to the nonce.
Output
string
The generated nonce.
Details
visibility
public
final
false
static
false
access
public

getTimeAgo

getTimeAgo( string $time ) : string

Gets a properly formatted "time ago" from a specified timestamp. Copied from MODx core output filters.

Arguments
$time
string
Output
string
Details
visibility
public
final
false
static
false

initialize

initialize( string $ctx = mgr ) : string

Initializes Quip based on a specific context.

Arguments
$ctx
string
The context to initialize in.
Output
string
The processed content.
Details
visibility
public
final
false
static
false
access
public

loadHooks

loadHooks( string $type = post, array $config = array ) : \quipHooks

Loads the Hooks class.

Arguments
$type
string
The type of hook to load.
$config
array
An array of configuration parameters for the hooks class
Output
\quipHooks
An instance of the quipHooks class.
Details
visibility
public
final
false
static
false

parseLinks

parseLinks( string $body, array $scriptProperties = array ) : string

Convert links to <a> tags and add rel="nofollow"

Arguments
$body
string
The string to parse
$scriptProperties
array
An array of options
Output
string
The parsed text
Details
visibility
public
final
false
static
false

timesince

timesince( string $input ) : array

Gets a proper array of time since a timestamp

Arguments
$input
string
The time to get from
Output
array
An array of times
Details
visibility
public
final
false
static
false
access
public
Documentation was generated by DocBlox 0.11.2.