function create_admin_menu_entry()
 {
     $page = "edit.php?post_type=" . Wdsi_SlideIn::POST_TYPE;
     $perms = is_multisite() ? 'manage_network_options' : 'manage_options';
     if (current_user_can($perms) && !empty($_POST) && isset($_POST['option_page'])) {
         $changed = false;
         if ('wdsi_options_page' == wdsi_getval($_POST, 'option_page')) {
             $services = !empty($_POST['wdsi']['services']) ? $_POST['wdsi']['services'] : array();
             $services = is_array($services) ? $services : array();
             if (!empty($_POST['wdsi']['new_service']['name']) && !empty($_POST['wdsi']['new_service']['code'])) {
                 $services[] = $_POST['wdsi']['new_service'];
                 unset($_POST['wdsi']['new_service']);
             }
             foreach ($services as $key => $service) {
                 if (!empty($service['code'])) {
                     $services[$key]['code'] = stripslashes($service['code']);
                 }
             }
             $_POST['wdsi']['services'] = $services;
             update_option('wdsi', $_POST['wdsi']);
             $changed = true;
         }
         if ($changed) {
             $goback = add_query_arg('settings-updated', 'true', wp_get_referer());
             wp_redirect($goback);
             die;
         }
     }
     add_submenu_page($page, __('Global Settings', 'wdsi'), __('Global Settings', 'wdsi'), $perms, 'wdsi', array($this, 'create_admin_page'));
 }
 public static function message_markup($message, $opts, $output = true)
 {
     if (empty($message->ID)) {
         return false;
     }
     $msg = get_post_meta($message->ID, 'wdsi', true);
     $type = get_post_meta($message->ID, 'wdsi-type', true);
     $services = wdsi_getval($msg, 'services');
     $services = $services ? $services : wdsi_getval($opts, 'services');
     $services = is_array($services) ? $services : array();
     $skip_script = wdsi_getval($opts, 'skip_script');
     $skip_script = is_array($skip_script) ? $skip_script : array();
     $no_count = wdsi_getval($opts, 'no_count');
     $no_count = is_array($no_count) ? $no_count : array();
     $content_type = wdsi_getval($type, 'content_type', 'text');
     if ('widgets' == $content_type && !$this->_data->get_option('allow_widgets')) {
         return false;
     }
     // Break on this
     $related_posts_count = wdsi_getval($type, 'related-posts_count', 3);
     $related_taxonomy = wdsi_getval($type, 'related-taxonomy', 'post_tag');
     $related_has_thumbnails = wdsi_getval($type, 'related-has_thumbnails');
     $mailchimp_placeholder = wdsi_getval($type, 'mailchimp-placeholder', '*****@*****.**');
     $mailchimp_position = wdsi_getval($type, 'mailchimp-position', 'after');
     $position = wdsi_getval($msg, 'position') ? $msg['position'] : wdsi_getval($opts, 'position');
     $position = $position ? $position : 'left';
     $percentage = $selector = $timeout = false;
     $condition = wdsi_getval($msg, 'show_after-condition') ? $msg['show_after-condition'] : wdsi_getval($opts, 'show_after-condition');
     $value = wdsi_getval($msg, 'show_after-rule') ? $msg['show_after-rule'] : wdsi_getval($opts, 'show_after-rule');
     switch ($condition) {
         case "selector":
             $selector = "#{$value}";
             $percentage = '0%';
             $timeout = '0s';
             break;
         case "timeout":
             $selector = false;
             $percentage = '0%';
             $timeout = sprintf('%ds', (int) $value);
             break;
         case "percentage":
         default:
             $selector = false;
             $percentage = sprintf('%d%%', (int) $value);
             $timeout = '0s';
             break;
     }
     $_theme = wdsi_getval($msg, 'theme') ? $msg['theme'] : wdsi_getval($opts, 'theme');
     $theme = $_theme && in_array($_theme, array_keys(Wdsi_SlideIn::get_appearance_themes())) ? $_theme : 'minimal';
     $_variation = wdsi_getval($msg, 'variation') ? $msg['variation'] : wdsi_getval($opts, 'variation');
     $variation = $_variation && in_array($_variation, array_keys(Wdsi_SlideIn::get_theme_variations())) ? $_variation : 'light';
     $_scheme = wdsi_getval($msg, 'scheme') ? $msg['scheme'] : wdsi_getval($opts, 'scheme');
     $scheme = $_scheme && in_array($_scheme, array_keys(Wdsi_SlideIn::get_variation_schemes())) ? $_scheme : 'red';
     $expire_after = wdsi_getval($msg, 'show_for-time') ? $msg['show_for-time'] : wdsi_getval($opts, 'show_for-time');
     $expire_after = $expire_after ? $expire_after : 10;
     $expire_unit = wdsi_getval($msg, 'show_for-unit') ? $msg['show_for-unit'] : wdsi_getval($opts, 'show_for-unit');
     $expire_unit = $expire_unit ? $expire_unit : 's';
     $expire_timeout = sprintf("%d%s", $expire_after, $expire_unit);
     $full_width = $width = false;
     $_width = wdsi_getval($msg, 'width') ? $msg['width'] : wdsi_getval($opts, 'width');
     if (!(int) $_width || 'full' == $width) {
         $full_width = 'slidein-full';
     } else {
         $width = 'style="width:' . (int) $_width . 'px;"';
     }
     $out = '';
     if (empty($output)) {
         ob_start();
     }
     require_once WDSI_PLUGIN_BASE_DIR . '/lib/forms/box_output.php';
     if (empty($output)) {
         $out = ob_get_contents();
         ob_end_clean();
     }
     return $out;
 }