If you need to access a variable repeatedly then you should generally place it within a constructor methodconstructor method and assign it as a class property, rather than continuously checking config values. This approach also gives you the opportunity to set a default value which you can use class-wide if the config item is not found.
<?php
class Myplugin {
var $return_data;
var $my_setting;
function __construct()
{
$this->EE =& get_instance();
if($this->EE->config->item('my_setting') !== false)
{
$this->my_setting = $this->EE->config->item('my_setting');
}
else
{
$this->my_setting = "Default value if config value doesn't exist.";
}
}
function one()
{
echo $this->my_setting;
}
function two()
{
echo $this->my_setting;
}
}