function akst_request_handler()
{
    if (!empty($_REQUEST['akst_action'])) {
        switch ($_REQUEST['akst_action']) {
            case 'share-this':
                akst_page();
                break;
            case 'send_mail':
                akst_send_mail();
                break;
        }
    }
}
 function akst_request_handler()
 {
     if (!empty($_REQUEST['akst_action'])) {
         switch ($_REQUEST['akst_action']) {
             case 'share-this':
                 akst_page();
                 break;
             case 'send_mail':
                 akst_send_mail();
                 break;
             case 'akst_update_settings':
                 if (ak_can_update_options()) {
                     if (empty($_POST['akst_tabs_to_show'])) {
                         $_POST['akst_tabs_to_show'] = array('email', 'social');
                     }
                     if (empty($_POST['tab_order'])) {
                         $_POST['tab_order'] = 'email';
                     }
                     $tabs = array();
                     if (count($_POST['akst_tabs_to_show']) > 1) {
                         switch ($_POST['tab_order']) {
                             case 'social':
                                 $tabs[] = 'social';
                                 break;
                             case 'email':
                                 $tabs[] = 'email';
                                 break;
                         }
                     }
                     if (!in_array('social', $tabs) && in_array('social', $_POST['akst_tabs_to_show'])) {
                         $tabs[] = 'social';
                     }
                     if (!in_array('email', $tabs) && in_array('email', $_POST['akst_tabs_to_show'])) {
                         $tabs[] = 'email';
                     }
                     update_option('akst_tabs', implode(',', $tabs));
                     if (isset($_POST['akst_addtocontent'])) {
                         update_option('akst_addtocontent', 1);
                     } else {
                         update_option('akst_addtocontent', 0);
                     }
                     /*if ( isset( $_POST['akst_addtofooter'] ) )
                     			update_option('akst_addtofooter', 1);
                     		else
                     			update_option('akst_addtofooter', 0);
                     		*/
                     if (isset($_POST['akst_addtofeed'])) {
                         update_option('akst_addtofeed', 1);
                     } else {
                         update_option('akst_addtofeed', 0);
                     }
                     if (isset($_POST['akst_showicon'])) {
                         update_option('akst_showicon', 1);
                     } else {
                         update_option('akst_showicon', 0);
                     }
                     if (isset($_POST['akst_linktext'])) {
                         update_option('akst_linktext', wp_specialchars(stripslashes($_POST['akst_linktext']), true));
                     } else {
                         update_option('akst_linktext', 'ShareThis');
                     }
                     if (empty($_POST['akst_socialwebs'])) {
                         $socialwebs = 'twitter,facebook,digg,stumbleupon,delicious,reddit,blinklist,newsvine,furl,tailrank,magnolia';
                     } else {
                         $socialwebs = implode(',', $_POST['akst_socialwebs']);
                     }
                     update_option('akst_socialwebs', $socialwebs);
                     header('Location: ' . get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=share-this.php&updated=true');
                     die;
                 }
                 break;
         }
     }
 }
Beispiel #3
0
function akst_request_handler()
{
    if (!empty($_REQUEST['akst_action'])) {
        switch ($_REQUEST['akst_action']) {
            case 'share-this':
                akst_page();
                break;
            case 'send_mail':
                akst_send_mail();
                break;
            case 'akst_update_settings':
                if (ak_can_update_options()) {
                    if (empty($_POST['akst_tabs_to_show'])) {
                        $_POST['akst_tabs_to_show'] = array('social', 'email');
                    }
                    if (empty($_POST['tab_order'])) {
                        $_POST['tab_order'] = 'social';
                    }
                    $tabs = array();
                    if (count($_POST['akst_tabs_to_show']) > 1) {
                        switch ($_POST['tab_order']) {
                            case 'social':
                                $tabs[] = 'social';
                                break;
                            case 'email':
                                $tabs[] = 'email';
                                break;
                        }
                    }
                    if (!in_array('social', $tabs) && in_array('social', $_POST['akst_tabs_to_show'])) {
                        $tabs[] = 'social';
                    }
                    if (!in_array('email', $tabs) && in_array('email', $_POST['akst_tabs_to_show'])) {
                        $tabs[] = 'email';
                    }
                    update_option('akst_tabs', implode(',', $tabs));
                    header('Location: ' . get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=share-this.php&updated=true');
                    die;
                }
                break;
        }
    }
}