update_option('skype_status', $option); echo "<div id=\"notice\" class=\"updated fade\"><p><strong>" . __('Options updated!', 'skype-online-status') . "</strong></p></div>"; Skype_Online_Status::$config = $option; } else { if (!empty($_POST['skype_status_reset'])) { // pressed reset button Skype_Online_Status::$config = Skype_Online_Status::get_default_values(); update_option('skype_status', Skype_Online_Status::$config); echo "<div id=\"notice\" class=\"updated fade\"><p><strong>" . __('Options reset!', 'skype-online-status') . "</strong></p></div>"; } else { $option = Skype_Online_Status::$config; } } // get all the selected options (except test call id) and their previews into an array Skype_Online_Status::$preview_options = wp_parse_args(array('skype_id' => 'echo123', 'user_name' => __('Skype Test Call', 'skype-online-status')), $option); Skype_Online_Status::$walk = Skype_Online_Status::walk_templates('', Skype_Online_Status::$preview_options, "", "", true); // build output foreach (Skype_Online_Status::$walk['previews'] as $key => $value) { Skype_Online_Status::$previews .= "<div class=\"preview-wrapper\" id=\"{$value['0']}\" style=\"display:"; if ($value[0] == $option['button_theme']) { Skype_Online_Status::$previews .= "block"; Skype_Online_Status::$current_theme_fullname = $key; } else { Skype_Online_Status::$previews .= "none"; } Skype_Online_Status::$previews .= "\"><div style=\"height:38px;border-bottom:1px dotted grey;margin:0 0 5px 0\">{$key}</div>{$value['1']}</div>"; } unset($value); ?> <form enctype="multipart/form-data" method="post" action="#" id="online-status">
public function form($instance) { $defaults = array('title' => __('Skype Button', 'skype-online-status'), 'skype_id' => '', 'user_name' => '', 'button_theme' => '', 'button_template' => '', 'use_voicemail' => '', 'before' => '', 'after' => ''); $instance = wp_parse_args((array) $instance, $defaults); $title = strip_tags($instance['title']); $user_name = strip_tags($instance['user_name']); $before = format_to_edit($instance['before']); $after = format_to_edit($instance['after']); $walk = Skype_Online_Status::walk_templates('', $instance, '', '', FALSE, TRUE); // get list of templates ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($title); ?> " /></p> <p><label for="<?php echo $this->get_field_id('skype_id'); ?> "><?php _e('Skype ID', 'skype-online-status'); ?> *<?php _e(': ', 'skype-online-status'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('skype_id'); ?> " name="<?php echo $this->get_field_name('skype_id'); ?> " type="text" value="<?php echo $instance['skype_id']; ?> " /></p> <p><label for="<?php echo $this->get_field_id('user_name'); ?> "><?php _e('Full Name', 'skype-online-status'); ?> *<?php _e(': ', 'skype-online-status'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('user_name'); ?> " name="<?php echo $this->get_field_name('user_name'); ?> " type="text" value="<?php echo esc_attr($user_name); ?> " /></p> <p><label for="<?php echo $this->get_field_id('before'); ?> "><?php _e('Text before button', 'skype-online-status'); ?> **<?php _e(': ', 'skype-online-status'); ?> </label> <textarea class="widefat" rows="2" cols="20" id="<?php echo $this->get_field_id('before'); ?> " name="<?php echo $this->get_field_name('before'); ?> "><?php echo $before; ?> </textarea></p> <p><label for="<?php echo $this->get_field_id('button_theme'); ?> "><?php _e('Theme', 'skype-online-status'); _e(': ', 'skype-online-status'); ?> </label> <select class="select" id="<?php echo $this->get_field_id('button_theme'); ?> " name="<?php echo $this->get_field_name('button_theme'); ?> "><option value=""<?php if ($instance['button_theme'] == '') { echo " selected=\"selected\""; } ?> ><?php _e('Default', 'skype-online-status'); ?> </option><?php foreach ($walk['select'] as $key => $value) { echo "<option value=\"{$value}\""; if ($value == $instance['button_theme']) { echo " selected=\"selected\""; } echo ">{$key} </option>"; } unset($value); ?> </select></p> <p><label for="<?php echo $this->get_field_id('after'); ?> "><?php _e('Text after button', 'skype-online-status'); ?> **<?php _e(': ', 'skype-online-status'); ?> </label> <textarea class="widefat" rows="2" cols="20" id="<?php echo $this->get_field_id('after'); ?> " name="<?php echo $this->get_field_name('after'); ?> "><?php echo $after; ?> </textarea></p> <p><label for="<?php echo $this->get_field_id('use_voicemail'); ?> "><?php _e('Use Voicemail?', 'skype-online-status'); ?> </label>*** <select class="select" id="<?php echo $this->get_field_id('use_voicemail'); ?> " name="<?php echo $this->get_field_name('use_voicemail'); ?> "><option value=""<?php if ($instance['use_voicemail'] == '') { echo " selected=\"selected\""; } ?> ><?php _e('Default', 'skype-online-status'); ?> </option><option value="on"<?php if ($instance['use_voicemail'] == 'on') { echo " selected=\"selected\""; } ?> ><?php _e('Yes'); ?> </option><option value="off"<?php if ($instance['use_voicemail'] == 'off') { echo " selected=\"selected\""; } ?> ><?php _e('No'); ?> </option></select></p> <p style="clear:both;font-size:78%;font-weight:lighter;">* <?php _e('Leave blank to use the default options as you defined on the <a href="options-general.php?page=skype-status.php">Skype Settings</a> page.', 'skype-online-status'); //printf(__('Leave blank to use the default options as you defined on the %1$s page.', 'skype-online-status'), '<a href="'.admin_url('options-general.php?page='.SOSPLUGINBASENAME).'">'.__('Settings').'</a>'); ?> <br /> ** <?php _e('You can use some basic HTML here like <br /> for new line.', 'skype-online-status'); ?> <br /> *** <?php printf(__('Set to %1$s if you do not have %2$s or %3$s.', 'skype-online-status'), __('No'), '<a href="https://support.skype.com/en/category/ONLINE_NUMBER_SKYPEIN/" target="_blank">' . __('SkypeIn', 'skype-online-status') . '</a><img src="//www.ftjcfx.com/image-3049686-10520919" width="1" height="1" border="0"/>', '<a href="https://support.skype.com/en/category/VOICEMAIL/" target="_blank">' . __('Skype Voicemail', 'skype-online-status') . '</a><img src="//www.ftjcfx.com/image-3049686-10423078" width="1" height="1" border="0"/>'); ?> </p> <?php }