Updated API documentation package tags

Fixed some whitespace

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@47725 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-01-08 06:37:50 +00:00
parent 5ffeb1a4be
commit d27937f448
157 changed files with 1662 additions and 961 deletions

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage integration
*/
/**
* RSSFeed class
*

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage integration
*/
/**
* RestfulService class allows you to consume various RESTful APIs.
* Through this you could connect and aggregate data of various web services.
@ -65,7 +70,7 @@ class RestfulService extends ViewableData {
if($this->rawXML != ""){
// save the response in cache
$fp = @fopen($cache_path,"w+");
@fwrite($fp,$this->rawXML);
@fwrite($fp,$this->rawXML);
@fclose($fp);
if($this->checkErrors == true) {

View File

@ -1,5 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage integration
*/
/**
* Soap server class
*/
class SapphireSoapServer extends Controller {
static $methods = array();
static $xsd_types = array(

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage integration
*/
/****************************************************
SIMPLEPIE
A PHP-Based RSS and Atom Feed Framework

View File

@ -1,867 +1,866 @@
<?php
/**
* Spyc -- A Simple PHP YAML Class
* @version 0.2.(5) -- 2006-12-31
* @author Chris Wanstrath <chris@ozmm.org>
* @author Vlad Andersen <vlad@oneiros.ru>
* @link http://spyc.sourceforge.net/
* @copyright Copyright 2005-2006 Chris Wanstrath
* @license http://www.opensource.org/licenses/mit-license.php MIT License
* @package Spyc
/**
* Spyc -- A Simple PHP YAML Class
* @version 0.2.(5) -- 2006-12-31
* @author Chris Wanstrath <chris@ozmm.org>
* @author Vlad Andersen <vlad@oneiros.ru>
* @link http://spyc.sourceforge.net/
* @copyright Copyright 2005-2006 Chris Wanstrath
* @license http://www.opensource.org/licenses/mit-license.php MIT License
* @package sapphire
* @subpackage misc
*/
/**
* A node, used by Spyc for parsing YAML.
*/
class YAMLNode {
/**#@+
* @access public
* @var string
*/
public $parent;
public $id;
/**#@+*/
/**
* @access public
* @var mixed
*/
public $data;
/**
* @access public
* @var int
*/
public $indent;
/**
* @access public
* @var bool
*/
public $children = false;
/**
* A node, used by Spyc for parsing YAML.
* @package Spyc
* The constructor assigns the node a unique ID.
* @access public
* @return void
*/
class YAMLNode {
/**#@+
* @access public
* @var string
*/
public $parent;
public $id;
/**#@+*/
/**
* @access public
* @var mixed
*/
public $data;
/**
* @access public
* @var int
*/
public $indent;
/**
* @access public
* @var bool
*/
public $children = false;
public function YAMLNode($nodeId) {
$this->id = $nodeId;
}
}
/**
* The constructor assigns the node a unique ID.
* @access public
* @return void
*/
public function YAMLNode($nodeId) {
$this->id = $nodeId;
}
/**
* The Simple PHP YAML Class.
*
* This class can be used to read a YAML file and convert its contents
* into a PHP array. It currently supports a very limited subsection of
* the YAML spec.
*
* Usage:
* <code>
* $parser = new Spyc;
* $array = $parser->load($file);
* </code>
*/
class Spyc {
/**
* Load YAML into a PHP array statically
*
* The load method, when supplied with a YAML stream (string or file),
* will do its best to convert YAML in a file into a PHP array. Pretty
* simple.
* Usage:
* <code>
* $array = Spyc::YAMLLoad('lucky.yaml');
* print_r($array);
* </code>
* @access public
* @return array
* @param string $input Path of YAML file or string containing YAML
*/
public static function YAMLLoad($input) {
$spyc = new Spyc;
return $spyc->load($input);
}
/**
* The Simple PHP YAML Class.
* Dump YAML from PHP array statically
*
* This class can be used to read a YAML file and convert its contents
* into a PHP array. It currently supports a very limited subsection of
* the YAML spec.
* The dump method, when supplied with an array, will do its best
* to convert the array into friendly YAML. Pretty simple. Feel free to
* save the returned string as nothing.yaml and pass it around.
*
* Usage:
* <code>
* Oh, and you can decide how big the indent is and what the wordwrap
* for folding is. Pretty cool -- just pass in 'false' for either if
* you want to use the default.
*
* Indent's default is 2 spaces, wordwrap's default is 40 characters. And
* you can turn off wordwrap by passing in 0.
*
* @access public
* @return string
* @param array $array PHP array
* @param int $indent Pass in false to use the default, which is 2
* @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)
*/
public static function YAMLDump($array,$indent = false,$wordwrap = false) {
$spyc = new Spyc;
return $spyc->dump($array,$indent,$wordwrap);
}
/**
* Load YAML into a PHP array from an instantiated object
*
* The load method, when supplied with a YAML stream (string or file path),
* will do its best to convert the YAML into a PHP array. Pretty simple.
* Usage:
* <code>
* $parser = new Spyc;
* $array = $parser->load($file);
* </code>
* @package Spyc
* $array = $parser->load('lucky.yaml');
* print_r($array);
* </code>
* @access public
* @return array
* @param string $input Path of YAML file or string containing YAML
*/
class Spyc {
/**
* Load YAML into a PHP array statically
*
* The load method, when supplied with a YAML stream (string or file),
* will do its best to convert YAML in a file into a PHP array. Pretty
* simple.
* Usage:
* <code>
* $array = Spyc::YAMLLoad('lucky.yaml');
* print_r($array);
* </code>
* @access public
* @return array
* @param string $input Path of YAML file or string containing YAML
*/
public static function YAMLLoad($input) {
$spyc = new Spyc;
return $spyc->load($input);
public function load($input) {
// See what type of input we're talking about
// If it's not a file, assume it's a string
if (!empty($input) && (strpos($input, "\n") === false)
&& file_exists($input)) {
$yaml = file($input);
} else {
$yaml = explode("\n",$input);
}
// Initiate some objects and values
$base = new YAMLNode (1);
$base->indent = 0;
$this->_lastIndent = 0;
$this->_lastNode = $base->id;
$this->_inBlock = false;
$this->_isInline = false;
$this->_nodeId = 2;
/**
* Dump YAML from PHP array statically
*
* The dump method, when supplied with an array, will do its best
* to convert the array into friendly YAML. Pretty simple. Feel free to
* save the returned string as nothing.yaml and pass it around.
*
* Oh, and you can decide how big the indent is and what the wordwrap
* for folding is. Pretty cool -- just pass in 'false' for either if
* you want to use the default.
*
* Indent's default is 2 spaces, wordwrap's default is 40 characters. And
* you can turn off wordwrap by passing in 0.
*
* @access public
* @return string
* @param array $array PHP array
* @param int $indent Pass in false to use the default, which is 2
* @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)
*/
public static function YAMLDump($array,$indent = false,$wordwrap = false) {
$spyc = new Spyc;
return $spyc->dump($array,$indent,$wordwrap);
}
foreach ($yaml as $linenum => $line) {
$ifchk = trim($line);
/**
* Load YAML into a PHP array from an instantiated object
*
* The load method, when supplied with a YAML stream (string or file path),
* will do its best to convert the YAML into a PHP array. Pretty simple.
* Usage:
* <code>
* $parser = new Spyc;
* $array = $parser->load('lucky.yaml');
* print_r($array);
* </code>
* @access public
* @return array
* @param string $input Path of YAML file or string containing YAML
*/
public function load($input) {
// See what type of input we're talking about
// If it's not a file, assume it's a string
if (!empty($input) && (strpos($input, "\n") === false)
&& file_exists($input)) {
$yaml = file($input);
} else {
$yaml = explode("\n",$input);
// If the line starts with a tab (instead of a space), throw a fit.
if (preg_match('/^(\t)+(\w+)/', $line)) {
$err = 'ERROR: Line '. ($linenum + 1) .' in your input YAML begins'.
' with a tab. YAML only recognizes spaces. Please reformat.';
die($err);
}
// Initiate some objects and values
$base = new YAMLNode (1);
$base->indent = 0;
$this->_lastIndent = 0;
$this->_lastNode = $base->id;
$this->_inBlock = false;
$this->_isInline = false;
$this->_nodeId = 2;
foreach ($yaml as $linenum => $line) {
$ifchk = trim($line);
if ($this->_inBlock === false && empty($ifchk)) {
continue;
} elseif ($this->_inBlock == true && empty($ifchk)) {
$last =& $this->_allNodes[$this->_lastNode];
$last->data[key($last->data)] .= "\n";
} elseif ($ifchk{0} != '#' && substr($ifchk,0,3) != '---') {
// Create a new node and get its indent
$node = new YAMLNode ($this->_nodeId);
$this->_nodeId++;
$node->indent = $this->_getIndent($line);
// If the line starts with a tab (instead of a space), throw a fit.
if (preg_match('/^(\t)+(\w+)/', $line)) {
$err = 'ERROR: Line '. ($linenum + 1) .' in your input YAML begins'.
' with a tab. YAML only recognizes spaces. Please reformat.';
die($err);
}
if ($this->_inBlock === false && empty($ifchk)) {
continue;
} elseif ($this->_inBlock == true && empty($ifchk)) {
$last =& $this->_allNodes[$this->_lastNode];
$last->data[key($last->data)] .= "\n";
} elseif ($ifchk{0} != '#' && substr($ifchk,0,3) != '---') {
// Create a new node and get its indent
$node = new YAMLNode ($this->_nodeId);
$this->_nodeId++;
$node->indent = $this->_getIndent($line);
// Check where the node lies in the hierarchy
if ($this->_lastIndent == $node->indent) {
// If we're in a block, add the text to the parent's data
if ($this->_inBlock === true) {
$parent =& $this->_allNodes[$this->_lastNode];
$parent->data[key($parent->data)] .= trim($line).$this->_blockEnd;
} else {
// The current node's parent is the same as the previous node's
if (isset($this->_allNodes[$this->_lastNode])) {
$node->parent = $this->_allNodes[$this->_lastNode]->parent;
}
// Check where the node lies in the hierarchy
if ($this->_lastIndent == $node->indent) {
// If we're in a block, add the text to the parent's data
if ($this->_inBlock === true) {
$parent =& $this->_allNodes[$this->_lastNode];
$parent->data[key($parent->data)] .= trim($line).$this->_blockEnd;
} else {
// The current node's parent is the same as the previous node's
if (isset($this->_allNodes[$this->_lastNode])) {
$node->parent = $this->_allNodes[$this->_lastNode]->parent;
}
} elseif ($this->_lastIndent < $node->indent) {
if ($this->_inBlock === true) {
$parent =& $this->_allNodes[$this->_lastNode];
$parent->data[key($parent->data)] .= trim($line).$this->_blockEnd;
} elseif ($this->_inBlock === false) {
// The current node's parent is the previous node
$node->parent = $this->_lastNode;
}
} elseif ($this->_lastIndent < $node->indent) {
if ($this->_inBlock === true) {
$parent =& $this->_allNodes[$this->_lastNode];
$parent->data[key($parent->data)] .= trim($line).$this->_blockEnd;
} elseif ($this->_inBlock === false) {
// The current node's parent is the previous node
$node->parent = $this->_lastNode;
// If the value of the last node's data was > or | we need to
// start blocking i.e. taking in all lines as a text value until
// we drop our indent.
$parent =& $this->_allNodes[$node->parent];
$this->_allNodes[$node->parent]->children = true;
if (is_array($parent->data)) {
// if (isset ($parent->data[key($parent->data)]))
$chk = $parent->data[key($parent->data)];
if ($chk === '>') {
$this->_inBlock = true;
$this->_blockEnd = ' ';
$parent->data[key($parent->data)] =
str_replace('>','',$parent->data[key($parent->data)]);
$parent->data[key($parent->data)] .= trim($line).' ';
$this->_allNodes[$node->parent]->children = false;
$this->_lastIndent = $node->indent;
} elseif ($chk === '|') {
$this->_inBlock = true;
$this->_blockEnd = "\n";
$parent->data[key($parent->data)] =
str_replace('|','',$parent->data[key($parent->data)]);
$parent->data[key($parent->data)] .= trim($line)."\n";
$this->_allNodes[$node->parent]->children = false;
$this->_lastIndent = $node->indent;
}
}
}
} elseif ($this->_lastIndent > $node->indent) {
// Any block we had going is dead now
if ($this->_inBlock === true) {
$this->_inBlock = false;
if ($this->_blockEnd = "\n") {
$last =& $this->_allNodes[$this->_lastNode];
$last->data[key($last->data)] =
trim($last->data[key($last->data)]);
}
}
// We don't know the parent of the node so we have to find it
// foreach ($this->_allNodes as $n) {
foreach ($this->_indentSort[$node->indent] as $n) {
if ($n->indent == $node->indent) {
$node->parent = $n->parent;
// If the value of the last node's data was > or | we need to
// start blocking i.e. taking in all lines as a text value until
// we drop our indent.
$parent =& $this->_allNodes[$node->parent];
$this->_allNodes[$node->parent]->children = true;
if (is_array($parent->data)) {
// if (isset ($parent->data[key($parent->data)]))
$chk = $parent->data[key($parent->data)];
if ($chk === '>') {
$this->_inBlock = true;
$this->_blockEnd = ' ';
$parent->data[key($parent->data)] =
str_replace('>','',$parent->data[key($parent->data)]);
$parent->data[key($parent->data)] .= trim($line).' ';
$this->_allNodes[$node->parent]->children = false;
$this->_lastIndent = $node->indent;
} elseif ($chk === '|') {
$this->_inBlock = true;
$this->_blockEnd = "\n";
$parent->data[key($parent->data)] =
str_replace('|','',$parent->data[key($parent->data)]);
$parent->data[key($parent->data)] .= trim($line)."\n";
$this->_allNodes[$node->parent]->children = false;
$this->_lastIndent = $node->indent;
}
}
}
} elseif ($this->_lastIndent > $node->indent) {
// Any block we had going is dead now
if ($this->_inBlock === true) {
$this->_inBlock = false;
if ($this->_blockEnd = "\n") {
$last =& $this->_allNodes[$this->_lastNode];
$last->data[key($last->data)] =
trim($last->data[key($last->data)]);
}
}
if ($this->_inBlock === false) {
// Set these properties with information from our current node
$this->_lastIndent = $node->indent;
// Set the last node
$this->_lastNode = $node->id;
// Parse the YAML line and return its data
$node->data = $this->_parseLine($line);
// Add the node to the master list
$this->_allNodes[$node->id] = $node;
// Add a reference to the parent list
$this->_allParent[intval($node->parent)][] = $node->id;
// Add a reference to the node in an indent array
$this->_indentSort[$node->indent][] =& $this->_allNodes[$node->id];
// Add a reference to the node in a References array if this node
// has a YAML reference in it.
if (
( (is_array($node->data)) &&
isset($node->data[key($node->data)]) &&
(!is_array($node->data[key($node->data)])) )
&&
( (preg_match('/^&([^ ]+)/',$node->data[key($node->data)]))
||
(preg_match('/^\*([^ ]+)/',$node->data[key($node->data)])) )
) {
$this->_haveRefs[] =& $this->_allNodes[$node->id];
} elseif (
( (is_array($node->data)) &&
isset($node->data[key($node->data)]) &&
(is_array($node->data[key($node->data)])) )
) {
// Incomplete reference making code. Ugly, needs cleaned up.
foreach ($node->data[key($node->data)] as $d) {
if ( !is_array($d) &&
( (preg_match('/^&([^ ]+)/',$d))
||
(preg_match('/^\*([^ ]+)/',$d)) )
) {
$this->_haveRefs[] =& $this->_allNodes[$node->id];
}
// We don't know the parent of the node so we have to find it
// foreach ($this->_allNodes as $n) {
foreach ($this->_indentSort[$node->indent] as $n) {
if ($n->indent == $node->indent) {
$node->parent = $n->parent;
}
}
}
if ($this->_inBlock === false) {
// Set these properties with information from our current node
$this->_lastIndent = $node->indent;
// Set the last node
$this->_lastNode = $node->id;
// Parse the YAML line and return its data
$node->data = $this->_parseLine($line);
// Add the node to the master list
$this->_allNodes[$node->id] = $node;
// Add a reference to the parent list
$this->_allParent[intval($node->parent)][] = $node->id;
// Add a reference to the node in an indent array
$this->_indentSort[$node->indent][] =& $this->_allNodes[$node->id];
// Add a reference to the node in a References array if this node
// has a YAML reference in it.
if (
( (is_array($node->data)) &&
isset($node->data[key($node->data)]) &&
(!is_array($node->data[key($node->data)])) )
&&
( (preg_match('/^&([^ ]+)/',$node->data[key($node->data)]))
||
(preg_match('/^\*([^ ]+)/',$node->data[key($node->data)])) )
) {
$this->_haveRefs[] =& $this->_allNodes[$node->id];
} elseif (
( (is_array($node->data)) &&
isset($node->data[key($node->data)]) &&
(is_array($node->data[key($node->data)])) )
) {
// Incomplete reference making code. Ugly, needs cleaned up.
foreach ($node->data[key($node->data)] as $d) {
if ( !is_array($d) &&
( (preg_match('/^&([^ ]+)/',$d))
||
(preg_match('/^\*([^ ]+)/',$d)) )
) {
$this->_haveRefs[] =& $this->_allNodes[$node->id];
}
}
}
}
}
unset($node);
}
unset($node);
// Here we travel through node-space and pick out references (& and *)
$this->_linkReferences();
// Here we travel through node-space and pick out references (& and *)
$this->_linkReferences();
// Build the PHP array out of node-space
$trunk = $this->_buildArray();
return $trunk;
// Build the PHP array out of node-space
$trunk = $this->_buildArray();
return $trunk;
}
/**
* Dump PHP array to YAML
*
* The dump method, when supplied with an array, will do its best
* to convert the array into friendly YAML. Pretty simple. Feel free to
* save the returned string as tasteful.yaml and pass it around.
*
* Oh, and you can decide how big the indent is and what the wordwrap
* for folding is. Pretty cool -- just pass in 'false' for either if
* you want to use the default.
*
* Indent's default is 2 spaces, wordwrap's default is 40 characters. And
* you can turn off wordwrap by passing in 0.
*
* @access public
* @return string
* @param array $array PHP array
* @param int $indent Pass in false to use the default, which is 2
* @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)
*/
public function dump($array,$indent = false,$wordwrap = false) {
// Dumps to some very clean YAML. We'll have to add some more features
// and options soon. And better support for folding.
// New features and options.
if ($indent === false or !is_numeric($indent)) {
$this->_dumpIndent = 2;
} else {
$this->_dumpIndent = $indent;
}
/**
* Dump PHP array to YAML
*
* The dump method, when supplied with an array, will do its best
* to convert the array into friendly YAML. Pretty simple. Feel free to
* save the returned string as tasteful.yaml and pass it around.
*
* Oh, and you can decide how big the indent is and what the wordwrap
* for folding is. Pretty cool -- just pass in 'false' for either if
* you want to use the default.
*
* Indent's default is 2 spaces, wordwrap's default is 40 characters. And
* you can turn off wordwrap by passing in 0.
*
* @access public
* @return string
* @param array $array PHP array
* @param int $indent Pass in false to use the default, which is 2
* @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)
*/
public function dump($array,$indent = false,$wordwrap = false) {
// Dumps to some very clean YAML. We'll have to add some more features
// and options soon. And better support for folding.
if ($wordwrap === false or !is_numeric($wordwrap)) {
$this->_dumpWordWrap = 40;
} else {
$this->_dumpWordWrap = $wordwrap;
}
// New features and options.
if ($indent === false or !is_numeric($indent)) {
$this->_dumpIndent = 2;
} else {
$this->_dumpIndent = $indent;
}
// New YAML document
$string = "---\n";
if ($wordwrap === false or !is_numeric($wordwrap)) {
$this->_dumpWordWrap = 40;
} else {
$this->_dumpWordWrap = $wordwrap;
}
// Start at the base of the array and move through it.
foreach ($array as $key => $value) {
$string .= $this->_yamlize($key,$value,0);
}
return $string;
}
// New YAML document
$string = "---\n";
/**** Private Properties ****/
// Start at the base of the array and move through it.
/**#@+
* @access private
* @var mixed
*/
private $_haveRefs;
private $_allNodes;
private $_allParent;
private $_lastIndent;
private $_lastNode;
private $_inBlock;
private $_isInline;
private $_dumpIndent;
private $_dumpWordWrap;
/**#@+*/
/**** Public Properties ****/
/**#@+
* @access public
* @var mixed
*/
public $_nodeId;
/**#@+*/
/**** Private Methods ****/
/**
* Attempts to convert a key / value array item to YAML
* @access private
* @return string
* @param $key The name of the key
* @param $value The value of the item
* @param $indent The indent of the current node
*/
private function _yamlize($key,$value,$indent) {
if (is_array($value)) {
// It has children. What to do?
// Make it the right kind of item
$string = $this->_dumpNode($key,NULL,$indent);
// Add the indent
$indent += $this->_dumpIndent;
// Yamlize the array
$string .= $this->_yamlizeArray($value,$indent);
} elseif (!is_array($value)) {
// It doesn't have children. Yip.
$string = $this->_dumpNode($key,$value,$indent);
}
return $string;
}
/**
* Attempts to convert an array to YAML
* @access private
* @return string
* @param $array The array you want to convert
* @param $indent The indent of the current level
*/
private function _yamlizeArray($array,$indent) {
if (is_array($array)) {
$string = '';
foreach ($array as $key => $value) {
$string .= $this->_yamlize($key,$value,0);
$string .= $this->_yamlize($key,$value,$indent);
}
return $string;
}
/**** Private Properties ****/
/**#@+
* @access private
* @var mixed
*/
private $_haveRefs;
private $_allNodes;
private $_allParent;
private $_lastIndent;
private $_lastNode;
private $_inBlock;
private $_isInline;
private $_dumpIndent;
private $_dumpWordWrap;
/**#@+*/
/**** Public Properties ****/
/**#@+
* @access public
* @var mixed
*/
public $_nodeId;
/**#@+*/
/**** Private Methods ****/
/**
* Attempts to convert a key / value array item to YAML
* @access private
* @return string
* @param $key The name of the key
* @param $value The value of the item
* @param $indent The indent of the current node
*/
private function _yamlize($key,$value,$indent) {
if (is_array($value)) {
// It has children. What to do?
// Make it the right kind of item
$string = $this->_dumpNode($key,NULL,$indent);
// Add the indent
$indent += $this->_dumpIndent;
// Yamlize the array
$string .= $this->_yamlizeArray($value,$indent);
} elseif (!is_array($value)) {
// It doesn't have children. Yip.
$string = $this->_dumpNode($key,$value,$indent);
}
return $string;
}
/**
* Attempts to convert an array to YAML
* @access private
* @return string
* @param $array The array you want to convert
* @param $indent The indent of the current level
*/
private function _yamlizeArray($array,$indent) {
if (is_array($array)) {
$string = '';
foreach ($array as $key => $value) {
$string .= $this->_yamlize($key,$value,$indent);
}
return $string;
} else {
return false;
}
}
/**
* Returns YAML from a key and a value
* @access private
* @return string
* @param $key The name of the key
* @param $value The value of the item
* @param $indent The indent of the current node
*/
private function _dumpNode($key,$value,$indent) {
// do some folding here, for blocks
if (strpos($value,"\n") !== false || strpos($value,": ") !== false || strpos($value,"- ") !== false) {
$value = $this->_doLiteralBlock($value,$indent);
} else {
$value = $this->_doFolding($value,$indent);
}
if (is_bool($value)) {
$value = ($value) ? "true" : "false";
}
$spaces = str_repeat(' ',$indent);
if (is_int($key)) {
// It's a sequence
$string = $spaces.'- '.$value."\n";
} else {
// It's mapped
$string = $spaces.$key.': '.$value."\n";
}
return $string;
}
/**
* Creates a literal block for dumping
* @access private
* @return string
* @param $value
* @param $indent int The value of the indent
*/
private function _doLiteralBlock($value,$indent) {
$exploded = explode("\n",$value);
$newValue = '|';
$indent += $this->_dumpIndent;
$spaces = str_repeat(' ',$indent);
foreach ($exploded as $line) {
$newValue .= "\n" . $spaces . trim($line);
}
return $newValue;
}
/**
* Folds a string of text, if necessary
* @access private
* @return string
* @param $value The string you wish to fold
*/
private function _doFolding($value,$indent) {
// Don't do anything if wordwrap is set to 0
if ($this->_dumpWordWrap === 0) {
return $value;
}
if (strlen($value) > $this->_dumpWordWrap) {
$indent += $this->_dumpIndent;
$indent = str_repeat(' ',$indent);
$wrapped = wordwrap($value,$this->_dumpWordWrap,"\n$indent");
$value = ">\n".$indent.$wrapped;
}
return $value;
}
/* Methods used in loading */
/**
* Finds and returns the indentation of a YAML line
* @access private
* @return int
* @param string $line A line from the YAML file
*/
private function _getIndent($line) {
preg_match('/^\s{1,}/',$line,$match);
if (!empty($match[0])) {
$indent = substr_count($match[0],' ');
} else {
$indent = 0;
}
return $indent;
}
/**
* Parses YAML code and returns an array for a node
* @access private
* @return array
* @param string $line A line from the YAML file
*/
private function _parseLine($line) {
$line = trim($line);
$array = array();
if (preg_match('/^-(.*):$/',$line)) {
// It's a mapped sequence
$key = trim(substr(substr($line,1),0,-1));
$array[$key] = '';
} elseif ($line[0] == '-' && substr($line,0,3) != '---') {
// It's a list item but not a new stream
if (strlen($line) > 1) {
$value = trim(substr($line,1));
// Set the type of the value. Int, string, etc
$value = $this->_toType($value);
$array[] = $value;
} else {
$array[] = array();
}
} elseif (preg_match('/^(.+):/',$line,$key)) {
// It's a key/value pair most likely
// If the key is in double quotes pull it out
if (preg_match('/^(["\'](.*)["\'](\s)*:)/',$line,$matches)) {
$value = trim(str_replace($matches[1],'',$line));
$key = $matches[2];
} else {
// Do some guesswork as to the key and the value
$explode = explode(':',$line);
$key = trim($explode[0]);
array_shift($explode);
$value = trim(implode(':',$explode));
}
// Set the type of the value. Int, string, etc
$value = $this->_toType($value);
if (empty($key)) {
$array[] = $value;
} else {
$array[$key] = $value;
}
}
return $array;
}
/**
* Finds the type of the passed value, returns the value as the new type.
* @access private
* @param string $value
* @return mixed
*/
private function _toType($value) {
if (preg_match('/^("(.*)"|\'(.*)\')/',$value,$matches)) {
$value = (string)preg_replace('/(\'\'|\\\\\')/',"'",end($matches));
$value = preg_replace('/\\\\"/','"',$value);
} elseif (preg_match('/^\\[(.+)\\]$/',$value,$matches)) {
// Inline Sequence
// Take out strings sequences and mappings
$explode = $this->_inlineEscape($matches[1]);
// Propogate value array
$value = array();
foreach ($explode as $v) {
$value[] = $this->_toType($v);
}
} elseif (strpos($value,': ')!==false && !preg_match('/^{(.+)/',$value)) {
// It's a map
$array = explode(': ',$value);
$key = trim($array[0]);
array_shift($array);
$value = trim(implode(': ',$array));
$value = $this->_toType($value);
$value = array($key => $value);
} elseif (preg_match("/{(.+)}$/",$value,$matches)) {
// Inline Mapping
// Take out strings sequences and mappings
$explode = $this->_inlineEscape($matches[1]);
// Propogate value array
$array = array();
foreach ($explode as $v) {
$array = $array + $this->_toType($v);
}
$value = $array;
} elseif (strtolower($value) == 'null' or $value == '' or $value == '~') {
$value = NULL;
} elseif (preg_match ('/^[0-9]+$/', $value)) {
$value = (int)$value;
} elseif (in_array(strtolower($value),
array('true', 'on', '+', 'yes', 'y'))) {
$value = TRUE;
} elseif (in_array(strtolower($value),
array('false', 'off', '-', 'no', 'n'))) {
$value = FALSE;
} elseif (is_numeric($value)) {
$value = (float)$value;
} else {
// Just a normal string, right?
$value = trim(preg_replace('/#(.+)$/','',$value));
}
return $value;
}
/**
* Used in inlines to check for more inlines or quoted strings
* @access private
* @return array
*/
private function _inlineEscape($inline) {
// There's gotta be a cleaner way to do this...
// While pure sequences seem to be nesting just fine,
// pure mappings and mappings with sequences inside can't go very
// deep. This needs to be fixed.
$saved_strings = array();
// Check for strings
$regex = '/(?:(")|(?:\'))((?(1)[^"]+|[^\']+))(?(1)"|\')/';
if (preg_match_all($regex,$inline,$strings)) {
$saved_strings = $strings[0];
$inline = preg_replace($regex,'YAMLString',$inline);
}
unset($regex);
// Check for sequences
if (preg_match_all('/\[(.+)\]/U',$inline,$seqs)) {
$inline = preg_replace('/\[(.+)\]/U','YAMLSeq',$inline);
$seqs = $seqs[0];
}
// Check for mappings
if (preg_match_all('/{(.+)}/U',$inline,$maps)) {
$inline = preg_replace('/{(.+)}/U','YAMLMap',$inline);
$maps = $maps[0];
}
$explode = explode(', ',$inline);
// Re-add the sequences
if (!empty($seqs)) {
$i = 0;
foreach ($explode as $key => $value) {
if (strpos($value,'YAMLSeq') !== false) {
$explode[$key] = str_replace('YAMLSeq',$seqs[$i],$value);
++$i;
}
}
}
// Re-add the mappings
if (!empty($maps)) {
$i = 0;
foreach ($explode as $key => $value) {
if (strpos($value,'YAMLMap') !== false) {
$explode[$key] = str_replace('YAMLMap',$maps[$i],$value);
++$i;
}
}
}
// Re-add the strings
if (!empty($saved_strings)) {
$i = 0;
foreach ($explode as $key => $value) {
while (strpos($value,'YAMLString') !== false) {
$explode[$key] = preg_replace('/YAMLString/',$saved_strings[$i],$value, 1);
++$i;
$value = $explode[$key];
}
}
}
return $explode;
}
/**
* Builds the PHP array from all the YAML nodes we've gathered
* @access private
* @return array
*/
private function _buildArray() {
$trunk = array();
if (!isset($this->_indentSort[0])) {
return $trunk;
}
foreach ($this->_indentSort[0] as $n) {
if (empty($n->parent)) {
$this->_nodeArrayizeData($n);
// Check for references and copy the needed data to complete them.
$this->_makeReferences($n);
// Merge our data with the big array we're building
$trunk = $this->_array_kmerge($trunk,$n->data);
}
}
return $trunk;
}
/**
* Traverses node-space and sets references (& and *) accordingly
* @access private
* @return bool
*/
private function _linkReferences() {
if (is_array($this->_haveRefs)) {
foreach ($this->_haveRefs as $node) {
if (!empty($node->data)) {
$key = key($node->data);
// If it's an array, don't check.
if (is_array($node->data[$key])) {
foreach ($node->data[$key] as $k => $v) {
$this->_linkRef($node,$key,$k,$v);
}
} else {
$this->_linkRef($node,$key);
}
}
}
}
return true;
}
function _linkRef(&$n,$key,$k = NULL,$v = NULL) {
if (empty($k) && empty($v)) {
// Look for &refs
if (preg_match('/^&([^ ]+)/',$n->data[$key],$matches)) {
// Flag the node so we know it's a reference
$this->_allNodes[$n->id]->ref = substr($matches[0],1);
$this->_allNodes[$n->id]->data[$key] =
substr($n->data[$key],strlen($matches[0])+1);
// Look for *refs
} elseif (preg_match('/^\*([^ ]+)/',$n->data[$key],$matches)) {
$ref = substr($matches[0],1);
// Flag the node as having a reference
$this->_allNodes[$n->id]->refKey = $ref;
}
} elseif (!empty($k) && !empty($v)) {
if (preg_match('/^&([^ ]+)/',$v,$matches)) {
// Flag the node so we know it's a reference
$this->_allNodes[$n->id]->ref = substr($matches[0],1);
$this->_allNodes[$n->id]->data[$key][$k] =
substr($v,strlen($matches[0])+1);
// Look for *refs
} elseif (preg_match('/^\*([^ ]+)/',$v,$matches)) {
$ref = substr($matches[0],1);
// Flag the node as having a reference
$this->_allNodes[$n->id]->refKey = $ref;
}
}
}
/**
* Finds the children of a node and aids in the building of the PHP array
* @access private
* @param int $nid The id of the node whose children we're gathering
* @return array
*/
private function _gatherChildren($nid) {
$return = array();
$node =& $this->_allNodes[$nid];
if (is_array ($this->_allParent[$node->id])) {
foreach ($this->_allParent[$node->id] as $nodeZ) {
$z =& $this->_allNodes[$nodeZ];
// We found a child
$this->_nodeArrayizeData($z);
// Check for references
$this->_makeReferences($z);
// Merge with the big array we're returning
// The big array being all the data of the children of our parent node
$return = $this->_array_kmerge($return,$z->data);
}
}
return $return;
}
/**
* Turns a node's data and its children's data into a PHP array
*
* @access private
* @param array $node The node which you want to arrayize
* @return boolean
*/
private function _nodeArrayizeData(&$node) {
if (is_array($node->data) && $node->children == true) {
// This node has children, so we need to find them
$childs = $this->_gatherChildren($node->id);
// We've gathered all our children's data and are ready to use it
$key = key($node->data);
$key = empty($key) ? 0 : $key;
// If it's an array, add to it of course
if (isset ($node->data[$key])) {
if (is_array($node->data[$key])) {
$node->data[$key] = $this->_array_kmerge($node->data[$key],$childs);
} else {
$node->data[$key] = $childs;
}
} else {
$node->data[$key] = $childs;
}
} elseif (!is_array($node->data) && $node->children == true) {
// Same as above, find the children of this node
$childs = $this->_gatherChildren($node->id);
$node->data = array();
$node->data[] = $childs;
}
// We edited $node by reference, so just return true
return true;
}
/**
* Traverses node-space and copies references to / from this object.
* @access private
* @param object $z A node whose references we wish to make real
* @return bool
*/
private function _makeReferences(&$z) {
// It is a reference
if (isset($z->ref)) {
$key = key($z->data);
// Copy the data to this object for easy retrieval later
$this->ref[$z->ref] =& $z->data[$key];
// It has a reference
} elseif (isset($z->refKey)) {
if (isset($this->ref[$z->refKey])) {
$key = key($z->data);
// Copy the data from this object to make the node a real reference
$z->data[$key] =& $this->ref[$z->refKey];
}
}
return true;
}
/**
* Merges arrays and maintains numeric keys.
*
* An ever-so-slightly modified version of the array_kmerge() function posted
* to php.net by mail at nospam dot iaindooley dot com on 2004-04-08.
*
* http://us3.php.net/manual/en/function.array-merge.php#41394
*
* @access private
* @param array $arr1
* @param array $arr2
* @return array
*/
private function _array_kmerge($arr1,$arr2) {
if(!is_array($arr1)) $arr1 = array();
if(!is_array($arr2)) $arr2 = array();
$keys = array_merge(array_keys($arr1),array_keys($arr2));
$vals = array_merge(array_values($arr1),array_values($arr2));
$ret = array();
foreach($keys as $key) {
list($unused,$val) = each($vals);
if (isset($ret[$key]) and is_int($key)) $ret[] = $val; else $ret[$key] = $val;
}
return $ret;
} else {
return false;
}
}
/**
* Returns YAML from a key and a value
* @access private
* @return string
* @param $key The name of the key
* @param $value The value of the item
* @param $indent The indent of the current node
*/
private function _dumpNode($key,$value,$indent) {
// do some folding here, for blocks
if (strpos($value,"\n") !== false || strpos($value,": ") !== false || strpos($value,"- ") !== false) {
$value = $this->_doLiteralBlock($value,$indent);
} else {
$value = $this->_doFolding($value,$indent);
}
if (is_bool($value)) {
$value = ($value) ? "true" : "false";
}
$spaces = str_repeat(' ',$indent);
if (is_int($key)) {
// It's a sequence
$string = $spaces.'- '.$value."\n";
} else {
// It's mapped
$string = $spaces.$key.': '.$value."\n";
}
return $string;
}
/**
* Creates a literal block for dumping
* @access private
* @return string
* @param $value
* @param $indent int The value of the indent
*/
private function _doLiteralBlock($value,$indent) {
$exploded = explode("\n",$value);
$newValue = '|';
$indent += $this->_dumpIndent;
$spaces = str_repeat(' ',$indent);
foreach ($exploded as $line) {
$newValue .= "\n" . $spaces . trim($line);
}
return $newValue;
}
/**
* Folds a string of text, if necessary
* @access private
* @return string
* @param $value The string you wish to fold
*/
private function _doFolding($value,$indent) {
// Don't do anything if wordwrap is set to 0
if ($this->_dumpWordWrap === 0) {
return $value;
}
if (strlen($value) > $this->_dumpWordWrap) {
$indent += $this->_dumpIndent;
$indent = str_repeat(' ',$indent);
$wrapped = wordwrap($value,$this->_dumpWordWrap,"\n$indent");
$value = ">\n".$indent.$wrapped;
}
return $value;
}
/* Methods used in loading */
/**
* Finds and returns the indentation of a YAML line
* @access private
* @return int
* @param string $line A line from the YAML file
*/
private function _getIndent($line) {
preg_match('/^\s{1,}/',$line,$match);
if (!empty($match[0])) {
$indent = substr_count($match[0],' ');
} else {
$indent = 0;
}
return $indent;
}
/**
* Parses YAML code and returns an array for a node
* @access private
* @return array
* @param string $line A line from the YAML file
*/
private function _parseLine($line) {
$line = trim($line);
$array = array();
if (preg_match('/^-(.*):$/',$line)) {
// It's a mapped sequence
$key = trim(substr(substr($line,1),0,-1));
$array[$key] = '';
} elseif ($line[0] == '-' && substr($line,0,3) != '---') {
// It's a list item but not a new stream
if (strlen($line) > 1) {
$value = trim(substr($line,1));
// Set the type of the value. Int, string, etc
$value = $this->_toType($value);
$array[] = $value;
} else {
$array[] = array();
}
} elseif (preg_match('/^(.+):/',$line,$key)) {
// It's a key/value pair most likely
// If the key is in double quotes pull it out
if (preg_match('/^(["\'](.*)["\'](\s)*:)/',$line,$matches)) {
$value = trim(str_replace($matches[1],'',$line));
$key = $matches[2];
} else {
// Do some guesswork as to the key and the value
$explode = explode(':',$line);
$key = trim($explode[0]);
array_shift($explode);
$value = trim(implode(':',$explode));
}
// Set the type of the value. Int, string, etc
$value = $this->_toType($value);
if (empty($key)) {
$array[] = $value;
} else {
$array[$key] = $value;
}
}
return $array;
}
/**
* Finds the type of the passed value, returns the value as the new type.
* @access private
* @param string $value
* @return mixed
*/
private function _toType($value) {
if (preg_match('/^("(.*)"|\'(.*)\')/',$value,$matches)) {
$value = (string)preg_replace('/(\'\'|\\\\\')/',"'",end($matches));
$value = preg_replace('/\\\\"/','"',$value);
} elseif (preg_match('/^\\[(.+)\\]$/',$value,$matches)) {
// Inline Sequence
// Take out strings sequences and mappings
$explode = $this->_inlineEscape($matches[1]);
// Propogate value array
$value = array();
foreach ($explode as $v) {
$value[] = $this->_toType($v);
}
} elseif (strpos($value,': ')!==false && !preg_match('/^{(.+)/',$value)) {
// It's a map
$array = explode(': ',$value);
$key = trim($array[0]);
array_shift($array);
$value = trim(implode(': ',$array));
$value = $this->_toType($value);
$value = array($key => $value);
} elseif (preg_match("/{(.+)}$/",$value,$matches)) {
// Inline Mapping
// Take out strings sequences and mappings
$explode = $this->_inlineEscape($matches[1]);
// Propogate value array
$array = array();
foreach ($explode as $v) {
$array = $array + $this->_toType($v);
}
$value = $array;
} elseif (strtolower($value) == 'null' or $value == '' or $value == '~') {
$value = NULL;
} elseif (preg_match ('/^[0-9]+$/', $value)) {
$value = (int)$value;
} elseif (in_array(strtolower($value),
array('true', 'on', '+', 'yes', 'y'))) {
$value = TRUE;
} elseif (in_array(strtolower($value),
array('false', 'off', '-', 'no', 'n'))) {
$value = FALSE;
} elseif (is_numeric($value)) {
$value = (float)$value;
} else {
// Just a normal string, right?
$value = trim(preg_replace('/#(.+)$/','',$value));
}
return $value;
}
/**
* Used in inlines to check for more inlines or quoted strings
* @access private
* @return array
*/
private function _inlineEscape($inline) {
// There's gotta be a cleaner way to do this...
// While pure sequences seem to be nesting just fine,
// pure mappings and mappings with sequences inside can't go very
// deep. This needs to be fixed.
$saved_strings = array();
// Check for strings
$regex = '/(?:(")|(?:\'))((?(1)[^"]+|[^\']+))(?(1)"|\')/';
if (preg_match_all($regex,$inline,$strings)) {
$saved_strings = $strings[0];
$inline = preg_replace($regex,'YAMLString',$inline);
}
unset($regex);
// Check for sequences
if (preg_match_all('/\[(.+)\]/U',$inline,$seqs)) {
$inline = preg_replace('/\[(.+)\]/U','YAMLSeq',$inline);
$seqs = $seqs[0];
}
// Check for mappings
if (preg_match_all('/{(.+)}/U',$inline,$maps)) {
$inline = preg_replace('/{(.+)}/U','YAMLMap',$inline);
$maps = $maps[0];
}
$explode = explode(', ',$inline);
// Re-add the sequences
if (!empty($seqs)) {
$i = 0;
foreach ($explode as $key => $value) {
if (strpos($value,'YAMLSeq') !== false) {
$explode[$key] = str_replace('YAMLSeq',$seqs[$i],$value);
++$i;
}
}
}
// Re-add the mappings
if (!empty($maps)) {
$i = 0;
foreach ($explode as $key => $value) {
if (strpos($value,'YAMLMap') !== false) {
$explode[$key] = str_replace('YAMLMap',$maps[$i],$value);
++$i;
}
}
}
// Re-add the strings
if (!empty($saved_strings)) {
$i = 0;
foreach ($explode as $key => $value) {
while (strpos($value,'YAMLString') !== false) {
$explode[$key] = preg_replace('/YAMLString/',$saved_strings[$i],$value, 1);
++$i;
$value = $explode[$key];
}
}
}
return $explode;
}
/**
* Builds the PHP array from all the YAML nodes we've gathered
* @access private
* @return array
*/
private function _buildArray() {
$trunk = array();
if (!isset($this->_indentSort[0])) {
return $trunk;
}
foreach ($this->_indentSort[0] as $n) {
if (empty($n->parent)) {
$this->_nodeArrayizeData($n);
// Check for references and copy the needed data to complete them.
$this->_makeReferences($n);
// Merge our data with the big array we're building
$trunk = $this->_array_kmerge($trunk,$n->data);
}
}
return $trunk;
}
/**
* Traverses node-space and sets references (& and *) accordingly
* @access private
* @return bool
*/
private function _linkReferences() {
if (is_array($this->_haveRefs)) {
foreach ($this->_haveRefs as $node) {
if (!empty($node->data)) {
$key = key($node->data);
// If it's an array, don't check.
if (is_array($node->data[$key])) {
foreach ($node->data[$key] as $k => $v) {
$this->_linkRef($node,$key,$k,$v);
}
} else {
$this->_linkRef($node,$key);
}
}
}
}
return true;
}
function _linkRef(&$n,$key,$k = NULL,$v = NULL) {
if (empty($k) && empty($v)) {
// Look for &refs
if (preg_match('/^&([^ ]+)/',$n->data[$key],$matches)) {
// Flag the node so we know it's a reference
$this->_allNodes[$n->id]->ref = substr($matches[0],1);
$this->_allNodes[$n->id]->data[$key] =
substr($n->data[$key],strlen($matches[0])+1);
// Look for *refs
} elseif (preg_match('/^\*([^ ]+)/',$n->data[$key],$matches)) {
$ref = substr($matches[0],1);
// Flag the node as having a reference
$this->_allNodes[$n->id]->refKey = $ref;
}
} elseif (!empty($k) && !empty($v)) {
if (preg_match('/^&([^ ]+)/',$v,$matches)) {
// Flag the node so we know it's a reference
$this->_allNodes[$n->id]->ref = substr($matches[0],1);
$this->_allNodes[$n->id]->data[$key][$k] =
substr($v,strlen($matches[0])+1);
// Look for *refs
} elseif (preg_match('/^\*([^ ]+)/',$v,$matches)) {
$ref = substr($matches[0],1);
// Flag the node as having a reference
$this->_allNodes[$n->id]->refKey = $ref;
}
}
}
/**
* Finds the children of a node and aids in the building of the PHP array
* @access private
* @param int $nid The id of the node whose children we're gathering
* @return array
*/
private function _gatherChildren($nid) {
$return = array();
$node =& $this->_allNodes[$nid];
if (is_array ($this->_allParent[$node->id])) {
foreach ($this->_allParent[$node->id] as $nodeZ) {
$z =& $this->_allNodes[$nodeZ];
// We found a child
$this->_nodeArrayizeData($z);
// Check for references
$this->_makeReferences($z);
// Merge with the big array we're returning
// The big array being all the data of the children of our parent node
$return = $this->_array_kmerge($return,$z->data);
}
}
return $return;
}
/**
* Turns a node's data and its children's data into a PHP array
*
* @access private
* @param array $node The node which you want to arrayize
* @return boolean
*/
private function _nodeArrayizeData(&$node) {
if (is_array($node->data) && $node->children == true) {
// This node has children, so we need to find them
$childs = $this->_gatherChildren($node->id);
// We've gathered all our children's data and are ready to use it
$key = key($node->data);
$key = empty($key) ? 0 : $key;
// If it's an array, add to it of course
if (isset ($node->data[$key])) {
if (is_array($node->data[$key])) {
$node->data[$key] = $this->_array_kmerge($node->data[$key],$childs);
} else {
$node->data[$key] = $childs;
}
} else {
$node->data[$key] = $childs;
}
} elseif (!is_array($node->data) && $node->children == true) {
// Same as above, find the children of this node
$childs = $this->_gatherChildren($node->id);
$node->data = array();
$node->data[] = $childs;
}
// We edited $node by reference, so just return true
return true;
}
/**
* Traverses node-space and copies references to / from this object.
* @access private
* @param object $z A node whose references we wish to make real
* @return bool
*/
private function _makeReferences(&$z) {
// It is a reference
if (isset($z->ref)) {
$key = key($z->data);
// Copy the data to this object for easy retrieval later
$this->ref[$z->ref] =& $z->data[$key];
// It has a reference
} elseif (isset($z->refKey)) {
if (isset($this->ref[$z->refKey])) {
$key = key($z->data);
// Copy the data from this object to make the node a real reference
$z->data[$key] =& $this->ref[$z->refKey];
}
}
return true;
}
/**
* Merges arrays and maintains numeric keys.
*
* An ever-so-slightly modified version of the array_kmerge() function posted
* to php.net by mail at nospam dot iaindooley dot com on 2004-04-08.
*
* http://us3.php.net/manual/en/function.array-merge.php#41394
*
* @access private
* @param array $arr1
* @param array $arr2
* @return array
*/
private function _array_kmerge($arr1,$arr2) {
if(!is_array($arr1)) $arr1 = array();
if(!is_array($arr2)) $arr2 = array();
$keys = array_merge(array_keys($arr1),array_keys($arr2));
$vals = array_merge(array_values($arr1),array_values($arr2));
$ret = array();
foreach($keys as $key) {
list($unused,$val) = each($vals);
if (isset($ret[$key]) and is_int($key)) $ret[] = $val; else $ret[$key] = $val;
}
return $ret;
}
}
?>

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage cron
*/
/**
* Base class invoked from CLI rather than the webserver (Cron jobs, handling email bounces)
*/

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage cron
*/
/**
* Classes that must be run daily extend this class
*/

View File

@ -1,6 +1,12 @@
<?php
/**
* Executed a task monthly
* @package sapphire
* @subpackage cron
*/
/**
* Classes that must be run monthly extend this class
*/
class MonthlyTask extends ScheduledTask {

View File

@ -1,5 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage cron
*/
/**
* Abstract task representing scheudled tasks
*/
abstract class ScheduledTask extends CliController {
// this class exists as a logical extension
}

View File

@ -1,4 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage cron
*/
/**
* Classes that must be run weekly extend this class
*/
class WeeklyTask extends ScheduledTask {
}

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage view
*/
/**
* Lets you wrap a bunch of array data into a ViewableData object.
* This is useful when you want to pass data to a template in the "SilverStripe 1" way of giving a

View File

@ -1,5 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage misc
*/
/**
* Library of static methods for manipulating arrays.
*/
class ArrayLib extends Object {
static function invert($arr) {
if (! $arr) return false;

View File

@ -3,6 +3,9 @@
* Provides introspection information about the class tree.
* It's a cached wrapper around the built-in class functions. Sapphire uses class introspection heavily
* and without the caching it creates an unfortunate performance hit.
*
* @package sapphire
* @subpackage core
*/
class ClassInfo {
/**

View File

@ -14,6 +14,9 @@
*
* html: HTML source suitable for use in a page or email
* text: Plain-text content, suitable for display to a user as-is, or insertion in a plaintext email.
*
* @package sapphire
* @subpackage misc
*/
class Convert extends Object {
// Convert raw to other formats

View File

@ -1,5 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage misc
*/
/**
* A set of static methods for manipulating cookies.
*/
class Cookie extends Object {
/**
* Set a cookie variable

View File

@ -1,4 +1,11 @@
<?php
/**
* This file contains several methods that control the core behaviour of Sapphire.
*
* @package sapphire
* @subpackage core
*/
/**
* Returns the temporary folder that sapphire/silverstripe should use for its cache files
* This is loaded into the TEMP_FOLDER define on start up

View File

@ -1,6 +1,9 @@
<?php
/**
* Class of static methods to support debugging.
*
* @package sapphire
* @subpackage core
*/
class Debug {

View File

@ -1,8 +1,16 @@
<?php
define('X_MAILER', 'SilverStripe Mailer - version 2006.06.21 (Sent from "'.$_SERVER['SERVER_NAME'].'")');
/**
* @package sapphire
* @subpackage email
*/
/**
* X-Mailer header value on emails sent
*/
define('X_MAILER', 'SilverStripe Mailer - version 2006.06.21 (Sent from "'.$_SERVER['SERVER_NAME'].'")');
// Note: The constant 'BOUNCE_EMAIL' should be defined as a valid email address for where bounces should be returned to.
/**
* Class to support sending emails.
*/

View File

@ -3,6 +3,9 @@
/**
* Add extension that can be added to an object with Object::add_extension().
* For DataObject extensions, use DataObjectDecorator
*
* @package sapphire
* @subpackage core
*/
abstract class Extension extends Object {

View File

@ -3,6 +3,9 @@
/**
* A class with HTTP-related helpers.
* Like Debug, this is more a bundle of methods than a class ;-)
*
* @package sapphire
* @subpackage misc
*/
class HTTP {

View File

@ -1,8 +1,13 @@
<?php
/**
* ManifestBuilder
*
* Name of the manifest file
*/
define("MANIFEST_FILE", TEMP_FOLDER . "/manifest" . str_replace(array("/",":", "\\"),"_", $_SERVER['SCRIPT_FILENAME']));
/**
* The ManifestBuilder class generates the manifest file and keeps it fresh.
*
* The manifest file is a PHP include that contains global variables that
* represent the collected contents of the application:
* - all classes
@ -12,21 +17,9 @@
* Traversing the filesystem to collect this information on everypage.
* This information is cached so that it need not be regenerated on every
* pageview.
*/
/**
* Define a constant for the name of the manifest file
*/
define("MANIFEST_FILE", TEMP_FOLDER . "/manifest" . str_replace(array("/",":", "\\"),"_", $_SERVER['SCRIPT_FILENAME']));
/**
* ManifestBuilder
*
* The ManifestBuilder class generates the manifest file and keeps it fresh.
* @package sapphire
* @subpackage core
*/
class ManifestBuilder {

View File

@ -1,9 +1,14 @@
<?php
/**
* @package sapphire
* @subpackage core
*/
/**
* Base object that all others should inherit from.
* This object provides a number of helper methods that patch over PHP's deficiencies.
*/
class Object {
/**
* This DataObjects extensions, eg Versioned.

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage view
*/
/**
* Requirements tracker, for javascript and css.
* @todo Document the requirements tracker, and discuss it with the others.

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage view
*/
/**
* The SSViewer executes a .ss template file.
* The SSViewer class handles rendering of .ss templates. In addition to a full template in

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage control
*/
/**
* Handles all manipulation of the session.
*
@ -12,14 +17,6 @@
*
* The instance object is basically just a way of manipulating a set of nested maps, and isn't specific to session data.
* This class is currently really basic and could do with a more well-thought-out implementation
*
* $session->myVar = 'XYZ' would be fine, as would Session::data->myVar. What about the equivalent
* of Session::get('member.abc')? Are the explicit accessor methods acceptable? Do we need a
* broader spectrum of functions, such as Session::inc("cart.$productID", 2)? And what should
* Session::get("cart") then return? An array?
*
* @todo Decide whether this class is really necessary, and if so, overhaul it. Perhaps use
* __set() and __get() on an instance, rather than static functions?
*/
class Session {
public static function set($name, $val) {

View File

@ -2,7 +2,7 @@
/**
* @package sapphire
* @subpackage core
* @subpackage view
*/
/**

View File

@ -12,6 +12,9 @@
*
* Subclasses of ContentController are generally instantiated by ModelAsController; this will create
* a controller based on the URLSegment action variable, by looking in the SiteTree table.
*
* @package sapphire
* @subpackage control
*/
class ContentController extends Controller {
protected $dataRecord;

View File

@ -1,4 +1,8 @@
<?php
/**
* @package sapphire
* @subpackage control
*/
/**
* The content negotiator performs text/html or application/xhtml+xml switching.

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage control
*/
/**
* Base controller class.
* Controllers are the cornerstone of all site functionality in Sapphire. The {@link Director}

View File

@ -6,6 +6,9 @@
* one of a number of patterns, and determines the controller, action and any argument to be
* used. It then runs the controller, which will finally run the viewer and/or perform processing
* steps.
*
* @package sapphire
* @subpackage control
*/
class Director {

View File

@ -21,6 +21,9 @@
*
* TODO Force a specific execution order ($forceTop, $forceBottom)
* TODO Extension to return different formats, e.g. JSON or XML
*
* @package sapphire
* @subpackage forms
*/
class FormResponse {

View File

@ -2,6 +2,9 @@
/**
* Represenets an HTTPResponse returned by a controller.
*
* @package sapphire
* @subpackage control
*/
class HTTPResponse extends Object {
protected static $status_codes = array(

View File

@ -4,6 +4,9 @@
* ModelAsController will hand over all control to the appopriate model object
* It uses URLSegment to determine the right object. Also, if (ModelClass)_Controller exists,
* that controller will be used instead. It should be a subclass of ContentController.
*
* @package sapphire
* @subpackage control
*/
class ModelAsController extends Controller implements NestedController {

View File

@ -1,5 +1,16 @@
<?php
/**
* @package sapphire
* @subpackage control
*/
/**
* Interface that is implemented by controllers that are designed to hand control over to another controller.
* ModelAsController, which selects up a SiteTree object and passes control over to a suitable subclass of ContentController, is a good
* example of this.
*/
interface NestedController {
public function getNestedController();

View File

@ -1,7 +1,10 @@
<?php
/**
* This controller handles what happens when you visit the root URL
* This controller handles what happens when you visit the root URL.
*
* @package sapphire
* @subpackage control
*/
class RootURLController extends Controller {
protected static $is_at_root = false;

View File

@ -21,6 +21,8 @@
* Please see the {Translatable} DataObjectDecorator for managing translations of database-content.
*
* @author Bernat Foj Capell <bernat@silverstripe.com>
* @package sapphire
* @subpackage misc
*/
class i18n extends Controller {

View File

@ -1,8 +1,7 @@
<?php
/**
* @package sapphire
* @subpackage core
* @subpackage model
*/
/**

View File

@ -1,8 +1,7 @@
<?php
/**
* @package sapphire
* @subpackage core
* @package cms
*/
/**

View File

@ -2,7 +2,7 @@
/**
* @package sapphire
* @subpackage core
* @subpackage model
*/
/**

View File

@ -2,7 +2,7 @@
/**
* @package sapphire
* @subpackage core
* @subpackage model
*/
/**

View File

@ -2,7 +2,7 @@
/**
* @package sapphire
* @subpackage core
* @subpackage model
*/

View File

@ -1,4 +1,8 @@
<?php
/**
* @package sapphire
* @subpackage model
*/
/**
* DataObjectInterface is an interface that other data systems in your application can implement in order to behave in a manner

View File

@ -2,7 +2,7 @@
/**
* @package sapphire
* @subpackage core
* @subpackage model
*/
/**

View File

@ -2,7 +2,7 @@
/**
* @package sapphire
* @subpackage core
* @subpackage model
*/
/**

View File

@ -2,7 +2,7 @@
/**
* @package sapphire
* @subpackage core
* @subpackage model
*/
/**

View File

@ -4,7 +4,7 @@
* Database Administration
*
* @package sapphire
* @subpackage core
* @subpackage model
*/

View File

@ -1,8 +1,7 @@
<?php
/**
* @package sapphire
* @subpackage core
* @package cms
*/
/**

View File

@ -1,8 +1,7 @@
<?php
/**
* @package sapphire
* @subpackage core
* @package cms
*/
/**

View File

@ -1,8 +1,7 @@
<?php
/**
* @package sapphire
* @subpackage core
* @package cms
*/
/**

View File

@ -2,7 +2,7 @@
/**
* @package sapphire
* @subpackage core
* @subpackage model
*/
/**

View File

@ -2,7 +2,7 @@
/**
* @package sapphire
* @subpackage core
* @subpackage filesystem
*/
/**

View File

@ -2,7 +2,7 @@
/**
* @package sapphire
* @subpackage core
* @subpackage model
*/
/**

View File

@ -2,7 +2,7 @@
/**
* @package sapphire
* @subpackage core
* @subpackage model
*/
/**

View File

@ -1,7 +1,6 @@
<?php
/**
* @package sapphire
* @subpackage core
* @package cms
*/
/**

View File

@ -1,5 +1,9 @@
<?php
/**
* @package cms
*/
/**
* A redirector page redirects when the page is visited.
*/

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage model
*/
/**
* This is a class used to represent key->value pairs generated from database queries.
* The query isn't actually executed until you need it.

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage model
*/
/**
* Object representing a SQL query.
* The various parts of the SQL query can be manipulated individually.

View File

@ -1,7 +1,7 @@
<?php
/**
* @package sapphire
* @subpackage core
* @package cms
*/
/**

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage misc
*/
/**
* The {Translatable} decorator allows your DataObjects to have versions in different languages,
* defining which fields are can be translated.

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage model
*/
/**
* The Versioned decorator allows your DataObjects to have several versions, allowing
* you to rollback changes and view history. An example of this is the pages used in the CMS.

View File

@ -1,5 +1,9 @@
<?php
/**
* @package cms
*/
/**
* Virtual Page creates an instance of a page, with the same fields that the original page had, but readonly.
* This allows you can have a page in mulitple places in the site structure, with different children without duplicating the content

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage model
*/
/**
* Represents a boolean field.
*

View File

@ -1,6 +1,12 @@
<?php
/**
* Currency value.
* @package sapphire
* @subpackage model
*/
/**
* Represents a decimal field containing a currency amount.
* Currency the currency class only supports single currencies.
*/
class Currency extends Decimal {

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage model
*/
/**
* Single field in the database.
* Every field from the database is represented as a sub-class of DBField. In addition to supporting

View File

@ -1,5 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage model
*/
/**
* Represents a date field.
*/
class Date extends DBField {
function setValue($value) {

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage model
*/
if(!class_exists('Datetime')) {
class Datetime extends Date {
function __construct($name) {

View File

@ -1,6 +1,12 @@
<?php
/**
* Decimal value.
* @package sapphire
* @subpackage model
*/
/**
* Represents a Decimal field.
*/
class Decimal extends DBField {
protected $wholeSize, $decimalSize;

View File

@ -1,5 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage model
*/
/**
* Represents an enumeration field.
*/
class Enum extends DBField {
protected $enum, $default;

View File

@ -1,6 +1,12 @@
<?php
/**
*
* @package sapphire
* @subpackage model
*/
/**
* Represents a floating point field.
*/
class Float extends DBField {

View File

@ -1,5 +1,15 @@
<?php
/**
* @package sapphire
* @subpackage model
*/
/**
* Represents a large text field that contains HTML content.
*
* This behaves similarly to Text, but the template processor won't escape any HTML content within it.
*/
class HTMLText extends Text {
/**

View File

@ -1,8 +1,14 @@
<?php
/**
* This behaves exactly the same as Varchar but is intended to store HTML content in it.
* The template processor won't escape any HTML content within it
* @package sapphire
* @subpackage model
*/
/**
* Represents a short text field that is intended to contain HTML content.
*
* This behaves similarly to Varchar, but the template processor won't escape any HTML content within it.
*/
class HTMLVarchar extends Varchar {

View File

@ -1,5 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage model
*/
/**
* Represents an integer field.
*
* @param $defaultVal int
*/
class Int extends DBField {

View File

@ -1,5 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage model
*/
/**
* Represents a decimal field from 0-1 containing a percentage value.
*/
class Percentage extends Decimal {
/**

View File

@ -1,4 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage model
*/
/**
* Represents a date-time field.
*/
class SSDatetime extends Date {
function setValue($value) {
if($value) $this->value = date('Y-m-d H:i:s', strtotime($value));

View File

@ -1,5 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage model
*/
/**
* Represents a long text field.
*/
class Text extends DBField {
static $casting = array(
"AbsoluteLinks" => "HTMLText",

View File

@ -1,8 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage model
*/
/**
* Represents a column in the database with the type 'Time'
*/
class Time extends DBField {
function setVal($value) {

View File

@ -1,5 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage model
*/
/**
* Represents a short text field.
*/
class Varchar extends DBField {
protected $size;

View File

@ -1,5 +1,9 @@
<?php
/**
* @package cms
*/
/**
* The Notifications class allows you to create email notifications for various events.
* It lets your scripts generate a number of notifications, and delay sending of the emails until

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage email
*/
/**
* Stores a queued email to be sent at the given time
*/

View File

@ -1,4 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage email
*/
/**
* Daily task to send queued email.
*/
class QueuedEmailDispatchTask extends DailyTask {
public function process() {

View File

@ -1,6 +1,18 @@
<?php
/**
* @package sapphire
* @subpackage filesystem
*/
/**
* Class for handling archives.
* To implement a specific archive system, create a subclass of this abstract class, and amend the implementation of Archive::open().
*/
abstract class Archive extends Object {
/**
* Return an Archive object for the given file.
*/
static function open($filename) {
if(substr($filename, strlen($filename) - strlen('.tar.gz')) == '.tar.gz' ||
substr($filename, strlen($filename) - strlen('.tar.bz2')) == '.tar.bz2' ||

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage filesystem
*/
/**
* This class handles the representation of a File within Sapphire
* Note: The files are stored in the "/assets/" directory, but sapphire

View File

@ -1,5 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage filesystem
*/
/**
* A collection of static methods for manipulating the filesystem.
*/
class Filesystem extends Object {
public static $file_create_mask = 02775;

View File

@ -1,5 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage filesystem
*/
/**
* Represents a folder in the assets directory.
*/
class Folder extends File {
static $many_many = array(

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage filesystem
*/
/**
* A wrapper class for GD-based images, with lots of manipulation functions.
*/

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* Writes the POST array to a file as a last-ditch effort to preserve entered data.
*/

View File

@ -1,5 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage filesystem
*/
/**
* Implementation of .tar, .tar.gz, and .tar.bz2 archive handler.
*/
class TarballArchive extends Archive {
private $filename = '';
private $compressionModifiers = '';

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* Provides a tabuar list in your form with view, edit and add links to edit records
* with a "has-one"-relationship. Detail-views are shown in a greybox-iframe.

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* EditableButton
* Allows a user to modify the text on the button

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* EditableCheckbox
* A user modifiable checkbox on a UserDefinedForm

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* EditableDropdown
* Represents a set of selectable radio buttons

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* EditableDropdownOption
* Represents a single entry in an EditableRadioField

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* EditableDateField
* Allows a user to add a date field to the Field Editor

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* EditableDropdown
* Represents a modifiable dropdown box on a form

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* EditableDropdownOption
* Represents a single entry in an EditableDropdown

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* EditableEmailField
* Allow users to define a validating editable email field for a UserDefinedForm

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* EditableFileField
* Allows a user to add a field that can be used to upload a file

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* Represents an editable form field
*/

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* Allows an editor to insert a generic heading into a field
*/

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* Creates an editable field that displays members in a given group
*/

View File

@ -1,5 +1,11 @@
<?php
/**
/**
* @package sapphire
* @subpackage forms
*/
/**
* EditableDropdown
* Represents a set of selectable radio buttons
*/

View File

@ -1,8 +1,14 @@
<?php
/**
* EditableDropdownOption
* Represents a single entry in an EditableRadioField
*/
/**
* @package sapphire
* @subpackage forms
*/
/**
* EditableDropdownOption
* Represents a single entry in an EditableRadioField
*/
class EditableRadioOption extends DataObject {

View File

@ -1,8 +1,14 @@
<?php
/**
* EditableTextField
* This control represents a user-defined field in a user defined form
*/
/**
* @package sapphire
* @subpackage forms
*/
/**
* EditableTextField
* This control represents a user-defined field in a user defined form
*/
class EditableTextField extends EditableFormField {
static $db = array(

View File

@ -1,7 +1,8 @@
<?php
/**
* Bulk of the form system
* @package sapphire
* @subpackage forms
*/
/**

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* Represents a field in a form.
* A FieldSet contains a number of FormField objects which make up the whole of a form.

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* This class represents "transformations" of a form - such as making it printable or making it readonly.
* The idea is that sometimes you will want to make your own such transformations, and you shouldn't have

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
class HasManyComplexTableField extends ComplexTableField {
public $joinField;

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
class HasOneComplexTableField extends HasManyComplexTableField {
protected $itemClass = 'HasOneComplexTableField_Item';

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* A WYSIWYG editor field, powered by tinymce.
* tinymce editor fields are created from <textarea> tags which are then converted with javascript.

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
class ManyManyComplexTableField extends HasManyComplexTableField {
private $manyManyParentClass;

View File

@ -1,5 +1,9 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* Displays complex reports based on the list of tables and fields provided to

View File

@ -1,4 +1,12 @@
<?php
/**
* @package cms
*/
/**
* A file uploaded on a UserDefinedForm field
*/
class SubmittedFileField extends SubmittedFormField {
static $has_one = array(

View File

@ -1,4 +1,9 @@
<?php
/**
* @package cms
*/
/**
* SubmittedForm
* Contents of an UserDefinedForm submission

View File

@ -1,19 +1,24 @@
<?php
/**
* SubmittedFormField
* Data received from a UserDefinedForm submission
*/
class SubmittedFormField extends DataObject {
static $db = array(
"Name" => "Varchar",
"Value" => "Text",
"Title" => "Varchar"
);
static $has_one = array(
"Parent" => "SubmittedForm"
);
}
/**
* @package cms
*/
/**
* SubmittedFormField
* Data received from a UserDefinedForm submission
*/
class SubmittedFormField extends DataObject {
static $db = array(
"Name" => "Varchar",
"Value" => "Text",
"Title" => "Varchar"
);
static $has_one = array(
"Parent" => "SubmittedForm"
);
}
?>

View File

@ -1,8 +1,13 @@
<?php
/**
* SubmittedFormReportField
* Displays a summary of instances of a form submitted to the website
*/
/**
* @package cms
*/
/**
* SubmittedFormReportField
* Displays a summary of instances of a form submitted to the website
*/
class SubmittedFormReportField extends FormField {

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* TableField behaves in the same manner as TableListField, however allows the addition of
* fields and editing of attributes specified, and filtering results.

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* Form field that embeds a list into a form, such as a member list or a file list.
*

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage forms
*/
/**
* This validation class handles all form and custom form validation through
* the use of Required fields.

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage misc
*/
/**
* Base class for XML parsers
*/

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage misc
*/
/**
* Browscap.ini parsing class with caching and update capabilities
*
@ -19,7 +24,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package Browscap
* @author Jonathan Stoppani <st.jonathan@gmail.com>
* @copyright Copyright (c) 2006 Jonathan Stoppani
* @version 0.7
@ -656,7 +660,6 @@ class Browscap
/**
* Browscap.ini parsing class exception
*
* @package Browscap
* @author Jonathan Stoppani <st.jonathan@gmail.com>
* @copyright Copyright (c) 2006 Jonathan Stoppani
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License

View File

@ -1,10 +1,15 @@
<?php
/**
* @package sapphire
* @subpackage misc
*/
/**
* Initial implementation of Sitemap support.
* GoogleSitemap should handle requests to 'sitemap.xml'
* the other two classes are used to render the sitemap
*/
class GoogleSitemap extends Controller {
protected $Pages;

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage misc
*/
/**
* Ioncube Performance Suite management
*/

View File

@ -1,5 +1,9 @@
<?php
/**
* @package cms
*/
/**
* Statistics class for gathering and formatting of statistical data for tables and charts in
* both public and administrative contexts.

View File

@ -1,5 +1,9 @@
<?php
/**
* @package sapphire
* @subpackage misc
*/
require_once('HTML/HTMLBBCodeParser.php');
/*Seting up the PEAR bbcode parser*/
@ -10,6 +14,10 @@ $options = $config['SSHTMLBBCodeParser'];
unset($options);
/**
* BBCode parser object.
* Use on a text field in a template with $Content.Parse(BBCodeParser).
*/
class BBCodeParser extends TextParser {
protected static $autolinkUrls = true;

View File

@ -1,4 +1,9 @@
<?php
/**
* @package sapphire
* @subpackage misc
*/
require_once 'HTML/HTMLBBCodeParser.php';
/**

View File

@ -20,9 +20,10 @@
//
/**
* @package SSHTMLBBCodeParser
* @author Stijn de Reede <sjr@gmx.co.uk>
*/
* @package sapphire
* @subpackage misc
* @author Stijn de Reede <sjr@gmx.co.uk>
*/
require_once 'HTML/BBCodeParser/Filter.php';

View File

@ -20,9 +20,10 @@
//
/**
* @package SSHTMLBBCodeParser
* @author Stijn de Reede <sjr@gmx.co.uk>
*/
* @package sapphire
* @subpackage misc
* @author Stijn de Reede <sjr@gmx.co.uk>
*/
require_once 'HTML/BBCodeParser/Filter.php';

View File

@ -20,9 +20,10 @@
//
/**
* @package SSHTMLBBCodeParser
* @author Stijn de Reede <sjr@gmx.co.uk>
*/
* @package sapphire
* @subpackage misc
* @author Stijn de Reede <sjr@gmx.co.uk>
*/
require_once 'HTML/BBCodeParser/Filter.php';

View File

@ -20,9 +20,10 @@
//
/**
* @package SSHTMLBBCodeParser
* @author Stijn de Reede <sjr@gmx.co.uk>
*/
* @package sapphire
* @subpackage misc
* @author Stijn de Reede <sjr@gmx.co.uk>
*/
require_once 'HTML/BBCodeParser/Filter.php';
class SSHTMLBBCodeParser_Filter_Images extends SSHTMLBBCodeParser_Filter

View File

@ -20,9 +20,10 @@
//
/**
* @package SSHTMLBBCodeParser
* @author Stijn de Reede <sjr@gmx.co.uk>
*/
* @package sapphire
* @subpackage misc
* @author Stijn de Reede <sjr@gmx.co.uk>
*/
require_once 'HTML/BBCodeParser/Filter.php';
/**

View File

@ -21,9 +21,10 @@
/**
* @package SSHTMLBBCodeParser
* @author Stijn de Reede <sjr@gmx.co.uk>
*/
* @package sapphire
* @subpackage misc
* @author Stijn de Reede <sjr@gmx.co.uk>
*/
require_once 'HTML/BBCodeParser/Filter.php';

View File

@ -21,7 +21,8 @@
// Modified by SilverStripe www.silverstripe.com
/**
* @package SSHTMLBBCodeParser
* @package sapphire
* @subpackage misc
* @author Stijn de Reede <sjr@gmx.co.uk> , SilverStripe
*
*

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage misc
*/
/**
* Parses text in a variety of ways.
*

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage misc
*/
/********************************************************************************\
* Copyright (C) Carl Taylor (cjtaylor@adepteo.com) *
* Copyright (C) Torben Nehmer (torben@nehmer.net) for Code Cleanup *
@ -6,6 +12,10 @@
\********************************************************************************/
/// Enable multiple timers to aid profiling of performance over sections of code
/**
* Execution time profiler.
*/
class Profiler {
var $description;
var $startTime;

View File

@ -1,6 +1,12 @@
<?php
/**
* Standard basical search form
* @package sapphire
* @subpackage search
*/
/**
* More advanced search form
*/
class AdvancedSearchForm extends SearchForm {

View File

@ -1,8 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage search
*/
/**
* Standard basic search form
*/
class SearchForm extends Form {
protected $showInSearchTurnOn;

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage security
*/
/**
* Abstract base class for an authentication method
*

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage security
*/
/**
* Provides an interface to HTTP basic authentication.
*/

View File

@ -1,10 +1,10 @@
<?php
/**
* Change password form
* @package sapphire
* @subpackage security
*/
/**
* Standard Change Password Form
*/

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage misc
*/
/* Geoip.php
Known to work with the following versions of GeoIP:

View File

@ -1,5 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage security
*/
/**
* A security group.
*/
class Group extends DataObject {
// This breaks too many things for upgraded sites
// static $default_sort = "Sort";

View File

@ -1,13 +1,11 @@
<?php
/**
* LoginForm base class
*
* @author Markus Lanthaler <markus@silverstripe.com>
* @package sapphire
* @subpackage security
*/
/**
* Abstract base class for a login form
*

View File

@ -2,10 +2,10 @@
/**
* Member classes
* @package sapphire
* @subpackage security
*/
/**
* The member class which represents the users of the system
*/

View File

@ -1,13 +1,11 @@
<?php
/**
* Member authenticator
*
* @package sapphire
* @subpackage security
* @author Markus Lanthaler <markus@silverstripe.com>
*/
/**
* Authenticator for the default "member" method
*

View File

@ -1,11 +1,10 @@
<?php
/**
* Log-in form for the "member" authentication method
* @package sapphire
* @subpackage security
*/
/**
* Log-in form for the "member" authentication method
*/
@ -103,15 +102,15 @@ class MemberLoginForm extends LoginForm {
Session::clear("BackURL");
Director::redirect($backURL);
} else {
Director::redirectBack();
Director::redirectBack();
}
} else {
Session::set('SessionForms.MemberLoginForm.Email', $data['Email']);
Session::set('SessionForms.MemberLoginForm.Remember', isset($data['Remember']));
if(isset($_REQUEST['BackURL']) && $backURL = $_REQUEST['BackURL']) {
Session::set('BackURL', $backURL);
}
Session::set('SessionForms.MemberLoginForm.Remember', isset($data['Remember']));
if(isset($_REQUEST['BackURL']) && $backURL = $_REQUEST['BackURL']) {
Session::set('BackURL', $backURL);
}
if($badLoginURL = Session::get("BadLoginURL")) {
Director::redirect($badLoginURL);
@ -197,4 +196,4 @@ class MemberLoginForm extends LoginForm {
}
?>
?>

View File

@ -1,4 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage security
*/
/**
* Represents a permission assigned to a group.
*/
class Permission extends DataObject {
// the (1) after Type specifies the DB default value which is needed for

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage security
*/
/**
* Special kind of dropdown field that has all permission codes as its dropdown source.
* Note: This would ordinarily be overkill; the main reason we have it is that TableField doesn't let you specify a dropdown source;

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage security
*/
/**
* Used to let classes provide new permission codes.
* Every implementor of PermissionProvider is accessed and providePermissions() called to get the full list of permission codes.

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage security
*/
/**
* Implements a basic security model
*/

View File

@ -1,4 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage synchronisation
*/
/**
* Synchroniser controller - used to let two servers communicate
*/
class Synchronise extends Controller {
public function update() {

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage synchronisation
*/
/**
* Functions to provide synchronisation between two Silverstripe implementations. This allows the same entry to have two different
* IDs on each installation

View File

@ -1,4 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage testing
*/
/*
$dir = dirname(dirname((__FILE__)));
$_SERVER['SCRIPT_FILENAME'] = "$dir/main.php";

View File

@ -1,5 +1,12 @@
<?php
/**
* @package tests
*/
/**
* Tests for SiteTree
*/
class SiteTreeTest extends SapphireTest {
static $fixture_file = 'sapphire/tests/SiteTreeTest.yml';

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage testing
*/
// Check that PHPUnit is installed
$hasPhpUnit = false;
$paths = explode(PATH_SEPARATOR, ini_get('include_path'));

View File

@ -1,5 +1,10 @@
<?php
/**
* @package sapphire
* @subpackage misc
*/
/**
** Contains heaps of tools that you can use when importing database information
**/

View File

@ -1,5 +1,14 @@
<?php
/**
* @package sapphire
* @subpackage widgets
*/
/**
* Base class for widgets.
* Widgets let CMS authors drag and drop small pieces of functionality into defined areas of their websites.
*/
class Widget extends DataObject {
static $db = array(
"ParentID" => "Int",

View File

@ -1,5 +1,13 @@
<?php
/**
* @package sapphire
* @subpackage synchronisation
*/
/**
* Represents a set of widgets shown on a page.
*/
class WidgetArea extends DataObject {
static $db = array();