/** * Generation of the HTML code of the widget * for the full display in the sidebar associated */ function widget($args, $instance) { // Checking whether there are the variables that are used during the processing // the script and check the default values in case they were not specified $options = $this->common_empty(array('channel' => '', 'width' => '', 'widthunit' => '', 'height' => '', 'heightunit' => ''), $instance); // Definition of the control variables of the widget, these values // do not affect the items of basic but affect some aspects $controls = $this->common_empty(array('method' => '', 'width_auto' => '', 'height_auto' => ''), $instance); // Correction of the value of size is specified in // the case the automatically and then use javascript if ($controls['method'] == '1') { $options['channel'] = ''; } if ($controls['width_auto'] == '1') { $options['width'] = '100'; } if ($controls['width_auto'] == '1') { $options['widthunit'] = '%'; } if ($controls['height_auto'] == '1') { $options['height'] = '100'; } if ($controls['height_auto'] == '1') { $options['heightunit'] = 'px'; } // Create the HTML code for the current widget recalling the basic // function which is also invoked by the corresponding shortcode $OBJC = new SZGoogleActionYoutubeBadge(); $HTML = $OBJC->getHTMLCode($options); // Output HTML code linked to the widget to // display call to the general standard for wrap echo $this->common_widget($args, $instance, $HTML); }
/** * Generazione del codice HTML del widget per la * visualizzazione completa nella sidebar di appartenenza */ function widget($args, $instance) { // Controllo se esistono le variabili che servono durante l'elaborazione // dello script e assegno dei valori di default nel caso non fossero specificati $options = $this->common_empty(array('channel' => '', 'width' => '', 'widthunit' => '', 'height' => '', 'heightunit' => ''), $instance); // Definizione delle variabili di controllo del widget, questi valori non // interessano le opzioni della funzione base ma incidono su alcuni aspetti $controls = $this->common_empty(array('method' => '', 'width_auto' => '', 'height_auto' => ''), $instance); // Se sul widget ho escluso il badge dal pulsante azzero anche // le variabili del badge eventualmente impostate e memorizzate if ($controls['method'] == '1') { $options['channel'] = ''; } if ($controls['width_auto'] == '1') { $options['width'] = '100'; } if ($controls['width_auto'] == '1') { $options['widthunit'] = '%'; } if ($controls['height_auto'] == '1') { $options['height'] = '100'; } if ($controls['height_auto'] == '1') { $options['heightunit'] = 'px'; } // Creazione del codice HTML per il widget attuale richiamando la // funzione base che viene richiamata anche dallo shortcode corrispondente $OBJC = new SZGoogleActionYoutubeBadge(); $HTML = $OBJC->getHTMLCode($options); // Output del codice HTML legato al widget da visualizzare // chiamata alla funzione generale per wrap standard echo $this->common_widget($args, $instance, $HTML); }
function szgoogle_youtube_get_code_badge($options = array()) { if (!($object = new SZGoogleActionYoutubeBadge())) { return false; } else { return $object->getHTMLCode($options); } }