1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

eVars/abstract batch shortcode minor improvements

This commit is contained in:
secretr 2010-12-07 13:30:22 +00:00
parent af990019d1
commit 976aaadcac
2 changed files with 52 additions and 7 deletions

View File

@ -2181,6 +2181,16 @@ class e_vars
$this->setVars($array);
}
/**
* Get data array
*
* @return array
*/
public function getVars()
{
return $this->vars;
}
/**
* Set array data
*

View File

@ -277,11 +277,11 @@ class e_parse_shortcode
}
// e.g. class plugin_myplug_news_shortcodes
$_class_fname = $overrideClass;
$className = 'plugin_'.$pluginName.'_'.$overrideClass;
$className = 'plugin_'.$pluginName.'_'.str_replace('/', '_', $overrideClass);
}
elseif($pluginName)
{
$className = 'plugin_'.$pluginName.'_'.$className;
$className = 'plugin_'.$pluginName.'_'.str_replace('/', '_', $className);
}
if ($this->isScClass($className))
@ -867,7 +867,7 @@ class e_shortcode
/**
* Add shortcode value
* <code>e107::getScObject('class_name')->setScVar('some_property', $some_value);</code>
* <code>e107::getScBatch('class_name')->setScVar('some_property', $some_value);</code>
*
* @param string $name
* @param mixed $value
@ -879,9 +879,22 @@ class e_shortcode
return $this;
}
/**
* Add shortcode values
* <code>e107::getScBatch('class_name')->addScVars(array('some_property', $some_value));</code>
*
* @param array $vars
* @return e_shortcode
*/
public function addScVars($vars)
{
$this->scVars->addVars($vars);
return $this;
}
/**
* Retrieve shortcode value
* <code>$some_value = e107::getScObject('class_name')->getScVar('some_property');</code>
* <code>$some_value = e107::getScBatch('class_name')->getScVar('some_property');</code>
*
* @param string $name
* @return mixed
@ -891,9 +904,20 @@ class e_shortcode
return $this->scVars->$name;
}
/**
* Retrieve all shortcode values
* <code>$some_value = e107::getScBatch('class_name')->getScVars();</code>
*
* @return mixed
*/
public function getScVars()
{
return $this->scVars->getVars();
}
/**
* Check if shortcode variable is set
* <code>if(e107::getScObject('class_name')->issetScVar('some_property'))
* <code>if(e107::getScBatch('class_name')->issetScVar('some_property'))
* {
* //do something
* }</code>
@ -908,15 +932,26 @@ class e_shortcode
/**
* Unset shortcode value
* <code>e107::getScObject('class_name')->unsetScVar('some_property');</code>
* <code>e107::getScBatch('class_name')->unsetScVar('some_property');</code>
*
* @param string $name
* @return void
* @return e_shortcode
*/
public function unsetScVar($name)
{
$this->scVars->$name = null;
unset($this->scVars->$name);
return $this;
}
/**
* Empty scvar object data
* @return e_shortcode
*/
public function emptyScVars()
{
$this->scVars->emptyVars();
return $this;
}
/**