SZGoogleWidgetMaps

The SZ - Google SZGoogleWidgetMaps class.

Defined (1)

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

/classes/widget/SZGoogleWidgetMaps.php  
  1. class SZGoogleWidgetMaps 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-MAPS', __('SZ-Google - Maps', 'szgoogleadmin'), array( 
  9. 'classname' => 'sz-widget-google sz-widget-google-maps sz-widget-google-maps-embed',  
  10. 'description' => ucfirst(__('google maps.', '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. 'title' => '', // default value 
  24. 'width' => '', // default value 
  25. 'height' => '', // default value 
  26. 'lat' => '', // default value 
  27. 'lng' => '', // default value 
  28. 'zoom' => '', // default value 
  29. 'view' => '', // default value 
  30. 'layer' => '', // default value 
  31. 'wheel' => '', // default value 
  32. 'marker' => '', // default value 
  33. 'action' => 'W', // default value 
  34. ), $instance); 
  35.  
  36. // Definition of the control variables of the widget, these values* 
  37. // do not affect the items of basic but affect some aspects 
  38.  
  39. $controls = $this->common_empty(array( 
  40. 'width_auto' => '', // default value 
  41. 'height_auto' => '', // default value 
  42. ), $instance); 
  43.  
  44. // Correction of the value of size is specified in 
  45. // the case the automatically and then use javascript 
  46.  
  47. if ($controls['width_auto'] == '1') $options['width'] = 'auto'; 
  48. if ($controls['height_auto'] == '1') $options['height'] = 'auto'; 
  49.  
  50. // Create the HTML code for the current widget recalling the basic 
  51. // function which is also invoked by the corresponding shortcode 
  52.  
  53. $OBJC = new SZGoogleActionMaps(); 
  54. $HTML = $OBJC->getHTMLCode($options); 
  55.  
  56. // Output HTML code linked to the widget to 
  57. // display call to the general standard for wrap 
  58.  
  59. echo $this->common_widget($args, $instance, $HTML); 
  60.  
  61. /** 
  62. * Changing parameters related to the widget FORM  
  63. * with storing the values **directly in the database 
  64. */ 
  65.  
  66. function update($new_instance, $old_instance)  
  67. // Performing additional operations on fields of the 
  68. // form widget before it is stored in the database 
  69.  
  70. return $this->common_update(array( 
  71. 'title' => '0', // strip_tags 
  72. 'width' => '1', // strip_tags 
  73. 'height' => '1', // strip_tags 
  74. 'width_auto' => '1', // strip_tags 
  75. 'height_auto' => '1', // strip_tags 
  76. 'lat' => '1', // strip_tags 
  77. 'lng' => '1', // strip_tags 
  78. 'zoom' => '1', // strip_tags 
  79. 'view' => '1', // strip_tags 
  80. 'layer' => '1', // strip_tags 
  81. 'wheel' => '1', // strip_tags 
  82. 'marker' => '1', // strip_tags 
  83. ), $new_instance, $old_instance); 
  84.  
  85. /** 
  86. * FORM display the widget in the management of  
  87. * sidebar in the administration panel of wordpress 
  88. */ 
  89.  
  90. function form($instance)  
  91. // Creating arrays for list fields that must be 
  92. // present in the form before calling wp_parse_args() 
  93.  
  94. $array = array( 
  95. 'title' => '', // default value 
  96. 'width' => '', // default value 
  97. 'height' => '', // default value 
  98. 'width_auto' => '', // default value 
  99. 'height_auto' => '', // default value 
  100. 'lat' => '', // default value 
  101. 'lng' => '', // default value 
  102. 'zoom' => '', // default value 
  103. 'view' => '', // default value 
  104. 'layer' => '', // default value 
  105. 'wheel' => '', // default value 
  106. 'marker' => '', // default value 
  107. 'action' => 'A', // default value 
  108. ); 
  109.  
  110. // Creating arrays for list of fields to be retrieved FORM 
  111. // and loading the file with the HTML template to display 
  112.  
  113. $OBJC = new SZGoogleActionMaps(); 
  114. extract((array) $OBJC->checkOptions(wp_parse_args($instance, $array), EXTR_OVERWRITE)); 
  115.  
  116. // Calling the template for displaying the part  
  117. // that concerns the administration panel (admin) 
  118.  
  119. @include(dirname(SZ_PLUGIN_GOOGLE_MAIN).'/admin/widgets/SZGoogleWidget.php'); 
  120. @include(dirname(SZ_PLUGIN_GOOGLE_MAIN).'/admin/widgets/' .__CLASS__.'.php');