Skip to content

Commit

Permalink
Merge 3.3/release/3.3.3 into 3.3/master
Browse files Browse the repository at this point in the history
  • Loading branch information
enov committed Dec 11, 2014
2 parents 5701a0f + b8f634b commit 9c24994
Show file tree
Hide file tree
Showing 21 changed files with 214 additions and 156 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ Icon?
.idea
*~
*.swp
composer.lock
vendor/*
koharness_bootstrap.php

18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6
- hhvm

before_script:
- composer install --prefer-dist
- vendor/bin/koharness

script:
- cd /tmp/koharness && ./vendor/bin/phpunit --bootstrap=modules/unittest/bootstrap.php modules/unittest/tests.php

notifications:
email: false
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Kohana - userguide module

| ver | Stable | Develop |
|-------|----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
| 3.3.x | [![Build Status - 3.3/master](https://travis-ci.org/kohana/userguide.svg?branch=3.3%2Fmaster)](https://travis-ci.org/kohana/userguide) | [![Build Status - 3.3/develop](https://travis-ci.org/kohana/userguide.svg?branch=3.3%2Fdevelop)](https://travis-ci.org/kohana/userguide) |
| 3.4.x | [![Build Status - 3.4/master](https://travis-ci.org/kohana/userguide.svg?branch=3.4%2Fmaster)](https://travis-ci.org/kohana/userguide) | [![Build Status - 3.4/develop](https://travis-ci.org/kohana/userguide.svg?branch=3.4%2Fdevelop)](https://travis-ci.org/kohana/userguide) |

## What needs to be done?

Most articles are stubs, with a couple links to pages to be used as a reference when writing the page. The idea is to use the information on those links to help write the new ones. Some of the old userguide pages can probably be mostly copied, with a few improvements, others will be better to be completely rewritten. If you ever have questions, please feel free to jump in the kohana irc channel.
Expand Down Expand Up @@ -66,4 +73,4 @@ If you want to have parameters, only put the brackets around the class and funct

You may include a view by putting the name of the view in double curly brackets. **If the view is not found, no exception or error will be shown!** The curly brackets and view will simply be shown an the page as is.

{{some/view}}
{{some/view}}
22 changes: 11 additions & 11 deletions classes/Kohana/Controller/Userguide.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
* Kohana user guide and api browser.
*
* @package Kohana/Userguide
* @category Controllers
* @category Controller
* @author Kohana Team
* @copyright (c) 2008-2013 Kohana Team
* @license http://kohanaframework.org/license
*/
abstract class Kohana_Controller_Userguide extends Controller_Template {

Expand Down Expand Up @@ -76,7 +78,7 @@ public function error($message)
);
}
// If we are in the api browser, show the menu and show the api browser in the breadcrumbs
else if (Route::name($this->request->route()) == 'docs/api')
elseif (Route::name($this->request->route()) == 'docs/api')
{
$this->template->menu = Kodoc::menu();

Expand Down Expand Up @@ -116,13 +118,13 @@ public function action_docs()
}

// Prevent "guide/module" and "guide/module/index" from having duplicate content
if ( $page == 'index')
if ($page == 'index')
{
return $this->error('Userguide page not found');
}

// If a module is set, but no page was provided in the url, show the index page
if ( ! $page )
if ( ! $page)
{
$page = 'index';
}
Expand All @@ -141,12 +143,14 @@ public function action_docs()
Kodoc_Markdown::$image_url = URL::site($this->media->uri()).'/'.$module.'/';

// Set the page title
$this->template->title = $page == 'index' ? Kohana::$config->load('userguide.modules.'.$module.'.name') : $this->title($page);
$this->template->title = ($page == 'index')
? Kohana::$config->load('userguide.modules.'.$module.'.name')
: $this->title($page);

// Parse the page contents into the template
Kodoc_Markdown::$show_toc = true;
Kodoc_Markdown::$show_toc = TRUE;
$this->template->content = Kodoc_Markdown::markdown(file_get_contents($file));
Kodoc_Markdown::$show_toc = false;
Kodoc_Markdown::$show_toc = FALSE;

// Attach this module's menu to the template
$this->template->menu = Kodoc_Markdown::markdown($this->_get_all_menu_markdown());
Expand Down Expand Up @@ -358,11 +362,7 @@ protected function _get_all_menu_markdown()
if ($file AND $text = file_get_contents($file))
{
// Add spans around non-link categories. This is a terrible hack.
//echo Debug::vars($text);

//$text = preg_replace('/(\s*[\-\*\+]\s*)(.*)/','$1<span>$2</span>',$text);
$text = preg_replace('/^(\s*[\-\*\+]\s*)([^\[\]]+)$/m','$1<span>$2</span>',$text);
//echo Debug::vars($text);
$markdown .= $text;
}

Expand Down
29 changes: 16 additions & 13 deletions classes/Kohana/Kodoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* @package Kohana/Userguide
* @category Base
* @author Kohana Team
* @copyright (c) 2008-2012 Kohana Team
* @license http://kohanaphp.com/license
* @copyright (c) 2008-2013 Kohana Team
* @license http://kohanaframework.org/license
*/
class Kohana_Kodoc {

Expand Down Expand Up @@ -34,6 +34,10 @@ public static function link_class_member($matches)
{
$member = '#property:'.substr($matches[3], 1);
}
elseif (preg_match('/^[A-Z_\x7f-\xff][A-Z0-9_\x7f-\xff]*$/', $matches[3]))
{
$member = '#constant:'.substr($matches[3],0);
}
else
{
$member = '#'.$matches[3];
Expand Down Expand Up @@ -275,7 +279,7 @@ public static function parse($comment, $html = TRUE)
* @param string $text Content of the tag
* @return void
*/
$add_tag = function($tag, $text) use ($html, &$tags)
$add_tag = function ($tag, $text) use ($html, & $tags)
{
// Don't show @access lines, they are shown elsewhere
if ($tag !== 'access')
Expand All @@ -290,7 +294,7 @@ public static function parse($comment, $html = TRUE)
}
};

$comment = $tag = null;
$comment = $tag = NULL;
$end = count($lines[1]) - 1;

foreach ($lines[1] as $i => $line)
Expand Down Expand Up @@ -415,12 +419,12 @@ public static function show_class(Kodoc_Class $class)
*
* Module developers can therefore add their own transparent extension
* namespaces and exclude them from the userguide.
*
* @param string $class The name of the class to check for transparency
* @param array $classes An optional list of all defined classes
* @return false If this is not a transparent extension class
* @return string The name of the class that extends this (in the case provided)
* @throws InvalidArgumentException If the $classes array is provided and the $class variable is not lowercase
*
* @param string $class The name of the class to check for transparency
* @param array $classes An optional list of all defined classes
* @return false If this is not a transparent extension class
* @return string The name of the class that extends this (in the case provided)
* @throws InvalidArgumentException If the $classes array is provided and the $class variable is not lowercase
*/
public static function is_transparent($class, $classes = NULL)
{
Expand All @@ -447,11 +451,11 @@ public static function is_transparent($class, $classes = NULL)
// Cater for Foo extends Module_Foo naming
$child_class = $segments[1];
}

// It is only a transparent class if the unprefixed class also exists
if ($classes AND ! isset($classes[$child_class]))
return FALSE;

// Return the name of the child class
return $child_class;
}
Expand All @@ -462,5 +466,4 @@ public static function is_transparent($class, $classes = NULL)
}
}


} // End Kodoc
36 changes: 19 additions & 17 deletions classes/Kohana/Kodoc/Class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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)
Expand All @@ -59,7 +59,7 @@ public function __construct($class)

$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())
{
Expand Down Expand Up @@ -154,21 +154,21 @@ public function properties()

return $props;
}

protected function _prop_sort($a, $b)
{
// If one property is public, and the other is not, it goes on top
if ($a->isPublic() AND ( ! $b->isPublic()))
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);
}
Expand All @@ -191,14 +191,15 @@ public function methods()

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)
{
Expand All @@ -207,16 +208,16 @@ protected function _method_sort($a, $b)
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),
Expand Down Expand Up @@ -276,4 +277,5 @@ public function tags()

return $result;
}
}

} // End Kodoc_Class
Loading

0 comments on commit 9c24994

Please sign in to comment.