SZGoogleWidgetDriveSaveButton

The SZ - Google SZGoogleWidgetDriveSaveButton class.

Defined (1)

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

/classes/widget/SZGoogleWidgetDriveSaveButton.php  
  1. class SZGoogleWidgetDriveSaveButton 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-Drive-Save-Button', __('SZ-Google - Drive Save Button', 'szgoogleadmin'), array( 
  9. 'classname' => 'sz-widget-google sz-widget-google-drive sz-widget-google-drive-save-button',  
  10. 'description' => ucfirst(__('google drive save button.', '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. 'url' => '', // default value 
  24. 'filename' => '', // default value 
  25. 'sitename' => '', // default value 
  26. 'text' => '', // default value 
  27. 'img' => '', // default value 
  28. 'position' => '', // default value 
  29. 'align' => '', // default value 
  30. 'margintop' => '', // default value 
  31. 'marginright' => '', // default value 
  32. 'marginbottom' => '', // default value 
  33. 'marginleft' => '', // default value 
  34. 'marginunit' => '', // default value 
  35. ), $instance); 
  36.  
  37. // Definition of the control variables of the widget, these values* 
  38. // do not affect the items of basic but affect some aspects 
  39.  
  40. $controls = $this->common_empty(array( 
  41. 'badge' => '', // default value 
  42. ), $instance); 
  43.  
  44. // If the widget I excluded from the badge button I reset 
  45. // the variables of the badge possibly set and saved 
  46.  
  47. if ($controls['badge'] != '1') { 
  48. $options['img'] = ''; 
  49. $options['text'] = ''; 
  50. $options['position'] = ''; 
  51.  
  52. // Create the HTML code for the current widget recalling the basic 
  53. // function which is also invoked by the corresponding shortcode 
  54.  
  55. $OBJC = new SZGoogleActionDriveSave(); 
  56. $HTML = $OBJC->getHTMLCode($options); 
  57.  
  58. // Output HTML code linked to the widget to 
  59. // display call to the general standard for wrap 
  60.  
  61. echo $this->common_widget($args, $instance, $HTML); 
  62.  
  63. /** 
  64. * Changing parameters related to the widget FORM  
  65. * with storing the values **directly in the database 
  66. */ 
  67.  
  68. function update($new_instance, $old_instance)  
  69. // Performing additional operations on fields of the 
  70. // form widget before it is stored in the database 
  71.  
  72. return $this->common_update(array( 
  73. 'title' => '0', // strip_tags 
  74. 'badge' => '1', // strip_tags 
  75. 'url' => '0', // strip_tags 
  76. 'text' => '0', // strip_tags 
  77. 'img' => '1', // strip_tags 
  78. 'align' => '1', // strip_tags 
  79. 'position' => '1', // strip_tags 
  80. ), $new_instance, $old_instance); 
  81.  
  82. /** 
  83. * FORM display the widget in the management of  
  84. * sidebar in the administration panel of wordpress 
  85. */ 
  86.  
  87. function form($instance)  
  88. // Creating arrays for list fields that must be 
  89. // present in the form before calling wp_parse_args() 
  90.  
  91. $array = array( 
  92. 'title' => '', // default value 
  93. 'badge' => '', // default value 
  94. 'url' => '', // default value 
  95. 'text' => '', // default value 
  96. 'img' => '', // default value 
  97. 'align' => '', // default value 
  98. 'position' => '', // default value 
  99. ); 
  100.  
  101. // Creating arrays for list of fields to be retrieved FORM 
  102. // and loading the file with the HTML template to display 
  103.  
  104. extract(wp_parse_args($instance, $array), EXTR_OVERWRITE); 
  105.  
  106. // Calling the template for displaying the part  
  107. // that concerns the administration panel (admin) 
  108.  
  109. @include(dirname(SZ_PLUGIN_GOOGLE_MAIN).'/admin/widgets/SZGoogleWidget.php'); 
  110. @include(dirname(SZ_PLUGIN_GOOGLE_MAIN).'/admin/widgets/' .__CLASS__.'.php');