SZGoogleModuleAjax

The SZ - Google SZGoogleModuleAjax class.

Defined (1)

The class is defined in the following location(s).

/classes/module/SZGoogleModuleAjax.php  
  1. class SZGoogleModuleAjax extends SZGoogleModule 
  2. /** 
  3. * Definition of the initial variable array which are 
  4. * used to identify the module and options related to it 
  5. */ 
  6.  
  7. function moduleAddSetup() 
  8. $this->moduleSetClassName(__CLASS__); 
  9. add_action('wp_ajax_sz_google_shortcodes', array($this, 'moduleAddAjaxShortcodes')); 
  10.  
  11. /** 
  12. * Function for the Ajax call regarding the 
  13. * calling of template matching of shortcodes 
  14. */ 
  15.  
  16. function moduleAddAjaxShortcodes()  
  17. // Check if the call to this function contains the 
  18. // parameters expected in form with the POST method 
  19.  
  20. if (!isset($_GET['action'])) return null; 
  21. if (!isset($_GET['shortcode'])) return null; 
  22. if (!isset($_GET['title'])) return null; 
  23.  
  24. // Checking existence specified shortcode and 
  25. // loading template that covers the shortcode 
  26.  
  27. $shortcode = $_GET['shortcode']; 
  28. $shortcodes = $this->moduleGetAjaxShortcodes(); 
  29.  
  30. if (isset($shortcodes[$shortcode])) { 
  31. define('SZGOOGLE_AJAX_NAME', $shortcodes[$shortcode]); 
  32. $filename = dirname(SZ_PLUGIN_GOOGLE_MAIN).'/admin/mce/shortcodes/'.$shortcodes[$shortcode].'.php'; 
  33. if (is_file($filename)) @include($filename); 
  34.  
  35. // The AJAX call must be properly closed with the  
  36. // command exit() or die() and the process should continue 
  37.  
  38. die(); 
  39.  
  40. // Definition array to hold the shortcodes strings  
  41. // to use the plugin defined in the js file attached 
  42.  
  43. function moduleGetAjaxShortcodes()  
  44. return array( 
  45. 'sz-gplus-author' => 'SZGooglePlusAuthorBadge',  
  46. 'sz-gplus-comments' => 'SZGooglePlusComments',  
  47. 'sz-gplus-community' => 'SZGooglePlusCommunity',  
  48. 'sz-gplus-follow' => 'SZGooglePlusFollow',  
  49. 'sz-gplus-followers' => 'SZGooglePlusFollowers',  
  50. 'sz-gplus-page' => 'SZGooglePlusPage',  
  51. 'sz-gplus-post' => 'SZGooglePlusPost',  
  52. 'sz-gplus-profile' => 'SZGooglePlusProfile',  
  53. 'sz-gplus-one' => 'SZGooglePlusPlusone',  
  54. 'sz-gplus-share' => 'SZGooglePlusShare',  
  55. 'sz-calendar' => 'SZGoogleCalendar',  
  56. 'sz-drive-embed' => 'SZGoogleDriveEmbed',  
  57. 'sz-drive-save' => 'SZGoogleDriveSaveButton',  
  58. 'sz-drive-viewer' => 'SZGoogleDriveViewer',  
  59. 'sz-ggroups' => 'SZGoogleGroups',  
  60. 'sz-hangouts-start' => 'SZGoogleHangoutsStart',  
  61. 'sz-maps' => 'SZGoogleMaps',  
  62. 'sz-panoramio' => 'SZGooglePanoramio',  
  63. 'sz-ytbadge' => 'SZGoogleYoutubeBadge',  
  64. 'sz-ytbutton' => 'SZGoogleYoutubeButton',  
  65. 'sz-ytlink' => 'SZGoogleYoutubeLink',  
  66. 'sz-ytplaylist' => 'SZGoogleYoutubePlaylist',  
  67. 'sz-ytvideo' => 'SZGoogleYoutubeVideo',  
  68. );