Changed static to self calls
This commit is contained in:
parent
a7fcddc48c
commit
a23a19b581
@ -16,15 +16,25 @@ class Object {
|
||||
* @param string Object Key that we are evaluating
|
||||
* @param string Value for that Key
|
||||
* @param array The array of objects
|
||||
* @param boolean Traverse children
|
||||
* @return boolean
|
||||
*/
|
||||
public static function in_array($key,$value,array $objects) {
|
||||
public static function in_array($key,$value,array $objects,$traverse=FALSE) {
|
||||
if (! count($objects))
|
||||
return FALSE;
|
||||
|
||||
foreach ($objects as $object)
|
||||
foreach ($objects as $object) {
|
||||
if (is_array($object)) {
|
||||
if (! $traverse)
|
||||
continue;
|
||||
|
||||
if (self::in_array($key,$value,$object,$traverse))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (isset($object->$key) AND $object->$key == $value)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ abstract class lnApp_Block extends HTMLRender {
|
||||
* Render this Block
|
||||
*/
|
||||
protected function render() {
|
||||
$record = static::$_data[$this->_x];
|
||||
$record = self::$_data[$this->_x];
|
||||
|
||||
$output = '';
|
||||
$output .= sprintf('<div class="span%s %s">',empty($record['span']) ? '12' : $record['span'],empty($record['scrollable']) ? '' : 'scrollable');
|
||||
|
@ -50,8 +50,8 @@ class lnApp_Block_Sub extends HTMLRender {
|
||||
|
||||
$i = 0;
|
||||
$x = $y = 0;
|
||||
Sort::MAsort(static::$_data,'order,position,title,subtitle');
|
||||
foreach (static::$_data as $value) {
|
||||
Sort::MAsort(self::$_data,'order,position,title,subtitle');
|
||||
foreach (self::$_data as $value) {
|
||||
$i = (! isset($value['order'])) ? $i+1 : $value['order'];
|
||||
|
||||
// Work out our dimentions
|
||||
|
@ -21,10 +21,10 @@ abstract class lnApp_BreadCrumb extends HTMLRender {
|
||||
* Enable a friendly name to be used for a path
|
||||
*/
|
||||
public static function name($path,$name,$override=TRUE) {
|
||||
if (isset(static::$_data['name'][$path]) AND ! $override)
|
||||
if (isset(self::$_data['name'][$path]) AND ! $override)
|
||||
return;
|
||||
|
||||
static::$_data['name'][$path] = $name;
|
||||
self::$_data['name'][$path] = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -34,7 +34,7 @@ abstract class lnApp_BreadCrumb extends HTMLRender {
|
||||
$output = '<article class="breadcrumbs">';
|
||||
$output .= HTML::anchor('/',_('Home'));
|
||||
|
||||
$data = empty(static::$_data['path']) ? explode('/',preg_replace('/^\//','',Request::detect_uri())) : static::$_data['path'];
|
||||
$data = empty(self::$_data['path']) ? explode('/',preg_replace('/^\//','',Request::detect_uri())) : self::$_data['path'];
|
||||
|
||||
$c = count($data);
|
||||
$i=0;
|
||||
@ -45,8 +45,8 @@ abstract class lnApp_BreadCrumb extends HTMLRender {
|
||||
$p = join('/',array_slice($data,0,$k+1));
|
||||
$output .= $i==$c ? '<span id="active">' : '<span id="inactive">';
|
||||
$output .= HTML::anchor(
|
||||
(empty(static::$_data['url'][$p]) ? $p : static::$_data['url'][$p]),
|
||||
(empty(static::$_data['name'][$p]) ? ucfirst(URL::dir($v)) : static::$_data['name'][$p])
|
||||
(empty(self::$_data['url'][$p]) ? $p : self::$_data['url'][$p]),
|
||||
(empty(self::$_data['name'][$p]) ? ucfirst(URL::dir($v)) : self::$_data['name'][$p])
|
||||
);
|
||||
$output .= '</span>';
|
||||
}
|
||||
@ -64,9 +64,9 @@ abstract class lnApp_BreadCrumb extends HTMLRender {
|
||||
$path = strtolower($path);
|
||||
|
||||
if (is_string($path))
|
||||
static::$_data['path'] = explode('/',$path);
|
||||
self::$_data['path'] = explode('/',$path);
|
||||
elseif (is_array($path))
|
||||
static::$_data['path'] = $path;
|
||||
self::$_data['path'] = $path;
|
||||
else
|
||||
throw new Kohana_Exception('Path is not a string, nor an array');
|
||||
}
|
||||
@ -78,10 +78,10 @@ abstract class lnApp_BreadCrumb extends HTMLRender {
|
||||
$path = strtolower($path);
|
||||
$url = strtolower($url);
|
||||
|
||||
if (isset(static::$_data['url'][$path]) AND ! $override)
|
||||
if (isset(self::$_data['url'][$path]) AND ! $override)
|
||||
return;
|
||||
|
||||
static::$_data['url'][$path] = $url;
|
||||
self::$_data['url'][$path] = $url;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -56,7 +56,7 @@ abstract class lnApp_Form extends Kohana_Form {
|
||||
}
|
||||
|
||||
public static function button($name,$body,array $attributes=NULL) {
|
||||
return sprintf(static::_controlgroup($name,$attributes),parent::button($name,$body,$attributes));
|
||||
return sprintf(self::_controlgroup($name,$attributes),parent::button($name,$body,$attributes));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -71,7 +71,7 @@ abstract class lnApp_Form extends Kohana_Form {
|
||||
* @usedby Form::image
|
||||
*/
|
||||
public static function input($name,$value=NULL,array $attributes=NULL) {
|
||||
return (isset($attributes['type']) AND $attributes['type'] == 'hidden') ? parent::input($name,$value,$attributes) : sprintf(static::_controlgroup($name,$attributes),parent::input($name,$value,$attributes));
|
||||
return (isset($attributes['type']) AND $attributes['type'] == 'hidden') ? parent::input($name,$value,$attributes) : sprintf(self::_controlgroup($name,$attributes),parent::input($name,$value,$attributes));
|
||||
}
|
||||
|
||||
public static function select($name,array $options=NULL,$selected=NULL,array $attributes=NULL) {
|
||||
@ -86,7 +86,7 @@ abstract class lnApp_Form extends Kohana_Form {
|
||||
unset($attributes['sort']);
|
||||
}
|
||||
|
||||
return sprintf(static::_controlgroup($name,$attributes),parent::select($name,$options,$selected,$attributes));
|
||||
return sprintf(self::_controlgroup($name,$attributes),parent::select($name,$options,$selected,$attributes));
|
||||
}
|
||||
|
||||
public static function textarea($name,$body='',array $attributes=NULL,$double_encode=TRUE) {
|
||||
@ -155,7 +155,7 @@ parserRules: {
|
||||
unset($attributes['edit']);
|
||||
}
|
||||
|
||||
return sprintf(static::_controlgroup($name,$attributes),parent::textarea($name,$body,$attributes,$double_encode));
|
||||
return sprintf(self::_controlgroup($name,$attributes),parent::textarea($name,$body,$attributes,$double_encode));
|
||||
}
|
||||
|
||||
public static function textarea_rows($textarea,$min=10,$char="\n") {
|
||||
|
@ -24,7 +24,7 @@ abstract class lnApp_Script extends HTMLRender {
|
||||
* @see HTMLRender::render()
|
||||
*/
|
||||
protected function render() {
|
||||
$record = static::$_data[$this->_x];
|
||||
$record = self::$_data[$this->_x];
|
||||
$output = '';
|
||||
|
||||
switch ($record['type']) {
|
||||
|
@ -24,7 +24,7 @@ abstract class lnApp_Style extends HTMLRender {
|
||||
* @see HTMLRender::render()
|
||||
*/
|
||||
protected function render() {
|
||||
$record = static::$_data[$this->_x];
|
||||
$record = self::$_data[$this->_x];
|
||||
|
||||
$output = '';
|
||||
switch ($record['type']) {
|
||||
|
@ -22,7 +22,7 @@ abstract class lnApp_SystemMessage extends HTMLRender {
|
||||
|
||||
// If we are a CLI session, then we have no session
|
||||
if (PHP_SAPI !== 'cli')
|
||||
Session::instance()->set('sessionmsgs',static::$_data);
|
||||
Session::instance()->set('sessionmsgs',self::$_data);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -35,13 +35,13 @@ abstract class lnApp_SystemMessage extends HTMLRender {
|
||||
*/
|
||||
public static function add($msg,$prepend=FALSE) {
|
||||
if ($msgs = Session::instance()->get_once('sessionmsgs'))
|
||||
static::$_data = $msgs;
|
||||
self::$_data = $msgs;
|
||||
|
||||
parent::add($msg);
|
||||
static::$_c = count(static::$_data);
|
||||
self::$_c = count(self::$_data);
|
||||
|
||||
// Save our messages in our session, so that we get them for redirects
|
||||
Session::instance()->set('sessionmsgs',static::$_data);
|
||||
Session::instance()->set('sessionmsgs',self::$_data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -50,7 +50,7 @@ abstract class lnApp_SystemMessage extends HTMLRender {
|
||||
* @see HTMLRender::render()
|
||||
*/
|
||||
protected function render() {
|
||||
$record = static::$_data[$this->_x];
|
||||
$record = self::$_data[$this->_x];
|
||||
|
||||
$output = '';
|
||||
|
||||
@ -83,7 +83,7 @@ abstract class lnApp_SystemMessage extends HTMLRender {
|
||||
public function render_all() {
|
||||
// Reload our message from the session
|
||||
if ($msgs = Session::instance()->get_once('sessionmsgs'))
|
||||
static::$_data = $msgs;
|
||||
self::$_data = $msgs;
|
||||
|
||||
return parent::render_all();
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ $(document).ready(function() {
|
||||
$prepend[$k] = array('url'=>$v['url']);
|
||||
}
|
||||
|
||||
return static::factory()
|
||||
return self::factory()
|
||||
->data($data)
|
||||
->jssort(TRUE)
|
||||
->page_items($rows)
|
||||
|
Reference in New Issue
Block a user