Last change
on this file since 4000 was
3282,
checked in by plg, 16 years ago
|
change: according to topic:15067, svn:keywords property was removed
|
-
Property svn:executable set to
*
|
File size:
1.4 KB
|
Rev | Line | |
---|
[2466] | 1 | <?php |
---|
| 2 | |
---|
| 3 | /* ----------------------------------------------------------------------------- |
---|
| 4 | class name: ajax |
---|
| 5 | class version: 2.0 |
---|
| 6 | date: 2008-07-20 |
---|
| 7 | ------------------------------------------------------------------------------ |
---|
| 8 | author: grum at grum.dnsalias.com |
---|
| 9 | << May the Little SpaceFrog be with you >> |
---|
| 10 | ------------------------------------------------------------------------------ |
---|
| 11 | |
---|
| 12 | this classes provides base functions to add ajax.js file into html page ; |
---|
| 13 | just instanciate an ajax object, and call return_result |
---|
| 14 | $ajax_content_to_be_returned = "..............."; |
---|
| 15 | $ajax = new ajax(); |
---|
| 16 | $ajax->return_result($ajax_content_to_be_returned); |
---|
| 17 | |
---|
| 18 | - constructor ajax() |
---|
| 19 | - function return_result($str) |
---|
| 20 | ---------------------------------------------------------------------- */ |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | class ajax |
---|
| 25 | { |
---|
| 26 | function ajax() |
---|
| 27 | { |
---|
| 28 | add_event_handler('loc_end_page_header', array(&$this, 'load_JS')); |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | function load_JS() |
---|
| 32 | { |
---|
| 33 | global $template; |
---|
| 34 | |
---|
| 35 | $name='plugins/'.basename(dirname(__FILE__)).'/ajax.js'; |
---|
| 36 | |
---|
| 37 | $template->append('head_elements', '<script src="'.$name.'" type="text/javascript"></script>'); |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | function return_result($str) |
---|
| 41 | { |
---|
| 42 | //$chars=get_html_translation_table(HTML_ENTITIES, ENT_NOQUOTES); |
---|
| 43 | $chars['<']='<'; |
---|
| 44 | $chars['>']='>'; |
---|
| 45 | $chars['&']='&'; |
---|
| 46 | exit(strtr($str, $chars)); |
---|
| 47 | } |
---|
| 48 | } //class |
---|
| 49 | |
---|
| 50 | /* |
---|
| 51 | it's better to make $ajax instance into the plugin object, otherwise an object |
---|
| 52 | made here cannot be acceeded.. |
---|
| 53 | */ |
---|
| 54 | //$ajax=new ajax(); |
---|
| 55 | |
---|
| 56 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.