<?php /** * Simplest possible usage of HTML_AJAX_Server * * The server responds to ajax calls and also serves the js client libraries, so they can be used directly from the PEAR data dir * 304 not modified headers are used when server client libraries so they will be cached on the browser reducing overhead * * @category HTML * @package AJAX * @author Joshua Eichorn <*****@*****.**> * @copyright 2005 Joshua Eichorn * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @version Release: @package_version@ * @link http://pear.php.net/package/HTML_AJAX */ // include the server class include 'HTML/AJAX/Server.php'; // include the test class will be registering include 'support/test.class.php'; // create our new server $server = new HTML_AJAX_Server(); // register an instance of the class were registering $test =& new test(); $server->registerClass($test); $server->ajax->packJavaScript = true; // handle different types of requests possiblities are // ?client=all - request for all javascript client files // ?stub=classname - request for proxy stub for given class, can be combined with client but this may hurt caching unless stub=all is used // ?c=classname&m=method - an ajax call, server handles serialization and handing things off to the proper method then returning the results $server->handleRequest();
<?php /** * AJAX Initialization * * @author Christopher Troup <*****@*****.**> * @package CMS * @subpackage Core * @version 2.0 */ /** * Require the Site initialization file. */ require dirname(__FILE__) . '/../include/Site.php'; /** * Require the AJAX Server class */ require 'HTML/AJAX/Server.php'; //Create server instance $server = new HTML_AJAX_Server(); $server->ajax->packJavaScript = true; include_once dirname(__FILE__) . '/../modules/Menu/include/Menu.php'; $menu = new Menu(); $server->registerClass($menu, 'Menu', array('getLinkables')); //Handle the request based on $_GET variables $server->handleRequest();
<?php /* * Copyright (C) 2007 Joshua Eichorn * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * I This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ // HTML_AJAX_Server class require_once 'HTML/AJAX/Server.php'; // UploadProgressMeter class were exporting require $_SERVER["DOCUMENT_ROOT"] . "/php/libs/uploadprogressmeter/UploadProgressMeterStatus.class.php"; $server = new HTML_AJAX_Server(); $status = new UploadProgressMeterStatus(); // were registering class and method name by hand so we don't run into php4/5 case compat problems $server->registerClass($status, 'UploadProgressMeterStatus', array('getStatus')); $server->handleRequest(); ?>
<?php include 'HTML/AJAX/Server.php'; include 'support/xml.class.php'; $server = new HTML_AJAX_Server(); // register an instance of the class were registering $xml =& new TestXml(); $server->registerClass($xml, 'TestXml', array('createHealthy', 'createJunk', 'writeDoc')); $server->setSerializer('XML'); $server->handleRequest();
<?php /** * Usage example for HTML_QuickForm2 package: AJAX-backed hierselect element, AJAX server */ require_once 'HTML/AJAX/Server.php'; require_once '../support/hierselect-loader.php'; $server = new HTML_AJAX_Server(); $server->registerClass(new OptionLoader(), 'OptionLoader', array('getOptionsAjax')); $server->handleRequest();
/** * HTML_AJAX_Server with a register itnerceptor class * * The server responds to ajax calls and also serves the js client libraries, so they can be used directly from the PEAR data dir * 304 not modified headers are used when server client libraries so they will be cached on the browser reducing overhead * * @category HTML * @package AJAX * @author Joshua Eichorn <*****@*****.**> * @copyright 2007 Joshua Eichorn * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @version Release: 0.5.2 * @link http://pear.php.net/package/HTML_AJAX */ // include the server class include 'HTML/AJAX/Server.php'; // include the test class will be registering include 'support/test.class.php'; include 'support/test2.class.php'; include 'support/interceptor.php'; // create our new server $server = new HTML_AJAX_Server(); // register an instance of the class were registering $test = new test(); $server->registerClass($test, 'test'); $test2 = new test2(); $server->registerClass($test2, 'test2'); $server->ajax->packJavaScript = true; $server->ajax->setInterceptor(new Interceptor()); $server->handleRequest();
<?php include 'HTML/AJAX/Server.php'; include 'support/xml.class.php'; $server = new HTML_AJAX_Server(); // register an instance of the class were registering $xml =& new TestXml(); $server->registerClass($xml); $server->setSerializer('XML'); $server->handleRequest();
// * Copyright (c) 2006 Senza Limiti s.r.o. * // * * // * This program is free software; you can redistribute it and/or * // * modify it under the terms of the GNU General Public License * // * as published by the Free Software Foundation; either version 2 * // * of the License, or (at your option) any later version. * // * * // * This program is distributed in the hope that it will be useful, * // * but WITHOUT ANY WARRANTY; without even the implied warranty of * // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * // * GNU General Public License for more details. * // * * // * For commercial licenses please contact Senza Limiti at * // * - http://www.senzalimiti.sk * // * - info(at)senzalimiti.sk * // ***************************************************************************** if (!defined("GRID_SOURCE")) { //define("GRID_SOURCE", str_replace(DIRECTORY_SEPARATOR, '/', realpath(dirname(__FILE__)))); define("GRID_SOURCE", ""); } //include_once '../../core/core.db.inc.php'; // TODO: Modificado para que corra el sistema //error_reporting(E_ALL|E_NOTICE); include_once "class/gridclasses.php"; @session_start(); include 'HTML/AJAX/Server.php'; include_once './ajax/functions.php'; $gridajax =& new gridajax(); $server = new HTML_AJAX_Server(); $server->registerClass($gridajax); $server->handleRequest();