SZGoogleWidgetGroups

The SZ - Google SZGoogleWidgetGroups class.

Defined (1)

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

/classes/widget/SZGoogleWidgetGroups.php  
  1. class SZGoogleWidgetGroups extends SZGoogleWidget 
  2. /** 
  3. * Definition the constructor function, which is called 
  4. * at the time of the creation of an instance of this class 
  5. */ 
  6.  
  7. function __construct()  
  8. parent::__construct('sz-google-groups-iframe', __('SZ-Google - Groups', 'szgoogleadmin'), array( 
  9. 'classname' => 'sz-widget-google sz-widget-google-groups sz-widget-google-groups-iframe',  
  10. 'description' => ucfirst(__('google groups.', 'szgoogleadmin')) 
  11. )); 
  12.  
  13. /** 
  14. * Generation of the HTML code of the widget 
  15. * for the full display in the sidebar associated 
  16. */ 
  17.  
  18. function widget($args, $instance)  
  19. // Checking whether there are the variables that are used during the processing 
  20. // the script and check the default values **in case they were not specified 
  21.  
  22. $options = $this->common_empty(array( 
  23. 'name' => '', // default value 
  24. 'domain' => '', // default value 
  25. 'width' => '', // default value 
  26. 'height' => '', // default value 
  27. 'showsearch' => '', // default value 
  28. 'showtabs' => '', // default value 
  29. 'hideforumtitle' => '', // default value 
  30. 'hidesubject' => '', // default value 
  31. 'hl' => '', // default value 
  32. ), $instance); 
  33.  
  34. // Definition of the control variables of the widget, these values* 
  35. // do not affect the items of basic but affect some aspects 
  36.  
  37. $controls = $this->common_empty(array( 
  38. 'width_auto' => '', // default value 
  39. 'height_auto' => '', // default value 
  40. ), $instance); 
  41.  
  42. // Correction of the value of size is specified in 
  43. // the case the automatically and then use javascript 
  44.  
  45. if ($controls['width_auto'] == '1') $options['width'] = 'auto'; 
  46. if ($controls['height_auto'] == '1') $options['height'] = 'auto'; 
  47.  
  48. // Create the HTML code for the current widget recalling the basic 
  49. // function which is also invoked by the corresponding shortcode 
  50.  
  51. $OBJC = new SZGoogleActionGroups(); 
  52. $HTML = $OBJC->getHTMLCode($options); 
  53.  
  54. // Output HTML code linked to the widget to 
  55. // display call to the general standard for wrap 
  56.  
  57. echo $this->common_widget($args, $instance, $HTML); 
  58.  
  59. /** 
  60. * Changing parameters related to the widget FORM  
  61. * with storing the values **directly in the database 
  62. */ 
  63.  
  64. function update($new_instance, $old_instance)  
  65. // Performing additional operations on fields of the 
  66. // form widget before it is stored in the database 
  67.  
  68. return $this->common_update(array( 
  69. 'title' => '0', // strip_tags 
  70. 'name' => '1', // strip_tags 
  71. 'domain' => '1', // strip_tags 
  72. 'width' => '1', // strip_tags 
  73. 'width_auto' => '1', // strip_tags 
  74. 'height' => '1', // strip_tags 
  75. 'height_auto' => '1', // strip_tags 
  76. 'showsearch' => '1', // strip_tags 
  77. 'showtabs' => '1', // strip_tags 
  78. 'hideforumtitle' => '1', // strip_tags 
  79. 'hidesubject' => '1', // strip_tags 
  80. 'hl' => '1', // strip_tags 
  81. ), $new_instance, $old_instance); 
  82.  
  83. /** 
  84. * FORM display the widget in the management of  
  85. * sidebar in the administration panel of wordpress 
  86. */ 
  87.  
  88. function form($instance)  
  89. // Creating arrays for list fields that must be 
  90. // present in the form before calling wp_parse_args() 
  91.  
  92. $array = array( 
  93. 'title' => '', // default value 
  94. 'name' => '', // default value 
  95. 'domain' => '', // default value 
  96. 'width' => '', // default value 
  97. 'width_auto' => '', // default value 
  98. 'height' => '', // default value 
  99. 'height_auto' => '', // default value 
  100. 'showsearch' => '', // default value 
  101. 'showtabs' => '', // default value 
  102. 'hideforumtitle' => '', // default value 
  103. 'hidesubject' => '', // default value 
  104. 'hl' => '', // default value 
  105. ); 
  106.  
  107. // Creating arrays for list of fields to be retrieved FORM 
  108. // and loading the file with the HTML template to display 
  109.  
  110. extract(wp_parse_args($instance, $array), EXTR_OVERWRITE); 
  111.  
  112. // Reading of the options for the control of default values 
  113. // be assigned to the widget when it is placed in the sidebar 
  114.  
  115. if ($object = SZGoogleModule::getObject('SZGoogleModuleGroups'))  
  116. $options = (object) $object->getOptions(); 
  117.  
  118. if (!ctype_digit($width) and $width != 'auto') $width = $options->groups_width; 
  119. if (!ctype_digit($height) and $height != 'auto') $height = $options->groups_height; 
  120.  
  121. // Setting any of the default parameters for the 
  122. // fields that contain invalid values **or inconsistent 
  123.  
  124. $DEFAULT = include(dirname(SZ_PLUGIN_GOOGLE_MAIN)."/options/sz_google_options_groups.php"); 
  125.  
  126. if (!ctype_digit($width) or $width == 0) { $width = $DEFAULT['groups_width']['value']; $width_auto = '1'; } 
  127. if (!ctype_digit($height) or $height == 0) { $height = $DEFAULT['groups_height']['value']; $height_auto = '1'; } 
  128.  
  129. // Calling the template for displaying the part  
  130. // that concerns the administration panel (admin) 
  131.  
  132. @include(dirname(SZ_PLUGIN_GOOGLE_MAIN).'/admin/widgets/SZGoogleWidget.php'); 
  133. @include(dirname(SZ_PLUGIN_GOOGLE_MAIN).'/admin/widgets/' .__CLASS__.'.php');