I've got a PHP script that's performed by being able to access it directly (to AJAX output).

I'm initializing Joomla Framework variables within that script by doing this:

if ($JEXEC_defined==TRUE) {
    defined('_JEXEC') OR defined('_VALID_MOS') OR die( 'Restricted access' ); //security reason
    $direct_script_access=FALSE;
}

if ($JEXEC_defined==FALSE) {
    define( '_JEXEC', 1 );
    define( 'DS', DIRECTORY_SEPARATOR );
    define('JPATH_BASE', dirname(__FILE__) );
    require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
    require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
    $direct_script_access=TRUE;

    // initialize the application 
    $mainframe =& JFactory::getApplication('site');
    $mainframe->initialise();
}


if ($user->username!="") if ($direct_script_access==TRUE) {
    //PHP code when script is accessed directly
}

Being an creation of the script when utilized directly I have to display a Joomla Wordpress plugin, for ex:

{valsimplecalendar SRQCMPDT1 }

But rather than exhibiting this content from the wordpress plugin, I recieve a set text "".

My question: how you can initialize wordpress plugin system when calling PHP directly? Thanks.

EDIT: I researched and located that I have to import the Joomla Plug ins:

JPluginHelper::importPlugin('content');
$dispatcher = &JDispatcher::getInstance();
$dispatcher->trigger('onBeforeDisplayContent', array ( & $category, &$params, $limitstart));

But anyway that does not make to show wordpress plugin content when directly calling php script.

Would appreciate any suggestions! Thanks!

According to your comment I believe your real question is really "How do you have an AJAX response without surrounding Joomla template HTML".

Within this situation you might want to read:

For 1.5

For 1.6+