Implementation of the singleton pattern: returns the one and only instance of the
xajax plugin manager.
Returns:
object : a reference to the one and only instance of the
plugin manager.
public static getInstance ( ) |
function &_getSections($sType) { $objPluginManager =& xajaxPluginManager::getInstance(); $objPluginManager->configure('deferScriptGeneration', 'deferred'); $aSections = array(); // buffer output ob_start(); $objPluginManager->generateClientScript(); $sScript = ob_get_clean(); // parse out blocks $aParts = explode('</' . $sType . '>', $sScript); foreach ($aParts as $sPart) { $aValues = explode('<' . $sType, $sPart, 2); if (2 == count($aValues)) { list($sJunk, $sPart) = $aValues; $aValues = explode('>', $sPart, 2); if (2 == count($aValues)) { list($sJunk, $sPart) = $aValues; if (0 < strlen($sPart)) { $aSections[] = $sPart; } } } } $objPluginManager->configure('deferScriptGeneration', $this->bDeferScriptGeneration); return $aSections; }
function xajaxResponse() { //SkipDebug if (0 < func_num_args()) { $objLanguageManager = xajaxLanguageManager::getInstance(); trigger_error($objLanguageManager->getText('XJXRSP:EDERR:01'), E_USER_ERROR); } //EndSkipDebug $this->aCommands = array(); $objResponseManager = xajaxResponseManager::getInstance(); $this->sCharacterEncoding = $objResponseManager->getCharacterEncoding(); $this->bOutputEntities = $objResponseManager->getOutputEntities(); $this->objPluginManager = xajaxPluginManager::getInstance(); }
function __wakeup() { ob_start(); $sLocalFolder = dirname(__FILE__); //SkipAIO require $sLocalFolder . '/xajaxPluginManager.inc.php'; require $sLocalFolder . '/xajaxLanguageManager.inc.php'; require $sLocalFolder . '/xajaxArgumentManager.inc.php'; require $sLocalFolder . '/xajaxResponseManager.inc.php'; require $sLocalFolder . '/xajaxRequest.inc.php'; require $sLocalFolder . '/xajaxResponse.inc.php'; //EndSkipAIO // this is the list of folders where xajax will look for plugins // that will be automatically included at startup. $aPluginFolders = array(); $aPluginFolders[] = dirname($sLocalFolder) . '/xajax_plugins'; //SkipAIO $aPluginFolders[] = $sLocalFolder . '/plugin_layer'; //EndSkipAIO // Setup plugin manager $this->objPluginManager =& xajaxPluginManager::getInstance(); $this->objPluginManager->loadPlugins($aPluginFolders); $this->objLanguageManager =& xajaxLanguageManager::getInstance(); $this->objArgumentManager =& xajaxArgumentManager::getInstance(); $this->objResponseManager =& xajaxResponseManager::getInstance(); $this->sCoreIncludeOutput = ob_get_clean(); }
echo '<'; echo '/script>'; echo $sCrLf; } } } /* Function: _getScriptFilename Returns the name of the script file, based on the current settings. sFilename - (string): The base filename. Returns: string - The filename as it should be specified in the script tags on the browser. */ private function _getScriptFilename($sFilename) { if ($this->bUseUncompressedScripts) { return str_replace('.js', '_uncompressed.js', $sFilename); } return $sFilename; } } /* Register the xajaxIncludeClientScriptPlugin object with the xajaxPluginManager. */ $objPluginManager = xajaxPluginManager::getInstance(); $objPluginManager->registerPlugin(new xajaxIncludeClientScriptPlugin(), 99);
/** * Returns a string containing a Javascript include of the xajax.js file * along with a check to see if the file loaded after six seconds * (typically called internally by xajax from get/printJavascript). * (executes Javascript include plugin) * * @param string the relative address of the folder where xajax has been * installed. For instance, if your PHP file is * "http://www.myserver.com/myfolder/mypage.php" * and xajax was installed in * "http://www.myserver.com/anotherfolder", then $sJsURI * should be set to "../anotherfolder". Defaults to assuming * xajax is in the same folder as your PHP file. * @param string the relative folder/file pair of the xajax Javascript * engine located within the xajax installation folder. * Defaults to xajax_js/xajax.js. * @return string */ function getJavascriptInclude($sJsURI = "", $sJsFile = NULL) { $objPluginManager =& xajaxPluginManager::getInstance(); $objInclude = $objPluginManager->getIncludePlugin(); $objInclude->setXajax($this); $objInclude->setFunctions($this->aFunctions); return $objInclude->getJavascriptInclude($sJsURI, $sJsFile); }
/** * Provides access to the xajaxResponse plugin system. If you use PHP 4 or * 5, pass the plugin name as the first argument, the plugin's method name * as the second argument, and subsequent arguments (if any) after that. * Optionally, if you use PHP 5, you can pass just the plugin name as the * first argument and the plugin object will be returned which you can use * to call the appropriate method. * * @param string name of the plugin to call */ function &plugin($sName) { $objManager =& xajaxPluginManager::getInstance(); $objPlugin =& $objManager->getResponsePlugin($sName); $objPlugin->setResponseObject($this); $aArgs = func_get_args(); array_shift($aArgs); if (!empty($aArgs)) { $sMethodName = array_shift($aArgs); call_user_func_array(array(&$objPlugin, $sMethodName), $aArgs); } return $objPlugin; }
function printJavascript($sJsURI = "", $aJsFiles = array()) { if (0 < strlen($sJsURI)) { $this->configure("javascript URI", $sJsURI); } if (0 < count($aJsFiles)) { $this->configure("javascript files", $aJsFiles); } $objPluginManager =& xajaxPluginManager::getInstance(); $objPluginManager->generateClientScript(); }
echo "\n<script type='text/javascript' src='" . $this->sJavascriptURI . "dhtmlHistory.js' " . $this->sDefer . "charset='UTF-8'>\n"; } } function getName() { return "dhtmlHistoryPlugin"; } function addWaypoint($sWaypointName, $aWaypointData) { $sWaypointData = base64_encode(serialize($aWaypointData)); $this->objResponse->script("dhtmlHistory.add('{$sWaypointName}({$sWaypointData})','')"); //$this->addCommand(array('cmd'=>'js'),"dhtmlHistory.add('$sWaypointName','$sWaypointData')" ); } } // register rsh plugin $pluginManager =& xajaxPluginManager::getInstance(); $pluginManager->registerPlugin(new dhtmlHistoryPlugin()); /** * xajax 0.5 plugin for backbutton and bookmark * * helper functions * */ /** * Adds a waypoint into the backbutton history * * @param unknown_type $objResponse * @param string $sWaypointName * @param mixed $sWaypointData */ function dhtmlHistoryAdd(&$objResponse, $sWaypointName, $sWaypointData)
function &plugin() { $aArgs = func_get_args(); if (0 < count($aArgs)) { $sName = array_shift($aArgs); $objPluginManager =& xajaxPluginManager::getInstance(); $objPlugin =& $objPluginManager->getPlugin($sName); if (false !== $objPlugin) { $objPlugin->setResponse($this); if (0 < count($aArgs)) { $sMethod = array_shift($aArgs); $aFunction = array(&$objPlugin, $sMethod); call_user_func_array($aFunction, $aArgs); } return $objPlugin; } else { $bReturn = false; return $bReturn; } } else { trigger_error("Error: Plugin name is missing or invalid.", E_USER_ERROR); } $bReturn = false; return $bReturn; }