Kohana v3.3.5
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
* @package Kohana/Userguide
|
||||
* @category Base
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2009-2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2013 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_Kodoc_Class extends Kodoc {
|
||||
|
||||
@@ -45,7 +45,7 @@ class Kohana_Kodoc_Class extends Kodoc {
|
||||
* the class. Reads the class modifiers, constants and comment. Parses the
|
||||
* comment to find the description and tags.
|
||||
*
|
||||
* @param string class name
|
||||
* @param string Class name
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($class)
|
||||
@@ -59,7 +59,7 @@ class Kohana_Kodoc_Class extends Kodoc {
|
||||
|
||||
$this->constants = $this->class->getConstants();
|
||||
|
||||
// If ReflectionClass::getParentClass() won't work if the class in
|
||||
// If ReflectionClass::getParentClass() won't work if the class in
|
||||
// question is an interface
|
||||
if ($this->class->isInterface())
|
||||
{
|
||||
@@ -154,7 +154,7 @@ class Kohana_Kodoc_Class extends Kodoc {
|
||||
|
||||
return $props;
|
||||
}
|
||||
|
||||
|
||||
protected function _prop_sort($a, $b)
|
||||
{
|
||||
// If one property is public, and the other is not, it goes on top
|
||||
@@ -162,13 +162,13 @@ class Kohana_Kodoc_Class extends Kodoc {
|
||||
return -1;
|
||||
if ($b->isPublic() AND ( ! $a->isPublic()))
|
||||
return 1;
|
||||
|
||||
|
||||
// If one property is protected and the other is private, it goes on top
|
||||
if ($a->isProtected() AND $b->isPrivate())
|
||||
return -1;
|
||||
if ($b->isProtected() AND $a->isPrivate())
|
||||
return 1;
|
||||
|
||||
|
||||
// Otherwise just do alphabetical
|
||||
return strcmp($a->name, $b->name);
|
||||
}
|
||||
@@ -191,14 +191,15 @@ class Kohana_Kodoc_Class extends Kodoc {
|
||||
|
||||
return $methods;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sort methods based on their visibility and declaring class based on:
|
||||
* - methods will be sorted public, protected, then private.
|
||||
* - methods that are declared by an ancestor will be after classes
|
||||
*
|
||||
* * methods will be sorted public, protected, then private.
|
||||
* * methods that are declared by an ancestor will be after classes
|
||||
* declared by the current class
|
||||
* - lastly, they will be sorted alphabetically
|
||||
*
|
||||
* * lastly, they will be sorted alphabetically
|
||||
*
|
||||
*/
|
||||
protected function _method_sort($a, $b)
|
||||
{
|
||||
@@ -207,16 +208,16 @@ class Kohana_Kodoc_Class extends Kodoc {
|
||||
return -1;
|
||||
if ($b->isPublic() AND ( ! $a->isPublic()))
|
||||
return 1;
|
||||
|
||||
|
||||
// If one method is protected and the other is private, it goes on top
|
||||
if ($a->isProtected() AND $b->isPrivate())
|
||||
return -1;
|
||||
if ($b->isProtected() AND $a->isPrivate())
|
||||
return 1;
|
||||
|
||||
|
||||
// The methods have the same visibility, so check the declaring class depth:
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
echo Debug::vars('a is '.$a->class.'::'.$a->name,'b is '.$b->class.'::'.$b->name,
|
||||
'are the classes the same?', $a->class == $b->class,'if they are, the result is:',strcmp($a->name, $b->name),
|
||||
@@ -276,4 +277,5 @@ class Kohana_Kodoc_Class extends Kodoc {
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
} // End Kodoc_Class
|
||||
|
@@ -5,8 +5,8 @@
|
||||
* @package Kohana/Userguide
|
||||
* @category Base
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2009-2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2013 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
|
||||
@@ -21,9 +21,10 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
public static $image_url = '';
|
||||
|
||||
/**
|
||||
* Currently defined heading ids.
|
||||
* Currently defined heading ids.
|
||||
* Used to prevent creating multiple headings with same id.
|
||||
* @var array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_heading_ids = array();
|
||||
|
||||
@@ -36,7 +37,7 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
* Slightly less terrible way to make it so the TOC only shows up when we
|
||||
* want it to. set this to true to show the toc.
|
||||
*/
|
||||
public static $show_toc = false;
|
||||
public static $show_toc = FALSE;
|
||||
|
||||
/**
|
||||
* Transform some text using [Kodoc_Markdown]
|
||||
@@ -78,8 +79,8 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
// Show table of contents for userguide pages
|
||||
$this->document_gamut['doTOC'] = 100;
|
||||
|
||||
// PHP4 makes me sad.
|
||||
parent::MarkdownExtra_Parser();
|
||||
// Call parent constructor.
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,25 +89,27 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
* Heading 1
|
||||
* =========
|
||||
*
|
||||
* @param array Matches from regex call
|
||||
* @return string Generated html
|
||||
* @param array Matches from regex call
|
||||
* @return string Generated html
|
||||
*/
|
||||
function _doHeaders_callback_setext($matches)
|
||||
function _doHeaders_callback_setext($matches)
|
||||
{
|
||||
if ($matches[3] == '-' && preg_match('{^- }', $matches[1]))
|
||||
if ($matches[3] == '-' AND preg_match('{^- }', $matches[1]))
|
||||
return $matches[0];
|
||||
$level = $matches[3]{0} == '=' ? 1 : 2;
|
||||
$level = ($matches[3]{0} == '=') ? 1 : 2;
|
||||
$attr = $this->_doHeaders_attr($id =& $matches[2]);
|
||||
|
||||
// Only auto-generate id if one doesn't exist
|
||||
if(empty($attr))
|
||||
if (empty($attr))
|
||||
{
|
||||
$attr = ' id="'.$this->make_heading_id($matches[1]).'"';
|
||||
}
|
||||
|
||||
// Add this header to the page toc
|
||||
$this->_add_to_toc($level,$matches[1],$this->make_heading_id($matches[1]));
|
||||
|
||||
$block = "<h$level$attr>".$this->runSpanGamut($matches[1])."</h$level>";
|
||||
return "\n" . $this->hashBlock($block) . "\n\n";
|
||||
return "\n".$this->hashBlock($block)."\n\n";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,23 +117,25 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
*
|
||||
* # Heading 1
|
||||
*
|
||||
* @param array Matches from regex call
|
||||
* @return string Generated html
|
||||
* @param array Matches from regex call
|
||||
* @return string Generated html
|
||||
*/
|
||||
function _doHeaders_callback_atx($matches)
|
||||
function _doHeaders_callback_atx($matches)
|
||||
{
|
||||
$level = strlen($matches[1]);
|
||||
$attr = $this->_doHeaders_attr($id =& $matches[3]);
|
||||
|
||||
// Only auto-generate id if one doesn't exist
|
||||
if(empty($attr))
|
||||
if (empty($attr))
|
||||
{
|
||||
$attr = ' id="'.$this->make_heading_id($matches[2]).'"';
|
||||
}
|
||||
|
||||
// Add this header to the page toc
|
||||
$this->_add_to_toc($level, $matches[2], $this->make_heading_id(empty($matches[3]) ? $matches[2] : $matches[3]));
|
||||
|
||||
$block = "<h$level$attr>".$this->runSpanGamut($matches[2])."</h$level>";
|
||||
return "\n" . $this->hashBlock($block) . "\n\n";
|
||||
return "\n".$this->hashBlock($block)."\n\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -138,14 +143,14 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
* Makes a heading id from the heading text
|
||||
* If any heading share the same name then subsequent headings will have an integer appended
|
||||
*
|
||||
* @param string The heading text
|
||||
* @return string ID for the heading
|
||||
* @param string The heading text
|
||||
* @return string ID for the heading
|
||||
*/
|
||||
function make_heading_id($heading)
|
||||
{
|
||||
$id = url::title($heading, '-', TRUE);
|
||||
|
||||
if(isset($this->_heading_ids[$id]))
|
||||
if (isset($this->_heading_ids[$id]))
|
||||
{
|
||||
$id .= '-';
|
||||
|
||||
@@ -155,8 +160,8 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
{
|
||||
$id .= $count;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
@@ -166,8 +171,6 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
{
|
||||
$replace = array();
|
||||
|
||||
$replace = array();
|
||||
|
||||
foreach ($matches as $set)
|
||||
{
|
||||
list($search, $view) = $set;
|
||||
@@ -203,7 +206,7 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
*
|
||||
* [filesystem](about.filesystem "Optional title")
|
||||
*
|
||||
* @param string span text
|
||||
* @param string Span text
|
||||
* @return string
|
||||
*/
|
||||
public function doBaseURL($text)
|
||||
@@ -217,7 +220,7 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
*
|
||||
* 
|
||||
*
|
||||
* @param string span text
|
||||
* @param string Span text
|
||||
* @return string
|
||||
*/
|
||||
public function doImageURL($text)
|
||||
@@ -231,7 +234,7 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
*
|
||||
* [Class_Name], [Class::method] or [Class::$property]
|
||||
*
|
||||
* @param string span text
|
||||
* @param string Span text
|
||||
* @return string
|
||||
*/
|
||||
public function doAPI($text)
|
||||
@@ -244,7 +247,7 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
*
|
||||
* [!!] Remember the milk!
|
||||
*
|
||||
* @param string span text
|
||||
* @param string Span text
|
||||
* @return string
|
||||
*/
|
||||
public function doNotes($text)
|
||||
@@ -264,7 +267,7 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
'name' => $name,
|
||||
'id' => $id);
|
||||
}
|
||||
|
||||
|
||||
public function doTOC($text)
|
||||
{
|
||||
// Only add the toc do userguide pages, not api since they already have one
|
||||
|
@@ -5,28 +5,28 @@
|
||||
* @package Kohana/Userguide
|
||||
* @category Base
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2009 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2013 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_Kodoc_Method extends Kodoc {
|
||||
|
||||
/**
|
||||
* @var ReflectionMethod The ReflectionMethod for this class
|
||||
* @var ReflectionMethod The ReflectionMethod for this class
|
||||
*/
|
||||
public $method;
|
||||
|
||||
/**
|
||||
* @var array array of Kodoc_Method_Param
|
||||
* @var array Array of Kodoc_Method_Param
|
||||
*/
|
||||
public $params;
|
||||
|
||||
/**
|
||||
* @var array the things this function can return
|
||||
* @var array The things this function can return
|
||||
*/
|
||||
public $return = array();
|
||||
|
||||
/**
|
||||
* @var string the source code for this function
|
||||
* @var string The source code for this function
|
||||
*/
|
||||
public $source;
|
||||
|
||||
|
@@ -5,8 +5,8 @@
|
||||
* @package Kohana/Userguide
|
||||
* @category Base
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2009 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2013 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_Kodoc_Method_Param extends Kodoc {
|
||||
|
||||
|
@@ -7,6 +7,8 @@
|
||||
* @package Kohana/Userguide
|
||||
* @category Undocumented
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2008-2013 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
* @since 3.0.7
|
||||
*/
|
||||
abstract class Kohana_Kodoc_Missing {
|
||||
|
@@ -5,8 +5,8 @@
|
||||
* @package Kohana/Userguide
|
||||
* @category Base
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2009-2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2013 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_Kodoc_Property extends Kodoc {
|
||||
|
||||
|
Reference in New Issue
Block a user