In Joomla Administrator, you can defined the site name in the Joomla administrative interface: SYSTEM > GLOBAL CONFIGURATION > SITE > SITE NAME.
It’s a global setting so, in anywhere, like plugin, components, modules, you can easy call that site name by using this code:
$config = JFactory::getConfig();
echo 'Site name is ' . $config->get( 'sitename' );
The above code will output your “site name” at the line you echo it.
This trick apply for all Joomla version from Joomla 1.5, 1.6, 1.7, 2.5, 3.x and even Joomla 4.x