Fixes for userguide, added url_resolve to Table()
This commit is contained in:
parent
45cadf0945
commit
c014a4cec8
@ -62,18 +62,18 @@ abstract class lnApp_Controller_TemplateDefault extends Kohana_Controller_Templa
|
||||
* @uses meta
|
||||
*/
|
||||
public function before() {
|
||||
// Do not template media files
|
||||
if ($this->request->action() === 'media') {
|
||||
$this->auto_render = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
// Actions that start with ajax, should only be ajax
|
||||
if (! Kohana::$config->load('debug')->ajax AND preg_match('/^ajax/',Request::current()->action()) AND ! Request::current()->is_ajax())
|
||||
throw HTTP_Exception::factory(412,_('Unable to fulfil request.'));
|
||||
|
||||
parent::before();
|
||||
|
||||
// Do not template media files
|
||||
if ($this->request->action() === 'media') {
|
||||
$this->auto_render = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
// Check user auth and role
|
||||
if ($this->_auth_required()) {
|
||||
if (PHP_SAPI === 'cli')
|
||||
|
@ -97,5 +97,9 @@ abstract class lnApp_Form extends Kohana_Form {
|
||||
|
||||
return sprintf(static::_controlgroup($name,$attributes),parent::textarea($name,$body,$attributes,$double_encode));
|
||||
}
|
||||
|
||||
public static function textarea_rows($textarea,$min=10,$char="\n") {
|
||||
return ($x=count(explode($char,$textarea))) < $min ? $min : $x;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -80,6 +80,19 @@ abstract class lnApp_Table {
|
||||
|
||||
case 'url': $x = HTML::anchor($data.$x,$x);
|
||||
break;
|
||||
|
||||
case 'url_resolve':
|
||||
$filtermatchall = array();
|
||||
preg_match_all('/%(\w+)(\|.+)?(\/[lUC])?%/U',$data,$filtermatchall);
|
||||
|
||||
foreach ($filtermatchall[1] as $id=>$key)
|
||||
$data = str_replace($filtermatchall[0][$id],$d->display($key),$data);
|
||||
|
||||
$x = HTML::anchor($data,$x);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw HTTP_Exception::factory(501,'Unknown action :action',array(':action'=>$act));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user