if (isset($_POST['skype_id'])) { $skype_id_array = explode("@", str_replace("live:", "", $_POST['skype_id'])); } $option = array("skype_id" => $skype_id_array[0], "user_name" => isset($_POST['user_name']) ? $_POST['user_name'] : '', "button_theme" => isset($_POST['button_theme']) ? $_POST['button_theme'] : '', "button_template" => isset($_POST['button_template']) ? stripslashes($_POST['button_template']) : '', "use_function" => isset($_POST['use_function']) ? $_POST['use_function'] : '', "use_voicemail" => isset($_POST['use_voicemail']) ? $_POST['use_voicemail'] : '', "use_buttonsnap" => isset($_POST['use_buttonsnap']) ? $_POST['use_buttonsnap'] : '', "local_images" => isset($_POST['local_images']) ? $_POST['local_images'] : '', "no_scheme" => isset($_POST['no_scheme']) ? $_POST['no_scheme'] : '', "add_text" => isset($_POST['add_text']) ? $_POST['add_text'] : '', "call_text" => isset($_POST['call_text']) ? $_POST['call_text'] : '', "chat_text" => isset($_POST['chat_text']) ? $_POST['chat_text'] : '', "sendfile_text" => isset($_POST['sendfile_text']) ? $_POST['sendfile_text'] : '', "userinfo_text" => isset($_POST['userinfo_text']) ? $_POST['userinfo_text'] : '', "voicemail_text" => isset($_POST['voicemail_text']) ? $_POST['voicemail_text'] : '', "seperator1_text" => isset($_POST['seperator1_text']) ? $_POST['seperator1_text'] : '', "use_getskype" => isset($_POST['use_getskype']) ? $_POST['use_getskype'] : '', "getskype_newline" => isset($_POST['getskype_newline']) ? $_POST['getskype_newline'] : '', "getskype_text" => isset($_POST['getskype_text']) ? $_POST['getskype_text'] : '', "getskype_link" => isset($_POST['getskype_link']) ? $_POST['getskype_link'] : '', "getskype_custom_link" => isset($_POST['getskype_custom_link']) ? $_POST['getskype_custom_link'] : ''); $option = array_merge(Skype_Online_Status::$config, $option); // strip nostatus flag after settings have been updated if (isset($option['nostatus'])) { unset($option['nostatus']); } 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;
public static function skype_status_init() { $defaults = self::get_default_values(); self::$config = get_option('skype_status', $defaults); // do stuff for admin ONLY when on the backend if (is_admin()) { // check for plugin upgrade if (self::$config['skype_status_version'] !== SOSVERSION) { // merge new default into old settings self::$config = array_merge($defaults, self::$config); // update: populate db with missing values and set upgraded flag to true self::$config['skype_status_version'] = SOSVERSION; self::$config['upgraded'] = true; if (!empty(self::$config['button_template']) && stripos(self::$config['button_template'], 'mystatus.skype.com')) { self::$config['button_theme'] = $defaults['button_theme']; self::$config['button_template'] = self::get_template_file($defaults['button_theme']); self::$config['nostatus'] = true; } update_option('skype_status', self::$config); // attempt upgrade from pre 2.8.4 widgets if ($options = get_option('skype_widget_options')) { $options['_multiwidget'] = 1; update_option('widget_skype-status', $options); delete_option('skype_widget_options'); } } // Warning about status button replaced by default if (!empty(self::$config['nostatus']) && current_user_can('manage_options')) { add_action('admin_notices', create_function('', 'echo \'<div class="error fade"><p>Microsoft officially <a href="https://support.skype.com/en/faq/FA605/how-do-i-set-up-the-skype-button-to-show-my-status-on-the-web-in-skype-for-windows-desktop" target="_blank">dropped the Skype Online status service</a> per Mai 15th, 2015.</p><p>It looks like you were using one of the "My Status" Skype button themes or a custom theme to show your online status. This type of button will not work anymore and has been replaced by the default button after the plugin upgrade. Please go to <a href="options-general.php?page=skype-status.php">Settings > Skype Buttons</a> and switch to any of the remaining legacy button themes. Save the Skype Button options to get rid of this warning message.</p></div>\';')); } // Quicktag button if (self::$config['use_buttonsnap'] == "on" && current_user_can('edit_posts') && current_user_can('edit_pages')) { add_filter('mce_external_plugins', array(__CLASS__, 'mce3_plugin')); add_filter('mce_buttons', array(__CLASS__, 'mce3_button'), 99); } // create WP hooks add_filter('plugin_action_links_' . SOSPLUGINBASENAME, array(__CLASS__, 'add_action_link')); add_action('admin_menu', array(__CLASS__, 'add_menu')); add_filter('screen_layout_columns', array(__CLASS__, 'admin_layout_columns'), 10, 2); // creates column option in Screen Options; not needed as the option does nothing? } /* if ( empty(self::$config['button_template']) && !empty(self::$config['button_theme']) && self::$config['button_theme']!="custom_edit" ) { // get template file content to load into db self::$config['button_template'] = self::get_template_file($default_values['button_theme']); update_option('skype_status',self::$config); }*/ add_shortcode('skype-status', array(__CLASS__, 'shortcode_callback')); add_action('wp_head', array(__CLASS__, 'print_style')); // http://scribu.net/wordpress/optimal-script-loading.html wp_register_script('skypecheck', plugins_url('/js/skypeCheck.js', __FILE__), '', SOSVERSION, true); add_action('wp_footer', array(__CLASS__, 'print_script')); }